blob_id
stringlengths
40
40
language
stringclasses
1 value
repo_name
stringlengths
5
132
path
stringlengths
2
382
src_encoding
stringclasses
34 values
length_bytes
int64
9
3.8M
score
float64
1.5
4.94
int_score
int64
2
5
detected_licenses
listlengths
0
142
license_type
stringclasses
2 values
text
stringlengths
9
3.8M
download_success
bool
1 class
17cd14cd8a3bb7d1b97ed81dfe597c84ef840927
Java
mohanbalaji95/WeatherAppTest
/app/src/main/java/com/example/weatherapptest/MainActivity.java
UTF-8
1,305
2.171875
2
[]
no_license
package com.example.weatherapptest; import android.support.design.widget.TabLayout; import android.support.v4.view.ViewPager; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import com.example.weatherapptest.Adapters.ViewPagerAdapter; import com.example.weatherapptest.Fragments.FragmentFiveDays; import com.example.weatherapptest.Fragments.TodayFragment; public class MainActivity extends AppCompatActivity { private TabLayout tabLayout; private ViewPager viewPager; private ViewPagerAdapter viewPagerAdapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); tabLayout = (TabLayout) findViewById(R.id.tabLayout_id); viewPager = (ViewPager) findViewById(R.id.viewPager_id); viewPagerAdapter = new ViewPagerAdapter(getSupportFragmentManager()); viewPagerAdapter.addFragment(new TodayFragment(),"Today"); viewPagerAdapter.addFragment(new FragmentFiveDays(),"Five Days"); viewPager.setAdapter(viewPagerAdapter); tabLayout.setupWithViewPager(viewPager); ActionBar actionBar = getSupportActionBar(); actionBar.setElevation(0); } }
true
5d1083eb749b2d58fdb21a2d72f9479db8890b9c
Java
bruce1237/Java
/HelloWorld.java
UTF-8
1,547
4.59375
5
[]
no_license
public class HelloWorld { public static void main(String[] args) { // 创建名为hello的对象 HelloWorld hello = new HelloWorld(); // 调用hello对象的calcAvg()方法,并将返回值保存在变量avg中 double avg = hello.calcAvg(); System.out.println("平均成绩为:" + avg); } // 定义一个返回值为double类型的方法 public double calcAvg() { double java = 92.5; double php = 83.0; double avg = (java + php) / 2; // 计算平均值 // 使用return返回值 return avg; } /* * 功能:计算两门课程考试成绩的平均分并输出平均分 定义一个包含两个参数的方法,用来传入两门课程的成绩 */ public double calcAvg(int score1, int score2) { double avg = (score1 + score2) / 2; System.out.println(avg); return avg; } /* * 功能:输出学生年龄的最大值 定义一个无参的方法,返回值为年龄的最大值 参考步骤: 1、定义一个整形数组 ages ,保存学生年龄,数组元素依次为 18 * ,23 ,21 ,19 ,25 ,29 ,17 2、定义一个整形变量 max ,保存学生最大年龄,初始时假定数组中的第一个元素为最大值 3、使用 for * 循环遍历数组中的元素,并与假定的最大值比较,如果比假定的最大值要大,则替换当前的最大值 4、使用 return 返回最大值 */ public int getMaxAge() { int[] ages = { 18, 23, 21, 19, 25, 29, 17 }; int max = ages[0]; for (int age : ages) { if (age > max) { max = age; } } return max; } }
true
b51eb2365d31188c59f3feb167efcee2a1408c12
Java
skdidwania/management-system
/Restaurant_Management.java
UTF-8
8,768
3.015625
3
[]
no_license
import java.util.*; public class Restaurant_Management { public static void main(String args[]) { Scanner in=new Scanner(System.in); { int vstr,tvstr=0; int nvstr,tnvstr=0; int vfd,tvfd=0; int nvfd,tnvfd=0; int fd,tfd=0; int tamt=0; int amt=0;int totalamt=0; int d,totald;int damt=0;int ch=0; double vat=0; String str=""; String ans; String choice="Y"; System.out.println("Welcome to the multicuisine restaurant!!"); System.out.println("Starter Corner:1"); System.out.println("Main Course: 2"); System.out.println("Deserts....3"); System.out.println(); System.out.println("Press 1 for starter"); System.out.println("Press 2 for Main Course"); System.out.println("Press 3 for Cool with Deserts"); System.out.println(); System.out.println("Enter your choice"); ch=in.nextInt(); switch(ch) { case 1: System.out.println("Welcome to the starter menu"); System.out.println("Enter 'VS' for veg starter and 'NVS' for non veg starter"); str=in.next(); if(str.equalsIgnoreCase("VS")) { System.out.println("Starters\t\t\tPrice in Rs."); System.out.println("1.Paneer Tikka\t\t\t110"); System.out.println("2.Veg Seekh kabab\t\t\t110"); System.out.println("3.Hara Bhara kebab\t\t\t110"); System.out.println("4.Shanghai Spring roll\t\t\t150"); System.out.println("5.American corn ball\t\t\t150"); System.out.println("6.Crispy american corn\t\t\t140"); System.out.println("7.Crispy baby corn\t\t\t140"); System.out.println("8.Crispy mushroom\t\t\t120"); System.out.println("9.Crispy chilly potato\t\t\t120"); System.out.println("10.Crispy chilly channa\t\t\t150"); System.out.println(); while(choice.equalsIgnoreCase("Y")) { System.out.println("Choose your starter from the above list by entering number"); vstr=in.nextInt(); System.out.println("Enter the total number of starters you want"); tvstr=in.nextInt(); if(vstr>=1&&vstr<=3) amt=tvstr*110; if(vstr==4||vstr==5) amt=tvstr*150; if(vstr==6||vstr==7) amt=tvstr*140; if(vstr==8||vstr==9) amt=tvstr*120; if(vstr==10) amt=tvstr*150; tamt =tamt+amt; System.out.println("Do you want to place more order?EnterY/N"); choice=in.next(); } } if(str.equalsIgnoreCase("NVS")) { System.out.println("Non vegetarian Starter"); System.out.println(); System.out.println("Non veg starters\t\t\t Price in Rs"); System.out.println("1.Chicken Tikka\t\t\t170"); System.out.println("Murg Reshmi Kebab\t\t\t170"); System.out.println("Murg Chilli Kebab\t\t\t170"); System.out.println("Chicken seekh kebab\t\t\t180"); System.out.println("Tangdi kebab\t\t\t180"); System.out.println("Murg Tandoori\t\t\t190"); System.out.println("Fish Ajwani Tikka\t\t\t190"); System.out.println("Chilli Chicken\t\t\t160"); System.out.println("Drums of Heaven\t\t\t180"); System.out.println("Shanghai Chicken\t\t\t180"); while(choice.equalsIgnoreCase("Y")) { System.out.println("choose your starter from the above list by entering nuumber"); nvstr=in.nextInt(); System.out.println("Enter the total no of starters you want"); tnvstr=in.nextInt(); if(nvstr==1||nvstr==2) amt =tnvstr*170; if(nvstr==3) amt=tnvstr*160; if(nvstr==4||nvstr==5) amt=tnvstr*180; if(nvstr==6||nvstr==7) amt=tnvstr*190; if(nvstr==8) amt=tnvstr*160; if(nvstr==9||nvstr==10) amt=tnvstr*180; tamt=tamt+amt; System.out.println("Do you want to place more order?Enter Y/N"); choice=in.next(); } } System.out.println("*******Multi Cuisine Restaurant********"); System.out.println("*********Bill*********"); System.out.println("Total cost=Rs."+tamt); vat=Math.round(14.5/100*tamt); System.out.println("VAT=14.5%"); System.out.println("Total VAT=Rs."+vat); System.out.println("Amount to be psid=Rs"+(tamt+vat)); System.out.println(); break; case 2: System.out.println("Main Course:Indian and Chinese Dishes!"); System.out.println("Enter 'v' for veg indian Dishes,'NV' for non-veg indian dishes and 'c' for chinese dishes"); str=in.next(); if(str.equalsIgnoreCase("V")) { System.out.println("Welcome to Indian Veg Dishes"); System.out.println("Indian Veg dishes\t\t\t\t:Price in Rs"); System.out.println("1.Shahi paneer\t\t\t\t\\t180"); System.out.println("2.Navratan korma\t\t\t\t\t180"); System.out.println("3.Kadahi paneer\t\t\t\t\t150"); System.out.println("4.Malai kofta \t\t\t\t\t140"); System.out.println("5.Kadahi vegetable\t\t\t\t\t140"); System.out.println("6.Vegetable pakeeza\t\t\t\t\t140"); System.out.println("7.Shabnam cury\t\t\t\t\t150"); System.out.println("8.Makai corn palak\t\t\t\t\t150"); System.out.println("9.veg pulao\t\t\t\t\t110"); System.out.println("10.Kashmiri pulao\t\t\t\t140"); System.out.println("11.Butter Naan\t\t\t\t40"); System.out.println("12.Stuffed naan\t\t\t\t60"); while(choice.equalsIgnoreCase("Y")) { System.out.println("Choose your main veg course by entering nunber"); vfd=in.nextInt(); System.out.println("how many plates do you want to place from the above list?"); tvfd=in.nextInt(); if(vfd==1||vfd==2) { amt=tvfd*180; if(vfd==3) amt=tvfd*150; if(vfd==4||vfd==5||vfd==6) amt=tvfd*140; if(vfd==7||vfd==8) amt=tvfd*150; if(vfd==9) amt=tvfd*110; if(vfd==10) amt=tvfd*140; if(vfd==11) amt=tvfd*40; if(vfd==12) amt=tvfd*60; totalamt=totalamt+amt; System.out.println("Do you want to place more order?Enter Y/N"); choice=in.next(); } } if(str.equalsIgnoreCase("NV")) { System.out.println("Welcome to Indian non veg dishes"); System.out.println("Indian non veg dishes\t\t\t\tPrice in Rs"); System.out.println("1.Chicken tikka masaala\t\t\t\t180"); System.out.println("2.Chicken tikka labadar\t\t\t\t\t180"); System.out.println("3.Chicken bharta\t\t\t\t\t150"); System.out.println("4.kadahi chicken\t\t\t\t\t160"); while(choice.equalsIgnoreCase("Y")) { System.out.println("choose your main non veg course from the above list by entering nuumber"); vfd=in.nextInt(); System.out.println("How many plates do u want from the above list"); tvfd=in.nextInt(); if(vfd==1||vfd==2) amt=tvfd*160; if(vfd==3) amt=tvfd*150; if(vfd==4) amt=tvfd*160; totalamt=totalamt+amt; System.out.println("Do you want to place more order?Enter Y/N"); choice=in.next(); } } if(str.equalsIgnoreCase("C")) { System.out.println("Welcome to chinese dishes"); System.out.println("Chinese dishes\t\t\t\tPricein Rs"); System.out.println("1.Schewzwan fried rice\t\t\t\t240"); System.out.println("2.Chilly chicken\t\t\t\t280"); System.out.println("3.chicken noodle\t\t\t\t210"); System.out.println("4.veg hakka noodle\t\t\t\t210"); while(choice.equalsIgnoreCase("Y")) { System.out.println("choose your main course from the above list by entering nuumber"); fd=in.nextInt(); System.out.println("How many plates do u want from the above list"); tfd=in.nextInt(); if(fd==1) amt=tfd*240; if(fd==2) amt=tfd*280; if(fd==3||fd==4) amt=tfd*210; totalamt=totalamt+amt; System.out.println("Do you want to place more order?Enter Y/N"); choice=in.next(); } } System.out.println(); System.out.println("********Multicuisine restaurant********"); System.out.println("********Bill********"); System.out.println("Total cost=Rs."+totalamt); vat=Math.round(14.5/100*totalamt); System.out.println("VAT=14.5%"); System.out.println("Total VAT=Rs."+vat); System.out.println("Amount to be psid=Rs"+(totalamt+vat)); System.out.println(); break;} case 3: System.out.println("Cool with deserts"); System.out.println("deserts\t\t\t\t\t\tPrice in Rs"); System.out.println(); System.out.println("1.Softy pineapple\t\t\t\t110"); System.out.println("2.Walnut brownie\t\t\t\t110"); System.out.println("3.Marble cake\t\t\t\t\t70"); System.out.println("4.mocha magic\t\t\t\t\t90"); while(choice.equalsIgnoreCase("Y")) { System.out.println("choose your desert from the above list by entering nuumber"); d=in.nextInt(); System.out.println("enter the total no items u want to buy"); totald=in.nextInt(); if(d==1||d==2) damt=totald*110; if(d==3) damt=totald*70; if(d==4) damt=totald*90; totalamt=totalamt+damt; System.out.println("Do u want to place more order?Enter Y/N"); choice=in.next(); } System.out.println(); System.out.println("********Multicuisine restaurant********"); System.out.println("********Bill********"); System.out.println("Total cost=Rs."+totalamt); vat=Math.round(14.5/100*totalamt); System.out.println("VAT=14.5%"); System.out.println("Total VAT=Rs."+vat); System.out.println("Amount to be psid=Rs"+(totalamt+vat)); break; default: System.out.println("You have entered wrong choice"); System.out.println("You can enter the multicuisne restaurant by executing the program again with the correct choice"); System.out.println("Now,'Quit' the program"); } System.out.println("to exit the multicuisine restaurant world,enter the word 'Quit'"); ans=in.next(); if(ans.equals("quit")||ans.equals("QUIT")||ans.equals("Quit")) { System.out.println("Thanks for coming to the multicuisine restaurant"); System.out.println("Your pleasure Our Comfort"); System.out.println("Visit again"); System.out.println(); } } } }
true
41e48bf1d99af24e31e5d8cec6c9df85bb71ce81
Java
haj/weblogic-kubernetes-operator
/model/src/main/java/oracle/kubernetes/weblogic/domain/v1/api/WeblogicApi.java
UTF-8
231,782
1.546875
2
[ "UPL-1.0" ]
permissive
// Copyright 2017, 2018, Oracle Corporation and/or its affiliates. All rights reserved. // Licensed under the Universal Permissive License v 1.0 as shown at // http://oss.oracle.com/licenses/upl. package oracle.kubernetes.weblogic.domain.v1.api; import com.google.gson.reflect.TypeToken; import io.kubernetes.client.ApiCallback; import io.kubernetes.client.ApiClient; import io.kubernetes.client.ApiException; import io.kubernetes.client.ApiResponse; import io.kubernetes.client.Configuration; import io.kubernetes.client.Pair; import io.kubernetes.client.ProgressRequestBody; import io.kubernetes.client.ProgressResponseBody; import io.kubernetes.client.models.V1DeleteOptions; import io.kubernetes.client.models.V1Scale; import io.kubernetes.client.models.V1Status; import io.kubernetes.client.models.V1WatchEvent; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.sound.midi.Patch; import oracle.kubernetes.weblogic.domain.v1.Domain; import oracle.kubernetes.weblogic.domain.v1.DomainList; public class WeblogicApi { private ApiClient apiClient; public WeblogicApi() { this(Configuration.getDefaultApiClient()); } public WeblogicApi(ApiClient apiClient) { this.apiClient = apiClient; } public ApiClient getApiClient() { return apiClient; } public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; } /** * Build call for createWebLogicOracleV1NamespacedDomain * * @param namespace object name and auth scope, such as for teams and projects (required) * @param body (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @param progressListener Progress listener * @param progressRequestListener Progress request listener * @return Call to execute * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call createWebLogicOracleV1NamespacedDomainCall( String namespace, Domain body, String pretty, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // create path and map variables String localVarPath = "/apis/weblogic.oracle/v1/namespaces/{namespace}/domains" .replaceAll("\\{" + "namespace" + "\\}", apiClient.escapeString(namespace)); List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); if (pretty != null) localVarQueryParams.addAll(apiClient.parameterToPair("pretty", pretty)); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json", "application/yaml", "application/vnd.kubernetes.protobuf" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = {"*/*"}; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { apiClient .getHttpClient() .networkInterceptors() .add( chain -> { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse .newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); }); } String[] localVarAuthNames = new String[] {"BearerToken"}; return apiClient.buildCall( localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } private com.squareup.okhttp.Call createWebLogicOracleV1NamespacedDomainValidateBeforeCall( String namespace, Domain body, String pretty, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'namespace' is set if (namespace == null) { throw new ApiException( "Missing the required parameter 'namespace' when calling createWebLogicOracleV1NamespacedDomain(Async)"); } // verify the required parameter 'body' is set if (body == null) { throw new ApiException( "Missing the required parameter 'body' when calling createWebLogicOracleV1NamespacedDomain(Async)"); } com.squareup.okhttp.Call call = createWebLogicOracleV1NamespacedDomainCall( namespace, body, pretty, progressListener, progressRequestListener); return call; } /** * create a Domain * * @param namespace object name and auth scope, such as for teams and projects (required) * @param body (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @return Domain * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ public Domain createWebLogicOracleV1NamespacedDomain(String namespace, Domain body, String pretty) throws ApiException { ApiResponse<Domain> resp = createWebLogicOracleV1NamespacedDomainWithHttpInfo(namespace, body, pretty); return resp.getData(); } /** * create a Domain * * @param namespace object name and auth scope, such as for teams and projects (required) * @param body (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @return ApiResponse&lt;Domain&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ public ApiResponse<Domain> createWebLogicOracleV1NamespacedDomainWithHttpInfo( String namespace, Domain body, String pretty) throws ApiException { com.squareup.okhttp.Call call = createWebLogicOracleV1NamespacedDomainValidateBeforeCall( namespace, body, pretty, null, null); Type localVarReturnType = new TypeToken<Domain>() {}.getType(); return apiClient.execute(call, localVarReturnType); } /** * (asynchronously) create a Domain * * @param namespace object name and auth scope, such as for teams and projects (required) * @param body (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @param callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ public com.squareup.okhttp.Call createWebLogicOracleV1NamespacedDomainAsync( String namespace, Domain body, String pretty, final ApiCallback<Domain> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = (bytesRead, contentLength, done) -> callback.onDownloadProgress(bytesRead, contentLength, done); progressRequestListener = (bytesWritten, contentLength, done) -> callback.onUploadProgress(bytesWritten, contentLength, done); } com.squareup.okhttp.Call call = createWebLogicOracleV1NamespacedDomainValidateBeforeCall( namespace, body, pretty, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<Domain>() {}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /** * Build call for deleteWebLogicOracleV1CollectionNamespacedDomain * * @param namespace object name and auth scope, such as for teams and projects (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @param _continue The continue option should be set when retrieving more results from the * server. Since this value is server defined, clients may only use the continue value from a * previous query result with identical query parameters (except for the value of continue) * and the server may reject a continue value it does not recognize. If the specified continue * value is no longer valid whether due to expiration (generally five to fifteen minutes) or a * configuration change on the server the server will respond with a 410 ResourceExpired error * indicating the client must restart their list without the continue field. This field is not * supported when watch is true. Clients may start a watch from the last resourceVersion value * returned by the server and not miss any modifications. (optional) * @param fieldSelector A selector to restrict the list of returned objects by their fields. * Defaults to everything. (optional) * @param includeUninitialized If true, partially initialized resources are included in the * response. (optional) * @param labelSelector A selector to restrict the list of returned objects by their labels. * Defaults to everything. (optional) * @param limit limit is a maximum number of responses to return for a list call. If more items * exist, the server will set the &#x60;continue&#x60; field on the list metadata to a value * that can be used with the same initial query to retrieve the next set of results. Setting a * limit may return fewer than the requested amount of items (up to zero items) in the event * all requested objects are filtered out and clients should only use the presence of the * continue field to determine whether more results are available. Servers may choose not to * support the limit argument and will return all of the available results. If limit is * specified and the continue field is empty, clients may assume that no more results are * available. This field is not supported if watch is true. The server guarantees that the * objects returned when using continue will be identical to issuing a single list call * without a limit - that is, no objects created, modified, or deleted after the first request * is issued will be included in any subsequent continued requests. This is sometimes referred * to as a consistent snapshot, and ensures that a client that is using limit to receive * smaller chunks of a very large result can ensure they see all possible objects. If objects * are updated during a chunked list the version of the object that was present at the time * the first list result was calculated is returned. (optional) * @param resourceVersion When specified with a watch call, shows changes that occur after that * particular version of a resource. Defaults to changes from the beginning of history. When * specified for list: - if unset, then the result is returned from remote storage based on * quorum-read flag; - if it&#39;s 0, then we simply return what we currently have in cache, * no guarantee; - if set to non zero, then the result is at least as fresh as given rv. * (optional) * @param timeoutSeconds Timeout for the list/watch call. (optional) * @param watch Watch for changes to the described resources and return them as a stream of add, * update, and remove notifications. Specify resourceVersion. (optional) * @param progressListener Progress listener * @param progressRequestListener Progress request listener * @return Call to execute * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call deleteWebLogicOracleV1CollectionNamespacedDomainCall( String namespace, String pretty, String _continue, String fieldSelector, Boolean includeUninitialized, String labelSelector, Integer limit, String resourceVersion, Integer timeoutSeconds, Boolean watch, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/apis/weblogic.oracle/v1/namespaces/{namespace}/domains" .replaceAll("\\{" + "namespace" + "\\}", apiClient.escapeString(namespace)); List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); if (pretty != null) { localVarQueryParams.addAll(apiClient.parameterToPair("pretty", pretty)); } if (_continue != null) { localVarQueryParams.addAll(apiClient.parameterToPair("continue", _continue)); } if (fieldSelector != null) { localVarQueryParams.addAll(apiClient.parameterToPair("fieldSelector", fieldSelector)); } if (includeUninitialized != null) { localVarQueryParams.addAll( apiClient.parameterToPair("includeUninitialized", includeUninitialized)); } if (labelSelector != null) { localVarQueryParams.addAll(apiClient.parameterToPair("labelSelector", labelSelector)); } if (limit != null) { localVarQueryParams.addAll(apiClient.parameterToPair("limit", limit)); } if (resourceVersion != null) { localVarQueryParams.addAll(apiClient.parameterToPair("resourceVersion", resourceVersion)); } if (timeoutSeconds != null) { localVarQueryParams.addAll(apiClient.parameterToPair("timeoutSeconds", timeoutSeconds)); } if (watch != null) { localVarQueryParams.addAll(apiClient.parameterToPair("watch", watch)); } Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json", "application/yaml", "application/vnd.kubernetes.protobuf" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = {"*/*"}; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { apiClient .getHttpClient() .networkInterceptors() .add( chain -> { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse .newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); }); } String[] localVarAuthNames = new String[] {"BearerToken"}; return apiClient.buildCall( localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } private com.squareup.okhttp.Call deleteWebLogicOracleV1CollectionNamespacedDomainValidateBeforeCall( String namespace, String pretty, String _continue, String fieldSelector, Boolean includeUninitialized, String labelSelector, Integer limit, String resourceVersion, Integer timeoutSeconds, Boolean watch, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'namespace' is set if (namespace == null) { throw new ApiException( "Missing the required parameter 'namespace' when calling deleteWebLogicOracleV1CollectionNamespacedDomain(Async)"); } com.squareup.okhttp.Call call = deleteWebLogicOracleV1CollectionNamespacedDomainCall( namespace, pretty, _continue, fieldSelector, includeUninitialized, labelSelector, limit, resourceVersion, timeoutSeconds, watch, progressListener, progressRequestListener); return call; } /** * delete collection of Domain * * @param namespace object name and auth scope, such as for teams and projects (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @param _continue The continue option should be set when retrieving more results from the * server. Since this value is server defined, clients may only use the continue value from a * previous query result with identical query parameters (except for the value of continue) * and the server may reject a continue value it does not recognize. If the specified continue * value is no longer valid whether due to expiration (generally five to fifteen minutes) or a * configuration change on the server the server will respond with a 410 ResourceExpired error * indicating the client must restart their list without the continue field. This field is not * supported when watch is true. Clients may start a watch from the last resourceVersion value * returned by the server and not miss any modifications. (optional) * @param fieldSelector A selector to restrict the list of returned objects by their fields. * Defaults to everything. (optional) * @param includeUninitialized If true, partially initialized resources are included in the * response. (optional) * @param labelSelector A selector to restrict the list of returned objects by their labels. * Defaults to everything. (optional) * @param limit limit is a maximum number of responses to return for a list call. If more items * exist, the server will set the &#x60;continue&#x60; field on the list metadata to a value * that can be used with the same initial query to retrieve the next set of results. Setting a * limit may return fewer than the requested amount of items (up to zero items) in the event * all requested objects are filtered out and clients should only use the presence of the * continue field to determine whether more results are available. Servers may choose not to * support the limit argument and will return all of the available results. If limit is * specified and the continue field is empty, clients may assume that no more results are * available. This field is not supported if watch is true. The server guarantees that the * objects returned when using continue will be identical to issuing a single list call * without a limit - that is, no objects created, modified, or deleted after the first request * is issued will be included in any subsequent continued requests. This is sometimes referred * to as a consistent snapshot, and ensures that a client that is using limit to receive * smaller chunks of a very large result can ensure they see all possible objects. If objects * are updated during a chunked list the version of the object that was present at the time * the first list result was calculated is returned. (optional) * @param resourceVersion When specified with a watch call, shows changes that occur after that * particular version of a resource. Defaults to changes from the beginning of history. When * specified for list: - if unset, then the result is returned from remote storage based on * quorum-read flag; - if it&#39;s 0, then we simply return what we currently have in cache, * no guarantee; - if set to non zero, then the result is at least as fresh as given rv. * (optional) * @param timeoutSeconds Timeout for the list/watch call. (optional) * @param watch Watch for changes to the described resources and return them as a stream of add, * update, and remove notifications. Specify resourceVersion. (optional) * @return V1Status * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ public V1Status deleteWebLogicOracleV1CollectionNamespacedDomain( String namespace, String pretty, String _continue, String fieldSelector, Boolean includeUninitialized, String labelSelector, Integer limit, String resourceVersion, Integer timeoutSeconds, Boolean watch) throws ApiException { ApiResponse<V1Status> resp = deleteWebLogicOracleV1CollectionNamespacedDomainWithHttpInfo( namespace, pretty, _continue, fieldSelector, includeUninitialized, labelSelector, limit, resourceVersion, timeoutSeconds, watch); return resp.getData(); } /** * delete collection of Domain * * @param namespace object name and auth scope, such as for teams and projects (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @param _continue The continue option should be set when retrieving more results from the * server. Since this value is server defined, clients may only use the continue value from a * previous query result with identical query parameters (except for the value of continue) * and the server may reject a continue value it does not recognize. If the specified continue * value is no longer valid whether due to expiration (generally five to fifteen minutes) or a * configuration change on the server the server will respond with a 410 ResourceExpired error * indicating the client must restart their list without the continue field. This field is not * supported when watch is true. Clients may start a watch from the last resourceVersion value * returned by the server and not miss any modifications. (optional) * @param fieldSelector A selector to restrict the list of returned objects by their fields. * Defaults to everything. (optional) * @param includeUninitialized If true, partially initialized resources are included in the * response. (optional) * @param labelSelector A selector to restrict the list of returned objects by their labels. * Defaults to everything. (optional) * @param limit limit is a maximum number of responses to return for a list call. If more items * exist, the server will set the &#x60;continue&#x60; field on the list metadata to a value * that can be used with the same initial query to retrieve the next set of results. Setting a * limit may return fewer than the requested amount of items (up to zero items) in the event * all requested objects are filtered out and clients should only use the presence of the * continue field to determine whether more results are available. Servers may choose not to * support the limit argument and will return all of the available results. If limit is * specified and the continue field is empty, clients may assume that no more results are * available. This field is not supported if watch is true. The server guarantees that the * objects returned when using continue will be identical to issuing a single list call * without a limit - that is, no objects created, modified, or deleted after the first request * is issued will be included in any subsequent continued requests. This is sometimes referred * to as a consistent snapshot, and ensures that a client that is using limit to receive * smaller chunks of a very large result can ensure they see all possible objects. If objects * are updated during a chunked list the version of the object that was present at the time * the first list result was calculated is returned. (optional) * @param resourceVersion When specified with a watch call, shows changes that occur after that * particular version of a resource. Defaults to changes from the beginning of history. When * specified for list: - if unset, then the result is returned from remote storage based on * quorum-read flag; - if it&#39;s 0, then we simply return what we currently have in cache, * no guarantee; - if set to non zero, then the result is at least as fresh as given rv. * (optional) * @param timeoutSeconds Timeout for the list/watch call. (optional) * @param watch Watch for changes to the described resources and return them as a stream of add, * update, and remove notifications. Specify resourceVersion. (optional) * @return ApiResponse&lt;V1Status&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ public ApiResponse<V1Status> deleteWebLogicOracleV1CollectionNamespacedDomainWithHttpInfo( String namespace, String pretty, String _continue, String fieldSelector, Boolean includeUninitialized, String labelSelector, Integer limit, String resourceVersion, Integer timeoutSeconds, Boolean watch) throws ApiException { com.squareup.okhttp.Call call = deleteWebLogicOracleV1CollectionNamespacedDomainValidateBeforeCall( namespace, pretty, _continue, fieldSelector, includeUninitialized, labelSelector, limit, resourceVersion, timeoutSeconds, watch, null, null); Type localVarReturnType = new TypeToken<V1Status>() {}.getType(); return apiClient.execute(call, localVarReturnType); } /** * (asynchronously) delete collection of Domain * * @param namespace object name and auth scope, such as for teams and projects (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @param _continue The continue option should be set when retrieving more results from the * server. Since this value is server defined, clients may only use the continue value from a * previous query result with identical query parameters (except for the value of continue) * and the server may reject a continue value it does not recognize. If the specified continue * value is no longer valid whether due to expiration (generally five to fifteen minutes) or a * configuration change on the server the server will respond with a 410 ResourceExpired error * indicating the client must restart their list without the continue field. This field is not * supported when watch is true. Clients may start a watch from the last resourceVersion value * returned by the server and not miss any modifications. (optional) * @param fieldSelector A selector to restrict the list of returned objects by their fields. * Defaults to everything. (optional) * @param includeUninitialized If true, partially initialized resources are included in the * response. (optional) * @param labelSelector A selector to restrict the list of returned objects by their labels. * Defaults to everything. (optional) * @param limit limit is a maximum number of responses to return for a list call. If more items * exist, the server will set the &#x60;continue&#x60; field on the list metadata to a value * that can be used with the same initial query to retrieve the next set of results. Setting a * limit may return fewer than the requested amount of items (up to zero items) in the event * all requested objects are filtered out and clients should only use the presence of the * continue field to determine whether more results are available. Servers may choose not to * support the limit argument and will return all of the available results. If limit is * specified and the continue field is empty, clients may assume that no more results are * available. This field is not supported if watch is true. The server guarantees that the * objects returned when using continue will be identical to issuing a single list call * without a limit - that is, no objects created, modified, or deleted after the first request * is issued will be included in any subsequent continued requests. This is sometimes referred * to as a consistent snapshot, and ensures that a client that is using limit to receive * smaller chunks of a very large result can ensure they see all possible objects. If objects * are updated during a chunked list the version of the object that was present at the time * the first list result was calculated is returned. (optional) * @param resourceVersion When specified with a watch call, shows changes that occur after that * particular version of a resource. Defaults to changes from the beginning of history. When * specified for list: - if unset, then the result is returned from remote storage based on * quorum-read flag; - if it&#39;s 0, then we simply return what we currently have in cache, * no guarantee; - if set to non zero, then the result is at least as fresh as given rv. * (optional) * @param timeoutSeconds Timeout for the list/watch call. (optional) * @param watch Watch for changes to the described resources and return them as a stream of add, * update, and remove notifications. Specify resourceVersion. (optional) * @param callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ public com.squareup.okhttp.Call deleteWebLogicOracleV1CollectionNamespacedDomainAsync( String namespace, String pretty, String _continue, String fieldSelector, Boolean includeUninitialized, String labelSelector, Integer limit, String resourceVersion, Integer timeoutSeconds, Boolean watch, final ApiCallback<V1Status> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = (bytesRead, contentLength, done) -> callback.onDownloadProgress(bytesRead, contentLength, done); progressRequestListener = (bytesWritten, contentLength, done) -> callback.onUploadProgress(bytesWritten, contentLength, done); } com.squareup.okhttp.Call call = deleteWebLogicOracleV1CollectionNamespacedDomainValidateBeforeCall( namespace, pretty, _continue, fieldSelector, includeUninitialized, labelSelector, limit, resourceVersion, timeoutSeconds, watch, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<V1Status>() {}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /** * Build call for deleteWebLogicOracleV1NamespacedDomain * * @param name name of the Domain (required) * @param namespace object name and auth scope, such as for teams and projects (required) * @param body (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @param gracePeriodSeconds The duration in seconds before the object should be deleted. Value * must be non-negative integer. The value zero indicates delete immediately. If this value is * nil, the default grace period for the specified type will be used. Defaults to a per object * value if not specified. zero means delete immediately. (optional) * @param orphanDependents Deprecated: please use the PropagationPolicy, this field will be * deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the * \&quot;orphan\&quot; finalizer will be added to/removed from the object&#39;s finalizers * list. Either this field or PropagationPolicy may be set, but not both. (optional) * @param propagationPolicy Whether and how garbage collection will be performed. Either this * field or OrphanDependents may be set, but not both. The default policy is decided by the * existing finalizer set in the metadata.finalizers and the resource-specific default policy. * (optional) * @param progressListener Progress listener * @param progressRequestListener Progress request listener * @return Call to execute * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call deleteWebLogicOracleV1NamespacedDomainCall( String name, String namespace, V1DeleteOptions body, String pretty, Integer gracePeriodSeconds, Boolean orphanDependents, String propagationPolicy, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // create path and map variables String localVarPath = "/apis/weblogic.oracle/v1/namespaces/{namespace}/domains/{name}" .replaceAll("\\{" + "name" + "\\}", apiClient.escapeString(name)) .replaceAll("\\{" + "namespace" + "\\}", apiClient.escapeString(namespace)); List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); if (pretty != null) { localVarQueryParams.addAll(apiClient.parameterToPair("pretty", pretty)); } if (gracePeriodSeconds != null) { localVarQueryParams.addAll( apiClient.parameterToPair("gracePeriodSeconds", gracePeriodSeconds)); } if (orphanDependents != null) { localVarQueryParams.addAll(apiClient.parameterToPair("orphanDependents", orphanDependents)); } if (propagationPolicy != null) { localVarQueryParams.addAll(apiClient.parameterToPair("propagationPolicy", propagationPolicy)); } Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json", "application/yaml", "application/vnd.kubernetes.protobuf" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = {"*/*"}; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { apiClient .getHttpClient() .networkInterceptors() .add( chain -> { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse .newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); }); } String[] localVarAuthNames = new String[] {"BearerToken"}; return apiClient.buildCall( localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } private com.squareup.okhttp.Call deleteWebLogicOracleV1NamespacedDomainValidateBeforeCall( String name, String namespace, V1DeleteOptions body, String pretty, Integer gracePeriodSeconds, Boolean orphanDependents, String propagationPolicy, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'name' is set if (name == null) { throw new ApiException( "Missing the required parameter 'name' when calling deleteWebLogicOracleV1NamespacedDomain(Async)"); } // verify the required parameter 'namespace' is set if (namespace == null) { throw new ApiException( "Missing the required parameter 'namespace' when calling deleteWebLogicOracleV1NamespacedDomain(Async)"); } // verify the required parameter 'body' is set if (body == null) { throw new ApiException( "Missing the required parameter 'body' when calling deleteWebLogicOracleV1NamespacedDomain(Async)"); } com.squareup.okhttp.Call call = deleteWebLogicOracleV1NamespacedDomainCall( name, namespace, body, pretty, gracePeriodSeconds, orphanDependents, propagationPolicy, progressListener, progressRequestListener); return call; } /** * delete a Domain * * @param name name of the Domain (required) * @param namespace object name and auth scope, such as for teams and projects (required) * @param body (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @param gracePeriodSeconds The duration in seconds before the object should be deleted. Value * must be non-negative integer. The value zero indicates delete immediately. If this value is * nil, the default grace period for the specified type will be used. Defaults to a per object * value if not specified. zero means delete immediately. (optional) * @param orphanDependents Deprecated: please use the PropagationPolicy, this field will be * deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the * \&quot;orphan\&quot; finalizer will be added to/removed from the object&#39;s finalizers * list. Either this field or PropagationPolicy may be set, but not both. (optional) * @param propagationPolicy Whether and how garbage collection will be performed. Either this * field or OrphanDependents may be set, but not both. The default policy is decided by the * existing finalizer set in the metadata.finalizers and the resource-specific default policy. * (optional) * @return V1Status * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ public V1Status deleteWebLogicOracleV1NamespacedDomain( String name, String namespace, V1DeleteOptions body, String pretty, Integer gracePeriodSeconds, Boolean orphanDependents, String propagationPolicy) throws ApiException { ApiResponse<V1Status> resp = deleteWebLogicOracleV1NamespacedDomainWithHttpInfo( name, namespace, body, pretty, gracePeriodSeconds, orphanDependents, propagationPolicy); return resp.getData(); } /** * delete a Domain * * @param name name of the Domain (required) * @param namespace object name and auth scope, such as for teams and projects (required) * @param body (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @param gracePeriodSeconds The duration in seconds before the object should be deleted. Value * must be non-negative integer. The value zero indicates delete immediately. If this value is * nil, the default grace period for the specified type will be used. Defaults to a per object * value if not specified. zero means delete immediately. (optional) * @param orphanDependents Deprecated: please use the PropagationPolicy, this field will be * deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the * \&quot;orphan\&quot; finalizer will be added to/removed from the object&#39;s finalizers * list. Either this field or PropagationPolicy may be set, but not both. (optional) * @param propagationPolicy Whether and how garbage collection will be performed. Either this * field or OrphanDependents may be set, but not both. The default policy is decided by the * existing finalizer set in the metadata.finalizers and the resource-specific default policy. * (optional) * @return ApiResponse&lt;V1Status&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ public ApiResponse<V1Status> deleteWebLogicOracleV1NamespacedDomainWithHttpInfo( String name, String namespace, V1DeleteOptions body, String pretty, Integer gracePeriodSeconds, Boolean orphanDependents, String propagationPolicy) throws ApiException { com.squareup.okhttp.Call call = deleteWebLogicOracleV1NamespacedDomainValidateBeforeCall( name, namespace, body, pretty, gracePeriodSeconds, orphanDependents, propagationPolicy, null, null); Type localVarReturnType = new TypeToken<V1Status>() {}.getType(); return apiClient.execute(call, localVarReturnType); } /** * (asynchronously) delete a Domain * * @param name name of the Domain (required) * @param namespace object name and auth scope, such as for teams and projects (required) * @param body (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @param gracePeriodSeconds The duration in seconds before the object should be deleted. Value * must be non-negative integer. The value zero indicates delete immediately. If this value is * nil, the default grace period for the specified type will be used. Defaults to a per object * value if not specified. zero means delete immediately. (optional) * @param orphanDependents Deprecated: please use the PropagationPolicy, this field will be * deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the * \&quot;orphan\&quot; finalizer will be added to/removed from the object&#39;s finalizers * list. Either this field or PropagationPolicy may be set, but not both. (optional) * @param propagationPolicy Whether and how garbage collection will be performed. Either this * field or OrphanDependents may be set, but not both. The default policy is decided by the * existing finalizer set in the metadata.finalizers and the resource-specific default policy. * (optional) * @param callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ public com.squareup.okhttp.Call deleteWebLogicOracleV1NamespacedDomainAsync( String name, String namespace, V1DeleteOptions body, String pretty, Integer gracePeriodSeconds, Boolean orphanDependents, String propagationPolicy, final ApiCallback<V1Status> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = (bytesRead, contentLength, done) -> callback.onDownloadProgress(bytesRead, contentLength, done); progressRequestListener = (bytesWritten, contentLength, done) -> callback.onUploadProgress(bytesWritten, contentLength, done); } com.squareup.okhttp.Call call = deleteWebLogicOracleV1NamespacedDomainValidateBeforeCall( name, namespace, body, pretty, gracePeriodSeconds, orphanDependents, propagationPolicy, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<V1Status>() {}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /** * Build call for listWebLogicOracleV1DomainForAllNamespaces * * @param _continue The continue option should be set when retrieving more results from the * server. Since this value is server defined, clients may only use the continue value from a * previous query result with identical query parameters (except for the value of continue) * and the server may reject a continue value it does not recognize. If the specified continue * value is no longer valid whether due to expiration (generally five to fifteen minutes) or a * configuration change on the server the server will respond with a 410 ResourceExpired error * indicating the client must restart their list without the continue field. This field is not * supported when watch is true. Clients may start a watch from the last resourceVersion value * returned by the server and not miss any modifications. (optional) * @param fieldSelector A selector to restrict the list of returned objects by their fields. * Defaults to everything. (optional) * @param includeUninitialized If true, partially initialized resources are included in the * response. (optional) * @param labelSelector A selector to restrict the list of returned objects by their labels. * Defaults to everything. (optional) * @param limit limit is a maximum number of responses to return for a list call. If more items * exist, the server will set the &#x60;continue&#x60; field on the list metadata to a value * that can be used with the same initial query to retrieve the next set of results. Setting a * limit may return fewer than the requested amount of items (up to zero items) in the event * all requested objects are filtered out and clients should only use the presence of the * continue field to determine whether more results are available. Servers may choose not to * support the limit argument and will return all of the available results. If limit is * specified and the continue field is empty, clients may assume that no more results are * available. This field is not supported if watch is true. The server guarantees that the * objects returned when using continue will be identical to issuing a single list call * without a limit - that is, no objects created, modified, or deleted after the first request * is issued will be included in any subsequent continued requests. This is sometimes referred * to as a consistent snapshot, and ensures that a client that is using limit to receive * smaller chunks of a very large result can ensure they see all possible objects. If objects * are updated during a chunked list the version of the object that was present at the time * the first list result was calculated is returned. (optional) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @param resourceVersion When specified with a watch call, shows changes that occur after that * particular version of a resource. Defaults to changes from the beginning of history. When * specified for list: - if unset, then the result is returned from remote storage based on * quorum-read flag; - if it&#39;s 0, then we simply return what we currently have in cache, * no guarantee; - if set to non zero, then the result is at least as fresh as given rv. * (optional) * @param timeoutSeconds Timeout for the list/watch call. (optional) * @param watch Watch for changes to the described resources and return them as a stream of add, * update, and remove notifications. Specify resourceVersion. (optional) * @param progressListener Progress listener * @param progressRequestListener Progress request listener * @return Call to execute * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call listWebLogicOracleV1DomainForAllNamespacesCall( String _continue, String fieldSelector, Boolean includeUninitialized, String labelSelector, Integer limit, String pretty, String resourceVersion, Integer timeoutSeconds, Boolean watch, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/apis/weblogic.oracle/v1/domains"; List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); if (_continue != null) { localVarQueryParams.addAll(apiClient.parameterToPair("continue", _continue)); } if (fieldSelector != null) { localVarQueryParams.addAll(apiClient.parameterToPair("fieldSelector", fieldSelector)); } if (includeUninitialized != null) { localVarQueryParams.addAll( apiClient.parameterToPair("includeUninitialized", includeUninitialized)); } if (labelSelector != null) { localVarQueryParams.addAll(apiClient.parameterToPair("labelSelector", labelSelector)); } if (limit != null) { localVarQueryParams.addAll(apiClient.parameterToPair("limit", limit)); } if (pretty != null) { localVarQueryParams.addAll(apiClient.parameterToPair("pretty", pretty)); } if (resourceVersion != null) { localVarQueryParams.addAll(apiClient.parameterToPair("resourceVersion", resourceVersion)); } if (timeoutSeconds != null) { localVarQueryParams.addAll(apiClient.parameterToPair("timeoutSeconds", timeoutSeconds)); } if (watch != null) { localVarQueryParams.addAll(apiClient.parameterToPair("watch", watch)); } Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json", "application/yaml", "application/vnd.kubernetes.protobuf", "application/json;stream=watch", "application/vnd.kubernetes.protobuf;stream=watch" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = {"*/*"}; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { apiClient .getHttpClient() .networkInterceptors() .add( chain -> { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse .newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); }); } String[] localVarAuthNames = new String[] {"BearerToken"}; return apiClient.buildCall( localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } private com.squareup.okhttp.Call listWebLogicOracleV1DomainForAllNamespacesValidateBeforeCall( String _continue, String fieldSelector, Boolean includeUninitialized, String labelSelector, Integer limit, String pretty, String resourceVersion, Integer timeoutSeconds, Boolean watch, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { com.squareup.okhttp.Call call = listWebLogicOracleV1DomainForAllNamespacesCall( _continue, fieldSelector, includeUninitialized, labelSelector, limit, pretty, resourceVersion, timeoutSeconds, watch, progressListener, progressRequestListener); return call; } /** * list or watch objects of kind Domain * * @param _continue The continue option should be set when retrieving more results from the * server. Since this value is server defined, clients may only use the continue value from a * previous query result with identical query parameters (except for the value of continue) * and the server may reject a continue value it does not recognize. If the specified continue * value is no longer valid whether due to expiration (generally five to fifteen minutes) or a * configuration change on the server the server will respond with a 410 ResourceExpired error * indicating the client must restart their list without the continue field. This field is not * supported when watch is true. Clients may start a watch from the last resourceVersion value * returned by the server and not miss any modifications. (optional) * @param fieldSelector A selector to restrict the list of returned objects by their fields. * Defaults to everything. (optional) * @param includeUninitialized If true, partially initialized resources are included in the * response. (optional) * @param labelSelector A selector to restrict the list of returned objects by their labels. * Defaults to everything. (optional) * @param limit limit is a maximum number of responses to return for a list call. If more items * exist, the server will set the &#x60;continue&#x60; field on the list metadata to a value * that can be used with the same initial query to retrieve the next set of results. Setting a * limit may return fewer than the requested amount of items (up to zero items) in the event * all requested objects are filtered out and clients should only use the presence of the * continue field to determine whether more results are available. Servers may choose not to * support the limit argument and will return all of the available results. If limit is * specified and the continue field is empty, clients may assume that no more results are * available. This field is not supported if watch is true. The server guarantees that the * objects returned when using continue will be identical to issuing a single list call * without a limit - that is, no objects created, modified, or deleted after the first request * is issued will be included in any subsequent continued requests. This is sometimes referred * to as a consistent snapshot, and ensures that a client that is using limit to receive * smaller chunks of a very large result can ensure they see all possible objects. If objects * are updated during a chunked list the version of the object that was present at the time * the first list result was calculated is returned. (optional) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @param resourceVersion When specified with a watch call, shows changes that occur after that * particular version of a resource. Defaults to changes from the beginning of history. When * specified for list: - if unset, then the result is returned from remote storage based on * quorum-read flag; - if it&#39;s 0, then we simply return what we currently have in cache, * no guarantee; - if set to non zero, then the result is at least as fresh as given rv. * (optional) * @param timeoutSeconds Timeout for the list/watch call. (optional) * @param watch Watch for changes to the described resources and return them as a stream of add, * update, and remove notifications. Specify resourceVersion. (optional) * @return DomainList * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ public DomainList listWebLogicOracleV1DomainForAllNamespaces( String _continue, String fieldSelector, Boolean includeUninitialized, String labelSelector, Integer limit, String pretty, String resourceVersion, Integer timeoutSeconds, Boolean watch) throws ApiException { ApiResponse<DomainList> resp = listWebLogicOracleV1DomainForAllNamespacesWithHttpInfo( _continue, fieldSelector, includeUninitialized, labelSelector, limit, pretty, resourceVersion, timeoutSeconds, watch); return resp.getData(); } /** * list or watch objects of kind Domain * * @param _continue The continue option should be set when retrieving more results from the * server. Since this value is server defined, clients may only use the continue value from a * previous query result with identical query parameters (except for the value of continue) * and the server may reject a continue value it does not recognize. If the specified continue * value is no longer valid whether due to expiration (generally five to fifteen minutes) or a * configuration change on the server the server will respond with a 410 ResourceExpired error * indicating the client must restart their list without the continue field. This field is not * supported when watch is true. Clients may start a watch from the last resourceVersion value * returned by the server and not miss any modifications. (optional) * @param fieldSelector A selector to restrict the list of returned objects by their fields. * Defaults to everything. (optional) * @param includeUninitialized If true, partially initialized resources are included in the * response. (optional) * @param labelSelector A selector to restrict the list of returned objects by their labels. * Defaults to everything. (optional) * @param limit limit is a maximum number of responses to return for a list call. If more items * exist, the server will set the &#x60;continue&#x60; field on the list metadata to a value * that can be used with the same initial query to retrieve the next set of results. Setting a * limit may return fewer than the requested amount of items (up to zero items) in the event * all requested objects are filtered out and clients should only use the presence of the * continue field to determine whether more results are available. Servers may choose not to * support the limit argument and will return all of the available results. If limit is * specified and the continue field is empty, clients may assume that no more results are * available. This field is not supported if watch is true. The server guarantees that the * objects returned when using continue will be identical to issuing a single list call * without a limit - that is, no objects created, modified, or deleted after the first request * is issued will be included in any subsequent continued requests. This is sometimes referred * to as a consistent snapshot, and ensures that a client that is using limit to receive * smaller chunks of a very large result can ensure they see all possible objects. If objects * are updated during a chunked list the version of the object that was present at the time * the first list result was calculated is returned. (optional) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @param resourceVersion When specified with a watch call, shows changes that occur after that * particular version of a resource. Defaults to changes from the beginning of history. When * specified for list: - if unset, then the result is returned from remote storage based on * quorum-read flag; - if it&#39;s 0, then we simply return what we currently have in cache, * no guarantee; - if set to non zero, then the result is at least as fresh as given rv. * (optional) * @param timeoutSeconds Timeout for the list/watch call. (optional) * @param watch Watch for changes to the described resources and return them as a stream of add, * update, and remove notifications. Specify resourceVersion. (optional) * @return ApiResponse&lt;DomainList&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ public ApiResponse<DomainList> listWebLogicOracleV1DomainForAllNamespacesWithHttpInfo( String _continue, String fieldSelector, Boolean includeUninitialized, String labelSelector, Integer limit, String pretty, String resourceVersion, Integer timeoutSeconds, Boolean watch) throws ApiException { com.squareup.okhttp.Call call = listWebLogicOracleV1DomainForAllNamespacesValidateBeforeCall( _continue, fieldSelector, includeUninitialized, labelSelector, limit, pretty, resourceVersion, timeoutSeconds, watch, null, null); Type localVarReturnType = new TypeToken<DomainList>() {}.getType(); return apiClient.execute(call, localVarReturnType); } /** * (asynchronously) list or watch objects of kind Domain * * @param _continue The continue option should be set when retrieving more results from the * server. Since this value is server defined, clients may only use the continue value from a * previous query result with identical query parameters (except for the value of continue) * and the server may reject a continue value it does not recognize. If the specified continue * value is no longer valid whether due to expiration (generally five to fifteen minutes) or a * configuration change on the server the server will respond with a 410 ResourceExpired error * indicating the client must restart their list without the continue field. This field is not * supported when watch is true. Clients may start a watch from the last resourceVersion value * returned by the server and not miss any modifications. (optional) * @param fieldSelector A selector to restrict the list of returned objects by their fields. * Defaults to everything. (optional) * @param includeUninitialized If true, partially initialized resources are included in the * response. (optional) * @param labelSelector A selector to restrict the list of returned objects by their labels. * Defaults to everything. (optional) * @param limit limit is a maximum number of responses to return for a list call. If more items * exist, the server will set the &#x60;continue&#x60; field on the list metadata to a value * that can be used with the same initial query to retrieve the next set of results. Setting a * limit may return fewer than the requested amount of items (up to zero items) in the event * all requested objects are filtered out and clients should only use the presence of the * continue field to determine whether more results are available. Servers may choose not to * support the limit argument and will return all of the available results. If limit is * specified and the continue field is empty, clients may assume that no more results are * available. This field is not supported if watch is true. The server guarantees that the * objects returned when using continue will be identical to issuing a single list call * without a limit - that is, no objects created, modified, or deleted after the first request * is issued will be included in any subsequent continued requests. This is sometimes referred * to as a consistent snapshot, and ensures that a client that is using limit to receive * smaller chunks of a very large result can ensure they see all possible objects. If objects * are updated during a chunked list the version of the object that was present at the time * the first list result was calculated is returned. (optional) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @param resourceVersion When specified with a watch call, shows changes that occur after that * particular version of a resource. Defaults to changes from the beginning of history. When * specified for list: - if unset, then the result is returned from remote storage based on * quorum-read flag; - if it&#39;s 0, then we simply return what we currently have in cache, * no guarantee; - if set to non zero, then the result is at least as fresh as given rv. * (optional) * @param timeoutSeconds Timeout for the list/watch call. (optional) * @param watch Watch for changes to the described resources and return them as a stream of add, * update, and remove notifications. Specify resourceVersion. (optional) * @param callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ public com.squareup.okhttp.Call listWebLogicOracleV1DomainForAllNamespacesAsync( String _continue, String fieldSelector, Boolean includeUninitialized, String labelSelector, Integer limit, String pretty, String resourceVersion, Integer timeoutSeconds, Boolean watch, final ApiCallback<DomainList> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = (bytesRead, contentLength, done) -> callback.onDownloadProgress(bytesRead, contentLength, done); progressRequestListener = (bytesWritten, contentLength, done) -> callback.onUploadProgress(bytesWritten, contentLength, done); } com.squareup.okhttp.Call call = listWebLogicOracleV1DomainForAllNamespacesValidateBeforeCall( _continue, fieldSelector, includeUninitialized, labelSelector, limit, pretty, resourceVersion, timeoutSeconds, watch, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<DomainList>() {}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /** * Build call for listWebLogicOracleV1NamespacedDomain * * @param namespace object name and auth scope, such as for teams and projects (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @param _continue The continue option should be set when retrieving more results from the * server. Since this value is server defined, clients may only use the continue value from a * previous query result with identical query parameters (except for the value of continue) * and the server may reject a continue value it does not recognize. If the specified continue * value is no longer valid whether due to expiration (generally five to fifteen minutes) or a * configuration change on the server the server will respond with a 410 ResourceExpired error * indicating the client must restart their list without the continue field. This field is not * supported when watch is true. Clients may start a watch from the last resourceVersion value * returned by the server and not miss any modifications. (optional) * @param fieldSelector A selector to restrict the list of returned objects by their fields. * Defaults to everything. (optional) * @param includeUninitialized If true, partially initialized resources are included in the * response. (optional) * @param labelSelector A selector to restrict the list of returned objects by their labels. * Defaults to everything. (optional) * @param limit limit is a maximum number of responses to return for a list call. If more items * exist, the server will set the &#x60;continue&#x60; field on the list metadata to a value * that can be used with the same initial query to retrieve the next set of results. Setting a * limit may return fewer than the requested amount of items (up to zero items) in the event * all requested objects are filtered out and clients should only use the presence of the * continue field to determine whether more results are available. Servers may choose not to * support the limit argument and will return all of the available results. If limit is * specified and the continue field is empty, clients may assume that no more results are * available. This field is not supported if watch is true. The server guarantees that the * objects returned when using continue will be identical to issuing a single list call * without a limit - that is, no objects created, modified, or deleted after the first request * is issued will be included in any subsequent continued requests. This is sometimes referred * to as a consistent snapshot, and ensures that a client that is using limit to receive * smaller chunks of a very large result can ensure they see all possible objects. If objects * are updated during a chunked list the version of the object that was present at the time * the first list result was calculated is returned. (optional) * @param resourceVersion When specified with a watch call, shows changes that occur after that * particular version of a resource. Defaults to changes from the beginning of history. When * specified for list: - if unset, then the result is returned from remote storage based on * quorum-read flag; - if it&#39;s 0, then we simply return what we currently have in cache, * no guarantee; - if set to non zero, then the result is at least as fresh as given rv. * (optional) * @param timeoutSeconds Timeout for the list/watch call. (optional) * @param watch Watch for changes to the described resources and return them as a stream of add, * update, and remove notifications. Specify resourceVersion. (optional) * @param progressListener Progress listener * @param progressRequestListener Progress request listener * @return Call to execute * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call listWebLogicOracleV1NamespacedDomainCall( String namespace, String pretty, String _continue, String fieldSelector, Boolean includeUninitialized, String labelSelector, Integer limit, String resourceVersion, Integer timeoutSeconds, Boolean watch, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/apis/weblogic.oracle/v1/namespaces/{namespace}/domains" .replaceAll("\\{" + "namespace" + "\\}", apiClient.escapeString(namespace)); List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); if (pretty != null) { localVarQueryParams.addAll(apiClient.parameterToPair("pretty", pretty)); } if (_continue != null) { localVarQueryParams.addAll(apiClient.parameterToPair("continue", _continue)); } if (fieldSelector != null) { localVarQueryParams.addAll(apiClient.parameterToPair("fieldSelector", fieldSelector)); } if (includeUninitialized != null) { localVarQueryParams.addAll( apiClient.parameterToPair("includeUninitialized", includeUninitialized)); } if (labelSelector != null) { localVarQueryParams.addAll(apiClient.parameterToPair("labelSelector", labelSelector)); } if (limit != null) { localVarQueryParams.addAll(apiClient.parameterToPair("limit", limit)); } if (resourceVersion != null) { localVarQueryParams.addAll(apiClient.parameterToPair("resourceVersion", resourceVersion)); } if (timeoutSeconds != null) { localVarQueryParams.addAll(apiClient.parameterToPair("timeoutSeconds", timeoutSeconds)); } if (watch != null) { localVarQueryParams.addAll(apiClient.parameterToPair("watch", watch)); } Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json", "application/yaml", "application/vnd.kubernetes.protobuf", "application/json;stream=watch", "application/vnd.kubernetes.protobuf;stream=watch" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = {"*/*"}; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { apiClient .getHttpClient() .networkInterceptors() .add( chain -> { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse .newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); }); } String[] localVarAuthNames = new String[] {"BearerToken"}; return apiClient.buildCall( localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } private com.squareup.okhttp.Call listWebLogicOracleV1NamespacedDomainValidateBeforeCall( String namespace, String pretty, String _continue, String fieldSelector, Boolean includeUninitialized, String labelSelector, Integer limit, String resourceVersion, Integer timeoutSeconds, Boolean watch, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'namespace' is set if (namespace == null) { throw new ApiException( "Missing the required parameter 'namespace' when calling listWebLogicOracleV1NamespacedDomain(Async)"); } com.squareup.okhttp.Call call = listWebLogicOracleV1NamespacedDomainCall( namespace, pretty, _continue, fieldSelector, includeUninitialized, labelSelector, limit, resourceVersion, timeoutSeconds, watch, progressListener, progressRequestListener); return call; } /** * list or watch objects of kind Domain * * @param namespace object name and auth scope, such as for teams and projects (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @param _continue The continue option should be set when retrieving more results from the * server. Since this value is server defined, clients may only use the continue value from a * previous query result with identical query parameters (except for the value of continue) * and the server may reject a continue value it does not recognize. If the specified continue * value is no longer valid whether due to expiration (generally five to fifteen minutes) or a * configuration change on the server the server will respond with a 410 ResourceExpired error * indicating the client must restart their list without the continue field. This field is not * supported when watch is true. Clients may start a watch from the last resourceVersion value * returned by the server and not miss any modifications. (optional) * @param fieldSelector A selector to restrict the list of returned objects by their fields. * Defaults to everything. (optional) * @param includeUninitialized If true, partially initialized resources are included in the * response. (optional) * @param labelSelector A selector to restrict the list of returned objects by their labels. * Defaults to everything. (optional) * @param limit limit is a maximum number of responses to return for a list call. If more items * exist, the server will set the &#x60;continue&#x60; field on the list metadata to a value * that can be used with the same initial query to retrieve the next set of results. Setting a * limit may return fewer than the requested amount of items (up to zero items) in the event * all requested objects are filtered out and clients should only use the presence of the * continue field to determine whether more results are available. Servers may choose not to * support the limit argument and will return all of the available results. If limit is * specified and the continue field is empty, clients may assume that no more results are * available. This field is not supported if watch is true. The server guarantees that the * objects returned when using continue will be identical to issuing a single list call * without a limit - that is, no objects created, modified, or deleted after the first request * is issued will be included in any subsequent continued requests. This is sometimes referred * to as a consistent snapshot, and ensures that a client that is using limit to receive * smaller chunks of a very large result can ensure they see all possible objects. If objects * are updated during a chunked list the version of the object that was present at the time * the first list result was calculated is returned. (optional) * @param resourceVersion When specified with a watch call, shows changes that occur after that * particular version of a resource. Defaults to changes from the beginning of history. When * specified for list: - if unset, then the result is returned from remote storage based on * quorum-read flag; - if it&#39;s 0, then we simply return what we currently have in cache, * no guarantee; - if set to non zero, then the result is at least as fresh as given rv. * (optional) * @param timeoutSeconds Timeout for the list/watch call. (optional) * @param watch Watch for changes to the described resources and return them as a stream of add, * update, and remove notifications. Specify resourceVersion. (optional) * @return DomainList * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ public DomainList listWebLogicOracleV1NamespacedDomain( String namespace, String pretty, String _continue, String fieldSelector, Boolean includeUninitialized, String labelSelector, Integer limit, String resourceVersion, Integer timeoutSeconds, Boolean watch) throws ApiException { ApiResponse<DomainList> resp = listWebLogicOracleV1NamespacedDomainWithHttpInfo( namespace, pretty, _continue, fieldSelector, includeUninitialized, labelSelector, limit, resourceVersion, timeoutSeconds, watch); return resp.getData(); } /** * list or watch objects of kind Domain * * @param namespace object name and auth scope, such as for teams and projects (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @param _continue The continue option should be set when retrieving more results from the * server. Since this value is server defined, clients may only use the continue value from a * previous query result with identical query parameters (except for the value of continue) * and the server may reject a continue value it does not recognize. If the specified continue * value is no longer valid whether due to expiration (generally five to fifteen minutes) or a * configuration change on the server the server will respond with a 410 ResourceExpired error * indicating the client must restart their list without the continue field. This field is not * supported when watch is true. Clients may start a watch from the last resourceVersion value * returned by the server and not miss any modifications. (optional) * @param fieldSelector A selector to restrict the list of returned objects by their fields. * Defaults to everything. (optional) * @param includeUninitialized If true, partially initialized resources are included in the * response. (optional) * @param labelSelector A selector to restrict the list of returned objects by their labels. * Defaults to everything. (optional) * @param limit limit is a maximum number of responses to return for a list call. If more items * exist, the server will set the &#x60;continue&#x60; field on the list metadata to a value * that can be used with the same initial query to retrieve the next set of results. Setting a * limit may return fewer than the requested amount of items (up to zero items) in the event * all requested objects are filtered out and clients should only use the presence of the * continue field to determine whether more results are available. Servers may choose not to * support the limit argument and will return all of the available results. If limit is * specified and the continue field is empty, clients may assume that no more results are * available. This field is not supported if watch is true. The server guarantees that the * objects returned when using continue will be identical to issuing a single list call * without a limit - that is, no objects created, modified, or deleted after the first request * is issued will be included in any subsequent continued requests. This is sometimes referred * to as a consistent snapshot, and ensures that a client that is using limit to receive * smaller chunks of a very large result can ensure they see all possible objects. If objects * are updated during a chunked list the version of the object that was present at the time * the first list result was calculated is returned. (optional) * @param resourceVersion When specified with a watch call, shows changes that occur after that * particular version of a resource. Defaults to changes from the beginning of history. When * specified for list: - if unset, then the result is returned from remote storage based on * quorum-read flag; - if it&#39;s 0, then we simply return what we currently have in cache, * no guarantee; - if set to non zero, then the result is at least as fresh as given rv. * (optional) * @param timeoutSeconds Timeout for the list/watch call. (optional) * @param watch Watch for changes to the described resources and return them as a stream of add, * update, and remove notifications. Specify resourceVersion. (optional) * @return ApiResponse&lt;DomainList&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ public ApiResponse<DomainList> listWebLogicOracleV1NamespacedDomainWithHttpInfo( String namespace, String pretty, String _continue, String fieldSelector, Boolean includeUninitialized, String labelSelector, Integer limit, String resourceVersion, Integer timeoutSeconds, Boolean watch) throws ApiException { com.squareup.okhttp.Call call = listWebLogicOracleV1NamespacedDomainValidateBeforeCall( namespace, pretty, _continue, fieldSelector, includeUninitialized, labelSelector, limit, resourceVersion, timeoutSeconds, watch, null, null); Type localVarReturnType = new TypeToken<DomainList>() {}.getType(); return apiClient.execute(call, localVarReturnType); } /** * (asynchronously) list or watch objects of kind Domain * * @param namespace object name and auth scope, such as for teams and projects (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @param _continue The continue option should be set when retrieving more results from the * server. Since this value is server defined, clients may only use the continue value from a * previous query result with identical query parameters (except for the value of continue) * and the server may reject a continue value it does not recognize. If the specified continue * value is no longer valid whether due to expiration (generally five to fifteen minutes) or a * configuration change on the server the server will respond with a 410 ResourceExpired error * indicating the client must restart their list without the continue field. This field is not * supported when watch is true. Clients may start a watch from the last resourceVersion value * returned by the server and not miss any modifications. (optional) * @param fieldSelector A selector to restrict the list of returned objects by their fields. * Defaults to everything. (optional) * @param includeUninitialized If true, partially initialized resources are included in the * response. (optional) * @param labelSelector A selector to restrict the list of returned objects by their labels. * Defaults to everything. (optional) * @param limit limit is a maximum number of responses to return for a list call. If more items * exist, the server will set the &#x60;continue&#x60; field on the list metadata to a value * that can be used with the same initial query to retrieve the next set of results. Setting a * limit may return fewer than the requested amount of items (up to zero items) in the event * all requested objects are filtered out and clients should only use the presence of the * continue field to determine whether more results are available. Servers may choose not to * support the limit argument and will return all of the available results. If limit is * specified and the continue field is empty, clients may assume that no more results are * available. This field is not supported if watch is true. The server guarantees that the * objects returned when using continue will be identical to issuing a single list call * without a limit - that is, no objects created, modified, or deleted after the first request * is issued will be included in any subsequent continued requests. This is sometimes referred * to as a consistent snapshot, and ensures that a client that is using limit to receive * smaller chunks of a very large result can ensure they see all possible objects. If objects * are updated during a chunked list the version of the object that was present at the time * the first list result was calculated is returned. (optional) * @param resourceVersion When specified with a watch call, shows changes that occur after that * particular version of a resource. Defaults to changes from the beginning of history. When * specified for list: - if unset, then the result is returned from remote storage based on * quorum-read flag; - if it&#39;s 0, then we simply return what we currently have in cache, * no guarantee; - if set to non zero, then the result is at least as fresh as given rv. * (optional) * @param timeoutSeconds Timeout for the list/watch call. (optional) * @param watch Watch for changes to the described resources and return them as a stream of add, * update, and remove notifications. Specify resourceVersion. (optional) * @param callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ public com.squareup.okhttp.Call listWebLogicOracleV1NamespacedDomainAsync( String namespace, String pretty, String _continue, String fieldSelector, Boolean includeUninitialized, String labelSelector, Integer limit, String resourceVersion, Integer timeoutSeconds, Boolean watch, final ApiCallback<DomainList> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = (bytesRead, contentLength, done) -> callback.onDownloadProgress(bytesRead, contentLength, done); progressRequestListener = (bytesWritten, contentLength, done) -> callback.onUploadProgress(bytesWritten, contentLength, done); } com.squareup.okhttp.Call call = listWebLogicOracleV1NamespacedDomainValidateBeforeCall( namespace, pretty, _continue, fieldSelector, includeUninitialized, labelSelector, limit, resourceVersion, timeoutSeconds, watch, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<DomainList>() {}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /** * Build call for patchWebLogicOracleV1NamespacedDomain * * @param name name of the Domain (required) * @param namespace object name and auth scope, such as for teams and projects (required) * @param body (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @param progressListener Progress listener * @param progressRequestListener Progress request listener * @return Call to execute * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call patchWebLogicOracleV1NamespacedDomainCall( String name, String namespace, Patch body, String pretty, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // create path and map variables String localVarPath = "/apis/weblogic.oracle/v1/namespaces/{namespace}/domains/{name}" .replaceAll("\\{" + "name" + "\\}", apiClient.escapeString(name)) .replaceAll("\\{" + "namespace" + "\\}", apiClient.escapeString(namespace)); List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); if (pretty != null) localVarQueryParams.addAll(apiClient.parameterToPair("pretty", pretty)); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json", "application/yaml", "application/vnd.kubernetes.protobuf" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { "application/json-patch+json", "application/merge-patch+json", "application/strategic-merge-patch+json" }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { apiClient .getHttpClient() .networkInterceptors() .add( chain -> { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse .newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); }); } String[] localVarAuthNames = new String[] {"BearerToken"}; return apiClient.buildCall( localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } private com.squareup.okhttp.Call patchWebLogicOracleV1NamespacedDomainValidateBeforeCall( String name, String namespace, Patch body, String pretty, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'name' is set if (name == null) { throw new ApiException( "Missing the required parameter 'name' when calling patchWebLogicOracleV1NamespacedDomain(Async)"); } // verify the required parameter 'namespace' is set if (namespace == null) { throw new ApiException( "Missing the required parameter 'namespace' when calling patchWebLogicOracleV1NamespacedDomain(Async)"); } // verify the required parameter 'body' is set if (body == null) { throw new ApiException( "Missing the required parameter 'body' when calling patchWebLogicOracleV1NamespacedDomain(Async)"); } com.squareup.okhttp.Call call = patchWebLogicOracleV1NamespacedDomainCall( name, namespace, body, pretty, progressListener, progressRequestListener); return call; } /** * partially update the specified Domain * * @param name name of the Domain (required) * @param namespace object name and auth scope, such as for teams and projects (required) * @param body (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @return Domain * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ public Domain patchWebLogicOracleV1NamespacedDomain( String name, String namespace, Patch body, String pretty) throws ApiException { ApiResponse<Domain> resp = patchWebLogicOracleV1NamespacedDomainWithHttpInfo(name, namespace, body, pretty); return resp.getData(); } /** * partially update the specified Domain * * @param name name of the Domain (required) * @param namespace object name and auth scope, such as for teams and projects (required) * @param body (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @return ApiResponse&lt;Domain&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ public ApiResponse<Domain> patchWebLogicOracleV1NamespacedDomainWithHttpInfo( String name, String namespace, Patch body, String pretty) throws ApiException { com.squareup.okhttp.Call call = patchWebLogicOracleV1NamespacedDomainValidateBeforeCall( name, namespace, body, pretty, null, null); Type localVarReturnType = new TypeToken<Domain>() {}.getType(); return apiClient.execute(call, localVarReturnType); } /** * (asynchronously) partially update the specified Domain * * @param name name of the Domain (required) * @param namespace object name and auth scope, such as for teams and projects (required) * @param body (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @param callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ public com.squareup.okhttp.Call patchWebLogicOracleV1NamespacedDomainAsync( String name, String namespace, Patch body, String pretty, final ApiCallback<Domain> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = (bytesRead, contentLength, done) -> callback.onDownloadProgress(bytesRead, contentLength, done); progressRequestListener = (bytesWritten, contentLength, done) -> callback.onUploadProgress(bytesWritten, contentLength, done); } com.squareup.okhttp.Call call = patchWebLogicOracleV1NamespacedDomainValidateBeforeCall( name, namespace, body, pretty, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<Domain>() {}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /** * Build call for patchWebLogicOracleV1NamespacedDomainScale * * @param name name of the Scale (required) * @param namespace object name and auth scope, such as for teams and projects (required) * @param body (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @param progressListener Progress listener * @param progressRequestListener Progress request listener * @return Call to execute * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call patchWebLogicOracleV1NamespacedDomainScaleCall( String name, String namespace, Patch body, String pretty, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // create path and map variables String localVarPath = "/apis/weblogic.oracle/v1/namespaces/{namespace}/domains/{name}/scale" .replaceAll("\\{" + "name" + "\\}", apiClient.escapeString(name)) .replaceAll("\\{" + "namespace" + "\\}", apiClient.escapeString(namespace)); List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); if (pretty != null) localVarQueryParams.addAll(apiClient.parameterToPair("pretty", pretty)); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json", "application/yaml", "application/vnd.kubernetes.protobuf" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { "application/json-patch+json", "application/merge-patch+json", "application/strategic-merge-patch+json" }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { apiClient .getHttpClient() .networkInterceptors() .add( chain -> { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse .newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); }); } String[] localVarAuthNames = new String[] {"BearerToken"}; return apiClient.buildCall( localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } private com.squareup.okhttp.Call patchWebLogicOracleV1NamespacedDomainScaleValidateBeforeCall( String name, String namespace, Patch body, String pretty, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'name' is set if (name == null) { throw new ApiException( "Missing the required parameter 'name' when calling patchWebLogicOracleV1NamespacedDomainScale(Async)"); } // verify the required parameter 'namespace' is set if (namespace == null) { throw new ApiException( "Missing the required parameter 'namespace' when calling patchWebLogicOracleV1NamespacedDomainScale(Async)"); } // verify the required parameter 'body' is set if (body == null) { throw new ApiException( "Missing the required parameter 'body' when calling patchWebLogicOracleV1NamespacedDomainScale(Async)"); } com.squareup.okhttp.Call call = patchWebLogicOracleV1NamespacedDomainScaleCall( name, namespace, body, pretty, progressListener, progressRequestListener); return call; } /** * partially update scale of the specified Domain * * @param name name of the Scale (required) * @param namespace object name and auth scope, such as for teams and projects (required) * @param body (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @return V1Scale * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ public V1Scale patchWebLogicOracleV1NamespacedDomainScale( String name, String namespace, Patch body, String pretty) throws ApiException { ApiResponse<V1Scale> resp = patchWebLogicOracleV1NamespacedDomainScaleWithHttpInfo(name, namespace, body, pretty); return resp.getData(); } /** * partially update scale of the specified Domain * * @param name name of the Scale (required) * @param namespace object name and auth scope, such as for teams and projects (required) * @param body (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @return ApiResponse&lt;V1Scale&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ public ApiResponse<V1Scale> patchWebLogicOracleV1NamespacedDomainScaleWithHttpInfo( String name, String namespace, Patch body, String pretty) throws ApiException { com.squareup.okhttp.Call call = patchWebLogicOracleV1NamespacedDomainScaleValidateBeforeCall( name, namespace, body, pretty, null, null); Type localVarReturnType = new TypeToken<V1Scale>() {}.getType(); return apiClient.execute(call, localVarReturnType); } /** * (asynchronously) partially update scale of the specified Domain * * @param name name of the Scale (required) * @param namespace object name and auth scope, such as for teams and projects (required) * @param body (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @param callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ public com.squareup.okhttp.Call patchWebLogicOracleV1NamespacedDomainScaleAsync( String name, String namespace, Patch body, String pretty, final ApiCallback<V1Scale> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = (bytesRead, contentLength, done) -> callback.onDownloadProgress(bytesRead, contentLength, done); progressRequestListener = (bytesWritten, contentLength, done) -> callback.onUploadProgress(bytesWritten, contentLength, done); } com.squareup.okhttp.Call call = patchWebLogicOracleV1NamespacedDomainScaleValidateBeforeCall( name, namespace, body, pretty, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<V1Scale>() {}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /** * Build call for patchWebLogicOracleV1NamespacedDomainStatus * * @param name name of the Domain (required) * @param namespace object name and auth scope, such as for teams and projects (required) * @param body (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @param progressListener Progress listener * @param progressRequestListener Progress request listener * @return Call to execute * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call patchWebLogicOracleV1NamespacedDomainStatusCall( String name, String namespace, Patch body, String pretty, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // create path and map variables String localVarPath = "/apis/weblogic.oracle/v1/namespaces/{namespace}/domains/{name}/status" .replaceAll("\\{" + "name" + "\\}", apiClient.escapeString(name)) .replaceAll("\\{" + "namespace" + "\\}", apiClient.escapeString(namespace)); List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); if (pretty != null) localVarQueryParams.addAll(apiClient.parameterToPair("pretty", pretty)); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json", "application/yaml", "application/vnd.kubernetes.protobuf" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { "application/json-patch+json", "application/merge-patch+json", "application/strategic-merge-patch+json" }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { apiClient .getHttpClient() .networkInterceptors() .add( chain -> { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse .newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); }); } String[] localVarAuthNames = new String[] {"BearerToken"}; return apiClient.buildCall( localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } private com.squareup.okhttp.Call patchWebLogicOracleV1NamespacedDomainStatusValidateBeforeCall( String name, String namespace, Patch body, String pretty, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'name' is set if (name == null) { throw new ApiException( "Missing the required parameter 'name' when calling patchWebLogicOracleV1NamespacedDomainStatus(Async)"); } // verify the required parameter 'namespace' is set if (namespace == null) { throw new ApiException( "Missing the required parameter 'namespace' when calling patchWebLogicOracleV1NamespacedDomainStatus(Async)"); } // verify the required parameter 'body' is set if (body == null) { throw new ApiException( "Missing the required parameter 'body' when calling patchWebLogicOracleV1NamespacedDomainStatus(Async)"); } com.squareup.okhttp.Call call = patchWebLogicOracleV1NamespacedDomainStatusCall( name, namespace, body, pretty, progressListener, progressRequestListener); return call; } /** * partially update status of the specified Domain * * @param name name of the Domain (required) * @param namespace object name and auth scope, such as for teams and projects (required) * @param body (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @return Domain * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ public Domain patchWebLogicOracleV1NamespacedDomainStatus( String name, String namespace, Patch body, String pretty) throws ApiException { ApiResponse<Domain> resp = patchWebLogicOracleV1NamespacedDomainStatusWithHttpInfo(name, namespace, body, pretty); return resp.getData(); } /** * partially update status of the specified Domain * * @param name name of the Domain (required) * @param namespace object name and auth scope, such as for teams and projects (required) * @param body (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @return ApiResponse&lt;Domain&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ public ApiResponse<Domain> patchWebLogicOracleV1NamespacedDomainStatusWithHttpInfo( String name, String namespace, Patch body, String pretty) throws ApiException { com.squareup.okhttp.Call call = patchWebLogicOracleV1NamespacedDomainStatusValidateBeforeCall( name, namespace, body, pretty, null, null); Type localVarReturnType = new TypeToken<Domain>() {}.getType(); return apiClient.execute(call, localVarReturnType); } /** * (asynchronously) partially update status of the specified Domain * * @param name name of the Domain (required) * @param namespace object name and auth scope, such as for teams and projects (required) * @param body (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @param callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ public com.squareup.okhttp.Call patchWebLogicOracleV1NamespacedDomainStatusAsync( String name, String namespace, Patch body, String pretty, final ApiCallback<Domain> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = (bytesRead, contentLength, done) -> callback.onDownloadProgress(bytesRead, contentLength, done); progressRequestListener = (bytesWritten, contentLength, done) -> callback.onUploadProgress(bytesWritten, contentLength, done); } com.squareup.okhttp.Call call = patchWebLogicOracleV1NamespacedDomainStatusValidateBeforeCall( name, namespace, body, pretty, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<Domain>() {}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /** * Build call for readWebLogicOracleV1NamespacedDomain * * @param name name of the Domain (required) * @param namespace object name and auth scope, such as for teams and projects (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @param exact Should the export be exact. Exact export maintains cluster-specific fields like * &#39;Namespace&#39;. (optional) * @param export Should this value be exported. Export strips fields that a user can not specify. * (optional) * @param progressListener Progress listener * @param progressRequestListener Progress request listener * @return Call to execute * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call readWebLogicOracleV1NamespacedDomainCall( String name, String namespace, String pretty, Boolean exact, Boolean export, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/apis/weblogic.oracle/v1/namespaces/{namespace}/domains/{name}" .replaceAll("\\{" + "name" + "\\}", apiClient.escapeString(name)) .replaceAll("\\{" + "namespace" + "\\}", apiClient.escapeString(namespace)); List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); if (pretty != null) { localVarQueryParams.addAll(apiClient.parameterToPair("pretty", pretty)); } if (exact != null) { localVarQueryParams.addAll(apiClient.parameterToPair("exact", exact)); } if (export != null) { localVarQueryParams.addAll(apiClient.parameterToPair("export", export)); } Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json", "application/yaml", "application/vnd.kubernetes.protobuf" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = {"*/*"}; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { apiClient .getHttpClient() .networkInterceptors() .add( chain -> { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse .newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); }); } String[] localVarAuthNames = new String[] {"BearerToken"}; return apiClient.buildCall( localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } private com.squareup.okhttp.Call readWebLogicOracleV1NamespacedDomainValidateBeforeCall( String name, String namespace, String pretty, Boolean exact, Boolean export, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'name' is set if (name == null) { throw new ApiException( "Missing the required parameter 'name' when calling readWebLogicOracleV1NamespacedDomain(Async)"); } // verify the required parameter 'namespace' is set if (namespace == null) { throw new ApiException( "Missing the required parameter 'namespace' when calling readWebLogicOracleV1NamespacedDomain(Async)"); } com.squareup.okhttp.Call call = readWebLogicOracleV1NamespacedDomainCall( name, namespace, pretty, exact, export, progressListener, progressRequestListener); return call; } /** * read the specified Domain * * @param name name of the Domain (required) * @param namespace object name and auth scope, such as for teams and projects (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @param exact Should the export be exact. Exact export maintains cluster-specific fields like * &#39;Namespace&#39;. (optional) * @param export Should this value be exported. Export strips fields that a user can not specify. * (optional) * @return Domain * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ public Domain readWebLogicOracleV1NamespacedDomain( String name, String namespace, String pretty, Boolean exact, Boolean export) throws ApiException { ApiResponse<Domain> resp = readWebLogicOracleV1NamespacedDomainWithHttpInfo(name, namespace, pretty, exact, export); return resp.getData(); } /** * read the specified Domain * * @param name name of the Domain (required) * @param namespace object name and auth scope, such as for teams and projects (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @param exact Should the export be exact. Exact export maintains cluster-specific fields like * &#39;Namespace&#39;. (optional) * @param export Should this value be exported. Export strips fields that a user can not specify. * (optional) * @return ApiResponse&lt;Domain&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ public ApiResponse<Domain> readWebLogicOracleV1NamespacedDomainWithHttpInfo( String name, String namespace, String pretty, Boolean exact, Boolean export) throws ApiException { com.squareup.okhttp.Call call = readWebLogicOracleV1NamespacedDomainValidateBeforeCall( name, namespace, pretty, exact, export, null, null); Type localVarReturnType = new TypeToken<Domain>() {}.getType(); return apiClient.execute(call, localVarReturnType); } /** * (asynchronously) read the specified Domain * * @param name name of the Domain (required) * @param namespace object name and auth scope, such as for teams and projects (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @param exact Should the export be exact. Exact export maintains cluster-specific fields like * &#39;Namespace&#39;. (optional) * @param export Should this value be exported. Export strips fields that a user can not specify. * (optional) * @param callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ public com.squareup.okhttp.Call readWebLogicOracleV1NamespacedDomainAsync( String name, String namespace, String pretty, Boolean exact, Boolean export, final ApiCallback<Domain> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = (bytesRead, contentLength, done) -> callback.onDownloadProgress(bytesRead, contentLength, done); progressRequestListener = (bytesWritten, contentLength, done) -> callback.onUploadProgress(bytesWritten, contentLength, done); } com.squareup.okhttp.Call call = readWebLogicOracleV1NamespacedDomainValidateBeforeCall( name, namespace, pretty, exact, export, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<Domain>() {}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /** * Build call for readWebLogicOracleV1NamespacedDomainScale * * @param name name of the Scale (required) * @param namespace object name and auth scope, such as for teams and projects (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @param progressListener Progress listener * @param progressRequestListener Progress request listener * @return Call to execute * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call readWebLogicOracleV1NamespacedDomainScaleCall( String name, String namespace, String pretty, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/apis/weblogic.oracle/v1/namespaces/{namespace}/domains/{name}/scale" .replaceAll("\\{" + "name" + "\\}", apiClient.escapeString(name)) .replaceAll("\\{" + "namespace" + "\\}", apiClient.escapeString(namespace)); List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); if (pretty != null) localVarQueryParams.addAll(apiClient.parameterToPair("pretty", pretty)); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json", "application/yaml", "application/vnd.kubernetes.protobuf" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = {"*/*"}; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { apiClient .getHttpClient() .networkInterceptors() .add( chain -> { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse .newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); }); } String[] localVarAuthNames = new String[] {"BearerToken"}; return apiClient.buildCall( localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } private com.squareup.okhttp.Call readWebLogicOracleV1NamespacedDomainScaleValidateBeforeCall( String name, String namespace, String pretty, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'name' is set if (name == null) { throw new ApiException( "Missing the required parameter 'name' when calling readWebLogicOracleV1NamespacedDomainScale(Async)"); } // verify the required parameter 'namespace' is set if (namespace == null) { throw new ApiException( "Missing the required parameter 'namespace' when calling readWebLogicOracleV1NamespacedDomainScale(Async)"); } com.squareup.okhttp.Call call = readWebLogicOracleV1NamespacedDomainScaleCall( name, namespace, pretty, progressListener, progressRequestListener); return call; } /** * read scale of the specified Domain * * @param name name of the Scale (required) * @param namespace object name and auth scope, such as for teams and projects (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @return V1Scale * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ public V1Scale readWebLogicOracleV1NamespacedDomainScale( String name, String namespace, String pretty) throws ApiException { ApiResponse<V1Scale> resp = readWebLogicOracleV1NamespacedDomainScaleWithHttpInfo(name, namespace, pretty); return resp.getData(); } /** * read scale of the specified Domain * * @param name name of the Scale (required) * @param namespace object name and auth scope, such as for teams and projects (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @return ApiResponse&lt;V1Scale&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ public ApiResponse<V1Scale> readWebLogicOracleV1NamespacedDomainScaleWithHttpInfo( String name, String namespace, String pretty) throws ApiException { com.squareup.okhttp.Call call = readWebLogicOracleV1NamespacedDomainScaleValidateBeforeCall( name, namespace, pretty, null, null); Type localVarReturnType = new TypeToken<V1Scale>() {}.getType(); return apiClient.execute(call, localVarReturnType); } /** * (asynchronously) read scale of the specified Domain * * @param name name of the Scale (required) * @param namespace object name and auth scope, such as for teams and projects (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @param callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ public com.squareup.okhttp.Call readWebLogicOracleV1NamespacedDomainScaleAsync( String name, String namespace, String pretty, final ApiCallback<V1Scale> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = (bytesRead, contentLength, done) -> callback.onDownloadProgress(bytesRead, contentLength, done); progressRequestListener = (bytesWritten, contentLength, done) -> callback.onUploadProgress(bytesWritten, contentLength, done); } com.squareup.okhttp.Call call = readWebLogicOracleV1NamespacedDomainScaleValidateBeforeCall( name, namespace, pretty, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<V1Scale>() {}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /** * Build call for readWebLogicOracleV1NamespacedDomainStatus * * @param name name of the Domain (required) * @param namespace object name and auth scope, such as for teams and projects (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @param progressListener Progress listener * @param progressRequestListener Progress request listener * @return Call to execute * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call readWebLogicOracleV1NamespacedDomainStatusCall( String name, String namespace, String pretty, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/apis/weblogic.oracle/v1/namespaces/{namespace}/domains/{name}/status" .replaceAll("\\{" + "name" + "\\}", apiClient.escapeString(name)) .replaceAll("\\{" + "namespace" + "\\}", apiClient.escapeString(namespace)); List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); if (pretty != null) localVarQueryParams.addAll(apiClient.parameterToPair("pretty", pretty)); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json", "application/yaml", "application/vnd.kubernetes.protobuf" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = {"*/*"}; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { apiClient .getHttpClient() .networkInterceptors() .add( chain -> { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse .newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); }); } String[] localVarAuthNames = new String[] {"BearerToken"}; return apiClient.buildCall( localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } private com.squareup.okhttp.Call readWebLogicOracleV1NamespacedDomainStatusValidateBeforeCall( String name, String namespace, String pretty, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'name' is set if (name == null) { throw new ApiException( "Missing the required parameter 'name' when calling readWebLogicOracleV1NamespacedDomainStatus(Async)"); } // verify the required parameter 'namespace' is set if (namespace == null) { throw new ApiException( "Missing the required parameter 'namespace' when calling readWebLogicOracleV1NamespacedDomainStatus(Async)"); } com.squareup.okhttp.Call call = readWebLogicOracleV1NamespacedDomainStatusCall( name, namespace, pretty, progressListener, progressRequestListener); return call; } /** * read status of the specified Domain * * @param name name of the Domain (required) * @param namespace object name and auth scope, such as for teams and projects (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @return Domain * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ public Domain readWebLogicOracleV1NamespacedDomainStatus( String name, String namespace, String pretty) throws ApiException { ApiResponse<Domain> resp = readWebLogicOracleV1NamespacedDomainStatusWithHttpInfo(name, namespace, pretty); return resp.getData(); } /** * read status of the specified Domain * * @param name name of the Domain (required) * @param namespace object name and auth scope, such as for teams and projects (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @return ApiResponse&lt;Domain&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ public ApiResponse<Domain> readWebLogicOracleV1NamespacedDomainStatusWithHttpInfo( String name, String namespace, String pretty) throws ApiException { com.squareup.okhttp.Call call = readWebLogicOracleV1NamespacedDomainStatusValidateBeforeCall( name, namespace, pretty, null, null); Type localVarReturnType = new TypeToken<Domain>() {}.getType(); return apiClient.execute(call, localVarReturnType); } /** * (asynchronously) read status of the specified Domain * * @param name name of the Domain (required) * @param namespace object name and auth scope, such as for teams and projects (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @param callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ public com.squareup.okhttp.Call readWebLogicOracleV1NamespacedDomainStatusAsync( String name, String namespace, String pretty, final ApiCallback<Domain> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = (bytesRead, contentLength, done) -> callback.onDownloadProgress(bytesRead, contentLength, done); progressRequestListener = (bytesWritten, contentLength, done) -> callback.onUploadProgress(bytesWritten, contentLength, done); } com.squareup.okhttp.Call call = readWebLogicOracleV1NamespacedDomainStatusValidateBeforeCall( name, namespace, pretty, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<Domain>() {}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /** * Build call for replaceWebLogicOracleV1NamespacedDomain * * @param name name of the Domain (required) * @param namespace object name and auth scope, such as for teams and projects (required) * @param body (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @param progressListener Progress listener * @param progressRequestListener Progress request listener * @return Call to execute * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call replaceWebLogicOracleV1NamespacedDomainCall( String name, String namespace, Domain body, String pretty, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // create path and map variables String localVarPath = "/apis/weblogic.oracle/v1/namespaces/{namespace}/domains/{name}" .replaceAll("\\{" + "name" + "\\}", apiClient.escapeString(name)) .replaceAll("\\{" + "namespace" + "\\}", apiClient.escapeString(namespace)); List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); if (pretty != null) localVarQueryParams.addAll(apiClient.parameterToPair("pretty", pretty)); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json", "application/yaml", "application/vnd.kubernetes.protobuf" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = {"*/*"}; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { apiClient .getHttpClient() .networkInterceptors() .add( chain -> { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse .newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); }); } String[] localVarAuthNames = new String[] {"BearerToken"}; return apiClient.buildCall( localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } private com.squareup.okhttp.Call replaceWebLogicOracleV1NamespacedDomainValidateBeforeCall( String name, String namespace, Domain body, String pretty, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'name' is set if (name == null) { throw new ApiException( "Missing the required parameter 'name' when calling replaceWebLogicOracleV1NamespacedDomain(Async)"); } // verify the required parameter 'namespace' is set if (namespace == null) { throw new ApiException( "Missing the required parameter 'namespace' when calling replaceWebLogicOracleV1NamespacedDomain(Async)"); } // verify the required parameter 'body' is set if (body == null) { throw new ApiException( "Missing the required parameter 'body' when calling replaceWebLogicOracleV1NamespacedDomain(Async)"); } com.squareup.okhttp.Call call = replaceWebLogicOracleV1NamespacedDomainCall( name, namespace, body, pretty, progressListener, progressRequestListener); return call; } /** * replace the specified Domain * * @param name name of the Domain (required) * @param namespace object name and auth scope, such as for teams and projects (required) * @param body (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @return Domain * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ public Domain replaceWebLogicOracleV1NamespacedDomain( String name, String namespace, Domain body, String pretty) throws ApiException { ApiResponse<Domain> resp = replaceWebLogicOracleV1NamespacedDomainWithHttpInfo(name, namespace, body, pretty); return resp.getData(); } /** * replace the specified Domain * * @param name name of the Domain (required) * @param namespace object name and auth scope, such as for teams and projects (required) * @param body (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @return ApiResponse&lt;Domain&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ public ApiResponse<Domain> replaceWebLogicOracleV1NamespacedDomainWithHttpInfo( String name, String namespace, Domain body, String pretty) throws ApiException { com.squareup.okhttp.Call call = replaceWebLogicOracleV1NamespacedDomainValidateBeforeCall( name, namespace, body, pretty, null, null); Type localVarReturnType = new TypeToken<Domain>() {}.getType(); return apiClient.execute(call, localVarReturnType); } /** * (asynchronously) replace the specified Domain * * @param name name of the Domain (required) * @param namespace object name and auth scope, such as for teams and projects (required) * @param body (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @param callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ public com.squareup.okhttp.Call replaceWebLogicOracleV1NamespacedDomainAsync( String name, String namespace, Domain body, String pretty, final ApiCallback<Domain> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = (bytesRead, contentLength, done) -> callback.onDownloadProgress(bytesRead, contentLength, done); progressRequestListener = (bytesWritten, contentLength, done) -> callback.onUploadProgress(bytesWritten, contentLength, done); } com.squareup.okhttp.Call call = replaceWebLogicOracleV1NamespacedDomainValidateBeforeCall( name, namespace, body, pretty, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<Domain>() {}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /** * Build call for replaceWebLogicOracleV1NamespacedDomainScale * * @param name name of the Scale (required) * @param namespace object name and auth scope, such as for teams and projects (required) * @param body (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @param progressListener Progress listener * @param progressRequestListener Progress request listener * @return Call to execute * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call replaceWebLogicOracleV1NamespacedDomainScaleCall( String name, String namespace, V1Scale body, String pretty, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // create path and map variables String localVarPath = "/apis/weblogic.oracle/v1/namespaces/{namespace}/domains/{name}/scale" .replaceAll("\\{" + "name" + "\\}", apiClient.escapeString(name)) .replaceAll("\\{" + "namespace" + "\\}", apiClient.escapeString(namespace)); List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); if (pretty != null) localVarQueryParams.addAll(apiClient.parameterToPair("pretty", pretty)); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json", "application/yaml", "application/vnd.kubernetes.protobuf" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = {"*/*"}; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { apiClient .getHttpClient() .networkInterceptors() .add( chain -> { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse .newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); }); } String[] localVarAuthNames = new String[] {"BearerToken"}; return apiClient.buildCall( localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } private com.squareup.okhttp.Call replaceWebLogicOracleV1NamespacedDomainScaleValidateBeforeCall( String name, String namespace, V1Scale body, String pretty, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'name' is set if (name == null) { throw new ApiException( "Missing the required parameter 'name' when calling replaceWebLogicOracleV1NamespacedDomainScale(Async)"); } // verify the required parameter 'namespace' is set if (namespace == null) { throw new ApiException( "Missing the required parameter 'namespace' when calling replaceWebLogicOracleV1NamespacedDomainScale(Async)"); } // verify the required parameter 'body' is set if (body == null) { throw new ApiException( "Missing the required parameter 'body' when calling replaceWebLogicOracleV1NamespacedDomainScale(Async)"); } com.squareup.okhttp.Call call = replaceWebLogicOracleV1NamespacedDomainScaleCall( name, namespace, body, pretty, progressListener, progressRequestListener); return call; } /** * replace scale of the specified Domain * * @param name name of the Scale (required) * @param namespace object name and auth scope, such as for teams and projects (required) * @param body (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @return V1Scale * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ public V1Scale replaceWebLogicOracleV1NamespacedDomainScale( String name, String namespace, V1Scale body, String pretty) throws ApiException { ApiResponse<V1Scale> resp = replaceWebLogicOracleV1NamespacedDomainScaleWithHttpInfo(name, namespace, body, pretty); return resp.getData(); } /** * replace scale of the specified Domain * * @param name name of the Scale (required) * @param namespace object name and auth scope, such as for teams and projects (required) * @param body (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @return ApiResponse&lt;V1Scale&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ public ApiResponse<V1Scale> replaceWebLogicOracleV1NamespacedDomainScaleWithHttpInfo( String name, String namespace, V1Scale body, String pretty) throws ApiException { com.squareup.okhttp.Call call = replaceWebLogicOracleV1NamespacedDomainScaleValidateBeforeCall( name, namespace, body, pretty, null, null); Type localVarReturnType = new TypeToken<V1Scale>() {}.getType(); return apiClient.execute(call, localVarReturnType); } /** * (asynchronously) replace scale of the specified Domain * * @param name name of the Scale (required) * @param namespace object name and auth scope, such as for teams and projects (required) * @param body (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @param callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ public com.squareup.okhttp.Call replaceWebLogicOracleV1NamespacedDomainScaleAsync( String name, String namespace, V1Scale body, String pretty, final ApiCallback<V1Scale> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = (bytesRead, contentLength, done) -> callback.onDownloadProgress(bytesRead, contentLength, done); progressRequestListener = (bytesWritten, contentLength, done) -> callback.onUploadProgress(bytesWritten, contentLength, done); } com.squareup.okhttp.Call call = replaceWebLogicOracleV1NamespacedDomainScaleValidateBeforeCall( name, namespace, body, pretty, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<V1Scale>() {}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /** * Build call for replaceWebLogicOracleV1NamespacedDomainStatus * * @param name name of the Domain (required) * @param namespace object name and auth scope, such as for teams and projects (required) * @param body (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @param progressListener Progress listener * @param progressRequestListener Progress request listener * @return Call to execute * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call replaceWebLogicOracleV1NamespacedDomainStatusCall( String name, String namespace, Domain body, String pretty, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // create path and map variables String localVarPath = "/apis/weblogic.oracle/v1/namespaces/{namespace}/domains/{name}/status" .replaceAll("\\{" + "name" + "\\}", apiClient.escapeString(name)) .replaceAll("\\{" + "namespace" + "\\}", apiClient.escapeString(namespace)); List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); if (pretty != null) localVarQueryParams.addAll(apiClient.parameterToPair("pretty", pretty)); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json", "application/yaml", "application/vnd.kubernetes.protobuf" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = {"*/*"}; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { apiClient .getHttpClient() .networkInterceptors() .add( chain -> { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse .newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); }); } String[] localVarAuthNames = new String[] {"BearerToken"}; return apiClient.buildCall( localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } private com.squareup.okhttp.Call replaceWebLogicOracleV1NamespacedDomainStatusValidateBeforeCall( String name, String namespace, Domain body, String pretty, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'name' is set if (name == null) { throw new ApiException( "Missing the required parameter 'name' when calling replaceWebLogicOracleV1NamespacedDomainStatus(Async)"); } // verify the required parameter 'namespace' is set if (namespace == null) { throw new ApiException( "Missing the required parameter 'namespace' when calling replaceWebLogicOracleV1NamespacedDomainStatus(Async)"); } // verify the required parameter 'body' is set if (body == null) { throw new ApiException( "Missing the required parameter 'body' when calling replaceWebLogicOracleV1NamespacedDomainStatus(Async)"); } com.squareup.okhttp.Call call = replaceWebLogicOracleV1NamespacedDomainStatusCall( name, namespace, body, pretty, progressListener, progressRequestListener); return call; } /** * replace status of the specified Domain * * @param name name of the Domain (required) * @param namespace object name and auth scope, such as for teams and projects (required) * @param body (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @return Domain * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ public Domain replaceWebLogicOracleV1NamespacedDomainStatus( String name, String namespace, Domain body, String pretty) throws ApiException { ApiResponse<Domain> resp = replaceWebLogicOracleV1NamespacedDomainStatusWithHttpInfo(name, namespace, body, pretty); return resp.getData(); } /** * replace status of the specified Domain * * @param name name of the Domain (required) * @param namespace object name and auth scope, such as for teams and projects (required) * @param body (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @return ApiResponse&lt;Domain&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ public ApiResponse<Domain> replaceWebLogicOracleV1NamespacedDomainStatusWithHttpInfo( String name, String namespace, Domain body, String pretty) throws ApiException { com.squareup.okhttp.Call call = replaceWebLogicOracleV1NamespacedDomainStatusValidateBeforeCall( name, namespace, body, pretty, null, null); Type localVarReturnType = new TypeToken<Domain>() {}.getType(); return apiClient.execute(call, localVarReturnType); } /** * (asynchronously) replace status of the specified Domain * * @param name name of the Domain (required) * @param namespace object name and auth scope, such as for teams and projects (required) * @param body (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @param callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ public com.squareup.okhttp.Call replaceWebLogicOracleV1NamespacedDomainStatusAsync( String name, String namespace, Domain body, String pretty, final ApiCallback<Domain> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = (bytesRead, contentLength, done) -> callback.onDownloadProgress(bytesRead, contentLength, done); progressRequestListener = (bytesWritten, contentLength, done) -> callback.onUploadProgress(bytesWritten, contentLength, done); } com.squareup.okhttp.Call call = replaceWebLogicOracleV1NamespacedDomainStatusValidateBeforeCall( name, namespace, body, pretty, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<Domain>() {}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /** * Build call for watchWebLogicOracleV1DomainListForAllNamespaces * * @param _continue The continue option should be set when retrieving more results from the * server. Since this value is server defined, clients may only use the continue value from a * previous query result with identical query parameters (except for the value of continue) * and the server may reject a continue value it does not recognize. If the specified continue * value is no longer valid whether due to expiration (generally five to fifteen minutes) or a * configuration change on the server the server will respond with a 410 ResourceExpired error * indicating the client must restart their list without the continue field. This field is not * supported when watch is true. Clients may start a watch from the last resourceVersion value * returned by the server and not miss any modifications. (optional) * @param fieldSelector A selector to restrict the list of returned objects by their fields. * Defaults to everything. (optional) * @param includeUninitialized If true, partially initialized resources are included in the * response. (optional) * @param labelSelector A selector to restrict the list of returned objects by their labels. * Defaults to everything. (optional) * @param limit limit is a maximum number of responses to return for a list call. If more items * exist, the server will set the &#x60;continue&#x60; field on the list metadata to a value * that can be used with the same initial query to retrieve the next set of results. Setting a * limit may return fewer than the requested amount of items (up to zero items) in the event * all requested objects are filtered out and clients should only use the presence of the * continue field to determine whether more results are available. Servers may choose not to * support the limit argument and will return all of the available results. If limit is * specified and the continue field is empty, clients may assume that no more results are * available. This field is not supported if watch is true. The server guarantees that the * objects returned when using continue will be identical to issuing a single list call * without a limit - that is, no objects created, modified, or deleted after the first request * is issued will be included in any subsequent continued requests. This is sometimes referred * to as a consistent snapshot, and ensures that a client that is using limit to receive * smaller chunks of a very large result can ensure they see all possible objects. If objects * are updated during a chunked list the version of the object that was present at the time * the first list result was calculated is returned. (optional) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @param resourceVersion When specified with a watch call, shows changes that occur after that * particular version of a resource. Defaults to changes from the beginning of history. When * specified for list: - if unset, then the result is returned from remote storage based on * quorum-read flag; - if it&#39;s 0, then we simply return what we currently have in cache, * no guarantee; - if set to non zero, then the result is at least as fresh as given rv. * (optional) * @param timeoutSeconds Timeout for the list/watch call. (optional) * @param watch Watch for changes to the described resources and return them as a stream of add, * update, and remove notifications. Specify resourceVersion. (optional) * @param progressListener Progress listener * @param progressRequestListener Progress request listener * @return Call to execute * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call watchWebLogicOracleV1DomainListForAllNamespacesCall( String _continue, String fieldSelector, Boolean includeUninitialized, String labelSelector, Integer limit, String pretty, String resourceVersion, Integer timeoutSeconds, Boolean watch, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/apis/weblogic.oracle/v1/watch/domains"; List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); if (_continue != null) { localVarQueryParams.addAll(apiClient.parameterToPair("continue", _continue)); } if (fieldSelector != null) { localVarQueryParams.addAll(apiClient.parameterToPair("fieldSelector", fieldSelector)); } if (includeUninitialized != null) { localVarQueryParams.addAll( apiClient.parameterToPair("includeUninitialized", includeUninitialized)); } if (labelSelector != null) { localVarQueryParams.addAll(apiClient.parameterToPair("labelSelector", labelSelector)); } if (limit != null) { localVarQueryParams.addAll(apiClient.parameterToPair("limit", limit)); } if (pretty != null) { localVarQueryParams.addAll(apiClient.parameterToPair("pretty", pretty)); } if (resourceVersion != null) { localVarQueryParams.addAll(apiClient.parameterToPair("resourceVersion", resourceVersion)); } if (timeoutSeconds != null) { localVarQueryParams.addAll(apiClient.parameterToPair("timeoutSeconds", timeoutSeconds)); } if (watch != null) { localVarQueryParams.addAll(apiClient.parameterToPair("watch", watch)); } Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json", "application/yaml", "application/vnd.kubernetes.protobuf", "application/json;stream=watch", "application/vnd.kubernetes.protobuf;stream=watch" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = {"*/*"}; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { apiClient .getHttpClient() .networkInterceptors() .add( chain -> { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse .newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); }); } String[] localVarAuthNames = new String[] {"BearerToken"}; return apiClient.buildCall( localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } private com.squareup.okhttp.Call watchWebLogicOracleV1DomainListForAllNamespacesValidateBeforeCall( String _continue, String fieldSelector, Boolean includeUninitialized, String labelSelector, Integer limit, String pretty, String resourceVersion, Integer timeoutSeconds, Boolean watch, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { com.squareup.okhttp.Call call = watchWebLogicOracleV1DomainListForAllNamespacesCall( _continue, fieldSelector, includeUninitialized, labelSelector, limit, pretty, resourceVersion, timeoutSeconds, watch, progressListener, progressRequestListener); return call; } /** * watch individual changes to a list of Domain * * @param _continue The continue option should be set when retrieving more results from the * server. Since this value is server defined, clients may only use the continue value from a * previous query result with identical query parameters (except for the value of continue) * and the server may reject a continue value it does not recognize. If the specified continue * value is no longer valid whether due to expiration (generally five to fifteen minutes) or a * configuration change on the server the server will respond with a 410 ResourceExpired error * indicating the client must restart their list without the continue field. This field is not * supported when watch is true. Clients may start a watch from the last resourceVersion value * returned by the server and not miss any modifications. (optional) * @param fieldSelector A selector to restrict the list of returned objects by their fields. * Defaults to everything. (optional) * @param includeUninitialized If true, partially initialized resources are included in the * response. (optional) * @param labelSelector A selector to restrict the list of returned objects by their labels. * Defaults to everything. (optional) * @param limit limit is a maximum number of responses to return for a list call. If more items * exist, the server will set the &#x60;continue&#x60; field on the list metadata to a value * that can be used with the same initial query to retrieve the next set of results. Setting a * limit may return fewer than the requested amount of items (up to zero items) in the event * all requested objects are filtered out and clients should only use the presence of the * continue field to determine whether more results are available. Servers may choose not to * support the limit argument and will return all of the available results. If limit is * specified and the continue field is empty, clients may assume that no more results are * available. This field is not supported if watch is true. The server guarantees that the * objects returned when using continue will be identical to issuing a single list call * without a limit - that is, no objects created, modified, or deleted after the first request * is issued will be included in any subsequent continued requests. This is sometimes referred * to as a consistent snapshot, and ensures that a client that is using limit to receive * smaller chunks of a very large result can ensure they see all possible objects. If objects * are updated during a chunked list the version of the object that was present at the time * the first list result was calculated is returned. (optional) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @param resourceVersion When specified with a watch call, shows changes that occur after that * particular version of a resource. Defaults to changes from the beginning of history. When * specified for list: - if unset, then the result is returned from remote storage based on * quorum-read flag; - if it&#39;s 0, then we simply return what we currently have in cache, * no guarantee; - if set to non zero, then the result is at least as fresh as given rv. * (optional) * @param timeoutSeconds Timeout for the list/watch call. (optional) * @param watch Watch for changes to the described resources and return them as a stream of add, * update, and remove notifications. Specify resourceVersion. (optional) * @return V1WatchEvent * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ public V1WatchEvent watchWebLogicOracleV1DomainListForAllNamespaces( String _continue, String fieldSelector, Boolean includeUninitialized, String labelSelector, Integer limit, String pretty, String resourceVersion, Integer timeoutSeconds, Boolean watch) throws ApiException { ApiResponse<V1WatchEvent> resp = watchWebLogicOracleV1DomainListForAllNamespacesWithHttpInfo( _continue, fieldSelector, includeUninitialized, labelSelector, limit, pretty, resourceVersion, timeoutSeconds, watch); return resp.getData(); } /** * watch individual changes to a list of Domain * * @param _continue The continue option should be set when retrieving more results from the * server. Since this value is server defined, clients may only use the continue value from a * previous query result with identical query parameters (except for the value of continue) * and the server may reject a continue value it does not recognize. If the specified continue * value is no longer valid whether due to expiration (generally five to fifteen minutes) or a * configuration change on the server the server will respond with a 410 ResourceExpired error * indicating the client must restart their list without the continue field. This field is not * supported when watch is true. Clients may start a watch from the last resourceVersion value * returned by the server and not miss any modifications. (optional) * @param fieldSelector A selector to restrict the list of returned objects by their fields. * Defaults to everything. (optional) * @param includeUninitialized If true, partially initialized resources are included in the * response. (optional) * @param labelSelector A selector to restrict the list of returned objects by their labels. * Defaults to everything. (optional) * @param limit limit is a maximum number of responses to return for a list call. If more items * exist, the server will set the &#x60;continue&#x60; field on the list metadata to a value * that can be used with the same initial query to retrieve the next set of results. Setting a * limit may return fewer than the requested amount of items (up to zero items) in the event * all requested objects are filtered out and clients should only use the presence of the * continue field to determine whether more results are available. Servers may choose not to * support the limit argument and will return all of the available results. If limit is * specified and the continue field is empty, clients may assume that no more results are * available. This field is not supported if watch is true. The server guarantees that the * objects returned when using continue will be identical to issuing a single list call * without a limit - that is, no objects created, modified, or deleted after the first request * is issued will be included in any subsequent continued requests. This is sometimes referred * to as a consistent snapshot, and ensures that a client that is using limit to receive * smaller chunks of a very large result can ensure they see all possible objects. If objects * are updated during a chunked list the version of the object that was present at the time * the first list result was calculated is returned. (optional) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @param resourceVersion When specified with a watch call, shows changes that occur after that * particular version of a resource. Defaults to changes from the beginning of history. When * specified for list: - if unset, then the result is returned from remote storage based on * quorum-read flag; - if it&#39;s 0, then we simply return what we currently have in cache, * no guarantee; - if set to non zero, then the result is at least as fresh as given rv. * (optional) * @param timeoutSeconds Timeout for the list/watch call. (optional) * @param watch Watch for changes to the described resources and return them as a stream of add, * update, and remove notifications. Specify resourceVersion. (optional) * @return ApiResponse&lt;V1WatchEvent&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ public ApiResponse<V1WatchEvent> watchWebLogicOracleV1DomainListForAllNamespacesWithHttpInfo( String _continue, String fieldSelector, Boolean includeUninitialized, String labelSelector, Integer limit, String pretty, String resourceVersion, Integer timeoutSeconds, Boolean watch) throws ApiException { com.squareup.okhttp.Call call = watchWebLogicOracleV1DomainListForAllNamespacesValidateBeforeCall( _continue, fieldSelector, includeUninitialized, labelSelector, limit, pretty, resourceVersion, timeoutSeconds, watch, null, null); Type localVarReturnType = new TypeToken<V1WatchEvent>() {}.getType(); return apiClient.execute(call, localVarReturnType); } /** * (asynchronously) watch individual changes to a list of Domain * * @param _continue The continue option should be set when retrieving more results from the * server. Since this value is server defined, clients may only use the continue value from a * previous query result with identical query parameters (except for the value of continue) * and the server may reject a continue value it does not recognize. If the specified continue * value is no longer valid whether due to expiration (generally five to fifteen minutes) or a * configuration change on the server the server will respond with a 410 ResourceExpired error * indicating the client must restart their list without the continue field. This field is not * supported when watch is true. Clients may start a watch from the last resourceVersion value * returned by the server and not miss any modifications. (optional) * @param fieldSelector A selector to restrict the list of returned objects by their fields. * Defaults to everything. (optional) * @param includeUninitialized If true, partially initialized resources are included in the * response. (optional) * @param labelSelector A selector to restrict the list of returned objects by their labels. * Defaults to everything. (optional) * @param limit limit is a maximum number of responses to return for a list call. If more items * exist, the server will set the &#x60;continue&#x60; field on the list metadata to a value * that can be used with the same initial query to retrieve the next set of results. Setting a * limit may return fewer than the requested amount of items (up to zero items) in the event * all requested objects are filtered out and clients should only use the presence of the * continue field to determine whether more results are available. Servers may choose not to * support the limit argument and will return all of the available results. If limit is * specified and the continue field is empty, clients may assume that no more results are * available. This field is not supported if watch is true. The server guarantees that the * objects returned when using continue will be identical to issuing a single list call * without a limit - that is, no objects created, modified, or deleted after the first request * is issued will be included in any subsequent continued requests. This is sometimes referred * to as a consistent snapshot, and ensures that a client that is using limit to receive * smaller chunks of a very large result can ensure they see all possible objects. If objects * are updated during a chunked list the version of the object that was present at the time * the first list result was calculated is returned. (optional) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @param resourceVersion When specified with a watch call, shows changes that occur after that * particular version of a resource. Defaults to changes from the beginning of history. When * specified for list: - if unset, then the result is returned from remote storage based on * quorum-read flag; - if it&#39;s 0, then we simply return what we currently have in cache, * no guarantee; - if set to non zero, then the result is at least as fresh as given rv. * (optional) * @param timeoutSeconds Timeout for the list/watch call. (optional) * @param watch Watch for changes to the described resources and return them as a stream of add, * update, and remove notifications. Specify resourceVersion. (optional) * @param callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ public com.squareup.okhttp.Call watchWebLogicOracleV1DomainListForAllNamespacesAsync( String _continue, String fieldSelector, Boolean includeUninitialized, String labelSelector, Integer limit, String pretty, String resourceVersion, Integer timeoutSeconds, Boolean watch, final ApiCallback<V1WatchEvent> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = (bytesRead, contentLength, done) -> callback.onDownloadProgress(bytesRead, contentLength, done); progressRequestListener = (bytesWritten, contentLength, done) -> callback.onUploadProgress(bytesWritten, contentLength, done); } com.squareup.okhttp.Call call = watchWebLogicOracleV1DomainListForAllNamespacesValidateBeforeCall( _continue, fieldSelector, includeUninitialized, labelSelector, limit, pretty, resourceVersion, timeoutSeconds, watch, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<V1WatchEvent>() {}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /** * Build call for watchWebLogicOracleV1NamespacedDomain * * @param name name of the Pod (required) * @param namespace object name and auth scope, such as for teams and projects (required) * @param _continue The continue option should be set when retrieving more results from the * server. Since this value is server defined, clients may only use the continue value from a * previous query result with identical query parameters (except for the value of continue) * and the server may reject a continue value it does not recognize. If the specified continue * value is no longer valid whether due to expiration (generally five to fifteen minutes) or a * configuration change on the server the server will respond with a 410 ResourceExpired error * indicating the client must restart their list without the continue field. This field is not * supported when watch is true. Clients may start a watch from the last resourceVersion value * returned by the server and not miss any modifications. (optional) * @param fieldSelector A selector to restrict the list of returned objects by their fields. * Defaults to everything. (optional) * @param includeUninitialized If true, partially initialized resources are included in the * response. (optional) * @param labelSelector A selector to restrict the list of returned objects by their labels. * Defaults to everything. (optional) * @param limit limit is a maximum number of responses to return for a list call. If more items * exist, the server will set the &#x60;continue&#x60; field on the list metadata to a value * that can be used with the same initial query to retrieve the next set of results. Setting a * limit may return fewer than the requested amount of items (up to zero items) in the event * all requested objects are filtered out and clients should only use the presence of the * continue field to determine whether more results are available. Servers may choose not to * support the limit argument and will return all of the available results. If limit is * specified and the continue field is empty, clients may assume that no more results are * available. This field is not supported if watch is true. The server guarantees that the * objects returned when using continue will be identical to issuing a single list call * without a limit - that is, no objects created, modified, or deleted after the first request * is issued will be included in any subsequent continued requests. This is sometimes referred * to as a consistent snapshot, and ensures that a client that is using limit to receive * smaller chunks of a very large result can ensure they see all possible objects. If objects * are updated during a chunked list the version of the object that was present at the time * the first list result was calculated is returned. (optional) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @param resourceVersion When specified with a watch call, shows changes that occur after that * particular version of a resource. Defaults to changes from the beginning of history. When * specified for list: - if unset, then the result is returned from remote storage based on * quorum-read flag; - if it&#39;s 0, then we simply return what we currently have in cache, * no guarantee; - if set to non zero, then the result is at least as fresh as given rv. * (optional) * @param timeoutSeconds Timeout for the list/watch call. (optional) * @param watch Watch for changes to the described resources and return them as a stream of add, * update, and remove notifications. Specify resourceVersion. (optional) * @param progressListener Progress listener * @param progressRequestListener Progress request listener * @return Call to execute * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call watchWebLogicOracleV1NamespacedDomainCall( String name, String namespace, String _continue, String fieldSelector, Boolean includeUninitialized, String labelSelector, Integer limit, String pretty, String resourceVersion, Integer timeoutSeconds, Boolean watch, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/apis/weblogic.oracle/v1/watch/namespaces/{namespace}/domains/{name}" .replaceAll("\\{" + "name" + "\\}", apiClient.escapeString(name)) .replaceAll("\\{" + "namespace" + "\\}", apiClient.escapeString(namespace)); List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); if (_continue != null) { localVarQueryParams.addAll(apiClient.parameterToPair("continue", _continue)); } if (fieldSelector != null) { localVarQueryParams.addAll(apiClient.parameterToPair("fieldSelector", fieldSelector)); } if (includeUninitialized != null) { localVarQueryParams.addAll( apiClient.parameterToPair("includeUninitialized", includeUninitialized)); } if (labelSelector != null) { localVarQueryParams.addAll(apiClient.parameterToPair("labelSelector", labelSelector)); } if (limit != null) { localVarQueryParams.addAll(apiClient.parameterToPair("limit", limit)); } if (pretty != null) { localVarQueryParams.addAll(apiClient.parameterToPair("pretty", pretty)); } if (resourceVersion != null) { localVarQueryParams.addAll(apiClient.parameterToPair("resourceVersion", resourceVersion)); } if (timeoutSeconds != null) { localVarQueryParams.addAll(apiClient.parameterToPair("timeoutSeconds", timeoutSeconds)); } if (watch != null) { localVarQueryParams.addAll(apiClient.parameterToPair("watch", watch)); } Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json", "application/yaml", "application/vnd.kubernetes.protobuf", "application/json;stream=watch", "application/vnd.kubernetes.protobuf;stream=watch" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = {"*/*"}; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { apiClient .getHttpClient() .networkInterceptors() .add( chain -> { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse .newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); }); } String[] localVarAuthNames = new String[] {"BearerToken"}; return apiClient.buildCall( localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } private com.squareup.okhttp.Call watchWebLogicOracleV1NamespacedDomainValidateBeforeCall( String name, String namespace, String _continue, String fieldSelector, Boolean includeUninitialized, String labelSelector, Integer limit, String pretty, String resourceVersion, Integer timeoutSeconds, Boolean watch, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'name' is set if (name == null) { throw new ApiException( "Missing the required parameter 'name' when calling watchWebLogicOracleV1NamespacedDomain(Async)"); } // verify the required parameter 'namespace' is set if (namespace == null) { throw new ApiException( "Missing the required parameter 'namespace' when calling watchWebLogicOracleV1NamespacedDomain(Async)"); } com.squareup.okhttp.Call call = watchWebLogicOracleV1NamespacedDomainCall( name, namespace, _continue, fieldSelector, includeUninitialized, labelSelector, limit, pretty, resourceVersion, timeoutSeconds, watch, progressListener, progressRequestListener); return call; } /** * watch changes to an object of kind Domain * * @param name name of the Pod (required) * @param namespace object name and auth scope, such as for teams and projects (required) * @param _continue The continue option should be set when retrieving more results from the * server. Since this value is server defined, clients may only use the continue value from a * previous query result with identical query parameters (except for the value of continue) * and the server may reject a continue value it does not recognize. If the specified continue * value is no longer valid whether due to expiration (generally five to fifteen minutes) or a * configuration change on the server the server will respond with a 410 ResourceExpired error * indicating the client must restart their list without the continue field. This field is not * supported when watch is true. Clients may start a watch from the last resourceVersion value * returned by the server and not miss any modifications. (optional) * @param fieldSelector A selector to restrict the list of returned objects by their fields. * Defaults to everything. (optional) * @param includeUninitialized If true, partially initialized resources are included in the * response. (optional) * @param labelSelector A selector to restrict the list of returned objects by their labels. * Defaults to everything. (optional) * @param limit limit is a maximum number of responses to return for a list call. If more items * exist, the server will set the &#x60;continue&#x60; field on the list metadata to a value * that can be used with the same initial query to retrieve the next set of results. Setting a * limit may return fewer than the requested amount of items (up to zero items) in the event * all requested objects are filtered out and clients should only use the presence of the * continue field to determine whether more results are available. Servers may choose not to * support the limit argument and will return all of the available results. If limit is * specified and the continue field is empty, clients may assume that no more results are * available. This field is not supported if watch is true. The server guarantees that the * objects returned when using continue will be identical to issuing a single list call * without a limit - that is, no objects created, modified, or deleted after the first request * is issued will be included in any subsequent continued requests. This is sometimes referred * to as a consistent snapshot, and ensures that a client that is using limit to receive * smaller chunks of a very large result can ensure they see all possible objects. If objects * are updated during a chunked list the version of the object that was present at the time * the first list result was calculated is returned. (optional) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @param resourceVersion When specified with a watch call, shows changes that occur after that * particular version of a resource. Defaults to changes from the beginning of history. When * specified for list: - if unset, then the result is returned from remote storage based on * quorum-read flag; - if it&#39;s 0, then we simply return what we currently have in cache, * no guarantee; - if set to non zero, then the result is at least as fresh as given rv. * (optional) * @param timeoutSeconds Timeout for the list/watch call. (optional) * @param watch Watch for changes to the described resources and return them as a stream of add, * update, and remove notifications. Specify resourceVersion. (optional) * @return V1WatchEvent * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ public V1WatchEvent watchWebLogicOracleV1NamespacedDomain( String name, String namespace, String _continue, String fieldSelector, Boolean includeUninitialized, String labelSelector, Integer limit, String pretty, String resourceVersion, Integer timeoutSeconds, Boolean watch) throws ApiException { ApiResponse<V1WatchEvent> resp = watchWebLogicOracleV1NamespacedDomainWithHttpInfo( name, namespace, _continue, fieldSelector, includeUninitialized, labelSelector, limit, pretty, resourceVersion, timeoutSeconds, watch); return resp.getData(); } /** * watch changes to an object of kind Domain * * @param name name of the Pod (required) * @param namespace object name and auth scope, such as for teams and projects (required) * @param _continue The continue option should be set when retrieving more results from the * server. Since this value is server defined, clients may only use the continue value from a * previous query result with identical query parameters (except for the value of continue) * and the server may reject a continue value it does not recognize. If the specified continue * value is no longer valid whether due to expiration (generally five to fifteen minutes) or a * configuration change on the server the server will respond with a 410 ResourceExpired error * indicating the client must restart their list without the continue field. This field is not * supported when watch is true. Clients may start a watch from the last resourceVersion value * returned by the server and not miss any modifications. (optional) * @param fieldSelector A selector to restrict the list of returned objects by their fields. * Defaults to everything. (optional) * @param includeUninitialized If true, partially initialized resources are included in the * response. (optional) * @param labelSelector A selector to restrict the list of returned objects by their labels. * Defaults to everything. (optional) * @param limit limit is a maximum number of responses to return for a list call. If more items * exist, the server will set the &#x60;continue&#x60; field on the list metadata to a value * that can be used with the same initial query to retrieve the next set of results. Setting a * limit may return fewer than the requested amount of items (up to zero items) in the event * all requested objects are filtered out and clients should only use the presence of the * continue field to determine whether more results are available. Servers may choose not to * support the limit argument and will return all of the available results. If limit is * specified and the continue field is empty, clients may assume that no more results are * available. This field is not supported if watch is true. The server guarantees that the * objects returned when using continue will be identical to issuing a single list call * without a limit - that is, no objects created, modified, or deleted after the first request * is issued will be included in any subsequent continued requests. This is sometimes referred * to as a consistent snapshot, and ensures that a client that is using limit to receive * smaller chunks of a very large result can ensure they see all possible objects. If objects * are updated during a chunked list the version of the object that was present at the time * the first list result was calculated is returned. (optional) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @param resourceVersion When specified with a watch call, shows changes that occur after that * particular version of a resource. Defaults to changes from the beginning of history. When * specified for list: - if unset, then the result is returned from remote storage based on * quorum-read flag; - if it&#39;s 0, then we simply return what we currently have in cache, * no guarantee; - if set to non zero, then the result is at least as fresh as given rv. * (optional) * @param timeoutSeconds Timeout for the list/watch call. (optional) * @param watch Watch for changes to the described resources and return them as a stream of add, * update, and remove notifications. Specify resourceVersion. (optional) * @return ApiResponse&lt;V1WatchEvent&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ public ApiResponse<V1WatchEvent> watchWebLogicOracleV1NamespacedDomainWithHttpInfo( String name, String namespace, String _continue, String fieldSelector, Boolean includeUninitialized, String labelSelector, Integer limit, String pretty, String resourceVersion, Integer timeoutSeconds, Boolean watch) throws ApiException { com.squareup.okhttp.Call call = watchWebLogicOracleV1NamespacedDomainValidateBeforeCall( name, namespace, _continue, fieldSelector, includeUninitialized, labelSelector, limit, pretty, resourceVersion, timeoutSeconds, watch, null, null); Type localVarReturnType = new TypeToken<V1WatchEvent>() {}.getType(); return apiClient.execute(call, localVarReturnType); } /** * (asynchronously) watch changes to an object of kind Domain * * @param name name of the Pod (required) * @param namespace object name and auth scope, such as for teams and projects (required) * @param _continue The continue option should be set when retrieving more results from the * server. Since this value is server defined, clients may only use the continue value from a * previous query result with identical query parameters (except for the value of continue) * and the server may reject a continue value it does not recognize. If the specified continue * value is no longer valid whether due to expiration (generally five to fifteen minutes) or a * configuration change on the server the server will respond with a 410 ResourceExpired error * indicating the client must restart their list without the continue field. This field is not * supported when watch is true. Clients may start a watch from the last resourceVersion value * returned by the server and not miss any modifications. (optional) * @param fieldSelector A selector to restrict the list of returned objects by their fields. * Defaults to everything. (optional) * @param includeUninitialized If true, partially initialized resources are included in the * response. (optional) * @param labelSelector A selector to restrict the list of returned objects by their labels. * Defaults to everything. (optional) * @param limit limit is a maximum number of responses to return for a list call. If more items * exist, the server will set the &#x60;continue&#x60; field on the list metadata to a value * that can be used with the same initial query to retrieve the next set of results. Setting a * limit may return fewer than the requested amount of items (up to zero items) in the event * all requested objects are filtered out and clients should only use the presence of the * continue field to determine whether more results are available. Servers may choose not to * support the limit argument and will return all of the available results. If limit is * specified and the continue field is empty, clients may assume that no more results are * available. This field is not supported if watch is true. The server guarantees that the * objects returned when using continue will be identical to issuing a single list call * without a limit - that is, no objects created, modified, or deleted after the first request * is issued will be included in any subsequent continued requests. This is sometimes referred * to as a consistent snapshot, and ensures that a client that is using limit to receive * smaller chunks of a very large result can ensure they see all possible objects. If objects * are updated during a chunked list the version of the object that was present at the time * the first list result was calculated is returned. (optional) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @param resourceVersion When specified with a watch call, shows changes that occur after that * particular version of a resource. Defaults to changes from the beginning of history. When * specified for list: - if unset, then the result is returned from remote storage based on * quorum-read flag; - if it&#39;s 0, then we simply return what we currently have in cache, * no guarantee; - if set to non zero, then the result is at least as fresh as given rv. * (optional) * @param timeoutSeconds Timeout for the list/watch call. (optional) * @param watch Watch for changes to the described resources and return them as a stream of add, * update, and remove notifications. Specify resourceVersion. (optional) * @param callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ public com.squareup.okhttp.Call watchWebLogicOracleV1NamespacedDomainAsync( String name, String namespace, String _continue, String fieldSelector, Boolean includeUninitialized, String labelSelector, Integer limit, String pretty, String resourceVersion, Integer timeoutSeconds, Boolean watch, final ApiCallback<V1WatchEvent> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = (bytesRead, contentLength, done) -> callback.onDownloadProgress(bytesRead, contentLength, done); progressRequestListener = (bytesWritten, contentLength, done) -> callback.onUploadProgress(bytesWritten, contentLength, done); } com.squareup.okhttp.Call call = watchWebLogicOracleV1NamespacedDomainValidateBeforeCall( name, namespace, _continue, fieldSelector, includeUninitialized, labelSelector, limit, pretty, resourceVersion, timeoutSeconds, watch, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<V1WatchEvent>() {}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /** * Build call for watchWebLogicOracleV1NamespacedDomainList * * @param namespace object name and auth scope, such as for teams and projects (required) * @param _continue The continue option should be set when retrieving more results from the * server. Since this value is server defined, clients may only use the continue value from a * previous query result with identical query parameters (except for the value of continue) * and the server may reject a continue value it does not recognize. If the specified continue * value is no longer valid whether due to expiration (generally five to fifteen minutes) or a * configuration change on the server the server will respond with a 410 ResourceExpired error * indicating the client must restart their list without the continue field. This field is not * supported when watch is true. Clients may start a watch from the last resourceVersion value * returned by the server and not miss any modifications. (optional) * @param fieldSelector A selector to restrict the list of returned objects by their fields. * Defaults to everything. (optional) * @param includeUninitialized If true, partially initialized resources are included in the * response. (optional) * @param labelSelector A selector to restrict the list of returned objects by their labels. * Defaults to everything. (optional) * @param limit limit is a maximum number of responses to return for a list call. If more items * exist, the server will set the &#x60;continue&#x60; field on the list metadata to a value * that can be used with the same initial query to retrieve the next set of results. Setting a * limit may return fewer than the requested amount of items (up to zero items) in the event * all requested objects are filtered out and clients should only use the presence of the * continue field to determine whether more results are available. Servers may choose not to * support the limit argument and will return all of the available results. If limit is * specified and the continue field is empty, clients may assume that no more results are * available. This field is not supported if watch is true. The server guarantees that the * objects returned when using continue will be identical to issuing a single list call * without a limit - that is, no objects created, modified, or deleted after the first request * is issued will be included in any subsequent continued requests. This is sometimes referred * to as a consistent snapshot, and ensures that a client that is using limit to receive * smaller chunks of a very large result can ensure they see all possible objects. If objects * are updated during a chunked list the version of the object that was present at the time * the first list result was calculated is returned. (optional) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @param resourceVersion When specified with a watch call, shows changes that occur after that * particular version of a resource. Defaults to changes from the beginning of history. When * specified for list: - if unset, then the result is returned from remote storage based on * quorum-read flag; - if it&#39;s 0, then we simply return what we currently have in cache, * no guarantee; - if set to non zero, then the result is at least as fresh as given rv. * (optional) * @param timeoutSeconds Timeout for the list/watch call. (optional) * @param watch Watch for changes to the described resources and return them as a stream of add, * update, and remove notifications. Specify resourceVersion. (optional) * @param progressListener Progress listener * @param progressRequestListener Progress request listener * @return Call to execute * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call watchWebLogicOracleV1NamespacedDomainListCall( String namespace, String _continue, String fieldSelector, Boolean includeUninitialized, String labelSelector, Integer limit, String pretty, String resourceVersion, Integer timeoutSeconds, Boolean watch, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/apis/weblogic.oracle/v1/watch/namespaces/{namespace}/domains" .replaceAll("\\{" + "namespace" + "\\}", apiClient.escapeString(namespace)); List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); if (_continue != null) { localVarQueryParams.addAll(apiClient.parameterToPair("continue", _continue)); } if (fieldSelector != null) { localVarQueryParams.addAll(apiClient.parameterToPair("fieldSelector", fieldSelector)); } if (includeUninitialized != null) { localVarQueryParams.addAll( apiClient.parameterToPair("includeUninitialized", includeUninitialized)); } if (labelSelector != null) { localVarQueryParams.addAll(apiClient.parameterToPair("labelSelector", labelSelector)); } if (limit != null) { localVarQueryParams.addAll(apiClient.parameterToPair("limit", limit)); } if (pretty != null) { localVarQueryParams.addAll(apiClient.parameterToPair("pretty", pretty)); } if (resourceVersion != null) { localVarQueryParams.addAll(apiClient.parameterToPair("resourceVersion", resourceVersion)); } if (timeoutSeconds != null) { localVarQueryParams.addAll(apiClient.parameterToPair("timeoutSeconds", timeoutSeconds)); } if (watch != null) { localVarQueryParams.addAll(apiClient.parameterToPair("watch", watch)); } Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json", "application/yaml", "application/vnd.kubernetes.protobuf", "application/json;stream=watch", "application/vnd.kubernetes.protobuf;stream=watch" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = {"*/*"}; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { apiClient .getHttpClient() .networkInterceptors() .add( chain -> { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse .newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); }); } String[] localVarAuthNames = new String[] {"BearerToken"}; return apiClient.buildCall( localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } private com.squareup.okhttp.Call watchWebLogicOracleV1NamespacedDomainListValidateBeforeCall( String namespace, String _continue, String fieldSelector, Boolean includeUninitialized, String labelSelector, Integer limit, String pretty, String resourceVersion, Integer timeoutSeconds, Boolean watch, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'namespace' is set if (namespace == null) { throw new ApiException( "Missing the required parameter 'namespace' when calling watchWebLogicOracleV1NamespacedDomainList(Async)"); } com.squareup.okhttp.Call call = watchWebLogicOracleV1NamespacedDomainListCall( namespace, _continue, fieldSelector, includeUninitialized, labelSelector, limit, pretty, resourceVersion, timeoutSeconds, watch, progressListener, progressRequestListener); return call; } /** * watch individual changes to a list of Domain * * @param namespace object name and auth scope, such as for teams and projects (required) * @param _continue The continue option should be set when retrieving more results from the * server. Since this value is server defined, clients may only use the continue value from a * previous query result with identical query parameters (except for the value of continue) * and the server may reject a continue value it does not recognize. If the specified continue * value is no longer valid whether due to expiration (generally five to fifteen minutes) or a * configuration change on the server the server will respond with a 410 ResourceExpired error * indicating the client must restart their list without the continue field. This field is not * supported when watch is true. Clients may start a watch from the last resourceVersion value * returned by the server and not miss any modifications. (optional) * @param fieldSelector A selector to restrict the list of returned objects by their fields. * Defaults to everything. (optional) * @param includeUninitialized If true, partially initialized resources are included in the * response. (optional) * @param labelSelector A selector to restrict the list of returned objects by their labels. * Defaults to everything. (optional) * @param limit limit is a maximum number of responses to return for a list call. If more items * exist, the server will set the &#x60;continue&#x60; field on the list metadata to a value * that can be used with the same initial query to retrieve the next set of results. Setting a * limit may return fewer than the requested amount of items (up to zero items) in the event * all requested objects are filtered out and clients should only use the presence of the * continue field to determine whether more results are available. Servers may choose not to * support the limit argument and will return all of the available results. If limit is * specified and the continue field is empty, clients may assume that no more results are * available. This field is not supported if watch is true. The server guarantees that the * objects returned when using continue will be identical to issuing a single list call * without a limit - that is, no objects created, modified, or deleted after the first request * is issued will be included in any subsequent continued requests. This is sometimes referred * to as a consistent snapshot, and ensures that a client that is using limit to receive * smaller chunks of a very large result can ensure they see all possible objects. If objects * are updated during a chunked list the version of the object that was present at the time * the first list result was calculated is returned. (optional) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @param resourceVersion When specified with a watch call, shows changes that occur after that * particular version of a resource. Defaults to changes from the beginning of history. When * specified for list: - if unset, then the result is returned from remote storage based on * quorum-read flag; - if it&#39;s 0, then we simply return what we currently have in cache, * no guarantee; - if set to non zero, then the result is at least as fresh as given rv. * (optional) * @param timeoutSeconds Timeout for the list/watch call. (optional) * @param watch Watch for changes to the described resources and return them as a stream of add, * update, and remove notifications. Specify resourceVersion. (optional) * @return V1WatchEvent * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ public V1WatchEvent watchWebLogicOracleV1NamespacedDomainList( String namespace, String _continue, String fieldSelector, Boolean includeUninitialized, String labelSelector, Integer limit, String pretty, String resourceVersion, Integer timeoutSeconds, Boolean watch) throws ApiException { ApiResponse<V1WatchEvent> resp = watchWebLogicOracleV1NamespacedDomainListWithHttpInfo( namespace, _continue, fieldSelector, includeUninitialized, labelSelector, limit, pretty, resourceVersion, timeoutSeconds, watch); return resp.getData(); } /** * watch individual changes to a list of Domain * * @param namespace object name and auth scope, such as for teams and projects (required) * @param _continue The continue option should be set when retrieving more results from the * server. Since this value is server defined, clients may only use the continue value from a * previous query result with identical query parameters (except for the value of continue) * and the server may reject a continue value it does not recognize. If the specified continue * value is no longer valid whether due to expiration (generally five to fifteen minutes) or a * configuration change on the server the server will respond with a 410 ResourceExpired error * indicating the client must restart their list without the continue field. This field is not * supported when watch is true. Clients may start a watch from the last resourceVersion value * returned by the server and not miss any modifications. (optional) * @param fieldSelector A selector to restrict the list of returned objects by their fields. * Defaults to everything. (optional) * @param includeUninitialized If true, partially initialized resources are included in the * response. (optional) * @param labelSelector A selector to restrict the list of returned objects by their labels. * Defaults to everything. (optional) * @param limit limit is a maximum number of responses to return for a list call. If more items * exist, the server will set the &#x60;continue&#x60; field on the list metadata to a value * that can be used with the same initial query to retrieve the next set of results. Setting a * limit may return fewer than the requested amount of items (up to zero items) in the event * all requested objects are filtered out and clients should only use the presence of the * continue field to determine whether more results are available. Servers may choose not to * support the limit argument and will return all of the available results. If limit is * specified and the continue field is empty, clients may assume that no more results are * available. This field is not supported if watch is true. The server guarantees that the * objects returned when using continue will be identical to issuing a single list call * without a limit - that is, no objects created, modified, or deleted after the first request * is issued will be included in any subsequent continued requests. This is sometimes referred * to as a consistent snapshot, and ensures that a client that is using limit to receive * smaller chunks of a very large result can ensure they see all possible objects. If objects * are updated during a chunked list the version of the object that was present at the time * the first list result was calculated is returned. (optional) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @param resourceVersion When specified with a watch call, shows changes that occur after that * particular version of a resource. Defaults to changes from the beginning of history. When * specified for list: - if unset, then the result is returned from remote storage based on * quorum-read flag; - if it&#39;s 0, then we simply return what we currently have in cache, * no guarantee; - if set to non zero, then the result is at least as fresh as given rv. * (optional) * @param timeoutSeconds Timeout for the list/watch call. (optional) * @param watch Watch for changes to the described resources and return them as a stream of add, * update, and remove notifications. Specify resourceVersion. (optional) * @return ApiResponse&lt;V1WatchEvent&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ public ApiResponse<V1WatchEvent> watchWebLogicOracleV1NamespacedDomainListWithHttpInfo( String namespace, String _continue, String fieldSelector, Boolean includeUninitialized, String labelSelector, Integer limit, String pretty, String resourceVersion, Integer timeoutSeconds, Boolean watch) throws ApiException { com.squareup.okhttp.Call call = watchWebLogicOracleV1NamespacedDomainListValidateBeforeCall( namespace, _continue, fieldSelector, includeUninitialized, labelSelector, limit, pretty, resourceVersion, timeoutSeconds, watch, null, null); Type localVarReturnType = new TypeToken<V1WatchEvent>() {}.getType(); return apiClient.execute(call, localVarReturnType); } /** * (asynchronously) watch individual changes to a list of Domain * * @param namespace object name and auth scope, such as for teams and projects (required) * @param _continue The continue option should be set when retrieving more results from the * server. Since this value is server defined, clients may only use the continue value from a * previous query result with identical query parameters (except for the value of continue) * and the server may reject a continue value it does not recognize. If the specified continue * value is no longer valid whether due to expiration (generally five to fifteen minutes) or a * configuration change on the server the server will respond with a 410 ResourceExpired error * indicating the client must restart their list without the continue field. This field is not * supported when watch is true. Clients may start a watch from the last resourceVersion value * returned by the server and not miss any modifications. (optional) * @param fieldSelector A selector to restrict the list of returned objects by their fields. * Defaults to everything. (optional) * @param includeUninitialized If true, partially initialized resources are included in the * response. (optional) * @param labelSelector A selector to restrict the list of returned objects by their labels. * Defaults to everything. (optional) * @param limit limit is a maximum number of responses to return for a list call. If more items * exist, the server will set the &#x60;continue&#x60; field on the list metadata to a value * that can be used with the same initial query to retrieve the next set of results. Setting a * limit may return fewer than the requested amount of items (up to zero items) in the event * all requested objects are filtered out and clients should only use the presence of the * continue field to determine whether more results are available. Servers may choose not to * support the limit argument and will return all of the available results. If limit is * specified and the continue field is empty, clients may assume that no more results are * available. This field is not supported if watch is true. The server guarantees that the * objects returned when using continue will be identical to issuing a single list call * without a limit - that is, no objects created, modified, or deleted after the first request * is issued will be included in any subsequent continued requests. This is sometimes referred * to as a consistent snapshot, and ensures that a client that is using limit to receive * smaller chunks of a very large result can ensure they see all possible objects. If objects * are updated during a chunked list the version of the object that was present at the time * the first list result was calculated is returned. (optional) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @param resourceVersion When specified with a watch call, shows changes that occur after that * particular version of a resource. Defaults to changes from the beginning of history. When * specified for list: - if unset, then the result is returned from remote storage based on * quorum-read flag; - if it&#39;s 0, then we simply return what we currently have in cache, * no guarantee; - if set to non zero, then the result is at least as fresh as given rv. * (optional) * @param timeoutSeconds Timeout for the list/watch call. (optional) * @param watch Watch for changes to the described resources and return them as a stream of add, * update, and remove notifications. Specify resourceVersion. (optional) * @param callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ public com.squareup.okhttp.Call watchWebLogicOracleV1NamespacedDomainListAsync( String namespace, String _continue, String fieldSelector, Boolean includeUninitialized, String labelSelector, Integer limit, String pretty, String resourceVersion, Integer timeoutSeconds, Boolean watch, final ApiCallback<V1WatchEvent> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = (bytesRead, contentLength, done) -> callback.onDownloadProgress(bytesRead, contentLength, done); progressRequestListener = (bytesWritten, contentLength, done) -> callback.onUploadProgress(bytesWritten, contentLength, done); } com.squareup.okhttp.Call call = watchWebLogicOracleV1NamespacedDomainListValidateBeforeCall( namespace, _continue, fieldSelector, includeUninitialized, labelSelector, limit, pretty, resourceVersion, timeoutSeconds, watch, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<V1WatchEvent>() {}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } }
true
6e8acfacdb0ae86ba636911908f53690d5e7e3f8
Java
lihaixing/javaEDU
/src/java眼中xml文件读取/SAXTest.java
GB18030
3,856
2.765625
3
[]
no_license
package javaxmlļȡ; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.util.ArrayList; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import javax.xml.transform.OutputKeys; import javax.xml.transform.Result; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.sax.SAXTransformerFactory; import javax.xml.transform.sax.TransformerHandler; import javax.xml.transform.stream.StreamResult; import org.xml.sax.SAXException; import org.xml.sax.helpers.AttributesImpl; import org.xml.sax.helpers.DefaultHandler; public class SAXTest extends DefaultHandler { public ArrayList<Books> XMLRead() throws ParserConfigurationException, SAXException, IOException { // ȡSAXParserFactoryʵ SAXParserFactory factory = SAXParserFactory.newInstance(); // ͨfactoryȡSAXParserʵ SAXParser parser = factory.newSAXParser(); // SAXParserHandler SAXParserHandler handler = new SAXParserHandler(); parser.parse("./src/javaxmlļȡ/books.xml", handler); System.out.println(handler.getBookList().size()); return handler.getBookList(); } public void createXML() throws ParserConfigurationException, SAXException, IOException, TransformerConfigurationException { ArrayList<Books> booklist = XMLRead(); SAXTransformerFactory tff = (SAXTransformerFactory) SAXTransformerFactory.newInstance(); TransformerHandler handler = tff.newTransformerHandler(); Transformer tf = handler.getTransformer(); tf.setOutputProperty(OutputKeys.ENCODING, "utf-8"); tf.setOutputProperty(OutputKeys.INDENT, "yes"); File file=new File("G:/java_study/code/ļĿ¼/createSAXXML.xml"); if (!file.exists()) { file.createNewFile(); } Result result = new StreamResult(new FileOutputStream(file)); handler.setResult(result); // ʼͨhandlerxmlļĶд handler.startDocument(); AttributesImpl attr = new AttributesImpl(); handler.startElement("", "", "bookstore", attr); // attr.clear(); // attr.addAttribute("", "", "id", "", "1"); // handler.startElement("", "", "book", attr); for (Books book : booklist) { attr.clear(); attr.addAttribute("", "", "id", "", book.getId()); handler.startElement("", "", "book", attr); attr.clear(); handler.startElement("", "", "name", attr); handler.characters(book.getName().toCharArray(), 0, book.getName().length()); handler.endElement("", "", "name"); if (book.getYear() != null && !book.getYear().trim().equals("")) { attr.clear(); handler.startElement("", "", "year", attr); handler.characters(book.getYear().toCharArray(), 0, book.getYear().length()); handler.endElement("", "", "year"); } handler.endElement("", "", "book"); System.out.println(book.getId()); System.out.println(book.getName()); System.out.println(book.getAuthor()); System.out.println(book.getYear()); System.out.println(book.getPrice()); System.out.println(book.getLanguage()); } // handler.endElement("", "", "book"); handler.endElement("", "", "bookstore"); handler.endDocument(); } public static void main(String[] args) throws ParserConfigurationException, SAXException, IOException, TransformerConfigurationException { SAXTest ST = new SAXTest(); ArrayList<Books> booklist = ST.XMLRead(); for (Books book : booklist) { System.out.println(book.getId()); System.out.println(book.getName()); System.out.println(book.getAuthor()); System.out.println(book.getYear()); System.out.println(book.getPrice()); System.out.println(book.getLanguage()); System.out.println(".....finish....."); } ST.createXML(); } }
true
7e3c288c1fbd605101549fb81426c7227afa941b
Java
RutgerBr/koenennkramers
/src/main/java/school/oose/dea/KramersAdapter.java
UTF-8
407
2.25
2
[]
no_license
package school.oose.dea; import nl.oose.dea.koenenkramers.KramersDictionary; public class KramersAdapter implements Translator { private KramersDictionary kramers = new KramersDictionary(); @Override public String translate(String word) { return kramers.find(word); } @Override public String getName() { return String.valueOf(DictionaryType.KRAMERS); } }
true
a03df0192de6058045c0d42f94f879ed6313e5e4
Java
dinislamgithub/springboot-mongo
/src/main/java/com/din/repository/StudentRepo.java
UTF-8
395
2.140625
2
[]
no_license
package com.din.repository; import org.springframework.data.mongodb.repository.MongoRepository; import org.springframework.stereotype.Repository; import com.din.model.Student; @Repository public interface StudentRepo extends MongoRepository<Student, Integer>{ Student findByName(String string); Student findByCell(String cell); Student findByNameAndCell(String string, String cell); }
true
d12e97e3e8f4f156dad530fa706f9304d4c20bc7
Java
brl0705/Lynch-cop3330-ex15
/src/main/java/org/example/App.java
UTF-8
454
2.90625
3
[]
no_license
package org.example; import java.util.Scanner; public class App { public static void main( String[] args ) { Scanner input1 = new Scanner (System.in); System.out.println("Password: "); String pass = input1.nextLine(); if(pass.equals("71368#")) { System.out.println("Access Granted"); } else { System.out.println("Access Denied"); } } }
true
e15f09ced49c7dbaaff7f0141bcdb264731bc1fa
Java
jcmartin2889/Repo
/EquationCommonStubs/src/com/misys/equation/common/test/transaction/COP.java
UTF-8
2,791
2.015625
2
[]
no_license
/* * This sample code is provided by Misys for illustrative purposes only. * * These examples have not been thoroughly tested under all conditions. * * Misys, therefore, cannot guarantee or imply reliability, serviceability, or function of these programs. * * All programs contained herein are provided to you "AS IS" without any warranties of any kind. The implied warranties of * non-infringement, merchantability and fitness for a particular purpose are expressly disclaimed. */ package com.misys.equation.common.test.transaction; import com.misys.equation.common.access.EquationStandardTransaction; import com.misys.equation.common.test.EquationTestCase; import com.misys.equation.common.test.TestEnvironment; public class COP extends EquationTestCase { // This attribute is used to store cvs version information. public static final String _revision = "$Id: COP.java 8213 2010-07-15 16:56:49Z CHALLIP1 $"; long startTime = System.currentTimeMillis(); long currentTime = startTime; String paymentReference = "LOND00105H000030"; private String programName = "K62MRR"; private String optionId = "COP"; @Override public void setUp() throws Exception { try { session = TestEnvironment.getTestEnvironment().getStandardSession(); } catch (Exception e) { System.out.println(e); e.printStackTrace(); } } public EquationStandardTransaction getTransaction() throws Exception { EquationStandardTransaction transaction = getEquationStandardTransaction(programName + optionId); transaction.setWorkStationId(WORKSTATIONID); return transaction; } public void test00100Retrieve() { try { EquationStandardTransaction confirmOutwardCleanPayment = getTransaction(); confirmOutwardCleanPayment.setFieldValue("GZDECD", "C"); // Decode; O/I=Auth,P/J=Susp,C=Conf,L=Coll (1A) confirmOutwardCleanPayment.setFieldValue("GZREF", paymentReference); // Payment reference (16A) confirmOutwardCleanPayment.setFieldValue("GZUSID", session.getUserId()); // Authorised by (4A) // Do the retrieve invocation applyRetrieval(confirmOutwardCleanPayment, true); } catch (Exception e) { e.printStackTrace(); } } public void test00200Update() { try { EquationStandardTransaction confirmOutwardCleanPayment = getTransaction(); confirmOutwardCleanPayment.setFieldValue("GZDECD", "C"); // Decode; O/I=Auth,P/J=Susp,C=Conf,L=Coll (1A) confirmOutwardCleanPayment.setFieldValue("GZREF", paymentReference); // Payment reference (16A) confirmOutwardCleanPayment.setFieldValue("GZUSID", session.getUserId()); // Authorised by (4A) // Do the invocation confirmOutwardCleanPayment.setMode("M"); applyTransaction(confirmOutwardCleanPayment, true); } catch (Exception e) { e.printStackTrace(); } } }
true
428714483453b0744e3839a59200fbff1e995626
Java
LI-KC/oop
/ooppj-masterBL/ooppj-master/ooppj-master/src/hk/edu/polyu/comp/comp2021/jungle/model/JungleGame.java
UTF-8
15,352
3.265625
3
[]
no_license
package hk.edu.polyu.comp.comp2021.jungle.model; import hk.edu.polyu.comp.comp2021.jungle.*; import java.lang.annotation.Target; public class JungleGame { private char[][] jungleBoard = new char[9][7]; private int[][] PlayerjungleBoard = new int[9][7]; private int[][] WaterBoard = new int[9][7]; private int[][] TrapBoard = new int[9][7]; private int[][] DenBoard = new int[9][7]; private Player x = new Player(); private Player y = new Player(); private static final char WATER = '河'; private static final char LAND = ' '; public static final String ANSI_RESET = "\u001B[0m"; public static final String ANSI_BLACK = "\u001B[30m"; public static final String ANSI_RED = "\u001B[31m"; public static final String ANSI_BLUE = "\u001B[34m"; //Store the character into the jungleBoard Array private void Insert(char c, int x, int y, int type) { this.jungleBoard[y][x] = c; if (type == 1) { this.PlayerjungleBoard[y][x] = 1; } if (type == 2) { this.PlayerjungleBoard[y][x] = 2; } if (type == 10) { this.WaterBoard[y][x] = 1; } if (type == 11) { this.WaterBoard[y][x] =2; } this.WaterBoard[2][0] = 0; this.WaterBoard[2][6] = 0; this.WaterBoard[6][0] = 0; this.WaterBoard[6][6] = 0; if (type == 3) { this.TrapBoard[y][x] = 1; } if (type == 4) { this.TrapBoard[y][x] = 2; } if (type == 5) { this.DenBoard[y][x] = 1; } if (type == 6) { this.DenBoard[y][x] = 2; } } //Get the name of Players public void getName() { System.out.print("Please input player 1 name:"); x.SetName(GetInput.Input()); System.out.print("Please input player 2 name:"); y.SetName(GetInput.Input()); } // The function print the jungleBoard and user name public void PrintBoard() { int z = 1; System.out.println(); System.out.println("Player one : " + x.GetName()); for (int i = 0; i < 9; i++) { //System.out.println(" - - - - - - -"); System.out.print(z++ + "|"); for (int j = 0; j < 7; j++) { if(WaterBoard[i][j]==1){ System.out.print(ANSI_BLUE+this.jungleBoard[i][j]+ANSI_RESET); }else if(this.PlayerjungleBoard[i][j]==2){ System.out.print(ANSI_RED+this.jungleBoard[i][j]+ANSI_RESET); } else{ System.out.print(ANSI_BLACK+this.jungleBoard[i][j]+ANSI_RESET); } System.out.print("|"); } System.out.println(); } System.out.println(" 一 一 一 一 一 一 一"); System.out.print(" "); for (int i = 0; i < 7; i++) { char x = (char) (65 + i); System.out.print(x + " "); } System.out.println(); System.out.println("Player two : " + y.GetName()); } //Create the chess in first time public void ChessInsert() { x.ChessCreator(1, 2, 6); this.Insert(x.GetChess(6), x.GetX(6), x.GetY(6), 1); x.ChessCreator(6, 0, 5); this.Insert(x.GetChess(5), x.GetX(5), x.GetY(5), 1); x.ChessCreator(1, 1, 2); this.Insert(x.GetChess(2), x.GetX(2), x.GetY(2), 1); x.ChessCreator(5, 1, 1); this.Insert(x.GetChess(1), x.GetX(1), x.GetY(1), 1); x.ChessCreator(0, 2, 0); this.Insert(x.GetChess(0), x.GetX(0), x.GetY(0), 1); x.ChessCreator(2, 2, 4); this.Insert(x.GetChess(4), x.GetX(4), x.GetY(4), 1); x.ChessCreator(4, 2, 3); this.Insert(x.GetChess(3), x.GetX(3), x.GetY(3), 1); x.ChessCreator(6, 2, 7); this.Insert(x.GetChess(7), x.GetX(7), x.GetY(7), 1); //////////////////////////////////// //////////////////////////////////// /////////////////////////////// y.ChessCreator(0, 8, 5); this.Insert(x.GetChess(5), y.GetX(5), y.GetY(5), 2); y.ChessCreator(6, 8, 6); this.Insert(x.GetChess(6), y.GetX(6), y.GetY(6), 2); y.ChessCreator(1, 7, 1); this.Insert(x.GetChess(1), y.GetX(1), y.GetY(1), 2); y.ChessCreator(5, 7, 2); this.Insert(x.GetChess(2), y.GetX(2), y.GetY(2), 2); y.ChessCreator(0, 6, 7); this.Insert(x.GetChess(7), y.GetX(7), y.GetY(7), 2); y.ChessCreator(2, 6, 3); this.Insert(x.GetChess(3), y.GetX(3), y.GetY(3), 2); y.ChessCreator(4, 6, 4); this.Insert(x.GetChess(4), y.GetX(4), y.GetY(4), 2); y.ChessCreator(6, 6, 0); this.Insert(x.GetChess(0), y.GetX(0), y.GetY(0), 2); } //Build the board with no chess public JungleGame() { for (int i = 0; i < 9; i++) { for (int j = 0; j < 7; j++) { if ((j >= 0 && j <= 6 ) && (i > 1 && i < 7)) { this.Insert('\0', j, i, 11); } if ((j > 0 && j < 6 && j != 3) && (i > 2 && i < 6)) { this.Insert(WATER, j, i, 10); continue; } this.Insert(LAND, j, i, 0); } } this.Insert(x.traps, 2, 0, 3); this.Insert(x.traps, 4, 0, 3); this.Insert(x.traps, 3, 1, 3); this.Insert(x.den, 3, 0, 5); this.Insert(y.traps, 2, 8, 4); this.Insert(y.traps, 4, 8, 4); this.Insert(y.traps, 3, 7, 4); this.Insert(y.den, 3, 8, 6); } public int UserMove(int OriX, int OriY, int targetX, int targetY) { //////////////////////////////////////////////////////////////////////////// // One space move only else you are tiger or lion can jump over the river // //////////////////////////////////////////////////////////////////////////// if(targetX==OriX && targetY == OriY){ System.out.println("You need to move"); return -1; } if(DenBoard[targetY][targetX]==1||DenBoard[targetY][targetX]==2) { System.out.println(DenBoard[targetY][targetX]+":"+PlayerjungleBoard[OriY][OriX]); if (DenBoard[targetY][targetX] == PlayerjungleBoard[OriY][OriX]) { System.out.println("Cant step on own den"); return -1; } } //////////////////////////////////////////// // Tiger and lion can jump over the river // //////////////////////////////////////////// if (this.jungleBoard[OriY][OriX] == '獅' || this.jungleBoard[OriY][OriX] == '虎') { if(this.WaterBoard[OriY][OriX] == 2 &&this.WaterBoard[targetY][targetX]==2){ if(OriX==targetX||OriY==targetY && Math.abs(targetX-OriX)==3 && Math.abs(targetY-OriY)==4){ if(targetX==OriX){ if(this.PlayerjungleBoard[3][OriX]!=0 ||this.PlayerjungleBoard[4][OriX]!=0||this.PlayerjungleBoard[5][OriX]!=0){ System.out.println("Cant Cross , have mice inside the river"); return -1; } }else if (targetY==OriY) { if(OriX==0) { if (this.PlayerjungleBoard[OriY][1] != 0 || this.PlayerjungleBoard[OriY][2] != 0) { System.out.println("Cant Cross , have mice inside the river"); return -1; } } else if(OriX==3){ if(targetX<OriX){ if (this.PlayerjungleBoard[OriY][1] != 0 || this.PlayerjungleBoard[OriY][2] != 0) { System.out.println("Cant Cross , have mice inside the river"); return -1; } } else if(targetX>OriX){ if (this.PlayerjungleBoard[OriY][4] != 0 || this.PlayerjungleBoard[OriY][5] != 0) { System.out.println("Cant Cross , have mice inside the river"); return -1; } } } else if(OriX==6){ if(this.PlayerjungleBoard[OriY][4]!=0 ||this.PlayerjungleBoard[OriY][5]!=0){ System.out.println("Cant Cross , have mice inside the river"); return -1; } } } if (Fight(OriX, OriY, targetX, targetY) == true) { Move(targetX,targetY,OriX,OriY); return 1; }else{ this.PlayerjungleBoard[OriY][OriX] = 0; this.jungleBoard[OriY][OriX] = ' '; return 1; } } } } if (Math.abs(targetX - OriX) + Math.abs(targetY - OriY) > 1) { System.out.println("Invalid input, you can only move vertically or horizontally with one space"); return -1; } ///////////////////////////////// // Only rat can get into river // ///////////////////////////////// if (this.jungleBoard[targetY][targetX] == '河') { if (this.jungleBoard[OriY][OriX] != '鼠') { System.out.println("You can't get into river"); return -1 ; } } if (this.jungleBoard[OriY][OriX] == '鼠') { if (this.WaterBoard[OriY][OriX] == 1) { if(this.WaterBoard[targetY][targetX]==1) { if (this.jungleBoard[targetY][targetX] == '鼠') { Fight(OriX,OriY,targetX,targetY); } }else{ System.out.println("You can't eat enemy on land"); return -1; } } } ///////////////////////////////// // Cant step on your chess // ///////////////////////////////// if (this.PlayerjungleBoard[OriY][OriX] == 1) { if (this.PlayerjungleBoard[targetY][targetX] == 1) { System.out.println("Same player chess, not a valid move"); return -1; } } if (this.PlayerjungleBoard[OriY][OriX] == 2) { if (this.PlayerjungleBoard[targetY][targetX] == 2) { //Same palyer chess System.out.println("Same player chess, not a valid move"); return -1; } } ///////////////////////////////// // Step on enemy chess // ///////////////////////////////// if (this.PlayerjungleBoard[OriY][OriX] == 1 || this.PlayerjungleBoard[OriY][OriX] == 2) { if (this.PlayerjungleBoard[targetY][targetX] == 1 || this.PlayerjungleBoard[targetY][targetX] == 2) { if (this.PlayerjungleBoard[targetY][targetX] != this.PlayerjungleBoard[OriY][OriX]) { if (Fight(OriX, OriY, targetX, targetY) == true) { Move(targetX,targetY,OriX,OriY); return 1; }else{ this.PlayerjungleBoard[OriY][OriX] = 0; this.jungleBoard[OriY][OriX] = ' '; return 1; } } } } Move(targetX,targetY,OriX,OriY); return 1; } public void Move(int targetX, int targetY, int OriX, int OriY) { this.jungleBoard[targetY][targetX] = this.jungleBoard[OriY][OriX]; this.jungleBoard[OriY][OriX] = ' '; this.PlayerjungleBoard[targetY][targetX] = this.PlayerjungleBoard[OriY][OriX]; this.PlayerjungleBoard[OriY][OriX] = 0; //////////////////////////// // rat move on water // //////////////////////////// if (WaterBoard[OriY][OriX] == 1) { this.Insert(WATER, OriX, OriY, 10); this.jungleBoard[OriY][OriX] = '河'; } if (TrapBoard[OriY][OriX] == 1||TrapBoard[OriY][OriX] == 2) { this.Insert(x.traps, OriX, OriY, TrapBoard[OriY][OriX]+2); this.jungleBoard[OriY][OriX] = '阱'; } if (DenBoard[OriY][OriX] == 1||DenBoard[OriY][OriX] == 2) { this.Insert(x.traps, OriX, OriY, TrapBoard[OriY][OriX]+4); this.jungleBoard[OriY][OriX] = '穴'; } System.out.println("Moved"); if(DenBoard[targetY][targetX]==1||DenBoard[targetY][targetX]==2) { System.out.println("Steped on 穴"); if(DenBoard[targetY][targetX]!=PlayerjungleBoard[targetY][targetX]) { System.out.println("Player "+PlayerjungleBoard[targetY][targetX]+" win"); PrintBoard(); Application.run = false; Win(); } } return; } public int getPlayerjungleBoard(int x, int y){ return PlayerjungleBoard[y][x]; } public boolean Fight(int a, int b, int c, int d) { Chess Chess1 = new Chess(a, b, jungleBoard[b][a]); Chess Chess2 = new Chess(c, d, jungleBoard[d][c]); System.out.println("Chess one rank is: " + Chess1.GetRank()); System.out.println("Chess two rank is: " + Chess2.GetRank()); if(TrapBoard[d][c]==PlayerjungleBoard[d][c]) { if (Chess1.GetRank() == 0 && (Chess2.GetRank() == 7)) { System.out.println("Win2"); return true; } if (Chess1.GetRank() == 7 && (Chess2.GetRank() == 0)) { System.out.println("Lose3"); return false; } if (Chess1.GetRank() >= Chess2.GetRank()) { System.out.println("Win4"); return true; } else { System.out.println("Lose2"); return false; } }else{ System.out.println("Win5"); return true; } } public void Win(){ System.out.println("FINISHHHHHHHHHHHHHHHHHHHHH"); System.exit(0); } //Save public void Save(){ SaveFile.main(PlayerjungleBoard, jungleBoard); } //Load public void Load(){ try { PlayerjungleBoard = LoadFile.LoadPlayerjungleBoard(); jungleBoard = LoadFile.LoadjungleBoard(); } catch (Exception e) { e.printStackTrace(); } } }
true
6e13f2b8ca698d9befa5a921a1c0e818b1f2f8d8
Java
hardcao/ssh
/src/com/ssh/dao/impl/ProblemContentDaoImpl.java
UTF-8
1,993
2.21875
2
[]
no_license
package com.ssh.dao.impl; import java.util.HashSet; import java.util.List; import java.util.Set; import com.ssh.dao.ProblemContentDao; import com.ssh.hibernate.HibernateUtil; import com.ssh.model.ProblemComment; import com.ssh.model.ProblemContent; public class ProblemContentDaoImpl implements ProblemContentDao { private static final ProblemContentDaoImpl instance = new ProblemContentDaoImpl(); public static ProblemContentDaoImpl getInstance() { return instance; } private ProblemContentDaoImpl() { } public ProblemContent createProblem(int problemLevel, int problemType, int uploadProblemUserID, String problemContent, String problemFrom, String problemKnowledgePoint, String problemLanguage, String problemSolutionWay) { ProblemContent problem = new ProblemContent(); problem.setProblemContent(problemContent); problem.setProblemLevel(problemLevel); problem.setProblemType(problemType); problem.setUploadProblemUserID(uploadProblemUserID); problem.setProblemFrom(problemFrom); problem.setProblemKnowledgePoint(problemKnowledgePoint); problem.setProblemLanguage(problemLanguage); problem.setProblemSolutionWay(problemSolutionWay); problem.setProblemScore(0); return problem; } public void save(ProblemContent a) { HibernateUtil.save(a); } public void addProblemComment(ProblemComment comment, int problemID) { // ProblemContent problem = (ProblemContent) HibernateUtil.getObject(ProblemContent.class, problemID); // problem.getCommentList().add(comment); // HibernateUtil.save(problem); } public void delete(int id) { // TODO Auto-generated method stub } public List<ProblemContent> getProblemsByType() { // TODO Auto-generated method stub return null; } public ProblemContent getProblem(int id) { // TODO Auto-generated method stub return null; } }
true
becdd6b293181fc1d26b970c24365ffaeebc0098
Java
zou23cn/cas
/support/cas-server-support-oauth/src/main/java/org/apereo/cas/support/oauth/authenticator/OAuth20UserAuthenticator.java
UTF-8
3,351
1.9375
2
[ "LicenseRef-scancode-free-unknown", "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
package org.apereo.cas.support.oauth.authenticator; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apereo.cas.authentication.Authentication; import org.apereo.cas.authentication.AuthenticationResult; import org.apereo.cas.authentication.AuthenticationSystemSupport; import org.apereo.cas.authentication.UsernamePasswordCredential; import org.apereo.cas.authentication.principal.Principal; import org.apereo.cas.authentication.principal.Service; import org.apereo.cas.authentication.principal.ServiceFactory; import org.apereo.cas.services.RegisteredService; import org.apereo.cas.services.RegisteredServiceAccessStrategyUtils; import org.apereo.cas.services.ServicesManager; import org.apereo.cas.support.oauth.OAuth20Constants; import org.apereo.cas.support.oauth.util.OAuth20Utils; import org.pac4j.core.context.WebContext; import org.pac4j.core.credentials.UsernamePasswordCredentials; import org.pac4j.core.credentials.authenticator.Authenticator; import org.pac4j.core.exception.CredentialsException; import org.pac4j.core.profile.CommonProfile; import java.util.Map; /** * Authenticator for user credentials authentication. * * @author Jerome Leleu * @since 5.0.0 */ @Slf4j @AllArgsConstructor public class OAuth20UserAuthenticator implements Authenticator<UsernamePasswordCredentials> { private final AuthenticationSystemSupport authenticationSystemSupport; private final ServicesManager servicesManager; private final ServiceFactory webApplicationServiceFactory; @Override public void validate(final UsernamePasswordCredentials credentials, final WebContext context) throws CredentialsException { final UsernamePasswordCredential casCredential = new UsernamePasswordCredential(credentials.getUsername(), credentials.getPassword()); try { final String clientId = context.getRequestParameter(OAuth20Constants.CLIENT_ID); final Service service = this.webApplicationServiceFactory.createService(clientId); final RegisteredService registeredService = OAuth20Utils.getRegisteredOAuthServiceByClientId(this.servicesManager, clientId); RegisteredServiceAccessStrategyUtils.ensureServiceAccessIsAllowed(registeredService); final AuthenticationResult authenticationResult = this.authenticationSystemSupport .handleAndFinalizeSingleAuthenticationTransaction(null, casCredential); final Authentication authentication = authenticationResult.getAuthentication(); final Principal principal = authentication.getPrincipal(); final CommonProfile profile = new CommonProfile(); final String id = registeredService.getUsernameAttributeProvider().resolveUsername(principal, service, registeredService); LOGGER.debug("Created profile id [{}]", id); profile.setId(id); final Map<String, Object> attributes = registeredService.getAttributeReleasePolicy().getAttributes(principal, service, registeredService); profile.addAttributes(attributes); LOGGER.debug("Authenticated user profile [{}]", profile); credentials.setUserProfile(profile); } catch (final Exception e) { throw new CredentialsException("Cannot login user using CAS internal authentication", e); } } }
true
2803c5eb4e76dd696dd2fbc910d6d73bc23c5f44
Java
fujion/fujion-framework
/fujion-highcharts/src/main/java/org/fujion/highcharts/PlotTileMap.java
UTF-8
1,714
2.484375
2
[ "LicenseRef-scancode-proprietary-license", "Apache-2.0" ]
permissive
/* * #%L * fujion * %% * Copyright (C) 2021 Fujion Framework * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * #L% */ package org.fujion.highcharts; import org.fujion.annotation.Option; /** * Options for tile map series. * <p> * A tile map series is a type of heat map where the tile shapes are configurable. */ public class PlotTileMap extends PlotOptions { /** * The column size - how many X axis units each column in the heatmap should span. Defaults to * 1. */ @Option public Integer colsize; /** * The color applied to null points. In styled mode, a general CSS class is applied instead. * Defaults to #f7f7f7. */ @Option public String nullColor; /** * The padding between points in the tilemap. Defaults to 2. */ @Option public Integer pointPadding; /** * The row size - how many Y axis units each heatmap row should span. Defaults to 1. */ @Option public Integer rowsize; /** * The shape of the tiles in the tilemap. Possible values are hexagon, circle, diamond, and * square. Defaults to hexagon. */ @Option public String tileShape; }
true
7f213adacac7ab95c567432c456a98a64ad675e3
Java
databrary/databrary-incubator
/labnanny-experiment/LabNanny/src/main/java/org/labnn/MainApp.java
UTF-8
12,187
2.109375
2
[]
no_license
package org.labnn; import org.databrary.entity.Volume; import org.databrary.controls.SessionDownload; import org.databrary.controls.VolumeView; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.annotation.JsonView; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import java.io.File; import java.io.IOException; import java.net.URL; import javafx.animation.FadeTransition; import javafx.application.Application; import javafx.application.Platform; import javafx.beans.property.ReadOnlyObjectProperty; import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; import javafx.collections.*; import javafx.concurrent.*; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.geometry.*; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.*; import javafx.scene.effect.DropShadow; import javafx.scene.image.*; import javafx.scene.layout.*; import javafx.scene.paint.Color; import javafx.scene.text.Text; import javafx.stage.*; import javafx.scene.web.WebView; import javafx.util.Duration; import org.databrary.utils.UrlUtils; //Numerical cognition Volume 10 public class MainApp extends Application { private Pane splashLayout; private ProgressBar loadProgress; private Label progressText; private Stage mainStage; private static final int SCENE_WIDTH = 1200; private static final int SCENE_HEIGHT = 600; Scene scene; //Tab pane BorderPane borderPane = new BorderPane(); final TabPane tabPane = new TabPane(); final Tab welcome = new Tab("Welcome"); final Tab tab2 = new Tab("My volums"); final Tab tab3 = new Tab("Metadata Upload"); final Tab tab4 = new Tab("Session/Visit Module"); final Tab tab5 = new Tab("Volume View"); final Tab tab6 = new Tab("Uploads"); final Tab downloads = new Tab("Downloads"); final Tab tab8 = new Tab(""); Text volumeLabelT = new Text("++++++++++++++++++++++++++++++++++++++++++++++++"); StringProperty jsonPretty = new SimpleStringProperty(""); public static void main(String[] args) throws Exception { launch(args); } @Override public void init() { ClassLoader classLoader = getClass().getClassLoader(); String imageUrl = classLoader.getResource("images/databrary.PNG").toExternalForm(); ImageView splash = new ImageView(new Image(imageUrl));; //splash.setFitWidth(SPLASH_WIDTH/2); //splash.setFitHeight(SPLASH_HEIGHT/2); loadProgress = new ProgressBar(); loadProgress.setPrefWidth(splash.getImage().getWidth()); progressText = new Label("Will find friends for peanuts . . ."); splashLayout = new VBox(); splashLayout.getChildren().addAll(splash, loadProgress, progressText); progressText.setAlignment(Pos.CENTER); splashLayout.setStyle( "-fx-padding: 5; " + "-fx-background-color: cornsilk; " + "-fx-border-width:5; " + "-fx-border-color: " + "linear-gradient(" + "to bottom, " + "chocolate, " + "derive(chocolate, 50%)" + ");" ); splashLayout.setEffect(new DropShadow()); } @Override public void start(final Stage initStage) throws Exception { downloads.setId("downloads"); volumeLabelT.textProperty().bind(jsonPretty); final Task<ObservableList<String>> friendTask = new Task<ObservableList<String>>() { @Override protected ObservableList<String> call() throws InterruptedException { ObservableList<String> foundVolumes = FXCollections.<String>observableArrayList(); ObservableList<String> availableVolumes = FXCollections.observableArrayList( "Volume 1", "Volume 2", "Volume 3", "Volume 4", "Volume 5", "Volume 6", "Volume 17", "Volume 8", "Volume 1", "Volume 1", "Volume 1", "Volume 1", "Volume 1" ); updateMessage("Finding volumes . . ."); try { UrlUtils.writeDatabraryVolumesNames(); } catch (Exception e) { e.printStackTrace(); } for (int i = 0; i < availableVolumes.size(); i++) { Thread.sleep(150); updateProgress(i + 1, availableVolumes.size()); String nextFriend = availableVolumes.get(i); foundVolumes.add(nextFriend); // updateMessage("Loading . . . found " + nextFriend); updateMessage("Loading . . . "); } Thread.sleep(120); updateMessage("All volumes found."); return foundVolumes; } }; showPreloader( initStage, friendTask, () -> showMainStage(friendTask.valueProperty()) ); new Thread(friendTask).start(); } private void showMainStage( ReadOnlyObjectProperty<ObservableList<String>> friends ) { mainStage = new Stage(StageStyle.DECORATED); mainStage.setTitle("Databrary desktop"); VBox top = new VBox(2); top.getChildren().addAll(getMenuBar()); borderPane.setTop(top); borderPane.setCenter(addHBox()); final ListView<String> peopleView = new ListView<>(); peopleView.itemsProperty().bind(friends); scene = new Scene(borderPane, SCENE_WIDTH, SCENE_HEIGHT); tabPane.prefWidthProperty().bind(scene.widthProperty().subtract(3.0)); // tab1.setContent(volumeLabelT);;; WebView web = UrlUtils.getBrowser(); welcome.setContent(web); try { // VolumeView vv = new VolumeView(); VBox volumeView = new VolumeView(); tab5.setContent(volumeView); } catch (Exception e) { e.printStackTrace(); } downloads.setContent(new SessionDownload(mainStage)); ClassLoader classLoader = getClass().getClassLoader(); String css = classLoader.getResource("styles/styles.css").toExternalForm(); scene.getStylesheets().add(css); mainStage.setScene(scene); mainStage.show(); scene.widthProperty().addListener((obs, oldScene, newScene) -> { if (newScene == null) { // not showing... } else { volumeLabelT.setWrappingWidth((double) newScene - 30); } }); // Platform.runLater(() -> jsonToJava()); Platform.runLater(new Runnable() { public void run() { jsonToJava(); // tab4.setContent(new Label(volumeProperty.get())); } }); } private void showPreloader( final Stage initStage, Task<?> task, InitCompletionHandler initCompletionHandler ) { progressText.textProperty().bind(task.messageProperty()); loadProgress.progressProperty().bind(task.progressProperty()); task.stateProperty().addListener((observableValue, oldState, newState) -> { if (newState == Worker.State.SUCCEEDED) { loadProgress.progressProperty().unbind(); loadProgress.setProgress(1); initStage.toFront(); FadeTransition fadeSplash = new FadeTransition(Duration.seconds(1.2), splashLayout); fadeSplash.setFromValue(1.0); fadeSplash.setToValue(0.0); fadeSplash.setOnFinished(actionEvent -> initStage.hide()); fadeSplash.play(); initCompletionHandler.complete(); } // todo add code to gracefully handle other task states. }); Scene splashScene = new Scene(splashLayout, Color.TRANSPARENT); final Rectangle2D bounds = Screen.getPrimary().getBounds(); initStage.setScene(splashScene); // initStage.setX(bounds.getMinX() + bounds.getWidth() / 2 - SPLASH_WIDTH / 2); // initStage.setY(bounds.getMinY() + bounds.getHeight() / 2 - SPLASH_HEIGHT / 2); initStage.initStyle(StageStyle.TRANSPARENT); initStage.setAlwaysOnTop(true); initStage.show(); } public interface InitCompletionHandler { void complete(); } MenuBar getMenuBar() { final Menu menuFile = new Menu("File"); MenuItem databraryStats = new MenuItem("Load Utilities"); databraryStats.setOnAction(new EventHandler<ActionEvent>() { public void handle(ActionEvent t) { try { UrlUtils.writeDatabraryVolumesNames(); } catch (Exception e) { e.printStackTrace(); } System.out.println("menu dadabrary"); } }); menuFile.getItems().add(databraryStats); final Menu menuOption = new Menu("Options"); final Menu menuHelp = new Menu("Help"); MenuBar menuBar = new MenuBar(); menuBar.getMenus().addAll(menuFile, menuOption, menuHelp); return menuBar; } public HBox addHBox() { HBox hbox = new HBox(); // hbox.setPadding(new Insets(15, 12, 15, 12)); hbox.setPadding(new Insets(2, 2, 2, 2)); hbox.setSpacing(10); // hbox.setStyle("-fx-background-color: #336699;"); // hbox.setStyle("-fx-background-color: lightgray;"); // Button buttonCurrent = new Button("Current"); // buttonCurrent.setPrefSize(100, 20); // Button buttonProjected = new Button("Projected"); // buttonProjected.setPrefSize(100, 20); hbox.getChildren().addAll( // buttonCurrent, //buttonProjected, // labNanny , getTabPane() ); return hbox; } public TabPane getTabPane() { // BorderPane borderPane = new BorderPane(); // tabPane.setPrefSize(400, 400); tabPane.setSide(Side.TOP); tabPane.setTabClosingPolicy(TabPane.TabClosingPolicy.UNAVAILABLE); // tabPane.setRotateGraphic(true); tabPane.setTabMinHeight(30); //tabPane.setTabMaxHeight(30); // tab1.setText("From Databrary"); // tab2.setText("To Databrary"); // tab3.setText("Tab 3"); // tab4.setText("Tab 4"); // tabPane.getTabs().addAll(tab1, tab2, tab3, tab4, tab5, tab6, tab7); tabPane.getTabs().addAll(welcome, tab2, tab3, tab4, tab5, downloads); return tabPane; // borderPane.setCenter(tabPane); // getChildren().add(borderPane); } public void jsonToJava() { System.out.println("staf1 --> "); ObjectMapper mapper = new ObjectMapper(); System.out.println("staf2 --> "); try { mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); // Convert JSON string from file to Object //Staf staff = mapper.readValue(new File("C:\\staf.json"), Volume.class); Volume staff = mapper.readValue(new URL("http://stage.databrary.org:443/api/volume/1"), Volume.class); System.out.println("staf3 --> " + staff); /* // Convert JSON string to Object String jsonInString = "{\"id\":\"1\"}"; Volume staff4 = mapper.readValue(jsonInString, Volume.class); System.out.println("staf4--> " + staff4); */ //Pretty print jsonPretty.setValue(mapper.writerWithDefaultPrettyPrinter().writeValueAsString(staff).toString()); System.out.println(volumeLabelT.getText()); } catch (Exception e) { e.printStackTrace(); } } }
true
ef35d583b5124ff5a803d4ca2df925eb0183ae62
Java
phwd/quest-tracker
/hollywood/com.oculus.assistant-base/sources/com/fasterxml/jackson/datatype/guava/deser/ImmutableBiMapDeserializer.java
UTF-8
388
1.578125
2
[]
no_license
package com.fasterxml.jackson.datatype.guava.deser; import X.C00313p; import X.OD; import X.PR; import com.fasterxml.jackson.databind.JsonDeserializer; public class ImmutableBiMapDeserializer extends GuavaImmutableMapDeserializer { public ImmutableBiMapDeserializer(C00313p r1, OD od, PR pr, JsonDeserializer jsonDeserializer) { super(r1, od, pr, jsonDeserializer); } }
true
98ecf9eb725ffef8f0ce508319aa8e4548642b7e
Java
shuangma/HomeGarden
/src/com/hummingbee/garden/model/sprinkler/TemperatureSensor.java
UTF-8
1,040
3.265625
3
[ "Apache-2.0" ]
permissive
package com.hummingbee.garden.model.sprinkler; import com.hummingbee.garden.model.simulation.TemperatureSimulator; /** * The TemperatureSensor class represents a temperature sensor, each sprinkler group owns one sensor * This temperature sensor will monitor the current temperature * @author Shuang Ma * */ public class TemperatureSensor extends Thread{ private double curTemperature = 85; private TemperatureSimulator temperatureSimulator = null; private String group; public TemperatureSensor(String group, TemperatureSimulator temperatureSimulator){ this.group = group; this.temperatureSimulator = temperatureSimulator; } public String getGroup(){ return group; } public double getCurTemperature(){ return curTemperature; } public void run(){ // This sensor monitors current temperature every 1 seconds while(true){ try { Thread.sleep(1*1000); } catch (InterruptedException e) { e.printStackTrace(); } curTemperature = this.temperatureSimulator.getGroupTemperature(group); } } }
true
1469fbed90159ee666935e05a5cf108e17b5f5fb
Java
bastobika/Leetcode_Solutions
/DS_Leetcode_Solutions/src/Medium/LC337_HouseRobber.java
UTF-8
1,456
3.75
4
[]
no_license
package Medium; /* The thief has found himself a new place for his thievery again. There is only one entrance to this area, called root. * Besides the root, each house has one and only one parent house. After a tour, the smart thief realized that all houses in this place form a binary tree. * It will automatically contact the police if two directly-linked houses were broken into on the same night. * Given the root of the binary tree, return the maximum amount of money the thief can rob without alerting the police. */ public class LC337_HouseRobber { public class TreeNode { int val; TreeNode left; TreeNode right; TreeNode() {} TreeNode(int val) { this.val = val; } TreeNode(int val, TreeNode left, TreeNode right) { this.val = val; this.left = left; this.right = right; } } public int rob(TreeNode root) { int arr[] = findMax(root); return Math.max(arr[0],arr[1]); } private int[] findMax(TreeNode root){ int arr[] = new int[2]; if(root == null) return arr; int[] left = findMax(root.left); int[] right = findMax(root.right); arr[0] = root.val + left[1] + right[1]; arr[1] = Math.max(Math.max(left[0]+right[0],left[1]+right[0]), Math.max(right[1]+left[0],right[1]+left[1])); return arr; } public static void main(String[] args) { System.out.println("House Robber"); } }
true
cbe03aec9eed55f0899dce317b9e643a4e69f0cf
Java
hjguyue/ddbSQL
/src/org/db/ddbserver/SqlResult.java
UTF-8
1,129
2.09375
2
[]
no_license
package org.db.ddbserver; import java.io.Serializable; import java.util.ArrayList; import java.util.LinkedList; public class SqlResult implements Serializable{ /** * */ private static final long serialVersionUID = 7417871626714039826L; private int result_id; private int site; private String table; private ArrayList<String> name; private ArrayList<SqlColomn> l; public SqlResult() { l = new ArrayList<SqlColomn>(); name = new ArrayList<String>(); } public ArrayList<String> getName() { return name; } public void setName(ArrayList<String> name) { this.name = name; } public int getResult_id() { return result_id; } public void setResult_id(int result_id) { this.result_id = result_id; } public int getSite() { return site; } public void setSite(int site) { this.site = site; } public String getTable() { return table; } public void setTable(String table) { this.table = table; } public ArrayList<SqlColomn> getL() { return l; } public void setL(ArrayList<SqlColomn> l) { this.l = l; } }
true
47594dfdda328ef59b409c3aa42db79affdf8956
Java
springning/study
/src/main/java/com/nsp/test/fanxing/TestEnumMethod.java
UTF-8
407
2.515625
3
[]
no_license
package com.nsp.test.fanxing; import org.junit.Test; public enum TestEnumMethod { SAMPLE1 { String getInfo() { return "sample1"; } }, SAMPLE2 { String getInfo() { return "sample2"; } }; abstract String getInfo(); @Test public void testMethod() { for (TestEnumMethod testEnumMethod : TestEnumMethod.values()) { System.out.println(testEnumMethod.getInfo()); } } }
true
067197151800deda3dfa97b5cd9073588bb7f0b9
Java
loke-dev/Java-challenges
/src/lc222ak_assign1/Play123Main.java
UTF-8
1,169
3.8125
4
[]
no_license
package lc222ak_assign1; import java.util.Objects; public class Play123Main { public void main() { int result = 0; for (int i = 0; i < 10000; i++) { if (play123()) { result++; } } float percentage = (float) result*100/10000; System.out.println("Result: " + result); System.out.println("Win chance: " + percentage + "%"); } private boolean play123() { boolean winning = true; Deck deck = new Deck(); deck.generateDeck(); deck.shuffle(); while(deck.deckSize() > 1) { for (int i = 1; i <= 3; i++) { Card drawnCard = deck.handOutNextCard(); if (drawnCard.toString().contains(Card.Rank.Ace.toString()) && i == 1) { winning = false; } else if (drawnCard.toString().contains(Card.Rank.Two.toString()) && i == 2) { winning = false; } else if (drawnCard.toString().contains(Card.Rank.Three.toString()) && i == 3) { winning = false; } } } return winning; } }
true
115965a483c5ec898447ee06bbcb74ea5d02ee9c
Java
gaaraw/LostFoundSSM
/src/main/java/service/CommentService.java
UTF-8
345
1.789063
2
[]
no_license
package service; import entity.Comment; import java.util.List; /** * @author HABIN * @date 2020/3/19 1:04 * 评论业务层接口 */ public interface CommentService { /** * 添加评论 * */ int insertComment(Comment comment); /* * 查询评论 * */ List<Comment> queryCommentByAcId(int articleId); }
true
bfb149d14377eb2fbf406516e900fda2ce6711ce
Java
carmenjama/healthy_life
/app/src/main/java/com/carmenjama/healthlife/ActivityEstadistica.java
UTF-8
1,398
2.171875
2
[]
no_license
package com.carmenjama.healthlife; import android.app.Activity; import android.database.sqlite.SQLiteDatabase; import android.os.Bundle; import android.view.WindowManager; import com.healthLife.DAO.model.DaoMaster; import com.healthLife.DAO.model.DaoSession; import lecho.lib.hellocharts.model.PieChartData; import lecho.lib.hellocharts.view.PieChartView; /** * Created by USUARIO on 28/08/2015. */ public class ActivityEstadistica extends Activity { private SQLiteDatabase db; private DaoMaster daoMaster; private DaoSession daoSession; private PieChartView pieChart; private PieChartData data; private boolean hasLabels = false; private boolean hasLabelsOutside = false; private boolean hasLabelForSelected = false; //Como ejemplo, en un examen tenemos buenas, malas y no respondidas. private int buenas = 0, malas = 0, noresp = 0, total = 0; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); DaoMaster.DevOpenHelper openHelper = new DaoMaster.DevOpenHelper(this, "BD",null); db = openHelper.getWritableDatabase(); daoMaster = new DaoMaster(db); daoSession = daoMaster.newSession(); } }
true
85a844924fd11778975464db74347f458b5c6082
Java
madalinazamfir/EAP-2021
/eaplabs/src/lab3/abstract_class/Laptop.java
UTF-8
239
2.625
3
[]
no_license
package lab3.abstract_class; public class Laptop extends ElectronicDevice{ @Override public int consumKW() { return 25; } @Override public void start() { System.out.println("booting system"); } }
true
68d53efa807951dc63b2cd62cca5871cfbf0f83a
Java
tamanna037/Online_Bookshop
/OnlineBookStore_19/src/java/servlets/searchName.java
UTF-8
5,740
2.15625
2
[]
no_license
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package servlets; import Interfaces.SharedConstants; import static Interfaces.SharedConstants.CATEGORY_ADDED; import static Interfaces.SharedConstants.HOME; import static Interfaces.SharedConstants.SearchByAuthor; import static Interfaces.SharedConstants.SearchByCat; import static Interfaces.SharedConstants.SearchByName; import static Interfaces.SharedConstants.SearchByPub; import static Interfaces.SharedConstants.Successful_Search; import database.DataAccess; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; /** * * @author MiNNiE */ @WebServlet(name = "searchName", urlPatterns = {"/searchName.do"}) public class searchName extends HttpServlet implements SharedConstants{ /** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> * methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); String err=""; boolean errFlag = false; HttpSession session = request.getSession(); String homeFlag= SearchByName; String search = request.getParameter("searchName"); //if(search!=null || !search.isEmpty()){homeFlag=;} if(search==null|| search.isEmpty()) {search=request.getParameter("searchAuthor"); homeFlag=SearchByAuthor;} if(search==null|| search.isEmpty()) {search=request.getParameter("searchCat");homeFlag=SearchByCat;} if(search==null|| search.isEmpty()) {search=request.getParameter("searchPub");homeFlag=SearchByPub;} if(search==null || search.isEmpty()) { session.setAttribute("alert", "search item is null"); RequestDispatcher rd = request.getRequestDispatcher("home.jsp"); rd.forward(request, response); } else { // System.out.println(search); session.setAttribute("search", search); System.out.print("s"+search); session.setAttribute("homeFlag",homeFlag); RequestDispatcher rd = request.getRequestDispatcher("home.jsp"); //System.out.println(search); rd.forward(request, response); // System.out.println(search); /*if(errFlag==false){ // String result = db.searchByName(search); //System.out.println(result); if(result.equals(Successful_Search)) { RequestDispatcher rd = request.getRequestDispatcher("seachName.jsp"); rd.forward(request, response); } else { RequestDispatcher rd = request.getRequestDispatcher("home.jsp"); rd.forward(request, response); } }else{ System.out.println("Alerts: "+err); try (PrintWriter out = response.getWriter()) { /* TODO output your page here. You may use following sample code. out.println("<!DOCTYPE html>"); out.println("<html>"); out.println("<head>"); out.println("<title>Servlet CreateAccountAdmin</title>"); out.println("</head>"); out.println("<body>"); out.println("<jsp:include page=\"navigation.jsp\" />"); out.println("<h1>Alerts: </h1>"); out.println(err); out.println("</body>"); out.println("</html>"); } }*/ }} // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."> /** * Handles the HTTP <code>GET</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Handles the HTTP <code>POST</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Returns a short description of the servlet. * * @return a String containing servlet description */ @Override public String getServletInfo() { return "Short description"; }// </editor-fold> }
true
bd05648c6ae9cf9ab618af577307b3f8d506ad99
Java
zeh/android-libs
/com/zehfernando/utils/KeyboardUtils.java
UTF-8
413
1.976563
2
[]
no_license
package com.zehfernando.utils; import android.content.Context; import android.view.View; import android.view.inputmethod.InputMethodManager; public class KeyboardUtils { public static void hideSoftKeyboard(View __anyView) { InputMethodManager mgr = (InputMethodManager) __anyView.getContext().getSystemService(Context.INPUT_METHOD_SERVICE); mgr.hideSoftInputFromWindow(__anyView.getWindowToken(), 0); } }
true
db5e2b87d677432edf34add6d6d127ecca74c317
Java
fiveOO/springboot-lifecycle
/src/main/java/com/github/fiveoo/spring/boot/lifecycle/Application.java
UTF-8
582
1.9375
2
[ "Apache-2.0" ]
permissive
package com.github.fiveoo.spring.boot.lifecycle; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import com.github.fiveoo.spring.boot.lifecycle.appevent.ApplicationEventOnAppListener; @SpringBootApplication public class Application { public static void main( final String[] args ) { SpringApplication springApplication = new SpringApplication( Application.class ); springApplication.addListeners( new ApplicationEventOnAppListener() ); springApplication.run( args ); } }
true
db21fdd47978b92de63b7e206c716cf36ed06edf
Java
huangzhi1234/dbm-api
/src/main/java/com/withlee/dbm/util/response/CommonResponse.java
UTF-8
1,493
2.515625
3
[]
no_license
package com.withlee.dbm.util.response; public class CommonResponse { private String message; private Object responseContent; private int status; // 执行查询成功返回 public CommonResponse(Object responseContent) { super(); this.message = "success"; this.responseContent = responseContent; this.status = 0; } // 执行增删改操作成功返回 public CommonResponse() { super(); this.message = "success"; this.responseContent = null; this.status = 0; } // 业务逻辑层错误(通常用这种):统一返回message和状态码400 public CommonResponse(String message) { super(); this.message = message; this.responseContent = false; this.status = 400; } // 错误 :如token失效 public CommonResponse(String message, int status) { super(); this.message = message; this.responseContent = null; this.status = status; } // 公用返回 public CommonResponse(String message, Object responseContent, int status) { super(); this.message = message; this.responseContent = responseContent; this.status = status; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public Object getResponseContent() { return responseContent; } public void setResponseContent(Object responseContent) { this.responseContent = responseContent; } public int getStatus() { return status; } public void setStatus(int status) { this.status = status; } }
true
25678c3cf4900e34af0792fcdb5e13cc656eb8f0
Java
coderanderson/connexus_android
/app/src/main/java/us/connex/miniprojectapt/Activities/ShowStreamsActivity.java
UTF-8
6,414
2.09375
2
[]
no_license
package us.connex.miniprojectapt.Activities; import android.content.Context; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.AdapterView; import android.widget.GridView; import android.widget.SearchView; import android.widget.Toast; import java.util.ArrayList; import java.util.List; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; import us.connex.miniprojectapt.Model.PhotoLocationes; import us.connex.miniprojectapt.Model.Search; import us.connex.miniprojectapt.Model.ViewAll; import us.connex.miniprojectapt.Model.ViewSingle; import us.connex.miniprojectapt.R; import us.connex.miniprojectapt.Remote.RetrofitClient; import us.connex.miniprojectapt.Remote.StreamService; import us.connex.miniprojectapt.Adapters.StreamImageAdapter; import static us.connex.miniprojectapt.Model.Constant.BASE_URL; import static us.connex.miniprojectapt.Model.Constant.EXTRA_MESSAGE; public class ShowStreamsActivity extends AppCompatActivity { private GridView gridview; private SearchView searchView; private StreamImageAdapter imageAdapter; private StreamService myStreamService; private List<Stream> streams = new ArrayList<>(); private Context context; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.streams_view); searchView = (SearchView) findViewById(R.id.searchView); searchView.setIconifiedByDefault(false); context = getApplicationContext(); request_streams(); searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { Toast.makeText(context, "begin search: " + query, Toast.LENGTH_SHORT).show(); myStreamService = getStreamService(); getStreamSearch(query); return true; } @Override public boolean onQueryTextChange(String newText) { return false; } }); } public void request_streams() { myStreamService = getStreamService(); getStream(); } public void showNearby(View view) { Intent intent = new Intent(ShowStreamsActivity.this, ShowNearbyActivity.class); ArrayList<String> allStreamNames = new ArrayList<>(); for(int i = 0;i < streams.size();i++) allStreamNames.add(streams.get(i).getName()); intent.putStringArrayListExtra("all_stream_names", allStreamNames); startActivity(intent); } private void getStream() { myStreamService.getViewAll_Obj().enqueue(new Callback<List<ViewAll>>() { @Override public void onResponse(Call<List<ViewAll>> call, Response<List<ViewAll>> response) { List<ViewAll> list = response.body(); for (int i = 0; i < list.size(); i++) { streams.add(new Stream(list.get(i).getName(), list.get(i).getCoverUrl())); } gridview = (GridView) findViewById(R.id.gridview); imageAdapter = new StreamImageAdapter(ShowStreamsActivity.this, streams); gridview.setAdapter(imageAdapter); gridview.setOnItemClickListener(new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View v, int position, long id) { String streamName = streams.get(position).getName(); myStreamService = getStreamService(); getSingleStream(streamName); } }); } @Override public void onFailure(Call<List<ViewAll>> call, Throwable t) { Log.e("ERROR", t.getMessage()); } }); } private void getSingleStream(final String string) { myStreamService.getSingleStream_Obj(string).enqueue(new Callback<ViewSingle>() { @Override public void onResponse(Call<ViewSingle> call, Response<ViewSingle> response) { ViewSingle viewsingle = response.body(); ArrayList<String> photoUrls = viewsingle.getPhotoUrls(); Intent intent = new Intent(ShowStreamsActivity.this, ShowSingleStreamActivity.class); intent.putExtra(EXTRA_MESSAGE, string); intent.putStringArrayListExtra("photo_urls", photoUrls); startActivity(intent); } @Override public void onFailure(Call<ViewSingle> call, Throwable t) { } }); } //this is a test for search view public void searchView(View view) { Intent intent = new Intent(ShowStreamsActivity.this, SearchActivity.class); startActivity(intent); } private void getStreamSearch(final String string) { myStreamService.getSearchResult_Obj(string).enqueue(new Callback<List<Search>>() { @Override public void onResponse(Call<List<Search>> call, Response<List<Search>> response) { List<Search> list = response.body(); ArrayList<String> name_list = new ArrayList<>(); ArrayList<String> cover_url_list = new ArrayList<>(); Intent intent = new Intent(ShowStreamsActivity.this, SearchActivity.class); if(list != null) { for (int i = 0; i < list.size(); i++) { name_list.add(list.get(i).getName()); cover_url_list.add(list.get(i).getCoverUrl()); } intent.putStringArrayListExtra("name_list", name_list); intent.putStringArrayListExtra("cover_url_list", cover_url_list); } intent.putExtra("query", string); startActivity(intent); } @Override public void onFailure(Call<List<Search>> call, Throwable t) { Log.e("ERROR", t.getMessage()); } }); } public static StreamService getStreamService() { return RetrofitClient.getClient(BASE_URL).create(StreamService.class); } }
true
86285153eeb3a302a5e2db1e86c61906efc6e47e
Java
panrenliang/JavaEE-exercise
/core/src/main/java/com/tw/core/dao/CustomerDao.java
UTF-8
1,514
2.484375
2
[]
no_license
package com.tw.core.dao; import com.tw.core.model.Customer; import com.tw.core.util.HibernateUtil; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; import org.springframework.stereotype.Repository; import java.util.List; @Repository public class CustomerDao { SessionFactory sessionFactory = HibernateUtil.getSessionFactory(); public List<Customer> getCustomers(){ Session session = sessionFactory.getCurrentSession(); Transaction transaction = session.beginTransaction(); String hql = "From Customer"; List<Customer> customers = session.createQuery(hql).list(); transaction.commit(); return customers; } public Customer getCustomer(int id) { Session session = sessionFactory.getCurrentSession(); Transaction transaction = session.beginTransaction(); Customer customer = (Customer) session.load(Customer.class, id); transaction.commit(); return customer; } public void addCustomer(Customer customer) { Session session = sessionFactory.getCurrentSession(); Transaction transaction = session.beginTransaction(); session.save(customer); transaction.commit(); } public void updateCustomer(Customer customer) { Session session = sessionFactory.getCurrentSession(); Transaction transaction = session.beginTransaction(); session.update(customer); transaction.commit(); } }
true
bb6de064db09d6511e42356ed6e2dff197f602cc
Java
gaborbiro/SharedExpenses
/app/src/main/java/com/gaborbiro/sharedexpenses/util/AssetUtils.java
UTF-8
788
2.59375
3
[]
no_license
package com.gaborbiro.sharedexpenses.util; import android.content.Context; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; public class AssetUtils { public static String readAssetAsText(Context context, String filename) throws IOException { return streamToString(context.getAssets().open(filename)); } public static String streamToString(InputStream is) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(is)); StringBuilder sb = new StringBuilder(); String line; while ((line = reader.readLine()) != null) { sb.append(line).append("\n"); } reader.close(); return sb.toString(); } }
true
deef2a4736fb93fb6db90930909f9b01fe1c7677
Java
amitsingh5949/Algorithms
/TreesBasics/src/com/javaDwarf/binaryTrees/leetcode/_235_LowestCommonAncestorofaBinarySearchTree.java
UTF-8
2,300
3.71875
4
[]
no_license
package com.javaDwarf.binaryTrees.leetcode; public class _235_LowestCommonAncestorofaBinarySearchTree { public static void main(String[] args) { } public TreeNode ancenstor = null; public TreeNode lowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) { this.ancenstor = null; lowestCommonAncestorRec(root, p, q); return this.ancenstor; } public TreeNode lowestCommonAncestorRec(TreeNode root, TreeNode p, TreeNode q) { if(root == null) return null; TreeNode left = lowestCommonAncestorRec(root.left, p, q); TreeNode right = lowestCommonAncestorRec(root.right, p, q); if( (left != null && right!=null) || ((left != null || right != null ) && (root.val == p.val || root.val == q.val))) { this.ancenstor = root; return root; } if(left != null && right==null){ return left; } else if(left == null && right!=null){ return right; } if(root.val == p.val || root.val == q.val) return root; return null; } // Neater solution public TreeNode lowestCommonAncestor1(TreeNode root, TreeNode n1,TreeNode n2) { if(root != null) { if(root.val==n1.val || root.val==n2.val) { return root; } TreeNode left = lowestCommonAncestor1(root.left,n1,n2); TreeNode right = lowestCommonAncestor1(root.right,n1,n2); if(left !=null && right==null) { root = left; } else if(left ==null && right!=null) { root = right; } else if(left ==null && right==null) { root = null; } } return root; } //even neater solution // idea is we are expecting two trues from left and right sub tree if the numbers are found and 1 true can be expected if the root itself is p or q // so if count is 2 or more that means its an LCA, however if count > 0 that means its not LC but this subtree should return true TreeNode result; public TreeNode lowestCommonAncestor11(TreeNode root, TreeNode p, TreeNode q) { helper(root,p,q); return result; } private boolean helper(TreeNode root, TreeNode p, TreeNode q){ if(root==null) return false; int count = 0; count += helper(root.left,p,q)?1:0; count += helper(root.right,p,q)?1:0; count += (root.val==p.val ||root.val==q.val)?1:0; if(count>1)result=root; return count>0; } }
true
59deb9547029c4db206445879c1fb3e80b20a1de
Java
44010039/netcrusher-java
/core/src/test/java/org/netcrusher/test/CheckLinuxTest.java
UTF-8
2,055
2.359375
2
[ "Apache-2.0" ]
permissive
package org.netcrusher.test; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.netcrusher.test.process.ProcessResult; import org.netcrusher.test.process.ProcessWrapper; import java.util.Arrays; import java.util.List; import java.util.concurrent.Future; import java.util.stream.Collectors; public class CheckLinuxTest extends AbstractLinuxTest { @Test public void check() throws Exception { Assertions.assertTrue(ensureCommand(Arrays.asList("socat", "-V")), "<socat> is not found"); Assertions.assertTrue(ensureCommand(Arrays.asList("iperf3", "-v")), "<iperf3> is not found"); Assertions.assertTrue(ensureCommand(Arrays.asList("openssl", "version")), "<openssl> is not found"); Assertions.assertTrue(ensureCommand(Arrays.asList("pv", "-V")), "<pv> is not found"); Assertions.assertTrue(ensureCommand(Arrays.asList("tee", "--version")), "<tee> is not found"); Assertions.assertTrue(ensureCommand(Arrays.asList("dd", "--version")), "<dd> is not found"); Assertions.assertTrue(ensureCommand(Arrays.asList("bash", "--version")), "<bash> is not found"); } private static boolean ensureCommand(List<String> commands) throws Exception { ProcessWrapper wrapper = new ProcessWrapper(commands); Future<ProcessResult> future = wrapper.run(); return future.get().getExitCode() == 0; } @Test public void checkMd5Extraction() throws Exception { List<String> hashes = extractMd5(Arrays.asList( "rwgrw g w 10f8941b7e6239f4e2af05fa916037fd rwgr", "10f8941b7e6239f4e2af05fa916038fd", "10f8941b7e6239f4e2af05fa916039fd rwgr" )).collect(Collectors.toList()); Assertions.assertEquals(3, hashes.size()); Assertions.assertEquals("10f8941b7e6239f4e2af05fa916037fd", hashes.get(0)); Assertions.assertEquals("10f8941b7e6239f4e2af05fa916038fd", hashes.get(1)); Assertions.assertEquals("10f8941b7e6239f4e2af05fa916039fd", hashes.get(2)); } }
true
04e0d5aa2124dc426e0c34859d41405675298fe7
Java
atulverma-git/CoreJavaProject
/src/cacheManager/CacheManager.java
UTF-8
1,759
3.46875
3
[]
no_license
package cacheManager; import java.util.HashMap; import java.util.Iterator; import java.util.Set; public class CacheManager { private static HashMap<Object, Object> cachedMap = new HashMap<>(); static { System.out.println("Static block called...................."); try { Thread threadCleanerUpper = new Thread(new Runnable() { final int milliSecondsSleepTime = 5000; public void run() { try { while (true) { System.out.println("threadCleanerUpper is sweeping for Expired Objects........."); Set keySet = cachedMap.keySet(); Iterator itr = keySet.iterator(); while (itr.hasNext()) { Object key = itr.next(); Cacheable cachedObj = (Cacheable) cachedMap.get(key); // check if cached obj has expired if (cachedObj.isExpired()) { System.out.println("Cached Obj: " + cachedObj.getIdentifier() + "is expired"); cachedMap.remove(key); } } Thread.sleep(milliSecondsSleepTime); } } catch (InterruptedException ie) { ie.printStackTrace(); } } }); threadCleanerUpper.setPriority(Thread.MIN_PRIORITY); threadCleanerUpper.start(); } catch (Exception e) { e.printStackTrace(); } } // end of static block public static void putCache(Cacheable obj){ System.out.println("put Object in cache"); cachedMap.put(obj.getIdentifier(), obj); } public static Cacheable getCache(Object id){ System.out.println("get from cache"); Cacheable cachedObj =(Cacheable) cachedMap.get(id); if(cachedObj==null){ return null; } if(cachedObj.isExpired()){ System.out.println("object has been expired"); cachedMap.remove(id); return null; }else{ return cachedObj; } } }
true
b17755bc48333011f0c70588bcd41ca789157644
Java
stefanhendriks/katas
/leddisplay/java/10-09-2012/test/LEDDisplayTest.java
UTF-8
3,062
2.703125
3
[]
no_license
import org.apache.commons.lang3.StringUtils; import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; import com.fundynamic.LEDDisplay; public class LEDDisplayTest { @Test public void shouldConvertNumberOne() { String expectedDisplay = makeDigit( " ", " |", " ", " |", " " ); final String result = makeLEDDisplay().convert(1); Assert.assertEquals(expectedDisplay, result); } @Test public void shouldConvertNumberTwo() { String expectedDisplay = makeDigit( " - ", " |", " - ", "| ", " - " ); final String result = makeLEDDisplay().convert(2); Assert.assertEquals(expectedDisplay, result); } @Test public void shouldConvertNumberThree() { String expectedDisplay = makeDigit( " - ", " |", " - ", " |", " - " ); final String result = makeLEDDisplay().convert(3); Assert.assertEquals(expectedDisplay, result); } @Test public void shouldConvertNumberZero() { String expectedDisplay = makeDigit( " - ", "| |", " ", "| |", " - " ); final int value = 0; final String result = makeLEDDisplay().convert(value); Assert.assertEquals(expectedDisplay, result); } @Test public void shouldConvertNumberEleven() { LEDDisplay ledDisplay = makeLEDDisplay(); String expectedDisplay = makeDigit( " ", " | |", " ", " | |", " " ); final String result = ledDisplay.convert(11); Assert.assertEquals(expectedDisplay, result); } @Test public void shouldConvertTwoDigitNumber() { LEDDisplay ledDisplay = makeLEDDisplay(); String expectedDisplay = makeDigit( " - ", " | |", " - ", " | | ", " - " ); final String result = ledDisplay.convert(12); Assert.assertEquals(expectedDisplay, result); } @Test public void shouldConvertThreeDigitNumber() { LEDDisplay ledDisplay = makeLEDDisplay(); String expectedDisplay = makeDigit( " - - ", " | | | | ", " - - - ", " | | |", " - - " ); final String result = ledDisplay.convert(345); Assert.assertEquals(expectedDisplay, result); } @Test public void shouldConvertFiveDigitNumber() { LEDDisplay ledDisplay = makeLEDDisplay(); String expectedDisplay = makeDigit( " - - - - - ", "| | | | | | | |", " - - - ", "| | | | | | | |", " - - - - "); final String result = ledDisplay.convert(67890); Assert.assertEquals(expectedDisplay, result); } private LEDDisplay makeLEDDisplay() { return new LEDDisplay(); } private String makeDigit(String... lines) { return StringUtils.join(lines, "\n"); } }
true
fc628ae71beb44bb83a117a837fea3fe6e31b49d
Java
rolandotr/Frechet-distance
/src/distances/Transformation.java
UTF-8
721
2.90625
3
[]
no_license
package distances; import trajectory.Trajectory; public class Transformation{ public double distance; public Trajectory t1; public Trajectory t2; public double[] alpha; public double[] beta; public Transformation(double distance, Trajectory t1, Trajectory t2, double[] alpha, double[] beta) { super(); this.distance = distance; this.t1 = t1; this.t2 = t2; this.alpha = alpha; this.beta = beta; } @Override public String toString() { return t1.getIdentifier()+" with "+t2.getIdentifier(); } @Override public boolean equals(Object obj) { if (obj instanceof Transformation){ return ((Transformation)obj).t2.equals(t2); } return false; } }
true
650f67530833a53a8c5c9c8629c8dad6528f3fd1
Java
aryanise/GitDemo
/src/test/java/Acadamy/E2EProject/verifynavigation.java
UTF-8
1,032
2.109375
2
[]
no_license
package Acadamy.E2EProject; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertTrue; import java.io.IOException; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; import pageObject.LandingPage; import pageObject.LoginPage; import resources.Base; public class verifynavigation extends Base { private static Logger Log = LogManager.getLogger(Base.class.getName()); @BeforeTest public void initialization() throws IOException { driver=initializeDriver(); driver.get(prop.getProperty("url")); } @Test public void homepage() throws IOException { LandingPage lp=new LandingPage(driver); assertTrue(lp.getnavigate().isDisplayed(), "items are displaying"); Log.info("item displaying sucessfully"); } @AfterTest public void close() { driver.close(); } }
true
43496c2c1c22b6e926a4a24ce255651966e6a787
Java
hkoscielski/system-dyplomant
/app/src/main/java/com/example/hubson/systemdyplomant/repository/remote/WebserviceImpl.java
UTF-8
959
2.390625
2
[]
no_license
package com.example.hubson.systemdyplomant.repository.remote; import com.google.gson.GsonBuilder; import retrofit2.Retrofit; import retrofit2.converter.gson.GsonConverterFactory; public class WebserviceImpl { private static final Object LOCK = new Object(); private static Webservice sInstance; private WebserviceImpl() {} public static Webservice getInstance() { if (sInstance == null) { synchronized (LOCK) { if(sInstance == null) { sInstance = new Retrofit.Builder() .baseUrl(ApiConstants.HTTP_GRADUATE_API) .addConverterFactory(GsonConverterFactory.create(new GsonBuilder().setLenient().create())) .addCallAdapterFactory(new LiveDataCallAdapterFactory()) .build().create(Webservice.class); } } } return sInstance; } }
true
e323d1ee9132c2714d414c2cbdbce2e0bb790228
Java
charlee1688/TestNG
/src/test/java/com/hrms/tests/OrangeHRM_LoginTests.java
UTF-8
4,753
2.390625
2
[]
no_license
package com.hrms.tests; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.testng.Assert; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import com.hrms.testBase.Driver; import com.hrms.utils.ConfigsReader; public class OrangeHRM_LoginTests { @BeforeMethod(alwaysRun = true) public void beforeClass() { Driver.getDriver().get(ConfigsReader.getProperty("url")); Driver.getDriver().manage().window().maximize(); Driver.getDriver().manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); } // 1. login using the valid credentials, and user should be able to successfully //login and see the dashboard/landing page //2. try loging in using a valid username and invalid password, and user should //see "Invalid credentials" // 3. invalid username, valid password // 4. invalid username, invalid password // 5. blank username , valid password // 6. valid username, blank password // 1. login using the valid credentials, and user should be able to successfully //login and see the dashboard/landing page @Test(priority = 1, groups = { "login" }) public void Login_ValidUsername_ValidPassword() { Driver.getDriver().findElement(By.id(ConfigsReader.getProperty("userNameId"))) .sendKeys(ConfigsReader.getProperty("validUserName")); Driver.getDriver().findElement(By.id(ConfigsReader.getProperty("passWordId"))) .sendKeys(ConfigsReader.getProperty("validPassWord")); Driver.getDriver().findElement(By.id(ConfigsReader.getProperty("loginButtonId"))).click(); String welcomeText = Driver.getDriver().findElement(By.id(ConfigsReader.getProperty("welcomeTextId"))) .getText(); String expectedWelcomeText = "Welcome Paul"; Assert.assertEquals(welcomeText, expectedWelcomeText); } //2. try loging in using a valid username and invalid password, and user should // see "Invalid credentials" @Test(priority = 0, groups = { "login" }) public void Login_validUsername_InvalidPassword() { Driver.getDriver().findElement(By.id(ConfigsReader.getProperty("userNameId"))) .sendKeys(ConfigsReader.getProperty("validUserName")); Driver.getDriver().findElement(By.id(ConfigsReader.getProperty("passWordId"))) .sendKeys(ConfigsReader.getProperty("invalidPassword")); Driver.getDriver().findElement(By.id(ConfigsReader.getProperty("loginButtonId"))).click(); String invalidCredentialMessage = Driver.getDriver().findElement(By.id(ConfigsReader.getProperty("spanMessageError"))) .getText(); String expectedCredentialMessage = "Invalid credentials"; Assert.assertEquals(invalidCredentialMessage, expectedCredentialMessage); } // 3. invalid username, valid password @Test(priority = 0, groups = { "login" }) public void Login_InvalidUsername_validPassword() { Driver.getDriver().findElement(By.id(ConfigsReader.getProperty("userNameId"))) .sendKeys(ConfigsReader.getProperty("invalidUserName")); Driver.getDriver().findElement(By.id(ConfigsReader.getProperty("passWordId"))) .sendKeys(ConfigsReader.getProperty("validPassWord")); Driver.getDriver().findElement(By.id(ConfigsReader.getProperty("loginButtonId"))).click(); } // 4. invalid username, invalid password @Test(priority = 0, groups = { "login" }) public void Login_InvalidUsername_InvalidPassword() { Driver.getDriver().findElement(By.id(ConfigsReader.getProperty("userNameId"))) .sendKeys(ConfigsReader.getProperty("invalidUserName")); Driver.getDriver().findElement(By.id(ConfigsReader.getProperty("passWordId"))) .sendKeys(ConfigsReader.getProperty("invalidUserName")); Driver.getDriver().findElement(By.id(ConfigsReader.getProperty("loginButtonId"))).click(); } // 5. blank username , valid password @Test(priority = 0, groups = { "login" }) public void BlankUsername_validPassword() { Driver.getDriver().findElement(By.id(ConfigsReader.getProperty("userNameId"))) .sendKeys(ConfigsReader.getProperty("blankUserName")); Driver.getDriver().findElement(By.id(ConfigsReader.getProperty("passWordId"))) .sendKeys(ConfigsReader.getProperty("validPassWord")); Driver.getDriver().findElement(By.id(ConfigsReader.getProperty("loginButtonId"))).click(); } // 6. valid username, blank password @Test(priority = 0, groups = { "login" }) public void Login_InvalidUsername_BlankPassword() { Driver.getDriver().findElement(By.id(ConfigsReader.getProperty("userNameId"))) .sendKeys(ConfigsReader.getProperty("validUserName")); Driver.getDriver().findElement(By.id(ConfigsReader.getProperty("passWordId"))) .sendKeys(ConfigsReader.getProperty("blankPassword")); Driver.getDriver().findElement(By.id(ConfigsReader.getProperty("loginButtonId"))).click(); } }
true
c9850fb51bd41c344ec8678fa13b2ee3252ee041
Java
piwpiw/epcis
/epcis-legacy/src/main/java/org/oliot/epcis/service/query/mongodb/MongoQueryService.java
UTF-8
106,181
1.515625
2
[ "Apache-2.0" ]
permissive
package org.oliot.epcis.service.query.mongodb; import static org.quartz.CronScheduleBuilder.cronSchedule; import static org.quartz.JobBuilder.newJob; import static org.quartz.TriggerBuilder.newTrigger; import java.io.StringWriter; import java.net.MalformedURLException; import java.net.URI; import java.net.URL; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.GregorianCalendar; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import javax.xml.bind.JAXB; import javax.xml.bind.JAXBElement; import javax.xml.datatype.DatatypeConfigurationException; import javax.xml.datatype.DatatypeFactory; import javax.xml.datatype.XMLGregorianCalendar; import javax.xml.namespace.QName; import org.apache.log4j.Level; import org.bson.BsonArray; import org.bson.BsonDocument; import org.bson.BsonInt32; import org.bson.BsonInt64; import org.bson.BsonString; import org.json.JSONArray; import org.json.JSONObject; import org.oliot.epcis.configuration.Configuration; import org.oliot.epcis.security.OAuthUtil; import org.oliot.epcis.serde.mongodb.AggregationEventReadConverter; import org.oliot.epcis.serde.mongodb.MasterDataReadConverter; import org.oliot.epcis.serde.mongodb.ObjectEventReadConverter; import org.oliot.epcis.serde.mongodb.QuantityEventReadConverter; import org.oliot.epcis.serde.mongodb.TransactionEventReadConverter; import org.oliot.epcis.serde.mongodb.TransformationEventReadConverter; import org.oliot.epcis.service.subscription.MongoSubscription; import org.oliot.epcis.service.subscription.MongoSubscriptionTask; import org.oliot.epcis.service.subscription.TriggerEngine; import org.oliot.model.epcis.AggregationEventType; import org.oliot.model.epcis.AttributeType; import org.oliot.model.epcis.EPCISQueryBodyType; import org.oliot.model.epcis.EPCISQueryDocumentType; import org.oliot.model.epcis.EventListType; import org.oliot.model.epcis.InvalidURIException; import org.oliot.model.epcis.ObjectEventType; import org.oliot.model.epcis.QuantityEventType; import org.oliot.model.epcis.QueryParam; import org.oliot.model.epcis.QueryParameterException; import org.oliot.model.epcis.QueryParams; import org.oliot.model.epcis.QueryResults; import org.oliot.model.epcis.QueryResultsBody; import org.oliot.model.epcis.QuerySchedule; import org.oliot.model.epcis.QueryTooLargeException; import org.oliot.model.epcis.SubscribeNotPermittedException; import org.oliot.model.epcis.SubscriptionControls; import org.oliot.model.epcis.SubscriptionControlsException; import org.oliot.model.epcis.SubscriptionType; import org.oliot.model.epcis.TransactionEventType; import org.oliot.model.epcis.TransformationEventType; import org.oliot.model.epcis.VocabularyElementType; import org.oliot.model.epcis.VocabularyListType; import org.oliot.model.epcis.VocabularyType; import org.quartz.JobDataMap; import org.quartz.JobDetail; import org.quartz.SchedulerException; import org.quartz.Trigger; import org.springframework.web.bind.annotation.PathVariable; import static org.quartz.TriggerKey.*; import static org.quartz.JobKey.*; import com.mongodb.client.FindIterable; import com.mongodb.client.MongoCollection; import com.mongodb.client.MongoCursor; import static org.oliot.epcis.service.query.mongodb.MongoQueryUtil.*; /** * Copyright (C) 2014-2016 Jaewook Byun * * This project is part of Oliot (oliot.org), pursuing the implementation of * Electronic Product Code Information Service(EPCIS) v1.1 specification in * EPCglobal. * [http://www.gs1.org/gsmp/kc/epcglobal/epcis/epcis_1_1-standard-20140520.pdf] * * * @author Jaewook Byun, Ph.D student * * Korea Advanced Institute of Science and Technology (KAIST) * * Real-time Embedded System Laboratory(RESL) * * bjw0829@kaist.ac.kr, bjw0829@gmail.com */ public class MongoQueryService { public String subscribe(SubscriptionType subscription) { String queryName = subscription.getQueryName(); String subscriptionID = subscription.getSubscriptionID(); String dest = subscription.getDest(); String cronExpression = subscription.getCronExpression(); boolean reportIfEmpty = subscription.isReportIfEmpty(); String initialRecordTime = subscription.getInitialRecordTime(); String eventType = subscription.getEventType(); String GE_eventTime = subscription.getGE_eventTime(); String LT_eventTime = subscription.getLT_eventTime(); String GE_recordTime = subscription.getGE_recordTime(); String LT_recordTime = subscription.getLT_recordTime(); String EQ_action = subscription.getEQ_action(); String EQ_bizStep = subscription.getEQ_bizStep(); String EQ_disposition = subscription.getEQ_disposition(); String EQ_readPoint = subscription.getEQ_readPoint(); String WD_readPoint = subscription.getWD_readPoint(); String EQ_bizLocation = subscription.getEQ_bizLocation(); String WD_bizLocation = subscription.getWD_bizLocation(); String EQ_transformationID = subscription.getEQ_transformationID(); String MATCH_epc = subscription.getMATCH_epc(); String MATCH_parentID = subscription.getMATCH_parentID(); String MATCH_inputEPC = subscription.getMATCH_inputEPC(); String MATCH_outputEPC = subscription.getMATCH_outputEPC(); String MATCH_anyEPC = subscription.getMATCH_anyEPC(); String MATCH_epcClass = subscription.getMATCH_epcClass(); String MATCH_inputEPCClass = subscription.getMATCH_inputEPCClass(); String MATCH_outputEPCClass = subscription.getMATCH_outputEPCClass(); String MATCH_anyEPCClass = subscription.getMATCH_anyEPCClass(); String EQ_quantity = subscription.getEQ_quantity(); String GT_quantity = subscription.getGT_quantity(); String GE_quantity = subscription.getGE_quantity(); String LT_quantity = subscription.getLT_quantity(); String LE_quantity = subscription.getLE_quantity(); String orderBy = subscription.getOrderBy(); String orderDirection = subscription.getOrderDirection(); String eventCountLimit = subscription.getEventCountLimit(); String maxEventCount = subscription.getMaxEventCount(); Map<String, String> paramMap = subscription.getParamMap(); // Oliot EPCIS doesn't support ignoreReceivedEvent for SOAP Interface // Oliot EPCIS doesn't support triggered subscription for SOAP Interface String result = subscribe(queryName, subscriptionID, dest, cronExpression, true, false, reportIfEmpty, initialRecordTime, eventType, GE_eventTime, LT_eventTime, GE_recordTime, LT_recordTime, EQ_action, EQ_bizStep, EQ_disposition, EQ_readPoint, WD_readPoint, EQ_bizLocation, WD_bizLocation, EQ_transformationID, MATCH_epc, MATCH_parentID, MATCH_inputEPC, MATCH_outputEPC, MATCH_anyEPC, MATCH_epcClass, MATCH_inputEPCClass, MATCH_outputEPCClass, MATCH_anyEPCClass, EQ_quantity, GT_quantity, GE_quantity, LT_quantity, LE_quantity, orderBy, orderDirection, eventCountLimit, maxEventCount, null, paramMap); return result; } public String subscribeEventQuery(String queryName, String subscriptionID, String dest, String cronExpression, boolean isScheduledSubscription, boolean ignoreReceivedEvent, boolean reportIfEmpty, String initialRecordTimeStr, String eventType, String GE_eventTime, String LT_eventTime, String GE_recordTime, String LT_recordTime, String EQ_action, String EQ_bizStep, String EQ_disposition, String EQ_readPoint, String WD_readPoint, String EQ_bizLocation, String WD_bizLocation, String EQ_transformationID, String MATCH_epc, String MATCH_parentID, String MATCH_inputEPC, String MATCH_outputEPC, String MATCH_anyEPC, String MATCH_epcClass, String MATCH_inputEPCClass, String MATCH_outputEPCClass, String MATCH_anyEPCClass, String EQ_quantity, String GT_quantity, String GE_quantity, String LT_quantity, String LE_quantity, String orderBy, String orderDirection, String eventCountLimit, String maxEventCount, String format, Map<String, String> paramMap) { // M27 - query params' constraint // M39 - query params' constraint String reason = checkConstraintSimpleEventQuery(queryName, eventType, GE_eventTime, LT_eventTime, GE_recordTime, LT_recordTime, EQ_action, EQ_bizStep, EQ_disposition, EQ_readPoint, WD_readPoint, EQ_bizLocation, WD_bizLocation, EQ_transformationID, MATCH_epc, MATCH_parentID, MATCH_inputEPC, MATCH_outputEPC, MATCH_anyEPC, MATCH_epcClass, MATCH_inputEPCClass, MATCH_outputEPCClass, MATCH_anyEPCClass, EQ_quantity, GT_quantity, GE_quantity, LT_quantity, LE_quantity, orderBy, orderDirection, eventCountLimit, maxEventCount, paramMap); if (reason != null) { return makeErrorResult(reason, QueryParameterException.class); } // Existing subscription Check MongoCollection<BsonDocument> collection = Configuration.mongoDatabase.getCollection("Subscription", BsonDocument.class); BsonDocument exist = collection.find(new BsonDocument("subscriptionID", new BsonString(subscriptionID))) .first(); if (exist != null) { return "SubscriptionID : " + subscriptionID + " is already subscribed. "; } // cron Example // 0/10 * * * * ? : every 10 second // M30 try { cronSchedule(cronExpression); } catch (RuntimeException e) { return makeErrorResult(e.toString(), SubscriptionControlsException.class); } // Add Schedule with Query if (isScheduledSubscription == true) { addScheduleToQuartz(queryName, subscriptionID, dest, cronExpression, isScheduledSubscription, ignoreReceivedEvent, reportIfEmpty, initialRecordTimeStr, eventType, GE_eventTime, LT_eventTime, GE_recordTime, LT_recordTime, EQ_action, EQ_bizStep, EQ_disposition, EQ_readPoint, WD_readPoint, EQ_bizLocation, WD_bizLocation, EQ_transformationID, MATCH_epc, MATCH_parentID, MATCH_inputEPC, MATCH_outputEPC, MATCH_anyEPC, MATCH_epcClass, MATCH_inputEPCClass, MATCH_outputEPCClass, MATCH_anyEPCClass, EQ_quantity, GT_quantity, GE_quantity, LT_quantity, LE_quantity, orderBy, orderDirection, eventCountLimit, maxEventCount, format, paramMap); } else { // Add Trigger with Query SubscriptionType subscription = new SubscriptionType(queryName, subscriptionID, dest, cronExpression, isScheduledSubscription, ignoreReceivedEvent, reportIfEmpty, initialRecordTimeStr, eventType, GE_eventTime, LT_eventTime, GE_recordTime, LT_recordTime, EQ_action, EQ_bizStep, EQ_disposition, EQ_readPoint, WD_readPoint, EQ_bizLocation, WD_bizLocation, EQ_transformationID, MATCH_epc, MATCH_parentID, MATCH_inputEPC, MATCH_outputEPC, MATCH_anyEPC, MATCH_epcClass, MATCH_inputEPCClass, MATCH_outputEPCClass, MATCH_anyEPCClass, EQ_quantity, GT_quantity, GE_quantity, LT_quantity, LE_quantity, orderBy, orderDirection, eventCountLimit, maxEventCount, format, paramMap); TriggerEngine.addTriggerSubscription(subscriptionID, subscription); } // Manage Subscription Persistently addScheduleToDB(queryName, subscriptionID, dest, cronExpression, isScheduledSubscription, ignoreReceivedEvent, reportIfEmpty, initialRecordTimeStr, eventType, GE_eventTime, LT_eventTime, GE_recordTime, LT_recordTime, EQ_action, EQ_bizStep, EQ_disposition, EQ_readPoint, WD_readPoint, EQ_bizLocation, WD_bizLocation, EQ_transformationID, MATCH_epc, MATCH_parentID, MATCH_inputEPC, MATCH_outputEPC, MATCH_anyEPC, MATCH_epcClass, MATCH_inputEPCClass, MATCH_outputEPCClass, MATCH_anyEPCClass, EQ_quantity, GT_quantity, GE_quantity, LT_quantity, LE_quantity, orderBy, orderDirection, eventCountLimit, maxEventCount, format, paramMap); String retString = "SubscriptionID : " + subscriptionID + " is successfully triggered. "; return retString; } // Soap Query Adaptor public void subscribe(String queryName, QueryParams params, URI dest, SubscriptionControls controls, String subscriptionID) { List<QueryParam> queryParamList = params.getParam(); String destStr = dest.toString(); String eventType = null; String GE_eventTime = null; String LT_eventTime = null; String GE_recordTime = null; String LT_recordTime = null; String EQ_action = null; String EQ_bizStep = null; String EQ_disposition = null; String EQ_readPoint = null; String WD_readPoint = null; String EQ_bizLocation = null; String WD_bizLocation = null; String EQ_transformationID = null; String MATCH_epc = null; String MATCH_parentID = null; String MATCH_inputEPC = null; String MATCH_outputEPC = null; String MATCH_anyEPC = null; String MATCH_epcClass = null; String MATCH_inputEPCClass = null; String MATCH_outputEPCClass = null; String MATCH_anyEPCClass = null; String EQ_quantity = null; String GT_quantity = null; String GE_quantity = null; String LT_quantity = null; String LE_quantity = null; String orderBy = null; String orderDirection = null; String eventCountLimit = null; String maxEventCount = null; String cronExpression = null; boolean reportIfEmpty = false; Map<String, String> extMap = new HashMap<String, String>(); for (int i = 0; i < queryParamList.size(); i++) { QueryParam qp = queryParamList.get(i); String name = qp.getName(); String value = (String) qp.getValue(); if (name.equals("cronExpression")) { cronExpression = value; continue; } else if (name.equals("eventType")) { eventType = value; continue; } else if (name.equals("GE_eventTime")) { GE_eventTime = value; continue; } else if (name.equals("LT_eventTime")) { LT_eventTime = value; continue; } else if (name.equals("GE_recordTime")) { GE_recordTime = value; continue; } else if (name.equals("LT_recordTime")) { LT_recordTime = value; continue; } else if (name.equals("EQ_action")) { EQ_action = value; continue; } else if (name.equals("EQ_bizStep")) { EQ_bizStep = value; continue; } else if (name.equals("EQ_disposition")) { EQ_disposition = value; continue; } else if (name.equals("EQ_readPoint")) { EQ_readPoint = value; continue; } else if (name.equals("WD_readPoint")) { WD_readPoint = value; continue; } else if (name.equals("EQ_bizLocation")) { EQ_bizLocation = value; continue; } else if (name.equals("WD_bizLocation")) { WD_bizLocation = value; continue; } else if (name.equals("EQ_transformationID")) { EQ_transformationID = value; continue; } else if (name.equals("MATCH_epc")) { MATCH_epc = value; continue; } else if (name.equals("MATCH_parentID")) { MATCH_parentID = value; continue; } else if (name.equals("MATCH_inputEPC")) { MATCH_inputEPC = value; continue; } else if (name.equals("MATCH_outputEPC")) { MATCH_outputEPC = value; continue; } else if (name.equals("MATCH_anyEPC")) { MATCH_anyEPC = value; continue; } else if (name.equals("MATCH_epcClass")) { MATCH_epcClass = value; continue; } else if (name.equals("MATCH_inputEPCClass")) { MATCH_inputEPCClass = value; continue; } else if (name.equals("MATCH_outputEPCClass")) { MATCH_outputEPCClass = value; continue; } else if (name.equals("MATCH_anyEPCClass")) { MATCH_anyEPCClass = value; continue; } else if (name.equals("EQ_quantity")) { EQ_quantity = value; continue; } else if (name.equals("GT_quantity")) { GT_quantity = value; continue; } else if (name.equals("GE_quantity")) { GE_quantity = value; continue; } else if (name.equals("LT_quantity")) { LT_quantity = value; continue; } else if (name.equals("LE_quantity")) { LE_quantity = value; continue; } else if (name.equals("orderBy")) { orderBy = value; continue; } else if (name.equals("orderDirection")) { orderDirection = value; continue; } else if (name.equals("eventCountLimit")) { eventCountLimit = value; continue; } else if (name.equals("maxEventCount")) { maxEventCount = value; continue; } else { extMap.put(name, value); } } // Subscription Control Processing /* * QuerySchedule: (Optional) Defines the periodic schedule on which the * query is to be executed. See Section 8.2.5.3. Exactly one of schedule * or trigger is required; if both are specified or both are omitted, * the implementation SHALL raise a SubscriptionControls- Exception.. */ QuerySchedule querySchedule = controls.getSchedule(); if (cronExpression == null) { String sec = querySchedule.getSecond(); String min = querySchedule.getMinute(); String hours = querySchedule.getHour(); String dayOfMonth = querySchedule.getDayOfMonth(); String month = querySchedule.getMonth(); String dayOfWeek = querySchedule.getDayOfWeek(); cronExpression = sec + " " + min + " " + hours + " " + dayOfMonth + " " + month + " " + dayOfWeek; } /* * InitialRecordTime: (Optional) Specifies a time used to constrain what * events are considered when processing the query when it is executed * for the first time. See Section 8.2.5.2. If omitted, defaults to the * time at which the subscription is created. */ XMLGregorianCalendar initialRecordTime = controls.getInitialRecordTime(); if (initialRecordTime == null) { try { initialRecordTime = DatatypeFactory.newInstance().newXMLGregorianCalendar(); } catch (DatatypeConfigurationException e) { e.printStackTrace(); } } SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX"); Date initialRecordDate = initialRecordTime.toGregorianCalendar().getTime(); String initialRecordTimeStr = sdf.format(initialRecordDate); /* * reportIfEmpty: If true, a QueryResults instance is always sent to the * subscriber when the query is executed. If false, a QueryResults * instance is sent to the subscriber only when the results are * non-empty. */ reportIfEmpty = controls.isReportIfEmpty(); // Oliot doesn't support ignoreReceivedEvent for SOAP interface // Oliot doesn't support to select output format for SOAP interface subscribe(queryName, subscriptionID, destStr, cronExpression, true, false, reportIfEmpty, initialRecordTimeStr, eventType, GE_eventTime, LT_eventTime, GE_recordTime, LT_recordTime, EQ_action, EQ_bizStep, EQ_disposition, EQ_readPoint, WD_readPoint, EQ_bizLocation, WD_bizLocation, EQ_transformationID, MATCH_epc, MATCH_parentID, MATCH_inputEPC, MATCH_outputEPC, MATCH_anyEPC, MATCH_epcClass, MATCH_inputEPCClass, MATCH_outputEPCClass, MATCH_anyEPCClass, EQ_quantity, GT_quantity, GE_quantity, LT_quantity, LE_quantity, orderBy, orderDirection, eventCountLimit, maxEventCount, null, extMap); } public String subscribe(String queryName, String subscriptionID, String dest, String cronExpression, boolean isScheduledSubscription, boolean ignoreReceivedEvent, boolean reportIfEmpty, String initialRecordTimeStr, String eventType, String GE_eventTime, String LT_eventTime, String GE_recordTime, String LT_recordTime, String EQ_action, String EQ_bizStep, String EQ_disposition, String EQ_readPoint, String WD_readPoint, String EQ_bizLocation, String WD_bizLocation, String EQ_transformationID, String MATCH_epc, String MATCH_parentID, String MATCH_inputEPC, String MATCH_outputEPC, String MATCH_anyEPC, String MATCH_epcClass, String MATCH_inputEPCClass, String MATCH_outputEPCClass, String MATCH_anyEPCClass, String EQ_quantity, String GT_quantity, String GE_quantity, String LT_quantity, String LE_quantity, String orderBy, String orderDirection, String eventCountLimit, String maxEventCount, String format, Map<String, String> paramMap) { // M20 : Throw an InvalidURIException for an incorrect dest argument in // the subscribe method in EPCIS Query Control Interface try { new URL(dest); } catch (MalformedURLException e) { return makeErrorResult(e.toString(), InvalidURIException.class); } // M24 : Virtual Error Handling // Automatically processed by URI param if (dest == null || cronExpression == null) { return makeErrorResult("Fill the mandatory field in subscribe method", QueryParameterException.class); } // M46 if (queryName.equals("SimpleMasterDataQuery")) { return makeErrorResult("SimpleMasterDataQuery is not available in subscription method", SubscribeNotPermittedException.class); } String retString = ""; if (queryName.equals("SimpleEventQuery")) { retString = subscribeEventQuery(queryName, subscriptionID, dest, cronExpression, isScheduledSubscription, ignoreReceivedEvent, reportIfEmpty, initialRecordTimeStr, eventType, GE_eventTime, LT_eventTime, GE_recordTime, LT_recordTime, EQ_action, EQ_bizStep, EQ_disposition, EQ_readPoint, WD_readPoint, EQ_bizLocation, WD_bizLocation, EQ_transformationID, MATCH_epc, MATCH_parentID, MATCH_inputEPC, MATCH_outputEPC, MATCH_anyEPC, MATCH_epcClass, MATCH_inputEPCClass, MATCH_outputEPCClass, MATCH_anyEPCClass, EQ_quantity, GT_quantity, GE_quantity, LT_quantity, LE_quantity, orderBy, orderDirection, eventCountLimit, maxEventCount, format, paramMap); } return retString; } public void unsubscribe(String subscriptionID) { MongoCollection<BsonDocument> collection = Configuration.mongoDatabase.getCollection("Subscription", BsonDocument.class); // Its size should be 0 or 1 BsonDocument s = collection .findOneAndDelete(new BsonDocument("subscriptionID", new BsonString(subscriptionID))); if (s != null) { SubscriptionType subscription = new SubscriptionType(s); if (subscription.isScheduledSubscription() == true) { // Remove from current Quartz removeScheduleFromQuartz(subscription); }else{ TriggerEngine.removeTriggerSubscription(subscription.getSubscriptionID()); } } } public String getSubscriptionIDsREST(@PathVariable String queryName) { JSONArray retArray = new JSONArray(); MongoCollection<BsonDocument> collection = Configuration.mongoDatabase.getCollection("Subscription", BsonDocument.class); Iterator<BsonDocument> subIterator = collection .find(new BsonDocument("queryName", new BsonString(queryName)), BsonDocument.class).iterator(); while (subIterator.hasNext()) { BsonDocument subscription = subIterator.next(); retArray.put(subscription.getString("subscriptionID").asString()); } return retArray.toString(1); } public List<String> getSubscriptionIDs(String queryName) { List<String> retList = new ArrayList<String>(); MongoCollection<BsonDocument> collection = Configuration.mongoDatabase.getCollection("Subscription", BsonDocument.class); Iterator<BsonDocument> subIterator = collection .find(new BsonDocument("queryName", new BsonString(queryName)), BsonDocument.class).iterator(); while (subIterator.hasNext()) { BsonDocument subscription = subIterator.next(); retList.add(subscription.getString("subscriptionID").asString().getValue()); } return retList; } @SuppressWarnings({ "unchecked", "rawtypes" }) public String pollEventQuery(String queryName, String eventType, String GE_eventTime, String LT_eventTime, String GE_recordTime, String LT_recordTime, String EQ_action, String EQ_bizStep, String EQ_disposition, String EQ_readPoint, String WD_readPoint, String EQ_bizLocation, String WD_bizLocation, String EQ_transformationID, String MATCH_epc, String MATCH_parentID, String MATCH_inputEPC, String MATCH_outputEPC, String MATCH_anyEPC, String MATCH_epcClass, String MATCH_inputEPCClass, String MATCH_outputEPCClass, String MATCH_anyEPCClass, String EQ_quantity, String GT_quantity, String GE_quantity, String LT_quantity, String LE_quantity, String orderBy, String orderDirection, String eventCountLimit, String maxEventCount, String format, String userID, List<String> friendList, Map<String, String> paramMap) { // M27 - query params' constraint // M39 - query params' constraint String reason = checkConstraintSimpleEventQuery(queryName, eventType, GE_eventTime, LT_eventTime, GE_recordTime, LT_recordTime, EQ_action, EQ_bizStep, EQ_disposition, EQ_readPoint, WD_readPoint, EQ_bizLocation, WD_bizLocation, EQ_transformationID, MATCH_epc, MATCH_parentID, MATCH_inputEPC, MATCH_outputEPC, MATCH_anyEPC, MATCH_epcClass, MATCH_inputEPCClass, MATCH_outputEPCClass, MATCH_anyEPCClass, EQ_quantity, GT_quantity, GE_quantity, LT_quantity, LE_quantity, orderBy, orderDirection, eventCountLimit, maxEventCount, paramMap); if (reason != null) { return makeErrorResult(reason, QueryParameterException.class); } // Make Base Result Document EPCISQueryDocumentType epcisQueryDocumentType = null; JSONObject retJSON = new JSONObject(); if (format == null || format.equals("XML")) { epcisQueryDocumentType = makeBaseResultDocument(queryName); } else if (format.equals("JSON")) { // Do Nothing } else { return makeErrorResult("format param should be one of XML or JSON", QueryParameterException.class); } // Prepare container which query results are included // eventObjects : Container which all the query results (events) will be // contained List<Object> eventObjects = null; if (format == null || format.equals("XML")) { eventObjects = epcisQueryDocumentType.getEPCISBody().getQueryResults().getResultsBody().getEventList() .getObjectEventOrAggregationEventOrQuantityEvent(); } else { // foramt == JSON -> Do Nothing } // To be filtered by eventType boolean toGetAggregationEvent = true; boolean toGetObjectEvent = true; boolean toGetQuantityEvent = true; boolean toGetTransactionEvent = true; boolean toGetTransformationEvent = true; /** * EventType : If specified, the result will only include events whose * type matches one of the types specified in the parameter value. Each * element of the parameter value may be one of the following strings: * ObjectEvent, AggregationEvent, QuantityEvent, TransactionEvent, or * TransformationEvent. An element of the parameter value may also be * the name of an extension event type. If omitted, all event types will * be considered for inclusion in the result. */ if (eventType != null) { toGetAggregationEvent = false; toGetObjectEvent = false; toGetQuantityEvent = false; toGetTransactionEvent = false; toGetTransformationEvent = false; String[] eventTypeArray = eventType.split(","); for (int i = 0; i < eventTypeArray.length; i++) { String eventTypeString = eventTypeArray[i]; if (eventTypeString != null) eventTypeString = eventTypeString.trim(); if (eventTypeString.equals("AggregationEvent")) toGetAggregationEvent = true; else if (eventTypeString.equals("ObjectEvent")) toGetObjectEvent = true; else if (eventTypeString.equals("QuantityEvent")) toGetQuantityEvent = true; else if (eventTypeString.equals("TransactionEvent")) toGetTransactionEvent = true; else if (eventTypeString.equals("TransformationEvent")) toGetTransformationEvent = true; } } if (toGetAggregationEvent == true) { // Aggregation Event Collection MongoCollection<BsonDocument> collection = Configuration.mongoDatabase.getCollection("AggregationEvent", BsonDocument.class); // Queries BsonArray queryList = makeQueryObjects("AggregationEvent", GE_eventTime, LT_eventTime, GE_recordTime, LT_recordTime, EQ_action, EQ_bizStep, EQ_disposition, EQ_readPoint, WD_readPoint, EQ_bizLocation, WD_bizLocation, EQ_transformationID, MATCH_epc, MATCH_parentID, MATCH_inputEPC, MATCH_outputEPC, MATCH_anyEPC, MATCH_epcClass, MATCH_inputEPCClass, MATCH_outputEPCClass, MATCH_anyEPCClass, EQ_quantity, GT_quantity, GE_quantity, LT_quantity, LE_quantity, orderBy, orderDirection, eventCountLimit, maxEventCount, paramMap); // Merge All the queries with $and BsonDocument baseQuery = new BsonDocument(); FindIterable<BsonDocument> cursor; if (queryList.isEmpty() == false) { BsonArray aggreQueryList = new BsonArray(); for (int i = 0; i < queryList.size(); i++) { aggreQueryList.add(queryList.get(i)); } baseQuery.put("$and", aggreQueryList); // Query cursor = collection.find(baseQuery); } else { cursor = collection.find(); } // Sort and Limit cursor = makeSortedLimitedCursor(cursor, orderBy, orderDirection, eventCountLimit); JSONArray aggrJSONArray = new JSONArray(); MongoCursor<BsonDocument> slCursor = cursor.iterator(); while (slCursor.hasNext()) { BsonDocument dbObject = slCursor.next(); if (OAuthUtil.isAccessible(userID, friendList, dbObject) == false) { continue; } if (format == null || format.equals("XML")) { AggregationEventReadConverter con = new AggregationEventReadConverter(); JAXBElement element = new JAXBElement(new QName("AggregationEvent"), AggregationEventType.class, con.convert(dbObject)); eventObjects.add(element); } else { dbObject.remove("_id"); aggrJSONArray.put(dbObject); } } if (aggrJSONArray.length() > 0) { retJSON.put("AggregationEvent", aggrJSONArray); } } // For Each Event Type! if (toGetObjectEvent == true) { MongoCollection<BsonDocument> collection = Configuration.mongoDatabase.getCollection("ObjectEvent", BsonDocument.class); // Queries BsonArray queryList = makeQueryObjects("ObjectEvent", GE_eventTime, LT_eventTime, GE_recordTime, LT_recordTime, EQ_action, EQ_bizStep, EQ_disposition, EQ_readPoint, WD_readPoint, EQ_bizLocation, WD_bizLocation, EQ_transformationID, MATCH_epc, MATCH_parentID, MATCH_inputEPC, MATCH_outputEPC, MATCH_anyEPC, MATCH_epcClass, MATCH_inputEPCClass, MATCH_outputEPCClass, MATCH_anyEPCClass, EQ_quantity, GT_quantity, GE_quantity, LT_quantity, LE_quantity, orderBy, orderDirection, eventCountLimit, maxEventCount, paramMap); // Merge All the queries with $and BsonDocument baseQuery = new BsonDocument(); FindIterable<BsonDocument> cursor; if (queryList.isEmpty() == false) { BsonArray aggreQueryList = new BsonArray(); for (int i = 0; i < queryList.size(); i++) { aggreQueryList.add(queryList.get(i)); } baseQuery.put("$and", aggreQueryList); // Query cursor = collection.find(baseQuery); } else { cursor = collection.find(); } // Sort and Limit cursor = makeSortedLimitedCursor(cursor, orderBy, orderDirection, eventCountLimit); JSONArray objJSONArray = new JSONArray(); MongoCursor<BsonDocument> slCursor = cursor.iterator(); while (slCursor.hasNext()) { BsonDocument dbObject = slCursor.next(); if (OAuthUtil.isAccessible(userID, friendList, dbObject) == false) { continue; } if (format == null || format.equals("XML")) { ObjectEventReadConverter con = new ObjectEventReadConverter(); JAXBElement element = new JAXBElement(new QName("ObjectEvent"), ObjectEventType.class, con.convert(dbObject)); eventObjects.add(element); } else { dbObject.remove("_id"); objJSONArray.put(dbObject); } } if (objJSONArray.length() > 0) { retJSON.put("ObjectEvent", objJSONArray); } } if (toGetQuantityEvent == true) { MongoCollection<BsonDocument> collection = Configuration.mongoDatabase.getCollection("QuantityEvent", BsonDocument.class); // Queries BsonArray queryList = makeQueryObjects("QuantityEvent", GE_eventTime, LT_eventTime, GE_recordTime, LT_recordTime, EQ_action, EQ_bizStep, EQ_disposition, EQ_readPoint, WD_readPoint, EQ_bizLocation, WD_bizLocation, EQ_transformationID, MATCH_epc, MATCH_parentID, MATCH_inputEPC, MATCH_outputEPC, MATCH_anyEPC, MATCH_epcClass, MATCH_inputEPCClass, MATCH_outputEPCClass, MATCH_anyEPCClass, EQ_quantity, GT_quantity, GE_quantity, LT_quantity, LE_quantity, orderBy, orderDirection, eventCountLimit, maxEventCount, paramMap); // Merge All the queries with $and BsonDocument baseQuery = new BsonDocument(); FindIterable<BsonDocument> cursor; if (queryList.isEmpty() == false) { BsonArray aggreQueryList = new BsonArray(); for (int i = 0; i < queryList.size(); i++) { aggreQueryList.add(queryList.get(i)); } baseQuery.put("$and", aggreQueryList); // Query cursor = collection.find(baseQuery); } else { cursor = collection.find(); } // Sort and Limit cursor = makeSortedLimitedCursor(cursor, orderBy, orderDirection, eventCountLimit); JSONArray qntJSONArray = new JSONArray(); MongoCursor<BsonDocument> slCursor = cursor.iterator(); while (slCursor.hasNext()) { BsonDocument dbObject = slCursor.next(); if (OAuthUtil.isAccessible(userID, friendList, dbObject) == false) { continue; } if (format == null || format.equals("XML")) { QuantityEventReadConverter con = new QuantityEventReadConverter(); JAXBElement element = new JAXBElement(new QName("QuantityEvent"), QuantityEventType.class, con.convert(dbObject)); eventObjects.add(element); } else { dbObject.remove("_id"); qntJSONArray.put(dbObject); } } if (qntJSONArray.length() > 0) { retJSON.put("QuantityEvent", qntJSONArray); } } if (toGetTransactionEvent == true) { MongoCollection<BsonDocument> collection = Configuration.mongoDatabase.getCollection("TransactionEvent", BsonDocument.class); // Queries BsonArray queryList = makeQueryObjects("TransactionEvent", GE_eventTime, LT_eventTime, GE_recordTime, LT_recordTime, EQ_action, EQ_bizStep, EQ_disposition, EQ_readPoint, WD_readPoint, EQ_bizLocation, WD_bizLocation, EQ_transformationID, MATCH_epc, MATCH_parentID, MATCH_inputEPC, MATCH_outputEPC, MATCH_anyEPC, MATCH_epcClass, MATCH_inputEPCClass, MATCH_outputEPCClass, MATCH_anyEPCClass, EQ_quantity, GT_quantity, GE_quantity, LT_quantity, LE_quantity, orderBy, orderDirection, eventCountLimit, maxEventCount, paramMap); // Merge All the queries with $and BsonDocument baseQuery = new BsonDocument(); FindIterable<BsonDocument> cursor; if (queryList.isEmpty() == false) { BsonArray aggreQueryList = new BsonArray(); for (int i = 0; i < queryList.size(); i++) { aggreQueryList.add(queryList.get(i)); } baseQuery.put("$and", aggreQueryList); // Query cursor = collection.find(baseQuery); } else { cursor = collection.find(); } // Sort and Limit cursor = makeSortedLimitedCursor(cursor, orderBy, orderDirection, eventCountLimit); JSONArray transactionJSONArray = new JSONArray(); MongoCursor<BsonDocument> slCursor = cursor.iterator(); while (slCursor.hasNext()) { BsonDocument dbObject = slCursor.next(); if (OAuthUtil.isAccessible(userID, friendList, dbObject) == false) { continue; } if (format == null || format.equals("XML")) { TransactionEventReadConverter con = new TransactionEventReadConverter(); JAXBElement element = new JAXBElement(new QName("TransactionEvent"), TransactionEventType.class, con.convert(dbObject)); eventObjects.add(element); } else { dbObject.remove("_id"); transactionJSONArray.put(dbObject); } } if (transactionJSONArray.length() > 0) { retJSON.put("TransactionEvent", transactionJSONArray); } } if (toGetTransformationEvent == true) { MongoCollection<BsonDocument> collection = Configuration.mongoDatabase.getCollection("TransformationEvent", BsonDocument.class); // Queries BsonArray queryList = makeQueryObjects("TransformationEvent", GE_eventTime, LT_eventTime, GE_recordTime, LT_recordTime, EQ_action, EQ_bizStep, EQ_disposition, EQ_readPoint, WD_readPoint, EQ_bizLocation, WD_bizLocation, EQ_transformationID, MATCH_epc, MATCH_parentID, MATCH_inputEPC, MATCH_outputEPC, MATCH_anyEPC, MATCH_epcClass, MATCH_inputEPCClass, MATCH_outputEPCClass, MATCH_anyEPCClass, EQ_quantity, GT_quantity, GE_quantity, LT_quantity, LE_quantity, orderBy, orderDirection, eventCountLimit, maxEventCount, paramMap); // Merge All the queries with $and BsonDocument baseQuery = new BsonDocument(); FindIterable<BsonDocument> cursor; if (queryList.isEmpty() == false) { BsonArray aggreQueryList = new BsonArray(); for (int i = 0; i < queryList.size(); i++) { aggreQueryList.add(queryList.get(i)); } baseQuery.put("$and", aggreQueryList); // Query cursor = collection.find(baseQuery); } else { cursor = collection.find(); } // Sort and Limit cursor = makeSortedLimitedCursor(cursor, orderBy, orderDirection, eventCountLimit); JSONArray transformationJSONArray = new JSONArray(); MongoCursor<BsonDocument> slCursor = cursor.iterator(); while (slCursor.hasNext()) { BsonDocument dbObject = slCursor.next(); if (OAuthUtil.isAccessible(userID, friendList, dbObject) == false) { continue; } if (format == null || format.equals("XML")) { TransformationEventReadConverter con = new TransformationEventReadConverter(); JAXBElement element = new JAXBElement(new QName("TransformationEvent"), TransformationEventType.class, con.convert(dbObject)); eventObjects.add(element); } else { dbObject.remove("_id"); transformationJSONArray.put(dbObject); } } if (transformationJSONArray.length() > 0) { retJSON.put("TransformationEvent", transformationJSONArray); } } // M44 if (maxEventCount != null) { if (format == null || format.equals("XML")) { if (eventObjects.size() > Integer.parseInt(maxEventCount)) { return makeErrorResult("Violate maxEventCount", QueryTooLargeException.class); } } else { int cnt = 0; if (!retJSON.isNull("AggregationEvent")) { cnt += retJSON.getJSONArray("AggregationEvent").length(); } if (!retJSON.isNull("ObjectEvent")) { cnt += retJSON.getJSONArray("ObjectEvent").length(); } if (!retJSON.isNull("QuantityEvent")) { cnt += retJSON.getJSONArray("QuantityEvent").length(); } if (!retJSON.isNull("TransactionEvent")) { cnt += retJSON.getJSONArray("TransactionEvent").length(); } if (!retJSON.isNull("TransformationEvent")) { cnt += retJSON.getJSONArray("TransformationEvent").length(); } if (cnt > Integer.parseInt(maxEventCount)) { return makeErrorResult("Violate maxEventCount", QueryTooLargeException.class); } } } if (format == null || format.equals("XML")) { StringWriter sw = new StringWriter(); JAXB.marshal(epcisQueryDocumentType, sw); return sw.toString(); } else { // BSONObject doc = (BSONObject) JSON.parse(retJSON.toString()); // BasicBSONEncoder en = new BasicBSONEncoder(); // System.out.println(doc.toString().length()); // byte[] ret = en.encode(doc); // try { // FileUtils.writeByteArrayToFile(new File("/home/jack/temp.bson"), // ret); // } catch (IOException e) { // e.printStackTrace(); // } // System.out.println(ret.length); // return new String(en.encode(doc)); // BasicBSONDecoder de = new BasicBSONDecoder(); // BSONObject obj = de.readObject(ret); // System.out.println(obj); return retJSON.toString(1); } } public String pollMasterDataQuery(String queryName, String vocabularyName, boolean includeAttributes, boolean includeChildren, String attributeNames, String eQ_name, String wD_name, String hASATTR, String maxElementCount, String format, Map<String, String> paramMap) { // Make Base Result Document EPCISQueryDocumentType epcisQueryDocumentType = null; JSONArray retArray = new JSONArray(); if (format == null || format.equals("XML")) { epcisQueryDocumentType = makeBaseResultDocument(queryName); } else if (format.equals("JSON")) { // Do Nothing } else { return makeErrorResult("format param should be one of XML or JSON", QueryParameterException.class); } MongoCollection<BsonDocument> collection = Configuration.mongoDatabase.getCollection("MasterData", BsonDocument.class); // Make Query BsonArray queryList = makeMasterQueryObjects(vocabularyName, includeAttributes, includeChildren, attributeNames, eQ_name, wD_name, hASATTR, maxElementCount, paramMap); // Merge All the queries with $and BsonDocument baseQuery = new BsonDocument(); FindIterable<BsonDocument> cursor; if (queryList.isEmpty() == false) { BsonArray aggreQueryList = new BsonArray(); for (int i = 0; i < queryList.size(); i++) { aggreQueryList.add(queryList.get(i)); } baseQuery.put("$and", aggreQueryList); // Query cursor = collection.find(baseQuery); } else { cursor = collection.find(); } // Cursor needed to ordered List<VocabularyType> vList = new ArrayList<>(); MongoCursor<BsonDocument> slCursor = cursor.iterator(); while (slCursor.hasNext()) { BsonDocument dbObject = slCursor.next(); if (format == null || format.equals("XML")) { MasterDataReadConverter con = new MasterDataReadConverter(); VocabularyType vt = con.convert(dbObject); boolean isMatched = true; if (vt.getVocabularyElementList() != null) { if (vt.getVocabularyElementList().getVocabularyElement() != null) { List<VocabularyElementType> vetList = vt.getVocabularyElementList().getVocabularyElement(); for (int i = 0; i < vetList.size(); i++) { VocabularyElementType vet = vetList.get(i); if (includeAttributes == false) { vet.setAttribute(null); } else if (includeAttributes == true && attributeNames != null) { /** * attributeNames : If specified, only those * attributes whose names match one of the * specified names will be included in the * results. If omitted, all attributes for each * matching vocabulary element will be included. * (To obtain a list of vocabulary element names * with no attributes, specify false for * includeAttributes.) The value of this * parameter SHALL be ignored if * includeAttributes is false. Note that this * parameter does not affect which vocabulary * elements are included in the result; it only * limits which attributes will be included with * each vocabulary element. */ isMatched = false; String[] attrArr = attributeNames.split(","); Set<String> attrSet = new HashSet<String>(); for (int j = 0; j < attrArr.length; j++) { attrSet.add(attrArr[j].trim()); } List<AttributeType> atList = vet.getAttribute(); for (int j = 0; j < atList.size(); j++) { if (attrSet.contains(atList.get(j).getId())) { isMatched = true; } } } if (includeChildren == false) { vet.setChildren(null); } } } } if (isMatched == true) vList.add(vt); } else { boolean isMatched = true; dbObject.remove("_id"); if (includeAttributes == false) { dbObject.remove("attributes"); } else if (includeAttributes == true && attributeNames != null) { String[] attrArr = attributeNames.split(","); Set<String> attrSet = new HashSet<String>(); for (int j = 0; j < attrArr.length; j++) { attrSet.add(attrArr[j].trim()); } BsonDocument attrObject = dbObject.get("attributes").asDocument(); isMatched = false; if (attrObject != null) { Iterator<String> attrKeys = attrObject.keySet().iterator(); while (attrKeys.hasNext()) { String attrKey = attrKeys.next(); if (attrSet.contains(attrKey)) { isMatched = true; } } } } if (includeChildren == false) { dbObject.remove("children"); } if (isMatched == true) { retArray.put(dbObject); } } } if (format == null || format.equals("XML")) { QueryResultsBody qbt = epcisQueryDocumentType.getEPCISBody().getQueryResults().getResultsBody(); VocabularyListType vlt = new VocabularyListType(); vlt.setVocabulary(vList); qbt.setVocabularyList(vlt); } // M47 if (maxElementCount != null) { try { int maxElement = Integer.parseInt(maxElementCount); if (format == null || format.equals("XML")) { if (vList.size() > maxElement) { return makeErrorResult("Too Large Master Data result", QueryTooLargeException.class); } } else { if (retArray.length() > maxElement) { return makeErrorResult("Too Large Master Data result", QueryTooLargeException.class); } } } catch (NumberFormatException e) { } } if (format == null || format.equals("XML")) { StringWriter sw = new StringWriter(); JAXB.marshal(epcisQueryDocumentType, sw); return sw.toString(); } else { return retArray.toString(1); } } // Soap Service Adaptor public String poll(String queryName, QueryParams queryParams) { List<QueryParam> queryParamList = queryParams.getParam(); String eventType = null; String GE_eventTime = null; String LT_eventTime = null; String GE_recordTime = null; String LT_recordTime = null; String EQ_action = null; String EQ_bizStep = null; String EQ_disposition = null; String EQ_readPoint = null; String WD_readPoint = null; String EQ_bizLocation = null; String WD_bizLocation = null; String EQ_transformationID = null; String MATCH_epc = null; String MATCH_parentID = null; String MATCH_inputEPC = null; String MATCH_outputEPC = null; String MATCH_anyEPC = null; String MATCH_epcClass = null; String MATCH_inputEPCClass = null; String MATCH_outputEPCClass = null; String MATCH_anyEPCClass = null; String EQ_quantity = null; String GT_quantity = null; String GE_quantity = null; String LT_quantity = null; String LE_quantity = null; String orderBy = null; String orderDirection = null; String eventCountLimit = null; String maxEventCount = null; String vocabularyName = null; boolean includeAttributes = false; boolean includeChildren = false; String attributeNames = null; String EQ_name = null; String WD_name = null; String HASATTR = null; String maxElementCount = null; Map<String, String> extMap = new HashMap<String, String>(); for (int i = 0; i < queryParamList.size(); i++) { QueryParam qp = queryParamList.get(i); String name = qp.getName(); String value = (String) qp.getValue(); if (name.equals("eventType")) { eventType = value; continue; } else if (name.equals("GE_eventTime")) { GE_eventTime = value; continue; } else if (name.equals("LT_eventTime")) { LT_eventTime = value; continue; } else if (name.equals("GE_recordTime")) { GE_recordTime = value; continue; } else if (name.equals("LT_recordTime")) { LT_recordTime = value; continue; } else if (name.equals("EQ_action")) { EQ_action = value; continue; } else if (name.equals("EQ_bizStep")) { EQ_bizStep = value; continue; } else if (name.equals("EQ_disposition")) { EQ_disposition = value; continue; } else if (name.equals("EQ_readPoint")) { EQ_readPoint = value; continue; } else if (name.equals("WD_readPoint")) { WD_readPoint = value; continue; } else if (name.equals("EQ_bizLocation")) { EQ_bizLocation = value; continue; } else if (name.equals("WD_bizLocation")) { WD_bizLocation = value; continue; } else if (name.equals("EQ_transformationID")) { EQ_transformationID = value; continue; } else if (name.equals("MATCH_epc")) { MATCH_epc = value; continue; } else if (name.equals("MATCH_parentID")) { MATCH_parentID = value; continue; } else if (name.equals("MATCH_inputEPC")) { MATCH_inputEPC = value; continue; } else if (name.equals("MATCH_outputEPC")) { MATCH_outputEPC = value; continue; } else if (name.equals("MATCH_anyEPC")) { MATCH_anyEPC = value; continue; } else if (name.equals("MATCH_epcClass")) { MATCH_epcClass = value; continue; } else if (name.equals("MATCH_inputEPCClass")) { MATCH_inputEPCClass = value; continue; } else if (name.equals("MATCH_outputEPCClass")) { MATCH_outputEPCClass = value; continue; } else if (name.equals("MATCH_anyEPCClass")) { MATCH_anyEPCClass = value; continue; } else if (name.equals("EQ_quantity")) { EQ_quantity = value; continue; } else if (name.equals("GT_quantity")) { GT_quantity = value; continue; } else if (name.equals("GE_quantity")) { GE_quantity = value; continue; } else if (name.equals("LT_quantity")) { LT_quantity = value; continue; } else if (name.equals("LE_quantity")) { LE_quantity = value; continue; } else if (name.equals("orderBy")) { orderBy = value; continue; } else if (name.equals("orderDirection")) { orderDirection = value; continue; } else if (name.equals("eventCountLimit")) { eventCountLimit = value; continue; } else if (name.equals("maxEventCount")) { maxEventCount = value; continue; } else if (name.equals("vocabularyName")) { vocabularyName = value; continue; } else if (name.equals("includeAttributes")) { if (value.equals("true")) includeAttributes = true; else includeAttributes = false; continue; } else if (name.equals("includeChildren")) { if (value.equals("true")) includeChildren = true; else includeChildren = false; continue; } else if (name.equals("attributeNames")) { attributeNames = value; continue; } else if (name.equals("EQ_name")) { EQ_name = value; continue; } else if (name.equals("WD_name")) { WD_name = value; continue; } else if (name.equals("HASATTR")) { HASATTR = value; continue; } else if (name.equals("maxElementCount")) { maxElementCount = value; continue; } else { extMap.put(name, value); } } return poll(queryName, eventType, GE_eventTime, LT_eventTime, GE_recordTime, LT_recordTime, EQ_action, EQ_bizStep, EQ_disposition, EQ_readPoint, WD_readPoint, EQ_bizLocation, WD_bizLocation, EQ_transformationID, MATCH_epc, MATCH_parentID, MATCH_inputEPC, MATCH_outputEPC, MATCH_anyEPC, MATCH_epcClass, MATCH_inputEPCClass, MATCH_outputEPCClass, MATCH_anyEPCClass, EQ_quantity, GT_quantity, GE_quantity, LT_quantity, LE_quantity, orderBy, orderDirection, eventCountLimit, maxEventCount, vocabularyName, includeAttributes, includeChildren, attributeNames, EQ_name, WD_name, HASATTR, maxElementCount, null, null, null, extMap); } public String poll(@PathVariable String queryName, String eventType, String GE_eventTime, String LT_eventTime, String GE_recordTime, String LT_recordTime, String EQ_action, String EQ_bizStep, String EQ_disposition, String EQ_readPoint, String WD_readPoint, String EQ_bizLocation, String WD_bizLocation, String EQ_transformationID, String MATCH_epc, String MATCH_parentID, String MATCH_inputEPC, String MATCH_outputEPC, String MATCH_anyEPC, String MATCH_epcClass, String MATCH_inputEPCClass, String MATCH_outputEPCClass, String MATCH_anyEPCClass, String EQ_quantity, String GT_quantity, String GE_quantity, String LT_quantity, String LE_quantity, String orderBy, String orderDirection, String eventCountLimit, String maxEventCount, String vocabularyName, boolean includeAttributes, boolean includeChildren, String attributeNames, String EQ_name, String WD_name, String HASATTR, String maxElementCount, String format, String userID, List<String> friendList, Map<String, String> paramMap) { // M24 if (queryName == null) { // It is not possible, automatically filtered by URI param return makeErrorResult("queryName is mandatory field in poll method", QueryParameterException.class); } if (queryName.equals("SimpleEventQuery")) return pollEventQuery(queryName, eventType, GE_eventTime, LT_eventTime, GE_recordTime, LT_recordTime, EQ_action, EQ_bizStep, EQ_disposition, EQ_readPoint, WD_readPoint, EQ_bizLocation, WD_bizLocation, EQ_transformationID, MATCH_epc, MATCH_parentID, MATCH_inputEPC, MATCH_outputEPC, MATCH_anyEPC, MATCH_epcClass, MATCH_inputEPCClass, MATCH_outputEPCClass, MATCH_anyEPCClass, EQ_quantity, GT_quantity, GE_quantity, LT_quantity, LE_quantity, orderBy, orderDirection, eventCountLimit, maxEventCount, format, userID, friendList, paramMap); if (queryName.equals("SimpleMasterDataQuery")) return pollMasterDataQuery(queryName, vocabularyName, includeAttributes, includeChildren, attributeNames, EQ_name, WD_name, HASATTR, maxElementCount, format, paramMap); return ""; } private String checkConstraintSimpleEventQuery(String queryName, String eventType, String GE_eventTime, String LT_eventTime, String GE_recordTime, String LT_recordTime, String EQ_action, String EQ_bizStep, String EQ_disposition, String EQ_readPoint, String WD_readPoint, String EQ_bizLocation, String WD_bizLocation, String EQ_transformationID, String MATCH_epc, String MATCH_parentID, String MATCH_inputEPC, String MATCH_outputEPC, String MATCH_anyEPC, String MATCH_epcClass, String MATCH_inputEPCClass, String MATCH_outputEPCClass, String MATCH_anyEPCClass, String EQ_quantity, String GT_quantity, String GE_quantity, String LT_quantity, String LE_quantity, String orderBy, String orderDirection, String eventCountLimit, String maxEventCount, Map<String, String> paramMap) { // M27 try { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX"); if (GE_eventTime != null) sdf.parse(GE_eventTime); if (LT_eventTime != null) sdf.parse(LT_eventTime); if (GE_recordTime != null) sdf.parse(GE_recordTime); if (LT_recordTime != null) sdf.parse(LT_recordTime); } catch (ParseException e) { try { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); if (GE_eventTime != null) sdf.parse(GE_eventTime); if (LT_eventTime != null) sdf.parse(LT_eventTime); if (GE_recordTime != null) sdf.parse(GE_recordTime); if (LT_recordTime != null) sdf.parse(LT_recordTime); } catch (ParseException e1) { return makeErrorResult(e.toString(), QueryParameterException.class); } } // M27 if (orderBy != null) { if (!orderBy.equals("eventTime") && !orderBy.equals("recordTime")) { return makeErrorResult("orderBy should be eventTime or recordTime", QueryParameterException.class); } if (orderDirection != null) { if (!orderDirection.equals("ASC") && !orderDirection.equals("DESC")) { return makeErrorResult("orderDirection should be ASC or DESC", QueryParameterException.class); } } } // M27 if (eventCountLimit != null) { try { int c = Integer.parseInt(eventCountLimit); if (c <= 0) { return makeErrorResult("eventCount should be natural number", QueryParameterException.class); } } catch (NumberFormatException e) { return makeErrorResult("eventCount: " + e.toString(), QueryParameterException.class); } } // M27 if (maxEventCount != null) { try { int c = Integer.parseInt(maxEventCount); if (c <= 0) { return makeErrorResult("maxEventCount should be natural number", QueryParameterException.class); } } catch (NumberFormatException e) { return makeErrorResult("maxEventCount: " + e.toString(), QueryParameterException.class); } } // M39 if (EQ_action != null) { if (!EQ_action.equals("ADD") && !EQ_action.equals("OBSERVE") && !EQ_action.equals("DELETE")) { return makeErrorResult("EQ_action: ADD | OBSERVE | DELETE", QueryParameterException.class); } } // M42 if (eventCountLimit != null && maxEventCount != null) { return makeErrorResult("One of eventCountLimit and maxEventCount should be omitted", QueryParameterException.class); } return null; } private EPCISQueryDocumentType makeBaseResultDocument(String queryName) { // Make Base Result Document EPCISQueryDocumentType epcisQueryDocumentType = new EPCISQueryDocumentType(); EPCISQueryBodyType epcisBody = new EPCISQueryBodyType(); epcisQueryDocumentType.setEPCISBody(epcisBody); QueryResults queryResults = new QueryResults(); queryResults.setQueryName(queryName); epcisBody.setQueryResults(queryResults); QueryResultsBody queryResultsBody = new QueryResultsBody(); queryResults.setResultsBody(queryResultsBody); EventListType eventListType = new EventListType(); queryResultsBody.setEventList(eventListType); // Object instanceof JAXBElement List<Object> eventObjects = new ArrayList<Object>(); eventListType.setObjectEventOrAggregationEventOrQuantityEvent(eventObjects); return epcisQueryDocumentType; } boolean isExtraParameter(String paramName) { if (paramName.contains("eventTime")) return false; if (paramName.contains("recordTime")) return false; if (paramName.contains("action")) return false; if (paramName.contains("bizStep")) return false; if (paramName.contains("disposition")) return false; if (paramName.contains("readPoint")) return false; if (paramName.contains("bizLocation")) return false; if (paramName.contains("bizTransaction")) return false; if (paramName.contains("source")) return false; if (paramName.contains("destination")) return false; if (paramName.contains("transformationID")) return false; return true; } public void addScheduleToQuartz(SubscriptionType subscription) { try { JobDataMap map = new JobDataMap(); map.put("queryName", subscription.getQueryName()); map.put("subscriptionID", subscription.getSubscriptionID()); map.put("dest", subscription.getDest()); map.put("cronExpression", subscription.getCronExpression()); map.put("initialRecordTime", subscription.getInitialRecordTime()); map.put("ignoreReceivedEvent", subscription.isIgnoreReceivedEvent()); map.put("reportIfEmpty", subscription.isReportIfEmpty()); if (subscription.getEventType() != null) map.put("eventType", subscription.getEventType()); if (subscription.getGE_eventTime() != null) map.put("GE_eventTime", subscription.getGE_eventTime()); if (subscription.getLT_eventTime() != null) map.put("LT_eventTime", subscription.getLT_eventTime()); if (subscription.getGE_recordTime() != null) map.put("GE_recordTime", subscription.getGE_recordTime()); if (subscription.getLT_recordTime() != null) map.put("LT_recordTime", subscription.getLT_recordTime()); if (subscription.getEQ_action() != null) map.put("EQ_action", subscription.getEQ_action()); if (subscription.getEQ_bizStep() != null) map.put("EQ_bizStep", subscription.getEQ_bizStep()); if (subscription.getEQ_disposition() != null) map.put("EQ_disposition", subscription.getEQ_disposition()); if (subscription.getEQ_readPoint() != null) map.put("EQ_readPoint", subscription.getEQ_readPoint()); if (subscription.getWD_readPoint() != null) map.put("WD_readPoint", subscription.getWD_readPoint()); if (subscription.getEQ_bizLocation() != null) map.put("EQ_bizLocation", subscription.getEQ_bizLocation()); if (subscription.getWD_bizLocation() != null) map.put("WD_bizLocation", subscription.getWD_bizLocation()); if (subscription.getEQ_transformationID() != null) map.put("EQ_transformationID", subscription.getEQ_transformationID()); if (subscription.getMATCH_epc() != null) map.put("MATCH_epc", subscription.getMATCH_epc()); if (subscription.getMATCH_parentID() != null) map.put("MATCH_parentID", subscription.getMATCH_parentID()); if (subscription.getMATCH_inputEPC() != null) map.put("MATCH_inputEPC", subscription.getMATCH_inputEPC()); if (subscription.getMATCH_outputEPC() != null) map.put("MATCH_outputEPC", subscription.getMATCH_outputEPC()); if (subscription.getMATCH_anyEPC() != null) map.put("MATCH_anyEPC", subscription.getMATCH_anyEPC()); if (subscription.getMATCH_epcClass() != null) map.put("MATCH_epcClass", subscription.getMATCH_epcClass()); if (subscription.getMATCH_inputEPCClass() != null) map.put("MATCH_inputEPCClass", subscription.getMATCH_inputEPCClass()); if (subscription.getMATCH_outputEPCClass() != null) map.put("MATCH_outputEPCClass", subscription.getMATCH_outputEPCClass()); if (subscription.getMATCH_anyEPCClass() != null) map.put("MATCH_anyEPCClass", subscription.getMATCH_anyEPCClass()); if (subscription.getEQ_quantity() != null) map.put("EQ_quantity", subscription.getEQ_quantity()); if (subscription.getGT_quantity() != null) map.put("GT_quantity", subscription.getGT_quantity()); if (subscription.getGE_quantity() != null) map.put("GE_quantity", subscription.getGE_quantity()); if (subscription.getLT_quantity() != null) map.put("LT_quantity", subscription.getLT_quantity()); if (subscription.getLE_quantity() != null) map.put("LE_quantity", subscription.getLE_quantity()); if (subscription.getOrderBy() != null) map.put("orderBy", subscription.getOrderBy()); if (subscription.getOrderDirection() != null) map.put("orderDirection", subscription.getOrderDirection()); if (subscription.getEventCountLimit() != null) map.put("eventCountLimit", subscription.getEventCountLimit()); if (subscription.getMaxEventCount() != null) map.put("maxEventCount", subscription.getMaxEventCount()); if (subscription.getFormat() != null) map.put("format", subscription.getFormat()); if (subscription.getParamMap() != null) map.put("paramMap", subscription.getParamMap()); JobDetail job = newJob(MongoSubscriptionTask.class) .withIdentity(subscription.getSubscriptionID(), subscription.getQueryName()).setJobData(map) .storeDurably(false).build(); Trigger trigger = newTrigger().withIdentity(subscription.getSubscriptionID(), subscription.getQueryName()) .startNow().withSchedule(cronSchedule(subscription.getCronExpression())).build(); // ClassPathXmlApplicationContext context = new // ClassPathXmlApplicationContext( // "classpath:QuartzConfig.xml"); // Scheduler sched = (Scheduler) context // .getBean("schedulerFactoryBean"); if (MongoSubscription.sched.isStarted() != true) MongoSubscription.sched.start(); MongoSubscription.sched.scheduleJob(job, trigger); Configuration.logger.log(Level.INFO, "Subscription ID: " + subscription.getSubscriptionID() + " is added to quartz scheduler. "); } catch (SchedulerException e) { Configuration.logger.log(Level.ERROR, e.toString()); } catch (RuntimeException e) { Configuration.logger.log(Level.ERROR, e.toString()); } } private void addScheduleToQuartz(String queryName, String subscriptionID, String dest, String cronExpression, boolean isScheduledSubscription, boolean ignoreReceivedEvent, boolean reportIfEmpty, String initialRecordTimeStr, String eventType, String GE_eventTime, String LT_eventTime, String GE_recordTime, String LT_recordTime, String EQ_action, String EQ_bizStep, String EQ_disposition, String EQ_readPoint, String WD_readPoint, String EQ_bizLocation, String WD_bizLocation, String EQ_transformationID, String MATCH_epc, String MATCH_parentID, String MATCH_inputEPC, String MATCH_outputEPC, String MATCH_anyEPC, String MATCH_epcClass, String MATCH_inputEPCClass, String MATCH_outputEPCClass, String MATCH_anyEPCClass, String EQ_quantity, String GT_quantity, String GE_quantity, String LT_quantity, String LE_quantity, String orderBy, String orderDirection, String eventCountLimit, String maxEventCount, String format, Map<String, String> paramMap) { try { JobDataMap map = new JobDataMap(); map.put("queryName", queryName); map.put("subscriptionID", subscriptionID); map.put("dest", dest); map.put("isScheduledSubscription", isScheduledSubscription); map.put("ignoreReceivedEvent", ignoreReceivedEvent); map.put("cronExpression", cronExpression); map.put("reportIfEmpty", reportIfEmpty); map.put("initialRecordTime", initialRecordTimeStr); if (eventType != null) map.put("eventType", eventType); if (GE_eventTime != null) map.put("GE_eventTime", GE_eventTime); if (LT_eventTime != null) map.put("LT_eventTime", LT_eventTime); if (GE_recordTime != null) map.put("GE_recordTime", GE_recordTime); if (LT_recordTime != null) map.put("LT_recordTime", LT_recordTime); if (EQ_action != null) map.put("EQ_action", EQ_action); if (EQ_bizStep != null) map.put("EQ_bizStep", EQ_bizStep); if (EQ_disposition != null) map.put("EQ_disposition", EQ_disposition); if (EQ_readPoint != null) map.put("EQ_readPoint", EQ_readPoint); if (WD_readPoint != null) map.put("WD_readPoint", WD_readPoint); if (EQ_bizLocation != null) map.put("EQ_bizLocation", EQ_bizLocation); if (WD_bizLocation != null) map.put("WD_bizLocation", WD_bizLocation); if (EQ_transformationID != null) map.put("EQ_transformationID", EQ_transformationID); if (MATCH_epc != null) map.put("MATCH_epc", MATCH_epc); if (MATCH_parentID != null) map.put("MATCH_parentID", MATCH_parentID); if (MATCH_inputEPC != null) map.put("MATCH_inputEPC", MATCH_inputEPC); if (MATCH_outputEPC != null) map.put("MATCH_outputEPC", MATCH_outputEPC); if (MATCH_anyEPC != null) map.put("MATCH_anyEPC", MATCH_anyEPC); if (MATCH_epcClass != null) map.put("MATCH_epcClass", MATCH_epcClass); if (MATCH_inputEPCClass != null) map.put("MATCH_inputEPCClass", MATCH_inputEPCClass); if (MATCH_outputEPCClass != null) map.put("MATCH_outputEPCClass", MATCH_outputEPCClass); if (MATCH_anyEPCClass != null) map.put("MATCH_anyEPCClass", MATCH_anyEPCClass); if (EQ_quantity != null) map.put("EQ_quantity", EQ_quantity); if (GT_quantity != null) map.put("GT_quantity", GT_quantity); if (GE_quantity != null) map.put("GE_quantity", GE_quantity); if (LT_quantity != null) map.put("LT_quantity", LT_quantity); if (LE_quantity != null) map.put("LE_quantity", LE_quantity); if (orderBy != null) map.put("orderBy", orderBy); if (orderDirection != null) map.put("orderDirection", orderDirection); if (eventCountLimit != null) map.put("eventCountLimit", eventCountLimit); if (maxEventCount != null) map.put("maxEventCount", maxEventCount); if (format != null) map.put("format", format); if (paramMap != null) map.put("paramMap", paramMap); JobDetail job = newJob(MongoSubscriptionTask.class).withIdentity(subscriptionID, queryName).setJobData(map) .storeDurably(false).build(); Trigger trigger = newTrigger().withIdentity(subscriptionID, queryName).startNow() .withSchedule(cronSchedule(cronExpression)).build(); // ClassPathXmlApplicationContext context = new // ClassPathXmlApplicationContext( // "classpath:QuartzConfig.xml"); // Scheduler sched = (Scheduler) context // .getBean("schedulerFactoryBean"); if (MongoSubscription.sched.isStarted() != true) MongoSubscription.sched.start(); MongoSubscription.sched.scheduleJob(job, trigger); Configuration.logger.log(Level.INFO, "Subscription ID: " + subscriptionID + " is added to quartz scheduler. "); } catch (SchedulerException e) { Configuration.logger.log(Level.ERROR, e.toString()); } } private boolean addScheduleToDB(String queryName, String subscriptionID, String dest, String cronExpression, boolean isScheduledSubscription, boolean ignoreReceivedEvent, boolean reportIfEmpty, String initialRecordTime, String eventType, String GE_eventTime, String LT_eventTime, String GE_recordTime, String LT_recordTime, String EQ_action, String EQ_bizStep, String EQ_disposition, String EQ_readPoint, String WD_readPoint, String EQ_bizLocation, String WD_bizLocation, String EQ_transformationID, String MATCH_epc, String MATCH_parentID, String MATCH_inputEPC, String MATCH_outputEPC, String MATCH_anyEPC, String MATCH_epcClass, String MATCH_inputEPCClass, String MATCH_outputEPCClass, String MATCH_anyEPCClass, String EQ_quantity, String GT_quantity, String GE_quantity, String LT_quantity, String LE_quantity, String orderBy, String orderDirection, String eventCountLimit, String maxEventCount, String format, Map<String, String> paramMap) { SubscriptionType st = new SubscriptionType(queryName, subscriptionID, dest, cronExpression, isScheduledSubscription, ignoreReceivedEvent, reportIfEmpty, initialRecordTime, eventType, GE_eventTime, LT_eventTime, GE_recordTime, LT_recordTime, EQ_action, EQ_bizStep, EQ_disposition, EQ_readPoint, WD_readPoint, EQ_bizLocation, WD_bizLocation, EQ_transformationID, MATCH_epc, MATCH_parentID, MATCH_inputEPC, MATCH_outputEPC, MATCH_anyEPC, MATCH_epcClass, MATCH_inputEPCClass, MATCH_outputEPCClass, MATCH_anyEPCClass, EQ_quantity, GT_quantity, GE_quantity, LT_quantity, LE_quantity, orderBy, orderDirection, eventCountLimit, maxEventCount, format, paramMap); MongoCollection<BsonDocument> collection = Configuration.mongoDatabase.getCollection("Subscription", BsonDocument.class); BsonDocument subscription = collection.find(new BsonDocument("subscriptionID", new BsonString(subscriptionID))) .first(); if (subscription == null) { collection.insertOne(SubscriptionType.asBsonDocument(st)); } Configuration.logger.log(Level.INFO, "Subscription ID: " + subscriptionID + " is added to DB. "); return true; } private void removeScheduleFromQuartz(SubscriptionType subscription) { try { MongoSubscription.sched .unscheduleJob(triggerKey(subscription.getSubscriptionID(), subscription.getQueryName())); MongoSubscription.sched.deleteJob(jobKey(subscription.getSubscriptionID(), subscription.getQueryName())); Configuration.logger.log(Level.INFO, "Subscription ID: " + subscription.getSubscriptionID() + " is removed from scheduler"); } catch (SchedulerException e) { Configuration.logger.log(Level.ERROR, e.toString()); } } @SuppressWarnings("unused") private void removeScheduleFromDB(SubscriptionType subscription) { MongoCollection<BsonDocument> collection = Configuration.mongoDatabase.getCollection("Subscription", BsonDocument.class); collection.deleteOne(new BsonDocument("subscriptionID", new BsonString(subscription.getSubscriptionID()))); Configuration.logger.log(Level.INFO, "Subscription ID: " + subscription.getSubscriptionID() + " is removed from DB"); } @SuppressWarnings("rawtypes") private String makeErrorResult(String err, Class type) { if (type == InvalidURIException.class) { InvalidURIException e = new InvalidURIException(); e.setReason(err); EPCISQueryDocumentType retDoc = new EPCISQueryDocumentType(); EPCISQueryBodyType retBody = new EPCISQueryBodyType(); retBody.setInvalidURIException(e); retDoc.setEPCISBody(retBody); StringWriter sw = new StringWriter(); JAXB.marshal(retDoc, sw); return sw.toString(); } if (type == QueryParameterException.class) { QueryParameterException e = new QueryParameterException(); e.setReason(err); EPCISQueryDocumentType retDoc = new EPCISQueryDocumentType(); EPCISQueryBodyType retBody = new EPCISQueryBodyType(); retBody.setQueryParameterException(e); retDoc.setEPCISBody(retBody); StringWriter sw = new StringWriter(); JAXB.marshal(retDoc, sw); return sw.toString(); } if (type == SubscriptionControlsException.class) { SubscriptionControlsException e = new SubscriptionControlsException(); e.setReason(err); EPCISQueryDocumentType retDoc = new EPCISQueryDocumentType(); EPCISQueryBodyType retBody = new EPCISQueryBodyType(); retBody.setSubscriptionControlsException(e); retDoc.setEPCISBody(retBody); StringWriter sw = new StringWriter(); JAXB.marshal(retDoc, sw); return sw.toString(); } if (type == QueryTooLargeException.class) { QueryTooLargeException e = new QueryTooLargeException(); e.setReason(err); EPCISQueryDocumentType retDoc = new EPCISQueryDocumentType(); EPCISQueryBodyType retBody = new EPCISQueryBodyType(); retBody.setQueryTooLargeException(e); retDoc.setEPCISBody(retBody); StringWriter sw = new StringWriter(); JAXB.marshal(retDoc, sw); return sw.toString(); } if (type == SubscribeNotPermittedException.class) { SubscribeNotPermittedException e = new SubscribeNotPermittedException(); e.setReason(err); EPCISQueryDocumentType retDoc = new EPCISQueryDocumentType(); EPCISQueryBodyType retBody = new EPCISQueryBodyType(); retBody.setSubscribeNotPermittedException(e); retDoc.setEPCISBody(retBody); StringWriter sw = new StringWriter(); JAXB.marshal(retDoc, sw); return sw.toString(); } return null; } private FindIterable<BsonDocument> makeSortedLimitedCursor(FindIterable<BsonDocument> cursor, String orderBy, String orderDirection, String eventCountLimit) { /** * orderBy : If specified, names a single field that will be used to * order the results. The orderDirection field specifies whether the * ordering is in ascending sequence or descending sequence. Events * included in the result that lack the specified field altogether may * occur in any position within the result event list. The value of this * parameter SHALL be one of: eventTime, recordTime, or the fully * qualified name of an extension field whose type is Int, Float, Time, * or String. A fully qualified fieldname is constructed as for the * EQ_fieldname parameter. In the case of a field of type String, the * ordering SHOULD be in lexicographic order based on the Unicode * encoding of the strings, or in some other collating sequence * appropriate to the locale. If omitted, no order is specified. The * implementation MAY order the results in any order it chooses, and * that order MAY differ even when the same query is executed twice on * the same data. (In EPCIS 1.0, the value quantity was also permitted, * but its use is deprecated in EPCIS 1.1.) * * orderDirection : If specified and orderBy is also specified, * specifies whether the results are ordered in ascending or descending * sequence according to the key specified by orderBy. The value of this * parameter must be one of ASC (for ascending order) or DESC (for * descending order); if not, the implementation SHALL raise a * QueryParameterException. If omitted, defaults to DESC. */ // Update Query with ORDER and LIMIT if (orderBy != null) { // Currently only eventTime, recordTime can be used if (orderBy.trim().equals("eventTime")) { if (orderDirection != null) { if (orderDirection.trim().equals("ASC")) { cursor = cursor.sort(new BsonDocument("eventTime", new BsonInt32(1))); } else if (orderDirection.trim().equals("DESC")) { cursor = cursor.sort(new BsonDocument("eventTime", new BsonInt32(-1))); } } } else if (orderBy.trim().equals("recordTime")) { if (orderDirection != null) { if (orderDirection.trim().equals("ASC")) { cursor = cursor.sort(new BsonDocument("recordTime", new BsonInt32(1))); } else if (orderDirection.trim().equals("DESC")) { cursor = cursor.sort(new BsonDocument("recordTime", new BsonInt32(-1))); } } } } /** * eventCountLimit: If specified, the results will only include the * first N events that match the other criteria, where N is the value of * this parameter. The ordering specified by the orderBy and * orderDirection parameters determine the meaning of “first” for this * purpose. If omitted, all events matching the specified criteria will * be included in the results. This parameter and maxEventCount are * mutually exclusive; if both are specified, a QueryParameterException * SHALL be raised. This parameter may only be used when orderBy is * specified; if orderBy is omitted and eventCountLimit is specified, a * QueryParameterException SHALL be raised. This parameter differs from * maxEventCount in that this parameter limits the amount of data * returned, whereas maxEventCount causes an exception to be thrown if * the limit is exceeded. */ if (eventCountLimit != null) { try { int eventCount = Integer.parseInt(eventCountLimit); cursor = cursor.limit(eventCount); } catch (NumberFormatException nfe) { Configuration.logger.log(Level.ERROR, nfe.toString()); } } return cursor; } private BsonArray makeQueryObjects(String eventType, String GE_eventTime, String LT_eventTime, String GE_recordTime, String LT_recordTime, String EQ_action, String EQ_bizStep, String EQ_disposition, String EQ_readPoint, String WD_readPoint, String EQ_bizLocation, String WD_bizLocation, String EQ_transformationID, String MATCH_epc, String MATCH_parentID, String MATCH_inputEPC, String MATCH_outputEPC, String MATCH_anyEPC, String MATCH_epcClass, String MATCH_inputEPCClass, String MATCH_outputEPCClass, String MATCH_anyEPCClass, String EQ_quantity, String GT_quantity, String GE_quantity, String LT_quantity, String LE_quantity, String orderBy, String orderDirection, String eventCountLimit, String maxEventCount, Map<String, String> paramMap) { BsonArray queryList = new BsonArray(); /** * GE_eventTime: If specified, only events with eventTime greater than * or equal to the specified value will be included in the result. If * omitted, events are included regardless of their eventTime (unless * constrained by the LT_eventTime parameter). Example: * 2014-08-11T19:57:59.717+09:00 SimpleDateFormat sdf = new * SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss.SSSXXX"); * eventTime.setTime(sdf.parse(timeString)); e.g. * 1988-07-04T12:08:56.235-07:00 * * Verified */ if (GE_eventTime != null) { long geEventTimeMillis = getTimeMillis(GE_eventTime); BsonDocument query = new BsonDocument(); query.put("eventTime", new BsonDocument("$gte", new BsonInt64(geEventTimeMillis))); queryList.add(query); } /** * LT_eventTime: If specified, only events with eventTime less than the * specified value will be included in the result. If omitted, events * are included regardless of their eventTime (unless constrained by the * GE_eventTime parameter). * * Verified */ if (LT_eventTime != null) { long ltEventTimeMillis = getTimeMillis(LT_eventTime); BsonDocument query = new BsonDocument(); query.put("eventTime", new BsonDocument("$lt", new BsonInt64(ltEventTimeMillis))); queryList.add(query); } /** * GE_recordTime: If provided, only events with recordTime greater than * or equal to the specified value will be returned. The automatic * limitation based on event record time (Section 8.2.5.2) may * implicitly provide a constraint similar to this parameter. If * omitted, events are included regardless of their recordTime, other * than automatic limitation based on event record time (Section * 8.2.5.2). * * Verified */ if (GE_recordTime != null) { long geRecordTimeMillis = getTimeMillis(GE_recordTime); BsonDocument query = new BsonDocument(); query.put("recordTime", new BsonDocument("$gte", new BsonInt64(geRecordTimeMillis))); queryList.add(query); } /** * LE_recordTime: If provided, only events with recordTime less than the * specified value will be returned. If omitted, events are included * regardless of their recordTime (unless constrained by the * GE_recordTime parameter or the automatic limitation based on event * record time). * * Verified */ if (LT_recordTime != null) { long ltRecordTimeMillis = getTimeMillis(LT_recordTime); BsonDocument query = new BsonDocument(); query.put("recordTime", new BsonDocument("$lt", new BsonInt64(ltRecordTimeMillis))); queryList.add(query); } /** * EQ_action: If specified, the result will only include events that (a) * have an action field; and where (b) the value of the action field * matches one of the specified values. The elements of the value of * this parameter each must be one of the strings ADD, OBSERVE, or * DELETE; if not, the implementation SHALL raise a * QueryParameterException. If omitted, events are included regardless * of their action field. * * Verified */ if (EQ_action != null) { // Constrained already checked BsonDocument query = new BsonDocument(); query.put("action", new BsonString(EQ_action)); queryList.add(query); } /** * EQ_bizStep: If specified, the result will only include events that * (a) have a non-null bizStep field; and where (b) the value of the * bizStep field matches one of the specified values. If this parameter * is omitted, events are returned regardless of the value of the * bizStep field or whether the bizStep field exists at all. * * Verified */ if (EQ_bizStep != null) { BsonDocument query = getINQueryObject("bizStep", EQ_bizStep); if (query != null) queryList.add(query); } /** * EQ_disposition: Like the EQ_bizStep parameter, but for the * disposition field. * * Verified */ if (EQ_disposition != null) { BsonDocument query = getINQueryObject("disposition", EQ_disposition); if (query != null) queryList.add(query); } /** * EQ_readPoint: If specified, the result will only include events that * (a) have a non-null readPoint field; and where (b) the value of the * readPoint field matches one of the specified values. If this * parameter and WD_readPoint are both omitted, events are returned * regardless of the value of the readPoint field or whether the * readPoint field exists at all. */ Set<String> readPointSet = new HashSet<String>(); if (EQ_readPoint != null) { String[] eqArr = EQ_readPoint.split(","); for (int i = 0; i < eqArr.length; i++) { String eqString = eqArr[i].trim(); readPointSet.add(eqString); } } /** * WD_readPoint: If specified, the result will only include events that * (a) have a non-null readPoint field; and where (b) the value of the * readPoint field matches one of the specified values, or is a direct * or indirect descendant of one of the specified values. The meaning of * “direct or indirect descendant” is specified by master data, as * described in Section 6.5. (WD is an abbreviation for “with * descendants.”) If this parameter and EQ_readPoint are both omitted, * events are returned regardless of the value of the readPoint field or * whether the readPoint field exists at all. */ if (WD_readPoint != null) { String[] eqArr = WD_readPoint.split(","); for (int i = 0; i < eqArr.length; i++) { eqArr[i] = eqArr[i].trim(); } for (int i = 0; i < eqArr.length; i++) { // Invoke vocabulary query with EQ_name and includeChildren readPointSet = getWDList(readPointSet, eqArr[i]); } } if (!readPointSet.isEmpty()) { BsonDocument query = getINQueryObject("readPoint.id", readPointSet); if (query != null) queryList.add(query); } /** * EQ_bizLocation: Like the EQ_readPoint parameter, but for the * bizLocation field. */ Set<String> bizLocationSet = new HashSet<String>(); if (EQ_bizLocation != null) { String[] eqArr = EQ_bizLocation.split(","); for (int i = 0; i < eqArr.length; i++) { String eqString = eqArr[i].trim(); bizLocationSet.add(eqString); } } /** * WD_bizLocation: Like the WD_readPoint parameter, but for the * bizLocation field. */ if (WD_bizLocation != null) { String[] eqArr = WD_bizLocation.split(","); for (int i = 0; i < eqArr.length; i++) { eqArr[i] = eqArr[i].trim(); } for (int i = 0; i < eqArr.length; i++) { // Invoke vocabulary query with EQ_name and includeChildren bizLocationSet = getWDList(bizLocationSet, eqArr[i]); } } if (!bizLocationSet.isEmpty()) { BsonDocument query = getINQueryObject("bizLocation.id", bizLocationSet); if (query != null) queryList.add(query); } /** * EQ_transformationID: If this parameter is specified, the result will * only include events that (a) have a transformationID field (that is, * TransformationEvents or extension event type that extend * TransformationEvent); and where (b) the transformationID field is * equal to one of the values specified in this parameter. */ if (EQ_transformationID != null) { BsonDocument query = getINQueryObject("transformationID", EQ_transformationID); if (query != null) queryList.add(query); } /** * MATCH_epc: If this parameter is specified, the result will only * include events that (a) have an epcList or a childEPCs field (that * is, ObjectEvent, AggregationEvent, TransactionEvent or extension * event types that extend one of those three); and where (b) one of the * EPCs listed in the epcList or childEPCs field (depending on event * type) matches one of the EPC patterns or URIs specified in this * parameter, where the meaning of “matches” is as specified in Section * 8.2.7.1.1. If this parameter is omitted, events are included * regardless of their epcList or childEPCs field or whether the epcList * or childEPCs field exists. * * Somewhat verified */ if (MATCH_epc != null) { BsonDocument query = getINQueryObject(new String[] { "epcList.epc", "childEPCs.epc" }, MATCH_epc); if (query != null) queryList.add(query); } /** * MATCH_parentID: Like MATCH_epc, but matches the parentID field of * AggregationEvent, the parentID field of TransactionEvent, and * extension event types that extend either AggregationEvent or * TransactionEvent. The meaning of “matches” is as specified in Section * 8.2.7.1.1. */ if (MATCH_parentID != null) { BsonDocument query = getINQueryObject("parentID", MATCH_parentID); if (query != null) queryList.add(query); } /** * MATCH_inputEPC: If this parameter is specified, the result will only * include events that (a) have an inputEPCList (that is, * TransformationEvent or an extension event type that extends * TransformationEvent); and where (b) one of the EPCs listed in the * inputEPCList field matches one of the EPC patterns or URIs specified * in this parameter. The meaning of “matches” is as specified in * Section 8.2.7.1.1. If this parameter is omitted, events are included * regardless of their inputEPCList field or whether the inputEPCList * field exists. */ if (MATCH_inputEPC != null) { BsonDocument query = getINQueryObject("inputEPCList.epc", MATCH_inputEPC); if (query != null) queryList.add(query); } /** * MATCH_outputEPC: If this parameter is specified, the result will only * include events that (a) have an inputEPCList (that is, * TransformationEvent or an extension event type that extends * TransformationEvent); and where (b) one of the EPCs listed in the * inputEPCList field matches one of the EPC patterns or URIs specified * in this parameter. The meaning of “matches” is as specified in * Section 8.2.7.1.1. If this parameter is omitted, events are included * regardless of their inputEPCList field or whether the inputEPCList * field exists. */ if (MATCH_outputEPC != null) { BsonDocument query = getINQueryObject("outputEPCList.epc", MATCH_outputEPC); if (query != null) queryList.add(query); } /** * MATCH_anyEPC: If this parameter is specified, the result will only * include events that (a) have an epcList field, a childEPCs field, a * parentID field, an inputEPCList field, or an outputEPCList field * (that is, ObjectEvent, AggregationEvent, TransactionEvent, * TransformationEvent, or extension event types that extend one of * those four); and where (b) the parentID field or one of the EPCs * listed in the epcList, childEPCs, inputEPCList, or outputEPCList * field (depending on event type) matches one of the EPC patterns or * URIs specified in this parameter. The meaning of “matches” is as * specified in Section 8.2.7.1.1. */ if (MATCH_anyEPC != null) { BsonDocument query = getINQueryObject(new String[] { "epcList.epc", "childEPCs.epc", "inputEPCList.epc", "outputEPCList.epc", "parentID" }, MATCH_anyEPC); if (query != null) queryList.add(query); } /** * MATCH_epcClass: If this parameter is specified, the result will only * include events that (a) have a quantityList or a childQuantityList * field (that is, ObjectEvent, AggregationEvent, TransactionEvent or * extension event types that extend one of those three); and where (b) * one of the EPC classes listed in the quantityList or * childQuantityList field (depending on event type) matches one of the * EPC patterns or URIs specified in this parameter. The result will * also include QuantityEvents whose epcClass field matches one of the * EPC patterns or URIs specified in this parameter. The meaning of * “matches” is as specified in Section 8.2.7.1.1. */ if (MATCH_epcClass != null) { BsonDocument query = getINQueryObject( new String[] { "extension.quantityList.epcClass", "extension.childQuantityList.epcClass" }, MATCH_epcClass); if (query != null) queryList.add(query); } /** * MATCH_inputEPCClass: If this parameter is specified, the result will * only include events that (a) have an inputQuantityList field (that * is, TransformationEvent or extension event types that extend it); and * where (b) one of the EPC classes listed in the inputQuantityList * field (depending on event type) matches one of the EPC patterns or * URIs specified in this parameter. The meaning of “matches” is as * specified in Section 8.2.7.1.1. */ if (MATCH_inputEPCClass != null) { BsonDocument query = getINQueryObject("inputQuantityList.epcClass", MATCH_inputEPCClass); if (query != null) queryList.add(query); } /** * MATCH_outputEPCClass: If this parameter is specified, the result will * only include events that (a) have an outputQuantityList field (that * is, TransformationEvent or extension event types that extend it); and * where (b) one of the EPC classes listed in the outputQuantityList * field (depending on event type) matches one of the EPC patterns or * URIs specified in this parameter. The meaning of “matches” is as * specified in Section 8.2.7.1.1. */ if (MATCH_outputEPCClass != null) { BsonDocument query = getINQueryObject("outputQuantityList.epcClass", MATCH_outputEPCClass); if (query != null) queryList.add(query); } /** * MATCH_anyEPCClass: If this parameter is specified, the result will * only include events that (a) have a quantityList, childQuantityList, * inputQuantityList, or outputQuantityList field (that is, ObjectEvent, * AggregationEvent, TransactionEvent, TransformationEvent, or extension * event types that extend one of those four); and where (b) one of the * EPC classes listed in any of those fields matches one of the EPC * patterns or URIs specified in this parameter. The result will also * include QuantityEvents whose epcClass field matches one of the EPC * patterns or URIs specified in this parameter. The meaning of * “matches” is as specified in Section 8.2.7.1.1. */ if (MATCH_anyEPCClass != null) { BsonDocument query = getINQueryObject( new String[] { "extension.quantityList.epcClass", "extension.childQuantityList.epcClass", "inputQuantityList.epcClass", "outputQuantityList.epcClass" }, MATCH_anyEPCClass); if (query != null) queryList.add(query); } /** * (DEPCRECATED in EPCIS 1.1) EQ_quantity; GT_quantity; GE_quantity; * LT_quantity; LE_quantity **/ /** * EQ_fieldname: This is not a single parameter, but a family of * parameters. If a parameter of this form is specified, the result will * only include events that (a) have a field named fieldname whose type * is either String or a vocabulary type; and where (b) the value of * that field matches one of the values specified in this parameter. * Fieldname is the fully qualified name of an extension field. The name * of an extension field is an XML qname; that is, a pair consisting of * an XML namespace URI and a name. The name of the corresponding query * parameter is constructed by concatenating the following: the string * EQ_, the namespace URI for the extension field, a pound sign (#), and * the name of the extension field. */ Iterator<String> paramIter = paramMap.keySet().iterator(); while (paramIter.hasNext()) { String paramName = paramIter.next(); String paramValues = paramMap.get(paramName); /** * EQ_bizTransaction_type: This is not a single parameter, but a * family of parameters. If a parameter of this form is specified, * the result will only include events that (a) include a * bizTransactionList; (b) where the business transaction list * includes an entry whose type subfield is equal to type extracted * from the name of this parameter; and (c) where the bizTransaction * subfield of that entry is equal to one of the values specified in * this parameter. */ if (paramName.contains("EQ_bizTransaction_")) { String type = paramName.substring(18, paramName.length()); BsonDocument query = getINFamilyQueryObject(type, "bizTransactionList", paramValues); if (query != null) queryList.add(query); } /** * EQ_source_type: This is not a single parameter, but a family of * parameters. If a parameter of this form is specified, the result * will only include events that (a) include a sourceList; (b) where * the source list includes an entry whose type subfield is equal to * type extracted from the name of this parameter; and (c) where the * source subfield of that entry is equal to one of the values * specified in this parameter. */ if (paramName.contains("EQ_source_")) { String type = paramName.substring(10, paramName.length()); if (eventType.equals("AggregationEvent") || eventType.equals("ObjectEvent") || eventType.equals("TransactionEvent")) { BsonDocument query = getINFamilyQueryObject(type, "extension.sourceList", paramValues); if (query != null) queryList.add(query); } if (eventType.equals("TransformationEvent")) { BsonDocument query = getINFamilyQueryObject(type, "sourceList", paramValues); if (query != null) queryList.add(query); } } /** * EQ_destination_type: This is not a single parameter, but a family * of parameters. If a parameter of this form is specified, the * result will only include events that (a) include a * destinationList; (b) where the destination list includes an entry * whose type subfield is equal to type extracted from the name of * this parameter; and (c) where the destination subfield of that * entry is equal to one of the values specified in this parameter. */ if (paramName.contains("EQ_destination_")) { String type = paramName.substring(15, paramName.length()); if (eventType.equals("AggregationEvent") || eventType.equals("ObjectEvent") || eventType.equals("TransactionEvent")) { BsonDocument query = getINFamilyQueryObject(type, "extension.destinationList", paramValues); if (query != null) queryList.add(query); } if (eventType.equals("TransformationEvent")) { BsonDocument query = getINFamilyQueryObject(type, "destinationList", paramValues); if (query != null) queryList.add(query); } } boolean isExtraParam = isExtraParameter(paramName); if (isExtraParam == true) { /** * EQ_fieldname: This is not a single parameter, but a family of * parameters. If a parameter of this form is specified, the * result will only include events that (a) have a field named * fieldname whose type is either String or a vocabulary type; * and where (b) the value of that field matches one of the * values specified in this parameter. Fieldname is the fully * qualified name of an extension field. The name of an * extension field is an XML qname; that is, a pair consisting * of an XML namespace URI and a name. The name of the * corresponding query parameter is constructed by concatenating * the following: the string EQ_, the namespace URI for the * extension field, a pound sign (#), and the name of the * extension field. */ if (paramName.startsWith("EQ_")) { String type = paramName.substring(3, paramName.length()); /* * if (eventType.equals("AggregationEvent") || * eventType.equals("ObjectEvent") || * eventType.equals("TransactionEvent")) { DBObject query = * getINExtensionQueryObject(type, new String[] { * "extension.extension.any." + type, * "extension.extension.otherAttributes." + type }, * paramValues); if (query != null) queryList.add(query); } * if (eventType.equals("QuantityEvent") || * eventType.equals("TransformationEvent")) { DBObject query * = getINExtensionQueryObject( type, new String[] { * "extension.any." + type, "extension.otherAttributes." + * type }, paramValues); if (query != null) * queryList.add(query); } */ BsonDocument query = getINExtensionQueryObject(type, new String[] { "any." + type, "otherAttributes." + type }, paramValues); if (query != null) queryList.add(query); } /** * GT/GE/LT/LE_fieldname: Like EQ_fieldname as described above, * but may be applied to a field of type Int, Float, or Time. * The result will include events that (a) have a field named * fieldname; and where (b) the type of the field matches the * type of this parameter (Int, Float, or Time); and where (c) * the value of the field is greater than the specified value. * Fieldname is constructed as for EQ_fieldname. */ if (paramName.startsWith("GT_") || paramName.startsWith("GE_") || paramName.startsWith("LT_") || paramName.startsWith("LE_")) { String type = paramName.substring(3, paramName.length()); /* * if (eventType.equals("AggregationEvent") || * eventType.equals("ObjectEvent") || * eventType.equals("TransactionEvent")) { if * (paramName.startsWith("GT_")) { DBObject query = * getCompExtensionQueryObject( type, new String[] { * "extension.extension.any." + type, * "extension.extension.otherAttributes." + type }, * paramValues, "GT"); if (query != null) * queryList.add(query); } if (paramName.startsWith("GE_")) * { DBObject query = getCompExtensionQueryObject( type, new * String[] { "extension.extension.any." + type, * "extension.extension.otherAttributes." + type }, * paramValues, "GE"); if (query != null) * queryList.add(query); } if (paramName.startsWith("LT_")) * { DBObject query = getCompExtensionQueryObject( type, new * String[] { "extension.extension.any." + type, * "extension.extension.otherAttributes." + type }, * paramValues, "LT"); if (query != null) * queryList.add(query); } if (paramName.startsWith("LE_")) * { DBObject query = getCompExtensionQueryObject( type, new * String[] { "extension.extension.any." + type, * "extension.extension.otherAttributes." + type }, * paramValues, "LE"); if (query != null) * queryList.add(query); } } if * (eventType.equals("QuantityEvent") || * eventType.equals("TransformationEvent")) { if * (paramName.startsWith("GT_")) { * * DBObject query = getCompExtensionQueryObject( type, new * String[] { "extension.any." + type, * "extension.otherAttributes." + type }, paramValues, * "GT"); if (query != null) queryList.add(query); } if * (paramName.startsWith("GE_")) { * * DBObject query = getCompExtensionQueryObject( type, new * String[] { "extension.any." + type, * "extension.otherAttributes." + type }, paramValues, * "GE"); if (query != null) queryList.add(query); } if * (paramName.startsWith("LT_")) { DBObject query = * getCompExtensionQueryObject( type, new String[] { * "extension.any." + type, "extension.otherAttributes." + * type }, paramValues, "LT"); if (query != null) * queryList.add(query); } if (paramName.startsWith("LE_")) * { * * DBObject query = getCompExtensionQueryObject( type, new * String[] { "extension.any." + type, * "extension.otherAttributes." + type }, paramValues, * "LE"); if (query != null) queryList.add(query); } } */ if (paramName.startsWith("GT_")) { BsonDocument query = getCompExtensionQueryObject(type, new String[] { "any." + type, "otherAttributes." + type }, paramValues, "GT"); if (query != null) queryList.add(query); } if (paramName.startsWith("GE_")) { BsonDocument query = getCompExtensionQueryObject(type, new String[] { "any." + type, "otherAttributes." + type }, paramValues, "GE"); if (query != null) queryList.add(query); } if (paramName.startsWith("LT_")) { BsonDocument query = getCompExtensionQueryObject(type, new String[] { "any." + type, "otherAttributes." + type }, paramValues, "LT"); if (query != null) queryList.add(query); } if (paramName.startsWith("LE_")) { BsonDocument query = getCompExtensionQueryObject(type, new String[] { "any." + type, "otherAttributes." + type }, paramValues, "LE"); if (query != null) queryList.add(query); } } } } return queryList; } private BsonArray makeMasterQueryObjects(String vocabularyName, boolean includeAttributes, boolean includeChildren, String attributeNames, String eQ_name, String wD_name, String hASATTR, String maxElementCount, Map<String, String> paramMap) { BsonArray queryList = new BsonArray(); /** * vocabularyName : If specified, only vocabulary elements drawn from * one of the specified vocabularies will be included in the results. * Each element of the specified list is the formal URI name for a * vocabulary; e.g., one of the URIs specified in the table at the end * of Section 7.2. If omitted, all vocabularies are considered. */ if (vocabularyName != null) { BsonDocument query = getINQueryObject("type", vocabularyName); if (query != null) queryList.add(query); } /** * EQ_name : If specified, the result will only include vocabulary * elements whose names are equal to one of the specified values. If * this parameter and WD_name are both omitted, vocabulary elements are * included regardless of their names. */ Set<String> idSet = new HashSet<String>(); if (eQ_name != null) { String[] eqArr = eQ_name.split(","); for (int i = 0; i < eqArr.length; i++) { String eqString = eqArr[i].trim(); idSet.add(eqString); } } /** * WD_name : If specified, the result will only include vocabulary * elements that either match one of the specified names, or are direct * or indirect descendants of a vocabulary element that matches one of * the specified names. The meaning of “direct or indirect descendant” * is described in Section 6.5. (WD is an abbreviation for “with * descendants.”) If this parameter and EQ_name are both omitted, * vocabulary elements are included regardless of their names. */ if (wD_name != null) { String[] eqArr = wD_name.split(","); for (int i = 0; i < eqArr.length; i++) { eqArr[i] = eqArr[i].trim(); } for (int i = 0; i < eqArr.length; i++) { // Invoke vocabulary query with EQ_name and includeChildren idSet = getWDList(idSet, eqArr[i]); } } if (!idSet.isEmpty()) { BsonDocument query = getINQueryObject("id", idSet); if (query != null) queryList.add(query); } /** * HASATTR : If specified, the result will only include vocabulary * elements that have a non-null attribute whose name matches one of the * values specified in this parameter. */ if (hASATTR != null) { String[] attrArr = hASATTR.split(","); for (int i = 0; i < attrArr.length; i++) { String attrString = attrArr[i].trim(); BsonDocument query = getExistsQueryObject("attributes", attrString); if (query != null) queryList.add(query); } } /** * EQATTR_attrnam : This is not a single parameter, but a family of * parameters. If a parameter of this form is specified, the result will * only include vocabulary elements that have a non-null attribute named * attrname, and where the value of that attribute matches one of the * values specified in this parameter. */ if (paramMap != null) { Iterator<String> paramIter = paramMap.keySet().iterator(); while (paramIter.hasNext()) { String paramName = paramIter.next(); String paramValues = paramMap.get(paramName); if (paramName.contains("EQATTR_")) { String type = paramName.substring(7, paramName.length()); BsonDocument query = getVocFamilyQueryObject(type, "attributes", paramValues); if (query != null) queryList.add(query); } } } return queryList; } private long getTimeMillis(String standardDateString) { try { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX"); GregorianCalendar eventTimeCalendar = new GregorianCalendar(); eventTimeCalendar.setTime(sdf.parse(standardDateString)); return eventTimeCalendar.getTimeInMillis(); } catch (ParseException e) { try { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); GregorianCalendar eventTimeCalendar = new GregorianCalendar(); eventTimeCalendar.setTime(sdf.parse(standardDateString)); return eventTimeCalendar.getTimeInMillis(); } catch (ParseException e1) { Configuration.logger.log(Level.ERROR, e1.toString()); } } // Never Happened return 0; } }
true
3dac8b4a173e1305699d1053b9f17b228f407aa6
Java
ValeriaMaran/2018-06-13-simulazione_FlightDelays_JDK11
/src/main/java/it/polito/tdp/flightdelays/db/FlightDelaysDAO.java
UTF-8
4,862
2.65625
3
[]
no_license
package it.polito.tdp.flightdelays.db; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import it.polito.tdp.flightdelays.model.Adiacenze; import it.polito.tdp.flightdelays.model.Airline; import it.polito.tdp.flightdelays.model.Airport; import it.polito.tdp.flightdelays.model.Flight; public class FlightDelaysDAO { public List<Airline> loadAllAirlines() { String sql = "SELECT id, airline from airlines"; List<Airline> result = new ArrayList<Airline>(); try { Connection conn = DBConnect.getConnection(); PreparedStatement st = conn.prepareStatement(sql); ResultSet rs = st.executeQuery(); while (rs.next()) { result.add(new Airline(rs.getString("ID"), rs.getString("airline"))); } conn.close(); return result; } catch (SQLException e) { e.printStackTrace(); System.out.println("Errore connessione al database"); throw new RuntimeException("Error Connection Database"); } } public Map<String,Airport> loadAllAirports(Map<String,Airport> idMap) { String sql = "SELECT id, airport, city, state, country, latitude, longitude FROM airports"; //Map<String,Airport> idMap = new HashMap<String,Airport>(); try { Connection conn = DBConnect.getConnection(); PreparedStatement st = conn.prepareStatement(sql); ResultSet rs = st.executeQuery(); while (rs.next()) { Airport airport = new Airport(rs.getString("id"), rs.getString("airport"), rs.getString("city"), rs.getString("state"), rs.getString("country"), rs.getDouble("latitude"), rs.getDouble("longitude")); if(idMap.containsKey(rs.getString("id"))==false) { idMap.put(rs.getString("id"), airport); } } conn.close(); return idMap; } catch (SQLException e) { e.printStackTrace(); System.out.println("Errore connessione al database"); throw new RuntimeException("Error Connection Database"); } } public List<Flight> loadAllFlights() { String sql = "SELECT id, airline, flight_number, origin_airport_id, destination_airport_id, scheduled_dep_date, " + "arrival_date, departure_delay, arrival_delay, air_time, distance FROM flights"; List<Flight> result = new LinkedList<Flight>(); try { Connection conn = DBConnect.getConnection(); PreparedStatement st = conn.prepareStatement(sql); ResultSet rs = st.executeQuery(); while (rs.next()) { Flight flight = new Flight(rs.getInt("id"), rs.getString("airline"), rs.getInt("flight_number"), rs.getString("origin_airport_id"), rs.getString("destination_airport_id"), rs.getTimestamp("scheduled_dep_date").toLocalDateTime(), rs.getTimestamp("arrival_date").toLocalDateTime(), rs.getInt("departure_delay"), rs.getInt("arrival_delay"), rs.getInt("air_time"), rs.getInt("distance")); result.add(flight); } conn.close(); return result; } catch (SQLException e) { e.printStackTrace(); System.out.println("Errore connessione al database"); throw new RuntimeException("Error Connection Database"); } } public Map<String,Airline> getStringLineeAeree(){ String sql = "SELECT id,airline FROM airlines a ORDER BY a.AIRLINE ASC "; Map<String,Airline> lineeAeree = new HashMap<String,Airline>(); try { Connection conn = DBConnect.getConnection(); PreparedStatement st = conn.prepareStatement(sql); ResultSet rs = st.executeQuery(); while(rs.next()) { Airline a = new Airline(rs.getString("id"),rs.getString("airline")); lineeAeree.put(a.getId(),a); } conn.close(); } catch(SQLException e) { e.printStackTrace(); } return lineeAeree; } public List<Adiacenze> getAdiacenze(String id, Map<String, Airport> idMap){ //Map<String,Airport> aereoporti = new HashMap<String,Airport>(); List<Adiacenze> rotte = new LinkedList<Adiacenze>(); //loadAllAirports(aereoporti); String sql ="SELECT f.ORIGIN_AIRPORT_ID AS air1, f.DESTINATION_AIRPORT_ID AS air2,AVG(f.ARRIVAL_DELAY) AS tot " + "FROM flights f " + "WHERE f.AIRLINE =? " + "GROUP BY f.ORIGIN_AIRPORT_ID,f.DESTINATION_AIRPORT_ID " + "HAVING COUNT(f.FLIGHT_NUMBER)>1"; try { Connection conn = DBConnect.getConnection(); PreparedStatement st = conn.prepareStatement(sql); st.setString(1, id); ResultSet rs = st.executeQuery(); while(rs.next()) { if(idMap.containsKey(rs.getString("air1")) && idMap.containsKey(rs.getString("air2"))) { Airport a1 = idMap.get(rs.getString("air1")); Airport a2 = idMap.get(rs.getString("air2")); Adiacenze a = new Adiacenze(a1,a2,rs.getDouble("tot")); rotte.add(a); } } } catch(SQLException e) { e.printStackTrace(); } return rotte; } }
true
6becd15fe776ae24214e4236982793c3ced17593
Java
ChristopherLowton/IP2-A6
/src/Controllers/ChooseCatController.java
UTF-8
3,020
2.390625
2
[]
no_license
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package Controllers; import java.io.IOException; import java.net.URL; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.Optional; import java.util.ResourceBundle; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.fxml.Initializable; import javafx.scene.Node; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.Alert; import javafx.scene.control.Button; import javafx.scene.control.ButtonType; import javafx.scene.control.TextField; import javafx.stage.Stage; /** * FXML Controller class * * @author syed */ public class ChooseCatController implements Initializable { @FXML private Button logout; @FXML private QuestionController questionController; Connection conn = null; PreparedStatement pst= null; ResultSet rs= null; @FXML private void easyCatButton(ActionEvent event) throws SQLException, IOException{ Parent QuestionParent = FXMLLoader.load(getClass().getResource("/Views/Question.fxml")); Scene QuestionScene = new Scene(QuestionParent); Stage QuestionPage = (Stage)((Node)event.getSource()).getScene().getWindow(); QuestionPage.setScene(QuestionScene); QuestionPage.show(); //calling easycategory to create first question // QuestionController question = new QuestionController(); // question.easyCat(); } @FXML private void mediumCat() { } @FXML private void hardCat() { } /** * Initializes the controller class. */ @Override public void initialize(URL url, ResourceBundle rb) { // TODO } @FXML private void logout(ActionEvent event) throws SQLException, Exception { Alert alert = new Alert(Alert.AlertType.CONFIRMATION); alert.setTitle("Confirm?"); alert.setHeaderText(null); alert.setContentText("Are you ok with this?"); Optional<ButtonType> result = alert.showAndWait(); if (result.get() == ButtonType.OK) { // ... user chose OK // (new FXMLLoader(getClass().getResource("/Views/Login.fxml"))).load(); Parent loginParent = FXMLLoader.load(getClass().getResource("/Views/Login.fxml")); Scene loginScene = new Scene(loginParent); Stage loginPage = (Stage) ((Node) event.getSource()).getScene().getWindow(); loginPage.setScene(loginScene); loginPage.show(); } else { // ... user chose CANCEL or closed the dialog } } }
true
6cd7c7754df6a38e39f79b1ee01284979cd88a8d
Java
51hghg/day05
/app/src/main/java/com/jy/day05/persenter/RecommendPersenter.java
UTF-8
3,661
2.046875
2
[]
no_license
package com.jy.day05.persenter; import com.jy.day05.base.BasePresenter; import com.jy.day05.interfaces.CallBack; import com.jy.day05.interfaces.tongpao.IRecommend; import com.jy.day05.model.RecommendModel; import com.jy.day05.model.data.tongpao.BannerBean; import com.jy.day05.model.data.tongpao.HotBean; import com.jy.day05.model.data.tongpao.PersonBean; import com.jy.day05.model.data.tongpao.RecommendBean; import com.jy.day05.model.data.tongpao.TopicBean; import com.jy.day05.model.data.tongpao.UserBean; import com.jy.day05.ui.fragment.Recommendragment; public class RecommendPersenter extends BasePresenter<IRecommend.View> implements IRecommend.Persenter { IRecommend.View view; IRecommend.Model model; public RecommendPersenter(IRecommend.View view) { this.view = view; this.model = new RecommendModel(); } @Override public void getRecommend() { model.loadRecommend(new CallBack() { @Override public void onFaile(String msg) { if (view != null) { view.tips(msg); } } @Override public void onSuccess(Object o) { if (view != null) { view.getRecommendReturn((RecommendBean) o); } } }); } @Override public void getBanner() { model.loadBanner(new CallBack() { @Override public void onFaile(String msg) { if (view != null) { view.tips(msg); } } @Override public void onSuccess(Object o) { if (view != null) { view.getBannerReturn((BannerBean) o); } } }); } @Override public void getTopic() { model.loadTopic(new CallBack() { @Override public void onFaile(String msg) { if (view != null) { view.tips(msg); } } @Override public void onSuccess(Object o) { if (view != null) { view.getTopisReturn((TopicBean) o); } } }); } @Override public void getUser() { model.loadUser(new CallBack() { @Override public void onFaile(String msg) { if (view != null) { view.tips(msg); } } @Override public void onSuccess(Object o) { if (view != null) { view.getUserReturn((UserBean) o); } } }); } @Override public void getPerson() { model.loadPerson(new CallBack() { @Override public void onFaile(String msg) { if (view != null) { view.tips(msg); } } @Override public void onSuccess(Object o) { if (view != null) { view.persenter((PersonBean) o); } } }); } @Override public void gethot() { model.getHot(new CallBack() { @Override public void onFaile(String msg) { if (view != null) { view.tips(msg); } } @Override public void onSuccess(Object o) { if (view != null) { view.getHot((HotBean) o); } } }); } }
true
8406a8733490c952e45a838495c20864574021a8
Java
chenxianghua2014/Education
/src/com/ttgis/education/service/CourseService.java
UTF-8
4,775
2.328125
2
[]
no_license
package com.ttgis.education.service; import java.util.List; import java.util.Map; import javax.annotation.Resource; import org.springframework.stereotype.Repository; import org.springframework.stereotype.Service; import com.ttgis.education.entity.Course; import com.ttgis.education.entity.page.CoursePage; import com.ttgis.education.mapper.CourseMapper; @Repository @Service public class CourseService { @Resource private CourseMapper courseMapper; public int deleteByPrimaryKey(String courseId){ return courseMapper.deleteByPrimaryKey(courseId); } public int insert(Course record){ return courseMapper.insert(record); } public int insertSelective(Course record){ return courseMapper.insertSelective(record); } public Course selectByPrimaryKey(String courseId){ return courseMapper.selectByPrimaryKey(courseId); } public int updateByPrimaryKeySelective(Course record){ return courseMapper.updateByPrimaryKeySelective(record); } public int updateByPrimaryKey(Course record){ return courseMapper.updateByPrimaryKey(record); } /** * 查询全部课程 * @return */ public List<Course> selectAllCourse(){ return courseMapper.selectAllCourse(); } /** * 分页分目录查询 * @param record * @return */ public List<Course> selectCourseBySyllabusId(CoursePage record){ return courseMapper.selectCourseBySyllabusId(record); } /** * 分页分目录查询总条数 * @param page * @return */ public int selectCourseBySyllabusIdRows(CoursePage page){ return courseMapper.selectCourseBySyllabusIdRows(page); } public List<Course> selectToStudyOver(String studentId){ return courseMapper.selectToStudyOver(studentId); } public List<Course> selectByTranningCourseId(String tranningCourseId){ return courseMapper.selectByTranningCourseId(tranningCourseId); } public List<Course> selectTopNumber(int num){ return courseMapper.selectTopNumber(num); } /** * 董再兴 2015-08-31 16:49 * 课程管理中的课程分页 * @param map 包含分页和课程实体两个查询对象 * @return */ public List<Course> selectCoursesBySyllabusId(Map map){ return courseMapper.selectCoursesBySyllabusId(map); } /** * 董再兴 2015-08-31 16:57 * 课程管理中的课程总数 * @param map 包含分页和课程实体两个查询对象 * @return */ public int selectCoursesBySyllabusIdCount(Map map){ return courseMapper.selectCoursesBySyllabusIdCount(map); } /** * 课程分页 * @param record * @return */ public List<Course> selectPageAll(Course record) { return courseMapper.selectPageAll(record); } /** * 课程总数 * @param record * @return */ public int CoursesCount(Course record) { return courseMapper.CoursesCount(record); } /** * 添加数据查询 * @param record * @return */ public Course CourseByOId(Course record) { return courseMapper.CourseByOId(record); } //------------培训班-------------- /** * 分页查询 * @return */ public List<Course> classCoursePageAll(Course p) { return courseMapper.classCoursePageAll(p); } /** * 总数 * @return */ public int classCourseCount(Course p) { return courseMapper.classCourseCount(p); } /** * 前台页面显示课程信息 */ public List<Course> CourseAll(Course p) { return courseMapper.CourseAll(p); } /** * 前台页面显示课程信息 */ public List<Course> CourseAllPV() { return courseMapper.CourseAllPV(); } /** * 前台课程分页 * @param record * @return */ public List<Course> selectPageWebAll(Course record) { return courseMapper.selectPageWebAll(record); } /** * 前台课程总数 * @param record * @return */ public int CoursesWebCount(Course record) { return courseMapper.CoursesWebCount(record); } /** * queryNameList查id,name */ public List<Course> queryNameList(){ return courseMapper.queryNameList(); } /** * 前台课程评分分页 * @param record * @return */ public List<Course> selectPageAllEstimate(Course ncourse) { return courseMapper.selectPageAllEstimate(ncourse); } /** * 前台收藏课程分页 * @param record * @return */ public List<Course> selectPageWebSc(Course record) { return courseMapper.selectPageWebSc(record); } /** * 前台收藏课程总数 * @param record * @return */ public int CoursesWebSc(Course record) { return courseMapper.CoursesWebSc(record); } /** * 站内模糊查询课程 * @param record * @return */ public List<Course> queryMyName(Course record) { return courseMapper.queryMyName(record); } }
true
24bd63ac6c35b7deae3dedf74a9411c61716e136
Java
damugua/wae
/wae-core/src/main/java/cn/finder/wae/queryer/handleclass/UpdateUserPwdQueryerAfter.java
UTF-8
1,809
2.265625
2
[ "Apache-2.0" ]
permissive
package cn.finder.wae.queryer.handleclass; import java.util.HashMap; import java.util.Map; import cn.finder.ui.webtool.QueryCondition; import cn.finder.wae.business.domain.TableQueryResult; import cn.finder.wae.business.domain.User; import cn.finder.wae.business.dto.MapParaQueryConditionDto; import cn.finder.wae.business.module.auth.service.AuthService; import cn.finder.wae.common.comm.AppApplicationContextUtil; import cn.finder.wae.common.comm.MD5Util; import cn.finder.wae.queryer.handleclass.QueryerDBAfterClass; /*** * 密码修改 * @author xiaoht * */ public class UpdateUserPwdQueryerAfter extends QueryerDBAfterClass { AuthService authService =AppApplicationContextUtil.getContext().getBean("authService", AuthService.class); @Override public TableQueryResult handle(TableQueryResult tableQueryResult, long showTableConfigId, QueryCondition<Object[]> condition) { super.handle(tableQueryResult, showTableConfigId, condition); @SuppressWarnings("unchecked") Map<String, Object> data = ((MapParaQueryConditionDto<String, Object>)condition).getMapParas(); String account = data.get("account").toString(); String oldPwd = data.get("oldPwd").toString(); String newPwd = data.get("newPwd").toString(); String oldPwdMD5 = MD5Util.getMD5(oldPwd); String newPwdMD5 = MD5Util.getMD5(newPwd); User user = authService.findByAccount(account); Map<String,Object> map = new HashMap<String,Object>(); if(user.getPassword().equals(oldPwdMD5)){ String user_sql = "update t_user set password = ? where account = ?"; authService.addUser(user_sql, new Object[]{newPwdMD5,account}); map.put("msg","密码修改成功!"); }else{ map.put("msg","原始密码不正确!"); } tableQueryResult.getResultList().add(map); return tableQueryResult; } }
true
7251ee79061d1a129d485e239ffb63488a4498df
Java
AnPMe/android
/media/src/main/java/com/example/media/ImageSwitcherActivity.java
UTF-8
3,846
2.09375
2
[]
no_license
package com.example.media; import com.example.media.adapter.GalleryAdapter; import com.example.media.task.GestureTask; import com.example.media.task.GestureTask.GestureCallback; import com.example.media.util.Utils; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.GestureDetector; import android.view.MotionEvent; import android.view.View; import android.view.View.OnTouchListener; import android.view.ViewGroup.LayoutParams; import android.view.animation.AnimationUtils; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.Gallery; import android.widget.ImageSwitcher; import android.widget.ImageView; import android.widget.ImageView.ScaleType; import android.widget.ViewSwitcher.ViewFactory; /** * Created by ouyangshen on 2016/12/4. */ public class ImageSwitcherActivity extends AppCompatActivity implements OnTouchListener, OnItemClickListener, GestureCallback { private ImageSwitcher is_switcher; private Gallery gl_switcher; private int[] mImageRes = { R.drawable.scene1, R.drawable.scene2, R.drawable.scene3, R.drawable.scene4, R.drawable.scene5, R.drawable.scene6 }; private GestureDetector mGesture; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_image_switcher); is_switcher = (ImageSwitcher) findViewById(R.id.is_switcher); is_switcher.setFactory(new ViewFactoryImpl()); is_switcher.setImageResource(mImageRes[0]); GestureTask gestureListener = new GestureTask(this); mGesture = new GestureDetector(this, gestureListener); gestureListener.setGestureCallback(this); is_switcher.setOnTouchListener(this); int dip_pad = Utils.dip2px(this, 20); gl_switcher = (Gallery) findViewById(R.id.gl_switcher); gl_switcher.setPadding(0, dip_pad, 0, dip_pad); gl_switcher.setSpacing(dip_pad); gl_switcher.setUnselectedAlpha(0.5f); gl_switcher.setOnItemClickListener(this); gl_switcher.setAdapter(new GalleryAdapter(this, mImageRes)); } @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { is_switcher.setInAnimation(AnimationUtils.loadAnimation(this, R.anim.fade_in)); is_switcher.setOutAnimation(AnimationUtils.loadAnimation(this, R.anim.fade_out)); is_switcher.setImageResource(mImageRes[position]); } public class ViewFactoryImpl implements ViewFactory { @Override public View makeView() { ImageView iv = new ImageView(ImageSwitcherActivity.this); iv.setBackgroundColor(0xFFFFFFFF); iv.setScaleType(ScaleType.FIT_XY); iv.setLayoutParams(new ImageSwitcher.LayoutParams( LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); return iv; } } @Override public boolean onTouch(View v, MotionEvent event) { mGesture.onTouchEvent(event); return true; } @Override public void gotoNext() { is_switcher.setInAnimation(AnimationUtils.loadAnimation(this, R.anim.push_left_in)); is_switcher.setOutAnimation(AnimationUtils.loadAnimation(this, R.anim.push_left_out)); int next_pos = (int) (gl_switcher.getSelectedItemId() + 1); if (next_pos >= mImageRes.length) { next_pos = 0; } is_switcher.setImageResource(mImageRes[next_pos]); gl_switcher.setSelection(next_pos); } @Override public void gotoPre() { is_switcher.setInAnimation(AnimationUtils.loadAnimation(this, R.anim.push_right_in)); is_switcher.setOutAnimation(AnimationUtils.loadAnimation(this, R.anim.push_right_out)); int pre_pos = (int) (gl_switcher.getSelectedItemId() - 1); if (pre_pos < 0) { pre_pos = mImageRes.length - 1; } is_switcher.setImageResource(mImageRes[pre_pos]); gl_switcher.setSelection(pre_pos); } }
true
722ca47f60dcf4a4494cdab6a5811420afecc903
Java
imma-fish-u/MobilePuzzleGame
/src/main/java/com/example/hex/GameActivity.java
UTF-8
509
1.953125
2
[]
no_license
package com.example.hex; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.view.Display; import com.example.hex.noodles.NoodlePanel; public class GameActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Display display = getWindowManager().getDefaultDisplay(); setContentView(new NoodlePanel(this, display.getWidth(), display.getHeight())); } }
true
213bb8792cdd9781ae81d3ad22eca50bd6d078fe
Java
LucienShui/HelloJava
/src/main/java/ink/lucien/persistence/orm/mybatis/annotation/mapper/KVSystemMapper.java
UTF-8
674
2.171875
2
[ "Apache-2.0" ]
permissive
package ink.lucien.persistence.orm.mybatis.annotation.mapper; import ink.lucien.persistence.orm.mybatis.annotation.model.KVSystem; import org.apache.ibatis.annotations.*; public interface KVSystemMapper { @Insert("INSERT INTO `kv_system` (`key`, `value`) VALUES (#{key}, #{value})") void insert(KVSystem kvSystem); @Delete("DELETE FROM `kv_system` WHERE `key` = #{key}") void deleteByKey(@Param("key") String key); @Update("UPDATE `kv_system` SET `value` = #{value} WHERE `key` = #{key}") void updateExistRecord(KVSystem key); @Select("SELECT * FROM `kv_system` WHERE `key` = #{key}") KVSystem getValueByKey(@Param("key") String key); }
true
3c2c13e0cb76ffb245581f4a15e810b347dc8045
Java
crossfx/DEMO2FINAL
/app/src/main/java/com/example/schen/camera/Adapter/EasyAdapter.java
UTF-8
3,807
2.71875
3
[]
no_license
package com.example.schen.camera.Adapter; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.TextView; import com.example.schen.camera.R; import com.squareup.picasso.Picasso; import java.io.File; import java.util.List; public class EasyAdapter extends BaseAdapter { private Context mContext; private LayoutInflater mInflater; private List<MyData> mDataList; public EasyAdapter(Context context, List<MyData> data) { this.mContext = context; this.mDataList = data; this.mInflater = LayoutInflater.from(context); } //Get the hex code for the cell reference, you dont need to care this part. @Override public long getItemId(int position) { return mDataList.get(position).hashCode(); } // Get the total number of cells, which is the same as the data list's size. If you want to make // the last cell different like (add post), you can add 1 onto the mDataList.size(). Then you // will need to construct the +1 cell by yourself in getView() function. @Override public int getCount() { return mDataList.size(); } //Return the data object for the target cell in selected position. @Override public Object getItem(int position) { return mDataList.get(position); } /** * Construct the cell object. This is the place you update the TextView, ImageView, or whatever * widgets you placed on the item layout file. * @param position index for the cell * @param convertView old view to be reused, which is the cell object (item_layout) * @param parent Your father Tz. (ListView) * @return */ @Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder viewHolder = null; //Check if the reused convertView is null or not. if it's null, inflate and create a ViewHolder //to define the TextView, ImageView objects in the layout file. if (convertView == null) { convertView = mInflater.inflate(R.layout.item_listview, parent, false); viewHolder = new ViewHolder(convertView); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } //MyData object contained the information needed for this cell at index 'position' MyData targetData = mDataList.get(position); //Update the widgets. /*viewHolder.imageTitle.setText(targetData.getImageTitle());*/ viewHolder.imageDes.setText(targetData.getImageDescription()); Picasso.get().load(new File(targetData.getImageUrl())).into(viewHolder.image); return convertView; } /** * Update the data set. Once new data set is saved, call notifyDataSetChanged() to refresh * the UI. * @param newData */ public void updateData(List<MyData> newData) { mDataList = newData; notifyDataSetChanged(); } /** * Private class only used by the adapter class. * This is a helper class to define the exact widgets for the item layout files through using * findViewById. */ public class ViewHolder { TextView imageTitle; TextView imageDes; ImageView image; /** * Pass the View object which is the view inflated from adapter class. * @param view */ public ViewHolder(View view) { /*imageTitle = view.findViewById(R.id.item_title);*/ imageDes = view.findViewById(R.id.item_description); image = view.findViewById(R.id.annotateimage); } } }
true
404088d8d3e52d9379676e22591a02ddc0632be8
Java
lijianSE/LeetCode
/java/src/com/company/Q102_BinaryTreeLevelOrderTraversal.java
UTF-8
1,277
3.34375
3
[]
no_license
package com.company; import java.util.*; /** * Created by LiJian on 2016/5/2. * Describe : This class is responsible for */ public class Q102_BinaryTreeLevelOrderTraversal { public List<List<Integer>> levelOrder(TreeNode root) { List<List<Integer>> result = new ArrayList<>(); Queue<TreeNode> queue = new LinkedList<>(); if (root == null) return result; queue.add(root); queue.add(null); List<Integer> item = new ArrayList<>(); while (!queue.isEmpty()) { TreeNode node = queue.remove(); if (node == null) { result.add(item); item = new ArrayList<>(); if (queue.isEmpty()) break; queue.add(null); continue; } item.add(node.val); if (node.left != null) queue.add(node.left); if (node.right != null) queue.add(node.right); } return result; } public static void main(String[] args) { TreeNode node = new TreeNode(1); Q102_BinaryTreeLevelOrderTraversal q = new Q102_BinaryTreeLevelOrderTraversal(); q.levelOrder(node); } }
true
7eae9c36c8ec443a623b057671c75159539b3a0c
Java
Moonybb/bitcamp-java_web_study
/javaWorkspace/day25/src/com/bit/day25/StringStream.java
UTF-8
827
3.15625
3
[]
no_license
package com.bit.day25; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.util.Scanner; public class StringStream { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String path = "data.txt"; File file = new File(path); FileWriter fw = null; BufferedWriter bw = null; try { fw = new FileWriter(file); bw = new BufferedWriter(fw); while(true){ String msg = sc.nextLine(); if(msg.equals("/exit"))break; bw.write(msg); bw.newLine(); } } catch (IOException e) { e.printStackTrace(); } finally { try { if(bw!=null)bw.close(); if(fw!=null)fw.close(); } catch (IOException e) { e.printStackTrace(); } } } }
true
8c5030ca524b8db71ea28b25a0e9274a76e06837
Java
ewjmulder/program-your-home
/commons-pyh/src/main/java/com/programyourhome/common/config/XsdSchemaIncludeInput.java
UTF-8
2,513
2.203125
2
[]
no_license
package com.programyourhome.common.config; import java.io.BufferedInputStream; import java.io.IOException; import java.io.InputStream; import java.io.Reader; import org.apache.commons.io.IOUtils; import org.w3c.dom.ls.LSInput; public class XsdSchemaIncludeInput implements LSInput { private String publicId; private String systemId; private BufferedInputStream inputStream; public XsdSchemaIncludeInput(final String publicId, final String systemId, final InputStream inputStream) { this.publicId = publicId; this.systemId = systemId; this.inputStream = new BufferedInputStream(inputStream); } @Override public String getPublicId() { return this.publicId; } @Override public void setPublicId(final String publicId) { this.publicId = publicId; } @Override public String getSystemId() { return this.systemId; } @Override public void setSystemId(final String systemId) { this.systemId = systemId; } public BufferedInputStream getInputStream() { return this.inputStream; } public void setInputStream(final BufferedInputStream inputStream) { this.inputStream = inputStream; } @Override public String getEncoding() { return "UTF-8"; } @Override public String getStringData() { try { return IOUtils.toString(this.inputStream); } catch (final IOException e) { throw new IllegalArgumentException("IOException while reading config.", e); } } /* * All methods below have no actual implementation, but are necessary to implement the LSInput interface. */ @Override public String getBaseURI() { return null; } @Override public InputStream getByteStream() { return null; } @Override public boolean getCertifiedText() { return false; } @Override public Reader getCharacterStream() { return null; } @Override public void setBaseURI(final String baseURI) { } @Override public void setByteStream(final InputStream byteStream) { } @Override public void setCertifiedText(final boolean certifiedText) { } @Override public void setCharacterStream(final Reader characterStream) { } @Override public void setEncoding(final String encoding) { } @Override public void setStringData(final String stringData) { } }
true
79d6a8d8a467bb85c35adb0dc9beb6a143f243c6
Java
RocioHuertasDiaz/migas
/src/main/java/com/migas/Model/Dao/ConsultasProveedor.java
UTF-8
4,327
2.484375
2
[]
no_license
package com.migas.Model.Dao; import com.migas.Model.Beans.Proveedor; import com.migas.Model.Beans.usuario; import com.migas.Util.Conexion.Conexion; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; public class ConsultasProveedor extends Conexion { private static PreparedStatement pst; PreparedStatement pSt = null; ResultSet res = null; Proveedor Pro = new Proveedor(); public boolean Registrar(int nitProveedor, String razonSocialProveedor, String nombreContactoProveedor, String emailProveedor, String direccionProveedor, int telefonoProveedor) { try { String sql= "insert into proveedor(NIT_Proveedor,RazonSocial_Proveedor, nombre_Contacto,email_Proveedor,direccion_Proveedor,telefono_proveedor)" + " values (?,?,?,?,?,?)"; pSt = getConexion().prepareStatement(sql); pSt.setInt(1,nitProveedor); pSt.setString(2,razonSocialProveedor); pSt.setString(3,nombreContactoProveedor); pSt.setString(4,emailProveedor); pSt.setString(5,direccionProveedor); pSt.setInt(6,telefonoProveedor); if (pSt.executeUpdate() == 1) { return true; } } catch (Exception ex) { System.err.println("ErrorR1" + ex); } finally { try { if (getConexion() != null) getConexion().close(); if (pSt != null) pSt.close(); } catch (Exception ex) { System.err.println("ErrorR2" + ex); } } return false; } public List<Proveedor> listar() throws SQLException{ List<Proveedor> listaProveedores = new ArrayList<>(); String consulta = "SELECT * FROM proveedor"; pSt = getConexion().prepareStatement(consulta); ResultSet res = pSt.executeQuery(); try { while (res.next()){ Proveedor pro = new Proveedor(); pro.setNitProveedor(res.getInt(1)); pro.setRazonSocialProveedor(res.getString(2)); pro.setNombreContactoProveedor(res.getString(3)); pro.setEmailProveedor(res.getString(4)); pro.setDireccionProveedor(res.getString(5)); pro.setTelefonoProveedor(res.getInt(6)); listaProveedores.add(pro); } }catch (SQLException e){ e.printStackTrace(); } return listaProveedores; } // obtener por id public static Proveedor obtenerNit(int nit) throws SQLException { Proveedor proveedor = null; String sql = "SELECT * FROM proveedor WHERE NIT_Proveedor=? "; pst = getConexion().prepareStatement(sql); pst.setInt(1, nit); ResultSet res = pst.executeQuery(); res = pst.executeQuery(); if (res.next()) { proveedor = new Proveedor(res.getInt("NIT_Proveedor"), res.getString("RazonSocial_Proveedor"), res.getString("nombre_Contacto"), res.getString("email_Proveedor"), res.getString("direccion_Proveedor"), res.getInt("telefono_proveedor")); } res.close(); pst.close(); return proveedor; } public boolean editar(Proveedor proveedor) throws SQLException { String sql = null; boolean estadoOperacion = false; sql = "update proveedor set RazonSocial_Proveedor=?,nombre_Contacto=?,email_Proveedor=?,direccion_Proveedor=?,telefono_proveedor=? where NIT_Proveedor=?"; pst = getConexion().prepareStatement(sql); pst.setString(1, proveedor.getRazonSocialProveedor()); pst.setString(2, proveedor.getNombreContactoProveedor()); pst.setString(3, proveedor.getEmailProveedor()); pst.setString(4, proveedor.getDireccionProveedor()); pst.setInt(5, proveedor.getTelefonoProveedor()); pst.setInt(6, proveedor.getNitProveedor()); estadoOperacion = pst.executeUpdate()>0; getConexion().close(); pst.close(); return estadoOperacion; } }
true
7dc90245626d3e7a314df6c960e7e65d031d8f9b
Java
l631768226/building
/src/main/java/com/ly/building/model/PlaceModel.java
UTF-8
2,970
2.15625
2
[]
no_license
package com.ly.building.model; public class PlaceModel { private String bank = "0"; private String hospitol = "0"; private String mall = "0"; private String park = "0"; private String restaurant = "0"; private String school = "0"; private String subway = "0"; private String water = "0"; private String price; private String placeN; private String placeL; private String placeD; private String placeA; private String rate; private String time; private String greeningRate; private String ID; public String getBank() { return bank; } public void setBank(String bank) { this.bank = bank; } public String getHospitol() { return hospitol; } public void setHospitol(String hospitol) { this.hospitol = hospitol; } public String getMall() { return mall; } public void setMall(String mall) { this.mall = mall; } public String getPark() { return park; } public void setPark(String park) { this.park = park; } public String getRestaurant() { return restaurant; } public void setRestaurant(String restaurant) { this.restaurant = restaurant; } public String getSchool() { return school; } public void setSchool(String school) { this.school = school; } public String getSubway() { return subway; } public void setSubway(String subway) { this.subway = subway; } public String getWater() { return water; } public void setWater(String water) { this.water = water; } public String getPrice() { return price; } public void setPrice(String price) { this.price = price; } public String getPlaceN() { return placeN; } public void setPlaceN(String placeN) { this.placeN = placeN; } public String getPlaceL() { return placeL; } public void setPlaceL(String placeL) { this.placeL = placeL; } public String getPlaceD() { return placeD; } public void setPlaceD(String placeD) { this.placeD = placeD; } public String getPlaceA() { return placeA; } public void setPlaceA(String placeA) { this.placeA = placeA; } public String getRate() { return rate; } public void setRate(String rate) { this.rate = rate; } public String getTime() { return time; } public void setTime(String time) { this.time = time; } public String getGreeningRate() { return greeningRate; } public void setGreeningRate(String greeningRate) { this.greeningRate = greeningRate; } public String getID() { return ID; } public void setID(String ID) { this.ID = ID; } }
true
10ea5c6a848e1cbc6dbe2d861b9264e71e97013f
Java
josephcalver/ProgrammingChallenges
/ProgrammingChallenges/src/_1_6_StringCompression/App.java
UTF-8
1,632
4.3125
4
[]
no_license
package _1_6_StringCompression; public class App { /* * String Compression: Implement a method to perform basic string compression using * the counts of repeated characters. For example, the string aabcccccaaa would become * a2blc5a3. If the "compressed"string would not become smaller than the original string, * your method should return the original string. You can assume the string has only * uppercase and lowercase letters (a - z). */ public static void main(String[] args) { String s = "aaabbbbcccccddeeeeeeee"; String compressed = compress(s); System.out.println(compressed); } public static String compress(String s) { // check length to see if worth compressing int finalLength = countCompression(s); if (finalLength >= s.length()) return s; StringBuilder compressed = new StringBuilder(finalLength); int countConsecutive = 0; for (int i = 0; i < s.length(); i++) { countConsecutive++; // if next char different to current char, append char and consecutiveCount if (i + 1 >= s.length() || s.charAt(i) != s.charAt(i + 1)) { compressed.append(s.charAt(i)); compressed.append(countConsecutive); countConsecutive = 0; } } return compressed.toString(); } private static int countCompression(String s) { int compressedLength = 0; int countConsecutive = 0; for (int i = 0; i < s.length(); i++) { countConsecutive++; if (i + 1 >= s.length() || s.charAt(i) != s.charAt(i + 1)) { compressedLength += 1 + String.valueOf(countConsecutive).length(); countConsecutive = 0; } } return compressedLength; } }
true
e92de88cc1bc4516471127a5a64334d24836ccd9
Java
EsatG/Eg
/src/day01_FirstProgramming/classmates.java
UTF-8
310
1.71875
2
[]
no_license
package day01_FirstProgramming; public class classmates { public static void main(String[] args) { System.out.println("Andi Pepa"); System.out.println("Yucel Bark"); System.out.println("Bahri Turel"); System.out.println("Suleyman Tuna Er"); System.out.println("Omer Cevdet Gorgun"); } }
true
02b252a5ae7605bc339a2bb3e7faf80557f8ddac
Java
transactionMDP/transactionMDP-server-side
/src/main/java/com/bcp/mdp/model/User.java
UTF-8
3,968
2.15625
2
[]
no_license
package com.bcp.mdp.model; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import org.hibernate.annotations.NaturalId; import javax.persistence.*; import javax.validation.constraints.Email; import javax.validation.constraints.Size; import java.io.Serializable; import java.time.Instant; import java.util.HashSet; import java.util.Set; @Entity @Table(name = "users", uniqueConstraints = { @UniqueConstraint(columnNames = { "registrationNumber" }), @UniqueConstraint(columnNames = { "email" }) }) @JsonIgnoreProperties({"hibernateLazyInitializer", "handler"}) public class User implements Serializable /*DateAudit*/ { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private long id; //@NotBlank @Size(min = 4, max = 40) private String name; //@NotBlank @Size(min = 3, max = 15) private String registrationNumber; @NaturalId //@NotBlank @Size(max = 40) @Email private String email; //@NotBlank @Size(min = 6, max = 100) private String password; @Transient //@NotBlank private String registrationNumberOrEmail; @OneToOne //@JsonManagedReference private Agency agency; @ManyToMany(fetch = FetchType.LAZY) @JoinTable(name = "user_roles", joinColumns = @JoinColumn(name = "user_id"), inverseJoinColumns = @JoinColumn(name = "role_id")) private Set<Role> roles = new HashSet<>(); /*@OneToOne(mappedBy = "user") private Teller teller; @JsonIgnore public Teller getTeller() { return teller; } public void setTeller(Teller teller) { this.teller = teller; }*/ public User() { } public User(String name, String registrationNumber, String email, String password) { this.name = name; this.registrationNumber = registrationNumber; this.email = email; this.password = password; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getRegistrationNumber() { return registrationNumber; } public void setRegistrationNumber(String registrationNumber) { this.registrationNumber = registrationNumber; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public Set<Role> getRoles() { return roles; } public void setRoles(Set<Role> roles) { this.roles = roles; } public String getRegistrationNumberOrEmail() { return registrationNumberOrEmail; } public void setRegistrationNumberOrEmail(String registrationNumberOrEmail) { this.registrationNumberOrEmail = registrationNumberOrEmail; } @Transient private Instant joinedAt; public void UserProfile(long id, String registrationNumber, String name, Instant joinedAt) { this.id = id; this.registrationNumber = registrationNumber; this.name = name; this.joinedAt = joinedAt; } public Instant getJoinedAt() { return joinedAt; } public void setJoinedAt(Instant joinedAt) { this.joinedAt = joinedAt; } @Transient private String role; public String getRole() { return role; } public void setRole(String role) { this.role = role; } public void UserSummary(long id, String registrationNumber, String name, String role) { this.id = id; this.registrationNumber = registrationNumber; this.name = name; this.role = role; } }
true
3b713f61fecf0bcca9404d9694a8cd31619984be
Java
pandafw/panda
/panda-core/src/test/java/panda/lang/time/DurationFormatsTest.java
UTF-8
26,308
2.8125
3
[ "Apache-2.0" ]
permissive
package panda.lang.time; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import java.lang.reflect.Constructor; import java.lang.reflect.Modifier; import java.util.Calendar; import java.util.TimeZone; import org.junit.Test; /** * TestCase for DurationFormats. */ public class DurationFormatsTest { // ----------------------------------------------------------------------- @Test public void testConstructor() { assertNotNull(new DurationFormats()); final Constructor<?>[] cons = DurationFormats.class.getDeclaredConstructors(); assertEquals(1, cons.length); assertTrue(Modifier.isPublic(cons[0].getModifiers())); assertTrue(Modifier.isPublic(DurationFormats.class.getModifiers())); assertFalse(Modifier.isFinal(DurationFormats.class.getModifiers())); } // ----------------------------------------------------------------------- @Test public void testFormatDurationWords() { String text = null; text = DurationFormats.formatDurationWords(50 * 1000, true, false); assertEquals("50 seconds", text); text = DurationFormats.formatDurationWords(65 * 1000, true, false); assertEquals("1 minute 5 seconds", text); text = DurationFormats.formatDurationWords(120 * 1000, true, false); assertEquals("2 minutes 0 seconds", text); text = DurationFormats.formatDurationWords(121 * 1000, true, false); assertEquals("2 minutes 1 second", text); text = DurationFormats.formatDurationWords(72 * 60 * 1000, true, false); assertEquals("1 hour 12 minutes 0 seconds", text); text = DurationFormats.formatDurationWords(24 * 60 * 60 * 1000, true, false); assertEquals("1 day 0 hours 0 minutes 0 seconds", text); text = DurationFormats.formatDurationWords(50 * 1000, true, true); assertEquals("50 seconds", text); text = DurationFormats.formatDurationWords(65 * 1000, true, true); assertEquals("1 minute 5 seconds", text); text = DurationFormats.formatDurationWords(120 * 1000, true, true); assertEquals("2 minutes", text); text = DurationFormats.formatDurationWords(121 * 1000, true, true); assertEquals("2 minutes 1 second", text); text = DurationFormats.formatDurationWords(72 * 60 * 1000, true, true); assertEquals("1 hour 12 minutes", text); text = DurationFormats.formatDurationWords(24 * 60 * 60 * 1000, true, true); assertEquals("1 day", text); text = DurationFormats.formatDurationWords(50 * 1000, false, true); assertEquals("0 days 0 hours 0 minutes 50 seconds", text); text = DurationFormats.formatDurationWords(65 * 1000, false, true); assertEquals("0 days 0 hours 1 minute 5 seconds", text); text = DurationFormats.formatDurationWords(120 * 1000, false, true); assertEquals("0 days 0 hours 2 minutes", text); text = DurationFormats.formatDurationWords(121 * 1000, false, true); assertEquals("0 days 0 hours 2 minutes 1 second", text); text = DurationFormats.formatDurationWords(72 * 60 * 1000, false, true); assertEquals("0 days 1 hour 12 minutes", text); text = DurationFormats.formatDurationWords(24 * 60 * 60 * 1000, false, true); assertEquals("1 day", text); text = DurationFormats.formatDurationWords(50 * 1000, false, false); assertEquals("0 days 0 hours 0 minutes 50 seconds", text); text = DurationFormats.formatDurationWords(65 * 1000, false, false); assertEquals("0 days 0 hours 1 minute 5 seconds", text); text = DurationFormats.formatDurationWords(120 * 1000, false, false); assertEquals("0 days 0 hours 2 minutes 0 seconds", text); text = DurationFormats.formatDurationWords(121 * 1000, false, false); assertEquals("0 days 0 hours 2 minutes 1 second", text); text = DurationFormats.formatDurationWords(72 * 60 * 1000, false, false); assertEquals("0 days 1 hour 12 minutes 0 seconds", text); text = DurationFormats.formatDurationWords(24 * 60 * 60 * 1000 + 72 * 60 * 1000, false, false); assertEquals("1 day 1 hour 12 minutes 0 seconds", text); text = DurationFormats.formatDurationWords(2 * 24 * 60 * 60 * 1000 + 72 * 60 * 1000, false, false); assertEquals("2 days 1 hour 12 minutes 0 seconds", text); for (int i = 2; i < 31; i++) { text = DurationFormats.formatDurationWords(i * 24 * 60 * 60 * 1000L, false, false); // assertEquals(i + " days 0 hours 0 minutes 0 seconds", text); // // junit.framework.ComparisonFailure: expected:<25 days 0 hours 0 minutes 0...> but // was:<-24 days -17 hours // -2 minutes -47...> // at junit.framework.Assert.assertEquals(Assert.java:81) // at junit.framework.Assert.assertEquals(Assert.java:87) // at // org.apache.commons.lang.time.DurationFormatUtilsTest.testFormatDurationWords(DurationFormatUtilsTest.java:124) // at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) // at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) // at // sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) // at java.lang.reflect.Method.invoke(Method.java:324) // at junit.framework.TestCase.runTest(TestCase.java:154) // at junit.framework.TestCase.runBare(TestCase.java:127) // at junit.framework.TestResult$1.protect(TestResult.java:106) // at junit.framework.TestResult.runProtected(TestResult.java:124) // at junit.framework.TestResult.run(TestResult.java:109) // at junit.framework.TestCase.run(TestCase.java:118) // at junit.framework.TestSuite.runTest(TestSuite.java:208) // at junit.framework.TestSuite.run(TestSuite.java:203) // at // org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478) // at // org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344) // at // org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) } } /** * Tests that "1 <unit>s" gets converted to "1 <unit>" but that "11 <unit>s" is left alone. */ @Test public void testFormatDurationPluralWords() { final long oneSecond = 1000; final long oneMinute = oneSecond * 60; final long oneHour = oneMinute * 60; final long oneDay = oneHour * 24; String text = null; text = DurationFormats.formatDurationWords(oneSecond, false, false); assertEquals("0 days 0 hours 0 minutes 1 second", text); text = DurationFormats.formatDurationWords(oneSecond * 2, false, false); assertEquals("0 days 0 hours 0 minutes 2 seconds", text); text = DurationFormats.formatDurationWords(oneSecond * 11, false, false); assertEquals("0 days 0 hours 0 minutes 11 seconds", text); text = DurationFormats.formatDurationWords(oneMinute, false, false); assertEquals("0 days 0 hours 1 minute 0 seconds", text); text = DurationFormats.formatDurationWords(oneMinute * 2, false, false); assertEquals("0 days 0 hours 2 minutes 0 seconds", text); text = DurationFormats.formatDurationWords(oneMinute * 11, false, false); assertEquals("0 days 0 hours 11 minutes 0 seconds", text); text = DurationFormats.formatDurationWords(oneMinute + oneSecond, false, false); assertEquals("0 days 0 hours 1 minute 1 second", text); text = DurationFormats.formatDurationWords(oneHour, false, false); assertEquals("0 days 1 hour 0 minutes 0 seconds", text); text = DurationFormats.formatDurationWords(oneHour * 2, false, false); assertEquals("0 days 2 hours 0 minutes 0 seconds", text); text = DurationFormats.formatDurationWords(oneHour * 11, false, false); assertEquals("0 days 11 hours 0 minutes 0 seconds", text); text = DurationFormats.formatDurationWords(oneHour + oneMinute + oneSecond, false, false); assertEquals("0 days 1 hour 1 minute 1 second", text); text = DurationFormats.formatDurationWords(oneDay, false, false); assertEquals("1 day 0 hours 0 minutes 0 seconds", text); text = DurationFormats.formatDurationWords(oneDay * 2, false, false); assertEquals("2 days 0 hours 0 minutes 0 seconds", text); text = DurationFormats.formatDurationWords(oneDay * 11, false, false); assertEquals("11 days 0 hours 0 minutes 0 seconds", text); text = DurationFormats.formatDurationWords(oneDay + oneHour + oneMinute + oneSecond, false, false); assertEquals("1 day 1 hour 1 minute 1 second", text); } @Test public void testFormatDurationHMS() { long time = 0; assertEquals("00:00:00.000", DurationFormats.formatDurationHMS(time)); time = 1; assertEquals("00:00:00.001", DurationFormats.formatDurationHMS(time)); time = 15; assertEquals("00:00:00.015", DurationFormats.formatDurationHMS(time)); time = 165; assertEquals("00:00:00.165", DurationFormats.formatDurationHMS(time)); time = 1675; assertEquals("00:00:01.675", DurationFormats.formatDurationHMS(time)); time = 13465; assertEquals("00:00:13.465", DurationFormats.formatDurationHMS(time)); time = 72789; assertEquals("00:01:12.789", DurationFormats.formatDurationHMS(time)); time = 12789 + 32 * 60000; assertEquals("00:32:12.789", DurationFormats.formatDurationHMS(time)); time = 12789 + 62 * 60000; assertEquals("01:02:12.789", DurationFormats.formatDurationHMS(time)); } @Test public void testFormatDurationISO() { assertEquals("P0Y0M0DT0H0M0.000S", DurationFormats.formatDurationISO(0L)); assertEquals("P0Y0M0DT0H0M0.001S", DurationFormats.formatDurationISO(1L)); assertEquals("P0Y0M0DT0H0M0.010S", DurationFormats.formatDurationISO(10L)); assertEquals("P0Y0M0DT0H0M0.100S", DurationFormats.formatDurationISO(100L)); assertEquals("P0Y0M0DT0H1M15.321S", DurationFormats.formatDurationISO(75321L)); } @Test public void testFormatDuration() { long duration = 0; assertEquals("0", DurationFormats.formatDuration(duration, "y")); assertEquals("0", DurationFormats.formatDuration(duration, "M")); assertEquals("0", DurationFormats.formatDuration(duration, "d")); assertEquals("0", DurationFormats.formatDuration(duration, "H")); assertEquals("0", DurationFormats.formatDuration(duration, "m")); assertEquals("0", DurationFormats.formatDuration(duration, "s")); assertEquals("0", DurationFormats.formatDuration(duration, "S")); assertEquals("0000", DurationFormats.formatDuration(duration, "SSSS")); assertEquals("0000", DurationFormats.formatDuration(duration, "yyyy")); assertEquals("0000", DurationFormats.formatDuration(duration, "yyMM")); duration = 60 * 1000; assertEquals("0", DurationFormats.formatDuration(duration, "y")); assertEquals("0", DurationFormats.formatDuration(duration, "M")); assertEquals("0", DurationFormats.formatDuration(duration, "d")); assertEquals("0", DurationFormats.formatDuration(duration, "H")); assertEquals("1", DurationFormats.formatDuration(duration, "m")); assertEquals("60", DurationFormats.formatDuration(duration, "s")); assertEquals("60000", DurationFormats.formatDuration(duration, "S")); assertEquals("01:00", DurationFormats.formatDuration(duration, "mm:ss")); final Calendar base = Calendar.getInstance(); base.set(2000, 0, 1, 0, 0, 0); base.set(Calendar.MILLISECOND, 0); final Calendar cal = Calendar.getInstance(); cal.set(2003, 1, 1, 0, 0, 0); cal.set(Calendar.MILLISECOND, 0); duration = cal.getTime().getTime() - base.getTime().getTime(); // duration from 2000-01-01 // to cal // don't use 1970 in test as time zones were less reliable in 1970 than now // remember that duration formatting ignores time zones, working on strict hour lengths final int days = 366 + 365 + 365 + 31; assertEquals("0 0 " + days, DurationFormats.formatDuration(duration, "y M d")); } @Test public void testFormatPeriodISO() { final TimeZone timeZone = TimeZone.getTimeZone("GMT-3"); final Calendar base = Calendar.getInstance(timeZone); base.set(1970, 0, 1, 0, 0, 0); base.set(Calendar.MILLISECOND, 0); final Calendar cal = Calendar.getInstance(timeZone); cal.set(2002, 1, 23, 9, 11, 12); cal.set(Calendar.MILLISECOND, 1); String text; // repeat a test from testDateTimeISO to compare extended and not extended. // test fixture is the same as above, but now with extended format. text = DurationFormats.formatPeriod(base.getTime().getTime(), cal.getTime().getTime(), DurationFormats.ISO_EXTENDED_FORMAT_PATTERN, false, timeZone); assertEquals("P32Y1M22DT9H11M12.001S", text); // test fixture from example in http://www.w3.org/TR/xmlschema-2/#duration cal.set(1971, 1, 3, 10, 30, 0); cal.set(Calendar.MILLISECOND, 0); text = DurationFormats.formatPeriod(base.getTime().getTime(), cal.getTime().getTime(), DurationFormats.ISO_EXTENDED_FORMAT_PATTERN, false, timeZone); assertEquals("P1Y1M2DT10H30M0.000S", text); // want a way to say 'don't print the seconds in format()' or other fields for that matter: // assertEquals("P1Y2M3DT10H30M", text); } @Test public void testFormatPeriod() { final Calendar cal1970 = Calendar.getInstance(); cal1970.set(1970, 0, 1, 0, 0, 0); cal1970.set(Calendar.MILLISECOND, 0); final long time1970 = cal1970.getTime().getTime(); assertEquals("0", DurationFormats.formatPeriod(time1970, time1970, "y")); assertEquals("0", DurationFormats.formatPeriod(time1970, time1970, "M")); assertEquals("0", DurationFormats.formatPeriod(time1970, time1970, "d")); assertEquals("0", DurationFormats.formatPeriod(time1970, time1970, "H")); assertEquals("0", DurationFormats.formatPeriod(time1970, time1970, "m")); assertEquals("0", DurationFormats.formatPeriod(time1970, time1970, "s")); assertEquals("0", DurationFormats.formatPeriod(time1970, time1970, "S")); assertEquals("0000", DurationFormats.formatPeriod(time1970, time1970, "SSSS")); assertEquals("0000", DurationFormats.formatPeriod(time1970, time1970, "yyyy")); assertEquals("0000", DurationFormats.formatPeriod(time1970, time1970, "yyMM")); long time = time1970 + 60 * 1000; assertEquals("0", DurationFormats.formatPeriod(time1970, time, "y")); assertEquals("0", DurationFormats.formatPeriod(time1970, time, "M")); assertEquals("0", DurationFormats.formatPeriod(time1970, time, "d")); assertEquals("0", DurationFormats.formatPeriod(time1970, time, "H")); assertEquals("1", DurationFormats.formatPeriod(time1970, time, "m")); assertEquals("60", DurationFormats.formatPeriod(time1970, time, "s")); assertEquals("60000", DurationFormats.formatPeriod(time1970, time, "S")); assertEquals("01:00", DurationFormats.formatPeriod(time1970, time, "mm:ss")); final Calendar cal = Calendar.getInstance(); cal.set(1973, 6, 1, 0, 0, 0); cal.set(Calendar.MILLISECOND, 0); time = cal.getTime().getTime(); assertEquals("36", DurationFormats.formatPeriod(time1970, time, "yM")); assertEquals("3 years 6 months", DurationFormats.formatPeriod(time1970, time, "y' years 'M' months'")); assertEquals("03/06", DurationFormats.formatPeriod(time1970, time, "yy/MM")); cal.set(1973, 10, 1, 0, 0, 0); cal.set(Calendar.MILLISECOND, 0); time = cal.getTime().getTime(); assertEquals("310", DurationFormats.formatPeriod(time1970, time, "yM")); assertEquals("3 years 10 months", DurationFormats.formatPeriod(time1970, time, "y' years 'M' months'")); assertEquals("03/10", DurationFormats.formatPeriod(time1970, time, "yy/MM")); cal.set(1974, 0, 1, 0, 0, 0); cal.set(Calendar.MILLISECOND, 0); time = cal.getTime().getTime(); assertEquals("40", DurationFormats.formatPeriod(time1970, time, "yM")); assertEquals("4 years 0 months", DurationFormats.formatPeriod(time1970, time, "y' years 'M' months'")); assertEquals("04/00", DurationFormats.formatPeriod(time1970, time, "yy/MM")); assertEquals("48", DurationFormats.formatPeriod(time1970, time, "M")); assertEquals("48", DurationFormats.formatPeriod(time1970, time, "MM")); assertEquals("048", DurationFormats.formatPeriod(time1970, time, "MMM")); } @Test public void testLexx() { // tests each constant assertArrayEquals(new DurationFormats.Token[] { new DurationFormats.Token(DurationFormats.y, 1), new DurationFormats.Token(DurationFormats.M, 1), new DurationFormats.Token(DurationFormats.d, 1), new DurationFormats.Token(DurationFormats.H, 1), new DurationFormats.Token(DurationFormats.m, 1), new DurationFormats.Token(DurationFormats.s, 1), new DurationFormats.Token(DurationFormats.S, 1) }, DurationFormats.lexx("yMdHmsS")); // tests the ISO8601-like assertArrayEquals(new DurationFormats.Token[] { new DurationFormats.Token(DurationFormats.H, 1), new DurationFormats.Token(new StringBuilder(":"), 1), new DurationFormats.Token(DurationFormats.m, 2), new DurationFormats.Token(new StringBuilder(":"), 1), new DurationFormats.Token(DurationFormats.s, 2), new DurationFormats.Token(new StringBuilder("."), 1), new DurationFormats.Token(DurationFormats.S, 3) }, DurationFormats.lexx("H:mm:ss.SSS")); // test the iso extended format assertArrayEquals(new DurationFormats.Token[] { new DurationFormats.Token(new StringBuilder("P"), 1), new DurationFormats.Token(DurationFormats.y, 4), new DurationFormats.Token(new StringBuilder("Y"), 1), new DurationFormats.Token(DurationFormats.M, 1), new DurationFormats.Token(new StringBuilder("M"), 1), new DurationFormats.Token(DurationFormats.d, 1), new DurationFormats.Token(new StringBuilder("DT"), 1), new DurationFormats.Token(DurationFormats.H, 1), new DurationFormats.Token(new StringBuilder("H"), 1), new DurationFormats.Token(DurationFormats.m, 1), new DurationFormats.Token(new StringBuilder("M"), 1), new DurationFormats.Token(DurationFormats.s, 1), new DurationFormats.Token(new StringBuilder("."), 1), new DurationFormats.Token(DurationFormats.S, 1), new DurationFormats.Token(new StringBuilder("S"), 1) }, DurationFormats.lexx(DurationFormats.ISO_EXTENDED_FORMAT_PATTERN)); // test failures in equals final DurationFormats.Token token = new DurationFormats.Token(DurationFormats.y, 4); assertFalse("Token equal to non-Token class. ", token.equals(new Object())); assertFalse("Token equal to Token with wrong value class. ", token.equals(new DurationFormats.Token(new Object()))); assertFalse("Token equal to Token with different count. ", token.equals(new DurationFormats.Token(DurationFormats.y, 1))); final DurationFormats.Token numToken = new DurationFormats.Token(Integer.valueOf(1), 4); assertTrue("Token with Number value not equal to itself. ", numToken.equals(numToken)); } // http://issues.apache.org/bugzilla/show_bug.cgi?id=38401 @Test public void testBugzilla38401() { assertEqualDuration("0000/00/30 16:00:00 000", new int[] { 2006, 0, 26, 18, 47, 34 }, new int[] { 2006, 1, 26, 10, 47, 34 }, "yyyy/MM/dd HH:mm:ss SSS"); } // https://issues.apache.org/jira/browse/LANG-281 @Test public void testJiraLang281() { assertEqualDuration("09", new int[] { 2005, 11, 31, 0, 0, 0 }, new int[] { 2006, 9, 6, 0, 0, 0 }, "MM"); } @Test public void testLANG815() { final Calendar calendar = Calendar.getInstance(); calendar.set(2012, 6, 30, 0, 0, 0); final long startMillis = calendar.getTimeInMillis(); calendar.set(2012, 8, 8); final long endMillis = calendar.getTimeInMillis(); assertEquals("1 9", DurationFormats.formatPeriod(startMillis, endMillis, "M d")); } // Testing the under a day range in DurationFormatUtils.formatPeriod @Test public void testLowDurations() { for (int hr = 0; hr < 24; hr++) { for (int min = 0; min < 60; min++) { for (int sec = 0; sec < 60; sec++) { assertEqualDuration(hr + ":" + min + ":" + sec, new int[] { 2000, 0, 1, 0, 0, 0, 0 }, new int[] { 2000, 0, 1, hr, min, sec }, "H:m:s"); } } } } // Attempting to test edge cases in DurationFormatUtils.formatPeriod @Test public void testEdgeDurations() { assertEqualDuration("01", new int[] { 2006, 0, 15, 0, 0, 0 }, new int[] { 2006, 2, 10, 0, 0, 0 }, "MM"); assertEqualDuration("12", new int[] { 2005, 0, 15, 0, 0, 0 }, new int[] { 2006, 0, 15, 0, 0, 0 }, "MM"); assertEqualDuration("12", new int[] { 2005, 0, 15, 0, 0, 0 }, new int[] { 2006, 0, 16, 0, 0, 0 }, "MM"); assertEqualDuration("11", new int[] { 2005, 0, 15, 0, 0, 0 }, new int[] { 2006, 0, 14, 0, 0, 0 }, "MM"); assertEqualDuration("01 26", new int[] { 2006, 0, 15, 0, 0, 0 }, new int[] { 2006, 2, 10, 0, 0, 0 }, "MM dd"); assertEqualDuration("54", new int[] { 2006, 0, 15, 0, 0, 0 }, new int[] { 2006, 2, 10, 0, 0, 0 }, "dd"); assertEqualDuration("09 12", new int[] { 2006, 1, 20, 0, 0, 0 }, new int[] { 2006, 11, 4, 0, 0, 0 }, "MM dd"); assertEqualDuration("287", new int[] { 2006, 1, 20, 0, 0, 0 }, new int[] { 2006, 11, 4, 0, 0, 0 }, "dd"); assertEqualDuration("11 30", new int[] { 2006, 0, 2, 0, 0, 0 }, new int[] { 2007, 0, 1, 0, 0, 0 }, "MM dd"); assertEqualDuration("364", new int[] { 2006, 0, 2, 0, 0, 0 }, new int[] { 2007, 0, 1, 0, 0, 0 }, "dd"); assertEqualDuration("12 00", new int[] { 2006, 0, 1, 0, 0, 0 }, new int[] { 2007, 0, 1, 0, 0, 0 }, "MM dd"); assertEqualDuration("365", new int[] { 2006, 0, 1, 0, 0, 0 }, new int[] { 2007, 0, 1, 0, 0, 0 }, "dd"); assertEqualDuration("31", new int[] { 2006, 0, 1, 0, 0, 0 }, new int[] { 2006, 1, 1, 0, 0, 0 }, "dd"); assertEqualDuration("92", new int[] { 2005, 9, 1, 0, 0, 0 }, new int[] { 2006, 0, 1, 0, 0, 0 }, "dd"); assertEqualDuration("77", new int[] { 2005, 9, 16, 0, 0, 0 }, new int[] { 2006, 0, 1, 0, 0, 0 }, "dd"); // test month larger in start than end assertEqualDuration("136", new int[] { 2005, 9, 16, 0, 0, 0 }, new int[] { 2006, 2, 1, 0, 0, 0 }, "dd"); // test when start in leap year assertEqualDuration("136", new int[] { 2004, 9, 16, 0, 0, 0 }, new int[] { 2005, 2, 1, 0, 0, 0 }, "dd"); // test when end in leap year assertEqualDuration("137", new int[] { 2003, 9, 16, 0, 0, 0 }, new int[] { 2004, 2, 1, 0, 0, 0 }, "dd"); // test when end in leap year but less than end of feb assertEqualDuration("135", new int[] { 2003, 9, 16, 0, 0, 0 }, new int[] { 2004, 1, 28, 0, 0, 0 }, "dd"); assertEqualDuration("364", new int[] { 2007, 0, 2, 0, 0, 0 }, new int[] { 2008, 0, 1, 0, 0, 0 }, "dd"); assertEqualDuration("729", new int[] { 2006, 0, 2, 0, 0, 0 }, new int[] { 2008, 0, 1, 0, 0, 0 }, "dd"); assertEqualDuration("365", new int[] { 2007, 2, 2, 0, 0, 0 }, new int[] { 2008, 2, 1, 0, 0, 0 }, "dd"); assertEqualDuration("333", new int[] { 2007, 1, 2, 0, 0, 0 }, new int[] { 2008, 0, 1, 0, 0, 0 }, "dd"); assertEqualDuration("28", new int[] { 2008, 1, 2, 0, 0, 0 }, new int[] { 2008, 2, 1, 0, 0, 0 }, "dd"); assertEqualDuration("393", new int[] { 2007, 1, 2, 0, 0, 0 }, new int[] { 2008, 2, 1, 0, 0, 0 }, "dd"); assertEqualDuration("369", new int[] { 2004, 0, 29, 0, 0, 0 }, new int[] { 2005, 1, 1, 0, 0, 0 }, "dd"); assertEqualDuration("338", new int[] { 2004, 1, 29, 0, 0, 0 }, new int[] { 2005, 1, 1, 0, 0, 0 }, "dd"); assertEqualDuration("28", new int[] { 2004, 2, 8, 0, 0, 0 }, new int[] { 2004, 3, 5, 0, 0, 0 }, "dd"); assertEqualDuration("48", new int[] { 1992, 1, 29, 0, 0, 0 }, new int[] { 1996, 1, 29, 0, 0, 0 }, "M"); // this seems odd - and will fail if I throw it in as a brute force // below as it expects the answer to be 12. It's a tricky edge case assertEqualDuration("11", new int[] { 1996, 1, 29, 0, 0, 0 }, new int[] { 1997, 1, 28, 0, 0, 0 }, "M"); // again - this seems odd assertEqualDuration("11 28", new int[] { 1996, 1, 29, 0, 0, 0 }, new int[] { 1997, 1, 28, 0, 0, 0 }, "M d"); } @Test public void testDurationsByBruteForce() { bruteForce(2006, 0, 1, "d", Calendar.DAY_OF_MONTH); bruteForce(2006, 0, 2, "d", Calendar.DAY_OF_MONTH); bruteForce(2007, 1, 2, "d", Calendar.DAY_OF_MONTH); bruteForce(2004, 1, 29, "d", Calendar.DAY_OF_MONTH); bruteForce(1996, 1, 29, "d", Calendar.DAY_OF_MONTH); bruteForce(1969, 1, 28, "M", Calendar.MONTH); // tests for 48 years // bruteForce(1996, 1, 29, "M", Calendar.MONTH); // this will fail } private static final int FOUR_YEARS = 365 * 3 + 366; // Takes a minute to run, so generally turned off // public void testBrutally() { // Calendar c = Calendar.getInstance(); // c.set(2004, 0, 1, 0, 0, 0); // for (int i=0; i < FOUR_YEARS; i++) { // bruteForce(c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DAY_OF_MONTH), "d", // Calendar.DAY_OF_MONTH ); // c.add(Calendar.DAY_OF_MONTH, 1); // } // } private void bruteForce(final int year, final int month, final int day, final String format, final int calendarType) { final String msg = year + "-" + month + "-" + day + " to "; final Calendar c = Calendar.getInstance(); c.set(year, month, day, 0, 0, 0); final int[] array1 = new int[] { year, month, day, 0, 0, 0 }; final int[] array2 = new int[] { year, month, day, 0, 0, 0 }; for (int i = 0; i < FOUR_YEARS; i++) { array2[0] = c.get(Calendar.YEAR); array2[1] = c.get(Calendar.MONTH); array2[2] = c.get(Calendar.DAY_OF_MONTH); final String tmpMsg = msg + array2[0] + "-" + array2[1] + "-" + array2[2] + " at "; assertEqualDuration(tmpMsg + i, Integer.toString(i), array1, array2, format); c.add(calendarType, 1); } } private void assertEqualDuration(final String expected, final int[] start, final int[] end, final String format) { assertEqualDuration(null, expected, start, end, format); } private void assertEqualDuration(final String message, final String expected, final int[] start, final int[] end, final String format) { final Calendar cal1 = Calendar.getInstance(); cal1.set(start[0], start[1], start[2], start[3], start[4], start[5]); cal1.set(Calendar.MILLISECOND, 0); final Calendar cal2 = Calendar.getInstance(); cal2.set(end[0], end[1], end[2], end[3], end[4], end[5]); cal2.set(Calendar.MILLISECOND, 0); final long milli1 = cal1.getTime().getTime(); final long milli2 = cal2.getTime().getTime(); final String result = DurationFormats.formatPeriod(milli1, milli2, format); if (message == null) { assertEquals(expected, result); } else { assertEquals(message, expected, result); } } private void assertArrayEquals(final DurationFormats.Token[] obj1, final DurationFormats.Token[] obj2) { assertEquals("Arrays are unequal length. ", obj1.length, obj2.length); for (int i = 0; i < obj1.length; i++) { assertTrue("Index " + i + " not equal, " + obj1[i] + " vs " + obj2[i], obj1[i].equals(obj2[i])); } } }
true
48ac32ca42cea434f517955e6aea19536e527003
Java
pprathameshmore/ZealMathOlympiad
/app/src/main/java/com/prathameshmore/zealmatholympiad/MainActivity.java
UTF-8
7,065
1.75
2
[ "MIT" ]
permissive
package com.prathameshmore.zealmatholympiad; import android.content.Intent; import android.net.Uri; import android.support.annotation.MainThread; import android.support.annotation.NonNull; import android.support.design.widget.NavigationView; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.MenuItem; import android.widget.ImageView; import android.widget.Toast; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import com.squareup.picasso.Picasso; public class MainActivity extends AppCompatActivity { private FirebaseAuth mAuth; private DrawerLayout mDrawerLayout; private ActionBarDrawerToggle toggle; private NavigationView _navigation_view; private FirebaseDatabase firebaseDatabaseMainImageVIew; private ImageView mainImageView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mAuth = FirebaseAuth.getInstance(); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); toggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.string.open, R.string.close); _navigation_view = (NavigationView) findViewById(R.id.navigation_view); mainImageView = (ImageView) findViewById(R.id.main_image_view); firebaseDatabaseMainImageVIew = FirebaseDatabase.getInstance(); final DatabaseReference databaseReference = firebaseDatabaseMainImageVIew.getReference("main_image"); databaseReference.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { String urlMainImage = dataSnapshot.getValue(String.class); Picasso.with(MainActivity.this).load(urlMainImage).placeholder(R.drawable.loading).into(mainImageView); } @Override public void onCancelled(DatabaseError databaseError) { Picasso.with(MainActivity.this).load(R.drawable.logo_wide).into(mainImageView); } }); mDrawerLayout.addDrawerListener(toggle); toggle.syncState(); getSupportActionBar().setDisplayHomeAsUpEnabled(true); _navigation_view.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(@NonNull MenuItem item) { switch (item.getItemId()) { case R.id.home_menu: mDrawerLayout.closeDrawers(); break; case R.id.tests_menu: Intent startStudyActivity = new Intent(MainActivity.this, StudyMaterial.class); startActivity(startStudyActivity); mDrawerLayout.closeDrawers(); break; case R.id.scholarship_menu: Intent startScholarshipActivity = new Intent(MainActivity.this, Scholarship.class); startActivity(startScholarshipActivity); mDrawerLayout.closeDrawers(); break; case R.id.admission_menu: Intent startAdmissionActivity = new Intent(MainActivity.this, AdmissionInfo.class); startActivity(startAdmissionActivity); mDrawerLayout.closeDrawers(); break; case R.id.updates_menu: Intent startUpdatesActivity = new Intent(MainActivity.this, NewsUpdates.class); startActivity(startUpdatesActivity); mDrawerLayout.closeDrawers(); break; case R.id.zeal_clg_menu: Intent startAboutZCOERActivity = new Intent(MainActivity.this, AboutZCOER.class); startActivity(startAboutZCOERActivity); mDrawerLayout.closeDrawers(); break; case R.id.about_menu: Intent startAboutActivity = new Intent(MainActivity.this, About.class); startActivity(startAboutActivity); mDrawerLayout.closeDrawers(); break; case R.id.log_out_menu: mAuth.signOut(); Intent startSignInActivity = new Intent(MainActivity.this, AuthActivity.class); startActivity(startSignInActivity); Toast.makeText(MainActivity.this, "Log Out Successfully", Toast.LENGTH_SHORT).show(); break; case R.id.share_menu: Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_TEXT, "Download Zeal Math Olympiad Android app : https://play.google.com/store/apps/details?id=com.prathameshmore.zealmatholympiad"); sendIntent.setType("text/plain"); startActivity(sendIntent); mDrawerLayout.closeDrawers(); break; case R.id.feedback_menu: Intent startFeedbackActivity = new Intent(MainActivity.this, Feedback.class); startActivity(startFeedbackActivity); mDrawerLayout.closeDrawers(); break; case R.id.take_test_menu: Intent startTakeTestActivity = new Intent(MainActivity.this, TakeTest.class); startActivity(startTakeTestActivity); mDrawerLayout.closeDrawers(); break; } return false; } }); } @Override public boolean onOptionsItemSelected(MenuItem item) { if (toggle.onOptionsItemSelected(item)) { return true; } return super.onOptionsItemSelected(item); } public void onStart() { super.onStart(); // Check if user is signed in (non-null) and update UI accordingly. FirebaseUser currentUser = mAuth.getCurrentUser(); if (currentUser == null) { Intent authIntent = new Intent(MainActivity.this, AuthActivity.class); startActivity(authIntent); finish(); } } }
true
f8d062f48bbb55b64dee8612350c7d0d168574d4
Java
sturmd1/ysoftdemo-backend
/src/main/java/ysoft/repository/TaskRepository.java
UTF-8
322
1.804688
2
[]
no_license
package ysoft.repository; import org.springframework.data.jpa.repository.JpaRepository; import ysoft.domain.Task; import java.util.Collection; /** * Created by sturm on 30.08.2016. */ public interface TaskRepository extends JpaRepository<Task, Long> { Collection<Task> findByTaskListUserName(String userName); }
true
6fe9de3c001d06cc719c58ac6541827451eba0e4
Java
Suji130/JavaProject09
/09Project/app/src/main/java/com/example/doqtq/a09project/MainActivity.java
UTF-8
2,130
2.21875
2
[]
no_license
package com.example.doqtq.a09project; import android.content.Intent; import android.graphics.drawable.Drawable; import android.support.v4.content.ContextCompat; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.Toast; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ListView listView = (ListView)findViewById(R.id.listView); ListViewAdapter adapter = new ListViewAdapter(); listView.setAdapter(adapter); adapter.addItem(ContextCompat.getDrawable(this,R.drawable.ic_launcher_background), "제목","내용"); // 위에서 생성한 listview에 클릭 이벤트 핸들러 정의. listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView parent, View v, int position, long id) { // get item ListViewItem item = (ListViewItem) parent.getItemAtPosition(position) ; String titleStr = item.getTitle() ; String descStr = item.getDesc() ; Drawable iconDrawable = item.getIcon() ; Log.d("ssssss",titleStr); // TODO : use item data. } }) ; } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()){ case R.id.writing09: Intent intent = new Intent(MainActivity.this, LoginActivity.class); startActivity(intent); } return super.onOptionsItemSelected(item); } }
true
033fabdfc3c60bcd0fd9b7fe74a78f47b70681bf
Java
PengPeng1121/result-util
/src/main/java/com/pp/common/constant/resultCognize/Scale_26.java
UTF-8
1,642
2.4375
2
[]
no_license
package com.pp.common.constant.resultCognize; /** * Created by asus on 2018/1/15. * 15月16天~16月15天 */ public enum Scale_26 { score_1("1","0-31"), score_2("2","32-33"), score_3("3","34-35"), score_4("4","36-37"), score_5("5","38-39"), score_6("6","40-41"), score_7("7","42-43"), score_8("8","44-45"), score_9("9","46-47"), score_10("10","48-49"), score_11("11","50-51"), score_12("12","52-52"), score_13("13","53-54"), score_14("14","55-55"), score_15("15","56-57"), score_16("16","58-58"), score_17("17","59-59"), score_18("18","60-60"), score_19("19","61-91"); private String name; private String index; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getIndex() { return index; } public void setIndex(String index) { this.index = index; } Scale_26(String name, String index){ this.name = name; this.index = index; } //根据索引获取名称 public static String getScaleScore(Integer index) { String name = "-1"; for (Scale_26 o : Scale_26.values()) { String arr[] = o.getIndex().split("-"); if(arr.length!=0) { Integer begin = Integer.parseInt(arr[0]); Integer end = Integer.parseInt(arr[1]); if (begin <= index && index <= end) { name = o.getName(); break; } } } return name; } }
true
e62d93cb68f2027c557fa8928d625537bd8b8d8f
Java
miladibra10/Hospital_Database_Project
/src/model/dataAccess/EmptyRoomsDA.java
UTF-8
1,785
2.75
3
[]
no_license
package model.dataAccess; import com.mysql.jdbc.Connection; import com.mysql.jdbc.PreparedStatement; import com.mysql.jdbc.ResultSet; import model.entity.Room; import java.sql.DriverManager; import java.sql.SQLException; import java.util.ArrayList; public class EmptyRoomsDA { private Connection connection; public EmptyRoomsDA() { try { Class.forName(Configuration.getMysqlDriver()); connection = (Connection) DriverManager.getConnection(Configuration.getConnectionString(), Configuration.getMysqlUser(), Configuration.getMysqlPass()); connection.setAutoCommit(false); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } } public ArrayList<Room> getFreeRooms() { ArrayList<Room> result = new ArrayList<>(); try { PreparedStatement preparedStatement = (PreparedStatement) connection.prepareStatement("SELECT * FROM room where free_cap>0 ORDER BY room_id"); ResultSet resultSet = (ResultSet) preparedStatement.executeQuery(); while (resultSet.next()){ Room temp = new Room(); temp.setCapacity(resultSet.getInt("capacity")); temp.setFree_cap(resultSet.getInt("free_cap")); temp.setRate(resultSet.getInt("rate")); temp.setRoom_id(resultSet.getInt("room_id")); result.add(temp); } }catch (Exception e) { e.printStackTrace(); }finally { try { connection.close(); } catch (SQLException e) { e.printStackTrace(); } } return result; } }
true
c5a31fc5f9c46e204f32c082dbd6f964fe466cd4
Java
mahebei/LeetCode
/1st_round/001-100/065.java
UTF-8
1,399
3.765625
4
[]
no_license
/* 65. Valid Number Hard Validate if a given string can be interpreted as a decimal number. Some examples: "0" => true " 0.1 " => true "abc" => false "1 a" => false "2e10" => true " -90e3 " => true " 1e" => false "e3" => false " 6e-1" => true " 99e2.5 " => false "53.5e93" => true " --6 " => false "-+3" => false "95a54e53" => false Note: It is intended for the problem statement to be ambiguous. You should gather all requirements up front before implementing one. However, here is a list of characters that can be in a valid decimal number: Numbers 0-9 Exponent - "e" Positive/negative sign - "+"/"-" Decimal point - "." Of course, the context of these characters also matters in the input. */ class Solution { public boolean isNumber(String s) { s = s.trim(); boolean num = false; boolean point = false; boolean e = false; boolean eNum = false; for (int i = 0; i < s.length(); i++) { if (s.charAt(i) >= '0' && s.charAt(i) <= '9') { num = true; eNum = true; } else if (s.charAt(i) == '.') { if (point || e) { return false; } point = true; } else if (s.charAt(i) == 'e') { if (!num || e) { return false; } e = true; eNum = false; } else if (s.charAt(i) == '+' || s.charAt(i) == '-') { if (i != 0 && s.charAt(i - 1) != 'e') { return false; } } else { return false; } } return num && eNum; } }
true
be7682f960d05b6d6a630178ff473bbcf37e86f6
Java
vulzee/Android
/Serializer/app/src/main/java/serializerteam/serializer/LoginActivity.java
UTF-8
4,395
2.109375
2
[]
no_license
package serializerteam.serializer; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.View; import android.widget.Toast; import com.facebook.AccessToken; import com.facebook.CallbackManager; import com.facebook.FacebookCallback; import com.facebook.FacebookException; import com.facebook.login.LoginResult; import com.facebook.login.widget.LoginButton; import com.google.android.gms.auth.api.Auth; import com.google.android.gms.auth.api.signin.GoogleSignInAccount; import com.google.android.gms.auth.api.signin.GoogleSignInOptions; import com.google.android.gms.auth.api.signin.GoogleSignInResult; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.api.GoogleApiClient; public class LoginActivity extends AppCompatActivity implements View.OnClickListener, GoogleApiClient.OnConnectionFailedListener{ GoogleApiClient mGoogleApiClient; int RC_SIGN_IN=945; private CallbackManager facebookCallbackManager; private String PREF_NAME = "serializer"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); initializeFacebook(); if(isLoggedIn()) { onLoginSuccessful(); } } @Override public void onClick(View v) { } private void googleSignIn() { Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient); startActivityForResult(signInIntent, RC_SIGN_IN); } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); // Result returned from launching the Intent from GoogleSignInApi.getSignInIntent(...); if (requestCode == RC_SIGN_IN) { GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data); handleSignInResult(result); } facebookCallbackManager.onActivityResult(requestCode, resultCode, data); } private void handleSignInResult(GoogleSignInResult result) { Log.d("GoogleSignIn", "handleSignInResult:" + result.isSuccess()); if (result.isSuccess()) { GoogleSignInAccount acct = result.getSignInAccount(); saveId(result.getSignInAccount().getId()); onLoginSuccessful(); } else { onLoginFailed(); } } @Override public void onConnectionFailed(@NonNull ConnectionResult connectionResult) { Toast.makeText(this, R.string.connection_failed, Toast.LENGTH_LONG).show(); } private void initializeFacebook() { facebookCallbackManager = CallbackManager.Factory.create(); final LoginButton loginButton = (LoginButton) findViewById(R.id.facebook_login_button); loginButton.registerCallback(facebookCallbackManager, new FacebookCallback<LoginResult>() { @Override public void onSuccess(LoginResult loginResult) { Toast.makeText(LoginActivity.this,"Success", Toast.LENGTH_LONG).show(); saveId(loginResult.getAccessToken().getUserId()); onLoginSuccessful(); } @Override public void onCancel() { } @Override public void onError(FacebookException error) { onLoginFailed(); } }); } private void onLoginSuccessful() { startActivity(new Intent(this, MainActivity.class)); this.finish(); } private void onLoginFailed() { Toast.makeText(LoginActivity.this, R.string.login_failed, Toast.LENGTH_LONG).show(); } private boolean isLoggedIn() { AccessToken accessToken = AccessToken.getCurrentAccessToken(); if(accessToken != null){ saveId(accessToken.getUserId()); } return AccessToken.getCurrentAccessToken() != null; } private void saveId(String userId){ SharedPreferences.Editor editor = getSharedPreferences(PREF_NAME, MODE_PRIVATE).edit(); editor.putString("userId",userId); editor.commit(); } }
true
44a812e596547841c712ecb7b2398ffa9e92f65a
Java
payneteasy/jdbc-proc
/jdbc-proc-daofactory/src/main/java/com/googlecode/jdbcproc/daofactory/impl/parameterconverter/ParameterConverterUtils.java
UTF-8
844
2.71875
3
[]
no_license
package com.googlecode.jdbcproc.daofactory.impl.parameterconverter; class ParameterConverterUtils { static String filter3BytesUTF(String value) { if (value == null) { return null; } if (!has4ByteChars(value)) { return value; } StringBuilder builder = new StringBuilder(value.length()); for (int i = 0; i < value.length(); i++) { char c = value.charAt(i); if (!Character.isSurrogate(c)) { builder.append(c); } } return builder.toString(); } private static boolean has4ByteChars(String value) { for (int i = 0; i < value.length(); i++) { if (Character.isSurrogate(value.charAt(i))) { return true; } } return false; } }
true
d03b58a6301973a7c7cf9fbbcf1937120f37bd30
Java
BiYiTuan/codegenius
/src/main/java/org/fishlab/util/lang/ClassUtils.java
UTF-8
2,273
2.96875
3
[]
no_license
package org.fishlab.util.lang; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; /**@author Black Lotus * */ public class ClassUtils { private static final String SETMETHOD_PREFIX="set"; /**获取一个类以及超类实现的所有接口 * */ public static List<Class<?>> getInterfacesIncludeSuperClass(final Class<?> clazz) { List<Class<?>> types=new ArrayList<Class<?>>(); for (Class<?> superClass = clazz; superClass != Object.class; superClass = superClass.getSuperclass()) { for(Class<?> intf: superClass.getInterfaces()){ if (!types.contains(intf)){ types.add(intf); } } } return types; } /**获取一个类以及超类实现的所有属性 * */ public static List<Field> getAllFieldsIncludeSuperClass(final Class<?> clazz) { List<Field> lf=new ArrayList<Field>(); for (Class<?> superClass = clazz; superClass != Object.class; superClass = superClass.getSuperclass()) { Field[] f=superClass.getDeclaredFields(); for (int j=0;j<f.length;j++){ lf.add(f[j]); } } return lf; } /**获取一个类以及超类实现的所有方法 * */ public static List<Method> getAllMethodsIncludeSuperClass(final Class<?> clazz) { List<Method> lf=new ArrayList<Method>(); for (Class<?> superClass = clazz; superClass!=null&&superClass != Object.class; superClass = superClass.getSuperclass()) { Method[] f=superClass.getDeclaredMethods(); for (int j=0;j<f.length;j++){ lf.add(f[j]); } } return lf; } /**获取一个类以及超类的set方法*/ public static List<Method> getAllSettersIncludeSuperClass(final Class<?> clazz) { List<Method> ls=new ArrayList<Method>(); for (Class<?> superClass = clazz; superClass!=null&&superClass != Object.class; superClass = superClass.getSuperclass()) { Method[] methods=superClass.getDeclaredMethods(); for (int i=0;i<methods.length;i++){ Method m=methods[i]; if(m.getName().startsWith(SETMETHOD_PREFIX)){ Class <?>[] paramTypes=m.getParameterTypes(); if(paramTypes.length==1){ ls.add(m); } } } } return ls; } }
true
8e3578890fe8fd2aa06bfbb0425d0ff8ba20b3f2
Java
johndunaske/FRC-Stronghold-2016
/src/org/usfirst/frc/team1559/robot/Gatherer.java
UTF-8
4,702
2.9375
3
[]
no_license
package org.usfirst.frc.team1559.robot; import edu.wpi.first.wpilibj.Counter; import edu.wpi.first.wpilibj.DigitalInput; import edu.wpi.first.wpilibj.Joystick; import edu.wpi.first.wpilibj.PowerDistributionPanel; import edu.wpi.first.wpilibj.Spark; import edu.wpi.first.wpilibj.Talon; public class Gatherer { private Talon gatherLift; private Talon gatherRotate; private DigitalInput diGathererTop; private DigitalInput diGathererBot; private Counter counter; private int gatherState = 0; /** * Initializes the two motor controls necessary for gatherer usage. * * @param liftId The id for the {@link Talon} * @param rotateId The id for the {@link Spark} */ public void initGatherers(int liftId, int rotateId) { gatherLift = new Talon(liftId); gatherRotate = new Talon(rotateId); } /** * Reads input from the joystick in order to control the lifting part of the gatherer, which operates on a three-tier elevator-like system. Three different buttons are read from the joystick in order to move the {@link Talon} to one of * the three tiers. Update periodically. * * @param input The joystick that will be used to control the gatherer. */ public void gathererTalon(Joystick input) { if (gatherLift == null) { System.err.println("The gatherer motor controllers have not been initialized. Call this class's method \"initGatherers()\" in order to do so."); return; } switch (gatherState) { case 0: // checking for input if (input.getRawButton(Wiring.BTN_GATHERER_TO_TOP) && diGathererTop.get()) { gatherLift.set(0.6); System.out.println("Gatherer up"); gatherCount = 0; gatherState = 1; } else if (input.getRawButton(Wiring.BTN_GATHERER_TO_BOT) && diGathererBot.get()) { gatherLift.set(-0.6); System.out.println("Gatherer down"); gatherCount = 0; gatherState = 3; } else if (input.getRawButton(Wiring.BTN_GATHERER_TO_MID)) { if (!diGathererTop.get()) { gatherLift.set(-0.6); System.out.println("Gatherer down"); gatherCount = 0; gatherState = 5; } else if (!diGathererBot.get()) { gatherLift.set(0.6); System.out.println("Gatherer up"); gatherCount = 0; gatherState = 6; } } break; case 1: // should be going up, wait until it hits the top if (!diGathererTop.get()) { gatherLift.set(0.0); System.out.println("Top limit"); gatherState = 2; } break; case 2: // at top, waiting for driver to stop holding the button if (!input.getRawButton(Wiring.BTN_GATHERER_TO_TOP)) { gatherState = 0; } break; case 3: // should be going down, wait until it hist the bottom if (!diGathererBot.get()) { gatherLift.set(0.0); System.out.println("Bottom limit"); gatherState = 4; } break; case 4: // at bottom, waiting for driver to stop holding the button if (!input.getRawButton(Wiring.BTN_GATHERER_TO_BOT)) { gatherState = 0; } break; case 5: // go down to mid gatherLift.set(-0.6); if (counter.get() >= 1) { gatherLift.set(0.0); // stahp counter.reset(); gatherState = 0; } break; case 6: // go up to mid gatherLift.set(0.6); if (counter.get() >= 1) { gatherLift.set(0.0); // stahp counter.reset(); gatherState = 0; } break; } } int gatherCount = 0; public void gathererSpark(Joystick input, PowerDistributionPanel pdp) { switch (gatherState) { case 0: if (input.getRawButton(7)) { gatherLift.set(0.6); System.out.println("Gatherer up"); gatherState = 1; } else if (input.getRawButton(8)) { gatherLift.set(-0.6); System.out.println("Gatherer down"); gatherState = 4; } else if (input.getRawButton(5)) { } break; case 1: if (pdp.getCurrent(13) > 1.25) { System.out.println("Motor Running"); gatherState = 2; } else if (gatherCount > 3) { gatherState = 3; System.out.println("Gather Timeout"); } gatherCount++; break; case 2: if (pdp.getCurrent(13) <= 1.25) { gatherLift.set(0.0); System.out.println("Top limit"); gatherState = 3; } break; case 3: if (!input.getRawButton(7)) { gatherCount = 0; gatherState = 0; } break; case 4: if (pdp.getCurrent(13) > 1.25) { System.out.println("Motor Running"); gatherState = 5; } else if (gatherCount > 3) { gatherState = 6; System.out.println("Gather Timeout"); } gatherCount++; break; case 5: if (pdp.getCurrent(13) <= 1.25) { gatherLift.set(0.0); System.out.println("Bottom limit"); gatherState = 6; } break; case 6: if (!input.getRawButton(8)) { gatherCount = 0; gatherState = 0; } break; } } }
true
521ecb0f35c651b2c9bb23bc84c3087b92343136
Java
keki/dd-trace-java
/dd-smoke-tests/profiling-integration-tests/src/main/java/datadog/smoketest/profiling/ProfilingTestApplication.java
UTF-8
1,555
2.796875
3
[ "Apache-2.0", "LGPL-2.1-only", "EPL-1.0", "MIT" ]
permissive
package datadog.smoketest.profiling; import datadog.trace.api.Trace; import java.lang.management.ManagementFactory; import java.lang.management.ThreadMXBean; import java.util.Random; import java.util.concurrent.TimeUnit; public class ProfilingTestApplication { private static final ThreadMXBean THREAD_MX_BEAN = ManagementFactory.getThreadMXBean(); public static void main(final String[] args) throws InterruptedException { long exitDelay = -1; if (args.length > 0) { exitDelay = TimeUnit.SECONDS.toMillis(Long.parseLong(args[0])); } final long startTime = System.currentTimeMillis(); while (true) { tracedMethod(); if (exitDelay > 0 && exitDelay + startTime < System.currentTimeMillis()) { break; } } System.out.println("Exiting (" + exitDelay + ")"); } @Trace private static void tracedMethod() throws InterruptedException { System.out.println("Tracing"); tracedBusyMethod(); try { throw new IllegalStateException("test"); } catch (final IllegalStateException ignored) { } Thread.sleep(50); } @Trace private static void tracedBusyMethod() { long startTime = THREAD_MX_BEAN.getCurrentThreadCpuTime(); Random random = new Random(); long accumulator = 0L; while (true) { accumulator += random.nextInt(113); if (THREAD_MX_BEAN.getCurrentThreadCpuTime() - startTime > 10_000_000L) { // looking for at least 10ms CPU time break; } } System.out.println("accumulated: " + accumulator); } }
true
8c3567bc51173d0e808dc6bf8f13942aa99c5c6a
Java
izardj/TPComplexe
/src/service/IReelService.java
WINDOWS-1252
471
2.953125
3
[]
no_license
package service; import metier.Reel; public interface IReelService { /** * Additionne deux nombres reels * @param x Premier nombre additionner * @param y Second nombre additionner * @return Le resultat de l'addition */ public Reel addition(Reel x, Reel y); /** * Soustrait deux nombres reels * @param x Nombre reel * @param y Nombre reel a soustraire * @return Le resultat de la soustraction */ public Reel soustraction(Reel x, Reel y); }
true
9c02103306fc6b02f26629e87d91803f46a38d86
Java
davidJavac/halcones_diarios
/src/controlador/ControladorSueldos.java
UTF-8
477
1.882813
2
[]
no_license
package controlador; import modelo.LogicaSueldos; import modelo_vo.Motivo_caja_internaVO; import vista.VistaAltaGastosInternos; import vista.VistaBuscarGastosInternos; import vista.VistaEditarGastosInternos; public class ControladorSueldos { private LogicaSueldos _logica_sueldos; public void setLogicaSueldos(LogicaSueldos _logica_sueldos){ this._logica_sueldos = _logica_sueldos; } public LogicaSueldos getLogicaSueldos(){ return _logica_sueldos; } }
true
2526264098050c23520ab407dec834e427ff42ec
Java
CMillerDevGuy/Superhero
/src/main/java/Superhero/Superhero/services/PowerService.java
UTF-8
240
2.15625
2
[]
no_license
package Superhero.Superhero.services; import java.util.List; import Superhero.Superhero.entities.Power; public interface PowerService { List<Power> getAllPowers(); void addPower(Power power); void updatePowerById(Power power); }
true
ff5fd796fda42da5b54bf93c68bea91af19f45c3
Java
xuxiaowei007/wt-console
/src/main/java/com/wt/hea/webbuilder/struts/form/BaseInfoForm.java
UTF-8
1,105
2.046875
2
[]
no_license
package com.wt.hea.webbuilder.struts.form; import org.apache.struts.action.ActionForm; import org.apache.struts.upload.FormFile; import com.wt.hea.webbuilder.model.BaseInfo; import com.wt.hea.webbuilder.model.PopWindow; /** * * <pre> * 业务名: * 功能说明: 首页资源信息form * 编写日期: 2011-3-24 * 作者: xiaoqi * * 历史记录 * 1、修改日期: * 修改人: * 修改内容: * </pre> */ @SuppressWarnings("serial") public class BaseInfoForm extends ActionForm { /** * 页面资源信息bean */ private BaseInfo baseInfo = new BaseInfo(); /** * */ private PopWindow popWindow = new PopWindow(); /** * 上传文件 */ private FormFile file; public FormFile getFile() { return file; } public void setFile(FormFile file) { this.file = file; } public BaseInfo getBaseInfo() { return baseInfo; } public void setBaseInfo(BaseInfo baseInfo) { this.baseInfo = baseInfo; } public PopWindow getPopWindow() { return popWindow; } public void setPopWindow(PopWindow popWindow) { this.popWindow = popWindow; } }
true
b484a80ee7e8e5ad7a2085b39dfdec96d67a4b7b
Java
sudha559/Obesity
/OverWeight-new/src/overweight/servlet/AssignPatient.java
UTF-8
2,789
2.234375
2
[]
no_license
//package overweight.servlet; // //import java.io.IOException; //import java.util.Date; // //import javax.servlet.RequestDispatcher; //import javax.servlet.ServletException; //import javax.servlet.http.HttpServlet; //import javax.servlet.http.HttpServletRequest; //import javax.servlet.http.HttpServletResponse; // //import overweight.dao.PatientDao; //import overweight.util.ObesityPages; // // // // //public class AssignPatient extends HttpServlet { // // public AssignPatient() { // } // public void doPost(HttpServletRequest request, HttpServletResponse response) // throws ServletException, IOException { // // // System.out.println("doPost is callling"); // //response // // // String patientId=(String) request.getParameter("patientId"); // String sex=(String) request.getParameter("sex"); // String pname=(String) request.getParameter("name"); // String uname=(String) request.getSession().getAttribute("uName"); // System.out.println("patientId:"+patientId+",pname:"+pname+",admin name:"+pname+",sex:"+sex); // String forword=ObesityPages.LIST_PATIENT; // if(!patientId.startsWith("P")){ // request.setAttribute("msg", "Please enter PatientId,Must be start's with 'P'"); // forword=ObesityPages.assign_Patient; // }else if(PatientDao.isPatientexist(patientId)){ // request.setAttribute("msg", patientId+": This PatientID alrady exist, Please try another patientId"); // forword=ObesityPages.assign_Patient; // }else{ // PatientDao.createPatient(patientId,pname,uname,sex,new Date()); // request.setAttribute("msg", "Created Successfully"); // request.setAttribute("patients", PatientDao.findByDoctorPatients(uname)); // } // //getServletContext().getRequestDispatcher().forward(request,response); // // RequestDispatcher view = request.getRequestDispatcher(forword); // view.forward(request,response); // } // // // @Override // public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { // // String action=req.getParameter("action"); // // //GenerateRandomString gRandom=new GenerateRandomString(); // System.out.println("assignpatient action onget:"+action); // if(action==null){ // System.out.println("No Action Found"); // return; // } // if(action.equals("new")){ // //req.setAttribute("patientId", "P01"+gRandom.getNumeric(6)); // getServletContext().getRequestDispatcher(ObesityPages.assign_Patient).forward(req, resp); // }else if(action.equals("Level1")){ // String patientid=req.getParameter("PID"); // req.setAttribute("msg", ""); // req.setAttribute("PID", patientid); // String forward=ObesityPages.doctorTreatmentForm; // getServletContext().getRequestDispatcher(forward).forward(req, resp); // } // // // } // // // //}
true
ad99de5cbfc10d0ce44f4fa8b291cd4679a1d8a7
Java
ilakkmanoharan/HttpRestClientForMeraki
/RESTClientForMeraki/src/HttpOrgRequests.java
UTF-8
1,056
1.75
2
[]
no_license
import org.apache.http.client.methods.HttpGet; import org.apache.http.entity.StringEntity; /* Copyright (C) 2017 Ilakkuvaselvi Manoharan - All Rights Reserved * */ public interface HttpOrgRequests { public String baseurl = "https://dashboard.meraki.com/api/v0"; public void getListOfOrgs(); public void getOrgById(int i); //update an organization public void updateOrgById(int i, StringEntity data); public void createOrg(); public void getLicenseStateById(int orgId); public void getSnmpById(int i); public void getVpnPeersById(int i); public void getListOfNetworksById(int i); public void getNetworkById(int orgId, String nId); //List all phones in a network and their contact assignment. public void getPhonesByNetworkId(String nid); //List the devices in the network public void getDevicesByNetworkId(String nid); //List the dashboard administrators in this organization public void getAdminByOrgId(int orgId); //Create a new dashboard administrator //public void createAdminByOrgId(int orgId); }
true
1443929155cf5faa4e7ccacd4d351c3901f885ed
Java
smeggins/CSTP1305-AlgorithmsDataStructures
/QueJava/src/PriorityQueArray.java
UTF-8
1,921
3.703125
4
[]
no_license
public class PriorityQueArray { int[] arr = new int[8]; int last_index; PriorityQueArray() { last_index = -1; } void insert(int val) { arr[last_index + 1] = val; last_index++; } int peek() { System.out.println("in peek"); int min = Integer.MAX_VALUE; System.out.println("min val: " + min); for (int i = 0; i < last_index + 1; i++) { if (arr[i] <= min) { System.out.println(arr[i] + " <= " + min); min = arr[i]; System.out.println("new min: " + min); } } return min; } void remove() { int min = arr[0]; int min_index = 0; for (int i = 1; i < last_index + 1; i++) { if (arr[i] < min) { min = arr[i]; min_index = i; } } swap(min_index, last_index, arr); last_index--; } void swap(int swap_index, int last_index, int[] theArr) { int tmp = theArr[swap_index]; theArr[swap_index] = theArr[last_index]; theArr[last_index] = tmp; } public static void main(String[] args) throws Exception { System.out.println("PriorityQueCircularArray: "); PriorityQueArray que = new PriorityQueArray(); que.insert(5); que.insert(6); que.insert(2); que.insert(4); que.insert(1); que.insert(3); System.out.println("peek: " + que.peek()); que.remove(); System.out.println("peek: " + que.peek()); que.remove(); System.out.println("peek: " + que.peek()); que.remove(); System.out.println("peek: " + que.peek()); que.remove(); System.out.println("peek: " + que.peek()); que.remove(); System.out.println("peek: " + que.peek()); que.remove(); } }
true
76ce5105d5b28241eedf02a111cdf182eb638316
Java
congcongye/bpmn
/store-map/src/main/java/dataService/xmlObj/Par.java
UTF-8
1,001
2.6875
3
[]
no_license
package dataService.xmlObj; import java.util.ArrayList; import java.util.List; import org.w3c.dom.Element; import org.w3c.dom.NodeList; public class Par { Integer lineSpace; Integer lineNumber; List<Line> lines; public Par(Element epar) { NodeList lineList = epar.getElementsByTagName("line"); lineNumber = lineList.getLength(); lineSpace = Integer.valueOf(epar.getAttribute("lineSpacing")); lines = new ArrayList<Line>(); for (int i = 0; i < lineList.getLength(); i++) { Element eline = (Element) lineList.item(i); Line line = new Line(eline); lines.add(line); } } public Integer getLineSpace() { return lineSpace; } public void setLineSpace(Integer lineSpace) { this.lineSpace = lineSpace; } public Integer getLineNumber() { return lineNumber; } public void setLineNumber(Integer lineNumber) { this.lineNumber = lineNumber; } public List<Line> getLines() { return lines; } public void setLines(List<Line> lines) { this.lines = lines; } }
true
b8deb76d6b264fb33d66edd7ef7c894a6be1bd36
Java
panlu2222/myGit
/day2/Solution2.java
GB18030
584
3.3125
3
[]
no_license
package day2; /** * public class ListNode { * int val; * ListNode next = null; return arr; } }* ListNode(int val) { * this.val = val; * } * } */ //һβͷ˳򷵻һArrayList import java.util.ArrayList; public class solution { public ArrayList<Integer> printListFromTailToHead(ListNode listNode) { ArrayList<Integer> arr=new ArrayList<Integer> (); while(listNode!=null){ arr.add(0, listNode.val); listNode=listNode.next; } } }
true
381f699adfcb716e22279704531429311c617ed9
Java
akshayshenoy38/DentalCare
/app/src/main/java/com/example/akshay/dentalcare3/DocBlogAdapter.java
UTF-8
2,131
2.46875
2
[]
no_license
package com.example.akshay.dentalcare3; import android.support.annotation.NonNull; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import java.util.ArrayList; public class DocBlogAdapter extends RecyclerView.Adapter<DocBlogAdapter.DocBlogViewHolder> { private ArrayList<DocBlogItem> mDocBlogItemArrayList = new ArrayList<>(); public static class DocBlogViewHolder extends RecyclerView.ViewHolder{ public ImageView ivDocBlog; public TextView tvDocBlogTitle,tvDocBlogDate,tvDocBlogContent; public DocBlogViewHolder(View itemView) { super(itemView); ivDocBlog = (ImageView) itemView.findViewById(R.id.ivDocBlog); tvDocBlogTitle = (TextView) itemView.findViewById(R.id.tvDocBlogTitle); tvDocBlogDate = (TextView) itemView.findViewById(R.id.tvDocBlogDate); tvDocBlogContent = (TextView) itemView.findViewById(R.id.tvDocBlogContent); } } public DocBlogAdapter(ArrayList<DocBlogItem> docBlogItemArrayList){ mDocBlogItemArrayList = docBlogItemArrayList; } @NonNull @Override public DocBlogViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.doc_blog_item,parent,false); DocBlogViewHolder docBlogViewHolder = new DocBlogViewHolder(view); return docBlogViewHolder; } @Override public void onBindViewHolder(@NonNull DocBlogViewHolder holder, int position) { DocBlogItem currentItem = mDocBlogItemArrayList.get(position); holder.ivDocBlog.setImageResource(currentItem.getImageResource()); holder.tvDocBlogTitle.setText(currentItem.getDocBlogTitle()); holder.tvDocBlogDate.setText(currentItem.getBlogDate()); holder.tvDocBlogContent.setText(currentItem.getContent()); } @Override public int getItemCount() { return mDocBlogItemArrayList.size(); } }
true
3387b683f1c8dcf95944f9a3a3589970559de8e2
Java
dlwls5201/CleanCode
/src/test/sample1/Exercise1.java
UTF-8
149
1.640625
2
[]
no_license
package sample1; public class Exercise1 { public static void main(String[] args) { Temp temp = new Temp(); //temp1,3,4 } }
true
71f6e6ac789639ec6061a40b5fc566da375cdf20
Java
wuxidemo/projmngr
/src/com/hs/pm/bean/ProjectFee.java
GB18030
1,601
2.09375
2
[]
no_license
package com.hs.pm.bean; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; /** * * ҵ¼ * @author lenvon * */ @Entity @Table(name="tb_projectfee") public class ProjectFee { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private Integer id; @Column(nullable=false) private String projectsn; private String feecontent;//ժҪ private float receiptamount;//Ʊ private float payamount;// private String operator;//¼ private String datetime;// public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getProjectsn() { return projectsn; } public void setProjectsn(String projectsn) { this.projectsn = projectsn; } public String getFeecontent() { return feecontent; } public void setFeecontent(String feecontent) { this.feecontent = feecontent; } public float getReceiptamount() { return receiptamount; } public void setReceiptamount(float receiptamount) { this.receiptamount = receiptamount; } public float getPayamount() { return payamount; } public void setPayamount(float payamount) { this.payamount = payamount; } public String getOperator() { return operator; } public void setOperator(String operator) { this.operator = operator; } public String getDatetime() { return datetime; } public void setDatetime(String datetime) { this.datetime = datetime; } }
true
2e3a45228ab123ddecdc350f9bc702bba7606f22
Java
aegerm/spring-sgl-bookstore
/src/main/java/com/aegerm/springsglbookstore/domain/Categoria.java
UTF-8
1,031
2.3125
2
[]
no_license
package com.aegerm.springsglbookstore.domain; import lombok.Data; import lombok.NoArgsConstructor; import org.hibernate.validator.constraints.Length; import javax.persistence.*; import javax.validation.constraints.NotEmpty; import java.io.Serializable; import java.util.ArrayList; import java.util.List; @Data @Entity @NoArgsConstructor @Table(name = "TblCategoria") public class Categoria implements Serializable { private static final long serialVersionUID = 982795673788112289L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @NotEmpty(message = "O campo nome é requerido") @Length(min = 3, max = 100, message = "O campo nome deve ter entre 3 e 100 caracteres") private String nome; @NotEmpty(message = "O campo descrição é requerido") @Length(min = 3, max = 200, message = "O campo descrição deve ter entre 3 e 200 caracteres") private String descricao; @OneToMany(mappedBy = "categoria") private List<Livro> livros = new ArrayList<>(); }
true
accb303fc821cadc4b0416e04e1c282f9f0edb21
Java
jozn/Bisphone
/app/messaging/broadcast/BroadcastEntityStatusModel.java
UTF-8
592
2.109375
2
[]
no_license
package app.messaging.broadcast; import app.common.entity.ContactEntityLite; import app.common.entity.HistoryEntity.DeliveryStatus; public class BroadcastEntityStatusModel { private ContactEntityLite f3314a; private DeliveryStatus f3315b; public BroadcastEntityStatusModel(ContactEntityLite contactEntityLite, DeliveryStatus deliveryStatus) { this.f3314a = contactEntityLite; this.f3315b = deliveryStatus; } public ContactEntityLite m5987a() { return this.f3314a; } public DeliveryStatus m5988b() { return this.f3315b; } }
true
cf6ba2f4066171b4d29b832ebc975bf53d9b6503
Java
AndreiGS/COVID-19-Finder
/Frontend/app/src/main/java/com/anticoronabrigade/frontend/ActivityClasses/Main/PointDto.java
UTF-8
844
2.75
3
[]
no_license
package com.anticoronabrigade.frontend.ActivityClasses.Main; public class PointDto { private Double latitude, longitude; public PointDto() { } public PointDto(PointDto pointDto){ this.latitude=pointDto.getLatitude(); this.longitude=pointDto.getLongitude(); } public PointDto(Double latitude, Double longitude) { this.latitude = latitude; this.longitude = longitude; } public Double getLatitude() { return latitude; } public void setLatitude(Double latitude) { this.latitude = latitude; } public Double getLongitude() { return longitude; } public void setLongitude(Double longitude) { this.longitude = longitude; } @Override public String toString() { return latitude + ", " + longitude; } }
true
94ccf83ce55d787199741a9b387877e922bce44c
Java
hjlee83/spring-webservice
/src/main/java/com/mango/webservice/dto/post/PostDto.java
UTF-8
587
2.171875
2
[]
no_license
package com.mango.webservice.dto.post; import com.mango.webservice.domain.post.Post; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; public class PostDto { @Getter @Setter @NoArgsConstructor public static class Create { private String title; private String content; private String author; public Post toEntity() { return Post.builder() .title(title) .content(content) .author(author) .build(); } } }
true
7baf73c1d066d56046b9c65d05af13371e29fb96
Java
debop/debop4k
/debop4k-data-orm/src/test/java/debop4k/data/orm/mapping/associations/onetomany/set/models/ProductImage.java
UTF-8
1,592
2.09375
2
[ "Apache-2.0" ]
permissive
/* * Copyright (c) 2016. Sunghyouk Bae <sunghyouk.bae@gmail.com> * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package debop4k.data.orm.mapping.associations.onetomany.set.models; import debop4k.core.AbstractValueObject; import debop4k.core.utils.Hashx; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import org.hibernate.annotations.DynamicInsert; import org.hibernate.annotations.DynamicUpdate; import org.hibernate.annotations.Parent; import javax.persistence.Embeddable; @Embeddable @DynamicInsert @DynamicUpdate @Getter @Setter @NoArgsConstructor public class ProductImage extends AbstractValueObject { public ProductImage(String name) { this.name = name; } // OneToOne 이나 @ManyToOne 에 많이 쓰인다. Primary Key 로 쓰인다는 뜻이다. @Parent private ProductItem item; private String name; private String filename; private Integer sizeX; private Integer sizeY; @Override public int hashCode() { return Hashx.compute(name, filename); } private static final long serialVersionUID = 5610268573587209644L; }
true
ab1e4e902807d868c27890595e3153beb9ecd818
Java
octsaifx2728/ingram
/src/main/java/com/ust/coppel/incentivos/repository/IncDependenciasRepository.java
UTF-8
652
1.8125
2
[]
no_license
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.ust.coppel.incentivos.repository; import java.util.List; import com.model.CalculoIncentivos.IncDependencias; import com.model.CalculoIncentivos.IncPaqueteReglas; /** * * @author U35058 */ public interface IncDependenciasRepository { public List<IncDependencias> find(IncPaqueteReglas paqueteReglas); public List<IncDependencias> find(String nombre); public void add(IncDependencias dependencia); }
true
acb5fb02f4bdad3dd239b6715a0c591e621d29fe
Java
asmuelle/lazywikiparser
/src/main/java/org/herban/wiki/filter/tags/SpecialTagToken.java
UTF-8
377
1.945313
2
[]
no_license
package org.herban.wiki.filter.tags; /** * Created by IntelliJ IDEA. * User: MUAN104 * Date: 04.03.2009 * Time: 10:20:58 * To change this template use File | Settings | File Templates. */ public class SpecialTagToken extends OpenTagToken { public SpecialTagToken(int token, String name, String openTag) { super(token, name, openTag); } }
true
5bd024006e0d53f9b643100510a166f626714519
Java
5l1v3r1/sony-headphones-hack
/base-dex2jar.jar.src--files/com/google/android/gms/maps/model/internal/zzt.java
UTF-8
907
1.523438
2
[]
no_license
package com.google.android.gms.maps.model.internal; import android.os.IBinder; import android.os.IInterface; import android.os.Parcel; import com.google.android.gms.internal.zzew; public abstract class zzt extends zzew implements zzs { public static zzs zzbn(IBinder paramIBinder) { if (paramIBinder == null) return null; IInterface iInterface = paramIBinder.queryLocalInterface("com.google.android.gms.maps.model.internal.IPolygonDelegate"); return (iInterface instanceof zzs) ? (zzs)iInterface : new zzu(paramIBinder); } public boolean onTransact(int paramInt1, Parcel paramParcel1, Parcel paramParcel2, int paramInt2) { throw new NoSuchMethodError(); } } /* Location: /home/egaebel/Programs/sony-headphones-hack/base-dex2jar.jar!/com/google/android/gms/maps/model/internal/zzt.class * Java compiler version: 6 (50.0) * JD-Core Version: 1.1.3 */
true
eb949a3605f5f95f312e59a8e0929b04782504a4
Java
zhangtao123/security
/src/main/java/com/yibo/security/service/impl/UserServiceImpl.java
UTF-8
605
1.945313
2
[]
no_license
package com.yibo.security.service.impl; import com.yibo.security.dao.UserDao; import com.yibo.security.entity.UserEntity; import com.yibo.security.service.UserService; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; @Service("userService") public class UserServiceImpl implements UserService { @Resource private UserDao userDao; @Override @Transactional(readOnly = true) public UserEntity findUserByUsername(String username) { return userDao.findByUsername(username); } }
true
a0a54476c960c9aa878a882ff43f5e13b171fb71
Java
wangqingshan/desin_pattern
/src/main/java/com/example/design/pattern/day09/interfacetype/Test.java
UTF-8
454
2.59375
3
[]
no_license
package com.example.design.pattern.day09.interfacetype; /** * Test * * @Title: Test.java * @Copyright: Copyright (c) 2005 * @Description: * @Company: 互动百科 * @Created on 2019-3-18 10:27 * @Author 90 */ public class Test { public static void main(String[] args) { Sourceable sourceable= new SourceSub1(); Sourceable sourceable2= new SourceSub2(); sourceable.method1(); sourceable2.method2(); } }
true
b573fa703ad9f2eb775f12df2411c4b26c94b745
Java
yufeilong92/2019-9-12
/app/src/main/java/com/tsyc/tianshengyoucai/utils/FragmentUtil.java
UTF-8
1,331
2.5625
3
[]
no_license
package com.tsyc.tianshengyoucai.utils; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; import java.util.List; /** * @Author : YFL is Creating a porject in PC$ * @Email : yufeilong92@163.com * @Time :2019/9/11 16:06 * @Purpose : */ public class FragmentUtil { /** * @param sfm fragment管理器 * @param list fragment集合 * @param layout 显示fragment 布局 * @param id 要显示的集合的fragment 的几个 * @return */ public static FragmentTransaction showSelectFragment(FragmentManager sfm, List<Fragment> list, int layout, int id) { if ((id+1) > list.size()) { throw new IndexOutOfBoundsException("超出集合长度"); } FragmentTransaction transaction = sfm.beginTransaction(); Fragment fragment = list.get(id); if (!fragment.isVisible()) { if (!fragment.isAdded()) { transaction.add(layout, fragment, fragment.getClass().getName()); } else { for (int i = 0; i < list.size(); i++) { sfm.beginTransaction().hide(list.get(i)).commit(); } transaction.show(fragment); } } return transaction; } }
true
0bfc5f076e16630d7815ba6b65a7369a7245c41a
Java
leodejevga/Modellgetriebene-Softwareentwicklung
/3/org.xtext.example.petrinet/src-gen/org/xtext/example/mydsl/petriNetz/util/PetriNetzAdapterFactory.java
UTF-8
7,170
1.960938
2
[]
no_license
/** * generated by Xtext 2.12.0 */ package org.xtext.example.mydsl.petriNetz.util; import org.eclipse.emf.common.notify.Adapter; import org.eclipse.emf.common.notify.Notifier; import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; import org.eclipse.emf.ecore.EObject; import org.xtext.example.mydsl.petriNetz.*; /** * <!-- begin-user-doc --> * The <b>Adapter Factory</b> for the model. * It provides an adapter <code>createXXX</code> method for each class of the model. * <!-- end-user-doc --> * @see org.xtext.example.mydsl.petriNetz.PetriNetzPackage * @generated */ public class PetriNetzAdapterFactory extends AdapterFactoryImpl { /** * The cached model package. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected static PetriNetzPackage modelPackage; /** * Creates an instance of the adapter factory. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public PetriNetzAdapterFactory() { if (modelPackage == null) { modelPackage = PetriNetzPackage.eINSTANCE; } } /** * Returns whether this factory is applicable for the type of the object. * <!-- begin-user-doc --> * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. * <!-- end-user-doc --> * @return whether this factory is applicable for the type of the object. * @generated */ @Override public boolean isFactoryForType(Object object) { if (object == modelPackage) { return true; } if (object instanceof EObject) { return ((EObject)object).eClass().getEPackage() == modelPackage; } return false; } /** * The switch that delegates to the <code>createXXX</code> methods. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected PetriNetzSwitch<Adapter> modelSwitch = new PetriNetzSwitch<Adapter>() { @Override public Adapter casePetrinet(Petrinet object) { return createPetrinetAdapter(); } @Override public Adapter casePlace(Place object) { return createPlaceAdapter(); } @Override public Adapter caseToken(Token object) { return createTokenAdapter(); } @Override public Adapter caseTransition(Transition object) { return createTransitionAdapter(); } @Override public Adapter caseArc(Arc object) { return createArcAdapter(); } @Override public Adapter casePTArc(PTArc object) { return createPTArcAdapter(); } @Override public Adapter caseTPArc(TPArc object) { return createTPArcAdapter(); } @Override public Adapter defaultCase(EObject object) { return createEObjectAdapter(); } }; /** * Creates an adapter for the <code>target</code>. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param target the object to adapt. * @return the adapter for the <code>target</code>. * @generated */ @Override public Adapter createAdapter(Notifier target) { return modelSwitch.doSwitch((EObject)target); } /** * Creates a new adapter for an object of class '{@link org.xtext.example.mydsl.petriNetz.Petrinet <em>Petrinet</em>}'. * <!-- begin-user-doc --> * This default implementation returns null so that we can easily ignore cases; * it's useful to ignore a case when inheritance will catch all the cases anyway. * <!-- end-user-doc --> * @return the new adapter. * @see org.xtext.example.mydsl.petriNetz.Petrinet * @generated */ public Adapter createPetrinetAdapter() { return null; } /** * Creates a new adapter for an object of class '{@link org.xtext.example.mydsl.petriNetz.Place <em>Place</em>}'. * <!-- begin-user-doc --> * This default implementation returns null so that we can easily ignore cases; * it's useful to ignore a case when inheritance will catch all the cases anyway. * <!-- end-user-doc --> * @return the new adapter. * @see org.xtext.example.mydsl.petriNetz.Place * @generated */ public Adapter createPlaceAdapter() { return null; } /** * Creates a new adapter for an object of class '{@link org.xtext.example.mydsl.petriNetz.Token <em>Token</em>}'. * <!-- begin-user-doc --> * This default implementation returns null so that we can easily ignore cases; * it's useful to ignore a case when inheritance will catch all the cases anyway. * <!-- end-user-doc --> * @return the new adapter. * @see org.xtext.example.mydsl.petriNetz.Token * @generated */ public Adapter createTokenAdapter() { return null; } /** * Creates a new adapter for an object of class '{@link org.xtext.example.mydsl.petriNetz.Transition <em>Transition</em>}'. * <!-- begin-user-doc --> * This default implementation returns null so that we can easily ignore cases; * it's useful to ignore a case when inheritance will catch all the cases anyway. * <!-- end-user-doc --> * @return the new adapter. * @see org.xtext.example.mydsl.petriNetz.Transition * @generated */ public Adapter createTransitionAdapter() { return null; } /** * Creates a new adapter for an object of class '{@link org.xtext.example.mydsl.petriNetz.Arc <em>Arc</em>}'. * <!-- begin-user-doc --> * This default implementation returns null so that we can easily ignore cases; * it's useful to ignore a case when inheritance will catch all the cases anyway. * <!-- end-user-doc --> * @return the new adapter. * @see org.xtext.example.mydsl.petriNetz.Arc * @generated */ public Adapter createArcAdapter() { return null; } /** * Creates a new adapter for an object of class '{@link org.xtext.example.mydsl.petriNetz.PTArc <em>PT Arc</em>}'. * <!-- begin-user-doc --> * This default implementation returns null so that we can easily ignore cases; * it's useful to ignore a case when inheritance will catch all the cases anyway. * <!-- end-user-doc --> * @return the new adapter. * @see org.xtext.example.mydsl.petriNetz.PTArc * @generated */ public Adapter createPTArcAdapter() { return null; } /** * Creates a new adapter for an object of class '{@link org.xtext.example.mydsl.petriNetz.TPArc <em>TP Arc</em>}'. * <!-- begin-user-doc --> * This default implementation returns null so that we can easily ignore cases; * it's useful to ignore a case when inheritance will catch all the cases anyway. * <!-- end-user-doc --> * @return the new adapter. * @see org.xtext.example.mydsl.petriNetz.TPArc * @generated */ public Adapter createTPArcAdapter() { return null; } /** * Creates a new adapter for the default case. * <!-- begin-user-doc --> * This default implementation returns null. * <!-- end-user-doc --> * @return the new adapter. * @generated */ public Adapter createEObjectAdapter() { return null; } } //PetriNetzAdapterFactory
true
181db7457b80f3fecdf6c49c2f9092257182fae2
Java
nikhilraskar/DigitalSignature
/DSCRM/src/main/java/com/nextech/dscrm/newDTO/ProductDTO.java
UTF-8
944
2.40625
2
[]
no_license
package com.nextech.dscrm.newDTO; import com.nextech.dscrm.dto.AbstractDTO; public class ProductDTO extends AbstractDTO{ private String productType; private String productValidity; private String name; private float pricePerUnit; public ProductDTO(){ } public ProductDTO(int id){ this.setId(id); } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getProductType() { return productType; } public void setProductType(String productType) { this.productType = productType; } public String getProductValidity() { return productValidity; } public void setProductValidity(String productValidity) { this.productValidity = productValidity; } public float getPricePerUnit() { return pricePerUnit; } public void setPricePerUnit(float pricePerUnit) { this.pricePerUnit = pricePerUnit; } }
true
f36f77522d0560db89529c583b4f5c1125ce9485
Java
MarcNBecker/Planspiel
/Planspiel/src/de/planspiel/ereignis/ZinsEreignis.java
ISO-8859-1
1,488
3.109375
3
[]
no_license
package de.planspiel.ereignis; import de.planspiel.cafe.Kredit; import de.planspiel.konsolengui.EntscheidungTreffenGUI; import de.planspiel.spiel.Zufall; /** * Proof of concept fr ein Eregnis * * @author Marc Becker * */ public class ZinsEreignis implements Ereignis { private int runde; private EntscheidungTreffenGUI gui; public ZinsEreignis(int runde, EntscheidungTreffenGUI gui) { this.runde = runde; this.gui = gui; } /** * Fhrt das Ereignis aus in Runde 1. Bei allen anderen Runden bestimmt der * Zufall, ob das Ereignis ausgefhrt wird oder nicht. Bei Ausfhrung wird * ein neuer Zinssatz fr Kredite festgelegt. */ @Override public void starten() { if (Zufall.treffenEntscheidung(2.0 / 3.0) || holeRunde() == 1) { double zusatz = Zufall.generierenNVZufallszahl() / 100.0; Kredit.setzeAktuellerZinssatz(Kredit.holeAktuellerZinssatz() + zusatz); if (Kredit.holeAktuellerZinssatz() < 0) { Kredit.setzeAktuellerZinssatz(0.001); } gui.hinzufuegenEreignis(this); } } /** * @return Liefert einen String zurck, der ber den aktuellen Zinssatz fr * Kredite Auskunft gibt */ @Override public String toString() { return "Ereignis: Zinssatz liegt jetzt bei " + (Math.round(Kredit.holeAktuellerZinssatz() * 10000.0) / 100.0) + "%"; } /** * * @return Liefert die Runde der Entscheidung zurck */ public int holeRunde() { return runde; } }
true
9fa1823b98ff78f94b4dee3a93a5863a7a6d3afa
Java
jflorus/Tests
/src/pages/BasePage.java
UTF-8
7,123
2.28125
2
[]
no_license
package pages; import org.junit.Assert; import org.openqa.selenium.*; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.ui.ExpectedCondition; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import java.util.List; /** * Created by jovana on 6/14/16. */ public class BasePage { public static WebDriver driver; @FindBy(className = "Error--common") public WebElement commonError; @FindBy(className = "logout") static WebElement logoutLink; @FindBy(className = "AppHeader-segment") public WebElement transactionType; @FindBy(className = "Footer") private static WebElement footer; @FindBy(className = "fa-spin") public static WebElement loadingSpinner; public static String orderType; static By cancelButton = By.xpath("//a[contains(text(), 'Cancel')]"); static By checkoutButton = By.xpath("//button[contains(text(), 'Check Out')]"); static By total = By.xpath("//span[contains(text(),'$')]"); static By nextButton = By.xpath("//button[contains(text(),'Next')]"); static By uniqueError = By.className("Error--unique"); private static void waitForPageLoaded(){ WebDriverWait wait = new WebDriverWait(driver, 30); try{Thread.sleep(500);} catch(InterruptedException interruptionException){} wait.until(new ExpectedCondition<Object>() { public Boolean apply(WebDriver wdriver) { return ((JavascriptExecutor) driver).executeScript( "return document.readyState" ).equals("complete"); } }); } public static void waitForPageLoaded (String url){ waitForPageLoaded(); WebDriverWait wait = new WebDriverWait(driver, 30); wait.until(new ExpectedCondition<Object>() { public Boolean apply(WebDriver wdriver) { return ((JavascriptExecutor) driver).executeScript( "return window.location.href" ).equals(url); } }); } public static void waitForPageLoaded (By by){ WebDriverWait wait = new WebDriverWait(driver, 5); waitForPageLoaded(); wait.until(ExpectedConditions.presenceOfElementLocated(by)); } public static void waitForPageLoaded (ExpectedCondition condition){ WebDriverWait wait = new WebDriverWait(driver, 5); waitForPageLoaded(); wait.until(condition); } public BasePage() { } public BasePage (WebDriver driver){ this.driver = driver; } public String getTitle (){ return driver.getTitle(); } public void waitForPageLoaded (WebElement webElement){ WebDriverWait wait = new WebDriverWait(driver, 5); waitForPageLoaded(); wait.until(ExpectedConditions.visibilityOf(webElement)); } public boolean contains(String tagname, String expectedValue, List<WebElement> searchResultsItems){ boolean isFound = false; for(WebElement searchResultsItem:searchResultsItems){ List <WebElement> fields = searchResultsItem.findElements(By.tagName(tagname)); for (WebElement field:fields){ isFound = isFound || field.getText().equalsIgnoreCase(expectedValue); if (isFound) { return true; } } } return isFound; } public boolean exists (WebElement webElement){ try{ webElement.getSize(); } catch(NoSuchElementException exception){ return false; } return true; } public boolean searchContains(String tagname, String expectedValue, List<WebElement> searchResultsItems){ boolean isFound = false; for(WebElement searchResultsItem:searchResultsItems){ List <WebElement> fields = searchResultsItem.findElements(By.tagName(tagname)); for (WebElement field:fields){ isFound = isFound || (field.getText().compareToIgnoreCase(expectedValue)==0); if (isFound) { selectItemFromList(searchResultsItem,searchResultsItems); return true; } } } return isFound; } private void selectItemFromList(WebElement selectableElement, List<WebElement> selectableList){ selectableElement.click(); //waitForPageLoaded(ExpectedConditions.invisibilityOfAllElements(selectableList)); } public static void checkUniqueError(String expectedError){ try{Thread.sleep(500);} catch(InterruptedException interruptedException){} waitForPageLoaded(ExpectedConditions.visibilityOfElementLocated(uniqueError)); WebElement error = driver.findElement(uniqueError); Assert.assertTrue("Actual: " + error.getText() +"\nExpected: " + expectedError,error.getText().equalsIgnoreCase(expectedError)); } public static void checkUniqueError(String expectedError, String headerText){ //TODO remove explicit sleep and wait on element try{ Thread.sleep(2000); } catch(InterruptedException interrupted){} List <WebElement> errors = getContainer(headerText).findElements(uniqueError); for(WebElement error:errors) { try { Assert.assertTrue("Actual: " + error.getText() +"\nExpected: " + expectedError,error.getText().equalsIgnoreCase(expectedError)); return; } catch (AssertionError assertionError){} } throw new AssertionError ("unique error not found"); } public void editField(String headerText){ String headerXPath = "//header//div[contains(text(),'"+headerText+"')]"; WebElement header = driver.findElement(By.xpath(headerXPath)); header.findElement(By.xpath("..")).findElement(By.tagName("Button")).click(); } public static WebElement getNextButton(String headerText){ for (WebElement element:getContainer(headerText).findElements(nextButton)) { if (0 == element.getText().compareToIgnoreCase("Next")) { return element; } } return null; } public static int getResultCount(String headerText, By by){ WebElement container = getContainer(headerText); return container.findElements(by).size(); } public static void logout (){ logoutLink.click(); } public static WebElement getCancelButton(){ return footer.findElement(cancelButton); } public static WebElement getCheckOutButton(){ return footer.findElement(checkoutButton); } public static WebElement getTotal(){ return footer.findElement(total); } public static WebElement getContainer (String headerText){ String containerXPath = "//header//div[contains(text(),'"+headerText+"')]//..//.."; return driver.findElement(By.xpath(containerXPath)); } }
true
5570a67d79effb6b6d357cdef83e487b400b7f20
Java
ali1112/MyTestSerivice1
/TestNew/src/graph/GraphSolutions.java
UTF-8
1,906
3.28125
3
[]
no_license
package graph; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Stack; /** * Created by msharafat on 1/31/18. */ public class GraphSolutions { public static void main(String [] args){ ArrayList<ArrayList<Integer>> list = new ArrayList<>(); ArrayList<Integer> node0 = new ArrayList<>(); node0.add(1); ArrayList<Integer> node1 = new ArrayList<>(); node1.add(2); node1.add(3); ArrayList<Integer> node2 = new ArrayList<>(); node2.add(3); node2.add(5); ArrayList<Integer> node3 = new ArrayList<>(); node3.add(1); ArrayList<Integer> node4 = new ArrayList<>(); node4.add(5); ArrayList<Integer> node5 = new ArrayList<>(); list.add(node0); list.add(node1); list.add(node2); list.add(node3); list.add(node4); list.add(node5); GraphSolutions g = new GraphSolutions(); List<Integer> list2 = g.topologicalSort(list); } public List<Integer> topologicalSort(ArrayList<ArrayList<Integer>> list){ int [] a = new int[list.size()]; for(int k=0;k<list.size();k++){ a[k] = 0; } Stack<Integer> s = new Stack<>(); List<Integer> sortedList = new ArrayList<>(); s.push(0); while(!s.isEmpty()){ Integer node = s.pop(); a[node] = 1; sortedList.add(node); int i =0; List<Integer> adjNodes = list.get(node); while(!adjNodes.isEmpty() && i < adjNodes.size()){ Integer adjNode = adjNodes.get(i++); if(a[adjNode] == 0){ s.push(adjNode); a[adjNode] = 1; } } } Collections.reverse(sortedList); return sortedList; } }
true
4dbc3e8223451e8f6163088a54be4c6c1f879f00
Java
justlookabove/GetUp-Alarm-App
/app/src/main/java/com/thisoneguy/cmps_121/alarm/Alarm.java
UTF-8
681
2.203125
2
[]
no_license
package com.thisoneguy.cmps_121.alarm; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.util.Log; public class Alarm extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Log.e("Receiver", "swag"); //get the info from intent String intentInfo = intent.getExtras().getString("extra"); //intent to the Ringtone service Intent service_intent = new Intent(context, RingtoneService.class); service_intent.putExtra("extra", intentInfo); //start service context.startService(service_intent); } }
true
9cc85c0203c220253bebf7b3ef683494346961a7
Java
ZarpaoMC/AthenaCore
/src/net/athenamc/spigot/core/permissions/SpigotPermissionAPI.java
UTF-8
4,115
2.46875
2
[]
no_license
package net.athenamc.spigot.core.permissions; import java.sql.ResultSet; import java.sql.SQLException; import java.util.HashMap; import java.util.Map; import java.util.UUID; import net.athenamc.core.Core; import net.athenamc.core.exceptions.RankDoesNotExistException; import net.athenamc.core.permissions.PermissionAPI; import net.athenamc.core.ranks.Rank; public class SpigotPermissionAPI extends PermissionAPI { private HashMap<UUID, HashMap<String, Boolean>> permissions; public SpigotPermissionAPI(Core plugin) { super(plugin); permissions = new HashMap<UUID, HashMap<String, Boolean>>(); reloadPlayerPermissions(); } public void reloadPlayerPermissions() { try { ResultSet rs = plugin.getSqlManager().executeQuery("SELECT * from player_permissions"); while (rs.next()) { HashMap<String, Boolean> map; if (permissions.containsKey(UUID.fromString(rs.getString("uuid")))) map = permissions.get(UUID.fromString(rs.getString("uuid"))); else map = new HashMap<String, Boolean>(); map.put(rs.getString("permission"), rs.getBoolean("value")); permissions.put(UUID.fromString(rs.getString("uuid")), map); } } catch (SQLException e) { e.printStackTrace(); } } public void reloadPlayerPermissions(UUID uuid) { try { ResultSet rs = plugin.getSqlManager() .executeQuery("SELECT * from player_permissions WHERE uuid='" + uuid.toString() + "'"); while (rs.next()) { HashMap<String, Boolean> map; if (permissions.containsKey(uuid)) map = permissions.get(uuid); else map = new HashMap<String, Boolean>(); map.put(rs.getString("permission"), rs.getBoolean("value")); permissions.put(uuid, map); } } catch (SQLException e) { e.printStackTrace(); } } public void reloadRankPermissions() { for (Rank rank : plugin.getRankApi().getRanks()) rank.reloadPerms(); } public boolean isPermissionSet(UUID uuid, String permissionName) { return permissions.containsKey(uuid) && permissions.get(uuid).containsKey(permissionName); } public void setRankPermission(String rankName, String permission, boolean value) throws RankDoesNotExistException { setRankPermission(plugin.getRankApi().getRank(rankName), permission, value); } public void setRankPermission(Rank rank, String permission, boolean value) { rank.setPermission(permission, value); plugin.getSqlManager().execute("REPLACE INTO rank_permissions VALUES ('" + rank.getName() + "', '" + permission + "', " + (value ? "1" : "0") + ")"); } public void setPlayerPermission(UUID uuid, String permission, boolean value) { HashMap<String, Boolean> perms = permissions.get(uuid); if (perms == null) perms = new HashMap<String, Boolean>(); perms.put(permission, value); permissions.put(uuid, perms); plugin.getSqlManager().execute("REPLACE INTO player_permissions VALUES ('" + uuid.toString() + "', '" + permission + "', " + (value ? "1" : "0") + ")"); } public void unsetRankPermission(String rankName, String permission) throws RankDoesNotExistException { unsetRankPermission(plugin.getRankApi().getRank(rankName), permission); } public void unsetRankPermission(Rank rank, String permission) { rank.unsetPermission(permission); plugin.getSqlManager().execute("DELETE FROM rank_permissions WHERE rank ='" + rank.getName() + "' AND permission='" + permission + "'"); } public void unsetPlayerPermission(UUID uuid, String permission) { HashMap<String, Boolean> perms = permissions.get(uuid); if (perms == null) perms = new HashMap<String, Boolean>(); perms.remove(permission); permissions.put(uuid, perms); plugin.getSqlManager().execute("DELETE FROM player_permissions WHERE uuid='" + uuid.toString() + "' AND permission='" + permission + "'"); } @Override public Map<String, Boolean> getPlayerPermissions(UUID uuid) { HashMap<String, Boolean> perms = permissions.get(uuid); if (perms == null) perms = new HashMap<String, Boolean>(); return perms; } }
true
9e83001a82f0db5e672f32285c0f3668780a8c0d
Java
lzxadsl/sub-frame
/testsrc/com/test/mq/MqMainTest.java
UTF-8
683
2.234375
2
[]
no_license
package com.test.mq; import java.util.ArrayList; import java.util.List; import com.frame.mq.BaseThread; import com.frame.mq.ConsumerThread; import com.frame.mq.ProductThread; /** * * @author LiZhiXian * @version 1.0 * @date 2015-12-14 上午11:14:48 */ public class MqMainTest { public static void main(String[] args) { List<BaseThread> list = new ArrayList<BaseThread>(); BaseThread threada = new ConsumerThread("sub_consumerA.xml"); BaseThread threadb = new ConsumerThread("sub_consumerB.xml"); threada.start(); threadb.start(); list.add(threada); list.add(threadb); Thread server = new ProductThread("product-server",list); server.start(); } }
true
cb4b2ac5eb19f4c76c68050def6c7fd97cb33d88
Java
claztec/spring4codingbook
/src/test/java/net/claztec/document/service/MyDocumentWithResourceInjectionTest.java
UTF-8
1,429
2.046875
2
[]
no_license
package net.claztec.document.service; import net.claztec.document.model.Type; import net.claztec.document.views.Menu; import net.claztec.document.views.ResourceLoaderMenu; import org.junit.Before; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.support.ClassPathXmlApplicationContext; import static org.junit.Assert.*; /** * Created by Derek Choi on 2015. 3. 12.. */ public class MyDocumentWithResourceInjectionTest { private static final Logger log = LoggerFactory.getLogger(MyDocumentWithResourceInjectionTest.class); private ClassPathXmlApplicationContext context; private SearchEngine engine; private Type webType; @Before public void setUp() { context = new ClassPathXmlApplicationContext("META-INF/spring/mydocuments-resource-injection-context.xml"); } @Test public void testMenu() { log.debug("About to read the Resource file: menu.txt"); Menu menu = context.getBean(Menu.class); assertNotNull(menu); menu.printMenu(); } @Test public void testMenuByResourceLoader() { log.debug("About to read the Resource file: menu.txt"); ResourceLoaderMenu menu = context.getBean(ResourceLoaderMenu.class); assertNotNull(menu); menu.printMenu("classpath:META-INF/data/menu.txt"); menu.printMenu("url:http://www.daum.net"); } }
true