blob_id
stringlengths 40
40
| __id__
int64 225
39,780B
| directory_id
stringlengths 40
40
| path
stringlengths 6
313
| content_id
stringlengths 40
40
| detected_licenses
list | license_type
stringclasses 2
values | repo_name
stringlengths 6
132
| repo_url
stringlengths 25
151
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
70
| visit_date
timestamp[ns] | revision_date
timestamp[ns] | committer_date
timestamp[ns] | github_id
int64 7.28k
689M
โ | star_events_count
int64 0
131k
| fork_events_count
int64 0
48k
| gha_license_id
stringclasses 23
values | gha_fork
bool 2
classes | gha_event_created_at
timestamp[ns] | gha_created_at
timestamp[ns] | gha_updated_at
timestamp[ns] | gha_pushed_at
timestamp[ns] | gha_size
int64 0
40.4M
โ | gha_stargazers_count
int32 0
112k
โ | gha_forks_count
int32 0
39.4k
โ | gha_open_issues_count
int32 0
11k
โ | gha_language
stringlengths 1
21
โ | gha_archived
bool 2
classes | gha_disabled
bool 1
class | content
stringlengths 7
4.37M
| src_encoding
stringlengths 3
16
| language
stringclasses 1
value | length_bytes
int64 7
4.37M
| extension
stringclasses 24
values | filename
stringlengths 4
174
| language_id
stringclasses 1
value | entities
list | contaminating_dataset
stringclasses 0
values | malware_signatures
list | redacted_content
stringlengths 7
4.37M
| redacted_length_bytes
int64 7
4.37M
| alphanum_fraction
float32 0.25
0.94
| alpha_fraction
float32 0.25
0.94
| num_lines
int32 1
84k
| avg_line_length
float32 0.76
99.9
| std_line_length
float32 0
220
| max_line_length
int32 5
998
| is_vendor
bool 2
classes | is_generated
bool 1
class | max_hex_length
int32 0
319
| hex_fraction
float32 0
0.38
| max_unicode_length
int32 0
408
| unicode_fraction
float32 0
0.36
| max_base64_length
int32 0
506
| base64_fraction
float32 0
0.5
| avg_csv_sep_count
float32 0
4
| is_autogen_header
bool 1
class | is_empty_html
bool 1
class | shard
stringclasses 16
values |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
bc2f3c6616ea4284e6ce75725195174957dfe5dd | 6,811,818,134,754 | 498dd2daff74247c83a698135e4fe728de93585a | /clients/google-api-services-calendar/v3/1.26.0/com/google/api/services/calendar/Calendar.java | 1920261b91ff5f1624375c3b05c35ae2732abb6d | [
"Apache-2.0"
] | permissive | googleapis/google-api-java-client-services | https://github.com/googleapis/google-api-java-client-services | 0e2d474988d9b692c2404d444c248ea57b1f453d | eb359dd2ad555431c5bc7deaeafca11af08eee43 | refs/heads/main | 2023-08-23T00:17:30.601000 | 2023-08-20T02:16:12 | 2023-08-20T02:16:12 | 147,399,159 | 545 | 390 | Apache-2.0 | false | 2023-09-14T02:14:14 | 2018-09-04T19:11:33 | 2023-09-08T17:44:41 | 2023-09-14T02:14:13 | 198,749 | 518 | 365 | 52 | null | false | false | /*
* 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.
*/
/*
* This code was generated by https://github.com/googleapis/google-api-java-client-services/
* Modify at your own risk.
*/
package com.google.api.services.calendar;
/**
* Service definition for Calendar (v3).
*
* <p>
* Manipulates events and other calendar data.
* </p>
*
* <p>
* For more information about this service, see the
* <a href="https://developers.google.com/google-apps/calendar/firstapp" target="_blank">API Documentation</a>
* </p>
*
* <p>
* This service uses {@link CalendarRequestInitializer} to initialize global parameters via its
* {@link Builder}.
* </p>
*
* @since 1.3
* @author Google, Inc.
*/
@SuppressWarnings("javadoc")
public class Calendar extends com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient {
// Note: Leave this static initializer at the top of the file.
static {
com.google.api.client.util.Preconditions.checkState(
com.google.api.client.googleapis.GoogleUtils.MAJOR_VERSION == 1 &&
com.google.api.client.googleapis.GoogleUtils.MINOR_VERSION >= 15,
"You are currently running with version %s of google-api-client. " +
"You need at least version 1.15 of google-api-client to run version " +
"1.26.0 of the Calendar API library.", com.google.api.client.googleapis.GoogleUtils.VERSION);
}
/**
* The default encoded root URL of the service. This is determined when the library is generated
* and normally should not be changed.
*
* @since 1.7
*/
public static final String DEFAULT_ROOT_URL = "https://www.googleapis.com/";
/**
* The default encoded service path of the service. This is determined when the library is
* generated and normally should not be changed.
*
* @since 1.7
*/
public static final String DEFAULT_SERVICE_PATH = "calendar/v3/";
/**
* The default encoded batch path of the service. This is determined when the library is
* generated and normally should not be changed.
*
* @since 1.23
*/
public static final String DEFAULT_BATCH_PATH = "batch/calendar/v3";
/**
* The default encoded base URL of the service. This is determined when the library is generated
* and normally should not be changed.
*/
public static final String DEFAULT_BASE_URL = DEFAULT_ROOT_URL + DEFAULT_SERVICE_PATH;
/**
* Constructor.
*
* <p>
* Use {@link Builder} if you need to specify any of the optional parameters.
* </p>
*
* @param transport HTTP transport, which should normally be:
* <ul>
* <li>Google App Engine:
* {@code com.google.api.client.extensions.appengine.http.UrlFetchTransport}</li>
* <li>Android: {@code newCompatibleTransport} from
* {@code com.google.api.client.extensions.android.http.AndroidHttp}</li>
* <li>Java: {@link com.google.api.client.googleapis.javanet.GoogleNetHttpTransport#newTrustedTransport()}
* </li>
* </ul>
* @param jsonFactory JSON factory, which may be:
* <ul>
* <li>Jackson: {@code com.google.api.client.json.jackson2.JacksonFactory}</li>
* <li>Google GSON: {@code com.google.api.client.json.gson.GsonFactory}</li>
* <li>Android Honeycomb or higher:
* {@code com.google.api.client.extensions.android.json.AndroidJsonFactory}</li>
* </ul>
* @param httpRequestInitializer HTTP request initializer or {@code null} for none
* @since 1.7
*/
public Calendar(com.google.api.client.http.HttpTransport transport, com.google.api.client.json.JsonFactory jsonFactory,
com.google.api.client.http.HttpRequestInitializer httpRequestInitializer) {
this(new Builder(transport, jsonFactory, httpRequestInitializer));
}
/**
* @param builder builder
*/
Calendar(Builder builder) {
super(builder);
}
@Override
protected void initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest<?> httpClientRequest) throws java.io.IOException {
super.initialize(httpClientRequest);
}
/**
* An accessor for creating requests from the Acl collection.
*
* <p>The typical use is:</p>
* <pre>
* {@code Calendar calendar = new Calendar(...);}
* {@code Calendar.Acl.List request = calendar.acl().list(parameters ...)}
* </pre>
*
* @return the resource collection
*/
public Acl acl() {
return new Acl();
}
/**
* The "acl" collection of methods.
*/
public class Acl {
/**
* Deletes an access control rule.
*
* Create a request for the method "acl.delete".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Delete#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param ruleId ACL rule identifier.
* @return the request
*/
public Delete delete(java.lang.String calendarId, java.lang.String ruleId) throws java.io.IOException {
Delete result = new Delete(calendarId, ruleId);
initialize(result);
return result;
}
public class Delete extends CalendarRequest<Void> {
private static final String REST_PATH = "calendars/{calendarId}/acl/{ruleId}";
/**
* Deletes an access control rule.
*
* Create a request for the method "acl.delete".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Delete#execute()} method to invoke the remote operation.
* <p> {@link
* Delete#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param ruleId ACL rule identifier.
* @since 1.13
*/
protected Delete(java.lang.String calendarId, java.lang.String ruleId) {
super(Calendar.this, "DELETE", REST_PATH, null, Void.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
this.ruleId = com.google.api.client.util.Preconditions.checkNotNull(ruleId, "Required parameter ruleId must be specified.");
}
@Override
public Delete setAlt(java.lang.String alt) {
return (Delete) super.setAlt(alt);
}
@Override
public Delete setFields(java.lang.String fields) {
return (Delete) super.setFields(fields);
}
@Override
public Delete setKey(java.lang.String key) {
return (Delete) super.setKey(key);
}
@Override
public Delete setOauthToken(java.lang.String oauthToken) {
return (Delete) super.setOauthToken(oauthToken);
}
@Override
public Delete setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Delete) super.setPrettyPrint(prettyPrint);
}
@Override
public Delete setQuotaUser(java.lang.String quotaUser) {
return (Delete) super.setQuotaUser(quotaUser);
}
@Override
public Delete setUserIp(java.lang.String userIp) {
return (Delete) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public Delete setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
/** ACL rule identifier. */
@com.google.api.client.util.Key
private java.lang.String ruleId;
/** ACL rule identifier.
*/
public java.lang.String getRuleId() {
return ruleId;
}
/** ACL rule identifier. */
public Delete setRuleId(java.lang.String ruleId) {
this.ruleId = ruleId;
return this;
}
@Override
public Delete set(String parameterName, Object value) {
return (Delete) super.set(parameterName, value);
}
}
/**
* Returns an access control rule.
*
* Create a request for the method "acl.get".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Get#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param ruleId ACL rule identifier.
* @return the request
*/
public Get get(java.lang.String calendarId, java.lang.String ruleId) throws java.io.IOException {
Get result = new Get(calendarId, ruleId);
initialize(result);
return result;
}
public class Get extends CalendarRequest<com.google.api.services.calendar.model.AclRule> {
private static final String REST_PATH = "calendars/{calendarId}/acl/{ruleId}";
/**
* Returns an access control rule.
*
* Create a request for the method "acl.get".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Get#execute()} method to invoke the remote operation. <p>
* {@link Get#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
* must be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param ruleId ACL rule identifier.
* @since 1.13
*/
protected Get(java.lang.String calendarId, java.lang.String ruleId) {
super(Calendar.this, "GET", REST_PATH, null, com.google.api.services.calendar.model.AclRule.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
this.ruleId = com.google.api.client.util.Preconditions.checkNotNull(ruleId, "Required parameter ruleId must be specified.");
}
@Override
public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException {
return super.executeUsingHead();
}
@Override
public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException {
return super.buildHttpRequestUsingHead();
}
@Override
public Get setAlt(java.lang.String alt) {
return (Get) super.setAlt(alt);
}
@Override
public Get setFields(java.lang.String fields) {
return (Get) super.setFields(fields);
}
@Override
public Get setKey(java.lang.String key) {
return (Get) super.setKey(key);
}
@Override
public Get setOauthToken(java.lang.String oauthToken) {
return (Get) super.setOauthToken(oauthToken);
}
@Override
public Get setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Get) super.setPrettyPrint(prettyPrint);
}
@Override
public Get setQuotaUser(java.lang.String quotaUser) {
return (Get) super.setQuotaUser(quotaUser);
}
@Override
public Get setUserIp(java.lang.String userIp) {
return (Get) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public Get setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
/** ACL rule identifier. */
@com.google.api.client.util.Key
private java.lang.String ruleId;
/** ACL rule identifier.
*/
public java.lang.String getRuleId() {
return ruleId;
}
/** ACL rule identifier. */
public Get setRuleId(java.lang.String ruleId) {
this.ruleId = ruleId;
return this;
}
@Override
public Get set(String parameterName, Object value) {
return (Get) super.set(parameterName, value);
}
}
/**
* Creates an access control rule.
*
* Create a request for the method "acl.insert".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Insert#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param content the {@link com.google.api.services.calendar.model.AclRule}
* @return the request
*/
public Insert insert(java.lang.String calendarId, com.google.api.services.calendar.model.AclRule content) throws java.io.IOException {
Insert result = new Insert(calendarId, content);
initialize(result);
return result;
}
public class Insert extends CalendarRequest<com.google.api.services.calendar.model.AclRule> {
private static final String REST_PATH = "calendars/{calendarId}/acl";
/**
* Creates an access control rule.
*
* Create a request for the method "acl.insert".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Insert#execute()} method to invoke the remote operation.
* <p> {@link
* Insert#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param content the {@link com.google.api.services.calendar.model.AclRule}
* @since 1.13
*/
protected Insert(java.lang.String calendarId, com.google.api.services.calendar.model.AclRule content) {
super(Calendar.this, "POST", REST_PATH, content, com.google.api.services.calendar.model.AclRule.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
checkRequiredParameter(content, "content");
checkRequiredParameter(content.getRole(), "AclRule.getRole()");
checkRequiredParameter(content, "content");
checkRequiredParameter(content.getScope(), "AclRule.getScope()");
checkRequiredParameter(content, "content");
checkRequiredParameter(content.getScope().getType(), "AclRule.getScope().getType()");
}
@Override
public Insert setAlt(java.lang.String alt) {
return (Insert) super.setAlt(alt);
}
@Override
public Insert setFields(java.lang.String fields) {
return (Insert) super.setFields(fields);
}
@Override
public Insert setKey(java.lang.String key) {
return (Insert) super.setKey(key);
}
@Override
public Insert setOauthToken(java.lang.String oauthToken) {
return (Insert) super.setOauthToken(oauthToken);
}
@Override
public Insert setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Insert) super.setPrettyPrint(prettyPrint);
}
@Override
public Insert setQuotaUser(java.lang.String quotaUser) {
return (Insert) super.setQuotaUser(quotaUser);
}
@Override
public Insert setUserIp(java.lang.String userIp) {
return (Insert) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public Insert setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
/**
* Whether to send notifications about the calendar sharing change. Optional. The default is
* True.
*/
@com.google.api.client.util.Key
private java.lang.Boolean sendNotifications;
/** Whether to send notifications about the calendar sharing change. Optional. The default is True.
*/
public java.lang.Boolean getSendNotifications() {
return sendNotifications;
}
/**
* Whether to send notifications about the calendar sharing change. Optional. The default is
* True.
*/
public Insert setSendNotifications(java.lang.Boolean sendNotifications) {
this.sendNotifications = sendNotifications;
return this;
}
@Override
public Insert set(String parameterName, Object value) {
return (Insert) super.set(parameterName, value);
}
}
/**
* Returns the rules in the access control list for the calendar.
*
* Create a request for the method "acl.list".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link List#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @return the request
*/
public List list(java.lang.String calendarId) throws java.io.IOException {
List result = new List(calendarId);
initialize(result);
return result;
}
public class List extends CalendarRequest<com.google.api.services.calendar.model.Acl> {
private static final String REST_PATH = "calendars/{calendarId}/acl";
/**
* Returns the rules in the access control list for the calendar.
*
* Create a request for the method "acl.list".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link List#execute()} method to invoke the remote operation. <p>
* {@link List#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
* must be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @since 1.13
*/
protected List(java.lang.String calendarId) {
super(Calendar.this, "GET", REST_PATH, null, com.google.api.services.calendar.model.Acl.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
}
@Override
public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException {
return super.executeUsingHead();
}
@Override
public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException {
return super.buildHttpRequestUsingHead();
}
@Override
public List setAlt(java.lang.String alt) {
return (List) super.setAlt(alt);
}
@Override
public List setFields(java.lang.String fields) {
return (List) super.setFields(fields);
}
@Override
public List setKey(java.lang.String key) {
return (List) super.setKey(key);
}
@Override
public List setOauthToken(java.lang.String oauthToken) {
return (List) super.setOauthToken(oauthToken);
}
@Override
public List setPrettyPrint(java.lang.Boolean prettyPrint) {
return (List) super.setPrettyPrint(prettyPrint);
}
@Override
public List setQuotaUser(java.lang.String quotaUser) {
return (List) super.setQuotaUser(quotaUser);
}
@Override
public List setUserIp(java.lang.String userIp) {
return (List) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public List setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
/**
* Maximum number of entries returned on one result page. By default the value is 100 entries.
* The page size can never be larger than 250 entries. Optional.
*/
@com.google.api.client.util.Key
private java.lang.Integer maxResults;
/** Maximum number of entries returned on one result page. By default the value is 100 entries. The
page size can never be larger than 250 entries. Optional.
[minimum: 1]
*/
public java.lang.Integer getMaxResults() {
return maxResults;
}
/**
* Maximum number of entries returned on one result page. By default the value is 100 entries.
* The page size can never be larger than 250 entries. Optional.
*/
public List setMaxResults(java.lang.Integer maxResults) {
this.maxResults = maxResults;
return this;
}
/** Token specifying which result page to return. Optional. */
@com.google.api.client.util.Key
private java.lang.String pageToken;
/** Token specifying which result page to return. Optional.
*/
public java.lang.String getPageToken() {
return pageToken;
}
/** Token specifying which result page to return. Optional. */
public List setPageToken(java.lang.String pageToken) {
this.pageToken = pageToken;
return this;
}
/**
* Whether to include deleted ACLs in the result. Deleted ACLs are represented by role equal
* to "none". Deleted ACLs will always be included if syncToken is provided. Optional. The
* default is False.
*/
@com.google.api.client.util.Key
private java.lang.Boolean showDeleted;
/** Whether to include deleted ACLs in the result. Deleted ACLs are represented by role equal to
"none". Deleted ACLs will always be included if syncToken is provided. Optional. The default is
False.
*/
public java.lang.Boolean getShowDeleted() {
return showDeleted;
}
/**
* Whether to include deleted ACLs in the result. Deleted ACLs are represented by role equal
* to "none". Deleted ACLs will always be included if syncToken is provided. Optional. The
* default is False.
*/
public List setShowDeleted(java.lang.Boolean showDeleted) {
this.showDeleted = showDeleted;
return this;
}
/**
* Token obtained from the nextSyncToken field returned on the last page of results from the
* previous list request. It makes the result of this list request contain only entries that
* have changed since then. All entries deleted since the previous list request will always be
* in the result set and it is not allowed to set showDeleted to False. If the syncToken
* expires, the server will respond with a 410 GONE response code and the client should clear
* its storage and perform a full synchronization without any syncToken. Learn more about
* incremental synchronization. Optional. The default is to return all entries.
*/
@com.google.api.client.util.Key
private java.lang.String syncToken;
/** Token obtained from the nextSyncToken field returned on the last page of results from the previous
list request. It makes the result of this list request contain only entries that have changed since
then. All entries deleted since the previous list request will always be in the result set and it
is not allowed to set showDeleted to False. If the syncToken expires, the server will respond with
a 410 GONE response code and the client should clear its storage and perform a full synchronization
without any syncToken. Learn more about incremental synchronization. Optional. The default is to
return all entries.
*/
public java.lang.String getSyncToken() {
return syncToken;
}
/**
* Token obtained from the nextSyncToken field returned on the last page of results from the
* previous list request. It makes the result of this list request contain only entries that
* have changed since then. All entries deleted since the previous list request will always be
* in the result set and it is not allowed to set showDeleted to False. If the syncToken
* expires, the server will respond with a 410 GONE response code and the client should clear
* its storage and perform a full synchronization without any syncToken. Learn more about
* incremental synchronization. Optional. The default is to return all entries.
*/
public List setSyncToken(java.lang.String syncToken) {
this.syncToken = syncToken;
return this;
}
@Override
public List set(String parameterName, Object value) {
return (List) super.set(parameterName, value);
}
}
/**
* Updates an access control rule. This method supports patch semantics.
*
* Create a request for the method "acl.patch".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Patch#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param ruleId ACL rule identifier.
* @param content the {@link com.google.api.services.calendar.model.AclRule}
* @return the request
*/
public Patch patch(java.lang.String calendarId, java.lang.String ruleId, com.google.api.services.calendar.model.AclRule content) throws java.io.IOException {
Patch result = new Patch(calendarId, ruleId, content);
initialize(result);
return result;
}
public class Patch extends CalendarRequest<com.google.api.services.calendar.model.AclRule> {
private static final String REST_PATH = "calendars/{calendarId}/acl/{ruleId}";
/**
* Updates an access control rule. This method supports patch semantics.
*
* Create a request for the method "acl.patch".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Patch#execute()} method to invoke the remote operation.
* <p> {@link
* Patch#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param ruleId ACL rule identifier.
* @param content the {@link com.google.api.services.calendar.model.AclRule}
* @since 1.13
*/
protected Patch(java.lang.String calendarId, java.lang.String ruleId, com.google.api.services.calendar.model.AclRule content) {
super(Calendar.this, "PATCH", REST_PATH, content, com.google.api.services.calendar.model.AclRule.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
this.ruleId = com.google.api.client.util.Preconditions.checkNotNull(ruleId, "Required parameter ruleId must be specified.");
}
@Override
public Patch setAlt(java.lang.String alt) {
return (Patch) super.setAlt(alt);
}
@Override
public Patch setFields(java.lang.String fields) {
return (Patch) super.setFields(fields);
}
@Override
public Patch setKey(java.lang.String key) {
return (Patch) super.setKey(key);
}
@Override
public Patch setOauthToken(java.lang.String oauthToken) {
return (Patch) super.setOauthToken(oauthToken);
}
@Override
public Patch setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Patch) super.setPrettyPrint(prettyPrint);
}
@Override
public Patch setQuotaUser(java.lang.String quotaUser) {
return (Patch) super.setQuotaUser(quotaUser);
}
@Override
public Patch setUserIp(java.lang.String userIp) {
return (Patch) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public Patch setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
/** ACL rule identifier. */
@com.google.api.client.util.Key
private java.lang.String ruleId;
/** ACL rule identifier.
*/
public java.lang.String getRuleId() {
return ruleId;
}
/** ACL rule identifier. */
public Patch setRuleId(java.lang.String ruleId) {
this.ruleId = ruleId;
return this;
}
/**
* Whether to send notifications about the calendar sharing change. Note that there are no
* notifications on access removal. Optional. The default is True.
*/
@com.google.api.client.util.Key
private java.lang.Boolean sendNotifications;
/** Whether to send notifications about the calendar sharing change. Note that there are no
notifications on access removal. Optional. The default is True.
*/
public java.lang.Boolean getSendNotifications() {
return sendNotifications;
}
/**
* Whether to send notifications about the calendar sharing change. Note that there are no
* notifications on access removal. Optional. The default is True.
*/
public Patch setSendNotifications(java.lang.Boolean sendNotifications) {
this.sendNotifications = sendNotifications;
return this;
}
@Override
public Patch set(String parameterName, Object value) {
return (Patch) super.set(parameterName, value);
}
}
/**
* Updates an access control rule.
*
* Create a request for the method "acl.update".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Update#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param ruleId ACL rule identifier.
* @param content the {@link com.google.api.services.calendar.model.AclRule}
* @return the request
*/
public Update update(java.lang.String calendarId, java.lang.String ruleId, com.google.api.services.calendar.model.AclRule content) throws java.io.IOException {
Update result = new Update(calendarId, ruleId, content);
initialize(result);
return result;
}
public class Update extends CalendarRequest<com.google.api.services.calendar.model.AclRule> {
private static final String REST_PATH = "calendars/{calendarId}/acl/{ruleId}";
/**
* Updates an access control rule.
*
* Create a request for the method "acl.update".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Update#execute()} method to invoke the remote operation.
* <p> {@link
* Update#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param ruleId ACL rule identifier.
* @param content the {@link com.google.api.services.calendar.model.AclRule}
* @since 1.13
*/
protected Update(java.lang.String calendarId, java.lang.String ruleId, com.google.api.services.calendar.model.AclRule content) {
super(Calendar.this, "PUT", REST_PATH, content, com.google.api.services.calendar.model.AclRule.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
this.ruleId = com.google.api.client.util.Preconditions.checkNotNull(ruleId, "Required parameter ruleId must be specified.");
}
@Override
public Update setAlt(java.lang.String alt) {
return (Update) super.setAlt(alt);
}
@Override
public Update setFields(java.lang.String fields) {
return (Update) super.setFields(fields);
}
@Override
public Update setKey(java.lang.String key) {
return (Update) super.setKey(key);
}
@Override
public Update setOauthToken(java.lang.String oauthToken) {
return (Update) super.setOauthToken(oauthToken);
}
@Override
public Update setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Update) super.setPrettyPrint(prettyPrint);
}
@Override
public Update setQuotaUser(java.lang.String quotaUser) {
return (Update) super.setQuotaUser(quotaUser);
}
@Override
public Update setUserIp(java.lang.String userIp) {
return (Update) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public Update setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
/** ACL rule identifier. */
@com.google.api.client.util.Key
private java.lang.String ruleId;
/** ACL rule identifier.
*/
public java.lang.String getRuleId() {
return ruleId;
}
/** ACL rule identifier. */
public Update setRuleId(java.lang.String ruleId) {
this.ruleId = ruleId;
return this;
}
/**
* Whether to send notifications about the calendar sharing change. Note that there are no
* notifications on access removal. Optional. The default is True.
*/
@com.google.api.client.util.Key
private java.lang.Boolean sendNotifications;
/** Whether to send notifications about the calendar sharing change. Note that there are no
notifications on access removal. Optional. The default is True.
*/
public java.lang.Boolean getSendNotifications() {
return sendNotifications;
}
/**
* Whether to send notifications about the calendar sharing change. Note that there are no
* notifications on access removal. Optional. The default is True.
*/
public Update setSendNotifications(java.lang.Boolean sendNotifications) {
this.sendNotifications = sendNotifications;
return this;
}
@Override
public Update set(String parameterName, Object value) {
return (Update) super.set(parameterName, value);
}
}
/**
* Watch for changes to ACL resources.
*
* Create a request for the method "acl.watch".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Watch#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param content the {@link com.google.api.services.calendar.model.Channel}
* @return the request
*/
public Watch watch(java.lang.String calendarId, com.google.api.services.calendar.model.Channel content) throws java.io.IOException {
Watch result = new Watch(calendarId, content);
initialize(result);
return result;
}
public class Watch extends CalendarRequest<com.google.api.services.calendar.model.Channel> {
private static final String REST_PATH = "calendars/{calendarId}/acl/watch";
/**
* Watch for changes to ACL resources.
*
* Create a request for the method "acl.watch".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Watch#execute()} method to invoke the remote operation.
* <p> {@link
* Watch#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param content the {@link com.google.api.services.calendar.model.Channel}
* @since 1.13
*/
protected Watch(java.lang.String calendarId, com.google.api.services.calendar.model.Channel content) {
super(Calendar.this, "POST", REST_PATH, content, com.google.api.services.calendar.model.Channel.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
}
@Override
public Watch setAlt(java.lang.String alt) {
return (Watch) super.setAlt(alt);
}
@Override
public Watch setFields(java.lang.String fields) {
return (Watch) super.setFields(fields);
}
@Override
public Watch setKey(java.lang.String key) {
return (Watch) super.setKey(key);
}
@Override
public Watch setOauthToken(java.lang.String oauthToken) {
return (Watch) super.setOauthToken(oauthToken);
}
@Override
public Watch setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Watch) super.setPrettyPrint(prettyPrint);
}
@Override
public Watch setQuotaUser(java.lang.String quotaUser) {
return (Watch) super.setQuotaUser(quotaUser);
}
@Override
public Watch setUserIp(java.lang.String userIp) {
return (Watch) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public Watch setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
/**
* Maximum number of entries returned on one result page. By default the value is 100 entries.
* The page size can never be larger than 250 entries. Optional.
*/
@com.google.api.client.util.Key
private java.lang.Integer maxResults;
/** Maximum number of entries returned on one result page. By default the value is 100 entries. The
page size can never be larger than 250 entries. Optional.
[minimum: 1]
*/
public java.lang.Integer getMaxResults() {
return maxResults;
}
/**
* Maximum number of entries returned on one result page. By default the value is 100 entries.
* The page size can never be larger than 250 entries. Optional.
*/
public Watch setMaxResults(java.lang.Integer maxResults) {
this.maxResults = maxResults;
return this;
}
/** Token specifying which result page to return. Optional. */
@com.google.api.client.util.Key
private java.lang.String pageToken;
/** Token specifying which result page to return. Optional.
*/
public java.lang.String getPageToken() {
return pageToken;
}
/** Token specifying which result page to return. Optional. */
public Watch setPageToken(java.lang.String pageToken) {
this.pageToken = pageToken;
return this;
}
/**
* Whether to include deleted ACLs in the result. Deleted ACLs are represented by role equal
* to "none". Deleted ACLs will always be included if syncToken is provided. Optional. The
* default is False.
*/
@com.google.api.client.util.Key
private java.lang.Boolean showDeleted;
/** Whether to include deleted ACLs in the result. Deleted ACLs are represented by role equal to
"none". Deleted ACLs will always be included if syncToken is provided. Optional. The default is
False.
*/
public java.lang.Boolean getShowDeleted() {
return showDeleted;
}
/**
* Whether to include deleted ACLs in the result. Deleted ACLs are represented by role equal
* to "none". Deleted ACLs will always be included if syncToken is provided. Optional. The
* default is False.
*/
public Watch setShowDeleted(java.lang.Boolean showDeleted) {
this.showDeleted = showDeleted;
return this;
}
/**
* Token obtained from the nextSyncToken field returned on the last page of results from the
* previous list request. It makes the result of this list request contain only entries that
* have changed since then. All entries deleted since the previous list request will always be
* in the result set and it is not allowed to set showDeleted to False. If the syncToken
* expires, the server will respond with a 410 GONE response code and the client should clear
* its storage and perform a full synchronization without any syncToken. Learn more about
* incremental synchronization. Optional. The default is to return all entries.
*/
@com.google.api.client.util.Key
private java.lang.String syncToken;
/** Token obtained from the nextSyncToken field returned on the last page of results from the previous
list request. It makes the result of this list request contain only entries that have changed since
then. All entries deleted since the previous list request will always be in the result set and it
is not allowed to set showDeleted to False. If the syncToken expires, the server will respond with
a 410 GONE response code and the client should clear its storage and perform a full synchronization
without any syncToken. Learn more about incremental synchronization. Optional. The default is to
return all entries.
*/
public java.lang.String getSyncToken() {
return syncToken;
}
/**
* Token obtained from the nextSyncToken field returned on the last page of results from the
* previous list request. It makes the result of this list request contain only entries that
* have changed since then. All entries deleted since the previous list request will always be
* in the result set and it is not allowed to set showDeleted to False. If the syncToken
* expires, the server will respond with a 410 GONE response code and the client should clear
* its storage and perform a full synchronization without any syncToken. Learn more about
* incremental synchronization. Optional. The default is to return all entries.
*/
public Watch setSyncToken(java.lang.String syncToken) {
this.syncToken = syncToken;
return this;
}
@Override
public Watch set(String parameterName, Object value) {
return (Watch) super.set(parameterName, value);
}
}
}
/**
* An accessor for creating requests from the CalendarList collection.
*
* <p>The typical use is:</p>
* <pre>
* {@code Calendar calendar = new Calendar(...);}
* {@code Calendar.CalendarList.List request = calendar.calendarList().list(parameters ...)}
* </pre>
*
* @return the resource collection
*/
public CalendarList calendarList() {
return new CalendarList();
}
/**
* The "calendarList" collection of methods.
*/
public class CalendarList {
/**
* Removes a calendar from the user's calendar list.
*
* Create a request for the method "calendarList.delete".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Delete#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @return the request
*/
public Delete delete(java.lang.String calendarId) throws java.io.IOException {
Delete result = new Delete(calendarId);
initialize(result);
return result;
}
public class Delete extends CalendarRequest<Void> {
private static final String REST_PATH = "users/me/calendarList/{calendarId}";
/**
* Removes a calendar from the user's calendar list.
*
* Create a request for the method "calendarList.delete".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Delete#execute()} method to invoke the remote operation.
* <p> {@link
* Delete#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @since 1.13
*/
protected Delete(java.lang.String calendarId) {
super(Calendar.this, "DELETE", REST_PATH, null, Void.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
}
@Override
public Delete setAlt(java.lang.String alt) {
return (Delete) super.setAlt(alt);
}
@Override
public Delete setFields(java.lang.String fields) {
return (Delete) super.setFields(fields);
}
@Override
public Delete setKey(java.lang.String key) {
return (Delete) super.setKey(key);
}
@Override
public Delete setOauthToken(java.lang.String oauthToken) {
return (Delete) super.setOauthToken(oauthToken);
}
@Override
public Delete setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Delete) super.setPrettyPrint(prettyPrint);
}
@Override
public Delete setQuotaUser(java.lang.String quotaUser) {
return (Delete) super.setQuotaUser(quotaUser);
}
@Override
public Delete setUserIp(java.lang.String userIp) {
return (Delete) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public Delete setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
@Override
public Delete set(String parameterName, Object value) {
return (Delete) super.set(parameterName, value);
}
}
/**
* Returns a calendar from the user's calendar list.
*
* Create a request for the method "calendarList.get".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Get#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @return the request
*/
public Get get(java.lang.String calendarId) throws java.io.IOException {
Get result = new Get(calendarId);
initialize(result);
return result;
}
public class Get extends CalendarRequest<com.google.api.services.calendar.model.CalendarListEntry> {
private static final String REST_PATH = "users/me/calendarList/{calendarId}";
/**
* Returns a calendar from the user's calendar list.
*
* Create a request for the method "calendarList.get".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Get#execute()} method to invoke the remote operation. <p>
* {@link Get#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
* must be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @since 1.13
*/
protected Get(java.lang.String calendarId) {
super(Calendar.this, "GET", REST_PATH, null, com.google.api.services.calendar.model.CalendarListEntry.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
}
@Override
public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException {
return super.executeUsingHead();
}
@Override
public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException {
return super.buildHttpRequestUsingHead();
}
@Override
public Get setAlt(java.lang.String alt) {
return (Get) super.setAlt(alt);
}
@Override
public Get setFields(java.lang.String fields) {
return (Get) super.setFields(fields);
}
@Override
public Get setKey(java.lang.String key) {
return (Get) super.setKey(key);
}
@Override
public Get setOauthToken(java.lang.String oauthToken) {
return (Get) super.setOauthToken(oauthToken);
}
@Override
public Get setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Get) super.setPrettyPrint(prettyPrint);
}
@Override
public Get setQuotaUser(java.lang.String quotaUser) {
return (Get) super.setQuotaUser(quotaUser);
}
@Override
public Get setUserIp(java.lang.String userIp) {
return (Get) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public Get setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
@Override
public Get set(String parameterName, Object value) {
return (Get) super.set(parameterName, value);
}
}
/**
* Inserts an existing calendar into the user's calendar list.
*
* Create a request for the method "calendarList.insert".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Insert#execute()} method to invoke the remote operation.
*
* @param content the {@link com.google.api.services.calendar.model.CalendarListEntry}
* @return the request
*/
public Insert insert(com.google.api.services.calendar.model.CalendarListEntry content) throws java.io.IOException {
Insert result = new Insert(content);
initialize(result);
return result;
}
public class Insert extends CalendarRequest<com.google.api.services.calendar.model.CalendarListEntry> {
private static final String REST_PATH = "users/me/calendarList";
/**
* Inserts an existing calendar into the user's calendar list.
*
* Create a request for the method "calendarList.insert".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Insert#execute()} method to invoke the remote operation.
* <p> {@link
* Insert#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param content the {@link com.google.api.services.calendar.model.CalendarListEntry}
* @since 1.13
*/
protected Insert(com.google.api.services.calendar.model.CalendarListEntry content) {
super(Calendar.this, "POST", REST_PATH, content, com.google.api.services.calendar.model.CalendarListEntry.class);
checkRequiredParameter(content, "content");
checkRequiredParameter(content.getId(), "CalendarListEntry.getId()");
}
@Override
public Insert setAlt(java.lang.String alt) {
return (Insert) super.setAlt(alt);
}
@Override
public Insert setFields(java.lang.String fields) {
return (Insert) super.setFields(fields);
}
@Override
public Insert setKey(java.lang.String key) {
return (Insert) super.setKey(key);
}
@Override
public Insert setOauthToken(java.lang.String oauthToken) {
return (Insert) super.setOauthToken(oauthToken);
}
@Override
public Insert setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Insert) super.setPrettyPrint(prettyPrint);
}
@Override
public Insert setQuotaUser(java.lang.String quotaUser) {
return (Insert) super.setQuotaUser(quotaUser);
}
@Override
public Insert setUserIp(java.lang.String userIp) {
return (Insert) super.setUserIp(userIp);
}
/**
* Whether to use the foregroundColor and backgroundColor fields to write the calendar colors
* (RGB). If this feature is used, the index-based colorId field will be set to the best
* matching option automatically. Optional. The default is False.
*/
@com.google.api.client.util.Key
private java.lang.Boolean colorRgbFormat;
/** Whether to use the foregroundColor and backgroundColor fields to write the calendar colors (RGB).
If this feature is used, the index-based colorId field will be set to the best matching option
automatically. Optional. The default is False.
*/
public java.lang.Boolean getColorRgbFormat() {
return colorRgbFormat;
}
/**
* Whether to use the foregroundColor and backgroundColor fields to write the calendar colors
* (RGB). If this feature is used, the index-based colorId field will be set to the best
* matching option automatically. Optional. The default is False.
*/
public Insert setColorRgbFormat(java.lang.Boolean colorRgbFormat) {
this.colorRgbFormat = colorRgbFormat;
return this;
}
@Override
public Insert set(String parameterName, Object value) {
return (Insert) super.set(parameterName, value);
}
}
/**
* Returns the calendars on the user's calendar list.
*
* Create a request for the method "calendarList.list".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link List#execute()} method to invoke the remote operation.
*
* @return the request
*/
public List list() throws java.io.IOException {
List result = new List();
initialize(result);
return result;
}
public class List extends CalendarRequest<com.google.api.services.calendar.model.CalendarList> {
private static final String REST_PATH = "users/me/calendarList";
/**
* Returns the calendars on the user's calendar list.
*
* Create a request for the method "calendarList.list".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link List#execute()} method to invoke the remote operation. <p>
* {@link List#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
* must be called to initialize this instance immediately after invoking the constructor. </p>
*
* @since 1.13
*/
protected List() {
super(Calendar.this, "GET", REST_PATH, null, com.google.api.services.calendar.model.CalendarList.class);
}
@Override
public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException {
return super.executeUsingHead();
}
@Override
public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException {
return super.buildHttpRequestUsingHead();
}
@Override
public List setAlt(java.lang.String alt) {
return (List) super.setAlt(alt);
}
@Override
public List setFields(java.lang.String fields) {
return (List) super.setFields(fields);
}
@Override
public List setKey(java.lang.String key) {
return (List) super.setKey(key);
}
@Override
public List setOauthToken(java.lang.String oauthToken) {
return (List) super.setOauthToken(oauthToken);
}
@Override
public List setPrettyPrint(java.lang.Boolean prettyPrint) {
return (List) super.setPrettyPrint(prettyPrint);
}
@Override
public List setQuotaUser(java.lang.String quotaUser) {
return (List) super.setQuotaUser(quotaUser);
}
@Override
public List setUserIp(java.lang.String userIp) {
return (List) super.setUserIp(userIp);
}
/**
* Maximum number of entries returned on one result page. By default the value is 100 entries.
* The page size can never be larger than 250 entries. Optional.
*/
@com.google.api.client.util.Key
private java.lang.Integer maxResults;
/** Maximum number of entries returned on one result page. By default the value is 100 entries. The
page size can never be larger than 250 entries. Optional.
[minimum: 1]
*/
public java.lang.Integer getMaxResults() {
return maxResults;
}
/**
* Maximum number of entries returned on one result page. By default the value is 100 entries.
* The page size can never be larger than 250 entries. Optional.
*/
public List setMaxResults(java.lang.Integer maxResults) {
this.maxResults = maxResults;
return this;
}
/**
* The minimum access role for the user in the returned entries. Optional. The default is no
* restriction.
*/
@com.google.api.client.util.Key
private java.lang.String minAccessRole;
/** The minimum access role for the user in the returned entries. Optional. The default is no
restriction.
*/
public java.lang.String getMinAccessRole() {
return minAccessRole;
}
/**
* The minimum access role for the user in the returned entries. Optional. The default is no
* restriction.
*/
public List setMinAccessRole(java.lang.String minAccessRole) {
this.minAccessRole = minAccessRole;
return this;
}
/** Token specifying which result page to return. Optional. */
@com.google.api.client.util.Key
private java.lang.String pageToken;
/** Token specifying which result page to return. Optional.
*/
public java.lang.String getPageToken() {
return pageToken;
}
/** Token specifying which result page to return. Optional. */
public List setPageToken(java.lang.String pageToken) {
this.pageToken = pageToken;
return this;
}
/**
* Whether to include deleted calendar list entries in the result. Optional. The default is
* False.
*/
@com.google.api.client.util.Key
private java.lang.Boolean showDeleted;
/** Whether to include deleted calendar list entries in the result. Optional. The default is False.
*/
public java.lang.Boolean getShowDeleted() {
return showDeleted;
}
/**
* Whether to include deleted calendar list entries in the result. Optional. The default is
* False.
*/
public List setShowDeleted(java.lang.Boolean showDeleted) {
this.showDeleted = showDeleted;
return this;
}
/** Whether to show hidden entries. Optional. The default is False. */
@com.google.api.client.util.Key
private java.lang.Boolean showHidden;
/** Whether to show hidden entries. Optional. The default is False.
*/
public java.lang.Boolean getShowHidden() {
return showHidden;
}
/** Whether to show hidden entries. Optional. The default is False. */
public List setShowHidden(java.lang.Boolean showHidden) {
this.showHidden = showHidden;
return this;
}
/**
* Token obtained from the nextSyncToken field returned on the last page of results from the
* previous list request. It makes the result of this list request contain only entries that
* have changed since then. If only read-only fields such as calendar properties or ACLs have
* changed, the entry won't be returned. All entries deleted and hidden since the previous
* list request will always be in the result set and it is not allowed to set showDeleted
* neither showHidden to False. To ensure client state consistency minAccessRole query
* parameter cannot be specified together with nextSyncToken. If the syncToken expires, the
* server will respond with a 410 GONE response code and the client should clear its storage
* and perform a full synchronization without any syncToken. Learn more about incremental
* synchronization. Optional. The default is to return all entries.
*/
@com.google.api.client.util.Key
private java.lang.String syncToken;
/** Token obtained from the nextSyncToken field returned on the last page of results from the previous
list request. It makes the result of this list request contain only entries that have changed since
then. If only read-only fields such as calendar properties or ACLs have changed, the entry won't be
returned. All entries deleted and hidden since the previous list request will always be in the
result set and it is not allowed to set showDeleted neither showHidden to False. To ensure client
state consistency minAccessRole query parameter cannot be specified together with nextSyncToken. If
the syncToken expires, the server will respond with a 410 GONE response code and the client should
clear its storage and perform a full synchronization without any syncToken. Learn more about
incremental synchronization. Optional. The default is to return all entries.
*/
public java.lang.String getSyncToken() {
return syncToken;
}
/**
* Token obtained from the nextSyncToken field returned on the last page of results from the
* previous list request. It makes the result of this list request contain only entries that
* have changed since then. If only read-only fields such as calendar properties or ACLs have
* changed, the entry won't be returned. All entries deleted and hidden since the previous
* list request will always be in the result set and it is not allowed to set showDeleted
* neither showHidden to False. To ensure client state consistency minAccessRole query
* parameter cannot be specified together with nextSyncToken. If the syncToken expires, the
* server will respond with a 410 GONE response code and the client should clear its storage
* and perform a full synchronization without any syncToken. Learn more about incremental
* synchronization. Optional. The default is to return all entries.
*/
public List setSyncToken(java.lang.String syncToken) {
this.syncToken = syncToken;
return this;
}
@Override
public List set(String parameterName, Object value) {
return (List) super.set(parameterName, value);
}
}
/**
* Updates an existing calendar on the user's calendar list. This method supports patch semantics.
*
* Create a request for the method "calendarList.patch".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Patch#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param content the {@link com.google.api.services.calendar.model.CalendarListEntry}
* @return the request
*/
public Patch patch(java.lang.String calendarId, com.google.api.services.calendar.model.CalendarListEntry content) throws java.io.IOException {
Patch result = new Patch(calendarId, content);
initialize(result);
return result;
}
public class Patch extends CalendarRequest<com.google.api.services.calendar.model.CalendarListEntry> {
private static final String REST_PATH = "users/me/calendarList/{calendarId}";
/**
* Updates an existing calendar on the user's calendar list. This method supports patch semantics.
*
* Create a request for the method "calendarList.patch".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Patch#execute()} method to invoke the remote operation.
* <p> {@link
* Patch#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param content the {@link com.google.api.services.calendar.model.CalendarListEntry}
* @since 1.13
*/
protected Patch(java.lang.String calendarId, com.google.api.services.calendar.model.CalendarListEntry content) {
super(Calendar.this, "PATCH", REST_PATH, content, com.google.api.services.calendar.model.CalendarListEntry.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
}
@Override
public Patch setAlt(java.lang.String alt) {
return (Patch) super.setAlt(alt);
}
@Override
public Patch setFields(java.lang.String fields) {
return (Patch) super.setFields(fields);
}
@Override
public Patch setKey(java.lang.String key) {
return (Patch) super.setKey(key);
}
@Override
public Patch setOauthToken(java.lang.String oauthToken) {
return (Patch) super.setOauthToken(oauthToken);
}
@Override
public Patch setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Patch) super.setPrettyPrint(prettyPrint);
}
@Override
public Patch setQuotaUser(java.lang.String quotaUser) {
return (Patch) super.setQuotaUser(quotaUser);
}
@Override
public Patch setUserIp(java.lang.String userIp) {
return (Patch) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public Patch setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
/**
* Whether to use the foregroundColor and backgroundColor fields to write the calendar colors
* (RGB). If this feature is used, the index-based colorId field will be set to the best
* matching option automatically. Optional. The default is False.
*/
@com.google.api.client.util.Key
private java.lang.Boolean colorRgbFormat;
/** Whether to use the foregroundColor and backgroundColor fields to write the calendar colors (RGB).
If this feature is used, the index-based colorId field will be set to the best matching option
automatically. Optional. The default is False.
*/
public java.lang.Boolean getColorRgbFormat() {
return colorRgbFormat;
}
/**
* Whether to use the foregroundColor and backgroundColor fields to write the calendar colors
* (RGB). If this feature is used, the index-based colorId field will be set to the best
* matching option automatically. Optional. The default is False.
*/
public Patch setColorRgbFormat(java.lang.Boolean colorRgbFormat) {
this.colorRgbFormat = colorRgbFormat;
return this;
}
@Override
public Patch set(String parameterName, Object value) {
return (Patch) super.set(parameterName, value);
}
}
/**
* Updates an existing calendar on the user's calendar list.
*
* Create a request for the method "calendarList.update".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Update#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param content the {@link com.google.api.services.calendar.model.CalendarListEntry}
* @return the request
*/
public Update update(java.lang.String calendarId, com.google.api.services.calendar.model.CalendarListEntry content) throws java.io.IOException {
Update result = new Update(calendarId, content);
initialize(result);
return result;
}
public class Update extends CalendarRequest<com.google.api.services.calendar.model.CalendarListEntry> {
private static final String REST_PATH = "users/me/calendarList/{calendarId}";
/**
* Updates an existing calendar on the user's calendar list.
*
* Create a request for the method "calendarList.update".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Update#execute()} method to invoke the remote operation.
* <p> {@link
* Update#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param content the {@link com.google.api.services.calendar.model.CalendarListEntry}
* @since 1.13
*/
protected Update(java.lang.String calendarId, com.google.api.services.calendar.model.CalendarListEntry content) {
super(Calendar.this, "PUT", REST_PATH, content, com.google.api.services.calendar.model.CalendarListEntry.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
}
@Override
public Update setAlt(java.lang.String alt) {
return (Update) super.setAlt(alt);
}
@Override
public Update setFields(java.lang.String fields) {
return (Update) super.setFields(fields);
}
@Override
public Update setKey(java.lang.String key) {
return (Update) super.setKey(key);
}
@Override
public Update setOauthToken(java.lang.String oauthToken) {
return (Update) super.setOauthToken(oauthToken);
}
@Override
public Update setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Update) super.setPrettyPrint(prettyPrint);
}
@Override
public Update setQuotaUser(java.lang.String quotaUser) {
return (Update) super.setQuotaUser(quotaUser);
}
@Override
public Update setUserIp(java.lang.String userIp) {
return (Update) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public Update setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
/**
* Whether to use the foregroundColor and backgroundColor fields to write the calendar colors
* (RGB). If this feature is used, the index-based colorId field will be set to the best
* matching option automatically. Optional. The default is False.
*/
@com.google.api.client.util.Key
private java.lang.Boolean colorRgbFormat;
/** Whether to use the foregroundColor and backgroundColor fields to write the calendar colors (RGB).
If this feature is used, the index-based colorId field will be set to the best matching option
automatically. Optional. The default is False.
*/
public java.lang.Boolean getColorRgbFormat() {
return colorRgbFormat;
}
/**
* Whether to use the foregroundColor and backgroundColor fields to write the calendar colors
* (RGB). If this feature is used, the index-based colorId field will be set to the best
* matching option automatically. Optional. The default is False.
*/
public Update setColorRgbFormat(java.lang.Boolean colorRgbFormat) {
this.colorRgbFormat = colorRgbFormat;
return this;
}
@Override
public Update set(String parameterName, Object value) {
return (Update) super.set(parameterName, value);
}
}
/**
* Watch for changes to CalendarList resources.
*
* Create a request for the method "calendarList.watch".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Watch#execute()} method to invoke the remote operation.
*
* @param content the {@link com.google.api.services.calendar.model.Channel}
* @return the request
*/
public Watch watch(com.google.api.services.calendar.model.Channel content) throws java.io.IOException {
Watch result = new Watch(content);
initialize(result);
return result;
}
public class Watch extends CalendarRequest<com.google.api.services.calendar.model.Channel> {
private static final String REST_PATH = "users/me/calendarList/watch";
/**
* Watch for changes to CalendarList resources.
*
* Create a request for the method "calendarList.watch".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Watch#execute()} method to invoke the remote operation.
* <p> {@link
* Watch#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param content the {@link com.google.api.services.calendar.model.Channel}
* @since 1.13
*/
protected Watch(com.google.api.services.calendar.model.Channel content) {
super(Calendar.this, "POST", REST_PATH, content, com.google.api.services.calendar.model.Channel.class);
}
@Override
public Watch setAlt(java.lang.String alt) {
return (Watch) super.setAlt(alt);
}
@Override
public Watch setFields(java.lang.String fields) {
return (Watch) super.setFields(fields);
}
@Override
public Watch setKey(java.lang.String key) {
return (Watch) super.setKey(key);
}
@Override
public Watch setOauthToken(java.lang.String oauthToken) {
return (Watch) super.setOauthToken(oauthToken);
}
@Override
public Watch setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Watch) super.setPrettyPrint(prettyPrint);
}
@Override
public Watch setQuotaUser(java.lang.String quotaUser) {
return (Watch) super.setQuotaUser(quotaUser);
}
@Override
public Watch setUserIp(java.lang.String userIp) {
return (Watch) super.setUserIp(userIp);
}
/**
* Maximum number of entries returned on one result page. By default the value is 100 entries.
* The page size can never be larger than 250 entries. Optional.
*/
@com.google.api.client.util.Key
private java.lang.Integer maxResults;
/** Maximum number of entries returned on one result page. By default the value is 100 entries. The
page size can never be larger than 250 entries. Optional.
[minimum: 1]
*/
public java.lang.Integer getMaxResults() {
return maxResults;
}
/**
* Maximum number of entries returned on one result page. By default the value is 100 entries.
* The page size can never be larger than 250 entries. Optional.
*/
public Watch setMaxResults(java.lang.Integer maxResults) {
this.maxResults = maxResults;
return this;
}
/**
* The minimum access role for the user in the returned entries. Optional. The default is no
* restriction.
*/
@com.google.api.client.util.Key
private java.lang.String minAccessRole;
/** The minimum access role for the user in the returned entries. Optional. The default is no
restriction.
*/
public java.lang.String getMinAccessRole() {
return minAccessRole;
}
/**
* The minimum access role for the user in the returned entries. Optional. The default is no
* restriction.
*/
public Watch setMinAccessRole(java.lang.String minAccessRole) {
this.minAccessRole = minAccessRole;
return this;
}
/** Token specifying which result page to return. Optional. */
@com.google.api.client.util.Key
private java.lang.String pageToken;
/** Token specifying which result page to return. Optional.
*/
public java.lang.String getPageToken() {
return pageToken;
}
/** Token specifying which result page to return. Optional. */
public Watch setPageToken(java.lang.String pageToken) {
this.pageToken = pageToken;
return this;
}
/**
* Whether to include deleted calendar list entries in the result. Optional. The default is
* False.
*/
@com.google.api.client.util.Key
private java.lang.Boolean showDeleted;
/** Whether to include deleted calendar list entries in the result. Optional. The default is False.
*/
public java.lang.Boolean getShowDeleted() {
return showDeleted;
}
/**
* Whether to include deleted calendar list entries in the result. Optional. The default is
* False.
*/
public Watch setShowDeleted(java.lang.Boolean showDeleted) {
this.showDeleted = showDeleted;
return this;
}
/** Whether to show hidden entries. Optional. The default is False. */
@com.google.api.client.util.Key
private java.lang.Boolean showHidden;
/** Whether to show hidden entries. Optional. The default is False.
*/
public java.lang.Boolean getShowHidden() {
return showHidden;
}
/** Whether to show hidden entries. Optional. The default is False. */
public Watch setShowHidden(java.lang.Boolean showHidden) {
this.showHidden = showHidden;
return this;
}
/**
* Token obtained from the nextSyncToken field returned on the last page of results from the
* previous list request. It makes the result of this list request contain only entries that
* have changed since then. If only read-only fields such as calendar properties or ACLs have
* changed, the entry won't be returned. All entries deleted and hidden since the previous
* list request will always be in the result set and it is not allowed to set showDeleted
* neither showHidden to False. To ensure client state consistency minAccessRole query
* parameter cannot be specified together with nextSyncToken. If the syncToken expires, the
* server will respond with a 410 GONE response code and the client should clear its storage
* and perform a full synchronization without any syncToken. Learn more about incremental
* synchronization. Optional. The default is to return all entries.
*/
@com.google.api.client.util.Key
private java.lang.String syncToken;
/** Token obtained from the nextSyncToken field returned on the last page of results from the previous
list request. It makes the result of this list request contain only entries that have changed since
then. If only read-only fields such as calendar properties or ACLs have changed, the entry won't be
returned. All entries deleted and hidden since the previous list request will always be in the
result set and it is not allowed to set showDeleted neither showHidden to False. To ensure client
state consistency minAccessRole query parameter cannot be specified together with nextSyncToken. If
the syncToken expires, the server will respond with a 410 GONE response code and the client should
clear its storage and perform a full synchronization without any syncToken. Learn more about
incremental synchronization. Optional. The default is to return all entries.
*/
public java.lang.String getSyncToken() {
return syncToken;
}
/**
* Token obtained from the nextSyncToken field returned on the last page of results from the
* previous list request. It makes the result of this list request contain only entries that
* have changed since then. If only read-only fields such as calendar properties or ACLs have
* changed, the entry won't be returned. All entries deleted and hidden since the previous
* list request will always be in the result set and it is not allowed to set showDeleted
* neither showHidden to False. To ensure client state consistency minAccessRole query
* parameter cannot be specified together with nextSyncToken. If the syncToken expires, the
* server will respond with a 410 GONE response code and the client should clear its storage
* and perform a full synchronization without any syncToken. Learn more about incremental
* synchronization. Optional. The default is to return all entries.
*/
public Watch setSyncToken(java.lang.String syncToken) {
this.syncToken = syncToken;
return this;
}
@Override
public Watch set(String parameterName, Object value) {
return (Watch) super.set(parameterName, value);
}
}
}
/**
* An accessor for creating requests from the Calendars collection.
*
* <p>The typical use is:</p>
* <pre>
* {@code Calendar calendar = new Calendar(...);}
* {@code Calendar.Calendars.List request = calendar.calendars().list(parameters ...)}
* </pre>
*
* @return the resource collection
*/
public Calendars calendars() {
return new Calendars();
}
/**
* The "calendars" collection of methods.
*/
public class Calendars {
/**
* Clears a primary calendar. This operation deletes all events associated with the primary calendar
* of an account.
*
* Create a request for the method "calendars.clear".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Clear#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @return the request
*/
public Clear clear(java.lang.String calendarId) throws java.io.IOException {
Clear result = new Clear(calendarId);
initialize(result);
return result;
}
public class Clear extends CalendarRequest<Void> {
private static final String REST_PATH = "calendars/{calendarId}/clear";
/**
* Clears a primary calendar. This operation deletes all events associated with the primary
* calendar of an account.
*
* Create a request for the method "calendars.clear".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Clear#execute()} method to invoke the remote operation.
* <p> {@link
* Clear#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @since 1.13
*/
protected Clear(java.lang.String calendarId) {
super(Calendar.this, "POST", REST_PATH, null, Void.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
}
@Override
public Clear setAlt(java.lang.String alt) {
return (Clear) super.setAlt(alt);
}
@Override
public Clear setFields(java.lang.String fields) {
return (Clear) super.setFields(fields);
}
@Override
public Clear setKey(java.lang.String key) {
return (Clear) super.setKey(key);
}
@Override
public Clear setOauthToken(java.lang.String oauthToken) {
return (Clear) super.setOauthToken(oauthToken);
}
@Override
public Clear setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Clear) super.setPrettyPrint(prettyPrint);
}
@Override
public Clear setQuotaUser(java.lang.String quotaUser) {
return (Clear) super.setQuotaUser(quotaUser);
}
@Override
public Clear setUserIp(java.lang.String userIp) {
return (Clear) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public Clear setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
@Override
public Clear set(String parameterName, Object value) {
return (Clear) super.set(parameterName, value);
}
}
/**
* Deletes a secondary calendar. Use calendars.clear for clearing all events on primary calendars.
*
* Create a request for the method "calendars.delete".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Delete#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @return the request
*/
public Delete delete(java.lang.String calendarId) throws java.io.IOException {
Delete result = new Delete(calendarId);
initialize(result);
return result;
}
public class Delete extends CalendarRequest<Void> {
private static final String REST_PATH = "calendars/{calendarId}";
/**
* Deletes a secondary calendar. Use calendars.clear for clearing all events on primary calendars.
*
* Create a request for the method "calendars.delete".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Delete#execute()} method to invoke the remote operation.
* <p> {@link
* Delete#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @since 1.13
*/
protected Delete(java.lang.String calendarId) {
super(Calendar.this, "DELETE", REST_PATH, null, Void.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
}
@Override
public Delete setAlt(java.lang.String alt) {
return (Delete) super.setAlt(alt);
}
@Override
public Delete setFields(java.lang.String fields) {
return (Delete) super.setFields(fields);
}
@Override
public Delete setKey(java.lang.String key) {
return (Delete) super.setKey(key);
}
@Override
public Delete setOauthToken(java.lang.String oauthToken) {
return (Delete) super.setOauthToken(oauthToken);
}
@Override
public Delete setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Delete) super.setPrettyPrint(prettyPrint);
}
@Override
public Delete setQuotaUser(java.lang.String quotaUser) {
return (Delete) super.setQuotaUser(quotaUser);
}
@Override
public Delete setUserIp(java.lang.String userIp) {
return (Delete) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public Delete setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
@Override
public Delete set(String parameterName, Object value) {
return (Delete) super.set(parameterName, value);
}
}
/**
* Returns metadata for a calendar.
*
* Create a request for the method "calendars.get".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Get#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @return the request
*/
public Get get(java.lang.String calendarId) throws java.io.IOException {
Get result = new Get(calendarId);
initialize(result);
return result;
}
public class Get extends CalendarRequest<com.google.api.services.calendar.model.Calendar> {
private static final String REST_PATH = "calendars/{calendarId}";
/**
* Returns metadata for a calendar.
*
* Create a request for the method "calendars.get".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Get#execute()} method to invoke the remote operation. <p>
* {@link Get#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
* must be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @since 1.13
*/
protected Get(java.lang.String calendarId) {
super(Calendar.this, "GET", REST_PATH, null, com.google.api.services.calendar.model.Calendar.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
}
@Override
public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException {
return super.executeUsingHead();
}
@Override
public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException {
return super.buildHttpRequestUsingHead();
}
@Override
public Get setAlt(java.lang.String alt) {
return (Get) super.setAlt(alt);
}
@Override
public Get setFields(java.lang.String fields) {
return (Get) super.setFields(fields);
}
@Override
public Get setKey(java.lang.String key) {
return (Get) super.setKey(key);
}
@Override
public Get setOauthToken(java.lang.String oauthToken) {
return (Get) super.setOauthToken(oauthToken);
}
@Override
public Get setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Get) super.setPrettyPrint(prettyPrint);
}
@Override
public Get setQuotaUser(java.lang.String quotaUser) {
return (Get) super.setQuotaUser(quotaUser);
}
@Override
public Get setUserIp(java.lang.String userIp) {
return (Get) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public Get setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
@Override
public Get set(String parameterName, Object value) {
return (Get) super.set(parameterName, value);
}
}
/**
* Creates a secondary calendar.
*
* Create a request for the method "calendars.insert".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Insert#execute()} method to invoke the remote operation.
*
* @param content the {@link com.google.api.services.calendar.model.Calendar}
* @return the request
*/
public Insert insert(com.google.api.services.calendar.model.Calendar content) throws java.io.IOException {
Insert result = new Insert(content);
initialize(result);
return result;
}
public class Insert extends CalendarRequest<com.google.api.services.calendar.model.Calendar> {
private static final String REST_PATH = "calendars";
/**
* Creates a secondary calendar.
*
* Create a request for the method "calendars.insert".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Insert#execute()} method to invoke the remote operation.
* <p> {@link
* Insert#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param content the {@link com.google.api.services.calendar.model.Calendar}
* @since 1.13
*/
protected Insert(com.google.api.services.calendar.model.Calendar content) {
super(Calendar.this, "POST", REST_PATH, content, com.google.api.services.calendar.model.Calendar.class);
checkRequiredParameter(content, "content");
checkRequiredParameter(content.getSummary(), "Calendar.getSummary()");
}
@Override
public Insert setAlt(java.lang.String alt) {
return (Insert) super.setAlt(alt);
}
@Override
public Insert setFields(java.lang.String fields) {
return (Insert) super.setFields(fields);
}
@Override
public Insert setKey(java.lang.String key) {
return (Insert) super.setKey(key);
}
@Override
public Insert setOauthToken(java.lang.String oauthToken) {
return (Insert) super.setOauthToken(oauthToken);
}
@Override
public Insert setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Insert) super.setPrettyPrint(prettyPrint);
}
@Override
public Insert setQuotaUser(java.lang.String quotaUser) {
return (Insert) super.setQuotaUser(quotaUser);
}
@Override
public Insert setUserIp(java.lang.String userIp) {
return (Insert) super.setUserIp(userIp);
}
@Override
public Insert set(String parameterName, Object value) {
return (Insert) super.set(parameterName, value);
}
}
/**
* Updates metadata for a calendar. This method supports patch semantics.
*
* Create a request for the method "calendars.patch".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Patch#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param content the {@link com.google.api.services.calendar.model.Calendar}
* @return the request
*/
public Patch patch(java.lang.String calendarId, com.google.api.services.calendar.model.Calendar content) throws java.io.IOException {
Patch result = new Patch(calendarId, content);
initialize(result);
return result;
}
public class Patch extends CalendarRequest<com.google.api.services.calendar.model.Calendar> {
private static final String REST_PATH = "calendars/{calendarId}";
/**
* Updates metadata for a calendar. This method supports patch semantics.
*
* Create a request for the method "calendars.patch".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Patch#execute()} method to invoke the remote operation.
* <p> {@link
* Patch#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param content the {@link com.google.api.services.calendar.model.Calendar}
* @since 1.13
*/
protected Patch(java.lang.String calendarId, com.google.api.services.calendar.model.Calendar content) {
super(Calendar.this, "PATCH", REST_PATH, content, com.google.api.services.calendar.model.Calendar.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
}
@Override
public Patch setAlt(java.lang.String alt) {
return (Patch) super.setAlt(alt);
}
@Override
public Patch setFields(java.lang.String fields) {
return (Patch) super.setFields(fields);
}
@Override
public Patch setKey(java.lang.String key) {
return (Patch) super.setKey(key);
}
@Override
public Patch setOauthToken(java.lang.String oauthToken) {
return (Patch) super.setOauthToken(oauthToken);
}
@Override
public Patch setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Patch) super.setPrettyPrint(prettyPrint);
}
@Override
public Patch setQuotaUser(java.lang.String quotaUser) {
return (Patch) super.setQuotaUser(quotaUser);
}
@Override
public Patch setUserIp(java.lang.String userIp) {
return (Patch) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public Patch setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
@Override
public Patch set(String parameterName, Object value) {
return (Patch) super.set(parameterName, value);
}
}
/**
* Updates metadata for a calendar.
*
* Create a request for the method "calendars.update".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Update#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param content the {@link com.google.api.services.calendar.model.Calendar}
* @return the request
*/
public Update update(java.lang.String calendarId, com.google.api.services.calendar.model.Calendar content) throws java.io.IOException {
Update result = new Update(calendarId, content);
initialize(result);
return result;
}
public class Update extends CalendarRequest<com.google.api.services.calendar.model.Calendar> {
private static final String REST_PATH = "calendars/{calendarId}";
/**
* Updates metadata for a calendar.
*
* Create a request for the method "calendars.update".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Update#execute()} method to invoke the remote operation.
* <p> {@link
* Update#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param content the {@link com.google.api.services.calendar.model.Calendar}
* @since 1.13
*/
protected Update(java.lang.String calendarId, com.google.api.services.calendar.model.Calendar content) {
super(Calendar.this, "PUT", REST_PATH, content, com.google.api.services.calendar.model.Calendar.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
}
@Override
public Update setAlt(java.lang.String alt) {
return (Update) super.setAlt(alt);
}
@Override
public Update setFields(java.lang.String fields) {
return (Update) super.setFields(fields);
}
@Override
public Update setKey(java.lang.String key) {
return (Update) super.setKey(key);
}
@Override
public Update setOauthToken(java.lang.String oauthToken) {
return (Update) super.setOauthToken(oauthToken);
}
@Override
public Update setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Update) super.setPrettyPrint(prettyPrint);
}
@Override
public Update setQuotaUser(java.lang.String quotaUser) {
return (Update) super.setQuotaUser(quotaUser);
}
@Override
public Update setUserIp(java.lang.String userIp) {
return (Update) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public Update setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
@Override
public Update set(String parameterName, Object value) {
return (Update) super.set(parameterName, value);
}
}
}
/**
* An accessor for creating requests from the Channels collection.
*
* <p>The typical use is:</p>
* <pre>
* {@code Calendar calendar = new Calendar(...);}
* {@code Calendar.Channels.List request = calendar.channels().list(parameters ...)}
* </pre>
*
* @return the resource collection
*/
public Channels channels() {
return new Channels();
}
/**
* The "channels" collection of methods.
*/
public class Channels {
/**
* Stop watching resources through this channel
*
* Create a request for the method "channels.stop".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Stop#execute()} method to invoke the remote operation.
*
* @param content the {@link com.google.api.services.calendar.model.Channel}
* @return the request
*/
public Stop stop(com.google.api.services.calendar.model.Channel content) throws java.io.IOException {
Stop result = new Stop(content);
initialize(result);
return result;
}
public class Stop extends CalendarRequest<Void> {
private static final String REST_PATH = "channels/stop";
/**
* Stop watching resources through this channel
*
* Create a request for the method "channels.stop".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Stop#execute()} method to invoke the remote operation. <p>
* {@link Stop#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
* must be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param content the {@link com.google.api.services.calendar.model.Channel}
* @since 1.13
*/
protected Stop(com.google.api.services.calendar.model.Channel content) {
super(Calendar.this, "POST", REST_PATH, content, Void.class);
}
@Override
public Stop setAlt(java.lang.String alt) {
return (Stop) super.setAlt(alt);
}
@Override
public Stop setFields(java.lang.String fields) {
return (Stop) super.setFields(fields);
}
@Override
public Stop setKey(java.lang.String key) {
return (Stop) super.setKey(key);
}
@Override
public Stop setOauthToken(java.lang.String oauthToken) {
return (Stop) super.setOauthToken(oauthToken);
}
@Override
public Stop setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Stop) super.setPrettyPrint(prettyPrint);
}
@Override
public Stop setQuotaUser(java.lang.String quotaUser) {
return (Stop) super.setQuotaUser(quotaUser);
}
@Override
public Stop setUserIp(java.lang.String userIp) {
return (Stop) super.setUserIp(userIp);
}
@Override
public Stop set(String parameterName, Object value) {
return (Stop) super.set(parameterName, value);
}
}
}
/**
* An accessor for creating requests from the Colors collection.
*
* <p>The typical use is:</p>
* <pre>
* {@code Calendar calendar = new Calendar(...);}
* {@code Calendar.Colors.List request = calendar.colors().list(parameters ...)}
* </pre>
*
* @return the resource collection
*/
public Colors colors() {
return new Colors();
}
/**
* The "colors" collection of methods.
*/
public class Colors {
/**
* Returns the color definitions for calendars and events.
*
* Create a request for the method "colors.get".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Get#execute()} method to invoke the remote operation.
*
* @return the request
*/
public Get get() throws java.io.IOException {
Get result = new Get();
initialize(result);
return result;
}
public class Get extends CalendarRequest<com.google.api.services.calendar.model.Colors> {
private static final String REST_PATH = "colors";
/**
* Returns the color definitions for calendars and events.
*
* Create a request for the method "colors.get".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Get#execute()} method to invoke the remote operation. <p>
* {@link Get#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
* must be called to initialize this instance immediately after invoking the constructor. </p>
*
* @since 1.13
*/
protected Get() {
super(Calendar.this, "GET", REST_PATH, null, com.google.api.services.calendar.model.Colors.class);
}
@Override
public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException {
return super.executeUsingHead();
}
@Override
public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException {
return super.buildHttpRequestUsingHead();
}
@Override
public Get setAlt(java.lang.String alt) {
return (Get) super.setAlt(alt);
}
@Override
public Get setFields(java.lang.String fields) {
return (Get) super.setFields(fields);
}
@Override
public Get setKey(java.lang.String key) {
return (Get) super.setKey(key);
}
@Override
public Get setOauthToken(java.lang.String oauthToken) {
return (Get) super.setOauthToken(oauthToken);
}
@Override
public Get setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Get) super.setPrettyPrint(prettyPrint);
}
@Override
public Get setQuotaUser(java.lang.String quotaUser) {
return (Get) super.setQuotaUser(quotaUser);
}
@Override
public Get setUserIp(java.lang.String userIp) {
return (Get) super.setUserIp(userIp);
}
@Override
public Get set(String parameterName, Object value) {
return (Get) super.set(parameterName, value);
}
}
}
/**
* An accessor for creating requests from the Events collection.
*
* <p>The typical use is:</p>
* <pre>
* {@code Calendar calendar = new Calendar(...);}
* {@code Calendar.Events.List request = calendar.events().list(parameters ...)}
* </pre>
*
* @return the resource collection
*/
public Events events() {
return new Events();
}
/**
* The "events" collection of methods.
*/
public class Events {
/**
* Deletes an event.
*
* Create a request for the method "events.delete".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Delete#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param eventId Event identifier.
* @return the request
*/
public Delete delete(java.lang.String calendarId, java.lang.String eventId) throws java.io.IOException {
Delete result = new Delete(calendarId, eventId);
initialize(result);
return result;
}
public class Delete extends CalendarRequest<Void> {
private static final String REST_PATH = "calendars/{calendarId}/events/{eventId}";
/**
* Deletes an event.
*
* Create a request for the method "events.delete".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Delete#execute()} method to invoke the remote operation.
* <p> {@link
* Delete#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param eventId Event identifier.
* @since 1.13
*/
protected Delete(java.lang.String calendarId, java.lang.String eventId) {
super(Calendar.this, "DELETE", REST_PATH, null, Void.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
this.eventId = com.google.api.client.util.Preconditions.checkNotNull(eventId, "Required parameter eventId must be specified.");
}
@Override
public Delete setAlt(java.lang.String alt) {
return (Delete) super.setAlt(alt);
}
@Override
public Delete setFields(java.lang.String fields) {
return (Delete) super.setFields(fields);
}
@Override
public Delete setKey(java.lang.String key) {
return (Delete) super.setKey(key);
}
@Override
public Delete setOauthToken(java.lang.String oauthToken) {
return (Delete) super.setOauthToken(oauthToken);
}
@Override
public Delete setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Delete) super.setPrettyPrint(prettyPrint);
}
@Override
public Delete setQuotaUser(java.lang.String quotaUser) {
return (Delete) super.setQuotaUser(quotaUser);
}
@Override
public Delete setUserIp(java.lang.String userIp) {
return (Delete) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public Delete setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
/** Event identifier. */
@com.google.api.client.util.Key
private java.lang.String eventId;
/** Event identifier.
*/
public java.lang.String getEventId() {
return eventId;
}
/** Event identifier. */
public Delete setEventId(java.lang.String eventId) {
this.eventId = eventId;
return this;
}
/**
* Deprecated. Please use sendUpdates instead.
*
* Whether to send notifications about the deletion of the event. Note that some emails might
* still be sent even if you set the value to false. The default is false.
*/
@com.google.api.client.util.Key
private java.lang.Boolean sendNotifications;
/** Deprecated. Please use sendUpdates instead.
Whether to send notifications about the deletion of the event. Note that some emails might still be
sent even if you set the value to false. The default is false.
*/
public java.lang.Boolean getSendNotifications() {
return sendNotifications;
}
/**
* Deprecated. Please use sendUpdates instead.
*
* Whether to send notifications about the deletion of the event. Note that some emails might
* still be sent even if you set the value to false. The default is false.
*/
public Delete setSendNotifications(java.lang.Boolean sendNotifications) {
this.sendNotifications = sendNotifications;
return this;
}
/** Guests who should receive notifications about the deletion of the event. */
@com.google.api.client.util.Key
private java.lang.String sendUpdates;
/** Guests who should receive notifications about the deletion of the event.
*/
public java.lang.String getSendUpdates() {
return sendUpdates;
}
/** Guests who should receive notifications about the deletion of the event. */
public Delete setSendUpdates(java.lang.String sendUpdates) {
this.sendUpdates = sendUpdates;
return this;
}
@Override
public Delete set(String parameterName, Object value) {
return (Delete) super.set(parameterName, value);
}
}
/**
* Returns an event.
*
* Create a request for the method "events.get".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Get#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param eventId Event identifier.
* @return the request
*/
public Get get(java.lang.String calendarId, java.lang.String eventId) throws java.io.IOException {
Get result = new Get(calendarId, eventId);
initialize(result);
return result;
}
public class Get extends CalendarRequest<com.google.api.services.calendar.model.Event> {
private static final String REST_PATH = "calendars/{calendarId}/events/{eventId}";
/**
* Returns an event.
*
* Create a request for the method "events.get".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Get#execute()} method to invoke the remote operation. <p>
* {@link Get#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
* must be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param eventId Event identifier.
* @since 1.13
*/
protected Get(java.lang.String calendarId, java.lang.String eventId) {
super(Calendar.this, "GET", REST_PATH, null, com.google.api.services.calendar.model.Event.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
this.eventId = com.google.api.client.util.Preconditions.checkNotNull(eventId, "Required parameter eventId must be specified.");
}
@Override
public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException {
return super.executeUsingHead();
}
@Override
public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException {
return super.buildHttpRequestUsingHead();
}
@Override
public Get setAlt(java.lang.String alt) {
return (Get) super.setAlt(alt);
}
@Override
public Get setFields(java.lang.String fields) {
return (Get) super.setFields(fields);
}
@Override
public Get setKey(java.lang.String key) {
return (Get) super.setKey(key);
}
@Override
public Get setOauthToken(java.lang.String oauthToken) {
return (Get) super.setOauthToken(oauthToken);
}
@Override
public Get setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Get) super.setPrettyPrint(prettyPrint);
}
@Override
public Get setQuotaUser(java.lang.String quotaUser) {
return (Get) super.setQuotaUser(quotaUser);
}
@Override
public Get setUserIp(java.lang.String userIp) {
return (Get) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public Get setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
/** Event identifier. */
@com.google.api.client.util.Key
private java.lang.String eventId;
/** Event identifier.
*/
public java.lang.String getEventId() {
return eventId;
}
/** Event identifier. */
public Get setEventId(java.lang.String eventId) {
this.eventId = eventId;
return this;
}
/**
* Whether to always include a value in the email field for the organizer, creator and
* attendees, even if no real email is available (i.e. a generated, non-working value will be
* provided). The use of this option is discouraged and should only be used by clients which
* cannot handle the absence of an email address value in the mentioned places. Optional. The
* default is False.
*/
@com.google.api.client.util.Key
private java.lang.Boolean alwaysIncludeEmail;
/** Whether to always include a value in the email field for the organizer, creator and attendees, even
if no real email is available (i.e. a generated, non-working value will be provided). The use of
this option is discouraged and should only be used by clients which cannot handle the absence of an
email address value in the mentioned places. Optional. The default is False.
*/
public java.lang.Boolean getAlwaysIncludeEmail() {
return alwaysIncludeEmail;
}
/**
* Whether to always include a value in the email field for the organizer, creator and
* attendees, even if no real email is available (i.e. a generated, non-working value will be
* provided). The use of this option is discouraged and should only be used by clients which
* cannot handle the absence of an email address value in the mentioned places. Optional. The
* default is False.
*/
public Get setAlwaysIncludeEmail(java.lang.Boolean alwaysIncludeEmail) {
this.alwaysIncludeEmail = alwaysIncludeEmail;
return this;
}
/**
* The maximum number of attendees to include in the response. If there are more than the
* specified number of attendees, only the participant is returned. Optional.
*/
@com.google.api.client.util.Key
private java.lang.Integer maxAttendees;
/** The maximum number of attendees to include in the response. If there are more than the specified
number of attendees, only the participant is returned. Optional.
[minimum: 1]
*/
public java.lang.Integer getMaxAttendees() {
return maxAttendees;
}
/**
* The maximum number of attendees to include in the response. If there are more than the
* specified number of attendees, only the participant is returned. Optional.
*/
public Get setMaxAttendees(java.lang.Integer maxAttendees) {
this.maxAttendees = maxAttendees;
return this;
}
/**
* Time zone used in the response. Optional. The default is the time zone of the calendar.
*/
@com.google.api.client.util.Key
private java.lang.String timeZone;
/** Time zone used in the response. Optional. The default is the time zone of the calendar.
*/
public java.lang.String getTimeZone() {
return timeZone;
}
/**
* Time zone used in the response. Optional. The default is the time zone of the calendar.
*/
public Get setTimeZone(java.lang.String timeZone) {
this.timeZone = timeZone;
return this;
}
@Override
public Get set(String parameterName, Object value) {
return (Get) super.set(parameterName, value);
}
}
/**
* Imports an event. This operation is used to add a private copy of an existing event to a
* calendar.
*
* Create a request for the method "events.import".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link CalendarImport#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param content the {@link com.google.api.services.calendar.model.Event}
* @return the request
*/
public CalendarImport calendarImport(java.lang.String calendarId, com.google.api.services.calendar.model.Event content) throws java.io.IOException {
CalendarImport result = new CalendarImport(calendarId, content);
initialize(result);
return result;
}
public class CalendarImport extends CalendarRequest<com.google.api.services.calendar.model.Event> {
private static final String REST_PATH = "calendars/{calendarId}/events/import";
/**
* Imports an event. This operation is used to add a private copy of an existing event to a
* calendar.
*
* Create a request for the method "events.import".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link CalendarImport#execute()} method to invoke the remote
* operation. <p> {@link CalendarImport#initialize(com.google.api.client.googleapis.services.Abstr
* actGoogleClientRequest)} must be called to initialize this instance immediately after invoking
* the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param content the {@link com.google.api.services.calendar.model.Event}
* @since 1.13
*/
protected CalendarImport(java.lang.String calendarId, com.google.api.services.calendar.model.Event content) {
super(Calendar.this, "POST", REST_PATH, content, com.google.api.services.calendar.model.Event.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
checkRequiredParameter(content, "content");
checkRequiredParameter(content.getICalUID(), "Event.getICalUID()");
}
@Override
public CalendarImport setAlt(java.lang.String alt) {
return (CalendarImport) super.setAlt(alt);
}
@Override
public CalendarImport setFields(java.lang.String fields) {
return (CalendarImport) super.setFields(fields);
}
@Override
public CalendarImport setKey(java.lang.String key) {
return (CalendarImport) super.setKey(key);
}
@Override
public CalendarImport setOauthToken(java.lang.String oauthToken) {
return (CalendarImport) super.setOauthToken(oauthToken);
}
@Override
public CalendarImport setPrettyPrint(java.lang.Boolean prettyPrint) {
return (CalendarImport) super.setPrettyPrint(prettyPrint);
}
@Override
public CalendarImport setQuotaUser(java.lang.String quotaUser) {
return (CalendarImport) super.setQuotaUser(quotaUser);
}
@Override
public CalendarImport setUserIp(java.lang.String userIp) {
return (CalendarImport) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public CalendarImport setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
/**
* Version number of conference data supported by the API client. Version 0 assumes no
* conference data support and ignores conference data in the event's body. Version 1 enables
* support for copying of ConferenceData as well as for creating new conferences using the
* createRequest field of conferenceData. The default is 0.
*/
@com.google.api.client.util.Key
private java.lang.Integer conferenceDataVersion;
/** Version number of conference data supported by the API client. Version 0 assumes no conference data
support and ignores conference data in the event's body. Version 1 enables support for copying of
ConferenceData as well as for creating new conferences using the createRequest field of
conferenceData. The default is 0.
[minimum: 0] [maximum: 1]
*/
public java.lang.Integer getConferenceDataVersion() {
return conferenceDataVersion;
}
/**
* Version number of conference data supported by the API client. Version 0 assumes no
* conference data support and ignores conference data in the event's body. Version 1 enables
* support for copying of ConferenceData as well as for creating new conferences using the
* createRequest field of conferenceData. The default is 0.
*/
public CalendarImport setConferenceDataVersion(java.lang.Integer conferenceDataVersion) {
this.conferenceDataVersion = conferenceDataVersion;
return this;
}
/**
* Whether API client performing operation supports event attachments. Optional. The default
* is False.
*/
@com.google.api.client.util.Key
private java.lang.Boolean supportsAttachments;
/** Whether API client performing operation supports event attachments. Optional. The default is False.
*/
public java.lang.Boolean getSupportsAttachments() {
return supportsAttachments;
}
/**
* Whether API client performing operation supports event attachments. Optional. The default
* is False.
*/
public CalendarImport setSupportsAttachments(java.lang.Boolean supportsAttachments) {
this.supportsAttachments = supportsAttachments;
return this;
}
@Override
public CalendarImport set(String parameterName, Object value) {
return (CalendarImport) super.set(parameterName, value);
}
}
/**
* Creates an event.
*
* Create a request for the method "events.insert".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Insert#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param content the {@link com.google.api.services.calendar.model.Event}
* @return the request
*/
public Insert insert(java.lang.String calendarId, com.google.api.services.calendar.model.Event content) throws java.io.IOException {
Insert result = new Insert(calendarId, content);
initialize(result);
return result;
}
public class Insert extends CalendarRequest<com.google.api.services.calendar.model.Event> {
private static final String REST_PATH = "calendars/{calendarId}/events";
/**
* Creates an event.
*
* Create a request for the method "events.insert".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Insert#execute()} method to invoke the remote operation.
* <p> {@link
* Insert#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param content the {@link com.google.api.services.calendar.model.Event}
* @since 1.13
*/
protected Insert(java.lang.String calendarId, com.google.api.services.calendar.model.Event content) {
super(Calendar.this, "POST", REST_PATH, content, com.google.api.services.calendar.model.Event.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
}
@Override
public Insert setAlt(java.lang.String alt) {
return (Insert) super.setAlt(alt);
}
@Override
public Insert setFields(java.lang.String fields) {
return (Insert) super.setFields(fields);
}
@Override
public Insert setKey(java.lang.String key) {
return (Insert) super.setKey(key);
}
@Override
public Insert setOauthToken(java.lang.String oauthToken) {
return (Insert) super.setOauthToken(oauthToken);
}
@Override
public Insert setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Insert) super.setPrettyPrint(prettyPrint);
}
@Override
public Insert setQuotaUser(java.lang.String quotaUser) {
return (Insert) super.setQuotaUser(quotaUser);
}
@Override
public Insert setUserIp(java.lang.String userIp) {
return (Insert) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public Insert setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
/**
* Version number of conference data supported by the API client. Version 0 assumes no
* conference data support and ignores conference data in the event's body. Version 1 enables
* support for copying of ConferenceData as well as for creating new conferences using the
* createRequest field of conferenceData. The default is 0.
*/
@com.google.api.client.util.Key
private java.lang.Integer conferenceDataVersion;
/** Version number of conference data supported by the API client. Version 0 assumes no conference data
support and ignores conference data in the event's body. Version 1 enables support for copying of
ConferenceData as well as for creating new conferences using the createRequest field of
conferenceData. The default is 0.
[minimum: 0] [maximum: 1]
*/
public java.lang.Integer getConferenceDataVersion() {
return conferenceDataVersion;
}
/**
* Version number of conference data supported by the API client. Version 0 assumes no
* conference data support and ignores conference data in the event's body. Version 1 enables
* support for copying of ConferenceData as well as for creating new conferences using the
* createRequest field of conferenceData. The default is 0.
*/
public Insert setConferenceDataVersion(java.lang.Integer conferenceDataVersion) {
this.conferenceDataVersion = conferenceDataVersion;
return this;
}
/**
* The maximum number of attendees to include in the response. If there are more than the
* specified number of attendees, only the participant is returned. Optional.
*/
@com.google.api.client.util.Key
private java.lang.Integer maxAttendees;
/** The maximum number of attendees to include in the response. If there are more than the specified
number of attendees, only the participant is returned. Optional.
[minimum: 1]
*/
public java.lang.Integer getMaxAttendees() {
return maxAttendees;
}
/**
* The maximum number of attendees to include in the response. If there are more than the
* specified number of attendees, only the participant is returned. Optional.
*/
public Insert setMaxAttendees(java.lang.Integer maxAttendees) {
this.maxAttendees = maxAttendees;
return this;
}
/**
* Deprecated. Please use sendUpdates instead.
*
* Whether to send notifications about the creation of the new event. Note that some emails
* might still be sent even if you set the value to false. The default is false.
*/
@com.google.api.client.util.Key
private java.lang.Boolean sendNotifications;
/** Deprecated. Please use sendUpdates instead.
Whether to send notifications about the creation of the new event. Note that some emails might
still be sent even if you set the value to false. The default is false.
*/
public java.lang.Boolean getSendNotifications() {
return sendNotifications;
}
/**
* Deprecated. Please use sendUpdates instead.
*
* Whether to send notifications about the creation of the new event. Note that some emails
* might still be sent even if you set the value to false. The default is false.
*/
public Insert setSendNotifications(java.lang.Boolean sendNotifications) {
this.sendNotifications = sendNotifications;
return this;
}
/**
* Whether to send notifications about the creation of the new event. Note that some emails
* might still be sent. The default is false.
*/
@com.google.api.client.util.Key
private java.lang.String sendUpdates;
/** Whether to send notifications about the creation of the new event. Note that some emails might
still be sent. The default is false.
*/
public java.lang.String getSendUpdates() {
return sendUpdates;
}
/**
* Whether to send notifications about the creation of the new event. Note that some emails
* might still be sent. The default is false.
*/
public Insert setSendUpdates(java.lang.String sendUpdates) {
this.sendUpdates = sendUpdates;
return this;
}
/**
* Whether API client performing operation supports event attachments. Optional. The default
* is False.
*/
@com.google.api.client.util.Key
private java.lang.Boolean supportsAttachments;
/** Whether API client performing operation supports event attachments. Optional. The default is False.
*/
public java.lang.Boolean getSupportsAttachments() {
return supportsAttachments;
}
/**
* Whether API client performing operation supports event attachments. Optional. The default
* is False.
*/
public Insert setSupportsAttachments(java.lang.Boolean supportsAttachments) {
this.supportsAttachments = supportsAttachments;
return this;
}
@Override
public Insert set(String parameterName, Object value) {
return (Insert) super.set(parameterName, value);
}
}
/**
* Returns instances of the specified recurring event.
*
* Create a request for the method "events.instances".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Instances#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param eventId Recurring event identifier.
* @return the request
*/
public Instances instances(java.lang.String calendarId, java.lang.String eventId) throws java.io.IOException {
Instances result = new Instances(calendarId, eventId);
initialize(result);
return result;
}
public class Instances extends CalendarRequest<com.google.api.services.calendar.model.Events> {
private static final String REST_PATH = "calendars/{calendarId}/events/{eventId}/instances";
/**
* Returns instances of the specified recurring event.
*
* Create a request for the method "events.instances".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Instances#execute()} method to invoke the remote
* operation. <p> {@link
* Instances#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
* must be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param eventId Recurring event identifier.
* @since 1.13
*/
protected Instances(java.lang.String calendarId, java.lang.String eventId) {
super(Calendar.this, "GET", REST_PATH, null, com.google.api.services.calendar.model.Events.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
this.eventId = com.google.api.client.util.Preconditions.checkNotNull(eventId, "Required parameter eventId must be specified.");
}
@Override
public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException {
return super.executeUsingHead();
}
@Override
public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException {
return super.buildHttpRequestUsingHead();
}
@Override
public Instances setAlt(java.lang.String alt) {
return (Instances) super.setAlt(alt);
}
@Override
public Instances setFields(java.lang.String fields) {
return (Instances) super.setFields(fields);
}
@Override
public Instances setKey(java.lang.String key) {
return (Instances) super.setKey(key);
}
@Override
public Instances setOauthToken(java.lang.String oauthToken) {
return (Instances) super.setOauthToken(oauthToken);
}
@Override
public Instances setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Instances) super.setPrettyPrint(prettyPrint);
}
@Override
public Instances setQuotaUser(java.lang.String quotaUser) {
return (Instances) super.setQuotaUser(quotaUser);
}
@Override
public Instances setUserIp(java.lang.String userIp) {
return (Instances) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public Instances setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
/** Recurring event identifier. */
@com.google.api.client.util.Key
private java.lang.String eventId;
/** Recurring event identifier.
*/
public java.lang.String getEventId() {
return eventId;
}
/** Recurring event identifier. */
public Instances setEventId(java.lang.String eventId) {
this.eventId = eventId;
return this;
}
/**
* Whether to always include a value in the email field for the organizer, creator and
* attendees, even if no real email is available (i.e. a generated, non-working value will be
* provided). The use of this option is discouraged and should only be used by clients which
* cannot handle the absence of an email address value in the mentioned places. Optional. The
* default is False.
*/
@com.google.api.client.util.Key
private java.lang.Boolean alwaysIncludeEmail;
/** Whether to always include a value in the email field for the organizer, creator and attendees, even
if no real email is available (i.e. a generated, non-working value will be provided). The use of
this option is discouraged and should only be used by clients which cannot handle the absence of an
email address value in the mentioned places. Optional. The default is False.
*/
public java.lang.Boolean getAlwaysIncludeEmail() {
return alwaysIncludeEmail;
}
/**
* Whether to always include a value in the email field for the organizer, creator and
* attendees, even if no real email is available (i.e. a generated, non-working value will be
* provided). The use of this option is discouraged and should only be used by clients which
* cannot handle the absence of an email address value in the mentioned places. Optional. The
* default is False.
*/
public Instances setAlwaysIncludeEmail(java.lang.Boolean alwaysIncludeEmail) {
this.alwaysIncludeEmail = alwaysIncludeEmail;
return this;
}
/**
* The maximum number of attendees to include in the response. If there are more than the
* specified number of attendees, only the participant is returned. Optional.
*/
@com.google.api.client.util.Key
private java.lang.Integer maxAttendees;
/** The maximum number of attendees to include in the response. If there are more than the specified
number of attendees, only the participant is returned. Optional.
[minimum: 1]
*/
public java.lang.Integer getMaxAttendees() {
return maxAttendees;
}
/**
* The maximum number of attendees to include in the response. If there are more than the
* specified number of attendees, only the participant is returned. Optional.
*/
public Instances setMaxAttendees(java.lang.Integer maxAttendees) {
this.maxAttendees = maxAttendees;
return this;
}
/**
* Maximum number of events returned on one result page. By default the value is 250 events.
* The page size can never be larger than 2500 events. Optional.
*/
@com.google.api.client.util.Key
private java.lang.Integer maxResults;
/** Maximum number of events returned on one result page. By default the value is 250 events. The page
size can never be larger than 2500 events. Optional.
[minimum: 1]
*/
public java.lang.Integer getMaxResults() {
return maxResults;
}
/**
* Maximum number of events returned on one result page. By default the value is 250 events.
* The page size can never be larger than 2500 events. Optional.
*/
public Instances setMaxResults(java.lang.Integer maxResults) {
this.maxResults = maxResults;
return this;
}
/** The original start time of the instance in the result. Optional. */
@com.google.api.client.util.Key
private java.lang.String originalStart;
/** The original start time of the instance in the result. Optional.
*/
public java.lang.String getOriginalStart() {
return originalStart;
}
/** The original start time of the instance in the result. Optional. */
public Instances setOriginalStart(java.lang.String originalStart) {
this.originalStart = originalStart;
return this;
}
/** Token specifying which result page to return. Optional. */
@com.google.api.client.util.Key
private java.lang.String pageToken;
/** Token specifying which result page to return. Optional.
*/
public java.lang.String getPageToken() {
return pageToken;
}
/** Token specifying which result page to return. Optional. */
public Instances setPageToken(java.lang.String pageToken) {
this.pageToken = pageToken;
return this;
}
/**
* Whether to include deleted events (with status equals "cancelled") in the result. Cancelled
* instances of recurring events will still be included if singleEvents is False. Optional.
* The default is False.
*/
@com.google.api.client.util.Key
private java.lang.Boolean showDeleted;
/** Whether to include deleted events (with status equals "cancelled") in the result. Cancelled
instances of recurring events will still be included if singleEvents is False. Optional. The
default is False.
*/
public java.lang.Boolean getShowDeleted() {
return showDeleted;
}
/**
* Whether to include deleted events (with status equals "cancelled") in the result. Cancelled
* instances of recurring events will still be included if singleEvents is False. Optional.
* The default is False.
*/
public Instances setShowDeleted(java.lang.Boolean showDeleted) {
this.showDeleted = showDeleted;
return this;
}
/**
* Upper bound (exclusive) for an event's start time to filter by. Optional. The default is
* not to filter by start time. Must be an RFC3339 timestamp with mandatory time zone offset.
*/
@com.google.api.client.util.Key
private com.google.api.client.util.DateTime timeMax;
/** Upper bound (exclusive) for an event's start time to filter by. Optional. The default is not to
filter by start time. Must be an RFC3339 timestamp with mandatory time zone offset.
*/
public com.google.api.client.util.DateTime getTimeMax() {
return timeMax;
}
/**
* Upper bound (exclusive) for an event's start time to filter by. Optional. The default is
* not to filter by start time. Must be an RFC3339 timestamp with mandatory time zone offset.
*/
public Instances setTimeMax(com.google.api.client.util.DateTime timeMax) {
this.timeMax = timeMax;
return this;
}
/**
* Lower bound (inclusive) for an event's end time to filter by. Optional. The default is not
* to filter by end time. Must be an RFC3339 timestamp with mandatory time zone offset.
*/
@com.google.api.client.util.Key
private com.google.api.client.util.DateTime timeMin;
/** Lower bound (inclusive) for an event's end time to filter by. Optional. The default is not to
filter by end time. Must be an RFC3339 timestamp with mandatory time zone offset.
*/
public com.google.api.client.util.DateTime getTimeMin() {
return timeMin;
}
/**
* Lower bound (inclusive) for an event's end time to filter by. Optional. The default is not
* to filter by end time. Must be an RFC3339 timestamp with mandatory time zone offset.
*/
public Instances setTimeMin(com.google.api.client.util.DateTime timeMin) {
this.timeMin = timeMin;
return this;
}
/**
* Time zone used in the response. Optional. The default is the time zone of the calendar.
*/
@com.google.api.client.util.Key
private java.lang.String timeZone;
/** Time zone used in the response. Optional. The default is the time zone of the calendar.
*/
public java.lang.String getTimeZone() {
return timeZone;
}
/**
* Time zone used in the response. Optional. The default is the time zone of the calendar.
*/
public Instances setTimeZone(java.lang.String timeZone) {
this.timeZone = timeZone;
return this;
}
@Override
public Instances set(String parameterName, Object value) {
return (Instances) super.set(parameterName, value);
}
}
/**
* Returns events on the specified calendar.
*
* Create a request for the method "events.list".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link List#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @return the request
*/
public List list(java.lang.String calendarId) throws java.io.IOException {
List result = new List(calendarId);
initialize(result);
return result;
}
public class List extends CalendarRequest<com.google.api.services.calendar.model.Events> {
private static final String REST_PATH = "calendars/{calendarId}/events";
/**
* Returns events on the specified calendar.
*
* Create a request for the method "events.list".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link List#execute()} method to invoke the remote operation. <p>
* {@link List#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
* must be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @since 1.13
*/
protected List(java.lang.String calendarId) {
super(Calendar.this, "GET", REST_PATH, null, com.google.api.services.calendar.model.Events.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
}
@Override
public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException {
return super.executeUsingHead();
}
@Override
public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException {
return super.buildHttpRequestUsingHead();
}
@Override
public List setAlt(java.lang.String alt) {
return (List) super.setAlt(alt);
}
@Override
public List setFields(java.lang.String fields) {
return (List) super.setFields(fields);
}
@Override
public List setKey(java.lang.String key) {
return (List) super.setKey(key);
}
@Override
public List setOauthToken(java.lang.String oauthToken) {
return (List) super.setOauthToken(oauthToken);
}
@Override
public List setPrettyPrint(java.lang.Boolean prettyPrint) {
return (List) super.setPrettyPrint(prettyPrint);
}
@Override
public List setQuotaUser(java.lang.String quotaUser) {
return (List) super.setQuotaUser(quotaUser);
}
@Override
public List setUserIp(java.lang.String userIp) {
return (List) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public List setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
/**
* Whether to always include a value in the email field for the organizer, creator and
* attendees, even if no real email is available (i.e. a generated, non-working value will be
* provided). The use of this option is discouraged and should only be used by clients which
* cannot handle the absence of an email address value in the mentioned places. Optional. The
* default is False.
*/
@com.google.api.client.util.Key
private java.lang.Boolean alwaysIncludeEmail;
/** Whether to always include a value in the email field for the organizer, creator and attendees, even
if no real email is available (i.e. a generated, non-working value will be provided). The use of
this option is discouraged and should only be used by clients which cannot handle the absence of an
email address value in the mentioned places. Optional. The default is False.
*/
public java.lang.Boolean getAlwaysIncludeEmail() {
return alwaysIncludeEmail;
}
/**
* Whether to always include a value in the email field for the organizer, creator and
* attendees, even if no real email is available (i.e. a generated, non-working value will be
* provided). The use of this option is discouraged and should only be used by clients which
* cannot handle the absence of an email address value in the mentioned places. Optional. The
* default is False.
*/
public List setAlwaysIncludeEmail(java.lang.Boolean alwaysIncludeEmail) {
this.alwaysIncludeEmail = alwaysIncludeEmail;
return this;
}
/** Specifies event ID in the iCalendar format to be included in the response. Optional. */
@com.google.api.client.util.Key
private java.lang.String iCalUID;
/** Specifies event ID in the iCalendar format to be included in the response. Optional.
*/
public java.lang.String getICalUID() {
return iCalUID;
}
/** Specifies event ID in the iCalendar format to be included in the response. Optional. */
public List setICalUID(java.lang.String iCalUID) {
this.iCalUID = iCalUID;
return this;
}
/**
* The maximum number of attendees to include in the response. If there are more than the
* specified number of attendees, only the participant is returned. Optional.
*/
@com.google.api.client.util.Key
private java.lang.Integer maxAttendees;
/** The maximum number of attendees to include in the response. If there are more than the specified
number of attendees, only the participant is returned. Optional.
[minimum: 1]
*/
public java.lang.Integer getMaxAttendees() {
return maxAttendees;
}
/**
* The maximum number of attendees to include in the response. If there are more than the
* specified number of attendees, only the participant is returned. Optional.
*/
public List setMaxAttendees(java.lang.Integer maxAttendees) {
this.maxAttendees = maxAttendees;
return this;
}
/**
* Maximum number of events returned on one result page. The number of events in the resulting
* page may be less than this value, or none at all, even if there are more events matching
* the query. Incomplete pages can be detected by a non-empty nextPageToken field in the
* response. By default the value is 250 events. The page size can never be larger than 2500
* events. Optional.
*/
@com.google.api.client.util.Key
private java.lang.Integer maxResults;
/** Maximum number of events returned on one result page. The number of events in the resulting page
may be less than this value, or none at all, even if there are more events matching the query.
Incomplete pages can be detected by a non-empty nextPageToken field in the response. By default the
value is 250 events. The page size can never be larger than 2500 events. Optional. [default: 250]
[minimum: 1]
*/
public java.lang.Integer getMaxResults() {
return maxResults;
}
/**
* Maximum number of events returned on one result page. The number of events in the resulting
* page may be less than this value, or none at all, even if there are more events matching
* the query. Incomplete pages can be detected by a non-empty nextPageToken field in the
* response. By default the value is 250 events. The page size can never be larger than 2500
* events. Optional.
*/
public List setMaxResults(java.lang.Integer maxResults) {
this.maxResults = maxResults;
return this;
}
/**
* The order of the events returned in the result. Optional. The default is an unspecified,
* stable order.
*/
@com.google.api.client.util.Key
private java.lang.String orderBy;
/** The order of the events returned in the result. Optional. The default is an unspecified, stable
order.
*/
public java.lang.String getOrderBy() {
return orderBy;
}
/**
* The order of the events returned in the result. Optional. The default is an unspecified,
* stable order.
*/
public List setOrderBy(java.lang.String orderBy) {
this.orderBy = orderBy;
return this;
}
/** Token specifying which result page to return. Optional. */
@com.google.api.client.util.Key
private java.lang.String pageToken;
/** Token specifying which result page to return. Optional.
*/
public java.lang.String getPageToken() {
return pageToken;
}
/** Token specifying which result page to return. Optional. */
public List setPageToken(java.lang.String pageToken) {
this.pageToken = pageToken;
return this;
}
/**
* Extended properties constraint specified as propertyName=value. Matches only private
* properties. This parameter might be repeated multiple times to return events that match all
* given constraints.
*/
@com.google.api.client.util.Key
private java.util.List<java.lang.String> privateExtendedProperty;
/** Extended properties constraint specified as propertyName=value. Matches only private properties.
This parameter might be repeated multiple times to return events that match all given constraints.
*/
public java.util.List<java.lang.String> getPrivateExtendedProperty() {
return privateExtendedProperty;
}
/**
* Extended properties constraint specified as propertyName=value. Matches only private
* properties. This parameter might be repeated multiple times to return events that match all
* given constraints.
*/
public List setPrivateExtendedProperty(java.util.List<java.lang.String> privateExtendedProperty) {
this.privateExtendedProperty = privateExtendedProperty;
return this;
}
/**
* Free text search terms to find events that match these terms in any field, except for
* extended properties. Optional.
*/
@com.google.api.client.util.Key
private java.lang.String q;
/** Free text search terms to find events that match these terms in any field, except for extended
properties. Optional.
*/
public java.lang.String getQ() {
return q;
}
/**
* Free text search terms to find events that match these terms in any field, except for
* extended properties. Optional.
*/
public List setQ(java.lang.String q) {
this.q = q;
return this;
}
/**
* Extended properties constraint specified as propertyName=value. Matches only shared
* properties. This parameter might be repeated multiple times to return events that match all
* given constraints.
*/
@com.google.api.client.util.Key
private java.util.List<java.lang.String> sharedExtendedProperty;
/** Extended properties constraint specified as propertyName=value. Matches only shared properties.
This parameter might be repeated multiple times to return events that match all given constraints.
*/
public java.util.List<java.lang.String> getSharedExtendedProperty() {
return sharedExtendedProperty;
}
/**
* Extended properties constraint specified as propertyName=value. Matches only shared
* properties. This parameter might be repeated multiple times to return events that match all
* given constraints.
*/
public List setSharedExtendedProperty(java.util.List<java.lang.String> sharedExtendedProperty) {
this.sharedExtendedProperty = sharedExtendedProperty;
return this;
}
/**
* Whether to include deleted events (with status equals "cancelled") in the result. Cancelled
* instances of recurring events (but not the underlying recurring event) will still be
* included if showDeleted and singleEvents are both False. If showDeleted and singleEvents
* are both True, only single instances of deleted events (but not the underlying recurring
* events) are returned. Optional. The default is False.
*/
@com.google.api.client.util.Key
private java.lang.Boolean showDeleted;
/** Whether to include deleted events (with status equals "cancelled") in the result. Cancelled
instances of recurring events (but not the underlying recurring event) will still be included if
showDeleted and singleEvents are both False. If showDeleted and singleEvents are both True, only
single instances of deleted events (but not the underlying recurring events) are returned.
Optional. The default is False.
*/
public java.lang.Boolean getShowDeleted() {
return showDeleted;
}
/**
* Whether to include deleted events (with status equals "cancelled") in the result. Cancelled
* instances of recurring events (but not the underlying recurring event) will still be
* included if showDeleted and singleEvents are both False. If showDeleted and singleEvents
* are both True, only single instances of deleted events (but not the underlying recurring
* events) are returned. Optional. The default is False.
*/
public List setShowDeleted(java.lang.Boolean showDeleted) {
this.showDeleted = showDeleted;
return this;
}
/** Whether to include hidden invitations in the result. Optional. The default is False. */
@com.google.api.client.util.Key
private java.lang.Boolean showHiddenInvitations;
/** Whether to include hidden invitations in the result. Optional. The default is False.
*/
public java.lang.Boolean getShowHiddenInvitations() {
return showHiddenInvitations;
}
/** Whether to include hidden invitations in the result. Optional. The default is False. */
public List setShowHiddenInvitations(java.lang.Boolean showHiddenInvitations) {
this.showHiddenInvitations = showHiddenInvitations;
return this;
}
/**
* Whether to expand recurring events into instances and only return single one-off events and
* instances of recurring events, but not the underlying recurring events themselves.
* Optional. The default is False.
*/
@com.google.api.client.util.Key
private java.lang.Boolean singleEvents;
/** Whether to expand recurring events into instances and only return single one-off events and
instances of recurring events, but not the underlying recurring events themselves. Optional. The
default is False.
*/
public java.lang.Boolean getSingleEvents() {
return singleEvents;
}
/**
* Whether to expand recurring events into instances and only return single one-off events and
* instances of recurring events, but not the underlying recurring events themselves.
* Optional. The default is False.
*/
public List setSingleEvents(java.lang.Boolean singleEvents) {
this.singleEvents = singleEvents;
return this;
}
/**
* Token obtained from the nextSyncToken field returned on the last page of results from the
* previous list request. It makes the result of this list request contain only entries that
* have changed since then. All events deleted since the previous list request will always be
* in the result set and it is not allowed to set showDeleted to False. There are several
* query parameters that cannot be specified together with nextSyncToken to ensure consistency
* of the client state.
*
* These are: - iCalUID - orderBy - privateExtendedProperty - q - sharedExtendedProperty -
* timeMin - timeMax - updatedMin If the syncToken expires, the server will respond with a 410
* GONE response code and the client should clear its storage and perform a full
* synchronization without any syncToken. Learn more about incremental synchronization.
* Optional. The default is to return all entries.
*/
@com.google.api.client.util.Key
private java.lang.String syncToken;
/** Token obtained from the nextSyncToken field returned on the last page of results from the previous
list request. It makes the result of this list request contain only entries that have changed since
then. All events deleted since the previous list request will always be in the result set and it is
not allowed to set showDeleted to False. There are several query parameters that cannot be
specified together with nextSyncToken to ensure consistency of the client state.
These are: - iCalUID - orderBy - privateExtendedProperty - q - sharedExtendedProperty - timeMin -
timeMax - updatedMin If the syncToken expires, the server will respond with a 410 GONE response
code and the client should clear its storage and perform a full synchronization without any
syncToken. Learn more about incremental synchronization. Optional. The default is to return all
entries.
*/
public java.lang.String getSyncToken() {
return syncToken;
}
/**
* Token obtained from the nextSyncToken field returned on the last page of results from the
* previous list request. It makes the result of this list request contain only entries that
* have changed since then. All events deleted since the previous list request will always be
* in the result set and it is not allowed to set showDeleted to False. There are several
* query parameters that cannot be specified together with nextSyncToken to ensure consistency
* of the client state.
*
* These are: - iCalUID - orderBy - privateExtendedProperty - q - sharedExtendedProperty -
* timeMin - timeMax - updatedMin If the syncToken expires, the server will respond with a 410
* GONE response code and the client should clear its storage and perform a full
* synchronization without any syncToken. Learn more about incremental synchronization.
* Optional. The default is to return all entries.
*/
public List setSyncToken(java.lang.String syncToken) {
this.syncToken = syncToken;
return this;
}
/**
* Upper bound (exclusive) for an event's start time to filter by. Optional. The default is
* not to filter by start time. Must be an RFC3339 timestamp with mandatory time zone offset,
* for example, 2011-06-03T10:00:00-07:00, 2011-06-03T10:00:00Z. Milliseconds may be provided
* but are ignored. If timeMin is set, timeMax must be greater than timeMin.
*/
@com.google.api.client.util.Key
private com.google.api.client.util.DateTime timeMax;
/** Upper bound (exclusive) for an event's start time to filter by. Optional. The default is not to
filter by start time. Must be an RFC3339 timestamp with mandatory time zone offset, for example,
2011-06-03T10:00:00-07:00, 2011-06-03T10:00:00Z. Milliseconds may be provided but are ignored. If
timeMin is set, timeMax must be greater than timeMin.
*/
public com.google.api.client.util.DateTime getTimeMax() {
return timeMax;
}
/**
* Upper bound (exclusive) for an event's start time to filter by. Optional. The default is
* not to filter by start time. Must be an RFC3339 timestamp with mandatory time zone offset,
* for example, 2011-06-03T10:00:00-07:00, 2011-06-03T10:00:00Z. Milliseconds may be provided
* but are ignored. If timeMin is set, timeMax must be greater than timeMin.
*/
public List setTimeMax(com.google.api.client.util.DateTime timeMax) {
this.timeMax = timeMax;
return this;
}
/**
* Lower bound (exclusive) for an event's end time to filter by. Optional. The default is not
* to filter by end time. Must be an RFC3339 timestamp with mandatory time zone offset, for
* example, 2011-06-03T10:00:00-07:00, 2011-06-03T10:00:00Z. Milliseconds may be provided but
* are ignored. If timeMax is set, timeMin must be smaller than timeMax.
*/
@com.google.api.client.util.Key
private com.google.api.client.util.DateTime timeMin;
/** Lower bound (exclusive) for an event's end time to filter by. Optional. The default is not to
filter by end time. Must be an RFC3339 timestamp with mandatory time zone offset, for example,
2011-06-03T10:00:00-07:00, 2011-06-03T10:00:00Z. Milliseconds may be provided but are ignored. If
timeMax is set, timeMin must be smaller than timeMax.
*/
public com.google.api.client.util.DateTime getTimeMin() {
return timeMin;
}
/**
* Lower bound (exclusive) for an event's end time to filter by. Optional. The default is not
* to filter by end time. Must be an RFC3339 timestamp with mandatory time zone offset, for
* example, 2011-06-03T10:00:00-07:00, 2011-06-03T10:00:00Z. Milliseconds may be provided but
* are ignored. If timeMax is set, timeMin must be smaller than timeMax.
*/
public List setTimeMin(com.google.api.client.util.DateTime timeMin) {
this.timeMin = timeMin;
return this;
}
/**
* Time zone used in the response. Optional. The default is the time zone of the calendar.
*/
@com.google.api.client.util.Key
private java.lang.String timeZone;
/** Time zone used in the response. Optional. The default is the time zone of the calendar.
*/
public java.lang.String getTimeZone() {
return timeZone;
}
/**
* Time zone used in the response. Optional. The default is the time zone of the calendar.
*/
public List setTimeZone(java.lang.String timeZone) {
this.timeZone = timeZone;
return this;
}
/**
* Lower bound for an event's last modification time (as a RFC3339 timestamp) to filter by.
* When specified, entries deleted since this time will always be included regardless of
* showDeleted. Optional. The default is not to filter by last modification time.
*/
@com.google.api.client.util.Key
private com.google.api.client.util.DateTime updatedMin;
/** Lower bound for an event's last modification time (as a RFC3339 timestamp) to filter by. When
specified, entries deleted since this time will always be included regardless of showDeleted.
Optional. The default is not to filter by last modification time.
*/
public com.google.api.client.util.DateTime getUpdatedMin() {
return updatedMin;
}
/**
* Lower bound for an event's last modification time (as a RFC3339 timestamp) to filter by.
* When specified, entries deleted since this time will always be included regardless of
* showDeleted. Optional. The default is not to filter by last modification time.
*/
public List setUpdatedMin(com.google.api.client.util.DateTime updatedMin) {
this.updatedMin = updatedMin;
return this;
}
@Override
public List set(String parameterName, Object value) {
return (List) super.set(parameterName, value);
}
}
/**
* Moves an event to another calendar, i.e. changes an event's organizer.
*
* Create a request for the method "events.move".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Move#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier of the source calendar where the event currently is on.
* @param eventId Event identifier.
* @param destination Calendar identifier of the target calendar where the event is to be moved to.
* @return the request
*/
public Move move(java.lang.String calendarId, java.lang.String eventId, java.lang.String destination) throws java.io.IOException {
Move result = new Move(calendarId, eventId, destination);
initialize(result);
return result;
}
public class Move extends CalendarRequest<com.google.api.services.calendar.model.Event> {
private static final String REST_PATH = "calendars/{calendarId}/events/{eventId}/move";
/**
* Moves an event to another calendar, i.e. changes an event's organizer.
*
* Create a request for the method "events.move".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Move#execute()} method to invoke the remote operation. <p>
* {@link Move#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
* must be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier of the source calendar where the event currently is on.
* @param eventId Event identifier.
* @param destination Calendar identifier of the target calendar where the event is to be moved to.
* @since 1.13
*/
protected Move(java.lang.String calendarId, java.lang.String eventId, java.lang.String destination) {
super(Calendar.this, "POST", REST_PATH, null, com.google.api.services.calendar.model.Event.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
this.eventId = com.google.api.client.util.Preconditions.checkNotNull(eventId, "Required parameter eventId must be specified.");
this.destination = com.google.api.client.util.Preconditions.checkNotNull(destination, "Required parameter destination must be specified.");
}
@Override
public Move setAlt(java.lang.String alt) {
return (Move) super.setAlt(alt);
}
@Override
public Move setFields(java.lang.String fields) {
return (Move) super.setFields(fields);
}
@Override
public Move setKey(java.lang.String key) {
return (Move) super.setKey(key);
}
@Override
public Move setOauthToken(java.lang.String oauthToken) {
return (Move) super.setOauthToken(oauthToken);
}
@Override
public Move setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Move) super.setPrettyPrint(prettyPrint);
}
@Override
public Move setQuotaUser(java.lang.String quotaUser) {
return (Move) super.setQuotaUser(quotaUser);
}
@Override
public Move setUserIp(java.lang.String userIp) {
return (Move) super.setUserIp(userIp);
}
/** Calendar identifier of the source calendar where the event currently is on. */
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier of the source calendar where the event currently is on.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/** Calendar identifier of the source calendar where the event currently is on. */
public Move setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
/** Event identifier. */
@com.google.api.client.util.Key
private java.lang.String eventId;
/** Event identifier.
*/
public java.lang.String getEventId() {
return eventId;
}
/** Event identifier. */
public Move setEventId(java.lang.String eventId) {
this.eventId = eventId;
return this;
}
/** Calendar identifier of the target calendar where the event is to be moved to. */
@com.google.api.client.util.Key
private java.lang.String destination;
/** Calendar identifier of the target calendar where the event is to be moved to.
*/
public java.lang.String getDestination() {
return destination;
}
/** Calendar identifier of the target calendar where the event is to be moved to. */
public Move setDestination(java.lang.String destination) {
this.destination = destination;
return this;
}
/**
* Deprecated. Please use sendUpdates instead.
*
* Whether to send notifications about the change of the event's organizer. Note that some
* emails might still be sent even if you set the value to false. The default is false.
*/
@com.google.api.client.util.Key
private java.lang.Boolean sendNotifications;
/** Deprecated. Please use sendUpdates instead.
Whether to send notifications about the change of the event's organizer. Note that some emails
might still be sent even if you set the value to false. The default is false.
*/
public java.lang.Boolean getSendNotifications() {
return sendNotifications;
}
/**
* Deprecated. Please use sendUpdates instead.
*
* Whether to send notifications about the change of the event's organizer. Note that some
* emails might still be sent even if you set the value to false. The default is false.
*/
public Move setSendNotifications(java.lang.Boolean sendNotifications) {
this.sendNotifications = sendNotifications;
return this;
}
/** Guests who should receive notifications about the change of the event's organizer. */
@com.google.api.client.util.Key
private java.lang.String sendUpdates;
/** Guests who should receive notifications about the change of the event's organizer.
*/
public java.lang.String getSendUpdates() {
return sendUpdates;
}
/** Guests who should receive notifications about the change of the event's organizer. */
public Move setSendUpdates(java.lang.String sendUpdates) {
this.sendUpdates = sendUpdates;
return this;
}
@Override
public Move set(String parameterName, Object value) {
return (Move) super.set(parameterName, value);
}
}
/**
* Updates an event. This method supports patch semantics.
*
* Create a request for the method "events.patch".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Patch#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param eventId Event identifier.
* @param content the {@link com.google.api.services.calendar.model.Event}
* @return the request
*/
public Patch patch(java.lang.String calendarId, java.lang.String eventId, com.google.api.services.calendar.model.Event content) throws java.io.IOException {
Patch result = new Patch(calendarId, eventId, content);
initialize(result);
return result;
}
public class Patch extends CalendarRequest<com.google.api.services.calendar.model.Event> {
private static final String REST_PATH = "calendars/{calendarId}/events/{eventId}";
/**
* Updates an event. This method supports patch semantics.
*
* Create a request for the method "events.patch".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Patch#execute()} method to invoke the remote operation.
* <p> {@link
* Patch#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param eventId Event identifier.
* @param content the {@link com.google.api.services.calendar.model.Event}
* @since 1.13
*/
protected Patch(java.lang.String calendarId, java.lang.String eventId, com.google.api.services.calendar.model.Event content) {
super(Calendar.this, "PATCH", REST_PATH, content, com.google.api.services.calendar.model.Event.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
this.eventId = com.google.api.client.util.Preconditions.checkNotNull(eventId, "Required parameter eventId must be specified.");
}
@Override
public Patch setAlt(java.lang.String alt) {
return (Patch) super.setAlt(alt);
}
@Override
public Patch setFields(java.lang.String fields) {
return (Patch) super.setFields(fields);
}
@Override
public Patch setKey(java.lang.String key) {
return (Patch) super.setKey(key);
}
@Override
public Patch setOauthToken(java.lang.String oauthToken) {
return (Patch) super.setOauthToken(oauthToken);
}
@Override
public Patch setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Patch) super.setPrettyPrint(prettyPrint);
}
@Override
public Patch setQuotaUser(java.lang.String quotaUser) {
return (Patch) super.setQuotaUser(quotaUser);
}
@Override
public Patch setUserIp(java.lang.String userIp) {
return (Patch) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public Patch setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
/** Event identifier. */
@com.google.api.client.util.Key
private java.lang.String eventId;
/** Event identifier.
*/
public java.lang.String getEventId() {
return eventId;
}
/** Event identifier. */
public Patch setEventId(java.lang.String eventId) {
this.eventId = eventId;
return this;
}
/**
* Whether to always include a value in the email field for the organizer, creator and
* attendees, even if no real email is available (i.e. a generated, non-working value will be
* provided). The use of this option is discouraged and should only be used by clients which
* cannot handle the absence of an email address value in the mentioned places. Optional. The
* default is False.
*/
@com.google.api.client.util.Key
private java.lang.Boolean alwaysIncludeEmail;
/** Whether to always include a value in the email field for the organizer, creator and attendees, even
if no real email is available (i.e. a generated, non-working value will be provided). The use of
this option is discouraged and should only be used by clients which cannot handle the absence of an
email address value in the mentioned places. Optional. The default is False.
*/
public java.lang.Boolean getAlwaysIncludeEmail() {
return alwaysIncludeEmail;
}
/**
* Whether to always include a value in the email field for the organizer, creator and
* attendees, even if no real email is available (i.e. a generated, non-working value will be
* provided). The use of this option is discouraged and should only be used by clients which
* cannot handle the absence of an email address value in the mentioned places. Optional. The
* default is False.
*/
public Patch setAlwaysIncludeEmail(java.lang.Boolean alwaysIncludeEmail) {
this.alwaysIncludeEmail = alwaysIncludeEmail;
return this;
}
/**
* Version number of conference data supported by the API client. Version 0 assumes no
* conference data support and ignores conference data in the event's body. Version 1 enables
* support for copying of ConferenceData as well as for creating new conferences using the
* createRequest field of conferenceData. The default is 0.
*/
@com.google.api.client.util.Key
private java.lang.Integer conferenceDataVersion;
/** Version number of conference data supported by the API client. Version 0 assumes no conference data
support and ignores conference data in the event's body. Version 1 enables support for copying of
ConferenceData as well as for creating new conferences using the createRequest field of
conferenceData. The default is 0.
[minimum: 0] [maximum: 1]
*/
public java.lang.Integer getConferenceDataVersion() {
return conferenceDataVersion;
}
/**
* Version number of conference data supported by the API client. Version 0 assumes no
* conference data support and ignores conference data in the event's body. Version 1 enables
* support for copying of ConferenceData as well as for creating new conferences using the
* createRequest field of conferenceData. The default is 0.
*/
public Patch setConferenceDataVersion(java.lang.Integer conferenceDataVersion) {
this.conferenceDataVersion = conferenceDataVersion;
return this;
}
/**
* The maximum number of attendees to include in the response. If there are more than the
* specified number of attendees, only the participant is returned. Optional.
*/
@com.google.api.client.util.Key
private java.lang.Integer maxAttendees;
/** The maximum number of attendees to include in the response. If there are more than the specified
number of attendees, only the participant is returned. Optional.
[minimum: 1]
*/
public java.lang.Integer getMaxAttendees() {
return maxAttendees;
}
/**
* The maximum number of attendees to include in the response. If there are more than the
* specified number of attendees, only the participant is returned. Optional.
*/
public Patch setMaxAttendees(java.lang.Integer maxAttendees) {
this.maxAttendees = maxAttendees;
return this;
}
/**
* Deprecated. Please use sendUpdates instead.
*
* Whether to send notifications about the event update (for example, description changes,
* etc.). Note that some emails might still be sent even if you set the value to false. The
* default is false.
*/
@com.google.api.client.util.Key
private java.lang.Boolean sendNotifications;
/** Deprecated. Please use sendUpdates instead.
Whether to send notifications about the event update (for example, description changes, etc.). Note
that some emails might still be sent even if you set the value to false. The default is false.
*/
public java.lang.Boolean getSendNotifications() {
return sendNotifications;
}
/**
* Deprecated. Please use sendUpdates instead.
*
* Whether to send notifications about the event update (for example, description changes,
* etc.). Note that some emails might still be sent even if you set the value to false. The
* default is false.
*/
public Patch setSendNotifications(java.lang.Boolean sendNotifications) {
this.sendNotifications = sendNotifications;
return this;
}
/**
* Guests who should receive notifications about the event update (for example, title changes,
* etc.).
*/
@com.google.api.client.util.Key
private java.lang.String sendUpdates;
/** Guests who should receive notifications about the event update (for example, title changes, etc.).
*/
public java.lang.String getSendUpdates() {
return sendUpdates;
}
/**
* Guests who should receive notifications about the event update (for example, title changes,
* etc.).
*/
public Patch setSendUpdates(java.lang.String sendUpdates) {
this.sendUpdates = sendUpdates;
return this;
}
/**
* Whether API client performing operation supports event attachments. Optional. The default
* is False.
*/
@com.google.api.client.util.Key
private java.lang.Boolean supportsAttachments;
/** Whether API client performing operation supports event attachments. Optional. The default is False.
*/
public java.lang.Boolean getSupportsAttachments() {
return supportsAttachments;
}
/**
* Whether API client performing operation supports event attachments. Optional. The default
* is False.
*/
public Patch setSupportsAttachments(java.lang.Boolean supportsAttachments) {
this.supportsAttachments = supportsAttachments;
return this;
}
@Override
public Patch set(String parameterName, Object value) {
return (Patch) super.set(parameterName, value);
}
}
/**
* Creates an event based on a simple text string.
*
* Create a request for the method "events.quickAdd".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link QuickAdd#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param text The text describing the event to be created.
* @return the request
*/
public QuickAdd quickAdd(java.lang.String calendarId, java.lang.String text) throws java.io.IOException {
QuickAdd result = new QuickAdd(calendarId, text);
initialize(result);
return result;
}
public class QuickAdd extends CalendarRequest<com.google.api.services.calendar.model.Event> {
private static final String REST_PATH = "calendars/{calendarId}/events/quickAdd";
/**
* Creates an event based on a simple text string.
*
* Create a request for the method "events.quickAdd".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link QuickAdd#execute()} method to invoke the remote operation.
* <p> {@link
* QuickAdd#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
* must be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param text The text describing the event to be created.
* @since 1.13
*/
protected QuickAdd(java.lang.String calendarId, java.lang.String text) {
super(Calendar.this, "POST", REST_PATH, null, com.google.api.services.calendar.model.Event.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
this.text = com.google.api.client.util.Preconditions.checkNotNull(text, "Required parameter text must be specified.");
}
@Override
public QuickAdd setAlt(java.lang.String alt) {
return (QuickAdd) super.setAlt(alt);
}
@Override
public QuickAdd setFields(java.lang.String fields) {
return (QuickAdd) super.setFields(fields);
}
@Override
public QuickAdd setKey(java.lang.String key) {
return (QuickAdd) super.setKey(key);
}
@Override
public QuickAdd setOauthToken(java.lang.String oauthToken) {
return (QuickAdd) super.setOauthToken(oauthToken);
}
@Override
public QuickAdd setPrettyPrint(java.lang.Boolean prettyPrint) {
return (QuickAdd) super.setPrettyPrint(prettyPrint);
}
@Override
public QuickAdd setQuotaUser(java.lang.String quotaUser) {
return (QuickAdd) super.setQuotaUser(quotaUser);
}
@Override
public QuickAdd setUserIp(java.lang.String userIp) {
return (QuickAdd) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public QuickAdd setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
/** The text describing the event to be created. */
@com.google.api.client.util.Key
private java.lang.String text;
/** The text describing the event to be created.
*/
public java.lang.String getText() {
return text;
}
/** The text describing the event to be created. */
public QuickAdd setText(java.lang.String text) {
this.text = text;
return this;
}
/**
* Deprecated. Please use sendUpdates instead.
*
* Whether to send notifications about the creation of the event. Note that some emails might
* still be sent even if you set the value to false. The default is false.
*/
@com.google.api.client.util.Key
private java.lang.Boolean sendNotifications;
/** Deprecated. Please use sendUpdates instead.
Whether to send notifications about the creation of the event. Note that some emails might still be
sent even if you set the value to false. The default is false.
*/
public java.lang.Boolean getSendNotifications() {
return sendNotifications;
}
/**
* Deprecated. Please use sendUpdates instead.
*
* Whether to send notifications about the creation of the event. Note that some emails might
* still be sent even if you set the value to false. The default is false.
*/
public QuickAdd setSendNotifications(java.lang.Boolean sendNotifications) {
this.sendNotifications = sendNotifications;
return this;
}
/** Guests who should receive notifications about the creation of the new event. */
@com.google.api.client.util.Key
private java.lang.String sendUpdates;
/** Guests who should receive notifications about the creation of the new event.
*/
public java.lang.String getSendUpdates() {
return sendUpdates;
}
/** Guests who should receive notifications about the creation of the new event. */
public QuickAdd setSendUpdates(java.lang.String sendUpdates) {
this.sendUpdates = sendUpdates;
return this;
}
@Override
public QuickAdd set(String parameterName, Object value) {
return (QuickAdd) super.set(parameterName, value);
}
}
/**
* Updates an event.
*
* Create a request for the method "events.update".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Update#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param eventId Event identifier.
* @param content the {@link com.google.api.services.calendar.model.Event}
* @return the request
*/
public Update update(java.lang.String calendarId, java.lang.String eventId, com.google.api.services.calendar.model.Event content) throws java.io.IOException {
Update result = new Update(calendarId, eventId, content);
initialize(result);
return result;
}
public class Update extends CalendarRequest<com.google.api.services.calendar.model.Event> {
private static final String REST_PATH = "calendars/{calendarId}/events/{eventId}";
/**
* Updates an event.
*
* Create a request for the method "events.update".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Update#execute()} method to invoke the remote operation.
* <p> {@link
* Update#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param eventId Event identifier.
* @param content the {@link com.google.api.services.calendar.model.Event}
* @since 1.13
*/
protected Update(java.lang.String calendarId, java.lang.String eventId, com.google.api.services.calendar.model.Event content) {
super(Calendar.this, "PUT", REST_PATH, content, com.google.api.services.calendar.model.Event.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
this.eventId = com.google.api.client.util.Preconditions.checkNotNull(eventId, "Required parameter eventId must be specified.");
}
@Override
public Update setAlt(java.lang.String alt) {
return (Update) super.setAlt(alt);
}
@Override
public Update setFields(java.lang.String fields) {
return (Update) super.setFields(fields);
}
@Override
public Update setKey(java.lang.String key) {
return (Update) super.setKey(key);
}
@Override
public Update setOauthToken(java.lang.String oauthToken) {
return (Update) super.setOauthToken(oauthToken);
}
@Override
public Update setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Update) super.setPrettyPrint(prettyPrint);
}
@Override
public Update setQuotaUser(java.lang.String quotaUser) {
return (Update) super.setQuotaUser(quotaUser);
}
@Override
public Update setUserIp(java.lang.String userIp) {
return (Update) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public Update setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
/** Event identifier. */
@com.google.api.client.util.Key
private java.lang.String eventId;
/** Event identifier.
*/
public java.lang.String getEventId() {
return eventId;
}
/** Event identifier. */
public Update setEventId(java.lang.String eventId) {
this.eventId = eventId;
return this;
}
/**
* Whether to always include a value in the email field for the organizer, creator and
* attendees, even if no real email is available (i.e. a generated, non-working value will be
* provided). The use of this option is discouraged and should only be used by clients which
* cannot handle the absence of an email address value in the mentioned places. Optional. The
* default is False.
*/
@com.google.api.client.util.Key
private java.lang.Boolean alwaysIncludeEmail;
/** Whether to always include a value in the email field for the organizer, creator and attendees, even
if no real email is available (i.e. a generated, non-working value will be provided). The use of
this option is discouraged and should only be used by clients which cannot handle the absence of an
email address value in the mentioned places. Optional. The default is False.
*/
public java.lang.Boolean getAlwaysIncludeEmail() {
return alwaysIncludeEmail;
}
/**
* Whether to always include a value in the email field for the organizer, creator and
* attendees, even if no real email is available (i.e. a generated, non-working value will be
* provided). The use of this option is discouraged and should only be used by clients which
* cannot handle the absence of an email address value in the mentioned places. Optional. The
* default is False.
*/
public Update setAlwaysIncludeEmail(java.lang.Boolean alwaysIncludeEmail) {
this.alwaysIncludeEmail = alwaysIncludeEmail;
return this;
}
/**
* Version number of conference data supported by the API client. Version 0 assumes no
* conference data support and ignores conference data in the event's body. Version 1 enables
* support for copying of ConferenceData as well as for creating new conferences using the
* createRequest field of conferenceData. The default is 0.
*/
@com.google.api.client.util.Key
private java.lang.Integer conferenceDataVersion;
/** Version number of conference data supported by the API client. Version 0 assumes no conference data
support and ignores conference data in the event's body. Version 1 enables support for copying of
ConferenceData as well as for creating new conferences using the createRequest field of
conferenceData. The default is 0.
[minimum: 0] [maximum: 1]
*/
public java.lang.Integer getConferenceDataVersion() {
return conferenceDataVersion;
}
/**
* Version number of conference data supported by the API client. Version 0 assumes no
* conference data support and ignores conference data in the event's body. Version 1 enables
* support for copying of ConferenceData as well as for creating new conferences using the
* createRequest field of conferenceData. The default is 0.
*/
public Update setConferenceDataVersion(java.lang.Integer conferenceDataVersion) {
this.conferenceDataVersion = conferenceDataVersion;
return this;
}
/**
* The maximum number of attendees to include in the response. If there are more than the
* specified number of attendees, only the participant is returned. Optional.
*/
@com.google.api.client.util.Key
private java.lang.Integer maxAttendees;
/** The maximum number of attendees to include in the response. If there are more than the specified
number of attendees, only the participant is returned. Optional.
[minimum: 1]
*/
public java.lang.Integer getMaxAttendees() {
return maxAttendees;
}
/**
* The maximum number of attendees to include in the response. If there are more than the
* specified number of attendees, only the participant is returned. Optional.
*/
public Update setMaxAttendees(java.lang.Integer maxAttendees) {
this.maxAttendees = maxAttendees;
return this;
}
/**
* Deprecated. Please use sendUpdates instead.
*
* Whether to send notifications about the event update (for example, description changes,
* etc.). Note that some emails might still be sent even if you set the value to false. The
* default is false.
*/
@com.google.api.client.util.Key
private java.lang.Boolean sendNotifications;
/** Deprecated. Please use sendUpdates instead.
Whether to send notifications about the event update (for example, description changes, etc.). Note
that some emails might still be sent even if you set the value to false. The default is false.
*/
public java.lang.Boolean getSendNotifications() {
return sendNotifications;
}
/**
* Deprecated. Please use sendUpdates instead.
*
* Whether to send notifications about the event update (for example, description changes,
* etc.). Note that some emails might still be sent even if you set the value to false. The
* default is false.
*/
public Update setSendNotifications(java.lang.Boolean sendNotifications) {
this.sendNotifications = sendNotifications;
return this;
}
/**
* Guests who should receive notifications about the event update (for example, title changes,
* etc.).
*/
@com.google.api.client.util.Key
private java.lang.String sendUpdates;
/** Guests who should receive notifications about the event update (for example, title changes, etc.).
*/
public java.lang.String getSendUpdates() {
return sendUpdates;
}
/**
* Guests who should receive notifications about the event update (for example, title changes,
* etc.).
*/
public Update setSendUpdates(java.lang.String sendUpdates) {
this.sendUpdates = sendUpdates;
return this;
}
/**
* Whether API client performing operation supports event attachments. Optional. The default
* is False.
*/
@com.google.api.client.util.Key
private java.lang.Boolean supportsAttachments;
/** Whether API client performing operation supports event attachments. Optional. The default is False.
*/
public java.lang.Boolean getSupportsAttachments() {
return supportsAttachments;
}
/**
* Whether API client performing operation supports event attachments. Optional. The default
* is False.
*/
public Update setSupportsAttachments(java.lang.Boolean supportsAttachments) {
this.supportsAttachments = supportsAttachments;
return this;
}
@Override
public Update set(String parameterName, Object value) {
return (Update) super.set(parameterName, value);
}
}
/**
* Watch for changes to Events resources.
*
* Create a request for the method "events.watch".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Watch#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param content the {@link com.google.api.services.calendar.model.Channel}
* @return the request
*/
public Watch watch(java.lang.String calendarId, com.google.api.services.calendar.model.Channel content) throws java.io.IOException {
Watch result = new Watch(calendarId, content);
initialize(result);
return result;
}
public class Watch extends CalendarRequest<com.google.api.services.calendar.model.Channel> {
private static final String REST_PATH = "calendars/{calendarId}/events/watch";
/**
* Watch for changes to Events resources.
*
* Create a request for the method "events.watch".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Watch#execute()} method to invoke the remote operation.
* <p> {@link
* Watch#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param content the {@link com.google.api.services.calendar.model.Channel}
* @since 1.13
*/
protected Watch(java.lang.String calendarId, com.google.api.services.calendar.model.Channel content) {
super(Calendar.this, "POST", REST_PATH, content, com.google.api.services.calendar.model.Channel.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
}
@Override
public Watch setAlt(java.lang.String alt) {
return (Watch) super.setAlt(alt);
}
@Override
public Watch setFields(java.lang.String fields) {
return (Watch) super.setFields(fields);
}
@Override
public Watch setKey(java.lang.String key) {
return (Watch) super.setKey(key);
}
@Override
public Watch setOauthToken(java.lang.String oauthToken) {
return (Watch) super.setOauthToken(oauthToken);
}
@Override
public Watch setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Watch) super.setPrettyPrint(prettyPrint);
}
@Override
public Watch setQuotaUser(java.lang.String quotaUser) {
return (Watch) super.setQuotaUser(quotaUser);
}
@Override
public Watch setUserIp(java.lang.String userIp) {
return (Watch) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public Watch setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
/**
* Whether to always include a value in the email field for the organizer, creator and
* attendees, even if no real email is available (i.e. a generated, non-working value will be
* provided). The use of this option is discouraged and should only be used by clients which
* cannot handle the absence of an email address value in the mentioned places. Optional. The
* default is False.
*/
@com.google.api.client.util.Key
private java.lang.Boolean alwaysIncludeEmail;
/** Whether to always include a value in the email field for the organizer, creator and attendees, even
if no real email is available (i.e. a generated, non-working value will be provided). The use of
this option is discouraged and should only be used by clients which cannot handle the absence of an
email address value in the mentioned places. Optional. The default is False.
*/
public java.lang.Boolean getAlwaysIncludeEmail() {
return alwaysIncludeEmail;
}
/**
* Whether to always include a value in the email field for the organizer, creator and
* attendees, even if no real email is available (i.e. a generated, non-working value will be
* provided). The use of this option is discouraged and should only be used by clients which
* cannot handle the absence of an email address value in the mentioned places. Optional. The
* default is False.
*/
public Watch setAlwaysIncludeEmail(java.lang.Boolean alwaysIncludeEmail) {
this.alwaysIncludeEmail = alwaysIncludeEmail;
return this;
}
/** Specifies event ID in the iCalendar format to be included in the response. Optional. */
@com.google.api.client.util.Key
private java.lang.String iCalUID;
/** Specifies event ID in the iCalendar format to be included in the response. Optional.
*/
public java.lang.String getICalUID() {
return iCalUID;
}
/** Specifies event ID in the iCalendar format to be included in the response. Optional. */
public Watch setICalUID(java.lang.String iCalUID) {
this.iCalUID = iCalUID;
return this;
}
/**
* The maximum number of attendees to include in the response. If there are more than the
* specified number of attendees, only the participant is returned. Optional.
*/
@com.google.api.client.util.Key
private java.lang.Integer maxAttendees;
/** The maximum number of attendees to include in the response. If there are more than the specified
number of attendees, only the participant is returned. Optional.
[minimum: 1]
*/
public java.lang.Integer getMaxAttendees() {
return maxAttendees;
}
/**
* The maximum number of attendees to include in the response. If there are more than the
* specified number of attendees, only the participant is returned. Optional.
*/
public Watch setMaxAttendees(java.lang.Integer maxAttendees) {
this.maxAttendees = maxAttendees;
return this;
}
/**
* Maximum number of events returned on one result page. The number of events in the resulting
* page may be less than this value, or none at all, even if there are more events matching
* the query. Incomplete pages can be detected by a non-empty nextPageToken field in the
* response. By default the value is 250 events. The page size can never be larger than 2500
* events. Optional.
*/
@com.google.api.client.util.Key
private java.lang.Integer maxResults;
/** Maximum number of events returned on one result page. The number of events in the resulting page
may be less than this value, or none at all, even if there are more events matching the query.
Incomplete pages can be detected by a non-empty nextPageToken field in the response. By default the
value is 250 events. The page size can never be larger than 2500 events. Optional. [default: 250]
[minimum: 1]
*/
public java.lang.Integer getMaxResults() {
return maxResults;
}
/**
* Maximum number of events returned on one result page. The number of events in the resulting
* page may be less than this value, or none at all, even if there are more events matching
* the query. Incomplete pages can be detected by a non-empty nextPageToken field in the
* response. By default the value is 250 events. The page size can never be larger than 2500
* events. Optional.
*/
public Watch setMaxResults(java.lang.Integer maxResults) {
this.maxResults = maxResults;
return this;
}
/**
* The order of the events returned in the result. Optional. The default is an unspecified,
* stable order.
*/
@com.google.api.client.util.Key
private java.lang.String orderBy;
/** The order of the events returned in the result. Optional. The default is an unspecified, stable
order.
*/
public java.lang.String getOrderBy() {
return orderBy;
}
/**
* The order of the events returned in the result. Optional. The default is an unspecified,
* stable order.
*/
public Watch setOrderBy(java.lang.String orderBy) {
this.orderBy = orderBy;
return this;
}
/** Token specifying which result page to return. Optional. */
@com.google.api.client.util.Key
private java.lang.String pageToken;
/** Token specifying which result page to return. Optional.
*/
public java.lang.String getPageToken() {
return pageToken;
}
/** Token specifying which result page to return. Optional. */
public Watch setPageToken(java.lang.String pageToken) {
this.pageToken = pageToken;
return this;
}
/**
* Extended properties constraint specified as propertyName=value. Matches only private
* properties. This parameter might be repeated multiple times to return events that match all
* given constraints.
*/
@com.google.api.client.util.Key
private java.util.List<java.lang.String> privateExtendedProperty;
/** Extended properties constraint specified as propertyName=value. Matches only private properties.
This parameter might be repeated multiple times to return events that match all given constraints.
*/
public java.util.List<java.lang.String> getPrivateExtendedProperty() {
return privateExtendedProperty;
}
/**
* Extended properties constraint specified as propertyName=value. Matches only private
* properties. This parameter might be repeated multiple times to return events that match all
* given constraints.
*/
public Watch setPrivateExtendedProperty(java.util.List<java.lang.String> privateExtendedProperty) {
this.privateExtendedProperty = privateExtendedProperty;
return this;
}
/**
* Free text search terms to find events that match these terms in any field, except for
* extended properties. Optional.
*/
@com.google.api.client.util.Key
private java.lang.String q;
/** Free text search terms to find events that match these terms in any field, except for extended
properties. Optional.
*/
public java.lang.String getQ() {
return q;
}
/**
* Free text search terms to find events that match these terms in any field, except for
* extended properties. Optional.
*/
public Watch setQ(java.lang.String q) {
this.q = q;
return this;
}
/**
* Extended properties constraint specified as propertyName=value. Matches only shared
* properties. This parameter might be repeated multiple times to return events that match all
* given constraints.
*/
@com.google.api.client.util.Key
private java.util.List<java.lang.String> sharedExtendedProperty;
/** Extended properties constraint specified as propertyName=value. Matches only shared properties.
This parameter might be repeated multiple times to return events that match all given constraints.
*/
public java.util.List<java.lang.String> getSharedExtendedProperty() {
return sharedExtendedProperty;
}
/**
* Extended properties constraint specified as propertyName=value. Matches only shared
* properties. This parameter might be repeated multiple times to return events that match all
* given constraints.
*/
public Watch setSharedExtendedProperty(java.util.List<java.lang.String> sharedExtendedProperty) {
this.sharedExtendedProperty = sharedExtendedProperty;
return this;
}
/**
* Whether to include deleted events (with status equals "cancelled") in the result. Cancelled
* instances of recurring events (but not the underlying recurring event) will still be
* included if showDeleted and singleEvents are both False. If showDeleted and singleEvents
* are both True, only single instances of deleted events (but not the underlying recurring
* events) are returned. Optional. The default is False.
*/
@com.google.api.client.util.Key
private java.lang.Boolean showDeleted;
/** Whether to include deleted events (with status equals "cancelled") in the result. Cancelled
instances of recurring events (but not the underlying recurring event) will still be included if
showDeleted and singleEvents are both False. If showDeleted and singleEvents are both True, only
single instances of deleted events (but not the underlying recurring events) are returned.
Optional. The default is False.
*/
public java.lang.Boolean getShowDeleted() {
return showDeleted;
}
/**
* Whether to include deleted events (with status equals "cancelled") in the result. Cancelled
* instances of recurring events (but not the underlying recurring event) will still be
* included if showDeleted and singleEvents are both False. If showDeleted and singleEvents
* are both True, only single instances of deleted events (but not the underlying recurring
* events) are returned. Optional. The default is False.
*/
public Watch setShowDeleted(java.lang.Boolean showDeleted) {
this.showDeleted = showDeleted;
return this;
}
/** Whether to include hidden invitations in the result. Optional. The default is False. */
@com.google.api.client.util.Key
private java.lang.Boolean showHiddenInvitations;
/** Whether to include hidden invitations in the result. Optional. The default is False.
*/
public java.lang.Boolean getShowHiddenInvitations() {
return showHiddenInvitations;
}
/** Whether to include hidden invitations in the result. Optional. The default is False. */
public Watch setShowHiddenInvitations(java.lang.Boolean showHiddenInvitations) {
this.showHiddenInvitations = showHiddenInvitations;
return this;
}
/**
* Whether to expand recurring events into instances and only return single one-off events and
* instances of recurring events, but not the underlying recurring events themselves.
* Optional. The default is False.
*/
@com.google.api.client.util.Key
private java.lang.Boolean singleEvents;
/** Whether to expand recurring events into instances and only return single one-off events and
instances of recurring events, but not the underlying recurring events themselves. Optional. The
default is False.
*/
public java.lang.Boolean getSingleEvents() {
return singleEvents;
}
/**
* Whether to expand recurring events into instances and only return single one-off events and
* instances of recurring events, but not the underlying recurring events themselves.
* Optional. The default is False.
*/
public Watch setSingleEvents(java.lang.Boolean singleEvents) {
this.singleEvents = singleEvents;
return this;
}
/**
* Token obtained from the nextSyncToken field returned on the last page of results from the
* previous list request. It makes the result of this list request contain only entries that
* have changed since then. All events deleted since the previous list request will always be
* in the result set and it is not allowed to set showDeleted to False. There are several
* query parameters that cannot be specified together with nextSyncToken to ensure consistency
* of the client state.
*
* These are: - iCalUID - orderBy - privateExtendedProperty - q - sharedExtendedProperty -
* timeMin - timeMax - updatedMin If the syncToken expires, the server will respond with a 410
* GONE response code and the client should clear its storage and perform a full
* synchronization without any syncToken. Learn more about incremental synchronization.
* Optional. The default is to return all entries.
*/
@com.google.api.client.util.Key
private java.lang.String syncToken;
/** Token obtained from the nextSyncToken field returned on the last page of results from the previous
list request. It makes the result of this list request contain only entries that have changed since
then. All events deleted since the previous list request will always be in the result set and it is
not allowed to set showDeleted to False. There are several query parameters that cannot be
specified together with nextSyncToken to ensure consistency of the client state.
These are: - iCalUID - orderBy - privateExtendedProperty - q - sharedExtendedProperty - timeMin -
timeMax - updatedMin If the syncToken expires, the server will respond with a 410 GONE response
code and the client should clear its storage and perform a full synchronization without any
syncToken. Learn more about incremental synchronization. Optional. The default is to return all
entries.
*/
public java.lang.String getSyncToken() {
return syncToken;
}
/**
* Token obtained from the nextSyncToken field returned on the last page of results from the
* previous list request. It makes the result of this list request contain only entries that
* have changed since then. All events deleted since the previous list request will always be
* in the result set and it is not allowed to set showDeleted to False. There are several
* query parameters that cannot be specified together with nextSyncToken to ensure consistency
* of the client state.
*
* These are: - iCalUID - orderBy - privateExtendedProperty - q - sharedExtendedProperty -
* timeMin - timeMax - updatedMin If the syncToken expires, the server will respond with a 410
* GONE response code and the client should clear its storage and perform a full
* synchronization without any syncToken. Learn more about incremental synchronization.
* Optional. The default is to return all entries.
*/
public Watch setSyncToken(java.lang.String syncToken) {
this.syncToken = syncToken;
return this;
}
/**
* Upper bound (exclusive) for an event's start time to filter by. Optional. The default is
* not to filter by start time. Must be an RFC3339 timestamp with mandatory time zone offset,
* for example, 2011-06-03T10:00:00-07:00, 2011-06-03T10:00:00Z. Milliseconds may be provided
* but are ignored. If timeMin is set, timeMax must be greater than timeMin.
*/
@com.google.api.client.util.Key
private com.google.api.client.util.DateTime timeMax;
/** Upper bound (exclusive) for an event's start time to filter by. Optional. The default is not to
filter by start time. Must be an RFC3339 timestamp with mandatory time zone offset, for example,
2011-06-03T10:00:00-07:00, 2011-06-03T10:00:00Z. Milliseconds may be provided but are ignored. If
timeMin is set, timeMax must be greater than timeMin.
*/
public com.google.api.client.util.DateTime getTimeMax() {
return timeMax;
}
/**
* Upper bound (exclusive) for an event's start time to filter by. Optional. The default is
* not to filter by start time. Must be an RFC3339 timestamp with mandatory time zone offset,
* for example, 2011-06-03T10:00:00-07:00, 2011-06-03T10:00:00Z. Milliseconds may be provided
* but are ignored. If timeMin is set, timeMax must be greater than timeMin.
*/
public Watch setTimeMax(com.google.api.client.util.DateTime timeMax) {
this.timeMax = timeMax;
return this;
}
/**
* Lower bound (exclusive) for an event's end time to filter by. Optional. The default is not
* to filter by end time. Must be an RFC3339 timestamp with mandatory time zone offset, for
* example, 2011-06-03T10:00:00-07:00, 2011-06-03T10:00:00Z. Milliseconds may be provided but
* are ignored. If timeMax is set, timeMin must be smaller than timeMax.
*/
@com.google.api.client.util.Key
private com.google.api.client.util.DateTime timeMin;
/** Lower bound (exclusive) for an event's end time to filter by. Optional. The default is not to
filter by end time. Must be an RFC3339 timestamp with mandatory time zone offset, for example,
2011-06-03T10:00:00-07:00, 2011-06-03T10:00:00Z. Milliseconds may be provided but are ignored. If
timeMax is set, timeMin must be smaller than timeMax.
*/
public com.google.api.client.util.DateTime getTimeMin() {
return timeMin;
}
/**
* Lower bound (exclusive) for an event's end time to filter by. Optional. The default is not
* to filter by end time. Must be an RFC3339 timestamp with mandatory time zone offset, for
* example, 2011-06-03T10:00:00-07:00, 2011-06-03T10:00:00Z. Milliseconds may be provided but
* are ignored. If timeMax is set, timeMin must be smaller than timeMax.
*/
public Watch setTimeMin(com.google.api.client.util.DateTime timeMin) {
this.timeMin = timeMin;
return this;
}
/**
* Time zone used in the response. Optional. The default is the time zone of the calendar.
*/
@com.google.api.client.util.Key
private java.lang.String timeZone;
/** Time zone used in the response. Optional. The default is the time zone of the calendar.
*/
public java.lang.String getTimeZone() {
return timeZone;
}
/**
* Time zone used in the response. Optional. The default is the time zone of the calendar.
*/
public Watch setTimeZone(java.lang.String timeZone) {
this.timeZone = timeZone;
return this;
}
/**
* Lower bound for an event's last modification time (as a RFC3339 timestamp) to filter by.
* When specified, entries deleted since this time will always be included regardless of
* showDeleted. Optional. The default is not to filter by last modification time.
*/
@com.google.api.client.util.Key
private com.google.api.client.util.DateTime updatedMin;
/** Lower bound for an event's last modification time (as a RFC3339 timestamp) to filter by. When
specified, entries deleted since this time will always be included regardless of showDeleted.
Optional. The default is not to filter by last modification time.
*/
public com.google.api.client.util.DateTime getUpdatedMin() {
return updatedMin;
}
/**
* Lower bound for an event's last modification time (as a RFC3339 timestamp) to filter by.
* When specified, entries deleted since this time will always be included regardless of
* showDeleted. Optional. The default is not to filter by last modification time.
*/
public Watch setUpdatedMin(com.google.api.client.util.DateTime updatedMin) {
this.updatedMin = updatedMin;
return this;
}
@Override
public Watch set(String parameterName, Object value) {
return (Watch) super.set(parameterName, value);
}
}
}
/**
* An accessor for creating requests from the Freebusy collection.
*
* <p>The typical use is:</p>
* <pre>
* {@code Calendar calendar = new Calendar(...);}
* {@code Calendar.Freebusy.List request = calendar.freebusy().list(parameters ...)}
* </pre>
*
* @return the resource collection
*/
public Freebusy freebusy() {
return new Freebusy();
}
/**
* The "freebusy" collection of methods.
*/
public class Freebusy {
/**
* Returns free/busy information for a set of calendars.
*
* Create a request for the method "freebusy.query".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Query#execute()} method to invoke the remote operation.
*
* @param content the {@link com.google.api.services.calendar.model.FreeBusyRequest}
* @return the request
*/
public Query query(com.google.api.services.calendar.model.FreeBusyRequest content) throws java.io.IOException {
Query result = new Query(content);
initialize(result);
return result;
}
public class Query extends CalendarRequest<com.google.api.services.calendar.model.FreeBusyResponse> {
private static final String REST_PATH = "freeBusy";
/**
* Returns free/busy information for a set of calendars.
*
* Create a request for the method "freebusy.query".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Query#execute()} method to invoke the remote operation.
* <p> {@link
* Query#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param content the {@link com.google.api.services.calendar.model.FreeBusyRequest}
* @since 1.13
*/
protected Query(com.google.api.services.calendar.model.FreeBusyRequest content) {
super(Calendar.this, "POST", REST_PATH, content, com.google.api.services.calendar.model.FreeBusyResponse.class);
}
@Override
public Query setAlt(java.lang.String alt) {
return (Query) super.setAlt(alt);
}
@Override
public Query setFields(java.lang.String fields) {
return (Query) super.setFields(fields);
}
@Override
public Query setKey(java.lang.String key) {
return (Query) super.setKey(key);
}
@Override
public Query setOauthToken(java.lang.String oauthToken) {
return (Query) super.setOauthToken(oauthToken);
}
@Override
public Query setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Query) super.setPrettyPrint(prettyPrint);
}
@Override
public Query setQuotaUser(java.lang.String quotaUser) {
return (Query) super.setQuotaUser(quotaUser);
}
@Override
public Query setUserIp(java.lang.String userIp) {
return (Query) super.setUserIp(userIp);
}
@Override
public Query set(String parameterName, Object value) {
return (Query) super.set(parameterName, value);
}
}
}
/**
* An accessor for creating requests from the Settings collection.
*
* <p>The typical use is:</p>
* <pre>
* {@code Calendar calendar = new Calendar(...);}
* {@code Calendar.Settings.List request = calendar.settings().list(parameters ...)}
* </pre>
*
* @return the resource collection
*/
public Settings settings() {
return new Settings();
}
/**
* The "settings" collection of methods.
*/
public class Settings {
/**
* Returns a single user setting.
*
* Create a request for the method "settings.get".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Get#execute()} method to invoke the remote operation.
*
* @param setting The id of the user setting.
* @return the request
*/
public Get get(java.lang.String setting) throws java.io.IOException {
Get result = new Get(setting);
initialize(result);
return result;
}
public class Get extends CalendarRequest<com.google.api.services.calendar.model.Setting> {
private static final String REST_PATH = "users/me/settings/{setting}";
/**
* Returns a single user setting.
*
* Create a request for the method "settings.get".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Get#execute()} method to invoke the remote operation. <p>
* {@link Get#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
* must be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param setting The id of the user setting.
* @since 1.13
*/
protected Get(java.lang.String setting) {
super(Calendar.this, "GET", REST_PATH, null, com.google.api.services.calendar.model.Setting.class);
this.setting = com.google.api.client.util.Preconditions.checkNotNull(setting, "Required parameter setting must be specified.");
}
@Override
public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException {
return super.executeUsingHead();
}
@Override
public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException {
return super.buildHttpRequestUsingHead();
}
@Override
public Get setAlt(java.lang.String alt) {
return (Get) super.setAlt(alt);
}
@Override
public Get setFields(java.lang.String fields) {
return (Get) super.setFields(fields);
}
@Override
public Get setKey(java.lang.String key) {
return (Get) super.setKey(key);
}
@Override
public Get setOauthToken(java.lang.String oauthToken) {
return (Get) super.setOauthToken(oauthToken);
}
@Override
public Get setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Get) super.setPrettyPrint(prettyPrint);
}
@Override
public Get setQuotaUser(java.lang.String quotaUser) {
return (Get) super.setQuotaUser(quotaUser);
}
@Override
public Get setUserIp(java.lang.String userIp) {
return (Get) super.setUserIp(userIp);
}
/** The id of the user setting. */
@com.google.api.client.util.Key
private java.lang.String setting;
/** The id of the user setting.
*/
public java.lang.String getSetting() {
return setting;
}
/** The id of the user setting. */
public Get setSetting(java.lang.String setting) {
this.setting = setting;
return this;
}
@Override
public Get set(String parameterName, Object value) {
return (Get) super.set(parameterName, value);
}
}
/**
* Returns all user settings for the authenticated user.
*
* Create a request for the method "settings.list".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link List#execute()} method to invoke the remote operation.
*
* @return the request
*/
public List list() throws java.io.IOException {
List result = new List();
initialize(result);
return result;
}
public class List extends CalendarRequest<com.google.api.services.calendar.model.Settings> {
private static final String REST_PATH = "users/me/settings";
/**
* Returns all user settings for the authenticated user.
*
* Create a request for the method "settings.list".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link List#execute()} method to invoke the remote operation. <p>
* {@link List#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
* must be called to initialize this instance immediately after invoking the constructor. </p>
*
* @since 1.13
*/
protected List() {
super(Calendar.this, "GET", REST_PATH, null, com.google.api.services.calendar.model.Settings.class);
}
@Override
public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException {
return super.executeUsingHead();
}
@Override
public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException {
return super.buildHttpRequestUsingHead();
}
@Override
public List setAlt(java.lang.String alt) {
return (List) super.setAlt(alt);
}
@Override
public List setFields(java.lang.String fields) {
return (List) super.setFields(fields);
}
@Override
public List setKey(java.lang.String key) {
return (List) super.setKey(key);
}
@Override
public List setOauthToken(java.lang.String oauthToken) {
return (List) super.setOauthToken(oauthToken);
}
@Override
public List setPrettyPrint(java.lang.Boolean prettyPrint) {
return (List) super.setPrettyPrint(prettyPrint);
}
@Override
public List setQuotaUser(java.lang.String quotaUser) {
return (List) super.setQuotaUser(quotaUser);
}
@Override
public List setUserIp(java.lang.String userIp) {
return (List) super.setUserIp(userIp);
}
/**
* Maximum number of entries returned on one result page. By default the value is 100 entries.
* The page size can never be larger than 250 entries. Optional.
*/
@com.google.api.client.util.Key
private java.lang.Integer maxResults;
/** Maximum number of entries returned on one result page. By default the value is 100 entries. The
page size can never be larger than 250 entries. Optional.
[minimum: 1]
*/
public java.lang.Integer getMaxResults() {
return maxResults;
}
/**
* Maximum number of entries returned on one result page. By default the value is 100 entries.
* The page size can never be larger than 250 entries. Optional.
*/
public List setMaxResults(java.lang.Integer maxResults) {
this.maxResults = maxResults;
return this;
}
/** Token specifying which result page to return. Optional. */
@com.google.api.client.util.Key
private java.lang.String pageToken;
/** Token specifying which result page to return. Optional.
*/
public java.lang.String getPageToken() {
return pageToken;
}
/** Token specifying which result page to return. Optional. */
public List setPageToken(java.lang.String pageToken) {
this.pageToken = pageToken;
return this;
}
/**
* Token obtained from the nextSyncToken field returned on the last page of results from the
* previous list request. It makes the result of this list request contain only entries that
* have changed since then. If the syncToken expires, the server will respond with a 410 GONE
* response code and the client should clear its storage and perform a full synchronization
* without any syncToken. Learn more about incremental synchronization. Optional. The default
* is to return all entries.
*/
@com.google.api.client.util.Key
private java.lang.String syncToken;
/** Token obtained from the nextSyncToken field returned on the last page of results from the previous
list request. It makes the result of this list request contain only entries that have changed since
then. If the syncToken expires, the server will respond with a 410 GONE response code and the
client should clear its storage and perform a full synchronization without any syncToken. Learn
more about incremental synchronization. Optional. The default is to return all entries.
*/
public java.lang.String getSyncToken() {
return syncToken;
}
/**
* Token obtained from the nextSyncToken field returned on the last page of results from the
* previous list request. It makes the result of this list request contain only entries that
* have changed since then. If the syncToken expires, the server will respond with a 410 GONE
* response code and the client should clear its storage and perform a full synchronization
* without any syncToken. Learn more about incremental synchronization. Optional. The default
* is to return all entries.
*/
public List setSyncToken(java.lang.String syncToken) {
this.syncToken = syncToken;
return this;
}
@Override
public List set(String parameterName, Object value) {
return (List) super.set(parameterName, value);
}
}
/**
* Watch for changes to Settings resources.
*
* Create a request for the method "settings.watch".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Watch#execute()} method to invoke the remote operation.
*
* @param content the {@link com.google.api.services.calendar.model.Channel}
* @return the request
*/
public Watch watch(com.google.api.services.calendar.model.Channel content) throws java.io.IOException {
Watch result = new Watch(content);
initialize(result);
return result;
}
public class Watch extends CalendarRequest<com.google.api.services.calendar.model.Channel> {
private static final String REST_PATH = "users/me/settings/watch";
/**
* Watch for changes to Settings resources.
*
* Create a request for the method "settings.watch".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Watch#execute()} method to invoke the remote operation.
* <p> {@link
* Watch#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param content the {@link com.google.api.services.calendar.model.Channel}
* @since 1.13
*/
protected Watch(com.google.api.services.calendar.model.Channel content) {
super(Calendar.this, "POST", REST_PATH, content, com.google.api.services.calendar.model.Channel.class);
}
@Override
public Watch setAlt(java.lang.String alt) {
return (Watch) super.setAlt(alt);
}
@Override
public Watch setFields(java.lang.String fields) {
return (Watch) super.setFields(fields);
}
@Override
public Watch setKey(java.lang.String key) {
return (Watch) super.setKey(key);
}
@Override
public Watch setOauthToken(java.lang.String oauthToken) {
return (Watch) super.setOauthToken(oauthToken);
}
@Override
public Watch setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Watch) super.setPrettyPrint(prettyPrint);
}
@Override
public Watch setQuotaUser(java.lang.String quotaUser) {
return (Watch) super.setQuotaUser(quotaUser);
}
@Override
public Watch setUserIp(java.lang.String userIp) {
return (Watch) super.setUserIp(userIp);
}
/**
* Maximum number of entries returned on one result page. By default the value is 100 entries.
* The page size can never be larger than 250 entries. Optional.
*/
@com.google.api.client.util.Key
private java.lang.Integer maxResults;
/** Maximum number of entries returned on one result page. By default the value is 100 entries. The
page size can never be larger than 250 entries. Optional.
[minimum: 1]
*/
public java.lang.Integer getMaxResults() {
return maxResults;
}
/**
* Maximum number of entries returned on one result page. By default the value is 100 entries.
* The page size can never be larger than 250 entries. Optional.
*/
public Watch setMaxResults(java.lang.Integer maxResults) {
this.maxResults = maxResults;
return this;
}
/** Token specifying which result page to return. Optional. */
@com.google.api.client.util.Key
private java.lang.String pageToken;
/** Token specifying which result page to return. Optional.
*/
public java.lang.String getPageToken() {
return pageToken;
}
/** Token specifying which result page to return. Optional. */
public Watch setPageToken(java.lang.String pageToken) {
this.pageToken = pageToken;
return this;
}
/**
* Token obtained from the nextSyncToken field returned on the last page of results from the
* previous list request. It makes the result of this list request contain only entries that
* have changed since then. If the syncToken expires, the server will respond with a 410 GONE
* response code and the client should clear its storage and perform a full synchronization
* without any syncToken. Learn more about incremental synchronization. Optional. The default
* is to return all entries.
*/
@com.google.api.client.util.Key
private java.lang.String syncToken;
/** Token obtained from the nextSyncToken field returned on the last page of results from the previous
list request. It makes the result of this list request contain only entries that have changed since
then. If the syncToken expires, the server will respond with a 410 GONE response code and the
client should clear its storage and perform a full synchronization without any syncToken. Learn
more about incremental synchronization. Optional. The default is to return all entries.
*/
public java.lang.String getSyncToken() {
return syncToken;
}
/**
* Token obtained from the nextSyncToken field returned on the last page of results from the
* previous list request. It makes the result of this list request contain only entries that
* have changed since then. If the syncToken expires, the server will respond with a 410 GONE
* response code and the client should clear its storage and perform a full synchronization
* without any syncToken. Learn more about incremental synchronization. Optional. The default
* is to return all entries.
*/
public Watch setSyncToken(java.lang.String syncToken) {
this.syncToken = syncToken;
return this;
}
@Override
public Watch set(String parameterName, Object value) {
return (Watch) super.set(parameterName, value);
}
}
}
/**
* Builder for {@link Calendar}.
*
* <p>
* Implementation is not thread-safe.
* </p>
*
* @since 1.3.0
*/
public static final class Builder extends com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient.Builder {
/**
* Returns an instance of a new builder.
*
* @param transport HTTP transport, which should normally be:
* <ul>
* <li>Google App Engine:
* {@code com.google.api.client.extensions.appengine.http.UrlFetchTransport}</li>
* <li>Android: {@code newCompatibleTransport} from
* {@code com.google.api.client.extensions.android.http.AndroidHttp}</li>
* <li>Java: {@link com.google.api.client.googleapis.javanet.GoogleNetHttpTransport#newTrustedTransport()}
* </li>
* </ul>
* @param jsonFactory JSON factory, which may be:
* <ul>
* <li>Jackson: {@code com.google.api.client.json.jackson2.JacksonFactory}</li>
* <li>Google GSON: {@code com.google.api.client.json.gson.GsonFactory}</li>
* <li>Android Honeycomb or higher:
* {@code com.google.api.client.extensions.android.json.AndroidJsonFactory}</li>
* </ul>
* @param httpRequestInitializer HTTP request initializer or {@code null} for none
* @since 1.7
*/
public Builder(com.google.api.client.http.HttpTransport transport, com.google.api.client.json.JsonFactory jsonFactory,
com.google.api.client.http.HttpRequestInitializer httpRequestInitializer) {
super(
transport,
jsonFactory,
DEFAULT_ROOT_URL,
DEFAULT_SERVICE_PATH,
httpRequestInitializer,
false);
setBatchPath(DEFAULT_BATCH_PATH);
}
/** Builds a new instance of {@link Calendar}. */
@Override
public Calendar build() {
return new Calendar(this);
}
@Override
public Builder setRootUrl(String rootUrl) {
return (Builder) super.setRootUrl(rootUrl);
}
@Override
public Builder setServicePath(String servicePath) {
return (Builder) super.setServicePath(servicePath);
}
@Override
public Builder setBatchPath(String batchPath) {
return (Builder) super.setBatchPath(batchPath);
}
@Override
public Builder setHttpRequestInitializer(com.google.api.client.http.HttpRequestInitializer httpRequestInitializer) {
return (Builder) super.setHttpRequestInitializer(httpRequestInitializer);
}
@Override
public Builder setApplicationName(String applicationName) {
return (Builder) super.setApplicationName(applicationName);
}
@Override
public Builder setSuppressPatternChecks(boolean suppressPatternChecks) {
return (Builder) super.setSuppressPatternChecks(suppressPatternChecks);
}
@Override
public Builder setSuppressRequiredParameterChecks(boolean suppressRequiredParameterChecks) {
return (Builder) super.setSuppressRequiredParameterChecks(suppressRequiredParameterChecks);
}
@Override
public Builder setSuppressAllChecks(boolean suppressAllChecks) {
return (Builder) super.setSuppressAllChecks(suppressAllChecks);
}
/**
* Set the {@link CalendarRequestInitializer}.
*
* @since 1.12
*/
public Builder setCalendarRequestInitializer(
CalendarRequestInitializer calendarRequestInitializer) {
return (Builder) super.setGoogleClientRequestInitializer(calendarRequestInitializer);
}
@Override
public Builder setGoogleClientRequestInitializer(
com.google.api.client.googleapis.services.GoogleClientRequestInitializer googleClientRequestInitializer) {
return (Builder) super.setGoogleClientRequestInitializer(googleClientRequestInitializer);
}
}
}
| UTF-8 | Java | 280,872 | java | Calendar.java | Java | [] | null | [] | /*
* 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.
*/
/*
* This code was generated by https://github.com/googleapis/google-api-java-client-services/
* Modify at your own risk.
*/
package com.google.api.services.calendar;
/**
* Service definition for Calendar (v3).
*
* <p>
* Manipulates events and other calendar data.
* </p>
*
* <p>
* For more information about this service, see the
* <a href="https://developers.google.com/google-apps/calendar/firstapp" target="_blank">API Documentation</a>
* </p>
*
* <p>
* This service uses {@link CalendarRequestInitializer} to initialize global parameters via its
* {@link Builder}.
* </p>
*
* @since 1.3
* @author Google, Inc.
*/
@SuppressWarnings("javadoc")
public class Calendar extends com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient {
// Note: Leave this static initializer at the top of the file.
static {
com.google.api.client.util.Preconditions.checkState(
com.google.api.client.googleapis.GoogleUtils.MAJOR_VERSION == 1 &&
com.google.api.client.googleapis.GoogleUtils.MINOR_VERSION >= 15,
"You are currently running with version %s of google-api-client. " +
"You need at least version 1.15 of google-api-client to run version " +
"1.26.0 of the Calendar API library.", com.google.api.client.googleapis.GoogleUtils.VERSION);
}
/**
* The default encoded root URL of the service. This is determined when the library is generated
* and normally should not be changed.
*
* @since 1.7
*/
public static final String DEFAULT_ROOT_URL = "https://www.googleapis.com/";
/**
* The default encoded service path of the service. This is determined when the library is
* generated and normally should not be changed.
*
* @since 1.7
*/
public static final String DEFAULT_SERVICE_PATH = "calendar/v3/";
/**
* The default encoded batch path of the service. This is determined when the library is
* generated and normally should not be changed.
*
* @since 1.23
*/
public static final String DEFAULT_BATCH_PATH = "batch/calendar/v3";
/**
* The default encoded base URL of the service. This is determined when the library is generated
* and normally should not be changed.
*/
public static final String DEFAULT_BASE_URL = DEFAULT_ROOT_URL + DEFAULT_SERVICE_PATH;
/**
* Constructor.
*
* <p>
* Use {@link Builder} if you need to specify any of the optional parameters.
* </p>
*
* @param transport HTTP transport, which should normally be:
* <ul>
* <li>Google App Engine:
* {@code com.google.api.client.extensions.appengine.http.UrlFetchTransport}</li>
* <li>Android: {@code newCompatibleTransport} from
* {@code com.google.api.client.extensions.android.http.AndroidHttp}</li>
* <li>Java: {@link com.google.api.client.googleapis.javanet.GoogleNetHttpTransport#newTrustedTransport()}
* </li>
* </ul>
* @param jsonFactory JSON factory, which may be:
* <ul>
* <li>Jackson: {@code com.google.api.client.json.jackson2.JacksonFactory}</li>
* <li>Google GSON: {@code com.google.api.client.json.gson.GsonFactory}</li>
* <li>Android Honeycomb or higher:
* {@code com.google.api.client.extensions.android.json.AndroidJsonFactory}</li>
* </ul>
* @param httpRequestInitializer HTTP request initializer or {@code null} for none
* @since 1.7
*/
public Calendar(com.google.api.client.http.HttpTransport transport, com.google.api.client.json.JsonFactory jsonFactory,
com.google.api.client.http.HttpRequestInitializer httpRequestInitializer) {
this(new Builder(transport, jsonFactory, httpRequestInitializer));
}
/**
* @param builder builder
*/
Calendar(Builder builder) {
super(builder);
}
@Override
protected void initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest<?> httpClientRequest) throws java.io.IOException {
super.initialize(httpClientRequest);
}
/**
* An accessor for creating requests from the Acl collection.
*
* <p>The typical use is:</p>
* <pre>
* {@code Calendar calendar = new Calendar(...);}
* {@code Calendar.Acl.List request = calendar.acl().list(parameters ...)}
* </pre>
*
* @return the resource collection
*/
public Acl acl() {
return new Acl();
}
/**
* The "acl" collection of methods.
*/
public class Acl {
/**
* Deletes an access control rule.
*
* Create a request for the method "acl.delete".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Delete#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param ruleId ACL rule identifier.
* @return the request
*/
public Delete delete(java.lang.String calendarId, java.lang.String ruleId) throws java.io.IOException {
Delete result = new Delete(calendarId, ruleId);
initialize(result);
return result;
}
public class Delete extends CalendarRequest<Void> {
private static final String REST_PATH = "calendars/{calendarId}/acl/{ruleId}";
/**
* Deletes an access control rule.
*
* Create a request for the method "acl.delete".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Delete#execute()} method to invoke the remote operation.
* <p> {@link
* Delete#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param ruleId ACL rule identifier.
* @since 1.13
*/
protected Delete(java.lang.String calendarId, java.lang.String ruleId) {
super(Calendar.this, "DELETE", REST_PATH, null, Void.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
this.ruleId = com.google.api.client.util.Preconditions.checkNotNull(ruleId, "Required parameter ruleId must be specified.");
}
@Override
public Delete setAlt(java.lang.String alt) {
return (Delete) super.setAlt(alt);
}
@Override
public Delete setFields(java.lang.String fields) {
return (Delete) super.setFields(fields);
}
@Override
public Delete setKey(java.lang.String key) {
return (Delete) super.setKey(key);
}
@Override
public Delete setOauthToken(java.lang.String oauthToken) {
return (Delete) super.setOauthToken(oauthToken);
}
@Override
public Delete setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Delete) super.setPrettyPrint(prettyPrint);
}
@Override
public Delete setQuotaUser(java.lang.String quotaUser) {
return (Delete) super.setQuotaUser(quotaUser);
}
@Override
public Delete setUserIp(java.lang.String userIp) {
return (Delete) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public Delete setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
/** ACL rule identifier. */
@com.google.api.client.util.Key
private java.lang.String ruleId;
/** ACL rule identifier.
*/
public java.lang.String getRuleId() {
return ruleId;
}
/** ACL rule identifier. */
public Delete setRuleId(java.lang.String ruleId) {
this.ruleId = ruleId;
return this;
}
@Override
public Delete set(String parameterName, Object value) {
return (Delete) super.set(parameterName, value);
}
}
/**
* Returns an access control rule.
*
* Create a request for the method "acl.get".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Get#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param ruleId ACL rule identifier.
* @return the request
*/
public Get get(java.lang.String calendarId, java.lang.String ruleId) throws java.io.IOException {
Get result = new Get(calendarId, ruleId);
initialize(result);
return result;
}
public class Get extends CalendarRequest<com.google.api.services.calendar.model.AclRule> {
private static final String REST_PATH = "calendars/{calendarId}/acl/{ruleId}";
/**
* Returns an access control rule.
*
* Create a request for the method "acl.get".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Get#execute()} method to invoke the remote operation. <p>
* {@link Get#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
* must be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param ruleId ACL rule identifier.
* @since 1.13
*/
protected Get(java.lang.String calendarId, java.lang.String ruleId) {
super(Calendar.this, "GET", REST_PATH, null, com.google.api.services.calendar.model.AclRule.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
this.ruleId = com.google.api.client.util.Preconditions.checkNotNull(ruleId, "Required parameter ruleId must be specified.");
}
@Override
public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException {
return super.executeUsingHead();
}
@Override
public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException {
return super.buildHttpRequestUsingHead();
}
@Override
public Get setAlt(java.lang.String alt) {
return (Get) super.setAlt(alt);
}
@Override
public Get setFields(java.lang.String fields) {
return (Get) super.setFields(fields);
}
@Override
public Get setKey(java.lang.String key) {
return (Get) super.setKey(key);
}
@Override
public Get setOauthToken(java.lang.String oauthToken) {
return (Get) super.setOauthToken(oauthToken);
}
@Override
public Get setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Get) super.setPrettyPrint(prettyPrint);
}
@Override
public Get setQuotaUser(java.lang.String quotaUser) {
return (Get) super.setQuotaUser(quotaUser);
}
@Override
public Get setUserIp(java.lang.String userIp) {
return (Get) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public Get setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
/** ACL rule identifier. */
@com.google.api.client.util.Key
private java.lang.String ruleId;
/** ACL rule identifier.
*/
public java.lang.String getRuleId() {
return ruleId;
}
/** ACL rule identifier. */
public Get setRuleId(java.lang.String ruleId) {
this.ruleId = ruleId;
return this;
}
@Override
public Get set(String parameterName, Object value) {
return (Get) super.set(parameterName, value);
}
}
/**
* Creates an access control rule.
*
* Create a request for the method "acl.insert".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Insert#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param content the {@link com.google.api.services.calendar.model.AclRule}
* @return the request
*/
public Insert insert(java.lang.String calendarId, com.google.api.services.calendar.model.AclRule content) throws java.io.IOException {
Insert result = new Insert(calendarId, content);
initialize(result);
return result;
}
public class Insert extends CalendarRequest<com.google.api.services.calendar.model.AclRule> {
private static final String REST_PATH = "calendars/{calendarId}/acl";
/**
* Creates an access control rule.
*
* Create a request for the method "acl.insert".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Insert#execute()} method to invoke the remote operation.
* <p> {@link
* Insert#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param content the {@link com.google.api.services.calendar.model.AclRule}
* @since 1.13
*/
protected Insert(java.lang.String calendarId, com.google.api.services.calendar.model.AclRule content) {
super(Calendar.this, "POST", REST_PATH, content, com.google.api.services.calendar.model.AclRule.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
checkRequiredParameter(content, "content");
checkRequiredParameter(content.getRole(), "AclRule.getRole()");
checkRequiredParameter(content, "content");
checkRequiredParameter(content.getScope(), "AclRule.getScope()");
checkRequiredParameter(content, "content");
checkRequiredParameter(content.getScope().getType(), "AclRule.getScope().getType()");
}
@Override
public Insert setAlt(java.lang.String alt) {
return (Insert) super.setAlt(alt);
}
@Override
public Insert setFields(java.lang.String fields) {
return (Insert) super.setFields(fields);
}
@Override
public Insert setKey(java.lang.String key) {
return (Insert) super.setKey(key);
}
@Override
public Insert setOauthToken(java.lang.String oauthToken) {
return (Insert) super.setOauthToken(oauthToken);
}
@Override
public Insert setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Insert) super.setPrettyPrint(prettyPrint);
}
@Override
public Insert setQuotaUser(java.lang.String quotaUser) {
return (Insert) super.setQuotaUser(quotaUser);
}
@Override
public Insert setUserIp(java.lang.String userIp) {
return (Insert) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public Insert setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
/**
* Whether to send notifications about the calendar sharing change. Optional. The default is
* True.
*/
@com.google.api.client.util.Key
private java.lang.Boolean sendNotifications;
/** Whether to send notifications about the calendar sharing change. Optional. The default is True.
*/
public java.lang.Boolean getSendNotifications() {
return sendNotifications;
}
/**
* Whether to send notifications about the calendar sharing change. Optional. The default is
* True.
*/
public Insert setSendNotifications(java.lang.Boolean sendNotifications) {
this.sendNotifications = sendNotifications;
return this;
}
@Override
public Insert set(String parameterName, Object value) {
return (Insert) super.set(parameterName, value);
}
}
/**
* Returns the rules in the access control list for the calendar.
*
* Create a request for the method "acl.list".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link List#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @return the request
*/
public List list(java.lang.String calendarId) throws java.io.IOException {
List result = new List(calendarId);
initialize(result);
return result;
}
public class List extends CalendarRequest<com.google.api.services.calendar.model.Acl> {
private static final String REST_PATH = "calendars/{calendarId}/acl";
/**
* Returns the rules in the access control list for the calendar.
*
* Create a request for the method "acl.list".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link List#execute()} method to invoke the remote operation. <p>
* {@link List#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
* must be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @since 1.13
*/
protected List(java.lang.String calendarId) {
super(Calendar.this, "GET", REST_PATH, null, com.google.api.services.calendar.model.Acl.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
}
@Override
public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException {
return super.executeUsingHead();
}
@Override
public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException {
return super.buildHttpRequestUsingHead();
}
@Override
public List setAlt(java.lang.String alt) {
return (List) super.setAlt(alt);
}
@Override
public List setFields(java.lang.String fields) {
return (List) super.setFields(fields);
}
@Override
public List setKey(java.lang.String key) {
return (List) super.setKey(key);
}
@Override
public List setOauthToken(java.lang.String oauthToken) {
return (List) super.setOauthToken(oauthToken);
}
@Override
public List setPrettyPrint(java.lang.Boolean prettyPrint) {
return (List) super.setPrettyPrint(prettyPrint);
}
@Override
public List setQuotaUser(java.lang.String quotaUser) {
return (List) super.setQuotaUser(quotaUser);
}
@Override
public List setUserIp(java.lang.String userIp) {
return (List) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public List setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
/**
* Maximum number of entries returned on one result page. By default the value is 100 entries.
* The page size can never be larger than 250 entries. Optional.
*/
@com.google.api.client.util.Key
private java.lang.Integer maxResults;
/** Maximum number of entries returned on one result page. By default the value is 100 entries. The
page size can never be larger than 250 entries. Optional.
[minimum: 1]
*/
public java.lang.Integer getMaxResults() {
return maxResults;
}
/**
* Maximum number of entries returned on one result page. By default the value is 100 entries.
* The page size can never be larger than 250 entries. Optional.
*/
public List setMaxResults(java.lang.Integer maxResults) {
this.maxResults = maxResults;
return this;
}
/** Token specifying which result page to return. Optional. */
@com.google.api.client.util.Key
private java.lang.String pageToken;
/** Token specifying which result page to return. Optional.
*/
public java.lang.String getPageToken() {
return pageToken;
}
/** Token specifying which result page to return. Optional. */
public List setPageToken(java.lang.String pageToken) {
this.pageToken = pageToken;
return this;
}
/**
* Whether to include deleted ACLs in the result. Deleted ACLs are represented by role equal
* to "none". Deleted ACLs will always be included if syncToken is provided. Optional. The
* default is False.
*/
@com.google.api.client.util.Key
private java.lang.Boolean showDeleted;
/** Whether to include deleted ACLs in the result. Deleted ACLs are represented by role equal to
"none". Deleted ACLs will always be included if syncToken is provided. Optional. The default is
False.
*/
public java.lang.Boolean getShowDeleted() {
return showDeleted;
}
/**
* Whether to include deleted ACLs in the result. Deleted ACLs are represented by role equal
* to "none". Deleted ACLs will always be included if syncToken is provided. Optional. The
* default is False.
*/
public List setShowDeleted(java.lang.Boolean showDeleted) {
this.showDeleted = showDeleted;
return this;
}
/**
* Token obtained from the nextSyncToken field returned on the last page of results from the
* previous list request. It makes the result of this list request contain only entries that
* have changed since then. All entries deleted since the previous list request will always be
* in the result set and it is not allowed to set showDeleted to False. If the syncToken
* expires, the server will respond with a 410 GONE response code and the client should clear
* its storage and perform a full synchronization without any syncToken. Learn more about
* incremental synchronization. Optional. The default is to return all entries.
*/
@com.google.api.client.util.Key
private java.lang.String syncToken;
/** Token obtained from the nextSyncToken field returned on the last page of results from the previous
list request. It makes the result of this list request contain only entries that have changed since
then. All entries deleted since the previous list request will always be in the result set and it
is not allowed to set showDeleted to False. If the syncToken expires, the server will respond with
a 410 GONE response code and the client should clear its storage and perform a full synchronization
without any syncToken. Learn more about incremental synchronization. Optional. The default is to
return all entries.
*/
public java.lang.String getSyncToken() {
return syncToken;
}
/**
* Token obtained from the nextSyncToken field returned on the last page of results from the
* previous list request. It makes the result of this list request contain only entries that
* have changed since then. All entries deleted since the previous list request will always be
* in the result set and it is not allowed to set showDeleted to False. If the syncToken
* expires, the server will respond with a 410 GONE response code and the client should clear
* its storage and perform a full synchronization without any syncToken. Learn more about
* incremental synchronization. Optional. The default is to return all entries.
*/
public List setSyncToken(java.lang.String syncToken) {
this.syncToken = syncToken;
return this;
}
@Override
public List set(String parameterName, Object value) {
return (List) super.set(parameterName, value);
}
}
/**
* Updates an access control rule. This method supports patch semantics.
*
* Create a request for the method "acl.patch".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Patch#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param ruleId ACL rule identifier.
* @param content the {@link com.google.api.services.calendar.model.AclRule}
* @return the request
*/
public Patch patch(java.lang.String calendarId, java.lang.String ruleId, com.google.api.services.calendar.model.AclRule content) throws java.io.IOException {
Patch result = new Patch(calendarId, ruleId, content);
initialize(result);
return result;
}
public class Patch extends CalendarRequest<com.google.api.services.calendar.model.AclRule> {
private static final String REST_PATH = "calendars/{calendarId}/acl/{ruleId}";
/**
* Updates an access control rule. This method supports patch semantics.
*
* Create a request for the method "acl.patch".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Patch#execute()} method to invoke the remote operation.
* <p> {@link
* Patch#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param ruleId ACL rule identifier.
* @param content the {@link com.google.api.services.calendar.model.AclRule}
* @since 1.13
*/
protected Patch(java.lang.String calendarId, java.lang.String ruleId, com.google.api.services.calendar.model.AclRule content) {
super(Calendar.this, "PATCH", REST_PATH, content, com.google.api.services.calendar.model.AclRule.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
this.ruleId = com.google.api.client.util.Preconditions.checkNotNull(ruleId, "Required parameter ruleId must be specified.");
}
@Override
public Patch setAlt(java.lang.String alt) {
return (Patch) super.setAlt(alt);
}
@Override
public Patch setFields(java.lang.String fields) {
return (Patch) super.setFields(fields);
}
@Override
public Patch setKey(java.lang.String key) {
return (Patch) super.setKey(key);
}
@Override
public Patch setOauthToken(java.lang.String oauthToken) {
return (Patch) super.setOauthToken(oauthToken);
}
@Override
public Patch setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Patch) super.setPrettyPrint(prettyPrint);
}
@Override
public Patch setQuotaUser(java.lang.String quotaUser) {
return (Patch) super.setQuotaUser(quotaUser);
}
@Override
public Patch setUserIp(java.lang.String userIp) {
return (Patch) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public Patch setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
/** ACL rule identifier. */
@com.google.api.client.util.Key
private java.lang.String ruleId;
/** ACL rule identifier.
*/
public java.lang.String getRuleId() {
return ruleId;
}
/** ACL rule identifier. */
public Patch setRuleId(java.lang.String ruleId) {
this.ruleId = ruleId;
return this;
}
/**
* Whether to send notifications about the calendar sharing change. Note that there are no
* notifications on access removal. Optional. The default is True.
*/
@com.google.api.client.util.Key
private java.lang.Boolean sendNotifications;
/** Whether to send notifications about the calendar sharing change. Note that there are no
notifications on access removal. Optional. The default is True.
*/
public java.lang.Boolean getSendNotifications() {
return sendNotifications;
}
/**
* Whether to send notifications about the calendar sharing change. Note that there are no
* notifications on access removal. Optional. The default is True.
*/
public Patch setSendNotifications(java.lang.Boolean sendNotifications) {
this.sendNotifications = sendNotifications;
return this;
}
@Override
public Patch set(String parameterName, Object value) {
return (Patch) super.set(parameterName, value);
}
}
/**
* Updates an access control rule.
*
* Create a request for the method "acl.update".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Update#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param ruleId ACL rule identifier.
* @param content the {@link com.google.api.services.calendar.model.AclRule}
* @return the request
*/
public Update update(java.lang.String calendarId, java.lang.String ruleId, com.google.api.services.calendar.model.AclRule content) throws java.io.IOException {
Update result = new Update(calendarId, ruleId, content);
initialize(result);
return result;
}
public class Update extends CalendarRequest<com.google.api.services.calendar.model.AclRule> {
private static final String REST_PATH = "calendars/{calendarId}/acl/{ruleId}";
/**
* Updates an access control rule.
*
* Create a request for the method "acl.update".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Update#execute()} method to invoke the remote operation.
* <p> {@link
* Update#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param ruleId ACL rule identifier.
* @param content the {@link com.google.api.services.calendar.model.AclRule}
* @since 1.13
*/
protected Update(java.lang.String calendarId, java.lang.String ruleId, com.google.api.services.calendar.model.AclRule content) {
super(Calendar.this, "PUT", REST_PATH, content, com.google.api.services.calendar.model.AclRule.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
this.ruleId = com.google.api.client.util.Preconditions.checkNotNull(ruleId, "Required parameter ruleId must be specified.");
}
@Override
public Update setAlt(java.lang.String alt) {
return (Update) super.setAlt(alt);
}
@Override
public Update setFields(java.lang.String fields) {
return (Update) super.setFields(fields);
}
@Override
public Update setKey(java.lang.String key) {
return (Update) super.setKey(key);
}
@Override
public Update setOauthToken(java.lang.String oauthToken) {
return (Update) super.setOauthToken(oauthToken);
}
@Override
public Update setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Update) super.setPrettyPrint(prettyPrint);
}
@Override
public Update setQuotaUser(java.lang.String quotaUser) {
return (Update) super.setQuotaUser(quotaUser);
}
@Override
public Update setUserIp(java.lang.String userIp) {
return (Update) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public Update setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
/** ACL rule identifier. */
@com.google.api.client.util.Key
private java.lang.String ruleId;
/** ACL rule identifier.
*/
public java.lang.String getRuleId() {
return ruleId;
}
/** ACL rule identifier. */
public Update setRuleId(java.lang.String ruleId) {
this.ruleId = ruleId;
return this;
}
/**
* Whether to send notifications about the calendar sharing change. Note that there are no
* notifications on access removal. Optional. The default is True.
*/
@com.google.api.client.util.Key
private java.lang.Boolean sendNotifications;
/** Whether to send notifications about the calendar sharing change. Note that there are no
notifications on access removal. Optional. The default is True.
*/
public java.lang.Boolean getSendNotifications() {
return sendNotifications;
}
/**
* Whether to send notifications about the calendar sharing change. Note that there are no
* notifications on access removal. Optional. The default is True.
*/
public Update setSendNotifications(java.lang.Boolean sendNotifications) {
this.sendNotifications = sendNotifications;
return this;
}
@Override
public Update set(String parameterName, Object value) {
return (Update) super.set(parameterName, value);
}
}
/**
* Watch for changes to ACL resources.
*
* Create a request for the method "acl.watch".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Watch#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param content the {@link com.google.api.services.calendar.model.Channel}
* @return the request
*/
public Watch watch(java.lang.String calendarId, com.google.api.services.calendar.model.Channel content) throws java.io.IOException {
Watch result = new Watch(calendarId, content);
initialize(result);
return result;
}
public class Watch extends CalendarRequest<com.google.api.services.calendar.model.Channel> {
private static final String REST_PATH = "calendars/{calendarId}/acl/watch";
/**
* Watch for changes to ACL resources.
*
* Create a request for the method "acl.watch".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Watch#execute()} method to invoke the remote operation.
* <p> {@link
* Watch#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param content the {@link com.google.api.services.calendar.model.Channel}
* @since 1.13
*/
protected Watch(java.lang.String calendarId, com.google.api.services.calendar.model.Channel content) {
super(Calendar.this, "POST", REST_PATH, content, com.google.api.services.calendar.model.Channel.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
}
@Override
public Watch setAlt(java.lang.String alt) {
return (Watch) super.setAlt(alt);
}
@Override
public Watch setFields(java.lang.String fields) {
return (Watch) super.setFields(fields);
}
@Override
public Watch setKey(java.lang.String key) {
return (Watch) super.setKey(key);
}
@Override
public Watch setOauthToken(java.lang.String oauthToken) {
return (Watch) super.setOauthToken(oauthToken);
}
@Override
public Watch setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Watch) super.setPrettyPrint(prettyPrint);
}
@Override
public Watch setQuotaUser(java.lang.String quotaUser) {
return (Watch) super.setQuotaUser(quotaUser);
}
@Override
public Watch setUserIp(java.lang.String userIp) {
return (Watch) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public Watch setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
/**
* Maximum number of entries returned on one result page. By default the value is 100 entries.
* The page size can never be larger than 250 entries. Optional.
*/
@com.google.api.client.util.Key
private java.lang.Integer maxResults;
/** Maximum number of entries returned on one result page. By default the value is 100 entries. The
page size can never be larger than 250 entries. Optional.
[minimum: 1]
*/
public java.lang.Integer getMaxResults() {
return maxResults;
}
/**
* Maximum number of entries returned on one result page. By default the value is 100 entries.
* The page size can never be larger than 250 entries. Optional.
*/
public Watch setMaxResults(java.lang.Integer maxResults) {
this.maxResults = maxResults;
return this;
}
/** Token specifying which result page to return. Optional. */
@com.google.api.client.util.Key
private java.lang.String pageToken;
/** Token specifying which result page to return. Optional.
*/
public java.lang.String getPageToken() {
return pageToken;
}
/** Token specifying which result page to return. Optional. */
public Watch setPageToken(java.lang.String pageToken) {
this.pageToken = pageToken;
return this;
}
/**
* Whether to include deleted ACLs in the result. Deleted ACLs are represented by role equal
* to "none". Deleted ACLs will always be included if syncToken is provided. Optional. The
* default is False.
*/
@com.google.api.client.util.Key
private java.lang.Boolean showDeleted;
/** Whether to include deleted ACLs in the result. Deleted ACLs are represented by role equal to
"none". Deleted ACLs will always be included if syncToken is provided. Optional. The default is
False.
*/
public java.lang.Boolean getShowDeleted() {
return showDeleted;
}
/**
* Whether to include deleted ACLs in the result. Deleted ACLs are represented by role equal
* to "none". Deleted ACLs will always be included if syncToken is provided. Optional. The
* default is False.
*/
public Watch setShowDeleted(java.lang.Boolean showDeleted) {
this.showDeleted = showDeleted;
return this;
}
/**
* Token obtained from the nextSyncToken field returned on the last page of results from the
* previous list request. It makes the result of this list request contain only entries that
* have changed since then. All entries deleted since the previous list request will always be
* in the result set and it is not allowed to set showDeleted to False. If the syncToken
* expires, the server will respond with a 410 GONE response code and the client should clear
* its storage and perform a full synchronization without any syncToken. Learn more about
* incremental synchronization. Optional. The default is to return all entries.
*/
@com.google.api.client.util.Key
private java.lang.String syncToken;
/** Token obtained from the nextSyncToken field returned on the last page of results from the previous
list request. It makes the result of this list request contain only entries that have changed since
then. All entries deleted since the previous list request will always be in the result set and it
is not allowed to set showDeleted to False. If the syncToken expires, the server will respond with
a 410 GONE response code and the client should clear its storage and perform a full synchronization
without any syncToken. Learn more about incremental synchronization. Optional. The default is to
return all entries.
*/
public java.lang.String getSyncToken() {
return syncToken;
}
/**
* Token obtained from the nextSyncToken field returned on the last page of results from the
* previous list request. It makes the result of this list request contain only entries that
* have changed since then. All entries deleted since the previous list request will always be
* in the result set and it is not allowed to set showDeleted to False. If the syncToken
* expires, the server will respond with a 410 GONE response code and the client should clear
* its storage and perform a full synchronization without any syncToken. Learn more about
* incremental synchronization. Optional. The default is to return all entries.
*/
public Watch setSyncToken(java.lang.String syncToken) {
this.syncToken = syncToken;
return this;
}
@Override
public Watch set(String parameterName, Object value) {
return (Watch) super.set(parameterName, value);
}
}
}
/**
* An accessor for creating requests from the CalendarList collection.
*
* <p>The typical use is:</p>
* <pre>
* {@code Calendar calendar = new Calendar(...);}
* {@code Calendar.CalendarList.List request = calendar.calendarList().list(parameters ...)}
* </pre>
*
* @return the resource collection
*/
public CalendarList calendarList() {
return new CalendarList();
}
/**
* The "calendarList" collection of methods.
*/
public class CalendarList {
/**
* Removes a calendar from the user's calendar list.
*
* Create a request for the method "calendarList.delete".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Delete#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @return the request
*/
public Delete delete(java.lang.String calendarId) throws java.io.IOException {
Delete result = new Delete(calendarId);
initialize(result);
return result;
}
public class Delete extends CalendarRequest<Void> {
private static final String REST_PATH = "users/me/calendarList/{calendarId}";
/**
* Removes a calendar from the user's calendar list.
*
* Create a request for the method "calendarList.delete".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Delete#execute()} method to invoke the remote operation.
* <p> {@link
* Delete#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @since 1.13
*/
protected Delete(java.lang.String calendarId) {
super(Calendar.this, "DELETE", REST_PATH, null, Void.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
}
@Override
public Delete setAlt(java.lang.String alt) {
return (Delete) super.setAlt(alt);
}
@Override
public Delete setFields(java.lang.String fields) {
return (Delete) super.setFields(fields);
}
@Override
public Delete setKey(java.lang.String key) {
return (Delete) super.setKey(key);
}
@Override
public Delete setOauthToken(java.lang.String oauthToken) {
return (Delete) super.setOauthToken(oauthToken);
}
@Override
public Delete setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Delete) super.setPrettyPrint(prettyPrint);
}
@Override
public Delete setQuotaUser(java.lang.String quotaUser) {
return (Delete) super.setQuotaUser(quotaUser);
}
@Override
public Delete setUserIp(java.lang.String userIp) {
return (Delete) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public Delete setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
@Override
public Delete set(String parameterName, Object value) {
return (Delete) super.set(parameterName, value);
}
}
/**
* Returns a calendar from the user's calendar list.
*
* Create a request for the method "calendarList.get".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Get#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @return the request
*/
public Get get(java.lang.String calendarId) throws java.io.IOException {
Get result = new Get(calendarId);
initialize(result);
return result;
}
public class Get extends CalendarRequest<com.google.api.services.calendar.model.CalendarListEntry> {
private static final String REST_PATH = "users/me/calendarList/{calendarId}";
/**
* Returns a calendar from the user's calendar list.
*
* Create a request for the method "calendarList.get".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Get#execute()} method to invoke the remote operation. <p>
* {@link Get#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
* must be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @since 1.13
*/
protected Get(java.lang.String calendarId) {
super(Calendar.this, "GET", REST_PATH, null, com.google.api.services.calendar.model.CalendarListEntry.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
}
@Override
public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException {
return super.executeUsingHead();
}
@Override
public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException {
return super.buildHttpRequestUsingHead();
}
@Override
public Get setAlt(java.lang.String alt) {
return (Get) super.setAlt(alt);
}
@Override
public Get setFields(java.lang.String fields) {
return (Get) super.setFields(fields);
}
@Override
public Get setKey(java.lang.String key) {
return (Get) super.setKey(key);
}
@Override
public Get setOauthToken(java.lang.String oauthToken) {
return (Get) super.setOauthToken(oauthToken);
}
@Override
public Get setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Get) super.setPrettyPrint(prettyPrint);
}
@Override
public Get setQuotaUser(java.lang.String quotaUser) {
return (Get) super.setQuotaUser(quotaUser);
}
@Override
public Get setUserIp(java.lang.String userIp) {
return (Get) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public Get setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
@Override
public Get set(String parameterName, Object value) {
return (Get) super.set(parameterName, value);
}
}
/**
* Inserts an existing calendar into the user's calendar list.
*
* Create a request for the method "calendarList.insert".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Insert#execute()} method to invoke the remote operation.
*
* @param content the {@link com.google.api.services.calendar.model.CalendarListEntry}
* @return the request
*/
public Insert insert(com.google.api.services.calendar.model.CalendarListEntry content) throws java.io.IOException {
Insert result = new Insert(content);
initialize(result);
return result;
}
public class Insert extends CalendarRequest<com.google.api.services.calendar.model.CalendarListEntry> {
private static final String REST_PATH = "users/me/calendarList";
/**
* Inserts an existing calendar into the user's calendar list.
*
* Create a request for the method "calendarList.insert".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Insert#execute()} method to invoke the remote operation.
* <p> {@link
* Insert#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param content the {@link com.google.api.services.calendar.model.CalendarListEntry}
* @since 1.13
*/
protected Insert(com.google.api.services.calendar.model.CalendarListEntry content) {
super(Calendar.this, "POST", REST_PATH, content, com.google.api.services.calendar.model.CalendarListEntry.class);
checkRequiredParameter(content, "content");
checkRequiredParameter(content.getId(), "CalendarListEntry.getId()");
}
@Override
public Insert setAlt(java.lang.String alt) {
return (Insert) super.setAlt(alt);
}
@Override
public Insert setFields(java.lang.String fields) {
return (Insert) super.setFields(fields);
}
@Override
public Insert setKey(java.lang.String key) {
return (Insert) super.setKey(key);
}
@Override
public Insert setOauthToken(java.lang.String oauthToken) {
return (Insert) super.setOauthToken(oauthToken);
}
@Override
public Insert setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Insert) super.setPrettyPrint(prettyPrint);
}
@Override
public Insert setQuotaUser(java.lang.String quotaUser) {
return (Insert) super.setQuotaUser(quotaUser);
}
@Override
public Insert setUserIp(java.lang.String userIp) {
return (Insert) super.setUserIp(userIp);
}
/**
* Whether to use the foregroundColor and backgroundColor fields to write the calendar colors
* (RGB). If this feature is used, the index-based colorId field will be set to the best
* matching option automatically. Optional. The default is False.
*/
@com.google.api.client.util.Key
private java.lang.Boolean colorRgbFormat;
/** Whether to use the foregroundColor and backgroundColor fields to write the calendar colors (RGB).
If this feature is used, the index-based colorId field will be set to the best matching option
automatically. Optional. The default is False.
*/
public java.lang.Boolean getColorRgbFormat() {
return colorRgbFormat;
}
/**
* Whether to use the foregroundColor and backgroundColor fields to write the calendar colors
* (RGB). If this feature is used, the index-based colorId field will be set to the best
* matching option automatically. Optional. The default is False.
*/
public Insert setColorRgbFormat(java.lang.Boolean colorRgbFormat) {
this.colorRgbFormat = colorRgbFormat;
return this;
}
@Override
public Insert set(String parameterName, Object value) {
return (Insert) super.set(parameterName, value);
}
}
/**
* Returns the calendars on the user's calendar list.
*
* Create a request for the method "calendarList.list".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link List#execute()} method to invoke the remote operation.
*
* @return the request
*/
public List list() throws java.io.IOException {
List result = new List();
initialize(result);
return result;
}
public class List extends CalendarRequest<com.google.api.services.calendar.model.CalendarList> {
private static final String REST_PATH = "users/me/calendarList";
/**
* Returns the calendars on the user's calendar list.
*
* Create a request for the method "calendarList.list".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link List#execute()} method to invoke the remote operation. <p>
* {@link List#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
* must be called to initialize this instance immediately after invoking the constructor. </p>
*
* @since 1.13
*/
protected List() {
super(Calendar.this, "GET", REST_PATH, null, com.google.api.services.calendar.model.CalendarList.class);
}
@Override
public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException {
return super.executeUsingHead();
}
@Override
public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException {
return super.buildHttpRequestUsingHead();
}
@Override
public List setAlt(java.lang.String alt) {
return (List) super.setAlt(alt);
}
@Override
public List setFields(java.lang.String fields) {
return (List) super.setFields(fields);
}
@Override
public List setKey(java.lang.String key) {
return (List) super.setKey(key);
}
@Override
public List setOauthToken(java.lang.String oauthToken) {
return (List) super.setOauthToken(oauthToken);
}
@Override
public List setPrettyPrint(java.lang.Boolean prettyPrint) {
return (List) super.setPrettyPrint(prettyPrint);
}
@Override
public List setQuotaUser(java.lang.String quotaUser) {
return (List) super.setQuotaUser(quotaUser);
}
@Override
public List setUserIp(java.lang.String userIp) {
return (List) super.setUserIp(userIp);
}
/**
* Maximum number of entries returned on one result page. By default the value is 100 entries.
* The page size can never be larger than 250 entries. Optional.
*/
@com.google.api.client.util.Key
private java.lang.Integer maxResults;
/** Maximum number of entries returned on one result page. By default the value is 100 entries. The
page size can never be larger than 250 entries. Optional.
[minimum: 1]
*/
public java.lang.Integer getMaxResults() {
return maxResults;
}
/**
* Maximum number of entries returned on one result page. By default the value is 100 entries.
* The page size can never be larger than 250 entries. Optional.
*/
public List setMaxResults(java.lang.Integer maxResults) {
this.maxResults = maxResults;
return this;
}
/**
* The minimum access role for the user in the returned entries. Optional. The default is no
* restriction.
*/
@com.google.api.client.util.Key
private java.lang.String minAccessRole;
/** The minimum access role for the user in the returned entries. Optional. The default is no
restriction.
*/
public java.lang.String getMinAccessRole() {
return minAccessRole;
}
/**
* The minimum access role for the user in the returned entries. Optional. The default is no
* restriction.
*/
public List setMinAccessRole(java.lang.String minAccessRole) {
this.minAccessRole = minAccessRole;
return this;
}
/** Token specifying which result page to return. Optional. */
@com.google.api.client.util.Key
private java.lang.String pageToken;
/** Token specifying which result page to return. Optional.
*/
public java.lang.String getPageToken() {
return pageToken;
}
/** Token specifying which result page to return. Optional. */
public List setPageToken(java.lang.String pageToken) {
this.pageToken = pageToken;
return this;
}
/**
* Whether to include deleted calendar list entries in the result. Optional. The default is
* False.
*/
@com.google.api.client.util.Key
private java.lang.Boolean showDeleted;
/** Whether to include deleted calendar list entries in the result. Optional. The default is False.
*/
public java.lang.Boolean getShowDeleted() {
return showDeleted;
}
/**
* Whether to include deleted calendar list entries in the result. Optional. The default is
* False.
*/
public List setShowDeleted(java.lang.Boolean showDeleted) {
this.showDeleted = showDeleted;
return this;
}
/** Whether to show hidden entries. Optional. The default is False. */
@com.google.api.client.util.Key
private java.lang.Boolean showHidden;
/** Whether to show hidden entries. Optional. The default is False.
*/
public java.lang.Boolean getShowHidden() {
return showHidden;
}
/** Whether to show hidden entries. Optional. The default is False. */
public List setShowHidden(java.lang.Boolean showHidden) {
this.showHidden = showHidden;
return this;
}
/**
* Token obtained from the nextSyncToken field returned on the last page of results from the
* previous list request. It makes the result of this list request contain only entries that
* have changed since then. If only read-only fields such as calendar properties or ACLs have
* changed, the entry won't be returned. All entries deleted and hidden since the previous
* list request will always be in the result set and it is not allowed to set showDeleted
* neither showHidden to False. To ensure client state consistency minAccessRole query
* parameter cannot be specified together with nextSyncToken. If the syncToken expires, the
* server will respond with a 410 GONE response code and the client should clear its storage
* and perform a full synchronization without any syncToken. Learn more about incremental
* synchronization. Optional. The default is to return all entries.
*/
@com.google.api.client.util.Key
private java.lang.String syncToken;
/** Token obtained from the nextSyncToken field returned on the last page of results from the previous
list request. It makes the result of this list request contain only entries that have changed since
then. If only read-only fields such as calendar properties or ACLs have changed, the entry won't be
returned. All entries deleted and hidden since the previous list request will always be in the
result set and it is not allowed to set showDeleted neither showHidden to False. To ensure client
state consistency minAccessRole query parameter cannot be specified together with nextSyncToken. If
the syncToken expires, the server will respond with a 410 GONE response code and the client should
clear its storage and perform a full synchronization without any syncToken. Learn more about
incremental synchronization. Optional. The default is to return all entries.
*/
public java.lang.String getSyncToken() {
return syncToken;
}
/**
* Token obtained from the nextSyncToken field returned on the last page of results from the
* previous list request. It makes the result of this list request contain only entries that
* have changed since then. If only read-only fields such as calendar properties or ACLs have
* changed, the entry won't be returned. All entries deleted and hidden since the previous
* list request will always be in the result set and it is not allowed to set showDeleted
* neither showHidden to False. To ensure client state consistency minAccessRole query
* parameter cannot be specified together with nextSyncToken. If the syncToken expires, the
* server will respond with a 410 GONE response code and the client should clear its storage
* and perform a full synchronization without any syncToken. Learn more about incremental
* synchronization. Optional. The default is to return all entries.
*/
public List setSyncToken(java.lang.String syncToken) {
this.syncToken = syncToken;
return this;
}
@Override
public List set(String parameterName, Object value) {
return (List) super.set(parameterName, value);
}
}
/**
* Updates an existing calendar on the user's calendar list. This method supports patch semantics.
*
* Create a request for the method "calendarList.patch".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Patch#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param content the {@link com.google.api.services.calendar.model.CalendarListEntry}
* @return the request
*/
public Patch patch(java.lang.String calendarId, com.google.api.services.calendar.model.CalendarListEntry content) throws java.io.IOException {
Patch result = new Patch(calendarId, content);
initialize(result);
return result;
}
public class Patch extends CalendarRequest<com.google.api.services.calendar.model.CalendarListEntry> {
private static final String REST_PATH = "users/me/calendarList/{calendarId}";
/**
* Updates an existing calendar on the user's calendar list. This method supports patch semantics.
*
* Create a request for the method "calendarList.patch".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Patch#execute()} method to invoke the remote operation.
* <p> {@link
* Patch#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param content the {@link com.google.api.services.calendar.model.CalendarListEntry}
* @since 1.13
*/
protected Patch(java.lang.String calendarId, com.google.api.services.calendar.model.CalendarListEntry content) {
super(Calendar.this, "PATCH", REST_PATH, content, com.google.api.services.calendar.model.CalendarListEntry.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
}
@Override
public Patch setAlt(java.lang.String alt) {
return (Patch) super.setAlt(alt);
}
@Override
public Patch setFields(java.lang.String fields) {
return (Patch) super.setFields(fields);
}
@Override
public Patch setKey(java.lang.String key) {
return (Patch) super.setKey(key);
}
@Override
public Patch setOauthToken(java.lang.String oauthToken) {
return (Patch) super.setOauthToken(oauthToken);
}
@Override
public Patch setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Patch) super.setPrettyPrint(prettyPrint);
}
@Override
public Patch setQuotaUser(java.lang.String quotaUser) {
return (Patch) super.setQuotaUser(quotaUser);
}
@Override
public Patch setUserIp(java.lang.String userIp) {
return (Patch) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public Patch setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
/**
* Whether to use the foregroundColor and backgroundColor fields to write the calendar colors
* (RGB). If this feature is used, the index-based colorId field will be set to the best
* matching option automatically. Optional. The default is False.
*/
@com.google.api.client.util.Key
private java.lang.Boolean colorRgbFormat;
/** Whether to use the foregroundColor and backgroundColor fields to write the calendar colors (RGB).
If this feature is used, the index-based colorId field will be set to the best matching option
automatically. Optional. The default is False.
*/
public java.lang.Boolean getColorRgbFormat() {
return colorRgbFormat;
}
/**
* Whether to use the foregroundColor and backgroundColor fields to write the calendar colors
* (RGB). If this feature is used, the index-based colorId field will be set to the best
* matching option automatically. Optional. The default is False.
*/
public Patch setColorRgbFormat(java.lang.Boolean colorRgbFormat) {
this.colorRgbFormat = colorRgbFormat;
return this;
}
@Override
public Patch set(String parameterName, Object value) {
return (Patch) super.set(parameterName, value);
}
}
/**
* Updates an existing calendar on the user's calendar list.
*
* Create a request for the method "calendarList.update".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Update#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param content the {@link com.google.api.services.calendar.model.CalendarListEntry}
* @return the request
*/
public Update update(java.lang.String calendarId, com.google.api.services.calendar.model.CalendarListEntry content) throws java.io.IOException {
Update result = new Update(calendarId, content);
initialize(result);
return result;
}
public class Update extends CalendarRequest<com.google.api.services.calendar.model.CalendarListEntry> {
private static final String REST_PATH = "users/me/calendarList/{calendarId}";
/**
* Updates an existing calendar on the user's calendar list.
*
* Create a request for the method "calendarList.update".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Update#execute()} method to invoke the remote operation.
* <p> {@link
* Update#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param content the {@link com.google.api.services.calendar.model.CalendarListEntry}
* @since 1.13
*/
protected Update(java.lang.String calendarId, com.google.api.services.calendar.model.CalendarListEntry content) {
super(Calendar.this, "PUT", REST_PATH, content, com.google.api.services.calendar.model.CalendarListEntry.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
}
@Override
public Update setAlt(java.lang.String alt) {
return (Update) super.setAlt(alt);
}
@Override
public Update setFields(java.lang.String fields) {
return (Update) super.setFields(fields);
}
@Override
public Update setKey(java.lang.String key) {
return (Update) super.setKey(key);
}
@Override
public Update setOauthToken(java.lang.String oauthToken) {
return (Update) super.setOauthToken(oauthToken);
}
@Override
public Update setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Update) super.setPrettyPrint(prettyPrint);
}
@Override
public Update setQuotaUser(java.lang.String quotaUser) {
return (Update) super.setQuotaUser(quotaUser);
}
@Override
public Update setUserIp(java.lang.String userIp) {
return (Update) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public Update setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
/**
* Whether to use the foregroundColor and backgroundColor fields to write the calendar colors
* (RGB). If this feature is used, the index-based colorId field will be set to the best
* matching option automatically. Optional. The default is False.
*/
@com.google.api.client.util.Key
private java.lang.Boolean colorRgbFormat;
/** Whether to use the foregroundColor and backgroundColor fields to write the calendar colors (RGB).
If this feature is used, the index-based colorId field will be set to the best matching option
automatically. Optional. The default is False.
*/
public java.lang.Boolean getColorRgbFormat() {
return colorRgbFormat;
}
/**
* Whether to use the foregroundColor and backgroundColor fields to write the calendar colors
* (RGB). If this feature is used, the index-based colorId field will be set to the best
* matching option automatically. Optional. The default is False.
*/
public Update setColorRgbFormat(java.lang.Boolean colorRgbFormat) {
this.colorRgbFormat = colorRgbFormat;
return this;
}
@Override
public Update set(String parameterName, Object value) {
return (Update) super.set(parameterName, value);
}
}
/**
* Watch for changes to CalendarList resources.
*
* Create a request for the method "calendarList.watch".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Watch#execute()} method to invoke the remote operation.
*
* @param content the {@link com.google.api.services.calendar.model.Channel}
* @return the request
*/
public Watch watch(com.google.api.services.calendar.model.Channel content) throws java.io.IOException {
Watch result = new Watch(content);
initialize(result);
return result;
}
public class Watch extends CalendarRequest<com.google.api.services.calendar.model.Channel> {
private static final String REST_PATH = "users/me/calendarList/watch";
/**
* Watch for changes to CalendarList resources.
*
* Create a request for the method "calendarList.watch".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Watch#execute()} method to invoke the remote operation.
* <p> {@link
* Watch#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param content the {@link com.google.api.services.calendar.model.Channel}
* @since 1.13
*/
protected Watch(com.google.api.services.calendar.model.Channel content) {
super(Calendar.this, "POST", REST_PATH, content, com.google.api.services.calendar.model.Channel.class);
}
@Override
public Watch setAlt(java.lang.String alt) {
return (Watch) super.setAlt(alt);
}
@Override
public Watch setFields(java.lang.String fields) {
return (Watch) super.setFields(fields);
}
@Override
public Watch setKey(java.lang.String key) {
return (Watch) super.setKey(key);
}
@Override
public Watch setOauthToken(java.lang.String oauthToken) {
return (Watch) super.setOauthToken(oauthToken);
}
@Override
public Watch setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Watch) super.setPrettyPrint(prettyPrint);
}
@Override
public Watch setQuotaUser(java.lang.String quotaUser) {
return (Watch) super.setQuotaUser(quotaUser);
}
@Override
public Watch setUserIp(java.lang.String userIp) {
return (Watch) super.setUserIp(userIp);
}
/**
* Maximum number of entries returned on one result page. By default the value is 100 entries.
* The page size can never be larger than 250 entries. Optional.
*/
@com.google.api.client.util.Key
private java.lang.Integer maxResults;
/** Maximum number of entries returned on one result page. By default the value is 100 entries. The
page size can never be larger than 250 entries. Optional.
[minimum: 1]
*/
public java.lang.Integer getMaxResults() {
return maxResults;
}
/**
* Maximum number of entries returned on one result page. By default the value is 100 entries.
* The page size can never be larger than 250 entries. Optional.
*/
public Watch setMaxResults(java.lang.Integer maxResults) {
this.maxResults = maxResults;
return this;
}
/**
* The minimum access role for the user in the returned entries. Optional. The default is no
* restriction.
*/
@com.google.api.client.util.Key
private java.lang.String minAccessRole;
/** The minimum access role for the user in the returned entries. Optional. The default is no
restriction.
*/
public java.lang.String getMinAccessRole() {
return minAccessRole;
}
/**
* The minimum access role for the user in the returned entries. Optional. The default is no
* restriction.
*/
public Watch setMinAccessRole(java.lang.String minAccessRole) {
this.minAccessRole = minAccessRole;
return this;
}
/** Token specifying which result page to return. Optional. */
@com.google.api.client.util.Key
private java.lang.String pageToken;
/** Token specifying which result page to return. Optional.
*/
public java.lang.String getPageToken() {
return pageToken;
}
/** Token specifying which result page to return. Optional. */
public Watch setPageToken(java.lang.String pageToken) {
this.pageToken = pageToken;
return this;
}
/**
* Whether to include deleted calendar list entries in the result. Optional. The default is
* False.
*/
@com.google.api.client.util.Key
private java.lang.Boolean showDeleted;
/** Whether to include deleted calendar list entries in the result. Optional. The default is False.
*/
public java.lang.Boolean getShowDeleted() {
return showDeleted;
}
/**
* Whether to include deleted calendar list entries in the result. Optional. The default is
* False.
*/
public Watch setShowDeleted(java.lang.Boolean showDeleted) {
this.showDeleted = showDeleted;
return this;
}
/** Whether to show hidden entries. Optional. The default is False. */
@com.google.api.client.util.Key
private java.lang.Boolean showHidden;
/** Whether to show hidden entries. Optional. The default is False.
*/
public java.lang.Boolean getShowHidden() {
return showHidden;
}
/** Whether to show hidden entries. Optional. The default is False. */
public Watch setShowHidden(java.lang.Boolean showHidden) {
this.showHidden = showHidden;
return this;
}
/**
* Token obtained from the nextSyncToken field returned on the last page of results from the
* previous list request. It makes the result of this list request contain only entries that
* have changed since then. If only read-only fields such as calendar properties or ACLs have
* changed, the entry won't be returned. All entries deleted and hidden since the previous
* list request will always be in the result set and it is not allowed to set showDeleted
* neither showHidden to False. To ensure client state consistency minAccessRole query
* parameter cannot be specified together with nextSyncToken. If the syncToken expires, the
* server will respond with a 410 GONE response code and the client should clear its storage
* and perform a full synchronization without any syncToken. Learn more about incremental
* synchronization. Optional. The default is to return all entries.
*/
@com.google.api.client.util.Key
private java.lang.String syncToken;
/** Token obtained from the nextSyncToken field returned on the last page of results from the previous
list request. It makes the result of this list request contain only entries that have changed since
then. If only read-only fields such as calendar properties or ACLs have changed, the entry won't be
returned. All entries deleted and hidden since the previous list request will always be in the
result set and it is not allowed to set showDeleted neither showHidden to False. To ensure client
state consistency minAccessRole query parameter cannot be specified together with nextSyncToken. If
the syncToken expires, the server will respond with a 410 GONE response code and the client should
clear its storage and perform a full synchronization without any syncToken. Learn more about
incremental synchronization. Optional. The default is to return all entries.
*/
public java.lang.String getSyncToken() {
return syncToken;
}
/**
* Token obtained from the nextSyncToken field returned on the last page of results from the
* previous list request. It makes the result of this list request contain only entries that
* have changed since then. If only read-only fields such as calendar properties or ACLs have
* changed, the entry won't be returned. All entries deleted and hidden since the previous
* list request will always be in the result set and it is not allowed to set showDeleted
* neither showHidden to False. To ensure client state consistency minAccessRole query
* parameter cannot be specified together with nextSyncToken. If the syncToken expires, the
* server will respond with a 410 GONE response code and the client should clear its storage
* and perform a full synchronization without any syncToken. Learn more about incremental
* synchronization. Optional. The default is to return all entries.
*/
public Watch setSyncToken(java.lang.String syncToken) {
this.syncToken = syncToken;
return this;
}
@Override
public Watch set(String parameterName, Object value) {
return (Watch) super.set(parameterName, value);
}
}
}
/**
* An accessor for creating requests from the Calendars collection.
*
* <p>The typical use is:</p>
* <pre>
* {@code Calendar calendar = new Calendar(...);}
* {@code Calendar.Calendars.List request = calendar.calendars().list(parameters ...)}
* </pre>
*
* @return the resource collection
*/
public Calendars calendars() {
return new Calendars();
}
/**
* The "calendars" collection of methods.
*/
public class Calendars {
/**
* Clears a primary calendar. This operation deletes all events associated with the primary calendar
* of an account.
*
* Create a request for the method "calendars.clear".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Clear#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @return the request
*/
public Clear clear(java.lang.String calendarId) throws java.io.IOException {
Clear result = new Clear(calendarId);
initialize(result);
return result;
}
public class Clear extends CalendarRequest<Void> {
private static final String REST_PATH = "calendars/{calendarId}/clear";
/**
* Clears a primary calendar. This operation deletes all events associated with the primary
* calendar of an account.
*
* Create a request for the method "calendars.clear".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Clear#execute()} method to invoke the remote operation.
* <p> {@link
* Clear#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @since 1.13
*/
protected Clear(java.lang.String calendarId) {
super(Calendar.this, "POST", REST_PATH, null, Void.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
}
@Override
public Clear setAlt(java.lang.String alt) {
return (Clear) super.setAlt(alt);
}
@Override
public Clear setFields(java.lang.String fields) {
return (Clear) super.setFields(fields);
}
@Override
public Clear setKey(java.lang.String key) {
return (Clear) super.setKey(key);
}
@Override
public Clear setOauthToken(java.lang.String oauthToken) {
return (Clear) super.setOauthToken(oauthToken);
}
@Override
public Clear setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Clear) super.setPrettyPrint(prettyPrint);
}
@Override
public Clear setQuotaUser(java.lang.String quotaUser) {
return (Clear) super.setQuotaUser(quotaUser);
}
@Override
public Clear setUserIp(java.lang.String userIp) {
return (Clear) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public Clear setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
@Override
public Clear set(String parameterName, Object value) {
return (Clear) super.set(parameterName, value);
}
}
/**
* Deletes a secondary calendar. Use calendars.clear for clearing all events on primary calendars.
*
* Create a request for the method "calendars.delete".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Delete#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @return the request
*/
public Delete delete(java.lang.String calendarId) throws java.io.IOException {
Delete result = new Delete(calendarId);
initialize(result);
return result;
}
public class Delete extends CalendarRequest<Void> {
private static final String REST_PATH = "calendars/{calendarId}";
/**
* Deletes a secondary calendar. Use calendars.clear for clearing all events on primary calendars.
*
* Create a request for the method "calendars.delete".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Delete#execute()} method to invoke the remote operation.
* <p> {@link
* Delete#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @since 1.13
*/
protected Delete(java.lang.String calendarId) {
super(Calendar.this, "DELETE", REST_PATH, null, Void.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
}
@Override
public Delete setAlt(java.lang.String alt) {
return (Delete) super.setAlt(alt);
}
@Override
public Delete setFields(java.lang.String fields) {
return (Delete) super.setFields(fields);
}
@Override
public Delete setKey(java.lang.String key) {
return (Delete) super.setKey(key);
}
@Override
public Delete setOauthToken(java.lang.String oauthToken) {
return (Delete) super.setOauthToken(oauthToken);
}
@Override
public Delete setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Delete) super.setPrettyPrint(prettyPrint);
}
@Override
public Delete setQuotaUser(java.lang.String quotaUser) {
return (Delete) super.setQuotaUser(quotaUser);
}
@Override
public Delete setUserIp(java.lang.String userIp) {
return (Delete) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public Delete setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
@Override
public Delete set(String parameterName, Object value) {
return (Delete) super.set(parameterName, value);
}
}
/**
* Returns metadata for a calendar.
*
* Create a request for the method "calendars.get".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Get#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @return the request
*/
public Get get(java.lang.String calendarId) throws java.io.IOException {
Get result = new Get(calendarId);
initialize(result);
return result;
}
public class Get extends CalendarRequest<com.google.api.services.calendar.model.Calendar> {
private static final String REST_PATH = "calendars/{calendarId}";
/**
* Returns metadata for a calendar.
*
* Create a request for the method "calendars.get".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Get#execute()} method to invoke the remote operation. <p>
* {@link Get#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
* must be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @since 1.13
*/
protected Get(java.lang.String calendarId) {
super(Calendar.this, "GET", REST_PATH, null, com.google.api.services.calendar.model.Calendar.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
}
@Override
public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException {
return super.executeUsingHead();
}
@Override
public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException {
return super.buildHttpRequestUsingHead();
}
@Override
public Get setAlt(java.lang.String alt) {
return (Get) super.setAlt(alt);
}
@Override
public Get setFields(java.lang.String fields) {
return (Get) super.setFields(fields);
}
@Override
public Get setKey(java.lang.String key) {
return (Get) super.setKey(key);
}
@Override
public Get setOauthToken(java.lang.String oauthToken) {
return (Get) super.setOauthToken(oauthToken);
}
@Override
public Get setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Get) super.setPrettyPrint(prettyPrint);
}
@Override
public Get setQuotaUser(java.lang.String quotaUser) {
return (Get) super.setQuotaUser(quotaUser);
}
@Override
public Get setUserIp(java.lang.String userIp) {
return (Get) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public Get setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
@Override
public Get set(String parameterName, Object value) {
return (Get) super.set(parameterName, value);
}
}
/**
* Creates a secondary calendar.
*
* Create a request for the method "calendars.insert".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Insert#execute()} method to invoke the remote operation.
*
* @param content the {@link com.google.api.services.calendar.model.Calendar}
* @return the request
*/
public Insert insert(com.google.api.services.calendar.model.Calendar content) throws java.io.IOException {
Insert result = new Insert(content);
initialize(result);
return result;
}
public class Insert extends CalendarRequest<com.google.api.services.calendar.model.Calendar> {
private static final String REST_PATH = "calendars";
/**
* Creates a secondary calendar.
*
* Create a request for the method "calendars.insert".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Insert#execute()} method to invoke the remote operation.
* <p> {@link
* Insert#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param content the {@link com.google.api.services.calendar.model.Calendar}
* @since 1.13
*/
protected Insert(com.google.api.services.calendar.model.Calendar content) {
super(Calendar.this, "POST", REST_PATH, content, com.google.api.services.calendar.model.Calendar.class);
checkRequiredParameter(content, "content");
checkRequiredParameter(content.getSummary(), "Calendar.getSummary()");
}
@Override
public Insert setAlt(java.lang.String alt) {
return (Insert) super.setAlt(alt);
}
@Override
public Insert setFields(java.lang.String fields) {
return (Insert) super.setFields(fields);
}
@Override
public Insert setKey(java.lang.String key) {
return (Insert) super.setKey(key);
}
@Override
public Insert setOauthToken(java.lang.String oauthToken) {
return (Insert) super.setOauthToken(oauthToken);
}
@Override
public Insert setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Insert) super.setPrettyPrint(prettyPrint);
}
@Override
public Insert setQuotaUser(java.lang.String quotaUser) {
return (Insert) super.setQuotaUser(quotaUser);
}
@Override
public Insert setUserIp(java.lang.String userIp) {
return (Insert) super.setUserIp(userIp);
}
@Override
public Insert set(String parameterName, Object value) {
return (Insert) super.set(parameterName, value);
}
}
/**
* Updates metadata for a calendar. This method supports patch semantics.
*
* Create a request for the method "calendars.patch".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Patch#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param content the {@link com.google.api.services.calendar.model.Calendar}
* @return the request
*/
public Patch patch(java.lang.String calendarId, com.google.api.services.calendar.model.Calendar content) throws java.io.IOException {
Patch result = new Patch(calendarId, content);
initialize(result);
return result;
}
public class Patch extends CalendarRequest<com.google.api.services.calendar.model.Calendar> {
private static final String REST_PATH = "calendars/{calendarId}";
/**
* Updates metadata for a calendar. This method supports patch semantics.
*
* Create a request for the method "calendars.patch".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Patch#execute()} method to invoke the remote operation.
* <p> {@link
* Patch#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param content the {@link com.google.api.services.calendar.model.Calendar}
* @since 1.13
*/
protected Patch(java.lang.String calendarId, com.google.api.services.calendar.model.Calendar content) {
super(Calendar.this, "PATCH", REST_PATH, content, com.google.api.services.calendar.model.Calendar.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
}
@Override
public Patch setAlt(java.lang.String alt) {
return (Patch) super.setAlt(alt);
}
@Override
public Patch setFields(java.lang.String fields) {
return (Patch) super.setFields(fields);
}
@Override
public Patch setKey(java.lang.String key) {
return (Patch) super.setKey(key);
}
@Override
public Patch setOauthToken(java.lang.String oauthToken) {
return (Patch) super.setOauthToken(oauthToken);
}
@Override
public Patch setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Patch) super.setPrettyPrint(prettyPrint);
}
@Override
public Patch setQuotaUser(java.lang.String quotaUser) {
return (Patch) super.setQuotaUser(quotaUser);
}
@Override
public Patch setUserIp(java.lang.String userIp) {
return (Patch) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public Patch setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
@Override
public Patch set(String parameterName, Object value) {
return (Patch) super.set(parameterName, value);
}
}
/**
* Updates metadata for a calendar.
*
* Create a request for the method "calendars.update".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Update#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param content the {@link com.google.api.services.calendar.model.Calendar}
* @return the request
*/
public Update update(java.lang.String calendarId, com.google.api.services.calendar.model.Calendar content) throws java.io.IOException {
Update result = new Update(calendarId, content);
initialize(result);
return result;
}
public class Update extends CalendarRequest<com.google.api.services.calendar.model.Calendar> {
private static final String REST_PATH = "calendars/{calendarId}";
/**
* Updates metadata for a calendar.
*
* Create a request for the method "calendars.update".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Update#execute()} method to invoke the remote operation.
* <p> {@link
* Update#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param content the {@link com.google.api.services.calendar.model.Calendar}
* @since 1.13
*/
protected Update(java.lang.String calendarId, com.google.api.services.calendar.model.Calendar content) {
super(Calendar.this, "PUT", REST_PATH, content, com.google.api.services.calendar.model.Calendar.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
}
@Override
public Update setAlt(java.lang.String alt) {
return (Update) super.setAlt(alt);
}
@Override
public Update setFields(java.lang.String fields) {
return (Update) super.setFields(fields);
}
@Override
public Update setKey(java.lang.String key) {
return (Update) super.setKey(key);
}
@Override
public Update setOauthToken(java.lang.String oauthToken) {
return (Update) super.setOauthToken(oauthToken);
}
@Override
public Update setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Update) super.setPrettyPrint(prettyPrint);
}
@Override
public Update setQuotaUser(java.lang.String quotaUser) {
return (Update) super.setQuotaUser(quotaUser);
}
@Override
public Update setUserIp(java.lang.String userIp) {
return (Update) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public Update setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
@Override
public Update set(String parameterName, Object value) {
return (Update) super.set(parameterName, value);
}
}
}
/**
* An accessor for creating requests from the Channels collection.
*
* <p>The typical use is:</p>
* <pre>
* {@code Calendar calendar = new Calendar(...);}
* {@code Calendar.Channels.List request = calendar.channels().list(parameters ...)}
* </pre>
*
* @return the resource collection
*/
public Channels channels() {
return new Channels();
}
/**
* The "channels" collection of methods.
*/
public class Channels {
/**
* Stop watching resources through this channel
*
* Create a request for the method "channels.stop".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Stop#execute()} method to invoke the remote operation.
*
* @param content the {@link com.google.api.services.calendar.model.Channel}
* @return the request
*/
public Stop stop(com.google.api.services.calendar.model.Channel content) throws java.io.IOException {
Stop result = new Stop(content);
initialize(result);
return result;
}
public class Stop extends CalendarRequest<Void> {
private static final String REST_PATH = "channels/stop";
/**
* Stop watching resources through this channel
*
* Create a request for the method "channels.stop".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Stop#execute()} method to invoke the remote operation. <p>
* {@link Stop#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
* must be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param content the {@link com.google.api.services.calendar.model.Channel}
* @since 1.13
*/
protected Stop(com.google.api.services.calendar.model.Channel content) {
super(Calendar.this, "POST", REST_PATH, content, Void.class);
}
@Override
public Stop setAlt(java.lang.String alt) {
return (Stop) super.setAlt(alt);
}
@Override
public Stop setFields(java.lang.String fields) {
return (Stop) super.setFields(fields);
}
@Override
public Stop setKey(java.lang.String key) {
return (Stop) super.setKey(key);
}
@Override
public Stop setOauthToken(java.lang.String oauthToken) {
return (Stop) super.setOauthToken(oauthToken);
}
@Override
public Stop setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Stop) super.setPrettyPrint(prettyPrint);
}
@Override
public Stop setQuotaUser(java.lang.String quotaUser) {
return (Stop) super.setQuotaUser(quotaUser);
}
@Override
public Stop setUserIp(java.lang.String userIp) {
return (Stop) super.setUserIp(userIp);
}
@Override
public Stop set(String parameterName, Object value) {
return (Stop) super.set(parameterName, value);
}
}
}
/**
* An accessor for creating requests from the Colors collection.
*
* <p>The typical use is:</p>
* <pre>
* {@code Calendar calendar = new Calendar(...);}
* {@code Calendar.Colors.List request = calendar.colors().list(parameters ...)}
* </pre>
*
* @return the resource collection
*/
public Colors colors() {
return new Colors();
}
/**
* The "colors" collection of methods.
*/
public class Colors {
/**
* Returns the color definitions for calendars and events.
*
* Create a request for the method "colors.get".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Get#execute()} method to invoke the remote operation.
*
* @return the request
*/
public Get get() throws java.io.IOException {
Get result = new Get();
initialize(result);
return result;
}
public class Get extends CalendarRequest<com.google.api.services.calendar.model.Colors> {
private static final String REST_PATH = "colors";
/**
* Returns the color definitions for calendars and events.
*
* Create a request for the method "colors.get".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Get#execute()} method to invoke the remote operation. <p>
* {@link Get#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
* must be called to initialize this instance immediately after invoking the constructor. </p>
*
* @since 1.13
*/
protected Get() {
super(Calendar.this, "GET", REST_PATH, null, com.google.api.services.calendar.model.Colors.class);
}
@Override
public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException {
return super.executeUsingHead();
}
@Override
public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException {
return super.buildHttpRequestUsingHead();
}
@Override
public Get setAlt(java.lang.String alt) {
return (Get) super.setAlt(alt);
}
@Override
public Get setFields(java.lang.String fields) {
return (Get) super.setFields(fields);
}
@Override
public Get setKey(java.lang.String key) {
return (Get) super.setKey(key);
}
@Override
public Get setOauthToken(java.lang.String oauthToken) {
return (Get) super.setOauthToken(oauthToken);
}
@Override
public Get setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Get) super.setPrettyPrint(prettyPrint);
}
@Override
public Get setQuotaUser(java.lang.String quotaUser) {
return (Get) super.setQuotaUser(quotaUser);
}
@Override
public Get setUserIp(java.lang.String userIp) {
return (Get) super.setUserIp(userIp);
}
@Override
public Get set(String parameterName, Object value) {
return (Get) super.set(parameterName, value);
}
}
}
/**
* An accessor for creating requests from the Events collection.
*
* <p>The typical use is:</p>
* <pre>
* {@code Calendar calendar = new Calendar(...);}
* {@code Calendar.Events.List request = calendar.events().list(parameters ...)}
* </pre>
*
* @return the resource collection
*/
public Events events() {
return new Events();
}
/**
* The "events" collection of methods.
*/
public class Events {
/**
* Deletes an event.
*
* Create a request for the method "events.delete".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Delete#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param eventId Event identifier.
* @return the request
*/
public Delete delete(java.lang.String calendarId, java.lang.String eventId) throws java.io.IOException {
Delete result = new Delete(calendarId, eventId);
initialize(result);
return result;
}
public class Delete extends CalendarRequest<Void> {
private static final String REST_PATH = "calendars/{calendarId}/events/{eventId}";
/**
* Deletes an event.
*
* Create a request for the method "events.delete".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Delete#execute()} method to invoke the remote operation.
* <p> {@link
* Delete#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param eventId Event identifier.
* @since 1.13
*/
protected Delete(java.lang.String calendarId, java.lang.String eventId) {
super(Calendar.this, "DELETE", REST_PATH, null, Void.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
this.eventId = com.google.api.client.util.Preconditions.checkNotNull(eventId, "Required parameter eventId must be specified.");
}
@Override
public Delete setAlt(java.lang.String alt) {
return (Delete) super.setAlt(alt);
}
@Override
public Delete setFields(java.lang.String fields) {
return (Delete) super.setFields(fields);
}
@Override
public Delete setKey(java.lang.String key) {
return (Delete) super.setKey(key);
}
@Override
public Delete setOauthToken(java.lang.String oauthToken) {
return (Delete) super.setOauthToken(oauthToken);
}
@Override
public Delete setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Delete) super.setPrettyPrint(prettyPrint);
}
@Override
public Delete setQuotaUser(java.lang.String quotaUser) {
return (Delete) super.setQuotaUser(quotaUser);
}
@Override
public Delete setUserIp(java.lang.String userIp) {
return (Delete) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public Delete setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
/** Event identifier. */
@com.google.api.client.util.Key
private java.lang.String eventId;
/** Event identifier.
*/
public java.lang.String getEventId() {
return eventId;
}
/** Event identifier. */
public Delete setEventId(java.lang.String eventId) {
this.eventId = eventId;
return this;
}
/**
* Deprecated. Please use sendUpdates instead.
*
* Whether to send notifications about the deletion of the event. Note that some emails might
* still be sent even if you set the value to false. The default is false.
*/
@com.google.api.client.util.Key
private java.lang.Boolean sendNotifications;
/** Deprecated. Please use sendUpdates instead.
Whether to send notifications about the deletion of the event. Note that some emails might still be
sent even if you set the value to false. The default is false.
*/
public java.lang.Boolean getSendNotifications() {
return sendNotifications;
}
/**
* Deprecated. Please use sendUpdates instead.
*
* Whether to send notifications about the deletion of the event. Note that some emails might
* still be sent even if you set the value to false. The default is false.
*/
public Delete setSendNotifications(java.lang.Boolean sendNotifications) {
this.sendNotifications = sendNotifications;
return this;
}
/** Guests who should receive notifications about the deletion of the event. */
@com.google.api.client.util.Key
private java.lang.String sendUpdates;
/** Guests who should receive notifications about the deletion of the event.
*/
public java.lang.String getSendUpdates() {
return sendUpdates;
}
/** Guests who should receive notifications about the deletion of the event. */
public Delete setSendUpdates(java.lang.String sendUpdates) {
this.sendUpdates = sendUpdates;
return this;
}
@Override
public Delete set(String parameterName, Object value) {
return (Delete) super.set(parameterName, value);
}
}
/**
* Returns an event.
*
* Create a request for the method "events.get".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Get#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param eventId Event identifier.
* @return the request
*/
public Get get(java.lang.String calendarId, java.lang.String eventId) throws java.io.IOException {
Get result = new Get(calendarId, eventId);
initialize(result);
return result;
}
public class Get extends CalendarRequest<com.google.api.services.calendar.model.Event> {
private static final String REST_PATH = "calendars/{calendarId}/events/{eventId}";
/**
* Returns an event.
*
* Create a request for the method "events.get".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Get#execute()} method to invoke the remote operation. <p>
* {@link Get#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
* must be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param eventId Event identifier.
* @since 1.13
*/
protected Get(java.lang.String calendarId, java.lang.String eventId) {
super(Calendar.this, "GET", REST_PATH, null, com.google.api.services.calendar.model.Event.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
this.eventId = com.google.api.client.util.Preconditions.checkNotNull(eventId, "Required parameter eventId must be specified.");
}
@Override
public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException {
return super.executeUsingHead();
}
@Override
public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException {
return super.buildHttpRequestUsingHead();
}
@Override
public Get setAlt(java.lang.String alt) {
return (Get) super.setAlt(alt);
}
@Override
public Get setFields(java.lang.String fields) {
return (Get) super.setFields(fields);
}
@Override
public Get setKey(java.lang.String key) {
return (Get) super.setKey(key);
}
@Override
public Get setOauthToken(java.lang.String oauthToken) {
return (Get) super.setOauthToken(oauthToken);
}
@Override
public Get setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Get) super.setPrettyPrint(prettyPrint);
}
@Override
public Get setQuotaUser(java.lang.String quotaUser) {
return (Get) super.setQuotaUser(quotaUser);
}
@Override
public Get setUserIp(java.lang.String userIp) {
return (Get) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public Get setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
/** Event identifier. */
@com.google.api.client.util.Key
private java.lang.String eventId;
/** Event identifier.
*/
public java.lang.String getEventId() {
return eventId;
}
/** Event identifier. */
public Get setEventId(java.lang.String eventId) {
this.eventId = eventId;
return this;
}
/**
* Whether to always include a value in the email field for the organizer, creator and
* attendees, even if no real email is available (i.e. a generated, non-working value will be
* provided). The use of this option is discouraged and should only be used by clients which
* cannot handle the absence of an email address value in the mentioned places. Optional. The
* default is False.
*/
@com.google.api.client.util.Key
private java.lang.Boolean alwaysIncludeEmail;
/** Whether to always include a value in the email field for the organizer, creator and attendees, even
if no real email is available (i.e. a generated, non-working value will be provided). The use of
this option is discouraged and should only be used by clients which cannot handle the absence of an
email address value in the mentioned places. Optional. The default is False.
*/
public java.lang.Boolean getAlwaysIncludeEmail() {
return alwaysIncludeEmail;
}
/**
* Whether to always include a value in the email field for the organizer, creator and
* attendees, even if no real email is available (i.e. a generated, non-working value will be
* provided). The use of this option is discouraged and should only be used by clients which
* cannot handle the absence of an email address value in the mentioned places. Optional. The
* default is False.
*/
public Get setAlwaysIncludeEmail(java.lang.Boolean alwaysIncludeEmail) {
this.alwaysIncludeEmail = alwaysIncludeEmail;
return this;
}
/**
* The maximum number of attendees to include in the response. If there are more than the
* specified number of attendees, only the participant is returned. Optional.
*/
@com.google.api.client.util.Key
private java.lang.Integer maxAttendees;
/** The maximum number of attendees to include in the response. If there are more than the specified
number of attendees, only the participant is returned. Optional.
[minimum: 1]
*/
public java.lang.Integer getMaxAttendees() {
return maxAttendees;
}
/**
* The maximum number of attendees to include in the response. If there are more than the
* specified number of attendees, only the participant is returned. Optional.
*/
public Get setMaxAttendees(java.lang.Integer maxAttendees) {
this.maxAttendees = maxAttendees;
return this;
}
/**
* Time zone used in the response. Optional. The default is the time zone of the calendar.
*/
@com.google.api.client.util.Key
private java.lang.String timeZone;
/** Time zone used in the response. Optional. The default is the time zone of the calendar.
*/
public java.lang.String getTimeZone() {
return timeZone;
}
/**
* Time zone used in the response. Optional. The default is the time zone of the calendar.
*/
public Get setTimeZone(java.lang.String timeZone) {
this.timeZone = timeZone;
return this;
}
@Override
public Get set(String parameterName, Object value) {
return (Get) super.set(parameterName, value);
}
}
/**
* Imports an event. This operation is used to add a private copy of an existing event to a
* calendar.
*
* Create a request for the method "events.import".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link CalendarImport#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param content the {@link com.google.api.services.calendar.model.Event}
* @return the request
*/
public CalendarImport calendarImport(java.lang.String calendarId, com.google.api.services.calendar.model.Event content) throws java.io.IOException {
CalendarImport result = new CalendarImport(calendarId, content);
initialize(result);
return result;
}
public class CalendarImport extends CalendarRequest<com.google.api.services.calendar.model.Event> {
private static final String REST_PATH = "calendars/{calendarId}/events/import";
/**
* Imports an event. This operation is used to add a private copy of an existing event to a
* calendar.
*
* Create a request for the method "events.import".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link CalendarImport#execute()} method to invoke the remote
* operation. <p> {@link CalendarImport#initialize(com.google.api.client.googleapis.services.Abstr
* actGoogleClientRequest)} must be called to initialize this instance immediately after invoking
* the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param content the {@link com.google.api.services.calendar.model.Event}
* @since 1.13
*/
protected CalendarImport(java.lang.String calendarId, com.google.api.services.calendar.model.Event content) {
super(Calendar.this, "POST", REST_PATH, content, com.google.api.services.calendar.model.Event.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
checkRequiredParameter(content, "content");
checkRequiredParameter(content.getICalUID(), "Event.getICalUID()");
}
@Override
public CalendarImport setAlt(java.lang.String alt) {
return (CalendarImport) super.setAlt(alt);
}
@Override
public CalendarImport setFields(java.lang.String fields) {
return (CalendarImport) super.setFields(fields);
}
@Override
public CalendarImport setKey(java.lang.String key) {
return (CalendarImport) super.setKey(key);
}
@Override
public CalendarImport setOauthToken(java.lang.String oauthToken) {
return (CalendarImport) super.setOauthToken(oauthToken);
}
@Override
public CalendarImport setPrettyPrint(java.lang.Boolean prettyPrint) {
return (CalendarImport) super.setPrettyPrint(prettyPrint);
}
@Override
public CalendarImport setQuotaUser(java.lang.String quotaUser) {
return (CalendarImport) super.setQuotaUser(quotaUser);
}
@Override
public CalendarImport setUserIp(java.lang.String userIp) {
return (CalendarImport) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public CalendarImport setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
/**
* Version number of conference data supported by the API client. Version 0 assumes no
* conference data support and ignores conference data in the event's body. Version 1 enables
* support for copying of ConferenceData as well as for creating new conferences using the
* createRequest field of conferenceData. The default is 0.
*/
@com.google.api.client.util.Key
private java.lang.Integer conferenceDataVersion;
/** Version number of conference data supported by the API client. Version 0 assumes no conference data
support and ignores conference data in the event's body. Version 1 enables support for copying of
ConferenceData as well as for creating new conferences using the createRequest field of
conferenceData. The default is 0.
[minimum: 0] [maximum: 1]
*/
public java.lang.Integer getConferenceDataVersion() {
return conferenceDataVersion;
}
/**
* Version number of conference data supported by the API client. Version 0 assumes no
* conference data support and ignores conference data in the event's body. Version 1 enables
* support for copying of ConferenceData as well as for creating new conferences using the
* createRequest field of conferenceData. The default is 0.
*/
public CalendarImport setConferenceDataVersion(java.lang.Integer conferenceDataVersion) {
this.conferenceDataVersion = conferenceDataVersion;
return this;
}
/**
* Whether API client performing operation supports event attachments. Optional. The default
* is False.
*/
@com.google.api.client.util.Key
private java.lang.Boolean supportsAttachments;
/** Whether API client performing operation supports event attachments. Optional. The default is False.
*/
public java.lang.Boolean getSupportsAttachments() {
return supportsAttachments;
}
/**
* Whether API client performing operation supports event attachments. Optional. The default
* is False.
*/
public CalendarImport setSupportsAttachments(java.lang.Boolean supportsAttachments) {
this.supportsAttachments = supportsAttachments;
return this;
}
@Override
public CalendarImport set(String parameterName, Object value) {
return (CalendarImport) super.set(parameterName, value);
}
}
/**
* Creates an event.
*
* Create a request for the method "events.insert".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Insert#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param content the {@link com.google.api.services.calendar.model.Event}
* @return the request
*/
public Insert insert(java.lang.String calendarId, com.google.api.services.calendar.model.Event content) throws java.io.IOException {
Insert result = new Insert(calendarId, content);
initialize(result);
return result;
}
public class Insert extends CalendarRequest<com.google.api.services.calendar.model.Event> {
private static final String REST_PATH = "calendars/{calendarId}/events";
/**
* Creates an event.
*
* Create a request for the method "events.insert".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Insert#execute()} method to invoke the remote operation.
* <p> {@link
* Insert#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param content the {@link com.google.api.services.calendar.model.Event}
* @since 1.13
*/
protected Insert(java.lang.String calendarId, com.google.api.services.calendar.model.Event content) {
super(Calendar.this, "POST", REST_PATH, content, com.google.api.services.calendar.model.Event.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
}
@Override
public Insert setAlt(java.lang.String alt) {
return (Insert) super.setAlt(alt);
}
@Override
public Insert setFields(java.lang.String fields) {
return (Insert) super.setFields(fields);
}
@Override
public Insert setKey(java.lang.String key) {
return (Insert) super.setKey(key);
}
@Override
public Insert setOauthToken(java.lang.String oauthToken) {
return (Insert) super.setOauthToken(oauthToken);
}
@Override
public Insert setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Insert) super.setPrettyPrint(prettyPrint);
}
@Override
public Insert setQuotaUser(java.lang.String quotaUser) {
return (Insert) super.setQuotaUser(quotaUser);
}
@Override
public Insert setUserIp(java.lang.String userIp) {
return (Insert) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public Insert setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
/**
* Version number of conference data supported by the API client. Version 0 assumes no
* conference data support and ignores conference data in the event's body. Version 1 enables
* support for copying of ConferenceData as well as for creating new conferences using the
* createRequest field of conferenceData. The default is 0.
*/
@com.google.api.client.util.Key
private java.lang.Integer conferenceDataVersion;
/** Version number of conference data supported by the API client. Version 0 assumes no conference data
support and ignores conference data in the event's body. Version 1 enables support for copying of
ConferenceData as well as for creating new conferences using the createRequest field of
conferenceData. The default is 0.
[minimum: 0] [maximum: 1]
*/
public java.lang.Integer getConferenceDataVersion() {
return conferenceDataVersion;
}
/**
* Version number of conference data supported by the API client. Version 0 assumes no
* conference data support and ignores conference data in the event's body. Version 1 enables
* support for copying of ConferenceData as well as for creating new conferences using the
* createRequest field of conferenceData. The default is 0.
*/
public Insert setConferenceDataVersion(java.lang.Integer conferenceDataVersion) {
this.conferenceDataVersion = conferenceDataVersion;
return this;
}
/**
* The maximum number of attendees to include in the response. If there are more than the
* specified number of attendees, only the participant is returned. Optional.
*/
@com.google.api.client.util.Key
private java.lang.Integer maxAttendees;
/** The maximum number of attendees to include in the response. If there are more than the specified
number of attendees, only the participant is returned. Optional.
[minimum: 1]
*/
public java.lang.Integer getMaxAttendees() {
return maxAttendees;
}
/**
* The maximum number of attendees to include in the response. If there are more than the
* specified number of attendees, only the participant is returned. Optional.
*/
public Insert setMaxAttendees(java.lang.Integer maxAttendees) {
this.maxAttendees = maxAttendees;
return this;
}
/**
* Deprecated. Please use sendUpdates instead.
*
* Whether to send notifications about the creation of the new event. Note that some emails
* might still be sent even if you set the value to false. The default is false.
*/
@com.google.api.client.util.Key
private java.lang.Boolean sendNotifications;
/** Deprecated. Please use sendUpdates instead.
Whether to send notifications about the creation of the new event. Note that some emails might
still be sent even if you set the value to false. The default is false.
*/
public java.lang.Boolean getSendNotifications() {
return sendNotifications;
}
/**
* Deprecated. Please use sendUpdates instead.
*
* Whether to send notifications about the creation of the new event. Note that some emails
* might still be sent even if you set the value to false. The default is false.
*/
public Insert setSendNotifications(java.lang.Boolean sendNotifications) {
this.sendNotifications = sendNotifications;
return this;
}
/**
* Whether to send notifications about the creation of the new event. Note that some emails
* might still be sent. The default is false.
*/
@com.google.api.client.util.Key
private java.lang.String sendUpdates;
/** Whether to send notifications about the creation of the new event. Note that some emails might
still be sent. The default is false.
*/
public java.lang.String getSendUpdates() {
return sendUpdates;
}
/**
* Whether to send notifications about the creation of the new event. Note that some emails
* might still be sent. The default is false.
*/
public Insert setSendUpdates(java.lang.String sendUpdates) {
this.sendUpdates = sendUpdates;
return this;
}
/**
* Whether API client performing operation supports event attachments. Optional. The default
* is False.
*/
@com.google.api.client.util.Key
private java.lang.Boolean supportsAttachments;
/** Whether API client performing operation supports event attachments. Optional. The default is False.
*/
public java.lang.Boolean getSupportsAttachments() {
return supportsAttachments;
}
/**
* Whether API client performing operation supports event attachments. Optional. The default
* is False.
*/
public Insert setSupportsAttachments(java.lang.Boolean supportsAttachments) {
this.supportsAttachments = supportsAttachments;
return this;
}
@Override
public Insert set(String parameterName, Object value) {
return (Insert) super.set(parameterName, value);
}
}
/**
* Returns instances of the specified recurring event.
*
* Create a request for the method "events.instances".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Instances#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param eventId Recurring event identifier.
* @return the request
*/
public Instances instances(java.lang.String calendarId, java.lang.String eventId) throws java.io.IOException {
Instances result = new Instances(calendarId, eventId);
initialize(result);
return result;
}
public class Instances extends CalendarRequest<com.google.api.services.calendar.model.Events> {
private static final String REST_PATH = "calendars/{calendarId}/events/{eventId}/instances";
/**
* Returns instances of the specified recurring event.
*
* Create a request for the method "events.instances".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Instances#execute()} method to invoke the remote
* operation. <p> {@link
* Instances#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
* must be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param eventId Recurring event identifier.
* @since 1.13
*/
protected Instances(java.lang.String calendarId, java.lang.String eventId) {
super(Calendar.this, "GET", REST_PATH, null, com.google.api.services.calendar.model.Events.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
this.eventId = com.google.api.client.util.Preconditions.checkNotNull(eventId, "Required parameter eventId must be specified.");
}
@Override
public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException {
return super.executeUsingHead();
}
@Override
public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException {
return super.buildHttpRequestUsingHead();
}
@Override
public Instances setAlt(java.lang.String alt) {
return (Instances) super.setAlt(alt);
}
@Override
public Instances setFields(java.lang.String fields) {
return (Instances) super.setFields(fields);
}
@Override
public Instances setKey(java.lang.String key) {
return (Instances) super.setKey(key);
}
@Override
public Instances setOauthToken(java.lang.String oauthToken) {
return (Instances) super.setOauthToken(oauthToken);
}
@Override
public Instances setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Instances) super.setPrettyPrint(prettyPrint);
}
@Override
public Instances setQuotaUser(java.lang.String quotaUser) {
return (Instances) super.setQuotaUser(quotaUser);
}
@Override
public Instances setUserIp(java.lang.String userIp) {
return (Instances) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public Instances setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
/** Recurring event identifier. */
@com.google.api.client.util.Key
private java.lang.String eventId;
/** Recurring event identifier.
*/
public java.lang.String getEventId() {
return eventId;
}
/** Recurring event identifier. */
public Instances setEventId(java.lang.String eventId) {
this.eventId = eventId;
return this;
}
/**
* Whether to always include a value in the email field for the organizer, creator and
* attendees, even if no real email is available (i.e. a generated, non-working value will be
* provided). The use of this option is discouraged and should only be used by clients which
* cannot handle the absence of an email address value in the mentioned places. Optional. The
* default is False.
*/
@com.google.api.client.util.Key
private java.lang.Boolean alwaysIncludeEmail;
/** Whether to always include a value in the email field for the organizer, creator and attendees, even
if no real email is available (i.e. a generated, non-working value will be provided). The use of
this option is discouraged and should only be used by clients which cannot handle the absence of an
email address value in the mentioned places. Optional. The default is False.
*/
public java.lang.Boolean getAlwaysIncludeEmail() {
return alwaysIncludeEmail;
}
/**
* Whether to always include a value in the email field for the organizer, creator and
* attendees, even if no real email is available (i.e. a generated, non-working value will be
* provided). The use of this option is discouraged and should only be used by clients which
* cannot handle the absence of an email address value in the mentioned places. Optional. The
* default is False.
*/
public Instances setAlwaysIncludeEmail(java.lang.Boolean alwaysIncludeEmail) {
this.alwaysIncludeEmail = alwaysIncludeEmail;
return this;
}
/**
* The maximum number of attendees to include in the response. If there are more than the
* specified number of attendees, only the participant is returned. Optional.
*/
@com.google.api.client.util.Key
private java.lang.Integer maxAttendees;
/** The maximum number of attendees to include in the response. If there are more than the specified
number of attendees, only the participant is returned. Optional.
[minimum: 1]
*/
public java.lang.Integer getMaxAttendees() {
return maxAttendees;
}
/**
* The maximum number of attendees to include in the response. If there are more than the
* specified number of attendees, only the participant is returned. Optional.
*/
public Instances setMaxAttendees(java.lang.Integer maxAttendees) {
this.maxAttendees = maxAttendees;
return this;
}
/**
* Maximum number of events returned on one result page. By default the value is 250 events.
* The page size can never be larger than 2500 events. Optional.
*/
@com.google.api.client.util.Key
private java.lang.Integer maxResults;
/** Maximum number of events returned on one result page. By default the value is 250 events. The page
size can never be larger than 2500 events. Optional.
[minimum: 1]
*/
public java.lang.Integer getMaxResults() {
return maxResults;
}
/**
* Maximum number of events returned on one result page. By default the value is 250 events.
* The page size can never be larger than 2500 events. Optional.
*/
public Instances setMaxResults(java.lang.Integer maxResults) {
this.maxResults = maxResults;
return this;
}
/** The original start time of the instance in the result. Optional. */
@com.google.api.client.util.Key
private java.lang.String originalStart;
/** The original start time of the instance in the result. Optional.
*/
public java.lang.String getOriginalStart() {
return originalStart;
}
/** The original start time of the instance in the result. Optional. */
public Instances setOriginalStart(java.lang.String originalStart) {
this.originalStart = originalStart;
return this;
}
/** Token specifying which result page to return. Optional. */
@com.google.api.client.util.Key
private java.lang.String pageToken;
/** Token specifying which result page to return. Optional.
*/
public java.lang.String getPageToken() {
return pageToken;
}
/** Token specifying which result page to return. Optional. */
public Instances setPageToken(java.lang.String pageToken) {
this.pageToken = pageToken;
return this;
}
/**
* Whether to include deleted events (with status equals "cancelled") in the result. Cancelled
* instances of recurring events will still be included if singleEvents is False. Optional.
* The default is False.
*/
@com.google.api.client.util.Key
private java.lang.Boolean showDeleted;
/** Whether to include deleted events (with status equals "cancelled") in the result. Cancelled
instances of recurring events will still be included if singleEvents is False. Optional. The
default is False.
*/
public java.lang.Boolean getShowDeleted() {
return showDeleted;
}
/**
* Whether to include deleted events (with status equals "cancelled") in the result. Cancelled
* instances of recurring events will still be included if singleEvents is False. Optional.
* The default is False.
*/
public Instances setShowDeleted(java.lang.Boolean showDeleted) {
this.showDeleted = showDeleted;
return this;
}
/**
* Upper bound (exclusive) for an event's start time to filter by. Optional. The default is
* not to filter by start time. Must be an RFC3339 timestamp with mandatory time zone offset.
*/
@com.google.api.client.util.Key
private com.google.api.client.util.DateTime timeMax;
/** Upper bound (exclusive) for an event's start time to filter by. Optional. The default is not to
filter by start time. Must be an RFC3339 timestamp with mandatory time zone offset.
*/
public com.google.api.client.util.DateTime getTimeMax() {
return timeMax;
}
/**
* Upper bound (exclusive) for an event's start time to filter by. Optional. The default is
* not to filter by start time. Must be an RFC3339 timestamp with mandatory time zone offset.
*/
public Instances setTimeMax(com.google.api.client.util.DateTime timeMax) {
this.timeMax = timeMax;
return this;
}
/**
* Lower bound (inclusive) for an event's end time to filter by. Optional. The default is not
* to filter by end time. Must be an RFC3339 timestamp with mandatory time zone offset.
*/
@com.google.api.client.util.Key
private com.google.api.client.util.DateTime timeMin;
/** Lower bound (inclusive) for an event's end time to filter by. Optional. The default is not to
filter by end time. Must be an RFC3339 timestamp with mandatory time zone offset.
*/
public com.google.api.client.util.DateTime getTimeMin() {
return timeMin;
}
/**
* Lower bound (inclusive) for an event's end time to filter by. Optional. The default is not
* to filter by end time. Must be an RFC3339 timestamp with mandatory time zone offset.
*/
public Instances setTimeMin(com.google.api.client.util.DateTime timeMin) {
this.timeMin = timeMin;
return this;
}
/**
* Time zone used in the response. Optional. The default is the time zone of the calendar.
*/
@com.google.api.client.util.Key
private java.lang.String timeZone;
/** Time zone used in the response. Optional. The default is the time zone of the calendar.
*/
public java.lang.String getTimeZone() {
return timeZone;
}
/**
* Time zone used in the response. Optional. The default is the time zone of the calendar.
*/
public Instances setTimeZone(java.lang.String timeZone) {
this.timeZone = timeZone;
return this;
}
@Override
public Instances set(String parameterName, Object value) {
return (Instances) super.set(parameterName, value);
}
}
/**
* Returns events on the specified calendar.
*
* Create a request for the method "events.list".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link List#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @return the request
*/
public List list(java.lang.String calendarId) throws java.io.IOException {
List result = new List(calendarId);
initialize(result);
return result;
}
public class List extends CalendarRequest<com.google.api.services.calendar.model.Events> {
private static final String REST_PATH = "calendars/{calendarId}/events";
/**
* Returns events on the specified calendar.
*
* Create a request for the method "events.list".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link List#execute()} method to invoke the remote operation. <p>
* {@link List#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
* must be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @since 1.13
*/
protected List(java.lang.String calendarId) {
super(Calendar.this, "GET", REST_PATH, null, com.google.api.services.calendar.model.Events.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
}
@Override
public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException {
return super.executeUsingHead();
}
@Override
public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException {
return super.buildHttpRequestUsingHead();
}
@Override
public List setAlt(java.lang.String alt) {
return (List) super.setAlt(alt);
}
@Override
public List setFields(java.lang.String fields) {
return (List) super.setFields(fields);
}
@Override
public List setKey(java.lang.String key) {
return (List) super.setKey(key);
}
@Override
public List setOauthToken(java.lang.String oauthToken) {
return (List) super.setOauthToken(oauthToken);
}
@Override
public List setPrettyPrint(java.lang.Boolean prettyPrint) {
return (List) super.setPrettyPrint(prettyPrint);
}
@Override
public List setQuotaUser(java.lang.String quotaUser) {
return (List) super.setQuotaUser(quotaUser);
}
@Override
public List setUserIp(java.lang.String userIp) {
return (List) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public List setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
/**
* Whether to always include a value in the email field for the organizer, creator and
* attendees, even if no real email is available (i.e. a generated, non-working value will be
* provided). The use of this option is discouraged and should only be used by clients which
* cannot handle the absence of an email address value in the mentioned places. Optional. The
* default is False.
*/
@com.google.api.client.util.Key
private java.lang.Boolean alwaysIncludeEmail;
/** Whether to always include a value in the email field for the organizer, creator and attendees, even
if no real email is available (i.e. a generated, non-working value will be provided). The use of
this option is discouraged and should only be used by clients which cannot handle the absence of an
email address value in the mentioned places. Optional. The default is False.
*/
public java.lang.Boolean getAlwaysIncludeEmail() {
return alwaysIncludeEmail;
}
/**
* Whether to always include a value in the email field for the organizer, creator and
* attendees, even if no real email is available (i.e. a generated, non-working value will be
* provided). The use of this option is discouraged and should only be used by clients which
* cannot handle the absence of an email address value in the mentioned places. Optional. The
* default is False.
*/
public List setAlwaysIncludeEmail(java.lang.Boolean alwaysIncludeEmail) {
this.alwaysIncludeEmail = alwaysIncludeEmail;
return this;
}
/** Specifies event ID in the iCalendar format to be included in the response. Optional. */
@com.google.api.client.util.Key
private java.lang.String iCalUID;
/** Specifies event ID in the iCalendar format to be included in the response. Optional.
*/
public java.lang.String getICalUID() {
return iCalUID;
}
/** Specifies event ID in the iCalendar format to be included in the response. Optional. */
public List setICalUID(java.lang.String iCalUID) {
this.iCalUID = iCalUID;
return this;
}
/**
* The maximum number of attendees to include in the response. If there are more than the
* specified number of attendees, only the participant is returned. Optional.
*/
@com.google.api.client.util.Key
private java.lang.Integer maxAttendees;
/** The maximum number of attendees to include in the response. If there are more than the specified
number of attendees, only the participant is returned. Optional.
[minimum: 1]
*/
public java.lang.Integer getMaxAttendees() {
return maxAttendees;
}
/**
* The maximum number of attendees to include in the response. If there are more than the
* specified number of attendees, only the participant is returned. Optional.
*/
public List setMaxAttendees(java.lang.Integer maxAttendees) {
this.maxAttendees = maxAttendees;
return this;
}
/**
* Maximum number of events returned on one result page. The number of events in the resulting
* page may be less than this value, or none at all, even if there are more events matching
* the query. Incomplete pages can be detected by a non-empty nextPageToken field in the
* response. By default the value is 250 events. The page size can never be larger than 2500
* events. Optional.
*/
@com.google.api.client.util.Key
private java.lang.Integer maxResults;
/** Maximum number of events returned on one result page. The number of events in the resulting page
may be less than this value, or none at all, even if there are more events matching the query.
Incomplete pages can be detected by a non-empty nextPageToken field in the response. By default the
value is 250 events. The page size can never be larger than 2500 events. Optional. [default: 250]
[minimum: 1]
*/
public java.lang.Integer getMaxResults() {
return maxResults;
}
/**
* Maximum number of events returned on one result page. The number of events in the resulting
* page may be less than this value, or none at all, even if there are more events matching
* the query. Incomplete pages can be detected by a non-empty nextPageToken field in the
* response. By default the value is 250 events. The page size can never be larger than 2500
* events. Optional.
*/
public List setMaxResults(java.lang.Integer maxResults) {
this.maxResults = maxResults;
return this;
}
/**
* The order of the events returned in the result. Optional. The default is an unspecified,
* stable order.
*/
@com.google.api.client.util.Key
private java.lang.String orderBy;
/** The order of the events returned in the result. Optional. The default is an unspecified, stable
order.
*/
public java.lang.String getOrderBy() {
return orderBy;
}
/**
* The order of the events returned in the result. Optional. The default is an unspecified,
* stable order.
*/
public List setOrderBy(java.lang.String orderBy) {
this.orderBy = orderBy;
return this;
}
/** Token specifying which result page to return. Optional. */
@com.google.api.client.util.Key
private java.lang.String pageToken;
/** Token specifying which result page to return. Optional.
*/
public java.lang.String getPageToken() {
return pageToken;
}
/** Token specifying which result page to return. Optional. */
public List setPageToken(java.lang.String pageToken) {
this.pageToken = pageToken;
return this;
}
/**
* Extended properties constraint specified as propertyName=value. Matches only private
* properties. This parameter might be repeated multiple times to return events that match all
* given constraints.
*/
@com.google.api.client.util.Key
private java.util.List<java.lang.String> privateExtendedProperty;
/** Extended properties constraint specified as propertyName=value. Matches only private properties.
This parameter might be repeated multiple times to return events that match all given constraints.
*/
public java.util.List<java.lang.String> getPrivateExtendedProperty() {
return privateExtendedProperty;
}
/**
* Extended properties constraint specified as propertyName=value. Matches only private
* properties. This parameter might be repeated multiple times to return events that match all
* given constraints.
*/
public List setPrivateExtendedProperty(java.util.List<java.lang.String> privateExtendedProperty) {
this.privateExtendedProperty = privateExtendedProperty;
return this;
}
/**
* Free text search terms to find events that match these terms in any field, except for
* extended properties. Optional.
*/
@com.google.api.client.util.Key
private java.lang.String q;
/** Free text search terms to find events that match these terms in any field, except for extended
properties. Optional.
*/
public java.lang.String getQ() {
return q;
}
/**
* Free text search terms to find events that match these terms in any field, except for
* extended properties. Optional.
*/
public List setQ(java.lang.String q) {
this.q = q;
return this;
}
/**
* Extended properties constraint specified as propertyName=value. Matches only shared
* properties. This parameter might be repeated multiple times to return events that match all
* given constraints.
*/
@com.google.api.client.util.Key
private java.util.List<java.lang.String> sharedExtendedProperty;
/** Extended properties constraint specified as propertyName=value. Matches only shared properties.
This parameter might be repeated multiple times to return events that match all given constraints.
*/
public java.util.List<java.lang.String> getSharedExtendedProperty() {
return sharedExtendedProperty;
}
/**
* Extended properties constraint specified as propertyName=value. Matches only shared
* properties. This parameter might be repeated multiple times to return events that match all
* given constraints.
*/
public List setSharedExtendedProperty(java.util.List<java.lang.String> sharedExtendedProperty) {
this.sharedExtendedProperty = sharedExtendedProperty;
return this;
}
/**
* Whether to include deleted events (with status equals "cancelled") in the result. Cancelled
* instances of recurring events (but not the underlying recurring event) will still be
* included if showDeleted and singleEvents are both False. If showDeleted and singleEvents
* are both True, only single instances of deleted events (but not the underlying recurring
* events) are returned. Optional. The default is False.
*/
@com.google.api.client.util.Key
private java.lang.Boolean showDeleted;
/** Whether to include deleted events (with status equals "cancelled") in the result. Cancelled
instances of recurring events (but not the underlying recurring event) will still be included if
showDeleted and singleEvents are both False. If showDeleted and singleEvents are both True, only
single instances of deleted events (but not the underlying recurring events) are returned.
Optional. The default is False.
*/
public java.lang.Boolean getShowDeleted() {
return showDeleted;
}
/**
* Whether to include deleted events (with status equals "cancelled") in the result. Cancelled
* instances of recurring events (but not the underlying recurring event) will still be
* included if showDeleted and singleEvents are both False. If showDeleted and singleEvents
* are both True, only single instances of deleted events (but not the underlying recurring
* events) are returned. Optional. The default is False.
*/
public List setShowDeleted(java.lang.Boolean showDeleted) {
this.showDeleted = showDeleted;
return this;
}
/** Whether to include hidden invitations in the result. Optional. The default is False. */
@com.google.api.client.util.Key
private java.lang.Boolean showHiddenInvitations;
/** Whether to include hidden invitations in the result. Optional. The default is False.
*/
public java.lang.Boolean getShowHiddenInvitations() {
return showHiddenInvitations;
}
/** Whether to include hidden invitations in the result. Optional. The default is False. */
public List setShowHiddenInvitations(java.lang.Boolean showHiddenInvitations) {
this.showHiddenInvitations = showHiddenInvitations;
return this;
}
/**
* Whether to expand recurring events into instances and only return single one-off events and
* instances of recurring events, but not the underlying recurring events themselves.
* Optional. The default is False.
*/
@com.google.api.client.util.Key
private java.lang.Boolean singleEvents;
/** Whether to expand recurring events into instances and only return single one-off events and
instances of recurring events, but not the underlying recurring events themselves. Optional. The
default is False.
*/
public java.lang.Boolean getSingleEvents() {
return singleEvents;
}
/**
* Whether to expand recurring events into instances and only return single one-off events and
* instances of recurring events, but not the underlying recurring events themselves.
* Optional. The default is False.
*/
public List setSingleEvents(java.lang.Boolean singleEvents) {
this.singleEvents = singleEvents;
return this;
}
/**
* Token obtained from the nextSyncToken field returned on the last page of results from the
* previous list request. It makes the result of this list request contain only entries that
* have changed since then. All events deleted since the previous list request will always be
* in the result set and it is not allowed to set showDeleted to False. There are several
* query parameters that cannot be specified together with nextSyncToken to ensure consistency
* of the client state.
*
* These are: - iCalUID - orderBy - privateExtendedProperty - q - sharedExtendedProperty -
* timeMin - timeMax - updatedMin If the syncToken expires, the server will respond with a 410
* GONE response code and the client should clear its storage and perform a full
* synchronization without any syncToken. Learn more about incremental synchronization.
* Optional. The default is to return all entries.
*/
@com.google.api.client.util.Key
private java.lang.String syncToken;
/** Token obtained from the nextSyncToken field returned on the last page of results from the previous
list request. It makes the result of this list request contain only entries that have changed since
then. All events deleted since the previous list request will always be in the result set and it is
not allowed to set showDeleted to False. There are several query parameters that cannot be
specified together with nextSyncToken to ensure consistency of the client state.
These are: - iCalUID - orderBy - privateExtendedProperty - q - sharedExtendedProperty - timeMin -
timeMax - updatedMin If the syncToken expires, the server will respond with a 410 GONE response
code and the client should clear its storage and perform a full synchronization without any
syncToken. Learn more about incremental synchronization. Optional. The default is to return all
entries.
*/
public java.lang.String getSyncToken() {
return syncToken;
}
/**
* Token obtained from the nextSyncToken field returned on the last page of results from the
* previous list request. It makes the result of this list request contain only entries that
* have changed since then. All events deleted since the previous list request will always be
* in the result set and it is not allowed to set showDeleted to False. There are several
* query parameters that cannot be specified together with nextSyncToken to ensure consistency
* of the client state.
*
* These are: - iCalUID - orderBy - privateExtendedProperty - q - sharedExtendedProperty -
* timeMin - timeMax - updatedMin If the syncToken expires, the server will respond with a 410
* GONE response code and the client should clear its storage and perform a full
* synchronization without any syncToken. Learn more about incremental synchronization.
* Optional. The default is to return all entries.
*/
public List setSyncToken(java.lang.String syncToken) {
this.syncToken = syncToken;
return this;
}
/**
* Upper bound (exclusive) for an event's start time to filter by. Optional. The default is
* not to filter by start time. Must be an RFC3339 timestamp with mandatory time zone offset,
* for example, 2011-06-03T10:00:00-07:00, 2011-06-03T10:00:00Z. Milliseconds may be provided
* but are ignored. If timeMin is set, timeMax must be greater than timeMin.
*/
@com.google.api.client.util.Key
private com.google.api.client.util.DateTime timeMax;
/** Upper bound (exclusive) for an event's start time to filter by. Optional. The default is not to
filter by start time. Must be an RFC3339 timestamp with mandatory time zone offset, for example,
2011-06-03T10:00:00-07:00, 2011-06-03T10:00:00Z. Milliseconds may be provided but are ignored. If
timeMin is set, timeMax must be greater than timeMin.
*/
public com.google.api.client.util.DateTime getTimeMax() {
return timeMax;
}
/**
* Upper bound (exclusive) for an event's start time to filter by. Optional. The default is
* not to filter by start time. Must be an RFC3339 timestamp with mandatory time zone offset,
* for example, 2011-06-03T10:00:00-07:00, 2011-06-03T10:00:00Z. Milliseconds may be provided
* but are ignored. If timeMin is set, timeMax must be greater than timeMin.
*/
public List setTimeMax(com.google.api.client.util.DateTime timeMax) {
this.timeMax = timeMax;
return this;
}
/**
* Lower bound (exclusive) for an event's end time to filter by. Optional. The default is not
* to filter by end time. Must be an RFC3339 timestamp with mandatory time zone offset, for
* example, 2011-06-03T10:00:00-07:00, 2011-06-03T10:00:00Z. Milliseconds may be provided but
* are ignored. If timeMax is set, timeMin must be smaller than timeMax.
*/
@com.google.api.client.util.Key
private com.google.api.client.util.DateTime timeMin;
/** Lower bound (exclusive) for an event's end time to filter by. Optional. The default is not to
filter by end time. Must be an RFC3339 timestamp with mandatory time zone offset, for example,
2011-06-03T10:00:00-07:00, 2011-06-03T10:00:00Z. Milliseconds may be provided but are ignored. If
timeMax is set, timeMin must be smaller than timeMax.
*/
public com.google.api.client.util.DateTime getTimeMin() {
return timeMin;
}
/**
* Lower bound (exclusive) for an event's end time to filter by. Optional. The default is not
* to filter by end time. Must be an RFC3339 timestamp with mandatory time zone offset, for
* example, 2011-06-03T10:00:00-07:00, 2011-06-03T10:00:00Z. Milliseconds may be provided but
* are ignored. If timeMax is set, timeMin must be smaller than timeMax.
*/
public List setTimeMin(com.google.api.client.util.DateTime timeMin) {
this.timeMin = timeMin;
return this;
}
/**
* Time zone used in the response. Optional. The default is the time zone of the calendar.
*/
@com.google.api.client.util.Key
private java.lang.String timeZone;
/** Time zone used in the response. Optional. The default is the time zone of the calendar.
*/
public java.lang.String getTimeZone() {
return timeZone;
}
/**
* Time zone used in the response. Optional. The default is the time zone of the calendar.
*/
public List setTimeZone(java.lang.String timeZone) {
this.timeZone = timeZone;
return this;
}
/**
* Lower bound for an event's last modification time (as a RFC3339 timestamp) to filter by.
* When specified, entries deleted since this time will always be included regardless of
* showDeleted. Optional. The default is not to filter by last modification time.
*/
@com.google.api.client.util.Key
private com.google.api.client.util.DateTime updatedMin;
/** Lower bound for an event's last modification time (as a RFC3339 timestamp) to filter by. When
specified, entries deleted since this time will always be included regardless of showDeleted.
Optional. The default is not to filter by last modification time.
*/
public com.google.api.client.util.DateTime getUpdatedMin() {
return updatedMin;
}
/**
* Lower bound for an event's last modification time (as a RFC3339 timestamp) to filter by.
* When specified, entries deleted since this time will always be included regardless of
* showDeleted. Optional. The default is not to filter by last modification time.
*/
public List setUpdatedMin(com.google.api.client.util.DateTime updatedMin) {
this.updatedMin = updatedMin;
return this;
}
@Override
public List set(String parameterName, Object value) {
return (List) super.set(parameterName, value);
}
}
/**
* Moves an event to another calendar, i.e. changes an event's organizer.
*
* Create a request for the method "events.move".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Move#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier of the source calendar where the event currently is on.
* @param eventId Event identifier.
* @param destination Calendar identifier of the target calendar where the event is to be moved to.
* @return the request
*/
public Move move(java.lang.String calendarId, java.lang.String eventId, java.lang.String destination) throws java.io.IOException {
Move result = new Move(calendarId, eventId, destination);
initialize(result);
return result;
}
public class Move extends CalendarRequest<com.google.api.services.calendar.model.Event> {
private static final String REST_PATH = "calendars/{calendarId}/events/{eventId}/move";
/**
* Moves an event to another calendar, i.e. changes an event's organizer.
*
* Create a request for the method "events.move".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Move#execute()} method to invoke the remote operation. <p>
* {@link Move#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
* must be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier of the source calendar where the event currently is on.
* @param eventId Event identifier.
* @param destination Calendar identifier of the target calendar where the event is to be moved to.
* @since 1.13
*/
protected Move(java.lang.String calendarId, java.lang.String eventId, java.lang.String destination) {
super(Calendar.this, "POST", REST_PATH, null, com.google.api.services.calendar.model.Event.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
this.eventId = com.google.api.client.util.Preconditions.checkNotNull(eventId, "Required parameter eventId must be specified.");
this.destination = com.google.api.client.util.Preconditions.checkNotNull(destination, "Required parameter destination must be specified.");
}
@Override
public Move setAlt(java.lang.String alt) {
return (Move) super.setAlt(alt);
}
@Override
public Move setFields(java.lang.String fields) {
return (Move) super.setFields(fields);
}
@Override
public Move setKey(java.lang.String key) {
return (Move) super.setKey(key);
}
@Override
public Move setOauthToken(java.lang.String oauthToken) {
return (Move) super.setOauthToken(oauthToken);
}
@Override
public Move setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Move) super.setPrettyPrint(prettyPrint);
}
@Override
public Move setQuotaUser(java.lang.String quotaUser) {
return (Move) super.setQuotaUser(quotaUser);
}
@Override
public Move setUserIp(java.lang.String userIp) {
return (Move) super.setUserIp(userIp);
}
/** Calendar identifier of the source calendar where the event currently is on. */
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier of the source calendar where the event currently is on.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/** Calendar identifier of the source calendar where the event currently is on. */
public Move setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
/** Event identifier. */
@com.google.api.client.util.Key
private java.lang.String eventId;
/** Event identifier.
*/
public java.lang.String getEventId() {
return eventId;
}
/** Event identifier. */
public Move setEventId(java.lang.String eventId) {
this.eventId = eventId;
return this;
}
/** Calendar identifier of the target calendar where the event is to be moved to. */
@com.google.api.client.util.Key
private java.lang.String destination;
/** Calendar identifier of the target calendar where the event is to be moved to.
*/
public java.lang.String getDestination() {
return destination;
}
/** Calendar identifier of the target calendar where the event is to be moved to. */
public Move setDestination(java.lang.String destination) {
this.destination = destination;
return this;
}
/**
* Deprecated. Please use sendUpdates instead.
*
* Whether to send notifications about the change of the event's organizer. Note that some
* emails might still be sent even if you set the value to false. The default is false.
*/
@com.google.api.client.util.Key
private java.lang.Boolean sendNotifications;
/** Deprecated. Please use sendUpdates instead.
Whether to send notifications about the change of the event's organizer. Note that some emails
might still be sent even if you set the value to false. The default is false.
*/
public java.lang.Boolean getSendNotifications() {
return sendNotifications;
}
/**
* Deprecated. Please use sendUpdates instead.
*
* Whether to send notifications about the change of the event's organizer. Note that some
* emails might still be sent even if you set the value to false. The default is false.
*/
public Move setSendNotifications(java.lang.Boolean sendNotifications) {
this.sendNotifications = sendNotifications;
return this;
}
/** Guests who should receive notifications about the change of the event's organizer. */
@com.google.api.client.util.Key
private java.lang.String sendUpdates;
/** Guests who should receive notifications about the change of the event's organizer.
*/
public java.lang.String getSendUpdates() {
return sendUpdates;
}
/** Guests who should receive notifications about the change of the event's organizer. */
public Move setSendUpdates(java.lang.String sendUpdates) {
this.sendUpdates = sendUpdates;
return this;
}
@Override
public Move set(String parameterName, Object value) {
return (Move) super.set(parameterName, value);
}
}
/**
* Updates an event. This method supports patch semantics.
*
* Create a request for the method "events.patch".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Patch#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param eventId Event identifier.
* @param content the {@link com.google.api.services.calendar.model.Event}
* @return the request
*/
public Patch patch(java.lang.String calendarId, java.lang.String eventId, com.google.api.services.calendar.model.Event content) throws java.io.IOException {
Patch result = new Patch(calendarId, eventId, content);
initialize(result);
return result;
}
public class Patch extends CalendarRequest<com.google.api.services.calendar.model.Event> {
private static final String REST_PATH = "calendars/{calendarId}/events/{eventId}";
/**
* Updates an event. This method supports patch semantics.
*
* Create a request for the method "events.patch".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Patch#execute()} method to invoke the remote operation.
* <p> {@link
* Patch#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param eventId Event identifier.
* @param content the {@link com.google.api.services.calendar.model.Event}
* @since 1.13
*/
protected Patch(java.lang.String calendarId, java.lang.String eventId, com.google.api.services.calendar.model.Event content) {
super(Calendar.this, "PATCH", REST_PATH, content, com.google.api.services.calendar.model.Event.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
this.eventId = com.google.api.client.util.Preconditions.checkNotNull(eventId, "Required parameter eventId must be specified.");
}
@Override
public Patch setAlt(java.lang.String alt) {
return (Patch) super.setAlt(alt);
}
@Override
public Patch setFields(java.lang.String fields) {
return (Patch) super.setFields(fields);
}
@Override
public Patch setKey(java.lang.String key) {
return (Patch) super.setKey(key);
}
@Override
public Patch setOauthToken(java.lang.String oauthToken) {
return (Patch) super.setOauthToken(oauthToken);
}
@Override
public Patch setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Patch) super.setPrettyPrint(prettyPrint);
}
@Override
public Patch setQuotaUser(java.lang.String quotaUser) {
return (Patch) super.setQuotaUser(quotaUser);
}
@Override
public Patch setUserIp(java.lang.String userIp) {
return (Patch) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public Patch setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
/** Event identifier. */
@com.google.api.client.util.Key
private java.lang.String eventId;
/** Event identifier.
*/
public java.lang.String getEventId() {
return eventId;
}
/** Event identifier. */
public Patch setEventId(java.lang.String eventId) {
this.eventId = eventId;
return this;
}
/**
* Whether to always include a value in the email field for the organizer, creator and
* attendees, even if no real email is available (i.e. a generated, non-working value will be
* provided). The use of this option is discouraged and should only be used by clients which
* cannot handle the absence of an email address value in the mentioned places. Optional. The
* default is False.
*/
@com.google.api.client.util.Key
private java.lang.Boolean alwaysIncludeEmail;
/** Whether to always include a value in the email field for the organizer, creator and attendees, even
if no real email is available (i.e. a generated, non-working value will be provided). The use of
this option is discouraged and should only be used by clients which cannot handle the absence of an
email address value in the mentioned places. Optional. The default is False.
*/
public java.lang.Boolean getAlwaysIncludeEmail() {
return alwaysIncludeEmail;
}
/**
* Whether to always include a value in the email field for the organizer, creator and
* attendees, even if no real email is available (i.e. a generated, non-working value will be
* provided). The use of this option is discouraged and should only be used by clients which
* cannot handle the absence of an email address value in the mentioned places. Optional. The
* default is False.
*/
public Patch setAlwaysIncludeEmail(java.lang.Boolean alwaysIncludeEmail) {
this.alwaysIncludeEmail = alwaysIncludeEmail;
return this;
}
/**
* Version number of conference data supported by the API client. Version 0 assumes no
* conference data support and ignores conference data in the event's body. Version 1 enables
* support for copying of ConferenceData as well as for creating new conferences using the
* createRequest field of conferenceData. The default is 0.
*/
@com.google.api.client.util.Key
private java.lang.Integer conferenceDataVersion;
/** Version number of conference data supported by the API client. Version 0 assumes no conference data
support and ignores conference data in the event's body. Version 1 enables support for copying of
ConferenceData as well as for creating new conferences using the createRequest field of
conferenceData. The default is 0.
[minimum: 0] [maximum: 1]
*/
public java.lang.Integer getConferenceDataVersion() {
return conferenceDataVersion;
}
/**
* Version number of conference data supported by the API client. Version 0 assumes no
* conference data support and ignores conference data in the event's body. Version 1 enables
* support for copying of ConferenceData as well as for creating new conferences using the
* createRequest field of conferenceData. The default is 0.
*/
public Patch setConferenceDataVersion(java.lang.Integer conferenceDataVersion) {
this.conferenceDataVersion = conferenceDataVersion;
return this;
}
/**
* The maximum number of attendees to include in the response. If there are more than the
* specified number of attendees, only the participant is returned. Optional.
*/
@com.google.api.client.util.Key
private java.lang.Integer maxAttendees;
/** The maximum number of attendees to include in the response. If there are more than the specified
number of attendees, only the participant is returned. Optional.
[minimum: 1]
*/
public java.lang.Integer getMaxAttendees() {
return maxAttendees;
}
/**
* The maximum number of attendees to include in the response. If there are more than the
* specified number of attendees, only the participant is returned. Optional.
*/
public Patch setMaxAttendees(java.lang.Integer maxAttendees) {
this.maxAttendees = maxAttendees;
return this;
}
/**
* Deprecated. Please use sendUpdates instead.
*
* Whether to send notifications about the event update (for example, description changes,
* etc.). Note that some emails might still be sent even if you set the value to false. The
* default is false.
*/
@com.google.api.client.util.Key
private java.lang.Boolean sendNotifications;
/** Deprecated. Please use sendUpdates instead.
Whether to send notifications about the event update (for example, description changes, etc.). Note
that some emails might still be sent even if you set the value to false. The default is false.
*/
public java.lang.Boolean getSendNotifications() {
return sendNotifications;
}
/**
* Deprecated. Please use sendUpdates instead.
*
* Whether to send notifications about the event update (for example, description changes,
* etc.). Note that some emails might still be sent even if you set the value to false. The
* default is false.
*/
public Patch setSendNotifications(java.lang.Boolean sendNotifications) {
this.sendNotifications = sendNotifications;
return this;
}
/**
* Guests who should receive notifications about the event update (for example, title changes,
* etc.).
*/
@com.google.api.client.util.Key
private java.lang.String sendUpdates;
/** Guests who should receive notifications about the event update (for example, title changes, etc.).
*/
public java.lang.String getSendUpdates() {
return sendUpdates;
}
/**
* Guests who should receive notifications about the event update (for example, title changes,
* etc.).
*/
public Patch setSendUpdates(java.lang.String sendUpdates) {
this.sendUpdates = sendUpdates;
return this;
}
/**
* Whether API client performing operation supports event attachments. Optional. The default
* is False.
*/
@com.google.api.client.util.Key
private java.lang.Boolean supportsAttachments;
/** Whether API client performing operation supports event attachments. Optional. The default is False.
*/
public java.lang.Boolean getSupportsAttachments() {
return supportsAttachments;
}
/**
* Whether API client performing operation supports event attachments. Optional. The default
* is False.
*/
public Patch setSupportsAttachments(java.lang.Boolean supportsAttachments) {
this.supportsAttachments = supportsAttachments;
return this;
}
@Override
public Patch set(String parameterName, Object value) {
return (Patch) super.set(parameterName, value);
}
}
/**
* Creates an event based on a simple text string.
*
* Create a request for the method "events.quickAdd".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link QuickAdd#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param text The text describing the event to be created.
* @return the request
*/
public QuickAdd quickAdd(java.lang.String calendarId, java.lang.String text) throws java.io.IOException {
QuickAdd result = new QuickAdd(calendarId, text);
initialize(result);
return result;
}
public class QuickAdd extends CalendarRequest<com.google.api.services.calendar.model.Event> {
private static final String REST_PATH = "calendars/{calendarId}/events/quickAdd";
/**
* Creates an event based on a simple text string.
*
* Create a request for the method "events.quickAdd".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link QuickAdd#execute()} method to invoke the remote operation.
* <p> {@link
* QuickAdd#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
* must be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param text The text describing the event to be created.
* @since 1.13
*/
protected QuickAdd(java.lang.String calendarId, java.lang.String text) {
super(Calendar.this, "POST", REST_PATH, null, com.google.api.services.calendar.model.Event.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
this.text = com.google.api.client.util.Preconditions.checkNotNull(text, "Required parameter text must be specified.");
}
@Override
public QuickAdd setAlt(java.lang.String alt) {
return (QuickAdd) super.setAlt(alt);
}
@Override
public QuickAdd setFields(java.lang.String fields) {
return (QuickAdd) super.setFields(fields);
}
@Override
public QuickAdd setKey(java.lang.String key) {
return (QuickAdd) super.setKey(key);
}
@Override
public QuickAdd setOauthToken(java.lang.String oauthToken) {
return (QuickAdd) super.setOauthToken(oauthToken);
}
@Override
public QuickAdd setPrettyPrint(java.lang.Boolean prettyPrint) {
return (QuickAdd) super.setPrettyPrint(prettyPrint);
}
@Override
public QuickAdd setQuotaUser(java.lang.String quotaUser) {
return (QuickAdd) super.setQuotaUser(quotaUser);
}
@Override
public QuickAdd setUserIp(java.lang.String userIp) {
return (QuickAdd) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public QuickAdd setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
/** The text describing the event to be created. */
@com.google.api.client.util.Key
private java.lang.String text;
/** The text describing the event to be created.
*/
public java.lang.String getText() {
return text;
}
/** The text describing the event to be created. */
public QuickAdd setText(java.lang.String text) {
this.text = text;
return this;
}
/**
* Deprecated. Please use sendUpdates instead.
*
* Whether to send notifications about the creation of the event. Note that some emails might
* still be sent even if you set the value to false. The default is false.
*/
@com.google.api.client.util.Key
private java.lang.Boolean sendNotifications;
/** Deprecated. Please use sendUpdates instead.
Whether to send notifications about the creation of the event. Note that some emails might still be
sent even if you set the value to false. The default is false.
*/
public java.lang.Boolean getSendNotifications() {
return sendNotifications;
}
/**
* Deprecated. Please use sendUpdates instead.
*
* Whether to send notifications about the creation of the event. Note that some emails might
* still be sent even if you set the value to false. The default is false.
*/
public QuickAdd setSendNotifications(java.lang.Boolean sendNotifications) {
this.sendNotifications = sendNotifications;
return this;
}
/** Guests who should receive notifications about the creation of the new event. */
@com.google.api.client.util.Key
private java.lang.String sendUpdates;
/** Guests who should receive notifications about the creation of the new event.
*/
public java.lang.String getSendUpdates() {
return sendUpdates;
}
/** Guests who should receive notifications about the creation of the new event. */
public QuickAdd setSendUpdates(java.lang.String sendUpdates) {
this.sendUpdates = sendUpdates;
return this;
}
@Override
public QuickAdd set(String parameterName, Object value) {
return (QuickAdd) super.set(parameterName, value);
}
}
/**
* Updates an event.
*
* Create a request for the method "events.update".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Update#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param eventId Event identifier.
* @param content the {@link com.google.api.services.calendar.model.Event}
* @return the request
*/
public Update update(java.lang.String calendarId, java.lang.String eventId, com.google.api.services.calendar.model.Event content) throws java.io.IOException {
Update result = new Update(calendarId, eventId, content);
initialize(result);
return result;
}
public class Update extends CalendarRequest<com.google.api.services.calendar.model.Event> {
private static final String REST_PATH = "calendars/{calendarId}/events/{eventId}";
/**
* Updates an event.
*
* Create a request for the method "events.update".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Update#execute()} method to invoke the remote operation.
* <p> {@link
* Update#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param eventId Event identifier.
* @param content the {@link com.google.api.services.calendar.model.Event}
* @since 1.13
*/
protected Update(java.lang.String calendarId, java.lang.String eventId, com.google.api.services.calendar.model.Event content) {
super(Calendar.this, "PUT", REST_PATH, content, com.google.api.services.calendar.model.Event.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
this.eventId = com.google.api.client.util.Preconditions.checkNotNull(eventId, "Required parameter eventId must be specified.");
}
@Override
public Update setAlt(java.lang.String alt) {
return (Update) super.setAlt(alt);
}
@Override
public Update setFields(java.lang.String fields) {
return (Update) super.setFields(fields);
}
@Override
public Update setKey(java.lang.String key) {
return (Update) super.setKey(key);
}
@Override
public Update setOauthToken(java.lang.String oauthToken) {
return (Update) super.setOauthToken(oauthToken);
}
@Override
public Update setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Update) super.setPrettyPrint(prettyPrint);
}
@Override
public Update setQuotaUser(java.lang.String quotaUser) {
return (Update) super.setQuotaUser(quotaUser);
}
@Override
public Update setUserIp(java.lang.String userIp) {
return (Update) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public Update setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
/** Event identifier. */
@com.google.api.client.util.Key
private java.lang.String eventId;
/** Event identifier.
*/
public java.lang.String getEventId() {
return eventId;
}
/** Event identifier. */
public Update setEventId(java.lang.String eventId) {
this.eventId = eventId;
return this;
}
/**
* Whether to always include a value in the email field for the organizer, creator and
* attendees, even if no real email is available (i.e. a generated, non-working value will be
* provided). The use of this option is discouraged and should only be used by clients which
* cannot handle the absence of an email address value in the mentioned places. Optional. The
* default is False.
*/
@com.google.api.client.util.Key
private java.lang.Boolean alwaysIncludeEmail;
/** Whether to always include a value in the email field for the organizer, creator and attendees, even
if no real email is available (i.e. a generated, non-working value will be provided). The use of
this option is discouraged and should only be used by clients which cannot handle the absence of an
email address value in the mentioned places. Optional. The default is False.
*/
public java.lang.Boolean getAlwaysIncludeEmail() {
return alwaysIncludeEmail;
}
/**
* Whether to always include a value in the email field for the organizer, creator and
* attendees, even if no real email is available (i.e. a generated, non-working value will be
* provided). The use of this option is discouraged and should only be used by clients which
* cannot handle the absence of an email address value in the mentioned places. Optional. The
* default is False.
*/
public Update setAlwaysIncludeEmail(java.lang.Boolean alwaysIncludeEmail) {
this.alwaysIncludeEmail = alwaysIncludeEmail;
return this;
}
/**
* Version number of conference data supported by the API client. Version 0 assumes no
* conference data support and ignores conference data in the event's body. Version 1 enables
* support for copying of ConferenceData as well as for creating new conferences using the
* createRequest field of conferenceData. The default is 0.
*/
@com.google.api.client.util.Key
private java.lang.Integer conferenceDataVersion;
/** Version number of conference data supported by the API client. Version 0 assumes no conference data
support and ignores conference data in the event's body. Version 1 enables support for copying of
ConferenceData as well as for creating new conferences using the createRequest field of
conferenceData. The default is 0.
[minimum: 0] [maximum: 1]
*/
public java.lang.Integer getConferenceDataVersion() {
return conferenceDataVersion;
}
/**
* Version number of conference data supported by the API client. Version 0 assumes no
* conference data support and ignores conference data in the event's body. Version 1 enables
* support for copying of ConferenceData as well as for creating new conferences using the
* createRequest field of conferenceData. The default is 0.
*/
public Update setConferenceDataVersion(java.lang.Integer conferenceDataVersion) {
this.conferenceDataVersion = conferenceDataVersion;
return this;
}
/**
* The maximum number of attendees to include in the response. If there are more than the
* specified number of attendees, only the participant is returned. Optional.
*/
@com.google.api.client.util.Key
private java.lang.Integer maxAttendees;
/** The maximum number of attendees to include in the response. If there are more than the specified
number of attendees, only the participant is returned. Optional.
[minimum: 1]
*/
public java.lang.Integer getMaxAttendees() {
return maxAttendees;
}
/**
* The maximum number of attendees to include in the response. If there are more than the
* specified number of attendees, only the participant is returned. Optional.
*/
public Update setMaxAttendees(java.lang.Integer maxAttendees) {
this.maxAttendees = maxAttendees;
return this;
}
/**
* Deprecated. Please use sendUpdates instead.
*
* Whether to send notifications about the event update (for example, description changes,
* etc.). Note that some emails might still be sent even if you set the value to false. The
* default is false.
*/
@com.google.api.client.util.Key
private java.lang.Boolean sendNotifications;
/** Deprecated. Please use sendUpdates instead.
Whether to send notifications about the event update (for example, description changes, etc.). Note
that some emails might still be sent even if you set the value to false. The default is false.
*/
public java.lang.Boolean getSendNotifications() {
return sendNotifications;
}
/**
* Deprecated. Please use sendUpdates instead.
*
* Whether to send notifications about the event update (for example, description changes,
* etc.). Note that some emails might still be sent even if you set the value to false. The
* default is false.
*/
public Update setSendNotifications(java.lang.Boolean sendNotifications) {
this.sendNotifications = sendNotifications;
return this;
}
/**
* Guests who should receive notifications about the event update (for example, title changes,
* etc.).
*/
@com.google.api.client.util.Key
private java.lang.String sendUpdates;
/** Guests who should receive notifications about the event update (for example, title changes, etc.).
*/
public java.lang.String getSendUpdates() {
return sendUpdates;
}
/**
* Guests who should receive notifications about the event update (for example, title changes,
* etc.).
*/
public Update setSendUpdates(java.lang.String sendUpdates) {
this.sendUpdates = sendUpdates;
return this;
}
/**
* Whether API client performing operation supports event attachments. Optional. The default
* is False.
*/
@com.google.api.client.util.Key
private java.lang.Boolean supportsAttachments;
/** Whether API client performing operation supports event attachments. Optional. The default is False.
*/
public java.lang.Boolean getSupportsAttachments() {
return supportsAttachments;
}
/**
* Whether API client performing operation supports event attachments. Optional. The default
* is False.
*/
public Update setSupportsAttachments(java.lang.Boolean supportsAttachments) {
this.supportsAttachments = supportsAttachments;
return this;
}
@Override
public Update set(String parameterName, Object value) {
return (Update) super.set(parameterName, value);
}
}
/**
* Watch for changes to Events resources.
*
* Create a request for the method "events.watch".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Watch#execute()} method to invoke the remote operation.
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param content the {@link com.google.api.services.calendar.model.Channel}
* @return the request
*/
public Watch watch(java.lang.String calendarId, com.google.api.services.calendar.model.Channel content) throws java.io.IOException {
Watch result = new Watch(calendarId, content);
initialize(result);
return result;
}
public class Watch extends CalendarRequest<com.google.api.services.calendar.model.Channel> {
private static final String REST_PATH = "calendars/{calendarId}/events/watch";
/**
* Watch for changes to Events resources.
*
* Create a request for the method "events.watch".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Watch#execute()} method to invoke the remote operation.
* <p> {@link
* Watch#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param calendarId Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
* access the primary calendar of the currently logged in user, use the "primary" keyword.
* @param content the {@link com.google.api.services.calendar.model.Channel}
* @since 1.13
*/
protected Watch(java.lang.String calendarId, com.google.api.services.calendar.model.Channel content) {
super(Calendar.this, "POST", REST_PATH, content, com.google.api.services.calendar.model.Channel.class);
this.calendarId = com.google.api.client.util.Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
}
@Override
public Watch setAlt(java.lang.String alt) {
return (Watch) super.setAlt(alt);
}
@Override
public Watch setFields(java.lang.String fields) {
return (Watch) super.setFields(fields);
}
@Override
public Watch setKey(java.lang.String key) {
return (Watch) super.setKey(key);
}
@Override
public Watch setOauthToken(java.lang.String oauthToken) {
return (Watch) super.setOauthToken(oauthToken);
}
@Override
public Watch setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Watch) super.setPrettyPrint(prettyPrint);
}
@Override
public Watch setQuotaUser(java.lang.String quotaUser) {
return (Watch) super.setQuotaUser(quotaUser);
}
@Override
public Watch setUserIp(java.lang.String userIp) {
return (Watch) super.setUserIp(userIp);
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
@com.google.api.client.util.Key
private java.lang.String calendarId;
/** Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to
access the primary calendar of the currently logged in user, use the "primary" keyword.
*/
public java.lang.String getCalendarId() {
return calendarId;
}
/**
* Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you
* want to access the primary calendar of the currently logged in user, use the "primary"
* keyword.
*/
public Watch setCalendarId(java.lang.String calendarId) {
this.calendarId = calendarId;
return this;
}
/**
* Whether to always include a value in the email field for the organizer, creator and
* attendees, even if no real email is available (i.e. a generated, non-working value will be
* provided). The use of this option is discouraged and should only be used by clients which
* cannot handle the absence of an email address value in the mentioned places. Optional. The
* default is False.
*/
@com.google.api.client.util.Key
private java.lang.Boolean alwaysIncludeEmail;
/** Whether to always include a value in the email field for the organizer, creator and attendees, even
if no real email is available (i.e. a generated, non-working value will be provided). The use of
this option is discouraged and should only be used by clients which cannot handle the absence of an
email address value in the mentioned places. Optional. The default is False.
*/
public java.lang.Boolean getAlwaysIncludeEmail() {
return alwaysIncludeEmail;
}
/**
* Whether to always include a value in the email field for the organizer, creator and
* attendees, even if no real email is available (i.e. a generated, non-working value will be
* provided). The use of this option is discouraged and should only be used by clients which
* cannot handle the absence of an email address value in the mentioned places. Optional. The
* default is False.
*/
public Watch setAlwaysIncludeEmail(java.lang.Boolean alwaysIncludeEmail) {
this.alwaysIncludeEmail = alwaysIncludeEmail;
return this;
}
/** Specifies event ID in the iCalendar format to be included in the response. Optional. */
@com.google.api.client.util.Key
private java.lang.String iCalUID;
/** Specifies event ID in the iCalendar format to be included in the response. Optional.
*/
public java.lang.String getICalUID() {
return iCalUID;
}
/** Specifies event ID in the iCalendar format to be included in the response. Optional. */
public Watch setICalUID(java.lang.String iCalUID) {
this.iCalUID = iCalUID;
return this;
}
/**
* The maximum number of attendees to include in the response. If there are more than the
* specified number of attendees, only the participant is returned. Optional.
*/
@com.google.api.client.util.Key
private java.lang.Integer maxAttendees;
/** The maximum number of attendees to include in the response. If there are more than the specified
number of attendees, only the participant is returned. Optional.
[minimum: 1]
*/
public java.lang.Integer getMaxAttendees() {
return maxAttendees;
}
/**
* The maximum number of attendees to include in the response. If there are more than the
* specified number of attendees, only the participant is returned. Optional.
*/
public Watch setMaxAttendees(java.lang.Integer maxAttendees) {
this.maxAttendees = maxAttendees;
return this;
}
/**
* Maximum number of events returned on one result page. The number of events in the resulting
* page may be less than this value, or none at all, even if there are more events matching
* the query. Incomplete pages can be detected by a non-empty nextPageToken field in the
* response. By default the value is 250 events. The page size can never be larger than 2500
* events. Optional.
*/
@com.google.api.client.util.Key
private java.lang.Integer maxResults;
/** Maximum number of events returned on one result page. The number of events in the resulting page
may be less than this value, or none at all, even if there are more events matching the query.
Incomplete pages can be detected by a non-empty nextPageToken field in the response. By default the
value is 250 events. The page size can never be larger than 2500 events. Optional. [default: 250]
[minimum: 1]
*/
public java.lang.Integer getMaxResults() {
return maxResults;
}
/**
* Maximum number of events returned on one result page. The number of events in the resulting
* page may be less than this value, or none at all, even if there are more events matching
* the query. Incomplete pages can be detected by a non-empty nextPageToken field in the
* response. By default the value is 250 events. The page size can never be larger than 2500
* events. Optional.
*/
public Watch setMaxResults(java.lang.Integer maxResults) {
this.maxResults = maxResults;
return this;
}
/**
* The order of the events returned in the result. Optional. The default is an unspecified,
* stable order.
*/
@com.google.api.client.util.Key
private java.lang.String orderBy;
/** The order of the events returned in the result. Optional. The default is an unspecified, stable
order.
*/
public java.lang.String getOrderBy() {
return orderBy;
}
/**
* The order of the events returned in the result. Optional. The default is an unspecified,
* stable order.
*/
public Watch setOrderBy(java.lang.String orderBy) {
this.orderBy = orderBy;
return this;
}
/** Token specifying which result page to return. Optional. */
@com.google.api.client.util.Key
private java.lang.String pageToken;
/** Token specifying which result page to return. Optional.
*/
public java.lang.String getPageToken() {
return pageToken;
}
/** Token specifying which result page to return. Optional. */
public Watch setPageToken(java.lang.String pageToken) {
this.pageToken = pageToken;
return this;
}
/**
* Extended properties constraint specified as propertyName=value. Matches only private
* properties. This parameter might be repeated multiple times to return events that match all
* given constraints.
*/
@com.google.api.client.util.Key
private java.util.List<java.lang.String> privateExtendedProperty;
/** Extended properties constraint specified as propertyName=value. Matches only private properties.
This parameter might be repeated multiple times to return events that match all given constraints.
*/
public java.util.List<java.lang.String> getPrivateExtendedProperty() {
return privateExtendedProperty;
}
/**
* Extended properties constraint specified as propertyName=value. Matches only private
* properties. This parameter might be repeated multiple times to return events that match all
* given constraints.
*/
public Watch setPrivateExtendedProperty(java.util.List<java.lang.String> privateExtendedProperty) {
this.privateExtendedProperty = privateExtendedProperty;
return this;
}
/**
* Free text search terms to find events that match these terms in any field, except for
* extended properties. Optional.
*/
@com.google.api.client.util.Key
private java.lang.String q;
/** Free text search terms to find events that match these terms in any field, except for extended
properties. Optional.
*/
public java.lang.String getQ() {
return q;
}
/**
* Free text search terms to find events that match these terms in any field, except for
* extended properties. Optional.
*/
public Watch setQ(java.lang.String q) {
this.q = q;
return this;
}
/**
* Extended properties constraint specified as propertyName=value. Matches only shared
* properties. This parameter might be repeated multiple times to return events that match all
* given constraints.
*/
@com.google.api.client.util.Key
private java.util.List<java.lang.String> sharedExtendedProperty;
/** Extended properties constraint specified as propertyName=value. Matches only shared properties.
This parameter might be repeated multiple times to return events that match all given constraints.
*/
public java.util.List<java.lang.String> getSharedExtendedProperty() {
return sharedExtendedProperty;
}
/**
* Extended properties constraint specified as propertyName=value. Matches only shared
* properties. This parameter might be repeated multiple times to return events that match all
* given constraints.
*/
public Watch setSharedExtendedProperty(java.util.List<java.lang.String> sharedExtendedProperty) {
this.sharedExtendedProperty = sharedExtendedProperty;
return this;
}
/**
* Whether to include deleted events (with status equals "cancelled") in the result. Cancelled
* instances of recurring events (but not the underlying recurring event) will still be
* included if showDeleted and singleEvents are both False. If showDeleted and singleEvents
* are both True, only single instances of deleted events (but not the underlying recurring
* events) are returned. Optional. The default is False.
*/
@com.google.api.client.util.Key
private java.lang.Boolean showDeleted;
/** Whether to include deleted events (with status equals "cancelled") in the result. Cancelled
instances of recurring events (but not the underlying recurring event) will still be included if
showDeleted and singleEvents are both False. If showDeleted and singleEvents are both True, only
single instances of deleted events (but not the underlying recurring events) are returned.
Optional. The default is False.
*/
public java.lang.Boolean getShowDeleted() {
return showDeleted;
}
/**
* Whether to include deleted events (with status equals "cancelled") in the result. Cancelled
* instances of recurring events (but not the underlying recurring event) will still be
* included if showDeleted and singleEvents are both False. If showDeleted and singleEvents
* are both True, only single instances of deleted events (but not the underlying recurring
* events) are returned. Optional. The default is False.
*/
public Watch setShowDeleted(java.lang.Boolean showDeleted) {
this.showDeleted = showDeleted;
return this;
}
/** Whether to include hidden invitations in the result. Optional. The default is False. */
@com.google.api.client.util.Key
private java.lang.Boolean showHiddenInvitations;
/** Whether to include hidden invitations in the result. Optional. The default is False.
*/
public java.lang.Boolean getShowHiddenInvitations() {
return showHiddenInvitations;
}
/** Whether to include hidden invitations in the result. Optional. The default is False. */
public Watch setShowHiddenInvitations(java.lang.Boolean showHiddenInvitations) {
this.showHiddenInvitations = showHiddenInvitations;
return this;
}
/**
* Whether to expand recurring events into instances and only return single one-off events and
* instances of recurring events, but not the underlying recurring events themselves.
* Optional. The default is False.
*/
@com.google.api.client.util.Key
private java.lang.Boolean singleEvents;
/** Whether to expand recurring events into instances and only return single one-off events and
instances of recurring events, but not the underlying recurring events themselves. Optional. The
default is False.
*/
public java.lang.Boolean getSingleEvents() {
return singleEvents;
}
/**
* Whether to expand recurring events into instances and only return single one-off events and
* instances of recurring events, but not the underlying recurring events themselves.
* Optional. The default is False.
*/
public Watch setSingleEvents(java.lang.Boolean singleEvents) {
this.singleEvents = singleEvents;
return this;
}
/**
* Token obtained from the nextSyncToken field returned on the last page of results from the
* previous list request. It makes the result of this list request contain only entries that
* have changed since then. All events deleted since the previous list request will always be
* in the result set and it is not allowed to set showDeleted to False. There are several
* query parameters that cannot be specified together with nextSyncToken to ensure consistency
* of the client state.
*
* These are: - iCalUID - orderBy - privateExtendedProperty - q - sharedExtendedProperty -
* timeMin - timeMax - updatedMin If the syncToken expires, the server will respond with a 410
* GONE response code and the client should clear its storage and perform a full
* synchronization without any syncToken. Learn more about incremental synchronization.
* Optional. The default is to return all entries.
*/
@com.google.api.client.util.Key
private java.lang.String syncToken;
/** Token obtained from the nextSyncToken field returned on the last page of results from the previous
list request. It makes the result of this list request contain only entries that have changed since
then. All events deleted since the previous list request will always be in the result set and it is
not allowed to set showDeleted to False. There are several query parameters that cannot be
specified together with nextSyncToken to ensure consistency of the client state.
These are: - iCalUID - orderBy - privateExtendedProperty - q - sharedExtendedProperty - timeMin -
timeMax - updatedMin If the syncToken expires, the server will respond with a 410 GONE response
code and the client should clear its storage and perform a full synchronization without any
syncToken. Learn more about incremental synchronization. Optional. The default is to return all
entries.
*/
public java.lang.String getSyncToken() {
return syncToken;
}
/**
* Token obtained from the nextSyncToken field returned on the last page of results from the
* previous list request. It makes the result of this list request contain only entries that
* have changed since then. All events deleted since the previous list request will always be
* in the result set and it is not allowed to set showDeleted to False. There are several
* query parameters that cannot be specified together with nextSyncToken to ensure consistency
* of the client state.
*
* These are: - iCalUID - orderBy - privateExtendedProperty - q - sharedExtendedProperty -
* timeMin - timeMax - updatedMin If the syncToken expires, the server will respond with a 410
* GONE response code and the client should clear its storage and perform a full
* synchronization without any syncToken. Learn more about incremental synchronization.
* Optional. The default is to return all entries.
*/
public Watch setSyncToken(java.lang.String syncToken) {
this.syncToken = syncToken;
return this;
}
/**
* Upper bound (exclusive) for an event's start time to filter by. Optional. The default is
* not to filter by start time. Must be an RFC3339 timestamp with mandatory time zone offset,
* for example, 2011-06-03T10:00:00-07:00, 2011-06-03T10:00:00Z. Milliseconds may be provided
* but are ignored. If timeMin is set, timeMax must be greater than timeMin.
*/
@com.google.api.client.util.Key
private com.google.api.client.util.DateTime timeMax;
/** Upper bound (exclusive) for an event's start time to filter by. Optional. The default is not to
filter by start time. Must be an RFC3339 timestamp with mandatory time zone offset, for example,
2011-06-03T10:00:00-07:00, 2011-06-03T10:00:00Z. Milliseconds may be provided but are ignored. If
timeMin is set, timeMax must be greater than timeMin.
*/
public com.google.api.client.util.DateTime getTimeMax() {
return timeMax;
}
/**
* Upper bound (exclusive) for an event's start time to filter by. Optional. The default is
* not to filter by start time. Must be an RFC3339 timestamp with mandatory time zone offset,
* for example, 2011-06-03T10:00:00-07:00, 2011-06-03T10:00:00Z. Milliseconds may be provided
* but are ignored. If timeMin is set, timeMax must be greater than timeMin.
*/
public Watch setTimeMax(com.google.api.client.util.DateTime timeMax) {
this.timeMax = timeMax;
return this;
}
/**
* Lower bound (exclusive) for an event's end time to filter by. Optional. The default is not
* to filter by end time. Must be an RFC3339 timestamp with mandatory time zone offset, for
* example, 2011-06-03T10:00:00-07:00, 2011-06-03T10:00:00Z. Milliseconds may be provided but
* are ignored. If timeMax is set, timeMin must be smaller than timeMax.
*/
@com.google.api.client.util.Key
private com.google.api.client.util.DateTime timeMin;
/** Lower bound (exclusive) for an event's end time to filter by. Optional. The default is not to
filter by end time. Must be an RFC3339 timestamp with mandatory time zone offset, for example,
2011-06-03T10:00:00-07:00, 2011-06-03T10:00:00Z. Milliseconds may be provided but are ignored. If
timeMax is set, timeMin must be smaller than timeMax.
*/
public com.google.api.client.util.DateTime getTimeMin() {
return timeMin;
}
/**
* Lower bound (exclusive) for an event's end time to filter by. Optional. The default is not
* to filter by end time. Must be an RFC3339 timestamp with mandatory time zone offset, for
* example, 2011-06-03T10:00:00-07:00, 2011-06-03T10:00:00Z. Milliseconds may be provided but
* are ignored. If timeMax is set, timeMin must be smaller than timeMax.
*/
public Watch setTimeMin(com.google.api.client.util.DateTime timeMin) {
this.timeMin = timeMin;
return this;
}
/**
* Time zone used in the response. Optional. The default is the time zone of the calendar.
*/
@com.google.api.client.util.Key
private java.lang.String timeZone;
/** Time zone used in the response. Optional. The default is the time zone of the calendar.
*/
public java.lang.String getTimeZone() {
return timeZone;
}
/**
* Time zone used in the response. Optional. The default is the time zone of the calendar.
*/
public Watch setTimeZone(java.lang.String timeZone) {
this.timeZone = timeZone;
return this;
}
/**
* Lower bound for an event's last modification time (as a RFC3339 timestamp) to filter by.
* When specified, entries deleted since this time will always be included regardless of
* showDeleted. Optional. The default is not to filter by last modification time.
*/
@com.google.api.client.util.Key
private com.google.api.client.util.DateTime updatedMin;
/** Lower bound for an event's last modification time (as a RFC3339 timestamp) to filter by. When
specified, entries deleted since this time will always be included regardless of showDeleted.
Optional. The default is not to filter by last modification time.
*/
public com.google.api.client.util.DateTime getUpdatedMin() {
return updatedMin;
}
/**
* Lower bound for an event's last modification time (as a RFC3339 timestamp) to filter by.
* When specified, entries deleted since this time will always be included regardless of
* showDeleted. Optional. The default is not to filter by last modification time.
*/
public Watch setUpdatedMin(com.google.api.client.util.DateTime updatedMin) {
this.updatedMin = updatedMin;
return this;
}
@Override
public Watch set(String parameterName, Object value) {
return (Watch) super.set(parameterName, value);
}
}
}
/**
* An accessor for creating requests from the Freebusy collection.
*
* <p>The typical use is:</p>
* <pre>
* {@code Calendar calendar = new Calendar(...);}
* {@code Calendar.Freebusy.List request = calendar.freebusy().list(parameters ...)}
* </pre>
*
* @return the resource collection
*/
public Freebusy freebusy() {
return new Freebusy();
}
/**
* The "freebusy" collection of methods.
*/
public class Freebusy {
/**
* Returns free/busy information for a set of calendars.
*
* Create a request for the method "freebusy.query".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Query#execute()} method to invoke the remote operation.
*
* @param content the {@link com.google.api.services.calendar.model.FreeBusyRequest}
* @return the request
*/
public Query query(com.google.api.services.calendar.model.FreeBusyRequest content) throws java.io.IOException {
Query result = new Query(content);
initialize(result);
return result;
}
public class Query extends CalendarRequest<com.google.api.services.calendar.model.FreeBusyResponse> {
private static final String REST_PATH = "freeBusy";
/**
* Returns free/busy information for a set of calendars.
*
* Create a request for the method "freebusy.query".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Query#execute()} method to invoke the remote operation.
* <p> {@link
* Query#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param content the {@link com.google.api.services.calendar.model.FreeBusyRequest}
* @since 1.13
*/
protected Query(com.google.api.services.calendar.model.FreeBusyRequest content) {
super(Calendar.this, "POST", REST_PATH, content, com.google.api.services.calendar.model.FreeBusyResponse.class);
}
@Override
public Query setAlt(java.lang.String alt) {
return (Query) super.setAlt(alt);
}
@Override
public Query setFields(java.lang.String fields) {
return (Query) super.setFields(fields);
}
@Override
public Query setKey(java.lang.String key) {
return (Query) super.setKey(key);
}
@Override
public Query setOauthToken(java.lang.String oauthToken) {
return (Query) super.setOauthToken(oauthToken);
}
@Override
public Query setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Query) super.setPrettyPrint(prettyPrint);
}
@Override
public Query setQuotaUser(java.lang.String quotaUser) {
return (Query) super.setQuotaUser(quotaUser);
}
@Override
public Query setUserIp(java.lang.String userIp) {
return (Query) super.setUserIp(userIp);
}
@Override
public Query set(String parameterName, Object value) {
return (Query) super.set(parameterName, value);
}
}
}
/**
* An accessor for creating requests from the Settings collection.
*
* <p>The typical use is:</p>
* <pre>
* {@code Calendar calendar = new Calendar(...);}
* {@code Calendar.Settings.List request = calendar.settings().list(parameters ...)}
* </pre>
*
* @return the resource collection
*/
public Settings settings() {
return new Settings();
}
/**
* The "settings" collection of methods.
*/
public class Settings {
/**
* Returns a single user setting.
*
* Create a request for the method "settings.get".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Get#execute()} method to invoke the remote operation.
*
* @param setting The id of the user setting.
* @return the request
*/
public Get get(java.lang.String setting) throws java.io.IOException {
Get result = new Get(setting);
initialize(result);
return result;
}
public class Get extends CalendarRequest<com.google.api.services.calendar.model.Setting> {
private static final String REST_PATH = "users/me/settings/{setting}";
/**
* Returns a single user setting.
*
* Create a request for the method "settings.get".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Get#execute()} method to invoke the remote operation. <p>
* {@link Get#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
* must be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param setting The id of the user setting.
* @since 1.13
*/
protected Get(java.lang.String setting) {
super(Calendar.this, "GET", REST_PATH, null, com.google.api.services.calendar.model.Setting.class);
this.setting = com.google.api.client.util.Preconditions.checkNotNull(setting, "Required parameter setting must be specified.");
}
@Override
public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException {
return super.executeUsingHead();
}
@Override
public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException {
return super.buildHttpRequestUsingHead();
}
@Override
public Get setAlt(java.lang.String alt) {
return (Get) super.setAlt(alt);
}
@Override
public Get setFields(java.lang.String fields) {
return (Get) super.setFields(fields);
}
@Override
public Get setKey(java.lang.String key) {
return (Get) super.setKey(key);
}
@Override
public Get setOauthToken(java.lang.String oauthToken) {
return (Get) super.setOauthToken(oauthToken);
}
@Override
public Get setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Get) super.setPrettyPrint(prettyPrint);
}
@Override
public Get setQuotaUser(java.lang.String quotaUser) {
return (Get) super.setQuotaUser(quotaUser);
}
@Override
public Get setUserIp(java.lang.String userIp) {
return (Get) super.setUserIp(userIp);
}
/** The id of the user setting. */
@com.google.api.client.util.Key
private java.lang.String setting;
/** The id of the user setting.
*/
public java.lang.String getSetting() {
return setting;
}
/** The id of the user setting. */
public Get setSetting(java.lang.String setting) {
this.setting = setting;
return this;
}
@Override
public Get set(String parameterName, Object value) {
return (Get) super.set(parameterName, value);
}
}
/**
* Returns all user settings for the authenticated user.
*
* Create a request for the method "settings.list".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link List#execute()} method to invoke the remote operation.
*
* @return the request
*/
public List list() throws java.io.IOException {
List result = new List();
initialize(result);
return result;
}
public class List extends CalendarRequest<com.google.api.services.calendar.model.Settings> {
private static final String REST_PATH = "users/me/settings";
/**
* Returns all user settings for the authenticated user.
*
* Create a request for the method "settings.list".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link List#execute()} method to invoke the remote operation. <p>
* {@link List#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
* must be called to initialize this instance immediately after invoking the constructor. </p>
*
* @since 1.13
*/
protected List() {
super(Calendar.this, "GET", REST_PATH, null, com.google.api.services.calendar.model.Settings.class);
}
@Override
public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException {
return super.executeUsingHead();
}
@Override
public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException {
return super.buildHttpRequestUsingHead();
}
@Override
public List setAlt(java.lang.String alt) {
return (List) super.setAlt(alt);
}
@Override
public List setFields(java.lang.String fields) {
return (List) super.setFields(fields);
}
@Override
public List setKey(java.lang.String key) {
return (List) super.setKey(key);
}
@Override
public List setOauthToken(java.lang.String oauthToken) {
return (List) super.setOauthToken(oauthToken);
}
@Override
public List setPrettyPrint(java.lang.Boolean prettyPrint) {
return (List) super.setPrettyPrint(prettyPrint);
}
@Override
public List setQuotaUser(java.lang.String quotaUser) {
return (List) super.setQuotaUser(quotaUser);
}
@Override
public List setUserIp(java.lang.String userIp) {
return (List) super.setUserIp(userIp);
}
/**
* Maximum number of entries returned on one result page. By default the value is 100 entries.
* The page size can never be larger than 250 entries. Optional.
*/
@com.google.api.client.util.Key
private java.lang.Integer maxResults;
/** Maximum number of entries returned on one result page. By default the value is 100 entries. The
page size can never be larger than 250 entries. Optional.
[minimum: 1]
*/
public java.lang.Integer getMaxResults() {
return maxResults;
}
/**
* Maximum number of entries returned on one result page. By default the value is 100 entries.
* The page size can never be larger than 250 entries. Optional.
*/
public List setMaxResults(java.lang.Integer maxResults) {
this.maxResults = maxResults;
return this;
}
/** Token specifying which result page to return. Optional. */
@com.google.api.client.util.Key
private java.lang.String pageToken;
/** Token specifying which result page to return. Optional.
*/
public java.lang.String getPageToken() {
return pageToken;
}
/** Token specifying which result page to return. Optional. */
public List setPageToken(java.lang.String pageToken) {
this.pageToken = pageToken;
return this;
}
/**
* Token obtained from the nextSyncToken field returned on the last page of results from the
* previous list request. It makes the result of this list request contain only entries that
* have changed since then. If the syncToken expires, the server will respond with a 410 GONE
* response code and the client should clear its storage and perform a full synchronization
* without any syncToken. Learn more about incremental synchronization. Optional. The default
* is to return all entries.
*/
@com.google.api.client.util.Key
private java.lang.String syncToken;
/** Token obtained from the nextSyncToken field returned on the last page of results from the previous
list request. It makes the result of this list request contain only entries that have changed since
then. If the syncToken expires, the server will respond with a 410 GONE response code and the
client should clear its storage and perform a full synchronization without any syncToken. Learn
more about incremental synchronization. Optional. The default is to return all entries.
*/
public java.lang.String getSyncToken() {
return syncToken;
}
/**
* Token obtained from the nextSyncToken field returned on the last page of results from the
* previous list request. It makes the result of this list request contain only entries that
* have changed since then. If the syncToken expires, the server will respond with a 410 GONE
* response code and the client should clear its storage and perform a full synchronization
* without any syncToken. Learn more about incremental synchronization. Optional. The default
* is to return all entries.
*/
public List setSyncToken(java.lang.String syncToken) {
this.syncToken = syncToken;
return this;
}
@Override
public List set(String parameterName, Object value) {
return (List) super.set(parameterName, value);
}
}
/**
* Watch for changes to Settings resources.
*
* Create a request for the method "settings.watch".
*
* This request holds the parameters needed by the calendar server. After setting any optional
* parameters, call the {@link Watch#execute()} method to invoke the remote operation.
*
* @param content the {@link com.google.api.services.calendar.model.Channel}
* @return the request
*/
public Watch watch(com.google.api.services.calendar.model.Channel content) throws java.io.IOException {
Watch result = new Watch(content);
initialize(result);
return result;
}
public class Watch extends CalendarRequest<com.google.api.services.calendar.model.Channel> {
private static final String REST_PATH = "users/me/settings/watch";
/**
* Watch for changes to Settings resources.
*
* Create a request for the method "settings.watch".
*
* This request holds the parameters needed by the the calendar server. After setting any
* optional parameters, call the {@link Watch#execute()} method to invoke the remote operation.
* <p> {@link
* Watch#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param content the {@link com.google.api.services.calendar.model.Channel}
* @since 1.13
*/
protected Watch(com.google.api.services.calendar.model.Channel content) {
super(Calendar.this, "POST", REST_PATH, content, com.google.api.services.calendar.model.Channel.class);
}
@Override
public Watch setAlt(java.lang.String alt) {
return (Watch) super.setAlt(alt);
}
@Override
public Watch setFields(java.lang.String fields) {
return (Watch) super.setFields(fields);
}
@Override
public Watch setKey(java.lang.String key) {
return (Watch) super.setKey(key);
}
@Override
public Watch setOauthToken(java.lang.String oauthToken) {
return (Watch) super.setOauthToken(oauthToken);
}
@Override
public Watch setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Watch) super.setPrettyPrint(prettyPrint);
}
@Override
public Watch setQuotaUser(java.lang.String quotaUser) {
return (Watch) super.setQuotaUser(quotaUser);
}
@Override
public Watch setUserIp(java.lang.String userIp) {
return (Watch) super.setUserIp(userIp);
}
/**
* Maximum number of entries returned on one result page. By default the value is 100 entries.
* The page size can never be larger than 250 entries. Optional.
*/
@com.google.api.client.util.Key
private java.lang.Integer maxResults;
/** Maximum number of entries returned on one result page. By default the value is 100 entries. The
page size can never be larger than 250 entries. Optional.
[minimum: 1]
*/
public java.lang.Integer getMaxResults() {
return maxResults;
}
/**
* Maximum number of entries returned on one result page. By default the value is 100 entries.
* The page size can never be larger than 250 entries. Optional.
*/
public Watch setMaxResults(java.lang.Integer maxResults) {
this.maxResults = maxResults;
return this;
}
/** Token specifying which result page to return. Optional. */
@com.google.api.client.util.Key
private java.lang.String pageToken;
/** Token specifying which result page to return. Optional.
*/
public java.lang.String getPageToken() {
return pageToken;
}
/** Token specifying which result page to return. Optional. */
public Watch setPageToken(java.lang.String pageToken) {
this.pageToken = pageToken;
return this;
}
/**
* Token obtained from the nextSyncToken field returned on the last page of results from the
* previous list request. It makes the result of this list request contain only entries that
* have changed since then. If the syncToken expires, the server will respond with a 410 GONE
* response code and the client should clear its storage and perform a full synchronization
* without any syncToken. Learn more about incremental synchronization. Optional. The default
* is to return all entries.
*/
@com.google.api.client.util.Key
private java.lang.String syncToken;
/** Token obtained from the nextSyncToken field returned on the last page of results from the previous
list request. It makes the result of this list request contain only entries that have changed since
then. If the syncToken expires, the server will respond with a 410 GONE response code and the
client should clear its storage and perform a full synchronization without any syncToken. Learn
more about incremental synchronization. Optional. The default is to return all entries.
*/
public java.lang.String getSyncToken() {
return syncToken;
}
/**
* Token obtained from the nextSyncToken field returned on the last page of results from the
* previous list request. It makes the result of this list request contain only entries that
* have changed since then. If the syncToken expires, the server will respond with a 410 GONE
* response code and the client should clear its storage and perform a full synchronization
* without any syncToken. Learn more about incremental synchronization. Optional. The default
* is to return all entries.
*/
public Watch setSyncToken(java.lang.String syncToken) {
this.syncToken = syncToken;
return this;
}
@Override
public Watch set(String parameterName, Object value) {
return (Watch) super.set(parameterName, value);
}
}
}
/**
* Builder for {@link Calendar}.
*
* <p>
* Implementation is not thread-safe.
* </p>
*
* @since 1.3.0
*/
public static final class Builder extends com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient.Builder {
/**
* Returns an instance of a new builder.
*
* @param transport HTTP transport, which should normally be:
* <ul>
* <li>Google App Engine:
* {@code com.google.api.client.extensions.appengine.http.UrlFetchTransport}</li>
* <li>Android: {@code newCompatibleTransport} from
* {@code com.google.api.client.extensions.android.http.AndroidHttp}</li>
* <li>Java: {@link com.google.api.client.googleapis.javanet.GoogleNetHttpTransport#newTrustedTransport()}
* </li>
* </ul>
* @param jsonFactory JSON factory, which may be:
* <ul>
* <li>Jackson: {@code com.google.api.client.json.jackson2.JacksonFactory}</li>
* <li>Google GSON: {@code com.google.api.client.json.gson.GsonFactory}</li>
* <li>Android Honeycomb or higher:
* {@code com.google.api.client.extensions.android.json.AndroidJsonFactory}</li>
* </ul>
* @param httpRequestInitializer HTTP request initializer or {@code null} for none
* @since 1.7
*/
public Builder(com.google.api.client.http.HttpTransport transport, com.google.api.client.json.JsonFactory jsonFactory,
com.google.api.client.http.HttpRequestInitializer httpRequestInitializer) {
super(
transport,
jsonFactory,
DEFAULT_ROOT_URL,
DEFAULT_SERVICE_PATH,
httpRequestInitializer,
false);
setBatchPath(DEFAULT_BATCH_PATH);
}
/** Builds a new instance of {@link Calendar}. */
@Override
public Calendar build() {
return new Calendar(this);
}
@Override
public Builder setRootUrl(String rootUrl) {
return (Builder) super.setRootUrl(rootUrl);
}
@Override
public Builder setServicePath(String servicePath) {
return (Builder) super.setServicePath(servicePath);
}
@Override
public Builder setBatchPath(String batchPath) {
return (Builder) super.setBatchPath(batchPath);
}
@Override
public Builder setHttpRequestInitializer(com.google.api.client.http.HttpRequestInitializer httpRequestInitializer) {
return (Builder) super.setHttpRequestInitializer(httpRequestInitializer);
}
@Override
public Builder setApplicationName(String applicationName) {
return (Builder) super.setApplicationName(applicationName);
}
@Override
public Builder setSuppressPatternChecks(boolean suppressPatternChecks) {
return (Builder) super.setSuppressPatternChecks(suppressPatternChecks);
}
@Override
public Builder setSuppressRequiredParameterChecks(boolean suppressRequiredParameterChecks) {
return (Builder) super.setSuppressRequiredParameterChecks(suppressRequiredParameterChecks);
}
@Override
public Builder setSuppressAllChecks(boolean suppressAllChecks) {
return (Builder) super.setSuppressAllChecks(suppressAllChecks);
}
/**
* Set the {@link CalendarRequestInitializer}.
*
* @since 1.12
*/
public Builder setCalendarRequestInitializer(
CalendarRequestInitializer calendarRequestInitializer) {
return (Builder) super.setGoogleClientRequestInitializer(calendarRequestInitializer);
}
@Override
public Builder setGoogleClientRequestInitializer(
com.google.api.client.googleapis.services.GoogleClientRequestInitializer googleClientRequestInitializer) {
return (Builder) super.setGoogleClientRequestInitializer(googleClientRequestInitializer);
}
}
}
| 280,872 | 0.669113 | 0.665773 | 7,080 | 38.671185 | 37.125134 | 163 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.278531 | false | false | 7 |
aae58aaa46fdc66d73c80010e5be56e7d8f2015f | 22,780,506,568,351 | a56fc4862086bf11aec988623e205cf5818baca6 | /generated/java/src/main/java/com/microsoft/azure/iiot/opc/twin/models/NodeAccessRestrictions.java | c6cd982a2090e185b18113fe3f0dfd6644176b88 | [
"MIT"
] | permissive | Azure/azure-iiot-services-api | https://github.com/Azure/azure-iiot-services-api | 1d419513bd886dacb89474bcdd596c33a6b077a6 | 45fb250fe2f3f204106189d548156076c22230af | refs/heads/master | 2023-04-24T01:47:46.059000 | 2019-04-16T13:39:34 | 2019-04-16T13:39:34 | 138,268,917 | 3 | 3 | MIT | false | 2019-04-16T13:39:36 | 2018-06-22T07:16:44 | 2019-04-06T06:34:00 | 2019-04-16T13:39:35 | 1,984 | 2 | 4 | 1 | C# | false | false | /**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
package com.microsoft.azure.iiot.opc.twin.models;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
/**
* Defines values for NodeAccessRestrictions.
*/
public enum NodeAccessRestrictions {
/** Enum value SigningRequired. */
SIGNING_REQUIRED("SigningRequired"),
/** Enum value EncryptionRequired. */
ENCRYPTION_REQUIRED("EncryptionRequired"),
/** Enum value SessionRequired. */
SESSION_REQUIRED("SessionRequired");
/** The actual serialized value for a NodeAccessRestrictions instance. */
private String value;
NodeAccessRestrictions(String value) {
this.value = value;
}
/**
* Parses a serialized value to a NodeAccessRestrictions instance.
*
* @param value the serialized value to parse.
* @return the parsed NodeAccessRestrictions object, or null if unable to parse.
*/
@JsonCreator
public static NodeAccessRestrictions fromString(String value) {
NodeAccessRestrictions[] items = NodeAccessRestrictions.values();
for (NodeAccessRestrictions item : items) {
if (item.toString().equalsIgnoreCase(value)) {
return item;
}
}
return null;
}
@JsonValue
@Override
public String toString() {
return this.value;
}
}
| UTF-8 | Java | 1,685 | java | NodeAccessRestrictions.java | Java | [] | null | [] | /**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
package com.microsoft.azure.iiot.opc.twin.models;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
/**
* Defines values for NodeAccessRestrictions.
*/
public enum NodeAccessRestrictions {
/** Enum value SigningRequired. */
SIGNING_REQUIRED("SigningRequired"),
/** Enum value EncryptionRequired. */
ENCRYPTION_REQUIRED("EncryptionRequired"),
/** Enum value SessionRequired. */
SESSION_REQUIRED("SessionRequired");
/** The actual serialized value for a NodeAccessRestrictions instance. */
private String value;
NodeAccessRestrictions(String value) {
this.value = value;
}
/**
* Parses a serialized value to a NodeAccessRestrictions instance.
*
* @param value the serialized value to parse.
* @return the parsed NodeAccessRestrictions object, or null if unable to parse.
*/
@JsonCreator
public static NodeAccessRestrictions fromString(String value) {
NodeAccessRestrictions[] items = NodeAccessRestrictions.values();
for (NodeAccessRestrictions item : items) {
if (item.toString().equalsIgnoreCase(value)) {
return item;
}
}
return null;
}
@JsonValue
@Override
public String toString() {
return this.value;
}
}
| 1,685 | 0.683086 | 0.680712 | 58 | 28.051723 | 25.449356 | 84 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.224138 | false | false | 7 |
c3a1fd058f62d260a71dbdcbf421108a38a93df5 | 28,458,453,368,695 | e94634feae07dffee31c7328e138965b35ef6a9e | /projects-mdt/Zoder/src-zoder/com/zoder/processors/exporting/SimpleRenameFolders.java | b436bd312c9a468d6eb00d1efb8dff939579ac8b | [] | no_license | cckmit/univeral-content-request-system | https://github.com/cckmit/univeral-content-request-system | 3c2b4ae263300f7419c79b170e1e0598e83fe995 | 9847b06070423b768801c623858941f61e806890 | refs/heads/master | 2023-03-18T01:35:00.168000 | 2011-01-29T07:14:25 | 2011-01-29T07:14:25 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.zoder.processors.exporting;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import com.zoder.main.IProcessor;
import com.zoder.util.CollUtils;
import com.zoder.util.Context;
import com.zoder.util.FolderPathUtils;
// "basic" renaming functionality...
// TODO: overwrite warning detection...
public class SimpleRenameFolders implements IProcessor
{
public void process(Map script, Context context) throws Exception
{
// get configured map of paths --> newnames
Map renamings = (Map)context.get("FolderRenames");
Map folderpaths = (Map)context.get("Folders.FolderPaths");
Map idmap = (Map)context.get("Folders.IdMap");
// iterate through, and apply changes -- use regexp for additional flexibility
// regexps CANNOT have /'s in them! So no, you cannot add/expand the paths this way.
// regexps have the string ::: in front of them...
// these macros may overwrite each other, we will "warn"
Map overwritewarning = new HashMap();
Iterator i = renamings.keySet().iterator();
int rulenum = 0;
while (i.hasNext()) {
String from = (String)i.next();
String to = (String)renamings.get(from);
String[] matcharr = FolderPathUtils.normalizePath(from).substring(1).split("/");
// sizes should match...
// iterate through from, matching where appropriate
Iterator p = folderpaths.keySet().iterator();
while (p.hasNext()) {
String path = (String)p.next();
String[] patharr = path.substring(1).split("/");
if (patharr.length == matcharr.length) {
boolean match = true;
for (int z=0; z<patharr.length; z++) {
String zpath = patharr[z];
String zmatch = matcharr[z];
if (zmatch.length() >=3 && ":::".equals(zmatch.substring(0,3))) {
if (!zpath.matches(zmatch.substring(3))) {
match = false;
z = patharr.length;
}
} else { // string match
if (!zpath.equals(zmatch)) {
match = false;
z = patharr.length;
}
}
}
if (match) {
// apply the change to the source folder
String id = (String)folderpaths.get(path);
overwritewarning.put(id,rulenum);
Map folder = (Map)idmap.get(id);
String oldname = (String)folder.get("ObjectName");
Map target = CollUtils.getMap(folder, "Target");
if (to.length() >=3 && ":::".equals(to.substring(0,3))) {
// regex!
String[] regex = to.substring(3).split("/");
String newname = oldname.replaceAll(regex[0], regex[1]);
target.put("ObjectName", newname);
} else {
target.put("ObjectName", to);
}
}
}
}
rulenum++;
}
}
}
| UTF-8 | Java | 3,617 | java | SimpleRenameFolders.java | Java | [] | null | [] | package com.zoder.processors.exporting;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import com.zoder.main.IProcessor;
import com.zoder.util.CollUtils;
import com.zoder.util.Context;
import com.zoder.util.FolderPathUtils;
// "basic" renaming functionality...
// TODO: overwrite warning detection...
public class SimpleRenameFolders implements IProcessor
{
public void process(Map script, Context context) throws Exception
{
// get configured map of paths --> newnames
Map renamings = (Map)context.get("FolderRenames");
Map folderpaths = (Map)context.get("Folders.FolderPaths");
Map idmap = (Map)context.get("Folders.IdMap");
// iterate through, and apply changes -- use regexp for additional flexibility
// regexps CANNOT have /'s in them! So no, you cannot add/expand the paths this way.
// regexps have the string ::: in front of them...
// these macros may overwrite each other, we will "warn"
Map overwritewarning = new HashMap();
Iterator i = renamings.keySet().iterator();
int rulenum = 0;
while (i.hasNext()) {
String from = (String)i.next();
String to = (String)renamings.get(from);
String[] matcharr = FolderPathUtils.normalizePath(from).substring(1).split("/");
// sizes should match...
// iterate through from, matching where appropriate
Iterator p = folderpaths.keySet().iterator();
while (p.hasNext()) {
String path = (String)p.next();
String[] patharr = path.substring(1).split("/");
if (patharr.length == matcharr.length) {
boolean match = true;
for (int z=0; z<patharr.length; z++) {
String zpath = patharr[z];
String zmatch = matcharr[z];
if (zmatch.length() >=3 && ":::".equals(zmatch.substring(0,3))) {
if (!zpath.matches(zmatch.substring(3))) {
match = false;
z = patharr.length;
}
} else { // string match
if (!zpath.equals(zmatch)) {
match = false;
z = patharr.length;
}
}
}
if (match) {
// apply the change to the source folder
String id = (String)folderpaths.get(path);
overwritewarning.put(id,rulenum);
Map folder = (Map)idmap.get(id);
String oldname = (String)folder.get("ObjectName");
Map target = CollUtils.getMap(folder, "Target");
if (to.length() >=3 && ":::".equals(to.substring(0,3))) {
// regex!
String[] regex = to.substring(3).split("/");
String newname = oldname.replaceAll(regex[0], regex[1]);
target.put("ObjectName", newname);
} else {
target.put("ObjectName", to);
}
}
}
}
rulenum++;
}
}
}
| 3,617 | 0.465026 | 0.461156 | 85 | 40.55294 | 24.737923 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.6 | false | false | 7 |
8397548d2f2413a76410c21800c9154f36b1abf7 | 9,259,949,516,471 | 8f37398569d4d1215b42687b606c966432c9d180 | /app/src/main/java/com/example/myweatherproject/WeatherAdapter.java | 2b13972bedf306957cc166e1ae1bb7cecacf495b | [] | no_license | nalhelal/Android-Weather-App | https://github.com/nalhelal/Android-Weather-App | 7c4efffb32ef8fbfe8346d25c5bf6c91635aa69d | b261900ebff3ec75020dd465e8c0e1a6bdd5c1f0 | refs/heads/master | 2021-07-07T12:46:11.659000 | 2017-10-02T20:09:34 | 2017-10-02T20:09:34 | 105,570,520 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.myweatherproject;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.squareup.picasso.Picasso;
import java.util.ArrayList;
/**
* Created by Nora on 10/25/16.
*/
public class WeatherAdapter extends ArrayAdapter<WeatherModel> {
private final ArrayList<WeatherModel> mAdapter;
private final Context mContext;
//Similar to the tutorial of Listview application we took in the class (AllRecipes)
public WeatherAdapter(Context context, ArrayList<WeatherModel> objects) {
//The list layout
super(context, R.layout.weather_list, objects);
mAdapter = objects;
mContext = context;
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
//Inflate the layout where the object will be displayed on
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context
.LAYOUT_INFLATER_SERVICE);
View rowView = inflater.inflate(R.layout.weather_list, parent, false);
//use the adapter to map the objects to the right locations using the WeatherModel class
WeatherModel weatherModel = mAdapter.get(position);
//positions
TextView temp = (TextView) rowView.findViewById(R.id.temp);
TextView day = (TextView) rowView.findViewById(R.id.day);
TextView description = (TextView) rowView.findViewById(R.id.description);
ImageView img = (ImageView) rowView.findViewById(R.id.img);
//get Weather Models
day.setText(weatherModel.mDate);
temp.setText(weatherModel.mTemp);
description.setText(weatherModel.mDescription);
//Use Picasso library to download the icon and set it as ImageView
Picasso.with(mContext).load(weatherModel.mIcon).into(img);
return rowView;
}
} | UTF-8 | Java | 2,019 | java | WeatherAdapter.java | Java | [
{
"context": "o;\n\nimport java.util.ArrayList;\n\n/**\n * Created by Nora on 10/25/16.\n */\n\npublic class WeatherAdapter ext",
"end": 355,
"score": 0.9221823215484619,
"start": 351,
"tag": "NAME",
"value": "Nora"
}
] | null | [] | package com.example.myweatherproject;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.squareup.picasso.Picasso;
import java.util.ArrayList;
/**
* Created by Nora on 10/25/16.
*/
public class WeatherAdapter extends ArrayAdapter<WeatherModel> {
private final ArrayList<WeatherModel> mAdapter;
private final Context mContext;
//Similar to the tutorial of Listview application we took in the class (AllRecipes)
public WeatherAdapter(Context context, ArrayList<WeatherModel> objects) {
//The list layout
super(context, R.layout.weather_list, objects);
mAdapter = objects;
mContext = context;
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
//Inflate the layout where the object will be displayed on
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context
.LAYOUT_INFLATER_SERVICE);
View rowView = inflater.inflate(R.layout.weather_list, parent, false);
//use the adapter to map the objects to the right locations using the WeatherModel class
WeatherModel weatherModel = mAdapter.get(position);
//positions
TextView temp = (TextView) rowView.findViewById(R.id.temp);
TextView day = (TextView) rowView.findViewById(R.id.day);
TextView description = (TextView) rowView.findViewById(R.id.description);
ImageView img = (ImageView) rowView.findViewById(R.id.img);
//get Weather Models
day.setText(weatherModel.mDate);
temp.setText(weatherModel.mTemp);
description.setText(weatherModel.mDescription);
//Use Picasso library to download the icon and set it as ImageView
Picasso.with(mContext).load(weatherModel.mIcon).into(img);
return rowView;
}
} | 2,019 | 0.712729 | 0.709757 | 63 | 31.063492 | 29.063627 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.539683 | false | false | 7 |
012366e5c6eba0cd94945250bff4a8385849ae9b | 20,014,547,608,032 | 5e0eb859848bd8007ab0fab14a6cc0239b681668 | /src/main/java/com/example/unit_test_demo/Service/UserService.java | 303636719cd1837d6168fa62d069f8e51d3ed20a | [] | no_license | rejector7/unit_test_demo | https://github.com/rejector7/unit_test_demo | e30849ff0744eae8b9d15156d9324843a21260ad | 340ded89db993af3ad09dd431fde17558b2b1373 | refs/heads/master | 2022-11-17T06:27:27.628000 | 2020-07-14T06:13:45 | 2020-07-14T06:13:45 | 279,498,093 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.unit_test_demo.Service;
import com.example.unit_test_demo.Entity.User;
import com.example.unit_test_demo.Repository.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class UserService {
@Autowired
private UserRepository userRepository;
public User addUser(User user){
User userSaved = userRepository.save(user);
System.out.println(userSaved);
return userSaved;
}
public void deleteUser(User user){
userRepository.delete(user);
}
public User updateUser(User user){
return userRepository.save(user);
}
public User getUserById(String userId){
User user = userRepository.findById(userId).isPresent()?
userRepository.findById(userId).get(): null;
System.out.println(user);
return user;
}
public List<User> getAllUsers(){
List<User> users = userRepository.findAll();
System.out.println(users.size());
return users;
}
}
| UTF-8 | Java | 1,151 | java | UserService.java | Java | [] | null | [] | package com.example.unit_test_demo.Service;
import com.example.unit_test_demo.Entity.User;
import com.example.unit_test_demo.Repository.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class UserService {
@Autowired
private UserRepository userRepository;
public User addUser(User user){
User userSaved = userRepository.save(user);
System.out.println(userSaved);
return userSaved;
}
public void deleteUser(User user){
userRepository.delete(user);
}
public User updateUser(User user){
return userRepository.save(user);
}
public User getUserById(String userId){
User user = userRepository.findById(userId).isPresent()?
userRepository.findById(userId).get(): null;
System.out.println(user);
return user;
}
public List<User> getAllUsers(){
List<User> users = userRepository.findAll();
System.out.println(users.size());
return users;
}
}
| 1,151 | 0.659427 | 0.659427 | 42 | 25.404762 | 21.069115 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.428571 | false | false | 7 |
c12d0128a18cb5d06a3ae7883cfffe95e1d91c3d | 21,801,254,059,612 | f9a502e725c4296c0ec6beef86685a725d10bb2d | /src/main/java/com/prueba/demo/interfazService/IPersonaService.java | c76d8f525b9159dba192f6c0fa5bc905710cb6ba | [] | no_license | crisj1985/CrudSringBoot | https://github.com/crisj1985/CrudSringBoot | a7c5482e0ea0c7ccd0f9734cd33a7b245cd310eb | 8c3cb8f8caf8ccba05c9c662781b9cec182b652a | refs/heads/master | 2022-05-25T00:43:57.915000 | 2020-05-02T04:09:47 | 2020-05-02T04:09:47 | 260,584,071 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.prueba.demo.interfazService;
import java.util.List;
import java.util.Optional;
import com.prueba.demo.modelo.Persona;
public interface IPersonaService {
public List<Persona> findAll();
public Optional<Persona> listarId(int id);
public int save(Persona p);
public void delete(int id);
}
| UTF-8 | Java | 308 | java | IPersonaService.java | Java | [] | null | [] | package com.prueba.demo.interfazService;
import java.util.List;
import java.util.Optional;
import com.prueba.demo.modelo.Persona;
public interface IPersonaService {
public List<Persona> findAll();
public Optional<Persona> listarId(int id);
public int save(Persona p);
public void delete(int id);
}
| 308 | 0.769481 | 0.769481 | 15 | 19.533333 | 16.491884 | 43 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.866667 | false | false | 7 |
c32ecb8325d2b272c4661348700550197fe3dace | 23,416,161,762,651 | b0adceb58ca33aa271dfbac6558769e2a87be1c8 | /Semana4/Tarea4/src/gergonzalezg/tienda/clases/Shop.java | 908d9967f03016eb38ddd4df6f523bc8a7219936 | [] | no_license | AkJardo/Mooc1 | https://github.com/AkJardo/Mooc1 | 6e2d536cfb3aa634478986fc91f626d9dd6e0f97 | 10ed72cc653f909b4e8c588269e9bfeec3b41f02 | refs/heads/master | 2020-04-30T22:51:53.447000 | 2013-11-28T11:40:41 | 2013-11-28T11:40:41 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package gergonzalezg.tienda.clases;
import java.io.Serializable;
import java.util.ArrayList;
public class Shop implements Serializable {
private static final long serialVersionUID = 5695682506102853998L;
private int id;
private String name;
private String activity;
private String address;
private String hoursOfOperaion;
private String phone;
private String url;
private String email;
private ArrayList<Comment> comments= new ArrayList<Comment>();
private Location location;
private int favorites;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getNombre() {
return name;
}
public void setNombre(String nombre) {
this.name = nombre;
}
public String getActividad() {
return activity;
}
public void setActividad(String actividad) {
this.activity = actividad;
}
public String getDireccion() {
return address;
}
public void setDireccion(String direccion) {
this.address = direccion;
}
public String getTelefono() {
return phone;
}
public void setTelefono(String telefono) {
this.phone = telefono;
}
public String getWeb() {
return url;
}
public void setWeb(String web) {
this.url = web;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getHorario() {
return hoursOfOperaion;
}
public void setHorario(String horario) {
this.hoursOfOperaion = horario;
}
public ArrayList<Comment> getComentarios() {
return comments;
}
public void setComentarios(ArrayList<Comment> comentarios) {
this.comments = comentarios;
}
public Location getLocalizacion() {
return location;
}
public void setLocalizacion(Location localizacion) {
this.location = localizacion;
}
public Shop() {
super();
}
public Shop(int id, String nombre, String actividad, String direccion,
String telefono, String web, String email, String horario) {
super();
this.id = id;
this.name = nombre;
this.activity = actividad;
this.address = direccion;
this.phone = telefono;
this.url = web;
this.email = email;
this.hoursOfOperaion = horario;
}
public int getFavorites() {
return favorites;
}
public void setFavorites(int favorites) {
this.favorites = favorites;
}
}
| UTF-8 | Java | 2,275 | java | Shop.java | Java | [
{
"context": "package gergonzalezg.tienda.clases;\n\nimport java.io.Serializa",
"end": 11,
"score": 0.5719922184944153,
"start": 8,
"tag": "USERNAME",
"value": "ger"
},
{
"context": "orario) {\n\t\tsuper();\n\t\tthis.id = id;\n\t\tthis.name = nombre;\n\t\tthis.activity = actividad;\n\t\tthis.address = di",
"end": 1978,
"score": 0.992878258228302,
"start": 1972,
"tag": "NAME",
"value": "nombre"
}
] | null | [] | package gergonzalezg.tienda.clases;
import java.io.Serializable;
import java.util.ArrayList;
public class Shop implements Serializable {
private static final long serialVersionUID = 5695682506102853998L;
private int id;
private String name;
private String activity;
private String address;
private String hoursOfOperaion;
private String phone;
private String url;
private String email;
private ArrayList<Comment> comments= new ArrayList<Comment>();
private Location location;
private int favorites;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getNombre() {
return name;
}
public void setNombre(String nombre) {
this.name = nombre;
}
public String getActividad() {
return activity;
}
public void setActividad(String actividad) {
this.activity = actividad;
}
public String getDireccion() {
return address;
}
public void setDireccion(String direccion) {
this.address = direccion;
}
public String getTelefono() {
return phone;
}
public void setTelefono(String telefono) {
this.phone = telefono;
}
public String getWeb() {
return url;
}
public void setWeb(String web) {
this.url = web;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getHorario() {
return hoursOfOperaion;
}
public void setHorario(String horario) {
this.hoursOfOperaion = horario;
}
public ArrayList<Comment> getComentarios() {
return comments;
}
public void setComentarios(ArrayList<Comment> comentarios) {
this.comments = comentarios;
}
public Location getLocalizacion() {
return location;
}
public void setLocalizacion(Location localizacion) {
this.location = localizacion;
}
public Shop() {
super();
}
public Shop(int id, String nombre, String actividad, String direccion,
String telefono, String web, String email, String horario) {
super();
this.id = id;
this.name = nombre;
this.activity = actividad;
this.address = direccion;
this.phone = telefono;
this.url = web;
this.email = email;
this.hoursOfOperaion = horario;
}
public int getFavorites() {
return favorites;
}
public void setFavorites(int favorites) {
this.favorites = favorites;
}
}
| 2,275 | 0.71956 | 0.711209 | 111 | 19.495495 | 16.94021 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.684685 | false | false | 7 |
30eebfa74f118bce2c45c534bfb9af61e6d31a1c | 8,907,762,239,096 | a4bfa03ea25c0902d9e24a12f48d2cf3106a710a | /esp/2017-2018/diop/TP3/exo1/TestNoteEtudiant.java | 17d5f67b437fef190a5a4a52e16142f2091e3f52 | [
"MIT"
] | permissive | ehbc221/projets-java | https://github.com/ehbc221/projets-java | 37a6049c5524b922fd8a16071003bd7c9343c5e1 | 1b0a67a6f529950effcb4ef2c8571aed94225f54 | refs/heads/master | 2020-12-30T12:37:11.029000 | 2018-01-07T23:35:42 | 2018-01-07T23:35:42 | 91,405,230 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import etudiant.*;
public class TestNoteEtudiant {
public static void main(String[] args) throws NoteEtudiantIncorrecteException {
try {
Etudiant e = new Etudiant("Cissรฉ", "El Hadj Babacar", 21);
} catch (NoteEtudiantIncorrecteException e) {
System.out.println("La note de l'รฉtudiant a รฉtรฉ changรฉe et mise ร 0.");
}
}
} | UTF-8 | Java | 343 | java | TestNoteEtudiant.java | Java | [
{
"context": " {\n\t\ttry {\n\t\t\tEtudiant e = new Etudiant(\"Cissรฉ\", \"El Hadj Babacar\", 21);\n\t\t} catch (NoteEtudiantIncorrecteException",
"end": 197,
"score": 0.9997868537902832,
"start": 182,
"tag": "NAME",
"value": "El Hadj Babacar"
}
] | null | [] | import etudiant.*;
public class TestNoteEtudiant {
public static void main(String[] args) throws NoteEtudiantIncorrecteException {
try {
Etudiant e = new Etudiant("Cissรฉ", "<NAME>", 21);
} catch (NoteEtudiantIncorrecteException e) {
System.out.println("La note de l'รฉtudiant a รฉtรฉ changรฉe et mise ร 0.");
}
}
} | 334 | 0.712166 | 0.703264 | 13 | 25 | 29.128363 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.538462 | false | false | 7 |
6e2ed53f4c1cad96344218ae25fc5d8dca8741b1 | 6,545,530,222,580 | e793bf42e0ef4a2f71657a9d0ddb4857af9cc7aa | /JavaProjects/src/assignments/TestInherit.java | c2a15910c2d2f9c8cd1096d44104a1263a8a2807 | [] | no_license | arunsinghchauhan/qa | https://github.com/arunsinghchauhan/qa | 5baaffff24a489050cf87a0ac83a17d13e2ad694 | a2f5db475b7198b92bd6c8e257479790284b7d0d | refs/heads/master | 2023-06-08T04:19:09.190000 | 2023-05-24T11:01:31 | 2023-05-24T12:57:29 | 79,085,257 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package assignments;
public class TestInherit {
void m1()
{
System.out.println("method 1");
}
// void m1()
// {
// System.out.println("2nd method");
// }
}
class derived extends TestInherit{
void m1()
{
System.out.println("method 2");
}
} | UTF-8 | Java | 286 | java | TestInherit.java | Java | [] | null | [] | package assignments;
public class TestInherit {
void m1()
{
System.out.println("method 1");
}
// void m1()
// {
// System.out.println("2nd method");
// }
}
class derived extends TestInherit{
void m1()
{
System.out.println("method 2");
}
} | 286 | 0.555944 | 0.534965 | 21 | 11.714286 | 13.220269 | 40 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.761905 | false | false | 7 |
69422a7244f9eb027b195788cf3b8746d28d774f | 13,297,218,759,422 | 649da55d85a2700a58eeb62f80cfae54ba00c03f | /sts-stock/src/main/java/com/sts/stock/controller/TestController.java | 2b2b0fa986ae81716f87ef488cde1e26bccdc62a | [
"Apache-2.0"
] | permissive | fangyi-yu/sts | https://github.com/fangyi-yu/sts | 80221a1ac3491e0c6be9508b7480b658a8d02a00 | 0445f2b9665e6ce94abfd54431ddff1896c67491 | refs/heads/master | 2022-06-23T05:16:25.988000 | 2019-09-20T07:19:20 | 2019-09-20T07:19:20 | 209,212,638 | 0 | 0 | Apache-2.0 | false | 2022-06-17T02:32:53 | 2019-09-18T03:51:20 | 2019-09-20T07:19:24 | 2022-06-17T02:32:53 | 36 | 0 | 0 | 1 | Java | false | false | package com.sts.stock.controller;
import com.sts.stock.application.feign.FuturesTetsService;
import com.sts.stock.infrastructure.config.SinaFinance;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* Created by fangyi on 2019/9/19
*/
@RestController
@RequestMapping("/test")
public class TestController {
@Autowired
private FuturesTetsService futuresTetsService;
@Autowired
private SinaFinance sinaFinance;
@GetMapping
public String testGetMethod(){
return "this is stock application";
}
@GetMapping("/stock-config")
public SinaFinance testStockUrl(){
return sinaFinance;
}
@GetMapping("/feign")
public String testFeign(){
return futuresTetsService.testGetMethod();
}
}
| UTF-8 | Java | 959 | java | TestController.java | Java | [
{
"context": "bind.annotation.RestController;\n\n/**\n * Created by fangyi on 2019/9/19\n */\n@RestController\n@RequestMapping(",
"end": 423,
"score": 0.9991686344146729,
"start": 417,
"tag": "USERNAME",
"value": "fangyi"
}
] | null | [] | package com.sts.stock.controller;
import com.sts.stock.application.feign.FuturesTetsService;
import com.sts.stock.infrastructure.config.SinaFinance;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* Created by fangyi on 2019/9/19
*/
@RestController
@RequestMapping("/test")
public class TestController {
@Autowired
private FuturesTetsService futuresTetsService;
@Autowired
private SinaFinance sinaFinance;
@GetMapping
public String testGetMethod(){
return "this is stock application";
}
@GetMapping("/stock-config")
public SinaFinance testStockUrl(){
return sinaFinance;
}
@GetMapping("/feign")
public String testFeign(){
return futuresTetsService.testGetMethod();
}
}
| 959 | 0.747654 | 0.740355 | 38 | 24.236841 | 21.470217 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.315789 | false | false | 7 |
f26511162644bd58a9709c3c4a3791d648fb00a0 | 30,940,944,414,765 | 82a8f35c86c274cb23279314db60ab687d33a691 | /duokan/reader/ui/personal/lz.java | 9df72d85af91622856831117e53c3abf9e607aeb | [] | no_license | QMSCount/DReader | https://github.com/QMSCount/DReader | 42363f6187b907dedde81ab3b9991523cbf2786d | c1537eed7091e32a5e2e52c79360606f622684bc | refs/heads/master | 2021-09-14T22:16:45.495000 | 2018-05-20T14:57:15 | 2018-05-20T14:57:15 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.duokan.reader.ui.personal;
import com.duokan.reader.domain.cloud.DkCloudReadingInfo;
import com.duokan.reader.domain.cloud.ap;
class lz implements ap {
final /* synthetic */ lv a;
lz(lv lvVar) {
this.a = lvVar;
}
public void a(DkCloudReadingInfo dkCloudReadingInfo) {
this.a.a(dkCloudReadingInfo);
this.a.a();
this.a.c.getAdapter().a(false);
}
public void a(String str) {
this.a.a();
this.a.c.getAdapter().m();
}
}
| UTF-8 | Java | 508 | java | lz.java | Java | [] | null | [] | package com.duokan.reader.ui.personal;
import com.duokan.reader.domain.cloud.DkCloudReadingInfo;
import com.duokan.reader.domain.cloud.ap;
class lz implements ap {
final /* synthetic */ lv a;
lz(lv lvVar) {
this.a = lvVar;
}
public void a(DkCloudReadingInfo dkCloudReadingInfo) {
this.a.a(dkCloudReadingInfo);
this.a.a();
this.a.c.getAdapter().a(false);
}
public void a(String str) {
this.a.a();
this.a.c.getAdapter().m();
}
}
| 508 | 0.616142 | 0.616142 | 23 | 21.086956 | 18.303986 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.434783 | false | false | 7 |
fcc9efaecfb64c1ef9b74c226c804574ec468f5f | 33,543,694,639,272 | 9e477cc9dd8690cfd7cee86c7cc3127d36f28384 | /app/src/main/java/com/gxtc/huchuan/ui/mine/deal/orderList/PurchaseListActivity.java | 1950cc562aaab335d747c5e92623536381c81466 | [] | no_license | zhangzzg/xmzj | https://github.com/zhangzzg/xmzj | f0682b5e32c96777405d5985b632b6a4f0ab1d4b | 23a76820b33d1766ca196f538fd7e0b44dd26c81 | refs/heads/master | 2020-03-27T21:59:16.175000 | 2018-09-03T11:27:58 | 2018-09-03T11:27:58 | 147,194,314 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.gxtc.huchuan.ui.mine.deal.orderList;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.LinearLayoutManager;
import android.util.Log;
import android.view.View;
import android.widget.LinearLayout;
import com.gxtc.commlibrary.base.BaseRecyclerAdapter;
import com.gxtc.commlibrary.base.BaseRecyclerTypeAdapter;
import com.gxtc.commlibrary.base.BaseTitleActivity;
import com.gxtc.commlibrary.recyclerview.RecyclerView;
import com.gxtc.commlibrary.recyclerview.wrapper.LoadMoreWrapper;
import com.gxtc.commlibrary.utils.EventBusUtil;
import com.gxtc.commlibrary.utils.GotoUtil;
import com.gxtc.commlibrary.utils.ToastUtil;
import com.gxtc.commlibrary.utils.WindowUtil;
import com.gxtc.huchuan.Constant;
import com.gxtc.huchuan.R;
import com.gxtc.huchuan.adapter.DealRecordAdapter;
import com.gxtc.huchuan.adapter.PurchaseListAdapter;
import com.gxtc.huchuan.bean.PurchaseListBean;
import com.gxtc.huchuan.bean.event.EventClickBean;
import com.gxtc.huchuan.ui.deal.deal.orderDetailed.OrderDetailedActivity;
import com.gxtc.huchuan.ui.deal.deal.orderDetailed.OrderDetailedBuyerActivity;
import com.gxtc.huchuan.ui.mine.loginandregister.LoginAndRegisteActivity;
import com.gxtc.huchuan.widget.DividerItemDecoration;
import org.greenrobot.eventbus.Subscribe;
import java.util.List;
import butterknife.BindView;
/**
* ่ฎขๅๅ่กจ้กต้ข
*/
public class PurchaseListActivity extends BaseTitleActivity implements PurchaseListContract.View, View.OnClickListener {
@BindView(R.id.swipelayout) SwipeRefreshLayout refreshLayout;
@BindView(R.id.recyclerView) RecyclerView listView;
private PurchaseListContract.Presenter mPresenter;
private DealRecordAdapter adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_purchase_list);
EventBusUtil.register(this);
}
@Override
public void initView() {
getBaseHeadView().showTitle(getString(R.string.title_order_list));
getBaseHeadView().showBackButton(this);
refreshLayout.setColorSchemeResources(
R.color.refresh_color1,
R.color.refresh_color2,
R.color.refresh_color3,
R.color.refresh_color4);
listView.setLayoutManager(new LinearLayoutManager(this, LinearLayout.VERTICAL,false));
// listView.addItemDecoration(new DividerItemDecoration(this,DividerItemDecoration.HORIZONTAL_LIST, WindowUtil.dip2px(this,10), Color.parseColor("#ECEDEE")));
listView.setLoadMoreView(R.layout.model_footview_loadmore);
}
@Override
public void initListener() {
refreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
listView.reLoadFinish();
mPresenter.getData(true);
}
});
listView.setOnLoadMoreListener(new LoadMoreWrapper.OnLoadMoreListener() {
@Override
public void onLoadMoreRequested() {
mPresenter.loadMrore();
}
});
}
@Override
public void onClick(View v) {
switch (v.getId()){
case R.id.headBackButton:
finish();
break;
}
}
@Subscribe
public void onEvent(EventClickBean bean){
if(bean.action.equals("ๅปๆฏไป")){
ToastUtil.showShort(this,bean.action);
}
if(bean.action.equals("็กฎ่ฎคๆถ่ดง")){
ToastUtil.showShort(this,bean.action);
}
if(bean.bean instanceof Boolean){
mPresenter.getData(false);
}
}
@Override
public void initData() {
new PurchaseListPresenter(this);
mPresenter.getData(false);
}
@Override
public void tokenOverdue() {
GotoUtil.goToActivity(this, LoginAndRegisteActivity.class);
}
@Override
public void showData(List<PurchaseListBean> datas) {
// adapter = new PurchaseListAdapter(this,datas,new int[]{R.layout.item_list_purchase,R.layout.item_list_purchase2});
adapter = new DealRecordAdapter(this,datas, R.layout.item_list_purchase3);
listView.setAdapter(adapter);
listView.setBackgroundColor(getResources().getColor(R.color.module_divide_line));
adapter.setOnReItemOnClickListener(new BaseRecyclerAdapter.OnReItemOnClickListener() {
@Override
public void onItemClick(View v, int position) {
gotoOrderDetailed(adapter.getList().get(position));
}
});
// adapter.setOnReItemOnClickListener(new BaseRecyclerTypeAdapter.OnReItemOnClickListener() {
// @Override
// public void onItemClick(View v, int position) {
// gotoOrderDetailed(adapter.getList().get(position));
// }
// });
}
@Override
public void showRefreshFinish(List<PurchaseListBean> datas) {
if(adapter != null){
listView.notifyChangeData(datas,adapter);
}
}
@Override
public void showLoadMore(List<PurchaseListBean> datas) {
listView.changeData(datas,adapter);
}
@Override
public void showNoMore() {
listView.loadFinish();
}
@Override
public void showLoad() {
getBaseLoadingView().showLoading();
}
@Override
public void showLoadFinish() {
refreshLayout.setRefreshing(false);
getBaseLoadingView().hideLoading();
}
@Override
public void showEmpty() {
if(adapter == null){
getBaseEmptyView().showEmptyContent();
}
}
@Override
public void showReLoad() {}
@Override
public void showError(String info) {
if(adapter == null){
getBaseEmptyView().showEmptyContent(info);
}else{
ToastUtil.showShort(this,info);
}
}
@Override
public void showNetError() {
getBaseEmptyView().showNetWorkView(new View.OnClickListener() {
@Override
public void onClick(View v) {
getBaseEmptyView().hideEmptyView();
mPresenter.getData(false);
}
});
}
@Override
public void setPresenter(PurchaseListContract.Presenter presenter) {
mPresenter = presenter;
}
@Override
protected void onDestroy() {
super.onDestroy();
EventBusUtil.unregister(this);
mPresenter.destroy();
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(resultCode == Constant.ResponseCode.ORDER_CANCEL && data != null){
String id = data.getStringExtra(Constant.INTENT_DATA);
for (int i = 0; i < adapter.getList().size(); i++) {
if(String.valueOf(adapter.getList().get(i).getId()).equals(id)){
listView.removeData(adapter,i);
}
}
}
if(resultCode == Constant.ResponseCode.LOGINRESPONSE_CODE){
mPresenter.getData(false);
}
}
//่ทณ่ฝฌ่ฎขๅ่ฏฆๆ
้กต
private void gotoOrderDetailed(PurchaseListBean bean){
Intent intent ;
//ๆฏๅฆๆฏไนฐๅฎถใ0๏ผไนฐๅฎถ๏ผ1๏ผๅๅฎถ
if(bean.getBuyer() == 0){
intent = new Intent(this, OrderDetailedBuyerActivity.class);
}else {
intent = new Intent(this, OrderDetailedActivity.class);
}
intent.putExtra(Constant.INTENT_DATA,bean.getId() + "");
startActivityForResult(intent,110);
}
}
| UTF-8 | Java | 7,852 | java | PurchaseListActivity.java | Java | [] | null | [] | package com.gxtc.huchuan.ui.mine.deal.orderList;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.LinearLayoutManager;
import android.util.Log;
import android.view.View;
import android.widget.LinearLayout;
import com.gxtc.commlibrary.base.BaseRecyclerAdapter;
import com.gxtc.commlibrary.base.BaseRecyclerTypeAdapter;
import com.gxtc.commlibrary.base.BaseTitleActivity;
import com.gxtc.commlibrary.recyclerview.RecyclerView;
import com.gxtc.commlibrary.recyclerview.wrapper.LoadMoreWrapper;
import com.gxtc.commlibrary.utils.EventBusUtil;
import com.gxtc.commlibrary.utils.GotoUtil;
import com.gxtc.commlibrary.utils.ToastUtil;
import com.gxtc.commlibrary.utils.WindowUtil;
import com.gxtc.huchuan.Constant;
import com.gxtc.huchuan.R;
import com.gxtc.huchuan.adapter.DealRecordAdapter;
import com.gxtc.huchuan.adapter.PurchaseListAdapter;
import com.gxtc.huchuan.bean.PurchaseListBean;
import com.gxtc.huchuan.bean.event.EventClickBean;
import com.gxtc.huchuan.ui.deal.deal.orderDetailed.OrderDetailedActivity;
import com.gxtc.huchuan.ui.deal.deal.orderDetailed.OrderDetailedBuyerActivity;
import com.gxtc.huchuan.ui.mine.loginandregister.LoginAndRegisteActivity;
import com.gxtc.huchuan.widget.DividerItemDecoration;
import org.greenrobot.eventbus.Subscribe;
import java.util.List;
import butterknife.BindView;
/**
* ่ฎขๅๅ่กจ้กต้ข
*/
public class PurchaseListActivity extends BaseTitleActivity implements PurchaseListContract.View, View.OnClickListener {
@BindView(R.id.swipelayout) SwipeRefreshLayout refreshLayout;
@BindView(R.id.recyclerView) RecyclerView listView;
private PurchaseListContract.Presenter mPresenter;
private DealRecordAdapter adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_purchase_list);
EventBusUtil.register(this);
}
@Override
public void initView() {
getBaseHeadView().showTitle(getString(R.string.title_order_list));
getBaseHeadView().showBackButton(this);
refreshLayout.setColorSchemeResources(
R.color.refresh_color1,
R.color.refresh_color2,
R.color.refresh_color3,
R.color.refresh_color4);
listView.setLayoutManager(new LinearLayoutManager(this, LinearLayout.VERTICAL,false));
// listView.addItemDecoration(new DividerItemDecoration(this,DividerItemDecoration.HORIZONTAL_LIST, WindowUtil.dip2px(this,10), Color.parseColor("#ECEDEE")));
listView.setLoadMoreView(R.layout.model_footview_loadmore);
}
@Override
public void initListener() {
refreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
listView.reLoadFinish();
mPresenter.getData(true);
}
});
listView.setOnLoadMoreListener(new LoadMoreWrapper.OnLoadMoreListener() {
@Override
public void onLoadMoreRequested() {
mPresenter.loadMrore();
}
});
}
@Override
public void onClick(View v) {
switch (v.getId()){
case R.id.headBackButton:
finish();
break;
}
}
@Subscribe
public void onEvent(EventClickBean bean){
if(bean.action.equals("ๅปๆฏไป")){
ToastUtil.showShort(this,bean.action);
}
if(bean.action.equals("็กฎ่ฎคๆถ่ดง")){
ToastUtil.showShort(this,bean.action);
}
if(bean.bean instanceof Boolean){
mPresenter.getData(false);
}
}
@Override
public void initData() {
new PurchaseListPresenter(this);
mPresenter.getData(false);
}
@Override
public void tokenOverdue() {
GotoUtil.goToActivity(this, LoginAndRegisteActivity.class);
}
@Override
public void showData(List<PurchaseListBean> datas) {
// adapter = new PurchaseListAdapter(this,datas,new int[]{R.layout.item_list_purchase,R.layout.item_list_purchase2});
adapter = new DealRecordAdapter(this,datas, R.layout.item_list_purchase3);
listView.setAdapter(adapter);
listView.setBackgroundColor(getResources().getColor(R.color.module_divide_line));
adapter.setOnReItemOnClickListener(new BaseRecyclerAdapter.OnReItemOnClickListener() {
@Override
public void onItemClick(View v, int position) {
gotoOrderDetailed(adapter.getList().get(position));
}
});
// adapter.setOnReItemOnClickListener(new BaseRecyclerTypeAdapter.OnReItemOnClickListener() {
// @Override
// public void onItemClick(View v, int position) {
// gotoOrderDetailed(adapter.getList().get(position));
// }
// });
}
@Override
public void showRefreshFinish(List<PurchaseListBean> datas) {
if(adapter != null){
listView.notifyChangeData(datas,adapter);
}
}
@Override
public void showLoadMore(List<PurchaseListBean> datas) {
listView.changeData(datas,adapter);
}
@Override
public void showNoMore() {
listView.loadFinish();
}
@Override
public void showLoad() {
getBaseLoadingView().showLoading();
}
@Override
public void showLoadFinish() {
refreshLayout.setRefreshing(false);
getBaseLoadingView().hideLoading();
}
@Override
public void showEmpty() {
if(adapter == null){
getBaseEmptyView().showEmptyContent();
}
}
@Override
public void showReLoad() {}
@Override
public void showError(String info) {
if(adapter == null){
getBaseEmptyView().showEmptyContent(info);
}else{
ToastUtil.showShort(this,info);
}
}
@Override
public void showNetError() {
getBaseEmptyView().showNetWorkView(new View.OnClickListener() {
@Override
public void onClick(View v) {
getBaseEmptyView().hideEmptyView();
mPresenter.getData(false);
}
});
}
@Override
public void setPresenter(PurchaseListContract.Presenter presenter) {
mPresenter = presenter;
}
@Override
protected void onDestroy() {
super.onDestroy();
EventBusUtil.unregister(this);
mPresenter.destroy();
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(resultCode == Constant.ResponseCode.ORDER_CANCEL && data != null){
String id = data.getStringExtra(Constant.INTENT_DATA);
for (int i = 0; i < adapter.getList().size(); i++) {
if(String.valueOf(adapter.getList().get(i).getId()).equals(id)){
listView.removeData(adapter,i);
}
}
}
if(resultCode == Constant.ResponseCode.LOGINRESPONSE_CODE){
mPresenter.getData(false);
}
}
//่ทณ่ฝฌ่ฎขๅ่ฏฆๆ
้กต
private void gotoOrderDetailed(PurchaseListBean bean){
Intent intent ;
//ๆฏๅฆๆฏไนฐๅฎถใ0๏ผไนฐๅฎถ๏ผ1๏ผๅๅฎถ
if(bean.getBuyer() == 0){
intent = new Intent(this, OrderDetailedBuyerActivity.class);
}else {
intent = new Intent(this, OrderDetailedActivity.class);
}
intent.putExtra(Constant.INTENT_DATA,bean.getId() + "");
startActivityForResult(intent,110);
}
}
| 7,852 | 0.653481 | 0.651169 | 246 | 30.650406 | 27.302576 | 165 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.504065 | false | false | 7 |
df6f018257595de546ff8e0116c0a30fb7f3b0a8 | 12,764,642,812,694 | c9aa6206b6e888e33db0157dce2726826465a03a | /Homework5/src/UrlCrawler.java | ae37d51d1e1c05be69d52b6c9753267d8095c0f9 | [] | no_license | Harry-Chen/java-programming-homework | https://github.com/Harry-Chen/java-programming-homework | b1832f27af05bdad52eebb2dff81a5b10a8c638c | f351d08f1fcb943d1727b0ceb796cf4375521f3d | refs/heads/master | 2020-05-21T06:15:27.502000 | 2018-08-31T08:55:23 | 2018-08-31T08:55:23 | 185,940,639 | 5 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Scanner;
import java.util.regex.MatchResult;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
public class UrlCrawler {
public static void main(String args[]) {
var pattern = new Scanner(System.in).nextLine().trim().toLowerCase();
try (
var stream = new URL("http://www.114la.com/").openStream();
var buffer = new BufferedReader(new InputStreamReader(stream))
) {
var lines = buffer.lines().collect(Collectors.joining());
Pattern.compile("(\\d|[a-zA-Z]|\\.)+\\.com")
.matcher(lines)
.results()
.map(MatchResult::group)
.map(String::toLowerCase)
.filter(s -> s.contains(pattern))
.sorted(String::compareTo)
.distinct()
.forEach(System.out::println);
} catch (IOException e) {
// do nothing
}
}
}
| UTF-8 | Java | 1,167 | java | UrlCrawler.java | Java | [] | null | [] | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Scanner;
import java.util.regex.MatchResult;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
public class UrlCrawler {
public static void main(String args[]) {
var pattern = new Scanner(System.in).nextLine().trim().toLowerCase();
try (
var stream = new URL("http://www.114la.com/").openStream();
var buffer = new BufferedReader(new InputStreamReader(stream))
) {
var lines = buffer.lines().collect(Collectors.joining());
Pattern.compile("(\\d|[a-zA-Z]|\\.)+\\.com")
.matcher(lines)
.results()
.map(MatchResult::group)
.map(String::toLowerCase)
.filter(s -> s.contains(pattern))
.sorted(String::compareTo)
.distinct()
.forEach(System.out::println);
} catch (IOException e) {
// do nothing
}
}
}
| 1,167 | 0.532991 | 0.53042 | 38 | 28.710526 | 23.232132 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.368421 | false | false | 7 |
15a63ffb64e95a7d75fd548500f03144db1b5e4f | 3,564,822,861,965 | 7bb81a17cd1506e1f0205b558ca868100d3d00cf | /Meeting_System/src/com/wllman/util/Tools.java | 8b5284f02b90f0b3ea49afb9a4a81c8dd319fac1 | [] | no_license | yujuanbalabala/my_meeting | https://github.com/yujuanbalabala/my_meeting | 85be3c7a1f31c06f5648b0d82f2edc5f34230f8d | b6ddf1fca4fcda01aa7cb1bcb1c2874334a14335 | refs/heads/master | 2020-12-30T17:11:30.024000 | 2017-05-12T08:15:29 | 2017-05-12T08:15:29 | 91,067,223 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.wllman.util;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
public class Tools {
public static String timeOffset(String fromDate,String toDate){
String timeoffset = null;
if(fromDate.equals("0")){
fromDate = "00:00";
}
DateFormat df = new SimpleDateFormat("HH:mm");
try {
Date ToDate = df.parse(toDate);
Date FromDate = df.parse(fromDate);
long diff = ToDate.getTime() - FromDate.getTime();
long hours = diff / (1000 * 60 * 60);
long minutes = diff / (1000 * 60) - hours * 60;
timeoffset = String.valueOf(hours)+":"+String.valueOf(minutes);
System.out.println(timeoffset);
} catch (ParseException e) {
e.printStackTrace();
}
return timeoffset;
}
}
| UTF-8 | Java | 797 | java | Tools.java | Java | [] | null | [] | package com.wllman.util;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
public class Tools {
public static String timeOffset(String fromDate,String toDate){
String timeoffset = null;
if(fromDate.equals("0")){
fromDate = "00:00";
}
DateFormat df = new SimpleDateFormat("HH:mm");
try {
Date ToDate = df.parse(toDate);
Date FromDate = df.parse(fromDate);
long diff = ToDate.getTime() - FromDate.getTime();
long hours = diff / (1000 * 60 * 60);
long minutes = diff / (1000 * 60) - hours * 60;
timeoffset = String.valueOf(hours)+":"+String.valueOf(minutes);
System.out.println(timeoffset);
} catch (ParseException e) {
e.printStackTrace();
}
return timeoffset;
}
}
| 797 | 0.675031 | 0.648683 | 29 | 26.482759 | 19.155661 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.241379 | false | false | 7 |
ebd0f14c5ba6be308e71ffff8e0247b296b1e5ad | 5,282,809,836,479 | 4261427df2109b27dfd45a02c9e98cfe197ea95a | /main/java/jaredbgreat/climaticbiome/gui/GuiScaleSlider.java | da1517e3e560a2d35cc72ed86041ebc9d31aa3d0 | [
"MIT"
] | permissive | BlackJar72/ClimaticBiomePlacement | https://github.com/BlackJar72/ClimaticBiomePlacement | 40c6e9b1f89a2b64a32b20d1db239b40b95b8986 | 7a804d23b23563b187a7f8de7f9f3755418f0d5d | refs/heads/v2 | 2023-07-13T04:33:24.887000 | 2023-06-21T12:33:34 | 2023-06-21T12:33:34 | 115,720,505 | 17 | 12 | MIT | false | 2019-10-07T15:04:40 | 2017-12-29T12:24:39 | 2019-09-30T11:28:45 | 2019-10-07T15:04:39 | 1,126 | 12 | 3 | 6 | Java | false | false | package jaredbgreat.climaticbiome.gui;
import jaredbgreat.climaticbiome.configuration.ClimaticWorldSettings;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiPageButtonList.GuiResponder;
import net.minecraft.client.gui.GuiSlider;
public class GuiScaleSlider extends GuiSlider {
final ClimaticWorldSettings.MapScaleSetter target;
public GuiScaleSlider(GuiResponder guiResponder, int idIn, int x, int y, int defaultValue,
String nameIn, ClimaticWorldSettings.MapScaleSetter target) {
super(guiResponder, idIn, x, y, nameIn, 0, 3, defaultValue, new ScaleFormatter());
this.target = target;
}
@Override
protected void mouseDragged(Minecraft mc, int mouseX, int mouseY) {
super.mouseDragged(mc, mouseX, mouseY);
target.set(this);
}
@Override
public float getSliderValue() {
return Math.round(super.getSliderValue());
}
public void setSliderValue(int value, ClimaticWorldSettings settings) {
super.setSliderValue(value, false);
target.setTarget(settings);
}
@Override
public void setSliderValue(float value, boolean notifyResponder) {
float v = Math.round(value);
super.setSliderValue(v, notifyResponder);
target.set(Math.round(v));
}
private static class ScaleFormatter implements GuiSlider.FormatHelper {
private static final String[] valueStrings = new String[]{"x1", "x2", "x3", "x4"};
@Override
public String getText(int id, String name, float value) {
return name + ": " + valueStrings[(int)value];
}
}
}
| UTF-8 | Java | 1,559 | java | GuiScaleSlider.java | Java | [] | null | [] | package jaredbgreat.climaticbiome.gui;
import jaredbgreat.climaticbiome.configuration.ClimaticWorldSettings;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiPageButtonList.GuiResponder;
import net.minecraft.client.gui.GuiSlider;
public class GuiScaleSlider extends GuiSlider {
final ClimaticWorldSettings.MapScaleSetter target;
public GuiScaleSlider(GuiResponder guiResponder, int idIn, int x, int y, int defaultValue,
String nameIn, ClimaticWorldSettings.MapScaleSetter target) {
super(guiResponder, idIn, x, y, nameIn, 0, 3, defaultValue, new ScaleFormatter());
this.target = target;
}
@Override
protected void mouseDragged(Minecraft mc, int mouseX, int mouseY) {
super.mouseDragged(mc, mouseX, mouseY);
target.set(this);
}
@Override
public float getSliderValue() {
return Math.round(super.getSliderValue());
}
public void setSliderValue(int value, ClimaticWorldSettings settings) {
super.setSliderValue(value, false);
target.setTarget(settings);
}
@Override
public void setSliderValue(float value, boolean notifyResponder) {
float v = Math.round(value);
super.setSliderValue(v, notifyResponder);
target.set(Math.round(v));
}
private static class ScaleFormatter implements GuiSlider.FormatHelper {
private static final String[] valueStrings = new String[]{"x1", "x2", "x3", "x4"};
@Override
public String getText(int id, String name, float value) {
return name + ": " + valueStrings[(int)value];
}
}
}
| 1,559 | 0.728031 | 0.724182 | 53 | 28.415094 | 28.228472 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.603774 | false | false | 7 |
5af63501b76d5f71263058a8e7f635907507d5ac | 26,740,466,445,896 | 48f3baca797b6080f4fb7d4a6a2dcf985cb98329 | /app/src/main/java/com/qsboy/antirecall/MainActivity.java | 15e74ee9ec0c1fa79c2a5838310d7f36f113d797 | [] | no_license | geshenjibi/Anti-recall | https://github.com/geshenjibi/Anti-recall | b651378b8d74fd2efa3679ad01fb211fb64ecd3f | fed2fbd49156cd2bab12b277f367a4112eea3a7c | refs/heads/master | 2021-05-09T13:31:37.857000 | 2018-01-04T19:30:11 | 2018-01-04T19:30:11 | 119,036,193 | 1 | 0 | null | true | 2018-01-26T10:02:40 | 2018-01-26T10:02:39 | 2018-01-25T05:43:43 | 2018-01-04T19:30:24 | 18,678 | 0 | 0 | 0 | null | false | null | package com.qsboy.antirecall;
import android.content.Intent;
import android.os.Bundle;
import android.provider.Settings;
import android.support.annotation.NonNull;
import android.support.design.widget.BottomNavigationView;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.MenuItem;
import android.widget.TextView;
import android.widget.Toast;
import com.qsboy.antirecall.utils.CheckAuthority;
import com.ramotion.foldingcell.FoldingCell;
public class MainActivity extends AppCompatActivity {
final String TAG = "Main Activity";
private TextView mTextMessage;
private BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
= new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()) {
case R.id.navigation_home:
mTextMessage.setText(R.string.title_home);
return true;
case R.id.navigation_monitor:
mTextMessage.setText(R.string.title_monitor);
return true;
case R.id.navigation_setting:
mTextMessage.setText(R.string.title_setting);
// ่ทณ่ฝฌๅฐ่พ
ๅฉๅ่ฝ็่ฎพ็ฝฎ
Intent intent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
startActivity(intent);
return true;
default:
return false;
}
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mTextMessage = findViewById(R.id.message);
BottomNavigationView navigation = findViewById(R.id.navigation);
navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
if (!new CheckAuthority(this).checkAlertWindowPermission()) {
Log.i(TAG, "authorized: show warning");
Toast.makeText(this, "ไธบๆพ็คบๆคๅ็ๆถๆฏ\n่ฏทๆไบๆฌๆตฎ็ชๆ้", Toast.LENGTH_LONG).show();
}
// final FoldingCell fc = findViewById(R.id.folding_cell);
// fc.setOnClickListener(v -> fc.toggle(false));
}
}
| UTF-8 | Java | 2,391 | java | MainActivity.java | Java | [
{
"context": "oy.antirecall.utils.CheckAuthority;\nimport com.ramotion.foldingcell.FoldingCell;\n\npublic class MainActivi",
"end": 459,
"score": 0.7900182008743286,
"start": 454,
"tag": "USERNAME",
"value": "otion"
}
] | null | [] | package com.qsboy.antirecall;
import android.content.Intent;
import android.os.Bundle;
import android.provider.Settings;
import android.support.annotation.NonNull;
import android.support.design.widget.BottomNavigationView;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.MenuItem;
import android.widget.TextView;
import android.widget.Toast;
import com.qsboy.antirecall.utils.CheckAuthority;
import com.ramotion.foldingcell.FoldingCell;
public class MainActivity extends AppCompatActivity {
final String TAG = "Main Activity";
private TextView mTextMessage;
private BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
= new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()) {
case R.id.navigation_home:
mTextMessage.setText(R.string.title_home);
return true;
case R.id.navigation_monitor:
mTextMessage.setText(R.string.title_monitor);
return true;
case R.id.navigation_setting:
mTextMessage.setText(R.string.title_setting);
// ่ทณ่ฝฌๅฐ่พ
ๅฉๅ่ฝ็่ฎพ็ฝฎ
Intent intent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
startActivity(intent);
return true;
default:
return false;
}
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mTextMessage = findViewById(R.id.message);
BottomNavigationView navigation = findViewById(R.id.navigation);
navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
if (!new CheckAuthority(this).checkAlertWindowPermission()) {
Log.i(TAG, "authorized: show warning");
Toast.makeText(this, "ไธบๆพ็คบๆคๅ็ๆถๆฏ\n่ฏทๆไบๆฌๆตฎ็ชๆ้", Toast.LENGTH_LONG).show();
}
// final FoldingCell fc = findViewById(R.id.folding_cell);
// fc.setOnClickListener(v -> fc.toggle(false));
}
}
| 2,391 | 0.660539 | 0.660111 | 66 | 34.439392 | 26.439255 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.560606 | false | false | 7 |
0c3b93f18da61a8df5ad8e4fa5c38ac333dffd10 | 22,969,485,139,726 | d408d5f863b79f27892a4b90dcfc1c1d149f848b | /app/src/main/java/net/rusnet/moviessearch/commons/domain/usecase/UseCase.java | 28780f596e50c68899bc17faeb8052a96a4022ab | [] | no_license | rkam88/Movies_Search | https://github.com/rkam88/Movies_Search | 8f56f57b86a39309d7151167d3ad271f21288cd7 | 8af95df5bd21c86d80a19c55404304349348661e | refs/heads/master | 2020-12-26T19:55:28.476000 | 2020-02-06T11:31:35 | 2020-02-06T11:31:35 | 237,623,492 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package net.rusnet.moviessearch.commons.domain.usecase;
import androidx.annotation.NonNull;
public abstract class UseCase<Q, R> {
public abstract void execute(@NonNull final Q requestValues, @NonNull Callback<R> callback);
public interface Callback<R> {
void onResult(@NonNull R result);
}
}
| UTF-8 | Java | 316 | java | UseCase.java | Java | [
{
"context": "package net.rusnet.moviessearch.commons.domain.usecase;\n\nimport andr",
"end": 18,
"score": 0.9624049067497253,
"start": 15,
"tag": "USERNAME",
"value": "net"
}
] | null | [] | package net.rusnet.moviessearch.commons.domain.usecase;
import androidx.annotation.NonNull;
public abstract class UseCase<Q, R> {
public abstract void execute(@NonNull final Q requestValues, @NonNull Callback<R> callback);
public interface Callback<R> {
void onResult(@NonNull R result);
}
}
| 316 | 0.734177 | 0.734177 | 12 | 25.333334 | 28.862701 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 7 |
93de2e9dca7ec0b24c10f4396302cc64550f7e61 | 13,237,089,209,352 | 98cf85b552cd0dfc820232e64816959afcd7ec14 | /main/java/com/howlowhello/katze/entities/FateSpinnerEntity.java | 218e5df118ad3598b2efddf17a90e464e81f4b22 | [] | no_license | HowLowHello/Katze | https://github.com/HowLowHello/Katze | 65aa9a36a2a763cfb104de9598f4336adc51c240 | dc53dedf7147f20a841a4efdb9fe0206e08b14c7 | refs/heads/main | 2023-04-26T00:07:51.572000 | 2021-05-29T14:02:15 | 2021-05-29T14:02:15 | 336,180,674 | 1 | 1 | null | false | 2021-02-05T06:59:37 | 2021-02-05T06:07:39 | 2021-02-05T06:54:56 | 2021-02-05T06:59:37 | 0 | 0 | 1 | 0 | Java | false | false | package com.howlowhello.katze.entities;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.MobEntity;
import net.minecraft.entity.ai.attributes.AttributeModifierMap;
import net.minecraft.entity.ai.attributes.Attributes;
import net.minecraft.entity.ai.goal.*;
import net.minecraft.entity.monster.EndermanEntity;
import net.minecraft.entity.passive.GolemEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.Effects;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.SoundEvents;
import net.minecraft.world.World;
public class FateSpinnerEntity extends EndermanEntity {
public FateSpinnerEntity(EntityType<? extends EndermanEntity> type, World worldIn) {
super(type, worldIn);
}
public static AttributeModifierMap.MutableAttribute setCustomAttributes() {
return MobEntity.func_233666_p_()
.createMutableAttribute(Attributes.MAX_HEALTH, 60.0D)
.createMutableAttribute(Attributes.ARMOR, 4.0D)
.createMutableAttribute(Attributes.ATTACK_DAMAGE, 12.0D)
.createMutableAttribute(Attributes.FOLLOW_RANGE, 48.0D)
.createMutableAttribute(Attributes.MOVEMENT_SPEED, 0.5D);
}
@Override
protected void registerGoals() {
this.goalSelector.addGoal(0, new SwimGoal(this));
this.goalSelector.addGoal(1, new MeleeAttackGoal(this, 1.0D, false));
this.goalSelector.addGoal(2, new WaterAvoidingRandomWalkingGoal(this, 1.0D, 0.0F));
this.goalSelector.addGoal(3, new LookAtGoal(this, PlayerEntity.class, 8.0F));
this.goalSelector.addGoal(4, new LookRandomlyGoal(this));
this.targetSelector.addGoal(1, new HurtByTargetGoal(this, DirewolfEntity.class));
this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, PlayerEntity.class, true));
this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, GolemEntity.class, true));
}
@Override
public boolean isWaterSensitive() {
return false;
}
@Override
public boolean attackEntityAsMob(Entity entityIn) {
boolean flag = super.attackEntityAsMob(entityIn);
if (flag) {
if (entityIn instanceof LivingEntity && entityIn.isAlive()){
((LivingEntity) entityIn).addPotionEffect(new EffectInstance(Effects.WITHER, 80, 2));
}
}
return flag;
}
@Override
protected SoundEvent getDeathSound() {
return super.getDeathSound();
}
}
| UTF-8 | Java | 2,667 | java | FateSpinnerEntity.java | Java | [] | null | [] | package com.howlowhello.katze.entities;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.MobEntity;
import net.minecraft.entity.ai.attributes.AttributeModifierMap;
import net.minecraft.entity.ai.attributes.Attributes;
import net.minecraft.entity.ai.goal.*;
import net.minecraft.entity.monster.EndermanEntity;
import net.minecraft.entity.passive.GolemEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.Effects;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.SoundEvents;
import net.minecraft.world.World;
public class FateSpinnerEntity extends EndermanEntity {
public FateSpinnerEntity(EntityType<? extends EndermanEntity> type, World worldIn) {
super(type, worldIn);
}
public static AttributeModifierMap.MutableAttribute setCustomAttributes() {
return MobEntity.func_233666_p_()
.createMutableAttribute(Attributes.MAX_HEALTH, 60.0D)
.createMutableAttribute(Attributes.ARMOR, 4.0D)
.createMutableAttribute(Attributes.ATTACK_DAMAGE, 12.0D)
.createMutableAttribute(Attributes.FOLLOW_RANGE, 48.0D)
.createMutableAttribute(Attributes.MOVEMENT_SPEED, 0.5D);
}
@Override
protected void registerGoals() {
this.goalSelector.addGoal(0, new SwimGoal(this));
this.goalSelector.addGoal(1, new MeleeAttackGoal(this, 1.0D, false));
this.goalSelector.addGoal(2, new WaterAvoidingRandomWalkingGoal(this, 1.0D, 0.0F));
this.goalSelector.addGoal(3, new LookAtGoal(this, PlayerEntity.class, 8.0F));
this.goalSelector.addGoal(4, new LookRandomlyGoal(this));
this.targetSelector.addGoal(1, new HurtByTargetGoal(this, DirewolfEntity.class));
this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, PlayerEntity.class, true));
this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, GolemEntity.class, true));
}
@Override
public boolean isWaterSensitive() {
return false;
}
@Override
public boolean attackEntityAsMob(Entity entityIn) {
boolean flag = super.attackEntityAsMob(entityIn);
if (flag) {
if (entityIn instanceof LivingEntity && entityIn.isAlive()){
((LivingEntity) entityIn).addPotionEffect(new EffectInstance(Effects.WITHER, 80, 2));
}
}
return flag;
}
@Override
protected SoundEvent getDeathSound() {
return super.getDeathSound();
}
}
| 2,667 | 0.717285 | 0.703037 | 68 | 38.220589 | 30.517519 | 106 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.867647 | false | false | 7 |
d47675891a5ffb996689dcd8bf142ea93390d72a | 13,091,060,345,279 | 1b64a251355a9fdd3591915eeaa77f97a835baa8 | /src/main/java/com/arkcloud/dao/SourceMapper.java | 9836b88bddb4d658caf2e3676d8117fd7ba74c19 | [] | no_license | lizhenBCNL/cloud_backup | https://github.com/lizhenBCNL/cloud_backup | 065184707920a43f38db5e2eb40a85b517809605 | 2df055d9bef63b3a0c4d7dad90becb37e19bfa52 | refs/heads/master | 2021-05-06T19:27:27.883000 | 2017-11-27T01:34:40 | 2017-11-27T01:34:40 | 112,130,693 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.arkcloud.dao;
import com.arkcloud.pojo.Source;
public interface SourceMapper {
int insert(Source record);
int insertSelective(Source record);
} | UTF-8 | Java | 166 | java | SourceMapper.java | Java | [] | null | [] | package com.arkcloud.dao;
import com.arkcloud.pojo.Source;
public interface SourceMapper {
int insert(Source record);
int insertSelective(Source record);
} | 166 | 0.759036 | 0.759036 | 9 | 17.555555 | 15.840252 | 39 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.444444 | false | false | 7 |
694d146a25232243426ae8808d2e10ce3c137ec3 | 7,602,092,134,406 | 798abb8df16c6346ac82141cf393ef666c766928 | /src/main/java/์ ๋ ฌ/๊ฐ์ฅํฐ์.java | 4d6f652c21a10f77a63f761b7dbe04fb11042ff5 | [] | no_license | Insookim0702/programmers_algorithm | https://github.com/Insookim0702/programmers_algorithm | 15edbbcc5440993a950e8a9950443b077a7a7f7a | 97d0c43e7a924d3e2d9f4370d50f83428b7a3334 | refs/heads/master | 2022-12-30T03:21:36.542000 | 2020-10-21T08:23:09 | 2020-10-21T08:23:09 | 293,683,843 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ์ ๋ ฌ;
import java.util.Collections;
import java.util.PriorityQueue;
public class ๊ฐ์ฅํฐ์ {
public String solution(int[] numbers) {
PriorityQueue<String> pque = new PriorityQueue<>(Collections.reverseOrder());
int n =numbers.length;
int[] output = new int[n];
boolean[] visited = new boolean[n];
perm(numbers, output, visited, 0, n, n, pque);
return pque.poll();
}
static void perm(int[] arr, int[] output, boolean[] visited, int depth, int n, int r, PriorityQueue<String> pque) {
if (depth == r) {
String value = "";
for (int i = 0; i < r; i++) {
value += output[i];
};
pque.add(value);
return;
}
for (int i = 0; i < n; i++) {
if (visited[i] != true) {
visited[i] = true;
output[depth] = arr[i];
perm(arr, output, visited, depth + 1, n, r, pque);
visited[i] = false;
}
}
}
// ๋ฐฐ์ด ์ถ๋ ฅ
static void print(int[] arr, int r) {
for (int i = 0; i < r; i++)
System.out.print(arr[i] + " ");
System.out.println();
}
}
| UTF-8 | Java | 1,232 | java | ๊ฐ์ฅํฐ์.java | Java | [] | null | [] | package ์ ๋ ฌ;
import java.util.Collections;
import java.util.PriorityQueue;
public class ๊ฐ์ฅํฐ์ {
public String solution(int[] numbers) {
PriorityQueue<String> pque = new PriorityQueue<>(Collections.reverseOrder());
int n =numbers.length;
int[] output = new int[n];
boolean[] visited = new boolean[n];
perm(numbers, output, visited, 0, n, n, pque);
return pque.poll();
}
static void perm(int[] arr, int[] output, boolean[] visited, int depth, int n, int r, PriorityQueue<String> pque) {
if (depth == r) {
String value = "";
for (int i = 0; i < r; i++) {
value += output[i];
};
pque.add(value);
return;
}
for (int i = 0; i < n; i++) {
if (visited[i] != true) {
visited[i] = true;
output[depth] = arr[i];
perm(arr, output, visited, depth + 1, n, r, pque);
visited[i] = false;
}
}
}
// ๋ฐฐ์ด ์ถ๋ ฅ
static void print(int[] arr, int r) {
for (int i = 0; i < r; i++)
System.out.print(arr[i] + " ");
System.out.println();
}
}
| 1,232 | 0.481848 | 0.477723 | 40 | 29.299999 | 23.261772 | 119 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.125 | false | false | 7 |
eba39b54af1fb50effc2bd9e32952ced60460435 | 14,791,867,385,018 | 56c793c244492257e3c02744eaa2a2c5453cce43 | /src/main/java/com/spin/main/responsemodel/PostingWrapper.java | ee427f131a77d2bd639df7139fa38acba1a81ff4 | [] | no_license | RameshejjagiriPractice/Spin_Reporter | https://github.com/RameshejjagiriPractice/Spin_Reporter | 157bcff0f5dedd81a137a9a1c8791cd87d928ca1 | e3532aac9d5f79f376313a51c95ffa930a359725 | refs/heads/master | 2022-03-23T01:52:13.934000 | 2019-09-17T09:29:55 | 2019-09-17T09:29:55 | 209,013,708 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.spin.main.responsemodel;
import java.util.List;
import com.spin.main.model.Postings;
public class PostingWrapper {
Errorcodes info;
List<Postings> data;
public Errorcodes getInfo() {
return info;
}
public void setInfo(Errorcodes info) {
this.info = info;
}
public List<Postings> getData() {
return data;
}
public void setData(List<Postings> data) {
this.data = data;
}
}
| UTF-8 | Java | 412 | java | PostingWrapper.java | Java | [] | null | [] | package com.spin.main.responsemodel;
import java.util.List;
import com.spin.main.model.Postings;
public class PostingWrapper {
Errorcodes info;
List<Postings> data;
public Errorcodes getInfo() {
return info;
}
public void setInfo(Errorcodes info) {
this.info = info;
}
public List<Postings> getData() {
return data;
}
public void setData(List<Postings> data) {
this.data = data;
}
}
| 412 | 0.703883 | 0.703883 | 29 | 13.206897 | 14.55875 | 43 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.965517 | false | false | 7 |
54d30f723a1a5713fd2b202126625d9bc6010add | 5,970,004,562,683 | dde2b109af8271e74fae72c2acb2c8cc2c579ee8 | /kers-core/src/main/java/br/com/capanema/kers/core/util/file/FileManager.java | 0ba3d94c652bb58358d57886d0d204a39b38dc67 | [] | no_license | thiagosoares/kers-mda | https://github.com/thiagosoares/kers-mda | 6cc8e3f31ff88eed548ad169ac312ac4b3b15fbf | 86260baa62f87d96b85c68fbcda2645e1c9cb6b0 | refs/heads/master | 2020-05-19T11:46:54.018000 | 2011-08-10T21:50:45 | 2011-08-10T21:50:45 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package br.com.capanema.kers.core.util.file;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.nio.channels.FileChannel;
public class FileManager {
public static void createFife(String nome, String caminho, String conteudo) throws IOException {
gerarDiretorio(caminho);
File file = new File(caminho, nome);
FileWriter fw = new FileWriter(file);
// escreve
fw.write(conteudo);
fw.flush();
// Cria
file.createNewFile();
fw.close();
}
public static void gerarDiretorio(String caminho) throws IOException {
File diretorio = new File(caminho);
if (!diretorio.exists()) {
diretorio.mkdirs();
}
}
public static void copiarArquivo(String caminhoOrigem, String caminhoDestino) throws IOException {
// Create channel on the source
FileChannel srcChannel = new FileInputStream(caminhoOrigem).getChannel();
// Create channel on the destination
FileChannel dstChannel = new FileOutputStream(caminhoDestino).getChannel();
// Copy file contents from source to destination
dstChannel.transferFrom(srcChannel, 0, srcChannel.size());
// Close the channels
srcChannel.close();
dstChannel.close();
}
public static String lerArquivo(String caminhoOrigem) throws IOException {
BufferedReader in = new BufferedReader(new FileReader(caminhoOrigem));
String str;
String str2 = "";
while ((str = in.readLine()) != null) {
str2 += str + "\n" ;
}
in.close();
return str2;
}
public static void gravarArquivo(String caminhoOrigem, String conteudo) throws IOException {
BufferedWriter out = new BufferedWriter(new FileWriter(caminhoOrigem));
out.write(conteudo);
out.close();
}
} | UTF-8 | Java | 1,943 | java | FileManager.java | Java | [] | null | [] | package br.com.capanema.kers.core.util.file;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.nio.channels.FileChannel;
public class FileManager {
public static void createFife(String nome, String caminho, String conteudo) throws IOException {
gerarDiretorio(caminho);
File file = new File(caminho, nome);
FileWriter fw = new FileWriter(file);
// escreve
fw.write(conteudo);
fw.flush();
// Cria
file.createNewFile();
fw.close();
}
public static void gerarDiretorio(String caminho) throws IOException {
File diretorio = new File(caminho);
if (!diretorio.exists()) {
diretorio.mkdirs();
}
}
public static void copiarArquivo(String caminhoOrigem, String caminhoDestino) throws IOException {
// Create channel on the source
FileChannel srcChannel = new FileInputStream(caminhoOrigem).getChannel();
// Create channel on the destination
FileChannel dstChannel = new FileOutputStream(caminhoDestino).getChannel();
// Copy file contents from source to destination
dstChannel.transferFrom(srcChannel, 0, srcChannel.size());
// Close the channels
srcChannel.close();
dstChannel.close();
}
public static String lerArquivo(String caminhoOrigem) throws IOException {
BufferedReader in = new BufferedReader(new FileReader(caminhoOrigem));
String str;
String str2 = "";
while ((str = in.readLine()) != null) {
str2 += str + "\n" ;
}
in.close();
return str2;
}
public static void gravarArquivo(String caminhoOrigem, String conteudo) throws IOException {
BufferedWriter out = new BufferedWriter(new FileWriter(caminhoOrigem));
out.write(conteudo);
out.close();
}
} | 1,943 | 0.699949 | 0.69789 | 71 | 25.394365 | 26.173569 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.633803 | false | false | 7 |
c5b45e4632e599b5b6e07f24a0b8e2109f4c3943 | 30,666,066,515,621 | 4488d9e3017eef0a33d63a835bea4a8963de0c2f | /src/milkteashop/MilkTea.java | 9538465d5141e2ce7a024b58d41f792ef09dab04 | [] | no_license | chidt117/milk_shop | https://github.com/chidt117/milk_shop | 03b4e043cce0aeefe45560494a76a3e8e091d094 | 013ca98cef16684f7d79f1b153b726e2c854405b | refs/heads/master | 2020-09-22T07:28:02.687000 | 2019-12-01T04:20:48 | 2019-12-01T04:20:48 | 225,104,689 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package milkteashop;
public class MilkTea {
private String name;
private Ingredient ingredient;
private String ingreName;
public String getIngreName() {
return ingreName;
}
public void setIngreName(String ingreName) {
this.ingreName = ingreName;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Ingredient getIngredient() {
return ingredient;
}
public void setIngredient(Ingredient ingredient) {
this.ingredient = ingredient;
}
}
| UTF-8 | Java | 521 | java | MilkTea.java | Java | [] | null | [] | package milkteashop;
public class MilkTea {
private String name;
private Ingredient ingredient;
private String ingreName;
public String getIngreName() {
return ingreName;
}
public void setIngreName(String ingreName) {
this.ingreName = ingreName;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Ingredient getIngredient() {
return ingredient;
}
public void setIngredient(Ingredient ingredient) {
this.ingredient = ingredient;
}
}
| 521 | 0.729367 | 0.729367 | 28 | 17.607143 | 14.900477 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.464286 | false | false | 7 |
dedbe83db814f8595aa26e18696e35d2e9c9dabd | 27,101,243,670,014 | 04107c467584873745d463b140d3fb0159e67ebf | /src/main/java/com/tasktree/controller/TaskController.java | f5b896e088369d7fb351a4c519981ac94db1d8ea | [
"Apache-2.0"
] | permissive | andrewd92/task-tree | https://github.com/andrewd92/task-tree | 8db9c3327293348d1c14cc3bf86bb96c8e924e65 | fa1b98c94098702ebeb12302792e5150f43b006f | refs/heads/master | 2020-05-09T15:16:39.570000 | 2019-04-27T23:01:29 | 2019-04-27T23:02:07 | 181,227,967 | 0 | 0 | Apache-2.0 | false | 2019-04-27T22:37:52 | 2019-04-13T20:57:42 | 2019-04-25T20:18:21 | 2019-04-27T22:37:52 | 20 | 0 | 0 | 0 | Java | false | false | package com.tasktree.controller;
import com.tasktree.model.Task;
import com.tasktree.service.TaskService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@AllArgsConstructor
public class TaskController {
private TaskService service;
@RequestMapping("/task/{id}")
public Task getByTitle(@PathVariable Long id) {
return service.getById(id).orElse(new Task(""));
}
@RequestMapping("/create/{title}")
public Task create(@PathVariable String title) {
return service.createByTitle(title);
}
}
| UTF-8 | Java | 724 | java | TaskController.java | Java | [] | null | [] | package com.tasktree.controller;
import com.tasktree.model.Task;
import com.tasktree.service.TaskService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@AllArgsConstructor
public class TaskController {
private TaskService service;
@RequestMapping("/task/{id}")
public Task getByTitle(@PathVariable Long id) {
return service.getById(id).orElse(new Task(""));
}
@RequestMapping("/create/{title}")
public Task create(@PathVariable String title) {
return service.createByTitle(title);
}
}
| 724 | 0.762431 | 0.762431 | 24 | 29.166666 | 21.367161 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.416667 | false | false | 7 |
78b2d13b93093c77c5d7c970de0db5d6db35ee06 | 27,882,927,697,052 | f22ca5d2131157287041881e945d01dc03a6fe57 | /DoolhofSpel/test/doolhofspel/PlattegrondTest.java | 0f83c300a1b2b26b0d86fc4b6be675b297d8351e | [] | no_license | ditisDanielle/DOOLHOF2 | https://github.com/ditisDanielle/DOOLHOF2 | 6cb26ea242dda5c944e1eece0c98b80a8afb8047 | 2a20b4a997c818f0ea4864dc8728a37d38082d35 | refs/heads/master | 2021-01-19T02:37:23.639000 | 2016-07-04T01:31:34 | 2016-07-04T01:31:34 | 62,425,482 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* 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 doolhofspel;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
/**
*
* @author Danielle
*/
public class PlattegrondTest {
@Test
public void testGetMapgrootte() {
Doolhof doolhof = new Doolhof();
System.out.println("Test of method getMapgrootte in class Plattegrond.");
Bord bord = new Bord(doolhof);
Plattegrond kaart = new Plattegrond(bord);
int expResult = 21;
int result = kaart.getMapgrootte();
assertEquals(expResult, result);
System.out.println("Het resultaat is " + result + " en het verwachte resultaat is " + expResult + ".");
}
}
| UTF-8 | Java | 834 | java | PlattegrondTest.java | Java | [
{
"context": "tEquals;\nimport org.junit.Test;\n\n/**\n *\n * @author Danielle\n */\npublic class PlattegrondTest {\n @Test\n ",
"end": 302,
"score": 0.9988911151885986,
"start": 294,
"tag": "NAME",
"value": "Danielle"
}
] | null | [] | /*
* 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 doolhofspel;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
/**
*
* @author Danielle
*/
public class PlattegrondTest {
@Test
public void testGetMapgrootte() {
Doolhof doolhof = new Doolhof();
System.out.println("Test of method getMapgrootte in class Plattegrond.");
Bord bord = new Bord(doolhof);
Plattegrond kaart = new Plattegrond(bord);
int expResult = 21;
int result = kaart.getMapgrootte();
assertEquals(expResult, result);
System.out.println("Het resultaat is " + result + " en het verwachte resultaat is " + expResult + ".");
}
}
| 834 | 0.670264 | 0.667866 | 27 | 29.888889 | 27.972651 | 111 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.555556 | false | false | 7 |
9f7e772e7638c51f8585b21cf4b253f2c091025f | 30,374,008,774,578 | 962f1162cbed13b1a042d575a4a6747cfa01cfd7 | /src/main/java/com/trj/jk/web/domain/UserMobileAppInfo.java | 567189228b84c789c1cdf2e9bd25fad11bfc1619 | [] | no_license | qccr-twl2123/borrower | https://github.com/qccr-twl2123/borrower | d67cb943cb9faa103dc52bbe7c846bbf534bece1 | c179e4eb0a6635fdb77aa791eee189a354b4e691 | refs/heads/master | 2020-03-26T17:54:24.039000 | 2018-08-18T11:14:02 | 2018-08-18T11:14:02 | 145,186,583 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.trj.jk.web.domain;
import java.util.Date;
public class UserMobileAppInfo {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jk_user_mobile_app_info.id
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
private Integer id;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jk_user_mobile_app_info.uid
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
private Integer uid;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jk_user_mobile_app_info.app_system
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
private String appSystem;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jk_user_mobile_app_info.collect_node
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
private Byte collectNode;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jk_user_mobile_app_info.app_info
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
private String appInfo;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jk_user_mobile_app_info.creator
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
private Integer creator;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jk_user_mobile_app_info.modifier
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
private Integer modifier;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jk_user_mobile_app_info.modify_time
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
private Date modifyTime;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jk_user_mobile_app_info.create_time
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
private Date createTime;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jk_user_mobile_app_info.version
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
private Integer version;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jk_user_mobile_app_info.id
*
* @return the value of jk_user_mobile_app_info.id
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
public Integer getId() {
return id;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jk_user_mobile_app_info.id
*
* @param id the value for jk_user_mobile_app_info.id
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
public void setId(Integer id) {
this.id = id;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jk_user_mobile_app_info.uid
*
* @return the value of jk_user_mobile_app_info.uid
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
public Integer getUid() {
return uid;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jk_user_mobile_app_info.uid
*
* @param uid the value for jk_user_mobile_app_info.uid
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
public void setUid(Integer uid) {
this.uid = uid;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jk_user_mobile_app_info.app_system
*
* @return the value of jk_user_mobile_app_info.app_system
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
public String getAppSystem() {
return appSystem;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jk_user_mobile_app_info.app_system
*
* @param appSystem the value for jk_user_mobile_app_info.app_system
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
public void setAppSystem(String appSystem) {
this.appSystem = appSystem;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jk_user_mobile_app_info.collect_node
*
* @return the value of jk_user_mobile_app_info.collect_node
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
public Byte getCollectNode() {
return collectNode;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jk_user_mobile_app_info.collect_node
*
* @param collectNode the value for jk_user_mobile_app_info.collect_node
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
public void setCollectNode(Byte collectNode) {
this.collectNode = collectNode;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jk_user_mobile_app_info.app_info
*
* @return the value of jk_user_mobile_app_info.app_info
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
public String getAppInfo() {
return appInfo;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jk_user_mobile_app_info.app_info
*
* @param appInfo the value for jk_user_mobile_app_info.app_info
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
public void setAppInfo(String appInfo) {
this.appInfo = appInfo;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jk_user_mobile_app_info.creator
*
* @return the value of jk_user_mobile_app_info.creator
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
public Integer getCreator() {
return creator;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jk_user_mobile_app_info.creator
*
* @param creator the value for jk_user_mobile_app_info.creator
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
public void setCreator(Integer creator) {
this.creator = creator;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jk_user_mobile_app_info.modifier
*
* @return the value of jk_user_mobile_app_info.modifier
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
public Integer getModifier() {
return modifier;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jk_user_mobile_app_info.modifier
*
* @param modifier the value for jk_user_mobile_app_info.modifier
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
public void setModifier(Integer modifier) {
this.modifier = modifier;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jk_user_mobile_app_info.modify_time
*
* @return the value of jk_user_mobile_app_info.modify_time
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
public Date getModifyTime() {
return modifyTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jk_user_mobile_app_info.modify_time
*
* @param modifyTime the value for jk_user_mobile_app_info.modify_time
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
public void setModifyTime(Date modifyTime) {
this.modifyTime = modifyTime;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jk_user_mobile_app_info.create_time
*
* @return the value of jk_user_mobile_app_info.create_time
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
public Date getCreateTime() {
return createTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jk_user_mobile_app_info.create_time
*
* @param createTime the value for jk_user_mobile_app_info.create_time
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jk_user_mobile_app_info.version
*
* @return the value of jk_user_mobile_app_info.version
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
public Integer getVersion() {
return version;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jk_user_mobile_app_info.version
*
* @param version the value for jk_user_mobile_app_info.version
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
public void setVersion(Integer version) {
this.version = version;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jk_user_mobile_app_info
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
UserMobileAppInfo other = (UserMobileAppInfo) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getUid() == null ? other.getUid() == null : this.getUid().equals(other.getUid()))
&& (this.getAppSystem() == null ? other.getAppSystem() == null : this.getAppSystem().equals(other.getAppSystem()))
&& (this.getCollectNode() == null ? other.getCollectNode() == null : this.getCollectNode().equals(other.getCollectNode()))
&& (this.getAppInfo() == null ? other.getAppInfo() == null : this.getAppInfo().equals(other.getAppInfo()))
&& (this.getCreator() == null ? other.getCreator() == null : this.getCreator().equals(other.getCreator()))
&& (this.getModifier() == null ? other.getModifier() == null : this.getModifier().equals(other.getModifier()))
&& (this.getModifyTime() == null ? other.getModifyTime() == null : this.getModifyTime().equals(other.getModifyTime()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getVersion() == null ? other.getVersion() == null : this.getVersion().equals(other.getVersion()));
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jk_user_mobile_app_info
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getUid() == null) ? 0 : getUid().hashCode());
result = prime * result + ((getAppSystem() == null) ? 0 : getAppSystem().hashCode());
result = prime * result + ((getCollectNode() == null) ? 0 : getCollectNode().hashCode());
result = prime * result + ((getAppInfo() == null) ? 0 : getAppInfo().hashCode());
result = prime * result + ((getCreator() == null) ? 0 : getCreator().hashCode());
result = prime * result + ((getModifier() == null) ? 0 : getModifier().hashCode());
result = prime * result + ((getModifyTime() == null) ? 0 : getModifyTime().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getVersion() == null) ? 0 : getVersion().hashCode());
return result;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jk_user_mobile_app_info
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", uid=").append(uid);
sb.append(", appSystem=").append(appSystem);
sb.append(", collectNode=").append(collectNode);
sb.append(", appInfo=").append(appInfo);
sb.append(", creator=").append(creator);
sb.append(", modifier=").append(modifier);
sb.append(", modifyTime=").append(modifyTime);
sb.append(", createTime=").append(createTime);
sb.append(", version=").append(version);
sb.append("]");
return sb.toString();
}
} | UTF-8 | Java | 13,905 | java | UserMobileAppInfo.java | Java | [] | null | [] | package com.trj.jk.web.domain;
import java.util.Date;
public class UserMobileAppInfo {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jk_user_mobile_app_info.id
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
private Integer id;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jk_user_mobile_app_info.uid
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
private Integer uid;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jk_user_mobile_app_info.app_system
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
private String appSystem;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jk_user_mobile_app_info.collect_node
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
private Byte collectNode;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jk_user_mobile_app_info.app_info
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
private String appInfo;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jk_user_mobile_app_info.creator
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
private Integer creator;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jk_user_mobile_app_info.modifier
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
private Integer modifier;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jk_user_mobile_app_info.modify_time
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
private Date modifyTime;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jk_user_mobile_app_info.create_time
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
private Date createTime;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jk_user_mobile_app_info.version
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
private Integer version;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jk_user_mobile_app_info.id
*
* @return the value of jk_user_mobile_app_info.id
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
public Integer getId() {
return id;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jk_user_mobile_app_info.id
*
* @param id the value for jk_user_mobile_app_info.id
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
public void setId(Integer id) {
this.id = id;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jk_user_mobile_app_info.uid
*
* @return the value of jk_user_mobile_app_info.uid
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
public Integer getUid() {
return uid;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jk_user_mobile_app_info.uid
*
* @param uid the value for jk_user_mobile_app_info.uid
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
public void setUid(Integer uid) {
this.uid = uid;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jk_user_mobile_app_info.app_system
*
* @return the value of jk_user_mobile_app_info.app_system
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
public String getAppSystem() {
return appSystem;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jk_user_mobile_app_info.app_system
*
* @param appSystem the value for jk_user_mobile_app_info.app_system
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
public void setAppSystem(String appSystem) {
this.appSystem = appSystem;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jk_user_mobile_app_info.collect_node
*
* @return the value of jk_user_mobile_app_info.collect_node
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
public Byte getCollectNode() {
return collectNode;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jk_user_mobile_app_info.collect_node
*
* @param collectNode the value for jk_user_mobile_app_info.collect_node
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
public void setCollectNode(Byte collectNode) {
this.collectNode = collectNode;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jk_user_mobile_app_info.app_info
*
* @return the value of jk_user_mobile_app_info.app_info
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
public String getAppInfo() {
return appInfo;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jk_user_mobile_app_info.app_info
*
* @param appInfo the value for jk_user_mobile_app_info.app_info
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
public void setAppInfo(String appInfo) {
this.appInfo = appInfo;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jk_user_mobile_app_info.creator
*
* @return the value of jk_user_mobile_app_info.creator
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
public Integer getCreator() {
return creator;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jk_user_mobile_app_info.creator
*
* @param creator the value for jk_user_mobile_app_info.creator
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
public void setCreator(Integer creator) {
this.creator = creator;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jk_user_mobile_app_info.modifier
*
* @return the value of jk_user_mobile_app_info.modifier
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
public Integer getModifier() {
return modifier;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jk_user_mobile_app_info.modifier
*
* @param modifier the value for jk_user_mobile_app_info.modifier
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
public void setModifier(Integer modifier) {
this.modifier = modifier;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jk_user_mobile_app_info.modify_time
*
* @return the value of jk_user_mobile_app_info.modify_time
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
public Date getModifyTime() {
return modifyTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jk_user_mobile_app_info.modify_time
*
* @param modifyTime the value for jk_user_mobile_app_info.modify_time
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
public void setModifyTime(Date modifyTime) {
this.modifyTime = modifyTime;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jk_user_mobile_app_info.create_time
*
* @return the value of jk_user_mobile_app_info.create_time
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
public Date getCreateTime() {
return createTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jk_user_mobile_app_info.create_time
*
* @param createTime the value for jk_user_mobile_app_info.create_time
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jk_user_mobile_app_info.version
*
* @return the value of jk_user_mobile_app_info.version
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
public Integer getVersion() {
return version;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jk_user_mobile_app_info.version
*
* @param version the value for jk_user_mobile_app_info.version
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
public void setVersion(Integer version) {
this.version = version;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jk_user_mobile_app_info
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
UserMobileAppInfo other = (UserMobileAppInfo) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getUid() == null ? other.getUid() == null : this.getUid().equals(other.getUid()))
&& (this.getAppSystem() == null ? other.getAppSystem() == null : this.getAppSystem().equals(other.getAppSystem()))
&& (this.getCollectNode() == null ? other.getCollectNode() == null : this.getCollectNode().equals(other.getCollectNode()))
&& (this.getAppInfo() == null ? other.getAppInfo() == null : this.getAppInfo().equals(other.getAppInfo()))
&& (this.getCreator() == null ? other.getCreator() == null : this.getCreator().equals(other.getCreator()))
&& (this.getModifier() == null ? other.getModifier() == null : this.getModifier().equals(other.getModifier()))
&& (this.getModifyTime() == null ? other.getModifyTime() == null : this.getModifyTime().equals(other.getModifyTime()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getVersion() == null ? other.getVersion() == null : this.getVersion().equals(other.getVersion()));
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jk_user_mobile_app_info
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getUid() == null) ? 0 : getUid().hashCode());
result = prime * result + ((getAppSystem() == null) ? 0 : getAppSystem().hashCode());
result = prime * result + ((getCollectNode() == null) ? 0 : getCollectNode().hashCode());
result = prime * result + ((getAppInfo() == null) ? 0 : getAppInfo().hashCode());
result = prime * result + ((getCreator() == null) ? 0 : getCreator().hashCode());
result = prime * result + ((getModifier() == null) ? 0 : getModifier().hashCode());
result = prime * result + ((getModifyTime() == null) ? 0 : getModifyTime().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getVersion() == null) ? 0 : getVersion().hashCode());
return result;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jk_user_mobile_app_info
*
* @mbg.generated Tue Jun 13 16:01:18 CST 2017
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", uid=").append(uid);
sb.append(", appSystem=").append(appSystem);
sb.append(", collectNode=").append(collectNode);
sb.append(", appInfo=").append(appInfo);
sb.append(", creator=").append(creator);
sb.append(", modifier=").append(modifier);
sb.append(", modifyTime=").append(modifyTime);
sb.append(", createTime=").append(createTime);
sb.append(", version=").append(version);
sb.append("]");
return sb.toString();
}
} | 13,905 | 0.617188 | 0.587774 | 414 | 32.589371 | 31.450605 | 134 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.183575 | false | false | 7 |
2fe9340fc0657f4a50421f0b1a6a253d849dba37 | 14,834,817,083,667 | 58968d8b10c014b8870dd9816bc3b1d9b86117dc | /src/main/java/ua/yurii/zhurakovskyi/springfileupload/service/StudentService.java | e1ce6a5b0eca94633d6b89057169290842244981 | [] | no_license | yuriizhurakovskyi/spring-file-upload | https://github.com/yuriizhurakovskyi/spring-file-upload | d29de46a13048a20f55ce254274b53fc1a370266 | 393457fc38b3fa4e2a5f68defb5066317e908760 | refs/heads/master | 2022-06-30T01:54:18.394000 | 2020-05-14T10:29:02 | 2020-05-14T10:29:02 | 262,403,014 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ua.yurii.zhurakovskyi.springfileupload.service;
import java.io.IOException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import org.springframework.web.multipart.MultipartFile;
import javassist.NotFoundException;
import ua.yurii.zhurakovskyi.springfileupload.domain.Student;
import ua.yurii.zhurakovskyi.springfileupload.repository.StudentRepository;
@Service
public class StudentService {
@Autowired
private StudentRepository studentRepository;
public Student storeStudent(String firstName, String lastName, Integer age, MultipartFile file) throws IOException {
String fileName = StringUtils.cleanPath(file.getOriginalFilename());
Student student = null;
if (!fileName.contains("..")) {
student = new Student(firstName, lastName, age, fileName, file.getContentType(), file.getBytes());
}
return studentRepository.save(student);
}
public Student getStudent(String studentId) throws NotFoundException {
return studentRepository.findById(studentId)
.orElseThrow(() -> new NotFoundException("Student not found with Id =" + studentId));
}
}
| UTF-8 | Java | 1,187 | java | StudentService.java | Java | [
{
"context": "ntRepository;\n\n\tpublic Student storeStudent(String firstName, String lastName, Integer age, MultipartFile file",
"end": 616,
"score": 0.9211114645004272,
"start": 607,
"tag": "NAME",
"value": "firstName"
},
{
"context": "blic Student storeStudent(String firstName, String lastName, Integer age, MultipartFile file) throws IOExcept",
"end": 633,
"score": 0.8706585168838501,
"start": 625,
"tag": "NAME",
"value": "lastName"
},
{
"context": "leName.contains(\"..\")) {\n\t\t\tstudent = new Student(firstName, lastName, age, fileName, file.getContentType(), ",
"end": 854,
"score": 0.9974167346954346,
"start": 845,
"tag": "NAME",
"value": "firstName"
},
{
"context": "tains(\"..\")) {\n\t\t\tstudent = new Student(firstName, lastName, age, fileName, file.getContentType(), file.getBy",
"end": 864,
"score": 0.993000864982605,
"start": 856,
"tag": "NAME",
"value": "lastName"
}
] | null | [] | package ua.yurii.zhurakovskyi.springfileupload.service;
import java.io.IOException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import org.springframework.web.multipart.MultipartFile;
import javassist.NotFoundException;
import ua.yurii.zhurakovskyi.springfileupload.domain.Student;
import ua.yurii.zhurakovskyi.springfileupload.repository.StudentRepository;
@Service
public class StudentService {
@Autowired
private StudentRepository studentRepository;
public Student storeStudent(String firstName, String lastName, Integer age, MultipartFile file) throws IOException {
String fileName = StringUtils.cleanPath(file.getOriginalFilename());
Student student = null;
if (!fileName.contains("..")) {
student = new Student(firstName, lastName, age, fileName, file.getContentType(), file.getBytes());
}
return studentRepository.save(student);
}
public Student getStudent(String studentId) throws NotFoundException {
return studentRepository.findById(studentId)
.orElseThrow(() -> new NotFoundException("Student not found with Id =" + studentId));
}
}
| 1,187 | 0.803707 | 0.803707 | 33 | 34.969696 | 32.670517 | 117 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.454545 | false | false | 1 |
dff1169affa7c4bfc42f96bbafecbd960fde499d | 33,337,536,207,833 | 3f10e22e52074de95acb7f60d1bd42a9c28dd219 | /Maven/src/main/java/br/pro/nunes/drogaria/dao/PessoaDAO.java | 8691dc280f0f8e573bc3fa2c1a23edeb7a585ad9 | [] | no_license | alexnunes017/Web | https://github.com/alexnunes017/Web | 0101e5452ef02b0e4f54b4df39799de5fb35fa84 | beeb74f528dd98dd467051ee71ee63c12fe28146 | refs/heads/master | 2016-08-12T06:19:07.997000 | 2016-01-14T15:40:59 | 2016-01-14T15:40:59 | 49,656,744 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package br.pro.nunes.drogaria.dao;
import br.pro.nunes.drogaria.domain.Pessoa;
public class PessoaDAO extends GenericDAO<Pessoa>{
}
| UTF-8 | Java | 135 | java | PessoaDAO.java | Java | [] | null | [] | package br.pro.nunes.drogaria.dao;
import br.pro.nunes.drogaria.domain.Pessoa;
public class PessoaDAO extends GenericDAO<Pessoa>{
}
| 135 | 0.792593 | 0.792593 | 7 | 18.285715 | 21.265091 | 50 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.285714 | false | false | 1 |
485cf5886b8817bd0261e7482a03e2543e6208a9 | 9,801,115,381,817 | 691181cfd8c630f65c345b0d390ce778c3de10cd | /com.djyos.dide.managedbuilder.cross/src/com/djyos/csky/abiv1/managedbuild/cross/CompilerCommandLineGenerator.java | 4bb32abc77e7c42907c292543a28d6ae33c41506 | [] | no_license | ErikChanGit/EclipseResources | https://github.com/ErikChanGit/EclipseResources | 2d0697dafb2c9f747df5bac77a2237d6976308aa | c34171f0f29d71b4675f7a964b168287f2b73544 | refs/heads/master | 2021-10-24T12:37:25.955000 | 2019-03-26T07:16:05 | 2019-03-26T07:16:32 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.djyos.csky.abiv1.managedbuild.cross;
import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo;
import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.internal.core.ManagedCommandLineGenerator;
import org.eclipse.cdt.managedbuilder.internal.core.ManagedCommandLineInfo;
@SuppressWarnings("restriction")
public class CompilerCommandLineGenerator extends ManagedCommandLineGenerator {
// ------------------------------------------------------------------------
@Override
public IManagedCommandLineInfo generateCommandLineInfo(ITool tool, String commandName, String[] flags,
String outputFlag, String outputPrefix, String outputName, String[] inputResources,
String commandLinePattern) {
IManagedCommandLineInfo lineInfo;
lineInfo = super.generateCommandLineInfo(tool, commandName, flags, outputFlag, outputPrefix, outputName,
inputResources, commandLinePattern);
String newCommandLine = lineInfo.getCommandLine();
newCommandLine = updateMT(newCommandLine);
String newFlags = lineInfo.getFlags();
newFlags = updateMT(newFlags);
return new ManagedCommandLineInfo(newCommandLine, lineInfo.getCommandLinePattern(), lineInfo.getCommandName(),
newFlags, lineInfo.getOutputFlag(), lineInfo.getOutputPrefix(), lineInfo.getOutput(),
lineInfo.getInputs());
}
private String updateMT(String s) {
return s.replace("-MT\"$(@:%.o=%.d)\"", "-MT\"$@\"");
}
// ------------------------------------------------------------------------
}
| UTF-8 | Java | 1,556 | java | CompilerCommandLineGenerator.java | Java | [] | null | [] | package com.djyos.csky.abiv1.managedbuild.cross;
import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo;
import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.internal.core.ManagedCommandLineGenerator;
import org.eclipse.cdt.managedbuilder.internal.core.ManagedCommandLineInfo;
@SuppressWarnings("restriction")
public class CompilerCommandLineGenerator extends ManagedCommandLineGenerator {
// ------------------------------------------------------------------------
@Override
public IManagedCommandLineInfo generateCommandLineInfo(ITool tool, String commandName, String[] flags,
String outputFlag, String outputPrefix, String outputName, String[] inputResources,
String commandLinePattern) {
IManagedCommandLineInfo lineInfo;
lineInfo = super.generateCommandLineInfo(tool, commandName, flags, outputFlag, outputPrefix, outputName,
inputResources, commandLinePattern);
String newCommandLine = lineInfo.getCommandLine();
newCommandLine = updateMT(newCommandLine);
String newFlags = lineInfo.getFlags();
newFlags = updateMT(newFlags);
return new ManagedCommandLineInfo(newCommandLine, lineInfo.getCommandLinePattern(), lineInfo.getCommandName(),
newFlags, lineInfo.getOutputFlag(), lineInfo.getOutputPrefix(), lineInfo.getOutput(),
lineInfo.getInputs());
}
private String updateMT(String s) {
return s.replace("-MT\"$(@:%.o=%.d)\"", "-MT\"$@\"");
}
// ------------------------------------------------------------------------
}
| 1,556 | 0.697943 | 0.697301 | 36 | 41.222221 | 35.246838 | 112 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.111111 | false | false | 1 |
f588468c621b802fe690861f478a81021db868ec | 10,402,410,815,467 | dad8ea2d4ab471ca3815beb6011678d04bb8526f | /src/main/java/com/sptest/friendmanager/db/repository/FollowerRepository.java | 45df28d752e500bd091bf16e30fb417d5f143ba5 | [] | no_license | lxqlx/friend-manager | https://github.com/lxqlx/friend-manager | 0ffcbf5f0ec8f43a08fd492ab647d17b79ae2245 | 3c827b4bc24a451a480dd5e11e0aff09a3dd7669 | refs/heads/master | 2020-03-14T00:46:12.659000 | 2018-04-29T10:19:07 | 2018-04-29T10:19:07 | 131,363,611 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.sptest.friendmanager.db.repository;
import com.sptest.friendmanager.db.model.FollowerRelationshipDto;
import com.sptest.friendmanager.db.model.RelationshipKey;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import javax.transaction.Transactional;
import java.util.List;
@Repository
@Transactional
public interface FollowerRepository extends JpaRepository<FollowerRelationshipDto, RelationshipKey> {
List<FollowerRelationshipDto> findByRelationshipKeyTargetEmail(String targetEmail);
} | UTF-8 | Java | 568 | java | FollowerRepository.java | Java | [] | null | [] | package com.sptest.friendmanager.db.repository;
import com.sptest.friendmanager.db.model.FollowerRelationshipDto;
import com.sptest.friendmanager.db.model.RelationshipKey;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import javax.transaction.Transactional;
import java.util.List;
@Repository
@Transactional
public interface FollowerRepository extends JpaRepository<FollowerRelationshipDto, RelationshipKey> {
List<FollowerRelationshipDto> findByRelationshipKeyTargetEmail(String targetEmail);
} | 568 | 0.862676 | 0.862676 | 15 | 36.933334 | 32.08004 | 101 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.6 | false | false | 1 |
0a6421a00eafc9979d2804b9d250b122e4607477 | 28,716,151,392,182 | 74e9bb8c7b0e31889def44370bd825cf3575942d | /domain/src/main/java/com/transition/scorekeeper/domain/builder/PlayerBuilder.java | 30e420f9205a8894d048564fb7c0210e59f1c806 | [] | no_license | desarrollo-cooperativo/scorekeeper | https://github.com/desarrollo-cooperativo/scorekeeper | 6abde0b60350a73bb4aaf5f6f2d93928ffa9d2ae | 6a78566042a2b10a194f78e2f64fbe4d39e81223 | refs/heads/master | 2021-01-12T23:33:14.468000 | 2016-10-15T18:11:53 | 2016-10-15T18:11:53 | 65,245,451 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.transition.scorekeeper.domain.builder;
import com.transition.scorekeeper.domain.Constants;
import com.transition.scorekeeper.domain.domain.Player;
import com.transition.scorekeeper.domain.exception.player.InvalidNameException;
/**
* @author diego.rotondale
* @since 13/05/16
*/
public class PlayerBuilder {
private String name;
private int preferentialPosition = Constants.Position.NONE;
public Player build() {
isValid();
return new Player(this);
}
public String getName() {
return name;
}
public PlayerBuilder setName(String name) {
this.name = name;
return this;
}
public int getPreferentialPosition() {
return preferentialPosition;
}
public PlayerBuilder setPreferentialPosition(int preferentialPosition) {
this.preferentialPosition = preferentialPosition;
return this;
}
private boolean isAValidName() {
return name == null
|| name.isEmpty()
|| name.length() < Constants.PlayerConstants.MIN_LENGTH
|| name.length() > Constants.PlayerConstants.MAX_LENGTH;
}
public void isValid() {
if (isAValidName()) {
throw new InvalidNameException();
}
}
}
| UTF-8 | Java | 1,284 | java | PlayerBuilder.java | Java | [
{
"context": "ption.player.InvalidNameException;\n\n/**\n * @author diego.rotondale\n * @since 13/05/16\n */\npublic class PlayerBuilder",
"end": 271,
"score": 0.9982107877731323,
"start": 256,
"tag": "NAME",
"value": "diego.rotondale"
}
] | null | [] | package com.transition.scorekeeper.domain.builder;
import com.transition.scorekeeper.domain.Constants;
import com.transition.scorekeeper.domain.domain.Player;
import com.transition.scorekeeper.domain.exception.player.InvalidNameException;
/**
* @author diego.rotondale
* @since 13/05/16
*/
public class PlayerBuilder {
private String name;
private int preferentialPosition = Constants.Position.NONE;
public Player build() {
isValid();
return new Player(this);
}
public String getName() {
return name;
}
public PlayerBuilder setName(String name) {
this.name = name;
return this;
}
public int getPreferentialPosition() {
return preferentialPosition;
}
public PlayerBuilder setPreferentialPosition(int preferentialPosition) {
this.preferentialPosition = preferentialPosition;
return this;
}
private boolean isAValidName() {
return name == null
|| name.isEmpty()
|| name.length() < Constants.PlayerConstants.MIN_LENGTH
|| name.length() > Constants.PlayerConstants.MAX_LENGTH;
}
public void isValid() {
if (isAValidName()) {
throw new InvalidNameException();
}
}
}
| 1,284 | 0.649533 | 0.64486 | 50 | 24.68 | 23.016029 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.44 | false | false | 1 |
449039823cca6d5bd91cda88b74d36fd1f1e01c4 | 22,832,046,172,882 | ce87f41bd3807eff1377574b986a06b5fed6f28c | /AAFWeb/AAFAdmin/src/com/teligent/pojo/properties/WebAppBean.java | b9033ca20b84d89f63912b1d76587e3469e48d36 | [] | no_license | teligent-systems/hats-pnb | https://github.com/teligent-systems/hats-pnb | a32ad043c80a304ef4447b56aa1668f25e81ad25 | d90cae99406e85c66c2ffd526455c306e2a6b0c2 | refs/heads/master | 2016-08-07T15:25:26.176000 | 2015-02-02T01:18:29 | 2015-02-02T01:18:29 | 30,063,304 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.teligent.pojo.properties;
public interface WebAppBean {
public String getAddress();
}
| UTF-8 | Java | 100 | java | WebAppBean.java | Java | [] | null | [] | package com.teligent.pojo.properties;
public interface WebAppBean {
public String getAddress();
}
| 100 | 0.79 | 0.79 | 5 | 19 | 15.427249 | 37 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.6 | false | false | 1 |
3e3b299f880c9bbe4143c3a81868810fec1c9978 | 20,813,411,555,624 | 50abe84551e396c09a20aa51aaca98198175d3e3 | /src/java/com/epic/tle/xml/XmlReader.java | 9e751157ed08343672a18e9d852d4ad2f9947892 | [] | no_license | kreshan882/WEBHibernatTleDemo | https://github.com/kreshan882/WEBHibernatTleDemo | 08ea81f13071b5abff6c56babe9a3905a2547979 | 74d967e50051781b70def2a24b0fb27f778d296d | refs/heads/master | 2020-03-23T07:15:55.538000 | 2018-07-17T11:26:01 | 2018-07-17T11:26:01 | 141,259,336 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.epic.tle.xml;
import java.io.File;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Result;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.Text;
/**
*
* @author kreshan
*/
public class XmlReader {
String xmlFileName;
public XmlReader(String xmlFileName) {
this.xmlFileName = xmlFileName;
}
public String getTleConfigurations(String element) throws Exception { //to get home values
String value = "";
try {
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
Document doc = docBuilder.parse(new File(xmlFileName));
// normalize text representation
doc.getDocumentElement().normalize();
NodeList listOfSPRMs = doc.getElementsByTagName("config");
int totalSPRMs = listOfSPRMs.getLength();
for (int i = 0; i < totalSPRMs; i++) {
Node firstSPRMNode = listOfSPRMs.item(i);
if (firstSPRMNode.getNodeType() == Node.ELEMENT_NODE) {
Element firstSPRAMElement = (Element) firstSPRMNode;
if (firstSPRAMElement.getElementsByTagName(element) != null) {
NodeList hostList = firstSPRAMElement.getElementsByTagName(element);
Element hostElement = (Element) hostList.item(0);
NodeList textHostList = hostElement.getChildNodes();
if ((textHostList.item(0)) != null) {
value = ((Node) textHostList.item(0)).getNodeValue().trim();
}
}
}//End if
}//End for
} catch (Exception ex) {
throw ex;
}
return value;
}
public void saveTleConfigurations(String element, String value) throws Exception {
try{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc = builder.parse(new File(xmlFileName));
Element rootElement = doc.getDocumentElement();
NodeList list = rootElement.getElementsByTagName(element);
if (list.item(0).getNodeName().equals(element)) {
NodeList valiveList = list.item(0).getChildNodes();
((Text) valiveList.item(0)).setData(value);
}
DOMSource source = new DOMSource(doc);
File file = new File(xmlFileName);
Result result = new StreamResult(file);
Transformer xformer = TransformerFactory.newInstance().newTransformer();
xformer.transform(source, result);
}catch(Exception ex){
throw ex;
//LogFileCreator.writErrorTologs(ex);
}
}
}
| UTF-8 | Java | 3,314 | java | XmlReader.java | Java | [
{
"context": "deList;\nimport org.w3c.dom.Text;\n/**\n *\n * @author kreshan\n */\npublic class XmlReader {\n\n String xmlFileN",
"end": 611,
"score": 0.9991574287414551,
"start": 604,
"tag": "USERNAME",
"value": "kreshan"
}
] | null | [] | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.epic.tle.xml;
import java.io.File;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Result;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.Text;
/**
*
* @author kreshan
*/
public class XmlReader {
String xmlFileName;
public XmlReader(String xmlFileName) {
this.xmlFileName = xmlFileName;
}
public String getTleConfigurations(String element) throws Exception { //to get home values
String value = "";
try {
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
Document doc = docBuilder.parse(new File(xmlFileName));
// normalize text representation
doc.getDocumentElement().normalize();
NodeList listOfSPRMs = doc.getElementsByTagName("config");
int totalSPRMs = listOfSPRMs.getLength();
for (int i = 0; i < totalSPRMs; i++) {
Node firstSPRMNode = listOfSPRMs.item(i);
if (firstSPRMNode.getNodeType() == Node.ELEMENT_NODE) {
Element firstSPRAMElement = (Element) firstSPRMNode;
if (firstSPRAMElement.getElementsByTagName(element) != null) {
NodeList hostList = firstSPRAMElement.getElementsByTagName(element);
Element hostElement = (Element) hostList.item(0);
NodeList textHostList = hostElement.getChildNodes();
if ((textHostList.item(0)) != null) {
value = ((Node) textHostList.item(0)).getNodeValue().trim();
}
}
}//End if
}//End for
} catch (Exception ex) {
throw ex;
}
return value;
}
public void saveTleConfigurations(String element, String value) throws Exception {
try{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc = builder.parse(new File(xmlFileName));
Element rootElement = doc.getDocumentElement();
NodeList list = rootElement.getElementsByTagName(element);
if (list.item(0).getNodeName().equals(element)) {
NodeList valiveList = list.item(0).getChildNodes();
((Text) valiveList.item(0)).setData(value);
}
DOMSource source = new DOMSource(doc);
File file = new File(xmlFileName);
Result result = new StreamResult(file);
Transformer xformer = TransformerFactory.newInstance().newTransformer();
xformer.transform(source, result);
}catch(Exception ex){
throw ex;
//LogFileCreator.writErrorTologs(ex);
}
}
}
| 3,314 | 0.624321 | 0.6207 | 95 | 33.884209 | 27.92692 | 94 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.547368 | false | false | 1 |
32c04824afd8c4a75af4a5454b61ef6ddfb7ce85 | 18,090,402,271,462 | 0124afe09ae341841c4555653c1af0bad211258e | /src/main/java/com/designfreed/rest/TalonarioRestController.java | 1f6a3e7d1be4c3867020d8d3bc278b7a775993bc | [] | no_license | mbisurgi-designfreed/distribuidoras-backend | https://github.com/mbisurgi-designfreed/distribuidoras-backend | 37ea2ec18eed36fcc731c36e0361f81ae5666c31 | 1fe9ef10051c17b1f005b89728e9e07415052c86 | refs/heads/master | 2021-01-11T23:16:11.933000 | 2018-07-25T19:31:54 | 2018-07-25T19:31:54 | 78,561,391 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.designfreed.rest;
import com.designfreed.crm.domain.Talonario;
import com.designfreed.services.TalonarioService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("/talonario")
public class TalonarioRestController {
private TalonarioService talonarioService;
@Autowired
public void setTalonarioService(TalonarioService talonarioService) {
this.talonarioService = talonarioService;
}
@GetMapping("/list")
public List<Talonario> findAll() {
return talonarioService.findAll();
}
}
| UTF-8 | Java | 792 | java | TalonarioRestController.java | Java | [] | null | [] | package com.designfreed.rest;
import com.designfreed.crm.domain.Talonario;
import com.designfreed.services.TalonarioService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("/talonario")
public class TalonarioRestController {
private TalonarioService talonarioService;
@Autowired
public void setTalonarioService(TalonarioService talonarioService) {
this.talonarioService = talonarioService;
}
@GetMapping("/list")
public List<Talonario> findAll() {
return talonarioService.findAll();
}
}
| 792 | 0.790404 | 0.790404 | 26 | 29.461538 | 23.396631 | 72 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.423077 | false | false | 1 |
66880d7b2d03e710500166b54642f668f453efe0 | 16,243,566,339,742 | b281a5bbccd2d0bb96d9c43ecfaa8425bb6f2db4 | /src/test/java/org/selenide/examples/config/configuration/EPropertiesKeys.java | e33d7cb1def05d09f813a6509f7c4bd046b70124 | [] | no_license | anjilinux/selenide-allure1-junit4-parallelJVM-JenkinsPipelines-Grid | https://github.com/anjilinux/selenide-allure1-junit4-parallelJVM-JenkinsPipelines-Grid | df07b4129fc0d84e95da87752f85fda853f6ba13 | 8f05b297d293c48d6b91f65a63a461ad20d20f4c | refs/heads/master | 2023-03-21T00:39:43.206000 | 2020-02-12T09:58:42 | 2020-02-12T09:58:42 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.selenide.examples.config.configuration;
public enum EPropertiesKeys {
BASE_URL("base.url"),
ENV("env"),
DEFAULT_ENV("dev"),
ENV_FILENAME_SUFFIX(".environment.properties");
private final String key;
public String getKey() {
return key;
}
EPropertiesKeys(String key) {
this.key = key;
}
@Override
public String toString() {
return getKey();
}
}
| UTF-8 | Java | 432 | java | EPropertiesKeys.java | Java | [] | null | [] | package org.selenide.examples.config.configuration;
public enum EPropertiesKeys {
BASE_URL("base.url"),
ENV("env"),
DEFAULT_ENV("dev"),
ENV_FILENAME_SUFFIX(".environment.properties");
private final String key;
public String getKey() {
return key;
}
EPropertiesKeys(String key) {
this.key = key;
}
@Override
public String toString() {
return getKey();
}
}
| 432 | 0.608796 | 0.608796 | 23 | 17.782608 | 15.427126 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.391304 | false | false | 1 |
054b33ed551dfd04afacff9f2ffd98b841e5d482 | 16,338,055,603,916 | 0adbe61dc47a7a7d8f1f2462df46208b28275737 | /src/main/java/observer/normal/Reader.java | 0f420f662236d28eddc88343768183ac2490d3f4 | [] | no_license | Aoldfarmer/designpattern | https://github.com/Aoldfarmer/designpattern | 501b07ef38d34736efd42dc95b9869ea21450ae8 | 84917626e5f07f9307537d94cd6a4ed39be37264 | refs/heads/master | 2021-01-01T17:49:57.073000 | 2017-12-25T06:02:21 | 2017-12-25T06:02:21 | 98,169,598 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package observer.normal;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Reader implements IObserver {
private static int count;
private static final Logger LOG = LoggerFactory.getLogger(Reader.class);
@Override
public void update(ISubject iSubject) {
if (iSubject instanceof Article) {
Article article = (Article) iSubject;
count++;
LOG.debug("่ฏป่
{}่ขซ้็ฅๅฐ, ๆ็ซ ๅทฒ่ขซๆดๆน,ๆดๆนๅ็ๆ ้ขไธบ๏ผ{}", count, article.getTitle());
}
}
}
| UTF-8 | Java | 547 | java | Reader.java | Java | [] | null | [] | package observer.normal;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Reader implements IObserver {
private static int count;
private static final Logger LOG = LoggerFactory.getLogger(Reader.class);
@Override
public void update(ISubject iSubject) {
if (iSubject instanceof Article) {
Article article = (Article) iSubject;
count++;
LOG.debug("่ฏป่
{}่ขซ้็ฅๅฐ, ๆ็ซ ๅทฒ่ขซๆดๆน,ๆดๆนๅ็ๆ ้ขไธบ๏ผ{}", count, article.getTitle());
}
}
}
| 547 | 0.656805 | 0.65286 | 19 | 25.68421 | 24.116062 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.631579 | false | false | 1 |
e689bd3263836cb96add2f9b334bb73ef51cce48 | 3,487,513,462,754 | 0e925326ebd43acc5080c0ee9443ad39caa01f07 | /src/vista/GestionInforme.java | 7c5ae53a1e71065697801a27fa24fb53bec11f20 | [] | no_license | PatoCris/TrabajoFinal | https://github.com/PatoCris/TrabajoFinal | 09675e85e5dbf355e22f8d0b6f66216217fba96f | e3baa4b6ac5a0e02fe3a9c7f9c17051da6a82eb8 | refs/heads/master | 2021-01-19T11:49:25.850000 | 2014-12-15T13:33:00 | 2014-12-15T13:33:00 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* 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 vista;
import Modelo.InformePiezaPedido;
import Modelo.Pedido;
import Modelo.PiezaRecambio;
import java.text.SimpleDateFormat;
import java.util.List;
import javax.swing.JOptionPane;
/**
*
* @author Asus
*/
public class GestionInforme extends javax.swing.JInternalFrame {
private ControladoraVista cv;
private String bandera;
private UtilVista util;
private int codigoP;
/**
* Creates new form GestionInforme
*/
public GestionInforme(ControladoraVista controladoraVista, int codigo) throws Exception {
initComponents();
cv = controladoraVista;
codigoP = codigo;
util = new UtilVista();
try {
// this.cv.traerPedido(codigoP);
lblPieza.setText(this.cv.traerPedido(codigoP).getUnaPieza().toString());
} catch (Exception ex) {
JOptionPane.showMessageDialog(null, ex.getMessage());
}
if (this.cv.traerPedido(codigo).getUnInforme() != null) {
this.estadoInicioEditar();
} else {
this.estadoInicioNuevo();
}
}
public void limpiar() {
txtCodigo.setText("");
txtFecha.setText("");
chkAprobado.setSelected(false);
}
public void estadoInicioNuevo() {
bandera = "nuevo";
txtFecha.setEnabled(true);
txtCodigo.setEnabled(false);
chkAprobado.setEnabled(true);
btnGuardar.setEnabled(true);
btnEditar.setEnabled(true);
btnEliminar.setEnabled(true);
limpiar();
}
public void estadoInicioEditar() throws Exception {
bandera = "editar";
SimpleDateFormat formato = new SimpleDateFormat("dd/MM/yyyy");
String fechaDate = formato.format(this.cv.traerPedido(codigoP).getUnInforme().getFecha());
txtFecha.setEnabled(false);
txtFecha.setText(fechaDate);
txtCodigo.setText(String.valueOf(this.cv.traerPedido(codigoP).getUnInforme().getCodigo()));
txtCodigo.setEnabled(false);
chkAprobado.setEnabled(true);
btnGuardar.setEnabled(true);
btnEditar.setEnabled(true);
btnEliminar.setEnabled(true);
chkAprobado.setSelected(this.cv.traerPedido(codigoP).getUnInforme().isAprobado());
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
txtCodigo = new javax.swing.JTextField();
chkAprobado = new javax.swing.JCheckBox();
txtFecha = new javax.swing.JFormattedTextField();
jLabel6 = new javax.swing.JLabel();
lblPieza = new javax.swing.JLabel();
jLabel1 = new javax.swing.JLabel();
btnGuardar = new javax.swing.JButton();
btnEditar = new javax.swing.JButton();
btnEliminar = new javax.swing.JButton();
btnSalir = new javax.swing.JButton();
setTitle("Gestiรณn de Informes de Piezas Pedidas");
setName(""); // NOI18N
jLabel2.setFont(new java.awt.Font("Politica", 0, 16)); // NOI18N
jLabel2.setText("Cรณdigo:");
jLabel3.setFont(new java.awt.Font("Politica", 0, 16)); // NOI18N
jLabel3.setText("Aprobado:");
jLabel4.setFont(new java.awt.Font("Politica", 0, 16)); // NOI18N
jLabel4.setText("Fecha: ");
try {
txtFecha.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("##/##/####")));
} catch (java.text.ParseException ex) {
ex.printStackTrace();
}
jLabel6.setFont(new java.awt.Font("Politica", 0, 16)); // NOI18N
jLabel6.setText("Pieza:");
lblPieza.setFont(new java.awt.Font("Politica", 1, 17)); // NOI18N
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel6)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(lblPieza, javax.swing.GroupLayout.PREFERRED_SIZE, 204, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel2)
.addComponent(jLabel3)
.addComponent(jLabel4))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(txtCodigo, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(chkAprobado, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtFecha, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(133, 133, 133)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(30, 30, 30)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2)
.addComponent(txtCodigo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(chkAprobado))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtFecha, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel4, javax.swing.GroupLayout.Alignment.TRAILING))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel6)
.addComponent(lblPieza, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(31, Short.MAX_VALUE))
);
jLabel1.setFont(new java.awt.Font("Politica", 1, 24)); // NOI18N
jLabel1.setText("GESTIรN DE INFORMES DE PIEZAS PEDIDAS");
btnGuardar.setFont(new java.awt.Font("Politica", 0, 16)); // NOI18N
btnGuardar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/save.png"))); // NOI18N
btnGuardar.setText("Guardar");
btnGuardar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnGuardarActionPerformed(evt);
}
});
btnEditar.setFont(new java.awt.Font("Politica", 0, 16)); // NOI18N
btnEditar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/pencil_edit.png"))); // NOI18N
btnEditar.setText("Editar");
btnEditar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnEditarActionPerformed(evt);
}
});
btnEliminar.setFont(new java.awt.Font("Politica", 0, 16)); // NOI18N
btnEliminar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/Trash.png"))); // NOI18N
btnEliminar.setText("Eliminar");
btnEliminar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnEliminarActionPerformed(evt);
}
});
btnSalir.setFont(new java.awt.Font("Politica", 0, 16)); // NOI18N
btnSalir.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/close_16.png"))); // NOI18N
btnSalir.setText("Salir");
btnSalir.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnSalirActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(btnSalir)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1)
.addGroup(layout.createSequentialGroup()
.addGap(142, 142, 142)
.addComponent(btnGuardar, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnEditar)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnEliminar))))
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(11, 11, 11)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnEditar)
.addComponent(btnGuardar)
.addComponent(btnEliminar))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btnSalir)
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void btnGuardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGuardarActionPerformed
try {
java.util.Date fecha = null;
boolean aprobado = chkAprobado.isSelected();
String fechaString = txtFecha.getText();
fecha = util.ParseFecha(fechaString, "Error en el formato de la fecha, debe ingresar dd/MM/yyyy");
if (bandera.equals("nuevo")) {
this.cv.nuevoInforme(aprobado, fecha, true, this.cv.traerPedido(codigoP).getUnaPieza());
Pedido unPedido = this.cv.traerPedido(codigoP);
this.cv.agregarInfoAPedido(unPedido, this.cv.recuperarUltimoInforme());
bandera = "";
estadoInicioNuevo();
} else {
int codigo = Integer.valueOf(txtCodigo.getText());
this.cv.editarInforme(codigo, aprobado, fecha, true, this.cv.traerPedido(codigoP).getUnaPieza());
estadoInicioNuevo();
}
} catch (Exception ex) {
JOptionPane.showMessageDialog(null, ex.getMessage());
}
}//GEN-LAST:event_btnGuardarActionPerformed
private void btnEditarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEditarActionPerformed
// txtCodigo.setEnabled(true);
// txtFecha.setEnabled(false);
// chkAprobado.setEnabled(true);
// btnEditar.setEnabled(false);
}//GEN-LAST:event_btnEditarActionPerformed
private void btnEliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEliminarActionPerformed
try {
util.verificarString(txtCodigo.getText(), "Cรณdigo");
int codigo = Integer.valueOf(txtCodigo.getText());
if (codigo != 0) {
this.cv.eliminarInforme(codigo);
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e.getMessage());
}
}//GEN-LAST:event_btnEliminarActionPerformed
private void btnSalirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSalirActionPerformed
this.dispose();
}//GEN-LAST:event_btnSalirActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnEditar;
private javax.swing.JButton btnEliminar;
private javax.swing.JButton btnGuardar;
private javax.swing.JButton btnSalir;
private javax.swing.JCheckBox chkAprobado;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel6;
private javax.swing.JPanel jPanel1;
private javax.swing.JLabel lblPieza;
private javax.swing.JTextField txtCodigo;
private javax.swing.JFormattedTextField txtFecha;
// End of variables declaration//GEN-END:variables
}
| UTF-8 | Java | 15,086 | java | GestionInforme.java | Java | [
{
"context": "import javax.swing.JOptionPane;\n\n/**\n *\n * @author Asus\n */\npublic class GestionInforme extends javax.swi",
"end": 399,
"score": 0.9958062171936035,
"start": 395,
"tag": "NAME",
"value": "Asus"
}
] | null | [] | /*
* 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 vista;
import Modelo.InformePiezaPedido;
import Modelo.Pedido;
import Modelo.PiezaRecambio;
import java.text.SimpleDateFormat;
import java.util.List;
import javax.swing.JOptionPane;
/**
*
* @author Asus
*/
public class GestionInforme extends javax.swing.JInternalFrame {
private ControladoraVista cv;
private String bandera;
private UtilVista util;
private int codigoP;
/**
* Creates new form GestionInforme
*/
public GestionInforme(ControladoraVista controladoraVista, int codigo) throws Exception {
initComponents();
cv = controladoraVista;
codigoP = codigo;
util = new UtilVista();
try {
// this.cv.traerPedido(codigoP);
lblPieza.setText(this.cv.traerPedido(codigoP).getUnaPieza().toString());
} catch (Exception ex) {
JOptionPane.showMessageDialog(null, ex.getMessage());
}
if (this.cv.traerPedido(codigo).getUnInforme() != null) {
this.estadoInicioEditar();
} else {
this.estadoInicioNuevo();
}
}
public void limpiar() {
txtCodigo.setText("");
txtFecha.setText("");
chkAprobado.setSelected(false);
}
public void estadoInicioNuevo() {
bandera = "nuevo";
txtFecha.setEnabled(true);
txtCodigo.setEnabled(false);
chkAprobado.setEnabled(true);
btnGuardar.setEnabled(true);
btnEditar.setEnabled(true);
btnEliminar.setEnabled(true);
limpiar();
}
public void estadoInicioEditar() throws Exception {
bandera = "editar";
SimpleDateFormat formato = new SimpleDateFormat("dd/MM/yyyy");
String fechaDate = formato.format(this.cv.traerPedido(codigoP).getUnInforme().getFecha());
txtFecha.setEnabled(false);
txtFecha.setText(fechaDate);
txtCodigo.setText(String.valueOf(this.cv.traerPedido(codigoP).getUnInforme().getCodigo()));
txtCodigo.setEnabled(false);
chkAprobado.setEnabled(true);
btnGuardar.setEnabled(true);
btnEditar.setEnabled(true);
btnEliminar.setEnabled(true);
chkAprobado.setSelected(this.cv.traerPedido(codigoP).getUnInforme().isAprobado());
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
txtCodigo = new javax.swing.JTextField();
chkAprobado = new javax.swing.JCheckBox();
txtFecha = new javax.swing.JFormattedTextField();
jLabel6 = new javax.swing.JLabel();
lblPieza = new javax.swing.JLabel();
jLabel1 = new javax.swing.JLabel();
btnGuardar = new javax.swing.JButton();
btnEditar = new javax.swing.JButton();
btnEliminar = new javax.swing.JButton();
btnSalir = new javax.swing.JButton();
setTitle("Gestiรณn de Informes de Piezas Pedidas");
setName(""); // NOI18N
jLabel2.setFont(new java.awt.Font("Politica", 0, 16)); // NOI18N
jLabel2.setText("Cรณdigo:");
jLabel3.setFont(new java.awt.Font("Politica", 0, 16)); // NOI18N
jLabel3.setText("Aprobado:");
jLabel4.setFont(new java.awt.Font("Politica", 0, 16)); // NOI18N
jLabel4.setText("Fecha: ");
try {
txtFecha.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("##/##/####")));
} catch (java.text.ParseException ex) {
ex.printStackTrace();
}
jLabel6.setFont(new java.awt.Font("Politica", 0, 16)); // NOI18N
jLabel6.setText("Pieza:");
lblPieza.setFont(new java.awt.Font("Politica", 1, 17)); // NOI18N
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel6)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(lblPieza, javax.swing.GroupLayout.PREFERRED_SIZE, 204, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel2)
.addComponent(jLabel3)
.addComponent(jLabel4))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(txtCodigo, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(chkAprobado, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtFecha, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(133, 133, 133)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(30, 30, 30)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2)
.addComponent(txtCodigo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(chkAprobado))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtFecha, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel4, javax.swing.GroupLayout.Alignment.TRAILING))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel6)
.addComponent(lblPieza, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(31, Short.MAX_VALUE))
);
jLabel1.setFont(new java.awt.Font("Politica", 1, 24)); // NOI18N
jLabel1.setText("GESTIรN DE INFORMES DE PIEZAS PEDIDAS");
btnGuardar.setFont(new java.awt.Font("Politica", 0, 16)); // NOI18N
btnGuardar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/save.png"))); // NOI18N
btnGuardar.setText("Guardar");
btnGuardar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnGuardarActionPerformed(evt);
}
});
btnEditar.setFont(new java.awt.Font("Politica", 0, 16)); // NOI18N
btnEditar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/pencil_edit.png"))); // NOI18N
btnEditar.setText("Editar");
btnEditar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnEditarActionPerformed(evt);
}
});
btnEliminar.setFont(new java.awt.Font("Politica", 0, 16)); // NOI18N
btnEliminar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/Trash.png"))); // NOI18N
btnEliminar.setText("Eliminar");
btnEliminar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnEliminarActionPerformed(evt);
}
});
btnSalir.setFont(new java.awt.Font("Politica", 0, 16)); // NOI18N
btnSalir.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/close_16.png"))); // NOI18N
btnSalir.setText("Salir");
btnSalir.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnSalirActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(btnSalir)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1)
.addGroup(layout.createSequentialGroup()
.addGap(142, 142, 142)
.addComponent(btnGuardar, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnEditar)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnEliminar))))
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(11, 11, 11)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnEditar)
.addComponent(btnGuardar)
.addComponent(btnEliminar))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btnSalir)
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void btnGuardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGuardarActionPerformed
try {
java.util.Date fecha = null;
boolean aprobado = chkAprobado.isSelected();
String fechaString = txtFecha.getText();
fecha = util.ParseFecha(fechaString, "Error en el formato de la fecha, debe ingresar dd/MM/yyyy");
if (bandera.equals("nuevo")) {
this.cv.nuevoInforme(aprobado, fecha, true, this.cv.traerPedido(codigoP).getUnaPieza());
Pedido unPedido = this.cv.traerPedido(codigoP);
this.cv.agregarInfoAPedido(unPedido, this.cv.recuperarUltimoInforme());
bandera = "";
estadoInicioNuevo();
} else {
int codigo = Integer.valueOf(txtCodigo.getText());
this.cv.editarInforme(codigo, aprobado, fecha, true, this.cv.traerPedido(codigoP).getUnaPieza());
estadoInicioNuevo();
}
} catch (Exception ex) {
JOptionPane.showMessageDialog(null, ex.getMessage());
}
}//GEN-LAST:event_btnGuardarActionPerformed
private void btnEditarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEditarActionPerformed
// txtCodigo.setEnabled(true);
// txtFecha.setEnabled(false);
// chkAprobado.setEnabled(true);
// btnEditar.setEnabled(false);
}//GEN-LAST:event_btnEditarActionPerformed
private void btnEliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEliminarActionPerformed
try {
util.verificarString(txtCodigo.getText(), "Cรณdigo");
int codigo = Integer.valueOf(txtCodigo.getText());
if (codigo != 0) {
this.cv.eliminarInforme(codigo);
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e.getMessage());
}
}//GEN-LAST:event_btnEliminarActionPerformed
private void btnSalirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSalirActionPerformed
this.dispose();
}//GEN-LAST:event_btnSalirActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnEditar;
private javax.swing.JButton btnEliminar;
private javax.swing.JButton btnGuardar;
private javax.swing.JButton btnSalir;
private javax.swing.JCheckBox chkAprobado;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel6;
private javax.swing.JPanel jPanel1;
private javax.swing.JLabel lblPieza;
private javax.swing.JTextField txtCodigo;
private javax.swing.JFormattedTextField txtFecha;
// End of variables declaration//GEN-END:variables
}
| 15,086 | 0.640896 | 0.628962 | 310 | 47.651611 | 36.261345 | 205 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.735484 | false | false | 1 |
67dcbbeabdeb29756610ca68c96bca2aec07a706 | 3,487,513,460,478 | f89359c5dd1b7bb70babdb33c4b01946bd31cfb5 | /src/HEMonkLoveForFood.java | 06846ea83aa8c2b01e08a24126943fc5176fdb92 | [] | no_license | cscvenkatmadurai/Coding | https://github.com/cscvenkatmadurai/Coding | 758b528d94492641740d2bd6fbf72ba16301c77d | 0704dcb79373f717e8b20c63c5f7393d997c8ec3 | refs/heads/master | 2021-01-25T12:20:39.414000 | 2015-08-11T11:07:42 | 2015-08-11T11:07:42 | 40,482,282 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* Created by HARISH on 6/16/2015.
*/
import java.io.*;
import java.util.*;
public class HEMonkLoveForFood {
public static void main(String[] args) throws IOException{
BufferedReader kb = new BufferedReader(new InputStreamReader( System.in ) );
int tt = Integer.parseInt( kb.readLine() );
ArrayList <Integer> stack = new ArrayList<>();
String ip[];
while(tt-- > 0){
ip = kb.readLine().split(" ");
if(ip.length == 1){
if(stack.size()==0){
System.out.println("No Food");
}else{
System.out.println(stack.remove(stack.size()-1));
}
}else{
stack.add(Integer.parseInt(ip[1]));
}
}
}
}
| UTF-8 | Java | 817 | java | HEMonkLoveForFood.java | Java | [
{
"context": "/**\r\n * Created by HARISH on 6/16/2015.\r\n */\r\nimport java.io.*;\r\nimport jav",
"end": 25,
"score": 0.9995102882385254,
"start": 19,
"tag": "NAME",
"value": "HARISH"
}
] | null | [] | /**
* Created by HARISH on 6/16/2015.
*/
import java.io.*;
import java.util.*;
public class HEMonkLoveForFood {
public static void main(String[] args) throws IOException{
BufferedReader kb = new BufferedReader(new InputStreamReader( System.in ) );
int tt = Integer.parseInt( kb.readLine() );
ArrayList <Integer> stack = new ArrayList<>();
String ip[];
while(tt-- > 0){
ip = kb.readLine().split(" ");
if(ip.length == 1){
if(stack.size()==0){
System.out.println("No Food");
}else{
System.out.println(stack.remove(stack.size()-1));
}
}else{
stack.add(Integer.parseInt(ip[1]));
}
}
}
}
| 817 | 0.487148 | 0.47246 | 25 | 30.68 | 21.877331 | 84 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false | 1 |
e6edfb2aa0bd897395d58177a15730d1e2852159 | 8,315,056,703,269 | d33fd2ee614b2b8340aea1254137ae5a1b792040 | /Cracking/Data_Structure/Chapter_2_Linked_Lists/LinkedFive.java | dfbf16c2d2575c1b9d20fe0ff29a30d5c5486022 | [] | no_license | mattycao/Java | https://github.com/mattycao/Java | 386a61c8ab3e78b87fd7a0414aaf716a7e5c93d1 | 9f33a7544081ff7b905490b7dfae198fb28a0928 | refs/heads/master | 2015-08-08T23:25:39 | 2014-01-16T23:42:42 | 2014-01-16T23:42:42 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* Chapter 2: Question 5:
* Two list with numbers, then each node contains a single digit. First in the reverse order, write a function taht adds the two numbers and returns
* the sum as a linked list.
*
* Anylsis:
* Interface: public SListNode add(SListNode one, SListNode two) {
* by the order the list, multiple the 10 order by order then add the two numbers together, then
* divided 10 order by order to get the weidght digit
* }
* Time: O(n), the length of the digit. Space: O(n)
* However, I don't think it is a good idea: like the int length is limited, normally the length of the list is very
* long, so here, my idea change to that: for the lowest order add it to the top, which simulates like a real adder.
* The time still O(n), the space could be O(n). Try to implement it, but a little bit hard.
**/
public class LinkedFive {
public static class SListNode {
protected int item;
protected SListNode next;
public SListNode(int obj) {
item = obj;
next = null;
}
public String printForward() {
if (next != null) {
return item + "->" + next.printForward();
} else {
return ((Integer) item).toString();
}
}
}
public static void main(String[] args) {
SListNode list = new SListNode(0);
SListNode list1 = new SListNode(0);
SListNode head = list;
SListNode head1 = list1;
for(int i = 3; i > 0; --i) {
list.next = new SListNode(i);
list = list.next;
list1.next = new SListNode(i);
list1 = list1.next;
}
list1.next = new SListNode(5);
System.out.println(head.printForward());
System.out.println(head1.printForward());
SListNode result = add(head, head1, 0);
System.out.println(result.printForward());
}
public static SListNode add(SListNode one, SListNode two, int carrier) {
if(one == null && two == null && carrier == 0) {
return null;
}
SListNode result = new SListNode(carrier);
int value = carrier;
if(one != null) {
value += one.item;
}
if(two != null) {
value += two.item;
}
result.item = value % 10;
// recurse
if(one != null || two != null || value >= 10) {
SListNode more = add(one == null ? null : one.next, two == null ? null : two.next, value >= 10 ? 1 : 0);
result.next = more;
}
return result;
}
} | UTF-8 | Java | 2,292 | java | LinkedFive.java | Java | [] | null | [] | /**
* Chapter 2: Question 5:
* Two list with numbers, then each node contains a single digit. First in the reverse order, write a function taht adds the two numbers and returns
* the sum as a linked list.
*
* Anylsis:
* Interface: public SListNode add(SListNode one, SListNode two) {
* by the order the list, multiple the 10 order by order then add the two numbers together, then
* divided 10 order by order to get the weidght digit
* }
* Time: O(n), the length of the digit. Space: O(n)
* However, I don't think it is a good idea: like the int length is limited, normally the length of the list is very
* long, so here, my idea change to that: for the lowest order add it to the top, which simulates like a real adder.
* The time still O(n), the space could be O(n). Try to implement it, but a little bit hard.
**/
public class LinkedFive {
public static class SListNode {
protected int item;
protected SListNode next;
public SListNode(int obj) {
item = obj;
next = null;
}
public String printForward() {
if (next != null) {
return item + "->" + next.printForward();
} else {
return ((Integer) item).toString();
}
}
}
public static void main(String[] args) {
SListNode list = new SListNode(0);
SListNode list1 = new SListNode(0);
SListNode head = list;
SListNode head1 = list1;
for(int i = 3; i > 0; --i) {
list.next = new SListNode(i);
list = list.next;
list1.next = new SListNode(i);
list1 = list1.next;
}
list1.next = new SListNode(5);
System.out.println(head.printForward());
System.out.println(head1.printForward());
SListNode result = add(head, head1, 0);
System.out.println(result.printForward());
}
public static SListNode add(SListNode one, SListNode two, int carrier) {
if(one == null && two == null && carrier == 0) {
return null;
}
SListNode result = new SListNode(carrier);
int value = carrier;
if(one != null) {
value += one.item;
}
if(two != null) {
value += two.item;
}
result.item = value % 10;
// recurse
if(one != null || two != null || value >= 10) {
SListNode more = add(one == null ? null : one.next, two == null ? null : two.next, value >= 10 ? 1 : 0);
result.next = more;
}
return result;
}
} | 2,292 | 0.641361 | 0.628272 | 78 | 28.397436 | 30.838428 | 149 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.205128 | false | false | 1 |
a4cfe82dafbf87b6b26a3b7b0f0d9b5d1d2036c6 | 11,914,239,291,770 | 389e594ac5787fb55c31cf92255220ad66cc7a04 | /zhongchaoshequ/ไธญ่ถ
็คพๅบAndroid็ๆฌ/src/com/example/qiumishequouzhan/Utils/UserPhotoUtils.java | d4bbc8822f701572a7de5ce355588c1d2a9700ca | [] | no_license | shegang/zhongchaoshequ | https://github.com/shegang/zhongchaoshequ | dc8a5658d571aa001f0a65c5274ab6695659b259 | 6123b4e0fec1b305aa2b63c6a2685d4a498f3288 | refs/heads/master | 2016-09-06T17:55:10.402000 | 2014-05-20T03:06:37 | 2014-05-20T03:06:37 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.qiumishequouzhan.Utils;
import android.app.AlertDialog.Builder;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Matrix;
import android.net.Uri;
import android.os.Environment;
import android.provider.MediaStore;
import android.view.Gravity;
import android.widget.Toast;
import com.example.qiumishequouzhan.Constant;
import com.example.qiumishequouzhan.MainView.MainActivity;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.mime.MultipartEntity;
import org.apache.http.entity.mime.content.ByteArrayBody;
import org.apache.http.entity.mime.content.StringBody;
import org.apache.http.impl.client.DefaultHttpClient;
import java.io.*;
public class UserPhotoUtils {
public static Uri GetTempFileUri() {
return Uri.fromFile(new File(Environment.getExternalStorageDirectory(), "wisportphoto.jpg"));
}
public static void StartUploadPhoto() {
Builder p_AlertBuilder = null;
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED) == false) {
Toast toast = Toast.makeText(MainActivity.GetInstance().getApplicationContext(), "ๆฒกๆSDๅก๏ผ", Toast.LENGTH_LONG);
toast.setGravity(Gravity.CENTER, 0, 0);
toast.show();
return;
}
if (p_AlertBuilder == null) {
p_AlertBuilder = new Builder(MainActivity.GetInstance()).setTitle("่ฎพ็ฝฎ").setItems(new String[]{"็ธๅไธไผ ", "ๆ็
งไธไผ "},
new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Intent intent = null;
switch (which) {
case 0:
intent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
intent.setType("image/*");
intent.putExtra("crop", "true");
intent.putExtra("aspectX", 1);
intent.putExtra("aspectY", 1);
intent.putExtra("outputX", Constant.OUT_PUT_PIC_WIDTH);
intent.putExtra("outputY", Constant.OUT_PUT_PIC_HEGITH);
intent.putExtra("return-data", true);
intent.setAction(Intent.ACTION_GET_CONTENT);
MainActivity.GetInstance().startActivityForResult(intent,Constant.REQUEST_CODE_REUSLT_PICTURE);//็ธๅ้ๆฉๅพ็
break;
case 1:
intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, GetTempFileUri());
MainActivity.GetInstance().startActivityForResult(intent, Constant.REQUEST_CODE_TAKE_CAPTURE);//็ธๆบ้ๆฉ
break;
}
}
}
);
}
p_AlertBuilder.show();
}
public static void UploadSubmit(final Bitmap Pic, final String Pamars) {
new Thread(
new Runnable() {
@Override
public void run() {
try {
Bitmap nPic = ScaleBitmap(Pic);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
nPic.compress(Bitmap.CompressFormat.JPEG, Constant.BITMAP_DEFAULT_QUALITY, baos);
byte[] byteArray = baos.toByteArray();
//JSONObject jsonObject = JsonUtils.Str2Json(Pamars);
String str[] = Pamars.split("\\?");
str = str[1].split("\\&");
String users[] = str[0].split("\\=");
String codes[] =str[1].split("\\=");
int UserID = Integer.parseInt(users[1]);
String UserCode = codes[1];
HttpClient httpClient = new DefaultHttpClient();
HttpPost post = new HttpPost(Constant.SERVER_URL + Constant.SERVER_UPLOADPIC_PATH);
MultipartEntity entity = new MultipartEntity();
entity.addPart("UserId", new StringBody(Integer.toString(UserID)));
entity.addPart("Code", new StringBody(UserCode));
entity.addPart("file", new ByteArrayBody(byteArray, "Android.jpg"));
post.setEntity(entity);
HttpResponse response;
StringBuffer sb = new StringBuffer();
response = httpClient.execute(post);
int stateCode = response.getStatusLine().getStatusCode();
if (stateCode == HttpStatus.SC_OK) {
HttpEntity result = response.getEntity();
if (result != null) {
InputStream is = result.getContent();
BufferedReader br = new BufferedReader(new InputStreamReader(is));
String tempLine;
while ((tempLine = br.readLine()) != null) {
sb.append(tempLine);
}
}
}
post.abort();
String[] Result = sb.toString().split("#");
if (Result.length == 2) {
String Path = Result[1];
// HttpUtils.GetURLContent_img(Path);
MainActivity.GetInstance().SendCallBack(Path);//่ฟ้ๆฏๅ่ฐๅฝๆฐ
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
).start();
}
private static Bitmap ScaleBitmap(Bitmap Pic) {
int imgWidth = Pic.getWidth();
int imgHeight = Pic.getHeight();
if (imgWidth > Constant.BITMAP_MAX_WIDTH || imgHeight > Constant.BITMAP_MAX_HEIGHT) {
float scale;
float scaleWidth = ((float) Constant.BITMAP_MAX_WIDTH) / imgWidth;
float scaleHeight = ((float) Constant.BITMAP_MAX_HEIGHT) / imgHeight;
if (scaleWidth > scaleHeight) {
scale = scaleWidth;
} else {
scale = scaleHeight;
}
// ๅๅพๆณ่ฆ็ผฉๆพ็matrixๅๆฐ๏ฟฝ๏ฟฝ๏ฟฝ
Matrix matrix = new Matrix();
matrix.postScale(scale, scale);
// ๅพๅฐๆฐ็ๅพ็
Pic = Bitmap.createBitmap(Pic, 0, 0, imgWidth, imgHeight, matrix, true);
}
return Pic;
}
}
| UTF-8 | Java | 7,549 | java | UserPhotoUtils.java | Java | [] | null | [] | package com.example.qiumishequouzhan.Utils;
import android.app.AlertDialog.Builder;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Matrix;
import android.net.Uri;
import android.os.Environment;
import android.provider.MediaStore;
import android.view.Gravity;
import android.widget.Toast;
import com.example.qiumishequouzhan.Constant;
import com.example.qiumishequouzhan.MainView.MainActivity;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.mime.MultipartEntity;
import org.apache.http.entity.mime.content.ByteArrayBody;
import org.apache.http.entity.mime.content.StringBody;
import org.apache.http.impl.client.DefaultHttpClient;
import java.io.*;
public class UserPhotoUtils {
public static Uri GetTempFileUri() {
return Uri.fromFile(new File(Environment.getExternalStorageDirectory(), "wisportphoto.jpg"));
}
public static void StartUploadPhoto() {
Builder p_AlertBuilder = null;
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED) == false) {
Toast toast = Toast.makeText(MainActivity.GetInstance().getApplicationContext(), "ๆฒกๆSDๅก๏ผ", Toast.LENGTH_LONG);
toast.setGravity(Gravity.CENTER, 0, 0);
toast.show();
return;
}
if (p_AlertBuilder == null) {
p_AlertBuilder = new Builder(MainActivity.GetInstance()).setTitle("่ฎพ็ฝฎ").setItems(new String[]{"็ธๅไธไผ ", "ๆ็
งไธไผ "},
new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Intent intent = null;
switch (which) {
case 0:
intent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
intent.setType("image/*");
intent.putExtra("crop", "true");
intent.putExtra("aspectX", 1);
intent.putExtra("aspectY", 1);
intent.putExtra("outputX", Constant.OUT_PUT_PIC_WIDTH);
intent.putExtra("outputY", Constant.OUT_PUT_PIC_HEGITH);
intent.putExtra("return-data", true);
intent.setAction(Intent.ACTION_GET_CONTENT);
MainActivity.GetInstance().startActivityForResult(intent,Constant.REQUEST_CODE_REUSLT_PICTURE);//็ธๅ้ๆฉๅพ็
break;
case 1:
intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, GetTempFileUri());
MainActivity.GetInstance().startActivityForResult(intent, Constant.REQUEST_CODE_TAKE_CAPTURE);//็ธๆบ้ๆฉ
break;
}
}
}
);
}
p_AlertBuilder.show();
}
public static void UploadSubmit(final Bitmap Pic, final String Pamars) {
new Thread(
new Runnable() {
@Override
public void run() {
try {
Bitmap nPic = ScaleBitmap(Pic);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
nPic.compress(Bitmap.CompressFormat.JPEG, Constant.BITMAP_DEFAULT_QUALITY, baos);
byte[] byteArray = baos.toByteArray();
//JSONObject jsonObject = JsonUtils.Str2Json(Pamars);
String str[] = Pamars.split("\\?");
str = str[1].split("\\&");
String users[] = str[0].split("\\=");
String codes[] =str[1].split("\\=");
int UserID = Integer.parseInt(users[1]);
String UserCode = codes[1];
HttpClient httpClient = new DefaultHttpClient();
HttpPost post = new HttpPost(Constant.SERVER_URL + Constant.SERVER_UPLOADPIC_PATH);
MultipartEntity entity = new MultipartEntity();
entity.addPart("UserId", new StringBody(Integer.toString(UserID)));
entity.addPart("Code", new StringBody(UserCode));
entity.addPart("file", new ByteArrayBody(byteArray, "Android.jpg"));
post.setEntity(entity);
HttpResponse response;
StringBuffer sb = new StringBuffer();
response = httpClient.execute(post);
int stateCode = response.getStatusLine().getStatusCode();
if (stateCode == HttpStatus.SC_OK) {
HttpEntity result = response.getEntity();
if (result != null) {
InputStream is = result.getContent();
BufferedReader br = new BufferedReader(new InputStreamReader(is));
String tempLine;
while ((tempLine = br.readLine()) != null) {
sb.append(tempLine);
}
}
}
post.abort();
String[] Result = sb.toString().split("#");
if (Result.length == 2) {
String Path = Result[1];
// HttpUtils.GetURLContent_img(Path);
MainActivity.GetInstance().SendCallBack(Path);//่ฟ้ๆฏๅ่ฐๅฝๆฐ
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
).start();
}
private static Bitmap ScaleBitmap(Bitmap Pic) {
int imgWidth = Pic.getWidth();
int imgHeight = Pic.getHeight();
if (imgWidth > Constant.BITMAP_MAX_WIDTH || imgHeight > Constant.BITMAP_MAX_HEIGHT) {
float scale;
float scaleWidth = ((float) Constant.BITMAP_MAX_WIDTH) / imgWidth;
float scaleHeight = ((float) Constant.BITMAP_MAX_HEIGHT) / imgHeight;
if (scaleWidth > scaleHeight) {
scale = scaleWidth;
} else {
scale = scaleHeight;
}
// ๅๅพๆณ่ฆ็ผฉๆพ็matrixๅๆฐ๏ฟฝ๏ฟฝ๏ฟฝ
Matrix matrix = new Matrix();
matrix.postScale(scale, scale);
// ๅพๅฐๆฐ็ๅพ็
Pic = Bitmap.createBitmap(Pic, 0, 0, imgWidth, imgHeight, matrix, true);
}
return Pic;
}
}
| 7,549 | 0.499128 | 0.49698 | 167 | 43.616768 | 32.49334 | 139 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.760479 | false | false | 1 |
86febd2de0b8d41a94913b06cfa19ea28cb5cb70 | 28,681,791,640,869 | 03a3d7e93a60df48b483c1d82473d21123d0ef69 | /src/main/java/com/javamentor/js/controller/UserController.java | f9d97cc6c62bf2e8b959477c26e9b436c6e8219e | [] | no_license | RuslanPu/JS | https://github.com/RuslanPu/JS | 985a72032e61df2f5fe44c6ac603d1b5356134cd | 4ce6d4654fece09ec57596127a64ef3235355f01 | refs/heads/master | 2022-04-18T04:38:17.712000 | 2020-04-16T16:39:15 | 2020-04-16T16:39:15 | 255,377,700 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.javamentor.js.controller;
import com.javamentor.js.model.Role;
import com.javamentor.js.model.User;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import java.util.List;
@Controller
@RequestMapping("/user")
public class UserController {
@RequestMapping(value = "/userPage", method = RequestMethod.GET)
public String userPage(ModelMap model) {
User user = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
List<Role> rolesUser =(List<Role>) SecurityContextHolder.getContext().getAuthentication().getAuthorities();
user.setRoles(rolesUser);
model.addAttribute("user", user);
return "user/userPage";
}
@GetMapping("/test")
public String getAjax() {
return "user/testAjax";
}
}
| UTF-8 | Java | 1,091 | java | UserController.java | Java | [] | null | [] | package com.javamentor.js.controller;
import com.javamentor.js.model.Role;
import com.javamentor.js.model.User;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import java.util.List;
@Controller
@RequestMapping("/user")
public class UserController {
@RequestMapping(value = "/userPage", method = RequestMethod.GET)
public String userPage(ModelMap model) {
User user = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
List<Role> rolesUser =(List<Role>) SecurityContextHolder.getContext().getAuthentication().getAuthorities();
user.setRoles(rolesUser);
model.addAttribute("user", user);
return "user/userPage";
}
@GetMapping("/test")
public String getAjax() {
return "user/testAjax";
}
}
| 1,091 | 0.752521 | 0.752521 | 32 | 33.09375 | 28.60437 | 115 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5625 | false | false | 1 |
7a2c438862c291fa1e6bd36ab9ae98568be67fed | 26,190,710,613,185 | d6ba935dccf6fa9cbd41d6882af83ad9ae1787b4 | /็จๅบๅ้ข่ฏ้ๅ
ธ็ฌฌ6็/้ข่ฏ้ข 04.03. List of Depth LCCI.java | 0898b69a0810702ea507597dca8a68a0ed54412a | [] | no_license | Hongze-Wang/TargetOffer | https://github.com/Hongze-Wang/TargetOffer | e643843c1428d60373832a79f76b49edc84a4289 | e61ebe91c62b31ce23f392ab109114297a4dac1c | refs/heads/master | 2021-06-30T05:28:38.803000 | 2021-01-18T02:36:09 | 2021-01-18T02:36:09 | 207,557,993 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* Definition for a binary tree node.
* public class TreeNode {
* int val;
* TreeNode left;
* TreeNode right;
* TreeNode(int x) { val = x; }
* }
*/
/**
* Definition for singly-linked list.
* public class ListNode {
* int val;
* ListNode next;
* ListNode(int x) { val = x; }
* }
*/
class Solution {
public ListNode[] listOfDepth(TreeNode tree) {
if(tree == null) return null;
ArrayList<ListNode> res = new ArrayList();
Queue<TreeNode> queue = new LinkedList();
queue.offer(tree);
ListNode dummyHead = new ListNode(-1);
while(!queue.isEmpty()) {
int size = queue.size();
ListNode cur = dummyHead;
for(int i=0; i<size; i++) {
TreeNode node = queue.poll();
cur.next = new ListNode(node.val);
cur = cur.next;
if(node.left != null) {
queue.offer(node.left);
}
if(node.right != null) {
queue.offer(node.right);
}
}
res.add(dummyHead.next);
}
ListNode[] out = new ListNode[res.size()];
for(int i=0; i<res.size(); i++) {
out[i] = res.get(i);
}
return out;
}
} | UTF-8 | Java | 1,317 | java | ้ข่ฏ้ข 04.03. List of Depth LCCI.java | Java | [] | null | [] | /**
* Definition for a binary tree node.
* public class TreeNode {
* int val;
* TreeNode left;
* TreeNode right;
* TreeNode(int x) { val = x; }
* }
*/
/**
* Definition for singly-linked list.
* public class ListNode {
* int val;
* ListNode next;
* ListNode(int x) { val = x; }
* }
*/
class Solution {
public ListNode[] listOfDepth(TreeNode tree) {
if(tree == null) return null;
ArrayList<ListNode> res = new ArrayList();
Queue<TreeNode> queue = new LinkedList();
queue.offer(tree);
ListNode dummyHead = new ListNode(-1);
while(!queue.isEmpty()) {
int size = queue.size();
ListNode cur = dummyHead;
for(int i=0; i<size; i++) {
TreeNode node = queue.poll();
cur.next = new ListNode(node.val);
cur = cur.next;
if(node.left != null) {
queue.offer(node.left);
}
if(node.right != null) {
queue.offer(node.right);
}
}
res.add(dummyHead.next);
}
ListNode[] out = new ListNode[res.size()];
for(int i=0; i<res.size(); i++) {
out[i] = res.get(i);
}
return out;
}
} | 1,317 | 0.475323 | 0.473045 | 47 | 27.042553 | 15.598633 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.574468 | false | false | 1 |
6a5deeb444cc25836f08ca1f85bec2ec8d648e82 | 2,087,354,109,867 | 07806c9a43a26fb577dff1c78f32bc4d960ad65c | /library/src/main/java/robertapengelly/support/tileview/tile/Tile.java | 60654d1aa9177ca072cd332d0c53a67476277e0b | [] | no_license | robertapengelly92/android-tileview | https://github.com/robertapengelly92/android-tileview | dcca329a13da7ccdca7147077ed28ff276dbf0c4 | 170e0d33ee53763ddaa2adba1a1f04d72a860dd6 | refs/heads/master | 2021-06-08T01:23:20.568000 | 2016-12-01T11:21:31 | 2016-12-01T11:21:31 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package robertapengelly.support.tileview.tile;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.support.annotation.StringDef;
import android.view.animation.AnimationUtils;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.ref.WeakReference;
import robertapengelly.support.tileview.detail.DetailLevel;
import robertapengelly.support.tileview.geom.FloatMathHelper;
import robertapengelly.support.tileview.graphics.BitmapProvider;
public class Tile {
private static final int DEFAULT_TRANSITION_DURATION = 200;
public static final String STATE_DECODED = "state_decoded";
public static final String STATE_PENDING_DECODE = "state_pending_decode";
public static final String STATE_UNASSIGNED = "state_unassigned";
private boolean mTransitionsEnabled;
private float mDetailLevelScale, mProgress;
private int mBottom, mColumn, mHeight, mLeft, mRight, mRow, mTop, mWidth;
private int mTransitionDuration = DEFAULT_TRANSITION_DURATION;
private Bitmap mBitmap;
private DetailLevel mDetailLevel;
private Object mData;
private Long mRenderTimestamp;
private Paint mPaint;
private Rect mBaseRect = new Rect(),
mIntrinsicRect = new Rect(),
mRelativeRect = new Rect(),
mScaledRect = new Rect();
private String mState = STATE_UNASSIGNED;
private WeakReference<TileRenderRunnable> mTileRenderRunnableWeakReference;
/** @hide **/
@StringDef({STATE_DECODED, STATE_PENDING_DECODE, STATE_UNASSIGNED})
@Retention(RetentionPolicy.SOURCE)
public @interface State {}
public Tile(int column, int row, int width, int height, Object data, DetailLevel detailLevel) {
mColumn = column;
mData = data;
mDetailLevel = detailLevel;
mDetailLevelScale = mDetailLevel.getScale();
mHeight = height;
mRow = row;
mWidth = width;
mLeft = (column * width);
mTop = (row * height);
mBottom = (mTop + height);
mRight = (mLeft + width);
updateRects();
}
public void computeProgress(){
if (!mTransitionsEnabled)
return;
if (mRenderTimestamp == null) {
mProgress = 0;
mRenderTimestamp = AnimationUtils.currentAnimationTimeMillis();
return;
}
double elapsed = (AnimationUtils.currentAnimationTimeMillis() - mRenderTimestamp);
mProgress = (float) Math.min(1, (elapsed / mTransitionDuration));
if (mProgress == 1f) {
mRenderTimestamp = null;
mTransitionsEnabled = false;
}
}
/** @param canvas The canvas the tile's bitmap should be drawn into. */
public void draw(Canvas canvas) {
if ((mBitmap != null) && !mBitmap.isRecycled())
canvas.drawBitmap(mBitmap, mIntrinsicRect, mRelativeRect, getPaint());
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj instanceof Tile) {
Tile tile = (Tile) obj;
return ((tile.getRow() == getRow()) && (tile.getColumn() == getColumn()) &&
(tile.getDetailLevel().getScale() == getDetailLevel().getScale()));
}
return false;
}
public void execute(TileRenderPoolExecutor tileRenderPoolExecutor) {
if (!mState.equals(STATE_UNASSIGNED))
return;
mState = STATE_PENDING_DECODE;
TileRenderRunnable runnable = new TileRenderRunnable();
mTileRenderRunnableWeakReference = new WeakReference<>(runnable);
runnable.setTile(this);
runnable.setTileRenderPoolExecutor(tileRenderPoolExecutor);
tileRenderPoolExecutor.execute(runnable);
}
void generateBitmap(Context context, BitmapProvider provider) {
if (mBitmap != null)
return;
mBitmap = provider.getBitmap(this, context);
mHeight = mBitmap.getHeight();
mWidth = mBitmap.getWidth();
mBottom = (mTop + mHeight);
mRight = (mLeft + mWidth);
updateRects();
mState = STATE_DECODED;
}
public Rect getBaseRect() {
return mBaseRect;
}
public Bitmap getBitmap() {
return mBitmap;
}
public int getColumn() {
return mColumn;
}
public Object getData() {
return mData;
}
public DetailLevel getDetailLevel() {
return mDetailLevel;
}
public int getHeight() {
return mHeight;
}
public boolean getIsDirty() {
return (mTransitionsEnabled && (mProgress < 1f));
}
public int getLeft() {
return mLeft;
}
public Paint getPaint() {
if (!mTransitionsEnabled)
return (mPaint = null);
if (mPaint == null)
mPaint = new Paint();
mPaint.setAlpha((int) (255 * mProgress));
return mPaint;
}
public Rect getRelativeRect() {
return mRelativeRect;
}
public float getRendered() {
return mProgress;
}
public int getRow() {
return mRow;
}
public Rect getScaledRect(float scale) {
mScaledRect.set((int) (mRelativeRect.left * scale), (int) (mRelativeRect.top * scale),
(int) (mRelativeRect.right * scale), (int) (mRelativeRect.bottom * scale));
return mScaledRect;
}
public @State String getState() {
return mState;
}
public int getTop() {
return mTop;
}
public int getWidth() {
return mWidth;
}
public boolean hasBitmap() {
return (mBitmap != null);
}
@Override
public int hashCode() {
int hash = 17;
hash = ((hash * 31) + getColumn());
hash = ((hash * 31) + getRow());
hash = ((hash * 31) + (int) (1000 * getDetailLevel().getScale()));
return hash;
}
void reset() {
if (mState.equals(STATE_PENDING_DECODE)) {
if (mTileRenderRunnableWeakReference != null) {
TileRenderRunnable runnable = mTileRenderRunnableWeakReference.get();
if (runnable != null)
runnable.cancel(true);
}
}
mRenderTimestamp = null;
mState = STATE_UNASSIGNED;
if ((mBitmap != null) && !mBitmap.isRecycled())
mBitmap.recycle();
mBitmap = null;
}
public void setState(@State String state) {
mState = state;
}
public void setTransitionDuration(int transitionDuration) {
mTransitionDuration = transitionDuration;
}
public void setTransitionsEnabled(boolean enabled) {
mTransitionsEnabled = enabled;
if (enabled)
mProgress = 0f;
}
public String toShortString() {
return (mColumn + ":" + mRow);
}
private void updateRects() {
mBaseRect.set(mLeft, mTop, mRight, mBottom);
mIntrinsicRect.set(0, 0, mWidth, mHeight);
mRelativeRect.set(FloatMathHelper.unscale(mLeft, mDetailLevelScale), FloatMathHelper.unscale(mTop, mDetailLevelScale),
FloatMathHelper.unscale(mRight, mDetailLevelScale), FloatMathHelper.unscale(mBottom, mDetailLevelScale));
mScaledRect.set(mRelativeRect);
}
} | UTF-8 | Java | 8,028 | java | Tile.java | Java | [] | null | [] | package robertapengelly.support.tileview.tile;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.support.annotation.StringDef;
import android.view.animation.AnimationUtils;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.ref.WeakReference;
import robertapengelly.support.tileview.detail.DetailLevel;
import robertapengelly.support.tileview.geom.FloatMathHelper;
import robertapengelly.support.tileview.graphics.BitmapProvider;
public class Tile {
private static final int DEFAULT_TRANSITION_DURATION = 200;
public static final String STATE_DECODED = "state_decoded";
public static final String STATE_PENDING_DECODE = "state_pending_decode";
public static final String STATE_UNASSIGNED = "state_unassigned";
private boolean mTransitionsEnabled;
private float mDetailLevelScale, mProgress;
private int mBottom, mColumn, mHeight, mLeft, mRight, mRow, mTop, mWidth;
private int mTransitionDuration = DEFAULT_TRANSITION_DURATION;
private Bitmap mBitmap;
private DetailLevel mDetailLevel;
private Object mData;
private Long mRenderTimestamp;
private Paint mPaint;
private Rect mBaseRect = new Rect(),
mIntrinsicRect = new Rect(),
mRelativeRect = new Rect(),
mScaledRect = new Rect();
private String mState = STATE_UNASSIGNED;
private WeakReference<TileRenderRunnable> mTileRenderRunnableWeakReference;
/** @hide **/
@StringDef({STATE_DECODED, STATE_PENDING_DECODE, STATE_UNASSIGNED})
@Retention(RetentionPolicy.SOURCE)
public @interface State {}
public Tile(int column, int row, int width, int height, Object data, DetailLevel detailLevel) {
mColumn = column;
mData = data;
mDetailLevel = detailLevel;
mDetailLevelScale = mDetailLevel.getScale();
mHeight = height;
mRow = row;
mWidth = width;
mLeft = (column * width);
mTop = (row * height);
mBottom = (mTop + height);
mRight = (mLeft + width);
updateRects();
}
public void computeProgress(){
if (!mTransitionsEnabled)
return;
if (mRenderTimestamp == null) {
mProgress = 0;
mRenderTimestamp = AnimationUtils.currentAnimationTimeMillis();
return;
}
double elapsed = (AnimationUtils.currentAnimationTimeMillis() - mRenderTimestamp);
mProgress = (float) Math.min(1, (elapsed / mTransitionDuration));
if (mProgress == 1f) {
mRenderTimestamp = null;
mTransitionsEnabled = false;
}
}
/** @param canvas The canvas the tile's bitmap should be drawn into. */
public void draw(Canvas canvas) {
if ((mBitmap != null) && !mBitmap.isRecycled())
canvas.drawBitmap(mBitmap, mIntrinsicRect, mRelativeRect, getPaint());
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj instanceof Tile) {
Tile tile = (Tile) obj;
return ((tile.getRow() == getRow()) && (tile.getColumn() == getColumn()) &&
(tile.getDetailLevel().getScale() == getDetailLevel().getScale()));
}
return false;
}
public void execute(TileRenderPoolExecutor tileRenderPoolExecutor) {
if (!mState.equals(STATE_UNASSIGNED))
return;
mState = STATE_PENDING_DECODE;
TileRenderRunnable runnable = new TileRenderRunnable();
mTileRenderRunnableWeakReference = new WeakReference<>(runnable);
runnable.setTile(this);
runnable.setTileRenderPoolExecutor(tileRenderPoolExecutor);
tileRenderPoolExecutor.execute(runnable);
}
void generateBitmap(Context context, BitmapProvider provider) {
if (mBitmap != null)
return;
mBitmap = provider.getBitmap(this, context);
mHeight = mBitmap.getHeight();
mWidth = mBitmap.getWidth();
mBottom = (mTop + mHeight);
mRight = (mLeft + mWidth);
updateRects();
mState = STATE_DECODED;
}
public Rect getBaseRect() {
return mBaseRect;
}
public Bitmap getBitmap() {
return mBitmap;
}
public int getColumn() {
return mColumn;
}
public Object getData() {
return mData;
}
public DetailLevel getDetailLevel() {
return mDetailLevel;
}
public int getHeight() {
return mHeight;
}
public boolean getIsDirty() {
return (mTransitionsEnabled && (mProgress < 1f));
}
public int getLeft() {
return mLeft;
}
public Paint getPaint() {
if (!mTransitionsEnabled)
return (mPaint = null);
if (mPaint == null)
mPaint = new Paint();
mPaint.setAlpha((int) (255 * mProgress));
return mPaint;
}
public Rect getRelativeRect() {
return mRelativeRect;
}
public float getRendered() {
return mProgress;
}
public int getRow() {
return mRow;
}
public Rect getScaledRect(float scale) {
mScaledRect.set((int) (mRelativeRect.left * scale), (int) (mRelativeRect.top * scale),
(int) (mRelativeRect.right * scale), (int) (mRelativeRect.bottom * scale));
return mScaledRect;
}
public @State String getState() {
return mState;
}
public int getTop() {
return mTop;
}
public int getWidth() {
return mWidth;
}
public boolean hasBitmap() {
return (mBitmap != null);
}
@Override
public int hashCode() {
int hash = 17;
hash = ((hash * 31) + getColumn());
hash = ((hash * 31) + getRow());
hash = ((hash * 31) + (int) (1000 * getDetailLevel().getScale()));
return hash;
}
void reset() {
if (mState.equals(STATE_PENDING_DECODE)) {
if (mTileRenderRunnableWeakReference != null) {
TileRenderRunnable runnable = mTileRenderRunnableWeakReference.get();
if (runnable != null)
runnable.cancel(true);
}
}
mRenderTimestamp = null;
mState = STATE_UNASSIGNED;
if ((mBitmap != null) && !mBitmap.isRecycled())
mBitmap.recycle();
mBitmap = null;
}
public void setState(@State String state) {
mState = state;
}
public void setTransitionDuration(int transitionDuration) {
mTransitionDuration = transitionDuration;
}
public void setTransitionsEnabled(boolean enabled) {
mTransitionsEnabled = enabled;
if (enabled)
mProgress = 0f;
}
public String toShortString() {
return (mColumn + ":" + mRow);
}
private void updateRects() {
mBaseRect.set(mLeft, mTop, mRight, mBottom);
mIntrinsicRect.set(0, 0, mWidth, mHeight);
mRelativeRect.set(FloatMathHelper.unscale(mLeft, mDetailLevelScale), FloatMathHelper.unscale(mTop, mDetailLevelScale),
FloatMathHelper.unscale(mRight, mDetailLevelScale), FloatMathHelper.unscale(mBottom, mDetailLevelScale));
mScaledRect.set(mRelativeRect);
}
} | 8,028 | 0.573742 | 0.570628 | 308 | 25.068182 | 23.493269 | 126 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.49026 | false | false | 1 |
bc2609874ebe53db9b50c30db2921d0f3c4c326e | 25,331,717,139,222 | 52ee0c7df63773103ddaa3be32011b382f3384ba | /app/src/main/java/fr/themsou/calendarwatchface/Designer.java | ca8be88b4bd90d4b8b00344f6fd34b47909e6f9f | [] | no_license | themsou/CalendarWatchFace | https://github.com/themsou/CalendarWatchFace | 63f97ed0812252231336ccbbcf75a79b9b23dd5d | caf246c8cf8a2e2406d3b576c7f67280b011cf83 | refs/heads/master | 2021-05-21T04:24:58.412000 | 2020-04-10T15:31:20 | 2020-04-10T15:31:20 | 252,473,447 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package fr.themsou.calendarwatchface;
import android.Manifest;
import android.content.ContentResolver;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.net.Uri;
import android.provider.CalendarContract;
import android.telecom.Call;
import android.util.Log;
import androidx.core.app.ActivityCompat;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Random;
class Designer {
private static final String TAG = "CalendarWatchFace";
private Paint paintTop;
private Paint paintBottom;
private Paint paintTicks;
private Paint paintSelectedTicks;
private Paint paintCurrentTick;
private Path pathTicks;
private Path pathSelectedTicks;
private Path pathCurrentTick;
private Paint paintHour;
private Paint paintSeconds;
private Paint paintDate;
private Paint paintCurrentEvent;
private Paint paintCurrentEventData;
private Paint paintNextEvent;
private Paint paintNextEventData;
private ArrayList<Event> events;
private MyWatchFace.Engine engine;
private DateEvents dateEvents;
Designer(MyWatchFace.Engine engine) {
this.engine = engine;
}
void setupPaints() {
paintTop = new Paint();
paintBottom = new Paint();
// TICKS
paintTicks = new Paint();
paintTicks.setColor(Color.rgb(150, 150, 150));
paintTicks.setStyle(Paint.Style.FILL);
paintTicks.setAntiAlias(true);
paintSelectedTicks = new Paint();
paintSelectedTicks.setColor(Color.rgb(255, 141, 26));
paintSelectedTicks.setStyle(Paint.Style.FILL);
paintSelectedTicks.setAntiAlias(true);
paintCurrentTick = new Paint();
paintCurrentTick.setColor(Color.rgb(42, 123, 155));
paintCurrentTick.setStyle(Paint.Style.FILL);
paintCurrentTick.setAntiAlias(true);
// TEXT
paintHour = new Paint();
paintHour.setTextSize(140);
paintHour.setTextScaleX(0.7f);
paintHour.setTypeface(engine.FONT_TEXTMEONE_REGULAR);
paintHour.setTextAlign(Paint.Align.CENTER);
paintHour.setColor(Color.WHITE);
paintHour.setAntiAlias(true);
paintSeconds = new Paint();
paintSeconds.setTextSize(50);
paintSeconds.setTypeface(engine.FONT_TEXTMEONE_REGULAR);
paintSeconds.setColor(Color.WHITE);
paintSeconds.setAntiAlias(true);
paintDate = new Paint();
paintDate.setTextSize(27);
paintDate.setTypeface(engine.FONT_DIN_BOLD);
paintDate.setTextAlign(Paint.Align.CENTER);
paintDate.setColor(Color.WHITE);
paintDate.setAntiAlias(true);
// EVENTS
paintCurrentEvent = new Paint();
paintCurrentEvent.setTextSize(27);
paintCurrentEvent.setTypeface(engine.FONT_TEXTMEONE_REGULAR);
paintCurrentEvent.setTextAlign(Paint.Align.CENTER);
paintCurrentEvent.setColor(Color.LTGRAY);
paintCurrentEvent.setAntiAlias(true);
paintCurrentEventData = new Paint();
paintCurrentEventData.setTextSize(22);
paintCurrentEventData.setTextScaleX(0.9f);
paintCurrentEventData.setTypeface(engine.FONT_TEXTMEONE_REGULAR);
paintCurrentEventData.setTextAlign(Paint.Align.CENTER);
paintCurrentEventData.setColor(Color.rgb(43, 152, 206));
paintCurrentEventData.setAntiAlias(true);
paintNextEvent = new Paint();
paintNextEvent.setTextSize(22);
paintNextEvent.setTypeface(engine.FONT_TEXTMEONE_REGULAR);
paintNextEvent.setTextAlign(Paint.Align.CENTER);
paintNextEvent.setColor(Color.rgb(170, 180, 0));
paintNextEvent.setAntiAlias(true);
paintNextEventData = new Paint();
paintNextEventData.setTextSize(22);
paintNextEventData.setTypeface(engine.FONT_TEXTMEONE_REGULAR);
paintNextEventData.setTextAlign(Paint.Align.CENTER);
paintNextEventData.setColor(Color.rgb(170, 180, 0));
paintNextEventData.setAntiAlias(true);
updatePaintsToFullMode();
dateEvents = new DateEvents(new CallBack() {
@Override public void call() { // MINUTES
setupCurrentTickPath();
}
}, new CallBack() {
@Override public void call() { // HOUR
updateCalendar();
}
});
}
void updatePaintsToFullMode() {
// Enable ShadowLayer and AntiAliasing
paintHour.setShadowLayer(1, 1, 1, paintHour.getColor());
paintSeconds.setShadowLayer(1, 1, 1, paintSeconds.getColor());
paintDate.setShadowLayer(1, 1, 1, paintDate.getColor());
paintCurrentEvent.setShadowLayer(1, 1, 1, paintCurrentEvent.getColor());
paintCurrentEventData.setShadowLayer(1, 1, 1, paintCurrentEventData.getColor());
paintNextEvent.setShadowLayer(1, 1, 1, paintNextEvent.getColor());
paintNextEventData.setShadowLayer(1, 1, 1, paintNextEventData.getColor());
CalendarReader.resetPermissionData();
}
void updatePaintsToAmbientMode() {
// Disable ShadowLayer and AntiAliasing
paintHour.clearShadowLayer();
paintDate.clearShadowLayer();
paintSeconds.clearShadowLayer();
paintCurrentEvent.clearShadowLayer();
paintCurrentEventData.clearShadowLayer();
paintNextEvent.clearShadowLayer();
paintNextEventData.clearShadowLayer();
}
void draw(Canvas canvas) {
if(pathTicks == null) setupPaths();
if(events == null) updateCalendar();
if(pathCurrentTick == null) setupCurrentTickPath();
dateEvents.tick(engine.calendar);
canvas.drawRect(0, 0, engine.displayWidth, engine.displayCenterY, paintTop);
canvas.drawRect(0, engine.displayCenterY, engine.displayWidth, engine.displayHeight, paintBottom);
Event current = CalendarReader.getCurrentEvent(events);
canvas.drawText(getTime(), engine.displayCenterX, engine.displayCenterY - 20, paintHour);
if(!engine.isAmbient){
canvas.drawText(":" + getSeconds(), engine.displayCenterX + 107, engine.displayCenterY - 20, paintSeconds);
canvas.drawText(getFullDate(), engine.displayCenterX, engine.displayCenterY - 130, paintDate);
Event next = CalendarReader.getNextEvent(events);
if(next != null){
canvas.drawText("Prochain ร " + getTime(next.getSinceDayMinuteBegin(engine.calendar)), engine.displayCenterX, engine.displayCenterY + 120, paintNextEventData);
canvas.drawText(next.getName(), engine.displayCenterX, engine.displayCenterY + 150, paintNextEvent);
}else{
canvas.drawText("Aucun ร suivre", engine.displayCenterX, engine.displayCenterY + 120, paintNextEventData);
}
if(current != null){
canvas.drawText(current.getName(), engine.displayCenterX, engine.displayCenterY + 40, paintCurrentEvent);
canvas.drawText(getTime(current.getSinceDayMinuteBegin(engine.calendar)) + " > " + getTime(current.getSinceDayMinuteEnd(engine.calendar)) + " - " + current.getSinceNowMinutesEnd() + "mn restantes"
, engine.displayCenterX, engine.displayCenterY + 70, paintCurrentEventData);
}else{
canvas.drawText("Aucun รฉvรจnement", engine.displayCenterX, engine.displayCenterY + 40, paintCurrentEvent);
}
}else{
canvas.drawText(getShortDate(), engine.displayCenterX, engine.displayCenterY - 130, paintDate);
if(current != null){
canvas.drawText(current.getName(), engine.displayCenterX, engine.displayCenterY + 40, paintCurrentEvent);
canvas.drawText(getTime(current.getSinceDayMinuteBegin(engine.calendar)) + " > " + getTime(current.getSinceDayMinuteEnd(engine.calendar)) + " - " + current.getSinceNowMinutesEnd() + "mn restantes"
, engine.displayCenterX, engine.displayCenterY + 75, paintCurrentEventData);
}
}
// TICKS
canvas.drawPath(pathTicks, paintTicks);
canvas.drawPath(pathSelectedTicks, paintSelectedTicks);
canvas.drawPath(pathCurrentTick, paintCurrentTick);
}
void singleTap(int x, int y){
if(y >= engine.displayCenterY){
Intent i;
try {
// { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 pkg=com.google.android.wearable.app cmp=com.google.android.wearable.app/com.google.android.clockwork.home.calendar.AgendaActivity }
i = engine.myWatchFace.getPackageManager().getLaunchIntentForPackage("com.google.android.wearable.app");
if(i == null) throw new PackageManager.NameNotFoundException();
i.addCategory(Intent.CATEGORY_LAUNCHER);
engine.myWatchFace.startActivity(i);
}catch(PackageManager.NameNotFoundException e) {
// Appli non prรฉsente
Log.d(TAG, "Application calendrier introuvable Packages disponibles : ");
final PackageManager pm = engine.myWatchFace.getPackageManager();
List<ApplicationInfo> packages = pm.getInstalledApplications(PackageManager.GET_META_DATA);
for (ApplicationInfo packageInfo : packages) {
Log.d(TAG, "Installed package :" + packageInfo.packageName);
Log.d(TAG, "Source dir : " + packageInfo.sourceDir);
Log.d(TAG, "Launch Activity :" + pm.getLaunchIntentForPackage(packageInfo.packageName));
Log.d(TAG, " ");
}
}
}
}
private void updateCalendar() {
Log.d(TAG, "updateCalendar");
if(CalendarReader.checkPermission(engine)){
events = CalendarReader.get24HEvents(engine.myWatchFace, engine.calendar);
setupSelectedTicksPath();
}
}
private void setupCurrentTickPath(){
pathCurrentTick = new Path();
pathCurrentTick.setFillType(Path.FillType.WINDING);
int tickIndex = (int) ((engine.calendar.get(Calendar.HOUR_OF_DAY)*60 + engine.calendar.get(Calendar.MINUTE)) / 15f);
float tickRadius = engine.displayCenterX - 18;
float tickRot = (float) -(Math.PI*2 / 96*tickIndex);
float x = (float) Math.sin(tickRot) * tickRadius;
float y = (float) Math.cos(tickRot) * tickRadius;
pathCurrentTick.addCircle(engine.displayCenterX + x, engine.displayCenterY + y, 4, Path.Direction.CW);
}
private void setupSelectedTicksPath(){
Log.d(TAG, "setupSelectedTicksPath");
pathSelectedTicks = new Path();
pathSelectedTicks.setFillType(Path.FillType.WINDING);
float tickRadius = engine.displayCenterX - 9;
for(Event event : events){
if(event.isAllDay()) continue; // Enlรจve les รฉvรจnements qui prennent toute la journรฉe
long begin = event.getSinceDayMinuteBegin(engine.calendar);
if(begin > 24*60) continue; // Enlรจve les รฉvรจnement qui n'est pas compris dans la journรฉe.
long end = begin + event.getDuration(); // plus optimisรฉ de faire une soustraction que plusieurs long calculs.
int beginIndex = (int) ((begin + 7.5) / 15f);
int endIndex = (int) ((end - 7.5) / 15f);
Log.d(TAG, event.getName() + " " + (begin/60) + ":" + (begin%60) + " (" + (beginIndex/4.0) + ") -> " + (end/60) + ":" + (end%60) + " (" + (endIndex/4.0) + ")");
for(int tickIndex = beginIndex; tickIndex <= endIndex; tickIndex++){
float tickRot = (float) -(Math.PI*2 / 96*tickIndex);
float x = (float) Math.sin(tickRot) * tickRadius;
float y = (float) Math.cos(tickRot) * tickRadius;
int radius = (tickIndex % 4 == 0) ? 3 : 2;
pathSelectedTicks.addCircle(engine.displayCenterX + x, engine.displayCenterY + y, radius, Path.Direction.CW);
}
}
}
private void setupPaths(){
Log.d(TAG, "setupPaths");
pathSelectedTicks = new Path();
pathSelectedTicks.setFillType(Path.FillType.WINDING);
pathTicks = new Path();
pathTicks.setFillType(Path.FillType.WINDING);
float tickRadius = engine.displayCenterX - 9;
for(int tickIndex = 0; tickIndex < 96; tickIndex++){
float tickRot = (float) (Math.PI * 2 / 96 * tickIndex);
float x = (float) Math.sin(tickRot) * tickRadius;
float y = (float) Math.cos(tickRot) * tickRadius;
int radius = (tickIndex % 4 == 0) ? 3 : 2;
pathTicks.addCircle(engine.displayCenterX + x, engine.displayCenterY + y, radius, Path.Direction.CW);
}
}
private String getTime(long mn){
int hour = (int) (mn) / 60;
int minutes = (int) (mn) % 60;
String stringHour = ((hour < 10) ? "0" : "") + hour;
String stringMinutes = ((minutes < 10) ? "0" : "") + minutes;
return stringHour + ":" + stringMinutes;
}
private String getTime(){
int hour = engine.calendar.get(Calendar.HOUR_OF_DAY);
int minutes = engine.calendar.get(Calendar.MINUTE);
String stringHour = ((hour < 10) ? "0" : "") + hour;
String stringMinutes = ((minutes < 10) ? "0" : "") + minutes;
return stringHour + ":" + stringMinutes;
}
private String getSeconds(){
int seconds = engine.calendar.get(Calendar.SECOND);
return ((seconds < 10) ? "0" : "") + seconds;
}
private String getShortDate(){
int dayMonth = engine.calendar.get(Calendar.DAY_OF_MONTH);
int month = engine.calendar.get(Calendar.MONTH);
String stringMonth = ((month < 10) ? "0" : "") + month;
return getWeakDay() + " " + dayMonth + "/" + stringMonth;
}
private String getFullDate(){
int dayMonth = engine.calendar.get(Calendar.DAY_OF_MONTH);
return getWeakDay() + " " + dayMonth + " " + getMonthName();
}
private String getWeakDay(){
switch(engine.calendar.get(Calendar.DAY_OF_WEEK)){
case 2:
return "Lun";
case 3:
return "Mar";
case 4:
return "Mer";
case 5:
return "Jeu";
case 6:
return "Ven";
case 7:
return "Sam";
case 1:
return "Dim";
default:
return "---";
}
}
private String getMonthName(){
switch(engine.calendar.get(Calendar.MONTH)){
case 0:
return "Janvier";
case 1:
return "Fรฉvrier";
case 2:
return "Mars";
case 3:
return "Avril";
case 4:
return "Mai";
case 5:
return "Juin";
case 6:
return "Juillet";
case 7:
return "Aoรปt";
case 8:
return "Septembre";
case 9:
return "Octobre";
case 10:
return "Novembre";
case 11:
return "Dรฉcembre";
default:
return "-----";
}
}
/*void drawHands(Canvas canvas){
// Draw the background.
canvas.drawRect(0, 0, canvas.getWidth(), canvas.getHeight(), mBackgroundPaint);
//These calculations reflect the rotation in degrees per unit of time, e.g., 360 / 60 = 6 and 360 / 12 = 30.
final float secondsRotation = (engine.calendar.get(Calendar.SECOND) + engine.calendar.get(Calendar.MILLISECOND) / 1000f) * 6f;
final float minutesRotation = engine.calendar.get(Calendar.MINUTE) * 6f;
final float hoursRotation = (engine.calendar.get(Calendar.HOUR) * 30) + (engine.calendar.get(Calendar.MINUTE) / 2f);
// save the canvas state before we begin to rotate it
canvas.save();
canvas.rotate(hoursRotation, engine.displayCenterX, engine.displayCenterY);
canvas.drawLine(engine.displayCenterX, engine.displayCenterY, engine.displayCenterX, engine.displayCenterY - 100, mHandPaint);
canvas.rotate(minutesRotation - hoursRotation, engine.displayCenterX, engine.displayCenterY);
canvas.drawLine(engine.displayCenterX, engine.displayCenterY, engine.displayCenterX, engine.displayCenterY - 150, mHandPaint);
if(!engine.isAmbient){
canvas.rotate(secondsRotation - minutesRotation, engine.displayCenterX, engine.displayCenterY);
canvas.drawLine(engine.displayCenterX, engine.displayCenterY, engine.displayCenterX, engine.displayCenterY - 180, mHandPaint);
}
// restore the canvas' original orientation.
canvas.restore();
}*/
}
| UTF-8 | Java | 17,266 | java | Designer.java | Java | [] | null | [] | package fr.themsou.calendarwatchface;
import android.Manifest;
import android.content.ContentResolver;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.net.Uri;
import android.provider.CalendarContract;
import android.telecom.Call;
import android.util.Log;
import androidx.core.app.ActivityCompat;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Random;
class Designer {
private static final String TAG = "CalendarWatchFace";
private Paint paintTop;
private Paint paintBottom;
private Paint paintTicks;
private Paint paintSelectedTicks;
private Paint paintCurrentTick;
private Path pathTicks;
private Path pathSelectedTicks;
private Path pathCurrentTick;
private Paint paintHour;
private Paint paintSeconds;
private Paint paintDate;
private Paint paintCurrentEvent;
private Paint paintCurrentEventData;
private Paint paintNextEvent;
private Paint paintNextEventData;
private ArrayList<Event> events;
private MyWatchFace.Engine engine;
private DateEvents dateEvents;
Designer(MyWatchFace.Engine engine) {
this.engine = engine;
}
void setupPaints() {
paintTop = new Paint();
paintBottom = new Paint();
// TICKS
paintTicks = new Paint();
paintTicks.setColor(Color.rgb(150, 150, 150));
paintTicks.setStyle(Paint.Style.FILL);
paintTicks.setAntiAlias(true);
paintSelectedTicks = new Paint();
paintSelectedTicks.setColor(Color.rgb(255, 141, 26));
paintSelectedTicks.setStyle(Paint.Style.FILL);
paintSelectedTicks.setAntiAlias(true);
paintCurrentTick = new Paint();
paintCurrentTick.setColor(Color.rgb(42, 123, 155));
paintCurrentTick.setStyle(Paint.Style.FILL);
paintCurrentTick.setAntiAlias(true);
// TEXT
paintHour = new Paint();
paintHour.setTextSize(140);
paintHour.setTextScaleX(0.7f);
paintHour.setTypeface(engine.FONT_TEXTMEONE_REGULAR);
paintHour.setTextAlign(Paint.Align.CENTER);
paintHour.setColor(Color.WHITE);
paintHour.setAntiAlias(true);
paintSeconds = new Paint();
paintSeconds.setTextSize(50);
paintSeconds.setTypeface(engine.FONT_TEXTMEONE_REGULAR);
paintSeconds.setColor(Color.WHITE);
paintSeconds.setAntiAlias(true);
paintDate = new Paint();
paintDate.setTextSize(27);
paintDate.setTypeface(engine.FONT_DIN_BOLD);
paintDate.setTextAlign(Paint.Align.CENTER);
paintDate.setColor(Color.WHITE);
paintDate.setAntiAlias(true);
// EVENTS
paintCurrentEvent = new Paint();
paintCurrentEvent.setTextSize(27);
paintCurrentEvent.setTypeface(engine.FONT_TEXTMEONE_REGULAR);
paintCurrentEvent.setTextAlign(Paint.Align.CENTER);
paintCurrentEvent.setColor(Color.LTGRAY);
paintCurrentEvent.setAntiAlias(true);
paintCurrentEventData = new Paint();
paintCurrentEventData.setTextSize(22);
paintCurrentEventData.setTextScaleX(0.9f);
paintCurrentEventData.setTypeface(engine.FONT_TEXTMEONE_REGULAR);
paintCurrentEventData.setTextAlign(Paint.Align.CENTER);
paintCurrentEventData.setColor(Color.rgb(43, 152, 206));
paintCurrentEventData.setAntiAlias(true);
paintNextEvent = new Paint();
paintNextEvent.setTextSize(22);
paintNextEvent.setTypeface(engine.FONT_TEXTMEONE_REGULAR);
paintNextEvent.setTextAlign(Paint.Align.CENTER);
paintNextEvent.setColor(Color.rgb(170, 180, 0));
paintNextEvent.setAntiAlias(true);
paintNextEventData = new Paint();
paintNextEventData.setTextSize(22);
paintNextEventData.setTypeface(engine.FONT_TEXTMEONE_REGULAR);
paintNextEventData.setTextAlign(Paint.Align.CENTER);
paintNextEventData.setColor(Color.rgb(170, 180, 0));
paintNextEventData.setAntiAlias(true);
updatePaintsToFullMode();
dateEvents = new DateEvents(new CallBack() {
@Override public void call() { // MINUTES
setupCurrentTickPath();
}
}, new CallBack() {
@Override public void call() { // HOUR
updateCalendar();
}
});
}
void updatePaintsToFullMode() {
// Enable ShadowLayer and AntiAliasing
paintHour.setShadowLayer(1, 1, 1, paintHour.getColor());
paintSeconds.setShadowLayer(1, 1, 1, paintSeconds.getColor());
paintDate.setShadowLayer(1, 1, 1, paintDate.getColor());
paintCurrentEvent.setShadowLayer(1, 1, 1, paintCurrentEvent.getColor());
paintCurrentEventData.setShadowLayer(1, 1, 1, paintCurrentEventData.getColor());
paintNextEvent.setShadowLayer(1, 1, 1, paintNextEvent.getColor());
paintNextEventData.setShadowLayer(1, 1, 1, paintNextEventData.getColor());
CalendarReader.resetPermissionData();
}
void updatePaintsToAmbientMode() {
// Disable ShadowLayer and AntiAliasing
paintHour.clearShadowLayer();
paintDate.clearShadowLayer();
paintSeconds.clearShadowLayer();
paintCurrentEvent.clearShadowLayer();
paintCurrentEventData.clearShadowLayer();
paintNextEvent.clearShadowLayer();
paintNextEventData.clearShadowLayer();
}
void draw(Canvas canvas) {
if(pathTicks == null) setupPaths();
if(events == null) updateCalendar();
if(pathCurrentTick == null) setupCurrentTickPath();
dateEvents.tick(engine.calendar);
canvas.drawRect(0, 0, engine.displayWidth, engine.displayCenterY, paintTop);
canvas.drawRect(0, engine.displayCenterY, engine.displayWidth, engine.displayHeight, paintBottom);
Event current = CalendarReader.getCurrentEvent(events);
canvas.drawText(getTime(), engine.displayCenterX, engine.displayCenterY - 20, paintHour);
if(!engine.isAmbient){
canvas.drawText(":" + getSeconds(), engine.displayCenterX + 107, engine.displayCenterY - 20, paintSeconds);
canvas.drawText(getFullDate(), engine.displayCenterX, engine.displayCenterY - 130, paintDate);
Event next = CalendarReader.getNextEvent(events);
if(next != null){
canvas.drawText("Prochain ร " + getTime(next.getSinceDayMinuteBegin(engine.calendar)), engine.displayCenterX, engine.displayCenterY + 120, paintNextEventData);
canvas.drawText(next.getName(), engine.displayCenterX, engine.displayCenterY + 150, paintNextEvent);
}else{
canvas.drawText("Aucun ร suivre", engine.displayCenterX, engine.displayCenterY + 120, paintNextEventData);
}
if(current != null){
canvas.drawText(current.getName(), engine.displayCenterX, engine.displayCenterY + 40, paintCurrentEvent);
canvas.drawText(getTime(current.getSinceDayMinuteBegin(engine.calendar)) + " > " + getTime(current.getSinceDayMinuteEnd(engine.calendar)) + " - " + current.getSinceNowMinutesEnd() + "mn restantes"
, engine.displayCenterX, engine.displayCenterY + 70, paintCurrentEventData);
}else{
canvas.drawText("Aucun รฉvรจnement", engine.displayCenterX, engine.displayCenterY + 40, paintCurrentEvent);
}
}else{
canvas.drawText(getShortDate(), engine.displayCenterX, engine.displayCenterY - 130, paintDate);
if(current != null){
canvas.drawText(current.getName(), engine.displayCenterX, engine.displayCenterY + 40, paintCurrentEvent);
canvas.drawText(getTime(current.getSinceDayMinuteBegin(engine.calendar)) + " > " + getTime(current.getSinceDayMinuteEnd(engine.calendar)) + " - " + current.getSinceNowMinutesEnd() + "mn restantes"
, engine.displayCenterX, engine.displayCenterY + 75, paintCurrentEventData);
}
}
// TICKS
canvas.drawPath(pathTicks, paintTicks);
canvas.drawPath(pathSelectedTicks, paintSelectedTicks);
canvas.drawPath(pathCurrentTick, paintCurrentTick);
}
void singleTap(int x, int y){
if(y >= engine.displayCenterY){
Intent i;
try {
// { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 pkg=com.google.android.wearable.app cmp=com.google.android.wearable.app/com.google.android.clockwork.home.calendar.AgendaActivity }
i = engine.myWatchFace.getPackageManager().getLaunchIntentForPackage("com.google.android.wearable.app");
if(i == null) throw new PackageManager.NameNotFoundException();
i.addCategory(Intent.CATEGORY_LAUNCHER);
engine.myWatchFace.startActivity(i);
}catch(PackageManager.NameNotFoundException e) {
// Appli non prรฉsente
Log.d(TAG, "Application calendrier introuvable Packages disponibles : ");
final PackageManager pm = engine.myWatchFace.getPackageManager();
List<ApplicationInfo> packages = pm.getInstalledApplications(PackageManager.GET_META_DATA);
for (ApplicationInfo packageInfo : packages) {
Log.d(TAG, "Installed package :" + packageInfo.packageName);
Log.d(TAG, "Source dir : " + packageInfo.sourceDir);
Log.d(TAG, "Launch Activity :" + pm.getLaunchIntentForPackage(packageInfo.packageName));
Log.d(TAG, " ");
}
}
}
}
private void updateCalendar() {
Log.d(TAG, "updateCalendar");
if(CalendarReader.checkPermission(engine)){
events = CalendarReader.get24HEvents(engine.myWatchFace, engine.calendar);
setupSelectedTicksPath();
}
}
private void setupCurrentTickPath(){
pathCurrentTick = new Path();
pathCurrentTick.setFillType(Path.FillType.WINDING);
int tickIndex = (int) ((engine.calendar.get(Calendar.HOUR_OF_DAY)*60 + engine.calendar.get(Calendar.MINUTE)) / 15f);
float tickRadius = engine.displayCenterX - 18;
float tickRot = (float) -(Math.PI*2 / 96*tickIndex);
float x = (float) Math.sin(tickRot) * tickRadius;
float y = (float) Math.cos(tickRot) * tickRadius;
pathCurrentTick.addCircle(engine.displayCenterX + x, engine.displayCenterY + y, 4, Path.Direction.CW);
}
private void setupSelectedTicksPath(){
Log.d(TAG, "setupSelectedTicksPath");
pathSelectedTicks = new Path();
pathSelectedTicks.setFillType(Path.FillType.WINDING);
float tickRadius = engine.displayCenterX - 9;
for(Event event : events){
if(event.isAllDay()) continue; // Enlรจve les รฉvรจnements qui prennent toute la journรฉe
long begin = event.getSinceDayMinuteBegin(engine.calendar);
if(begin > 24*60) continue; // Enlรจve les รฉvรจnement qui n'est pas compris dans la journรฉe.
long end = begin + event.getDuration(); // plus optimisรฉ de faire une soustraction que plusieurs long calculs.
int beginIndex = (int) ((begin + 7.5) / 15f);
int endIndex = (int) ((end - 7.5) / 15f);
Log.d(TAG, event.getName() + " " + (begin/60) + ":" + (begin%60) + " (" + (beginIndex/4.0) + ") -> " + (end/60) + ":" + (end%60) + " (" + (endIndex/4.0) + ")");
for(int tickIndex = beginIndex; tickIndex <= endIndex; tickIndex++){
float tickRot = (float) -(Math.PI*2 / 96*tickIndex);
float x = (float) Math.sin(tickRot) * tickRadius;
float y = (float) Math.cos(tickRot) * tickRadius;
int radius = (tickIndex % 4 == 0) ? 3 : 2;
pathSelectedTicks.addCircle(engine.displayCenterX + x, engine.displayCenterY + y, radius, Path.Direction.CW);
}
}
}
private void setupPaths(){
Log.d(TAG, "setupPaths");
pathSelectedTicks = new Path();
pathSelectedTicks.setFillType(Path.FillType.WINDING);
pathTicks = new Path();
pathTicks.setFillType(Path.FillType.WINDING);
float tickRadius = engine.displayCenterX - 9;
for(int tickIndex = 0; tickIndex < 96; tickIndex++){
float tickRot = (float) (Math.PI * 2 / 96 * tickIndex);
float x = (float) Math.sin(tickRot) * tickRadius;
float y = (float) Math.cos(tickRot) * tickRadius;
int radius = (tickIndex % 4 == 0) ? 3 : 2;
pathTicks.addCircle(engine.displayCenterX + x, engine.displayCenterY + y, radius, Path.Direction.CW);
}
}
private String getTime(long mn){
int hour = (int) (mn) / 60;
int minutes = (int) (mn) % 60;
String stringHour = ((hour < 10) ? "0" : "") + hour;
String stringMinutes = ((minutes < 10) ? "0" : "") + minutes;
return stringHour + ":" + stringMinutes;
}
private String getTime(){
int hour = engine.calendar.get(Calendar.HOUR_OF_DAY);
int minutes = engine.calendar.get(Calendar.MINUTE);
String stringHour = ((hour < 10) ? "0" : "") + hour;
String stringMinutes = ((minutes < 10) ? "0" : "") + minutes;
return stringHour + ":" + stringMinutes;
}
private String getSeconds(){
int seconds = engine.calendar.get(Calendar.SECOND);
return ((seconds < 10) ? "0" : "") + seconds;
}
private String getShortDate(){
int dayMonth = engine.calendar.get(Calendar.DAY_OF_MONTH);
int month = engine.calendar.get(Calendar.MONTH);
String stringMonth = ((month < 10) ? "0" : "") + month;
return getWeakDay() + " " + dayMonth + "/" + stringMonth;
}
private String getFullDate(){
int dayMonth = engine.calendar.get(Calendar.DAY_OF_MONTH);
return getWeakDay() + " " + dayMonth + " " + getMonthName();
}
private String getWeakDay(){
switch(engine.calendar.get(Calendar.DAY_OF_WEEK)){
case 2:
return "Lun";
case 3:
return "Mar";
case 4:
return "Mer";
case 5:
return "Jeu";
case 6:
return "Ven";
case 7:
return "Sam";
case 1:
return "Dim";
default:
return "---";
}
}
private String getMonthName(){
switch(engine.calendar.get(Calendar.MONTH)){
case 0:
return "Janvier";
case 1:
return "Fรฉvrier";
case 2:
return "Mars";
case 3:
return "Avril";
case 4:
return "Mai";
case 5:
return "Juin";
case 6:
return "Juillet";
case 7:
return "Aoรปt";
case 8:
return "Septembre";
case 9:
return "Octobre";
case 10:
return "Novembre";
case 11:
return "Dรฉcembre";
default:
return "-----";
}
}
/*void drawHands(Canvas canvas){
// Draw the background.
canvas.drawRect(0, 0, canvas.getWidth(), canvas.getHeight(), mBackgroundPaint);
//These calculations reflect the rotation in degrees per unit of time, e.g., 360 / 60 = 6 and 360 / 12 = 30.
final float secondsRotation = (engine.calendar.get(Calendar.SECOND) + engine.calendar.get(Calendar.MILLISECOND) / 1000f) * 6f;
final float minutesRotation = engine.calendar.get(Calendar.MINUTE) * 6f;
final float hoursRotation = (engine.calendar.get(Calendar.HOUR) * 30) + (engine.calendar.get(Calendar.MINUTE) / 2f);
// save the canvas state before we begin to rotate it
canvas.save();
canvas.rotate(hoursRotation, engine.displayCenterX, engine.displayCenterY);
canvas.drawLine(engine.displayCenterX, engine.displayCenterY, engine.displayCenterX, engine.displayCenterY - 100, mHandPaint);
canvas.rotate(minutesRotation - hoursRotation, engine.displayCenterX, engine.displayCenterY);
canvas.drawLine(engine.displayCenterX, engine.displayCenterY, engine.displayCenterX, engine.displayCenterY - 150, mHandPaint);
if(!engine.isAmbient){
canvas.rotate(secondsRotation - minutesRotation, engine.displayCenterX, engine.displayCenterY);
canvas.drawLine(engine.displayCenterX, engine.displayCenterY, engine.displayCenterX, engine.displayCenterY - 180, mHandPaint);
}
// restore the canvas' original orientation.
canvas.restore();
}*/
}
| 17,266 | 0.627399 | 0.612209 | 468 | 35.856838 | 35.923752 | 237 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.792735 | false | false | 1 |
75018a57ef7356392c20b61b5dda282416de442a | 15,350,213,164,433 | 52c2c1375340d970bf6d3ee1cdf2eb097ebd3dc2 | /crm/src/main/java/com/iurac/crm/workbench/web/controller/TranController.java | c54c7011cd4ecc5306b697e8582f881435dbe0f5 | [] | no_license | Iurac/CRM | https://github.com/Iurac/CRM | e35509cad11b61165f94f60ff0e1251e0c1362a3 | 3b2d61ff00b2c1efc05f51447bb18ab8ea1cfbe0 | refs/heads/master | 2023-01-20T04:48:48.351000 | 2020-11-20T14:05:04 | 2020-11-20T14:05:04 | 313,070,514 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.iurac.crm.workbench.web.controller;
import com.iurac.crm.settings.domain.User;
import com.iurac.crm.settings.service.UserService;
import com.iurac.crm.settings.service.impl.UserServiceImpl;
import com.iurac.crm.utils.DateTimeUtil;
import com.iurac.crm.utils.PrintJson;
import com.iurac.crm.utils.ServiceFactory;
import com.iurac.crm.utils.UUIDUtil;
import com.iurac.crm.vo.EchartsVo;
import com.iurac.crm.vo.PaginationVo;
import com.iurac.crm.workbench.domain.Activity;
import com.iurac.crm.workbench.domain.Contacts;
import com.iurac.crm.workbench.domain.Tran;
import com.iurac.crm.workbench.domain.TranHistory;
import com.iurac.crm.workbench.service.ActivityService;
import com.iurac.crm.workbench.service.ContactsService;
import com.iurac.crm.workbench.service.CustomerService;
import com.iurac.crm.workbench.service.TranService;
import com.iurac.crm.workbench.service.impl.ActivityServiceImpl;
import com.iurac.crm.workbench.service.impl.ContactsServiceImpl;
import com.iurac.crm.workbench.service.impl.CustomerServiceImpl;
import com.iurac.crm.workbench.service.impl.TranServiceImpl;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* BelongsProject: workspaceForCrm
* BelongsPackage: com.iurac.crm.workbench.web.controller
* Author: IuRac
* CreateTime: 2020-11-16 13:14
* Description:
*/
public class TranController extends HttpServlet {
@Override
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("่ฟๅ
ฅไบTranๆงๅถๅจ");
String path = request.getServletPath();
if("/workbench/transaction/transactionPageList.do".equals(path)){
transactionPageList(request,response);
}else if("/workbench/transaction/getActivityListByName.do".equals(path)){
getActivityListByName(request,response);
}else if("/workbench/transaction/getContactsListByName.do".equals(path)){
getContactsListByName(request,response);
}else if("/workbench/transaction/getUserList.do".equals(path)){
getUserList(request,response);
}else if("/workbench/transaction/getCustomerName.do".equals(path)){
getCustomerName(request,response);
}else if("/workbench/transaction/save.do".equals(path)){
save(request,response);
}else if("/workbench/transaction/detail.do".equals(path)){
detail(request,response);
}else if("/workbench/transaction/getTranHistoryListByTid.do".equals(path)){
getTranHistoryListByTid(request,response);
}else if("/workbench/transaction/changeStage.do".equals(path)){
changeStage(request,response);
}else if("/workbench/transaction/getEcharts.do".equals(path)){
getEcharts(request,response);
}
}
private void getEcharts(HttpServletRequest request, HttpServletResponse response) {
TranService tranService = (TranService) ServiceFactory.getService(new TranServiceImpl());
EchartsVo echartsVo = tranService.getEcharts();
PrintJson.printJsonObj(response,echartsVo);
}
private void changeStage(HttpServletRequest request, HttpServletResponse response) {
TranService tranService = (TranService) ServiceFactory.getService(new TranServiceImpl());
String id = request.getParameter("id");
String stage = request.getParameter("stage");
String money = request.getParameter("money");
String expectedDate = request.getParameter("expectedDate");
Tran tran = new Tran();
tran.setId(id);
tran.setEditTime(DateTimeUtil.getSysTime());
tran.setEditBy(((User)request.getSession().getAttribute("user")).getName());
tran.setStage(stage);
tran.setMoney(money);
tran.setExpectedDate(expectedDate);
ServletContext application = request.getServletContext();
Map<String,String> stage2Possibility = (Map<String, String>) application.getAttribute("stage2Possibility");
String possibility = stage2Possibility.get(stage);
tran.setPossibility(possibility);
boolean flag = tranService.changeStage(tran);
Map<String ,Object> map = new HashMap<>();
map.put("success",flag);
map.put("tran",tran);
PrintJson.printJsonObj(response,map);
}
private void getTranHistoryListByTid(HttpServletRequest request, HttpServletResponse response) {
TranService tranService = (TranService) ServiceFactory.getService(new TranServiceImpl());
String tid = request.getParameter("id");
List<TranHistory> tranHistoryList = tranService.getTranHistoryListByTid(tid);
ServletContext application = request.getServletContext();
Map<String,String> map = (Map<String, String>) application.getAttribute("stage2Possibility");
for(TranHistory tranHistory : tranHistoryList){
String stage = tranHistory.getStage();
String possibility = map.get(stage);
tranHistory.setPossibility(possibility);
}
PrintJson.printJsonObj(response,tranHistoryList);
}
private void detail(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
TranService tranService = (TranService) ServiceFactory.getService(new TranServiceImpl());
String id = request.getParameter("id");
Tran tran = tranService.detail(id);
String stage = tran.getStage();
ServletContext application = request.getServletContext();
Map<String,String> map = (Map<String, String>) application.getAttribute("stage2Possibility");
String possibility = map.get(stage);
tran.setPossibility(possibility);
request.setAttribute("tran",tran);
request.getRequestDispatcher("/workbench/transaction/detail.jsp").forward(request,response);
}
private void save(HttpServletRequest request, HttpServletResponse response) throws IOException {
TranService tranService = (TranService) ServiceFactory.getService(new TranServiceImpl());
String customerName = request.getParameter("create-customerName");
String id = UUIDUtil.getUUID();
String owner = request.getParameter("create-owner");
String money = request.getParameter("create-money");
String name = request.getParameter("create-name");
String expectedDate = request.getParameter("create-expectedDate");
String stage = request.getParameter("create-stage");
String type = request.getParameter("create-type");
String source = request.getParameter("create-source");
String activityId = request.getParameter("create-activityId");
String contactsId = request.getParameter("create-contactsId");
String createBy = ((User)request.getSession().getAttribute("user")).getName();
String createTime = DateTimeUtil.getSysTime();
String description = request.getParameter("create-description");
String contactSummary = request.getParameter("create-contactSummary");
String nextContactTime = request.getParameter("create-nextContactTime");
Tran tran = new Tran();
tran.setId(id);
tran.setMoney(money);
tran.setName(name);
tran.setStage(stage);
tran.setSource(source);
tran.setExpectedDate(expectedDate);
tran.setCreateTime(createTime);
tran.setCreateBy(createBy);
tran.setActivityId(activityId);
tran.setContactsId(contactsId);
tran.setContactSummary(contactSummary);
tran.setDescription(description);
tran.setType(type);
tran.setOwner(owner);
tran.setNextContactTime(nextContactTime);
boolean flag = tranService.save(tran,customerName);
if(flag) {
response.sendRedirect(request.getContextPath()+"/workbench/transaction/index1.jsp");
}
}
private void getCustomerName(HttpServletRequest request, HttpServletResponse response) {
CustomerService customerService = (CustomerService) ServiceFactory.getService(new CustomerServiceImpl());
String name = request.getParameter("name");
List<String> customerList = customerService.getCustomerName(name);
PrintJson.printJsonObj(response,customerList);
}
private void getUserList(HttpServletRequest request, HttpServletResponse response) {
UserService userService = (UserService) ServiceFactory.getService(new UserServiceImpl());
List<User> userList = userService.getUserList();
PrintJson.printJsonObj(response,userList);
}
private void getContactsListByName(HttpServletRequest request, HttpServletResponse response) {
ContactsService contactsService = (ContactsService) ServiceFactory.getService(new ContactsServiceImpl());
String cname = request.getParameter("cname");
List<Contacts> contactsList = contactsService.getContactsListByName(cname);
PrintJson.printJsonObj(response,contactsList);
}
private void getActivityListByName(HttpServletRequest request, HttpServletResponse response) {
ActivityService activityService = (ActivityService) ServiceFactory.getService(new ActivityServiceImpl());
String aname = request.getParameter("aname");
List<Activity> activityList = activityService.getActivityListByName(aname);
PrintJson.printJsonObj(response,activityList);
}
private void transactionPageList(HttpServletRequest request, HttpServletResponse response) {
TranService tranService = (TranService) ServiceFactory.getService(new TranServiceImpl());
String pageNoStr = request.getParameter("pageNo");
String pageSizeStr = request.getParameter("pageSize");
String name = request.getParameter("name");
String owner = request.getParameter("owner");
String stage = request.getParameter("stage");
String source = request.getParameter("source");
String type = request.getParameter("type");
String contactsName = request.getParameter("contactsName");
String customerName = request.getParameter("customerName");
int pageNo = Integer.parseInt(pageNoStr);
int pageSize = Integer.parseInt(pageSizeStr);
int skipCount = (pageNo-1)*pageSize;
Map<String, Object> map = new HashMap<>();
map.put("name",name);
map.put("owner",owner);
map.put("stage",stage);
map.put("source",source);
map.put("type",type);
map.put("contactsName",contactsName);
map.put("customerName",customerName);
map.put("skipCount",skipCount);
map.put("pageSize",pageSize);
PaginationVo<Tran> tranPaginationVo = tranService.transactionPageList(map);
PrintJson.printJsonObj(response,tranPaginationVo);
}
}
| UTF-8 | Java | 11,146 | java | TranController.java | Java | [
{
"context": " com.iurac.crm.workbench.web.controller\n * Author: IuRac\n * CreateTime: 2020-11-16 13:14\n * Description:\n ",
"end": 1524,
"score": 0.906318187713623,
"start": 1519,
"tag": "USERNAME",
"value": "IuRac"
},
{
"context": " tran.setMoney(money);\n tran.setName(name);\n tran.setStage(stage);\n tran.setS",
"end": 7537,
"score": 0.9991539716720581,
"start": 7533,
"tag": "NAME",
"value": "name"
}
] | null | [] | package com.iurac.crm.workbench.web.controller;
import com.iurac.crm.settings.domain.User;
import com.iurac.crm.settings.service.UserService;
import com.iurac.crm.settings.service.impl.UserServiceImpl;
import com.iurac.crm.utils.DateTimeUtil;
import com.iurac.crm.utils.PrintJson;
import com.iurac.crm.utils.ServiceFactory;
import com.iurac.crm.utils.UUIDUtil;
import com.iurac.crm.vo.EchartsVo;
import com.iurac.crm.vo.PaginationVo;
import com.iurac.crm.workbench.domain.Activity;
import com.iurac.crm.workbench.domain.Contacts;
import com.iurac.crm.workbench.domain.Tran;
import com.iurac.crm.workbench.domain.TranHistory;
import com.iurac.crm.workbench.service.ActivityService;
import com.iurac.crm.workbench.service.ContactsService;
import com.iurac.crm.workbench.service.CustomerService;
import com.iurac.crm.workbench.service.TranService;
import com.iurac.crm.workbench.service.impl.ActivityServiceImpl;
import com.iurac.crm.workbench.service.impl.ContactsServiceImpl;
import com.iurac.crm.workbench.service.impl.CustomerServiceImpl;
import com.iurac.crm.workbench.service.impl.TranServiceImpl;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* BelongsProject: workspaceForCrm
* BelongsPackage: com.iurac.crm.workbench.web.controller
* Author: IuRac
* CreateTime: 2020-11-16 13:14
* Description:
*/
public class TranController extends HttpServlet {
@Override
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("่ฟๅ
ฅไบTranๆงๅถๅจ");
String path = request.getServletPath();
if("/workbench/transaction/transactionPageList.do".equals(path)){
transactionPageList(request,response);
}else if("/workbench/transaction/getActivityListByName.do".equals(path)){
getActivityListByName(request,response);
}else if("/workbench/transaction/getContactsListByName.do".equals(path)){
getContactsListByName(request,response);
}else if("/workbench/transaction/getUserList.do".equals(path)){
getUserList(request,response);
}else if("/workbench/transaction/getCustomerName.do".equals(path)){
getCustomerName(request,response);
}else if("/workbench/transaction/save.do".equals(path)){
save(request,response);
}else if("/workbench/transaction/detail.do".equals(path)){
detail(request,response);
}else if("/workbench/transaction/getTranHistoryListByTid.do".equals(path)){
getTranHistoryListByTid(request,response);
}else if("/workbench/transaction/changeStage.do".equals(path)){
changeStage(request,response);
}else if("/workbench/transaction/getEcharts.do".equals(path)){
getEcharts(request,response);
}
}
private void getEcharts(HttpServletRequest request, HttpServletResponse response) {
TranService tranService = (TranService) ServiceFactory.getService(new TranServiceImpl());
EchartsVo echartsVo = tranService.getEcharts();
PrintJson.printJsonObj(response,echartsVo);
}
private void changeStage(HttpServletRequest request, HttpServletResponse response) {
TranService tranService = (TranService) ServiceFactory.getService(new TranServiceImpl());
String id = request.getParameter("id");
String stage = request.getParameter("stage");
String money = request.getParameter("money");
String expectedDate = request.getParameter("expectedDate");
Tran tran = new Tran();
tran.setId(id);
tran.setEditTime(DateTimeUtil.getSysTime());
tran.setEditBy(((User)request.getSession().getAttribute("user")).getName());
tran.setStage(stage);
tran.setMoney(money);
tran.setExpectedDate(expectedDate);
ServletContext application = request.getServletContext();
Map<String,String> stage2Possibility = (Map<String, String>) application.getAttribute("stage2Possibility");
String possibility = stage2Possibility.get(stage);
tran.setPossibility(possibility);
boolean flag = tranService.changeStage(tran);
Map<String ,Object> map = new HashMap<>();
map.put("success",flag);
map.put("tran",tran);
PrintJson.printJsonObj(response,map);
}
private void getTranHistoryListByTid(HttpServletRequest request, HttpServletResponse response) {
TranService tranService = (TranService) ServiceFactory.getService(new TranServiceImpl());
String tid = request.getParameter("id");
List<TranHistory> tranHistoryList = tranService.getTranHistoryListByTid(tid);
ServletContext application = request.getServletContext();
Map<String,String> map = (Map<String, String>) application.getAttribute("stage2Possibility");
for(TranHistory tranHistory : tranHistoryList){
String stage = tranHistory.getStage();
String possibility = map.get(stage);
tranHistory.setPossibility(possibility);
}
PrintJson.printJsonObj(response,tranHistoryList);
}
private void detail(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
TranService tranService = (TranService) ServiceFactory.getService(new TranServiceImpl());
String id = request.getParameter("id");
Tran tran = tranService.detail(id);
String stage = tran.getStage();
ServletContext application = request.getServletContext();
Map<String,String> map = (Map<String, String>) application.getAttribute("stage2Possibility");
String possibility = map.get(stage);
tran.setPossibility(possibility);
request.setAttribute("tran",tran);
request.getRequestDispatcher("/workbench/transaction/detail.jsp").forward(request,response);
}
private void save(HttpServletRequest request, HttpServletResponse response) throws IOException {
TranService tranService = (TranService) ServiceFactory.getService(new TranServiceImpl());
String customerName = request.getParameter("create-customerName");
String id = UUIDUtil.getUUID();
String owner = request.getParameter("create-owner");
String money = request.getParameter("create-money");
String name = request.getParameter("create-name");
String expectedDate = request.getParameter("create-expectedDate");
String stage = request.getParameter("create-stage");
String type = request.getParameter("create-type");
String source = request.getParameter("create-source");
String activityId = request.getParameter("create-activityId");
String contactsId = request.getParameter("create-contactsId");
String createBy = ((User)request.getSession().getAttribute("user")).getName();
String createTime = DateTimeUtil.getSysTime();
String description = request.getParameter("create-description");
String contactSummary = request.getParameter("create-contactSummary");
String nextContactTime = request.getParameter("create-nextContactTime");
Tran tran = new Tran();
tran.setId(id);
tran.setMoney(money);
tran.setName(name);
tran.setStage(stage);
tran.setSource(source);
tran.setExpectedDate(expectedDate);
tran.setCreateTime(createTime);
tran.setCreateBy(createBy);
tran.setActivityId(activityId);
tran.setContactsId(contactsId);
tran.setContactSummary(contactSummary);
tran.setDescription(description);
tran.setType(type);
tran.setOwner(owner);
tran.setNextContactTime(nextContactTime);
boolean flag = tranService.save(tran,customerName);
if(flag) {
response.sendRedirect(request.getContextPath()+"/workbench/transaction/index1.jsp");
}
}
private void getCustomerName(HttpServletRequest request, HttpServletResponse response) {
CustomerService customerService = (CustomerService) ServiceFactory.getService(new CustomerServiceImpl());
String name = request.getParameter("name");
List<String> customerList = customerService.getCustomerName(name);
PrintJson.printJsonObj(response,customerList);
}
private void getUserList(HttpServletRequest request, HttpServletResponse response) {
UserService userService = (UserService) ServiceFactory.getService(new UserServiceImpl());
List<User> userList = userService.getUserList();
PrintJson.printJsonObj(response,userList);
}
private void getContactsListByName(HttpServletRequest request, HttpServletResponse response) {
ContactsService contactsService = (ContactsService) ServiceFactory.getService(new ContactsServiceImpl());
String cname = request.getParameter("cname");
List<Contacts> contactsList = contactsService.getContactsListByName(cname);
PrintJson.printJsonObj(response,contactsList);
}
private void getActivityListByName(HttpServletRequest request, HttpServletResponse response) {
ActivityService activityService = (ActivityService) ServiceFactory.getService(new ActivityServiceImpl());
String aname = request.getParameter("aname");
List<Activity> activityList = activityService.getActivityListByName(aname);
PrintJson.printJsonObj(response,activityList);
}
private void transactionPageList(HttpServletRequest request, HttpServletResponse response) {
TranService tranService = (TranService) ServiceFactory.getService(new TranServiceImpl());
String pageNoStr = request.getParameter("pageNo");
String pageSizeStr = request.getParameter("pageSize");
String name = request.getParameter("name");
String owner = request.getParameter("owner");
String stage = request.getParameter("stage");
String source = request.getParameter("source");
String type = request.getParameter("type");
String contactsName = request.getParameter("contactsName");
String customerName = request.getParameter("customerName");
int pageNo = Integer.parseInt(pageNoStr);
int pageSize = Integer.parseInt(pageSizeStr);
int skipCount = (pageNo-1)*pageSize;
Map<String, Object> map = new HashMap<>();
map.put("name",name);
map.put("owner",owner);
map.put("stage",stage);
map.put("source",source);
map.put("type",type);
map.put("contactsName",contactsName);
map.put("customerName",customerName);
map.put("skipCount",skipCount);
map.put("pageSize",pageSize);
PaginationVo<Tran> tranPaginationVo = tranService.transactionPageList(map);
PrintJson.printJsonObj(response,tranPaginationVo);
}
}
| 11,146 | 0.713041 | 0.711335 | 257 | 42.322956 | 31.370275 | 123 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.832685 | false | false | 1 |
9a91cfc93fe68a485b5e00bbaccbc917a36cb212 | 26,645,977,161,126 | 7b06dfdb45a795e2bb59ae36754cfd262352c4e5 | /HttpDemo/src/main/java/org/xottys/network/http/Util.java | 80235f0e43723f64024ae4416ce2976587cabfc8 | [] | no_license | xottycq/Network | https://github.com/xottycq/Network | 807725da2f16a36db75865870d36aabf483a2bd8 | a933fe570c2560ba6719ffa72b80fed69b32f44d | refs/heads/master | 2021-09-14T20:54:41.331000 | 2018-05-19T11:05:01 | 2018-05-19T11:05:01 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* ๆฌไพไธบๅ็ง็ฝ็ป่ฎฟ้ฎ็ๅธธ็จๅทฅๅ
ท็ฑป็จๅบ
* 1๏ผ่ฏปๅใไฟๅญๆ่งฃๆurlๅฐๅ็
* 2๏ผๅคๆญ็ฝ่ทฏ็ถๆ็
* 3๏ผxml่งฃๆ็
* <p>
* <br/>Copyright (C), 2017-2018, Steve Chang
* <br/>This program is protected by copyright laws.
* <br/>Program Name:HttpDemo
* <br/>Date:May๏ผ2018
*
* @author xottys@163.com
* @version 1.0
*/
package org.xottys.network.http;
import android.content.Context;
import android.content.SharedPreferences;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.preference.PreferenceManager;
import android.widget.TextView;
import org.dom4j.io.OutputFormat;
import org.dom4j.io.XMLWriter;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import java.io.IOException;
import java.io.InputStream;
import java.io.StringWriter;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.Socket;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
public final class Util {
private static final String url = "localhost:8080/ServerDemo/";
public static String xmlString="";
static public String getAddr(Context ctx,int addressType) {
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(ctx);
String str="";
switch (addressType) {
case 0:
str=sp.getString("httpData", "http://"+url+"login");
break;
case 1:
str=sp.getString("httpFile", "http://"+url+"updown");
break;
case 2:
str=sp.getString("socketTcp", "http://"+url+"tcp"+"&8000");
break;
case 3:
str=sp.getString("socketUdp", "http://"+url+"udp"+"&9000"+"&9001");
break;
case 4:
str=sp.getString("websocket", "ws://"+url+"websocket");
break;
}
return str;
}
static public void saveAddr(Context ctx,int addressType ,String addr) {
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(ctx);
switch (addressType) {
case 0:
sp.edit().putString("httpData", addr).apply();
break;
case 1:
sp.edit().putString("httpFile", addr).apply();
break;
case 2:
sp.edit().putString("socketTcp", addr).apply();
break;
case 3:
sp.edit().putString("socketUdp", addr).apply();
break;
case 4:
sp.edit().putString("websocket", addr).apply();
break;
}
}
static public boolean isConnectableByHttp(URL url){
boolean isConn = false;
HttpURLConnection conn = null;
try {
conn = (HttpURLConnection)url.openConnection();
conn.setConnectTimeout(1000*5);
if(conn.getResponseCode()==200){
isConn = true;
}
}catch (IOException e) {
e.printStackTrace();
isConn = false;
}finally{
if (conn!=null)
conn.disconnect();
}
return isConn;
}
/**
* ๅคๆญๆฏๅฆๆญๅผ่ฟๆฅ๏ผๆญๅผ่ฟๅtrue,ๆฒกๆ่ฟๅfalse
* @param socket ้่ฆ่ฟๆฅ็socket
* @return true๏ผๅฏ่ฟๆฅ false๏ผไธๅฏ่ฟๆฅ
*/
static public Boolean isConnectableBySocket(Socket socket){
try{
socket.sendUrgentData(0);//ๅ้1ไธชๅญ่็็ดงๆฅๆฐๆฎ๏ผ้ป่ฎคๆ
ๅตไธ๏ผๆๅกๅจ็ซฏๆฒกๆๅผๅฏ็ดงๆฅๆฐๆฎๅค็๏ผไธๅฝฑๅๆญฃๅธธ้ไฟก
return true;
}catch(Exception e){
e.printStackTrace();
return false;
}
}
/**
* ๆฃๆตๅฝ็็ฝ็ป๏ผWLANใ3G/2G๏ผ็ถๆ
* @param context Context
* @return true ่กจ็คบ็ฝ็ปๅฏ็จ
*/
static public boolean isNetworkAvailable(Context context) {
ConnectivityManager connectivity = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
if (connectivity != null) {
NetworkInfo info = connectivity.getActiveNetworkInfo();
if (info != null && info.isConnected())
{
// ๅฝๅ็ฝ็ปๆฏ่ฟๆฅ็
return (info.getState() == NetworkInfo.State.CONNECTED);
}
}
return false;
}
static public void refreshLongText(TextView textView) {
int offset = textView.getLineCount() * textView.getLineHeight();
if (offset > textView.getHeight()) {
textView.scrollTo(0, offset - textView.getHeight());
}
}
//็จDOMๆนๅผ่งฃๆxml
static public ArrayList<HashMap> readxmlByDom(InputStream xmlInput) {
ArrayList<HashMap> results = new ArrayList<>();
HashMap<String, String> result;
DocumentBuilderFactory dbFactory;
DocumentBuilder db = null;
org.w3c.dom.Document document = null;
try {
dbFactory = DocumentBuilderFactory.newInstance();
db = dbFactory.newDocumentBuilder();
} catch (ParserConfigurationException e) {
e.printStackTrace();
}
//ๅฐ็ปๅฎ URI ็ๅ
ๅฎน่งฃๆไธบไธไธช XML ๆๆกฃ,ๅนถ่ฟๅDocumentๅฏน่ฑก
try {
if (db != null) document = db.parse(xmlInput);
} catch (Exception e) {
e.printStackTrace();
}
if (document!=null) {
document.getDocumentElement().normalize();
org.dom4j.io.DOMReader xmlReader = new org.dom4j.io.DOMReader();
org.dom4j.Document document4j = xmlReader.read(document);
if (document4j != null) xmlString = formatXML(document4j);
//ๆๆๆกฃ้กบๅบ่ฟๅๅ
ๅซๅจๆๆกฃไธญไธๅ
ทๆ็ปๅฎๆ ่ฎฐๅ็งฐ็ๆๆ Element ็ NodeList
NodeList resultList = document.getElementsByTagName("body");
for (int temp = 0; temp < resultList.getLength(); temp++) {
Node nNode = resultList.item(temp);
System.out.println("\nCurrent Element :"
+ nNode.getNodeName());
if (nNode.getNodeType() == Node.ELEMENT_NODE) {
result = new HashMap<>();
Element eElement = (Element) nNode;
//get element content
result.put("code", eElement.getElementsByTagName("code")
.item(0)
.getTextContent());
result.put("message", eElement.getElementsByTagName("info")
.item(0)
.getTextContent());
results.add(result);
}
}
}
return results;
}
static private String formatXML(org.dom4j.Document xmlDocument) {
StringWriter stringWriter = new StringWriter();
try {
OutputFormat formater= OutputFormat.createPrettyPrint();
formater.setOmitEncoding(true);
formater.setEncoding("UTF-8");
formater.setSuppressDeclaration(true);
stringWriter=new StringWriter();
XMLWriter writer=new XMLWriter(stringWriter,formater);
writer.write(xmlDocument);
writer.close();
}catch (IOException e){
e.printStackTrace();
}
return stringWriter.toString();
}
/**
* ่งฃๆๅบurlๅๆฐไธญ็้ฎๅผๅฏน
* ๅฆ "index.jsp?Action=del&id=123"๏ผ่งฃๆๅบAction:del,id:123ๅญๅ
ฅmapไธญ
* @param strUrlParam urlๆฅ่ฏขไธฒ๏ผๆ ผๅผๅฆ๏ผname1=value1&name2=value2
* @return HashMap๏ผget(name1)=value1,get(name2)=value2
*/
public static HashMap<String, String> decodeUrlQueryString(String strUrlParam) {
HashMap<String, String> mapResult = new HashMap<>();
String[] arrSplit;
//ๆฏไธช้ฎๅผไธบไธ็ป
arrSplit = strUrlParam.split("[&]");
for (String strSplit : arrSplit) {
String[] arrSplitEqual;
arrSplitEqual = strSplit.split("[=]");
//่งฃๆๅบ้ฎๅผ
if (arrSplitEqual.length > 1) {
//ๆญฃ็กฎ่งฃๆ
mapResult.put(arrSplitEqual[0], arrSplitEqual[1]);
} else {
if (!arrSplitEqual[0].equals("")) {
//ๅชๆๅๆฐๆฒกๆๅผ๏ผไธๅ ๅ
ฅ
mapResult.put(arrSplitEqual[0], "");
}
}
}
return mapResult;
}
/**
* ่งฃๆๅบurl
* ๅฆ ""http://192.168.1.1:8080/login๏ผ่งฃๆๅบ"BaseUrl:http://192.168.1.1,PathUrl:login"ๅญๅ
ฅmapไธญ
* @param url ๆ ผๅผๅฆ๏ผhttp://192.168.1.1:8080/login
* @return HashMap๏ผget("BaseUrl")=http://192.168.1.1:8080,get('PathUrl")=login
*/
public static HashMap<String, String> decodeUrl(String url) {
HashMap<String, String> mapResult = new HashMap<>();
try {
URL myurl = new URL(url);
mapResult.put("BaseUrl", myurl.getAuthority());
mapResult.put("PathUrl", myurl.getPath());
}catch (MalformedURLException e){
mapResult.put("BaseUrl", "http://192.168.0.1:8080");
mapResult.put("PathUrl", "login");
e.printStackTrace();
}
return mapResult;
}
}
| UTF-8 | Java | 9,676 | java | Util.java | Java | [
{
"context": " 3๏ผxml่งฃๆ็\n * <p>\n * <br/>Copyright (C), 2017-2018, Steve Chang\n * <br/>This program is protected by copyright la",
"end": 122,
"score": 0.9996795058250427,
"start": 111,
"tag": "NAME",
"value": "Steve Chang"
},
{
"context": " Name:HttpDemo\n * <br/>Date:May๏ผ2018\n *\n * @author xottys@163.com\n * @version 1.0\n */\npackage org.xottys.network.ht",
"end": 256,
"score": 0.9999264478683472,
"start": 242,
"tag": "EMAIL",
"value": "xottys@163.com"
},
{
"context": "t;\n }\n\n /**\n * ่งฃๆๅบurl\n * ๅฆ \"\"http://192.168.1.1:8080/login๏ผ่งฃๆๅบ\"BaseUrl:http://192.168.1.",
"end": 8423,
"score": 0.6093382835388184,
"start": 8421,
"tag": "IP_ADDRESS",
"value": "19"
},
{
"context": "\"http://192.168.1.1:8080/login๏ผ่งฃๆๅบ\"BaseUrl:http://192.168.1.1,PathUrl:login\"ๅญๅ
ฅmapไธญ\n * @param url ๆ ผๅผๅฆ๏ผhttp:/",
"end": 8474,
"score": 0.9991033673286438,
"start": 8463,
"tag": "IP_ADDRESS",
"value": "192.168.1.1"
},
{
"context": "PathUrl:login\"ๅญๅ
ฅmapไธญ\n * @param url ๆ ผๅผๅฆ๏ผhttp://192.168.1.1:8080/login\n * @return HashMap๏ผget(\"BaseUrl\")=",
"end": 8536,
"score": 0.9693273901939392,
"start": 8525,
"tag": "IP_ADDRESS",
"value": "192.168.1.1"
},
{
"context": "ogin\n * @return HashMap๏ผget(\"BaseUrl\")=http://192.168.1.1:8080,get('PathUrl\")=login\n */\n public stat",
"end": 8604,
"score": 0.9949412941932678,
"start": 8593,
"tag": "IP_ADDRESS",
"value": "192.168.1.1"
},
{
"context": " e){\n mapResult.put(\"BaseUrl\", \"http://192.168.0.1:8080\");\n mapResult.put(\"PathUrl\", \"log",
"end": 9031,
"score": 0.9971715807914734,
"start": 9020,
"tag": "IP_ADDRESS",
"value": "192.168.0.1"
}
] | null | [] | /**
* ๆฌไพไธบๅ็ง็ฝ็ป่ฎฟ้ฎ็ๅธธ็จๅทฅๅ
ท็ฑป็จๅบ
* 1๏ผ่ฏปๅใไฟๅญๆ่งฃๆurlๅฐๅ็
* 2๏ผๅคๆญ็ฝ่ทฏ็ถๆ็
* 3๏ผxml่งฃๆ็
* <p>
* <br/>Copyright (C), 2017-2018, <NAME>
* <br/>This program is protected by copyright laws.
* <br/>Program Name:HttpDemo
* <br/>Date:May๏ผ2018
*
* @author <EMAIL>
* @version 1.0
*/
package org.xottys.network.http;
import android.content.Context;
import android.content.SharedPreferences;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.preference.PreferenceManager;
import android.widget.TextView;
import org.dom4j.io.OutputFormat;
import org.dom4j.io.XMLWriter;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import java.io.IOException;
import java.io.InputStream;
import java.io.StringWriter;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.Socket;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
public final class Util {
private static final String url = "localhost:8080/ServerDemo/";
public static String xmlString="";
static public String getAddr(Context ctx,int addressType) {
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(ctx);
String str="";
switch (addressType) {
case 0:
str=sp.getString("httpData", "http://"+url+"login");
break;
case 1:
str=sp.getString("httpFile", "http://"+url+"updown");
break;
case 2:
str=sp.getString("socketTcp", "http://"+url+"tcp"+"&8000");
break;
case 3:
str=sp.getString("socketUdp", "http://"+url+"udp"+"&9000"+"&9001");
break;
case 4:
str=sp.getString("websocket", "ws://"+url+"websocket");
break;
}
return str;
}
static public void saveAddr(Context ctx,int addressType ,String addr) {
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(ctx);
switch (addressType) {
case 0:
sp.edit().putString("httpData", addr).apply();
break;
case 1:
sp.edit().putString("httpFile", addr).apply();
break;
case 2:
sp.edit().putString("socketTcp", addr).apply();
break;
case 3:
sp.edit().putString("socketUdp", addr).apply();
break;
case 4:
sp.edit().putString("websocket", addr).apply();
break;
}
}
static public boolean isConnectableByHttp(URL url){
boolean isConn = false;
HttpURLConnection conn = null;
try {
conn = (HttpURLConnection)url.openConnection();
conn.setConnectTimeout(1000*5);
if(conn.getResponseCode()==200){
isConn = true;
}
}catch (IOException e) {
e.printStackTrace();
isConn = false;
}finally{
if (conn!=null)
conn.disconnect();
}
return isConn;
}
/**
* ๅคๆญๆฏๅฆๆญๅผ่ฟๆฅ๏ผๆญๅผ่ฟๅtrue,ๆฒกๆ่ฟๅfalse
* @param socket ้่ฆ่ฟๆฅ็socket
* @return true๏ผๅฏ่ฟๆฅ false๏ผไธๅฏ่ฟๆฅ
*/
static public Boolean isConnectableBySocket(Socket socket){
try{
socket.sendUrgentData(0);//ๅ้1ไธชๅญ่็็ดงๆฅๆฐๆฎ๏ผ้ป่ฎคๆ
ๅตไธ๏ผๆๅกๅจ็ซฏๆฒกๆๅผๅฏ็ดงๆฅๆฐๆฎๅค็๏ผไธๅฝฑๅๆญฃๅธธ้ไฟก
return true;
}catch(Exception e){
e.printStackTrace();
return false;
}
}
/**
* ๆฃๆตๅฝ็็ฝ็ป๏ผWLANใ3G/2G๏ผ็ถๆ
* @param context Context
* @return true ่กจ็คบ็ฝ็ปๅฏ็จ
*/
static public boolean isNetworkAvailable(Context context) {
ConnectivityManager connectivity = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
if (connectivity != null) {
NetworkInfo info = connectivity.getActiveNetworkInfo();
if (info != null && info.isConnected())
{
// ๅฝๅ็ฝ็ปๆฏ่ฟๆฅ็
return (info.getState() == NetworkInfo.State.CONNECTED);
}
}
return false;
}
static public void refreshLongText(TextView textView) {
int offset = textView.getLineCount() * textView.getLineHeight();
if (offset > textView.getHeight()) {
textView.scrollTo(0, offset - textView.getHeight());
}
}
//็จDOMๆนๅผ่งฃๆxml
static public ArrayList<HashMap> readxmlByDom(InputStream xmlInput) {
ArrayList<HashMap> results = new ArrayList<>();
HashMap<String, String> result;
DocumentBuilderFactory dbFactory;
DocumentBuilder db = null;
org.w3c.dom.Document document = null;
try {
dbFactory = DocumentBuilderFactory.newInstance();
db = dbFactory.newDocumentBuilder();
} catch (ParserConfigurationException e) {
e.printStackTrace();
}
//ๅฐ็ปๅฎ URI ็ๅ
ๅฎน่งฃๆไธบไธไธช XML ๆๆกฃ,ๅนถ่ฟๅDocumentๅฏน่ฑก
try {
if (db != null) document = db.parse(xmlInput);
} catch (Exception e) {
e.printStackTrace();
}
if (document!=null) {
document.getDocumentElement().normalize();
org.dom4j.io.DOMReader xmlReader = new org.dom4j.io.DOMReader();
org.dom4j.Document document4j = xmlReader.read(document);
if (document4j != null) xmlString = formatXML(document4j);
//ๆๆๆกฃ้กบๅบ่ฟๅๅ
ๅซๅจๆๆกฃไธญไธๅ
ทๆ็ปๅฎๆ ่ฎฐๅ็งฐ็ๆๆ Element ็ NodeList
NodeList resultList = document.getElementsByTagName("body");
for (int temp = 0; temp < resultList.getLength(); temp++) {
Node nNode = resultList.item(temp);
System.out.println("\nCurrent Element :"
+ nNode.getNodeName());
if (nNode.getNodeType() == Node.ELEMENT_NODE) {
result = new HashMap<>();
Element eElement = (Element) nNode;
//get element content
result.put("code", eElement.getElementsByTagName("code")
.item(0)
.getTextContent());
result.put("message", eElement.getElementsByTagName("info")
.item(0)
.getTextContent());
results.add(result);
}
}
}
return results;
}
static private String formatXML(org.dom4j.Document xmlDocument) {
StringWriter stringWriter = new StringWriter();
try {
OutputFormat formater= OutputFormat.createPrettyPrint();
formater.setOmitEncoding(true);
formater.setEncoding("UTF-8");
formater.setSuppressDeclaration(true);
stringWriter=new StringWriter();
XMLWriter writer=new XMLWriter(stringWriter,formater);
writer.write(xmlDocument);
writer.close();
}catch (IOException e){
e.printStackTrace();
}
return stringWriter.toString();
}
/**
* ่งฃๆๅบurlๅๆฐไธญ็้ฎๅผๅฏน
* ๅฆ "index.jsp?Action=del&id=123"๏ผ่งฃๆๅบAction:del,id:123ๅญๅ
ฅmapไธญ
* @param strUrlParam urlๆฅ่ฏขไธฒ๏ผๆ ผๅผๅฆ๏ผname1=value1&name2=value2
* @return HashMap๏ผget(name1)=value1,get(name2)=value2
*/
public static HashMap<String, String> decodeUrlQueryString(String strUrlParam) {
HashMap<String, String> mapResult = new HashMap<>();
String[] arrSplit;
//ๆฏไธช้ฎๅผไธบไธ็ป
arrSplit = strUrlParam.split("[&]");
for (String strSplit : arrSplit) {
String[] arrSplitEqual;
arrSplitEqual = strSplit.split("[=]");
//่งฃๆๅบ้ฎๅผ
if (arrSplitEqual.length > 1) {
//ๆญฃ็กฎ่งฃๆ
mapResult.put(arrSplitEqual[0], arrSplitEqual[1]);
} else {
if (!arrSplitEqual[0].equals("")) {
//ๅชๆๅๆฐๆฒกๆๅผ๏ผไธๅ ๅ
ฅ
mapResult.put(arrSplitEqual[0], "");
}
}
}
return mapResult;
}
/**
* ่งฃๆๅบurl
* ๅฆ ""http://192.168.1.1:8080/login๏ผ่งฃๆๅบ"BaseUrl:http://192.168.1.1,PathUrl:login"ๅญๅ
ฅmapไธญ
* @param url ๆ ผๅผๅฆ๏ผhttp://192.168.1.1:8080/login
* @return HashMap๏ผget("BaseUrl")=http://192.168.1.1:8080,get('PathUrl")=login
*/
public static HashMap<String, String> decodeUrl(String url) {
HashMap<String, String> mapResult = new HashMap<>();
try {
URL myurl = new URL(url);
mapResult.put("BaseUrl", myurl.getAuthority());
mapResult.put("PathUrl", myurl.getPath());
}catch (MalformedURLException e){
mapResult.put("BaseUrl", "http://192.168.0.1:8080");
mapResult.put("PathUrl", "login");
e.printStackTrace();
}
return mapResult;
}
}
| 9,664 | 0.567001 | 0.550524 | 279 | 31.845879 | 23.236233 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.569892 | false | false | 1 |
1c9e96e672c1934ef44072d9f8d76ad22b5e118b | 14,903,536,532,489 | f342570b19795cd14183cf1eff0f08973676fae6 | /app/src/main/java/com/sky/medialib/ui/kit/view/TimeCountDownView.java | 533a8e861a4a50d21ae6197fc7af32a3890fe233 | [] | no_license | xuzhiyong017/MediaLib | https://github.com/xuzhiyong017/MediaLib | 34e5749a34ef3820e6a79307694cb0feb21904e7 | 42012b49ec61dc68497caf472876aafd43aff22a | refs/heads/master | 2023-07-09T13:13:31.180000 | 2021-08-13T03:19:03 | 2021-08-13T03:19:03 | 390,642,953 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.sky.medialib.ui.kit.view;
import android.content.Context;
import android.os.Handler.Callback;
import android.os.Message;
import android.util.AttributeSet;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.viewpager.widget.ViewPager;
import com.sky.medialib.R;
import com.sky.medialib.ui.kit.common.view.NavigationTabStrip;
import com.sky.medialib.util.UIHelper;
import com.sky.medialib.util.WeakHandler;
public class TimeCountDownView extends FrameLayout {
private final int[] mCountDownResId = new int[]{R.drawable.count_down_1, R.drawable.count_down_2, R.drawable.count_down_3, R.drawable.count_down_4, R.drawable.count_down_5, R.drawable.count_down_6, R.drawable.count_down_7, R.drawable.count_down_8, R.drawable.count_down_9, R.drawable.count_down_10};
private NavigationTabStrip mNavigationTabStrip;
private TextView mTextStart;
private ImageView mImageView;
private int mCount;
private CountDownListener mListener;
private Animation mAnimation;
private int chooseTime;
private int time = 3;
private WeakHandler mHandler = new WeakHandler(new CountDownCallback());
public interface CountDownListener {
void onFinish();
void start();
}
class CountDownCallback implements Callback {
CountDownCallback() {
}
public boolean handleMessage(Message message) {
switch (message.what) {
case 1:
if (TimeCountDownView.this.mCount > 0) {
TimeCountDownView.this.mHandler.sendEmptyMessageDelayed(1, 1000);
TimeCountDownView.this.mCount = TimeCountDownView.this.mCount - 1;
TimeCountDownView.this.mImageView.setImageResource(TimeCountDownView.this.mCountDownResId[TimeCountDownView.this.mCount]);
} else {
TimeCountDownView.this.mImageView.setImageResource(0);
if (TimeCountDownView.this.mListener != null) {
TimeCountDownView.this.mListener.onFinish();
}
}
TimeCountDownView.this.mImageView.startAnimation(TimeCountDownView.this.mAnimation);
break;
}
return true;
}
}
public TimeCountDownView(Context context) {
super(context);
initView();
}
public TimeCountDownView(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
initView();
}
public TimeCountDownView(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
initView();
}
private void initView() {
UIHelper.inflateView(getContext(), R.layout.camera_time_count, this);
this.mNavigationTabStrip = (NavigationTabStrip) findViewById(R.id.count_down_tab);
this.mTextStart = (TextView) findViewById(R.id.count_down_start);
this.mImageView = (ImageView) findViewById(R.id.count_down_animation);
this.mAnimation = AnimationUtils.loadAnimation(getContext(), R.anim.fade_in_then_out);
setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (mImageView.getVisibility() != VISIBLE) {
mCount = 0;
mHandler.removeMessages(1);
setVisibility(GONE);
mNavigationTabStrip.setVisibility(VISIBLE);
mTextStart.setVisibility(VISIBLE);
mImageView.setVisibility(GONE);
if (mListener != null) {
mListener.start();
}
}
}
});
this.mTextStart.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
mCount =time;
chooseTime =time;
mNavigationTabStrip.setVisibility(GONE);
mTextStart.setVisibility(GONE);
mImageView.setVisibility(VISIBLE);
startCountDown();
}
});
this.mNavigationTabStrip.setTabIndex(0);
mNavigationTabStrip.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener(){
@Override
public void onPageSelected(int position) {
switch (position){
case 0:
time = 3;
break;
case 1:
time = 5;
break;
case 2:
time = 10;
break;
}
}
});
mNavigationTabStrip.setTitles("3S","5S","10S");
}
public int getChooseTime() {
return this.chooseTime;
}
public void startCountDown() {
if (this.mCount > 0) {
this.mHandler.sendEmptyMessage(1);
}
}
public void doJob() {
this.mImageView.setImageResource(0);
this.mImageView.clearAnimation();
this.mImageView.setVisibility(GONE);
performClick();
}
public void setCountDownTimeListener(CountDownListener countDownListener) {
this.mListener = countDownListener;
}
}
| UTF-8 | Java | 5,526 | java | TimeCountDownView.java | Java | [] | null | [] | package com.sky.medialib.ui.kit.view;
import android.content.Context;
import android.os.Handler.Callback;
import android.os.Message;
import android.util.AttributeSet;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.viewpager.widget.ViewPager;
import com.sky.medialib.R;
import com.sky.medialib.ui.kit.common.view.NavigationTabStrip;
import com.sky.medialib.util.UIHelper;
import com.sky.medialib.util.WeakHandler;
public class TimeCountDownView extends FrameLayout {
private final int[] mCountDownResId = new int[]{R.drawable.count_down_1, R.drawable.count_down_2, R.drawable.count_down_3, R.drawable.count_down_4, R.drawable.count_down_5, R.drawable.count_down_6, R.drawable.count_down_7, R.drawable.count_down_8, R.drawable.count_down_9, R.drawable.count_down_10};
private NavigationTabStrip mNavigationTabStrip;
private TextView mTextStart;
private ImageView mImageView;
private int mCount;
private CountDownListener mListener;
private Animation mAnimation;
private int chooseTime;
private int time = 3;
private WeakHandler mHandler = new WeakHandler(new CountDownCallback());
public interface CountDownListener {
void onFinish();
void start();
}
class CountDownCallback implements Callback {
CountDownCallback() {
}
public boolean handleMessage(Message message) {
switch (message.what) {
case 1:
if (TimeCountDownView.this.mCount > 0) {
TimeCountDownView.this.mHandler.sendEmptyMessageDelayed(1, 1000);
TimeCountDownView.this.mCount = TimeCountDownView.this.mCount - 1;
TimeCountDownView.this.mImageView.setImageResource(TimeCountDownView.this.mCountDownResId[TimeCountDownView.this.mCount]);
} else {
TimeCountDownView.this.mImageView.setImageResource(0);
if (TimeCountDownView.this.mListener != null) {
TimeCountDownView.this.mListener.onFinish();
}
}
TimeCountDownView.this.mImageView.startAnimation(TimeCountDownView.this.mAnimation);
break;
}
return true;
}
}
public TimeCountDownView(Context context) {
super(context);
initView();
}
public TimeCountDownView(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
initView();
}
public TimeCountDownView(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
initView();
}
private void initView() {
UIHelper.inflateView(getContext(), R.layout.camera_time_count, this);
this.mNavigationTabStrip = (NavigationTabStrip) findViewById(R.id.count_down_tab);
this.mTextStart = (TextView) findViewById(R.id.count_down_start);
this.mImageView = (ImageView) findViewById(R.id.count_down_animation);
this.mAnimation = AnimationUtils.loadAnimation(getContext(), R.anim.fade_in_then_out);
setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (mImageView.getVisibility() != VISIBLE) {
mCount = 0;
mHandler.removeMessages(1);
setVisibility(GONE);
mNavigationTabStrip.setVisibility(VISIBLE);
mTextStart.setVisibility(VISIBLE);
mImageView.setVisibility(GONE);
if (mListener != null) {
mListener.start();
}
}
}
});
this.mTextStart.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
mCount =time;
chooseTime =time;
mNavigationTabStrip.setVisibility(GONE);
mTextStart.setVisibility(GONE);
mImageView.setVisibility(VISIBLE);
startCountDown();
}
});
this.mNavigationTabStrip.setTabIndex(0);
mNavigationTabStrip.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener(){
@Override
public void onPageSelected(int position) {
switch (position){
case 0:
time = 3;
break;
case 1:
time = 5;
break;
case 2:
time = 10;
break;
}
}
});
mNavigationTabStrip.setTitles("3S","5S","10S");
}
public int getChooseTime() {
return this.chooseTime;
}
public void startCountDown() {
if (this.mCount > 0) {
this.mHandler.sendEmptyMessage(1);
}
}
public void doJob() {
this.mImageView.setImageResource(0);
this.mImageView.clearAnimation();
this.mImageView.setVisibility(GONE);
performClick();
}
public void setCountDownTimeListener(CountDownListener countDownListener) {
this.mListener = countDownListener;
}
}
| 5,526 | 0.597177 | 0.5903 | 154 | 34.883118 | 33.637669 | 303 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.642857 | false | false | 1 |
1538c5058f3068d4afa36e10d9379359576179c9 | 7,017,976,593,062 | a34fa5a001e36f38df2eb97d86b670b330d71202 | /springboot_metrics/src/main/java/com/wujun/boot/metrics/HistogramsTest.java | 4010fb9185cbf35e8510e71324f0299dacad0074 | [] | no_license | levonyang/springboot_learning | https://github.com/levonyang/springboot_learning | 595b3df76e0410f0eec29e23e7452edfc9a4a926 | 88373fe14a6c0be63c2135ff1d4e9db5cd54615d | refs/heads/master | 2023-01-20T05:27:58.198000 | 2020-11-26T06:50:47 | 2020-11-26T06:50:47 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.wujun.boot.metrics;
import com.codahale.metrics.ConsoleReporter;
import com.codahale.metrics.ExponentiallyDecayingReservoir;
import com.codahale.metrics.Histogram;
import com.codahale.metrics.MetricRegistry;
import java.util.Random;
import java.util.concurrent.TimeUnit;
/**
* @author wujun
* @description Histogram็ป่ฎกๆฐๆฎ็ๅๅธๆ
ๅตใๆฏๅฆๆๅฐๅผ๏ผๆๅคงๅผ๏ผไธญ้ดๅผ๏ผ่ฟๆไธญไฝๆฐ๏ผ
* 75็พๅไฝ, 90็พๅไฝ, 95็พๅไฝ, 98็พๅไฝ, 99็พๅไฝ, ๅ 99.9็พๅไฝ็ๅผ(percentiles)ใ
* @date 19/1/22.
*/
public class HistogramsTest {
private static Random random = new Random();
public static void main(String[] args) throws InterruptedException {
MetricRegistry registry = new MetricRegistry();
ConsoleReporter reporter = ConsoleReporter.forRegistry(registry).build();
reporter.start(1, TimeUnit.SECONDS);
Histogram histograms = new Histogram(new ExponentiallyDecayingReservoir());
registry.register(MetricRegistry.name(HistogramsTest.class, "request", "histogram"),histograms);
while(true){
Thread.sleep(1000);
histograms.update(random.nextInt(100000));
}
}
}
| UTF-8 | Java | 1,221 | java | HistogramsTest.java | Java | [
{
"context": "ort java.util.concurrent.TimeUnit;\n\n/**\n * @author wujun\n * @description Histogram็ป่ฎกๆฐๆฎ็ๅๅธๆ
ๅตใๆฏๅฆๆๅฐๅผ๏ผๆๅคงๅผ๏ผไธญ้ดๅผ๏ผ",
"end": 306,
"score": 0.9995182156562805,
"start": 301,
"tag": "USERNAME",
"value": "wujun"
}
] | null | [] | package com.wujun.boot.metrics;
import com.codahale.metrics.ConsoleReporter;
import com.codahale.metrics.ExponentiallyDecayingReservoir;
import com.codahale.metrics.Histogram;
import com.codahale.metrics.MetricRegistry;
import java.util.Random;
import java.util.concurrent.TimeUnit;
/**
* @author wujun
* @description Histogram็ป่ฎกๆฐๆฎ็ๅๅธๆ
ๅตใๆฏๅฆๆๅฐๅผ๏ผๆๅคงๅผ๏ผไธญ้ดๅผ๏ผ่ฟๆไธญไฝๆฐ๏ผ
* 75็พๅไฝ, 90็พๅไฝ, 95็พๅไฝ, 98็พๅไฝ, 99็พๅไฝ, ๅ 99.9็พๅไฝ็ๅผ(percentiles)ใ
* @date 19/1/22.
*/
public class HistogramsTest {
private static Random random = new Random();
public static void main(String[] args) throws InterruptedException {
MetricRegistry registry = new MetricRegistry();
ConsoleReporter reporter = ConsoleReporter.forRegistry(registry).build();
reporter.start(1, TimeUnit.SECONDS);
Histogram histograms = new Histogram(new ExponentiallyDecayingReservoir());
registry.register(MetricRegistry.name(HistogramsTest.class, "request", "histogram"),histograms);
while(true){
Thread.sleep(1000);
histograms.update(random.nextInt(100000));
}
}
}
| 1,221 | 0.715309 | 0.689346 | 35 | 30.914286 | 29.017603 | 104 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.685714 | false | false | 1 |
4a6f987eeca6c554c87ca9aacaf0ae00d6d90b1e | 21,423,296,911,542 | 669dac91414ffb1a2f3e8dd0fe53926ac01d62b1 | /app/src/main/java/com/example/david/healthyapp/CustomAdapter.java | 97b64e4b8b76402270b39df2b57f16ed636baebc | [] | no_license | jnancy/Hykr | https://github.com/jnancy/Hykr | 5eff2135cd8757403f8bf9b7703a8ecd7b03847a | f0de8d4301aa32c657333427cbf90d1ea16a5dff | refs/heads/master | 2021-05-12T11:15:01.746000 | 2018-02-09T06:46:46 | 2018-02-09T06:46:46 | 117,382,696 | 2 | 1 | null | false | 2018-02-09T06:47:44 | 2018-01-13T22:15:51 | 2018-01-15T23:01:39 | 2018-02-09T06:46:46 | 6,001 | 1 | 1 | 0 | Java | false | null | package com.example.david.healthyapp;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import java.util.ArrayList;
public class CustomAdapter extends ArrayAdapter<Trail> {
public CustomAdapter(Context context, ArrayList<Trail> trails) {
super(context, R.layout.list_adapter,trails);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
Trail trail = getItem(position);
if (convertView == null) {
convertView = LayoutInflater.from(getContext()).inflate(R.layout.list_adapter, parent, false);
}
TextView firstLine = convertView.findViewById(R.id.firstLine);
TextView secondLine = convertView.findViewById(R.id.secondLine);
firstLine.setText(trail.name);
secondLine.setText(trail.length + " km");
return convertView;
}
}
| UTF-8 | Java | 1,003 | java | CustomAdapter.java | Java | [] | null | [] | package com.example.david.healthyapp;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import java.util.ArrayList;
public class CustomAdapter extends ArrayAdapter<Trail> {
public CustomAdapter(Context context, ArrayList<Trail> trails) {
super(context, R.layout.list_adapter,trails);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
Trail trail = getItem(position);
if (convertView == null) {
convertView = LayoutInflater.from(getContext()).inflate(R.layout.list_adapter, parent, false);
}
TextView firstLine = convertView.findViewById(R.id.firstLine);
TextView secondLine = convertView.findViewById(R.id.secondLine);
firstLine.setText(trail.name);
secondLine.setText(trail.length + " km");
return convertView;
}
}
| 1,003 | 0.713858 | 0.713858 | 31 | 31.354839 | 27.038263 | 106 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.741935 | false | false | 1 |
f4704d72d5f2f93e63448205b1bf55cd34755d9e | 9,586,367,046,367 | 193a87fa407fefdc5158c6b181c06c2cfd9ed272 | /micromall-ware/src/main/java/com/luban/micromall/ware/service/impl/WmsPurchaseDetailServiceImpl.java | 52caa02b26dfd0a682cbc8d212e96af8a94ced28 | [
"Apache-2.0"
] | permissive | pseudopochen/micromall | https://github.com/pseudopochen/micromall | 0764c9134ba99770fa2899625febaefa34c92800 | 23e4e19037ab5ade0e1c522f5f2e174acbad8fe0 | refs/heads/main | 2023-07-10T04:51:50.605000 | 2021-08-21T23:17:57 | 2021-08-21T23:17:57 | 396,962,487 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.luban.micromall.ware.service.impl;
import com.luban.micromall.ware.entity.WmsPurchaseDetail;
import com.luban.micromall.ware.mapper.WmsPurchaseDetailMapper;
import com.luban.micromall.ware.service.IWmsPurchaseDetailService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* ๆๅกๅฎ็ฐ็ฑป
* </p>
*
* @author pochen
* @since 2021-08-21
*/
@Service
public class WmsPurchaseDetailServiceImpl extends ServiceImpl<WmsPurchaseDetailMapper, WmsPurchaseDetail> implements IWmsPurchaseDetailService {
}
| UTF-8 | Java | 595 | java | WmsPurchaseDetailServiceImpl.java | Java | [
{
"context": "rvice;\n\n/**\n * <p>\n * ๆๅกๅฎ็ฐ็ฑป\n * </p>\n *\n * @author pochen\n * @since 2021-08-21\n */\n@Service\npublic class Wm",
"end": 402,
"score": 0.9996641278266907,
"start": 396,
"tag": "USERNAME",
"value": "pochen"
}
] | null | [] | package com.luban.micromall.ware.service.impl;
import com.luban.micromall.ware.entity.WmsPurchaseDetail;
import com.luban.micromall.ware.mapper.WmsPurchaseDetailMapper;
import com.luban.micromall.ware.service.IWmsPurchaseDetailService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* ๆๅกๅฎ็ฐ็ฑป
* </p>
*
* @author pochen
* @since 2021-08-21
*/
@Service
public class WmsPurchaseDetailServiceImpl extends ServiceImpl<WmsPurchaseDetailMapper, WmsPurchaseDetail> implements IWmsPurchaseDetailService {
}
| 595 | 0.811966 | 0.798291 | 20 | 28.25 | 36.06366 | 144 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.35 | false | false | 1 |
ec888065a703b5adab9f0258dee5934897235d33 | 31,353,261,297,817 | 4f8a104f41a8283be0eefdfbc86e099f82416e78 | /src/test/java/pages/SearchPage.java | fcdd83897ec2ffdd226376963b135820439641ca | [] | no_license | k-madalinska/AutomationTestSeleniumJava | https://github.com/k-madalinska/AutomationTestSeleniumJava | 25a733b0b80dac55a978546e9bb19459deb86616 | 98ffc61c812f7231c7d08834b5609c1e0084d94c | refs/heads/master | 2023-03-10T09:12:02.812000 | 2021-02-23T18:44:50 | 2021-02-23T18:44:50 | 341,311,760 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package pages;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import utils.ElementVisibleUtils;
public class SearchPage extends BasePage {
@FindBy(id = "search_query_top")
WebElement searchInput;
@FindBy(className = "button-search")
WebElement searchButton;
@FindBy(className = "product-count")
WebElement searchProductCount;
@FindBy(css = ".right-block > h5:nth-child(1) > a:nth-child(1)")
WebElement resultProductNameBlouse;
@FindBy(css = ".right-block .product-price")
WebElement resultProductPriceBlouse;
public SearchPage(WebDriver driver) {
super(driver);
}
public String resultTextProductPriceBlouse() {
return resultProductPriceBlouse.getText();
}
public String resultSearchProductNameBlouse() {
return resultProductNameBlouse.getText();
}
public void clickOnSearchInput() {
searchInput.click();
}
public void clickOnSearchButton() {
searchButton.click();
}
public void enterSearchInput(String product) {
searchInput.sendKeys(product);
}
public boolean isSearchBlouseDisplayed() {
return isAlertBoxDisplayed(searchProductCount);
}
private boolean isAlertBoxDisplayed(WebElement box) {
return ElementVisibleUtils.isElementVisible(box, wait);
}
}
| UTF-8 | Java | 1,409 | java | SearchPage.java | Java | [] | null | [] | package pages;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import utils.ElementVisibleUtils;
public class SearchPage extends BasePage {
@FindBy(id = "search_query_top")
WebElement searchInput;
@FindBy(className = "button-search")
WebElement searchButton;
@FindBy(className = "product-count")
WebElement searchProductCount;
@FindBy(css = ".right-block > h5:nth-child(1) > a:nth-child(1)")
WebElement resultProductNameBlouse;
@FindBy(css = ".right-block .product-price")
WebElement resultProductPriceBlouse;
public SearchPage(WebDriver driver) {
super(driver);
}
public String resultTextProductPriceBlouse() {
return resultProductPriceBlouse.getText();
}
public String resultSearchProductNameBlouse() {
return resultProductNameBlouse.getText();
}
public void clickOnSearchInput() {
searchInput.click();
}
public void clickOnSearchButton() {
searchButton.click();
}
public void enterSearchInput(String product) {
searchInput.sendKeys(product);
}
public boolean isSearchBlouseDisplayed() {
return isAlertBoxDisplayed(searchProductCount);
}
private boolean isAlertBoxDisplayed(WebElement box) {
return ElementVisibleUtils.isElementVisible(box, wait);
}
}
| 1,409 | 0.701207 | 0.699077 | 56 | 24.160715 | 21.302059 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.339286 | false | false | 1 |
25fde81da6e00653e5911c89828cc20fe4c7b8c6 | 31,353,261,294,131 | a6ba6ed9501e6907c67b461adf2f85af8d1eb0b3 | /service/service-test/src/main/java/com/atguigu/gmall/test/juc/MyTicket.java | ffa8511ad7eddb59a40c4c9e89545381a25859c1 | [] | no_license | corayu/gmall-parent-211 | https://github.com/corayu/gmall-parent-211 | 1097dc390fb6e31952a83f21bd3af3bd5ddec5b7 | 2d69bc932120ce6c61a59a807d9702d935242c1b | refs/heads/master | 2023-01-21T03:21:39.626000 | 2020-11-29T19:08:44 | 2020-11-29T19:08:44 | 309,444,755 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.atguigu.gmall.test.juc;
public class MyTicket {
private Long num = 100l;
public synchronized Long sale(){
num --;
printing();
return num;
}
private synchronized void printing() {
System.out.println(Thread.currentThread().getName()+"ไนฐ่ตฐไบไธๅผ ็ฅจ๏ผ็ฎๅๅฉไฝ็ฅจๆฐ๏ผ"+num);
}
}
| UTF-8 | Java | 363 | java | MyTicket.java | Java | [] | null | [] | package com.atguigu.gmall.test.juc;
public class MyTicket {
private Long num = 100l;
public synchronized Long sale(){
num --;
printing();
return num;
}
private synchronized void printing() {
System.out.println(Thread.currentThread().getName()+"ไนฐ่ตฐไบไธๅผ ็ฅจ๏ผ็ฎๅๅฉไฝ็ฅจๆฐ๏ผ"+num);
}
}
| 363 | 0.597015 | 0.58806 | 23 | 13.565217 | 19.982224 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.26087 | false | false | 1 |
d68c4e8de096320830385f0ffdfa20e04b94f2ae | 6,210,522,756,257 | 0f273b0948631291582c6f6fcdf74aa6ef986714 | /Capstone 1/MdAynulIslamU1Capstone/MdAynulIslamU1Capstone/src/main/java/com/company/MdAynulIslamU1Capstone/dao/SalesTaxRateDao.java | 44be564e39d656c02478a359d29666975e62bfa3 | [] | no_license | mdaynulislam/MdAynul_Islam_JavaS1 | https://github.com/mdaynulislam/MdAynul_Islam_JavaS1 | 64bc9eb55a173d23ca3e2e4c14855de8946b592d | 24310253ab31186e16d34677a5de8a08da0ab67e | refs/heads/master | 2022-02-25T12:31:44.557000 | 2019-10-06T22:27:16 | 2019-10-06T22:27:16 | 198,341,431 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.company.MdAynulIslamU1Capstone.dao;
import com.company.MdAynulIslamU1Capstone.model.SalesTaxRate;
import java.util.List;
public interface SalesTaxRateDao {
//CRUD
SalesTaxRate getSalesTaxRate(String state);
List<SalesTaxRate> getAllSalesTaxRates();
//so far I don't need it; if I do then will implement these
// SalesTaxRate addSalesTaxRate(SalesTaxRate salesTaxRate);
//
// void updateSalesTaxRate(SalesTaxRate salesTaxRate);
//
// void deleteSalesTaxRate(String state);
}
| UTF-8 | Java | 523 | java | SalesTaxRateDao.java | Java | [] | null | [] | package com.company.MdAynulIslamU1Capstone.dao;
import com.company.MdAynulIslamU1Capstone.model.SalesTaxRate;
import java.util.List;
public interface SalesTaxRateDao {
//CRUD
SalesTaxRate getSalesTaxRate(String state);
List<SalesTaxRate> getAllSalesTaxRates();
//so far I don't need it; if I do then will implement these
// SalesTaxRate addSalesTaxRate(SalesTaxRate salesTaxRate);
//
// void updateSalesTaxRate(SalesTaxRate salesTaxRate);
//
// void deleteSalesTaxRate(String state);
}
| 523 | 0.755258 | 0.751434 | 26 | 19.115385 | 24.345789 | 63 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.346154 | false | false | 1 |
1c2990fb818e0929da5283bd41905c7831eef786 | 22,436,909,184,839 | ae87aeb21d4fde8a902b66d4b88815dc34cb1ab9 | /src/main/java/com.botmasterzzz.telegram/dto/CallBackData.java | 83262243d96bd07209a9d25bf8b3800b579d5d12 | [] | no_license | akhunovaa/botmasterzzz-telegram-service | https://github.com/akhunovaa/botmasterzzz-telegram-service | c67bb58339ead5c483e84e3b5c406b941a42ddc2 | 80b292f5b9f323934b394bb3aa302034b6d210f0 | refs/heads/master | 2023-07-17T18:43:11.611000 | 2021-08-29T14:04:23 | 2021-08-29T14:04:23 | 401,053,556 | 1 | 0 | null | false | 2021-08-29T13:58:47 | 2021-08-29T13:50:41 | 2021-08-29T13:57:15 | 2021-08-29T13:58:46 | 0 | 0 | 0 | 0 | Java | false | false | package com.botmasterzzz.telegram.dto;
import java.util.Optional;
public class CallBackData {
private String path;
private Long userId;
private Integer categoryId;
private String ca;
private Integer offset;
private Integer limit;
private Integer l;
private Integer o;
private Integer productId;
private Integer fileCount;
private Integer fileSelected;
private Long fileId;
public CallBackData() {
}
public CallBackData(String path) {
this.path = path;
}
public CallBackData(String path, Long fileId) {
this.path = path;
this.fileId = fileId;
}
public CallBackData(String path, Long userId, Long fileId) {
this.path = path;
this.fileId = fileId;
this.userId = userId;
}
public CallBackData(Long telegramId) {
this.userId = telegramId;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public Integer getCategoryId() {
return categoryId;
}
public void setCategoryId(Integer categoryId) {
this.categoryId = categoryId;
}
public Integer getProductId() {
return productId;
}
public void setProductId(Integer productId) {
this.productId = productId;
}
public Integer getLimit() {
return limit;
}
public void setLimit(Integer limit) {
this.limit = limit;
}
public Integer getOffset(Integer max) {
return Optional.ofNullable(this.offset).orElse(0) > max ? max : Optional.ofNullable(this.offset).orElse(0);
}
public Integer getOffset() {
return offset;
}
public void setOffset(Integer offset) {
this.offset = offset < 0 ? 0 : offset;
}
public Integer getFileCount() {
return fileCount;
}
public void setFileCount(Integer fileCount) {
this.fileCount = fileCount;
}
public Integer getFileSelected() {
return fileSelected;
}
public void setFileSelected(Integer fileSelected) {
this.fileSelected = fileSelected;
}
public String getCa() {
return ca;
}
public void setCa(String ca) {
this.ca = ca;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public Long getFileId() {
return fileId;
}
public void setFileId(Long fileId) {
this.fileId = fileId;
}
public Integer getL() {
return l;
}
public void setL(Integer l) {
this.l = l;
}
public Integer getO() {
return o;
}
public void setO(Integer o) {
this.o = o;
}
@Override
public String toString() {
return "CallBackData{" +
"path='" + path + '\'' +
", userId=" + userId +
", categoryId=" + categoryId +
", ca='" + ca + '\'' +
", offset=" + offset +
", limit=" + limit +
", l=" + l +
", o=" + o +
", productId=" + productId +
", fileCount=" + fileCount +
", fileSelected=" + fileSelected +
", fileId=" + fileId +
'}';
}
}
| UTF-8 | Java | 3,366 | java | CallBackData.java | Java | [] | null | [] | package com.botmasterzzz.telegram.dto;
import java.util.Optional;
public class CallBackData {
private String path;
private Long userId;
private Integer categoryId;
private String ca;
private Integer offset;
private Integer limit;
private Integer l;
private Integer o;
private Integer productId;
private Integer fileCount;
private Integer fileSelected;
private Long fileId;
public CallBackData() {
}
public CallBackData(String path) {
this.path = path;
}
public CallBackData(String path, Long fileId) {
this.path = path;
this.fileId = fileId;
}
public CallBackData(String path, Long userId, Long fileId) {
this.path = path;
this.fileId = fileId;
this.userId = userId;
}
public CallBackData(Long telegramId) {
this.userId = telegramId;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public Integer getCategoryId() {
return categoryId;
}
public void setCategoryId(Integer categoryId) {
this.categoryId = categoryId;
}
public Integer getProductId() {
return productId;
}
public void setProductId(Integer productId) {
this.productId = productId;
}
public Integer getLimit() {
return limit;
}
public void setLimit(Integer limit) {
this.limit = limit;
}
public Integer getOffset(Integer max) {
return Optional.ofNullable(this.offset).orElse(0) > max ? max : Optional.ofNullable(this.offset).orElse(0);
}
public Integer getOffset() {
return offset;
}
public void setOffset(Integer offset) {
this.offset = offset < 0 ? 0 : offset;
}
public Integer getFileCount() {
return fileCount;
}
public void setFileCount(Integer fileCount) {
this.fileCount = fileCount;
}
public Integer getFileSelected() {
return fileSelected;
}
public void setFileSelected(Integer fileSelected) {
this.fileSelected = fileSelected;
}
public String getCa() {
return ca;
}
public void setCa(String ca) {
this.ca = ca;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public Long getFileId() {
return fileId;
}
public void setFileId(Long fileId) {
this.fileId = fileId;
}
public Integer getL() {
return l;
}
public void setL(Integer l) {
this.l = l;
}
public Integer getO() {
return o;
}
public void setO(Integer o) {
this.o = o;
}
@Override
public String toString() {
return "CallBackData{" +
"path='" + path + '\'' +
", userId=" + userId +
", categoryId=" + categoryId +
", ca='" + ca + '\'' +
", offset=" + offset +
", limit=" + limit +
", l=" + l +
", o=" + o +
", productId=" + productId +
", fileCount=" + fileCount +
", fileSelected=" + fileSelected +
", fileId=" + fileId +
'}';
}
}
| 3,366 | 0.549317 | 0.548128 | 159 | 20.169811 | 17.967899 | 115 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.383648 | false | false | 1 |
82bc449cf820938054fcd89cc9df4a100b02794f | 4,294,967,344,833 | eb3ca2b9af3901eb350a192f2c7c07bce44cdb06 | /DICETrackerAnalysis/src/dicetrackeranalysis/graphhandling/FilterByIsUniqueEdge.java | b28ed66c19501955c11a650a7af75bb6339652c6 | [] | no_license | leebeckman/DICE | https://github.com/leebeckman/DICE | 8733a5911f680ee34140c00938581e1d036ff68e | 6db31b0a613372da0a5bd9745a149230f88f26a3 | refs/heads/master | 2021-01-20T23:32:02.757000 | 2013-07-23T06:14:13 | 2013-07-23T06:14:13 | 3,228,446 | 2 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package dicetrackeranalysis.graphhandling;
import java.util.HashSet;
/**
*
* @author lee
*/
public class FilterByIsUniqueEdge implements EdgeFilter {
private HashSet<String> foundEdges;
public FilterByIsUniqueEdge() {
foundEdges = new HashSet<String>();
}
public boolean pass(TaintEdge input) {
if (!foundEdges.contains(input.getNonCounterString())) {
foundEdges.add(input.getNonCounterString());
return true;
}
else {
return false;
}
}
}
| UTF-8 | Java | 645 | java | FilterByIsUniqueEdge.java | Java | [
{
"context": "ing;\n\nimport java.util.HashSet;\n\n/**\n *\n * @author lee\n */\npublic class FilterByIsUniqueEdge implements ",
"end": 193,
"score": 0.9986721277236938,
"start": 190,
"tag": "USERNAME",
"value": "lee"
}
] | null | [] | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package dicetrackeranalysis.graphhandling;
import java.util.HashSet;
/**
*
* @author lee
*/
public class FilterByIsUniqueEdge implements EdgeFilter {
private HashSet<String> foundEdges;
public FilterByIsUniqueEdge() {
foundEdges = new HashSet<String>();
}
public boolean pass(TaintEdge input) {
if (!foundEdges.contains(input.getNonCounterString())) {
foundEdges.add(input.getNonCounterString());
return true;
}
else {
return false;
}
}
}
| 645 | 0.632558 | 0.632558 | 32 | 19.15625 | 20.579281 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.28125 | false | false | 1 |
76066335676b09fa06cbe3198301870a975ef935 | 36,747,740,191,198 | 7fa82ec1100e9b4b47ddf91debd2767270dd9112 | /src/_11_day_hashCode/_02_getClassๆนๆณ/getClassๆนๆณ.java | 30c1fb8043192a494e1ff9bb048ae790bb541559 | [] | no_license | Fongyitao/JavaBase | https://github.com/Fongyitao/JavaBase | efb9e07f5461d60675c5abb98d3866e1b787b2ce | 750e32e6c32dcbc8be22dc348458e488ece26c7c | refs/heads/master | 2021-08-27T22:18:38.072000 | 2017-12-10T14:23:59 | 2017-12-10T14:24:02 | 113,713,240 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package _11_day_hashCode._02_getClassๆนๆณ;
public class getClassๆนๆณ {
public static void main(String[] args) {
Person p1 = new Person("ๅผ ไธ",18);
p1.sayHi();
Class clazz = p1.getClass(); // ่ทๅ่ฏฅๅฏน่ฑก็ๅญ่็ ๆไปถ
String name = clazz.getName();
System.out.println(name); // _11_day._002_getClassๆนๆณ.Person
}
}
| UTF-8 | Java | 384 | java | getClassๆนๆณ.java | Java | [
{
"context": "(String[] args) {\n Person p1 = new Person(\"ๅผ ไธ\",18);\n p1.sayHi();\n\n Class clazz = ",
"end": 147,
"score": 0.9996674060821533,
"start": 145,
"tag": "NAME",
"value": "ๅผ ไธ"
}
] | null | [] | package _11_day_hashCode._02_getClassๆนๆณ;
public class getClassๆนๆณ {
public static void main(String[] args) {
Person p1 = new Person("ๅผ ไธ",18);
p1.sayHi();
Class clazz = p1.getClass(); // ่ทๅ่ฏฅๅฏน่ฑก็ๅญ่็ ๆไปถ
String name = clazz.getName();
System.out.println(name); // _11_day._002_getClassๆนๆณ.Person
}
}
| 384 | 0.601156 | 0.560694 | 13 | 25.615385 | 22.303978 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.538462 | false | false | 1 |
336fd1a8167a01e1b2d4092e5aac67f54e59761e | 9,165,460,245,208 | 1a8457e19bedf378008259c631db7658f000e792 | /src/main/java/com/in28minutes/springboot/controller/rest/CustomerController.java | 995514985b1aa150e3783905728c609f9a8425e3 | [] | no_license | bradmanGitHub/SpringBootCommonProject | https://github.com/bradmanGitHub/SpringBootCommonProject | fc1a13ae41d9df5e541eeb99806dd715eada5ce8 | 588536c2cbe627d5ebce6d4056e7c4928afe0548 | refs/heads/master | 2020-03-19T13:03:33.082000 | 2018-06-08T02:51:43 | 2018-06-08T02:51:43 | 136,557,817 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.in28minutes.springboot.controller.rest;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import com.in28minutes.springboot.model.Customer;
import com.in28minutes.springboot.model.mapper.CustomerAddressMapper;
import com.in28minutes.springboot.service.CustomerService;
@RestController
public class CustomerController {
@Autowired
private CustomerService customerService;
@GetMapping("/customer/customers")
public List<CustomerAddressMapper> retrieveQuestionsForSurvey(){
return customerService.getAllCustomer();
}
@GetMapping("/customer/customers2")
public List<Customer> retrieveQuestionsForSurvey2(){
return customerService.getAllCustomer2();
}
@GetMapping("/customer/addnew")
public void addNewCustomer(){
customerService.addNewCustomer();
}
}
| UTF-8 | Java | 948 | java | CustomerController.java | Java | [] | null | [] | package com.in28minutes.springboot.controller.rest;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import com.in28minutes.springboot.model.Customer;
import com.in28minutes.springboot.model.mapper.CustomerAddressMapper;
import com.in28minutes.springboot.service.CustomerService;
@RestController
public class CustomerController {
@Autowired
private CustomerService customerService;
@GetMapping("/customer/customers")
public List<CustomerAddressMapper> retrieveQuestionsForSurvey(){
return customerService.getAllCustomer();
}
@GetMapping("/customer/customers2")
public List<Customer> retrieveQuestionsForSurvey2(){
return customerService.getAllCustomer2();
}
@GetMapping("/customer/addnew")
public void addNewCustomer(){
customerService.addNewCustomer();
}
}
| 948 | 0.817511 | 0.805907 | 34 | 26.882353 | 23.975189 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false | 1 |
38098581d4e448d85e36077292a21d8c59e6b6eb | 35,631,048,700,146 | 0ce7298a23a84831d6e7215435038dc8cfcdd605 | /src/test/java/com/example/demo/logging/LoggingControllerTest.java | ff1277e06917679bbe8f863a034f56903145356d | [] | no_license | mefernandez/spring-dynamic-profiles | https://github.com/mefernandez/spring-dynamic-profiles | e0096e374837796af64f7b3c4be5da066054f041 | 6393744648e1ec354e44d87d0b71cbfa682242f9 | refs/heads/main | 2023-01-19T00:35:04.105000 | 2020-11-24T14:34:12 | 2020-11-24T14:34:12 | 311,454,399 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.demo.logging;
import static org.junit.jupiter.api.Assertions.*;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MockMvc;
@SpringBootTest
@AutoConfigureMockMvc
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
class LoggingControllerTest {
@Autowired
private LoggingController controller;
@Autowired
private MockMvc mvc;
@Order(0)
@Test
void testInitialLevels() {
assertTrue(controller.isErrorEnabled());
assertTrue(controller.isWarnEnabled());
assertTrue(controller.isInfoEnabled());
assertFalse(controller.isDebugEnabled());
assertFalse(controller.isTraceEnabled());
}
@Order(1)
@Test
void testLogWithInitialLogLevels() throws Exception {
mvc.perform(get("/log"))
.andExpect(status().isOk())
.andExpect(content().string("See the log for details"));
}
@Order(2)
@Test
void testChangeLogLevelToTraceAndLog() throws Exception {
mvc.perform(
post("/actuator/loggers/com.example.demo.logging")
.contentType(MediaType.APPLICATION_JSON)
.content("{\"configuredLevel\": \"TRACE\"}")
)
.andExpect(status().isNoContent());
mvc.perform(get("/log"))
.andExpect(status().isOk())
.andExpect(content().string("See the log for details"));
assertTrue(controller.isErrorEnabled());
assertTrue(controller.isWarnEnabled());
assertTrue(controller.isInfoEnabled());
assertTrue(controller.isDebugEnabled());
assertTrue(controller.isTraceEnabled());
}
}
| UTF-8 | Java | 2,021 | java | LoggingControllerTest.java | Java | [] | null | [] | package com.example.demo.logging;
import static org.junit.jupiter.api.Assertions.*;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MockMvc;
@SpringBootTest
@AutoConfigureMockMvc
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
class LoggingControllerTest {
@Autowired
private LoggingController controller;
@Autowired
private MockMvc mvc;
@Order(0)
@Test
void testInitialLevels() {
assertTrue(controller.isErrorEnabled());
assertTrue(controller.isWarnEnabled());
assertTrue(controller.isInfoEnabled());
assertFalse(controller.isDebugEnabled());
assertFalse(controller.isTraceEnabled());
}
@Order(1)
@Test
void testLogWithInitialLogLevels() throws Exception {
mvc.perform(get("/log"))
.andExpect(status().isOk())
.andExpect(content().string("See the log for details"));
}
@Order(2)
@Test
void testChangeLogLevelToTraceAndLog() throws Exception {
mvc.perform(
post("/actuator/loggers/com.example.demo.logging")
.contentType(MediaType.APPLICATION_JSON)
.content("{\"configuredLevel\": \"TRACE\"}")
)
.andExpect(status().isNoContent());
mvc.perform(get("/log"))
.andExpect(status().isOk())
.andExpect(content().string("See the log for details"));
assertTrue(controller.isErrorEnabled());
assertTrue(controller.isWarnEnabled());
assertTrue(controller.isInfoEnabled());
assertTrue(controller.isDebugEnabled());
assertTrue(controller.isTraceEnabled());
}
}
| 2,021 | 0.772885 | 0.7714 | 66 | 29.621212 | 22.986008 | 84 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.621212 | false | false | 1 |
39952f0b8b702079c77f61b8e4112a1812944f17 | 34,402,688,076,209 | 423eb715eaf73e61c4d2354e19e8fc534e36751d | /src/test/java/ca/timisencotech/projectmanagementapis/domainTest/SupervisorAppraisalsTest.java | 383c86eff55695dc16453dfed6fec2e62306331d | [] | no_license | timisenco2015/ProjectManagementAPIs | https://github.com/timisenco2015/ProjectManagementAPIs | 3f352b2b9778a35a14193002f5091955dae12adc | 2d06bd8ebe18d3ba6e850d35485379d4935791b6 | refs/heads/master | 2023-04-29T20:03:37.018000 | 2019-09-23T17:19:03 | 2019-09-23T17:19:03 | 197,971,707 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ca.timisencotech.projectmanagementapis.domainTest;
import static org.junit.Assert.assertEquals;
import java.sql.Timestamp;
import java.util.Date;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import ca.timisencotech.projectmanagementapis.domain.SupervisorAppraisals;
@RunWith(SpringRunner.class)
@SpringBootTest
public class SupervisorAppraisalsTest
{
@Test
public void testSettersGetters()
{
Date date= new Date();
SupervisorAppraisals supervisorAppraisals=new SupervisorAppraisals();
supervisorAppraisals.setStandardA("QuestionA");
supervisorAppraisals.setStandardAPoint(4);
supervisorAppraisals.setStandardB("QuestionB");
supervisorAppraisals.setStandardBPoint(3);
supervisorAppraisals.setStandardC("QuestionC");
supervisorAppraisals.setStandardCPoint(4);
supervisorAppraisals.setStandardD("QuestionD");
supervisorAppraisals.setStandardDPoint(2);
supervisorAppraisals.setStandardE("QuestionE");
supervisorAppraisals.setStandardEPoint(3);
supervisorAppraisals.setStandardF("QuestionF");
supervisorAppraisals.setStandardFPoint(4);
supervisorAppraisals.setStandardG("QuestionG");
supervisorAppraisals.setStandardGPoint(5);
supervisorAppraisals.setStandardH("QuestionH");
supervisorAppraisals.setStandardHPoint(2);
supervisorAppraisals.setStandardI("QuestionI");
supervisorAppraisals.setStandardIPoint(1);
supervisorAppraisals.setStandardJ("QuestionJ");
supervisorAppraisals.setStandardJPoint(2);
supervisorAppraisals.setSupervisorName("userAEmail@gmail.com");
supervisorAppraisals.setSubordinateMember("userHEmail@gmail.com");
supervisorAppraisals.setTaskName("Sub Task1");
supervisorAppraisals.setProjectName("Sherwood Project");
supervisorAppraisals.setDescription("fdgdjdydtf");
Timestamp appraisedStartDate = new Timestamp(date.getTime());
supervisorAppraisals.setAppraisedStartDate(appraisedStartDate);
Timestamp appraisedEndDate = new Timestamp(date.getTime());
supervisorAppraisals.setAppraisedEndDate(appraisedEndDate);
assertEquals("QuestionA", supervisorAppraisals.getStandardA());
assertEquals(4, supervisorAppraisals.getStandardAPoint());
assertEquals("QuestionB",supervisorAppraisals.getStandardB());
assertEquals(3, supervisorAppraisals.getStandardBPoint());
assertEquals("QuestionC", supervisorAppraisals.getStandardC());
assertEquals(4, supervisorAppraisals.getStandardCPoint());
assertEquals("QuestionD", supervisorAppraisals.getStandardD());
assertEquals(2, supervisorAppraisals.getStandardDPoint());
assertEquals("QuestionE", supervisorAppraisals.getStandardE());
assertEquals(3, supervisorAppraisals.getStandardEPoint());
assertEquals("QuestionF", supervisorAppraisals.getStandardF());
assertEquals(4, supervisorAppraisals.getStandardFPoint());
assertEquals("QuestionH", supervisorAppraisals.getStandardH());
assertEquals(2, supervisorAppraisals.getStandardHPoint());
assertEquals("QuestionI", supervisorAppraisals.getStandardI());
assertEquals(1, supervisorAppraisals.getStandardIPoint());
assertEquals("QuestionJ", supervisorAppraisals.getStandardJ());
assertEquals(2, supervisorAppraisals.getStandardJPoint());
assertEquals("QuestionG", supervisorAppraisals.getStandardG());
assertEquals(5, supervisorAppraisals.getStandardGPoint());
assertEquals(appraisedEndDate, supervisorAppraisals.getAppraisedEndDate());
assertEquals(appraisedStartDate, supervisorAppraisals.getAppraisedStartDate());
assertEquals("userAEmail@gmail.com", supervisorAppraisals.getSupervisorName());
assertEquals("userHEmail@gmail.com", supervisorAppraisals.getSubordinateMember());
assertEquals("Sub Task1", supervisorAppraisals.getTaskName());
}
}
| UTF-8 | Java | 3,887 | java | SupervisorAppraisalsTest.java | Java | [
{
"context": "nt(2);\n\t\t\tsupervisorAppraisals.setSupervisorName(\"userAEmail@gmail.com\");\n\t\t\tsupervisorAppraisals.setSubordinateMember(\"",
"end": 1678,
"score": 0.9999132752418518,
"start": 1658,
"tag": "EMAIL",
"value": "userAEmail@gmail.com"
},
{
"context": "\");\n\t\t\tsupervisorAppraisals.setSubordinateMember(\"userHEmail@gmail.com\");\n\t\t\tsupervisorAppraisals.setTaskName(\"Sub Task1",
"end": 1748,
"score": 0.9999149441719055,
"start": 1728,
"tag": "EMAIL",
"value": "userHEmail@gmail.com"
},
{
"context": "AppraisedStartDate());\n\t\t\tassertEquals(\"userAEmail@gmail.com\", supervisorAppraisals.getSupervisorName());\n\t\t\ta",
"end": 3677,
"score": 0.9999312162399292,
"start": 3667,
"tag": "EMAIL",
"value": "@gmail.com"
},
{
"context": "Appraisals.getSupervisorName());\n\t\t\tassertEquals(\"userHEmail@gmail.com\", supervisorAppraisals.getSubordinateMember());\n\t",
"end": 3760,
"score": 0.9999179840087891,
"start": 3740,
"tag": "EMAIL",
"value": "userHEmail@gmail.com"
}
] | null | [] | package ca.timisencotech.projectmanagementapis.domainTest;
import static org.junit.Assert.assertEquals;
import java.sql.Timestamp;
import java.util.Date;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import ca.timisencotech.projectmanagementapis.domain.SupervisorAppraisals;
@RunWith(SpringRunner.class)
@SpringBootTest
public class SupervisorAppraisalsTest
{
@Test
public void testSettersGetters()
{
Date date= new Date();
SupervisorAppraisals supervisorAppraisals=new SupervisorAppraisals();
supervisorAppraisals.setStandardA("QuestionA");
supervisorAppraisals.setStandardAPoint(4);
supervisorAppraisals.setStandardB("QuestionB");
supervisorAppraisals.setStandardBPoint(3);
supervisorAppraisals.setStandardC("QuestionC");
supervisorAppraisals.setStandardCPoint(4);
supervisorAppraisals.setStandardD("QuestionD");
supervisorAppraisals.setStandardDPoint(2);
supervisorAppraisals.setStandardE("QuestionE");
supervisorAppraisals.setStandardEPoint(3);
supervisorAppraisals.setStandardF("QuestionF");
supervisorAppraisals.setStandardFPoint(4);
supervisorAppraisals.setStandardG("QuestionG");
supervisorAppraisals.setStandardGPoint(5);
supervisorAppraisals.setStandardH("QuestionH");
supervisorAppraisals.setStandardHPoint(2);
supervisorAppraisals.setStandardI("QuestionI");
supervisorAppraisals.setStandardIPoint(1);
supervisorAppraisals.setStandardJ("QuestionJ");
supervisorAppraisals.setStandardJPoint(2);
supervisorAppraisals.setSupervisorName("<EMAIL>");
supervisorAppraisals.setSubordinateMember("<EMAIL>");
supervisorAppraisals.setTaskName("Sub Task1");
supervisorAppraisals.setProjectName("Sherwood Project");
supervisorAppraisals.setDescription("fdgdjdydtf");
Timestamp appraisedStartDate = new Timestamp(date.getTime());
supervisorAppraisals.setAppraisedStartDate(appraisedStartDate);
Timestamp appraisedEndDate = new Timestamp(date.getTime());
supervisorAppraisals.setAppraisedEndDate(appraisedEndDate);
assertEquals("QuestionA", supervisorAppraisals.getStandardA());
assertEquals(4, supervisorAppraisals.getStandardAPoint());
assertEquals("QuestionB",supervisorAppraisals.getStandardB());
assertEquals(3, supervisorAppraisals.getStandardBPoint());
assertEquals("QuestionC", supervisorAppraisals.getStandardC());
assertEquals(4, supervisorAppraisals.getStandardCPoint());
assertEquals("QuestionD", supervisorAppraisals.getStandardD());
assertEquals(2, supervisorAppraisals.getStandardDPoint());
assertEquals("QuestionE", supervisorAppraisals.getStandardE());
assertEquals(3, supervisorAppraisals.getStandardEPoint());
assertEquals("QuestionF", supervisorAppraisals.getStandardF());
assertEquals(4, supervisorAppraisals.getStandardFPoint());
assertEquals("QuestionH", supervisorAppraisals.getStandardH());
assertEquals(2, supervisorAppraisals.getStandardHPoint());
assertEquals("QuestionI", supervisorAppraisals.getStandardI());
assertEquals(1, supervisorAppraisals.getStandardIPoint());
assertEquals("QuestionJ", supervisorAppraisals.getStandardJ());
assertEquals(2, supervisorAppraisals.getStandardJPoint());
assertEquals("QuestionG", supervisorAppraisals.getStandardG());
assertEquals(5, supervisorAppraisals.getStandardGPoint());
assertEquals(appraisedEndDate, supervisorAppraisals.getAppraisedEndDate());
assertEquals(appraisedStartDate, supervisorAppraisals.getAppraisedStartDate());
assertEquals("userAEmail<EMAIL>", supervisorAppraisals.getSupervisorName());
assertEquals("<EMAIL>", supervisorAppraisals.getSubordinateMember());
assertEquals("Sub Task1", supervisorAppraisals.getTaskName());
}
}
| 3,845 | 0.806792 | 0.800875 | 89 | 42.674156 | 25.723148 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.089888 | false | false | 1 |
7c2f05881cad34f538241bd764787d847c397a6c | 36,532,991,839,514 | 8d1e2e3184164d9f1ce324e3b91b0decf70a2799 | /device-samples/archive/simulator-java/src/main/java/com/devices/simulator/Dispositivo.java | 92095b8ca4365e31b547bc57ecfacdc154edbc67 | [
"MIT"
] | permissive | RedRoundRobin/swe-gateway | https://github.com/RedRoundRobin/swe-gateway | c46d9b2c4f3257f1e502b1bc839aa345afe3ed63 | c46a5342b213fa4606e165e0df270ec029d1583a | refs/heads/develop | 2022-07-03T14:47:04.489000 | 2020-05-15T10:20:01 | 2020-05-15T10:20:01 | 240,958,943 | 0 | 1 | MIT | false | 2020-05-15T10:22:11 | 2020-02-16T20:14:41 | 2020-05-15T10:20:05 | 2020-05-15T10:22:11 | 442 | 1 | 1 | 3 | Java | false | false | package com.devices.simulator;
import java.util.List;
public class Dispositivo {
private int id;
private List<Sensore> sensori;
public Dispositivo(int id, List<Sensore> sensori) {
this.id = id;
this.sensori = sensori;
}
public int ottieniId() {
return id;
}
public List<Sensore> ottieniSensori() {
return sensori;
}
}
| UTF-8 | Java | 387 | java | Dispositivo.java | Java | [] | null | [] | package com.devices.simulator;
import java.util.List;
public class Dispositivo {
private int id;
private List<Sensore> sensori;
public Dispositivo(int id, List<Sensore> sensori) {
this.id = id;
this.sensori = sensori;
}
public int ottieniId() {
return id;
}
public List<Sensore> ottieniSensori() {
return sensori;
}
}
| 387 | 0.617571 | 0.617571 | 21 | 17.428572 | 15.71645 | 55 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.428571 | false | false | 1 |
c3d131b8716e33fd1d67819009dd424d3ee86064 | 30,760,555,824,499 | 95b147d3d51792c8804ccb305a947800b0c27252 | /src/main/java/com/poncethecat/iAdmin/listeners/TriviaListener.java | 700c3ff3b0b084516fb9f3b1dca8d7d4a20156a7 | [] | no_license | Track44/iAdmin | https://github.com/Track44/iAdmin | c62e1d0d7597e81b6bddee352810bd8ce8cf159b | 65c68da37deae02b8d5109a91fc968b4cb9fd4b3 | refs/heads/master | 2020-12-05T05:38:03.244000 | 2016-11-19T02:15:30 | 2016-11-19T02:15:30 | 67,651,662 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.poncethecat.iAdmin.listeners;
import sx.blah.discord.api.events.EventSubscriber;
import sx.blah.discord.handle.impl.events.MessageReceivedEvent;
import java.util.concurrent.atomic.AtomicBoolean;
public class TriviaListener {
AtomicBoolean triviaGameGoingOn = new AtomicBoolean(false);
AtomicBoolean nextQuestion = new AtomicBoolean(false);
@EventSubscriber
public void onMessage(MessageReceivedEvent event) {
}
}
| UTF-8 | Java | 454 | java | TriviaListener.java | Java | [] | null | [] | package com.poncethecat.iAdmin.listeners;
import sx.blah.discord.api.events.EventSubscriber;
import sx.blah.discord.handle.impl.events.MessageReceivedEvent;
import java.util.concurrent.atomic.AtomicBoolean;
public class TriviaListener {
AtomicBoolean triviaGameGoingOn = new AtomicBoolean(false);
AtomicBoolean nextQuestion = new AtomicBoolean(false);
@EventSubscriber
public void onMessage(MessageReceivedEvent event) {
}
}
| 454 | 0.788546 | 0.788546 | 20 | 21.700001 | 25.25688 | 63 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.3 | false | false | 1 |
1de3e47482db0e06a238774450cbd7b380c0872a | 4,844,723,134,033 | 14c29c0f5610271d19a03c99941523d45696dbfc | /app/src/main/java/com/semanientreprise/steemnotes/loggedIn.java | ec253fddf417437cac2f64c4e4ffcdc8e3ca5fa3 | [
"MIT"
] | permissive | generalkolo/steemnotes | https://github.com/generalkolo/steemnotes | 99f2b883aecf061a303dc9490973001edb3bd056 | 84c2b0163428f2d7768315dc6dc4d464ce764608 | refs/heads/master | 2020-03-19T03:31:04.119000 | 2018-07-05T15:43:23 | 2018-07-05T15:43:23 | 135,735,371 | 0 | 1 | MIT | false | 2018-07-05T12:17:32 | 2018-06-01T15:37:45 | 2018-06-13T01:54:33 | 2018-07-05T12:17:32 | 146 | 0 | 1 | 0 | Java | false | null | package com.semanientreprise.steemnotes;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.widget.Button;
import com.semanientreprise.steemnotes.screens.account.activity.AccountActivity;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
public class loggedIn extends AppCompatActivity {
@BindView(R.id.btn_go)
Button btnGo;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_logged_in);
ButterKnife.bind(this);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
}
@OnClick(R.id.btn_go)
public void onViewClicked() {
startActivity(new Intent(loggedIn.this,AccountActivity.class));
}
}
| UTF-8 | Java | 929 | java | loggedIn.java | Java | [] | null | [] | package com.semanientreprise.steemnotes;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.widget.Button;
import com.semanientreprise.steemnotes.screens.account.activity.AccountActivity;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
public class loggedIn extends AppCompatActivity {
@BindView(R.id.btn_go)
Button btnGo;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_logged_in);
ButterKnife.bind(this);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
}
@OnClick(R.id.btn_go)
public void onViewClicked() {
startActivity(new Intent(loggedIn.this,AccountActivity.class));
}
}
| 929 | 0.751346 | 0.749193 | 33 | 27.151516 | 21.788406 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.545455 | false | false | 1 |
20293d3d07cdba92e2d0d169cd62f263ca06e022 | 35,802,847,395,903 | 4f67af90d21d465a1b214a67f0b9f692b1b6ae07 | /cesium-gwt-main/src/main/java/org/cesiumjs/cesium/Cartesian4.java | 47d5b33b0bb271f0c9d419fb89e6c54e8c99207b | [
"Apache-2.0"
] | permissive | richkadel/cesium-gwt | https://github.com/richkadel/cesium-gwt | 9f1b13342b19f74ed01d7d7a14abccc940907ebc | 6910f4f1ac5515a32cb4ea4f51ae8f338f0b33b9 | refs/heads/master | 2021-01-10T21:05:16.172000 | 2015-07-06T18:44:16 | 2015-07-06T18:44:16 | 21,529,835 | 9 | 11 | null | false | 2015-03-31T19:47:48 | 2014-07-05T23:14:52 | 2014-12-01T14:49:45 | 2015-02-07T23:53:34 | 37,504 | 8 | 2 | 1 | JavaScript | null | null | package org.cesiumjs.cesium;
import com.google.gwt.core.client.JavaScriptObject;
/**
* @author richkadel
*
*/
public final class Cartesian4 extends JavaScriptObject {
// Overlay types always have protected, zero argument constructors.
protected Cartesian4(){}
public static native Cartesian4 create(double x, double y, double z, double w) /*-{
return Cesium.Cartesian4.fromArray([x, y, z, w])
}-*/;
public native void setX(double x) /*-{ this.x = x; }-*/;
public native double getX() /*-{ return this.x; }-*/;
public native void setY(double y) /*-{ this.y = y; }-*/;
public native double getY() /*-{ return this.y; }-*/;
public native void setZ(double z) /*-{ this.z = z; }-*/;
public native double getZ() /*-{ return this.z; }-*/;
public native void setW(double w) /*-{ this.w = w; }-*/;
public native double getW() /*-{ return this.w; }-*/;
public native boolean equals(Cartesian4 right) /*-{ return this.equals(right) }-*/;
} | UTF-8 | Java | 981 | java | Cartesian4.java | Java | [
{
"context": ".gwt.core.client.JavaScriptObject;\n\n/**\n * @author richkadel\n *\n */\npublic final class Cartesian4 extends Java",
"end": 107,
"score": 0.9992445111274719,
"start": 98,
"tag": "USERNAME",
"value": "richkadel"
}
] | null | [] | package org.cesiumjs.cesium;
import com.google.gwt.core.client.JavaScriptObject;
/**
* @author richkadel
*
*/
public final class Cartesian4 extends JavaScriptObject {
// Overlay types always have protected, zero argument constructors.
protected Cartesian4(){}
public static native Cartesian4 create(double x, double y, double z, double w) /*-{
return Cesium.Cartesian4.fromArray([x, y, z, w])
}-*/;
public native void setX(double x) /*-{ this.x = x; }-*/;
public native double getX() /*-{ return this.x; }-*/;
public native void setY(double y) /*-{ this.y = y; }-*/;
public native double getY() /*-{ return this.y; }-*/;
public native void setZ(double z) /*-{ this.z = z; }-*/;
public native double getZ() /*-{ return this.z; }-*/;
public native void setW(double w) /*-{ this.w = w; }-*/;
public native double getW() /*-{ return this.w; }-*/;
public native boolean equals(Cartesian4 right) /*-{ return this.equals(right) }-*/;
} | 981 | 0.640163 | 0.635066 | 30 | 31.733334 | 28.840866 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.9 | false | false | 1 |
249f07257ec0fe72398193e7387e215ad31b13d8 | 6,184,752,965,452 | 0307f0bffa6aa0772446b90be3b3c1b3d263e35e | /study-dataaccess/breadkey/with-maven/jpa/src/main/java/pokemon/business/service/PokemonSpecDao.java | 695a57fc825fe518cdeeb57aba9e3b0bfa9db0b5 | [] | no_license | study-return-study/spring-study | https://github.com/study-return-study/spring-study | 6bc1475e40b5c3f4c5d81ba4933967c942e565e1 | a7b8e28d9f6370ed72757b970eae5b4198f29abf | refs/heads/master | 2020-04-16T22:34:23.978000 | 2019-03-12T12:22:55 | 2019-03-12T12:22:55 | 165,974,205 | 0 | 0 | null | false | 2019-03-12T12:22:56 | 2019-01-16T04:34:15 | 2019-01-24T12:32:58 | 2019-03-12T12:22:56 | 52 | 0 | 0 | 0 | Java | false | null | package pokemon.business.service;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import pokemon.business.domain.PokemonSpec;
@Repository
public interface PokemonSpecDao extends JpaRepository<PokemonSpec, Integer> {
@Query
PokemonSpec findByIndexNumber(Integer indexNumber);
}
| UTF-8 | Java | 405 | java | PokemonSpecDao.java | Java | [] | null | [] | package pokemon.business.service;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import pokemon.business.domain.PokemonSpec;
@Repository
public interface PokemonSpecDao extends JpaRepository<PokemonSpec, Integer> {
@Query
PokemonSpec findByIndexNumber(Integer indexNumber);
}
| 405 | 0.837037 | 0.837037 | 12 | 32.75 | 26.099569 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.583333 | false | false | 1 |
418e0bb27db83060a055c262b0b7ffc430cabaa1 | 37,271,726,209,969 | aa8c3212d3c167976bb8604a3752ded60a41dd5e | /src/main/java/com/hendisantika/service/LibraryService.java | 6a438318c9aaab35e3f79147d520937666198063 | [] | no_license | hendisantika/quarkus-integration-test2 | https://github.com/hendisantika/quarkus-integration-test2 | 9f17e3882de51cac8be68c96130519ffe72f8ffb | 739b200486de6961864832cdb80be1777fbc9d96 | refs/heads/main | 2023-08-22T05:16:24.911000 | 2021-10-24T14:39:27 | 2021-10-24T14:39:27 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.hendisantika.service;
import com.hendisantika.model.Book;
import com.hendisantika.repository.BookRepository;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import javax.transaction.Transactional;
import java.util.Set;
import static java.util.stream.Collectors.toSet;
/**
* Created by IntelliJ IDEA.
* Project : quarkus-integration-test2
* User: hendisantika
* Email: hendisantika@gmail.com
* Telegram : @hendisantika34
* Date: 24/10/21
* Time: 21.08
*/
@Transactional
@ApplicationScoped
public class LibraryService {
@Inject
BookRepository bookRepository;
public Set<Book> find(String query) {
if (query == null) {
return bookRepository.findAll().stream().collect(toSet());
}
return bookRepository.findBy(query).collect(toSet());
}
}
| UTF-8 | Java | 845 | java | LibraryService.java | Java | [
{
"context": "A.\n * Project : quarkus-integration-test2\n * User: hendisantika\n * Email: hendisantika@gmail.com\n * Telegram : @h",
"end": 408,
"score": 0.9996283650398254,
"start": 396,
"tag": "USERNAME",
"value": "hendisantika"
},
{
"context": "-integration-test2\n * User: hendisantika\n * Email: hendisantika@gmail.com\n * Telegram : @hendisantika34\n * Date: 24/10/21\n ",
"end": 441,
"score": 0.9999290704727173,
"start": 419,
"tag": "EMAIL",
"value": "hendisantika@gmail.com"
},
{
"context": "ika\n * Email: hendisantika@gmail.com\n * Telegram : @hendisantika34\n * Date: 24/10/21\n * Time: 21.08\n */\n@Transaction",
"end": 471,
"score": 0.9794391989707947,
"start": 456,
"tag": "USERNAME",
"value": "@hendisantika34"
}
] | null | [] | package com.hendisantika.service;
import com.hendisantika.model.Book;
import com.hendisantika.repository.BookRepository;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import javax.transaction.Transactional;
import java.util.Set;
import static java.util.stream.Collectors.toSet;
/**
* Created by IntelliJ IDEA.
* Project : quarkus-integration-test2
* User: hendisantika
* Email: <EMAIL>
* Telegram : @hendisantika34
* Date: 24/10/21
* Time: 21.08
*/
@Transactional
@ApplicationScoped
public class LibraryService {
@Inject
BookRepository bookRepository;
public Set<Book> find(String query) {
if (query == null) {
return bookRepository.findAll().stream().collect(toSet());
}
return bookRepository.findBy(query).collect(toSet());
}
}
| 830 | 0.725444 | 0.710059 | 36 | 22.472221 | 19.000711 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.305556 | false | false | 1 |
4347d72084a1b375ef7e35c93769fbc0ba4f00ac | 35,227,321,778,902 | 993d20a81589b72b8f52b73f1f6cd0175bb1ec9a | /src/com/dhlyf/core/RightQuotaManager.java | 9a2d7985d34e7c5f3dba6b4fcf15b8949b3b3ebf | [] | no_license | dinghung/quanxian | https://github.com/dinghung/quanxian | 91218b73f88e93f2a2ced109f789cc40029dfe6e | 134e111487e7133e377d2ff7af15fa63aaa341b6 | refs/heads/master | 2016-08-07T09:45:27.858000 | 2015-05-19T10:12:08 | 2015-05-19T10:12:08 | 35,874,773 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.dhlyf.core;
import java.util.Date;
import java.util.List;
import java.util.TreeMap;
import javax.annotation.Resource;
import javax.servlet.ServletContext;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
import org.springframework.web.context.support.WebApplicationContextUtils;
import com.dhlyf.dao.Account;
import com.dhlyf.dao.AccountDAO;
import com.dhlyf.dao.AccountQuota;
import com.dhlyf.dao.AccountQuotaDAO;
import com.dhlyf.dao.FuncModule;
import com.dhlyf.dao.FuncModuleDAO;
import com.dhlyf.dao.Role;
import com.dhlyf.dao.RoleDAO;
import com.dhlyf.dao.RoleQuota;
import com.dhlyf.dao.RoleQuotaDAO;
import com.dhlyf.util.SysConstants;
/**
* ๆ้็ฎก็้ๆๆจกๅ
* @Description: TODO
* @author JiahaiWu
*
*/
@Service("RightQuotaManager")
public class RightQuotaManager {
/**
* ๆฅ่ฏขๆๆ่ง่ฒไฟกๆฏ
* @author JiahaiWu
* @return
*/
public List<Role> getAllRoles(){
return roleDAO.findAll();
}
/**
* ๆฅ่ฏขๆๆๆ้็ฎก็ๆจกๅไฟกๆฏ
* @author JiahaiWu
* @return
*/
public List<FuncModule> getAllFuncModules(){
return funcModuleDAO.findAll();
}
/**
* ๆฅ่ฏขๆๅฎ่ง่ฒ็ๆ้่ฎธๅฏ้
็ฝฎ
* @author JiahaiWu
* @param rid
* @return
*/
public List<FuncModule> getRoleQuotas(long rid,String roleName){
List<FuncModule> modules=funcModuleDAO.findAll();//ๆฅ่ฏขๅบๆฐๆฎๅบๆ้่กจไธญ็ๆๆๆ้
//็กฎ่ฎค่ทๅ็จๆท่ง่ฒๅ็งฐ
String rName=roleName;
if(roleName==null)
{
Role role= roleDAO.findById(rid);
rName=role==null?"":role.getRname();
}
//2.่ถ
็บง็ฎก็ๅไธๅๆ้ๅ้
่กจ็บฆๆ
if(rName.equals(SysConstants.getAdminRName())){
for(FuncModule module:modules)
{
module.setDefaultpermit(true);//func_module่กจไธญ้ป่ฎค็ๆ้trueๅณไธบ่ถ
็บง็ฎก็ๅ็ๆๆๆ้
}
return modules;
}
//ๆฅ่ฏข็ฎๆ ๆ้้
้ข
List<RoleQuota> rQuotas=roleQuotaDAO.findByRid(rid);
TreeMap<Long, RoleQuota> rQuotaMap=new TreeMap<Long, RoleQuota>();
for(RoleQuota rQuota:rQuotas)
{
rQuotaMap.put(rQuota.getFuncModule().getMid(), rQuota);
}
//ๆ้้ๅ
for(FuncModule module:modules)
{
RoleQuota rQuota=rQuotaMap.get(module.getMid());
if(rQuota!=null)
module.setDefaultpermit(rQuota.getPermit());
}
return modules;
}
/**
* ๆฅ่ฏขๆๅฎ่ดฆๆท็ๆ้่ฎธๅฏ้
็ฝฎ
* @author JiahaiWu
* @param aid
* @return
*/
public List<FuncModule> getAccountQuotas(long aid,String roleName){
List<FuncModule> modules=funcModuleDAO.findAll();
Account account=accountDAO.findById(aid);
//็กฎ่ฎค่ทๅ็จๆท่ง่ฒๅ็งฐ
String rName=roleName;
if(roleName==null)
{
Role role= roleDAO.findById(account.getRole().getRid());
rName=role==null?"":role.getRname();
}
//2.่ถ
็บง็ฎก็ๅไธๅๆ้ๅ้
่กจ็บฆๆ
if(rName.equals(SysConstants.getAdminRName())){
for(FuncModule module:modules)
{
module.setDefaultpermit(true);
}
return modules;
}
//ๆฅ่ฏข็ฎๆ ๆ้้
้ข
List<AccountQuota> aQuotas=accountQuotaDAO.findByAid(aid);
TreeMap<Long, AccountQuota> aQuotaMap=new TreeMap<Long, AccountQuota>();
for(AccountQuota aQuota:aQuotas)
{
aQuotaMap.put(aQuota.getFuncModule().getMid(), aQuota);
}
//ๆ้้ๅ
for(FuncModule module:modules)
{
AccountQuota aQuota=aQuotaMap.get(module.getMid());
if(aQuota!=null)
module.setDefaultpermit(aQuota.getPermit());
}
return modules;
}
/**
* ๆฅ้ช็จๆท่ฎฟ้ฎๆ้็่ฎธๅฏ
* @author JiahaiWu
* @param aid
* @param mid
* @param roleName ๅฏไธบ็ฉบ
* @return
*/
public boolean checkAccountAccess(long aid,long mid,String roleName){
// 1.ๆช็ปไปปไฝ่ฎพ็ฝฎ็ๅ่ฝ้กน้ป่ฎคๅผๆพ่ฎธๅฏ
// 2.่ถ
็บง็ฎก็ๅไธๅๆ้ๅ้
่กจ็บฆๆ
// 3.ๆฏไธช็จๆทๅฎ้
ๅฏ็จๆ้ๅ่ดฆๆทๆ้่กจๆงๅถ
// 4.็จๆทๆ้้
้ขๆชๅฎๆถ๏ผๆฅ้ชๅ่ฝ้กน็้ป่ฎค่ฎธๅฏ๏ผ
Account account=accountDAO.findById(aid);
FuncModule funcModule=funcModuleDAO.findById(mid);
if(account==null)
return false;
if(funcModule==null)
return true;
return checkAccountAccess(account, funcModule, roleName);
}
/**
* ๆฅ้ช็จๆท่ฎฟ้ฎๆ้็่ฎธๅฏ
* @author JiahaiWu
* @param aid
* @param mname
* @param roleName
* @return
*/
public boolean checkAccountAccess(long aid,String mname,String roleName){
Account account=accountDAO.findById(aid);
List<FuncModule> funcModules=funcModuleDAO.findByMname(mname);
if(account==null)
return false;
if(funcModules==null || funcModules.size()<1)
return true;
return checkAccountAccess(account, funcModules.get(0), roleName);
}
/**
* ๆฅ้ช็จๆท่ฎฟ้ฎๆ้็่ฎธๅฏ
* @author JiahaiWu
* @param aid
* @param mid
* @param roleName ๅฏไธบ็ฉบ
* @return
*/
public boolean checkAccountAccess(Account account,FuncModule funcModule,String roleName){
if(funcModule==null) //1.ๆ ๆ้้กน่ฎพ็ฝฎ๏ผ่ฎธๅฏ้่ฟ
return true;
//็กฎ่ฎค่ทๅ็จๆท่ง่ฒๅ็งฐ
String rName=roleName;
if(roleName==null)
{
Role role= roleDAO.findById(account.getRole().getRid());
rName=role==null?"":role.getRname();
}
//2.่ถ
็บง็ฎก็ๅไธๅๆ้ๅ้
่กจ็บฆๆ
if(rName.equals(SysConstants.getAdminRName())){
return true;
}
//ๆฅ่ฏข็ฎๆ ๆ้้
้ข
AccountQuota accountQuota=accountQuotaDAO.queryPermission(account.getAid(),funcModule.getMid());
//3.็จๆทๅฎ้
ๅฏ็จๆ้ๅ่ดฆๆทๆ้่กจๆงๅถ
if(accountQuota!=null)
return accountQuota.getPermit();
//4.็จๆทๆ้้
้ขๆชๅฎๆถ๏ผๆฅ้ชๅ่ฝ้กน็้ป่ฎค่ฎธๅฏ
return funcModule.getDefaultpermit();
}
/**
* ๆฐๅข่ง่ฒ
* @author JiahaiWu
* @param role
* @return
*/
public boolean addRole(Role role){
if(role==null)
return false;
role.setRid(null);
if(roleDAO.save(role))
{
syncQuotaFromDefaultQuota(role.getRid());
return true;
}
return false;
}
/**
* ๆฐๅขๅ่ฝ้
็ฝฎๆจกๅ
* @author JiahaiWu
* @param funcModule
* @return
*/
public boolean addFuncModule(FuncModule funcModule){
if(funcModule==null)
return false;
funcModule.setMid(null);
return funcModuleDAO.save(funcModule);
}
/**
* ๆฐๅข็ณป็ป่ฎฟ้ฎ่ดฆๆท๏ผๅๆญฅ่ฎพๅฎ่ง่ฒๆ้้
้ข
* @author JiahaiWu
* @param account
* @return
*/
public boolean addAccount(Account account)
{
if(account==null)
return false;
account.setAid(null);
if(accountDAO.save(account))
{
syncQuotaFromRoleQuota(account.getAid(),account.getRole().getRid());
return true;
}
return false;
}
/**
* ๆดๆฐ็จๆทๆ้่ฎธๅฏ่ฎพๅฎๅผ
* @author JiahaiWu
* @param aid
* @param mid
* @param permit
* @return
*/
public boolean updateAccountQuota(long aid,long mid,boolean permit){
AccountQuota quota= accountQuotaDAO.queryPermission(aid, mid);
if(quota==null)
{
quota=new AccountQuota();
Account account=new Account();
account.setAid(aid);
quota.setAccount(account);
FuncModule module=new FuncModule();
module.setMid(mid);
quota.setFuncModule(module);
}
quota.setPermit(permit);
quota.setUpdatetime(new Date());
return accountQuotaDAO.merge(quota)!=null;
}
/**
* ๆดๆฐๆๅทๆฐ่ง่ฒๆ้้
้ข่ฎพๅฎ
* @author JiahaiWu
* @param rid
* @param mid
* @param permit
* @return
*/
public boolean updateRoleQuota(long rid,long mid,boolean permit){
RoleQuota quota=roleQuotaDAO.queryPermission(rid, mid);
if(quota==null)
{
quota=new RoleQuota();
Role role=new Role();
role.setRid(rid);
quota.setRole(role);
FuncModule module=new FuncModule();
module.setMid(mid);
quota.setFuncModule(module);
}
quota.setPermit(permit);
quota.setUpdatetime(new Date());
if(roleQuotaDAO.merge(quota)!=null)
{
List<Account> accounts=accountDAO.findByRid(rid);
if(accounts!=null && accounts.size()>0)
{
String vals="";
for(int i=0;i<accounts.size();i++)
{
if(i>1000)
{
syncAccountQuotaInGroup(mid,permit,vals.substring(1));
vals="";
}
vals=vals.concat(",").concat(accounts.get(i).getAid().toString());
}
return syncAccountQuotaInGroup(mid,permit,vals.substring(1));
}else
return true;
}
return false;
}
public boolean syncQuotaFromDefaultQuota(long rid)
{
List<FuncModule> modules=funcModuleDAO.findAll();
boolean success=true;
for(FuncModule module:modules)
{
if(!updateRoleQuota(rid, module.getMid(), module.getDefaultpermit()))
success=false;
}
return success;
}
/**
* ไปๆๅฎ็่ง่ฒๆ้้
็ฝฎๅๆญฅๆดๆฐ่ณๆๅฎ็็จๆทๆ้้
้ข
* @author JiahaiWu
* @param aid
* @param rid
* @return
*/
public boolean syncQuotaFromRoleQuota(long aid,long rid)
{
List<RoleQuota> quotas=roleQuotaDAO.findByRid(rid);
boolean success=true;
for(RoleQuota quota:quotas)
{
if(!updateAccountQuota(aid, quota.getFuncModule().getMid(), quota.getPermit()))
success=false;
}
return success;
}
/**
* ไปฅ็พค็ปๆดๆฐ็ๆนๅผ๏ผๅๆดๅ่ฝๆ้่ฎพ็ฝฎ
* @author JiahaiWu
* @param mid
* @param permit
* @param aids ๅคๅผไธฒ่ๅญ็ฌฆไธฒ๏ผaidไน้ดไฝฟ็จ้ๅทไฝไธบๅ้็ฌฆ
* @return
*/
public boolean syncAccountQuotaInGroup(long mid,boolean permit,String aids)
{
if(aids.length()>0)
{
return accountQuotaDAO.updatePermitByAids(mid,permit,aids)>-1;
}
return false;
}
@Resource
private AccountDAO accountDAO;
@Resource
private RoleDAO roleDAO;
@Resource
private FuncModuleDAO funcModuleDAO;
@Resource
private AccountQuotaDAO accountQuotaDAO;
@Resource
private RoleQuotaDAO roleQuotaDAO;
public void setAccountDAO(AccountDAO accountDAO)
{
this.accountDAO = accountDAO;
}
public void setRoleDAO(RoleDAO roleDAO)
{
this.roleDAO = roleDAO;
}
public void setFuncModuleDAO(FuncModuleDAO funcModuleDAO)
{
this.funcModuleDAO = funcModuleDAO;
}
public void setAccountQuotaDAO(AccountQuotaDAO accountQuotaDAO)
{
this.accountQuotaDAO = accountQuotaDAO;
}
public void setRoleQuotaDAO(RoleQuotaDAO roleQuotaDAO)
{
this.roleQuotaDAO = roleQuotaDAO;
}
public static RightQuotaManager getFromServletContext(ServletContext sc){
ApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(sc);
return (RightQuotaManager)ctx.getBean("RightQuotaManager");
}
}
| UTF-8 | Java | 10,257 | java | RightQuotaManager.java | Java | [
{
"context": ";\n/**\n * ๆ้็ฎก็้ๆๆจกๅ\n * @Description: TODO\n * @author JiahaiWu\n *\n */\n@Service(\"RightQuotaManager\")\npublic class",
"end": 770,
"score": 0.9962919354438782,
"start": 762,
"tag": "NAME",
"value": "JiahaiWu"
},
{
"context": " RightQuotaManager {\n\t/**\n\t * ๆฅ่ฏขๆๆ่ง่ฒไฟกๆฏ\n\t * @author JiahaiWu\n\t * @return\n\t */\n\tpublic List<Role> getAllRoles()",
"end": 879,
"score": 0.9699109792709351,
"start": 871,
"tag": "NAME",
"value": "JiahaiWu"
},
{
"context": "AO.findAll();\n\t}\n\t/**\n\t * ๆฅ่ฏขๆๆๆ้็ฎก็ๆจกๅไฟกๆฏ\n\t * @author JiahaiWu\n\t * @return\n\t */\n\tpublic List<FuncModule> getAllF",
"end": 1004,
"score": 0.9870454668998718,
"start": 996,
"tag": "NAME",
"value": "JiahaiWu"
},
{
"context": "O.findAll();\n\t}\n\t/**\n\t * ๆฅ่ฏขๆๅฎ่ง่ฒ็ๆ้่ฎธๅฏ้
็ฝฎ\n\t * @author JiahaiWu\n\t * @param rid\n\t * @return\n\t */\n\tpublic List<Func",
"end": 1148,
"score": 0.9541242718696594,
"start": 1140,
"tag": "NAME",
"value": "JiahaiWu"
},
{
"context": "urn modules;\n\t}\n\t/**\n\t * ๆฅ่ฏขๆๅฎ่ดฆๆท็ๆ้่ฎธๅฏ้
็ฝฎ\n\t * @author JiahaiWu\n\t * @param aid\n\t * @return\n\t */\n public List<F",
"end": 2142,
"score": 0.9997456669807434,
"start": 2134,
"tag": "NAME",
"value": "JiahaiWu"
},
{
"context": "eturn modules;\n\t}\n\t/**\n\t * ๆฅ้ช็จๆท่ฎฟ้ฎๆ้็่ฎธๅฏ\n\t * @author JiahaiWu\n\t * @param aid\n\t * @param mid\n\t * @param roleName",
"end": 3178,
"score": 0.8714432120323181,
"start": 3170,
"tag": "NAME",
"value": "JiahaiWu"
},
{
"context": "le, roleName);\n\t}\n\t/**\n\t * ๆฅ้ช็จๆท่ฎฟ้ฎๆ้็่ฎธๅฏ\n\t * @author JiahaiWu\n\t * @param aid\n\t * @param mname\n\t * @param roleNa",
"end": 3695,
"score": 0.9655089974403381,
"start": 3687,
"tag": "NAME",
"value": "JiahaiWu"
},
{
"context": ", roleName);\n\t}\n\t\n\t/**\n\t * ๆฅ้ช็จๆท่ฎฟ้ฎๆ้็่ฎธๅฏ\n\t * @author JiahaiWu\n\t * @param aid\n\t * @param mid\n\t * @param roleName",
"end": 4164,
"score": 0.9507076740264893,
"start": 4156,
"tag": "NAME",
"value": "JiahaiWu"
},
{
"context": "e.getDefaultpermit();\n\t}\n\t/**\n\t * ๆฐๅข่ง่ฒ\n\t * @author JiahaiWu\n\t * @param role\n\t * @return\n\t */\n\tpublic b",
"end": 4935,
"score": 0.8764907121658325,
"start": 4934,
"tag": "NAME",
"value": "J"
},
{
"context": "getDefaultpermit();\n\t}\n\t/**\n\t * ๆฐๅข่ง่ฒ\n\t * @author JiahaiWu\n\t * @param role\n\t * @return\n\t */\n\tpublic boolean ",
"end": 4942,
"score": 0.6184864044189453,
"start": 4935,
"tag": "USERNAME",
"value": "iahaiWu"
},
{
"context": "}\n\t\treturn false;\n\t}\n\t/**\n\t * ๆฐๅขๅ่ฝ้
็ฝฎๆจกๅ\n\t * @author JiahaiWu\n\t * @param funcModule\n\t * @return\n\t */\n\tpublic bo",
"end": 5218,
"score": 0.784763514995575,
"start": 5210,
"tag": "NAME",
"value": "JiahaiWu"
},
{
"context": "dule);\n\t}\n\t/**\n\t * ๆฐๅข็ณป็ป่ฎฟ้ฎ่ดฆๆท๏ผๅๆญฅ่ฎพๅฎ่ง่ฒๆ้้
้ข\n\t * @author JiahaiWu\n\t * @param account\n\t * @return\n\t */\n\tpublic boole",
"end": 5472,
"score": 0.680004358291626,
"start": 5464,
"tag": "NAME",
"value": "JiahaiWu"
},
{
"context": "\treturn false;\n\t}\n\t/**\n\t * ๆดๆฐ็จๆทๆ้่ฎธๅฏ่ฎพๅฎๅผ\n\t * @author JiahaiWu\n\t * @param aid\n\t * @param mid\n\t * @param permit\n\t",
"end": 5804,
"score": 0.9987245202064514,
"start": 5796,
"tag": "NAME",
"value": "JiahaiWu"
},
{
"context": "uota)!=null;\n\t}\n\t/**\n\t * ๆดๆฐๆๅทๆฐ่ง่ฒๆ้้
้ข่ฎพๅฎ\n\t * @author JiahaiWu\n\t * @param rid\n\t * @param mid\n\t * @param permit\n\t",
"end": 6395,
"score": 0.998073935508728,
"start": 6387,
"tag": "NAME",
"value": "JiahaiWu"
},
{
"context": ";\n\t}\n\t/**\n\t * ไปๆๅฎ็่ง่ฒๆ้้
็ฝฎๅๆญฅๆดๆฐ่ณๆๅฎ็็จๆทๆ้้
้ข\n\t * @author JiahaiWu\n\t * @param aid\n\t * @param rid\n\t * @return\n\t */\n\tp",
"end": 7710,
"score": 0.9857456088066101,
"start": 7702,
"tag": "NAME",
"value": "JiahaiWu"
},
{
"context": "success;\n\t}\n\t/**\n\t * ไปฅ็พค็ปๆดๆฐ็ๆนๅผ๏ผๅๆดๅ่ฝๆ้่ฎพ็ฝฎ\n\t * @author JiahaiWu\n\t * @param mid\n\t * @param permit\n\t * @param aids ",
"end": 8105,
"score": 0.9893667697906494,
"start": 8097,
"tag": "NAME",
"value": "JiahaiWu"
}
] | null | [] | package com.dhlyf.core;
import java.util.Date;
import java.util.List;
import java.util.TreeMap;
import javax.annotation.Resource;
import javax.servlet.ServletContext;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
import org.springframework.web.context.support.WebApplicationContextUtils;
import com.dhlyf.dao.Account;
import com.dhlyf.dao.AccountDAO;
import com.dhlyf.dao.AccountQuota;
import com.dhlyf.dao.AccountQuotaDAO;
import com.dhlyf.dao.FuncModule;
import com.dhlyf.dao.FuncModuleDAO;
import com.dhlyf.dao.Role;
import com.dhlyf.dao.RoleDAO;
import com.dhlyf.dao.RoleQuota;
import com.dhlyf.dao.RoleQuotaDAO;
import com.dhlyf.util.SysConstants;
/**
* ๆ้็ฎก็้ๆๆจกๅ
* @Description: TODO
* @author JiahaiWu
*
*/
@Service("RightQuotaManager")
public class RightQuotaManager {
/**
* ๆฅ่ฏขๆๆ่ง่ฒไฟกๆฏ
* @author JiahaiWu
* @return
*/
public List<Role> getAllRoles(){
return roleDAO.findAll();
}
/**
* ๆฅ่ฏขๆๆๆ้็ฎก็ๆจกๅไฟกๆฏ
* @author JiahaiWu
* @return
*/
public List<FuncModule> getAllFuncModules(){
return funcModuleDAO.findAll();
}
/**
* ๆฅ่ฏขๆๅฎ่ง่ฒ็ๆ้่ฎธๅฏ้
็ฝฎ
* @author JiahaiWu
* @param rid
* @return
*/
public List<FuncModule> getRoleQuotas(long rid,String roleName){
List<FuncModule> modules=funcModuleDAO.findAll();//ๆฅ่ฏขๅบๆฐๆฎๅบๆ้่กจไธญ็ๆๆๆ้
//็กฎ่ฎค่ทๅ็จๆท่ง่ฒๅ็งฐ
String rName=roleName;
if(roleName==null)
{
Role role= roleDAO.findById(rid);
rName=role==null?"":role.getRname();
}
//2.่ถ
็บง็ฎก็ๅไธๅๆ้ๅ้
่กจ็บฆๆ
if(rName.equals(SysConstants.getAdminRName())){
for(FuncModule module:modules)
{
module.setDefaultpermit(true);//func_module่กจไธญ้ป่ฎค็ๆ้trueๅณไธบ่ถ
็บง็ฎก็ๅ็ๆๆๆ้
}
return modules;
}
//ๆฅ่ฏข็ฎๆ ๆ้้
้ข
List<RoleQuota> rQuotas=roleQuotaDAO.findByRid(rid);
TreeMap<Long, RoleQuota> rQuotaMap=new TreeMap<Long, RoleQuota>();
for(RoleQuota rQuota:rQuotas)
{
rQuotaMap.put(rQuota.getFuncModule().getMid(), rQuota);
}
//ๆ้้ๅ
for(FuncModule module:modules)
{
RoleQuota rQuota=rQuotaMap.get(module.getMid());
if(rQuota!=null)
module.setDefaultpermit(rQuota.getPermit());
}
return modules;
}
/**
* ๆฅ่ฏขๆๅฎ่ดฆๆท็ๆ้่ฎธๅฏ้
็ฝฎ
* @author JiahaiWu
* @param aid
* @return
*/
public List<FuncModule> getAccountQuotas(long aid,String roleName){
List<FuncModule> modules=funcModuleDAO.findAll();
Account account=accountDAO.findById(aid);
//็กฎ่ฎค่ทๅ็จๆท่ง่ฒๅ็งฐ
String rName=roleName;
if(roleName==null)
{
Role role= roleDAO.findById(account.getRole().getRid());
rName=role==null?"":role.getRname();
}
//2.่ถ
็บง็ฎก็ๅไธๅๆ้ๅ้
่กจ็บฆๆ
if(rName.equals(SysConstants.getAdminRName())){
for(FuncModule module:modules)
{
module.setDefaultpermit(true);
}
return modules;
}
//ๆฅ่ฏข็ฎๆ ๆ้้
้ข
List<AccountQuota> aQuotas=accountQuotaDAO.findByAid(aid);
TreeMap<Long, AccountQuota> aQuotaMap=new TreeMap<Long, AccountQuota>();
for(AccountQuota aQuota:aQuotas)
{
aQuotaMap.put(aQuota.getFuncModule().getMid(), aQuota);
}
//ๆ้้ๅ
for(FuncModule module:modules)
{
AccountQuota aQuota=aQuotaMap.get(module.getMid());
if(aQuota!=null)
module.setDefaultpermit(aQuota.getPermit());
}
return modules;
}
/**
* ๆฅ้ช็จๆท่ฎฟ้ฎๆ้็่ฎธๅฏ
* @author JiahaiWu
* @param aid
* @param mid
* @param roleName ๅฏไธบ็ฉบ
* @return
*/
public boolean checkAccountAccess(long aid,long mid,String roleName){
// 1.ๆช็ปไปปไฝ่ฎพ็ฝฎ็ๅ่ฝ้กน้ป่ฎคๅผๆพ่ฎธๅฏ
// 2.่ถ
็บง็ฎก็ๅไธๅๆ้ๅ้
่กจ็บฆๆ
// 3.ๆฏไธช็จๆทๅฎ้
ๅฏ็จๆ้ๅ่ดฆๆทๆ้่กจๆงๅถ
// 4.็จๆทๆ้้
้ขๆชๅฎๆถ๏ผๆฅ้ชๅ่ฝ้กน็้ป่ฎค่ฎธๅฏ๏ผ
Account account=accountDAO.findById(aid);
FuncModule funcModule=funcModuleDAO.findById(mid);
if(account==null)
return false;
if(funcModule==null)
return true;
return checkAccountAccess(account, funcModule, roleName);
}
/**
* ๆฅ้ช็จๆท่ฎฟ้ฎๆ้็่ฎธๅฏ
* @author JiahaiWu
* @param aid
* @param mname
* @param roleName
* @return
*/
public boolean checkAccountAccess(long aid,String mname,String roleName){
Account account=accountDAO.findById(aid);
List<FuncModule> funcModules=funcModuleDAO.findByMname(mname);
if(account==null)
return false;
if(funcModules==null || funcModules.size()<1)
return true;
return checkAccountAccess(account, funcModules.get(0), roleName);
}
/**
* ๆฅ้ช็จๆท่ฎฟ้ฎๆ้็่ฎธๅฏ
* @author JiahaiWu
* @param aid
* @param mid
* @param roleName ๅฏไธบ็ฉบ
* @return
*/
public boolean checkAccountAccess(Account account,FuncModule funcModule,String roleName){
if(funcModule==null) //1.ๆ ๆ้้กน่ฎพ็ฝฎ๏ผ่ฎธๅฏ้่ฟ
return true;
//็กฎ่ฎค่ทๅ็จๆท่ง่ฒๅ็งฐ
String rName=roleName;
if(roleName==null)
{
Role role= roleDAO.findById(account.getRole().getRid());
rName=role==null?"":role.getRname();
}
//2.่ถ
็บง็ฎก็ๅไธๅๆ้ๅ้
่กจ็บฆๆ
if(rName.equals(SysConstants.getAdminRName())){
return true;
}
//ๆฅ่ฏข็ฎๆ ๆ้้
้ข
AccountQuota accountQuota=accountQuotaDAO.queryPermission(account.getAid(),funcModule.getMid());
//3.็จๆทๅฎ้
ๅฏ็จๆ้ๅ่ดฆๆทๆ้่กจๆงๅถ
if(accountQuota!=null)
return accountQuota.getPermit();
//4.็จๆทๆ้้
้ขๆชๅฎๆถ๏ผๆฅ้ชๅ่ฝ้กน็้ป่ฎค่ฎธๅฏ
return funcModule.getDefaultpermit();
}
/**
* ๆฐๅข่ง่ฒ
* @author JiahaiWu
* @param role
* @return
*/
public boolean addRole(Role role){
if(role==null)
return false;
role.setRid(null);
if(roleDAO.save(role))
{
syncQuotaFromDefaultQuota(role.getRid());
return true;
}
return false;
}
/**
* ๆฐๅขๅ่ฝ้
็ฝฎๆจกๅ
* @author JiahaiWu
* @param funcModule
* @return
*/
public boolean addFuncModule(FuncModule funcModule){
if(funcModule==null)
return false;
funcModule.setMid(null);
return funcModuleDAO.save(funcModule);
}
/**
* ๆฐๅข็ณป็ป่ฎฟ้ฎ่ดฆๆท๏ผๅๆญฅ่ฎพๅฎ่ง่ฒๆ้้
้ข
* @author JiahaiWu
* @param account
* @return
*/
public boolean addAccount(Account account)
{
if(account==null)
return false;
account.setAid(null);
if(accountDAO.save(account))
{
syncQuotaFromRoleQuota(account.getAid(),account.getRole().getRid());
return true;
}
return false;
}
/**
* ๆดๆฐ็จๆทๆ้่ฎธๅฏ่ฎพๅฎๅผ
* @author JiahaiWu
* @param aid
* @param mid
* @param permit
* @return
*/
public boolean updateAccountQuota(long aid,long mid,boolean permit){
AccountQuota quota= accountQuotaDAO.queryPermission(aid, mid);
if(quota==null)
{
quota=new AccountQuota();
Account account=new Account();
account.setAid(aid);
quota.setAccount(account);
FuncModule module=new FuncModule();
module.setMid(mid);
quota.setFuncModule(module);
}
quota.setPermit(permit);
quota.setUpdatetime(new Date());
return accountQuotaDAO.merge(quota)!=null;
}
/**
* ๆดๆฐๆๅทๆฐ่ง่ฒๆ้้
้ข่ฎพๅฎ
* @author JiahaiWu
* @param rid
* @param mid
* @param permit
* @return
*/
public boolean updateRoleQuota(long rid,long mid,boolean permit){
RoleQuota quota=roleQuotaDAO.queryPermission(rid, mid);
if(quota==null)
{
quota=new RoleQuota();
Role role=new Role();
role.setRid(rid);
quota.setRole(role);
FuncModule module=new FuncModule();
module.setMid(mid);
quota.setFuncModule(module);
}
quota.setPermit(permit);
quota.setUpdatetime(new Date());
if(roleQuotaDAO.merge(quota)!=null)
{
List<Account> accounts=accountDAO.findByRid(rid);
if(accounts!=null && accounts.size()>0)
{
String vals="";
for(int i=0;i<accounts.size();i++)
{
if(i>1000)
{
syncAccountQuotaInGroup(mid,permit,vals.substring(1));
vals="";
}
vals=vals.concat(",").concat(accounts.get(i).getAid().toString());
}
return syncAccountQuotaInGroup(mid,permit,vals.substring(1));
}else
return true;
}
return false;
}
public boolean syncQuotaFromDefaultQuota(long rid)
{
List<FuncModule> modules=funcModuleDAO.findAll();
boolean success=true;
for(FuncModule module:modules)
{
if(!updateRoleQuota(rid, module.getMid(), module.getDefaultpermit()))
success=false;
}
return success;
}
/**
* ไปๆๅฎ็่ง่ฒๆ้้
็ฝฎๅๆญฅๆดๆฐ่ณๆๅฎ็็จๆทๆ้้
้ข
* @author JiahaiWu
* @param aid
* @param rid
* @return
*/
public boolean syncQuotaFromRoleQuota(long aid,long rid)
{
List<RoleQuota> quotas=roleQuotaDAO.findByRid(rid);
boolean success=true;
for(RoleQuota quota:quotas)
{
if(!updateAccountQuota(aid, quota.getFuncModule().getMid(), quota.getPermit()))
success=false;
}
return success;
}
/**
* ไปฅ็พค็ปๆดๆฐ็ๆนๅผ๏ผๅๆดๅ่ฝๆ้่ฎพ็ฝฎ
* @author JiahaiWu
* @param mid
* @param permit
* @param aids ๅคๅผไธฒ่ๅญ็ฌฆไธฒ๏ผaidไน้ดไฝฟ็จ้ๅทไฝไธบๅ้็ฌฆ
* @return
*/
public boolean syncAccountQuotaInGroup(long mid,boolean permit,String aids)
{
if(aids.length()>0)
{
return accountQuotaDAO.updatePermitByAids(mid,permit,aids)>-1;
}
return false;
}
@Resource
private AccountDAO accountDAO;
@Resource
private RoleDAO roleDAO;
@Resource
private FuncModuleDAO funcModuleDAO;
@Resource
private AccountQuotaDAO accountQuotaDAO;
@Resource
private RoleQuotaDAO roleQuotaDAO;
public void setAccountDAO(AccountDAO accountDAO)
{
this.accountDAO = accountDAO;
}
public void setRoleDAO(RoleDAO roleDAO)
{
this.roleDAO = roleDAO;
}
public void setFuncModuleDAO(FuncModuleDAO funcModuleDAO)
{
this.funcModuleDAO = funcModuleDAO;
}
public void setAccountQuotaDAO(AccountQuotaDAO accountQuotaDAO)
{
this.accountQuotaDAO = accountQuotaDAO;
}
public void setRoleQuotaDAO(RoleQuotaDAO roleQuotaDAO)
{
this.roleQuotaDAO = roleQuotaDAO;
}
public static RightQuotaManager getFromServletContext(ServletContext sc){
ApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(sc);
return (RightQuotaManager)ctx.getBean("RightQuotaManager");
}
}
| 10,257 | 0.71049 | 0.708132 | 393 | 22.748091 | 20.162952 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.104326 | false | false | 1 |
69c65e9e725f18a825a1d7c90e0bd035e1d6671a | 35,184,372,114,164 | cfbb4013b11a9700aa40ea6201b0b3f5f9b08373 | /app/src/main/java/Script/IFileSystem.java | 78b3266558fe82ede5f377d9b04f1b5841528b93 | [
"MIT"
] | permissive | sillsdev/HearThisAndroid | https://github.com/sillsdev/HearThisAndroid | 81c855321b08f3a7e221469f5a19bf7b124a4ec8 | 500fd39b3fe53ece6b21b7f1dd05caaf980abd33 | refs/heads/master | 2023-02-01T23:53:31.058000 | 2023-01-25T18:20:05 | 2023-01-25T18:20:05 | 27,271,266 | 3 | 3 | NOASSERTION | false | 2023-08-24T20:50:48 | 2014-11-28T14:57:59 | 2023-01-31T16:35:55 | 2023-08-24T20:50:47 | 1,423 | 2 | 4 | 2 | Java | false | false | package Script;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
/**
* This interface 'wraps' the functionality we need from the file system to facilitate unit testing.
*/
public interface IFileSystem {
boolean FileExists(String path);
InputStream ReadFile(String path) throws FileNotFoundException;
OutputStream WriteFile(String path) throws FileNotFoundException;
void Delete(String path);
ArrayList<String> getDirectories(String path);
}
| UTF-8 | Java | 539 | java | IFileSystem.java | Java | [] | null | [] | package Script;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
/**
* This interface 'wraps' the functionality we need from the file system to facilitate unit testing.
*/
public interface IFileSystem {
boolean FileExists(String path);
InputStream ReadFile(String path) throws FileNotFoundException;
OutputStream WriteFile(String path) throws FileNotFoundException;
void Delete(String path);
ArrayList<String> getDirectories(String path);
}
| 539 | 0.782931 | 0.782931 | 17 | 30.705883 | 27.239168 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.588235 | false | false | 1 |
1011e7d1a1a647e8b7383aab52d5a0cf8c7a55cc | 34,196,529,633,878 | db2c49a189e13554e73713ed2a69ca887a2ad9f0 | /org.nb.mgm.client/src/org/nb/mgm/client/cli/MachineCommand.java | 4fc9a88572c36a335612ce952a8a611b2dfa55dc | [] | no_license | EngineerBarsik/dev | https://github.com/EngineerBarsik/dev | fa501b6ff58e0b6b263d54d6e85c6d69a323f612 | 81715414de121e1d7cead7d4066d626b095816d6 | refs/heads/master | 2023-02-11T01:20:29.217000 | 2021-01-08T01:14:21 | 2021-01-08T01:14:21 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.nb.mgm.client.cli;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
import org.apache.felix.service.command.Descriptor;
import org.apache.felix.service.command.Parameter;
import org.nb.mgm.client.api.IHome;
import org.nb.mgm.client.api.IMachine;
import org.nb.mgm.client.api.ManagementClient;
import org.origin.common.annotation.Annotated;
import org.origin.common.annotation.Dependency;
import org.origin.common.annotation.DependencyFullfilled;
import org.origin.common.annotation.DependencyUnfullfilled;
import org.origin.common.osgi.OSGiServiceUtil;
import org.origin.common.rest.client.ClientException;
import org.origin.common.util.PrettyPrinter;
import org.osgi.framework.BundleContext;
public class MachineCommand implements Annotated {
protected static String[] MACHINE_TITLES = new String[] { "ID", "Name", "IP Address", "Description" };
protected static String[] MACHINE_TITLES_ALL = new String[] { "ID", "Name", "IP Address", "Description", "Home" };
protected BundleContext bundleContext;
@Dependency
protected ManagementClient mgmClient;
/**
*
* @param bundleContext
*/
public MachineCommand(BundleContext bundleContext) {
this.bundleContext = bundleContext;
}
public void start() {
System.out.println("MachineCommand.start()");
Hashtable<String, Object> props = new Hashtable<String, Object>();
props.put("osgi.command.scope", "nb");
props.put("osgi.command.function", new String[] { "lmachines", "addmachine", "updatemachine", "removemachine" });
OSGiServiceUtil.register(this.bundleContext, MachineCommand.class.getName(), this, props);
OSGiServiceUtil.register(this.bundleContext, Annotated.class.getName(), this);
}
public void stop() {
System.out.println("MachineCommand.stop()");
OSGiServiceUtil.unregister(MachineCommand.class.getName(), this);
OSGiServiceUtil.unregister(Annotated.class.getName(), this);
}
@DependencyFullfilled
public void managementSet() {
}
@DependencyUnfullfilled
public void managementUnset() {
}
/**
* List Machines.
*
* Command: lmachines
*
* @param mgm
* @throws ClientException
*/
@Descriptor("List Machines")
public void lmachines(
// Options
@Descriptor("List with detailed information of each Machine") @Parameter(names = { "-all", "--all" }, absentValue = "false", presentValue = "true") boolean all //
) throws ClientException {
if (this.mgmClient == null) {
System.out.println("Please login first.");
return;
}
all = true;
List<IMachine> machines = this.mgmClient.getMachines(null);
if (all) {
List<String[]> items = new ArrayList<String[]>();
for (IMachine machine : machines) {
String machineId = machine.getId();
String name = machine.getName();
String ipAddress = machine.getIpAddress();
String desc = machine.getDescription();
List<IHome> homes = machine.getHomes();
if (homes.isEmpty()) {
String[] item = new String[] { machineId, name, ipAddress, desc, "" };
items.add(item);
} else {
for (int i = 0; i < homes.size(); i++) {
IHome currHome = homes.get(i);
String homeName = currHome.getName();
String homeText = homeName;
String[] item = null;
if (i == 0) {
item = new String[] { machineId, name, ipAddress, desc, homeText };
} else {
item = new String[] { "", "", "", "", homeText };
}
items.add(item);
}
}
}
String[][] rows = new String[items.size()][MACHINE_TITLES_ALL.length];
int rowIndex = 0;
for (String[] item : items) {
rows[rowIndex++] = item;
}
PrettyPrinter.prettyPrint(MACHINE_TITLES_ALL, rows, machines.size());
} else {
String[][] rows = new String[machines.size()][MACHINE_TITLES.length];
int rowIndex = 0;
for (IMachine machine : machines) {
String machineId = machine.getId();
String name = machine.getName();
String ipAddress = machine.getIpAddress();
String desc = machine.getDescription();
rows[rowIndex++] = new String[] { machineId, name, ipAddress, desc };
}
PrettyPrinter.prettyPrint(MACHINE_TITLES, rows, machines.size());
}
}
/**
* Add a Machine.
*
* Command: addmachine -name <machineName> -ip <ipAddress> -desc <machineDescription>
*
* @param name
* @param ipAddress
* @param description
*/
@Descriptor("Add Machine")
public void addmachine( //
// Parameters
@Descriptor("Machine Name") @Parameter(names = { "-name", "--name" }, absentValue = "") String name, // required
@Descriptor("Machine IP Address") @Parameter(names = { "-ip", "--ipAddress" }, absentValue = "") String ipAddress, // required
@Descriptor("Machine Description") @Parameter(names = { "-desc", "--description" }, absentValue = "") String description // optional
) {
if (this.mgmClient == null) {
System.out.println("Please login first.");
return;
}
try {
// name is required for creating new Machine
if ("".equals(name)) {
System.out.println("Please specify -name parameter.");
return;
}
// machineId is required for adding new Machine.
if ("".equals(ipAddress)) {
System.out.println("Please specify -ip parameter.");
return;
}
IMachine newMachine = this.mgmClient.addMachine(name, ipAddress, description);
if (newMachine != null) {
System.out.println("New Machine is added. ");
} else {
System.out.println("New Machine is not added.");
}
} catch (ClientException e) {
System.out.println("Cannot added new Machine. " + e.getMessage());
}
}
/**
* Update Machine information.
*
* Command: updatemachine -machineid <machineId> -name <newMachineName> -ip <newMachineIpAddress> -desc <newMachineDescription>
*
* @param machineId
*/
@Descriptor("Update Machine")
public void updatemachine( //
// Parameters
@Descriptor("Machine ID") @Parameter(names = { "-machineid", "--machineId" }, absentValue = "") String machineId, // required
@Descriptor("New Machine name") @Parameter(names = { "-name", "--name" }, absentValue = "null") String newMachineName, // optional
@Descriptor("New Machine name") @Parameter(names = { "-ip", "--ipAddress" }, absentValue = "null") String newIpAddress, // optional
@Descriptor("New Machine description") @Parameter(names = { "-desc", "--description" }, absentValue = "null") String newMachineDescription // optional
) {
if (this.mgmClient == null) {
System.out.println("Please login first.");
return;
}
// machineId is required for updating a Machine
if ("".equals(machineId)) {
System.out.println("Please specify -id parameter.");
return;
}
try {
IMachine machine = this.mgmClient.getMachine(machineId);
if (machine == null) {
System.out.println("Machine is not found.");
return;
}
boolean isUpdated = false;
if (!"null".equals(newMachineName)) {
machine.setName(newMachineName);
isUpdated = true;
}
if (!"null".equals(newIpAddress)) {
machine.setIpAddress(newIpAddress);
isUpdated = true;
}
if (!"null".equals(newMachineDescription)) {
machine.setDescription(newMachineDescription);
isUpdated = true;
}
if (isUpdated) {
boolean succeed = machine.update();
if (succeed) {
System.out.println("Machine is updated. ");
} else {
System.out.println("Failed to update Machine.");
}
} else {
System.out.println("Machine is not updated.");
}
} catch (ClientException e) {
System.out.println("ClientException: " + e.getMessage());
}
}
/**
* Remove a Machine.
*
* Command: removemachine -machineid <machineId>
*
* @param machineId
*/
@Descriptor("Remove a Machine")
public void removemachine( //
// Parameters
@Descriptor("Machine ID") @Parameter(names = { "-machineid", "--machineId" }, absentValue = "") String machineId // required
) {
if (this.mgmClient == null) {
System.out.println("Please login first.");
return;
}
try {
// machineId is required for deleting a Machine
if ("".equals(machineId)) {
System.out.println("Please specify -machineid parameter.");
return;
}
boolean succeed = this.mgmClient.removeMachine(machineId);
if (succeed) {
System.out.println("Machine is removed. ");
} else {
System.out.println("Failed to remove Machine.");
}
} catch (ClientException e) {
System.out.println("Failed to remove Machine. " + e.getMessage());
}
}
}
| UTF-8 | Java | 8,436 | java | MachineCommand.java | Java | [] | null | [] | package org.nb.mgm.client.cli;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
import org.apache.felix.service.command.Descriptor;
import org.apache.felix.service.command.Parameter;
import org.nb.mgm.client.api.IHome;
import org.nb.mgm.client.api.IMachine;
import org.nb.mgm.client.api.ManagementClient;
import org.origin.common.annotation.Annotated;
import org.origin.common.annotation.Dependency;
import org.origin.common.annotation.DependencyFullfilled;
import org.origin.common.annotation.DependencyUnfullfilled;
import org.origin.common.osgi.OSGiServiceUtil;
import org.origin.common.rest.client.ClientException;
import org.origin.common.util.PrettyPrinter;
import org.osgi.framework.BundleContext;
public class MachineCommand implements Annotated {
protected static String[] MACHINE_TITLES = new String[] { "ID", "Name", "IP Address", "Description" };
protected static String[] MACHINE_TITLES_ALL = new String[] { "ID", "Name", "IP Address", "Description", "Home" };
protected BundleContext bundleContext;
@Dependency
protected ManagementClient mgmClient;
/**
*
* @param bundleContext
*/
public MachineCommand(BundleContext bundleContext) {
this.bundleContext = bundleContext;
}
public void start() {
System.out.println("MachineCommand.start()");
Hashtable<String, Object> props = new Hashtable<String, Object>();
props.put("osgi.command.scope", "nb");
props.put("osgi.command.function", new String[] { "lmachines", "addmachine", "updatemachine", "removemachine" });
OSGiServiceUtil.register(this.bundleContext, MachineCommand.class.getName(), this, props);
OSGiServiceUtil.register(this.bundleContext, Annotated.class.getName(), this);
}
public void stop() {
System.out.println("MachineCommand.stop()");
OSGiServiceUtil.unregister(MachineCommand.class.getName(), this);
OSGiServiceUtil.unregister(Annotated.class.getName(), this);
}
@DependencyFullfilled
public void managementSet() {
}
@DependencyUnfullfilled
public void managementUnset() {
}
/**
* List Machines.
*
* Command: lmachines
*
* @param mgm
* @throws ClientException
*/
@Descriptor("List Machines")
public void lmachines(
// Options
@Descriptor("List with detailed information of each Machine") @Parameter(names = { "-all", "--all" }, absentValue = "false", presentValue = "true") boolean all //
) throws ClientException {
if (this.mgmClient == null) {
System.out.println("Please login first.");
return;
}
all = true;
List<IMachine> machines = this.mgmClient.getMachines(null);
if (all) {
List<String[]> items = new ArrayList<String[]>();
for (IMachine machine : machines) {
String machineId = machine.getId();
String name = machine.getName();
String ipAddress = machine.getIpAddress();
String desc = machine.getDescription();
List<IHome> homes = machine.getHomes();
if (homes.isEmpty()) {
String[] item = new String[] { machineId, name, ipAddress, desc, "" };
items.add(item);
} else {
for (int i = 0; i < homes.size(); i++) {
IHome currHome = homes.get(i);
String homeName = currHome.getName();
String homeText = homeName;
String[] item = null;
if (i == 0) {
item = new String[] { machineId, name, ipAddress, desc, homeText };
} else {
item = new String[] { "", "", "", "", homeText };
}
items.add(item);
}
}
}
String[][] rows = new String[items.size()][MACHINE_TITLES_ALL.length];
int rowIndex = 0;
for (String[] item : items) {
rows[rowIndex++] = item;
}
PrettyPrinter.prettyPrint(MACHINE_TITLES_ALL, rows, machines.size());
} else {
String[][] rows = new String[machines.size()][MACHINE_TITLES.length];
int rowIndex = 0;
for (IMachine machine : machines) {
String machineId = machine.getId();
String name = machine.getName();
String ipAddress = machine.getIpAddress();
String desc = machine.getDescription();
rows[rowIndex++] = new String[] { machineId, name, ipAddress, desc };
}
PrettyPrinter.prettyPrint(MACHINE_TITLES, rows, machines.size());
}
}
/**
* Add a Machine.
*
* Command: addmachine -name <machineName> -ip <ipAddress> -desc <machineDescription>
*
* @param name
* @param ipAddress
* @param description
*/
@Descriptor("Add Machine")
public void addmachine( //
// Parameters
@Descriptor("Machine Name") @Parameter(names = { "-name", "--name" }, absentValue = "") String name, // required
@Descriptor("Machine IP Address") @Parameter(names = { "-ip", "--ipAddress" }, absentValue = "") String ipAddress, // required
@Descriptor("Machine Description") @Parameter(names = { "-desc", "--description" }, absentValue = "") String description // optional
) {
if (this.mgmClient == null) {
System.out.println("Please login first.");
return;
}
try {
// name is required for creating new Machine
if ("".equals(name)) {
System.out.println("Please specify -name parameter.");
return;
}
// machineId is required for adding new Machine.
if ("".equals(ipAddress)) {
System.out.println("Please specify -ip parameter.");
return;
}
IMachine newMachine = this.mgmClient.addMachine(name, ipAddress, description);
if (newMachine != null) {
System.out.println("New Machine is added. ");
} else {
System.out.println("New Machine is not added.");
}
} catch (ClientException e) {
System.out.println("Cannot added new Machine. " + e.getMessage());
}
}
/**
* Update Machine information.
*
* Command: updatemachine -machineid <machineId> -name <newMachineName> -ip <newMachineIpAddress> -desc <newMachineDescription>
*
* @param machineId
*/
@Descriptor("Update Machine")
public void updatemachine( //
// Parameters
@Descriptor("Machine ID") @Parameter(names = { "-machineid", "--machineId" }, absentValue = "") String machineId, // required
@Descriptor("New Machine name") @Parameter(names = { "-name", "--name" }, absentValue = "null") String newMachineName, // optional
@Descriptor("New Machine name") @Parameter(names = { "-ip", "--ipAddress" }, absentValue = "null") String newIpAddress, // optional
@Descriptor("New Machine description") @Parameter(names = { "-desc", "--description" }, absentValue = "null") String newMachineDescription // optional
) {
if (this.mgmClient == null) {
System.out.println("Please login first.");
return;
}
// machineId is required for updating a Machine
if ("".equals(machineId)) {
System.out.println("Please specify -id parameter.");
return;
}
try {
IMachine machine = this.mgmClient.getMachine(machineId);
if (machine == null) {
System.out.println("Machine is not found.");
return;
}
boolean isUpdated = false;
if (!"null".equals(newMachineName)) {
machine.setName(newMachineName);
isUpdated = true;
}
if (!"null".equals(newIpAddress)) {
machine.setIpAddress(newIpAddress);
isUpdated = true;
}
if (!"null".equals(newMachineDescription)) {
machine.setDescription(newMachineDescription);
isUpdated = true;
}
if (isUpdated) {
boolean succeed = machine.update();
if (succeed) {
System.out.println("Machine is updated. ");
} else {
System.out.println("Failed to update Machine.");
}
} else {
System.out.println("Machine is not updated.");
}
} catch (ClientException e) {
System.out.println("ClientException: " + e.getMessage());
}
}
/**
* Remove a Machine.
*
* Command: removemachine -machineid <machineId>
*
* @param machineId
*/
@Descriptor("Remove a Machine")
public void removemachine( //
// Parameters
@Descriptor("Machine ID") @Parameter(names = { "-machineid", "--machineId" }, absentValue = "") String machineId // required
) {
if (this.mgmClient == null) {
System.out.println("Please login first.");
return;
}
try {
// machineId is required for deleting a Machine
if ("".equals(machineId)) {
System.out.println("Please specify -machineid parameter.");
return;
}
boolean succeed = this.mgmClient.removeMachine(machineId);
if (succeed) {
System.out.println("Machine is removed. ");
} else {
System.out.println("Failed to remove Machine.");
}
} catch (ClientException e) {
System.out.println("Failed to remove Machine. " + e.getMessage());
}
}
}
| 8,436 | 0.666548 | 0.666074 | 282 | 28.914894 | 31.075859 | 165 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.666667 | false | false | 1 |
b52678ee264aaf52144ea4dab34e5d163ee44e8f | 37,142,877,191,157 | f26cb141bcabb2c84525216e49db2b3e464e9d58 | /java/CommonCore/src/sk/jakubvanko/commoncore/InventoryData.java | 7ba4d56605e0ff520317cb054f1390111ec52909 | [
"Unlicense"
] | permissive | jakubvanko/commoncore | https://github.com/jakubvanko/commoncore | 6db285f128b94e2e445a9a3b08e41bdf05a4ed88 | 387c5f04fc51c044e6d85a275d44bfafb23cdfcf | refs/heads/master | 2023-07-24T08:48:19.695000 | 2023-05-15T14:58:51 | 2023-05-15T14:58:51 | 243,963,866 | 1 | 2 | Unlicense | false | 2023-07-13T07:43:06 | 2020-02-29T12:21:45 | 2023-04-14T02:02:38 | 2023-07-13T07:43:06 | 7,774 | 0 | 1 | 1 | HTML | false | false | package sk.jakubvanko.commoncore;
import org.bukkit.inventory.Inventory;
import java.util.List;
import java.util.Map;
/**
* Represents an inventory data holder
*/
public final class InventoryData {
private Inventory inventory;
private Map<Integer, List<ClickAction>> slotActionMap;
private String inventoryTitle;
/**
* Gets the linked inventory
*
* @return Linked inventory
*/
public Inventory getInventory() {
return inventory;
}
/**
* Sets the linked inventory
*
* @param inventory Inventory to set as linked
*/
public void setInventory(Inventory inventory) {
this.inventory = inventory;
}
/**
* Gets a map representing inventory slots linked to different actions
*
* @return Map representing inventory slots and corresponding actions
*/
public Map<Integer, List<ClickAction>> getSlotActionMap() {
return slotActionMap;
}
/**
* Sets the map representing inventory slots linked to different actions
*
* @param slotActionMap Map representing inventory slots and corresponding actions
*/
public void setSlotActionMap(Map<Integer, List<ClickAction>> slotActionMap) {
this.slotActionMap = slotActionMap;
}
/**
* Gets the title of the inventory
* @return The title of the inventory
*/
public String getInventoryTitle() {
return inventoryTitle;
}
/**
* Creates a new inventory data holder
*
* @param inventory Linked inventory
* @param slotActionMap Map representing inventory slots linked to different actions
*/
public InventoryData(Inventory inventory, Map<Integer, List<ClickAction>> slotActionMap) {
this.inventory = inventory;
this.slotActionMap = slotActionMap;
}
/**
* Creates a new inventory data holder
*
* @param inventory Linked inventory
* @param slotActionMap Map representing inventory slots linked to different actions
* @param inventoryTitle The title of the inventory
*/
public InventoryData(Inventory inventory, Map<Integer, List<ClickAction>> slotActionMap, String inventoryTitle) {
this.inventory = inventory;
this.slotActionMap = slotActionMap;
this.inventoryTitle = inventoryTitle;
}
/**
* Triggers all actions for a given inventory slot
*
* @param clickedSlot Inventory slot number to trigger all actions of
* @param eventArguments Additional arguments specified at runtime
*/
public void triggerActions(Integer clickedSlot, EventArguments eventArguments) {
List<ClickAction> slotActions = slotActionMap.get(clickedSlot);
if (slotActions == null) return;
for (ClickAction clickAction : slotActions) {
clickAction.onSlotClicked(eventArguments);
}
}
}
| UTF-8 | Java | 2,914 | java | InventoryData.java | Java | [] | null | [] | package sk.jakubvanko.commoncore;
import org.bukkit.inventory.Inventory;
import java.util.List;
import java.util.Map;
/**
* Represents an inventory data holder
*/
public final class InventoryData {
private Inventory inventory;
private Map<Integer, List<ClickAction>> slotActionMap;
private String inventoryTitle;
/**
* Gets the linked inventory
*
* @return Linked inventory
*/
public Inventory getInventory() {
return inventory;
}
/**
* Sets the linked inventory
*
* @param inventory Inventory to set as linked
*/
public void setInventory(Inventory inventory) {
this.inventory = inventory;
}
/**
* Gets a map representing inventory slots linked to different actions
*
* @return Map representing inventory slots and corresponding actions
*/
public Map<Integer, List<ClickAction>> getSlotActionMap() {
return slotActionMap;
}
/**
* Sets the map representing inventory slots linked to different actions
*
* @param slotActionMap Map representing inventory slots and corresponding actions
*/
public void setSlotActionMap(Map<Integer, List<ClickAction>> slotActionMap) {
this.slotActionMap = slotActionMap;
}
/**
* Gets the title of the inventory
* @return The title of the inventory
*/
public String getInventoryTitle() {
return inventoryTitle;
}
/**
* Creates a new inventory data holder
*
* @param inventory Linked inventory
* @param slotActionMap Map representing inventory slots linked to different actions
*/
public InventoryData(Inventory inventory, Map<Integer, List<ClickAction>> slotActionMap) {
this.inventory = inventory;
this.slotActionMap = slotActionMap;
}
/**
* Creates a new inventory data holder
*
* @param inventory Linked inventory
* @param slotActionMap Map representing inventory slots linked to different actions
* @param inventoryTitle The title of the inventory
*/
public InventoryData(Inventory inventory, Map<Integer, List<ClickAction>> slotActionMap, String inventoryTitle) {
this.inventory = inventory;
this.slotActionMap = slotActionMap;
this.inventoryTitle = inventoryTitle;
}
/**
* Triggers all actions for a given inventory slot
*
* @param clickedSlot Inventory slot number to trigger all actions of
* @param eventArguments Additional arguments specified at runtime
*/
public void triggerActions(Integer clickedSlot, EventArguments eventArguments) {
List<ClickAction> slotActions = slotActionMap.get(clickedSlot);
if (slotActions == null) return;
for (ClickAction clickAction : slotActions) {
clickAction.onSlotClicked(eventArguments);
}
}
}
| 2,914 | 0.668154 | 0.668154 | 100 | 28.139999 | 28.084879 | 117 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.29 | false | false | 1 |
ff9e4ba1ab045a18113d76e8a1bbe49a33a2dc24 | 34,273,839,066,043 | f5aa8265a2a19bc168393c9cfb79c22f71e2ea2c | /Client/src/presentation/userui/user/DetailedInfomation_controller.java | e176be5db76963eae11e80ca31c707118153b778 | [] | no_license | SYY17/HMS | https://github.com/SYY17/HMS | 9c2085ed0781398adbcd33bdd9daff1b144a4565 | a0cbc953f75f926ccc126239a911a1c1f247e6d4 | refs/heads/master | 2020-12-24T09:44:08.767000 | 2016-11-20T13:48:16 | 2016-11-20T13:48:16 | 73,274,006 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package presentation.userui.user;
import java.io.IOException;
import javax.swing.JOptionPane;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.stage.Stage;
import presentation.loginui.LogFrame;
import presentation.mainui.User_start;
public class DetailedInfomation_controller {
public static Stage stage;
@FXML
private void onLogout(ActionEvent event) throws IOException {
new LogFrame().start(stage);
}
@FXML
private void onBack(ActionEvent event) throws IOException {
new User_start().start(stage);
}
@FXML
private void onShowOrder(ActionEvent event) throws IOException {
new AllOrder_start().start(stage);
}
@FXML
private void onDetailedInfo(ActionEvent event) {
new DetailedInfomation_start().start(stage);
}
@FXML
private void onEdit(ActionEvent event) {
//JOptionPane.showMessageDialog(null, "๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝหณ๏ฟฝ", "๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ", JOptionPane.PLAIN_MESSAGE);
}
@FXML
private void onSubmit(ActionEvent event) {
new User_start().start(stage);
//JOptionPane.showMessageDialog(null, "๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝหณ๏ฟฝ", "๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ", JOptionPane.PLAIN_MESSAGE);
}
}
| UTF-8 | Java | 1,134 | java | DetailedInfomation_controller.java | Java | [] | null | [] | package presentation.userui.user;
import java.io.IOException;
import javax.swing.JOptionPane;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.stage.Stage;
import presentation.loginui.LogFrame;
import presentation.mainui.User_start;
public class DetailedInfomation_controller {
public static Stage stage;
@FXML
private void onLogout(ActionEvent event) throws IOException {
new LogFrame().start(stage);
}
@FXML
private void onBack(ActionEvent event) throws IOException {
new User_start().start(stage);
}
@FXML
private void onShowOrder(ActionEvent event) throws IOException {
new AllOrder_start().start(stage);
}
@FXML
private void onDetailedInfo(ActionEvent event) {
new DetailedInfomation_start().start(stage);
}
@FXML
private void onEdit(ActionEvent event) {
//JOptionPane.showMessageDialog(null, "๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝหณ๏ฟฝ", "๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ", JOptionPane.PLAIN_MESSAGE);
}
@FXML
private void onSubmit(ActionEvent event) {
new User_start().start(stage);
//JOptionPane.showMessageDialog(null, "๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝหณ๏ฟฝ", "๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ", JOptionPane.PLAIN_MESSAGE);
}
}
| 1,134 | 0.735348 | 0.735348 | 49 | 21.285715 | 23.669493 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.244898 | false | false | 1 |
acfcd882c65982496f75874319c2d2333c64f559 | 35,029,753,297,304 | 5edcfa46286941d1b740698f2bf31cad814c8131 | /src/com/pclewis/mcpatcher/MCPatcher.java | 8295c93cd390adc5b54c19bd9b713a50009878bc | [
"LicenseRef-scancode-public-domain"
] | permissive | Techrocket9/mcpatcher | https://github.com/Techrocket9/mcpatcher | 18313f832e52bea8e347d47585741f5cfd6d2b97 | 0d4e6e3f83bd3283c01a68e97121019796eb107d | refs/heads/master | 2021-01-18T06:40:10.139000 | 2010-12-22T19:56:36 | 2010-12-22T19:56:36 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.pclewis.mcpatcher;
import com.pclewis.mcpatcher.archive.PathArchive;
import javassist.ClassPool;
import javassist.CtClass;
import javassist.bytecode.ClassFile;
import javassist.bytecode.ConstPool;
import javassist.bytecode.MethodInfo;
import javax.imageio.ImageIO;
import javax.swing.*;
import javax.swing.text.DefaultCaret;
import java.awt.*;
import java.awt.datatransfer.StringSelection;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.io.*;
import java.net.URI;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.jar.JarOutputStream;
import java.util.logging.Logger;
import java.util.zip.ZipEntry;
public class MCPatcher {
private static final Logger logger = Logger.getLogger("com.pclewis.mcpatcher.MCPatcher");
public static PrintStream out;
public static PrintStream err;
public static Params globalParams = new Params();
public static JFrame logWindow;
private static MainForm mainForm;
public static void main(String[] argv) throws Exception {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
initLogWindow();
/*
mainForm = MainForm.create();
findMinecraft();
mainForm.show();
*/
MinecraftLibrary mcl = new MinecraftLibrary(new File(Util.getMinecraftPath(), "/archive"));
mcl.importFile( new File(Util.getMinecraftPath(), "/bin/minecraft_server.jar"));
for(Minecraft mc : mcl.getEntries()) {
Logger.getLogger("com.pclewis").fine(mc.getFile().getName() + ": " + mc.guessVersion().toString());
}
URI myJar = MCPatcher.class.getProtectionDomain().getCodeSource().getLocation().toURI();
List<Mod> mods = ModFinder.findMods(new PathArchive(new File(myJar)));
Minecraft mc = new Minecraft(new File(Util.getMinecraftPath(), "bin/minecraft.jar"));
Logger.getLogger("com.pclewis").severe(mc.getVersion().toString());
NewGui newgui = new NewGui();
for (Mod mod : mods) {
newgui.addMod(mod);
}
Deobfuscator de = deobfuscate(mc, mods);
newgui.show();
}
private static Deobfuscator deobfuscate(Minecraft mc, List<Mod> mods) throws IOException {
Deobfuscator de = new Deobfuscator(mc.getVersion());
JarFile jf = new JarFile(mc.getFile());
try {
ClassPool cp = ClassPool.getDefault();
for(JarEntry entry : Collections.list(jf.entries())) {
if(entry.getName().endsWith(".class")) {
CtClass ctClass;
try {
ctClass = cp.makeClass(jf.getInputStream(entry));
} catch (IOException e) {
e.printStackTrace();
throw new RuntimeException();
}
de.addClass( ctClass.getName() );
for(Mod mod : mods) {
String identity = mod.identifyClass(de, ctClass);
if(identity!=null) {
logger.info("Identified class: " + ctClass.getName() + " -> " + identity);
de.addClassName(ctClass.getName(), identity);
}
}
}
}
} finally {
jf.close();
}
return de;
}
private static void findMinecraft() throws Exception {
String appdata = System.getenv("APPDATA");
String home = System.getProperty("user.home");
String[] paths = new String[] {
"minecraft.original.jar",
(appdata==null?home:appdata) + "/.minecraft/bin/minecraft.original.jar",
home + "/Library/Application Support/minecraft/bin/minecraft.original.jar",
home + "/.minecraft/bin/minecraft.original.jar",
home + "/minecraft/bin/minecraft.original.jar",
"minecraft.jar",
(appdata==null?home:appdata) + "/.minecraft/bin/minecraft.jar",
home + "/Library/Application Support/minecraft/bin/minecraft.jar",
home + "/.minecraft/bin/minecraft.jar",
home + "/minecraft/bin/minecraft.jar",
};
for(String path : paths) {
File f = new File(path);
if(f.exists()) {
if(mainForm.setMinecraftPath(f.getPath())) // .getPath() to normalize /s
break;
}
}
}
private static void initLogWindow() {
logWindow = new JFrame("Log");
final JTextArea ta = new JTextArea(20,50);
((DefaultCaret)ta.getCaret()).setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
//JPanel panel = new JPanel(new GridLayout());
logWindow.add(new JScrollPane(ta), BorderLayout.CENTER);
JButton button = new JButton("Copy to Clipboard");
button.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(
new StringSelection(ta.getText()), null
);
}
});
//panel.add(button);
logWindow.add(button, BorderLayout.SOUTH);
logWindow.pack();
out = new JTextAreaPrintStream(ta);
err = out;
}
public static void applyPatch(OldMinecraft minecraft, TexturePack texturePack, File outputFile) {
JarOutputStream newjar = null;
ArrayList<PatchSet> patches = new ArrayList<PatchSet>();
ArrayList<String> replaceFiles = new ArrayList<String>();
getPatches(patches, replaceFiles);
try {
newjar = new JarOutputStream(new FileOutputStream(outputFile));
} catch(IOException e) {
e.printStackTrace(MCPatcher.err);
return;
}
if (newjar==null) {
return;
}
javassist.bytecode.MethodInfo.doPreverify = true;
ClassPool cp = ClassPool.getDefault();
for(JarEntry entry : Collections.list(minecraft.getJar().entries())) {
if(entry.getName().endsWith(".class")) {
try {
cp.makeClass(minecraft.getJar().getInputStream(entry));
} catch (IOException e) {
e.printStackTrace();
throw new RuntimeException();
}
}
}
try {
int totalFiles = minecraft.getJar().size();
int procFiles = 0;
for(JarEntry entry : Collections.list(minecraft.getJar().entries())) {
String name = entry.getName();
procFiles += 1;
mainForm.updateProgress(procFiles, totalFiles);
if(entry.getName().startsWith("META-INF"))
continue; // leave out manifest
newjar.putNextEntry(new ZipEntry(entry.getName()));
if(entry.isDirectory()) {
newjar.closeEntry();
continue;
}
InputStream input = null;
if(entry.getName().endsWith(".png"))
input = texturePack.getInputStream(entry.getName());
else
input = minecraft.getJar().getInputStream(entry);
boolean patched = false;
if(replaceFiles.contains(name)) {
replaceFiles.remove(name);
replaceFile(name, newjar);
patched = true;
} else if (name.endsWith(".class")) {
patched = applyPatches(name, input, minecraft, patches, newjar, cp);
} else if(name.equals("gui/items.png") || name.equals("terrain.png")) {
patched = resizeImage(name, input, newjar);
if(!patched) { // can't rewind, so reopen
input = texturePack.getInputStream(entry.getName());
}
}
if(!patched) {
Util.copyStream(input, newjar);
}
newjar.closeEntry();
}
// Add files in replaceFiles list that weren't encountered in src
for(String f : replaceFiles) {
newjar.putNextEntry(new ZipEntry(f));
replaceFile(f, newjar);
newjar.closeEntry();
}
newjar.close();
} catch(Exception e) {
e.printStackTrace(MCPatcher.err);
return;
}
MCPatcher.out.println("\n\n#### Success! ...probably ####");
}
private static InputStream openResource(String name) throws FileNotFoundException {
InputStream is = MCPatcher.class.getResourceAsStream("/newcode/" + name);
if(is==null) {
is = MCPatcher.class.getResourceAsStream(name);
if(is==null) {
try {
is = new FileInputStream(new File("C:/Users/nex/Desktop/projects/mcpatcher/out/production/newcode/" + name));
} catch (FileNotFoundException e) {
is = null;
}
}
}
return is;
}
private static void replaceFile(String name, JarOutputStream newjar) throws IOException {
MCPatcher.out.println("Replacing " + name);
InputStream is = openResource(name);
if(is == null)
throw new FileNotFoundException("newcode/" + name);
Util.copyStream(is, newjar);
for(int i = 1; true; ++i) {
String nn = (name.replace(".class", "$"+i+".class"));
is = openResource(nn);
if(is==null)
break;
MCPatcher.out.println("Adding " + nn);
newjar.closeEntry();
newjar.putNextEntry(new ZipEntry(nn));
Util.copyStream(is,newjar);
}
}
private static void getPatches(ArrayList<PatchSet> patches, ArrayList<String> replaceFiles) {
patches.add(new PatchSet(Patches.animManager));
patches.add(new PatchSet(Patches.animTexture));
PatchSet waterPatches = new PatchSet(Patches.water);
if (globalParams.getBoolean("useCustomWater")) {
patches.add(new PatchSet("Minecraft", new PatchSet(Patches.customWaterMC)));
replaceFiles.add("ht.class");
replaceFiles.add("ml.class");
} else {
if(!globalParams.getBoolean("useAnimatedWater")) {
waterPatches.setParam("tileSize", "0");
patches.add( new PatchSet(Patches.hideWater) );
}
patches.add(new PatchSet("FlowWater", waterPatches));
patches.add(new PatchSet("StillWater", waterPatches));
}
PatchSet lavaPatches = new PatchSet(Patches.water);
if(globalParams.getBoolean("useCustomLava")) {
patches.add(new PatchSet("Minecraft", new PatchSet(Patches.customLavaMC)));
replaceFiles.add("eg.class");
replaceFiles.add("at.class");
//lavaPatches.setParam("tileSize", "0");
//patches.add(new PatchSet("StillLava", lavaPatches));
//patches.add( new PatchSet(Patches.hideStillLava) );
} else {
if(!globalParams.getBoolean("useAnimatedLava")) {
lavaPatches.setParam("tileSize", "0");
patches.add( new PatchSet(Patches.hideLava) );
}
patches.add(new PatchSet("FlowLava", lavaPatches));
patches.add(new PatchSet("StillLava", lavaPatches));
}
if (globalParams.getBoolean("useCustomWater")||
globalParams.getBoolean("useCustomLava")) {
replaceFiles.add("WaterAnimation.class");
}
PatchSet firePatches = new PatchSet(Patches.fire);
if(!globalParams.getBoolean("useAnimatedFire")) {
firePatches.setParam("tileSize", "0");
patches.add( new PatchSet(Patches.hideFire) );
}
if(globalParams.getInt("tileSize") > 16) {
patches.add(new PatchSet("Fire",firePatches));
patches.add(new PatchSet(Patches.compass));
patches.add(new PatchSet(Patches.tool3d));
}
if(globalParams.getBoolean("useBetterGrass")) {
patches.add(new PatchSet(Patches.betterGrass));
replaceFiles.add("BetterGrass.class");
}
patches.add(new PatchSet("gy", Patches.electricCart));
patches.add(new PatchSet("jo", Patches.electricCart));
replaceFiles.add("ElectricCart.class");
patches.add(new PatchSet(Patches.cart));
patches.add(new PatchSet("Block", Patches.electricWire));
patches.add(new PatchSet(Patches.wire));
replaceFiles.add("ElectricWire.class");
replaceFiles.add("ElectricCart$Point.class");
replaceFiles.add("ElectricCart$PoweredPoint.class");
patches.add(new PatchSet(Patches.entityLoader));
patches.add(new PatchSet(Patches.moreTracks));
}
private static boolean resizeImage(String name, InputStream input, JarOutputStream newjar) throws IOException {
boolean patched = false;
int size = globalParams.getInt("tileSize") * 16;
MCPatcher.out.println("Reading " + name + "...");
BufferedImage image = ImageIO.read(input);
if(image.getWidth() != size || image.getHeight() != size) {
MCPatcher.out.println("Resizing " + name + " from " + image.getWidth() + "x" +
image.getHeight() + " to " + size + "x" + size);
BufferedImage newImage = new BufferedImage(size, size, BufferedImage.TYPE_INT_ARGB);
Graphics2D graphics2D = newImage.createGraphics();
graphics2D.drawImage(image, 0, 0, size, size, null);
// Write the scaled image to the outputstream
ImageIO.write(newImage, "PNG", newjar);
patched = true;
}
return patched;
}
private static boolean applyPatches(String name, InputStream input, OldMinecraft minecraft,
ArrayList<PatchSet> patches, JarOutputStream newjar, ClassPool classPool) throws Exception {
Boolean patched = false;
ClassFile cf = null;
ConstPool cp = null;
CtClass ct = null;
for(PatchSet patch : patches) {
if(name.equals(minecraft.getClassMap().get(patch.getClassName()))) {
if(cf == null) {
MCPatcher.out.println("Patching class: " + patch.getClassName() + " (" + name + ")");
ct = classPool.makeClass(input);
cf = ct.getClassFile(); //new ClassFile(new DataInputStream(input));
cp = cf.getConstPool();
}
patch.visitClassPre(ct);
patch.visitConstPool(cp);
for(Object mo : cf.getMethods()) {
patch.visitMethod((MethodInfo)mo);
}
patch.visitClassPost(ct);
}
}
if(cf != null) {
//cf.compact();
cf.write(new DataOutputStream(newjar));
patched = true;
}
return patched;
}
}
| UTF-8 | Java | 13,462 | java | MCPatcher.java | Java | [
{
"context": "n/minecraft.jar\"));\n Logger.getLogger(\"com.pclewis\").severe(mc.getVersion().toString());\n\n Ne",
"end": 2026,
"score": 0.8282212615013123,
"start": 2019,
"tag": "USERNAME",
"value": "pclewis"
}
] | null | [] | package com.pclewis.mcpatcher;
import com.pclewis.mcpatcher.archive.PathArchive;
import javassist.ClassPool;
import javassist.CtClass;
import javassist.bytecode.ClassFile;
import javassist.bytecode.ConstPool;
import javassist.bytecode.MethodInfo;
import javax.imageio.ImageIO;
import javax.swing.*;
import javax.swing.text.DefaultCaret;
import java.awt.*;
import java.awt.datatransfer.StringSelection;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.io.*;
import java.net.URI;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.jar.JarOutputStream;
import java.util.logging.Logger;
import java.util.zip.ZipEntry;
public class MCPatcher {
private static final Logger logger = Logger.getLogger("com.pclewis.mcpatcher.MCPatcher");
public static PrintStream out;
public static PrintStream err;
public static Params globalParams = new Params();
public static JFrame logWindow;
private static MainForm mainForm;
public static void main(String[] argv) throws Exception {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
initLogWindow();
/*
mainForm = MainForm.create();
findMinecraft();
mainForm.show();
*/
MinecraftLibrary mcl = new MinecraftLibrary(new File(Util.getMinecraftPath(), "/archive"));
mcl.importFile( new File(Util.getMinecraftPath(), "/bin/minecraft_server.jar"));
for(Minecraft mc : mcl.getEntries()) {
Logger.getLogger("com.pclewis").fine(mc.getFile().getName() + ": " + mc.guessVersion().toString());
}
URI myJar = MCPatcher.class.getProtectionDomain().getCodeSource().getLocation().toURI();
List<Mod> mods = ModFinder.findMods(new PathArchive(new File(myJar)));
Minecraft mc = new Minecraft(new File(Util.getMinecraftPath(), "bin/minecraft.jar"));
Logger.getLogger("com.pclewis").severe(mc.getVersion().toString());
NewGui newgui = new NewGui();
for (Mod mod : mods) {
newgui.addMod(mod);
}
Deobfuscator de = deobfuscate(mc, mods);
newgui.show();
}
private static Deobfuscator deobfuscate(Minecraft mc, List<Mod> mods) throws IOException {
Deobfuscator de = new Deobfuscator(mc.getVersion());
JarFile jf = new JarFile(mc.getFile());
try {
ClassPool cp = ClassPool.getDefault();
for(JarEntry entry : Collections.list(jf.entries())) {
if(entry.getName().endsWith(".class")) {
CtClass ctClass;
try {
ctClass = cp.makeClass(jf.getInputStream(entry));
} catch (IOException e) {
e.printStackTrace();
throw new RuntimeException();
}
de.addClass( ctClass.getName() );
for(Mod mod : mods) {
String identity = mod.identifyClass(de, ctClass);
if(identity!=null) {
logger.info("Identified class: " + ctClass.getName() + " -> " + identity);
de.addClassName(ctClass.getName(), identity);
}
}
}
}
} finally {
jf.close();
}
return de;
}
private static void findMinecraft() throws Exception {
String appdata = System.getenv("APPDATA");
String home = System.getProperty("user.home");
String[] paths = new String[] {
"minecraft.original.jar",
(appdata==null?home:appdata) + "/.minecraft/bin/minecraft.original.jar",
home + "/Library/Application Support/minecraft/bin/minecraft.original.jar",
home + "/.minecraft/bin/minecraft.original.jar",
home + "/minecraft/bin/minecraft.original.jar",
"minecraft.jar",
(appdata==null?home:appdata) + "/.minecraft/bin/minecraft.jar",
home + "/Library/Application Support/minecraft/bin/minecraft.jar",
home + "/.minecraft/bin/minecraft.jar",
home + "/minecraft/bin/minecraft.jar",
};
for(String path : paths) {
File f = new File(path);
if(f.exists()) {
if(mainForm.setMinecraftPath(f.getPath())) // .getPath() to normalize /s
break;
}
}
}
private static void initLogWindow() {
logWindow = new JFrame("Log");
final JTextArea ta = new JTextArea(20,50);
((DefaultCaret)ta.getCaret()).setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
//JPanel panel = new JPanel(new GridLayout());
logWindow.add(new JScrollPane(ta), BorderLayout.CENTER);
JButton button = new JButton("Copy to Clipboard");
button.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(
new StringSelection(ta.getText()), null
);
}
});
//panel.add(button);
logWindow.add(button, BorderLayout.SOUTH);
logWindow.pack();
out = new JTextAreaPrintStream(ta);
err = out;
}
public static void applyPatch(OldMinecraft minecraft, TexturePack texturePack, File outputFile) {
JarOutputStream newjar = null;
ArrayList<PatchSet> patches = new ArrayList<PatchSet>();
ArrayList<String> replaceFiles = new ArrayList<String>();
getPatches(patches, replaceFiles);
try {
newjar = new JarOutputStream(new FileOutputStream(outputFile));
} catch(IOException e) {
e.printStackTrace(MCPatcher.err);
return;
}
if (newjar==null) {
return;
}
javassist.bytecode.MethodInfo.doPreverify = true;
ClassPool cp = ClassPool.getDefault();
for(JarEntry entry : Collections.list(minecraft.getJar().entries())) {
if(entry.getName().endsWith(".class")) {
try {
cp.makeClass(minecraft.getJar().getInputStream(entry));
} catch (IOException e) {
e.printStackTrace();
throw new RuntimeException();
}
}
}
try {
int totalFiles = minecraft.getJar().size();
int procFiles = 0;
for(JarEntry entry : Collections.list(minecraft.getJar().entries())) {
String name = entry.getName();
procFiles += 1;
mainForm.updateProgress(procFiles, totalFiles);
if(entry.getName().startsWith("META-INF"))
continue; // leave out manifest
newjar.putNextEntry(new ZipEntry(entry.getName()));
if(entry.isDirectory()) {
newjar.closeEntry();
continue;
}
InputStream input = null;
if(entry.getName().endsWith(".png"))
input = texturePack.getInputStream(entry.getName());
else
input = minecraft.getJar().getInputStream(entry);
boolean patched = false;
if(replaceFiles.contains(name)) {
replaceFiles.remove(name);
replaceFile(name, newjar);
patched = true;
} else if (name.endsWith(".class")) {
patched = applyPatches(name, input, minecraft, patches, newjar, cp);
} else if(name.equals("gui/items.png") || name.equals("terrain.png")) {
patched = resizeImage(name, input, newjar);
if(!patched) { // can't rewind, so reopen
input = texturePack.getInputStream(entry.getName());
}
}
if(!patched) {
Util.copyStream(input, newjar);
}
newjar.closeEntry();
}
// Add files in replaceFiles list that weren't encountered in src
for(String f : replaceFiles) {
newjar.putNextEntry(new ZipEntry(f));
replaceFile(f, newjar);
newjar.closeEntry();
}
newjar.close();
} catch(Exception e) {
e.printStackTrace(MCPatcher.err);
return;
}
MCPatcher.out.println("\n\n#### Success! ...probably ####");
}
private static InputStream openResource(String name) throws FileNotFoundException {
InputStream is = MCPatcher.class.getResourceAsStream("/newcode/" + name);
if(is==null) {
is = MCPatcher.class.getResourceAsStream(name);
if(is==null) {
try {
is = new FileInputStream(new File("C:/Users/nex/Desktop/projects/mcpatcher/out/production/newcode/" + name));
} catch (FileNotFoundException e) {
is = null;
}
}
}
return is;
}
private static void replaceFile(String name, JarOutputStream newjar) throws IOException {
MCPatcher.out.println("Replacing " + name);
InputStream is = openResource(name);
if(is == null)
throw new FileNotFoundException("newcode/" + name);
Util.copyStream(is, newjar);
for(int i = 1; true; ++i) {
String nn = (name.replace(".class", "$"+i+".class"));
is = openResource(nn);
if(is==null)
break;
MCPatcher.out.println("Adding " + nn);
newjar.closeEntry();
newjar.putNextEntry(new ZipEntry(nn));
Util.copyStream(is,newjar);
}
}
private static void getPatches(ArrayList<PatchSet> patches, ArrayList<String> replaceFiles) {
patches.add(new PatchSet(Patches.animManager));
patches.add(new PatchSet(Patches.animTexture));
PatchSet waterPatches = new PatchSet(Patches.water);
if (globalParams.getBoolean("useCustomWater")) {
patches.add(new PatchSet("Minecraft", new PatchSet(Patches.customWaterMC)));
replaceFiles.add("ht.class");
replaceFiles.add("ml.class");
} else {
if(!globalParams.getBoolean("useAnimatedWater")) {
waterPatches.setParam("tileSize", "0");
patches.add( new PatchSet(Patches.hideWater) );
}
patches.add(new PatchSet("FlowWater", waterPatches));
patches.add(new PatchSet("StillWater", waterPatches));
}
PatchSet lavaPatches = new PatchSet(Patches.water);
if(globalParams.getBoolean("useCustomLava")) {
patches.add(new PatchSet("Minecraft", new PatchSet(Patches.customLavaMC)));
replaceFiles.add("eg.class");
replaceFiles.add("at.class");
//lavaPatches.setParam("tileSize", "0");
//patches.add(new PatchSet("StillLava", lavaPatches));
//patches.add( new PatchSet(Patches.hideStillLava) );
} else {
if(!globalParams.getBoolean("useAnimatedLava")) {
lavaPatches.setParam("tileSize", "0");
patches.add( new PatchSet(Patches.hideLava) );
}
patches.add(new PatchSet("FlowLava", lavaPatches));
patches.add(new PatchSet("StillLava", lavaPatches));
}
if (globalParams.getBoolean("useCustomWater")||
globalParams.getBoolean("useCustomLava")) {
replaceFiles.add("WaterAnimation.class");
}
PatchSet firePatches = new PatchSet(Patches.fire);
if(!globalParams.getBoolean("useAnimatedFire")) {
firePatches.setParam("tileSize", "0");
patches.add( new PatchSet(Patches.hideFire) );
}
if(globalParams.getInt("tileSize") > 16) {
patches.add(new PatchSet("Fire",firePatches));
patches.add(new PatchSet(Patches.compass));
patches.add(new PatchSet(Patches.tool3d));
}
if(globalParams.getBoolean("useBetterGrass")) {
patches.add(new PatchSet(Patches.betterGrass));
replaceFiles.add("BetterGrass.class");
}
patches.add(new PatchSet("gy", Patches.electricCart));
patches.add(new PatchSet("jo", Patches.electricCart));
replaceFiles.add("ElectricCart.class");
patches.add(new PatchSet(Patches.cart));
patches.add(new PatchSet("Block", Patches.electricWire));
patches.add(new PatchSet(Patches.wire));
replaceFiles.add("ElectricWire.class");
replaceFiles.add("ElectricCart$Point.class");
replaceFiles.add("ElectricCart$PoweredPoint.class");
patches.add(new PatchSet(Patches.entityLoader));
patches.add(new PatchSet(Patches.moreTracks));
}
private static boolean resizeImage(String name, InputStream input, JarOutputStream newjar) throws IOException {
boolean patched = false;
int size = globalParams.getInt("tileSize") * 16;
MCPatcher.out.println("Reading " + name + "...");
BufferedImage image = ImageIO.read(input);
if(image.getWidth() != size || image.getHeight() != size) {
MCPatcher.out.println("Resizing " + name + " from " + image.getWidth() + "x" +
image.getHeight() + " to " + size + "x" + size);
BufferedImage newImage = new BufferedImage(size, size, BufferedImage.TYPE_INT_ARGB);
Graphics2D graphics2D = newImage.createGraphics();
graphics2D.drawImage(image, 0, 0, size, size, null);
// Write the scaled image to the outputstream
ImageIO.write(newImage, "PNG", newjar);
patched = true;
}
return patched;
}
private static boolean applyPatches(String name, InputStream input, OldMinecraft minecraft,
ArrayList<PatchSet> patches, JarOutputStream newjar, ClassPool classPool) throws Exception {
Boolean patched = false;
ClassFile cf = null;
ConstPool cp = null;
CtClass ct = null;
for(PatchSet patch : patches) {
if(name.equals(minecraft.getClassMap().get(patch.getClassName()))) {
if(cf == null) {
MCPatcher.out.println("Patching class: " + patch.getClassName() + " (" + name + ")");
ct = classPool.makeClass(input);
cf = ct.getClassFile(); //new ClassFile(new DataInputStream(input));
cp = cf.getConstPool();
}
patch.visitClassPre(ct);
patch.visitConstPool(cp);
for(Object mo : cf.getMethods()) {
patch.visitMethod((MethodInfo)mo);
}
patch.visitClassPost(ct);
}
}
if(cf != null) {
//cf.compact();
cf.write(new DataOutputStream(newjar));
patched = true;
}
return patched;
}
}
| 13,462 | 0.651092 | 0.649532 | 406 | 32.157635 | 26.529373 | 132 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.32266 | false | false | 1 |
2f98e823fcf25d4299183377d6c45b187429fa10 | 16,080,357,623,540 | 59c8840e8bbaab940e80320f4e5a2b8a5b14beb2 | /src/main/java/xyz/no21/appcommon/ui/widget/NoTouchTabLayout.java | 1eb165298e4679c077e3058fdb1b5678ab7a5302 | [] | no_license | linqipeng/AppCommon | https://github.com/linqipeng/AppCommon | 09b606c1340b8632affa746a07b3b57d3ffbd1b6 | 6b16f960fb7a0fa67f487ece75a43731c941afa1 | refs/heads/master | 2018-12-20T05:51:58.135000 | 2018-12-05T09:41:17 | 2018-12-05T09:41:17 | 96,284,135 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package xyz.no21.appcommon.ui.widget;
import android.content.Context;
import android.support.design.widget.TabLayout;
import android.util.AttributeSet;
import android.view.MotionEvent;
/**
* Created by cookie on 2017/11/13.
* Email:l437943145@gmail.com
* Desc
*/
public class NoTouchTabLayout extends TabLayout {
public NoTouchTabLayout(Context context) {
super(context);
}
public NoTouchTabLayout(Context context, AttributeSet attrs) {
super(context, attrs);
}
public NoTouchTabLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
return true;
}
@Override
public boolean onTouchEvent(MotionEvent ev) {
return true;
}
}
| UTF-8 | Java | 834 | java | NoTouchTabLayout.java | Java | [
{
"context": "mport android.view.MotionEvent;\n\n/**\n * Created by cookie on 2017/11/13.\n * Email:l437943145@gmail.com\n * D",
"end": 211,
"score": 0.79478919506073,
"start": 205,
"tag": "USERNAME",
"value": "cookie"
},
{
"context": "\n/**\n * Created by cookie on 2017/11/13.\n * Email:l437943145@gmail.com\n * Desc\n */\n\npublic class NoTouchTabLayout extend",
"end": 256,
"score": 0.9998882412910461,
"start": 236,
"tag": "EMAIL",
"value": "l437943145@gmail.com"
}
] | null | [] | package xyz.no21.appcommon.ui.widget;
import android.content.Context;
import android.support.design.widget.TabLayout;
import android.util.AttributeSet;
import android.view.MotionEvent;
/**
* Created by cookie on 2017/11/13.
* Email:<EMAIL>
* Desc
*/
public class NoTouchTabLayout extends TabLayout {
public NoTouchTabLayout(Context context) {
super(context);
}
public NoTouchTabLayout(Context context, AttributeSet attrs) {
super(context, attrs);
}
public NoTouchTabLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
return true;
}
@Override
public boolean onTouchEvent(MotionEvent ev) {
return true;
}
}
| 821 | 0.703837 | 0.681055 | 36 | 22.166666 | 21.996843 | 84 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.444444 | false | false | 1 |
bb1b5a173c36d86800fca5cd16847b72d93bf55e | 36,180,804,525,593 | 036a8a45975691374deb5e518d1f6feaec1b96cd | /src/main/java/um/canario/grupo1/models/dao/HashtagDao.java | c35beaa8b298698fb6c8e7e6fa26499403734740 | [] | no_license | um-fi-programacion2/canario_grupo1 | https://github.com/um-fi-programacion2/canario_grupo1 | fad95820c30b5f2a3b1f46ce40e6f4aad09b4453 | d407c4f3b8ba3d0eb874064f3fedb76b205a6fbb | refs/heads/master | 2020-04-06T03:40:53.854000 | 2013-06-23T16:36:06 | 2013-06-23T16:36:06 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package um.canario.grupo1.models.dao;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import um.canario.grupo1.models.beans.Tags;
import um.canario.grupo1.models.beans.TweetBean;
import um.canario.grupo1.models.beans.UsuarioBean;
import um.canario.grupo1.utils.HibernateUtil;
public class HashtagDao {
//LISTA
public boolean guardar(List<String> hashtags, Integer idTweet) {
Tags tag;
try {
for (String tago : hashtags) {
tag = new Tags();
tag.setIdTweet(idTweet);
tag.setTag(tago);
System.err.println("Hashtag: " + tag.getTag());
SessionFactory sesion = HibernateUtil.getSessionFactory();
Transaction t = null;
Session session = sesion.openSession();
t = session.beginTransaction();
session.persist(tag);
t.commit();
System.err.println("Hashtagged #" + tag.getTag());
}
} catch (Exception e) {
System.err.println("ERROR Hashtagged #guardar" + e);
}
return true;
}
//LISTA
public List<Tags> getHashtags(String tag) { //Devuelve las menciones (idTweet+idUsuario) de un idUsuario
System.err.println("FROM Tags tago where tago.tag = " + tag);
try {
List<Tags> tags = new ArrayList<Tags>();
SessionFactory sf = HibernateUtil.getSessionFactory();
Transaction t = null;
Session s = sf.openSession();
t = s.beginTransaction(); // start a new transaction
Query query = s.createQuery("FROM Tags tago where tago.tag = '" + tag + "'");
t.commit();
tags = query.list();
return tags;
} catch (Exception ex) {
System.err.println("Error getHashtags()!-->" + ex.getMessage());
return null;
}
}
//LISTA
public List<UsuarioBean> getUsuarios(String tag) { //Devuelve los usuarios que escriben los tweets donde
//se menciona a nombreDeUsuario
List<UsuarioBean> usuarios = new ArrayList<UsuarioBean>();
try {
SessionFactory sf = HibernateUtil.getSessionFactory();
Transaction t = null;
Session s = sf.openSession();
t = s.beginTransaction();
String IN = this.getUsuariosIdsString(tag); //Trae usuarios
Query query = s.createQuery("FROM UsuarioBean t where t.id IN " + IN);
usuarios = (List<UsuarioBean>) query.list();
t.commit();
return usuarios;
} catch (Exception e) {
System.err.println("getUsuarios MentionDAO !-->" + e.getMessage());
return usuarios;
}
}
//LISTA
public List<TweetBean> getTweets(String tag) { //Devuelve los tweets donde se menciona a nombreDeUsuario
List<TweetBean> tweets = new ArrayList<TweetBean>();
String IN = this.getTweetsIdsString(tag);
System.err.println("FROM TweetBean t where t.id IN " + IN);
try {
SessionFactory sf = HibernateUtil.getSessionFactory();
Transaction t = null;
Session s = sf.openSession();
t = s.beginTransaction();
Query query = s.createQuery("FROM TweetBean t where t.id IN " + IN);
tweets = (List<TweetBean>) query.list();
t.commit();
return tweets;
} catch (Exception e) {
System.err.println("Error1003 !-->" + e.getMessage());
return tweets;
}
}
//LISTA
private String getUsuariosIdsString(String tag) { //Devuelve los IDฤซs de los usuarios que estan tagueados
//con el String tag
List<TweetBean> tweetsIds = new ArrayList<TweetBean>();
tweetsIds = this.getTweets(tag);
Iterator iter = tweetsIds.iterator();
TweetBean tweet;
String IN;
if (iter.hasNext()) {
IN = "(";
while (iter.hasNext()) {
tweet = (TweetBean) iter.next();
IN = IN + tweet.getIdUsuario();
if (iter.hasNext()) {
IN = IN + " , ";
}
}
IN = IN + ")";
} else {
IN = "(null)";
}
System.err.println("usuariosIds !-->" + IN);
return IN; //devuelve algo como (12,232,42,24)
}
//LISTA
public String getTweetsIdsString(String tag) { //Devuelve los IDฤซs de los tweets donde se menciona a idUsuario
List<Tags> tags = new ArrayList<Tags>();
tags = this.getHashtags(tag);
Iterator iter = tags.iterator();
Tags tago;
String IN;
if (iter.hasNext()) {
IN = "(";
while (iter.hasNext()) {
tago = (Tags) iter.next();
IN = IN + tago.getIdTweet();
if (iter.hasNext()) {
IN = IN + " , ";
}
}
IN = IN + ")";
} else {
IN = "(null)";
}
System.err.println("tagsId !-->" + IN);
return IN; //devuelve algo como (12,232,42,24)
}
public List<Tags> getTop() {
List<Tags> tags = new ArrayList<Tags>();
try {
SessionFactory sf = HibernateUtil.getSessionFactory();
Transaction t = null;
Session s = sf.openSession();
t = s.beginTransaction(); // start a new transaction
Query query = s.createQuery("FROM Tags Group by tag order by count(*) desc ");
query.setFirstResult(0);
query.setMaxResults(10);
t.commit();
tags = query.list();
return tags;
} catch (Exception ex) {
System.err.println("Error getTOP()!-->" + ex.getMessage());
return null;
}
}
}
| ISO-8859-10 | Java | 6,178 | java | HashtagDao.java | Java | [] | null | [] | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package um.canario.grupo1.models.dao;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import um.canario.grupo1.models.beans.Tags;
import um.canario.grupo1.models.beans.TweetBean;
import um.canario.grupo1.models.beans.UsuarioBean;
import um.canario.grupo1.utils.HibernateUtil;
public class HashtagDao {
//LISTA
public boolean guardar(List<String> hashtags, Integer idTweet) {
Tags tag;
try {
for (String tago : hashtags) {
tag = new Tags();
tag.setIdTweet(idTweet);
tag.setTag(tago);
System.err.println("Hashtag: " + tag.getTag());
SessionFactory sesion = HibernateUtil.getSessionFactory();
Transaction t = null;
Session session = sesion.openSession();
t = session.beginTransaction();
session.persist(tag);
t.commit();
System.err.println("Hashtagged #" + tag.getTag());
}
} catch (Exception e) {
System.err.println("ERROR Hashtagged #guardar" + e);
}
return true;
}
//LISTA
public List<Tags> getHashtags(String tag) { //Devuelve las menciones (idTweet+idUsuario) de un idUsuario
System.err.println("FROM Tags tago where tago.tag = " + tag);
try {
List<Tags> tags = new ArrayList<Tags>();
SessionFactory sf = HibernateUtil.getSessionFactory();
Transaction t = null;
Session s = sf.openSession();
t = s.beginTransaction(); // start a new transaction
Query query = s.createQuery("FROM Tags tago where tago.tag = '" + tag + "'");
t.commit();
tags = query.list();
return tags;
} catch (Exception ex) {
System.err.println("Error getHashtags()!-->" + ex.getMessage());
return null;
}
}
//LISTA
public List<UsuarioBean> getUsuarios(String tag) { //Devuelve los usuarios que escriben los tweets donde
//se menciona a nombreDeUsuario
List<UsuarioBean> usuarios = new ArrayList<UsuarioBean>();
try {
SessionFactory sf = HibernateUtil.getSessionFactory();
Transaction t = null;
Session s = sf.openSession();
t = s.beginTransaction();
String IN = this.getUsuariosIdsString(tag); //Trae usuarios
Query query = s.createQuery("FROM UsuarioBean t where t.id IN " + IN);
usuarios = (List<UsuarioBean>) query.list();
t.commit();
return usuarios;
} catch (Exception e) {
System.err.println("getUsuarios MentionDAO !-->" + e.getMessage());
return usuarios;
}
}
//LISTA
public List<TweetBean> getTweets(String tag) { //Devuelve los tweets donde se menciona a nombreDeUsuario
List<TweetBean> tweets = new ArrayList<TweetBean>();
String IN = this.getTweetsIdsString(tag);
System.err.println("FROM TweetBean t where t.id IN " + IN);
try {
SessionFactory sf = HibernateUtil.getSessionFactory();
Transaction t = null;
Session s = sf.openSession();
t = s.beginTransaction();
Query query = s.createQuery("FROM TweetBean t where t.id IN " + IN);
tweets = (List<TweetBean>) query.list();
t.commit();
return tweets;
} catch (Exception e) {
System.err.println("Error1003 !-->" + e.getMessage());
return tweets;
}
}
//LISTA
private String getUsuariosIdsString(String tag) { //Devuelve los IDฤซs de los usuarios que estan tagueados
//con el String tag
List<TweetBean> tweetsIds = new ArrayList<TweetBean>();
tweetsIds = this.getTweets(tag);
Iterator iter = tweetsIds.iterator();
TweetBean tweet;
String IN;
if (iter.hasNext()) {
IN = "(";
while (iter.hasNext()) {
tweet = (TweetBean) iter.next();
IN = IN + tweet.getIdUsuario();
if (iter.hasNext()) {
IN = IN + " , ";
}
}
IN = IN + ")";
} else {
IN = "(null)";
}
System.err.println("usuariosIds !-->" + IN);
return IN; //devuelve algo como (12,232,42,24)
}
//LISTA
public String getTweetsIdsString(String tag) { //Devuelve los IDฤซs de los tweets donde se menciona a idUsuario
List<Tags> tags = new ArrayList<Tags>();
tags = this.getHashtags(tag);
Iterator iter = tags.iterator();
Tags tago;
String IN;
if (iter.hasNext()) {
IN = "(";
while (iter.hasNext()) {
tago = (Tags) iter.next();
IN = IN + tago.getIdTweet();
if (iter.hasNext()) {
IN = IN + " , ";
}
}
IN = IN + ")";
} else {
IN = "(null)";
}
System.err.println("tagsId !-->" + IN);
return IN; //devuelve algo como (12,232,42,24)
}
public List<Tags> getTop() {
List<Tags> tags = new ArrayList<Tags>();
try {
SessionFactory sf = HibernateUtil.getSessionFactory();
Transaction t = null;
Session s = sf.openSession();
t = s.beginTransaction(); // start a new transaction
Query query = s.createQuery("FROM Tags Group by tag order by count(*) desc ");
query.setFirstResult(0);
query.setMaxResults(10);
t.commit();
tags = query.list();
return tags;
} catch (Exception ex) {
System.err.println("Error getTOP()!-->" + ex.getMessage());
return null;
}
}
}
| 6,178 | 0.541451 | 0.536593 | 210 | 28.409523 | 26.27626 | 114 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.538095 | false | false | 1 |
c1892d5bb2b1d65e5436984510c963e8257dfef5 | 24,850,680,830,086 | 915a40377933ba3d624441bab64826339bd5d060 | /Driver.java | dbe5b83299e36222e2a71995f7758090c37dcb72 | [] | no_license | saumyanda/Backpropagation-neural-net | https://github.com/saumyanda/Backpropagation-neural-net | 6692dc254572c66aef338c1d700b789747e589e0 | 91ae33dcc3b90573047adc2182b08755418faa55 | refs/heads/master | 2023-06-05T22:32:23.051000 | 2021-07-01T20:45:11 | 2021-07-01T20:45:11 | 216,957,796 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ece.cpen502;
import java.io.File;
import java.io.IOException;
public class Driver {
public static void main(String[] args) throws IOException {
NeuralNet nn = new NeuralNet();
nn.initializeTrainingSet();
//Training the network for 100 trials
int avgEpoch=0;
for(int i = 0; i < 100; i++) {
nn.initializeWeights();
avgEpoch += nn.train();
}
avgEpoch = avgEpoch / 100;
System.out.println("avg epoch " + avgEpoch);
//Save error to a file
nn.saveErrorToFile("C:\\Users\\saumy\\Desktop\\error.txt");
// Load and save weights to file
nn.save(new File("C:\\Users\\saumy\\Desktop\\weights.txt"));
try {
nn.load("C:\\Users\\saumy\\Desktop\\weights.txt");
} catch (IOException e) {
e.printStackTrace();
}
}
}
| UTF-8 | Java | 788 | java | Driver.java | Java | [] | null | [] | package ece.cpen502;
import java.io.File;
import java.io.IOException;
public class Driver {
public static void main(String[] args) throws IOException {
NeuralNet nn = new NeuralNet();
nn.initializeTrainingSet();
//Training the network for 100 trials
int avgEpoch=0;
for(int i = 0; i < 100; i++) {
nn.initializeWeights();
avgEpoch += nn.train();
}
avgEpoch = avgEpoch / 100;
System.out.println("avg epoch " + avgEpoch);
//Save error to a file
nn.saveErrorToFile("C:\\Users\\saumy\\Desktop\\error.txt");
// Load and save weights to file
nn.save(new File("C:\\Users\\saumy\\Desktop\\weights.txt"));
try {
nn.load("C:\\Users\\saumy\\Desktop\\weights.txt");
} catch (IOException e) {
e.printStackTrace();
}
}
}
| 788 | 0.634518 | 0.616751 | 32 | 22.625 | 19.07346 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.90625 | false | false | 1 |
5a761b37e54d5aab96ac38dabdebf6204a28865f | 24,850,680,828,172 | 6e5cd67b9d4fc82b9bef8c8280012b062295c086 | /src/tarefa7/Tarefa7.java | 266b4e92bb16a1f9d9bdc7c8401a0de85a39bf62 | [] | no_license | jreyarijon/tarefa7 | https://github.com/jreyarijon/tarefa7 | ef42af9f6ad585dc977658237d809dd10d728879 | ee2185e4a2684f2fc51d8d81f0dff3a322615dc2 | refs/heads/master | 2022-04-23T12:04:04.572000 | 2020-04-29T16:56:39 | 2020-04-29T16:56:39 | 259,986,929 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* 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 tarefa7;
import java.util.ArrayList;
import javax.swing.JOptionPane;
/**
*
* @author Josemolamazo
*/
public class Tarefa7 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Barco vel = new Veleros("vel123", 2, 4.5f);
Barco yat = new Yates("yat123", 35.5f, 3, 7.5f);
Barco barMot = new BarcoMotor("barMot123", 60.6f, 5.3f);
ArrayList<Barco> barcos = new ArrayList();
barcos.add(vel);
barcos.add(yat);
barcos.add(barMot);
int opcion = 0;
while (opcion < 4) {
opcion = Integer.parseInt(JOptionPane.showInputDialog(null, "---MENU---"
+ "\n 1. Alquilar velero."
+ "\n 2. Alquilar barco a motor."
+ "\n 3. Alquilar yate."
+ "\n 4. Sair."));
switch (opcion) {
case 1:
System.out.println("---FACTURA--------\n" + vel.factura(vel.aluguer()));
break;
case 2:
System.out.println("---FACTURA--------\n" + barMot.factura(barMot.aluguer()));
break;
case 3:
System.out.println("---FACTURA--------\n" + yat.factura(yat.aluguer()));
break;
case 4:
System.exit(0);
}
}
}
}
| UTF-8 | Java | 1,672 | java | Tarefa7.java | Java | [
{
"context": "rt javax.swing.JOptionPane;\r\n\r\n/**\r\n *\r\n * @author Josemolamazo\r\n */\r\npublic class Tarefa7 {\r\n\r\n /**\r\n * @",
"end": 306,
"score": 0.899787962436676,
"start": 294,
"tag": "NAME",
"value": "Josemolamazo"
}
] | null | [] | /*
* 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 tarefa7;
import java.util.ArrayList;
import javax.swing.JOptionPane;
/**
*
* @author Josemolamazo
*/
public class Tarefa7 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Barco vel = new Veleros("vel123", 2, 4.5f);
Barco yat = new Yates("yat123", 35.5f, 3, 7.5f);
Barco barMot = new BarcoMotor("barMot123", 60.6f, 5.3f);
ArrayList<Barco> barcos = new ArrayList();
barcos.add(vel);
barcos.add(yat);
barcos.add(barMot);
int opcion = 0;
while (opcion < 4) {
opcion = Integer.parseInt(JOptionPane.showInputDialog(null, "---MENU---"
+ "\n 1. Alquilar velero."
+ "\n 2. Alquilar barco a motor."
+ "\n 3. Alquilar yate."
+ "\n 4. Sair."));
switch (opcion) {
case 1:
System.out.println("---FACTURA--------\n" + vel.factura(vel.aluguer()));
break;
case 2:
System.out.println("---FACTURA--------\n" + barMot.factura(barMot.aluguer()));
break;
case 3:
System.out.println("---FACTURA--------\n" + yat.factura(yat.aluguer()));
break;
case 4:
System.exit(0);
}
}
}
}
| 1,672 | 0.477273 | 0.455742 | 53 | 29.547171 | 25.953199 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.566038 | false | false | 1 |
20dc84e4e2efcc58516fc180c51371752f298c49 | 16,578,573,815,064 | 495be39be705effa8b23c6f9acf9a878f3bc856b | /app/src/main/java/se/mah/pfi3_2015_marcus_n/Variables.java | f4da799ca8e5ed96d75d9b18ca1425f35871e16f | [] | no_license | Mcni91/Pfi3_2015_Marcus_N | https://github.com/Mcni91/Pfi3_2015_Marcus_N | 9dc9fda95b908c2c775d28d1be9cbe7de024dfae | 16e8461d6d0d0a3555d350f51e2666f4d6877025 | refs/heads/master | 2021-01-20T12:41:39.279000 | 2015-04-29T23:17:10 | 2015-04-29T23:17:10 | 33,303,397 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package se.mah.pfi3_2015_marcus_n;
/**
* Saves variables through orientations changes.
*/
public class Variables {
public static String quote = "";
}
| UTF-8 | Java | 157 | java | Variables.java | Java | [] | null | [] | package se.mah.pfi3_2015_marcus_n;
/**
* Saves variables through orientations changes.
*/
public class Variables {
public static String quote = "";
}
| 157 | 0.700637 | 0.66879 | 8 | 18.625 | 17.943924 | 48 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | false | false | 1 |
f81995278274625155062960ac141f2ebdfa0a17 | 1,975,685,008,021 | 062e4946766d8d006f7c094646c7738cdcecdacc | /app/src/main/java/com/arsalan/garage/volleytask/HttpUtils.java | 159fec26bfa22d55951459b38eeb5777abbf88a1 | [] | no_license | noorazmi/Garage | https://github.com/noorazmi/Garage | 5e5bc7c8daa9964d8c6d7fd1f298c214bce77d74 | 6b0e7040e3e75b5f0a3652247782065d4faa4d8f | refs/heads/master | 2021-01-16T23:45:29.756000 | 2017-07-20T12:03:19 | 2017-07-20T12:03:19 | 41,489,224 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.arsalan.garage.volleytask;
import com.arsalan.garage.utils.Logger;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
/**
* <p/>
* Created by: Noor Alam on 14/12/15.<br/>
* Email id: noor.alam@tothenew.com<br/>
* Skype id: mfsi_noora
* <p/>
*/
class HttpUtils {
/**
* Returns ResponseModel after populating it using JSONString passed in this method.
*
* @param resultJson
* @param responseModelClassFullyQualifiedName Fully qualified name of the class extending the ValueObject interface
* @return
*/
protected static ResponseModel getResponseModelObject(String resultJson, String responseModelClassFullyQualifiedName) {
try {
Class<? extends ResponseModel> valueObjectClass = (Class<? extends ResponseModel>) Class.forName(responseModelClassFullyQualifiedName);
return getModelFromJsonString(resultJson, valueObjectClass);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
//Parsing was not successful, we are returning null.
return null;
}
/**
* @param response json string obtained from the server
* @param responseModelClassObject Class of {@link ResponseModel} base class in which we have to fill the data from json string
* @return ValueObject after populating it with data obtained from json string
*/
private static ResponseModel getModelFromJsonString(String response, Class responseModelClassObject) {
Gson gson = new GsonBuilder().create();
ResponseModel valueObject = null;
try {
valueObject = (ResponseModel) gson.fromJson(response, responseModelClassObject);
} catch (com.google.gson.JsonSyntaxException e) {
Logger.printError("com.google.gson.JsonSyntaxException:" + e.getMessage());
}
return valueObject;
}
}
| UTF-8 | Java | 1,911 | java | HttpUtils.java | Java | [
{
"context": "ogle.gson.GsonBuilder;\n\n/**\n * <p/>\n * Created by: Noor Alam on 14/12/15.<br/>\n * Email id: noor.alam@tothenew",
"end": 183,
"score": 0.9998680353164673,
"start": 173,
"tag": "NAME",
"value": "Noor Alam"
},
{
"context": "ated by: Noor Alam on 14/12/15.<br/>\n * Email id: noor.alam@tothenew.com<br/>\n * Skype id: mfsi_noora\n * <p/>\n */\nclass Ht",
"end": 237,
"score": 0.999933123588562,
"start": 215,
"tag": "EMAIL",
"value": "noor.alam@tothenew.com"
}
] | null | [] | package com.arsalan.garage.volleytask;
import com.arsalan.garage.utils.Logger;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
/**
* <p/>
* Created by: <NAME> on 14/12/15.<br/>
* Email id: <EMAIL><br/>
* Skype id: mfsi_noora
* <p/>
*/
class HttpUtils {
/**
* Returns ResponseModel after populating it using JSONString passed in this method.
*
* @param resultJson
* @param responseModelClassFullyQualifiedName Fully qualified name of the class extending the ValueObject interface
* @return
*/
protected static ResponseModel getResponseModelObject(String resultJson, String responseModelClassFullyQualifiedName) {
try {
Class<? extends ResponseModel> valueObjectClass = (Class<? extends ResponseModel>) Class.forName(responseModelClassFullyQualifiedName);
return getModelFromJsonString(resultJson, valueObjectClass);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
//Parsing was not successful, we are returning null.
return null;
}
/**
* @param response json string obtained from the server
* @param responseModelClassObject Class of {@link ResponseModel} base class in which we have to fill the data from json string
* @return ValueObject after populating it with data obtained from json string
*/
private static ResponseModel getModelFromJsonString(String response, Class responseModelClassObject) {
Gson gson = new GsonBuilder().create();
ResponseModel valueObject = null;
try {
valueObject = (ResponseModel) gson.fromJson(response, responseModelClassObject);
} catch (com.google.gson.JsonSyntaxException e) {
Logger.printError("com.google.gson.JsonSyntaxException:" + e.getMessage());
}
return valueObject;
}
}
| 1,892 | 0.687598 | 0.684458 | 50 | 37.220001 | 39.323933 | 147 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.36 | false | false | 1 |
2c36a329d2f4dfd047b0639eb721a3d46c208b3a | 24,927,990,224,472 | 056386baab8a1ff68d2b318c0fad3e3f115a971d | /src/main/java/com/everis/livecode/abstraction/Main.java | cdc1791469bed8a1554e7870c369d7063c68683d | [] | no_license | javaPassionate/everisJavaTrainingLiveCode | https://github.com/javaPassionate/everisJavaTrainingLiveCode | 453fa1afb9b23ac25e31a4e51e73568a532dbdfa | 3b08c2f40a1ea0dc0145a61fe25259ae1623ebbd | refs/heads/master | 2020-05-07T14:21:00.081000 | 2019-04-11T11:44:45 | 2019-04-11T11:44:45 | 180,589,949 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.everis.livecode.abstraction;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.everis.livecode.abstraction.models.Student;
import com.everis.livecode.abstraction.models.StudentDTO;
public class Main {
public static void main(String[] args) {
StudentTransformer studentTransformer = new StudentTransformer();
List<Object> studentList = new ArrayList<Object>();
Student student = new Student("Mohammed", new Date());
studentList.add(student);
List<Object> dtoList = studentTransformer.toDTOList(studentList);
StudentDTO dto = (StudentDTO) dtoList.get(0);
System.out.println(dto.getFirstName());
System.out.println(dto.getBirthDate());
}
} | UTF-8 | Java | 710 | java | Main.java | Java | [
{
"context": "yList<Object>();\n\t\tStudent student = new Student(\"Mohammed\", new Date());\n\t\tstudentList.add(student);\n\t\t\n\t\tL",
"end": 458,
"score": 0.9997963905334473,
"start": 450,
"tag": "NAME",
"value": "Mohammed"
}
] | null | [] | package com.everis.livecode.abstraction;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.everis.livecode.abstraction.models.Student;
import com.everis.livecode.abstraction.models.StudentDTO;
public class Main {
public static void main(String[] args) {
StudentTransformer studentTransformer = new StudentTransformer();
List<Object> studentList = new ArrayList<Object>();
Student student = new Student("Mohammed", new Date());
studentList.add(student);
List<Object> dtoList = studentTransformer.toDTOList(studentList);
StudentDTO dto = (StudentDTO) dtoList.get(0);
System.out.println(dto.getFirstName());
System.out.println(dto.getBirthDate());
}
} | 710 | 0.764789 | 0.76338 | 25 | 27.440001 | 23.589964 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.4 | false | false | 1 |
05a6bc5e1006ddce4ca42cf2b4dfa645cb3c53e4 | 25,340,307,093,765 | c2c3f107e5f7a2e836265f7c11cbe7b3bd55308d | /openexchange-test/unittests/com/openexchange/mail/folderstorage/MailFolderTest.java | 8c187a72e655ebd1aab73e356759bbc72c696988 | [] | no_license | yantarou/backend | https://github.com/yantarou/backend | d20a4d566a1cb80195cf3a2ee6a35e1be4faaa4a | 8146bbc247512dd9e0fd1f7aaee634ebe799c40c | refs/heads/master | 2020-03-12T13:16:55.281000 | 2018-04-23T05:50:07 | 2018-04-23T05:50:07 | 130,638,291 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
*
* OPEN-XCHANGE legal information
*
* All intellectual property rights in the Software are protected by
* international copyright laws.
*
*
* In some countries OX, OX Open-Xchange, open xchange and OXtender
* as well as the corresponding Logos OX Open-Xchange and OX are registered
* trademarks of the OX Software GmbH group of companies.
* The use of the Logos is not covered by the GNU General Public License.
* Instead, you are allowed to use these Logos according to the terms and
* conditions of the Creative Commons License, Version 2.5, Attribution,
* Non-commercial, ShareAlike, and the interpretation of the term
* Non-commercial applicable to the aforementioned license is published
* on the web site http://www.open-xchange.com/EN/legal/index.html.
*
* Please make sure that third-party modules and libraries are used
* according to their respective licenses.
*
* Any modifications to this package must retain all copyright notices
* of the original copyright holder(s) for the original code used.
*
* After any such modifications, the original and derivative code shall remain
* under the copyright of the copyright holder(s) and/or original author(s)per
* the Attribution and Assignment Agreement that can be located at
* http://www.open-xchange.com/EN/developer/. The contributing author shall be
* given Attribution for the derivative code and a license granting use.
*
* Copyright (C) 2016-2020 OX Software GmbH
* Mail: info@open-xchange.com
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License, Version 2 as published
* by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc., 59
* Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.openexchange.mail.folderstorage;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.io.IOException;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import javax.mail.MessagingException;
import org.junit.Test;
import com.openexchange.exception.OXException;
import com.openexchange.imap.dataobjects.IMAPMailFolder;
import com.openexchange.mail.AbstractMailTest;
import com.openexchange.mail.IndexRange;
import com.openexchange.mail.MailField;
import com.openexchange.mail.MailProviderRegistry;
import com.openexchange.mail.MailSortField;
import com.openexchange.mail.OrderDirection;
import com.openexchange.mail.Quota;
import com.openexchange.mail.api.MailAccess;
import com.openexchange.mail.api.MailCapabilities;
import com.openexchange.mail.config.MailProperties;
import com.openexchange.mail.dataobjects.MailFolder;
import com.openexchange.mail.dataobjects.MailFolderDescription;
import com.openexchange.mail.dataobjects.MailMessage;
import com.openexchange.mail.permission.DefaultMailPermission;
import com.openexchange.mail.permission.MailPermission;
import com.openexchange.mail.usersetting.UserSettingMailStorage;
import com.openexchange.mailaccount.MailAccount;
import com.openexchange.server.impl.OCLPermission;
import com.openexchange.sessiond.impl.SessionObject;
/**
* {@link MailFolderTest}
*
* @author <a href="mailto:thorben.betten@open-xchange.com">Thorben Betten</a>
*
*/
public final class MailFolderTest extends AbstractMailTest {
private static final String INBOX = "INBOX";
@Test
public void testStandardFolders() {
try {
final SessionObject session = getSession();
final MailAccess<?, ?> mailAccess = MailAccess.getInstance(session);
mailAccess.connect();
try {
String fullname = mailAccess.getFolderStorage().getDraftsFolder();
assertTrue("Missing drafts folder", fullname != null && fullname.length() > 0);
fullname = mailAccess.getFolderStorage().getSentFolder();
assertTrue("Missing sent folder", fullname != null && fullname.length() > 0);
fullname = mailAccess.getFolderStorage().getSpamFolder();
assertTrue("Missing spam folder", fullname != null && fullname.length() > 0);
fullname = mailAccess.getFolderStorage().getTrashFolder();
assertTrue("Missing trash folder", fullname != null && fullname.length() > 0);
if (UserSettingMailStorage.getInstance().getUserSettingMail(getUser(), getCid()).isSpamEnabled()) {
fullname = mailAccess.getFolderStorage().getConfirmedHamFolder();
assertTrue("Missing confirmed ham folder: " + fullname, fullname != null && fullname.length() > 0);
fullname = mailAccess.getFolderStorage().getConfirmedSpamFolder();
assertTrue("Missing confirmed spam folder: " + fullname, fullname != null && fullname.length() > 0);
}
} finally {
/*
* close
*/
mailAccess.close(false);
}
} catch (final Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}
@Test
public void testExistStandardFolders() {
try {
final SessionObject session = getSession();
final MailAccess<?, ?> mailAccess = MailAccess.getInstance(session);
mailAccess.connect();
try {
String fullname = mailAccess.getFolderStorage().getDraftsFolder();
assertTrue("Non-existing drafts folder", mailAccess.getFolderStorage().exists(fullname));
fullname = mailAccess.getFolderStorage().getSentFolder();
assertTrue("Non-existing sent folder", mailAccess.getFolderStorage().exists(fullname));
fullname = mailAccess.getFolderStorage().getSpamFolder();
assertTrue("Non-existing spam folder", mailAccess.getFolderStorage().exists(fullname));
fullname = mailAccess.getFolderStorage().getTrashFolder();
assertTrue("Non-existing trash folder", mailAccess.getFolderStorage().exists(fullname));
if (UserSettingMailStorage.getInstance().getUserSettingMail(getUser(), getCid()).isSpamEnabled()) {
fullname = mailAccess.getFolderStorage().getConfirmedHamFolder();
assertTrue("Non-existing confirmed ham folder", mailAccess.getFolderStorage().exists(fullname));
fullname = mailAccess.getFolderStorage().getConfirmedSpamFolder();
assertTrue("Non-existing confirmed spam folder", mailAccess.getFolderStorage().exists(fullname));
}
} finally {
/*
* close
*/
mailAccess.close(false);
}
} catch (final Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}
@Test
public void testFolderGet() throws OXException {
final SessionObject session = getSession();
final MailAccess<?, ?> mailAccess = MailAccess.getInstance(session);
mailAccess.connect();
try {
final MailFolder f = mailAccess.getFolderStorage().getFolder(INBOX);
assertTrue("Missing default folder flag", f.containsDefaultFolder());
assertTrue("Missing deleted count", f.containsDeletedMessageCount());
assertTrue("Missing exists flag", f.containsExists());
assertTrue("Missing fullname", f.containsFullname());
assertTrue("Missing holds folders flag", f.containsHoldsFolders());
assertTrue("Missing holds messages flag", f.containsHoldsMessages());
assertTrue("Missing message count", f.containsMessageCount());
assertTrue("Missing name", f.containsName());
assertTrue("Missing new message count", f.containsNewMessageCount());
if (f instanceof IMAPMailFolder) {
assertTrue("Missing non-existent flag", ((IMAPMailFolder) f).containsNonExistent());
}
assertTrue("Missing own permission", f.containsOwnPermission());
assertTrue("Missing parent fullname", f.containsParentFullname());
assertTrue("Missing permissions", f.containsPermissions());
assertTrue("Missing root folder flag", f.containsRootFolder());
assertTrue("Missing separator flag", f.containsSeparator());
assertTrue("Missing subfolder flag", f.containsSubfolders());
assertTrue("Missing subscribed flag", f.containsSubscribed());
assertTrue("Missing subscribed subfolders flag", f.containsSubscribedSubfolders());
assertTrue("Missing supports user flags flag", f.containsSupportsUserFlags());
assertTrue("Missing unread message count", f.containsUnreadMessageCount());
} finally {
/*
* close
*/
mailAccess.close(false);
}
}
@Test
public void testFolderCreateAndSubfolders() throws OXException {
final SessionObject session = getSession();
final MailAccess<?, ?> mailAccess = MailAccess.getInstance(session);
mailAccess.connect();
String fullname = null;
try {
final MailFolder f = mailAccess.getFolderStorage().getFolder(INBOX);
assertTrue("Missing default folder flag", f.containsDefaultFolder());
assertTrue("Missing deleted count", f.containsDeletedMessageCount());
assertTrue("Missing exists flag", f.containsExists());
assertTrue("Missing fullname", f.containsFullname());
assertTrue("Missing holds folders flag", f.containsHoldsFolders());
assertTrue("Missing holds messages flag", f.containsHoldsMessages());
assertTrue("Missing message count", f.containsMessageCount());
assertTrue("Missing name", f.containsName());
assertTrue("Missing new message count", f.containsNewMessageCount());
if (f instanceof IMAPMailFolder) {
assertTrue("Missing non-existent flag", ((IMAPMailFolder) f).containsNonExistent());
}
assertTrue("Missing own permission", f.containsOwnPermission());
assertTrue("Missing parent fullname", f.containsParentFullname());
assertTrue("Missing permissions", f.containsPermissions());
assertTrue("Missing root folder flag", f.containsRootFolder());
assertTrue("Missing separator flag", f.containsSeparator());
assertTrue("Missing subfolder flag", f.containsSubfolders());
assertTrue("Missing subscribed flag", f.containsSubscribed());
assertTrue("Missing subscribed subfolders flag", f.containsSubscribedSubfolders());
assertTrue("Missing supports user flags flag", f.containsSupportsUserFlags());
assertTrue("Missing unread message count", f.containsUnreadMessageCount());
String parentFullname = null;
{
final MailFolder inbox = mailAccess.getFolderStorage().getFolder(INBOX);
String name = "TemporaryFolder" + UUID.randomUUID().toString().substring(0, 8);
if (inbox.isHoldsFolders()) {
fullname = new StringBuilder(inbox.getFullname()).append(inbox.getSeparator()).append(name).toString();
parentFullname = INBOX;
} else {
fullname = name;
parentFullname = MailFolder.DEFAULT_FOLDER_ID;
}
final MailFolderDescription mfd = new MailFolderDescription();
mfd.setExists(false);
mfd.setParentFullname(parentFullname);
mfd.setSeparator(inbox.getSeparator());
mfd.setSubscribed(false);
mfd.setName(name);
final MailPermission p = MailProviderRegistry.getMailProviderBySession(session, MailAccount.DEFAULT_ID).createNewMailPermission(session, MailAccount.DEFAULT_ID);
p.setEntity(getUser());
p.setAllPermission(OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION);
p.setFolderAdmin(true);
p.setGroupPermission(false);
mfd.addPermission(p);
mailAccess.getFolderStorage().createFolder(mfd);
}
boolean found = false;
MailFolder[] folders = mailAccess.getFolderStorage().getSubfolders(parentFullname, true);
for (int i = 0; i < folders.length; i++) {
final MailFolder mf = folders[i];
assertTrue("Missing default folder flag", mf.containsDefaultFolder());
assertTrue("Missing deleted count", mf.containsDeletedMessageCount());
assertTrue("Missing exists flag", mf.containsExists());
assertTrue("Missing fullname", mf.containsFullname());
assertTrue("Missing holds folders flag", mf.containsHoldsFolders());
assertTrue("Missing holds messages flag", mf.containsHoldsMessages());
assertTrue("Missing message count", mf.containsMessageCount());
assertTrue("Missing name", mf.containsName());
assertTrue("Missing new message count", mf.containsNewMessageCount());
if (mf instanceof IMAPMailFolder) {
assertTrue("Missing non-existent flag", ((IMAPMailFolder) mf).containsNonExistent());
}
assertTrue("Missing own permission", mf.containsOwnPermission());
assertTrue("Missing parent fullname", mf.containsParentFullname());
assertTrue("Missing permissions", mf.containsPermissions());
assertTrue("Missing root folder flag", mf.containsRootFolder());
assertTrue("Missing separator flag", mf.containsSeparator());
assertTrue("Missing subfolder flag", mf.containsSubfolders());
assertTrue("Missing subscribed flag", mf.containsSubscribed());
assertTrue("Missing subscribed subfolders flag", mf.containsSubscribedSubfolders());
assertTrue("Missing supports user flags flag", mf.containsSupportsUserFlags());
assertTrue("Missing unread message count", mf.containsUnreadMessageCount());
if (fullname.equals(mf.getFullname())) {
found = true;
assertFalse("Subscribed, but shouldn't be", MailProperties.getInstance().isSupportSubscription() ? mf.isSubscribed() : false);
}
}
assertTrue("Newly created subfolder not found!", found);
if (MailProperties.getInstance().isSupportSubscription()) {
found = false;
folders = mailAccess.getFolderStorage().getSubfolders(parentFullname, false);
for (final MailFolder mailFolder : folders) {
found |= (fullname.equals(mailFolder.getFullname()));
}
assertFalse("Unsubscribed subfolder listed as subscribed!", found);
}
} finally {
if (fullname != null) {
mailAccess.getFolderStorage().deleteFolder(fullname, true);
}
/*
* close
*/
mailAccess.close(false);
}
}
@Test
public void testFolderRoot() {
try {
final SessionObject session = getSession();
final MailAccess<?, ?> mailAccess = MailAccess.getInstance(session);
mailAccess.connect();
try {
final MailFolder f = mailAccess.getFolderStorage().getRootFolder();
assertTrue("Missing default folder flag", f.containsDefaultFolder());
assertTrue("Missing deleted count", f.containsDeletedMessageCount());
assertTrue("Missing exists flag", f.containsExists());
assertTrue("Missing fullname", f.containsFullname());
assertTrue("Missing holds folders flag", f.containsHoldsFolders());
assertTrue("Missing holds messages flag", f.containsHoldsMessages());
assertTrue("Missing message count", f.containsMessageCount());
assertTrue("Missing name", f.containsName());
assertTrue("Missing new message count", f.containsNewMessageCount());
if (f instanceof IMAPMailFolder) {
assertTrue("Missing non-existent flag", ((IMAPMailFolder) f).containsNonExistent());
}
assertTrue("Missing own permission", f.containsOwnPermission());
assertTrue("Missing parent fullname", f.containsParentFullname());
assertTrue("Missing permissions", f.containsPermissions());
assertTrue("Missing root folder flag", f.containsRootFolder());
assertTrue("Missing separator flag", f.containsSeparator());
assertTrue("Missing subfolder flag", f.containsSubfolders());
assertTrue("Missing subscribed flag", f.containsSubscribed());
assertTrue("Missing subscribed subfolders flag", f.containsSubscribedSubfolders());
assertTrue("Missing supports user flags flag", f.containsSupportsUserFlags());
assertTrue("Missing unread message count", f.containsUnreadMessageCount());
assertTrue("Unexpected root fullname", MailFolder.DEFAULT_FOLDER_ID.equals(f.getFullname()));
assertTrue("Unexpected root's parent fullname", f.getParentFullname() == null);
} finally {
/*
* close
*/
mailAccess.close(false);
}
} catch (final Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}
@Test
public void testFolderUpdate() throws OXException {
final SessionObject session = getSession();
final MailAccess<?, ?> mailAccess = MailAccess.getInstance(session);
mailAccess.connect();
String fullname = null;
try {
String parentFullname = null;
{
final MailFolder inbox = mailAccess.getFolderStorage().getFolder(INBOX);
String name = "TemporaryFolder" + UUID.randomUUID().toString().substring(0, 8);
if (inbox.isHoldsFolders()) {
fullname = new StringBuilder(inbox.getFullname()).append(inbox.getSeparator()).append(name).toString();
parentFullname = INBOX;
} else {
fullname = name;
parentFullname = MailFolder.DEFAULT_FOLDER_ID;
}
final MailFolderDescription mfd = new MailFolderDescription();
mfd.setExists(false);
mfd.setParentFullname(parentFullname);
mfd.setSeparator(inbox.getSeparator());
mfd.setSubscribed(false);
mfd.setName(name);
final MailPermission p = MailProviderRegistry.getMailProviderBySession(session, MailAccount.DEFAULT_ID).createNewMailPermission(session, MailAccount.DEFAULT_ID);
p.setEntity(getUser());
p.setAllPermission(OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION);
p.setFolderAdmin(true);
p.setGroupPermission(false);
mfd.addPermission(p);
mailAccess.getFolderStorage().createFolder(mfd);
}
if (MailProperties.getInstance().isSupportSubscription() && !MailProperties.getInstance().isIgnoreSubscription()) {
final MailFolderDescription mfd = new MailFolderDescription();
mfd.setSubscribed(true);
mailAccess.getFolderStorage().updateFolder(fullname, mfd);
assertTrue("Could not be subscribed", mailAccess.getFolderStorage().getFolder(fullname).isSubscribed());
}
final MailFolderDescription mfd = new MailFolderDescription();
final MailPermission p1 = MailProviderRegistry.getMailProviderBySession(session, MailAccount.DEFAULT_ID).createNewMailPermission(session, MailAccount.DEFAULT_ID);
p1.setEntity(getUser());
p1.setAllPermission(OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION);
p1.setFolderAdmin(true);
p1.setGroupPermission(false);
mfd.addPermission(p1);
final MailPermission p2 = MailProviderRegistry.getMailProviderBySession(session, MailAccount.DEFAULT_ID).createNewMailPermission(session, MailAccount.DEFAULT_ID);
p2.setEntity(getSecondUser());
p2.setAllPermission(OCLPermission.READ_FOLDER, OCLPermission.ADMIN_PERMISSION, OCLPermission.NO_PERMISSIONS, OCLPermission.NO_PERMISSIONS);
p2.setFolderAdmin(false);
p2.setGroupPermission(false);
mfd.addPermission(p2);
assertTrue("Hugh... No permissions?!", mfd.containsPermissions());
mailAccess.getFolderStorage().updateFolder(fullname, mfd);
final MailFolder updatedFolder = mailAccess.getFolderStorage().getFolder(fullname);
final OCLPermission[] perms = updatedFolder.getPermissions();
if (mailAccess.getMailConfig().getCapabilities().hasPermissions()) {
assertTrue("Unexpected number of permissions: " + perms.length, perms.length == 2);
for (final OCLPermission permission : perms) {
if (permission.getEntity() == getUser()) {
assertTrue(permission.getFolderPermission() >= OCLPermission.CREATE_SUB_FOLDERS);
assertTrue(permission.getReadPermission() >= OCLPermission.READ_ALL_OBJECTS);
assertTrue(permission.getWritePermission() >= OCLPermission.WRITE_ALL_OBJECTS);
assertTrue(permission.getDeletePermission() >= OCLPermission.DELETE_ALL_OBJECTS);
assertTrue(permission.isFolderAdmin());
} else if (permission.getEntity() == getSecondUser()) {
assertTrue(permission.getFolderPermission() == OCLPermission.READ_FOLDER);
assertTrue(permission.getReadPermission() >= OCLPermission.READ_ALL_OBJECTS);
assertTrue(permission.getWritePermission() == OCLPermission.NO_PERMISSIONS);
assertTrue(permission.getDeletePermission() == OCLPermission.NO_PERMISSIONS);
assertFalse(permission.isFolderAdmin());
}
}
} else {
assertTrue("No default permission set!" + perms.length, perms.length == 1 && DefaultMailPermission.class.isInstance(perms[0]));
}
} finally {
if (fullname != null) {
mailAccess.getFolderStorage().deleteFolder(fullname, true);
}
/*
* close
*/
mailAccess.close(false);
}
}
@Test
public void testFolderMove() throws OXException {
final SessionObject session = getSession();
final MailAccess<?, ?> mailAccess = MailAccess.getInstance(session);
mailAccess.connect();
String fullname = null;
try {
String parentFullname = null;
char separator = '\0';
final boolean parentIsDefault;
{
final MailFolder inbox = mailAccess.getFolderStorage().getFolder(INBOX);
String name = "TemporaryFolder" + UUID.randomUUID().toString().substring(0, 8);
if (inbox.isHoldsFolders()) {
fullname = new StringBuilder(inbox.getFullname()).append(inbox.getSeparator()).append(name).toString();
parentFullname = INBOX;
parentIsDefault = false;
} else {
fullname = name;
parentFullname = MailFolder.DEFAULT_FOLDER_ID;
parentIsDefault = true;
}
final MailFolderDescription mfd = new MailFolderDescription();
mfd.setExists(false);
mfd.setParentFullname(parentFullname);
mfd.setSeparator((separator = inbox.getSeparator()));
mfd.setSubscribed(false);
mfd.setName(name);
final MailPermission p = MailProviderRegistry.getMailProviderBySession(session, MailAccount.DEFAULT_ID).createNewMailPermission(session, MailAccount.DEFAULT_ID);
p.setEntity(getUser());
p.setAllPermission(OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION);
p.setFolderAdmin(true);
p.setGroupPermission(false);
mfd.addPermission(p);
mailAccess.getFolderStorage().createFolder(mfd);
}
String stamp = Long.toString(System.currentTimeMillis());
String newFullname = parentIsDefault ? ("TemporaryFolderMoved" + stamp) : new StringBuilder(parentFullname).append(separator).append("TemporaryFolderMoved").append(stamp).toString();
// MOVE FOLDER
mailAccess.getFolderStorage().moveFolder(fullname, newFullname);
// ENSURE OLD ONE DOES NO MORE EXIST
Exception exc = null;
try {
mailAccess.getFolderStorage().getFolder(fullname);
} catch (final OXException e) {
exc = e;
}
assertTrue("Moved folder still exists", exc != null);
fullname = newFullname;
MailFolder mf = mailAccess.getFolderStorage().getFolder(fullname);
assertEquals("Unexpected name: " + mf.getName(), ("TemporaryFolderMoved" + stamp), mf.getName());
assertEquals("Unexpected parent: " + mf.getParentFullname(), parentFullname, mf.getParentFullname());
/*
* Move below root folder
*/
final MailFolder root = mailAccess.getFolderStorage().getRootFolder();
final OCLPermission[] rootPerms = root.getPermissions();
if (canCreateSubfolders(rootPerms)) {
newFullname = "TemporaryFolderMovedAgain" + stamp;
exc = null;
try {
mailAccess.getFolderStorage().moveFolder(fullname, newFullname);
} catch (final OXException e) {
exc = e;
}
assertTrue("Move below root folder failed", exc == null);
exc = null;
try {
mailAccess.getFolderStorage().getFolder(fullname);
} catch (final OXException e) {
exc = e;
}
assertTrue("Moved folder still exists", exc != null);
fullname = newFullname;
mf = mailAccess.getFolderStorage().getFolder(fullname);
assertTrue("Unexpected name: " + mf.getName(), ("TemporaryFolderMovedAgain" + stamp).equals(mf.getName()));
assertTrue("Unexpected parent: " + mf.getParentFullname(), MailFolder.DEFAULT_FOLDER_ID.equals(mf.getParentFullname()));
} else {
fullname = null;
}
} finally {
if (fullname != null) {
mailAccess.getFolderStorage().deleteFolder(fullname, true);
}
/*
* close
*/
mailAccess.close(false);
}
}
private boolean canCreateSubfolders(final OCLPermission[] perms) {
if (null == perms) {
return false;
}
for (final OCLPermission permission : perms) {
if (permission.getEntity() == getUser()) {
return permission.getFolderPermission() >= OCLPermission.CREATE_SUB_FOLDERS;
}
}
return false;
}
@Test
public void testFolderRename() throws OXException {
final SessionObject session = getSession();
final MailAccess<?, ?> mailAccess = MailAccess.getInstance(session);
mailAccess.connect();
String fullname = null;
try {
String parentFullname = null;
char separator = '\0';
final boolean isParentDefault;
{
final MailFolder inbox = mailAccess.getFolderStorage().getFolder(INBOX);
String name = "TemporaryFolder" + UUID.randomUUID().toString().substring(0, 8);
if (inbox.isHoldsFolders()) {
fullname = new StringBuilder(inbox.getFullname()).append(inbox.getSeparator()).append(name).toString();
parentFullname = INBOX;
isParentDefault = false;
} else {
fullname = name;
parentFullname = MailFolder.DEFAULT_FOLDER_ID;
isParentDefault = true;
}
final MailFolderDescription mfd = new MailFolderDescription();
mfd.setExists(false);
mfd.setParentFullname(parentFullname);
mfd.setSeparator((separator = inbox.getSeparator()));
mfd.setSubscribed(false);
mfd.setName(name);
final MailPermission p = MailProviderRegistry.getMailProviderBySession(session, MailAccount.DEFAULT_ID).createNewMailPermission(session, MailAccount.DEFAULT_ID);
p.setEntity(getUser());
p.setAllPermission(OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION);
p.setFolderAdmin(true);
p.setGroupPermission(false);
mfd.addPermission(p);
mailAccess.getFolderStorage().createFolder(mfd);
}
mailAccess.getFolderStorage().renameFolder(fullname, "TemporaryFolderRenamed");
Exception exc = null;
try {
mailAccess.getFolderStorage().getFolder(fullname);
} catch (final OXException e) {
exc = e;
}
assertTrue("Renamed folder still exists", exc != null);
fullname = isParentDefault ? "TemporaryFolderRenamed" : new StringBuilder(parentFullname).append(separator).append("TemporaryFolderRenamed").toString();
final MailFolder mf = mailAccess.getFolderStorage().getFolder(fullname);
assertEquals("Unexpected name: " + mf.getName(), "TemporaryFolderRenamed", mf.getName());
assertEquals("Unexpected parent: " + mf.getParentFullname(), parentFullname, mf.getParentFullname());
} finally {
if (fullname != null) {
mailAccess.getFolderStorage().deleteFolder(fullname, true);
}
/*
* close
*/
mailAccess.close(false);
}
}
@Test
public void testFolderDelete() throws OXException {
final SessionObject session = getSession();
final MailAccess<?, ?> mailAccess = MailAccess.getInstance(session);
mailAccess.connect();
String fullname = null;
try {
final String name = "TemporaryFolder" + UUID.randomUUID().toString().substring(0, 8);
String parentFullname = null;
{
final MailFolder inbox = mailAccess.getFolderStorage().getFolder(INBOX);
if (inbox.isHoldsFolders()) {
fullname = new StringBuilder(inbox.getFullname()).append(inbox.getSeparator()).append(name).toString();
parentFullname = INBOX;
} else {
fullname = name;
parentFullname = MailFolder.DEFAULT_FOLDER_ID;
}
final MailFolderDescription mfd = new MailFolderDescription();
mfd.setExists(false);
mfd.setParentFullname(parentFullname);
mfd.setSeparator(inbox.getSeparator());
mfd.setSubscribed(false);
mfd.setName(name);
final MailPermission p = MailProviderRegistry.getMailProviderBySession(session, MailAccount.DEFAULT_ID).createNewMailPermission(session, MailAccount.DEFAULT_ID);
p.setEntity(getUser());
p.setAllPermission(OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION);
p.setFolderAdmin(true);
p.setGroupPermission(false);
mfd.addPermission(p);
mailAccess.getFolderStorage().createFolder(mfd);
}
int numAppendix = mailAccess.getFolderStorage().getFolder(mailAccess.getFolderStorage().getTrashFolder()).isHoldsFolders() ? 0 : -1;
if (numAppendix == 0) {
final MailFolder[] trashedFolders = mailAccess.getFolderStorage().getSubfolders(mailAccess.getFolderStorage().getTrashFolder(), true);
for (final MailFolder mailFolder : trashedFolders) {
if (mailFolder.getName().startsWith(name)) {
final String substr = mailFolder.getName().substring(name.length());
if (substr.length() > 0) {
final int tmp = numAppendix;
try {
numAppendix = Math.max(numAppendix, Integer.parseInt(substr));
} catch (final NumberFormatException e) {
// ignore
numAppendix = tmp;
}
}
}
}
if (numAppendix > 0) {
numAppendix++;
}
}
mailAccess.getFolderStorage().deleteFolder(fullname);
Exception exc = null;
try {
mailAccess.getFolderStorage().getFolder(fullname);
} catch (final OXException e) {
exc = e;
}
assertTrue("Deleted folder still exists", exc != null);
if (numAppendix >= 0) {
boolean found = false;
/*
* Find backup folder below trash folder
*/
final MailFolder[] trashedFolders = mailAccess.getFolderStorage().getSubfolders(mailAccess.getFolderStorage().getTrashFolder(), true);
for (int i = 0; i < trashedFolders.length && !found; i++) {
if (trashedFolders[i].getName().startsWith(name)) {
if (numAppendix == 0) {
found = trashedFolders[i].getName().equals(name);
} else {
final String substr = trashedFolders[i].getName().substring(name.length());
try {
found = (numAppendix == Integer.parseInt(substr));
} catch (final NumberFormatException e) {
// ignore
}
}
if (found) {
fullname = trashedFolders[i].getFullname();
}
}
}
if (!found) {
fullname = null;
}
assertTrue("No backup folder found below trash folder", found);
}
} finally {
if (fullname != null) {
mailAccess.getFolderStorage().deleteFolder(fullname, true);
}
/*
* close
*/
mailAccess.close(false);
}
}
private static final MailField[] FIELDS_ID = { MailField.ID };
@Test
public void testFolderClear() throws OXException, MessagingException, IOException {
final SessionObject session = getSession();
final MailAccess<?, ?> mailAccess = MailAccess.getInstance(session);
mailAccess.connect();
String fullname = null;
String[] trashedIDs = null;
String trashFullname = null;
try {
final String name = "TemporaryFolder" + UUID.randomUUID().toString().substring(0, 8);
{
final MailFolder inbox = mailAccess.getFolderStorage().getFolder(INBOX);
final String parentFullname;
if (inbox.isHoldsFolders()) {
fullname = new StringBuilder(inbox.getFullname()).append(inbox.getSeparator()).append(name).toString();
parentFullname = INBOX;
} else {
fullname = name;
parentFullname = MailFolder.DEFAULT_FOLDER_ID;
}
if (mailAccess.getFolderStorage().exists(fullname)) {
mailAccess.getFolderStorage().clearFolder(fullname, true);
} else {
final MailFolderDescription mfd = new MailFolderDescription();
mfd.setExists(false);
mfd.setParentFullname(parentFullname);
mfd.setSeparator(inbox.getSeparator());
mfd.setSubscribed(false);
mfd.setName(name);
final MailPermission p = MailProviderRegistry.getMailProviderBySession(session, MailAccount.DEFAULT_ID).createNewMailPermission(session, MailAccount.DEFAULT_ID);
p.setEntity(getUser());
p.setAllPermission(OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION);
p.setFolderAdmin(true);
p.setGroupPermission(false);
mfd.addPermission(p);
mailAccess.getFolderStorage().createFolder(mfd);
}
}
final MailMessage[] mails = getMessages(getTestMailDir(), -1);
String[] uids = mailAccess.getMessageStorage().appendMessages(fullname, mails);
final MailFolder f = mailAccess.getFolderStorage().getFolder(fullname);
final int messageCount = f.getMessageCount();
if (messageCount > 0) {
assertTrue("Messages not completely appended to mail folder " + fullname + ": " + messageCount + " < " + uids.length, messageCount >= uids.length);
}
trashFullname = mailAccess.getFolderStorage().getTrashFolder();
int numTrashedMails = getMessageCount(mailAccess, trashFullname);
final Set<String> ids = new HashSet<String>(numTrashedMails);
MailMessage[] trashed = mailAccess.getMessageStorage().getAllMessages(trashFullname, IndexRange.NULL, MailSortField.RECEIVED_DATE, OrderDirection.ASC, FIELDS_ID);
for (int i = 0; i < trashed.length; i++) {
ids.add(trashed[i].getMailId());
}
mailAccess.getFolderStorage().clearFolder(fullname);
assertTrue("Folder should be empty", getMessageCount(mailAccess, fullname) == 0);
final int expectedMsgCount = numTrashedMails + uids.length;
assertTrue("Mails not completely backuped", getMessageCount(mailAccess, trashFullname) == expectedMsgCount);
final Set<String> newIds = new HashSet<String>(expectedMsgCount);
trashed = mailAccess.getMessageStorage().getAllMessages(trashFullname, IndexRange.NULL, MailSortField.RECEIVED_DATE, OrderDirection.ASC, FIELDS_ID);
assertTrue("Size mismatch: " + trashed.length + " but should be " + expectedMsgCount, trashed.length == expectedMsgCount);
for (int i = 0; i < trashed.length; i++) {
newIds.add(trashed[i].getMailId());
}
newIds.removeAll(ids);
trashedIDs = new String[newIds.size()];
int i = 0;
for (final String id : newIds) {
trashedIDs[i++] = id;
}
mailAccess.getMessageStorage().deleteMessages(trashFullname, trashedIDs, true);
trashedIDs = null;
uids = mailAccess.getMessageStorage().appendMessages(fullname, mails);
//f = mailAccess.getFolderStorage().getFolder(fullname);
assertTrue("Messages not completely appended to mail folder " + fullname, getMessageCount(mailAccess, fullname) == uids.length);
numTrashedMails = getMessageCount(mailAccess, trashFullname);
mailAccess.getFolderStorage().clearFolder(fullname, true);
assertTrue("Folder should be empty", getMessageCount(mailAccess, fullname) == 0);
assertTrue("Mails not deleted permanently although hardDelete flag set to true", getMessageCount(mailAccess, trashFullname) == numTrashedMails);
} finally {
if (fullname != null) {
mailAccess.getFolderStorage().deleteFolder(fullname, true);
}
if (trashedIDs != null) {
mailAccess.getMessageStorage().deleteMessages(trashFullname, trashedIDs, true);
}
/*
* close
*/
mailAccess.close(false);
}
}
@Test
public void testFolderQuota() throws OXException, MessagingException, IOException {
final SessionObject session = getSession();
final MailAccess<?, ?> mailAccess = MailAccess.getInstance(session);
mailAccess.connect();
final MailCapabilities caps = mailAccess.getMailConfig().getCapabilities();
if (!caps.hasQuota()) {
return;
}
String fullname = null;
try {
final String name = "TemporaryFolder" + UUID.randomUUID().toString().substring(0, 8);
{
final MailFolder inbox = mailAccess.getFolderStorage().getFolder(INBOX);
final String parentFullname;
if (inbox.isHoldsFolders()) {
fullname = new StringBuilder(inbox.getFullname()).append(inbox.getSeparator()).append(name).toString();
parentFullname = INBOX;
} else {
fullname = name;
parentFullname = MailFolder.DEFAULT_FOLDER_ID;
}
final MailFolderDescription mfd = new MailFolderDescription();
mfd.setExists(false);
mfd.setParentFullname(parentFullname);
mfd.setSeparator(inbox.getSeparator());
mfd.setSubscribed(false);
mfd.setName(name);
final MailPermission p = MailProviderRegistry.getMailProviderBySession(session, MailAccount.DEFAULT_ID).createNewMailPermission(session, MailAccount.DEFAULT_ID);
p.setEntity(getUser());
p.setAllPermission(OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION);
p.setFolderAdmin(true);
p.setGroupPermission(false);
mfd.addPermission(p);
mailAccess.getFolderStorage().createFolder(mfd);
}
final Quota.Type[] types = new Quota.Type[] { Quota.Type.STORAGE };
final long prevUsage = mailAccess.getFolderStorage().getQuotas(fullname, types)[0].getUsage();
if (prevUsage == Quota.UNLIMITED) {
return;
}
mailAccess.getMessageStorage().appendMessages(fullname, getMessages(getTestMailDir(), -1));
assertTrue("QUOTA not increased although mails were appended", mailAccess.getFolderStorage().getQuotas(fullname, types)[0].getUsage() > prevUsage);
} finally {
if (fullname != null) {
mailAccess.getFolderStorage().deleteFolder(fullname, true);
}
/*
* close
*/
mailAccess.close(false);
}
}
@Test
public void testPath2DefaultFolder() throws OXException {
final SessionObject session = getSession();
final MailAccess<?, ?> mailAccess = MailAccess.getInstance(session);
mailAccess.connect();
String fullname = null;
String anotherFullname = null;
try {
final String name = "TemporaryFolder" + UUID.randomUUID().toString().substring(0, 8);
final boolean isParentDefault;
{
final MailFolder inbox = mailAccess.getFolderStorage().getFolder(INBOX);
final String parentFullname;
if (inbox.isHoldsFolders()) {
fullname = new StringBuilder(inbox.getFullname()).append(inbox.getSeparator()).append(name).toString();
parentFullname = INBOX;
isParentDefault = false;
} else {
fullname = name;
parentFullname = MailFolder.DEFAULT_FOLDER_ID;
isParentDefault = true;
}
final MailFolderDescription mfd = new MailFolderDescription();
mfd.setExists(false);
mfd.setParentFullname(parentFullname);
mfd.setSeparator(inbox.getSeparator());
mfd.setSubscribed(false);
mfd.setName(name);
final MailPermission p = MailProviderRegistry.getMailProviderBySession(session, MailAccount.DEFAULT_ID).createNewMailPermission(session, MailAccount.DEFAULT_ID);
p.setEntity(getUser());
p.setAllPermission(OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION);
p.setFolderAdmin(true);
p.setGroupPermission(false);
mfd.addPermission(p);
mailAccess.getFolderStorage().createFolder(mfd);
}
MailFolder[] path = mailAccess.getFolderStorage().getPath2DefaultFolder(fullname);
assertEquals("Unexpected path length: " + path.length, (isParentDefault ? 1 : 2), path.length);
for (int i = 0; i < path.length; i++) {
if (i == 0) {
assertTrue("Unexpected mail folder in first path position", path[i].getFullname().equals(fullname));
} else {
assertTrue("Unexpected mail folder in second path position", path[i].getFullname().equals(INBOX));
}
}
path = null;
{
final MailFolder temp = mailAccess.getFolderStorage().getFolder(fullname);
final String parentFullname;
if (temp.isHoldsFolders()) {
anotherFullname = new StringBuilder(temp.getFullname()).append(temp.getSeparator()).append(name).toString();
parentFullname = temp.getFullname();
final MailFolderDescription mfd = new MailFolderDescription();
mfd.setExists(false);
mfd.setParentFullname(parentFullname);
mfd.setSeparator(temp.getSeparator());
mfd.setSubscribed(false);
mfd.setName(name);
final MailPermission p = MailProviderRegistry.getMailProviderBySession(session, MailAccount.DEFAULT_ID).createNewMailPermission(session, MailAccount.DEFAULT_ID);
p.setEntity(getUser());
p.setAllPermission(OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION);
p.setFolderAdmin(true);
p.setGroupPermission(false);
mfd.addPermission(p);
mailAccess.getFolderStorage().createFolder(mfd);
final MailFolder[] apath = mailAccess.getFolderStorage().getPath2DefaultFolder(anotherFullname);
assertTrue("Unexpected path length: " + apath.length, apath.length == (isParentDefault ? 2 : 3));
for (int i = 0; i < apath.length; i++) {
if (i == 0) {
assertTrue("Unexpected mail folder in first path position", apath[i].getFullname().equals(anotherFullname));
} else if (i == 1) {
assertTrue("Unexpected mail folder in first path position", apath[i].getFullname().equals(fullname));
} else {
assertTrue("Unexpected mail folder in second path position", apath[i].getFullname().equals(INBOX));
}
}
}
}
} finally {
if (anotherFullname != null) {
mailAccess.getFolderStorage().deleteFolder(anotherFullname, true);
}
if (fullname != null) {
mailAccess.getFolderStorage().deleteFolder(fullname, true);
}
/*
* close
*/
mailAccess.close(false);
}
}
}
| UTF-8 | Java | 50,370 | java | MailFolderTest.java | Java | [
{
"context": "yright (C) 2016-2020 OX Software GmbH\n * Mail: info@open-xchange.com\n *\n *\n * This program is free software; you c",
"end": 1563,
"score": 0.9999317526817322,
"start": 1542,
"tag": "EMAIL",
"value": "info@open-xchange.com"
},
{
"context": "ink MailFolderTest}\n *\n * @author <a href=\"mailto:thorben.betten@open-xchange.com\">Thorben Betten</a>\n *\n */\npublic final class Mai",
"end": 3795,
"score": 0.999930202960968,
"start": 3764,
"tag": "EMAIL",
"value": "thorben.betten@open-xchange.com"
},
{
"context": " <a href=\"mailto:thorben.betten@open-xchange.com\">Thorben Betten</a>\n *\n */\npublic final class MailFolderTest exte",
"end": 3811,
"score": 0.9998898506164551,
"start": 3797,
"tag": "NAME",
"value": "Thorben Betten"
},
{
"context": " } else {\n fullname = name;\n parentFullname = MailFolder.",
"end": 12094,
"score": 0.7284907698631287,
"start": 12090,
"tag": "NAME",
"value": "name"
},
{
"context": " exists\", exc != null);\n fullname = newFullname;\n mf = mailAccess.getFolderStorage",
"end": 27982,
"score": 0.9271699786186218,
"start": 27971,
"tag": "NAME",
"value": "newFullname"
},
{
"context": " } else {\n fullname = name;\n parentFullname = MailFolder.",
"end": 32857,
"score": 0.9654661417007446,
"start": 32853,
"tag": "NAME",
"value": "name"
},
{
"context": " } else {\n fullname = name;\n parentFullname = MailFolder.",
"end": 37929,
"score": 0.5138927102088928,
"start": 37925,
"tag": "NAME",
"value": "name"
}
] | null | [] | /*
*
* OPEN-XCHANGE legal information
*
* All intellectual property rights in the Software are protected by
* international copyright laws.
*
*
* In some countries OX, OX Open-Xchange, open xchange and OXtender
* as well as the corresponding Logos OX Open-Xchange and OX are registered
* trademarks of the OX Software GmbH group of companies.
* The use of the Logos is not covered by the GNU General Public License.
* Instead, you are allowed to use these Logos according to the terms and
* conditions of the Creative Commons License, Version 2.5, Attribution,
* Non-commercial, ShareAlike, and the interpretation of the term
* Non-commercial applicable to the aforementioned license is published
* on the web site http://www.open-xchange.com/EN/legal/index.html.
*
* Please make sure that third-party modules and libraries are used
* according to their respective licenses.
*
* Any modifications to this package must retain all copyright notices
* of the original copyright holder(s) for the original code used.
*
* After any such modifications, the original and derivative code shall remain
* under the copyright of the copyright holder(s) and/or original author(s)per
* the Attribution and Assignment Agreement that can be located at
* http://www.open-xchange.com/EN/developer/. The contributing author shall be
* given Attribution for the derivative code and a license granting use.
*
* Copyright (C) 2016-2020 OX Software GmbH
* Mail: <EMAIL>
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License, Version 2 as published
* by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc., 59
* Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.openexchange.mail.folderstorage;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.io.IOException;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import javax.mail.MessagingException;
import org.junit.Test;
import com.openexchange.exception.OXException;
import com.openexchange.imap.dataobjects.IMAPMailFolder;
import com.openexchange.mail.AbstractMailTest;
import com.openexchange.mail.IndexRange;
import com.openexchange.mail.MailField;
import com.openexchange.mail.MailProviderRegistry;
import com.openexchange.mail.MailSortField;
import com.openexchange.mail.OrderDirection;
import com.openexchange.mail.Quota;
import com.openexchange.mail.api.MailAccess;
import com.openexchange.mail.api.MailCapabilities;
import com.openexchange.mail.config.MailProperties;
import com.openexchange.mail.dataobjects.MailFolder;
import com.openexchange.mail.dataobjects.MailFolderDescription;
import com.openexchange.mail.dataobjects.MailMessage;
import com.openexchange.mail.permission.DefaultMailPermission;
import com.openexchange.mail.permission.MailPermission;
import com.openexchange.mail.usersetting.UserSettingMailStorage;
import com.openexchange.mailaccount.MailAccount;
import com.openexchange.server.impl.OCLPermission;
import com.openexchange.sessiond.impl.SessionObject;
/**
* {@link MailFolderTest}
*
* @author <a href="mailto:<EMAIL>"><NAME></a>
*
*/
public final class MailFolderTest extends AbstractMailTest {
private static final String INBOX = "INBOX";
@Test
public void testStandardFolders() {
try {
final SessionObject session = getSession();
final MailAccess<?, ?> mailAccess = MailAccess.getInstance(session);
mailAccess.connect();
try {
String fullname = mailAccess.getFolderStorage().getDraftsFolder();
assertTrue("Missing drafts folder", fullname != null && fullname.length() > 0);
fullname = mailAccess.getFolderStorage().getSentFolder();
assertTrue("Missing sent folder", fullname != null && fullname.length() > 0);
fullname = mailAccess.getFolderStorage().getSpamFolder();
assertTrue("Missing spam folder", fullname != null && fullname.length() > 0);
fullname = mailAccess.getFolderStorage().getTrashFolder();
assertTrue("Missing trash folder", fullname != null && fullname.length() > 0);
if (UserSettingMailStorage.getInstance().getUserSettingMail(getUser(), getCid()).isSpamEnabled()) {
fullname = mailAccess.getFolderStorage().getConfirmedHamFolder();
assertTrue("Missing confirmed ham folder: " + fullname, fullname != null && fullname.length() > 0);
fullname = mailAccess.getFolderStorage().getConfirmedSpamFolder();
assertTrue("Missing confirmed spam folder: " + fullname, fullname != null && fullname.length() > 0);
}
} finally {
/*
* close
*/
mailAccess.close(false);
}
} catch (final Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}
@Test
public void testExistStandardFolders() {
try {
final SessionObject session = getSession();
final MailAccess<?, ?> mailAccess = MailAccess.getInstance(session);
mailAccess.connect();
try {
String fullname = mailAccess.getFolderStorage().getDraftsFolder();
assertTrue("Non-existing drafts folder", mailAccess.getFolderStorage().exists(fullname));
fullname = mailAccess.getFolderStorage().getSentFolder();
assertTrue("Non-existing sent folder", mailAccess.getFolderStorage().exists(fullname));
fullname = mailAccess.getFolderStorage().getSpamFolder();
assertTrue("Non-existing spam folder", mailAccess.getFolderStorage().exists(fullname));
fullname = mailAccess.getFolderStorage().getTrashFolder();
assertTrue("Non-existing trash folder", mailAccess.getFolderStorage().exists(fullname));
if (UserSettingMailStorage.getInstance().getUserSettingMail(getUser(), getCid()).isSpamEnabled()) {
fullname = mailAccess.getFolderStorage().getConfirmedHamFolder();
assertTrue("Non-existing confirmed ham folder", mailAccess.getFolderStorage().exists(fullname));
fullname = mailAccess.getFolderStorage().getConfirmedSpamFolder();
assertTrue("Non-existing confirmed spam folder", mailAccess.getFolderStorage().exists(fullname));
}
} finally {
/*
* close
*/
mailAccess.close(false);
}
} catch (final Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}
@Test
public void testFolderGet() throws OXException {
final SessionObject session = getSession();
final MailAccess<?, ?> mailAccess = MailAccess.getInstance(session);
mailAccess.connect();
try {
final MailFolder f = mailAccess.getFolderStorage().getFolder(INBOX);
assertTrue("Missing default folder flag", f.containsDefaultFolder());
assertTrue("Missing deleted count", f.containsDeletedMessageCount());
assertTrue("Missing exists flag", f.containsExists());
assertTrue("Missing fullname", f.containsFullname());
assertTrue("Missing holds folders flag", f.containsHoldsFolders());
assertTrue("Missing holds messages flag", f.containsHoldsMessages());
assertTrue("Missing message count", f.containsMessageCount());
assertTrue("Missing name", f.containsName());
assertTrue("Missing new message count", f.containsNewMessageCount());
if (f instanceof IMAPMailFolder) {
assertTrue("Missing non-existent flag", ((IMAPMailFolder) f).containsNonExistent());
}
assertTrue("Missing own permission", f.containsOwnPermission());
assertTrue("Missing parent fullname", f.containsParentFullname());
assertTrue("Missing permissions", f.containsPermissions());
assertTrue("Missing root folder flag", f.containsRootFolder());
assertTrue("Missing separator flag", f.containsSeparator());
assertTrue("Missing subfolder flag", f.containsSubfolders());
assertTrue("Missing subscribed flag", f.containsSubscribed());
assertTrue("Missing subscribed subfolders flag", f.containsSubscribedSubfolders());
assertTrue("Missing supports user flags flag", f.containsSupportsUserFlags());
assertTrue("Missing unread message count", f.containsUnreadMessageCount());
} finally {
/*
* close
*/
mailAccess.close(false);
}
}
@Test
public void testFolderCreateAndSubfolders() throws OXException {
final SessionObject session = getSession();
final MailAccess<?, ?> mailAccess = MailAccess.getInstance(session);
mailAccess.connect();
String fullname = null;
try {
final MailFolder f = mailAccess.getFolderStorage().getFolder(INBOX);
assertTrue("Missing default folder flag", f.containsDefaultFolder());
assertTrue("Missing deleted count", f.containsDeletedMessageCount());
assertTrue("Missing exists flag", f.containsExists());
assertTrue("Missing fullname", f.containsFullname());
assertTrue("Missing holds folders flag", f.containsHoldsFolders());
assertTrue("Missing holds messages flag", f.containsHoldsMessages());
assertTrue("Missing message count", f.containsMessageCount());
assertTrue("Missing name", f.containsName());
assertTrue("Missing new message count", f.containsNewMessageCount());
if (f instanceof IMAPMailFolder) {
assertTrue("Missing non-existent flag", ((IMAPMailFolder) f).containsNonExistent());
}
assertTrue("Missing own permission", f.containsOwnPermission());
assertTrue("Missing parent fullname", f.containsParentFullname());
assertTrue("Missing permissions", f.containsPermissions());
assertTrue("Missing root folder flag", f.containsRootFolder());
assertTrue("Missing separator flag", f.containsSeparator());
assertTrue("Missing subfolder flag", f.containsSubfolders());
assertTrue("Missing subscribed flag", f.containsSubscribed());
assertTrue("Missing subscribed subfolders flag", f.containsSubscribedSubfolders());
assertTrue("Missing supports user flags flag", f.containsSupportsUserFlags());
assertTrue("Missing unread message count", f.containsUnreadMessageCount());
String parentFullname = null;
{
final MailFolder inbox = mailAccess.getFolderStorage().getFolder(INBOX);
String name = "TemporaryFolder" + UUID.randomUUID().toString().substring(0, 8);
if (inbox.isHoldsFolders()) {
fullname = new StringBuilder(inbox.getFullname()).append(inbox.getSeparator()).append(name).toString();
parentFullname = INBOX;
} else {
fullname = name;
parentFullname = MailFolder.DEFAULT_FOLDER_ID;
}
final MailFolderDescription mfd = new MailFolderDescription();
mfd.setExists(false);
mfd.setParentFullname(parentFullname);
mfd.setSeparator(inbox.getSeparator());
mfd.setSubscribed(false);
mfd.setName(name);
final MailPermission p = MailProviderRegistry.getMailProviderBySession(session, MailAccount.DEFAULT_ID).createNewMailPermission(session, MailAccount.DEFAULT_ID);
p.setEntity(getUser());
p.setAllPermission(OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION);
p.setFolderAdmin(true);
p.setGroupPermission(false);
mfd.addPermission(p);
mailAccess.getFolderStorage().createFolder(mfd);
}
boolean found = false;
MailFolder[] folders = mailAccess.getFolderStorage().getSubfolders(parentFullname, true);
for (int i = 0; i < folders.length; i++) {
final MailFolder mf = folders[i];
assertTrue("Missing default folder flag", mf.containsDefaultFolder());
assertTrue("Missing deleted count", mf.containsDeletedMessageCount());
assertTrue("Missing exists flag", mf.containsExists());
assertTrue("Missing fullname", mf.containsFullname());
assertTrue("Missing holds folders flag", mf.containsHoldsFolders());
assertTrue("Missing holds messages flag", mf.containsHoldsMessages());
assertTrue("Missing message count", mf.containsMessageCount());
assertTrue("Missing name", mf.containsName());
assertTrue("Missing new message count", mf.containsNewMessageCount());
if (mf instanceof IMAPMailFolder) {
assertTrue("Missing non-existent flag", ((IMAPMailFolder) mf).containsNonExistent());
}
assertTrue("Missing own permission", mf.containsOwnPermission());
assertTrue("Missing parent fullname", mf.containsParentFullname());
assertTrue("Missing permissions", mf.containsPermissions());
assertTrue("Missing root folder flag", mf.containsRootFolder());
assertTrue("Missing separator flag", mf.containsSeparator());
assertTrue("Missing subfolder flag", mf.containsSubfolders());
assertTrue("Missing subscribed flag", mf.containsSubscribed());
assertTrue("Missing subscribed subfolders flag", mf.containsSubscribedSubfolders());
assertTrue("Missing supports user flags flag", mf.containsSupportsUserFlags());
assertTrue("Missing unread message count", mf.containsUnreadMessageCount());
if (fullname.equals(mf.getFullname())) {
found = true;
assertFalse("Subscribed, but shouldn't be", MailProperties.getInstance().isSupportSubscription() ? mf.isSubscribed() : false);
}
}
assertTrue("Newly created subfolder not found!", found);
if (MailProperties.getInstance().isSupportSubscription()) {
found = false;
folders = mailAccess.getFolderStorage().getSubfolders(parentFullname, false);
for (final MailFolder mailFolder : folders) {
found |= (fullname.equals(mailFolder.getFullname()));
}
assertFalse("Unsubscribed subfolder listed as subscribed!", found);
}
} finally {
if (fullname != null) {
mailAccess.getFolderStorage().deleteFolder(fullname, true);
}
/*
* close
*/
mailAccess.close(false);
}
}
@Test
public void testFolderRoot() {
try {
final SessionObject session = getSession();
final MailAccess<?, ?> mailAccess = MailAccess.getInstance(session);
mailAccess.connect();
try {
final MailFolder f = mailAccess.getFolderStorage().getRootFolder();
assertTrue("Missing default folder flag", f.containsDefaultFolder());
assertTrue("Missing deleted count", f.containsDeletedMessageCount());
assertTrue("Missing exists flag", f.containsExists());
assertTrue("Missing fullname", f.containsFullname());
assertTrue("Missing holds folders flag", f.containsHoldsFolders());
assertTrue("Missing holds messages flag", f.containsHoldsMessages());
assertTrue("Missing message count", f.containsMessageCount());
assertTrue("Missing name", f.containsName());
assertTrue("Missing new message count", f.containsNewMessageCount());
if (f instanceof IMAPMailFolder) {
assertTrue("Missing non-existent flag", ((IMAPMailFolder) f).containsNonExistent());
}
assertTrue("Missing own permission", f.containsOwnPermission());
assertTrue("Missing parent fullname", f.containsParentFullname());
assertTrue("Missing permissions", f.containsPermissions());
assertTrue("Missing root folder flag", f.containsRootFolder());
assertTrue("Missing separator flag", f.containsSeparator());
assertTrue("Missing subfolder flag", f.containsSubfolders());
assertTrue("Missing subscribed flag", f.containsSubscribed());
assertTrue("Missing subscribed subfolders flag", f.containsSubscribedSubfolders());
assertTrue("Missing supports user flags flag", f.containsSupportsUserFlags());
assertTrue("Missing unread message count", f.containsUnreadMessageCount());
assertTrue("Unexpected root fullname", MailFolder.DEFAULT_FOLDER_ID.equals(f.getFullname()));
assertTrue("Unexpected root's parent fullname", f.getParentFullname() == null);
} finally {
/*
* close
*/
mailAccess.close(false);
}
} catch (final Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}
@Test
public void testFolderUpdate() throws OXException {
final SessionObject session = getSession();
final MailAccess<?, ?> mailAccess = MailAccess.getInstance(session);
mailAccess.connect();
String fullname = null;
try {
String parentFullname = null;
{
final MailFolder inbox = mailAccess.getFolderStorage().getFolder(INBOX);
String name = "TemporaryFolder" + UUID.randomUUID().toString().substring(0, 8);
if (inbox.isHoldsFolders()) {
fullname = new StringBuilder(inbox.getFullname()).append(inbox.getSeparator()).append(name).toString();
parentFullname = INBOX;
} else {
fullname = name;
parentFullname = MailFolder.DEFAULT_FOLDER_ID;
}
final MailFolderDescription mfd = new MailFolderDescription();
mfd.setExists(false);
mfd.setParentFullname(parentFullname);
mfd.setSeparator(inbox.getSeparator());
mfd.setSubscribed(false);
mfd.setName(name);
final MailPermission p = MailProviderRegistry.getMailProviderBySession(session, MailAccount.DEFAULT_ID).createNewMailPermission(session, MailAccount.DEFAULT_ID);
p.setEntity(getUser());
p.setAllPermission(OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION);
p.setFolderAdmin(true);
p.setGroupPermission(false);
mfd.addPermission(p);
mailAccess.getFolderStorage().createFolder(mfd);
}
if (MailProperties.getInstance().isSupportSubscription() && !MailProperties.getInstance().isIgnoreSubscription()) {
final MailFolderDescription mfd = new MailFolderDescription();
mfd.setSubscribed(true);
mailAccess.getFolderStorage().updateFolder(fullname, mfd);
assertTrue("Could not be subscribed", mailAccess.getFolderStorage().getFolder(fullname).isSubscribed());
}
final MailFolderDescription mfd = new MailFolderDescription();
final MailPermission p1 = MailProviderRegistry.getMailProviderBySession(session, MailAccount.DEFAULT_ID).createNewMailPermission(session, MailAccount.DEFAULT_ID);
p1.setEntity(getUser());
p1.setAllPermission(OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION);
p1.setFolderAdmin(true);
p1.setGroupPermission(false);
mfd.addPermission(p1);
final MailPermission p2 = MailProviderRegistry.getMailProviderBySession(session, MailAccount.DEFAULT_ID).createNewMailPermission(session, MailAccount.DEFAULT_ID);
p2.setEntity(getSecondUser());
p2.setAllPermission(OCLPermission.READ_FOLDER, OCLPermission.ADMIN_PERMISSION, OCLPermission.NO_PERMISSIONS, OCLPermission.NO_PERMISSIONS);
p2.setFolderAdmin(false);
p2.setGroupPermission(false);
mfd.addPermission(p2);
assertTrue("Hugh... No permissions?!", mfd.containsPermissions());
mailAccess.getFolderStorage().updateFolder(fullname, mfd);
final MailFolder updatedFolder = mailAccess.getFolderStorage().getFolder(fullname);
final OCLPermission[] perms = updatedFolder.getPermissions();
if (mailAccess.getMailConfig().getCapabilities().hasPermissions()) {
assertTrue("Unexpected number of permissions: " + perms.length, perms.length == 2);
for (final OCLPermission permission : perms) {
if (permission.getEntity() == getUser()) {
assertTrue(permission.getFolderPermission() >= OCLPermission.CREATE_SUB_FOLDERS);
assertTrue(permission.getReadPermission() >= OCLPermission.READ_ALL_OBJECTS);
assertTrue(permission.getWritePermission() >= OCLPermission.WRITE_ALL_OBJECTS);
assertTrue(permission.getDeletePermission() >= OCLPermission.DELETE_ALL_OBJECTS);
assertTrue(permission.isFolderAdmin());
} else if (permission.getEntity() == getSecondUser()) {
assertTrue(permission.getFolderPermission() == OCLPermission.READ_FOLDER);
assertTrue(permission.getReadPermission() >= OCLPermission.READ_ALL_OBJECTS);
assertTrue(permission.getWritePermission() == OCLPermission.NO_PERMISSIONS);
assertTrue(permission.getDeletePermission() == OCLPermission.NO_PERMISSIONS);
assertFalse(permission.isFolderAdmin());
}
}
} else {
assertTrue("No default permission set!" + perms.length, perms.length == 1 && DefaultMailPermission.class.isInstance(perms[0]));
}
} finally {
if (fullname != null) {
mailAccess.getFolderStorage().deleteFolder(fullname, true);
}
/*
* close
*/
mailAccess.close(false);
}
}
@Test
public void testFolderMove() throws OXException {
final SessionObject session = getSession();
final MailAccess<?, ?> mailAccess = MailAccess.getInstance(session);
mailAccess.connect();
String fullname = null;
try {
String parentFullname = null;
char separator = '\0';
final boolean parentIsDefault;
{
final MailFolder inbox = mailAccess.getFolderStorage().getFolder(INBOX);
String name = "TemporaryFolder" + UUID.randomUUID().toString().substring(0, 8);
if (inbox.isHoldsFolders()) {
fullname = new StringBuilder(inbox.getFullname()).append(inbox.getSeparator()).append(name).toString();
parentFullname = INBOX;
parentIsDefault = false;
} else {
fullname = name;
parentFullname = MailFolder.DEFAULT_FOLDER_ID;
parentIsDefault = true;
}
final MailFolderDescription mfd = new MailFolderDescription();
mfd.setExists(false);
mfd.setParentFullname(parentFullname);
mfd.setSeparator((separator = inbox.getSeparator()));
mfd.setSubscribed(false);
mfd.setName(name);
final MailPermission p = MailProviderRegistry.getMailProviderBySession(session, MailAccount.DEFAULT_ID).createNewMailPermission(session, MailAccount.DEFAULT_ID);
p.setEntity(getUser());
p.setAllPermission(OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION);
p.setFolderAdmin(true);
p.setGroupPermission(false);
mfd.addPermission(p);
mailAccess.getFolderStorage().createFolder(mfd);
}
String stamp = Long.toString(System.currentTimeMillis());
String newFullname = parentIsDefault ? ("TemporaryFolderMoved" + stamp) : new StringBuilder(parentFullname).append(separator).append("TemporaryFolderMoved").append(stamp).toString();
// MOVE FOLDER
mailAccess.getFolderStorage().moveFolder(fullname, newFullname);
// ENSURE OLD ONE DOES NO MORE EXIST
Exception exc = null;
try {
mailAccess.getFolderStorage().getFolder(fullname);
} catch (final OXException e) {
exc = e;
}
assertTrue("Moved folder still exists", exc != null);
fullname = newFullname;
MailFolder mf = mailAccess.getFolderStorage().getFolder(fullname);
assertEquals("Unexpected name: " + mf.getName(), ("TemporaryFolderMoved" + stamp), mf.getName());
assertEquals("Unexpected parent: " + mf.getParentFullname(), parentFullname, mf.getParentFullname());
/*
* Move below root folder
*/
final MailFolder root = mailAccess.getFolderStorage().getRootFolder();
final OCLPermission[] rootPerms = root.getPermissions();
if (canCreateSubfolders(rootPerms)) {
newFullname = "TemporaryFolderMovedAgain" + stamp;
exc = null;
try {
mailAccess.getFolderStorage().moveFolder(fullname, newFullname);
} catch (final OXException e) {
exc = e;
}
assertTrue("Move below root folder failed", exc == null);
exc = null;
try {
mailAccess.getFolderStorage().getFolder(fullname);
} catch (final OXException e) {
exc = e;
}
assertTrue("Moved folder still exists", exc != null);
fullname = newFullname;
mf = mailAccess.getFolderStorage().getFolder(fullname);
assertTrue("Unexpected name: " + mf.getName(), ("TemporaryFolderMovedAgain" + stamp).equals(mf.getName()));
assertTrue("Unexpected parent: " + mf.getParentFullname(), MailFolder.DEFAULT_FOLDER_ID.equals(mf.getParentFullname()));
} else {
fullname = null;
}
} finally {
if (fullname != null) {
mailAccess.getFolderStorage().deleteFolder(fullname, true);
}
/*
* close
*/
mailAccess.close(false);
}
}
private boolean canCreateSubfolders(final OCLPermission[] perms) {
if (null == perms) {
return false;
}
for (final OCLPermission permission : perms) {
if (permission.getEntity() == getUser()) {
return permission.getFolderPermission() >= OCLPermission.CREATE_SUB_FOLDERS;
}
}
return false;
}
@Test
public void testFolderRename() throws OXException {
final SessionObject session = getSession();
final MailAccess<?, ?> mailAccess = MailAccess.getInstance(session);
mailAccess.connect();
String fullname = null;
try {
String parentFullname = null;
char separator = '\0';
final boolean isParentDefault;
{
final MailFolder inbox = mailAccess.getFolderStorage().getFolder(INBOX);
String name = "TemporaryFolder" + UUID.randomUUID().toString().substring(0, 8);
if (inbox.isHoldsFolders()) {
fullname = new StringBuilder(inbox.getFullname()).append(inbox.getSeparator()).append(name).toString();
parentFullname = INBOX;
isParentDefault = false;
} else {
fullname = name;
parentFullname = MailFolder.DEFAULT_FOLDER_ID;
isParentDefault = true;
}
final MailFolderDescription mfd = new MailFolderDescription();
mfd.setExists(false);
mfd.setParentFullname(parentFullname);
mfd.setSeparator((separator = inbox.getSeparator()));
mfd.setSubscribed(false);
mfd.setName(name);
final MailPermission p = MailProviderRegistry.getMailProviderBySession(session, MailAccount.DEFAULT_ID).createNewMailPermission(session, MailAccount.DEFAULT_ID);
p.setEntity(getUser());
p.setAllPermission(OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION);
p.setFolderAdmin(true);
p.setGroupPermission(false);
mfd.addPermission(p);
mailAccess.getFolderStorage().createFolder(mfd);
}
mailAccess.getFolderStorage().renameFolder(fullname, "TemporaryFolderRenamed");
Exception exc = null;
try {
mailAccess.getFolderStorage().getFolder(fullname);
} catch (final OXException e) {
exc = e;
}
assertTrue("Renamed folder still exists", exc != null);
fullname = isParentDefault ? "TemporaryFolderRenamed" : new StringBuilder(parentFullname).append(separator).append("TemporaryFolderRenamed").toString();
final MailFolder mf = mailAccess.getFolderStorage().getFolder(fullname);
assertEquals("Unexpected name: " + mf.getName(), "TemporaryFolderRenamed", mf.getName());
assertEquals("Unexpected parent: " + mf.getParentFullname(), parentFullname, mf.getParentFullname());
} finally {
if (fullname != null) {
mailAccess.getFolderStorage().deleteFolder(fullname, true);
}
/*
* close
*/
mailAccess.close(false);
}
}
@Test
public void testFolderDelete() throws OXException {
final SessionObject session = getSession();
final MailAccess<?, ?> mailAccess = MailAccess.getInstance(session);
mailAccess.connect();
String fullname = null;
try {
final String name = "TemporaryFolder" + UUID.randomUUID().toString().substring(0, 8);
String parentFullname = null;
{
final MailFolder inbox = mailAccess.getFolderStorage().getFolder(INBOX);
if (inbox.isHoldsFolders()) {
fullname = new StringBuilder(inbox.getFullname()).append(inbox.getSeparator()).append(name).toString();
parentFullname = INBOX;
} else {
fullname = name;
parentFullname = MailFolder.DEFAULT_FOLDER_ID;
}
final MailFolderDescription mfd = new MailFolderDescription();
mfd.setExists(false);
mfd.setParentFullname(parentFullname);
mfd.setSeparator(inbox.getSeparator());
mfd.setSubscribed(false);
mfd.setName(name);
final MailPermission p = MailProviderRegistry.getMailProviderBySession(session, MailAccount.DEFAULT_ID).createNewMailPermission(session, MailAccount.DEFAULT_ID);
p.setEntity(getUser());
p.setAllPermission(OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION);
p.setFolderAdmin(true);
p.setGroupPermission(false);
mfd.addPermission(p);
mailAccess.getFolderStorage().createFolder(mfd);
}
int numAppendix = mailAccess.getFolderStorage().getFolder(mailAccess.getFolderStorage().getTrashFolder()).isHoldsFolders() ? 0 : -1;
if (numAppendix == 0) {
final MailFolder[] trashedFolders = mailAccess.getFolderStorage().getSubfolders(mailAccess.getFolderStorage().getTrashFolder(), true);
for (final MailFolder mailFolder : trashedFolders) {
if (mailFolder.getName().startsWith(name)) {
final String substr = mailFolder.getName().substring(name.length());
if (substr.length() > 0) {
final int tmp = numAppendix;
try {
numAppendix = Math.max(numAppendix, Integer.parseInt(substr));
} catch (final NumberFormatException e) {
// ignore
numAppendix = tmp;
}
}
}
}
if (numAppendix > 0) {
numAppendix++;
}
}
mailAccess.getFolderStorage().deleteFolder(fullname);
Exception exc = null;
try {
mailAccess.getFolderStorage().getFolder(fullname);
} catch (final OXException e) {
exc = e;
}
assertTrue("Deleted folder still exists", exc != null);
if (numAppendix >= 0) {
boolean found = false;
/*
* Find backup folder below trash folder
*/
final MailFolder[] trashedFolders = mailAccess.getFolderStorage().getSubfolders(mailAccess.getFolderStorage().getTrashFolder(), true);
for (int i = 0; i < trashedFolders.length && !found; i++) {
if (trashedFolders[i].getName().startsWith(name)) {
if (numAppendix == 0) {
found = trashedFolders[i].getName().equals(name);
} else {
final String substr = trashedFolders[i].getName().substring(name.length());
try {
found = (numAppendix == Integer.parseInt(substr));
} catch (final NumberFormatException e) {
// ignore
}
}
if (found) {
fullname = trashedFolders[i].getFullname();
}
}
}
if (!found) {
fullname = null;
}
assertTrue("No backup folder found below trash folder", found);
}
} finally {
if (fullname != null) {
mailAccess.getFolderStorage().deleteFolder(fullname, true);
}
/*
* close
*/
mailAccess.close(false);
}
}
private static final MailField[] FIELDS_ID = { MailField.ID };
@Test
public void testFolderClear() throws OXException, MessagingException, IOException {
final SessionObject session = getSession();
final MailAccess<?, ?> mailAccess = MailAccess.getInstance(session);
mailAccess.connect();
String fullname = null;
String[] trashedIDs = null;
String trashFullname = null;
try {
final String name = "TemporaryFolder" + UUID.randomUUID().toString().substring(0, 8);
{
final MailFolder inbox = mailAccess.getFolderStorage().getFolder(INBOX);
final String parentFullname;
if (inbox.isHoldsFolders()) {
fullname = new StringBuilder(inbox.getFullname()).append(inbox.getSeparator()).append(name).toString();
parentFullname = INBOX;
} else {
fullname = name;
parentFullname = MailFolder.DEFAULT_FOLDER_ID;
}
if (mailAccess.getFolderStorage().exists(fullname)) {
mailAccess.getFolderStorage().clearFolder(fullname, true);
} else {
final MailFolderDescription mfd = new MailFolderDescription();
mfd.setExists(false);
mfd.setParentFullname(parentFullname);
mfd.setSeparator(inbox.getSeparator());
mfd.setSubscribed(false);
mfd.setName(name);
final MailPermission p = MailProviderRegistry.getMailProviderBySession(session, MailAccount.DEFAULT_ID).createNewMailPermission(session, MailAccount.DEFAULT_ID);
p.setEntity(getUser());
p.setAllPermission(OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION);
p.setFolderAdmin(true);
p.setGroupPermission(false);
mfd.addPermission(p);
mailAccess.getFolderStorage().createFolder(mfd);
}
}
final MailMessage[] mails = getMessages(getTestMailDir(), -1);
String[] uids = mailAccess.getMessageStorage().appendMessages(fullname, mails);
final MailFolder f = mailAccess.getFolderStorage().getFolder(fullname);
final int messageCount = f.getMessageCount();
if (messageCount > 0) {
assertTrue("Messages not completely appended to mail folder " + fullname + ": " + messageCount + " < " + uids.length, messageCount >= uids.length);
}
trashFullname = mailAccess.getFolderStorage().getTrashFolder();
int numTrashedMails = getMessageCount(mailAccess, trashFullname);
final Set<String> ids = new HashSet<String>(numTrashedMails);
MailMessage[] trashed = mailAccess.getMessageStorage().getAllMessages(trashFullname, IndexRange.NULL, MailSortField.RECEIVED_DATE, OrderDirection.ASC, FIELDS_ID);
for (int i = 0; i < trashed.length; i++) {
ids.add(trashed[i].getMailId());
}
mailAccess.getFolderStorage().clearFolder(fullname);
assertTrue("Folder should be empty", getMessageCount(mailAccess, fullname) == 0);
final int expectedMsgCount = numTrashedMails + uids.length;
assertTrue("Mails not completely backuped", getMessageCount(mailAccess, trashFullname) == expectedMsgCount);
final Set<String> newIds = new HashSet<String>(expectedMsgCount);
trashed = mailAccess.getMessageStorage().getAllMessages(trashFullname, IndexRange.NULL, MailSortField.RECEIVED_DATE, OrderDirection.ASC, FIELDS_ID);
assertTrue("Size mismatch: " + trashed.length + " but should be " + expectedMsgCount, trashed.length == expectedMsgCount);
for (int i = 0; i < trashed.length; i++) {
newIds.add(trashed[i].getMailId());
}
newIds.removeAll(ids);
trashedIDs = new String[newIds.size()];
int i = 0;
for (final String id : newIds) {
trashedIDs[i++] = id;
}
mailAccess.getMessageStorage().deleteMessages(trashFullname, trashedIDs, true);
trashedIDs = null;
uids = mailAccess.getMessageStorage().appendMessages(fullname, mails);
//f = mailAccess.getFolderStorage().getFolder(fullname);
assertTrue("Messages not completely appended to mail folder " + fullname, getMessageCount(mailAccess, fullname) == uids.length);
numTrashedMails = getMessageCount(mailAccess, trashFullname);
mailAccess.getFolderStorage().clearFolder(fullname, true);
assertTrue("Folder should be empty", getMessageCount(mailAccess, fullname) == 0);
assertTrue("Mails not deleted permanently although hardDelete flag set to true", getMessageCount(mailAccess, trashFullname) == numTrashedMails);
} finally {
if (fullname != null) {
mailAccess.getFolderStorage().deleteFolder(fullname, true);
}
if (trashedIDs != null) {
mailAccess.getMessageStorage().deleteMessages(trashFullname, trashedIDs, true);
}
/*
* close
*/
mailAccess.close(false);
}
}
@Test
public void testFolderQuota() throws OXException, MessagingException, IOException {
final SessionObject session = getSession();
final MailAccess<?, ?> mailAccess = MailAccess.getInstance(session);
mailAccess.connect();
final MailCapabilities caps = mailAccess.getMailConfig().getCapabilities();
if (!caps.hasQuota()) {
return;
}
String fullname = null;
try {
final String name = "TemporaryFolder" + UUID.randomUUID().toString().substring(0, 8);
{
final MailFolder inbox = mailAccess.getFolderStorage().getFolder(INBOX);
final String parentFullname;
if (inbox.isHoldsFolders()) {
fullname = new StringBuilder(inbox.getFullname()).append(inbox.getSeparator()).append(name).toString();
parentFullname = INBOX;
} else {
fullname = name;
parentFullname = MailFolder.DEFAULT_FOLDER_ID;
}
final MailFolderDescription mfd = new MailFolderDescription();
mfd.setExists(false);
mfd.setParentFullname(parentFullname);
mfd.setSeparator(inbox.getSeparator());
mfd.setSubscribed(false);
mfd.setName(name);
final MailPermission p = MailProviderRegistry.getMailProviderBySession(session, MailAccount.DEFAULT_ID).createNewMailPermission(session, MailAccount.DEFAULT_ID);
p.setEntity(getUser());
p.setAllPermission(OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION);
p.setFolderAdmin(true);
p.setGroupPermission(false);
mfd.addPermission(p);
mailAccess.getFolderStorage().createFolder(mfd);
}
final Quota.Type[] types = new Quota.Type[] { Quota.Type.STORAGE };
final long prevUsage = mailAccess.getFolderStorage().getQuotas(fullname, types)[0].getUsage();
if (prevUsage == Quota.UNLIMITED) {
return;
}
mailAccess.getMessageStorage().appendMessages(fullname, getMessages(getTestMailDir(), -1));
assertTrue("QUOTA not increased although mails were appended", mailAccess.getFolderStorage().getQuotas(fullname, types)[0].getUsage() > prevUsage);
} finally {
if (fullname != null) {
mailAccess.getFolderStorage().deleteFolder(fullname, true);
}
/*
* close
*/
mailAccess.close(false);
}
}
@Test
public void testPath2DefaultFolder() throws OXException {
final SessionObject session = getSession();
final MailAccess<?, ?> mailAccess = MailAccess.getInstance(session);
mailAccess.connect();
String fullname = null;
String anotherFullname = null;
try {
final String name = "TemporaryFolder" + UUID.randomUUID().toString().substring(0, 8);
final boolean isParentDefault;
{
final MailFolder inbox = mailAccess.getFolderStorage().getFolder(INBOX);
final String parentFullname;
if (inbox.isHoldsFolders()) {
fullname = new StringBuilder(inbox.getFullname()).append(inbox.getSeparator()).append(name).toString();
parentFullname = INBOX;
isParentDefault = false;
} else {
fullname = name;
parentFullname = MailFolder.DEFAULT_FOLDER_ID;
isParentDefault = true;
}
final MailFolderDescription mfd = new MailFolderDescription();
mfd.setExists(false);
mfd.setParentFullname(parentFullname);
mfd.setSeparator(inbox.getSeparator());
mfd.setSubscribed(false);
mfd.setName(name);
final MailPermission p = MailProviderRegistry.getMailProviderBySession(session, MailAccount.DEFAULT_ID).createNewMailPermission(session, MailAccount.DEFAULT_ID);
p.setEntity(getUser());
p.setAllPermission(OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION);
p.setFolderAdmin(true);
p.setGroupPermission(false);
mfd.addPermission(p);
mailAccess.getFolderStorage().createFolder(mfd);
}
MailFolder[] path = mailAccess.getFolderStorage().getPath2DefaultFolder(fullname);
assertEquals("Unexpected path length: " + path.length, (isParentDefault ? 1 : 2), path.length);
for (int i = 0; i < path.length; i++) {
if (i == 0) {
assertTrue("Unexpected mail folder in first path position", path[i].getFullname().equals(fullname));
} else {
assertTrue("Unexpected mail folder in second path position", path[i].getFullname().equals(INBOX));
}
}
path = null;
{
final MailFolder temp = mailAccess.getFolderStorage().getFolder(fullname);
final String parentFullname;
if (temp.isHoldsFolders()) {
anotherFullname = new StringBuilder(temp.getFullname()).append(temp.getSeparator()).append(name).toString();
parentFullname = temp.getFullname();
final MailFolderDescription mfd = new MailFolderDescription();
mfd.setExists(false);
mfd.setParentFullname(parentFullname);
mfd.setSeparator(temp.getSeparator());
mfd.setSubscribed(false);
mfd.setName(name);
final MailPermission p = MailProviderRegistry.getMailProviderBySession(session, MailAccount.DEFAULT_ID).createNewMailPermission(session, MailAccount.DEFAULT_ID);
p.setEntity(getUser());
p.setAllPermission(OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION, OCLPermission.ADMIN_PERMISSION);
p.setFolderAdmin(true);
p.setGroupPermission(false);
mfd.addPermission(p);
mailAccess.getFolderStorage().createFolder(mfd);
final MailFolder[] apath = mailAccess.getFolderStorage().getPath2DefaultFolder(anotherFullname);
assertTrue("Unexpected path length: " + apath.length, apath.length == (isParentDefault ? 2 : 3));
for (int i = 0; i < apath.length; i++) {
if (i == 0) {
assertTrue("Unexpected mail folder in first path position", apath[i].getFullname().equals(anotherFullname));
} else if (i == 1) {
assertTrue("Unexpected mail folder in first path position", apath[i].getFullname().equals(fullname));
} else {
assertTrue("Unexpected mail folder in second path position", apath[i].getFullname().equals(INBOX));
}
}
}
}
} finally {
if (anotherFullname != null) {
mailAccess.getFolderStorage().deleteFolder(anotherFullname, true);
}
if (fullname != null) {
mailAccess.getFolderStorage().deleteFolder(fullname, true);
}
/*
* close
*/
mailAccess.close(false);
}
}
}
| 50,324 | 0.595037 | 0.593151 | 1,053 | 46.834759 | 39.18681 | 194 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.809117 | false | false | 1 |
0349dffdfa20171aabd1f1ec41bc0d62c80b5bd7 | 14,783,277,480,093 | c7f18b90e3f354e1a161e9acc8e04185ec0fa03c | /Suite 1.0/src/telas/RelatorioClientesOS.java | 278dca572a02f0ea85688be49600b197e29e55a2 | [] | no_license | vagnermendes/NetBeansProjects | https://github.com/vagnermendes/NetBeansProjects | 331ece629ec7c5cc6e1b8f9d94076623fc5fa535 | fa23c4206be601379715ac9e43ce72b33da9b4a5 | refs/heads/master | 2021-08-14T23:55:02.084000 | 2017-11-15T16:57:44 | 2017-11-15T16:57:44 | 111,042,935 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/*
* RelatorioContaspagar.java
*
* Created on 25/05/2011, 19:02:39
*/
package telas;
import banco.BD_Clientes;
import banco.BD_OrdemServico;
import impressao.ImprimirRelatorioClientesOS;
import impressao.ImprimirRelatorioCustos;
import java.sql.SQLException;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JTable;
import objetos.Kernel;
import objetos.Cliente;
import objetos.OrdemServico;
/**
*
* @author vagnerfeijomendes
*/
public class RelatorioClientesOS extends javax.swing.JPanel {
private Kernel kernel = null;
private DecimalFormat fmt = null;
private Cliente obj_Clientes = null;
private OrdemServico obj_OrdemServico = null;
private BD_OrdemServico bd_OrdemServico = null;
private BD_Clientes bd_Clientes = null;
private ImprimirRelatorioClientesOS impressao = null;
private int acao = 0;
/** Creates new form RelatorioContaspagar */
public RelatorioClientesOS(Kernel obj,int acao,Object texto) {
this.kernel = obj;
this.acao = acao;
initComponents();
bd_Clientes = new BD_Clientes(kernel);
bd_OrdemServico = new BD_OrdemServico(kernel);
impressao = new ImprimirRelatorioClientesOS(kernel);
if(acao!=0){
obj_Clientes = bd_Clientes.getClienteID(acao);
Cliente_id.setText(String.valueOf(obj_Clientes.getCliente_id()));
campo_cliente.setText(obj_Clientes.getNome());
}
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
painel_cadastrar_area3 = new javax.swing.JPanel();
voltar = new javax.swing.JButton();
imprimir = new javax.swing.JButton();
Cliente_id = new javax.swing.JLabel();
jLabel47 = new javax.swing.JLabel();
jLabel48 = new javax.swing.JLabel();
jPanel1 = new javax.swing.JPanel();
busca = new javax.swing.JButton();
busca_cliente = new javax.swing.JButton();
campo_cliente = new javax.swing.JTextField();
jLabel1 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
valor_total = new javax.swing.JLabel();
sp = new javax.swing.JScrollPane();
tabela = new javax.swing.JTable();
setBackground(new java.awt.Color(204, 204, 204));
setForeground(new java.awt.Color(204, 204, 204));
painel_cadastrar_area3.setBackground(new java.awt.Color(204, 204, 204));
painel_cadastrar_area3.setBorder(javax.swing.BorderFactory.createEtchedBorder());
painel_cadastrar_area3.setForeground(new java.awt.Color(204, 204, 204));
voltar.setBackground(new java.awt.Color(204, 204, 204));
voltar.setForeground(new java.awt.Color(204, 204, 204));
voltar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/back.png"))); // NOI18N
voltar.setToolTipText("Voltar");
voltar.setBorder(null);
voltar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
voltarActionPerformed(evt);
}
});
imprimir.setBackground(new java.awt.Color(204, 204, 204));
imprimir.setForeground(new java.awt.Color(204, 204, 204));
imprimir.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/impressora.png"))); // NOI18N
imprimir.setToolTipText("Voltar");
imprimir.setBorder(null);
imprimir.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
imprimirActionPerformed(evt);
}
});
Cliente_id.setBackground(new java.awt.Color(204, 204, 204));
Cliente_id.setForeground(new java.awt.Color(204, 204, 204));
Cliente_id.setText("0");
jLabel47.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel47.setText("Voltar");
jLabel48.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel48.setText("Imprimir");
org.jdesktop.layout.GroupLayout painel_cadastrar_area3Layout = new org.jdesktop.layout.GroupLayout(painel_cadastrar_area3);
painel_cadastrar_area3.setLayout(painel_cadastrar_area3Layout);
painel_cadastrar_area3Layout.setHorizontalGroup(
painel_cadastrar_area3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(painel_cadastrar_area3Layout.createSequentialGroup()
.addContainerGap()
.add(painel_cadastrar_area3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
.add(voltar, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 58, Short.MAX_VALUE)
.add(jLabel47, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(painel_cadastrar_area3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
.add(imprimir, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 60, Short.MAX_VALUE)
.add(jLabel48, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(Cliente_id, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 15, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addContainerGap(963, Short.MAX_VALUE))
);
painel_cadastrar_area3Layout.setVerticalGroup(
painel_cadastrar_area3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(painel_cadastrar_area3Layout.createSequentialGroup()
.add(painel_cadastrar_area3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(painel_cadastrar_area3Layout.createSequentialGroup()
.add(painel_cadastrar_area3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
.add(voltar, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 61, Short.MAX_VALUE)
.add(imprimir, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(painel_cadastrar_area3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel47)
.add(jLabel48)))
.add(painel_cadastrar_area3Layout.createSequentialGroup()
.addContainerGap()
.add(Cliente_id)))
.addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel1.setBackground(new java.awt.Color(204, 204, 204));
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Filtro"));
jPanel1.setForeground(new java.awt.Color(204, 204, 204));
busca.setBackground(new java.awt.Color(204, 204, 204));
busca.setForeground(new java.awt.Color(204, 204, 204));
busca.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/lupa.png"))); // NOI18N
busca.setToolTipText("Salvar");
busca.setBorder(null);
busca.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buscaActionPerformed(evt);
}
});
busca_cliente.setText("Busca cliente");
busca_cliente.setBorder(null);
busca_cliente.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
busca_clienteActionPerformed(evt);
}
});
campo_cliente.setEditable(false);
jLabel1.setText("Cliente:");
jLabel5.setText("Total (R$):");
valor_total.setText("0,0");
org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel1Layout.createSequentialGroup()
.add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel1Layout.createSequentialGroup()
.add(jLabel5)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(valor_total))
.add(jPanel1Layout.createSequentialGroup()
.add(jLabel1)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(campo_cliente, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 267, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(busca_cliente, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 80, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(busca, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 57, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel1Layout.createSequentialGroup()
.add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel1)
.add(campo_cliente, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.add(4, 4, 4)
.add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel5)
.add(valor_total)))
.add(busca_cliente, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 20, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(busca, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 43, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
);
tabela.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null}
},
new String [] {
"Cod", "Nome", "Valor", "Data"
}
) {
Class[] types = new Class [] {
java.lang.String.class, java.lang.String.class, java.lang.Object.class, java.lang.Object.class
};
boolean[] canEdit = new boolean [] {
false, false, false, false
};
public Class getColumnClass(int columnIndex) {
return types [columnIndex];
}
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
tabela.setDragEnabled(true);
tabela.setRowHeight(25);
tabela.getTableHeader().setReorderingAllowed(false);
sp.setViewportView(tabela);
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(2, 2, 2)
.add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addContainerGap(641, Short.MAX_VALUE))
.add(sp, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 1122, Short.MAX_VALUE)
.add(painel_cadastrar_area3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(painel_cadastrar_area3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 92, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(sp, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 119, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
private void voltarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_voltarActionPerformed
// TODO add your handling code here:
kernel.Tela(24,kernel,0,null,null);
}//GEN-LAST:event_voltarActionPerformed
private void imprimirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_imprimirActionPerformed
// TODO add your handling code here:
try {
impressao.Imprimir(Integer.parseInt(Cliente_id.getText()));
} catch (SQLException ex) {
Logger.getLogger(RelatorioClientesOS.class.getName()).log(Level.SEVERE, null, ex);
}
}//GEN-LAST:event_imprimirActionPerformed
private void buscaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buscaActionPerformed
// TODO add your handling code here:
MontarTabela(Integer.parseInt(Cliente_id.getText()));
}//GEN-LAST:event_buscaActionPerformed
private void busca_clienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_busca_clienteActionPerformed
// TODO add your handling code here:
kernel.Tela(30,kernel,0,null,null);
}//GEN-LAST:event_busca_clienteActionPerformed
private void MontarTabela(int id) {
try {
OrdemServico[] vetor1 = null;
vetor1 = bd_OrdemServico.getRelatorio(id);
int tamanho= vetor1.length;
String dados[][] = new String[tamanho][5];
int coluna=0;
OrdemServico esp = new OrdemServico();
double venda = 0.0;
double desconto = 0.0;
double total = 0.0;
fmt = new DecimalFormat("#0.00");
for(int i=0; i < vetor1.length; i++){
coluna=0;
esp = (OrdemServico)vetor1[i];
dados[i][coluna++] = String.valueOf(esp.getOrdem_servico_id());
dados[i][coluna++] = String.valueOf("ORDEM SERVIรO: "+esp.getServico().getNome());
dados[i][coluna++] = fmt.format(esp.getValor());
dados[i][coluna++] = new SimpleDateFormat("dd/MM/yyyy").format(esp.getData_abertura());
dados[i][coluna++] = String.valueOf((esp.getStatus()==0?"Fechado":"Aberto"));
total += esp.getValor();
}
valor_total.setText(String.valueOf(total));
tabela.setModel(new javax.swing.table.DefaultTableModel(
dados,
new String [] {"Cod", "Descriรงรฃo","Valor","Data"," "}){
Class[] types = new Class [] {
java.lang.String.class, java.lang.String.class, java.lang.String.class,
java.lang.String.class,java.lang.String.class
};
public Class getColumnClass(int columnIndex) {
return types [columnIndex];
}
});
coluna=0;
tabela.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
tabela.getColumnModel().getColumn(coluna++).setPreferredWidth(50);
tabela.getColumnModel().getColumn(coluna++).setPreferredWidth(400);
tabela.getColumnModel().getColumn(coluna++).setPreferredWidth(100);
tabela.getColumnModel().getColumn(coluna++).setPreferredWidth(100);
tabela.getColumnModel().getColumn(coluna++).setPreferredWidth(100);
tabela.setDragEnabled(true);
sp.setViewportView(tabela);
//ButtonColumn buttonColumn0 = new ButtonColumn(table, 0);//VER
} catch (SQLException ex) {
Logger.getLogger(RelatorioClientesOS.class.getName()).log(Level.SEVERE, null, ex);
}
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel Cliente_id;
private javax.swing.JButton busca;
private javax.swing.JButton busca_cliente;
private javax.swing.JTextField campo_cliente;
private javax.swing.JButton imprimir;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel47;
private javax.swing.JLabel jLabel48;
private javax.swing.JLabel jLabel5;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel painel_cadastrar_area3;
private javax.swing.JScrollPane sp;
private javax.swing.JTable tabela;
private javax.swing.JLabel valor_total;
private javax.swing.JButton voltar;
// End of variables declaration//GEN-END:variables
}
| UTF-8 | Java | 18,552 | java | RelatorioClientesOS.java | Java | [
{
"context": "e;\nimport objetos.OrdemServico;\n\n/**\n *\n * @author vagnerfeijomendes\n */\npublic class RelatorioClientesOS extends java",
"end": 693,
"score": 0.9994935393333435,
"start": 676,
"tag": "USERNAME",
"value": "vagnerfeijomendes"
}
] | null | [] | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/*
* RelatorioContaspagar.java
*
* Created on 25/05/2011, 19:02:39
*/
package telas;
import banco.BD_Clientes;
import banco.BD_OrdemServico;
import impressao.ImprimirRelatorioClientesOS;
import impressao.ImprimirRelatorioCustos;
import java.sql.SQLException;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JTable;
import objetos.Kernel;
import objetos.Cliente;
import objetos.OrdemServico;
/**
*
* @author vagnerfeijomendes
*/
public class RelatorioClientesOS extends javax.swing.JPanel {
private Kernel kernel = null;
private DecimalFormat fmt = null;
private Cliente obj_Clientes = null;
private OrdemServico obj_OrdemServico = null;
private BD_OrdemServico bd_OrdemServico = null;
private BD_Clientes bd_Clientes = null;
private ImprimirRelatorioClientesOS impressao = null;
private int acao = 0;
/** Creates new form RelatorioContaspagar */
public RelatorioClientesOS(Kernel obj,int acao,Object texto) {
this.kernel = obj;
this.acao = acao;
initComponents();
bd_Clientes = new BD_Clientes(kernel);
bd_OrdemServico = new BD_OrdemServico(kernel);
impressao = new ImprimirRelatorioClientesOS(kernel);
if(acao!=0){
obj_Clientes = bd_Clientes.getClienteID(acao);
Cliente_id.setText(String.valueOf(obj_Clientes.getCliente_id()));
campo_cliente.setText(obj_Clientes.getNome());
}
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
painel_cadastrar_area3 = new javax.swing.JPanel();
voltar = new javax.swing.JButton();
imprimir = new javax.swing.JButton();
Cliente_id = new javax.swing.JLabel();
jLabel47 = new javax.swing.JLabel();
jLabel48 = new javax.swing.JLabel();
jPanel1 = new javax.swing.JPanel();
busca = new javax.swing.JButton();
busca_cliente = new javax.swing.JButton();
campo_cliente = new javax.swing.JTextField();
jLabel1 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
valor_total = new javax.swing.JLabel();
sp = new javax.swing.JScrollPane();
tabela = new javax.swing.JTable();
setBackground(new java.awt.Color(204, 204, 204));
setForeground(new java.awt.Color(204, 204, 204));
painel_cadastrar_area3.setBackground(new java.awt.Color(204, 204, 204));
painel_cadastrar_area3.setBorder(javax.swing.BorderFactory.createEtchedBorder());
painel_cadastrar_area3.setForeground(new java.awt.Color(204, 204, 204));
voltar.setBackground(new java.awt.Color(204, 204, 204));
voltar.setForeground(new java.awt.Color(204, 204, 204));
voltar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/back.png"))); // NOI18N
voltar.setToolTipText("Voltar");
voltar.setBorder(null);
voltar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
voltarActionPerformed(evt);
}
});
imprimir.setBackground(new java.awt.Color(204, 204, 204));
imprimir.setForeground(new java.awt.Color(204, 204, 204));
imprimir.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/impressora.png"))); // NOI18N
imprimir.setToolTipText("Voltar");
imprimir.setBorder(null);
imprimir.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
imprimirActionPerformed(evt);
}
});
Cliente_id.setBackground(new java.awt.Color(204, 204, 204));
Cliente_id.setForeground(new java.awt.Color(204, 204, 204));
Cliente_id.setText("0");
jLabel47.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel47.setText("Voltar");
jLabel48.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel48.setText("Imprimir");
org.jdesktop.layout.GroupLayout painel_cadastrar_area3Layout = new org.jdesktop.layout.GroupLayout(painel_cadastrar_area3);
painel_cadastrar_area3.setLayout(painel_cadastrar_area3Layout);
painel_cadastrar_area3Layout.setHorizontalGroup(
painel_cadastrar_area3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(painel_cadastrar_area3Layout.createSequentialGroup()
.addContainerGap()
.add(painel_cadastrar_area3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
.add(voltar, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 58, Short.MAX_VALUE)
.add(jLabel47, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(painel_cadastrar_area3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
.add(imprimir, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 60, Short.MAX_VALUE)
.add(jLabel48, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(Cliente_id, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 15, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addContainerGap(963, Short.MAX_VALUE))
);
painel_cadastrar_area3Layout.setVerticalGroup(
painel_cadastrar_area3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(painel_cadastrar_area3Layout.createSequentialGroup()
.add(painel_cadastrar_area3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(painel_cadastrar_area3Layout.createSequentialGroup()
.add(painel_cadastrar_area3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
.add(voltar, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 61, Short.MAX_VALUE)
.add(imprimir, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(painel_cadastrar_area3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel47)
.add(jLabel48)))
.add(painel_cadastrar_area3Layout.createSequentialGroup()
.addContainerGap()
.add(Cliente_id)))
.addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel1.setBackground(new java.awt.Color(204, 204, 204));
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Filtro"));
jPanel1.setForeground(new java.awt.Color(204, 204, 204));
busca.setBackground(new java.awt.Color(204, 204, 204));
busca.setForeground(new java.awt.Color(204, 204, 204));
busca.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/lupa.png"))); // NOI18N
busca.setToolTipText("Salvar");
busca.setBorder(null);
busca.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buscaActionPerformed(evt);
}
});
busca_cliente.setText("Busca cliente");
busca_cliente.setBorder(null);
busca_cliente.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
busca_clienteActionPerformed(evt);
}
});
campo_cliente.setEditable(false);
jLabel1.setText("Cliente:");
jLabel5.setText("Total (R$):");
valor_total.setText("0,0");
org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel1Layout.createSequentialGroup()
.add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel1Layout.createSequentialGroup()
.add(jLabel5)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(valor_total))
.add(jPanel1Layout.createSequentialGroup()
.add(jLabel1)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(campo_cliente, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 267, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(busca_cliente, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 80, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(busca, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 57, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel1Layout.createSequentialGroup()
.add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel1)
.add(campo_cliente, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.add(4, 4, 4)
.add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel5)
.add(valor_total)))
.add(busca_cliente, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 20, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(busca, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 43, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
);
tabela.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null}
},
new String [] {
"Cod", "Nome", "Valor", "Data"
}
) {
Class[] types = new Class [] {
java.lang.String.class, java.lang.String.class, java.lang.Object.class, java.lang.Object.class
};
boolean[] canEdit = new boolean [] {
false, false, false, false
};
public Class getColumnClass(int columnIndex) {
return types [columnIndex];
}
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
tabela.setDragEnabled(true);
tabela.setRowHeight(25);
tabela.getTableHeader().setReorderingAllowed(false);
sp.setViewportView(tabela);
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(2, 2, 2)
.add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addContainerGap(641, Short.MAX_VALUE))
.add(sp, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 1122, Short.MAX_VALUE)
.add(painel_cadastrar_area3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(painel_cadastrar_area3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 92, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(sp, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 119, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
private void voltarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_voltarActionPerformed
// TODO add your handling code here:
kernel.Tela(24,kernel,0,null,null);
}//GEN-LAST:event_voltarActionPerformed
private void imprimirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_imprimirActionPerformed
// TODO add your handling code here:
try {
impressao.Imprimir(Integer.parseInt(Cliente_id.getText()));
} catch (SQLException ex) {
Logger.getLogger(RelatorioClientesOS.class.getName()).log(Level.SEVERE, null, ex);
}
}//GEN-LAST:event_imprimirActionPerformed
private void buscaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buscaActionPerformed
// TODO add your handling code here:
MontarTabela(Integer.parseInt(Cliente_id.getText()));
}//GEN-LAST:event_buscaActionPerformed
private void busca_clienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_busca_clienteActionPerformed
// TODO add your handling code here:
kernel.Tela(30,kernel,0,null,null);
}//GEN-LAST:event_busca_clienteActionPerformed
private void MontarTabela(int id) {
try {
OrdemServico[] vetor1 = null;
vetor1 = bd_OrdemServico.getRelatorio(id);
int tamanho= vetor1.length;
String dados[][] = new String[tamanho][5];
int coluna=0;
OrdemServico esp = new OrdemServico();
double venda = 0.0;
double desconto = 0.0;
double total = 0.0;
fmt = new DecimalFormat("#0.00");
for(int i=0; i < vetor1.length; i++){
coluna=0;
esp = (OrdemServico)vetor1[i];
dados[i][coluna++] = String.valueOf(esp.getOrdem_servico_id());
dados[i][coluna++] = String.valueOf("ORDEM SERVIรO: "+esp.getServico().getNome());
dados[i][coluna++] = fmt.format(esp.getValor());
dados[i][coluna++] = new SimpleDateFormat("dd/MM/yyyy").format(esp.getData_abertura());
dados[i][coluna++] = String.valueOf((esp.getStatus()==0?"Fechado":"Aberto"));
total += esp.getValor();
}
valor_total.setText(String.valueOf(total));
tabela.setModel(new javax.swing.table.DefaultTableModel(
dados,
new String [] {"Cod", "Descriรงรฃo","Valor","Data"," "}){
Class[] types = new Class [] {
java.lang.String.class, java.lang.String.class, java.lang.String.class,
java.lang.String.class,java.lang.String.class
};
public Class getColumnClass(int columnIndex) {
return types [columnIndex];
}
});
coluna=0;
tabela.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
tabela.getColumnModel().getColumn(coluna++).setPreferredWidth(50);
tabela.getColumnModel().getColumn(coluna++).setPreferredWidth(400);
tabela.getColumnModel().getColumn(coluna++).setPreferredWidth(100);
tabela.getColumnModel().getColumn(coluna++).setPreferredWidth(100);
tabela.getColumnModel().getColumn(coluna++).setPreferredWidth(100);
tabela.setDragEnabled(true);
sp.setViewportView(tabela);
//ButtonColumn buttonColumn0 = new ButtonColumn(table, 0);//VER
} catch (SQLException ex) {
Logger.getLogger(RelatorioClientesOS.class.getName()).log(Level.SEVERE, null, ex);
}
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel Cliente_id;
private javax.swing.JButton busca;
private javax.swing.JButton busca_cliente;
private javax.swing.JTextField campo_cliente;
private javax.swing.JButton imprimir;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel47;
private javax.swing.JLabel jLabel48;
private javax.swing.JLabel jLabel5;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel painel_cadastrar_area3;
private javax.swing.JScrollPane sp;
private javax.swing.JTable tabela;
private javax.swing.JLabel valor_total;
private javax.swing.JButton voltar;
// End of variables declaration//GEN-END:variables
}
| 18,552 | 0.63804 | 0.621058 | 374 | 48.596256 | 36.179295 | 182 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.820856 | false | false | 1 |
caf1ffbce21e2d485bc2e21d2f0cddbef0b6ab98 | 29,102,698,448,698 | 7f943d8f37d8fa3490d4039cf8f3bcb058c27160 | /src/main/java/com/intellectseec/billing/policyModel/paidpremiumpolicy/PaidPolicyRs.java | cf22527eec3d5e39913ccfb0ae69eaf335d52d5f | [] | no_license | DasariNaveen/BillingBrmsServices | https://github.com/DasariNaveen/BillingBrmsServices | da8bc0cafa18264e86582d121cc652a79e3b4b57 | ac49a053d4c262e7e1620c8bd447056267a8692e | refs/heads/master | 2020-03-16T21:15:48.008000 | 2018-05-15T11:35:56 | 2018-05-15T11:35:56 | 132,991,564 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.intellectseec.billing.policyModel.paidpremiumpolicy;
import java.util.List;
import com.intellectseec.billing.model.common.BaseResponse;
import com.intellectseec.billing.policyModel.dto.PaidPolicyDTO;
import com.intellectseec.billing.policyModel.paymentGateway.CcmsPaymentResponseInfo;
import com.intellectseec.billing.policyModel.paymentGateway.PaymentRs;
/**
* @author avinash.m
*
*/
public class PaidPolicyRs extends BaseResponse {
private List<PaidPolicyDTO> paidPolicyList;
private List<PaymentRs> paymentRsList;
List<CcmsPaymentResponseInfo> ccmsPaymentResponseInfos;
/**
* @return the paidPolicyList
*/
public List<PaidPolicyDTO> getPaidPolicyList() {
return paidPolicyList;
}
/**
* @param paidPolicyList
* the paidPolicyList to set
*/
public void setPaidPolicyList(List<PaidPolicyDTO> paidPolicyList) {
this.paidPolicyList = paidPolicyList;
}
public List<PaymentRs> getPaymentRsList() {
return paymentRsList;
}
public void setPaymentRsList(List<PaymentRs> paymentRsList) {
this.paymentRsList = paymentRsList;
}
public List<CcmsPaymentResponseInfo> getCcmsPaymentResponseInfos() {
return ccmsPaymentResponseInfos;
}
public void setCcmsPaymentResponseInfos(List<CcmsPaymentResponseInfo> ccmsPaymentResponseInfos) {
this.ccmsPaymentResponseInfos = ccmsPaymentResponseInfos;
}
}
| UTF-8 | Java | 1,360 | java | PaidPolicyRs.java | Java | [
{
"context": "icyModel.paymentGateway.PaymentRs;\n\n/**\n * @author avinash.m\n *\n */\npublic class PaidPolicyRs extends BaseResp",
"end": 395,
"score": 0.9561015963554382,
"start": 386,
"tag": "USERNAME",
"value": "avinash.m"
}
] | null | [] | package com.intellectseec.billing.policyModel.paidpremiumpolicy;
import java.util.List;
import com.intellectseec.billing.model.common.BaseResponse;
import com.intellectseec.billing.policyModel.dto.PaidPolicyDTO;
import com.intellectseec.billing.policyModel.paymentGateway.CcmsPaymentResponseInfo;
import com.intellectseec.billing.policyModel.paymentGateway.PaymentRs;
/**
* @author avinash.m
*
*/
public class PaidPolicyRs extends BaseResponse {
private List<PaidPolicyDTO> paidPolicyList;
private List<PaymentRs> paymentRsList;
List<CcmsPaymentResponseInfo> ccmsPaymentResponseInfos;
/**
* @return the paidPolicyList
*/
public List<PaidPolicyDTO> getPaidPolicyList() {
return paidPolicyList;
}
/**
* @param paidPolicyList
* the paidPolicyList to set
*/
public void setPaidPolicyList(List<PaidPolicyDTO> paidPolicyList) {
this.paidPolicyList = paidPolicyList;
}
public List<PaymentRs> getPaymentRsList() {
return paymentRsList;
}
public void setPaymentRsList(List<PaymentRs> paymentRsList) {
this.paymentRsList = paymentRsList;
}
public List<CcmsPaymentResponseInfo> getCcmsPaymentResponseInfos() {
return ccmsPaymentResponseInfos;
}
public void setCcmsPaymentResponseInfos(List<CcmsPaymentResponseInfo> ccmsPaymentResponseInfos) {
this.ccmsPaymentResponseInfos = ccmsPaymentResponseInfos;
}
}
| 1,360 | 0.795588 | 0.795588 | 53 | 24.660378 | 27.502962 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.924528 | false | false | 1 |
428fc9a2e5daa1214064040a84f4921035c666f3 | 26,405,458,983,868 | a5c42a60104beb73131fb740ae96bb5c7e42b64a | /src/test/java/fr/unice/polytech/qgl/qab/strategy/ground/states/TransformResourceTest.java | 121bb49653883226f9135a782e48793d6a7b045e | [] | no_license | raquel-oliveira/QGL | https://github.com/raquel-oliveira/QGL | dc78282c6cb3f4705c411ba558f3876422632a2c | fdc7ad1b29ad989fe92f431224cf512ff37d296d | refs/heads/master | 2021-01-10T05:00:00.512000 | 2016-04-08T09:02:39 | 2016-04-08T09:02:39 | 54,964,219 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package fr.unice.polytech.qgl.qab.strategy.ground.states;
import fr.unice.polytech.qgl.qab.actions.Action;
import fr.unice.polytech.qgl.qab.actions.simple.common.Stop;
import fr.unice.polytech.qgl.qab.actions.simple.ground.Transform;
import fr.unice.polytech.qgl.qab.exception.action.IndexOutOfBoundsComboAction;
import fr.unice.polytech.qgl.qab.exception.context.NegativeBudgetException;
import fr.unice.polytech.qgl.qab.exception.map.PositionOutOfMapRange;
import fr.unice.polytech.qgl.qab.map.Map;
import fr.unice.polytech.qgl.qab.resources.manufactured.ManufacturedResource;
import fr.unice.polytech.qgl.qab.resources.manufactured.ManufacturedType;
import fr.unice.polytech.qgl.qab.resources.primary.PrimaryResource;
import fr.unice.polytech.qgl.qab.resources.primary.PrimaryType;
import fr.unice.polytech.qgl.qab.strategy.context.Context;
import fr.unice.polytech.qgl.qab.strategy.context.contracts.ContractItem;
import static java.lang.Math.ceil;
import org.junit.Before;
import org.junit.Test;
import java.util.ArrayList;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.List;
import static org.junit.Assert.assertEquals;
/**
* version 14/03/2016.
*/
public class TransformResourceTest {
TransformResource trans;
Context context;
@Before
public void defineContext() throws NegativeBudgetException{
trans = new TransformResource();
context = new Context();
}
@Test
public void testInstance() {
TransformResource transforme = new TransformResource();
assertEquals(trans.getClass(), transforme.getClass());
}
@Test
public void testReturnState() throws NegativeBudgetException, PositionOutOfMapRange{
context.getContracts().addContract("WOOD", 15);
context.getContracts().addCollectedResources(new PrimaryResource(PrimaryType.FISH), 10);
GroundState state = trans.getState(context, new Map());
assertEquals(ScoutTile.class, state.getClass());
context.getContracts().addCollectedResources(new PrimaryResource(PrimaryType.WOOD), 15);
state = trans.getState(context, new Map());
assertEquals(ScoutTile.class, state.getClass());
context.getContracts().addContract("GLASS", 1);
context.getContracts().addCollectedResources(new PrimaryResource(PrimaryType.QUARTZ), new ManufacturedResource(ManufacturedType.GLASS).getRecipe((int)(ceil(1 * ContractItem.getMarginError()))).get(PrimaryType.QUARTZ));
context.getContracts().addCollectedResources(new PrimaryResource(PrimaryType.WOOD), new ManufacturedResource(ManufacturedType.GLASS).getRecipe((int)(ceil(1 * ContractItem.getMarginError()))).get(PrimaryType.WOOD));
state = trans.getState(context, new Map());
assertEquals(TransformResource.class, state.getClass());
}
@Test
public void responseStop() throws NegativeBudgetException, IndexOutOfBoundsComboAction {
context.getContracts().addContract("GLASS", 1);
context.getContracts().addCollectedResources(new ManufacturedResource(ManufacturedType.GLASS), 1);
Action act = trans.responseState(context, new Map());
assertEquals(Stop.class, act.getClass());
}
@Test
public void responseTransforme() throws NegativeBudgetException, IndexOutOfBoundsComboAction {
context.setBudget(1000);
context.getContracts().addContract("GLASS", 5);
context.getContracts().addCollectedResources(new PrimaryResource(PrimaryType.QUARTZ), new ManufacturedResource(ManufacturedType.GLASS).getRecipe((int)(ceil(5 * ContractItem.getMarginError()))).get(PrimaryType.QUARTZ));
context.getContracts().addCollectedResources(new PrimaryResource(PrimaryType.WOOD), new ManufacturedResource(ManufacturedType.GLASS).getRecipe((int)(ceil(5 * ContractItem.getMarginError()))).get(PrimaryType.WOOD));
Action act = trans.responseState(context, new Map());
assertEquals(Transform.class, act.getClass());
}
}
| UTF-8 | Java | 3,979 | java | TransformResourceTest.java | Java | [] | null | [] | package fr.unice.polytech.qgl.qab.strategy.ground.states;
import fr.unice.polytech.qgl.qab.actions.Action;
import fr.unice.polytech.qgl.qab.actions.simple.common.Stop;
import fr.unice.polytech.qgl.qab.actions.simple.ground.Transform;
import fr.unice.polytech.qgl.qab.exception.action.IndexOutOfBoundsComboAction;
import fr.unice.polytech.qgl.qab.exception.context.NegativeBudgetException;
import fr.unice.polytech.qgl.qab.exception.map.PositionOutOfMapRange;
import fr.unice.polytech.qgl.qab.map.Map;
import fr.unice.polytech.qgl.qab.resources.manufactured.ManufacturedResource;
import fr.unice.polytech.qgl.qab.resources.manufactured.ManufacturedType;
import fr.unice.polytech.qgl.qab.resources.primary.PrimaryResource;
import fr.unice.polytech.qgl.qab.resources.primary.PrimaryType;
import fr.unice.polytech.qgl.qab.strategy.context.Context;
import fr.unice.polytech.qgl.qab.strategy.context.contracts.ContractItem;
import static java.lang.Math.ceil;
import org.junit.Before;
import org.junit.Test;
import java.util.ArrayList;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.List;
import static org.junit.Assert.assertEquals;
/**
* version 14/03/2016.
*/
public class TransformResourceTest {
TransformResource trans;
Context context;
@Before
public void defineContext() throws NegativeBudgetException{
trans = new TransformResource();
context = new Context();
}
@Test
public void testInstance() {
TransformResource transforme = new TransformResource();
assertEquals(trans.getClass(), transforme.getClass());
}
@Test
public void testReturnState() throws NegativeBudgetException, PositionOutOfMapRange{
context.getContracts().addContract("WOOD", 15);
context.getContracts().addCollectedResources(new PrimaryResource(PrimaryType.FISH), 10);
GroundState state = trans.getState(context, new Map());
assertEquals(ScoutTile.class, state.getClass());
context.getContracts().addCollectedResources(new PrimaryResource(PrimaryType.WOOD), 15);
state = trans.getState(context, new Map());
assertEquals(ScoutTile.class, state.getClass());
context.getContracts().addContract("GLASS", 1);
context.getContracts().addCollectedResources(new PrimaryResource(PrimaryType.QUARTZ), new ManufacturedResource(ManufacturedType.GLASS).getRecipe((int)(ceil(1 * ContractItem.getMarginError()))).get(PrimaryType.QUARTZ));
context.getContracts().addCollectedResources(new PrimaryResource(PrimaryType.WOOD), new ManufacturedResource(ManufacturedType.GLASS).getRecipe((int)(ceil(1 * ContractItem.getMarginError()))).get(PrimaryType.WOOD));
state = trans.getState(context, new Map());
assertEquals(TransformResource.class, state.getClass());
}
@Test
public void responseStop() throws NegativeBudgetException, IndexOutOfBoundsComboAction {
context.getContracts().addContract("GLASS", 1);
context.getContracts().addCollectedResources(new ManufacturedResource(ManufacturedType.GLASS), 1);
Action act = trans.responseState(context, new Map());
assertEquals(Stop.class, act.getClass());
}
@Test
public void responseTransforme() throws NegativeBudgetException, IndexOutOfBoundsComboAction {
context.setBudget(1000);
context.getContracts().addContract("GLASS", 5);
context.getContracts().addCollectedResources(new PrimaryResource(PrimaryType.QUARTZ), new ManufacturedResource(ManufacturedType.GLASS).getRecipe((int)(ceil(5 * ContractItem.getMarginError()))).get(PrimaryType.QUARTZ));
context.getContracts().addCollectedResources(new PrimaryResource(PrimaryType.WOOD), new ManufacturedResource(ManufacturedType.GLASS).getRecipe((int)(ceil(5 * ContractItem.getMarginError()))).get(PrimaryType.WOOD));
Action act = trans.responseState(context, new Map());
assertEquals(Transform.class, act.getClass());
}
}
| 3,979 | 0.75622 | 0.749686 | 85 | 45.811764 | 49.558876 | 226 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.882353 | false | false | 1 |
30ead4d5e1dfffcac71cc195c940d5f7eed2d672 | 13,460,427,555,433 | dd2afcacb7f73b504a2ea0caa18c60cb9ebdc656 | /Specify/src/edu/ku/brc/af/ui/forms/formatters/FmtListEditorDlgBase.java | 9608c2e55233998ad1d4a3fec53997cceff88e91 | [] | no_license | harvardinformatics/specify-huh | https://github.com/harvardinformatics/specify-huh | 7361bc28cd9bf1fa73935dfe9782535a87579751 | de9eebf1e39d683a932038938313a1a304e90b09 | refs/heads/master | 2020-03-16T22:46:22.803000 | 2011-06-14T14:28:42 | 2011-06-14T14:28:42 | 133,051,909 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /* Copyright (C) 2009, University of Kansas Center for Research
*
* Specify Software Project, specify@ku.edu, Biodiversity Institute,
* 1345 Jayhawk Boulevard, Lawrence, Kansas, 66045, USA
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package edu.ku.brc.af.ui.forms.formatters;
import static edu.ku.brc.ui.UIHelper.createI18NFormLabel;
import static edu.ku.brc.ui.UIHelper.createLabel;
import static edu.ku.brc.ui.UIRegistry.getResourceString;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Frame;
import java.awt.HeadlessException;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.DefaultListModel;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.ListCellRenderer;
import javax.swing.ListSelectionModel;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import com.jgoodies.forms.builder.PanelBuilder;
import com.jgoodies.forms.layout.CellConstraints;
import com.jgoodies.forms.layout.FormLayout;
import edu.ku.brc.af.core.db.DBInfoBase;
import edu.ku.brc.af.core.db.DBTableInfo;
import edu.ku.brc.ui.CustomDialog;
import edu.ku.brc.ui.UIHelper;
/**
* @author rod
*
* @code_status Alpha
*
* Aug 11, 2008
*
*/
public abstract class FmtListEditorDlgBase extends CustomDialog
{
protected DBInfoBase baseInfo;
protected DataObjFieldFormatMgr dataObjFieldFormatMgrCache;
protected UIFieldFormatterMgr uiFieldFormatterMgrCache;
protected boolean hasChanged = false;
// UI controls
protected JList list;
protected DefaultListModel listModel;
protected DefEditDeleteAddPanel dedaPanel;
/**
* @throws HeadlessException
*/
public FmtListEditorDlgBase(final Frame frame,
final String titleKey,
final String helpContext,
final DBInfoBase baseInfo,
final DataObjFieldFormatMgr dataObjFieldFormatMgrCache,
final UIFieldFormatterMgr uiFieldFormatterMgrCache)
throws HeadlessException
{
super(frame, getResourceString(titleKey), true, OK_BTN | HELP_BTN, null);
this.baseInfo = baseInfo;
this.dataObjFieldFormatMgrCache = dataObjFieldFormatMgrCache;
this.uiFieldFormatterMgrCache = uiFieldFormatterMgrCache;
this.helpContext = helpContext;
okLabel = getResourceString("CLOSE");
}
/* (non-Javadoc)
* @see edu.ku.brc.ui.CustomDialog#createUI()
*/
@Override
public void createUI()
{
super.createUI();
CellConstraints cc = new CellConstraints();
// table info
PanelBuilder tblInfoPB = new PanelBuilder(new FormLayout("p,p:g", "p")/*, new FormDebugPanel()*/);
JLabel tableTitleLbl = createI18NFormLabel("FmtListEditorBase." + (baseInfo instanceof DBTableInfo ? "TABLE" : "FIELD"));
JLabel tableTitleValueLbl = createLabel(baseInfo.getTitle());
tableTitleValueLbl.setBackground(Color.WHITE);
tableTitleValueLbl.setOpaque(true);
tblInfoPB.add(tableTitleLbl, cc.xy(1, 1));
tblInfoPB.add(tableTitleValueLbl, cc.xy(2, 1));
// add available data object formatters
createList();
ActionListener addAL = new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
addItem();
}
};
ActionListener delAL = new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
deleteSelectedItem();
}
};
ActionListener edtAL = new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
editItem(list.getSelectedValue(), false);
}
};
ActionListener defAL = new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
setDefaultItem();
}
};
String[] toolTipKeys = getDEDAToolTipKeys();
// delete button
dedaPanel = new DefEditDeleteAddPanel(defAL, edtAL, delAL, addAL,
toolTipKeys[0], toolTipKeys[1], toolTipKeys[2], toolTipKeys[3]);
dedaPanel.getAddBtn().setEnabled(true);
PanelBuilder pb = new PanelBuilder(new FormLayout("f:max(250px;p):g", "p,6px,f:max(250px;p):g,2px,p"));
// lay out components on main panel
int y = 1; // leave first row blank
pb.add(tblInfoPB.getPanel(), cc.xy(1, y)); y += 2;
pb.add(UIHelper.createScrollPane(list), cc.xy(1,y)); y += 2;
pb.add(dedaPanel, cc.xy(1,y)); y += 2;
pb.setDefaultDialogBorder();
contentPanel = pb.getPanel();
mainPanel.add(contentPanel, BorderLayout.CENTER);
updateUIEnabled();
pack();
}
/**
* @return
*/
protected void createList()
{
listModel = createListDataModel();
list = new JList(listModel);
list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
ListCellRenderer cellRenderer = getListCellRenderer();
if (cellRenderer != null)
{
list.setCellRenderer(cellRenderer);
}
list.addListSelectionListener(new ListSelectionListener()
{
public void valueChanged(ListSelectionEvent e)
{
if (!e.getValueIsAdjusting())
{
updateUIEnabled();
}
}
});
list.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e)
{
super.mouseClicked(e);
if (e.getClickCount() == 2)
{
editItem(list.getSelectedValue(), false);
}
}
});
}
protected ListCellRenderer getListCellRenderer()
{
return null;
}
/**
* @return
*/
protected abstract String[] getDEDAToolTipKeys();
/**
* @return
*/
protected abstract DefaultListModel createListDataModel();
/**
*
*/
protected abstract void deleteSelectedItem();
/**
*
*/
protected abstract void editItem(final Object dataObj, final boolean isNew);
/**
*
*/
protected abstract void setDefaultItem();
/**
*
*/
protected abstract void addItem();
/**
*
*/
protected void updateUIEnabled()
{
Object item = list.getSelectedValue();
dedaPanel.getDelBtn().setEnabled(item != null);
dedaPanel.getDefBtn().setEnabled(item != null);
dedaPanel.getEditBtn().setEnabled(item != null);
}
/**
* @return the hasChanged
*/
public boolean hasChanged()
{
return hasChanged;
}
/**
* @param hasChanged the hasChanged to set
*/
public void setHasChanged(boolean hasChanged)
{
if (this.hasChanged != hasChanged)
{
setWindowModified(hasChanged);
}
this.hasChanged = hasChanged;
updateUIEnabled();
}
}
| UTF-8 | Java | 8,490 | java | FmtListEditorDlgBase.java | Java | [
{
"context": "nter for Research\n * \n * Specify Software Project, specify@ku.edu, Biodiversity Institute,\n * 1345 Jayhawk Boulevar",
"end": 111,
"score": 0.9999246597290039,
"start": 97,
"tag": "EMAIL",
"value": "specify@ku.edu"
},
{
"context": "t, specify@ku.edu, Biodiversity Institute,\n * 1345 Jayhawk Boulevard, Lawrence, Kansas, 66045, USA\n * \n * This program",
"end": 162,
"score": 0.9995532631874084,
"start": 145,
"tag": "NAME",
"value": "Jayhawk Boulevard"
},
{
"context": "og;\nimport edu.ku.brc.ui.UIHelper;\n\n/**\n * @author rod\n *\n * @code_status Alpha\n *\n * Aug 11, 2008\n *\n *",
"end": 1959,
"score": 0.9994343519210815,
"start": 1956,
"tag": "USERNAME",
"value": "rod"
}
] | null | [] | /* Copyright (C) 2009, University of Kansas Center for Research
*
* Specify Software Project, <EMAIL>, Biodiversity Institute,
* 1345 <NAME>, Lawrence, Kansas, 66045, USA
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package edu.ku.brc.af.ui.forms.formatters;
import static edu.ku.brc.ui.UIHelper.createI18NFormLabel;
import static edu.ku.brc.ui.UIHelper.createLabel;
import static edu.ku.brc.ui.UIRegistry.getResourceString;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Frame;
import java.awt.HeadlessException;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.DefaultListModel;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.ListCellRenderer;
import javax.swing.ListSelectionModel;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import com.jgoodies.forms.builder.PanelBuilder;
import com.jgoodies.forms.layout.CellConstraints;
import com.jgoodies.forms.layout.FormLayout;
import edu.ku.brc.af.core.db.DBInfoBase;
import edu.ku.brc.af.core.db.DBTableInfo;
import edu.ku.brc.ui.CustomDialog;
import edu.ku.brc.ui.UIHelper;
/**
* @author rod
*
* @code_status Alpha
*
* Aug 11, 2008
*
*/
public abstract class FmtListEditorDlgBase extends CustomDialog
{
protected DBInfoBase baseInfo;
protected DataObjFieldFormatMgr dataObjFieldFormatMgrCache;
protected UIFieldFormatterMgr uiFieldFormatterMgrCache;
protected boolean hasChanged = false;
// UI controls
protected JList list;
protected DefaultListModel listModel;
protected DefEditDeleteAddPanel dedaPanel;
/**
* @throws HeadlessException
*/
public FmtListEditorDlgBase(final Frame frame,
final String titleKey,
final String helpContext,
final DBInfoBase baseInfo,
final DataObjFieldFormatMgr dataObjFieldFormatMgrCache,
final UIFieldFormatterMgr uiFieldFormatterMgrCache)
throws HeadlessException
{
super(frame, getResourceString(titleKey), true, OK_BTN | HELP_BTN, null);
this.baseInfo = baseInfo;
this.dataObjFieldFormatMgrCache = dataObjFieldFormatMgrCache;
this.uiFieldFormatterMgrCache = uiFieldFormatterMgrCache;
this.helpContext = helpContext;
okLabel = getResourceString("CLOSE");
}
/* (non-Javadoc)
* @see edu.ku.brc.ui.CustomDialog#createUI()
*/
@Override
public void createUI()
{
super.createUI();
CellConstraints cc = new CellConstraints();
// table info
PanelBuilder tblInfoPB = new PanelBuilder(new FormLayout("p,p:g", "p")/*, new FormDebugPanel()*/);
JLabel tableTitleLbl = createI18NFormLabel("FmtListEditorBase." + (baseInfo instanceof DBTableInfo ? "TABLE" : "FIELD"));
JLabel tableTitleValueLbl = createLabel(baseInfo.getTitle());
tableTitleValueLbl.setBackground(Color.WHITE);
tableTitleValueLbl.setOpaque(true);
tblInfoPB.add(tableTitleLbl, cc.xy(1, 1));
tblInfoPB.add(tableTitleValueLbl, cc.xy(2, 1));
// add available data object formatters
createList();
ActionListener addAL = new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
addItem();
}
};
ActionListener delAL = new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
deleteSelectedItem();
}
};
ActionListener edtAL = new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
editItem(list.getSelectedValue(), false);
}
};
ActionListener defAL = new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
setDefaultItem();
}
};
String[] toolTipKeys = getDEDAToolTipKeys();
// delete button
dedaPanel = new DefEditDeleteAddPanel(defAL, edtAL, delAL, addAL,
toolTipKeys[0], toolTipKeys[1], toolTipKeys[2], toolTipKeys[3]);
dedaPanel.getAddBtn().setEnabled(true);
PanelBuilder pb = new PanelBuilder(new FormLayout("f:max(250px;p):g", "p,6px,f:max(250px;p):g,2px,p"));
// lay out components on main panel
int y = 1; // leave first row blank
pb.add(tblInfoPB.getPanel(), cc.xy(1, y)); y += 2;
pb.add(UIHelper.createScrollPane(list), cc.xy(1,y)); y += 2;
pb.add(dedaPanel, cc.xy(1,y)); y += 2;
pb.setDefaultDialogBorder();
contentPanel = pb.getPanel();
mainPanel.add(contentPanel, BorderLayout.CENTER);
updateUIEnabled();
pack();
}
/**
* @return
*/
protected void createList()
{
listModel = createListDataModel();
list = new JList(listModel);
list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
ListCellRenderer cellRenderer = getListCellRenderer();
if (cellRenderer != null)
{
list.setCellRenderer(cellRenderer);
}
list.addListSelectionListener(new ListSelectionListener()
{
public void valueChanged(ListSelectionEvent e)
{
if (!e.getValueIsAdjusting())
{
updateUIEnabled();
}
}
});
list.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e)
{
super.mouseClicked(e);
if (e.getClickCount() == 2)
{
editItem(list.getSelectedValue(), false);
}
}
});
}
protected ListCellRenderer getListCellRenderer()
{
return null;
}
/**
* @return
*/
protected abstract String[] getDEDAToolTipKeys();
/**
* @return
*/
protected abstract DefaultListModel createListDataModel();
/**
*
*/
protected abstract void deleteSelectedItem();
/**
*
*/
protected abstract void editItem(final Object dataObj, final boolean isNew);
/**
*
*/
protected abstract void setDefaultItem();
/**
*
*/
protected abstract void addItem();
/**
*
*/
protected void updateUIEnabled()
{
Object item = list.getSelectedValue();
dedaPanel.getDelBtn().setEnabled(item != null);
dedaPanel.getDefBtn().setEnabled(item != null);
dedaPanel.getEditBtn().setEnabled(item != null);
}
/**
* @return the hasChanged
*/
public boolean hasChanged()
{
return hasChanged;
}
/**
* @param hasChanged the hasChanged to set
*/
public void setHasChanged(boolean hasChanged)
{
if (this.hasChanged != hasChanged)
{
setWindowModified(hasChanged);
}
this.hasChanged = hasChanged;
updateUIEnabled();
}
}
| 8,472 | 0.587044 | 0.580094 | 284 | 28.894365 | 25.61874 | 140 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.566901 | false | false | 1 |
5048c110064d071bc3f5f408a165fbd6c820068d | 18,451,179,556,058 | a188b18fd71c546d78d0c2010a69105987a1f5c8 | /Five in a Row/gui/Statelabel.java | 661f3e2b91415c8b016109b163badeb128af688c | [] | no_license | anorakj/OOP-Project | https://github.com/anorakj/OOP-Project | 53e5faca0728eb4109169b24e0110919a945dbf6 | 0d54d1e6bf028d2ef5880ee5f4931a6df01db31c | refs/heads/master | 2017-12-02T12:51:43.101000 | 2017-03-18T02:05:56 | 2017-03-18T02:05:56 | 85,368,070 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package gui;
import javax.swing.*;
import model.Game;
import model.GameListener;
import model.Player;
import model.Board.State;
public class Statelabel extends JLabel implements GameListener {
/** construct the label that shows the state of game. */
public Statelabel() {
super("PlayerX turn",JLabel.CENTER);
}
/** change the content of label as game changed */
@Override
public void gameChanged(Game g) {
if (g.nextTurn()==Player.X) {
this.setText("PlayerX's turn");
}
if (g.nextTurn()==Player.O) {
this.setText("PlayerO's turn");
}
if (g.getBoard().getState()==State.DRAW) {
this.setText("DRAW");
}
if (g.getBoard().getState()==State.HAS_WINNER && g.getBoard().getWinner().winner==Player.X) {
this.setText("PlayerX win!");
}
if (g.getBoard().getState()==State.HAS_WINNER && g.getBoard().getWinner().winner==Player.O) {
this.setText("PlayerO win!");
}
}
}
| UTF-8 | Java | 920 | java | Statelabel.java | Java | [] | null | [] | package gui;
import javax.swing.*;
import model.Game;
import model.GameListener;
import model.Player;
import model.Board.State;
public class Statelabel extends JLabel implements GameListener {
/** construct the label that shows the state of game. */
public Statelabel() {
super("PlayerX turn",JLabel.CENTER);
}
/** change the content of label as game changed */
@Override
public void gameChanged(Game g) {
if (g.nextTurn()==Player.X) {
this.setText("PlayerX's turn");
}
if (g.nextTurn()==Player.O) {
this.setText("PlayerO's turn");
}
if (g.getBoard().getState()==State.DRAW) {
this.setText("DRAW");
}
if (g.getBoard().getState()==State.HAS_WINNER && g.getBoard().getWinner().winner==Player.X) {
this.setText("PlayerX win!");
}
if (g.getBoard().getState()==State.HAS_WINNER && g.getBoard().getWinner().winner==Player.O) {
this.setText("PlayerO win!");
}
}
}
| 920 | 0.659783 | 0.659783 | 39 | 22.589743 | 24.16367 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.538462 | false | false | 1 |
c76162cb26ad62880fcc0f4ca374d7e657b26713 | 18,485,539,292,505 | 0d809e2e267ecc33fcf94172327c2000edab6066 | /src/week1/standard/K.java | 42053db615b9483bbe2749a12be9f3693ee7de73 | [] | no_license | mohamedhalim1998/Assuit-Sheet-pahse-I | https://github.com/mohamedhalim1998/Assuit-Sheet-pahse-I | 28c2579902075770e2d7563465827490c5f8e5e6 | cf8759660c095bd215cdd410d2e0347e8b63fb77 | refs/heads/main | 2023-02-22T23:12:09.539000 | 2021-01-27T16:52:05 | 2021-01-27T16:52:05 | 327,581,695 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package week1.standard;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class K {
public static void main(String[] args) {
FastScanner scanner = new FastScanner();
int n = scanner.nextInt();
Friend[] friends = new Friend[n];
for (int i = 0; i < n; i++) {
friends[i] = new Friend(scanner.next(), scanner.nextInt());
}
Arrays.sort(friends);
for(Friend f : friends){
System.out.println(f);
}
}
static class Friend implements Comparable<Friend> {
String name;
int salary;
public Friend(String name, int salary) {
this.name = name;
this.salary = salary;
}
@Override
public int compareTo(Friend friend) {
if (salary != friend.salary) {
return Integer.compare(friend.salary, salary);
} else {
return name.compareTo(friend.name);
}
}
@Override
public String toString() {
return name + " " + salary;
}
}
static class FastScanner {
BufferedReader br;
StringTokenizer st;
public FastScanner() {
br = new BufferedReader(new
InputStreamReader(System.in));
}
String next() {
while (st == null || !st.hasMoreElements()) {
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
long nextLong() {
return Long.parseLong(next());
}
double nextDouble() {
return Double.parseDouble(next());
}
String nextLine() {
String str = "";
try {
str = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
int[] nextArray(int n) {
int[] arr = new int[n];
for (int i = 0; i < n; i++) {
arr[i] = nextInt();
}
return arr;
}
}
} | UTF-8 | Java | 2,435 | java | K.java | Java | [] | null | [] | package week1.standard;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class K {
public static void main(String[] args) {
FastScanner scanner = new FastScanner();
int n = scanner.nextInt();
Friend[] friends = new Friend[n];
for (int i = 0; i < n; i++) {
friends[i] = new Friend(scanner.next(), scanner.nextInt());
}
Arrays.sort(friends);
for(Friend f : friends){
System.out.println(f);
}
}
static class Friend implements Comparable<Friend> {
String name;
int salary;
public Friend(String name, int salary) {
this.name = name;
this.salary = salary;
}
@Override
public int compareTo(Friend friend) {
if (salary != friend.salary) {
return Integer.compare(friend.salary, salary);
} else {
return name.compareTo(friend.name);
}
}
@Override
public String toString() {
return name + " " + salary;
}
}
static class FastScanner {
BufferedReader br;
StringTokenizer st;
public FastScanner() {
br = new BufferedReader(new
InputStreamReader(System.in));
}
String next() {
while (st == null || !st.hasMoreElements()) {
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
long nextLong() {
return Long.parseLong(next());
}
double nextDouble() {
return Double.parseDouble(next());
}
String nextLine() {
String str = "";
try {
str = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
int[] nextArray(int n) {
int[] arr = new int[n];
for (int i = 0; i < n; i++) {
arr[i] = nextInt();
}
return arr;
}
}
} | 2,435 | 0.473922 | 0.47269 | 99 | 23.60606 | 17.320402 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.444444 | false | false | 1 |
c5a18e4279b2a5763bbb7adfcc4fc9f9fbf1e154 | 32,435,593,048,287 | ead5d86ce19759f3c559a3ac76740164522ebbab | /domenetjenester/fpsak/src/main/java/no/nav/foreldrepenger/fpsak/dto/beregning/beregningsresultat/BeregningsresultatPeriodeDto.java | 2479e1d45ad10ee9379246c7dd18d4f1d6751af9 | [
"MIT"
] | permissive | sturleh/fp-formidling | https://github.com/sturleh/fp-formidling | da2ec9057140c0eb8e62ce9579baaf14c0a5a793 | df24a60bc26369211647d53607e8dbfc4a6d0137 | refs/heads/master | 2020-08-13T14:42:09.564000 | 2019-10-02T15:26:27 | 2019-10-02T15:26:27 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package no.nav.foreldrepenger.fpsak.dto.beregning.beregningsresultat;
import java.time.LocalDate;
import java.util.Arrays;
public class BeregningsresultatPeriodeDto {
private LocalDate fom;
private LocalDate tom;
private int dagsats;
private BeregningsresultatPeriodeAndelDto[] andeler;
public LocalDate getFom() {
return fom;
}
public LocalDate getTom() {
return tom;
}
public int getDagsats() {
return dagsats;
}
public BeregningsresultatPeriodeAndelDto[] getAndeler() {
return Arrays.copyOf(andeler, andeler.length);
}
public void setFom(LocalDate fom) {
this.fom = fom;
}
public void setTom(LocalDate tom) {
this.tom = tom;
}
public void setDagsats(int dagsats) {
this.dagsats = dagsats;
}
public void setAndeler(BeregningsresultatPeriodeAndelDto[] andeler) {
this.andeler = andeler;
}
}
| UTF-8 | Java | 946 | java | BeregningsresultatPeriodeDto.java | Java | [] | null | [] | package no.nav.foreldrepenger.fpsak.dto.beregning.beregningsresultat;
import java.time.LocalDate;
import java.util.Arrays;
public class BeregningsresultatPeriodeDto {
private LocalDate fom;
private LocalDate tom;
private int dagsats;
private BeregningsresultatPeriodeAndelDto[] andeler;
public LocalDate getFom() {
return fom;
}
public LocalDate getTom() {
return tom;
}
public int getDagsats() {
return dagsats;
}
public BeregningsresultatPeriodeAndelDto[] getAndeler() {
return Arrays.copyOf(andeler, andeler.length);
}
public void setFom(LocalDate fom) {
this.fom = fom;
}
public void setTom(LocalDate tom) {
this.tom = tom;
}
public void setDagsats(int dagsats) {
this.dagsats = dagsats;
}
public void setAndeler(BeregningsresultatPeriodeAndelDto[] andeler) {
this.andeler = andeler;
}
}
| 946 | 0.661734 | 0.661734 | 43 | 21 | 20.402918 | 73 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.372093 | false | false | 1 |
d180daf427738dd4d664ba879703f5e108c5ec20 | 32,255,204,462,703 | 583fce9cc6ee6b55b92ba99f3037a71f26967342 | /test-java/src/main/java/br/com/blz/testjava/endpoint/ProdutoEndpoint.java | 7b8c14eb132dbc872000f3e6619103f6f37316b2 | [] | no_license | cleberfatec/test-java | https://github.com/cleberfatec/test-java | c5d78039f161b23769821485ebc00a72bd71cff3 | db6e2f80e1ef580f652e8df03db409f0925da314 | refs/heads/master | 2020-09-08T20:48:37.529000 | 2019-11-13T20:23:42 | 2019-11-13T20:23:42 | 221,237,604 | 0 | 0 | null | true | 2019-11-13T20:23:43 | 2019-11-12T14:30:03 | 2019-11-12T14:30:05 | 2019-11-13T20:23:43 | 21,103 | 0 | 0 | 0 | null | false | false | package br.com.blz.testjava.endpoint;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import br.com.blz.testjava.exception.ProdutoExistenteException;
import br.com.blz.testjava.exception.ProdutoInexistenteException;
import br.com.blz.testjava.model.Produto;
import br.com.blz.testjava.service.ProdutoService;
@RestController
@RequestMapping(value = "/produto")
public class ProdutoEndpoint {
@Autowired
private ProdutoService service;
@PostMapping(value = "/", consumes = APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.CREATED)
public void cadastrarProduto(@RequestBody Produto produto) {
final Produto prod = service.buscarProdutoPorSku(produto.getSku());
if (prod != null) {
throw new ProdutoExistenteException();
}
service.cadastrarProduto(produto);
}
@GetMapping(value = "/{sku}", produces = APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.OK)
public Produto buscarProdutoPorSku(@PathVariable(value = "sku") Integer sku) {
Produto prod = service.buscarProdutoPorSku(sku);
if (prod == null) {
throw new ProdutoInexistenteException();
}
return prod;
}
@DeleteMapping(value = "/{sku}")
@ResponseStatus(HttpStatus.CREATED)
public void apagarProduto(@PathVariable(value = "sku") Integer sku) {
service.apagarProduto(sku);
}
@PutMapping(value = "/", consumes = APPLICATION_JSON_VALUE)
public void atualizarProduto(@RequestBody Produto produto) {
service.atualizarProduto(produto);
}
}
| UTF-8 | Java | 2,203 | java | ProdutoEndpoint.java | Java | [] | null | [] | package br.com.blz.testjava.endpoint;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import br.com.blz.testjava.exception.ProdutoExistenteException;
import br.com.blz.testjava.exception.ProdutoInexistenteException;
import br.com.blz.testjava.model.Produto;
import br.com.blz.testjava.service.ProdutoService;
@RestController
@RequestMapping(value = "/produto")
public class ProdutoEndpoint {
@Autowired
private ProdutoService service;
@PostMapping(value = "/", consumes = APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.CREATED)
public void cadastrarProduto(@RequestBody Produto produto) {
final Produto prod = service.buscarProdutoPorSku(produto.getSku());
if (prod != null) {
throw new ProdutoExistenteException();
}
service.cadastrarProduto(produto);
}
@GetMapping(value = "/{sku}", produces = APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.OK)
public Produto buscarProdutoPorSku(@PathVariable(value = "sku") Integer sku) {
Produto prod = service.buscarProdutoPorSku(sku);
if (prod == null) {
throw new ProdutoInexistenteException();
}
return prod;
}
@DeleteMapping(value = "/{sku}")
@ResponseStatus(HttpStatus.CREATED)
public void apagarProduto(@PathVariable(value = "sku") Integer sku) {
service.apagarProduto(sku);
}
@PutMapping(value = "/", consumes = APPLICATION_JSON_VALUE)
public void atualizarProduto(@RequestBody Produto produto) {
service.atualizarProduto(produto);
}
}
| 2,203 | 0.768951 | 0.768951 | 64 | 32.421875 | 26.15029 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.28125 | false | false | 1 |
b9665dfc5b59ae07697001a3c2391f6f0b645b76 | 38,817,914,447,076 | 386c579cc68986ffd25ba4973d74b172ae165b2d | /TrainingProgramProject/src/com/mastek/training/Vehicle/Condition.java | a3cb973426b526ddcc1bbaaddb33a04021198a02 | [] | no_license | raff786/GraduateProgramJan2020 | https://github.com/raff786/GraduateProgramJan2020 | 05bdbf68a887deae39c5710c6f04c4155eddc49c | 27c5555f1dfe68df823554bec8553c6abfcda068 | refs/heads/master | 2020-12-28T07:15:50.970000 | 2020-03-09T13:12:50 | 2020-03-09T13:12:50 | 238,225,334 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.mastek.training.Vehicle;
public enum Condition {New,used,damaged
}
| UTF-8 | Java | 86 | java | Condition.java | Java | [] | null | [] | package com.mastek.training.Vehicle;
public enum Condition {New,used,damaged
}
| 86 | 0.744186 | 0.744186 | 5 | 15.2 | 18.236227 | 39 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.6 | false | false | 1 |
57150ca43e3c1d01e603b04ca238c686e60abef4 | 33,191,507,331,372 | 642a5035b3a90c6b83ad2cca77942509f152448e | /Visible.java | f0d61e5f7ca674d92ad48b45c3548fa55656bdfb | [] | no_license | ledfox/RogueLed | https://github.com/ledfox/RogueLed | 0fa06b12faa7e1450dbc94451414522c9a705aa5 | ac3a51a7e26ad54df7138816b513ae7165f27f3d | refs/heads/master | 2021-01-01T16:31:20.506000 | 2018-04-19T23:52:07 | 2018-04-19T23:52:07 | 97,847,827 | 1 | 0 | null | false | 2018-04-01T17:40:06 | 2017-07-20T14:54:38 | 2018-04-01T17:21:42 | 2018-04-01T17:40:06 | 54 | 1 | 0 | 1 | Java | false | null | package primary;
import net.slashie.libjcsi.CSIColor;
public class Visible {
CSIColor color;
CSIColor defaultColor;
CSIColor startColor = CSIColor.BLACK;
int xPos = 0;
int yPos = 0;
//VISION
//Decides whether to draw the object or not
public void checkVisibility(Player PC){
if ((((xPos - PC.xPos) <= PC.vision) && ((yPos - PC.yPos) <= PC.vision))
// )
&& ((PC.xPos - xPos) <= PC.vision) && ((PC.yPos - yPos) <= PC.vision))
{
color = defaultColor;
} else color = CSIColor.BLACK;
}
}
| UTF-8 | Java | 567 | java | Visible.java | Java | [] | null | [] | package primary;
import net.slashie.libjcsi.CSIColor;
public class Visible {
CSIColor color;
CSIColor defaultColor;
CSIColor startColor = CSIColor.BLACK;
int xPos = 0;
int yPos = 0;
//VISION
//Decides whether to draw the object or not
public void checkVisibility(Player PC){
if ((((xPos - PC.xPos) <= PC.vision) && ((yPos - PC.yPos) <= PC.vision))
// )
&& ((PC.xPos - xPos) <= PC.vision) && ((PC.yPos - yPos) <= PC.vision))
{
color = defaultColor;
} else color = CSIColor.BLACK;
}
}
| 567 | 0.580247 | 0.57672 | 32 | 15.71875 | 20.09856 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.53125 | false | false | 1 |
e9e068e53be90ba167d0681dee3c6ff3c01f0b31 | 27,891,517,686,167 | d8baaf7d73650ef5fa7a263fbbcf1c08a6875882 | /src/main/java/com/lagopusempire/MagicCompass/commands/ResetCommand.java | 742521e95c9b6b0ebb78688d9ffdc2620672d51d | [
"Zlib"
] | permissive | MrZoraman/MagicCompass | https://github.com/MrZoraman/MagicCompass | 4f38dc10f9817241d5662fb55cf5d8796d65adb5 | cc0742c70c1ddb73bc1bb54f0723f576da94e2ca | refs/heads/master | 2021-01-19T01:59:46.342000 | 2016-07-03T06:30:30 | 2016-07-03T06:31:22 | 20,386,933 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.lagopusempire.MagicCompass.commands;
import com.lagopusempire.MagicCompass.Permissions;
import com.lagopusempire.MagicCompass.management.PointManager;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class ResetCommand extends CommandBase {
public ResetCommand(PointManager pointManager) {
super(pointManager);
}
@Override
public boolean execute(CommandSender sender, Player player, String cmdName, String[] preArgs, String[] args) {
if (player == null) {
sender.sendMessage(ChatColor.RED + "You must be a player to save a compass point!");
return true;
}
if (Permissions.CAN_USE.verify(player) == false) {
player.sendMessage(ChatColor.RED + "You're not allowed to change the location your compass points to!");
return true;
}
player.setCompassTarget(player.getWorld().getSpawnLocation());
player.sendMessage(ChatColor.GREEN + "Your compass not points to your world's spawn location.");
return true;
}
}
| UTF-8 | Java | 1,168 | java | ResetCommand.java | Java | [] | null | [] | package com.lagopusempire.MagicCompass.commands;
import com.lagopusempire.MagicCompass.Permissions;
import com.lagopusempire.MagicCompass.management.PointManager;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class ResetCommand extends CommandBase {
public ResetCommand(PointManager pointManager) {
super(pointManager);
}
@Override
public boolean execute(CommandSender sender, Player player, String cmdName, String[] preArgs, String[] args) {
if (player == null) {
sender.sendMessage(ChatColor.RED + "You must be a player to save a compass point!");
return true;
}
if (Permissions.CAN_USE.verify(player) == false) {
player.sendMessage(ChatColor.RED + "You're not allowed to change the location your compass points to!");
return true;
}
player.setCompassTarget(player.getWorld().getSpawnLocation());
player.sendMessage(ChatColor.GREEN + "Your compass not points to your world's spawn location.");
return true;
}
}
| 1,168 | 0.66524 | 0.66524 | 32 | 34.5 | 34.155891 | 116 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5625 | false | false | 1 |
00d6981798606b98ed1a91b82872186c699b58c2 | 2,044,404,469,607 | 889f483f68716e8a4351365cfa56119c025a3c7b | /src/com/top/cloud/service/TopCloudUserServiceImpl.java | 37fbbe88f407de8e3ec44f4762ac118346e740d9 | [] | no_license | lane-liu/TopCloud | https://github.com/lane-liu/TopCloud | 4a62300f7d1669e3d35ceabc115e36f66bc18abd | 748f0999632e985b0974a2c7eb5367995d5eb036 | refs/heads/master | 2021-10-01T00:25:31.021000 | 2018-11-26T08:18:17 | 2018-11-26T08:18:17 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.top.cloud.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.top.cloud.bean.TopCloudUser;
import com.top.cloud.mapper.TopCloudUserMapper;
import com.top.cloud.utils.EmaiCheckCode;
import com.top.cloud.utils.MD5Util;
import com.top.cloud.utils.SendEmailUtil;
@Service
public class TopCloudUserServiceImpl implements TopCloudUserService{
@Autowired
private TopCloudUserMapper topCloudUserMapper;
@Override
public TopCloudUser login(String username) {
TopCloudUser user = topCloudUserMapper.login(username);
return user;
}
@Override
public int checkedEmail(String email) {
TopCloudUser user=topCloudUserMapper.checkedEmail(email);
if(user==null){
return 1;
}
return 0;
}
@Override
public int checkedName(String username) {
TopCloudUser user = topCloudUserMapper.login(username);
if(user==null){
return 1;
}
return 0;
}
@Override
public int regist(String username, String email, String password) {
try {
password=MD5Util.encode(password);
} catch (Exception e) {
e.printStackTrace();
}
TopCloudUser user=new TopCloudUser();
user.setUsername(username);
user.setEmail(email);
user.setPassword(password);
int result=topCloudUserMapper.regist(user);
return result;
}
@Override
public int selectId(String username) {
TopCloudUser topCloudUser = topCloudUserMapper.selectId(username);
return topCloudUser.getId();
}
// ไฟฎๆนๅฏ็
public Integer ChangePassword(int id, String newpassword, String oldpassword) {
/*String passwordString = null;
String password = null;*/
System.out.println("ๆต็จๅฐ่พพTopCloudUserServiceไธญ็ChangePasswordๆนๆณไธญ");
System.out.println("======================>่ทๅๅฐ็็จๆทidไธบ"+id);
System.out.println("======================>่ทๅๅฐ็็จๆทnewpasswordไธบ"+newpassword);
System.out.println("======================>่ทๅๅฐ็็จๆทoldpasswordไธบ"+oldpassword);
try {
//็จๆทๅๆฅ็ๅฏ็
oldpassword = MD5Util.encode(oldpassword);
System.out.println("===============>MD5ๅ ๅฏไผ ้่ฟๆฅ็็จๆท็่ๅฏ็ "+oldpassword+"***********");
newpassword = MD5Util.encode(newpassword);
System.out.println("===============>MD5ๅ ๅฏไผ ้่ฟๆฅ็็จๆท็ๆฐๅฏ็ "+newpassword+"***********");
} catch (Exception e) {
e.printStackTrace();
}
TopCloudUser user = new TopCloudUser();
user.setId(id);
//user.setPassword(passwordString);
TopCloudUser CloudUser = topCloudUserMapper.SelectByPassword(user);
String trueoldpassword=CloudUser.getPassword();
System.out.println("===============>่ฐ็จselect่ทๅพ็็จๆท็ๅฎ็่ๅฏ็ "+trueoldpassword+"***********");
//String selectByPassword = selectByPassword2.getPassword();
//System.out.println("selectByPassword-------------------->"+selectByPassword);
//int changePassword = 0;
if (oldpassword.equals(trueoldpassword)) {
try {
//newpassword = MD5Util.encode(newpassword);
System.out.println("===============>MD5ๅ ๅฏไผ ้่ฟๆฅ็็จๆท็ๆฐๅฏ็ "+newpassword+"***********");
} catch (Exception e) {
e.printStackTrace();
}
System.out.println(newpassword+"-------------------->MD5Util.encode(newpassword)");
TopCloudUser changeUserPassWord = new TopCloudUser();
changeUserPassWord.setId(id);
changeUserPassWord.setPassword(newpassword);
int isok = topCloudUserMapper.ChangeById(changeUserPassWord);
System.out.println("Well done");
return isok;
} else {
System.out.println("rubbish");
return 0;
}
}
//http://localhost:8080/TopCloud/ChangePassword.do?id=2&newpassword=888888q&oldpassword=123123q
//ๆ นๆฎid่ทๅTopCloudUserๅฏน่ฑก
public TopCloudUser getTopCloudUser(int id) {
TopCloudUser topCloudUser = topCloudUserMapper.getTopCloudUser(id);
return topCloudUser;
}
public int updateUserInfor(int id, String sex, String address, String tel) {
TopCloudUser infor=new TopCloudUser();
infor.setId(id);
infor.setSex(sex);
infor.setAddress(address);
infor.setTel(tel);
int result=topCloudUserMapper.updateUserInfor(infor);
System.out.println("================>Serviceไธญ็result"+result);
return result;
}
@Override
public int CheckedOldPassWord(String oldpassword, int id) {
TopCloudUser user=new TopCloudUser();
user.setId(id);
TopCloudUser selectByOldPassword = topCloudUserMapper.SelectByPassword(user);
try {
oldpassword = MD5Util.encode(oldpassword);
} catch (Exception e) {
e.printStackTrace();
}
System.out.println(selectByOldPassword);
boolean equals = selectByOldPassword.getPassword().equals(oldpassword);
if(equals){
return 1;
}
return 0;
}
//้ฎ็ฎฑ้ช่ฏ
public String findApplicantUser(int id) {
System.out.println("====================>findApplicantUser็idไธบ"+id);
TopCloudUser topCloudUser = topCloudUserMapper.getTopCloudUser(id);
System.out.println("====================>findApplicantUser็่ทๅ็จๆทไธบ"+topCloudUser);
String email = topCloudUser.getEmail();
System.out.println("====================>findApplicantUser็่ทๅ็จๆทgetEmailไธบ"+email);
String emaiCheckCode = EmaiCheckCode.getEmaiCheckCode();
System.out.println("====================>findApplicantUser็่ทๅemaiCheckCodeไธบ"+emaiCheckCode);
SendEmailUtil.send(email, emaiCheckCode);
System.out.println("===================>findApplicantUser็ปๆ");
return emaiCheckCode;
}
public int insertMailboxCode(String checkCode, int id) {
TopCloudUser topCloudUser = topCloudUserMapper.getTopCloudUser(id);
topCloudUser.setIs_ckeckedEmail("ture");
int i = topCloudUserMapper.insertMailboxCode(topCloudUser);
return i;
}
}
| UTF-8 | Java | 5,709 | java | TopCloudUserServiceImpl.java | Java | [
{
"context": "dUser user=new TopCloudUser();\n\t\tuser.setUsername(username);\n\t\tuser.setEmail(email);\n\t\tuser.setPassword(pass",
"end": 1198,
"score": 0.9917420148849487,
"start": 1190,
"tag": "USERNAME",
"value": "username"
},
{
"context": "oudUser();\n\t\tuser.setId(id);\n\t\t//user.setPassword(passwordString);\n\t TopCloudUser CloudUser = topCloudUse",
"end": 2352,
"score": 0.6758841872215271,
"start": 2344,
"tag": "PASSWORD",
"value": "password"
},
{
"context": ");\n\t\t//String selectByPassword = selectByPassword2.getPassword();\n\t\t\n\t\t//System.out.println(\"selectBy",
"end": 2628,
"score": 0.7359105348587036,
"start": 2628,
"tag": "PASSWORD",
"value": ""
},
{
"context": "Word.setId(id);\n\t\t\tchangeUserPassWord.setPassword(newpassword);\n\t\t\tint isok = topCloudUserMapper.ChangeById(cha",
"end": 3229,
"score": 0.9730188846588135,
"start": 3218,
"tag": "PASSWORD",
"value": "newpassword"
},
{
"context": ":8080/TopCloud/ChangePassword.do?id=2&newpassword=888888q&oldpassword=123123q\n\t//ๆ นๆฎid่ทๅTopCloudUserๅฏน่ฑก\n\tpubl",
"end": 3490,
"score": 0.9993301630020142,
"start": 3483,
"tag": "PASSWORD",
"value": "888888q"
},
{
"context": "ePassword.do?id=2&newpassword=888888q&oldpassword=123123q\n\t//ๆ นๆฎid่ทๅTopCloudUserๅฏน่ฑก\n\tpublic TopCloudUser getT",
"end": 3510,
"score": 0.9993311762809753,
"start": 3503,
"tag": "PASSWORD",
"value": "123123q"
}
] | null | [] | package com.top.cloud.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.top.cloud.bean.TopCloudUser;
import com.top.cloud.mapper.TopCloudUserMapper;
import com.top.cloud.utils.EmaiCheckCode;
import com.top.cloud.utils.MD5Util;
import com.top.cloud.utils.SendEmailUtil;
@Service
public class TopCloudUserServiceImpl implements TopCloudUserService{
@Autowired
private TopCloudUserMapper topCloudUserMapper;
@Override
public TopCloudUser login(String username) {
TopCloudUser user = topCloudUserMapper.login(username);
return user;
}
@Override
public int checkedEmail(String email) {
TopCloudUser user=topCloudUserMapper.checkedEmail(email);
if(user==null){
return 1;
}
return 0;
}
@Override
public int checkedName(String username) {
TopCloudUser user = topCloudUserMapper.login(username);
if(user==null){
return 1;
}
return 0;
}
@Override
public int regist(String username, String email, String password) {
try {
password=MD5Util.encode(password);
} catch (Exception e) {
e.printStackTrace();
}
TopCloudUser user=new TopCloudUser();
user.setUsername(username);
user.setEmail(email);
user.setPassword(password);
int result=topCloudUserMapper.regist(user);
return result;
}
@Override
public int selectId(String username) {
TopCloudUser topCloudUser = topCloudUserMapper.selectId(username);
return topCloudUser.getId();
}
// ไฟฎๆนๅฏ็
public Integer ChangePassword(int id, String newpassword, String oldpassword) {
/*String passwordString = null;
String password = null;*/
System.out.println("ๆต็จๅฐ่พพTopCloudUserServiceไธญ็ChangePasswordๆนๆณไธญ");
System.out.println("======================>่ทๅๅฐ็็จๆทidไธบ"+id);
System.out.println("======================>่ทๅๅฐ็็จๆทnewpasswordไธบ"+newpassword);
System.out.println("======================>่ทๅๅฐ็็จๆทoldpasswordไธบ"+oldpassword);
try {
//็จๆทๅๆฅ็ๅฏ็
oldpassword = MD5Util.encode(oldpassword);
System.out.println("===============>MD5ๅ ๅฏไผ ้่ฟๆฅ็็จๆท็่ๅฏ็ "+oldpassword+"***********");
newpassword = MD5Util.encode(newpassword);
System.out.println("===============>MD5ๅ ๅฏไผ ้่ฟๆฅ็็จๆท็ๆฐๅฏ็ "+newpassword+"***********");
} catch (Exception e) {
e.printStackTrace();
}
TopCloudUser user = new TopCloudUser();
user.setId(id);
//user.setPassword(<PASSWORD>String);
TopCloudUser CloudUser = topCloudUserMapper.SelectByPassword(user);
String trueoldpassword=CloudUser.getPassword();
System.out.println("===============>่ฐ็จselect่ทๅพ็็จๆท็ๅฎ็่ๅฏ็ "+trueoldpassword+"***********");
//String selectByPassword = selectByPassword2.getPassword();
//System.out.println("selectByPassword-------------------->"+selectByPassword);
//int changePassword = 0;
if (oldpassword.equals(trueoldpassword)) {
try {
//newpassword = MD5Util.encode(newpassword);
System.out.println("===============>MD5ๅ ๅฏไผ ้่ฟๆฅ็็จๆท็ๆฐๅฏ็ "+newpassword+"***********");
} catch (Exception e) {
e.printStackTrace();
}
System.out.println(newpassword+"-------------------->MD5Util.encode(newpassword)");
TopCloudUser changeUserPassWord = new TopCloudUser();
changeUserPassWord.setId(id);
changeUserPassWord.setPassword(<PASSWORD>);
int isok = topCloudUserMapper.ChangeById(changeUserPassWord);
System.out.println("Well done");
return isok;
} else {
System.out.println("rubbish");
return 0;
}
}
//http://localhost:8080/TopCloud/ChangePassword.do?id=2&newpassword=<PASSWORD>&oldpassword=<PASSWORD>
//ๆ นๆฎid่ทๅTopCloudUserๅฏน่ฑก
public TopCloudUser getTopCloudUser(int id) {
TopCloudUser topCloudUser = topCloudUserMapper.getTopCloudUser(id);
return topCloudUser;
}
public int updateUserInfor(int id, String sex, String address, String tel) {
TopCloudUser infor=new TopCloudUser();
infor.setId(id);
infor.setSex(sex);
infor.setAddress(address);
infor.setTel(tel);
int result=topCloudUserMapper.updateUserInfor(infor);
System.out.println("================>Serviceไธญ็result"+result);
return result;
}
@Override
public int CheckedOldPassWord(String oldpassword, int id) {
TopCloudUser user=new TopCloudUser();
user.setId(id);
TopCloudUser selectByOldPassword = topCloudUserMapper.SelectByPassword(user);
try {
oldpassword = MD5Util.encode(oldpassword);
} catch (Exception e) {
e.printStackTrace();
}
System.out.println(selectByOldPassword);
boolean equals = selectByOldPassword.getPassword().equals(oldpassword);
if(equals){
return 1;
}
return 0;
}
//้ฎ็ฎฑ้ช่ฏ
public String findApplicantUser(int id) {
System.out.println("====================>findApplicantUser็idไธบ"+id);
TopCloudUser topCloudUser = topCloudUserMapper.getTopCloudUser(id);
System.out.println("====================>findApplicantUser็่ทๅ็จๆทไธบ"+topCloudUser);
String email = topCloudUser.getEmail();
System.out.println("====================>findApplicantUser็่ทๅ็จๆทgetEmailไธบ"+email);
String emaiCheckCode = EmaiCheckCode.getEmaiCheckCode();
System.out.println("====================>findApplicantUser็่ทๅemaiCheckCodeไธบ"+emaiCheckCode);
SendEmailUtil.send(email, emaiCheckCode);
System.out.println("===================>findApplicantUser็ปๆ");
return emaiCheckCode;
}
public int insertMailboxCode(String checkCode, int id) {
TopCloudUser topCloudUser = topCloudUserMapper.getTopCloudUser(id);
topCloudUser.setIs_ckeckedEmail("ture");
int i = topCloudUserMapper.insertMailboxCode(topCloudUser);
return i;
}
}
| 5,716 | 0.708555 | 0.70196 | 167 | 31.688623 | 26.981453 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.269461 | false | false | 1 |
a9cde776a8e7e33a3e77c834c9fa59e2e52d809a | 2,044,404,472,656 | 16c081912e6ccce4140fceca0a9f5a7051b5e731 | /app/src/main/java/com/pdkj/carschool/activity/HomeActivity.java | 560cd148b9a0ff565befa2d99b7198cb176baaec | [] | no_license | wuyue0829/CarSchool2019 | https://github.com/wuyue0829/CarSchool2019 | 0dfc2c5908c35cf44dcad2e95a63b83c716c8790 | 7e14d5ccd27e25e600299705901ed2740f410ebe | refs/heads/master | 2020-04-11T06:44:06.979000 | 2019-09-02T10:29:01 | 2019-09-02T10:29:01 | 161,589,982 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.pdkj.carschool.activity;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import com.google.gson.Gson;
import com.hss01248.dialog.StyledDialog;
import com.hss01248.dialog.interfaces.MyDialogListener;
import com.pdkj.carschool.R;
import com.pdkj.carschool.activity.base.BaseActivity;
import com.pdkj.carschool.activity.base.BaseHandler;
import com.pdkj.carschool.activity.base.MyBaseActivity;
import com.pdkj.carschool.bean.IsPayMemory;
import com.pdkj.carschool.bean.Qustion;
import com.pdkj.carschool.bean.QustionBean;
import com.pdkj.carschool.bean.TokenModel;
import com.pdkj.carschool.bean.isupdatecode;
import com.pdkj.carschool.utils.DateUtils;
import com.pdkj.carschool.utils.NetConstant;
import com.pdkj.carschool.utils.SharedPreferenceUtils;
import com.pdkj.carschool.utils.SysConfig;
import org.xutils.DbManager;
import org.xutils.common.Callback;
import org.xutils.common.util.LogUtil;
import org.xutils.ex.DbException;
import org.xutils.http.RequestParams;
import org.xutils.x;
import java.util.ArrayList;
import java.util.List;
import crossoverone.statuslib.StatusUtil;
import static org.xutils.common.util.LogUtil.e;
public class HomeActivity extends BaseActivity implements View.OnClickListener {
private ImageView im_lianxi;
private ImageView im_moni;
private ImageView im_tiku;
private RelativeLayout rl_mine;
private RelativeLayout rl_return;
@SuppressLint("HandlerLeak")
private Handler mHandler = new BaseHandler(this) {
@Override
protected void handleMessage(Context mContext, Message msg) {
StyledDialog.dismissLoading();
}
};
@Override
protected int getLayout() {
return R.layout.activity_home;
}
@Override
protected void initData(Bundle savedInstanceState) {
StatusUtil.setUseStatusBarColor(this, Color.TRANSPARENT, Color.parseColor("#33000000"));
StatusUtil.setSystemStatus(this, true, true);
im_lianxi = findViewById(R.id.im_lianxi);
im_moni = findViewById(R.id.im_moni);
im_tiku = findViewById(R.id.im_tiku);
rl_mine = findViewById(R.id.rl_mine);
rl_return = findViewById(R.id.rl_return);
}
@Override
protected void initEvent() {
im_lianxi.setOnClickListener(this);
im_moni.setOnClickListener(this);
im_tiku.setOnClickListener(this);
rl_mine.setOnClickListener(this);
rl_return.setOnClickListener(this);
if(TextUtils.isEmpty(SharedPreferenceUtils.getParams("examTypeId",mContext))||SharedPreferenceUtils.getParams("examTypeId",mContext).equals("0")){
StyledDialog.buildIosAlert("ๆ็คบ", "ๆจ่ฟๆฒกๆๅฎๅไธชไบบไฟกๆฏ๏ผ่ฏทๅ
ๅปๅฎๅไฟกๆฏ๏ผ", new MyDialogListener() {
@Override
public void onFirst() {
startActivity(InformationActivity.class);
}
@Override
public void onSecond() {
finish();
}
}).show();
}else{
/**
* ่ทๅๆฏๅฆไธบไป่ดน็จๆท
*/
if(!TextUtils.isEmpty(SharedPreferenceUtils.getParams("examTypeId",this))){
RequestParams params1 = new RequestParams(NetConstant.BASE_URL + "/app/usermember/isPayment");
TokenModel tokenMode2 = new TokenModel(SharedPreferenceUtils.getIntValue(mContext,"userId"),SharedPreferenceUtils.getParams("token",mContext));
params1.addBodyParameter("model",new Gson().toJson(tokenMode2));
params1.addBodyParameter("examTypeId", SharedPreferenceUtils.getParams("examTypeId",mContext));
x.http().post(params1, new Callback.CommonCallback<String>() {
@Override
public void onSuccess(String result) {
IsPayMemory isPayMemory = new Gson().fromJson(result, IsPayMemory.class);
if(isPayMemory.isData()){
SysConfig.getConfig(mContext).setUserVip("99", SharedPreferenceUtils.getParams("examTypeId",mContext));
}
SharedPreferenceUtils.saveBooleanValue(mContext,"isVip",isPayMemory.isData());
}
@Override
public void onError(Throwable ex, boolean isOnCallback) {
}
@Override
public void onCancelled(CancelledException cex) {
}
@Override
public void onFinished() {
}
});
StyledDialog.buildLoading("ๆญฃๅจๆฃๆฅ้ขๅบๆฏๅฆๆๆฐ็ๆฌ").show();
/**
* ่ทๅ่ฏ้ขไฟๅญๅฐๆฐๆฎๅบ
*/
RequestParams params = new RequestParams(NetConstant.BASE_URL + "/app/examquestion/lastQuestion");
TokenModel tokenModel = new TokenModel(SharedPreferenceUtils.getIntValue(mContext,"userId"),SharedPreferenceUtils.getParams("token",mContext));
params.addBodyParameter("model",new Gson().toJson(tokenModel));
params.setConnectTimeout(100000);
params.setReadTimeout(100000);
params.addBodyParameter("examTypeId", SharedPreferenceUtils.getParams("examTypeId",mContext));
params.addBodyParameter("lastDate", SysConfig.getConfig(mContext).getLastTime(SharedPreferenceUtils.getParams("examTypeId",mContext)));
x.http().post(params, new Callback.CommonCallback<String>() {
@Override
public void onSuccess(String result) {
QustionBean qustionBean = new Gson().fromJson(result,QustionBean.class);
if(qustionBean.getCode() == 200){
if(null != qustionBean.getData() && qustionBean.getData().size()>0){
StyledDialog.buildLoading("่ฏ้ขๅบๆญฃๅจๆดๆฐไธญ๏ผ่ฏทไธ่ฆ้ๅบๆ่
ๅๆขๅฐๅๅฐ").show();
new Thread(() -> {
DbManager db = x.getDb(PDApplication.getDaoConfig());
List<Qustion> qustionList = new ArrayList<>();
for(Qustion qustion:qustionBean.getData()){
Qustion qustion1 = new Qustion();
qustion1.setAnswer(qustion.getAnswer());
qustion1.setCategoryId(qustion.getCategoryId());
qustion1.setExamTypeId(qustion.getExamTypeId());
qustion1.setId(qustion.getId());
qustion1.setScene(qustion.isScene());
qustion1.setQuestion(qustion.getQuestion());
qustion1.setQuestionType(qustion.getQuestionType());
qustion1.setRemark(qustion.getRemark());
qustion1.setLastDate(qustion.getLastDate());
if(!TextUtils.isEmpty(qustion.getUrl())){
qustion1.setUrl(NetConstant.BASE_URL+qustion.getUrl());
}else{
qustion1.setUrl("");
}
qustion1.setCategoryType(qustion.getCategoryType());
if(qustion.getOptions().size() == 1){
qustion1.setItem1(qustion.getOptions().get(0).getOptionName());
qustion1.setItem2("");
qustion1.setItem3("");
qustion1.setItem4("");
}
if(qustion.getOptions().size() == 2){
qustion1.setItem1(qustion.getOptions().get(0).getOptionName());
qustion1.setItem2(qustion.getOptions().get(1).getOptionName());
qustion1.setItem3("");
qustion1.setItem4("");
}
if(qustion.getOptions().size() == 3){
qustion1.setItem1(qustion.getOptions().get(0).getOptionName());
qustion1.setItem2(qustion.getOptions().get(1).getOptionName());
qustion1.setItem3(qustion.getOptions().get(2).getOptionName());
qustion1.setItem4("");
}
if(qustion.getOptions().size() == 4){
qustion1.setItem1(qustion.getOptions().get(0).getOptionName());
qustion1.setItem2(qustion.getOptions().get(1).getOptionName());
qustion1.setItem3(qustion.getOptions().get(2).getOptionName());
qustion1.setItem4(qustion.getOptions().get(3).getOptionName());
}
qustionList.add(qustion1);
}
try {
for(Qustion qustion :qustionList){
if(null != db.findById(Qustion.class,qustion.getId())){
db.update(qustion);
}else{
db.save(qustion);
}
}
} catch (DbException e) {
e.printStackTrace();
}
if(null != qustionList && qustionList.size()>0){
SysConfig.getConfig(mContext).setLastTime(DateUtils.getFormatDate("yyyy-MM-dd HH:mm:ss",qustionList.get(0).getLastDate()),SharedPreferenceUtils.getParams("examTypeId",mContext));
}
mHandler.sendEmptyMessage(2000);
}).start();
}
}
}
@Override
public void onError(Throwable ex, boolean isOnCallback) {
e(ex.getMessage());
}
@Override
public void onCancelled(CancelledException cex) {
e(cex.getMessage());
}
@Override
public void onFinished() {
StyledDialog.dismissLoading();
}
});
}
}
}
@Override
public void onClick(View v) {
switch (v.getId()){
case R.id.im_lianxi:
Bundle bundle = new Bundle();
bundle.putInt("questionType",2);
bundle.putString("examTypeId",SharedPreferenceUtils.getStringValue(this,"examTypeId"));
bundle.putInt("type",1);
bundle.putInt("clickType",1);
startActivity(bundle, ChooseActivity.class);
break;
case R.id.im_moni:
Bundle bundle1 = new Bundle();
bundle1.putString("examTypeId",SharedPreferenceUtils.getStringValue(this,"examTypeId"));
bundle1.putInt("type",1);
bundle1.putInt("clickType",2);
startActivity(bundle1, ChooseActivity.class);
break;
case R.id.im_tiku:
Bundle bundle3 = new Bundle();
bundle3.putInt("type",1);
startActivity(bundle3,MyCollectionsActivity.class);
break;
case R.id.rl_mine:
startActivity(MineActivity.class);
break;
case R.id.rl_return:
finish();
break;
}
}
}
| UTF-8 | Java | 12,988 | java | HomeActivity.java | Java | [] | null | [] | package com.pdkj.carschool.activity;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import com.google.gson.Gson;
import com.hss01248.dialog.StyledDialog;
import com.hss01248.dialog.interfaces.MyDialogListener;
import com.pdkj.carschool.R;
import com.pdkj.carschool.activity.base.BaseActivity;
import com.pdkj.carschool.activity.base.BaseHandler;
import com.pdkj.carschool.activity.base.MyBaseActivity;
import com.pdkj.carschool.bean.IsPayMemory;
import com.pdkj.carschool.bean.Qustion;
import com.pdkj.carschool.bean.QustionBean;
import com.pdkj.carschool.bean.TokenModel;
import com.pdkj.carschool.bean.isupdatecode;
import com.pdkj.carschool.utils.DateUtils;
import com.pdkj.carschool.utils.NetConstant;
import com.pdkj.carschool.utils.SharedPreferenceUtils;
import com.pdkj.carschool.utils.SysConfig;
import org.xutils.DbManager;
import org.xutils.common.Callback;
import org.xutils.common.util.LogUtil;
import org.xutils.ex.DbException;
import org.xutils.http.RequestParams;
import org.xutils.x;
import java.util.ArrayList;
import java.util.List;
import crossoverone.statuslib.StatusUtil;
import static org.xutils.common.util.LogUtil.e;
public class HomeActivity extends BaseActivity implements View.OnClickListener {
private ImageView im_lianxi;
private ImageView im_moni;
private ImageView im_tiku;
private RelativeLayout rl_mine;
private RelativeLayout rl_return;
@SuppressLint("HandlerLeak")
private Handler mHandler = new BaseHandler(this) {
@Override
protected void handleMessage(Context mContext, Message msg) {
StyledDialog.dismissLoading();
}
};
@Override
protected int getLayout() {
return R.layout.activity_home;
}
@Override
protected void initData(Bundle savedInstanceState) {
StatusUtil.setUseStatusBarColor(this, Color.TRANSPARENT, Color.parseColor("#33000000"));
StatusUtil.setSystemStatus(this, true, true);
im_lianxi = findViewById(R.id.im_lianxi);
im_moni = findViewById(R.id.im_moni);
im_tiku = findViewById(R.id.im_tiku);
rl_mine = findViewById(R.id.rl_mine);
rl_return = findViewById(R.id.rl_return);
}
@Override
protected void initEvent() {
im_lianxi.setOnClickListener(this);
im_moni.setOnClickListener(this);
im_tiku.setOnClickListener(this);
rl_mine.setOnClickListener(this);
rl_return.setOnClickListener(this);
if(TextUtils.isEmpty(SharedPreferenceUtils.getParams("examTypeId",mContext))||SharedPreferenceUtils.getParams("examTypeId",mContext).equals("0")){
StyledDialog.buildIosAlert("ๆ็คบ", "ๆจ่ฟๆฒกๆๅฎๅไธชไบบไฟกๆฏ๏ผ่ฏทๅ
ๅปๅฎๅไฟกๆฏ๏ผ", new MyDialogListener() {
@Override
public void onFirst() {
startActivity(InformationActivity.class);
}
@Override
public void onSecond() {
finish();
}
}).show();
}else{
/**
* ่ทๅๆฏๅฆไธบไป่ดน็จๆท
*/
if(!TextUtils.isEmpty(SharedPreferenceUtils.getParams("examTypeId",this))){
RequestParams params1 = new RequestParams(NetConstant.BASE_URL + "/app/usermember/isPayment");
TokenModel tokenMode2 = new TokenModel(SharedPreferenceUtils.getIntValue(mContext,"userId"),SharedPreferenceUtils.getParams("token",mContext));
params1.addBodyParameter("model",new Gson().toJson(tokenMode2));
params1.addBodyParameter("examTypeId", SharedPreferenceUtils.getParams("examTypeId",mContext));
x.http().post(params1, new Callback.CommonCallback<String>() {
@Override
public void onSuccess(String result) {
IsPayMemory isPayMemory = new Gson().fromJson(result, IsPayMemory.class);
if(isPayMemory.isData()){
SysConfig.getConfig(mContext).setUserVip("99", SharedPreferenceUtils.getParams("examTypeId",mContext));
}
SharedPreferenceUtils.saveBooleanValue(mContext,"isVip",isPayMemory.isData());
}
@Override
public void onError(Throwable ex, boolean isOnCallback) {
}
@Override
public void onCancelled(CancelledException cex) {
}
@Override
public void onFinished() {
}
});
StyledDialog.buildLoading("ๆญฃๅจๆฃๆฅ้ขๅบๆฏๅฆๆๆฐ็ๆฌ").show();
/**
* ่ทๅ่ฏ้ขไฟๅญๅฐๆฐๆฎๅบ
*/
RequestParams params = new RequestParams(NetConstant.BASE_URL + "/app/examquestion/lastQuestion");
TokenModel tokenModel = new TokenModel(SharedPreferenceUtils.getIntValue(mContext,"userId"),SharedPreferenceUtils.getParams("token",mContext));
params.addBodyParameter("model",new Gson().toJson(tokenModel));
params.setConnectTimeout(100000);
params.setReadTimeout(100000);
params.addBodyParameter("examTypeId", SharedPreferenceUtils.getParams("examTypeId",mContext));
params.addBodyParameter("lastDate", SysConfig.getConfig(mContext).getLastTime(SharedPreferenceUtils.getParams("examTypeId",mContext)));
x.http().post(params, new Callback.CommonCallback<String>() {
@Override
public void onSuccess(String result) {
QustionBean qustionBean = new Gson().fromJson(result,QustionBean.class);
if(qustionBean.getCode() == 200){
if(null != qustionBean.getData() && qustionBean.getData().size()>0){
StyledDialog.buildLoading("่ฏ้ขๅบๆญฃๅจๆดๆฐไธญ๏ผ่ฏทไธ่ฆ้ๅบๆ่
ๅๆขๅฐๅๅฐ").show();
new Thread(() -> {
DbManager db = x.getDb(PDApplication.getDaoConfig());
List<Qustion> qustionList = new ArrayList<>();
for(Qustion qustion:qustionBean.getData()){
Qustion qustion1 = new Qustion();
qustion1.setAnswer(qustion.getAnswer());
qustion1.setCategoryId(qustion.getCategoryId());
qustion1.setExamTypeId(qustion.getExamTypeId());
qustion1.setId(qustion.getId());
qustion1.setScene(qustion.isScene());
qustion1.setQuestion(qustion.getQuestion());
qustion1.setQuestionType(qustion.getQuestionType());
qustion1.setRemark(qustion.getRemark());
qustion1.setLastDate(qustion.getLastDate());
if(!TextUtils.isEmpty(qustion.getUrl())){
qustion1.setUrl(NetConstant.BASE_URL+qustion.getUrl());
}else{
qustion1.setUrl("");
}
qustion1.setCategoryType(qustion.getCategoryType());
if(qustion.getOptions().size() == 1){
qustion1.setItem1(qustion.getOptions().get(0).getOptionName());
qustion1.setItem2("");
qustion1.setItem3("");
qustion1.setItem4("");
}
if(qustion.getOptions().size() == 2){
qustion1.setItem1(qustion.getOptions().get(0).getOptionName());
qustion1.setItem2(qustion.getOptions().get(1).getOptionName());
qustion1.setItem3("");
qustion1.setItem4("");
}
if(qustion.getOptions().size() == 3){
qustion1.setItem1(qustion.getOptions().get(0).getOptionName());
qustion1.setItem2(qustion.getOptions().get(1).getOptionName());
qustion1.setItem3(qustion.getOptions().get(2).getOptionName());
qustion1.setItem4("");
}
if(qustion.getOptions().size() == 4){
qustion1.setItem1(qustion.getOptions().get(0).getOptionName());
qustion1.setItem2(qustion.getOptions().get(1).getOptionName());
qustion1.setItem3(qustion.getOptions().get(2).getOptionName());
qustion1.setItem4(qustion.getOptions().get(3).getOptionName());
}
qustionList.add(qustion1);
}
try {
for(Qustion qustion :qustionList){
if(null != db.findById(Qustion.class,qustion.getId())){
db.update(qustion);
}else{
db.save(qustion);
}
}
} catch (DbException e) {
e.printStackTrace();
}
if(null != qustionList && qustionList.size()>0){
SysConfig.getConfig(mContext).setLastTime(DateUtils.getFormatDate("yyyy-MM-dd HH:mm:ss",qustionList.get(0).getLastDate()),SharedPreferenceUtils.getParams("examTypeId",mContext));
}
mHandler.sendEmptyMessage(2000);
}).start();
}
}
}
@Override
public void onError(Throwable ex, boolean isOnCallback) {
e(ex.getMessage());
}
@Override
public void onCancelled(CancelledException cex) {
e(cex.getMessage());
}
@Override
public void onFinished() {
StyledDialog.dismissLoading();
}
});
}
}
}
@Override
public void onClick(View v) {
switch (v.getId()){
case R.id.im_lianxi:
Bundle bundle = new Bundle();
bundle.putInt("questionType",2);
bundle.putString("examTypeId",SharedPreferenceUtils.getStringValue(this,"examTypeId"));
bundle.putInt("type",1);
bundle.putInt("clickType",1);
startActivity(bundle, ChooseActivity.class);
break;
case R.id.im_moni:
Bundle bundle1 = new Bundle();
bundle1.putString("examTypeId",SharedPreferenceUtils.getStringValue(this,"examTypeId"));
bundle1.putInt("type",1);
bundle1.putInt("clickType",2);
startActivity(bundle1, ChooseActivity.class);
break;
case R.id.im_tiku:
Bundle bundle3 = new Bundle();
bundle3.putInt("type",1);
startActivity(bundle3,MyCollectionsActivity.class);
break;
case R.id.rl_mine:
startActivity(MineActivity.class);
break;
case R.id.rl_return:
finish();
break;
}
}
}
| 12,988 | 0.505607 | 0.496029 | 273 | 46.040295 | 34.979145 | 218 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.710623 | false | false | 1 |
57ae5b7f31f303f8100add28f6c5df8c53f5cf25 | 10,977,936,420,282 | 8e426d8649d9b01c299a82fe1c262636810db143 | /vol3/vol3-dl4j-examples/src/main/java/com/heatonresearch/aifh/util/FileUtil.java | 669973b1ee054a9f3a7cd657faa86c5abdb208bc | [
"LicenseRef-scancode-proprietary-license",
"Apache-2.0",
"BSD-3-Clause"
] | permissive | Sun-Joong/aifh | https://github.com/Sun-Joong/aifh | c91b5324da07ecc7e1a237ff76870f53f0f77173 | 1b6363d26f54b77348020ce88ced0670568ed736 | refs/heads/master | 2022-11-23T04:33:26.589000 | 2020-08-02T20:50:19 | 2020-08-02T20:50:19 | 283,822,972 | 0 | 0 | Apache-2.0 | true | 2020-07-30T16:21:43 | 2020-07-30T16:21:43 | 2020-07-30T01:02:21 | 2018-12-10T14:25:37 | 5,901 | 0 | 0 | 0 | null | false | false | /*
* Artificial Intelligence for Humans
* Volume 3: Deep Learning and Neural Networks
* Java Version
* http://www.aifh.org
* http://www.jeffheaton.com
*
* Code repository:
* https://github.com/jeffheaton/aifh
*
* Copyright 2014-2015 by Jeff Heaton
*
* 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.
*
* For more information on Heaton Research copyrights, licenses
* and trademarks visit:
* http://www.heatonresearch.com/copyright
*/
package com.heatonresearch.aifh.util;
import com.heatonresearch.aifh.AIFHError;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.URL;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
/**
* Misc utilities for file processing.
*/
public class FileUtil {
/**
* Download a file from the Internet to a local path.
* @param url The URL to download from.
* @param path The path to download to.
*/
public static void downloadFile(String url, File path) {
try {
URL website = new URL(url);
ReadableByteChannel rbc = Channels.newChannel(website.openStream());
FileOutputStream fos = new FileOutputStream(path);
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
} catch(IOException ex) {
path.delete();// Delete failed file
throw new AIFHError(ex);
}
}
}
| UTF-8 | Java | 1,920 | java | FileUtil.java | Java | [
{
"context": "b.com/jeffheaton/aifh\n *\n * Copyright 2014-2015 by Jeff Heaton\n *\n * Licensed under the Apache License, Version ",
"end": 257,
"score": 0.9998251795768738,
"start": 246,
"tag": "NAME",
"value": "Jeff Heaton"
}
] | null | [] | /*
* Artificial Intelligence for Humans
* Volume 3: Deep Learning and Neural Networks
* Java Version
* http://www.aifh.org
* http://www.jeffheaton.com
*
* Code repository:
* https://github.com/jeffheaton/aifh
*
* Copyright 2014-2015 by <NAME>
*
* 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.
*
* For more information on Heaton Research copyrights, licenses
* and trademarks visit:
* http://www.heatonresearch.com/copyright
*/
package com.heatonresearch.aifh.util;
import com.heatonresearch.aifh.AIFHError;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.URL;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
/**
* Misc utilities for file processing.
*/
public class FileUtil {
/**
* Download a file from the Internet to a local path.
* @param url The URL to download from.
* @param path The path to download to.
*/
public static void downloadFile(String url, File path) {
try {
URL website = new URL(url);
ReadableByteChannel rbc = Channels.newChannel(website.openStream());
FileOutputStream fos = new FileOutputStream(path);
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
} catch(IOException ex) {
path.delete();// Delete failed file
throw new AIFHError(ex);
}
}
}
| 1,915 | 0.696354 | 0.689062 | 62 | 29.967741 | 23.861813 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.370968 | false | false | 1 |
fa628d7a95abb338085a1ecd4d0114f71848dcca | 21,157,008,914,549 | a60cc5c4fd3c6894e2f6460196e67fc9c18f6f62 | /XmlValidator/src/XmlValidator.java | 74d98490aec2b0e73e474e629e1c5267df96fce6 | [] | no_license | tkpensieve/RestaurantFinder | https://github.com/tkpensieve/RestaurantFinder | 3d0dfc6e2ccac5b7487472058b329b930e9e7d60 | e7e6d9051c66e780bc956195e98b35dfcf78530e | refs/heads/master | 2020-05-25T10:21:12.050000 | 2013-10-04T03:03:51 | 2013-10-04T03:03:51 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
public class XmlValidator {
public static boolean validateXMLSchema(File xsdFile, File xmlFile){
try {
SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema schema = factory.newSchema(xsdFile);
Validator validator = schema.newValidator();
validator.validate(new StreamSource(xmlFile));
} catch (IOException | SAXException e) {
System.out.println("Exception: "+e.getMessage());
return false;
}
return true;
}
public static boolean validateXMLDtd(File dtdFile, File xmlFile){
try{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setValidating(true);
DocumentBuilder builder = factory.newDocumentBuilder();
builder.setErrorHandler(new org.xml.sax.ErrorHandler() {
//Ignore the fatal errors
public void fatalError(SAXParseException exception)
throws SAXException { }
//Validation errors
public void error(SAXParseException e)
throws SAXParseException {
System.out.println("Error at " +e.getLineNumber() + " line.");
System.out.println(e.getMessage());
System.exit(0);
}
//Show warnings
public void warning(SAXParseException err)
throws SAXParseException{
System.out.println(err.getMessage());
System.exit(0);
}
});
Document xmlDocument = builder.parse(xmlFile);
// DOMSource source = new DOMSource(xmlDocument);
// StreamResult result = new StreamResult(System.out);
// TransformerFactory tf = TransformerFactory.newInstance();
// Transformer transformer = tf.newTransformer();
// transformer.setOutputProperty(
// OutputKeys.DOCTYPE_SYSTEM, dtdFile.getName());
// transformer.transform(source, result);
return true;
}
catch (Exception e) {
System.out.println(e.getMessage());
return false;
}
}
} | UTF-8 | Java | 2,662 | java | XmlValidator.java | Java | [] | null | [] | import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
public class XmlValidator {
public static boolean validateXMLSchema(File xsdFile, File xmlFile){
try {
SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema schema = factory.newSchema(xsdFile);
Validator validator = schema.newValidator();
validator.validate(new StreamSource(xmlFile));
} catch (IOException | SAXException e) {
System.out.println("Exception: "+e.getMessage());
return false;
}
return true;
}
public static boolean validateXMLDtd(File dtdFile, File xmlFile){
try{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setValidating(true);
DocumentBuilder builder = factory.newDocumentBuilder();
builder.setErrorHandler(new org.xml.sax.ErrorHandler() {
//Ignore the fatal errors
public void fatalError(SAXParseException exception)
throws SAXException { }
//Validation errors
public void error(SAXParseException e)
throws SAXParseException {
System.out.println("Error at " +e.getLineNumber() + " line.");
System.out.println(e.getMessage());
System.exit(0);
}
//Show warnings
public void warning(SAXParseException err)
throws SAXParseException{
System.out.println(err.getMessage());
System.exit(0);
}
});
Document xmlDocument = builder.parse(xmlFile);
// DOMSource source = new DOMSource(xmlDocument);
// StreamResult result = new StreamResult(System.out);
// TransformerFactory tf = TransformerFactory.newInstance();
// Transformer transformer = tf.newTransformer();
// transformer.setOutputProperty(
// OutputKeys.DOCTYPE_SYSTEM, dtdFile.getName());
// transformer.transform(source, result);
return true;
}
catch (Exception e) {
System.out.println(e.getMessage());
return false;
}
}
} | 2,662 | 0.706236 | 0.704733 | 75 | 34.493332 | 21.429808 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.413333 | false | false | 1 |
e5fa9f0055e11e3ee2a39f7dba4b0def01755253 | 16,260,746,197,464 | e9affefd4e89b3c7e2064fee8833d7838c0e0abc | /aws-java-sdk-migrationhuborchestrator/src/main/java/com/amazonaws/services/migrationhuborchestrator/AWSMigrationHubOrchestratorClient.java | 2101edd7ec10eb2d212079cf0bc20dcbd54453b6 | [
"Apache-2.0"
] | permissive | aws/aws-sdk-java | https://github.com/aws/aws-sdk-java | 2c6199b12b47345b5d3c50e425dabba56e279190 | bab987ab604575f41a76864f755f49386e3264b4 | refs/heads/master | 2023-08-29T10:49:07.379000 | 2023-08-28T21:05:55 | 2023-08-28T21:05:55 | 574,877 | 3,695 | 3,092 | Apache-2.0 | false | 2023-09-13T23:35:28 | 2010-03-22T23:34:58 | 2023-09-13T22:30:40 | 2023-09-13T21:56:58 | 4,866,710 | 3,998 | 2,861 | 114 | null | false | false | /*
* Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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 com.amazonaws.services.migrationhuborchestrator;
import org.w3c.dom.*;
import java.net.*;
import java.util.*;
import javax.annotation.Generated;
import org.apache.commons.logging.*;
import com.amazonaws.*;
import com.amazonaws.annotation.SdkInternalApi;
import com.amazonaws.auth.*;
import com.amazonaws.handlers.*;
import com.amazonaws.http.*;
import com.amazonaws.internal.*;
import com.amazonaws.internal.auth.*;
import com.amazonaws.metrics.*;
import com.amazonaws.regions.*;
import com.amazonaws.transform.*;
import com.amazonaws.util.*;
import com.amazonaws.protocol.json.*;
import com.amazonaws.util.AWSRequestMetrics.Field;
import com.amazonaws.annotation.ThreadSafe;
import com.amazonaws.client.AwsSyncClientParams;
import com.amazonaws.client.builder.AdvancedConfig;
import com.amazonaws.services.migrationhuborchestrator.AWSMigrationHubOrchestratorClientBuilder;
import com.amazonaws.AmazonServiceException;
import com.amazonaws.services.migrationhuborchestrator.model.*;
import com.amazonaws.services.migrationhuborchestrator.model.transform.*;
/**
* Client for accessing AWS Migration Hub Orchestrator. All service calls made using this client are blocking, and will
* not return until the service call completes.
* <p>
* <p>
* This API reference provides descriptions, syntax, and other details about each of the actions and data types for AWS
* Migration Hub Orchestrator. he topic for each action shows the API request parameters and the response.
* Alternatively, you can use one of the AWS SDKs to access an API that is tailored to the programming language or
* platform that you're using.
* </p>
*/
@ThreadSafe
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class AWSMigrationHubOrchestratorClient extends AmazonWebServiceClient implements AWSMigrationHubOrchestrator {
/** Provider for AWS credentials. */
private final AWSCredentialsProvider awsCredentialsProvider;
private static final Log log = LogFactory.getLog(AWSMigrationHubOrchestrator.class);
/** Default signing name for the service. */
private static final String DEFAULT_SIGNING_NAME = "migrationhub-orchestrator";
/** Client configuration factory providing ClientConfigurations tailored to this client */
protected static final ClientConfigurationFactory configFactory = new ClientConfigurationFactory();
private final AdvancedConfig advancedConfig;
private static final com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory = new com.amazonaws.protocol.json.SdkJsonProtocolFactory(
new JsonClientMetadata()
.withProtocolVersion("1.1")
.withSupportsCbor(false)
.withSupportsIon(false)
.withContentTypeOverride("application/json")
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("AccessDeniedException").withExceptionUnmarshaller(
com.amazonaws.services.migrationhuborchestrator.model.transform.AccessDeniedExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("ResourceNotFoundException").withExceptionUnmarshaller(
com.amazonaws.services.migrationhuborchestrator.model.transform.ResourceNotFoundExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("ThrottlingException").withExceptionUnmarshaller(
com.amazonaws.services.migrationhuborchestrator.model.transform.ThrottlingExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("ValidationException").withExceptionUnmarshaller(
com.amazonaws.services.migrationhuborchestrator.model.transform.ValidationExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("InternalServerException").withExceptionUnmarshaller(
com.amazonaws.services.migrationhuborchestrator.model.transform.InternalServerExceptionUnmarshaller.getInstance()))
.withBaseServiceExceptionClass(com.amazonaws.services.migrationhuborchestrator.model.AWSMigrationHubOrchestratorException.class));
public static AWSMigrationHubOrchestratorClientBuilder builder() {
return AWSMigrationHubOrchestratorClientBuilder.standard();
}
/**
* Constructs a new client to invoke service methods on AWS Migration Hub Orchestrator using the specified
* parameters.
*
* <p>
* All service calls made using this new client object are blocking, and will not return until the service call
* completes.
*
* @param clientParams
* Object providing client parameters.
*/
AWSMigrationHubOrchestratorClient(AwsSyncClientParams clientParams) {
this(clientParams, false);
}
/**
* Constructs a new client to invoke service methods on AWS Migration Hub Orchestrator using the specified
* parameters.
*
* <p>
* All service calls made using this new client object are blocking, and will not return until the service call
* completes.
*
* @param clientParams
* Object providing client parameters.
*/
AWSMigrationHubOrchestratorClient(AwsSyncClientParams clientParams, boolean endpointDiscoveryEnabled) {
super(clientParams);
this.awsCredentialsProvider = clientParams.getCredentialsProvider();
this.advancedConfig = clientParams.getAdvancedConfig();
init();
}
private void init() {
setServiceNameIntern(DEFAULT_SIGNING_NAME);
setEndpointPrefix(ENDPOINT_PREFIX);
// calling this.setEndPoint(...) will also modify the signer accordingly
setEndpoint("migrationhub-orchestrator.us-east-1.amazonaws.com");
HandlerChainFactory chainFactory = new HandlerChainFactory();
requestHandler2s.addAll(chainFactory.newRequestHandlerChain("/com/amazonaws/services/migrationhuborchestrator/request.handlers"));
requestHandler2s.addAll(chainFactory.newRequestHandler2Chain("/com/amazonaws/services/migrationhuborchestrator/request.handler2s"));
requestHandler2s.addAll(chainFactory.getGlobalHandlers());
}
/**
* <p>
* Create a workflow to orchestrate your migrations.
* </p>
*
* @param createWorkflowRequest
* @return Result of the CreateWorkflow operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An internal error has occurred.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an AWS service.
* @sample AWSMigrationHubOrchestrator.CreateWorkflow
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/CreateWorkflow"
* target="_top">AWS API Documentation</a>
*/
@Override
public CreateWorkflowResult createWorkflow(CreateWorkflowRequest request) {
request = beforeClientExecution(request);
return executeCreateWorkflow(request);
}
@SdkInternalApi
final CreateWorkflowResult executeCreateWorkflow(CreateWorkflowRequest createWorkflowRequest) {
ExecutionContext executionContext = createExecutionContext(createWorkflowRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<CreateWorkflowRequest> request = null;
Response<CreateWorkflowResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new CreateWorkflowRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createWorkflowRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateWorkflow");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<CreateWorkflowResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateWorkflowResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Create a step in the migration workflow.
* </p>
*
* @param createWorkflowStepRequest
* @return Result of the CreateWorkflowStep operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An internal error has occurred.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an AWS service.
* @sample AWSMigrationHubOrchestrator.CreateWorkflowStep
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/CreateWorkflowStep"
* target="_top">AWS API Documentation</a>
*/
@Override
public CreateWorkflowStepResult createWorkflowStep(CreateWorkflowStepRequest request) {
request = beforeClientExecution(request);
return executeCreateWorkflowStep(request);
}
@SdkInternalApi
final CreateWorkflowStepResult executeCreateWorkflowStep(CreateWorkflowStepRequest createWorkflowStepRequest) {
ExecutionContext executionContext = createExecutionContext(createWorkflowStepRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<CreateWorkflowStepRequest> request = null;
Response<CreateWorkflowStepResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new CreateWorkflowStepRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createWorkflowStepRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateWorkflowStep");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<CreateWorkflowStepResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateWorkflowStepResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Create a step group in a migration workflow.
* </p>
*
* @param createWorkflowStepGroupRequest
* @return Result of the CreateWorkflowStepGroup operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An internal error has occurred.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an AWS service.
* @sample AWSMigrationHubOrchestrator.CreateWorkflowStepGroup
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/CreateWorkflowStepGroup"
* target="_top">AWS API Documentation</a>
*/
@Override
public CreateWorkflowStepGroupResult createWorkflowStepGroup(CreateWorkflowStepGroupRequest request) {
request = beforeClientExecution(request);
return executeCreateWorkflowStepGroup(request);
}
@SdkInternalApi
final CreateWorkflowStepGroupResult executeCreateWorkflowStepGroup(CreateWorkflowStepGroupRequest createWorkflowStepGroupRequest) {
ExecutionContext executionContext = createExecutionContext(createWorkflowStepGroupRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<CreateWorkflowStepGroupRequest> request = null;
Response<CreateWorkflowStepGroupResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new CreateWorkflowStepGroupRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(createWorkflowStepGroupRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateWorkflowStepGroup");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<CreateWorkflowStepGroupResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new CreateWorkflowStepGroupResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Delete a migration workflow. You must pause a running workflow in Migration Hub Orchestrator console to delete
* it.
* </p>
*
* @param deleteWorkflowRequest
* @return Result of the DeleteWorkflow operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An internal error has occurred.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an AWS service.
* @throws ResourceNotFoundException
* The resource is not available.
* @sample AWSMigrationHubOrchestrator.DeleteWorkflow
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/DeleteWorkflow"
* target="_top">AWS API Documentation</a>
*/
@Override
public DeleteWorkflowResult deleteWorkflow(DeleteWorkflowRequest request) {
request = beforeClientExecution(request);
return executeDeleteWorkflow(request);
}
@SdkInternalApi
final DeleteWorkflowResult executeDeleteWorkflow(DeleteWorkflowRequest deleteWorkflowRequest) {
ExecutionContext executionContext = createExecutionContext(deleteWorkflowRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<DeleteWorkflowRequest> request = null;
Response<DeleteWorkflowResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DeleteWorkflowRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteWorkflowRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteWorkflow");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<DeleteWorkflowResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteWorkflowResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Delete a step in a migration workflow. Pause the workflow to delete a running step.
* </p>
*
* @param deleteWorkflowStepRequest
* @return Result of the DeleteWorkflowStep operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An internal error has occurred.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an AWS service.
* @throws ResourceNotFoundException
* The resource is not available.
* @sample AWSMigrationHubOrchestrator.DeleteWorkflowStep
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/DeleteWorkflowStep"
* target="_top">AWS API Documentation</a>
*/
@Override
public DeleteWorkflowStepResult deleteWorkflowStep(DeleteWorkflowStepRequest request) {
request = beforeClientExecution(request);
return executeDeleteWorkflowStep(request);
}
@SdkInternalApi
final DeleteWorkflowStepResult executeDeleteWorkflowStep(DeleteWorkflowStepRequest deleteWorkflowStepRequest) {
ExecutionContext executionContext = createExecutionContext(deleteWorkflowStepRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<DeleteWorkflowStepRequest> request = null;
Response<DeleteWorkflowStepResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DeleteWorkflowStepRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteWorkflowStepRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteWorkflowStep");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<DeleteWorkflowStepResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteWorkflowStepResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Delete a step group in a migration workflow.
* </p>
*
* @param deleteWorkflowStepGroupRequest
* @return Result of the DeleteWorkflowStepGroup operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An internal error has occurred.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an AWS service.
* @throws ResourceNotFoundException
* The resource is not available.
* @sample AWSMigrationHubOrchestrator.DeleteWorkflowStepGroup
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/DeleteWorkflowStepGroup"
* target="_top">AWS API Documentation</a>
*/
@Override
public DeleteWorkflowStepGroupResult deleteWorkflowStepGroup(DeleteWorkflowStepGroupRequest request) {
request = beforeClientExecution(request);
return executeDeleteWorkflowStepGroup(request);
}
@SdkInternalApi
final DeleteWorkflowStepGroupResult executeDeleteWorkflowStepGroup(DeleteWorkflowStepGroupRequest deleteWorkflowStepGroupRequest) {
ExecutionContext executionContext = createExecutionContext(deleteWorkflowStepGroupRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<DeleteWorkflowStepGroupRequest> request = null;
Response<DeleteWorkflowStepGroupResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DeleteWorkflowStepGroupRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(deleteWorkflowStepGroupRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteWorkflowStepGroup");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<DeleteWorkflowStepGroupResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new DeleteWorkflowStepGroupResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Get the template you want to use for creating a migration workflow.
* </p>
*
* @param getTemplateRequest
* @return Result of the GetTemplate operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An internal error has occurred.
* @throws ResourceNotFoundException
* The resource is not available.
* @sample AWSMigrationHubOrchestrator.GetTemplate
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/GetTemplate"
* target="_top">AWS API Documentation</a>
*/
@Override
public GetTemplateResult getTemplate(GetTemplateRequest request) {
request = beforeClientExecution(request);
return executeGetTemplate(request);
}
@SdkInternalApi
final GetTemplateResult executeGetTemplate(GetTemplateRequest getTemplateRequest) {
ExecutionContext executionContext = createExecutionContext(getTemplateRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<GetTemplateRequest> request = null;
Response<GetTemplateResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetTemplateRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getTemplateRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetTemplate");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<GetTemplateResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetTemplateResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Get a specific step in a template.
* </p>
*
* @param getTemplateStepRequest
* @return Result of the GetTemplateStep operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An internal error has occurred.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an AWS service.
* @throws ResourceNotFoundException
* The resource is not available.
* @sample AWSMigrationHubOrchestrator.GetTemplateStep
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/GetTemplateStep"
* target="_top">AWS API Documentation</a>
*/
@Override
public GetTemplateStepResult getTemplateStep(GetTemplateStepRequest request) {
request = beforeClientExecution(request);
return executeGetTemplateStep(request);
}
@SdkInternalApi
final GetTemplateStepResult executeGetTemplateStep(GetTemplateStepRequest getTemplateStepRequest) {
ExecutionContext executionContext = createExecutionContext(getTemplateStepRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<GetTemplateStepRequest> request = null;
Response<GetTemplateStepResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetTemplateStepRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getTemplateStepRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetTemplateStep");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<GetTemplateStepResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetTemplateStepResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Get a step group in a template.
* </p>
*
* @param getTemplateStepGroupRequest
* @return Result of the GetTemplateStepGroup operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An internal error has occurred.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an AWS service.
* @throws ResourceNotFoundException
* The resource is not available.
* @sample AWSMigrationHubOrchestrator.GetTemplateStepGroup
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/GetTemplateStepGroup"
* target="_top">AWS API Documentation</a>
*/
@Override
public GetTemplateStepGroupResult getTemplateStepGroup(GetTemplateStepGroupRequest request) {
request = beforeClientExecution(request);
return executeGetTemplateStepGroup(request);
}
@SdkInternalApi
final GetTemplateStepGroupResult executeGetTemplateStepGroup(GetTemplateStepGroupRequest getTemplateStepGroupRequest) {
ExecutionContext executionContext = createExecutionContext(getTemplateStepGroupRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<GetTemplateStepGroupRequest> request = null;
Response<GetTemplateStepGroupResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetTemplateStepGroupRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getTemplateStepGroupRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetTemplateStepGroup");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<GetTemplateStepGroupResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetTemplateStepGroupResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Get migration workflow.
* </p>
*
* @param getWorkflowRequest
* @return Result of the GetWorkflow operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An internal error has occurred.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an AWS service.
* @throws ResourceNotFoundException
* The resource is not available.
* @sample AWSMigrationHubOrchestrator.GetWorkflow
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/GetWorkflow"
* target="_top">AWS API Documentation</a>
*/
@Override
public GetWorkflowResult getWorkflow(GetWorkflowRequest request) {
request = beforeClientExecution(request);
return executeGetWorkflow(request);
}
@SdkInternalApi
final GetWorkflowResult executeGetWorkflow(GetWorkflowRequest getWorkflowRequest) {
ExecutionContext executionContext = createExecutionContext(getWorkflowRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<GetWorkflowRequest> request = null;
Response<GetWorkflowResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetWorkflowRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getWorkflowRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetWorkflow");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<GetWorkflowResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetWorkflowResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Get a step in the migration workflow.
* </p>
*
* @param getWorkflowStepRequest
* @return Result of the GetWorkflowStep operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An internal error has occurred.
* @throws ResourceNotFoundException
* The resource is not available.
* @sample AWSMigrationHubOrchestrator.GetWorkflowStep
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/GetWorkflowStep"
* target="_top">AWS API Documentation</a>
*/
@Override
public GetWorkflowStepResult getWorkflowStep(GetWorkflowStepRequest request) {
request = beforeClientExecution(request);
return executeGetWorkflowStep(request);
}
@SdkInternalApi
final GetWorkflowStepResult executeGetWorkflowStep(GetWorkflowStepRequest getWorkflowStepRequest) {
ExecutionContext executionContext = createExecutionContext(getWorkflowStepRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<GetWorkflowStepRequest> request = null;
Response<GetWorkflowStepResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetWorkflowStepRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getWorkflowStepRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetWorkflowStep");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<GetWorkflowStepResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetWorkflowStepResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Get the step group of a migration workflow.
* </p>
*
* @param getWorkflowStepGroupRequest
* @return Result of the GetWorkflowStepGroup operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An internal error has occurred.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an AWS service.
* @throws ResourceNotFoundException
* The resource is not available.
* @sample AWSMigrationHubOrchestrator.GetWorkflowStepGroup
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/GetWorkflowStepGroup"
* target="_top">AWS API Documentation</a>
*/
@Override
public GetWorkflowStepGroupResult getWorkflowStepGroup(GetWorkflowStepGroupRequest request) {
request = beforeClientExecution(request);
return executeGetWorkflowStepGroup(request);
}
@SdkInternalApi
final GetWorkflowStepGroupResult executeGetWorkflowStepGroup(GetWorkflowStepGroupRequest getWorkflowStepGroupRequest) {
ExecutionContext executionContext = createExecutionContext(getWorkflowStepGroupRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<GetWorkflowStepGroupRequest> request = null;
Response<GetWorkflowStepGroupResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetWorkflowStepGroupRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getWorkflowStepGroupRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetWorkflowStepGroup");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<GetWorkflowStepGroupResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetWorkflowStepGroupResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* List AWS Migration Hub Orchestrator plugins.
* </p>
*
* @param listPluginsRequest
* @return Result of the ListPlugins operation returned by the service.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An internal error has occurred.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an AWS service.
* @sample AWSMigrationHubOrchestrator.ListPlugins
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/ListPlugins"
* target="_top">AWS API Documentation</a>
*/
@Override
public ListPluginsResult listPlugins(ListPluginsRequest request) {
request = beforeClientExecution(request);
return executeListPlugins(request);
}
@SdkInternalApi
final ListPluginsResult executeListPlugins(ListPluginsRequest listPluginsRequest) {
ExecutionContext executionContext = createExecutionContext(listPluginsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<ListPluginsRequest> request = null;
Response<ListPluginsResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListPluginsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listPluginsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListPlugins");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<ListPluginsResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListPluginsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* List the tags added to a resource.
* </p>
*
* @param listTagsForResourceRequest
* @return Result of the ListTagsForResource operation returned by the service.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an AWS service.
* @throws ResourceNotFoundException
* The resource is not available.
* @sample AWSMigrationHubOrchestrator.ListTagsForResource
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/ListTagsForResource"
* target="_top">AWS API Documentation</a>
*/
@Override
public ListTagsForResourceResult listTagsForResource(ListTagsForResourceRequest request) {
request = beforeClientExecution(request);
return executeListTagsForResource(request);
}
@SdkInternalApi
final ListTagsForResourceResult executeListTagsForResource(ListTagsForResourceRequest listTagsForResourceRequest) {
ExecutionContext executionContext = createExecutionContext(listTagsForResourceRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<ListTagsForResourceRequest> request = null;
Response<ListTagsForResourceResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListTagsForResourceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listTagsForResourceRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListTagsForResource");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<ListTagsForResourceResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListTagsForResourceResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* List the step groups in a template.
* </p>
*
* @param listTemplateStepGroupsRequest
* @return Result of the ListTemplateStepGroups operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An internal error has occurred.
* @throws ResourceNotFoundException
* The resource is not available.
* @sample AWSMigrationHubOrchestrator.ListTemplateStepGroups
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/ListTemplateStepGroups"
* target="_top">AWS API Documentation</a>
*/
@Override
public ListTemplateStepGroupsResult listTemplateStepGroups(ListTemplateStepGroupsRequest request) {
request = beforeClientExecution(request);
return executeListTemplateStepGroups(request);
}
@SdkInternalApi
final ListTemplateStepGroupsResult executeListTemplateStepGroups(ListTemplateStepGroupsRequest listTemplateStepGroupsRequest) {
ExecutionContext executionContext = createExecutionContext(listTemplateStepGroupsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<ListTemplateStepGroupsRequest> request = null;
Response<ListTemplateStepGroupsResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListTemplateStepGroupsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listTemplateStepGroupsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListTemplateStepGroups");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<ListTemplateStepGroupsResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new ListTemplateStepGroupsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* List the steps in a template.
* </p>
*
* @param listTemplateStepsRequest
* @return Result of the ListTemplateSteps operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An internal error has occurred.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an AWS service.
* @throws ResourceNotFoundException
* The resource is not available.
* @sample AWSMigrationHubOrchestrator.ListTemplateSteps
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/ListTemplateSteps"
* target="_top">AWS API Documentation</a>
*/
@Override
public ListTemplateStepsResult listTemplateSteps(ListTemplateStepsRequest request) {
request = beforeClientExecution(request);
return executeListTemplateSteps(request);
}
@SdkInternalApi
final ListTemplateStepsResult executeListTemplateSteps(ListTemplateStepsRequest listTemplateStepsRequest) {
ExecutionContext executionContext = createExecutionContext(listTemplateStepsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<ListTemplateStepsRequest> request = null;
Response<ListTemplateStepsResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListTemplateStepsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listTemplateStepsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListTemplateSteps");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<ListTemplateStepsResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListTemplateStepsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* List the templates available in Migration Hub Orchestrator to create a migration workflow.
* </p>
*
* @param listTemplatesRequest
* @return Result of the ListTemplates operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An internal error has occurred.
* @sample AWSMigrationHubOrchestrator.ListTemplates
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/ListTemplates"
* target="_top">AWS API Documentation</a>
*/
@Override
public ListTemplatesResult listTemplates(ListTemplatesRequest request) {
request = beforeClientExecution(request);
return executeListTemplates(request);
}
@SdkInternalApi
final ListTemplatesResult executeListTemplates(ListTemplatesRequest listTemplatesRequest) {
ExecutionContext executionContext = createExecutionContext(listTemplatesRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<ListTemplatesRequest> request = null;
Response<ListTemplatesResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListTemplatesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listTemplatesRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListTemplates");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<ListTemplatesResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListTemplatesResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* List the step groups in a migration workflow.
* </p>
*
* @param listWorkflowStepGroupsRequest
* @return Result of the ListWorkflowStepGroups operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An internal error has occurred.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an AWS service.
* @throws ResourceNotFoundException
* The resource is not available.
* @sample AWSMigrationHubOrchestrator.ListWorkflowStepGroups
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/ListWorkflowStepGroups"
* target="_top">AWS API Documentation</a>
*/
@Override
public ListWorkflowStepGroupsResult listWorkflowStepGroups(ListWorkflowStepGroupsRequest request) {
request = beforeClientExecution(request);
return executeListWorkflowStepGroups(request);
}
@SdkInternalApi
final ListWorkflowStepGroupsResult executeListWorkflowStepGroups(ListWorkflowStepGroupsRequest listWorkflowStepGroupsRequest) {
ExecutionContext executionContext = createExecutionContext(listWorkflowStepGroupsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<ListWorkflowStepGroupsRequest> request = null;
Response<ListWorkflowStepGroupsResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListWorkflowStepGroupsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listWorkflowStepGroupsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListWorkflowStepGroups");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<ListWorkflowStepGroupsResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new ListWorkflowStepGroupsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* List the steps in a workflow.
* </p>
*
* @param listWorkflowStepsRequest
* @return Result of the ListWorkflowSteps operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An internal error has occurred.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an AWS service.
* @sample AWSMigrationHubOrchestrator.ListWorkflowSteps
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/ListWorkflowSteps"
* target="_top">AWS API Documentation</a>
*/
@Override
public ListWorkflowStepsResult listWorkflowSteps(ListWorkflowStepsRequest request) {
request = beforeClientExecution(request);
return executeListWorkflowSteps(request);
}
@SdkInternalApi
final ListWorkflowStepsResult executeListWorkflowSteps(ListWorkflowStepsRequest listWorkflowStepsRequest) {
ExecutionContext executionContext = createExecutionContext(listWorkflowStepsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<ListWorkflowStepsRequest> request = null;
Response<ListWorkflowStepsResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListWorkflowStepsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listWorkflowStepsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListWorkflowSteps");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<ListWorkflowStepsResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListWorkflowStepsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* List the migration workflows.
* </p>
*
* @param listWorkflowsRequest
* @return Result of the ListWorkflows operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An internal error has occurred.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an AWS service.
* @throws ResourceNotFoundException
* The resource is not available.
* @sample AWSMigrationHubOrchestrator.ListWorkflows
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/ListWorkflows"
* target="_top">AWS API Documentation</a>
*/
@Override
public ListWorkflowsResult listWorkflows(ListWorkflowsRequest request) {
request = beforeClientExecution(request);
return executeListWorkflows(request);
}
@SdkInternalApi
final ListWorkflowsResult executeListWorkflows(ListWorkflowsRequest listWorkflowsRequest) {
ExecutionContext executionContext = createExecutionContext(listWorkflowsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<ListWorkflowsRequest> request = null;
Response<ListWorkflowsResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListWorkflowsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listWorkflowsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListWorkflows");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<ListWorkflowsResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListWorkflowsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Retry a failed step in a migration workflow.
* </p>
*
* @param retryWorkflowStepRequest
* @return Result of the RetryWorkflowStep operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An internal error has occurred.
* @throws ResourceNotFoundException
* The resource is not available.
* @sample AWSMigrationHubOrchestrator.RetryWorkflowStep
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/RetryWorkflowStep"
* target="_top">AWS API Documentation</a>
*/
@Override
public RetryWorkflowStepResult retryWorkflowStep(RetryWorkflowStepRequest request) {
request = beforeClientExecution(request);
return executeRetryWorkflowStep(request);
}
@SdkInternalApi
final RetryWorkflowStepResult executeRetryWorkflowStep(RetryWorkflowStepRequest retryWorkflowStepRequest) {
ExecutionContext executionContext = createExecutionContext(retryWorkflowStepRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<RetryWorkflowStepRequest> request = null;
Response<RetryWorkflowStepResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new RetryWorkflowStepRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(retryWorkflowStepRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "RetryWorkflowStep");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<RetryWorkflowStepResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new RetryWorkflowStepResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Start a migration workflow.
* </p>
*
* @param startWorkflowRequest
* @return Result of the StartWorkflow operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An internal error has occurred.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an AWS service.
* @throws ResourceNotFoundException
* The resource is not available.
* @sample AWSMigrationHubOrchestrator.StartWorkflow
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/StartWorkflow"
* target="_top">AWS API Documentation</a>
*/
@Override
public StartWorkflowResult startWorkflow(StartWorkflowRequest request) {
request = beforeClientExecution(request);
return executeStartWorkflow(request);
}
@SdkInternalApi
final StartWorkflowResult executeStartWorkflow(StartWorkflowRequest startWorkflowRequest) {
ExecutionContext executionContext = createExecutionContext(startWorkflowRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<StartWorkflowRequest> request = null;
Response<StartWorkflowResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new StartWorkflowRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(startWorkflowRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "StartWorkflow");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<StartWorkflowResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new StartWorkflowResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Stop an ongoing migration workflow.
* </p>
*
* @param stopWorkflowRequest
* @return Result of the StopWorkflow operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An internal error has occurred.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an AWS service.
* @throws ResourceNotFoundException
* The resource is not available.
* @sample AWSMigrationHubOrchestrator.StopWorkflow
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/StopWorkflow"
* target="_top">AWS API Documentation</a>
*/
@Override
public StopWorkflowResult stopWorkflow(StopWorkflowRequest request) {
request = beforeClientExecution(request);
return executeStopWorkflow(request);
}
@SdkInternalApi
final StopWorkflowResult executeStopWorkflow(StopWorkflowRequest stopWorkflowRequest) {
ExecutionContext executionContext = createExecutionContext(stopWorkflowRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<StopWorkflowRequest> request = null;
Response<StopWorkflowResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new StopWorkflowRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(stopWorkflowRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "StopWorkflow");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<StopWorkflowResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new StopWorkflowResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Tag a resource by specifying its Amazon Resource Name (ARN).
* </p>
*
* @param tagResourceRequest
* @return Result of the TagResource operation returned by the service.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an AWS service.
* @throws ResourceNotFoundException
* The resource is not available.
* @sample AWSMigrationHubOrchestrator.TagResource
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/TagResource"
* target="_top">AWS API Documentation</a>
*/
@Override
public TagResourceResult tagResource(TagResourceRequest request) {
request = beforeClientExecution(request);
return executeTagResource(request);
}
@SdkInternalApi
final TagResourceResult executeTagResource(TagResourceRequest tagResourceRequest) {
ExecutionContext executionContext = createExecutionContext(tagResourceRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<TagResourceRequest> request = null;
Response<TagResourceResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new TagResourceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(tagResourceRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "TagResource");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<TagResourceResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new TagResourceResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Deletes the tags for a resource.
* </p>
*
* @param untagResourceRequest
* @return Result of the UntagResource operation returned by the service.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an AWS service.
* @throws ResourceNotFoundException
* The resource is not available.
* @sample AWSMigrationHubOrchestrator.UntagResource
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/UntagResource"
* target="_top">AWS API Documentation</a>
*/
@Override
public UntagResourceResult untagResource(UntagResourceRequest request) {
request = beforeClientExecution(request);
return executeUntagResource(request);
}
@SdkInternalApi
final UntagResourceResult executeUntagResource(UntagResourceRequest untagResourceRequest) {
ExecutionContext executionContext = createExecutionContext(untagResourceRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<UntagResourceRequest> request = null;
Response<UntagResourceResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new UntagResourceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(untagResourceRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UntagResource");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<UntagResourceResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UntagResourceResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Update a migration workflow.
* </p>
*
* @param updateWorkflowRequest
* @return Result of the UpdateWorkflow operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An internal error has occurred.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an AWS service.
* @throws ResourceNotFoundException
* The resource is not available.
* @sample AWSMigrationHubOrchestrator.UpdateWorkflow
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/UpdateWorkflow"
* target="_top">AWS API Documentation</a>
*/
@Override
public UpdateWorkflowResult updateWorkflow(UpdateWorkflowRequest request) {
request = beforeClientExecution(request);
return executeUpdateWorkflow(request);
}
@SdkInternalApi
final UpdateWorkflowResult executeUpdateWorkflow(UpdateWorkflowRequest updateWorkflowRequest) {
ExecutionContext executionContext = createExecutionContext(updateWorkflowRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<UpdateWorkflowRequest> request = null;
Response<UpdateWorkflowResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new UpdateWorkflowRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(updateWorkflowRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateWorkflow");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<UpdateWorkflowResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UpdateWorkflowResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Update a step in a migration workflow.
* </p>
*
* @param updateWorkflowStepRequest
* @return Result of the UpdateWorkflowStep operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An internal error has occurred.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an AWS service.
* @sample AWSMigrationHubOrchestrator.UpdateWorkflowStep
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/UpdateWorkflowStep"
* target="_top">AWS API Documentation</a>
*/
@Override
public UpdateWorkflowStepResult updateWorkflowStep(UpdateWorkflowStepRequest request) {
request = beforeClientExecution(request);
return executeUpdateWorkflowStep(request);
}
@SdkInternalApi
final UpdateWorkflowStepResult executeUpdateWorkflowStep(UpdateWorkflowStepRequest updateWorkflowStepRequest) {
ExecutionContext executionContext = createExecutionContext(updateWorkflowStepRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<UpdateWorkflowStepRequest> request = null;
Response<UpdateWorkflowStepResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new UpdateWorkflowStepRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(updateWorkflowStepRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateWorkflowStep");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<UpdateWorkflowStepResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UpdateWorkflowStepResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Update the step group in a migration workflow.
* </p>
*
* @param updateWorkflowStepGroupRequest
* @return Result of the UpdateWorkflowStepGroup operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An internal error has occurred.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an AWS service.
* @throws ResourceNotFoundException
* The resource is not available.
* @sample AWSMigrationHubOrchestrator.UpdateWorkflowStepGroup
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/UpdateWorkflowStepGroup"
* target="_top">AWS API Documentation</a>
*/
@Override
public UpdateWorkflowStepGroupResult updateWorkflowStepGroup(UpdateWorkflowStepGroupRequest request) {
request = beforeClientExecution(request);
return executeUpdateWorkflowStepGroup(request);
}
@SdkInternalApi
final UpdateWorkflowStepGroupResult executeUpdateWorkflowStepGroup(UpdateWorkflowStepGroupRequest updateWorkflowStepGroupRequest) {
ExecutionContext executionContext = createExecutionContext(updateWorkflowStepGroupRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<UpdateWorkflowStepGroupRequest> request = null;
Response<UpdateWorkflowStepGroupResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new UpdateWorkflowStepGroupRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(updateWorkflowStepGroupRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateWorkflowStepGroup");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<UpdateWorkflowStepGroupResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new UpdateWorkflowStepGroupResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* Returns additional metadata for a previously executed successful, request, typically used for debugging issues
* where a service isn't acting as expected. This data isn't considered part of the result data returned by an
* operation, so it's available through this separate, diagnostic interface.
* <p>
* Response metadata is only cached for a limited period of time, so if you need to access this extra diagnostic
* information for an executed request, you should use this method to retrieve it as soon as possible after
* executing the request.
*
* @param request
* The originally executed request
*
* @return The response metadata for the specified request, or null if none is available.
*/
public ResponseMetadata getCachedResponseMetadata(AmazonWebServiceRequest request) {
return client.getResponseMetadataForRequest(request);
}
/**
* Normal invoke with authentication. Credentials are required and may be overriden at the request level.
**/
private <X, Y extends AmazonWebServiceRequest> Response<X> invoke(Request<Y> request, HttpResponseHandler<AmazonWebServiceResponse<X>> responseHandler,
ExecutionContext executionContext) {
return invoke(request, responseHandler, executionContext, null, null);
}
/**
* Normal invoke with authentication. Credentials are required and may be overriden at the request level.
**/
private <X, Y extends AmazonWebServiceRequest> Response<X> invoke(Request<Y> request, HttpResponseHandler<AmazonWebServiceResponse<X>> responseHandler,
ExecutionContext executionContext, URI cachedEndpoint, URI uriFromEndpointTrait) {
executionContext.setCredentialsProvider(CredentialUtils.getCredentialsProvider(request.getOriginalRequest(), awsCredentialsProvider));
return doInvoke(request, responseHandler, executionContext, cachedEndpoint, uriFromEndpointTrait);
}
/**
* Invoke with no authentication. Credentials are not required and any credentials set on the client or request will
* be ignored for this operation.
**/
private <X, Y extends AmazonWebServiceRequest> Response<X> anonymousInvoke(Request<Y> request,
HttpResponseHandler<AmazonWebServiceResponse<X>> responseHandler, ExecutionContext executionContext) {
return doInvoke(request, responseHandler, executionContext, null, null);
}
/**
* Invoke the request using the http client. Assumes credentials (or lack thereof) have been configured in the
* ExecutionContext beforehand.
**/
private <X, Y extends AmazonWebServiceRequest> Response<X> doInvoke(Request<Y> request, HttpResponseHandler<AmazonWebServiceResponse<X>> responseHandler,
ExecutionContext executionContext, URI discoveredEndpoint, URI uriFromEndpointTrait) {
if (discoveredEndpoint != null) {
request.setEndpoint(discoveredEndpoint);
request.getOriginalRequest().getRequestClientOptions().appendUserAgent("endpoint-discovery");
} else if (uriFromEndpointTrait != null) {
request.setEndpoint(uriFromEndpointTrait);
} else {
request.setEndpoint(endpoint);
}
request.setTimeOffset(timeOffset);
HttpResponseHandler<AmazonServiceException> errorResponseHandler = protocolFactory.createErrorResponseHandler(new JsonErrorResponseMetadata());
return client.execute(request, responseHandler, errorResponseHandler, executionContext);
}
@com.amazonaws.annotation.SdkInternalApi
static com.amazonaws.protocol.json.SdkJsonProtocolFactory getProtocolFactory() {
return protocolFactory;
}
@Override
public void shutdown() {
super.shutdown();
}
}
| UTF-8 | Java | 100,071 | java | AWSMigrationHubOrchestratorClient.java | Java | [] | null | [] | /*
* Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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 com.amazonaws.services.migrationhuborchestrator;
import org.w3c.dom.*;
import java.net.*;
import java.util.*;
import javax.annotation.Generated;
import org.apache.commons.logging.*;
import com.amazonaws.*;
import com.amazonaws.annotation.SdkInternalApi;
import com.amazonaws.auth.*;
import com.amazonaws.handlers.*;
import com.amazonaws.http.*;
import com.amazonaws.internal.*;
import com.amazonaws.internal.auth.*;
import com.amazonaws.metrics.*;
import com.amazonaws.regions.*;
import com.amazonaws.transform.*;
import com.amazonaws.util.*;
import com.amazonaws.protocol.json.*;
import com.amazonaws.util.AWSRequestMetrics.Field;
import com.amazonaws.annotation.ThreadSafe;
import com.amazonaws.client.AwsSyncClientParams;
import com.amazonaws.client.builder.AdvancedConfig;
import com.amazonaws.services.migrationhuborchestrator.AWSMigrationHubOrchestratorClientBuilder;
import com.amazonaws.AmazonServiceException;
import com.amazonaws.services.migrationhuborchestrator.model.*;
import com.amazonaws.services.migrationhuborchestrator.model.transform.*;
/**
* Client for accessing AWS Migration Hub Orchestrator. All service calls made using this client are blocking, and will
* not return until the service call completes.
* <p>
* <p>
* This API reference provides descriptions, syntax, and other details about each of the actions and data types for AWS
* Migration Hub Orchestrator. he topic for each action shows the API request parameters and the response.
* Alternatively, you can use one of the AWS SDKs to access an API that is tailored to the programming language or
* platform that you're using.
* </p>
*/
@ThreadSafe
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class AWSMigrationHubOrchestratorClient extends AmazonWebServiceClient implements AWSMigrationHubOrchestrator {
/** Provider for AWS credentials. */
private final AWSCredentialsProvider awsCredentialsProvider;
private static final Log log = LogFactory.getLog(AWSMigrationHubOrchestrator.class);
/** Default signing name for the service. */
private static final String DEFAULT_SIGNING_NAME = "migrationhub-orchestrator";
/** Client configuration factory providing ClientConfigurations tailored to this client */
protected static final ClientConfigurationFactory configFactory = new ClientConfigurationFactory();
private final AdvancedConfig advancedConfig;
private static final com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory = new com.amazonaws.protocol.json.SdkJsonProtocolFactory(
new JsonClientMetadata()
.withProtocolVersion("1.1")
.withSupportsCbor(false)
.withSupportsIon(false)
.withContentTypeOverride("application/json")
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("AccessDeniedException").withExceptionUnmarshaller(
com.amazonaws.services.migrationhuborchestrator.model.transform.AccessDeniedExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("ResourceNotFoundException").withExceptionUnmarshaller(
com.amazonaws.services.migrationhuborchestrator.model.transform.ResourceNotFoundExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("ThrottlingException").withExceptionUnmarshaller(
com.amazonaws.services.migrationhuborchestrator.model.transform.ThrottlingExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("ValidationException").withExceptionUnmarshaller(
com.amazonaws.services.migrationhuborchestrator.model.transform.ValidationExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("InternalServerException").withExceptionUnmarshaller(
com.amazonaws.services.migrationhuborchestrator.model.transform.InternalServerExceptionUnmarshaller.getInstance()))
.withBaseServiceExceptionClass(com.amazonaws.services.migrationhuborchestrator.model.AWSMigrationHubOrchestratorException.class));
public static AWSMigrationHubOrchestratorClientBuilder builder() {
return AWSMigrationHubOrchestratorClientBuilder.standard();
}
/**
* Constructs a new client to invoke service methods on AWS Migration Hub Orchestrator using the specified
* parameters.
*
* <p>
* All service calls made using this new client object are blocking, and will not return until the service call
* completes.
*
* @param clientParams
* Object providing client parameters.
*/
AWSMigrationHubOrchestratorClient(AwsSyncClientParams clientParams) {
this(clientParams, false);
}
/**
* Constructs a new client to invoke service methods on AWS Migration Hub Orchestrator using the specified
* parameters.
*
* <p>
* All service calls made using this new client object are blocking, and will not return until the service call
* completes.
*
* @param clientParams
* Object providing client parameters.
*/
AWSMigrationHubOrchestratorClient(AwsSyncClientParams clientParams, boolean endpointDiscoveryEnabled) {
super(clientParams);
this.awsCredentialsProvider = clientParams.getCredentialsProvider();
this.advancedConfig = clientParams.getAdvancedConfig();
init();
}
private void init() {
setServiceNameIntern(DEFAULT_SIGNING_NAME);
setEndpointPrefix(ENDPOINT_PREFIX);
// calling this.setEndPoint(...) will also modify the signer accordingly
setEndpoint("migrationhub-orchestrator.us-east-1.amazonaws.com");
HandlerChainFactory chainFactory = new HandlerChainFactory();
requestHandler2s.addAll(chainFactory.newRequestHandlerChain("/com/amazonaws/services/migrationhuborchestrator/request.handlers"));
requestHandler2s.addAll(chainFactory.newRequestHandler2Chain("/com/amazonaws/services/migrationhuborchestrator/request.handler2s"));
requestHandler2s.addAll(chainFactory.getGlobalHandlers());
}
/**
* <p>
* Create a workflow to orchestrate your migrations.
* </p>
*
* @param createWorkflowRequest
* @return Result of the CreateWorkflow operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An internal error has occurred.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an AWS service.
* @sample AWSMigrationHubOrchestrator.CreateWorkflow
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/CreateWorkflow"
* target="_top">AWS API Documentation</a>
*/
@Override
public CreateWorkflowResult createWorkflow(CreateWorkflowRequest request) {
request = beforeClientExecution(request);
return executeCreateWorkflow(request);
}
@SdkInternalApi
final CreateWorkflowResult executeCreateWorkflow(CreateWorkflowRequest createWorkflowRequest) {
ExecutionContext executionContext = createExecutionContext(createWorkflowRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<CreateWorkflowRequest> request = null;
Response<CreateWorkflowResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new CreateWorkflowRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createWorkflowRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateWorkflow");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<CreateWorkflowResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateWorkflowResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Create a step in the migration workflow.
* </p>
*
* @param createWorkflowStepRequest
* @return Result of the CreateWorkflowStep operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An internal error has occurred.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an AWS service.
* @sample AWSMigrationHubOrchestrator.CreateWorkflowStep
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/CreateWorkflowStep"
* target="_top">AWS API Documentation</a>
*/
@Override
public CreateWorkflowStepResult createWorkflowStep(CreateWorkflowStepRequest request) {
request = beforeClientExecution(request);
return executeCreateWorkflowStep(request);
}
@SdkInternalApi
final CreateWorkflowStepResult executeCreateWorkflowStep(CreateWorkflowStepRequest createWorkflowStepRequest) {
ExecutionContext executionContext = createExecutionContext(createWorkflowStepRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<CreateWorkflowStepRequest> request = null;
Response<CreateWorkflowStepResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new CreateWorkflowStepRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createWorkflowStepRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateWorkflowStep");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<CreateWorkflowStepResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateWorkflowStepResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Create a step group in a migration workflow.
* </p>
*
* @param createWorkflowStepGroupRequest
* @return Result of the CreateWorkflowStepGroup operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An internal error has occurred.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an AWS service.
* @sample AWSMigrationHubOrchestrator.CreateWorkflowStepGroup
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/CreateWorkflowStepGroup"
* target="_top">AWS API Documentation</a>
*/
@Override
public CreateWorkflowStepGroupResult createWorkflowStepGroup(CreateWorkflowStepGroupRequest request) {
request = beforeClientExecution(request);
return executeCreateWorkflowStepGroup(request);
}
@SdkInternalApi
final CreateWorkflowStepGroupResult executeCreateWorkflowStepGroup(CreateWorkflowStepGroupRequest createWorkflowStepGroupRequest) {
ExecutionContext executionContext = createExecutionContext(createWorkflowStepGroupRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<CreateWorkflowStepGroupRequest> request = null;
Response<CreateWorkflowStepGroupResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new CreateWorkflowStepGroupRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(createWorkflowStepGroupRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateWorkflowStepGroup");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<CreateWorkflowStepGroupResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new CreateWorkflowStepGroupResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Delete a migration workflow. You must pause a running workflow in Migration Hub Orchestrator console to delete
* it.
* </p>
*
* @param deleteWorkflowRequest
* @return Result of the DeleteWorkflow operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An internal error has occurred.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an AWS service.
* @throws ResourceNotFoundException
* The resource is not available.
* @sample AWSMigrationHubOrchestrator.DeleteWorkflow
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/DeleteWorkflow"
* target="_top">AWS API Documentation</a>
*/
@Override
public DeleteWorkflowResult deleteWorkflow(DeleteWorkflowRequest request) {
request = beforeClientExecution(request);
return executeDeleteWorkflow(request);
}
@SdkInternalApi
final DeleteWorkflowResult executeDeleteWorkflow(DeleteWorkflowRequest deleteWorkflowRequest) {
ExecutionContext executionContext = createExecutionContext(deleteWorkflowRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<DeleteWorkflowRequest> request = null;
Response<DeleteWorkflowResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DeleteWorkflowRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteWorkflowRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteWorkflow");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<DeleteWorkflowResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteWorkflowResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Delete a step in a migration workflow. Pause the workflow to delete a running step.
* </p>
*
* @param deleteWorkflowStepRequest
* @return Result of the DeleteWorkflowStep operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An internal error has occurred.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an AWS service.
* @throws ResourceNotFoundException
* The resource is not available.
* @sample AWSMigrationHubOrchestrator.DeleteWorkflowStep
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/DeleteWorkflowStep"
* target="_top">AWS API Documentation</a>
*/
@Override
public DeleteWorkflowStepResult deleteWorkflowStep(DeleteWorkflowStepRequest request) {
request = beforeClientExecution(request);
return executeDeleteWorkflowStep(request);
}
@SdkInternalApi
final DeleteWorkflowStepResult executeDeleteWorkflowStep(DeleteWorkflowStepRequest deleteWorkflowStepRequest) {
ExecutionContext executionContext = createExecutionContext(deleteWorkflowStepRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<DeleteWorkflowStepRequest> request = null;
Response<DeleteWorkflowStepResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DeleteWorkflowStepRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteWorkflowStepRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteWorkflowStep");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<DeleteWorkflowStepResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteWorkflowStepResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Delete a step group in a migration workflow.
* </p>
*
* @param deleteWorkflowStepGroupRequest
* @return Result of the DeleteWorkflowStepGroup operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An internal error has occurred.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an AWS service.
* @throws ResourceNotFoundException
* The resource is not available.
* @sample AWSMigrationHubOrchestrator.DeleteWorkflowStepGroup
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/DeleteWorkflowStepGroup"
* target="_top">AWS API Documentation</a>
*/
@Override
public DeleteWorkflowStepGroupResult deleteWorkflowStepGroup(DeleteWorkflowStepGroupRequest request) {
request = beforeClientExecution(request);
return executeDeleteWorkflowStepGroup(request);
}
@SdkInternalApi
final DeleteWorkflowStepGroupResult executeDeleteWorkflowStepGroup(DeleteWorkflowStepGroupRequest deleteWorkflowStepGroupRequest) {
ExecutionContext executionContext = createExecutionContext(deleteWorkflowStepGroupRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<DeleteWorkflowStepGroupRequest> request = null;
Response<DeleteWorkflowStepGroupResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DeleteWorkflowStepGroupRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(deleteWorkflowStepGroupRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteWorkflowStepGroup");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<DeleteWorkflowStepGroupResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new DeleteWorkflowStepGroupResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Get the template you want to use for creating a migration workflow.
* </p>
*
* @param getTemplateRequest
* @return Result of the GetTemplate operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An internal error has occurred.
* @throws ResourceNotFoundException
* The resource is not available.
* @sample AWSMigrationHubOrchestrator.GetTemplate
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/GetTemplate"
* target="_top">AWS API Documentation</a>
*/
@Override
public GetTemplateResult getTemplate(GetTemplateRequest request) {
request = beforeClientExecution(request);
return executeGetTemplate(request);
}
@SdkInternalApi
final GetTemplateResult executeGetTemplate(GetTemplateRequest getTemplateRequest) {
ExecutionContext executionContext = createExecutionContext(getTemplateRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<GetTemplateRequest> request = null;
Response<GetTemplateResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetTemplateRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getTemplateRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetTemplate");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<GetTemplateResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetTemplateResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Get a specific step in a template.
* </p>
*
* @param getTemplateStepRequest
* @return Result of the GetTemplateStep operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An internal error has occurred.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an AWS service.
* @throws ResourceNotFoundException
* The resource is not available.
* @sample AWSMigrationHubOrchestrator.GetTemplateStep
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/GetTemplateStep"
* target="_top">AWS API Documentation</a>
*/
@Override
public GetTemplateStepResult getTemplateStep(GetTemplateStepRequest request) {
request = beforeClientExecution(request);
return executeGetTemplateStep(request);
}
@SdkInternalApi
final GetTemplateStepResult executeGetTemplateStep(GetTemplateStepRequest getTemplateStepRequest) {
ExecutionContext executionContext = createExecutionContext(getTemplateStepRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<GetTemplateStepRequest> request = null;
Response<GetTemplateStepResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetTemplateStepRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getTemplateStepRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetTemplateStep");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<GetTemplateStepResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetTemplateStepResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Get a step group in a template.
* </p>
*
* @param getTemplateStepGroupRequest
* @return Result of the GetTemplateStepGroup operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An internal error has occurred.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an AWS service.
* @throws ResourceNotFoundException
* The resource is not available.
* @sample AWSMigrationHubOrchestrator.GetTemplateStepGroup
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/GetTemplateStepGroup"
* target="_top">AWS API Documentation</a>
*/
@Override
public GetTemplateStepGroupResult getTemplateStepGroup(GetTemplateStepGroupRequest request) {
request = beforeClientExecution(request);
return executeGetTemplateStepGroup(request);
}
@SdkInternalApi
final GetTemplateStepGroupResult executeGetTemplateStepGroup(GetTemplateStepGroupRequest getTemplateStepGroupRequest) {
ExecutionContext executionContext = createExecutionContext(getTemplateStepGroupRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<GetTemplateStepGroupRequest> request = null;
Response<GetTemplateStepGroupResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetTemplateStepGroupRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getTemplateStepGroupRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetTemplateStepGroup");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<GetTemplateStepGroupResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetTemplateStepGroupResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Get migration workflow.
* </p>
*
* @param getWorkflowRequest
* @return Result of the GetWorkflow operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An internal error has occurred.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an AWS service.
* @throws ResourceNotFoundException
* The resource is not available.
* @sample AWSMigrationHubOrchestrator.GetWorkflow
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/GetWorkflow"
* target="_top">AWS API Documentation</a>
*/
@Override
public GetWorkflowResult getWorkflow(GetWorkflowRequest request) {
request = beforeClientExecution(request);
return executeGetWorkflow(request);
}
@SdkInternalApi
final GetWorkflowResult executeGetWorkflow(GetWorkflowRequest getWorkflowRequest) {
ExecutionContext executionContext = createExecutionContext(getWorkflowRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<GetWorkflowRequest> request = null;
Response<GetWorkflowResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetWorkflowRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getWorkflowRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetWorkflow");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<GetWorkflowResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetWorkflowResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Get a step in the migration workflow.
* </p>
*
* @param getWorkflowStepRequest
* @return Result of the GetWorkflowStep operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An internal error has occurred.
* @throws ResourceNotFoundException
* The resource is not available.
* @sample AWSMigrationHubOrchestrator.GetWorkflowStep
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/GetWorkflowStep"
* target="_top">AWS API Documentation</a>
*/
@Override
public GetWorkflowStepResult getWorkflowStep(GetWorkflowStepRequest request) {
request = beforeClientExecution(request);
return executeGetWorkflowStep(request);
}
@SdkInternalApi
final GetWorkflowStepResult executeGetWorkflowStep(GetWorkflowStepRequest getWorkflowStepRequest) {
ExecutionContext executionContext = createExecutionContext(getWorkflowStepRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<GetWorkflowStepRequest> request = null;
Response<GetWorkflowStepResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetWorkflowStepRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getWorkflowStepRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetWorkflowStep");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<GetWorkflowStepResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetWorkflowStepResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Get the step group of a migration workflow.
* </p>
*
* @param getWorkflowStepGroupRequest
* @return Result of the GetWorkflowStepGroup operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An internal error has occurred.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an AWS service.
* @throws ResourceNotFoundException
* The resource is not available.
* @sample AWSMigrationHubOrchestrator.GetWorkflowStepGroup
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/GetWorkflowStepGroup"
* target="_top">AWS API Documentation</a>
*/
@Override
public GetWorkflowStepGroupResult getWorkflowStepGroup(GetWorkflowStepGroupRequest request) {
request = beforeClientExecution(request);
return executeGetWorkflowStepGroup(request);
}
@SdkInternalApi
final GetWorkflowStepGroupResult executeGetWorkflowStepGroup(GetWorkflowStepGroupRequest getWorkflowStepGroupRequest) {
ExecutionContext executionContext = createExecutionContext(getWorkflowStepGroupRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<GetWorkflowStepGroupRequest> request = null;
Response<GetWorkflowStepGroupResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetWorkflowStepGroupRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getWorkflowStepGroupRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetWorkflowStepGroup");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<GetWorkflowStepGroupResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetWorkflowStepGroupResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* List AWS Migration Hub Orchestrator plugins.
* </p>
*
* @param listPluginsRequest
* @return Result of the ListPlugins operation returned by the service.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An internal error has occurred.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an AWS service.
* @sample AWSMigrationHubOrchestrator.ListPlugins
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/ListPlugins"
* target="_top">AWS API Documentation</a>
*/
@Override
public ListPluginsResult listPlugins(ListPluginsRequest request) {
request = beforeClientExecution(request);
return executeListPlugins(request);
}
@SdkInternalApi
final ListPluginsResult executeListPlugins(ListPluginsRequest listPluginsRequest) {
ExecutionContext executionContext = createExecutionContext(listPluginsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<ListPluginsRequest> request = null;
Response<ListPluginsResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListPluginsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listPluginsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListPlugins");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<ListPluginsResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListPluginsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* List the tags added to a resource.
* </p>
*
* @param listTagsForResourceRequest
* @return Result of the ListTagsForResource operation returned by the service.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an AWS service.
* @throws ResourceNotFoundException
* The resource is not available.
* @sample AWSMigrationHubOrchestrator.ListTagsForResource
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/ListTagsForResource"
* target="_top">AWS API Documentation</a>
*/
@Override
public ListTagsForResourceResult listTagsForResource(ListTagsForResourceRequest request) {
request = beforeClientExecution(request);
return executeListTagsForResource(request);
}
@SdkInternalApi
final ListTagsForResourceResult executeListTagsForResource(ListTagsForResourceRequest listTagsForResourceRequest) {
ExecutionContext executionContext = createExecutionContext(listTagsForResourceRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<ListTagsForResourceRequest> request = null;
Response<ListTagsForResourceResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListTagsForResourceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listTagsForResourceRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListTagsForResource");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<ListTagsForResourceResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListTagsForResourceResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* List the step groups in a template.
* </p>
*
* @param listTemplateStepGroupsRequest
* @return Result of the ListTemplateStepGroups operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An internal error has occurred.
* @throws ResourceNotFoundException
* The resource is not available.
* @sample AWSMigrationHubOrchestrator.ListTemplateStepGroups
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/ListTemplateStepGroups"
* target="_top">AWS API Documentation</a>
*/
@Override
public ListTemplateStepGroupsResult listTemplateStepGroups(ListTemplateStepGroupsRequest request) {
request = beforeClientExecution(request);
return executeListTemplateStepGroups(request);
}
@SdkInternalApi
final ListTemplateStepGroupsResult executeListTemplateStepGroups(ListTemplateStepGroupsRequest listTemplateStepGroupsRequest) {
ExecutionContext executionContext = createExecutionContext(listTemplateStepGroupsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<ListTemplateStepGroupsRequest> request = null;
Response<ListTemplateStepGroupsResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListTemplateStepGroupsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listTemplateStepGroupsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListTemplateStepGroups");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<ListTemplateStepGroupsResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new ListTemplateStepGroupsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* List the steps in a template.
* </p>
*
* @param listTemplateStepsRequest
* @return Result of the ListTemplateSteps operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An internal error has occurred.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an AWS service.
* @throws ResourceNotFoundException
* The resource is not available.
* @sample AWSMigrationHubOrchestrator.ListTemplateSteps
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/ListTemplateSteps"
* target="_top">AWS API Documentation</a>
*/
@Override
public ListTemplateStepsResult listTemplateSteps(ListTemplateStepsRequest request) {
request = beforeClientExecution(request);
return executeListTemplateSteps(request);
}
@SdkInternalApi
final ListTemplateStepsResult executeListTemplateSteps(ListTemplateStepsRequest listTemplateStepsRequest) {
ExecutionContext executionContext = createExecutionContext(listTemplateStepsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<ListTemplateStepsRequest> request = null;
Response<ListTemplateStepsResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListTemplateStepsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listTemplateStepsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListTemplateSteps");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<ListTemplateStepsResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListTemplateStepsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* List the templates available in Migration Hub Orchestrator to create a migration workflow.
* </p>
*
* @param listTemplatesRequest
* @return Result of the ListTemplates operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An internal error has occurred.
* @sample AWSMigrationHubOrchestrator.ListTemplates
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/ListTemplates"
* target="_top">AWS API Documentation</a>
*/
@Override
public ListTemplatesResult listTemplates(ListTemplatesRequest request) {
request = beforeClientExecution(request);
return executeListTemplates(request);
}
@SdkInternalApi
final ListTemplatesResult executeListTemplates(ListTemplatesRequest listTemplatesRequest) {
ExecutionContext executionContext = createExecutionContext(listTemplatesRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<ListTemplatesRequest> request = null;
Response<ListTemplatesResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListTemplatesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listTemplatesRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListTemplates");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<ListTemplatesResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListTemplatesResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* List the step groups in a migration workflow.
* </p>
*
* @param listWorkflowStepGroupsRequest
* @return Result of the ListWorkflowStepGroups operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An internal error has occurred.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an AWS service.
* @throws ResourceNotFoundException
* The resource is not available.
* @sample AWSMigrationHubOrchestrator.ListWorkflowStepGroups
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/ListWorkflowStepGroups"
* target="_top">AWS API Documentation</a>
*/
@Override
public ListWorkflowStepGroupsResult listWorkflowStepGroups(ListWorkflowStepGroupsRequest request) {
request = beforeClientExecution(request);
return executeListWorkflowStepGroups(request);
}
@SdkInternalApi
final ListWorkflowStepGroupsResult executeListWorkflowStepGroups(ListWorkflowStepGroupsRequest listWorkflowStepGroupsRequest) {
ExecutionContext executionContext = createExecutionContext(listWorkflowStepGroupsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<ListWorkflowStepGroupsRequest> request = null;
Response<ListWorkflowStepGroupsResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListWorkflowStepGroupsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listWorkflowStepGroupsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListWorkflowStepGroups");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<ListWorkflowStepGroupsResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new ListWorkflowStepGroupsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* List the steps in a workflow.
* </p>
*
* @param listWorkflowStepsRequest
* @return Result of the ListWorkflowSteps operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An internal error has occurred.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an AWS service.
* @sample AWSMigrationHubOrchestrator.ListWorkflowSteps
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/ListWorkflowSteps"
* target="_top">AWS API Documentation</a>
*/
@Override
public ListWorkflowStepsResult listWorkflowSteps(ListWorkflowStepsRequest request) {
request = beforeClientExecution(request);
return executeListWorkflowSteps(request);
}
@SdkInternalApi
final ListWorkflowStepsResult executeListWorkflowSteps(ListWorkflowStepsRequest listWorkflowStepsRequest) {
ExecutionContext executionContext = createExecutionContext(listWorkflowStepsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<ListWorkflowStepsRequest> request = null;
Response<ListWorkflowStepsResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListWorkflowStepsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listWorkflowStepsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListWorkflowSteps");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<ListWorkflowStepsResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListWorkflowStepsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* List the migration workflows.
* </p>
*
* @param listWorkflowsRequest
* @return Result of the ListWorkflows operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An internal error has occurred.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an AWS service.
* @throws ResourceNotFoundException
* The resource is not available.
* @sample AWSMigrationHubOrchestrator.ListWorkflows
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/ListWorkflows"
* target="_top">AWS API Documentation</a>
*/
@Override
public ListWorkflowsResult listWorkflows(ListWorkflowsRequest request) {
request = beforeClientExecution(request);
return executeListWorkflows(request);
}
@SdkInternalApi
final ListWorkflowsResult executeListWorkflows(ListWorkflowsRequest listWorkflowsRequest) {
ExecutionContext executionContext = createExecutionContext(listWorkflowsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<ListWorkflowsRequest> request = null;
Response<ListWorkflowsResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListWorkflowsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listWorkflowsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListWorkflows");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<ListWorkflowsResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListWorkflowsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Retry a failed step in a migration workflow.
* </p>
*
* @param retryWorkflowStepRequest
* @return Result of the RetryWorkflowStep operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An internal error has occurred.
* @throws ResourceNotFoundException
* The resource is not available.
* @sample AWSMigrationHubOrchestrator.RetryWorkflowStep
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/RetryWorkflowStep"
* target="_top">AWS API Documentation</a>
*/
@Override
public RetryWorkflowStepResult retryWorkflowStep(RetryWorkflowStepRequest request) {
request = beforeClientExecution(request);
return executeRetryWorkflowStep(request);
}
@SdkInternalApi
final RetryWorkflowStepResult executeRetryWorkflowStep(RetryWorkflowStepRequest retryWorkflowStepRequest) {
ExecutionContext executionContext = createExecutionContext(retryWorkflowStepRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<RetryWorkflowStepRequest> request = null;
Response<RetryWorkflowStepResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new RetryWorkflowStepRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(retryWorkflowStepRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "RetryWorkflowStep");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<RetryWorkflowStepResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new RetryWorkflowStepResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Start a migration workflow.
* </p>
*
* @param startWorkflowRequest
* @return Result of the StartWorkflow operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An internal error has occurred.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an AWS service.
* @throws ResourceNotFoundException
* The resource is not available.
* @sample AWSMigrationHubOrchestrator.StartWorkflow
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/StartWorkflow"
* target="_top">AWS API Documentation</a>
*/
@Override
public StartWorkflowResult startWorkflow(StartWorkflowRequest request) {
request = beforeClientExecution(request);
return executeStartWorkflow(request);
}
@SdkInternalApi
final StartWorkflowResult executeStartWorkflow(StartWorkflowRequest startWorkflowRequest) {
ExecutionContext executionContext = createExecutionContext(startWorkflowRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<StartWorkflowRequest> request = null;
Response<StartWorkflowResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new StartWorkflowRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(startWorkflowRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "StartWorkflow");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<StartWorkflowResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new StartWorkflowResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Stop an ongoing migration workflow.
* </p>
*
* @param stopWorkflowRequest
* @return Result of the StopWorkflow operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An internal error has occurred.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an AWS service.
* @throws ResourceNotFoundException
* The resource is not available.
* @sample AWSMigrationHubOrchestrator.StopWorkflow
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/StopWorkflow"
* target="_top">AWS API Documentation</a>
*/
@Override
public StopWorkflowResult stopWorkflow(StopWorkflowRequest request) {
request = beforeClientExecution(request);
return executeStopWorkflow(request);
}
@SdkInternalApi
final StopWorkflowResult executeStopWorkflow(StopWorkflowRequest stopWorkflowRequest) {
ExecutionContext executionContext = createExecutionContext(stopWorkflowRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<StopWorkflowRequest> request = null;
Response<StopWorkflowResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new StopWorkflowRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(stopWorkflowRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "StopWorkflow");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<StopWorkflowResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new StopWorkflowResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Tag a resource by specifying its Amazon Resource Name (ARN).
* </p>
*
* @param tagResourceRequest
* @return Result of the TagResource operation returned by the service.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an AWS service.
* @throws ResourceNotFoundException
* The resource is not available.
* @sample AWSMigrationHubOrchestrator.TagResource
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/TagResource"
* target="_top">AWS API Documentation</a>
*/
@Override
public TagResourceResult tagResource(TagResourceRequest request) {
request = beforeClientExecution(request);
return executeTagResource(request);
}
@SdkInternalApi
final TagResourceResult executeTagResource(TagResourceRequest tagResourceRequest) {
ExecutionContext executionContext = createExecutionContext(tagResourceRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<TagResourceRequest> request = null;
Response<TagResourceResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new TagResourceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(tagResourceRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "TagResource");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<TagResourceResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new TagResourceResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Deletes the tags for a resource.
* </p>
*
* @param untagResourceRequest
* @return Result of the UntagResource operation returned by the service.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an AWS service.
* @throws ResourceNotFoundException
* The resource is not available.
* @sample AWSMigrationHubOrchestrator.UntagResource
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/UntagResource"
* target="_top">AWS API Documentation</a>
*/
@Override
public UntagResourceResult untagResource(UntagResourceRequest request) {
request = beforeClientExecution(request);
return executeUntagResource(request);
}
@SdkInternalApi
final UntagResourceResult executeUntagResource(UntagResourceRequest untagResourceRequest) {
ExecutionContext executionContext = createExecutionContext(untagResourceRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<UntagResourceRequest> request = null;
Response<UntagResourceResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new UntagResourceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(untagResourceRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UntagResource");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<UntagResourceResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UntagResourceResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Update a migration workflow.
* </p>
*
* @param updateWorkflowRequest
* @return Result of the UpdateWorkflow operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An internal error has occurred.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an AWS service.
* @throws ResourceNotFoundException
* The resource is not available.
* @sample AWSMigrationHubOrchestrator.UpdateWorkflow
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/UpdateWorkflow"
* target="_top">AWS API Documentation</a>
*/
@Override
public UpdateWorkflowResult updateWorkflow(UpdateWorkflowRequest request) {
request = beforeClientExecution(request);
return executeUpdateWorkflow(request);
}
@SdkInternalApi
final UpdateWorkflowResult executeUpdateWorkflow(UpdateWorkflowRequest updateWorkflowRequest) {
ExecutionContext executionContext = createExecutionContext(updateWorkflowRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<UpdateWorkflowRequest> request = null;
Response<UpdateWorkflowResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new UpdateWorkflowRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(updateWorkflowRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateWorkflow");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<UpdateWorkflowResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UpdateWorkflowResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Update a step in a migration workflow.
* </p>
*
* @param updateWorkflowStepRequest
* @return Result of the UpdateWorkflowStep operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An internal error has occurred.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an AWS service.
* @sample AWSMigrationHubOrchestrator.UpdateWorkflowStep
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/UpdateWorkflowStep"
* target="_top">AWS API Documentation</a>
*/
@Override
public UpdateWorkflowStepResult updateWorkflowStep(UpdateWorkflowStepRequest request) {
request = beforeClientExecution(request);
return executeUpdateWorkflowStep(request);
}
@SdkInternalApi
final UpdateWorkflowStepResult executeUpdateWorkflowStep(UpdateWorkflowStepRequest updateWorkflowStepRequest) {
ExecutionContext executionContext = createExecutionContext(updateWorkflowStepRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<UpdateWorkflowStepRequest> request = null;
Response<UpdateWorkflowStepResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new UpdateWorkflowStepRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(updateWorkflowStepRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateWorkflowStep");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<UpdateWorkflowStepResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UpdateWorkflowStepResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Update the step group in a migration workflow.
* </p>
*
* @param updateWorkflowStepGroupRequest
* @return Result of the UpdateWorkflowStepGroup operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An internal error has occurred.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an AWS service.
* @throws ResourceNotFoundException
* The resource is not available.
* @sample AWSMigrationHubOrchestrator.UpdateWorkflowStepGroup
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/migrationhuborchestrator-2021-08-28/UpdateWorkflowStepGroup"
* target="_top">AWS API Documentation</a>
*/
@Override
public UpdateWorkflowStepGroupResult updateWorkflowStepGroup(UpdateWorkflowStepGroupRequest request) {
request = beforeClientExecution(request);
return executeUpdateWorkflowStepGroup(request);
}
@SdkInternalApi
final UpdateWorkflowStepGroupResult executeUpdateWorkflowStepGroup(UpdateWorkflowStepGroupRequest updateWorkflowStepGroupRequest) {
ExecutionContext executionContext = createExecutionContext(updateWorkflowStepGroupRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<UpdateWorkflowStepGroupRequest> request = null;
Response<UpdateWorkflowStepGroupResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new UpdateWorkflowStepGroupRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(updateWorkflowStepGroupRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MigrationHubOrchestrator");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateWorkflowStepGroup");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<UpdateWorkflowStepGroupResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new UpdateWorkflowStepGroupResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* Returns additional metadata for a previously executed successful, request, typically used for debugging issues
* where a service isn't acting as expected. This data isn't considered part of the result data returned by an
* operation, so it's available through this separate, diagnostic interface.
* <p>
* Response metadata is only cached for a limited period of time, so if you need to access this extra diagnostic
* information for an executed request, you should use this method to retrieve it as soon as possible after
* executing the request.
*
* @param request
* The originally executed request
*
* @return The response metadata for the specified request, or null if none is available.
*/
public ResponseMetadata getCachedResponseMetadata(AmazonWebServiceRequest request) {
return client.getResponseMetadataForRequest(request);
}
/**
* Normal invoke with authentication. Credentials are required and may be overriden at the request level.
**/
private <X, Y extends AmazonWebServiceRequest> Response<X> invoke(Request<Y> request, HttpResponseHandler<AmazonWebServiceResponse<X>> responseHandler,
ExecutionContext executionContext) {
return invoke(request, responseHandler, executionContext, null, null);
}
/**
* Normal invoke with authentication. Credentials are required and may be overriden at the request level.
**/
private <X, Y extends AmazonWebServiceRequest> Response<X> invoke(Request<Y> request, HttpResponseHandler<AmazonWebServiceResponse<X>> responseHandler,
ExecutionContext executionContext, URI cachedEndpoint, URI uriFromEndpointTrait) {
executionContext.setCredentialsProvider(CredentialUtils.getCredentialsProvider(request.getOriginalRequest(), awsCredentialsProvider));
return doInvoke(request, responseHandler, executionContext, cachedEndpoint, uriFromEndpointTrait);
}
/**
* Invoke with no authentication. Credentials are not required and any credentials set on the client or request will
* be ignored for this operation.
**/
private <X, Y extends AmazonWebServiceRequest> Response<X> anonymousInvoke(Request<Y> request,
HttpResponseHandler<AmazonWebServiceResponse<X>> responseHandler, ExecutionContext executionContext) {
return doInvoke(request, responseHandler, executionContext, null, null);
}
/**
* Invoke the request using the http client. Assumes credentials (or lack thereof) have been configured in the
* ExecutionContext beforehand.
**/
private <X, Y extends AmazonWebServiceRequest> Response<X> doInvoke(Request<Y> request, HttpResponseHandler<AmazonWebServiceResponse<X>> responseHandler,
ExecutionContext executionContext, URI discoveredEndpoint, URI uriFromEndpointTrait) {
if (discoveredEndpoint != null) {
request.setEndpoint(discoveredEndpoint);
request.getOriginalRequest().getRequestClientOptions().appendUserAgent("endpoint-discovery");
} else if (uriFromEndpointTrait != null) {
request.setEndpoint(uriFromEndpointTrait);
} else {
request.setEndpoint(endpoint);
}
request.setTimeOffset(timeOffset);
HttpResponseHandler<AmazonServiceException> errorResponseHandler = protocolFactory.createErrorResponseHandler(new JsonErrorResponseMetadata());
return client.execute(request, responseHandler, errorResponseHandler, executionContext);
}
@com.amazonaws.annotation.SdkInternalApi
static com.amazonaws.protocol.json.SdkJsonProtocolFactory getProtocolFactory() {
return protocolFactory;
}
@Override
public void shutdown() {
super.shutdown();
}
}
| 100,071 | 0.706109 | 0.70366 | 2,014 | 48.687687 | 40.972565 | 160 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.499503 | false | false | 1 |
091dbc2d00408c8d2c0c0d2ab1d726cbff375763 | 32,684,701,173,776 | 4b0ef9af806109b9f9aae42fa891dc0d22efdfce | /src/chatroom/client/ui/LoginPanel.java | 7ae61067c6dd6b676b07227b6077c7632ca5835a | [] | no_license | RomainHP/ACS_ChatRoom | https://github.com/RomainHP/ACS_ChatRoom | 569c1c9f34a6e149062a66564280e3bce9d87829 | 8df0172f701865dafa5f481654290def159793c2 | refs/heads/master | 2021-09-12T14:28:16.919000 | 2018-04-17T16:11:05 | 2018-04-17T16:11:05 | 126,483,117 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package chatroom.client.ui;
import chatroom.client.Client;
import chatroom.exception.*;
import chatroom.server.Login;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;
/**
* Login interface
*/
class LoginPanel extends JPanel {
private static final long serialVersionUID = -301099811934446277L;
private JList<String> chatroomsList;
private final JButton btnConfirm;
private final JButton actualizeButton;
private final Client client;
public LoginPanel(MainFrame frame, Login log, Client client) throws RemoteException {
this.setLayout(new BorderLayout());
this.client = client;
Box verticalBox = Box.createVerticalBox();
this.add(verticalBox, BorderLayout.WEST);
JLabel lblPseudo = new JLabel("Nickname :");
verticalBox.add(lblPseudo);
JTextField pseudoTextField = new JTextField();
verticalBox.add(pseudoTextField);
pseudoTextField.setColumns(10);
JLabel lblLogin = new JLabel("Login");
lblLogin.setHorizontalAlignment(SwingConstants.CENTER);
this.add(lblLogin, BorderLayout.NORTH);
btnConfirm = new JButton("Confirm");
this.add(btnConfirm, BorderLayout.SOUTH);
JTabbedPane tabPane = new JTabbedPane(JTabbedPane.TOP);
this.add(tabPane, BorderLayout.CENTER);
Box chatroomScrollPane = Box.createVerticalBox();
tabPane.addTab("Join", null, chatroomScrollPane, null);
Box selectBox = Box.createHorizontalBox();
JLabel lblChatroom = new JLabel("Select a ChatRoom :");
selectBox.add(lblChatroom);
selectBox.add(Box.createHorizontalGlue());
actualizeButton = new JButton("Actualize");
selectBox.add(actualizeButton);
chatroomScrollPane.add(selectBox, BorderLayout.NORTH);
this.chatroomsList = new JList<>(log.getAllChatRoom());
JScrollPane scrollPane = new JScrollPane(chatroomsList);
chatroomScrollPane.add(scrollPane);
Box verticalBox_2 = Box.createVerticalBox();
tabPane.addTab("Create", null, verticalBox_2, null);
JLabel chatroomLabel = new JLabel("ChatRoom :");
verticalBox_2.add(chatroomLabel);
JTextField chatroomTextField = new JTextField();
verticalBox_2.add(chatroomTextField);
chatroomTextField.setColumns(10);
JLabel lblPassword = new JLabel("Password :");
verticalBox_2.add(lblPassword);
JPasswordField passwordTextField = new JPasswordField();
passwordTextField.setColumns(10);
verticalBox_2.add(passwordTextField);
JLabel lblMaxUsers = new JLabel("Max Users :");
verticalBox_2.add(lblMaxUsers);
IncrementPanel maxUsersPanel = new IncrementPanel();
verticalBox_2.add(maxUsersPanel);
// actualize the list of chatroom
actualizeButton.addActionListener((ActionEvent arg0) -> {
try {
LoginPanel.this.chatroomsList.setListData(log.getAllChatRoom());
} catch (RemoteException e) {
ExceptionPopup.showError(e);
}
});
// launch the chat
btnConfirm.addActionListener((ActionEvent arg0) -> {
try {
// nickname
String pseudo = pseudoTextField.getText();
if (!Client.verifyName(pseudo)) {
throw new UncorrectNameException("nickname");
}
// chat
String chat;
// password
String password = "";
// number max of users
int max_users = 10;
// tab choose a chatroom
if (tabPane.getSelectedIndex() == 0) {
if (chatroomsList.isSelectionEmpty()) {
return;
}
chat = chatroomsList.getSelectedValue();
if (log.isPrivateChatroom(chat)) {
password = PasswordPopup.askPassword();
}
// tab create a chatroom
} else {
chat = chatroomTextField.getText();
password = passwordTextField.getText();
if (!Client.verifyName(chat)) {
throw new UncorrectNameException("chat");
}
max_users = maxUsersPanel.getVal();
}
//client.setNickname(pseudo);
// no password
if (password.trim().length() == 0) {
if (max_users > 0) {
client.setNickname(client.connect(pseudo, chat, max_users), pseudo);
} else {
throw new IncorrectMaxUsers();
}
// password
} else {
if (!Client.verifyName(password)) {
throw new UncorrectNameException("password");
}
if (max_users > 0) {
client.setNickname(client.connect(pseudo, chat, password, max_users), pseudo);
} else {
throw new IncorrectMaxUsers();
}
}
frame.changeView(LoginPanel.this, chat, client.getSession());
} catch (MaxConnectionException | WrongPasswordException | NicknameNotAvailableException | NotBoundException | UncorrectNameException | IncorrectMaxUsers | IOException e) {
ExceptionPopup.showError(e);
}
});
}
public void setConfirmAction(ActionListener act) {
this.btnConfirm.addActionListener(act);
}
public void setActualizeAction(ActionListener act) {
this.actualizeButton.addActionListener(act);
}
public Client getClient() {
return this.client;
}
}
| UTF-8 | Java | 6,270 | java | LoginPanel.java | Java | [] | null | [] | package chatroom.client.ui;
import chatroom.client.Client;
import chatroom.exception.*;
import chatroom.server.Login;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;
/**
* Login interface
*/
class LoginPanel extends JPanel {
private static final long serialVersionUID = -301099811934446277L;
private JList<String> chatroomsList;
private final JButton btnConfirm;
private final JButton actualizeButton;
private final Client client;
public LoginPanel(MainFrame frame, Login log, Client client) throws RemoteException {
this.setLayout(new BorderLayout());
this.client = client;
Box verticalBox = Box.createVerticalBox();
this.add(verticalBox, BorderLayout.WEST);
JLabel lblPseudo = new JLabel("Nickname :");
verticalBox.add(lblPseudo);
JTextField pseudoTextField = new JTextField();
verticalBox.add(pseudoTextField);
pseudoTextField.setColumns(10);
JLabel lblLogin = new JLabel("Login");
lblLogin.setHorizontalAlignment(SwingConstants.CENTER);
this.add(lblLogin, BorderLayout.NORTH);
btnConfirm = new JButton("Confirm");
this.add(btnConfirm, BorderLayout.SOUTH);
JTabbedPane tabPane = new JTabbedPane(JTabbedPane.TOP);
this.add(tabPane, BorderLayout.CENTER);
Box chatroomScrollPane = Box.createVerticalBox();
tabPane.addTab("Join", null, chatroomScrollPane, null);
Box selectBox = Box.createHorizontalBox();
JLabel lblChatroom = new JLabel("Select a ChatRoom :");
selectBox.add(lblChatroom);
selectBox.add(Box.createHorizontalGlue());
actualizeButton = new JButton("Actualize");
selectBox.add(actualizeButton);
chatroomScrollPane.add(selectBox, BorderLayout.NORTH);
this.chatroomsList = new JList<>(log.getAllChatRoom());
JScrollPane scrollPane = new JScrollPane(chatroomsList);
chatroomScrollPane.add(scrollPane);
Box verticalBox_2 = Box.createVerticalBox();
tabPane.addTab("Create", null, verticalBox_2, null);
JLabel chatroomLabel = new JLabel("ChatRoom :");
verticalBox_2.add(chatroomLabel);
JTextField chatroomTextField = new JTextField();
verticalBox_2.add(chatroomTextField);
chatroomTextField.setColumns(10);
JLabel lblPassword = new JLabel("Password :");
verticalBox_2.add(lblPassword);
JPasswordField passwordTextField = new JPasswordField();
passwordTextField.setColumns(10);
verticalBox_2.add(passwordTextField);
JLabel lblMaxUsers = new JLabel("Max Users :");
verticalBox_2.add(lblMaxUsers);
IncrementPanel maxUsersPanel = new IncrementPanel();
verticalBox_2.add(maxUsersPanel);
// actualize the list of chatroom
actualizeButton.addActionListener((ActionEvent arg0) -> {
try {
LoginPanel.this.chatroomsList.setListData(log.getAllChatRoom());
} catch (RemoteException e) {
ExceptionPopup.showError(e);
}
});
// launch the chat
btnConfirm.addActionListener((ActionEvent arg0) -> {
try {
// nickname
String pseudo = pseudoTextField.getText();
if (!Client.verifyName(pseudo)) {
throw new UncorrectNameException("nickname");
}
// chat
String chat;
// password
String password = "";
// number max of users
int max_users = 10;
// tab choose a chatroom
if (tabPane.getSelectedIndex() == 0) {
if (chatroomsList.isSelectionEmpty()) {
return;
}
chat = chatroomsList.getSelectedValue();
if (log.isPrivateChatroom(chat)) {
password = PasswordPopup.askPassword();
}
// tab create a chatroom
} else {
chat = chatroomTextField.getText();
password = passwordTextField.getText();
if (!Client.verifyName(chat)) {
throw new UncorrectNameException("chat");
}
max_users = maxUsersPanel.getVal();
}
//client.setNickname(pseudo);
// no password
if (password.trim().length() == 0) {
if (max_users > 0) {
client.setNickname(client.connect(pseudo, chat, max_users), pseudo);
} else {
throw new IncorrectMaxUsers();
}
// password
} else {
if (!Client.verifyName(password)) {
throw new UncorrectNameException("password");
}
if (max_users > 0) {
client.setNickname(client.connect(pseudo, chat, password, max_users), pseudo);
} else {
throw new IncorrectMaxUsers();
}
}
frame.changeView(LoginPanel.this, chat, client.getSession());
} catch (MaxConnectionException | WrongPasswordException | NicknameNotAvailableException | NotBoundException | UncorrectNameException | IncorrectMaxUsers | IOException e) {
ExceptionPopup.showError(e);
}
});
}
public void setConfirmAction(ActionListener act) {
this.btnConfirm.addActionListener(act);
}
public void setActualizeAction(ActionListener act) {
this.actualizeButton.addActionListener(act);
}
public Client getClient() {
return this.client;
}
}
| 6,270 | 0.563796 | 0.557416 | 176 | 33.625 | 26.232706 | 184 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.653409 | false | false | 1 |
e67be79e95d65bc16d5efbdbfc6d21e56ee4677d | 32,744,830,687,912 | 820c487f5d00f9c7c9f231f682db68efc7ce6f66 | /MobileProject/src/main/java/com/example/demo/dao/RuleDao.java | f3d4686275b28ca18a6853dafeea166eeb8cb13b | [] | no_license | anggasenna/MobileProject | https://github.com/anggasenna/MobileProject | 4cd3d4ed35e59e90a499ca7706df64cd9a533544 | 82d55a40c842b0bc6ab258a9ce1872fa46c296b1 | refs/heads/master | 2020-03-23T14:46:13.500000 | 2018-08-29T07:50:22 | 2018-08-29T07:50:22 | 141,698,253 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.demo.dao;
import com.example.demo.model.Rule;
import com.example.demo.model.Status;
import com.example.demo.model.TipePengajuan;
public interface RuleDao {
public Rule findNextStatus(TipePengajuan tipe, Status status);
}
| UTF-8 | Java | 247 | java | RuleDao.java | Java | [] | null | [] | package com.example.demo.dao;
import com.example.demo.model.Rule;
import com.example.demo.model.Status;
import com.example.demo.model.TipePengajuan;
public interface RuleDao {
public Rule findNextStatus(TipePengajuan tipe, Status status);
}
| 247 | 0.797571 | 0.797571 | 11 | 21.454546 | 21.22333 | 63 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.727273 | false | false | 1 |
e6c3b6f7ac97b477e1c01fd631e16ea301df40f7 | 14,190,571,991,523 | 945bf2e624da695ec1b5cab5145e72d66c0dff8a | /20190717/Test028.java | a4f2e525348ca01085f1d6d501418f81427d04d3 | [] | no_license | alexjime/jeju_java_study | https://github.com/alexjime/jeju_java_study | c6294f74345b7dfcaa41d3bf9ac1a12052a05024 | 046433bb47adab93783c9c70f46c6441b454c13f | refs/heads/master | 2022-01-29T19:37:37.879000 | 2019-08-01T01:01:23 | 2019-08-01T01:01:23 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | class Apple{
int data=0;
//return ๊ฐ์ด ์กด์ฌํ์ง ์๋ ํจ์๋ฅผ ์๋ธ๋ฃจํด์ด๋ผ ํ๋ค.
//์ด๋ฐ๊ฒฝ์ฐ return type์ void๋ก ์ ์ธํ๋ฉด ๋๋ค.
//ํจ์ ํ๋์ ๊ธธ์ด๊ฐ ํฌ๋ค๊ณ ํด์ ์ธ์คํด์ค๋ฅผ ๋ง์ด ์์ฑํ๋ฉด ๋ฉ๋ชจ๋ฆฌ์ ๋ถ๋ด๊ฐ๋? NO
//์? ์ค๋๊ณผ์ : ๋๋ ์ค temp04.cํ์ผ์ ๋ถ์ํด์ java์ ๋น๊ตํด์ ๋ฆฌํฌํธ ์์ฑ.
void print(){
System.out.println(this.data);
//๋ฉค๋ฒํจ์ ์์์ ์์ ์ด ์์๋ ์ธ์คํด์ค์ ๋ํ ํฌ์ธํฐ๋ฅผ ์ฌ์ฉ๊ฐ๋ฅ: this
}
}
public class Test028{
public static void main(String[] args){
Apple t = new Apple();
t.data = 10;
t.print();
Apple l = new Apple();
l.data = 20;
l.print();
}
} | UHC | Java | 704 | java | Test028.java | Java | [] | null | [] | class Apple{
int data=0;
//return ๊ฐ์ด ์กด์ฌํ์ง ์๋ ํจ์๋ฅผ ์๋ธ๋ฃจํด์ด๋ผ ํ๋ค.
//์ด๋ฐ๊ฒฝ์ฐ return type์ void๋ก ์ ์ธํ๋ฉด ๋๋ค.
//ํจ์ ํ๋์ ๊ธธ์ด๊ฐ ํฌ๋ค๊ณ ํด์ ์ธ์คํด์ค๋ฅผ ๋ง์ด ์์ฑํ๋ฉด ๋ฉ๋ชจ๋ฆฌ์ ๋ถ๋ด๊ฐ๋? NO
//์? ์ค๋๊ณผ์ : ๋๋ ์ค temp04.cํ์ผ์ ๋ถ์ํด์ java์ ๋น๊ตํด์ ๋ฆฌํฌํธ ์์ฑ.
void print(){
System.out.println(this.data);
//๋ฉค๋ฒํจ์ ์์์ ์์ ์ด ์์๋ ์ธ์คํด์ค์ ๋ํ ํฌ์ธํฐ๋ฅผ ์ฌ์ฉ๊ฐ๋ฅ: this
}
}
public class Test028{
public static void main(String[] args){
Apple t = new Apple();
t.data = 10;
t.print();
Apple l = new Apple();
l.data = 20;
l.print();
}
} | 704 | 0.648305 | 0.627119 | 21 | 21.523809 | 15.604087 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.571429 | false | false | 1 |
e1a940f60903e15d92307cb38b308398cde7ac9f | 22,917,945,541,597 | 5cfbbde5055b556f374ea169630cd8fff4cd859a | /manageComplex/src/main/java/com/manage/complex/controller/SigninController.java | d38714502d87db417c1663101d9192b1f96aaeec | [] | no_license | anuragalw/manageComplex | https://github.com/anuragalw/manageComplex | e5ddb6c37d22ae164917c1bd33d386139097cea6 | e938ccf91e12befe6ea23a0ccff4d61cd9b94dd4 | refs/heads/master | 2021-01-02T09:35:07.284000 | 2013-10-18T09:26:27 | 2013-10-18T09:26:27 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
*
*/
package com.manage.complex.controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import com.manage.complex.model.SignupModel;
import com.manage.complex.service.SignupService;
import com.manage.complex.util.ManageComplexConstant;
/**
* @author kumaamre
*
*/
@Controller
public class SigninController implements ManageComplexConstant {
@Autowired
private SignupService signupService;
@RequestMapping(value = SIGN_IN, method = RequestMethod.GET)
public ModelAndView getSignupPage(
HttpServletRequest request,
HttpServletResponse response,
@ModelAttribute(SIGN_UP_MODEL) SignupModel signupModel) {
ModelAndView mv = null;
mv = new ModelAndView(SIGN_IN);
return mv;
}
@RequestMapping(value = SIGN_IN, method = RequestMethod.POST)
public ModelAndView geSignupPage(
HttpServletRequest request,
HttpServletResponse response,
@ModelAttribute(SIGN_UP_MODEL) SignupModel signupModel) {
ModelAndView mv = null;
mv = new ModelAndView(SIGN_IN_SUCCESS);
boolean isSignSucessfull = signupService.isSignSucessfull(signupModel);
if(isSignSucessfull){
// go to homepage
mv.addObject("msg","successfully");
}else{
mv.addObject("msg","fail");
}
// else error message
return mv;
}
}
| UTF-8 | Java | 1,667 | java | SigninController.java | Java | [
{
"context": "omplex.util.ManageComplexConstant;\n\n/**\n * @author kumaamre\n * \n */\n@Controller\npublic class SigninController",
"end": 673,
"score": 0.9997310638427734,
"start": 665,
"tag": "USERNAME",
"value": "kumaamre"
}
] | null | [] | /**
*
*/
package com.manage.complex.controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import com.manage.complex.model.SignupModel;
import com.manage.complex.service.SignupService;
import com.manage.complex.util.ManageComplexConstant;
/**
* @author kumaamre
*
*/
@Controller
public class SigninController implements ManageComplexConstant {
@Autowired
private SignupService signupService;
@RequestMapping(value = SIGN_IN, method = RequestMethod.GET)
public ModelAndView getSignupPage(
HttpServletRequest request,
HttpServletResponse response,
@ModelAttribute(SIGN_UP_MODEL) SignupModel signupModel) {
ModelAndView mv = null;
mv = new ModelAndView(SIGN_IN);
return mv;
}
@RequestMapping(value = SIGN_IN, method = RequestMethod.POST)
public ModelAndView geSignupPage(
HttpServletRequest request,
HttpServletResponse response,
@ModelAttribute(SIGN_UP_MODEL) SignupModel signupModel) {
ModelAndView mv = null;
mv = new ModelAndView(SIGN_IN_SUCCESS);
boolean isSignSucessfull = signupService.isSignSucessfull(signupModel);
if(isSignSucessfull){
// go to homepage
mv.addObject("msg","successfully");
}else{
mv.addObject("msg","fail");
}
// else error message
return mv;
}
}
| 1,667 | 0.773845 | 0.773845 | 65 | 24.646154 | 23.009985 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.523077 | false | false | 1 |
1553451d5eafa81b74f30b5e30d0dfaef7147ef1 | 22,952,305,288,348 | 4a5ff5b823f11a98cfe6b6538f49621b9204508c | /thoughts/src/main/java/com/r3Tech/Thoughts/Utils/entItem.java | 460c44fa884fab0e46be5275827c750a26a11aa1 | [] | no_license | rudrik/Thoughts | https://github.com/rudrik/Thoughts | d249c1fb7965991e8bf4b847fd08b4f76a57c304 | 0619147ba28f6b131fe8bf96385e8ffdfa48461c | refs/heads/master | 2021-01-17T23:35:10.050000 | 2017-03-07T17:41:19 | 2017-03-07T17:41:19 | 84,228,173 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.r3Tech.Thoughts.Utils;
import android.content.Context;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONArray;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
public class entItem {
// ------------------------------------------------------------------------------------------------------------ Properties
public Integer ID;
public String CATEGORY;
public String TAGS;
public String CONTENT_TYPE;
public String TITLE;
public String SMALL_DESC;
public String FULL_DESC;
public String THUMB_URL;
public String EXTERNAL_URL;
public String ATTRIBUTION;
public String PUBLISH_DATE;
public Integer VIEWS;
public Integer LIKES;
public Integer IS_FAV;
// ------------------------------------------------------------------------------------------------------------ getItems
public List<entItem> getItems(Context context, int pageNumber, String category, String displayMode) throws Exception {
try {
List<NameValuePair> _parameters = new ArrayList<NameValuePair>();
if (displayMode.equals("latest") || displayMode.equals("popular")) {
_parameters.add(new BasicNameValuePair("function", "GetContentList"));
_parameters.add(new BasicNameValuePair("pagenumber", String.valueOf(pageNumber)));
_parameters.add(new BasicNameValuePair("category", String.valueOf(category)));
_parameters.add(new BasicNameValuePair("dispmode", displayMode));
_parameters.add(new BasicNameValuePair("foros", "android"));
} else if (displayMode.equals("fav")) {
_parameters.add(new BasicNameValuePair("function", "GetUserFavList"));
Integer _uid = new clsPrefes(context).getUserId();
_parameters.add(new BasicNameValuePair("uniqueuserid", String.valueOf(_uid)));
_parameters.add(new BasicNameValuePair("pagenumber", String.valueOf(pageNumber)));
_parameters.add(new BasicNameValuePair("foros", "android"));
}
String _jsonContent = new clsGeneral().GetJSONContentFromInternetService(context, _parameters, true);
JSONArray _jArr = new JSONArray(_jsonContent);
List<entItem> _items = new ArrayList<entItem>();
for (int _i = 0; _i < _jArr.length(); _i++) {
JSONObject _jObj = _jArr.getJSONObject(_i);
entItem _item = new entItem();
_item.ID = _jObj.getInt("Id");
_item.CATEGORY = _jObj.getString("Category");
_item.CONTENT_TYPE = _jObj.getString("ContentType");
_item.TITLE = _jObj.getString("Title");
_item.SMALL_DESC = _jObj.getString("SmallDesc");
_item.THUMB_URL = _jObj.getString("ThumbURL");
_item.PUBLISH_DATE = _jObj.getString("PublishDate");
_item.VIEWS = _jObj.getInt("Views");
_item.LIKES = _jObj.getInt("Likes");
_items.add(_item);
}
return _items;
} catch (Exception ex) {
throw ex;
}
}
// ------------------------------------------------------------------------------------------------------------ getItem
public entItem getItem(Context context, int id) throws Exception {
try {
List<NameValuePair> _parameters = new ArrayList<NameValuePair>();
_parameters.add(new BasicNameValuePair("function", "GetContentDetail"));
_parameters.add(new BasicNameValuePair("contentid", String.valueOf(id)));
_parameters.add(new BasicNameValuePair("foros", "android"));
_parameters.add(new BasicNameValuePair("uniqueuserid", String.valueOf(new clsPrefes(context).getUserId())));
String _jsonContent = new clsGeneral().GetJSONContentFromInternetService(context, _parameters, true);
entItem _item = new entItem();
JSONArray _jArr = new JSONArray(_jsonContent);
if (_jArr.length() == 0) return _item;
JSONObject _jObj = _jArr.getJSONObject(0);
_item.ID = _jObj.getInt("Id");
_item.CATEGORY = _jObj.getString("Category");
_item.TAGS = _jObj.getString("Tags");
_item.CONTENT_TYPE = _jObj.getString("ContentType");
_item.TITLE = _jObj.getString("Title");
_item.SMALL_DESC = _jObj.getString("SmallDesc");
_item.FULL_DESC = _jObj.getString("FullDesc").replace("\\n", "\n").replace("\\'", "\'");
_item.THUMB_URL = _jObj.getString("ThumbURL");
_item.EXTERNAL_URL = _jObj.getString("ExternalURL");
_item.ATTRIBUTION = _jObj.getString("Attribution");
_item.PUBLISH_DATE = _jObj.getString("PublishDate");
_item.VIEWS = _jObj.getInt("Views");
_item.LIKES = _jObj.getInt("Likes");
_item.IS_FAV = _jObj.getInt("IsUserFav");
return _item;
} catch (Exception ex) {
throw ex;
}
}
// ------------------------------------------------------------------------------------------------------------ increaseLikeCount
public void increaseLikeCount(Context context, Integer id) throws Exception {
try {
List<NameValuePair> _parameters = new ArrayList<NameValuePair>();
_parameters.add(new BasicNameValuePair("function", "UpdateLikeCount"));
_parameters.add(new BasicNameValuePair("contentid", String.valueOf(id)));
_parameters.add(new BasicNameValuePair("foros", "android"));
String _jsonContent = new clsGeneral().GetJSONContentFromInternetService(context, _parameters, true);
JSONObject _jObj = new JSONObject(_jsonContent);
if (_jObj.getString("message") == "success") {
// OK RESULT
}
} catch (Exception ex) {
throw ex;
}
}
// ------------------------------------------------------------------------------------------------------------ addToFavList
public void addToFavList(Context context, Integer id, String action) throws Exception {
try {
List<NameValuePair> _parameters = new ArrayList<NameValuePair>();
_parameters.add(new BasicNameValuePair("function", "UpdateUserFavs"));
Integer _uid = new clsPrefes(context).getUserId();
_parameters.add(new BasicNameValuePair("uniqueuserid", String.valueOf(_uid)));
_parameters.add(new BasicNameValuePair("action", action));
_parameters.add(new BasicNameValuePair("itemid", String.valueOf(id)));
String _jsonContent = new clsGeneral().GetJSONContentFromInternetService(context, _parameters, true);
JSONObject _jObj = new JSONObject(_jsonContent);
if (_jObj.getString("message") == "success") {
// OK RESULT
}
} catch (Exception ex) {
throw ex;
}
}
}
| UTF-8 | Java | 7,117 | java | entItem.java | Java | [] | null | [] | package com.r3Tech.Thoughts.Utils;
import android.content.Context;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONArray;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
public class entItem {
// ------------------------------------------------------------------------------------------------------------ Properties
public Integer ID;
public String CATEGORY;
public String TAGS;
public String CONTENT_TYPE;
public String TITLE;
public String SMALL_DESC;
public String FULL_DESC;
public String THUMB_URL;
public String EXTERNAL_URL;
public String ATTRIBUTION;
public String PUBLISH_DATE;
public Integer VIEWS;
public Integer LIKES;
public Integer IS_FAV;
// ------------------------------------------------------------------------------------------------------------ getItems
public List<entItem> getItems(Context context, int pageNumber, String category, String displayMode) throws Exception {
try {
List<NameValuePair> _parameters = new ArrayList<NameValuePair>();
if (displayMode.equals("latest") || displayMode.equals("popular")) {
_parameters.add(new BasicNameValuePair("function", "GetContentList"));
_parameters.add(new BasicNameValuePair("pagenumber", String.valueOf(pageNumber)));
_parameters.add(new BasicNameValuePair("category", String.valueOf(category)));
_parameters.add(new BasicNameValuePair("dispmode", displayMode));
_parameters.add(new BasicNameValuePair("foros", "android"));
} else if (displayMode.equals("fav")) {
_parameters.add(new BasicNameValuePair("function", "GetUserFavList"));
Integer _uid = new clsPrefes(context).getUserId();
_parameters.add(new BasicNameValuePair("uniqueuserid", String.valueOf(_uid)));
_parameters.add(new BasicNameValuePair("pagenumber", String.valueOf(pageNumber)));
_parameters.add(new BasicNameValuePair("foros", "android"));
}
String _jsonContent = new clsGeneral().GetJSONContentFromInternetService(context, _parameters, true);
JSONArray _jArr = new JSONArray(_jsonContent);
List<entItem> _items = new ArrayList<entItem>();
for (int _i = 0; _i < _jArr.length(); _i++) {
JSONObject _jObj = _jArr.getJSONObject(_i);
entItem _item = new entItem();
_item.ID = _jObj.getInt("Id");
_item.CATEGORY = _jObj.getString("Category");
_item.CONTENT_TYPE = _jObj.getString("ContentType");
_item.TITLE = _jObj.getString("Title");
_item.SMALL_DESC = _jObj.getString("SmallDesc");
_item.THUMB_URL = _jObj.getString("ThumbURL");
_item.PUBLISH_DATE = _jObj.getString("PublishDate");
_item.VIEWS = _jObj.getInt("Views");
_item.LIKES = _jObj.getInt("Likes");
_items.add(_item);
}
return _items;
} catch (Exception ex) {
throw ex;
}
}
// ------------------------------------------------------------------------------------------------------------ getItem
public entItem getItem(Context context, int id) throws Exception {
try {
List<NameValuePair> _parameters = new ArrayList<NameValuePair>();
_parameters.add(new BasicNameValuePair("function", "GetContentDetail"));
_parameters.add(new BasicNameValuePair("contentid", String.valueOf(id)));
_parameters.add(new BasicNameValuePair("foros", "android"));
_parameters.add(new BasicNameValuePair("uniqueuserid", String.valueOf(new clsPrefes(context).getUserId())));
String _jsonContent = new clsGeneral().GetJSONContentFromInternetService(context, _parameters, true);
entItem _item = new entItem();
JSONArray _jArr = new JSONArray(_jsonContent);
if (_jArr.length() == 0) return _item;
JSONObject _jObj = _jArr.getJSONObject(0);
_item.ID = _jObj.getInt("Id");
_item.CATEGORY = _jObj.getString("Category");
_item.TAGS = _jObj.getString("Tags");
_item.CONTENT_TYPE = _jObj.getString("ContentType");
_item.TITLE = _jObj.getString("Title");
_item.SMALL_DESC = _jObj.getString("SmallDesc");
_item.FULL_DESC = _jObj.getString("FullDesc").replace("\\n", "\n").replace("\\'", "\'");
_item.THUMB_URL = _jObj.getString("ThumbURL");
_item.EXTERNAL_URL = _jObj.getString("ExternalURL");
_item.ATTRIBUTION = _jObj.getString("Attribution");
_item.PUBLISH_DATE = _jObj.getString("PublishDate");
_item.VIEWS = _jObj.getInt("Views");
_item.LIKES = _jObj.getInt("Likes");
_item.IS_FAV = _jObj.getInt("IsUserFav");
return _item;
} catch (Exception ex) {
throw ex;
}
}
// ------------------------------------------------------------------------------------------------------------ increaseLikeCount
public void increaseLikeCount(Context context, Integer id) throws Exception {
try {
List<NameValuePair> _parameters = new ArrayList<NameValuePair>();
_parameters.add(new BasicNameValuePair("function", "UpdateLikeCount"));
_parameters.add(new BasicNameValuePair("contentid", String.valueOf(id)));
_parameters.add(new BasicNameValuePair("foros", "android"));
String _jsonContent = new clsGeneral().GetJSONContentFromInternetService(context, _parameters, true);
JSONObject _jObj = new JSONObject(_jsonContent);
if (_jObj.getString("message") == "success") {
// OK RESULT
}
} catch (Exception ex) {
throw ex;
}
}
// ------------------------------------------------------------------------------------------------------------ addToFavList
public void addToFavList(Context context, Integer id, String action) throws Exception {
try {
List<NameValuePair> _parameters = new ArrayList<NameValuePair>();
_parameters.add(new BasicNameValuePair("function", "UpdateUserFavs"));
Integer _uid = new clsPrefes(context).getUserId();
_parameters.add(new BasicNameValuePair("uniqueuserid", String.valueOf(_uid)));
_parameters.add(new BasicNameValuePair("action", action));
_parameters.add(new BasicNameValuePair("itemid", String.valueOf(id)));
String _jsonContent = new clsGeneral().GetJSONContentFromInternetService(context, _parameters, true);
JSONObject _jObj = new JSONObject(_jsonContent);
if (_jObj.getString("message") == "success") {
// OK RESULT
}
} catch (Exception ex) {
throw ex;
}
}
}
| 7,117 | 0.556555 | 0.555993 | 147 | 47.414967 | 34.95047 | 133 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.904762 | false | false | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.