blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2
values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132
values | src_encoding stringclasses 34
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 3 9.45M | extension stringclasses 28
values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
18c544acc038f908d315d8f1a6c8f674e82dd02f | 8e2a3b0e491f8a87dd0de0a36141671e79e488c1 | /ejercicios16Al30/Ejercicio_18.java | 74dea991254f4ef45034a511f77f779d8dfa70bc | [] | no_license | karaly2020/Unidad_04_TP_CaC | a7150b1556cd0d05b4142a7ff61d6227a09ae41f | f8bfbcdc97c8254c803fd58d861b1a536f871b80 | refs/heads/master | 2023-01-03T06:32:38.832018 | 2020-10-25T20:35:57 | 2020-10-25T20:35:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 699 | java | /* Ingresar por teclado 1 número entero y mostrar por pantalla su tabla de multiplicar entre 1 y 10 (usando la
instrucción while)*/
package ejercicios16Al30;
import java.util.Scanner;
public class Ejercicio_18 {
public static void main(String[] args) {
Scanner entrada = new Scanner(System.in);
int numero, tabla;
int i = 0;
System.out.print("Digite un numero: ");
numero = entrada.nextInt();
System.out.println("La tabla de multiplicar del numero " +numero+ " es: ");
while (i <= 9){
i++;
tabla = numero * i;
System.out.println(numero+ " por " +i+ " es igual a " +tabla );
}
}
}
| [
"karen.ayala.it@gmail.com"
] | karen.ayala.it@gmail.com |
ffa4bf6b15d8f31c2582e68eacea83b697254a4d | 0521fbc08f96cf34d152cf302ff6cfb9f464974f | /CDI_EJB/app1/goodcesi/src/main/java/com/goodcesi/business/domain/Order.java | 2fad029243a25b4a2e0252b1ecd6ccff76ba4f25 | [] | no_license | Lmaurinjollis/ExiaJavaEE | 0f08140475a8c97aa97683ebf8ae931be45b4a4e | 9855272490999e9ae50451c270832ba819e14af0 | refs/heads/master | 2022-07-02T10:53:13.846262 | 2021-03-08T10:24:27 | 2021-03-08T10:24:27 | 205,341,108 | 0 | 0 | null | 2022-06-21T01:46:46 | 2019-08-30T08:38:28 | Java | UTF-8 | Java | false | false | 3,263 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.goodcesi.business.domain;
import java.io.Serializable;
import java.util.Date;
import java.util.Objects;
import javax.persistence.*;
/**
*
* @author asbriglio
*/
@Entity
@Table(name="itemorder")//pour éviter des erreurs de génération SQL avec un nom de table Order par défaut.
public class Order implements Serializable {
private Double totalPrice;
@Temporal(TemporalType.DATE)
private Date orderDate;
@Temporal(TemporalType.DATE)
private Date shippingDate;
@Enumerated(EnumType.ORDINAL)
private OrderStatus status;
//relations
@ManyToOne
private User buyer;//acheteur
//id dérivée - l'id de Order (entité dépendante) est dérivée de la clé primaire de Item (parent)
//la colonne clé primaire de la table principale de Order est une clé étrangère référençant la clé primaire le de la table de Item
@OneToOne //relation unidirectionnelle
@Id //l'attribut Id est une relation 1-1 avec l'entité parent Item
private Item orderedItem;
public Order() {
this.status = OrderStatus.IN_PROGRESS;
}
public User getBuyer() {
return buyer;
}
public void setBuyer(User buyer) {
this.buyer = buyer;
}
public Item getOrderedItem() {
return orderedItem;
}
public void setOrderedItem(Item item) {
this.orderedItem = item;
}
public Double getTotalPrice() {
return totalPrice;
}
public void setTotalPrice(Double totalPrice) {
this.totalPrice = totalPrice;
}
public Date getOrderDate() {
return orderDate;
}
public void setOrderDate(Date orderDate) {
this.orderDate = orderDate;
}
public Date getShippingDate() {
return shippingDate;
}
public void setShippingDate(Date shippingDate) {
this.shippingDate = shippingDate;
}
public OrderStatus getStatus() {
return status;
}
public void setStatus(OrderStatus status) {
this.status = status;
}
/*
on surdéfinit equals et hascode pour que les entités (de même type) puissent êtres considérées significativement égales
si elles ont le même id(identité) notamment si on recherche dans une liste.
A noter que le framework JPA considère égales 2 entitités si elles ont la même identité.
*/
@Override
public int hashCode() {
int hash = 3;
hash = 89 * hash + Objects.hashCode(this.orderedItem);
return hash;
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Order other = (Order) obj;
if (!Objects.equals(this.orderedItem.getId(), other.orderedItem.getId())) {
return false;
}
return true;
}
}
| [
"ludwig.maurinjollisgally@viacesi.fr"
] | ludwig.maurinjollisgally@viacesi.fr |
eac15855ac67a88f3e0806ba8e3964f24817608d | e660dcb8e86b8c816a999d93a6e02ea9ca296bca | /src/iart2017/gerador/Autor.java | b28b4b2c08d1082cffdb24e23c5cbfcd7e36f884 | [] | no_license | DioVaz/IART2017 | dc310bab157595fbbe2de4e2a819d4ab0953cf72 | b8d42cf45f8998e02d24ebfdbfe5fef215d63810 | refs/heads/master | 2021-01-20T15:33:09.801845 | 2017-05-15T16:54:16 | 2017-05-15T16:54:16 | 90,787,103 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 390 | java | /*
* 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 iart2017.gerador;
/**
*
* @author Diogo
*/
public class Autor {
int ID;
String nome;
public Autor(int ID, String nome){
this.ID = ID;
this.nome = nome;
}
}
| [
"snowblade90@gmail.com"
] | snowblade90@gmail.com |
a5457aa87250896caaab298c9457259407966604 | adc700cfc796bd72215160a78502e8cb03ca8f72 | /src/main/java/bdv/render/Bounds.java | 83805573e60afa8fd9937224137b74f77aac9740 | [
"BSD-2-Clause"
] | permissive | axtimwalde/bigdataviewer-render-app | 97359b7215b50107bd012085b7a003deea4ad52c | 3b73f29b1b7d5b4b3276cd7c15619dc8b5f5b3ab | refs/heads/master | 2021-04-12T11:32:45.530425 | 2020-08-06T20:06:41 | 2020-08-06T20:06:41 | 64,526,768 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 959 | java | /**
* License: GPL
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License 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 bdv.render;
/**
*
*
* @author Stephan Saalfeld <saalfelds@janelia.hhmi.org>
*/
public class Bounds {
public double minX = 0;
public double minY = 0;
public double minZ = 0;
public double maxX = 0;
public double maxY = 0;
public double maxZ = 0;
} | [
"saalfelds@janelia.hhmi.org"
] | saalfelds@janelia.hhmi.org |
adfaa2a63ad59117abcf1ece9dc4cf47897d31cd | d8c1a766bf1232b7bd22fb4872fa129aa75a126c | /src/Mississippi.java | 1f72d0adb6260125bb9a7233a041a0d7ff128a4f | [] | no_license | Faiza1987/Java | fe926f921999b92755ba17bf2bb75f8902faa8a7 | 4a0e7738b449dfec5376cdd1a792d01cc998af15 | refs/heads/main | 2021-11-11T05:59:44.693423 | 2021-10-30T04:16:09 | 2021-10-30T04:16:09 | 138,913,963 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,501 | java |
public class Mississippi {
public static void main(String[] args) {
lineM();
System.out.println();
lineI();
System.out.println();
lineS();
System.out.println();
lineS();
System.out.println();
lineI();
System.out.println();
lineS();
System.out.println();
lineS();
System.out.println();
lineI();
System.out.println();
lineP();
System.out.println();
lineP();
System.out.println();
lineI();
}
public static void lineM() {
System.out.println("M M");
System.out.println("MM MM");
System.out.println("M M M M M");
System.out.println("M M M");
System.out.println("M M");
System.out.println("M M");
System.out.println("M M");
}
public static void lineI() {
System.out.println("I I I I I");
System.out.println(" I ");
System.out.println(" I ");
System.out.println(" I ");
System.out.println(" I ");
System.out.println(" I ");
System.out.println("I I I I I");
}
public static void lineS() {
System.out.println(" SSSSS ");
System.out.println("S S");
System.out.println("S");
System.out.println(" SSSSS ");
System.out.println(" S");
System.out.println("S S");
System.out.println(" SSSSS");
}
public static void lineP() {
System.out.println("PPPPPP");
System.out.println("P P");
System.out.println("P P");
System.out.println("PPPPPP");
System.out.println("P");
System.out.println("P");
System.out.println("P");
}
}
| [
"faiza.ahsan1222@gmail.com"
] | faiza.ahsan1222@gmail.com |
47031b90ca2b51cd3f7e25d478070231bc00c8bc | 91990d1a784d402a712086838d561a8b0e314463 | /Sum of even numbers/Main.java | 00517543da226dcdf6d2ca812e663dfbe5288af0 | [] | no_license | Kavya167/Playground | 3d3ebb984134ad643e29f24420656b85ff442801 | ab846ac522e4418b56e87353dc6b02eb219a203e | refs/heads/master | 2022-12-19T14:47:31.875995 | 2020-09-30T12:33:57 | 2020-09-30T12:33:57 | 299,850,910 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 398 | java | #include<iostream>
using namespace std;
int main()
{
//Type your code here.
int n;
cout<<"Enter the number of elements in the array"<<endl;
cin>>n;
cout<<"Enter the elements in the array"<<endl;
int a[n],sum=0;
for(int i=0;i<n;i++)
{
cin>>a[i];
if(a[i]%2==0)
{
sum=sum+a[i];
}
}
cout<<"The sum of the even elements in the array is "<<sum;
return 0;
} | [
"70323328+Kavya167@users.noreply.github.com"
] | 70323328+Kavya167@users.noreply.github.com |
bd5bc06b25068ed9c556018d2242745967b7f767 | 5a866c5e6a67484a587f4b7d3e102f7c8a6a6f87 | /src/package-info.java | 71cdadacfd82ca95ed7d52a16a50e720e92118da | [] | no_license | MingrenChen/TrainSim | b1e3d315e666834df077bddac3a192a738fe48ce | c37abbb86483281b3b7a5eaab75c8b680cae1e74 | refs/heads/master | 2021-04-30T01:30:06.038712 | 2018-02-14T07:58:55 | 2018-02-14T07:58:55 | 121,485,125 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 62 | java | /**
* train simulation.
* Created by Harru on 2017/7/6.
*/
| [
"chenmr9769"
] | chenmr9769 |
4786b2902a5a6a0af7ec8d95d0c5f2656e709035 | de370098c7268e3a5ae7a907b761ef5e0310232a | /src/logicaJogo/carga/Branco.java | 18fea41e68a90bbb3bf3f74b9e9499f80c3ba0e7 | [] | no_license | korshar/MilkyWay | e92febb756aa7fb318c7ffa79e3fe5fbd9252fe1 | 187b1d149f67b7ecb260f58eb77a1d98f16ab41d | refs/heads/master | 2016-08-30T19:33:57.390801 | 2015-06-09T17:52:15 | 2015-06-09T17:52:15 | 35,098,129 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 127 | java | package logicaJogo.carga;
public class Branco extends Carga {
public Branco() {
nome = "Branco";
}
}
| [
"andre_pinho_93@outlook.com"
] | andre_pinho_93@outlook.com |
ddd4fba2caa9ec006ccd0b3cb81d31b0eeaa1f28 | a7a07c2a1e86fb96d6f70e79bdf0273876eea884 | /Backend/src/main/java/com/niit/configuration/WebAppInitializer.java | 2acc53953aa702213df069e57d1d03435060f0aa | [] | no_license | Rubanselva/Collaboration-Portal | 389dc60f1e1b1f76c55d1ac19de5e8655ddfc8fa | 2c99b4038bd82817532eef62a0a3dc8838648db0 | refs/heads/master | 2021-09-10T14:56:58.090624 | 2018-03-28T04:47:10 | 2018-03-28T04:47:10 | 124,842,606 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 642 | java | package com.niit.configuration;
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;
public class WebAppInitializer extends AbstractAnnotationConfigDispatcherServletInitializer{
@Override
protected Class<?>[] getRootConfigClasses() {
// TODO Auto-generated method stub
return new Class[]{DBConfiguration.class};
}
@Override
protected Class<?>[] getServletConfigClasses() {
// TODO Auto-generated method stub
return new Class[]{WebAppConfig.class};
}
@Override
protected String[] getServletMappings() {
// TODO Auto-generated method stub
return new String[]{"/"};
}
}
| [
"rubanselva21@gmail.com"
] | rubanselva21@gmail.com |
6146803082d0aef47338d51abdf1913e62ba71c5 | 9254e7279570ac8ef687c416a79bb472146e9b35 | /ocr-api-20210707/src/main/java/com/aliyun/ocr_api20210707/models/RecognizeMedicalDeviceManageLicenseRequest.java | a951b5412bf8f4b811f50424a0ffdda648d308bc | [
"Apache-2.0"
] | permissive | lquterqtd/alibabacloud-java-sdk | 3eaa17276dd28004dae6f87e763e13eb90c30032 | 3e5dca8c36398469e10cdaaa34c314ae0bb640b4 | refs/heads/master | 2023-08-12T13:56:26.379027 | 2021-10-19T07:22:15 | 2021-10-19T07:22:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 770 | java | // This file is auto-generated, don't edit it. Thanks.
package com.aliyun.ocr_api20210707.models;
import com.aliyun.tea.*;
public class RecognizeMedicalDeviceManageLicenseRequest extends TeaModel {
// 图片链接(长度不超 1014,不支持 base64)
@NameInMap("Url")
public String url;
public static RecognizeMedicalDeviceManageLicenseRequest build(java.util.Map<String, ?> map) throws Exception {
RecognizeMedicalDeviceManageLicenseRequest self = new RecognizeMedicalDeviceManageLicenseRequest();
return TeaModel.build(map, self);
}
public RecognizeMedicalDeviceManageLicenseRequest setUrl(String url) {
this.url = url;
return this;
}
public String getUrl() {
return this.url;
}
}
| [
"sdk-team@alibabacloud.com"
] | sdk-team@alibabacloud.com |
f054c4bdd3ee279a4bf90a685b57a1eab2de4d92 | 5307330f7212323204c6674b1d2f5bf89ca1e450 | /app/src/main/java/com/example/gautham/dr/main/GridviewCustomAdapter.java | f503a6ea85846263a446f02e5965273914a42c75 | [] | no_license | lgoutham/Water_Drink_Reminder | 5829d9077a163b068ba142097ae990cd95cd43d3 | ad83013d773639dbb82802cf90e0e49f270f1de3 | refs/heads/master | 2020-04-06T04:04:51.906585 | 2017-06-30T08:40:05 | 2017-06-30T08:40:05 | 57,052,282 | 2 | 2 | null | null | null | null | UTF-8 | Java | false | false | 4,112 | java | package com.example.gautham.dr.main;
import android.content.Context;
import android.database.Cursor;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.SimpleCursorAdapter;
import android.widget.TextView;
import android.widget.Toast;
import com.example.gautham.dr.R;
import com.example.gautham.dr.database.WaterBottlesData;
import com.example.gautham.dr.database.WaterDatabase;
/**
* Created by GAUTHAM on 4/26/2016.
*/
public class GridviewCustomAdapter extends SimpleCursorAdapter {
Cursor dataCursor;
LayoutInflater mInflater;
Context context;
public GridviewCustomAdapter(Context context, int layout, Cursor c, String[] from, int[] to, int flags) {
super(context, layout, c, from, to, flags);
dataCursor = c;
this.context = context;
mInflater = LayoutInflater.from(context);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
CustomViewHolder holder;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.custom_grid_view, null);
holder = new CustomViewHolder();
holder.tvTime = (TextView) convertView.findViewById(R.id.bottle_time);
holder.tvSize = (TextView) convertView.findViewById(R.id.bottle_quantity);
holder.imageView = (ImageView) convertView.findViewById(R.id.bottle);
convertView.setTag(holder);
} else {
holder = (CustomViewHolder) convertView.getTag();
}
dataCursor.moveToPosition(position);
int title = dataCursor.getColumnIndex(WaterDatabase.KEY_TIME);
String task_title = dataCursor.getString(title);
int description_index = dataCursor.getColumnIndex(WaterDatabase.KEY_POS);
int priority = dataCursor.getInt(description_index);
holder.tvTime.setText(task_title);
switch (priority) {
case 0:
holder.tvSize.setText(WaterBottlesData.getData().get(0).title + "ml");
holder.imageView.setImageResource(WaterBottlesData.getData().get(0).imageId);
break;
case 1:
holder.tvSize.setText(WaterBottlesData.getData().get(1).title + "ml");
holder.imageView.setImageResource(WaterBottlesData.getData().get(1).imageId);
break;
case 2:
holder.tvSize.setText(WaterBottlesData.getData().get(2).title + "ml");
holder.imageView.setImageResource(WaterBottlesData.getData().get(2).imageId);
break;
case 3:
holder.tvSize.setText(WaterBottlesData.getData().get(3).title + "ml");
holder.imageView.setImageResource(WaterBottlesData.getData().get(3).imageId);
break;
case 4:
holder.tvSize.setText(WaterBottlesData.getData().get(4).title + "ml");
holder.imageView.setImageResource(WaterBottlesData.getData().get(4).imageId);
break;
case 5:
holder.tvSize.setText(WaterBottlesData.getData().get(5).title + "ml");
holder.imageView.setImageResource(WaterBottlesData.getData().get(5).imageId);
break;
case 6:
holder.tvSize.setText(WaterBottlesData.getData().get(6).title + "ml");
holder.imageView.setImageResource(WaterBottlesData.getData().get(6).imageId);
break;
case 7:
holder.tvSize.setText(WaterBottlesData.getData().get(7).title + "ml");
holder.imageView.setImageResource(WaterBottlesData.getData().get(7).imageId);
break;
default:
Toast.makeText(context, "Wrong input", Toast.LENGTH_SHORT).show();
}
return convertView;
}
public static class CustomViewHolder {
public TextView tvSize;
public TextView tvTime;
public ImageView imageView;
}
}
| [
"lgouthamreddy9@gmail.com"
] | lgouthamreddy9@gmail.com |
851ee0b95e121427b0e22c6814f25a75a697525e | 24f32d4b6fdb5dce23965e6a9696b0d000e0a337 | /webapp-repository/src/main/java/org/apache/jackrabbit/j2ee/DerbyShutdown.java | 2acc7c2f8278be79a2a0393e6de0550a95dc2fc6 | [
"Apache-2.0"
] | permissive | deleidos/digitaledge-platform | 98f03a6c6402ba4d1ec57ebcec36e335b544f691 | 1eafdb92f6a205936ab4e08ef62be6bb0b9c9ec9 | refs/heads/master | 2020-04-12T06:36:08.811127 | 2016-11-17T15:25:13 | 2016-11-17T15:25:13 | 37,742,975 | 4 | 4 | Apache-2.0 | 2018-04-19T20:03:21 | 2015-06-19T19:57:30 | HTML | UTF-8 | Java | false | false | 14,162 | java | /**
* Apache License
* Version 2.0, January 2004
* http://www.apache.org/licenses/
*
* TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
*
* 1. Definitions.
*
* "License" shall mean the terms and conditions for use, reproduction,
* and distribution as defined by Sections 1 through 9 of this document.
*
* "Licensor" shall mean the copyright owner or entity authorized by
* the copyright owner that is granting the License.
*
* "Legal Entity" shall mean the union of the acting entity and all
* other entities that control, are controlled by, or are under common
* control with that entity. For the purposes of this definition,
* "control" means (i) the power, direct or indirect, to cause the
* direction or management of such entity, whether by contract or
* otherwise, or (ii) ownership of fifty percent (50%) or more of the
* outstanding shares, or (iii) beneficial ownership of such entity.
*
* "You" (or "Your") shall mean an individual or Legal Entity
* exercising permissions granted by this License.
*
* "Source" form shall mean the preferred form for making modifications,
* including but not limited to software source code, documentation
* source, and configuration files.
*
* "Object" form shall mean any form resulting from mechanical
* transformation or translation of a Source form, including but
* not limited to compiled object code, generated documentation,
* and conversions to other media types.
*
* "Work" shall mean the work of authorship, whether in Source or
* Object form, made available under the License, as indicated by a
* copyright notice that is included in or attached to the work
* (an example is provided in the Appendix below).
*
* "Derivative Works" shall mean any work, whether in Source or Object
* form, that is based on (or derived from) the Work and for which the
* editorial revisions, annotations, elaborations, or other modifications
* represent, as a whole, an original work of authorship. For the purposes
* of this License, Derivative Works shall not include works that remain
* separable from, or merely link (or bind by name) to the interfaces of,
* the Work and Derivative Works thereof.
*
* "Contribution" shall mean any work of authorship, including
* the original version of the Work and any modifications or additions
* to that Work or Derivative Works thereof, that is intentionally
* submitted to Licensor for inclusion in the Work by the copyright owner
* or by an individual or Legal Entity authorized to submit on behalf of
* the copyright owner. For the purposes of this definition, "submitted"
* means any form of electronic, verbal, or written communication sent
* to the Licensor or its representatives, including but not limited to
* communication on electronic mailing lists, source code control systems,
* and issue tracking systems that are managed by, or on behalf of, the
* Licensor for the purpose of discussing and improving the Work, but
* excluding communication that is conspicuously marked or otherwise
* designated in writing by the copyright owner as "Not a Contribution."
*
* "Contributor" shall mean Licensor and any individual or Legal Entity
* on behalf of whom a Contribution has been received by Licensor and
* subsequently incorporated within the Work.
*
* 2. Grant of Copyright License. Subject to the terms and conditions of
* this License, each Contributor hereby grants to You a perpetual,
* worldwide, non-exclusive, no-charge, royalty-free, irrevocable
* copyright license to reproduce, prepare Derivative Works of,
* publicly display, publicly perform, sublicense, and distribute the
* Work and such Derivative Works in Source or Object form.
*
* 3. Grant of Patent License. Subject to the terms and conditions of
* this License, each Contributor hereby grants to You a perpetual,
* worldwide, non-exclusive, no-charge, royalty-free, irrevocable
* (except as stated in this section) patent license to make, have made,
* use, offer to sell, sell, import, and otherwise transfer the Work,
* where such license applies only to those patent claims licensable
* by such Contributor that are necessarily infringed by their
* Contribution(s) alone or by combination of their Contribution(s)
* with the Work to which such Contribution(s) was submitted. If You
* institute patent litigation against any entity (including a
* cross-claim or counterclaim in a lawsuit) alleging that the Work
* or a Contribution incorporated within the Work constitutes direct
* or contributory patent infringement, then any patent licenses
* granted to You under this License for that Work shall terminate
* as of the date such litigation is filed.
*
* 4. Redistribution. You may reproduce and distribute copies of the
* Work or Derivative Works thereof in any medium, with or without
* modifications, and in Source or Object form, provided that You
* meet the following conditions:
*
* (a) You must give any other recipients of the Work or
* Derivative Works a copy of this License; and
*
* (b) You must cause any modified files to carry prominent notices
* stating that You changed the files; and
*
* (c) You must retain, in the Source form of any Derivative Works
* that You distribute, all copyright, patent, trademark, and
* attribution notices from the Source form of the Work,
* excluding those notices that do not pertain to any part of
* the Derivative Works; and
*
* (d) If the Work includes a "NOTICE" text file as part of its
* distribution, then any Derivative Works that You distribute must
* include a readable copy of the attribution notices contained
* within such NOTICE file, excluding those notices that do not
* pertain to any part of the Derivative Works, in at least one
* of the following places: within a NOTICE text file distributed
* as part of the Derivative Works; within the Source form or
* documentation, if provided along with the Derivative Works; or,
* within a display generated by the Derivative Works, if and
* wherever such third-party notices normally appear. The contents
* of the NOTICE file are for informational purposes only and
* do not modify the License. You may add Your own attribution
* notices within Derivative Works that You distribute, alongside
* or as an addendum to the NOTICE text from the Work, provided
* that such additional attribution notices cannot be construed
* as modifying the License.
*
* You may add Your own copyright statement to Your modifications and
* may provide additional or different license terms and conditions
* for use, reproduction, or distribution of Your modifications, or
* for any such Derivative Works as a whole, provided Your use,
* reproduction, and distribution of the Work otherwise complies with
* the conditions stated in this License.
*
* 5. Submission of Contributions. Unless You explicitly state otherwise,
* any Contribution intentionally submitted for inclusion in the Work
* by You to the Licensor shall be under the terms and conditions of
* this License, without any additional terms or conditions.
* Notwithstanding the above, nothing herein shall supersede or modify
* the terms of any separate license agreement you may have executed
* with Licensor regarding such Contributions.
*
* 6. Trademarks. This License does not grant permission to use the trade
* names, trademarks, service marks, or product names of the Licensor,
* except as required for reasonable and customary use in describing the
* origin of the Work and reproducing the content of the NOTICE file.
*
* 7. Disclaimer of Warranty. Unless required by applicable law or
* agreed to in writing, Licensor provides the Work (and each
* Contributor provides its Contributions) on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied, including, without limitation, any warranties or conditions
* of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
* PARTICULAR PURPOSE. You are solely responsible for determining the
* appropriateness of using or redistributing the Work and assume any
* risks associated with Your exercise of permissions under this License.
*
* 8. Limitation of Liability. In no event and under no legal theory,
* whether in tort (including negligence), contract, or otherwise,
* unless required by applicable law (such as deliberate and grossly
* negligent acts) or agreed to in writing, shall any Contributor be
* liable to You for damages, including any direct, indirect, special,
* incidental, or consequential damages of any character arising as a
* result of this License or out of the use or inability to use the
* Work (including but not limited to damages for loss of goodwill,
* work stoppage, computer failure or malfunction, or any and all
* other commercial damages or losses), even if such Contributor
* has been advised of the possibility of such damages.
*
* 9. Accepting Warranty or Additional Liability. While redistributing
* the Work or Derivative Works thereof, You may choose to offer,
* and charge a fee for, acceptance of support, warranty, indemnity,
* or other liability obligations and/or rights consistent with this
* License. However, in accepting such obligations, You may act only
* on Your own behalf and on Your sole responsibility, not on behalf
* of any other Contributor, and only if You agree to indemnify,
* defend, and hold each Contributor harmless for any liability
* incurred by, or claims asserted against, such Contributor by reason
* of your accepting any such warranty or additional liability.
*
* END OF TERMS AND CONDITIONS
*
* APPENDIX: How to apply the Apache License to your work.
*
* To apply the Apache License to your work, attach the following
* boilerplate notice, with the fields enclosed by brackets "{}"
* replaced with your own identifying information. (Don't include
* the brackets!) The text should be enclosed in the appropriate
* comment syntax for the file format. We also recommend that a
* file or class name and description of purpose be included on the
* same "printed page" as the copyright notice for easier
* identification within third-party archives.
*
* Copyright {yyyy} {name of copyright owner}
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.jackrabbit.j2ee;
import java.lang.reflect.Method;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Enumeration;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
/**
* Servlet context listener that releases all remaining Derby resources
* when the web application is undeployed. The resources are released only
* if the Derby classes were loaded from within this webapp.
*
* @see <a href="https://issues.apache.org/jira/browse/JCR-1301">JCR-1301</a>
*/
public class DerbyShutdown implements ServletContextListener {
public void contextInitialized(ServletContextEvent event) {
}
public void contextDestroyed(ServletContextEvent event) {
ClassLoader loader = DerbyShutdown.class.getClassLoader();
// Deregister all JDBC drivers loaded from this webapp
Enumeration<Driver> drivers = DriverManager.getDrivers();
while (drivers.hasMoreElements()) {
Driver driver = drivers.nextElement();
// Check if this driver comes from this webapp
if (driver.getClass().getClassLoader() == loader) {
try {
DriverManager.deregisterDriver(driver);
} catch (SQLException ignore) {
}
}
}
// Explicitly tell Derby to release all remaining resources.
// Use reflection to avoid problems when the Derby is not used.
try {
Class<?> monitorClass =
loader.loadClass("org.apache.derby.iapi.services.monitor.Monitor");
if (monitorClass.getClassLoader() == loader) {
Method getMonitorMethod =
monitorClass.getMethod("getMonitor", new Class<?>[0]);
Object monitor =
getMonitorMethod.invoke(null, new Object[0]);
if (monitor != null) {
Method shutdownMethod =
monitor.getClass().getMethod("shutdown", new Class<?>[0]);
shutdownMethod.invoke(monitor, new Object[0]);
}
}
} catch (Exception ignore) {
}
}
} | [
"loomisn@leidos.com"
] | loomisn@leidos.com |
b053903847b7b514790983ca57b5f61fb991714d | 53fbf6866edad478f468ce08fffb66885bac2e37 | /web01/src/servlets/step01/ScoreInsert.java | 438c9d580392856de3581dc543574f68ea32476e | [] | no_license | MUNSEONJU/bitJava56 | 179530a4be111dcddcfacfd74a36654410555c89 | 61e6c1496b02fa50e65a5cb92c73b41a6d5c4389 | refs/heads/master | 2020-06-02T08:10:14.440457 | 2014-07-09T01:06:53 | 2014-07-09T01:06:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,258 | java | package servlets.step01;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/score/insert")
public class ScoreInsert extends HttpServlet {
private static final long serialVersionUID = 1L;
DbConnectionPool dbcp;
ScoreDao scoreDao;
@Override
public void init(ServletConfig config) throws ServletException {
super.init(config); // overriding하기 전의 init
try {
dbcp = new DbConnectionPool("com.mysql.jdbc.Driver",
"jdbc:mysql://localhost:3306/bitdb?useUnicode=true&characterEncoding=UTF-8",
"bit", "1111");
} catch (Exception e) {
e.printStackTrace();
}
scoreDao = new ScoreDao();
scoreDao.setDbConnectionPool(dbcp);
}
@Override
public void destroy() {
super.destroy();
dbcp.closeAll();
}
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
Score score = new Score();
String name = request.getParameter("name");
int kor = Integer.parseInt(request.getParameter("kor"));
int eng = Integer.parseInt(request.getParameter("eng"));
int math = Integer.parseInt(request.getParameter("math"));
score.setName(name);
score.setKor(kor);
score.setEng(eng);
score.setMath(math);
try {
scoreDao.insert(score);
response.setContentType("text/html; charset=UTF-8");
PrintWriter out = response.getWriter();
out.println(" <!DOCTYPE html>");
out.println(" <html>");
out.println(" <head>");
out.println(" <meta charset='UTF-8'>");
out.println(" <meta http-equiv='Refresh' content='1; list'>");
out.println(" <title>성적 등록</title>");
out.println(" </head>");
out.println(" <body>");
out.println(" <p> 등록 되었습니다. </p>");
out.println(" </body>");
out.println(" </html>");
} catch (Exception e) {
e.printStackTrace();
}
}
}
| [
"SJ@Orange"
] | SJ@Orange |
4f0bfddb3cb96e991267f82c90b2c65a4fb7def7 | b78acf398729c6e7bfb6969937ad93a276277c67 | /src/com/skd/videoframing/OnFrameClickListener.java | c5b7d5ac7192936b2f5e74244eab1e3e461d32b7 | [] | no_license | xxwikkixx/VideoFramingOriginal | de75664e414a7502f27fc3ce9b849eaf5d39cb80 | 5359415703d37c8512334b46ef5f684bcf804ad4 | refs/heads/master | 2020-12-24T15:50:17.874203 | 2016-05-20T02:23:38 | 2016-05-20T02:23:38 | 35,501,907 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 116 | java | package com.skd.videoframing;
public interface OnFrameClickListener {
public void onFrameClicked(int time);
}
| [
"wikkii@msn.com"
] | wikkii@msn.com |
23c08e48468cd09054ac97b97a73c73888023b63 | 65befe28d69189681a2c79c77d9fcbdceab3dc27 | /Programming/javaworkspace/Chacter7/src/Dynamic/Driver.java | f33362a9e653cf288d808656ca3e9934ec625afd | [] | no_license | solwish/TIL | 554a67f79c66ed5d5a5075f08b6f0369aa363249 | 4314767fa763de73238aa141e105a5cf3641a9fc | refs/heads/master | 2023-01-08T01:11:34.677452 | 2021-01-07T13:43:56 | 2021-01-07T13:43:56 | 101,876,124 | 10 | 0 | null | 2023-01-03T14:41:06 | 2017-08-30T12:03:25 | CSS | UTF-8 | Java | false | false | 119 | java | package Dynamic;
public class Driver {
public void drive(Vehicle vehicle){
vehicle.run();
vehicle.stop();
}
}
| [
"solwish90@gmail.com"
] | solwish90@gmail.com |
e00dc4016f34d0bc236957e88d33680fc90946ca | d9902df8125e1926379fa5d8848ed4c59a578252 | /Projects/MavenProjects/WebProjects/bwcar1/src/main/java/pers/yo/bwcar1/pojo/TagExample.java | 8167c37707654ed7cc681a60ab187342299695c0 | [] | no_license | yogurtcss/JavaDM | 87f051e832fef931e3196a676cd41e91f334004e | 03a38d3b5c41e99fd876f2892a60e3b7eeb9bf51 | refs/heads/master | 2020-11-25T06:25:54.703190 | 2020-03-01T06:53:01 | 2020-03-01T06:53:01 | 221,098,836 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 19,616 | java | package pers.yo.bwcar1.pojo;
import java.util.ArrayList;
import java.util.List;
public class TagExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public TagExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Integer value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Integer value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Integer value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Integer value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Integer value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Integer value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Integer> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Integer> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Integer value1, Integer value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Integer value1, Integer value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andNameIsNull() {
addCriterion("name is null");
return (Criteria) this;
}
public Criteria andNameIsNotNull() {
addCriterion("name is not null");
return (Criteria) this;
}
public Criteria andNameEqualTo(String value) {
addCriterion("name =", value, "name");
return (Criteria) this;
}
public Criteria andNameNotEqualTo(String value) {
addCriterion("name <>", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThan(String value) {
addCriterion("name >", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThanOrEqualTo(String value) {
addCriterion("name >=", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThan(String value) {
addCriterion("name <", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThanOrEqualTo(String value) {
addCriterion("name <=", value, "name");
return (Criteria) this;
}
public Criteria andNameLike(String value) {
addCriterion("name like", value, "name");
return (Criteria) this;
}
public Criteria andNameNotLike(String value) {
addCriterion("name not like", value, "name");
return (Criteria) this;
}
public Criteria andNameIn(List<String> values) {
addCriterion("name in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> values) {
addCriterion("name not in", values, "name");
return (Criteria) this;
}
public Criteria andNameBetween(String value1, String value2) {
addCriterion("name between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andNameNotBetween(String value1, String value2) {
addCriterion("name not between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andIsDeletedIsNull() {
addCriterion("is_deleted is null");
return (Criteria) this;
}
public Criteria andIsDeletedIsNotNull() {
addCriterion("is_deleted is not null");
return (Criteria) this;
}
public Criteria andIsDeletedEqualTo(Byte value) {
addCriterion("is_deleted =", value, "isDeleted");
return (Criteria) this;
}
public Criteria andIsDeletedNotEqualTo(Byte value) {
addCriterion("is_deleted <>", value, "isDeleted");
return (Criteria) this;
}
public Criteria andIsDeletedGreaterThan(Byte value) {
addCriterion("is_deleted >", value, "isDeleted");
return (Criteria) this;
}
public Criteria andIsDeletedGreaterThanOrEqualTo(Byte value) {
addCriterion("is_deleted >=", value, "isDeleted");
return (Criteria) this;
}
public Criteria andIsDeletedLessThan(Byte value) {
addCriterion("is_deleted <", value, "isDeleted");
return (Criteria) this;
}
public Criteria andIsDeletedLessThanOrEqualTo(Byte value) {
addCriterion("is_deleted <=", value, "isDeleted");
return (Criteria) this;
}
public Criteria andIsDeletedIn(List<Byte> values) {
addCriterion("is_deleted in", values, "isDeleted");
return (Criteria) this;
}
public Criteria andIsDeletedNotIn(List<Byte> values) {
addCriterion("is_deleted not in", values, "isDeleted");
return (Criteria) this;
}
public Criteria andIsDeletedBetween(Byte value1, Byte value2) {
addCriterion("is_deleted between", value1, value2, "isDeleted");
return (Criteria) this;
}
public Criteria andIsDeletedNotBetween(Byte value1, Byte value2) {
addCriterion("is_deleted not between", value1, value2, "isDeleted");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Long value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Long value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Long value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Long value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Long value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Long value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Long> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Long> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Long value1, Long value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Long value1, Long value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeIsNull() {
addCriterion("last_update_time is null");
return (Criteria) this;
}
public Criteria andLastUpdateTimeIsNotNull() {
addCriterion("last_update_time is not null");
return (Criteria) this;
}
public Criteria andLastUpdateTimeEqualTo(Long value) {
addCriterion("last_update_time =", value, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeNotEqualTo(Long value) {
addCriterion("last_update_time <>", value, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeGreaterThan(Long value) {
addCriterion("last_update_time >", value, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeGreaterThanOrEqualTo(Long value) {
addCriterion("last_update_time >=", value, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeLessThan(Long value) {
addCriterion("last_update_time <", value, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeLessThanOrEqualTo(Long value) {
addCriterion("last_update_time <=", value, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeIn(List<Long> values) {
addCriterion("last_update_time in", values, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeNotIn(List<Long> values) {
addCriterion("last_update_time not in", values, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeBetween(Long value1, Long value2) {
addCriterion("last_update_time between", value1, value2, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeNotBetween(Long value1, Long value2) {
addCriterion("last_update_time not between", value1, value2, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andClickCountIsNull() {
addCriterion("click_count is null");
return (Criteria) this;
}
public Criteria andClickCountIsNotNull() {
addCriterion("click_count is not null");
return (Criteria) this;
}
public Criteria andClickCountEqualTo(Long value) {
addCriterion("click_count =", value, "clickCount");
return (Criteria) this;
}
public Criteria andClickCountNotEqualTo(Long value) {
addCriterion("click_count <>", value, "clickCount");
return (Criteria) this;
}
public Criteria andClickCountGreaterThan(Long value) {
addCriterion("click_count >", value, "clickCount");
return (Criteria) this;
}
public Criteria andClickCountGreaterThanOrEqualTo(Long value) {
addCriterion("click_count >=", value, "clickCount");
return (Criteria) this;
}
public Criteria andClickCountLessThan(Long value) {
addCriterion("click_count <", value, "clickCount");
return (Criteria) this;
}
public Criteria andClickCountLessThanOrEqualTo(Long value) {
addCriterion("click_count <=", value, "clickCount");
return (Criteria) this;
}
public Criteria andClickCountIn(List<Long> values) {
addCriterion("click_count in", values, "clickCount");
return (Criteria) this;
}
public Criteria andClickCountNotIn(List<Long> values) {
addCriterion("click_count not in", values, "clickCount");
return (Criteria) this;
}
public Criteria andClickCountBetween(Long value1, Long value2) {
addCriterion("click_count between", value1, value2, "clickCount");
return (Criteria) this;
}
public Criteria andClickCountNotBetween(Long value1, Long value2) {
addCriterion("click_count not between", value1, value2, "clickCount");
return (Criteria) this;
}
public Criteria andTypeIsNull() {
addCriterion("type is null");
return (Criteria) this;
}
public Criteria andTypeIsNotNull() {
addCriterion("type is not null");
return (Criteria) this;
}
public Criteria andTypeEqualTo(Byte value) {
addCriterion("type =", value, "type");
return (Criteria) this;
}
public Criteria andTypeNotEqualTo(Byte value) {
addCriterion("type <>", value, "type");
return (Criteria) this;
}
public Criteria andTypeGreaterThan(Byte value) {
addCriterion("type >", value, "type");
return (Criteria) this;
}
public Criteria andTypeGreaterThanOrEqualTo(Byte value) {
addCriterion("type >=", value, "type");
return (Criteria) this;
}
public Criteria andTypeLessThan(Byte value) {
addCriterion("type <", value, "type");
return (Criteria) this;
}
public Criteria andTypeLessThanOrEqualTo(Byte value) {
addCriterion("type <=", value, "type");
return (Criteria) this;
}
public Criteria andTypeIn(List<Byte> values) {
addCriterion("type in", values, "type");
return (Criteria) this;
}
public Criteria andTypeNotIn(List<Byte> values) {
addCriterion("type not in", values, "type");
return (Criteria) this;
}
public Criteria andTypeBetween(Byte value1, Byte value2) {
addCriterion("type between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andTypeNotBetween(Byte value1, Byte value2) {
addCriterion("type not between", value1, value2, "type");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
} | [
"1806631955@qq.com"
] | 1806631955@qq.com |
65c1ebce0fa5c304e9f6e41cf3d0370fc48ceafb | b496a66dce218b6378e5c4f327becfdc97188515 | /app/src/main/java/com/eusecom/samfantozzi/NewPoklPridajActivity.java | b169f6297a0a57b15907eb8991fe7a0fb9d463c5 | [
"Apache-2.0"
] | permissive | eurosecom/samfantozzi | 41ecc1db8c5a2d51a847294024246be15838216c | 5be41da4093d24bd09db3a4550c8a2e9faf431e7 | refs/heads/master | 2021-01-15T15:52:30.856513 | 2018-01-01T21:50:19 | 2018-01-01T21:50:19 | 23,825,269 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 35,206 | java | package com.eusecom.samfantozzi;
/**
* Create and save new document ....
* Called from UpravPoklPolActivity.java
* Call ../androidfanti/get_poklzah.php and ../androidfanti/uloz_newpoklzah.php
*/
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.HttpResponse;
import org.apache.http.HttpVersion;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.params.HttpParams;
import org.apache.http.protocol.HTTP;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnFocusChangeListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.os.StrictMode;
import com.eusecom.samfantozzi.MCrypt;
public class NewPoklPridajActivity extends Activity {
EditText inputKto;
EditText inputTxp;
EditText inputIco;
TextView inputIconaz;
EditText inputDat;
EditText inputUce;
EditText inputFak;
Button btnSave;
Button btnIco;
Button btnPohyb;
TextView inputEdiServer;
TextView inputEdiUser;
TextView inputEdiDruhid;
TextView inputAll;
TextView inputDph1;
TextView inputDph2;
EditText inputPoh;
EditText inputZk2;
EditText inputDn2;
EditText inputZk1;
EditText inputDn1;
EditText inputZk0;
EditText inputCelkom;
TextView textzakl2;
TextView textdph2;
TextView textzakl1;
TextView textdph1;
String pid;
BufferedReader in;
String druhid;
String encrypted;
// Progress Dialog
private ProgressDialog pDialog;
private ProgressDialog pDialog2;
// JSON parser class
JSONParser jsonParser = new JSONParser();
// JSON Node names
private static final String TAG_SUCCESS = "success";
private static final String TAG_PRODUCT = "product";
private static final String TAG_DAT = "dat";
private static final String TAG_ICONAZ = "iconaz";
private static final String TAG_UCE = "uce";
private static final String TAG_KTO = "kto";
private static final String TAG_TXP = "txp";
private static final String TAG_ICO = "ico";
private static final String TAG_POZX = "pozx";
private static final String TAG_FAKX = "fakx";
private static final String TAG_ODKADE = "odkade";
private static final String TAG_NEWX = "newx";
private static final String TAG_PAGEX = "page";
private static final String TAG_CAT = "cat";
private SQLiteDatabase db=null;
private Cursor constantsCursor=null;
String idtitle;
String idvalue;
String mno;
String hod;
String mnozs;
int mnozi;
String dcex;
String pozx;
String fakx;
String newx;
String cat;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.new_poklzah);
// getting product details from intent
Intent i = getIntent();
Bundle extras = i.getExtras();
pozx = extras.getString(TAG_POZX);
fakx = extras.getString(TAG_FAKX);
newx = extras.getString(TAG_NEWX);
cat = extras.getString(TAG_CAT);
db=(new DatabaseHelper(this)).getWritableDatabase();
if( cat.equals("1")) {
if( pozx.equals("1")) {
String akypokl=getResources().getString(R.string.popisprijmovy);
this.setTitle(String.format(getResources().getString(R.string.title_activity_upravdok), fakx) + " " + akypokl);
}
if( pozx.equals("2")) {
String akypokl=getResources().getString(R.string.popisvydavkovy);
this.setTitle(String.format(getResources().getString(R.string.title_activity_upravdok), fakx) + " " + akypokl);
}
}
if( cat.equals("4")) {
String akypokl=getResources().getString(R.string.popisbankovy);
this.setTitle(String.format(getResources().getString(R.string.title_activity_upravdok), fakx) + " " + akypokl);
}
if( cat.equals("8")) {
String akypokl=getResources().getString(R.string.popisodberatelska);
this.setTitle(String.format(getResources().getString(R.string.title_activity_upravdok), fakx) + " " + akypokl);
}
if( cat.equals("9")) {
String akypokl=getResources().getString(R.string.popisdodavatelska);
this.setTitle(String.format(getResources().getString(R.string.title_activity_upravdok), fakx) + " " + akypokl);
}
inputDat = (EditText) findViewById(R.id.inputDat);
inputKto = (EditText) findViewById(R.id.inputKto);
inputTxp = (EditText) findViewById(R.id.inputTxp);
inputKto.setEnabled(false);
inputKto.setFocusable(false);
inputKto.setFocusableInTouchMode(false);
inputTxp.setEnabled(false);
inputTxp.setFocusable(false);
inputTxp.setFocusableInTouchMode(false);
inputDat.setEnabled(false);
inputDat.setFocusable(false);
inputDat.setFocusableInTouchMode(false);
textzakl2 = (TextView) findViewById(R.id.textzakl2);
textzakl2.setText(String.format(getResources().getString(R.string.popzakl2), SettingsActivity.getFirdph2(this)) + "%");
textdph2 = (TextView) findViewById(R.id.textdph2);
textdph2.setText(String.format(getResources().getString(R.string.popdph2), SettingsActivity.getFirdph2(this)) + "%");
textzakl1 = (TextView) findViewById(R.id.textzakl1);
textzakl1.setText(String.format(getResources().getString(R.string.popzakl1), SettingsActivity.getFirdph1(this)) + "%");
textdph1 = (TextView) findViewById(R.id.textdph1);
textdph1.setText(String.format(getResources().getString(R.string.popdph1), SettingsActivity.getFirdph1(this)) + "%");
inputAll = (TextView) findViewById(R.id.inputAll);
inputAll.setText("Fir/" + SettingsActivity.getFir(this) + "/Firrok/" + SettingsActivity.getFirrok(this));
inputEdiServer = (TextView) findViewById(R.id.inputEdiServer);
inputEdiServer.setText(SettingsActivity.getServerName(this));
inputEdiUser = (TextView) findViewById(R.id.inputEdiUser);
inputEdiUser.setText("Nick/" + SettingsActivity.getNickName(this) + "/ID/" + SettingsActivity.getUserId(this) + "/PSW/"
+ SettingsActivity.getUserPsw(this) + "/druhID/" + SettingsActivity.getDruhId(this)
+ "/Doklad/" + SettingsActivity.getDoklad(this));
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
inputZk0 = (EditText) findViewById( R.id.inputZk0 );
inputZk1 = (EditText) findViewById( R.id.inputZk1 );
inputZk2 = (EditText) findViewById( R.id.inputZk2 );
inputDn1 = (EditText) findViewById( R.id.inputDn1 );
inputDn2 = (EditText) findViewById( R.id.inputDn2 );
inputCelkom = (EditText) findViewById( R.id.inputCelkom );
inputDph1 = (TextView) findViewById( R.id.inputDph1 );
inputDph2 = (TextView) findViewById( R.id.inputDph2 );
inputDph2.setText(SettingsActivity.getFirdph2(this));
inputDph1.setText(SettingsActivity.getFirdph1(this));
inputZk2.setOnFocusChangeListener(new OnFocusChangeListener() {
public void onFocusChange(View v, boolean hasFocus) {
if(!hasFocus){
String zk2x = inputZk2.getText().toString();
String zk1x = inputZk1.getText().toString();
String zk0x = inputZk0.getText().toString();
String dn2x = inputDn2.getText().toString();
String dn1x = inputDn1.getText().toString();
Float zk2xf = 0f;
Float zk1xf = 0f;
Float zk0xf = 0f;
Float dn2xf = 0f;
Float dn1xf = 0f;
if (inputZk2.getText().toString().trim().length() > 0) { zk2xf = Float.parseFloat(zk2x); }
if (inputZk1.getText().toString().trim().length() > 0) { zk1xf = Float.parseFloat(zk1x); }
if (inputZk0.getText().toString().trim().length() > 0) { zk0xf = Float.parseFloat(zk0x); }
if (inputDn2.getText().toString().trim().length() > 0) { dn2xf = Float.parseFloat(dn2x); }
if (inputDn1.getText().toString().trim().length() > 0) { dn1xf = Float.parseFloat(dn1x); }
String dph2x = "0." + inputDph2.getText().toString();
Float dph2f = Float.parseFloat(dph2x);
dn2xf = zk2xf * ( dph2f );
DecimalFormat df = new DecimalFormat("0.00");
String dn2s = df.format(dn2xf);
dn2s = dn2s.replace(',','.');
inputDn2.setText(dn2s);
Float celkomf = zk2xf + zk1xf + zk0xf + dn2xf + dn1xf;
String celkoms = df.format(celkomf);
celkoms = celkoms.replace(',','.');
inputCelkom.setText(celkoms);
}
}
});
inputDn2.setOnFocusChangeListener(new OnFocusChangeListener() {
public void onFocusChange(View v, boolean hasFocus) {
if(!hasFocus){
String zk2x = inputZk2.getText().toString();
String zk1x = inputZk1.getText().toString();
String zk0x = inputZk0.getText().toString();
String dn2x = inputDn2.getText().toString();
String dn1x = inputDn1.getText().toString();
Float zk2xf = 0f;
Float zk1xf = 0f;
Float zk0xf = 0f;
Float dn2xf = 0f;
Float dn1xf = 0f;
if (inputZk2.getText().toString().trim().length() > 0) { zk2xf = Float.parseFloat(zk2x); }
if (inputZk1.getText().toString().trim().length() > 0) { zk1xf = Float.parseFloat(zk1x); }
if (inputZk0.getText().toString().trim().length() > 0) { zk0xf = Float.parseFloat(zk0x); }
if (inputDn2.getText().toString().trim().length() > 0) { dn2xf = Float.parseFloat(dn2x); }
if (inputDn1.getText().toString().trim().length() > 0) { dn1xf = Float.parseFloat(dn1x); }
Float celkomf = zk2xf + zk1xf + zk0xf + dn2xf + dn1xf;
DecimalFormat df = new DecimalFormat("0.00");
String celkoms = df.format(celkomf);
celkoms = celkoms.replace(',','.');
inputCelkom.setText(celkoms);
}
}
});
inputZk1.setOnFocusChangeListener(new OnFocusChangeListener() {
public void onFocusChange(View v, boolean hasFocus) {
if(!hasFocus){
String zk2x = inputZk2.getText().toString();
String zk1x = inputZk1.getText().toString();
String zk0x = inputZk0.getText().toString();
String dn2x = inputDn2.getText().toString();
String dn1x = inputDn1.getText().toString();
Float zk2xf = 0f;
Float zk1xf = 0f;
Float zk0xf = 0f;
Float dn2xf = 0f;
Float dn1xf = 0f;
if (inputZk2.getText().toString().trim().length() > 0) { zk2xf = Float.parseFloat(zk2x); }
if (inputZk1.getText().toString().trim().length() > 0) { zk1xf = Float.parseFloat(zk1x); }
if (inputZk0.getText().toString().trim().length() > 0) { zk0xf = Float.parseFloat(zk0x); }
if (inputDn2.getText().toString().trim().length() > 0) { dn2xf = Float.parseFloat(dn2x); }
if (inputDn1.getText().toString().trim().length() > 0) { dn1xf = Float.parseFloat(dn1x); }
String dph1x = "0." + inputDph1.getText().toString();
Float dph1f = Float.parseFloat(dph1x);
dn1xf = zk1xf * ( dph1f );
DecimalFormat df = new DecimalFormat("0.00");
String dn1s = df.format(dn1xf);
dn1s = dn1s.replace(',','.');
inputDn1.setText(dn1s);
Float celkomf = zk2xf + zk1xf + zk0xf + dn2xf + dn1xf;
String celkoms = df.format(celkomf);
celkoms = celkoms.replace(',','.');
inputCelkom.setText(celkoms);
}
}
});
inputDn1.setOnFocusChangeListener(new OnFocusChangeListener() {
public void onFocusChange(View v, boolean hasFocus) {
if(!hasFocus){
String zk2x = inputZk2.getText().toString();
String zk1x = inputZk1.getText().toString();
String zk0x = inputZk0.getText().toString();
String dn2x = inputDn2.getText().toString();
String dn1x = inputDn1.getText().toString();
Float zk2xf = 0f;
Float zk1xf = 0f;
Float zk0xf = 0f;
Float dn2xf = 0f;
Float dn1xf = 0f;
if (inputZk2.getText().toString().trim().length() > 0) { zk2xf = Float.parseFloat(zk2x); }
if (inputZk1.getText().toString().trim().length() > 0) { zk1xf = Float.parseFloat(zk1x); }
if (inputZk0.getText().toString().trim().length() > 0) { zk0xf = Float.parseFloat(zk0x); }
if (inputDn2.getText().toString().trim().length() > 0) { dn2xf = Float.parseFloat(dn2x); }
if (inputDn1.getText().toString().trim().length() > 0) { dn1xf = Float.parseFloat(dn1x); }
Float celkomf = zk2xf + zk1xf + zk0xf + dn2xf + dn1xf;
DecimalFormat df = new DecimalFormat("0.00");
String celkoms = df.format(celkomf);
celkoms = celkoms.replace(',','.');
inputCelkom.setText(celkoms);
}
}
});
inputZk0.setOnFocusChangeListener(new OnFocusChangeListener() {
public void onFocusChange(View v, boolean hasFocus) {
if(!hasFocus){
String zk2x = inputZk2.getText().toString();
String zk1x = inputZk1.getText().toString();
String zk0x = inputZk0.getText().toString();
String dn2x = inputDn2.getText().toString();
String dn1x = inputDn1.getText().toString();
Float zk2xf = 0f;
Float zk1xf = 0f;
Float zk0xf = 0f;
Float dn2xf = 0f;
Float dn1xf = 0f;
if (inputZk2.getText().toString().trim().length() > 0) { zk2xf = Float.parseFloat(zk2x); }
if (inputZk1.getText().toString().trim().length() > 0) { zk1xf = Float.parseFloat(zk1x); }
if (inputZk0.getText().toString().trim().length() > 0) { zk0xf = Float.parseFloat(zk0x); }
if (inputDn2.getText().toString().trim().length() > 0) { dn2xf = Float.parseFloat(dn2x); }
if (inputDn1.getText().toString().trim().length() > 0) { dn1xf = Float.parseFloat(dn1x); }
Float celkomf = zk2xf + zk1xf + zk0xf + dn2xf + dn1xf;
DecimalFormat df = new DecimalFormat("0.00");
String celkoms = df.format(celkomf);
celkoms = celkoms.replace(',','.');
inputCelkom.setText(celkoms);
}
}
});
//ico button
btnIco = (Button) findViewById(R.id.btnIco);
btnIco.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// Launching All products Activity
Intent iz = new Intent(getApplicationContext(), VyberIcoActivity.class);
Bundle extrasz = new Bundle();
//extrasz.putString(TAG_POZX, "1");
extrasz.putString(TAG_PAGEX, "1");
extrasz.putString(TAG_ODKADE, "1");
iz.putExtras(extrasz);
startActivityForResult(iz, 100);
}
});
//pohyb button
btnPohyb = (Button) findViewById(R.id.btnPohyb);
btnPohyb.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// Launching All products Activity
Intent iz = new Intent(getApplicationContext(), VyberPohybActivity.class);
Bundle extrasz = new Bundle();
if(cat.equals("1")) {
if(pozx.equals("1")) { extrasz.putString(TAG_ODKADE, "1"); }
if(pozx.equals("2")) { extrasz.putString(TAG_ODKADE, "2"); }
}
if(cat.equals("4")) { extrasz.putString(TAG_ODKADE, "3"); }
iz.putExtras(extrasz);
startActivityForResult(iz, 100);
}
});
// save button
btnSave = (Button) findViewById(R.id.btnSave);
// save button click event
btnSave.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
// starting background task to update product
new SaveProductDetails().execute();
}
});
new GetProductDetails().execute();
}
//koniec oncreate
// Response from VyberIcoActivity
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
// if result code 100
//navrat z vyberico prij aj vyd
if (resultCode == 201) {vylistuj201();}
//navrat z vyber pohyb 601prij 602vyd, 603banka
if (resultCode == 601) {vylistuj601();}
if (resultCode == 602) {vylistuj602();}
if (resultCode == 603) {vylistuj603();}
}
//koniec onactivityresult
private void vylistuj201() {
if( SettingsActivity.getCisloico(this).equals("0")) {
}else{
inputIco = (EditText) findViewById(R.id.inputIco);
inputIco.setText(SettingsActivity.getCisloico(this));
}
constantsCursor=db.rawQuery("SELECT _ID, title, titleico, titleodbm, value "+
"FROM constants WHERE _id = 1 ORDER BY title",
null);
//getString(2) znamena ze beriem 3tiu 0,1,2 premennu teda titleico
if (constantsCursor.moveToFirst()) {
idtitle=constantsCursor.getString(2);
idvalue=constantsCursor.getString(3);
}
inputIconaz = (TextView) findViewById(R.id.inputIconaz);
inputIconaz.setText(idtitle);
}
//koniec vylistuj
private void vylistuj601() {
constantsCursor=db.rawQuery("SELECT _ID, title, titlepoh, valuepoh, value "+
"FROM constants WHERE _id = 1 ORDER BY title",
null);
//getString(2) znamena ze beriem 3tiu 0,1,2 premennu teda titleico
if (constantsCursor.moveToFirst()) {
idtitle=constantsCursor.getString(2);
idvalue=constantsCursor.getString(3);
}
btnPohyb = (Button) findViewById(R.id.btnPohyb);
btnPohyb.setText(idtitle);
inputPoh = (EditText) findViewById(R.id.inputPoh);
inputPoh.setText(idvalue);
}
//koniec vylistuj
private void vylistuj602() {
constantsCursor=db.rawQuery("SELECT _ID, title, titlepoh, valuepoh, value "+
"FROM constants WHERE _id = 1 ORDER BY title",
null);
//getString(2) znamena ze beriem 3tiu 0,1,2 premennu teda titleico
if (constantsCursor.moveToFirst()) {
idtitle=constantsCursor.getString(2);
idvalue=constantsCursor.getString(3);
}
btnPohyb = (Button) findViewById(R.id.btnPohyb);
btnPohyb.setText(idtitle);
inputPoh = (EditText) findViewById(R.id.inputPoh);
inputPoh.setText(idvalue);
}
//koniec vylistuj
private void vylistuj603() {
constantsCursor=db.rawQuery("SELECT _ID, title, titlepoh, valuepoh, value "+
"FROM constants WHERE _id = 1 ORDER BY title",
null);
//getString(2) znamena ze beriem 3tiu 0,1,2 premennu teda titleico
if (constantsCursor.moveToFirst()) {
idtitle=constantsCursor.getString(2);
idvalue=constantsCursor.getString(3);
}
btnPohyb = (Button) findViewById(R.id.btnPohyb);
btnPohyb.setText(idtitle);
inputPoh = (EditText) findViewById(R.id.inputPoh);
inputPoh.setText(idvalue);
}
//koniec vylistuj
/**
* Background Async Task to Get complete product details
* */
class GetProductDetails extends AsyncTask<String, String, String> {
/**
* Before starting background thread Show Progress Dialog
* */
@Override
protected void onPreExecute() {
super.onPreExecute();
pDialog2 = new ProgressDialog(NewPoklPridajActivity.this);
pDialog2.setMessage(getString(R.string.progdata));
pDialog2.setIndeterminate(false);
pDialog2.setCancelable(true);
pDialog2.show();
}
/**
* Getting product details in background thread
* */
protected String doInBackground(String... params) {
// updating UI from Background Thread
runOnUiThread(new Runnable() {
public void run() {
// Check for success tag
int success;
try {
// Building Parameters
String prmall = inputAll.getText().toString();
String serverx = inputEdiServer.getText().toString();
String delims = "[/]+";
String[] serverxxx = serverx.split(delims);
String userx = inputEdiUser.getText().toString();
String userxplus = userx + "/" + fakx;
//String userhash = sha1Hash( userx );
MCrypt mcrypt = new MCrypt();
/* Encrypt */
try {
encrypted = MCrypt.bytesToHex( mcrypt.encrypt(userxplus) );
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
/* Decrypt */
//String decrypted = new String( mcrypt.decrypt( encrypted ) );
List<NameValuePair> params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("prmall", prmall));
params.add(new BasicNameValuePair("fakx", fakx));
params.add(new BasicNameValuePair("serverx", serverx));
//params.add(new BasicNameValuePair("userx", userx));
params.add(new BasicNameValuePair("userhash", encrypted));
params.add(new BasicNameValuePair("newx", newx));
params.add(new BasicNameValuePair("cat", cat));
// getting product details by making HTTP request
// Note that product details url will use GET request
JSONObject json = jsonParser.makeHttpRequest(
"http://" + serverxxx[0] + "/androidfanti/get_poklzah.php", "GET", params);
// check your log for json response
Log.d("Single Product Details", json.toString());
// json success tag
success = json.getInt(TAG_SUCCESS);
if (success == 1) {
// successfully received product details
JSONArray productObj = json
.getJSONArray(TAG_PRODUCT); // JSON Array
// get first product object from JSON Array
JSONObject product = productObj.getJSONObject(0);
// product with this pid found
// Edit Text
inputUce = (EditText) findViewById(R.id.inputUce);
inputDat = (EditText) findViewById(R.id.inputDat);
inputKto = (EditText) findViewById(R.id.inputKto);
inputTxp = (EditText) findViewById(R.id.inputTxp);
inputIco = (EditText) findViewById(R.id.inputIco);
inputIconaz = (TextView) findViewById(R.id.inputIconaz);
// display product data in EditText
inputUce.setText(product.getString(TAG_UCE));
inputDat.setText(product.getString(TAG_DAT));
inputKto.setText(product.getString(TAG_KTO));
inputIco.setText(product.getString(TAG_ICO));
inputIconaz.setText(product.getString(TAG_ICONAZ));
inputTxp.setText(product.getString(TAG_TXP));
}else{
// product with pid not found
}
} catch (JSONException e) {
e.printStackTrace();
}
}
});//endrunOnUiThread
return null;
}
/**
* After completing background task Dismiss the progress dialog
* **/
protected void onPostExecute(String file_url) {
// dismiss the dialog once got all details
pDialog2.dismiss();
}
}
/**
* Background Async Task to Save product Details
* */
class SaveProductDetails extends AsyncTask<String, String, String> {
/**
* Before starting background thread Show Progress Dialog
* */
@Override
protected void onPreExecute() {
super.onPreExecute();
pDialog = new ProgressDialog(NewPoklPridajActivity.this);
pDialog.setMessage(getString(R.string.progdata));
pDialog.setIndeterminate(false);
pDialog.setCancelable(true);
pDialog.show();
}
/**
* Saving product
* */
protected String doInBackground(String... args) {
// updating UI from Background Thread
runOnUiThread(new Runnable() {
public void run() {
inputZk0 = (EditText) findViewById( R.id.inputZk0 );
inputZk1 = (EditText) findViewById( R.id.inputZk1 );
inputZk2 = (EditText) findViewById( R.id.inputZk2 );
inputDn1 = (EditText) findViewById( R.id.inputDn1 );
inputDn2 = (EditText) findViewById( R.id.inputDn2 );
inputCelkom = (EditText) findViewById( R.id.inputCelkom );
inputPoh = (EditText) findViewById( R.id.inputPoh );
inputDat = (EditText) findViewById( R.id.inputDat );
inputFak = (EditText) findViewById( R.id.inputFak );
inputUce = (EditText) findViewById( R.id.inputUce );
inputKto = (EditText) findViewById( R.id.inputKto );
inputTxp = (EditText) findViewById( R.id.inputTxp );
inputIco = (EditText) findViewById( R.id.inputIco );
// getting updated data from EditTexts
String uce = inputUce.getText().toString();
String dat = inputDat.getText().toString();
String fak = inputFak.getText().toString();
String kto = inputKto.getText().toString();
String txp = inputTxp.getText().toString();
String ico = inputIco.getText().toString();
String poh = inputPoh.getText().toString();
String zk0 = inputZk0.getText().toString();
String zk1 = inputZk1.getText().toString();
String zk2 = inputZk2.getText().toString();
String dn1 = inputDn1.getText().toString();
String dn2 = inputDn2.getText().toString();
String clk = inputCelkom.getText().toString();
String prmall = inputAll.getText().toString();
String serverx = inputEdiServer.getText().toString();
String delims = "[/]+";
String[] serverxxx = serverx.split(delims);
String userx = inputEdiUser.getText().toString();
String userxplus = userx + "/" + fakx;
//String userhash = sha1Hash( userx );
MCrypt mcrypt = new MCrypt();
/* Encrypt */
try {
encrypted = MCrypt.bytesToHex( mcrypt.encrypt(userxplus) );
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
/* Decrypt */
//String decrypted = new String( mcrypt.decrypt( encrypted ) );
HttpParams httpParameters = new BasicHttpParams();
HttpClient client = new DefaultHttpClient(httpParameters);
client.getParams().setParameter("http.protocol.version", HttpVersion.HTTP_1_1);
client.getParams().setParameter("http.socket.timeout", 2000);
client.getParams().setParameter("http.protocol.content-charset", HTTP.UTF_8);
httpParameters.setBooleanParameter("http.protocol.expect-continue", false);
HttpPost request = new HttpPost("http://" + serverxxx[0] + "/androidfanti/uloz_newpoklzah.php?sid=" + String.valueOf(Math.random()));
request.getParams().setParameter("http.socket.timeout", 5000);
List<NameValuePair> postParameters = new ArrayList<NameValuePair>();
postParameters.add(new BasicNameValuePair("prmall", prmall));
postParameters.add(new BasicNameValuePair("uce", uce));
postParameters.add(new BasicNameValuePair(TAG_DAT, dat));
postParameters.add(new BasicNameValuePair(TAG_KTO, kto));
postParameters.add(new BasicNameValuePair(TAG_TXP, txp));
postParameters.add(new BasicNameValuePair(TAG_ICO, ico));
postParameters.add(new BasicNameValuePair("poh", poh));
postParameters.add(new BasicNameValuePair("fak", fak));
postParameters.add(new BasicNameValuePair("zk0", zk0));
postParameters.add(new BasicNameValuePair("zk1", zk1));
postParameters.add(new BasicNameValuePair("zk2", zk2));
postParameters.add(new BasicNameValuePair("dn1", dn1));
postParameters.add(new BasicNameValuePair("dn2", dn2));
postParameters.add(new BasicNameValuePair("celkom", clk));
postParameters.add(new BasicNameValuePair("serverx", serverx));
//postParameters.add(new BasicNameValuePair("userx", userx));
postParameters.add(new BasicNameValuePair("userhash", encrypted));
postParameters.add(new BasicNameValuePair("fakx", fakx));
postParameters.add(new BasicNameValuePair("newx", newx));
postParameters.add(new BasicNameValuePair("pozx", pozx));
postParameters.add(new BasicNameValuePair("cat", cat));
try {
UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(postParameters, HTTP.UTF_8);
request.setEntity(formEntity);
HttpResponse response = client.execute(request);
in = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
StringBuffer sb = new StringBuffer("");
String line = "";
//String lineSeparator = System.getProperty("line.separator");
while ((line = in.readLine()) != null) {
sb.append(line);
//sb.append(lineSeparator);
}
in.close();
String result = sb.toString();
String delimso = "[;]+";
String[] resultxxx = result.split(delimso);
if( resultxxx[0].equals("1")) {
// successfully updated
Intent i = getIntent();
// send result code 100 to notify about product update
setResult(100, i);
finish();
}else {
}
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
e.printStackTrace();
//Toast.makeText(EditProductv2Activity.this, e.toString(), Toast.LENGTH_LONG).show();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
//Toast.makeText(EditProductv2Activity.this, e.toString(), Toast.LENGTH_LONG).show();
}
}
});//end runOnUiThread
return null;
}
/**
* After completing background task Dismiss the progress dialog
* **/
protected void onPostExecute(String file_url) {
// dismiss the dialog once product uupdated
pDialog.dismiss();
}
}
//koniec save
} | [
"eurosecom1@gmail.com"
] | eurosecom1@gmail.com |
6fafac33753805e7161ab85ef9df7336d3f6c242 | 6f0577e5ac815c4ed653c9938877c7688fa52b98 | /locationsockets/src/main/java/com/smartconnect/locationsockets/Activity/MainActivity.java | b293d6488ebf016af5a8e3cf6af2a33894d27f9a | [] | no_license | AkshataAndroid/LocationTracker | 07d0f3c520441b718da465fd56ee4a93f9df0294 | 672b5a89e89d4b123b06a6dfa0b77ef2156eba95 | refs/heads/master | 2022-08-15T23:05:26.002468 | 2020-05-16T10:02:23 | 2020-05-16T10:02:23 | 264,408,175 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,179 | java | package com.smartconnect.locationsockets.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Toast;
import androidx.appcompat.widget.Toolbar;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.zxing.integration.android.IntentIntegrator;
import com.google.zxing.integration.android.IntentResult;
import com.smartconnect.locationsockets.Adapter.TabletListing;
import com.smartconnect.locationsockets.Handler.EventHandler;
import com.smartconnect.locationsockets.R;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
public class MainActivity extends BaseActivity {
RecyclerView list;
private IntentIntegrator qrScan;
public static EventHandler eventHandler;
FloatingActionButton fab;
TabletListing adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public void onResume() {
super.onResume();
activeScreen = MainActivity.class.getSimpleName();
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
if (result != null) {
if (result.getContents() == null) {
Log.e("Scan*******", "Cancelled scan");
} else {
Log.d("CODE", "Scanned" + result.getContents());
Log.d("Scan", "Scanned");
Toast.makeText(this, "Scanned: " + result.getContents(), Toast.LENGTH_LONG).show();
}
} else {
// This is important, otherwise the result will not be passed to the fragment
super.onActivityResult(requestCode, resultCode, data);
}
}
}
| [
"Akshata"
] | Akshata |
2698262582b7074209cf9d6042519230aa3c74a8 | be63900863969e5216d2832a7f97d1165673eecf | /mssc-beer-order-service/src/main/java/guru/sfg/beer/order/service/services/BeerOrderServiceImpl.java | 89bd842c6263ccccc57ac5bc123fc4c15f2ce196 | [] | no_license | jpmoraes97/mssc-beer-order-service | bd9d10980b09239d6f0c246a8e0d45a34d5a6ee9 | 39815c38447b04579a7ae31bd2f4f1f92053bb9b | refs/heads/master | 2022-09-14T11:52:09.491102 | 2020-05-22T01:01:43 | 2020-05-22T01:01:43 | 260,063,956 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,528 | java | /*
* Copyright 2019 the original author or authors.
*
* 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 3 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, see <https://www.gnu.org/licenses/>.
*/
package guru.sfg.beer.order.service.services;
import guru.sfg.beer.order.service.domain.BeerOrder;
import guru.sfg.beer.order.service.domain.Customer;
import guru.sfg.beer.order.service.domain.OrderStatusEnum;
import guru.sfg.beer.order.service.repositories.BeerOrderRepository;
import guru.sfg.beer.order.service.repositories.CustomerRepository;
import guru.sfg.beer.order.service.web.mappers.BeerOrderMapper;
import guru.sfg.beer.order.service.web.model.BeerOrderDto;
import guru.sfg.beer.order.service.web.model.BeerOrderPagedList;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Optional;
import java.util.UUID;
import java.util.stream.Collectors;
@Slf4j
@Service
public class BeerOrderServiceImpl implements BeerOrderService {
private final BeerOrderRepository beerOrderRepository;
private final CustomerRepository customerRepository;
private final BeerOrderMapper beerOrderMapper;
private final ApplicationEventPublisher publisher;
public BeerOrderServiceImpl(BeerOrderRepository beerOrderRepository,
CustomerRepository customerRepository,
BeerOrderMapper beerOrderMapper, ApplicationEventPublisher publisher) {
this.beerOrderRepository = beerOrderRepository;
this.customerRepository = customerRepository;
this.beerOrderMapper = beerOrderMapper;
this.publisher = publisher;
}
@Override
public BeerOrderPagedList listOrders(UUID customerId, Pageable pageable) {
Optional<Customer> customerOptional = customerRepository.findById(customerId);
if (customerOptional.isPresent()) {
Page<BeerOrder> beerOrderPage =
beerOrderRepository.findAllByCustomer(customerOptional.get(), pageable);
return new BeerOrderPagedList(beerOrderPage
.stream()
.map(beerOrderMapper::beerOrderToDto)
.collect(Collectors.toList()), PageRequest.of(
beerOrderPage.getPageable().getPageNumber(),
beerOrderPage.getPageable().getPageSize()),
beerOrderPage.getTotalElements());
} else {
return null;
}
}
@Transactional
@Override
public BeerOrderDto placeOrder(UUID customerId, BeerOrderDto beerOrderDto) {
Optional<Customer> customerOptional = customerRepository.findById(customerId);
if (customerOptional.isPresent()) {
BeerOrder beerOrder = beerOrderMapper.dtoToBeerOrder(beerOrderDto);
beerOrder.setId(null); //should not be set by outside client
beerOrder.setCustomer(customerOptional.get());
beerOrder.setOrderStatus(OrderStatusEnum.NEW);
beerOrder.getBeerOrderLines().forEach(line -> line.setBeerOrder(beerOrder));
BeerOrder savedBeerOrder = beerOrderRepository.saveAndFlush(beerOrder);
log.debug("Saved Beer Order: " + beerOrder.getId());
//todo impl
// publisher.publishEvent(new NewBeerOrderEvent(savedBeerOrder));
return beerOrderMapper.beerOrderToDto(savedBeerOrder);
}
//todo add exception type
throw new RuntimeException("Customer Not Found");
}
@Override
public BeerOrderDto getOrderById(UUID customerId, UUID orderId) {
return beerOrderMapper.beerOrderToDto(getOrder(customerId, orderId));
}
@Override
public void pickupOrder(UUID customerId, UUID orderId) {
BeerOrder beerOrder = getOrder(customerId, orderId);
beerOrder.setOrderStatus(OrderStatusEnum.PICKED_UP);
beerOrderRepository.save(beerOrder);
}
private BeerOrder getOrder(UUID customerId, UUID orderId) {
Optional<Customer> customerOptional = customerRepository.findById(customerId);
if (customerOptional.isPresent()) {
Optional<BeerOrder> beerOrderOptional = beerOrderRepository.findById(orderId);
if (beerOrderOptional.isPresent()) {
BeerOrder beerOrder = beerOrderOptional.get();
// fall to exception if customer id's do not match - order not for customer
if (beerOrder.getCustomer().getId().equals(customerId)) {
return beerOrder;
}
}
throw new RuntimeException("Beer Order Not Found");
}
throw new RuntimeException("Customer Not Found");
}
}
| [
"lookinhoo@hotmail.com"
] | lookinhoo@hotmail.com |
6ee23188d42bcac2a7f07cac25e88a3cf763b130 | 794473ff2ba2749db9c0782f5d281b00dd785a95 | /braches_20171206/qiubaotong-server/qbt-system-web/src/main/java/com/qbt/web/support/impl/SfNotifyConfigSupportImpl.java | 7a8a4773bbe1c1866f40c63002a028d0d9a5887b | [] | no_license | hexilei/qbt | a0fbc9c1870da1bf1ec24bba0f508841ca1b9750 | 040e5fcc9fbb27d52712cc1678d71693b5c85cce | refs/heads/master | 2021-05-05T23:03:20.377229 | 2018-01-12T03:33:12 | 2018-01-12T03:33:12 | 116,363,833 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,779 | java | package com.qbt.web.support.impl;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.qbt.common.entity.PageEntity;
import com.qbt.common.enums.ErrorCodeEnum;
import com.qbt.common.exception.BusinessException;
import com.qbt.common.util.BeanUtil;
import com.qbt.persistent.entity.SfNotifyConfig;
import com.qbt.service.SfNotifyConfigService;
import com.qbt.web.pojo.sfNotifyConfig.SfNotifyConfigAddReqVo;
import com.qbt.web.pojo.sfNotifyConfig.SfNotifyConfigPageReqVo;
import com.qbt.web.pojo.sfNotifyConfig.SfNotifyConfigVo;
import com.qbt.web.support.SfNotifyConfigSupport;
@Service
public class SfNotifyConfigSupportImpl implements SfNotifyConfigSupport {
@Resource
private SfNotifyConfigService notifyService;
@Override
public List<SfNotifyConfigVo> findByPage(SfNotifyConfigPageReqVo reqVo) {
PageEntity<SfNotifyConfig> pageEntity = BeanUtil.pageConvert(reqVo, SfNotifyConfig.class);
List<SfNotifyConfig> list = notifyService.findByPage(pageEntity);
List<SfNotifyConfigVo> voList = new ArrayList<SfNotifyConfigVo>();
for(SfNotifyConfig act : list){
SfNotifyConfigVo vo = BeanUtil.a2b(act, SfNotifyConfigVo.class);
voList.add(vo);
}
reqVo.setTotalCount(pageEntity.getTotalCount());
return voList;
}
@Override
public int add(SfNotifyConfigAddReqVo vo) {
SfNotifyConfig urgent = BeanUtil.a2b(vo, SfNotifyConfig.class);
if(notifyService.isDisabledNotify(vo.getOrderNumber())) {
throw new BusinessException(ErrorCodeEnum.ERROR_VALID_FAIL, "已存在通知数据");
}
int activityId = notifyService.insert(urgent);
return activityId;
}
@Override
public int deleteById(Integer id) {
return notifyService.deleteById(id);
}
}
| [
"louis.he@missionsky.com"
] | louis.he@missionsky.com |
9b1c2d368b8215d3d18fe28324488a075f14a497 | c3a83420ab341677929e4be7676467294e52aee3 | /everything-like/src/main/java/task/ScannerCallBack.java | 4ba4f6f81ecbd4ff2d3a455b7874351550bc82d8 | [] | no_license | LYHccc/study_java | 525474403d9c0aaadaac84c1bf1ba7d7d77de89e | 732e1ada5e3d9d2117ddfefac750f9b1354fbb6f | refs/heads/master | 2022-11-25T19:57:18.091460 | 2020-11-13T14:29:58 | 2020-11-13T14:29:58 | 217,519,014 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 188 | java | package task;
import java.io.File;
public interface ScannerCallBack {
//文件扫描回调,用来保存下一级子文件夹和子文件到数据库
void callBack(File dir);
}
| [
"1587168434@qq.com"
] | 1587168434@qq.com |
e6ff0a4e552882fc0adcb57c3524b3ce4e5739f1 | 4347ea57d9a2f78977c05ade175ed2d70134cde4 | /Trainer Works/JavaWorks/src/com/fannie/HelloWorld.java | c49943215cf136f52e9d8cc13d65813006a17c1e | [] | no_license | adithnaveen/SDET5 | fb92ed5459f43558a3027c4545957eea2ac4e3f3 | 4a3d60f1fe5085b111d32663f7542ed4974e1ab3 | refs/heads/master | 2020-12-30T14:57:29.930662 | 2018-09-11T09:37:13 | 2018-09-11T09:37:13 | 91,100,869 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 141 | java | package com.fannie;
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World from Java");
}
}
| [
"adith.naveen@gmail.com"
] | adith.naveen@gmail.com |
ec74c9737a0ac367df21860a69aa253f12a91d86 | 3c24d860428748edd185c401af8081004c8fb2ac | /src/main/java/org/gerald/inventario/repository/UserRepository.java | 38dbb17baa774ccc4b0cbc04aaf753eacdbe9329 | [] | no_license | Pollito777/inventario | e92423478ccbb48e3a96d0a4b5a9a7e8c5232a51 | 715cbf65331667c5b1bd422b990c8d7f14c4ef36 | refs/heads/master | 2016-09-14T01:10:39.251142 | 2016-04-19T22:23:15 | 2016-04-19T22:23:15 | 56,541,740 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 811 | java | package org.gerald.inventario.repository;
import org.gerald.inventario.domain.User;
import java.time.ZonedDateTime;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import java.util.List;
import java.util.Optional;
/**
* Spring Data JPA repository for the User entity.
*/
public interface UserRepository extends JpaRepository<User, Long> {
Optional<User> findOneByActivationKey(String activationKey);
List<User> findAllByActivatedIsFalseAndCreatedDateBefore(ZonedDateTime dateTime);
Optional<User> findOneByResetKey(String resetKey);
Optional<User> findOneByEmail(String email);
Optional<User> findOneByLogin(String login);
Optional<User> findOneById(Long userId);
@Override
void delete(User t);
}
| [
"lanselot_hailander@hotmail.com"
] | lanselot_hailander@hotmail.com |
945899ee809f62fc38ab09056402659e038b1544 | ad2a397919542bedf55a1e6ef61a982e7289b008 | /src/main/java/club/bugmakers/bruce/lombok/Demo08Data.java | 63f2360acc3c16dd2cce210844b8fdc2e5b717f8 | [] | no_license | BruceOuyang/boy-learning-lombok | b3fd3e0039ecc7455586481f30ae09572646beb7 | 8d3d46707ab9e3f6afff91651ae93a370336d8f7 | refs/heads/master | 2020-03-27T12:17:09.137398 | 2018-09-03T03:14:08 | 2018-09-03T03:14:08 | 146,536,972 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 366 | java | package club.bugmakers.bruce.lombok;
import lombok.Data;
/**
* @description: @Data注解作用比较全,其包含注解的集合@ToString,@EqualsAndHashCode,所有字段的@Getter和所有非final字段的@Setter, @RequiredArgsConstructor
* @author: ouyangqiangqiang
* @date: 2018/8/31 10:13
*/
@Data
public class Demo08Data {
private Integer id;
}
| [
"oiiopro@live.cn"
] | oiiopro@live.cn |
71caeb5d127c54a593497608a1b28ebf115a5c40 | 147d879833fdc4be9891d6b4a7227b64da4edc26 | /proyecto/src/main/java/com/citrus/api/domain/valueObjects/Application_Date.java | e209d6c6e31095272724d29e9f02955a9f27eaa2 | [] | no_license | Citrus-Software-Solutions/citrus-app-SpringbootAPI | 84f66064dd90cda74e100c62b8241ee241a46f0f | e56700f2b8268c5f2ccc56b38f02f20da76ab80f | refs/heads/main | 2023-06-28T06:23:25.014479 | 2021-08-06T14:31:03 | 2021-08-06T14:31:03 | 375,539,790 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 291 | java | package com.citrus.api.domain.valueObjects;
import java.util.Date;
public class Application_Date {
public Application_Date(Date value) {
this.value=value;
}
Date value;
public void setValue(Date value) {
this.value = value;
}
public Date getValue() {
return value;
}
}
| [
"marianangelic@gmail.com"
] | marianangelic@gmail.com |
d167bcfc8bc36f91f7ba971a1ba9d95867312e73 | 501315671527f4d158e0b85c613949313ffdbbec | /src/test/java/com/nowcoder/LikeServiceTests.java | d921cbeab06faa192c2c95a152f604a0707c2dd0 | [] | no_license | Treeriver/toutiao | 0fd771add2cf6db58f03de29d583e178310a24a0 | 966baa37b1ffa42662196db3542177bb6ebf4cef | refs/heads/master | 2021-01-22T04:01:34.397264 | 2017-10-24T02:08:08 | 2017-10-24T02:08:08 | 102,261,588 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,393 | java | package com.nowcoder;
import com.nowcoder.service.LikeService;
import org.junit.*;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
* Created by Administrator on 2017/8/17.
*/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = ToutiaoApplication.class)
public class LikeServiceTests {
@Autowired
LikeService likeService;
@Test
public void testLike(){
likeService.like(123,1,1);
Assert.assertEquals(1,likeService.getLikeStatus(123,1,1));//断言
}
@Test
public void testDisLike(){
likeService.dislike(123,1,1);
Assert.assertEquals(-1,likeService.getLikeStatus(123,1,1));//断言
}
@Test(expected = IllegalArgumentException.class)
public void testException(){
throw new IllegalArgumentException("xxxx");
}
@Before
public void setUp(){
System.out.println("setUp");
}
@After
public void tearDown(){
System.out.println("tearDown");
}
@BeforeClass
public static void beforeClass(){
System.out.println("beforeClass");
}
@AfterClass
public static void afterClass() {
System.out.println("afterClass");
}
}
| [
"1723137972@qq.com"
] | 1723137972@qq.com |
e5b153c69915f3ae8530bd3f44e33a788dcbe983 | 86bb5d7ae1c4d98bf9ef2e77806a88cc799447f0 | /backend/src/main/java/com/pazukdev/backend/config/GoogleDriveServiceConfig.java | f48c103b31f98a7fe68405ac7172f12dfdac3f93 | [] | no_license | pazukdev/bearings-info | 657e8b62cb2813e621282a5030c23c642f8a69b3 | 8f7597fdde204f30cb95da137ada1791682d40e3 | refs/heads/master | 2023-01-12T06:09:26.692297 | 2020-10-04T13:18:34 | 2020-10-04T13:18:34 | 182,553,960 | 0 | 0 | null | 2023-01-03T23:20:00 | 2019-04-21T15:58:58 | Java | UTF-8 | Java | false | false | 3,553 | java | package com.pazukdev.backend.config;
import com.google.api.client.auth.oauth2.Credential;
import com.google.api.client.extensions.java6.auth.oauth2.AuthorizationCodeInstalledApp;
import com.google.api.client.extensions.jetty.auth.oauth2.LocalServerReceiver;
import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow;
import com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets;
import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;
import com.google.api.client.http.javanet.NetHttpTransport;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.client.util.store.FileDataStoreFactory;
import com.google.api.services.drive.Drive;
import com.google.api.services.drive.DriveScopes;
import java.io.*;
import java.util.Collections;
import java.util.List;
//@Configuration
public class GoogleDriveServiceConfig {
private static final String APPLICATION_NAME = "Old Vehicles";
private static final JsonFactory JSON_FACTORY = JacksonFactory.getDefaultInstance();
private static final String TOKENS_DIRECTORY_PATH = "tokens";
/**
* Global instance of the scopes required by this quickstart.
* If modifying these scopes, delete your previously saved tokens/ folder.
*/
private static final List<String> SCOPES = Collections.singletonList(DriveScopes.DRIVE);
private static final String CREDENTIALS_FILE_PATH = "/old-vehicles.json";
/**
* Creates an authorized Credential object.
* @param HTTP_TRANSPORT The network HTTP Transport.
* @return An authorized Credential object.
* @throws IOException If the credentials.json file cannot be found.
*/
private static Credential getCredentials(final NetHttpTransport HTTP_TRANSPORT) throws Exception {
// Load client secrets.
InputStream in = GoogleDriveServiceConfig.class.getResourceAsStream(CREDENTIALS_FILE_PATH);
if (in == null) {
throw new FileNotFoundException("Resource not found: " + CREDENTIALS_FILE_PATH);
}
GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(JSON_FACTORY, new InputStreamReader(in));
// Build flow and trigger user authorization request.
GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(
HTTP_TRANSPORT, JSON_FACTORY, clientSecrets, SCOPES)
.setDataStoreFactory(new FileDataStoreFactory(new java.io.File(TOKENS_DIRECTORY_PATH)))
.setAccessType("offline")
.build();
LocalServerReceiver receiver = new LocalServerReceiver.Builder().setPort(8888).build();
return new AuthorizationCodeInstalledApp(flow, receiver).authorize("user");
}
// @Bean
public static Drive getGoogleDriveService() throws Exception {
final NetHttpTransport HTTP_TRANSPORT = GoogleNetHttpTransport.newTrustedTransport();
return new Drive.Builder(HTTP_TRANSPORT, JSON_FACTORY, getCredentials(HTTP_TRANSPORT))
.setApplicationName(APPLICATION_NAME)
.build();
}
public static void main(String[] args) throws Exception {
String fileId = "1_dybfXVuNeziHoR-0Dllop7xluXsX2RjQvP1wTqgC1o";
OutputStream outputStream = new ByteArrayOutputStream();
final Drive.Files.Export export = getGoogleDriveService().files().export(fileId, "text/plain");
export.executeMediaAndDownloadTo(outputStream);
System.out.println(outputStream);
}
} | [
"pazukdev@gmail.com"
] | pazukdev@gmail.com |
ac3fa87dbca71393c9328bbb66fcf5d7d533c9c3 | 01ed65f9bf77e8db2e416a4dc24a9463fe6f3480 | /testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/ssh/TestRSyncCommandExecutor.java | 173a57e40f617b4c5986e53cf88a2bb1be07cf45 | [
"Apache-2.0",
"MIT",
"JSON",
"GPL-1.0-or-later",
"BSD-3-Clause",
"LicenseRef-scancode-jdbm-1.00"
] | permissive | ckadner/hive_0.13 | 5f8f8f0fef4305ed166d897738988d6ff19a1da8 | ff80bddb86d7a7c4804bf388f8324056f6b1dae0 | refs/heads/branch-0.13 | 2022-10-23T03:11:53.734028 | 2014-06-02T19:23:08 | 2014-06-02T19:23:08 | 35,976,845 | 0 | 0 | Apache-2.0 | 2022-10-05T00:14:41 | 2015-05-20T22:09:07 | Java | UTF-8 | Java | false | false | 3,628 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.hive.ptest.execution.ssh;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import junit.framework.Assert;
import org.apache.hive.ptest.execution.Constants;
import org.apache.hive.ptest.execution.LocalCommand;
import org.apache.hive.ptest.execution.MockLocalCommandFactory;
import org.junit.Before;
import org.junit.Test;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class TestRSyncCommandExecutor {
private static final Logger LOG = LoggerFactory
.getLogger(TestRSyncCommandExecutor.class);
private MockLocalCommandFactory localCommandFactory;
@Before
public void setup() throws Exception {
localCommandFactory = new MockLocalCommandFactory(LOG);
}
@Test
public void testShutdownBeforeWaitFor() throws Exception {
LocalCommand localCommand = mock(LocalCommand.class);
localCommandFactory.setInstance(localCommand);
RSyncCommandExecutor executor = new RSyncCommandExecutor(LOG, localCommandFactory);
Assert.assertFalse(executor.isShutdown());
executor.shutdownNow();
RSyncCommand command = new RSyncCommand(executor, "privateKey", "user", "host", 1, "local", "remote", RSyncCommand.Type.FROM_LOCAL);
executor.execute(command);
Assert.assertTrue(executor.isShutdown());
Assert.assertEquals(Constants.EXIT_CODE_UNKNOWN, command.getExitCode());
if(command.getException() != null) {
throw new Exception("Unexpected exception during execution", command.getException());
}
verify(localCommand, times(1)).kill();
}
@Test
public void testShutdownDuringWaitFor() throws Exception {
LocalCommand localCommand = mock(LocalCommand.class);
localCommandFactory.setInstance(localCommand);
final RSyncCommandExecutor executor = new RSyncCommandExecutor(LOG, localCommandFactory);
Assert.assertFalse(executor.isShutdown());
when(localCommand.getExitCode()).thenAnswer(new Answer<Integer>() {
@Override
public Integer answer(InvocationOnMock invocation) throws Throwable {
executor.shutdownNow();
return Constants.EXIT_CODE_UNKNOWN;
}
});
RSyncCommand command = new RSyncCommand(executor, "privateKey", "user", "host", 1, "local", "remote", RSyncCommand.Type.FROM_LOCAL);
executor.execute(command);
Assert.assertTrue(executor.isShutdown());
Assert.assertEquals(Constants.EXIT_CODE_UNKNOWN, command.getExitCode());
if(command.getException() != null) {
throw new Exception("Unexpected exception during execution", command.getException());
}
verify(localCommand, never()).kill();
}
} | [
"brock@apache.org"
] | brock@apache.org |
79c0964051db1e42c81171a441e8694f52ff0e36 | c91f7d1f090e407b28b07ffd806bfd95fc536f29 | /mavenexample/src/test/java/TF/Create_garantie_project_sign.java | 61b93b4dced5422eda97962b88117ba4233de592 | [
"Apache-2.0"
] | permissive | master4ein/Trade_Finance | 36d77658758fffc6c32ae41fea740972d0a3c10e | de17d5b6a16047bc9c09a139449dc37a5f1674fd | refs/heads/master | 2020-11-29T23:37:47.546336 | 2020-02-03T10:01:48 | 2020-02-03T10:01:48 | 230,239,943 | 0 | 0 | Apache-2.0 | 2020-10-13T19:07:14 | 2019-12-26T09:59:37 | Java | UTF-8 | Java | false | false | 6,463 | java | package TF;
import static org.junit.Assert.fail;
//Создание на основе гарантии в статусе "Проект"
import java.io.File;
import java.util.ArrayList;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.engine.script.Script;
import org.junit.jupiter.params.provider.Arguments;
import org.openqa.selenium.By;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.openqa.selenium.JavascriptExecutor;
public class Create_garantie_project_sign {
private WebDriver driver;
@BeforeEach
void setUp() throws Exception {
ChromeOptions options = new ChromeOptions();
options.addArguments("--user-data-dir=C:\\Users\\YD052CKF\\AppData\\Local\\Google\\Chrome\\User Data");
options.addArguments("--profile-directory=Profile");
options.addExtensions(new File("C:\\Users\\YD052CKF\\Extensions\\1.2.7_1.crx"));
driver = new ChromeDriver(options);
driver.get("http://46.182.25.137/v1/#/login");
Thread.sleep(5000);
//Выбираем сертификат(крипто-про оператор по умолчанию)
WebElement t = (new WebDriverWait(driver, 30)).
until(ExpectedConditions.presenceOfElementLocated(By.tagName("button")));
((JavascriptExecutor) driver).executeScript("arguments[0].click()", t);
//((JavascriptExecutor) driver).executeScript("arguments[0].click()",
// driver.findElement(By.tagName("button")));
//Thread.sleep(3000);
//t = driver.findElement(By.className("btn-success"));
t = (new WebDriverWait(driver, 3)).
//Кликнуть кнопку "Выбрать"
until(ExpectedConditions.presenceOfElementLocated(By.xpath("//*[@id=\"__BVID__90___BV_modal_body_\"]/div[2]/button/span")));
System.out.println(t);
System.out.println(t.isEnabled());
System.out.println(t.isDisplayed());
System.out.println(t.getText());
//t.click();
((JavascriptExecutor) driver).executeScript("arguments[0].click()", t);
t = (new WebDriverWait(driver, 10)).
//Кликнуть войти в систему
//*[@id="__BVID__34___BV_modal_body_"]/div[2]/button[2]/span
until(ExpectedConditions.presenceOfElementLocated(By.xpath("//*[@id=\"__BVID__34___BV_modal_body_\"]/div[2]/button[2]/span")));
System.out.println(t);
System.out.println(t.isEnabled());
System.out.println(t.isDisplayed());
System.out.println(t.getText());
//t.click();
((JavascriptExecutor) driver).executeScript("arguments[0].click()", t);
Thread.sleep(50000);
//t = (new WebDriverWait(driver, 10));
/*Обходим ошибку
until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("#__BVID__150___BV_modal_footer_ > div > button")));
System.out.println(t);
System.out.println(t.isEnabled());
System.out.println(t.isDisplayed());
System.out.println(t.getText());
//t.click();
((JavascriptExecutor) driver).executeScript("arguments[0].click()", t);*/
t = (new WebDriverWait(driver, 10)).
//Войти в заявку в статусе "Проект"
until(ExpectedConditions.presenceOfElementLocated(By.partialLinkText("Выход")));
System.out.println(t);
System.out.println(t.isEnabled());
System.out.println(t.isDisplayed());
System.out.println(t.getText());
//t.click();
((JavascriptExecutor) driver).executeScript("arguments[0].click()", t);
t = (new WebDriverWait(driver, 10)).
//Thread.sleep(3000);
//Создать на основе
until(ExpectedConditions.presenceOfElementLocated(By.xpath("//*[@id=\"app\"]/div[2]/div[2]/div[1]/div/div/div/div[3]/div[2]/div[10]/button[5]/span")));
System.out.println(t);
System.out.println(t.isEnabled());
System.out.println(t.isDisplayed());
System.out.println(t.getText());
t.click();
((JavascriptExecutor) driver).executeScript("arguments[0].click()", t);
t = (new WebDriverWait(driver, 10)).
//Подтвердить действие
until(ExpectedConditions.presenceOfElementLocated(By.xpath("//*[@id=\"__BVID__363___BV_modal_footer_\"]/div/button[2]/span")));
System.out.println(t);
System.out.println(t.isEnabled());
System.out.println(t.isDisplayed());
System.out.println(t.getText());
t.click();
((JavascriptExecutor) driver).executeScript("arguments[0].click()", t);
// t = (new WebDriverWait(driver, 10)).
Thread.sleep(3000);
//Предполагаемая дата выдачи
WebElement element;
element = driver.findElement(By.xpath("//*[@id=\"__BVID__467\"]"));
element.sendKeys("27123000");
//Окончание срока действия гарантии
element = driver.findElement(By.xpath("//*[@id=\"__BVID__502\"]"));
element.sendKeys("27123003");
t = (new WebDriverWait(driver, 10)).
//Сохранить заявление
until(ExpectedConditions.presenceOfElementLocated(By.xpath("//*[@id=\"app\"]/div[2]/div[2]/div[1]/div/div/div/div[3]/div[2]/form/div[68]/button[2]/span")));
System.out.println(t);
System.out.println(t.isEnabled());
System.out.println(t.isDisplayed());
System.out.println(t.getText());
t.click();
((JavascriptExecutor) driver).executeScript("arguments[0].click()", t);
Thread.sleep(3000);
}
@AfterEach
void tearDown() throws Exception {
//driver.close();
}
@Test
void test() {
}
}
| [
"master4ein@mail.ru"
] | master4ein@mail.ru |
d303d97abdc11761b1b805f9018332e93dd95327 | 7cb7c478a85fd6c48dd1480cdab5180b6484cc7b | /app/src/main/java/com/scu/xing/myapplication/BCReceiver3.java | 43a81e5c7c21998b0404a4d1cc037ee1560b7d77 | [] | no_license | xingyiyang/MyApplication | b24f5694ebb8603ab92f442464725f85bbc8e55e | e719aa8446535790d3808a0ea24a71459a923216 | refs/heads/master | 2021-01-19T19:01:59.103429 | 2017-08-23T14:01:32 | 2017-08-23T14:01:32 | 101,181,312 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 421 | java | package com.scu.xing.myapplication;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
/**
* Created by xing on 2017/8/9.
*/
public class BCReceiver3 extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent) {
Log.i("info","收到异步广播消息");
}
}
| [
"532956941@qq.com"
] | 532956941@qq.com |
b77f23b08f0463f6d6730a94b8a803c7358ef6ee | d51f69f48c2b001ae15f15a2e54b31f00f06f610 | /app/src/main/java/de/vkay/updateapps/AlleApps/AlleApps.java | 2906082681582eebfb673661f3fede3a61c7901e | [] | no_license | vkay94/UpdateApps | 238d1604501c246f5a411d8df7338a73ecc7444c | a33b3b1ce46163b256f7625280fdd4696b700865 | refs/heads/master | 2020-05-21T23:42:48.262270 | 2017-03-05T16:25:35 | 2017-03-05T16:25:35 | 69,366,582 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,582 | java | package de.vkay.updateapps.AlleApps;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.view.View;
import java.util.ArrayList;
import de.vkay.updateapps.Datenspeicher.DB_AlleApps;
import de.vkay.updateapps.R;
public class AlleApps extends AppCompatActivity {
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_alle_apps);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
if(getSupportActionBar() != null){ getSupportActionBar().setDisplayHomeAsUpEnabled(true); }
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onBackPressed();
}
});
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerview_alleapps);
GridLayoutManager gridLayoutManager = new GridLayoutManager(this, 3);
recyclerView.setLayoutManager(gridLayoutManager);
DB_AlleApps db_alleApps = new DB_AlleApps(this);
ArrayList<AlleAppsDatatype> allAppsArray = db_alleApps.getDatabaseApps();
RAdapterAlleApps rvAAA = new RAdapterAlleApps(allAppsArray, getApplicationContext(), this);
recyclerView.setAdapter(rvAAA);
recyclerView.setHasFixedSize(true);
}
}
| [
"viktor.krez94@gmail.com"
] | viktor.krez94@gmail.com |
435c89d57f87de0d589f83cfbf325519637859bd | d0744bc40de3d7406913272059be2b279a29aaa6 | /src/bases/Constraints.java | 0ccac0239cfa9420847bed5660423c297ec3ccca | [] | no_license | 5kywa1k3r/Pacman | a71e24a47e6e7333087456603fc5bfeedc6e15e2 | dbc28f415fe9916d8b333c93943dcd8c76b651a7 | refs/heads/master | 2020-03-17T04:04:43.745986 | 2018-05-13T18:12:57 | 2018-05-13T18:12:57 | 133,261,957 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 582 | java | package bases;
public class Constraints {
public float top;
public float bottom;
public float left;
public float right;
public Constraints(float top, float bottom, float left, float right) {
this.top = top;
this.bottom = bottom;
this.left = left;
this.right = right;
}
public void make(Vector2D position) {
if (position.y < top) position.y = top;
if (position.y > bottom) position.y = bottom;
if (position.x < left) position.x = left;
if (position.x > right) position.x = right;
}
}
| [
"daoduyanh.tin47@gmail.com"
] | daoduyanh.tin47@gmail.com |
5f24917784ab4227d0b05ee28f91c8f3483ef0a6 | 8d4cab77f05e8d6662870a1b014ddbf8ede78a8a | /app/src/main/java/com/nedaei1375/json_place_holder_rest_api_example/Model/PhotosData.java | f62a1f9fff930c6c665b7ef1bb6792aef8e63194 | [] | no_license | MortezaNedaei/Android-Rest-API-Application | 13d832ae4f444db90c83f218289b7d63078e98c6 | 261e8725e4af843479809dfc1dc7bef8df1c294b | refs/heads/master | 2020-05-28T01:45:22.185954 | 2019-05-27T14:06:00 | 2019-05-27T14:06:00 | 188,845,942 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,224 | java | package com.nedaei1375.json_place_holder_rest_api_example.Model;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class PhotosData {
@SerializedName("albumId")
@Expose
private int albumId;
@SerializedName("id")
@Expose
private int id;
@SerializedName("title")
@Expose
private String title;
@SerializedName("url")
@Expose
private String url;
@SerializedName("thumbnailUrl")
@Expose
private String thumbnailUrl;
public int getAlbumId() {
return albumId;
}
public void setAlbumId(int albumId) {
this.albumId = albumId;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getThumbnailUrl() {
return thumbnailUrl;
}
public void setThumbnailUrl(String thumbnailUrl) {
this.thumbnailUrl = thumbnailUrl;
}
}
| [
"nedaei1375@gmail.com"
] | nedaei1375@gmail.com |
09d259cb375eb490fa03d939addd795c9600e442 | f3c85130bd3b7d5b9d47b181f4afd561e6e626cb | /src/main/java/pageObjects/LoginPageElements.java | b769d62e27873d0516dbec304ccc0d0636fe2ee1 | [] | no_license | pathansapna/Screenshots_Framework | 839c41d09cc11941f2b78d9c9dcc646b085b9f2a | 665ba948bcb3f7e9eb7a7bbcd2bf9b2599f6d439 | refs/heads/main | 2023-08-02T09:09:43.340001 | 2021-10-07T03:47:16 | 2021-10-07T03:47:16 | 414,306,721 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 180 | java | package pageObjects;
public interface LoginPageElements {
String loginTest= "//body/div[@id='a-page']/div[1]/div[1]/div[1]/a[1]/i[1]";
String emailAddress = "ap_email";
}
| [
"pathansapna@gmail.com"
] | pathansapna@gmail.com |
63e5b61cf9198a5a4d23c4a7b2b107f97d9aea64 | dbb9c951130e253cc18723266a00a3eb0fd06bd8 | /src/main/java/com/aldren/entity/User.java | 9bf16b08b6b6e0a3ac3f8442d22b856e00a1df21 | [] | no_license | iamaldren/BookingManagementSystem | 278c25c4f627ac658405855c5a7ecb0d7e4d4040 | 8a102c4fee014043c5c174db84eaa53313c251fd | refs/heads/dev | 2023-05-31T20:05:57.345128 | 2021-06-27T04:09:44 | 2021-06-27T04:09:44 | 347,665,990 | 0 | 0 | null | 2021-06-27T04:10:55 | 2021-03-14T14:55:02 | Java | UTF-8 | Java | false | false | 305 | java | package com.aldren.entity;
import lombok.Getter;
import lombok.Setter;
import org.springframework.data.redis.core.RedisHash;
import org.springframework.data.redis.core.index.Indexed;
@Getter
@Setter
@RedisHash("User")
public class User {
@Indexed
private String id;
private String name;
}
| [
"aldrenbobiles@gmail.com"
] | aldrenbobiles@gmail.com |
1c6084830390fb6ff273b5120bee6eafe454d519 | f69442a56bcdcc9db4377c8667e4abf15984485e | /src/saptechnoteaser2022/week3/TheBigPizza.java | 11268011df59ca1374a650100b69357479a3d0be | [] | no_license | saplabsbg/technoteaser | 53465ab61830f0958970d57481a91eef3b431aac | 2ebcb5cc8bbb253486b6e7397187d1c321e2c6a2 | refs/heads/master | 2023-01-13T07:41:22.723064 | 2022-06-01T08:21:16 | 2022-06-01T08:21:16 | 170,290,785 | 1 | 2 | null | 2020-06-17T09:14:05 | 2019-02-12T09:34:27 | Java | UTF-8 | Java | false | false | 1,074 | java | package saptechnoteaser2022.week3;
/*
* <h1>The big pizza</h1>
* SAPTechnoteaser 2022, Week3, Question2
* @see <a href="https://saplabsbg.github.io/technoteaser/docs/technoteaser2022/#week3,question2">Description and explanation</a>
*
*/
public class TheBigPizza {
public static final int NUMBER_OF_PEOPLE = 100;
public static final int PIZZA_PIECES = 100;
public static void main(String[] args) {
double pizzaAmmountLeft = PIZZA_PIECES;
double maxPizzaAmmountTaken = 0;
int personWithMaxPizzaAmmount = 0;
for (int i = 1; i <= NUMBER_OF_PEOPLE; i++) {
double pizzaAmmountForCurrentPerson = pizzaAmmountLeft*i/100;
if (pizzaAmmountForCurrentPerson > maxPizzaAmmountTaken) {
maxPizzaAmmountTaken = pizzaAmmountForCurrentPerson;
personWithMaxPizzaAmmount = i;
}
pizzaAmmountLeft -= pizzaAmmountForCurrentPerson;
}
System.out.println("The maximum pizza amount goes to person " + personWithMaxPizzaAmmount + " taking " + maxPizzaAmmountTaken + " out of " + NUMBER_OF_PEOPLE + " pieces");
}
}
| [
"35692212+JordanJordanov@users.noreply.github.com"
] | 35692212+JordanJordanov@users.noreply.github.com |
fec242c3d71526125dcd256024cd02230c6fc99e | 537b5adaffdada7f6d7a9744925df2ca6571a0de | /app/src/main/java/geekbrains/AndroidBasicLevel/forecastData/ForecastCoord.java | 9923a0b958150c9bba25655f4544d09755788036 | [] | no_license | VadimSurits/Android.BasicLevel | 4104ede0c5a1f25bcf2a3b7da42faa7e4f8ca4af | 32c8f23941c06df80ef25ce3dba0ce2cc2bd9a92 | refs/heads/master | 2022-12-29T05:06:17.190571 | 2020-10-13T10:36:57 | 2020-10-13T10:36:57 | 286,946,188 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 547 | java | package geekbrains.AndroidBasicLevel.forecastData;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class ForecastCoord {
@SerializedName("lat")
@Expose
private float lat;
@SerializedName("lon")
@Expose
private float lon;
public float getLon() {
return lon;
}
public void setLon(float lon) {
this.lon = lon;
}
public float getLat() {
return lat;
}
public void setLat(float lat) {
this.lat = lat;
}
}
| [
"Sourits-moscow@mail.ru"
] | Sourits-moscow@mail.ru |
cee5434576e24219c7c3294ec416746b3297224e | 5250398e2b3d6e3abcbbd2825330d05b4eb94414 | /j360-dubbo-base/src/main/java/me/j360/dubbo/base/model/result/PageDTO.java | 47e72bd5e46cfb607842548a7c24295d5b716771 | [] | no_license | pengqing123/dubbo-app-all | 1616bc0b79f5295afc71844dd20e172e5fb80689 | 2cda281507bee6a4dc7b0fc7e3479549d5fb5a18 | refs/heads/master | 2021-08-08T21:37:28.637844 | 2017-11-01T12:00:09 | 2017-11-01T12:00:09 | 110,332,337 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 908 | java | package me.j360.dubbo.base.model.result;
import java.io.Serializable;
public class PageDTO<T> implements Serializable {
private static final long serialVersionUID = 1L;
private int recordCount;
private int recordSize;
private int pageNo;
private int pageSize;
private T data;
public int getRecordCount() {
return recordCount;
}
public void setRecordCount(int recordCount) {
this.recordCount = recordCount;
}
public int getRecordSize() {
return recordSize;
}
public void setRecordSize(int recordSize) {
this.recordSize = recordSize;
}
public int getPageNo() {
return pageNo;
}
public void setPageNo(int pageNo) {
this.pageNo = pageNo;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public T getData() {
return data;
}
public void setData(T data) {
this.data = data;
}
}
| [
"xumin_wlt@163.com"
] | xumin_wlt@163.com |
306dfaec663198950dec534aa3b9bacbb318e462 | 0162500c98cd9ed1d1036c72febbe57c46aaecff | /src/main/java/com/nallani/login/registration/service/impl/UserServiceImpl.java | 46e349b7ab1407f4bdd6f3339db2dbca1cfb4a7a | [
"MIT"
] | permissive | Nallani9/registration | f8c275285e9bd452bf649aad07a4e7708da7f2da | d59ea826ce9e4684568aa2ea2266d4f770caa757 | refs/heads/master | 2023-07-19T18:36:45.022195 | 2021-08-18T04:58:59 | 2021-08-18T04:58:59 | 351,283,317 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 588 | java | package com.nallani.login.registration.service.impl;
import com.nallani.login.registration.model.User;
import com.nallani.login.registration.repository.UserRepository;
import com.nallani.login.registration.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class UserServiceImpl implements UserService {
@Autowired
private UserRepository userRepository;
@Override
public User findByUsername(String username) {
return userRepository.findByUsername(username);
}
} | [
"nallanisrikanth99@gmail.com"
] | nallanisrikanth99@gmail.com |
b6d8e0e035a2a8d31d2e12da833988629371b51b | 755a5432e9b53191a8941591f560e7a4fc28b1a0 | /java-web-project/src05/main/java/com/eomcs/lms/servlet/MemberUpdateServlet.java | 6e896a0813b7dddda6d7ab2f8a6045f0ac72f6ee | [] | no_license | SeungWanWoo/bitcamp-java-2018-12 | 4cff763ddab52721f24ce8abcebcec998dacc9e3 | d14a8a935ef7a4d24eb633fedea892378e59168d | refs/heads/master | 2021-08-06T22:11:24.954160 | 2019-08-06T08:17:07 | 2019-08-06T08:17:07 | 163,650,664 | 0 | 0 | null | 2020-04-30T03:39:17 | 2018-12-31T08:00:39 | Java | UTF-8 | Java | false | false | 1,980 | java |
package com.eomcs.lms.servlet;
import java.io.IOException;
import java.util.UUID;
import javax.servlet.ServletException;
import javax.servlet.annotation.MultipartConfig;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.Part;
import org.springframework.context.ApplicationContext;
import com.eomcs.lms.domain.Member;
import com.eomcs.lms.service.MemberService;
@MultipartConfig(maxFileSize = 1024 * 1024 * 5)
@SuppressWarnings("serial")
@WebServlet("/member/update")
public class MemberUpdateServlet extends HttpServlet {
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
MemberService memberService = ((ApplicationContext) this.getServletContext()
.getAttribute("iocContainer")).getBean(MemberService.class);
response.setContentType("text/html;charset=UTF-8");
Member member = new Member();
member.setNo(Integer.parseInt(request.getParameter("no")));
member.setName(request.getParameter("name"));
member.setEmail(request.getParameter("email"));
member.setPassword(request.getParameter("password"));
member.setTel(request.getParameter("tel"));
Part photo = request.getPart("photo");
if (photo.getSize() > 0) {
String filename = UUID.randomUUID().toString();
String uploadDir = this.getServletContext().getRealPath("/upload/member");
photo.write(uploadDir + "/" + filename);
member.setPhoto(filename);
}
if (memberService.update(member) == 1) {
response.sendRedirect("list");
return;
}
request.setAttribute("error.title", "회원 변경 오류");
request.setAttribute("error.content", "해당 번호의 수업이 없습니다.");
request.getRequestDispatcher("/error.jsp").include(request, response);
}
}
| [
"seungwan.woo94@gmail.com"
] | seungwan.woo94@gmail.com |
769b54be8a9f3075f2021131cf1f0e2940807fd6 | c8912a1b594c2b34ff0815ff733a89afa78d25e5 | /Array/Peak-Index-in-a-Mountain-Array/src/com/zmc/Main.java | 72a8e78f85ed3d4db6978fc0625a05e6420a2537 | [] | no_license | ZhangXiaoM/LeetCode | c7925b4b29da123affab825bd74d821ef1e051b8 | bddcabf5ba1176d9d8c323e95c9b1fbc90af47c8 | refs/heads/master | 2018-10-16T09:03:23.830001 | 2018-08-31T03:36:35 | 2018-08-31T03:36:35 | 117,225,464 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,505 | java |
/*
https://leetcode.com/problems/peak-index-in-a-mountain-array/description/
Let's call an array A a mountain if the following properties hold:
A.length >= 3
There exists some 0 < i < A.length - 1 such that A[0] < A[1] < ... A[i-1] < A[i] > A[i+1] > ... > A[A.length - 1]
Given an array that is definitely a mountain, return any i such that A[0] < A[1] < ... A[i-1] < A[i] > A[i+1] > ... > A[A.length - 1].
Example 1:
Input: [0,1,0]
Output: 1
Example 2:
Input: [0,2,1,0]
Output: 1
Note:
3 <= A.length <= 10000
0 <= A[i] <= 10^6
A is a mountain, as defined above.
*/
package com.zmc;
public class Main {
public static void main(String[] args) {
// write your code here
int[] A = {3,4,5,1};
peakIndexInMountainArray1(A);
}
// time O(N)
public int peakIndexInMountainArray(int[] A) {
if (A == null || A.length < 3) return -1;
for (int i = 1; i < A.length - 1; ++i) {
if (A[i] >= A[i - 1] && A[i] <= A[i + 1])
return i;
}
return -1;
}
public static int peakIndexInMountainArray1(int[] A) {
if (A == null || A.length < 3) return -1;
int lo = 0, hi = A.length - 1;
while (lo < hi) {
int mid = lo + (hi - lo) / 2;
if (A[mid] < A[mid + 1]) {
lo = mid + 1;
} else if (A[mid] < A[mid - 1]) {
hi = mid;
} else {
return mid;
}
}
return -1;
}
}
| [
"zhangmc81@163.com"
] | zhangmc81@163.com |
87c04ebd86864a147e8e4b1520e5218b9ff78fe4 | bcbc759d0163c45d45196b8ba2a76f0d52b95bcb | /xxpay-manage/src/main/java/org/xxpay/manage/settlement/ctrl/AgentpayController.java | 1c703a0334452edffd754d1d5959118229575fdd | [] | no_license | xiaoxiaoguai233/xxpay-0514 | 0cec7a9bdeaa7a9cd19509d5859b01f9bf2a62c0 | e234dc6a597a7ccd824066c82c8f21a1e870315a | refs/heads/main | 2023-04-25T16:22:32.984923 | 2021-05-09T07:25:05 | 2021-05-09T07:25:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,475 | java | package org.xxpay.manage.settlement.ctrl;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.xxpay.core.common.constant.Constant;
import org.xxpay.core.common.domain.XxPayPageRes;
import org.xxpay.core.common.domain.XxPayResponse;
import org.xxpay.core.common.util.StrUtil;
import org.xxpay.core.common.util.XXPayUtil;
import org.xxpay.core.entity.AgentpayPassageAccount;
import org.xxpay.core.entity.MchAgentpayRecord;
import org.xxpay.manage.common.ctrl.BaseController;
import org.xxpay.manage.common.service.RpcCommonService;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
/**
* @author: dingzhiwei
* @date: 17/12/6
* @description: 代付
*/
@RestController
@RequestMapping(Constant.MGR_CONTROLLER_ROOT_PATH + "/agentpay")
public class AgentpayController extends BaseController {
@Autowired
private RpcCommonService rpcCommonService;
/**
* 代付列表查询
* @return
*/
@RequestMapping("/list")
@ResponseBody
public ResponseEntity<?> list(HttpServletRequest request) {
JSONObject param = getJsonParam(request);
MchAgentpayRecord mchAgentpayRecord = getObject(param, MchAgentpayRecord.class);
if(mchAgentpayRecord == null) mchAgentpayRecord = new MchAgentpayRecord();
int count = rpcCommonService.rpcMchAgentpayService.count(mchAgentpayRecord, getQueryObj(param));
if(count == 0) return ResponseEntity.ok(XxPayPageRes.buildSuccess());
List<MchAgentpayRecord> mchAgentpayRecordList = rpcCommonService.rpcMchAgentpayService.select((getPageIndex(param)-1) * getPageSize(param), getPageSize(param), mchAgentpayRecord, getQueryObj(param));
for(MchAgentpayRecord mchAgentpayRecord1 : mchAgentpayRecordList) {
// 取银行卡号前四位和后四位,中间星号代替
String accountNo = StrUtil.str2Star3(mchAgentpayRecord1.getAccountNo(), 4, 4, 4);
mchAgentpayRecord1.setAccountNo(accountNo);
}
return ResponseEntity.ok(XxPayPageRes.buildSuccess(mchAgentpayRecordList, count));
}
/**
* 代付记录查询
* @return
*/
@RequestMapping("/get")
@ResponseBody
public ResponseEntity<?> get(HttpServletRequest request) {
JSONObject param = getJsonParam(request);
String agentpayOrderId = getStringRequired(param, "agentpayOrderId");
MchAgentpayRecord mchAgentpayRecord = new MchAgentpayRecord();
mchAgentpayRecord.setAgentpayOrderId(agentpayOrderId);
mchAgentpayRecord = rpcCommonService.rpcMchAgentpayService.find(mchAgentpayRecord);
if(mchAgentpayRecord != null) {
// 取银行卡号前四位和后四位,中间星号代替
String accountNo = StrUtil.str2Star3(mchAgentpayRecord.getAccountNo(), 4, 4, 4);
mchAgentpayRecord.setAccountNo(accountNo);
}
return ResponseEntity.ok(XxPayResponse.buildSuccess(mchAgentpayRecord));
}
@RequestMapping("/trans_query")
@ResponseBody
public ResponseEntity<?> queryTrans(HttpServletRequest request) {
JSONObject param = getJsonParam(request);
String transOrderId = getStringRequired(param, "transOrderId");
JSONObject resObj = rpcCommonService.rpcXxPayTransService.queryTrans(transOrderId);
if(XXPayUtil.isSuccess(resObj)) {
JSONObject jsonObject = resObj.getJSONObject("channelObj");
return ResponseEntity.ok(XxPayResponse.buildSuccess(jsonObject == null ? "转账接口没有返回channelObj" : jsonObject.toJSONString()));
}else {
return ResponseEntity.ok(XxPayResponse.buildSuccess("查询通道异常"));
}
}
/**
* 查询统计数据
* @return
*/
@RequestMapping("/count")
@ResponseBody
public ResponseEntity<?> count(HttpServletRequest request) {
JSONObject param = getJsonParam(request);
Long mchId = getLong(param, "mchId");
String agentpayOrderId = getString(param, "agentpayOrderId");
String transOrderId = getString(param, "transOrderId");
String accountName = getString(param, "accountName");
Byte status = getByte(param, "status");
Byte agentpayChannel = getByte(param, "agentpayChannel");
// 订单起止时间
String createTimeStartStr = getString(param, "createTimeStart");
String createTimeEndStr = getString(param, "createTimeEnd");
Map allMap = rpcCommonService.rpcMchAgentpayService.count4All(mchId, accountName, agentpayOrderId, transOrderId, status, agentpayChannel, createTimeStartStr, createTimeEndStr);
JSONObject obj = new JSONObject();
obj.put("allTotalCount", allMap.get("totalCount")); // 所有订单数
obj.put("allTotalAmount", allMap.get("totalAmount")); // 金额
obj.put("allTotalFee", allMap.get("totalFee")); // 费用
obj.put("allTotalSubAmount", allMap.get("totalSubAmount")); // 扣减金额
return ResponseEntity.ok(XxPayResponse.buildSuccess(obj));
}
}
| [
"1255343742@qq.com"
] | 1255343742@qq.com |
f77290bd24b1f65806a0706c2da8416440dbd67c | 6b5990f5e6a980239ab0c7b3a5087fe71ae40727 | /src/main/java/com/smoothstack/utopia/entities/User.java | 9b475bad48c1cc6be7e1b51c9ae642b1aada476b | [] | no_license | Matthew-Crowell/Utopia-Microservices | 10f3a6b74785f7f0145a23de68a181662c6a75d6 | a369175786a533402d9ccd4be660f6629b1d05e5 | refs/heads/master | 2023-06-03T20:53:38.058813 | 2021-06-22T01:03:54 | 2021-06-22T01:03:54 | 379,099,293 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,652 | java | package com.smoothstack.utopia.entities;
import javax.persistence.*;
import java.util.Objects;
/**
* Class representing User data in the database.
*
* @author matthew.crowell
*/
@Entity
public class User {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
@ManyToOne
private UserRole role;
private String givenName;
private String familyName;
private String username;
private String email;
private String phone;
private String password;
/**
* Get user id.
*
* @return int user id
*/
public long getId() {
return id;
}
/**
* Set user id.
*
* @param id int user id
*/
public void setId(long id) {
this.id = id;
}
/**
* Get user's role.
*
* @return UserRole user's role
*/
public UserRole getRole() {
return role;
}
/**
* Set user's role.
*
* @param role UserRole user's role
*/
public void setRole(UserRole role) {
this.role = role;
}
/**
* Get user's given name.
*
* @return String given name
*/
public String getGivenName() {
return givenName;
}
/**
* Set user's given name.
*
* @param givenName String user's given name
*/
public void setGivenName(String givenName) {
this.givenName = givenName;
}
/**
* Get passenger's family name.
*
* @return String passenger's family name.
*/
public String getFamilyName() {
return familyName;
}
/**
* Set user's family name.
*
* @param familyName String user's family name
*/
public void setFamilyName(String familyName) {
this.familyName = familyName;
}
/**
* Get user's username.
*
* @return String user's username
*/
public String getUsername() {
return username;
}
/**
* Set user's username.
*
* @param username String user's username
*/
public void setUsername(String username) {
this.username = username;
}
/**
* Get user's email.
*
* @return String user's email address
*/
public String getEmail() {
return email;
}
/**
* Set user's email.
*
* @param email String email address
*/
public void setEmail(String email) {
this.email = email;
}
/**
* Get user's phone number.
*
* @return String user's phone number
*/
public String getPhone() {
return phone;
}
/**
* Set user's phone number.
*
* @param phone String user's phone number
*/
public void setPhone(String phone) {
this.phone = phone;
}
/**
* Get user's stored password.
*
* @return String user's password as stored in database
*/
public String getPassword() {
return password;
}
/**
* Set user's password.
*
* @param password user's password as stored in database
*/
public void setPassword(String password) {
this.password = password;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
User user = (User) o;
return id == user.id && Objects.equals(role, user.role) && Objects.equals(givenName, user.givenName) && Objects.equals(familyName, user.familyName) && Objects.equals(username, user.username) && Objects.equals(email, user.email) && Objects.equals(phone, user.phone) && Objects.equals(password, user.password);
}
@Override
public int hashCode() {
return Objects.hash(id, role, givenName, familyName, username, email, phone, password);
}
@Override
public String toString() {
return "User{" +
"id=" + id +
", role=" + role +
", givenName='" + givenName + '\'' +
", familyName='" + familyName + '\'' +
", username='" + username + '\'' +
", email='" + email + '\'' +
", phone='" + phone + '\'' +
", password='" + password + '\'' +
'}';
}
}
| [
"83970387+Matthew-Crowell@users.noreply.github.com"
] | 83970387+Matthew-Crowell@users.noreply.github.com |
32af736f377f2d67f17bdd0fcc20a9cdc61c8a86 | 48e835e6f176a8ac9ae3ca718e8922891f1e5a18 | /benchmark/training/io/grpc/alts/internal/AltsProtocolNegotiatorTest.java | eef24a081dc7da638e30458b89fb32aea94f7140 | [] | no_license | STAMP-project/dspot-experiments | f2c7a639d6616ae0adfc491b4cb4eefcb83d04e5 | 121487e65cdce6988081b67f21bbc6731354a47f | refs/heads/master | 2023-02-07T14:40:12.919811 | 2019-11-06T07:17:09 | 2019-11-06T07:17:09 | 75,710,758 | 14 | 19 | null | 2023-01-26T23:57:41 | 2016-12-06T08:27:42 | null | UTF-8 | Java | false | false | 14,906 | java | /**
* Copyright 2018 The gRPC Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.grpc.alts.internal;
import AltsProtocolNegotiator.ALTS_CONTEXT_KEY;
import AltsProtocolNegotiator.TSI_PEER_KEY;
import Grpc.TRANSPORT_ATTR_LOCAL_ADDR;
import Grpc.TRANSPORT_ATTR_REMOTE_ADDR;
import GrpcAttributes.ATTR_SECURITY_LEVEL;
import SecurityLevel.PRIVACY_AND_INTEGRITY;
import TsiHandshakeHandler.TsiHandshakeCompletionEvent;
import Unpooled.EMPTY_BUFFER;
import io.grpc.Attributes;
import io.grpc.InternalChannelz;
import io.grpc.alts.internal.TsiPeer.Property;
import io.grpc.netty.GrpcHttp2ConnectionHandler;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufAllocator;
import io.netty.buffer.CompositeByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelDuplexHandler;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelPromise;
import io.netty.channel.embedded.EmbeddedChannel;
import io.netty.handler.codec.http2.Http2ConnectionDecoder;
import io.netty.handler.codec.http2.Http2ConnectionEncoder;
import io.netty.handler.codec.http2.Http2Settings;
import io.netty.util.ReferenceCounted;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.security.GeneralSecurityException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.Future;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
/**
* Tests for {@link AltsProtocolNegotiator}.
*/
@RunWith(JUnit4.class)
public class AltsProtocolNegotiatorTest {
private final AltsProtocolNegotiatorTest.CapturingGrpcHttp2ConnectionHandler grpcHandler = capturingGrpcHandler();
private final List<ReferenceCounted> references = new ArrayList<>();
private final LinkedBlockingQueue<AltsProtocolNegotiatorTest.InterceptingProtector> protectors = new LinkedBlockingQueue<>();
private EmbeddedChannel channel;
private Throwable caughtException;
private volatile TsiHandshakeCompletionEvent tsiEvent;
private ChannelHandler handler;
private TsiPeer mockedTsiPeer = new TsiPeer(Collections.<Property<?>>emptyList());
private AltsAuthContext mockedAltsContext = new AltsAuthContext(HandshakerResult.newBuilder().setPeerRpcVersions(RpcProtocolVersionsUtil.getRpcProtocolVersions()).build());
private final TsiHandshaker mockHandshaker = new AltsProtocolNegotiatorTest.DelegatingTsiHandshaker(FakeTsiHandshaker.newFakeHandshakerServer()) {
@Override
public TsiPeer extractPeer() throws GeneralSecurityException {
return mockedTsiPeer;
}
@Override
public Object extractPeerObject() throws GeneralSecurityException {
return mockedAltsContext;
}
};
private final NettyTsiHandshaker serverHandshaker = new NettyTsiHandshaker(mockHandshaker);
@Test
public void handshakeShouldBeSuccessful() throws Exception {
doHandshake();
}
// List cast
@Test
@SuppressWarnings("unchecked")
public void protectShouldRoundtrip() throws Exception {
// Write the message 1 character at a time. The message should be buffered
// and not interfere with the handshake.
final AtomicInteger writeCount = new AtomicInteger();
String message = "hello";
for (int ix = 0; ix < (message.length()); ++ix) {
ByteBuf in = Unpooled.copiedBuffer(message, ix, 1, StandardCharsets.UTF_8);
// go/futurereturn-lsc
@SuppressWarnings("unused")
Future<?> possiblyIgnoredError = channel.write(in).addListener(new ChannelFutureListener() {
@Override
public void operationComplete(ChannelFuture future) throws Exception {
if (future.isSuccess()) {
writeCount.incrementAndGet();
}
}
});
}
channel.flush();
// Now do the handshake. The buffered message will automatically be protected
// and sent.
doHandshake();
// Capture the protected data written to the wire.
Assert.assertEquals(1, channel.outboundMessages().size());
ByteBuf protectedData = channel.readOutbound();
Assert.assertEquals(message.length(), writeCount.get());
// Read the protected message at the server and verify it matches the original message.
TsiFrameProtector serverProtector = serverHandshaker.createFrameProtector(channel.alloc());
List<ByteBuf> unprotected = new ArrayList<>();
serverProtector.unprotect(protectedData, ((List<Object>) ((List<?>) (unprotected))), channel.alloc());
// We try our best to remove the HTTP2 handler as soon as possible, but just by constructing it
// a settings frame is written (and an HTTP2 preface). This is hard coded into Netty, so we
// have to remove it here. See {@code Http2ConnectionHandler.PrefaceDecode.sendPreface}.
int settingsFrameLength = 9;
CompositeByteBuf unprotectedAll = new CompositeByteBuf(channel.alloc(), false, ((unprotected.size()) + 1), unprotected);
ByteBuf unprotectedData = unprotectedAll.slice(settingsFrameLength, message.length());
Assert.assertEquals(message, unprotectedData.toString(StandardCharsets.UTF_8));
// Protect the same message at the server.
final AtomicReference<ByteBuf> newlyProtectedData = new AtomicReference<>();
serverProtector.protectFlush(Collections.singletonList(unprotectedData), new io.grpc.alts.internal.TsiFrameProtector.Consumer<ByteBuf>() {
@Override
public void accept(ByteBuf buf) {
newlyProtectedData.set(buf);
}
}, channel.alloc());
// Read the protected message at the client and verify that it matches the original message.
channel.writeInbound(newlyProtectedData.get());
Assert.assertEquals(1, channel.inboundMessages().size());
Assert.assertEquals(message, channel.<ByteBuf>readInbound().toString(StandardCharsets.UTF_8));
}
@Test
public void unprotectLargeIncomingFrame() throws Exception {
// We use a server frameprotector with twice the standard frame size.
int serverFrameSize = 4096 * 2;
// This should fit into one frame.
byte[] unprotectedBytes = new byte[serverFrameSize - 500];
Arrays.fill(unprotectedBytes, ((byte) (7)));
ByteBuf unprotectedData = Unpooled.wrappedBuffer(unprotectedBytes);
unprotectedData.writerIndex(unprotectedBytes.length);
// Perform handshake.
doHandshake();
// Protect the message on the server.
TsiFrameProtector serverProtector = serverHandshaker.createFrameProtector(serverFrameSize, channel.alloc());
serverProtector.protectFlush(Collections.singletonList(unprotectedData), new io.grpc.alts.internal.TsiFrameProtector.Consumer<ByteBuf>() {
@Override
public void accept(ByteBuf buf) {
channel.writeInbound(buf);
}
}, channel.alloc());
channel.flushInbound();
// Read the protected message at the client and verify that it matches the original message.
Assert.assertEquals(1, channel.inboundMessages().size());
ByteBuf receivedData1 = channel.readInbound();
int receivedLen1 = receivedData1.readableBytes();
byte[] receivedBytes = new byte[receivedLen1];
receivedData1.readBytes(receivedBytes, 0, receivedLen1);
assertThat(unprotectedBytes.length).isEqualTo(receivedBytes.length);
assertThat(unprotectedBytes).isEqualTo(receivedBytes);
}
@Test
public void flushShouldFailAllPromises() throws Exception {
doHandshake();
channel.pipeline().addFirst(new ChannelDuplexHandler() {
@Override
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
throw new Exception("Fake exception");
}
});
// Write the message 1 character at a time.
String message = "hello";
final AtomicInteger failures = new AtomicInteger();
for (int ix = 0; ix < (message.length()); ++ix) {
ByteBuf in = Unpooled.copiedBuffer(message, ix, 1, StandardCharsets.UTF_8);
// go/futurereturn-lsc
@SuppressWarnings("unused")
Future<?> possiblyIgnoredError = channel.write(in).addListener(new ChannelFutureListener() {
@Override
public void operationComplete(ChannelFuture future) throws Exception {
if (!(future.isSuccess())) {
failures.incrementAndGet();
}
}
});
}
channel.flush();
// Verify that the promises fail.
Assert.assertEquals(message.length(), failures.get());
}
@Test
public void doNotFlushEmptyBuffer() throws Exception {
doHandshake();
Assert.assertEquals(1, protectors.size());
AltsProtocolNegotiatorTest.InterceptingProtector protector = protectors.poll();
String message = "hello";
ByteBuf in = Unpooled.copiedBuffer(message, StandardCharsets.UTF_8);
Assert.assertEquals(0, protector.flushes.get());
Future<?> done = channel.write(in);
channel.flush();
done.get(5, TimeUnit.SECONDS);
Assert.assertEquals(1, protector.flushes.get());
done = channel.write(EMPTY_BUFFER);
channel.flush();
done.get(5, TimeUnit.SECONDS);
Assert.assertEquals(1, protector.flushes.get());
}
@Test
public void peerPropagated() throws Exception {
doHandshake();
assertThat(grpcHandler.attrs.get(TSI_PEER_KEY)).isEqualTo(mockedTsiPeer);
assertThat(grpcHandler.attrs.get(ALTS_CONTEXT_KEY)).isEqualTo(mockedAltsContext);
assertThat(grpcHandler.attrs.get(TRANSPORT_ATTR_REMOTE_ADDR).toString()).isEqualTo("embedded");
assertThat(grpcHandler.attrs.get(TRANSPORT_ATTR_LOCAL_ADDR).toString()).isEqualTo("embedded");
assertThat(grpcHandler.attrs.get(ATTR_SECURITY_LEVEL)).isEqualTo(PRIVACY_AND_INTEGRITY);
}
private final class CapturingGrpcHttp2ConnectionHandler extends GrpcHttp2ConnectionHandler {
private Attributes attrs;
private CapturingGrpcHttp2ConnectionHandler(Http2ConnectionDecoder decoder, Http2ConnectionEncoder encoder, Http2Settings initialSettings) {
super(null, decoder, encoder, initialSettings);
}
@Override
public void handleProtocolNegotiationCompleted(Attributes attrs, InternalChannelz.Security securityInfo) {
// If we are added to the pipeline, we need to remove ourselves. The HTTP2 handler
channel.pipeline().remove(this);
this.attrs = attrs;
}
}
private static class DelegatingTsiHandshakerFactory implements TsiHandshakerFactory {
private TsiHandshakerFactory delegate;
DelegatingTsiHandshakerFactory(TsiHandshakerFactory delegate) {
this.delegate = delegate;
}
@Override
public TsiHandshaker newHandshaker(String authority) {
return delegate.newHandshaker(authority);
}
}
private class DelegatingTsiHandshaker implements TsiHandshaker {
private final TsiHandshaker delegate;
DelegatingTsiHandshaker(TsiHandshaker delegate) {
this.delegate = delegate;
}
@Override
public void getBytesToSendToPeer(ByteBuffer bytes) throws GeneralSecurityException {
delegate.getBytesToSendToPeer(bytes);
}
@Override
public boolean processBytesFromPeer(ByteBuffer bytes) throws GeneralSecurityException {
return delegate.processBytesFromPeer(bytes);
}
@Override
public boolean isInProgress() {
return delegate.isInProgress();
}
@Override
public TsiPeer extractPeer() throws GeneralSecurityException {
return delegate.extractPeer();
}
@Override
public Object extractPeerObject() throws GeneralSecurityException {
return delegate.extractPeerObject();
}
@Override
public TsiFrameProtector createFrameProtector(ByteBufAllocator alloc) {
AltsProtocolNegotiatorTest.InterceptingProtector protector = new AltsProtocolNegotiatorTest.InterceptingProtector(delegate.createFrameProtector(alloc));
protectors.add(protector);
return protector;
}
@Override
public TsiFrameProtector createFrameProtector(int maxFrameSize, ByteBufAllocator alloc) {
AltsProtocolNegotiatorTest.InterceptingProtector protector = new AltsProtocolNegotiatorTest.InterceptingProtector(delegate.createFrameProtector(maxFrameSize, alloc));
protectors.add(protector);
return protector;
}
}
private static class InterceptingProtector implements TsiFrameProtector {
private final TsiFrameProtector delegate;
final AtomicInteger flushes = new AtomicInteger();
InterceptingProtector(TsiFrameProtector delegate) {
this.delegate = delegate;
}
@Override
public void protectFlush(List<ByteBuf> unprotectedBufs, io.grpc.alts.internal.TsiFrameProtector.Consumer<ByteBuf> ctxWrite, ByteBufAllocator alloc) throws GeneralSecurityException {
flushes.incrementAndGet();
delegate.protectFlush(unprotectedBufs, ctxWrite, alloc);
}
@Override
public void unprotect(ByteBuf in, List<Object> out, ByteBufAllocator alloc) throws GeneralSecurityException {
delegate.unprotect(in, out, alloc);
}
@Override
public void destroy() {
delegate.destroy();
}
}
}
| [
"benjamin.danglot@inria.fr"
] | benjamin.danglot@inria.fr |
5abf0bf551bd8904a94d992bf3d5c9ca10e6e824 | 72f28643a856847a7e5db03c2bfd962cb96e8e87 | /sponge/sponge-service-api6/src/main/java/me/lucko/luckperms/sponge/service/proxy/api6/SubjectDataProxy.java | 8ab169cf9d547e22cf5745c699f5532c353004c5 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | Tominous/LuckPerms | 829b46f9bc182c4e67d51bf25e887adec4301406 | d937c9ce0622eabd060b97c43a8e777859e2ae1a | refs/heads/master | 2021-01-02T11:42:50.131071 | 2020-02-10T00:45:47 | 2020-02-10T00:45:47 | 239,608,668 | 1 | 0 | MIT | 2020-02-10T20:40:47 | 2020-02-10T20:40:47 | null | UTF-8 | Java | false | false | 8,380 | java | /*
* This file is part of LuckPerms, licensed under the MIT License.
*
* Copyright (c) lucko (Luck) <luck@lucko.me>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package me.lucko.luckperms.sponge.service.proxy.api6;
import me.lucko.luckperms.common.util.ImmutableCollectors;
import me.lucko.luckperms.sponge.service.CompatibilityUtil;
import me.lucko.luckperms.sponge.service.model.LPPermissionService;
import me.lucko.luckperms.sponge.service.model.LPSubject;
import me.lucko.luckperms.sponge.service.model.LPSubjectData;
import me.lucko.luckperms.sponge.service.model.LPSubjectReference;
import me.lucko.luckperms.sponge.service.model.ProxiedServiceObject;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.spongepowered.api.service.context.Context;
import org.spongepowered.api.service.permission.Subject;
import org.spongepowered.api.service.permission.SubjectData;
import org.spongepowered.api.util.Tristate;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
@SuppressWarnings("unchecked")
public final class SubjectDataProxy implements SubjectData, ProxiedServiceObject {
private final LPPermissionService service;
private final LPSubjectReference ref;
private final boolean enduring;
public SubjectDataProxy(LPPermissionService service, LPSubjectReference ref, boolean enduring) {
this.service = service;
this.ref = ref;
this.enduring = enduring;
}
private CompletableFuture<LPSubjectData> handle() {
return this.enduring ?
this.ref.resolveLp().thenApply(LPSubject::getSubjectData) :
this.ref.resolveLp().thenApply(LPSubject::getTransientSubjectData);
}
@SuppressWarnings("rawtypes")
@Override
public @NonNull Map<Set<Context>, Map<String, Boolean>> getAllPermissions() {
return (Map) handle().thenApply(handle -> handle.getAllPermissions().entrySet().stream()
.collect(ImmutableCollectors.toMap(
e -> CompatibilityUtil.convertContexts(e.getKey()),
Map.Entry::getValue
))).join();
}
@Override
public @NonNull Map<String, Boolean> getPermissions(@NonNull Set<Context> contexts) {
return handle().thenApply(handle -> handle.getPermissions(CompatibilityUtil.convertContexts(contexts))).join();
}
@Override
public boolean setPermission(@NonNull Set<Context> contexts, @NonNull String permission, @NonNull Tristate value) {
handle().thenCompose(handle -> handle.setPermission(
CompatibilityUtil.convertContexts(contexts),
permission,
CompatibilityUtil.convertTristate(value)
));
return true;
}
@Override
public boolean clearPermissions() {
handle().thenCompose(LPSubjectData::clearPermissions);
return true;
}
@Override
public boolean clearPermissions(@NonNull Set<Context> contexts) {
handle().thenCompose(handle -> handle.clearPermissions(CompatibilityUtil.convertContexts(contexts)));
return true;
}
@SuppressWarnings("rawtypes")
@Override
public @NonNull Map<Set<Context>, List<Subject>> getAllParents() {
return (Map) handle().thenApply(handle -> handle.getAllParents().entrySet().stream()
.collect(ImmutableCollectors.toMap(
e -> CompatibilityUtil.convertContexts(e.getKey()),
e -> e.getValue().stream()
.map(s -> new SubjectProxy(this.service, s))
.collect(ImmutableCollectors.toList())
)
)).join();
}
@SuppressWarnings("rawtypes")
@Override
public @NonNull List<Subject> getParents(@NonNull Set<Context> contexts) {
return (List) handle().thenApply(handle -> handle.getParents(CompatibilityUtil.convertContexts(contexts)).stream()
.map(s -> new SubjectProxy(this.service, s))
.collect(ImmutableCollectors.toList())).join();
}
@Override
public boolean addParent(@NonNull Set<Context> contexts, @NonNull Subject parent) {
handle().thenCompose(handle -> handle.addParent(
CompatibilityUtil.convertContexts(contexts),
this.service.getReferenceFactory().obtain(parent)
));
return true;
}
@Override
public boolean removeParent(@NonNull Set<Context> contexts, @NonNull Subject parent) {
handle().thenCompose(handle -> handle.removeParent(
CompatibilityUtil.convertContexts(contexts),
this.service.getReferenceFactory().obtain(parent)
));
return true;
}
@Override
public boolean clearParents() {
handle().thenCompose(LPSubjectData::clearParents);
return true;
}
@Override
public boolean clearParents(@NonNull Set<Context> contexts) {
handle().thenCompose(handle -> handle.clearParents(CompatibilityUtil.convertContexts(contexts)));
return true;
}
@SuppressWarnings("rawtypes")
@Override
public @NonNull Map<Set<Context>, Map<String, String>> getAllOptions() {
return (Map) handle().thenApply(handle -> handle.getAllOptions().entrySet().stream()
.collect(ImmutableCollectors.toMap(
e -> CompatibilityUtil.convertContexts(e.getKey()),
Map.Entry::getValue
))).join();
}
@Override
public @NonNull Map<String, String> getOptions(@NonNull Set<Context> contexts) {
return handle().thenApply(handle -> handle.getOptions(CompatibilityUtil.convertContexts(contexts))).join();
}
@Override
public boolean setOption(@NonNull Set<Context> contexts, @NonNull String key, String value) {
if (value == null) {
handle().thenCompose(handle -> handle.unsetOption(CompatibilityUtil.convertContexts(contexts), key));
return true;
} else {
handle().thenCompose(handle -> handle.setOption(CompatibilityUtil.convertContexts(contexts), key, value));
return true;
}
}
@Override
public boolean clearOptions(@NonNull Set<Context> contexts) {
handle().thenCompose(handle -> handle.clearOptions(CompatibilityUtil.convertContexts(contexts)));
return true;
}
@Override
public boolean clearOptions() {
handle().thenCompose(LPSubjectData::clearOptions);
return true;
}
@Override
public boolean equals(Object o) {
if (o == this) return true;
if (!(o instanceof SubjectDataProxy)) return false;
final SubjectDataProxy other = (SubjectDataProxy) o;
return this.ref.equals(other.ref) && this.enduring == other.enduring;
}
@Override
public int hashCode() {
final int PRIME = 59;
int result = 1;
result = result * PRIME + this.ref.hashCode();
result = result * PRIME + (this.enduring ? 79 : 97);
return result;
}
@Override
public String toString() {
return "luckperms.api6.SubjectDataProxy(ref=" + this.ref + ", enduring=" + this.enduring + ")";
}
}
| [
"git@lucko.me"
] | git@lucko.me |
dd7a395e95be502d1ac43e4db00a4e6ef40afb5f | ca1b55b39c4d4d6acfbf2b5592889f7c994297db | /src/com/find/guide/api/user/GetVerifyCodeRequest.java | 55065c724930f16fa8ec5f3e774e09bd0b9f9d91 | [] | no_license | MichaelSun/TourGuide | cdc583c06a0b5e3c6a223c91513b4b78e7e5f7e6 | 948e02a01b691fd9c4d3b291b882a189a101250e | refs/heads/master | 2020-04-25T04:26:33.942828 | 2013-11-26T07:13:41 | 2013-11-26T07:13:41 | 13,464,281 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 535 | java | package com.find.guide.api.user;
import com.find.guide.api.base.PMRequestBase;
import com.plugin.internet.core.annotations.NoNeedTicket;
import com.plugin.internet.core.annotations.RequiredParam;
import com.plugin.internet.core.annotations.RestMethodUrl;
@NoNeedTicket
@RestMethodUrl("user/getVerifyCode")
public class GetVerifyCodeRequest extends PMRequestBase<GetVerifyCodeResponse> {
@RequiredParam("mobile")
private String mobile;
public GetVerifyCodeRequest(String mobile) {
this.mobile = mobile;
}
}
| [
"di.zhang1@renren-inc.com"
] | di.zhang1@renren-inc.com |
9f27c1cb6da659164ca074bebde41a04c5a967c2 | 525140451790502aa9eca53ba7ffece8e1ff9b40 | /myfirstexample-algo/BFSDFSForArticle/src/java/bfsdfs/Node.java | 977426190add9a9307458bdeb20dfba98e898298 | [] | no_license | abhilashranjan/myfisrtexample | e8a50a1ea7eff2972aef97b45a0a9f8be20946ac | 4fdc918e9b02a3e739cb3a59a72978aed18bf574 | refs/heads/master | 2021-01-10T14:56:25.049024 | 2018-07-05T03:19:03 | 2018-07-05T03:19:03 | 53,335,020 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 185 | java | package bfsdfs;
/**
* Created by anya on 6/4/17.
*/
public class Node {
int data;
public boolean visted=false;
public Node(int data) {
this.data = data;
}
}
| [
"ranjan.abhilash@gmail.com"
] | ranjan.abhilash@gmail.com |
ca4f16560c0abd9e6c591c601eb64cf1a430e297 | b925e681cfa649ae53a3eaff3c909d6f486405f1 | /src/main/java/hello/springmvc/basic/request/RequestHeaderController.java | 0e3a1f2a4b734706113bae5512857d48edf89b32 | [] | no_license | twkim5235/spring_mvc_2 | fc606b1c31fa1c0d367afb1994e19fd11655ec41 | 6a9b424f3c9f3c6e92654ce41782f632f71a1f9e | refs/heads/main | 2023-07-06T20:33:31.233089 | 2021-08-28T08:29:58 | 2021-08-28T08:29:58 | 399,821,043 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,421 | java | package hello.springmvc.basic.request;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpMethod;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Locale;
@Slf4j
@RestController
public class RequestHeaderController {
@RequestMapping("/headers")
public String headers(HttpServletRequest request,
HttpServletResponse response,
HttpMethod httpMethod,
Locale locale,
@RequestHeader MultiValueMap<String, String> headerMap,
@RequestHeader("host") String host,
@CookieValue(value = "myCookie", required = false) String cookie
){
log.info("request={}", request);
log.info("response={}", response);
log.info("httpMethod={}", httpMethod);
log.info("locale={}", locale);
log.info("headerMap={}", headerMap);
log.info("header host={}", host);
log.info("myCookie={}", cookie);
return "ok";
}
}
| [
"sssunggure@naver.com"
] | sssunggure@naver.com |
5ddcf14dd51a391e0fc798e75e6eedfc1003db8f | 6f7d9bb78091d649791688d4b6ad646020b7aeaa | /app/src/main/java/in/teachcoder/app/userInterface1/layouts/LinearLayoutHorActivity.java | 29d58fc1e144d4774fe22e19530e3ca8923d2392 | [] | no_license | Dinesh-Sunny/ApiGuideApp | eb256d18ce3601fce4ed5b91f320f487f7c663d2 | 4fc585be3090d4645666f69f6e2ae165adb67833 | refs/heads/master | 2021-01-23T13:18:19.062909 | 2015-07-22T09:57:35 | 2015-07-22T09:57:35 | 39,442,104 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,217 | java | package in.teachcoder.app.userInterface1.layouts;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import in.teachcoder.app.apiguideapp0.R;
public class LinearLayoutHorActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_linear_layout_hor);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_linear_layout_hor, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
| [
"nazusana9594@gmail.com"
] | nazusana9594@gmail.com |
fdfdecc887f1af7c032502e16a1a6863d2e8f190 | 8080bc1da3e138fd6ea7f271879829090f3b5744 | /SQLiteCameraDataMigrationApp/app/src/main/java/com/example/sqlitecameradatamigrationapp/FeedReaderDbHelper.java | 968c56a3526b8df1cb8f36fa38103fe74273ed83 | [] | no_license | karishmacrao/android_learning | e64fa1dfb94401c432557f82addf643bed1757f8 | 9d3e91eb96717ae8f8b55822c3d48e87a0811992 | refs/heads/master | 2020-06-03T11:56:00.200815 | 2019-07-08T10:06:40 | 2019-07-08T10:06:40 | 191,558,672 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,519 | java | package com.example.sqlitecameradatamigrationapp;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import static com.example.sqlitecameradatamigrationapp.FeedEntryDao.SQL_CREATE_ENTRIES;
public class FeedReaderDbHelper {
private static FeedReaderDbHelper mInstance;
private SQLiteDatabase mDatabase;
private FeedReaderDbHelper(Context context) {
mDatabase = new FeedDb(context).getWritableDatabase();
}
public static void init(Context context) {
mInstance = new FeedReaderDbHelper(context);
}
public static FeedReaderDbHelper getInstance() {
return mInstance;
}
public SQLiteDatabase getDB() {
return mDatabase;
}
class FeedDb extends SQLiteOpenHelper {
public static final String DATABASE_NAME = "FeedReader.db";
public static final int DATABASE_VERSION = 1;
public FeedDb(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(SQL_CREATE_ENTRIES);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
// db.execSQL(SQL_DELETE_ENTRIES);
// onCreate(db);
}
public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) {
// onUpgrade(db, oldVersion, newVersion);
}
}
}
| [
"karishmacrao@gmail.com"
] | karishmacrao@gmail.com |
0986dd4aa76429c0301e5dd68af2ecceb686f6fa | 1fb52c65f93bc6d3a8df6c81820b522e83e48663 | /seguridad/src/main/java/com/deportel/seguridad/view/SeguridadActionListener.java | 5f148e0289e6f4da1be15071601772ac5e3c6458 | [] | no_license | emylyano3/futboltel | 50190a12c229f51e186e68843601ed1e89f8159e | 34e5852af358274653c9d49350c8a0f3f8fa1a49 | refs/heads/master | 2021-09-03T01:01:17.800019 | 2018-01-04T11:42:22 | 2018-01-04T11:42:22 | 116,181,302 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,087 | java | package com.deportel.seguridad.view;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import com.deportel.administracion.modelo.Usuario;
import com.deportel.common.Command;
import com.deportel.common.callback.CallBackLauncher;
import com.deportel.common.callback.CallBackListener;
import com.deportel.guiBuilder.gui.component.Popup;
import com.deportel.guiBuilder.model.GuiManager;
import com.deportel.seguridad.exception.InvalidUserCredentialsException;
import com.deportel.seguridad.main.SeguridadFacade;
/**
* @author Emy
*/
public class SeguridadActionListener implements ActionListener, CallBackLauncher, CallBackListener
{
private final GuiManager manager;
private final CallBackListener listener;
public SeguridadActionListener(GuiManager manager, CallBackListener listener)
{
this.listener = listener;
this.manager = manager;
}
@Override
public void actionPerformed(ActionEvent event)
{
String userName = (this.manager.getTextField(R.TEXT_FIELDS.USER)).getText();
String password = (this.manager.getTextField(R.TEXT_FIELDS.PASS)).getText();
if (event.getActionCommand().equalsIgnoreCase(Command.ACCEPT))
{
try
{
Usuario user = SeguridadFacade.getInstance().authenticateUser(userName, password);
this.listener.receiveCallBack(Command.ACCEPT, user);
}
catch (InvalidUserCredentialsException e)
{
Popup.getInstance
(
e.getMessage(),
Popup.POPUP_ERROR,
SeguridadWindow.getInstance(this.listener),
this
)
.showGui();
this.listener.receiveCallBack(Command.ACCEPT, Command.NO_OK);
}
}
else if (event.getActionCommand().equalsIgnoreCase(Command.CANCEL))
{
this.listener.receiveCallBack(Command.CANCEL, Command.NO_OK);
}
}
@Override
public void receiveCallBack(String action, CallBackLauncher laucher)
{
}
@Override
public Object getData ()
{
return null;
}
@Override
public void doCallBack()
{
}
@Override
public void receiveCallBack(String action, Object data)
{
}
@Override
public void receiveCallBack(int data)
{
}
}
| [
"emylyano3@gmail.com"
] | emylyano3@gmail.com |
72cb49d75054694c6d63e0b54dd11f8416ce3c39 | be73270af6be0a811bca4f1710dc6a038e4a8fd2 | /crash-reproduction-moho/results/MOCKITO-3b-8-28-SPEA2-WeightedSum:TestLen:CallDiversity/org/mockito/internal/handler/NullResultGuardian_ESTest.java | 30daa5cc64acf7cb39cd8e59ef195ac68bd79771 | [] | no_license | STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application | cf118b23ecb87a8bf59643e42f7556b521d1f754 | 3bb39683f9c343b8ec94890a00b8f260d158dfe3 | refs/heads/master | 2022-07-29T14:44:00.774547 | 2020-08-10T15:14:49 | 2020-08-10T15:14:49 | 285,804,495 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 571 | java | /*
* This file was automatically generated by EvoSuite
* Sun Apr 05 21:49:31 UTC 2020
*/
package org.mockito.internal.handler;
import org.junit.Test;
import static org.junit.Assert.*;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.junit.runner.RunWith;
@RunWith(EvoRunner.class) @EvoRunnerParameters(useVFS = true, useJEE = true)
public class NullResultGuardian_ESTest extends NullResultGuardian_ESTest_scaffolding {
@Test
public void notGeneratedAnyTest() {
// EvoSuite did not generate any tests
}
}
| [
"pouria.derakhshanfar@gmail.com"
] | pouria.derakhshanfar@gmail.com |
080c594697554f26f9db5b5664ecd0af29acc634 | a6b6e362eac85c55e93ee1e0e967a2fcaa76394a | /hku-domain/src/main/java/com/accentrix/hku/domain/app/SpecialScheme.java | e2347e3a8d378d4b83d438cd37361c07600c9817 | [] | no_license | peterso05168/hku | 4a609d332ccb7d8a99ce96afc85332f96dc1ddba | 2447e29d968a1fff7a0f8a788e5cbbb39877979a | refs/heads/master | 2020-03-21T17:11:28.961542 | 2018-06-27T02:24:54 | 2018-06-27T02:24:54 | 118,405,513 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,325 | java | package com.accentrix.hku.domain.app;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import org.hibernate.annotations.GenericGenerator;
import org.jsondoc.core.annotation.ApiObject;
import org.jsondoc.core.annotation.ApiObjectField;
/**
* @author Jaye.Lin
* @date 创建时间:2018年1月30日 下午4:33:08
* @version 1.0
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.PROPERTY)
@Entity
@Table(name = "app_special_scheme")
@ApiObject(name = "SpecialScheme")
public class SpecialScheme implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(generator = "system-uuid")
@GenericGenerator(name = "system-uuid", strategy = "uuid")
@Column(name = "special_scheme_id", length = 32)
@ApiObjectField(description = "The primary key")
private String id;
@Column(name = "special_scheme_cd")
@ApiObjectField(description = "specialSchemeCd")
private String specialSchemeCd;
@Column(name = "application_id")
@ApiObjectField(description = "applicationId")
private String applicationId;
@Column(name = "spt_app_scheme")
@ApiObjectField(description = "sptAppScheme")
private String sptAppScheme;
@Column(name = "spt_sports")
@ApiObjectField(description = "sptSports")
private String sptSports;
@Column(name = "spt_level")
@ApiObjectField(description = "sptLevel")
private String sptLevel;
@Column(name = "spt_level_others")
@ApiObjectField(description = "sptLevelOthers")
private String sptLevelOthers;
@Column(name = "spt_hyperlink")
@ApiObjectField(description = "sptHyperlink")
private String sptHyperlink;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getSpecialSchemeCd() {
return specialSchemeCd;
}
public void setSpecialSchemeCd(String specialSchemeCd) {
this.specialSchemeCd = specialSchemeCd;
}
public String getApplicationId() {
return applicationId;
}
public void setApplicationId(String applicationId) {
this.applicationId = applicationId;
}
public String getSptAppScheme() {
return sptAppScheme;
}
public void setSptAppScheme(String sptAppScheme) {
this.sptAppScheme = sptAppScheme;
}
public String getSptSports() {
return sptSports;
}
public void setSptSports(String sptSports) {
this.sptSports = sptSports;
}
public String getSptLevel() {
return sptLevel;
}
public void setSptLevel(String sptLevel) {
this.sptLevel = sptLevel;
}
public String getSptLevelOthers() {
return sptLevelOthers;
}
public void setSptLevelOthers(String sptLevelOthers) {
this.sptLevelOthers = sptLevelOthers;
}
public String getSptHyperlink() {
return sptHyperlink;
}
public void setSptHyperlink(String sptHyperlink) {
this.sptHyperlink = sptHyperlink;
}
}
| [
"peterso05168@gmail.com"
] | peterso05168@gmail.com |
a99f2bff83eb8e4f905490b78420933461725977 | ef9b30035758e96d52164c3c6197331c7acb5b24 | /1st try/MAIN/MAIN.java | d21920604e4f33672d005e79d52c36f0b0a2337e | [] | no_license | chedlyrdissi/projects | ac00cf5b6e990f8fa9a89a666b4f6e22efa09482 | a56dc017303bb6a2515d3a7363ce5c7234879670 | refs/heads/master | 2020-07-25T02:48:16.107256 | 2019-09-14T01:07:41 | 2019-09-14T01:07:41 | 208,140,062 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,548 | java | import java.util.LinkedList;
import javax.swing.*;
import java.awt.*;
import java.util.*;
public class MAIN implements ActionListener{
public interface playable{
public abstract void play();
public abstract String getName();
public abstract Icon getIcon();
}
private LinkedList<playable> gamelist=new LinkedList<playable>();
private JFrame frame;
private JPanel listpanel;
private LayoutManager manager;
public MAIN(){
gamelist=new LinkedList<playable>();
frame=new JFrame("main frame");
listpanel=new JPanel();
listpanel.setBackground(new Color(0,50,64));
listpanel.setSize(200,100);
manager=new GroupLayout(frame);
frame.add(listpanel);
frame.setSize(300,700);
frame.setVisible(true);
}
public void importGame(){
// gameList.add();
}
public void prepareList(){
Iterator<playable> iterator=gameList.descendingIterator();
while(iterator.hasNext()){
playable game=iterator.next();
JButton button=new JButton(game.getName(),game.getIcon());
button.setActionCommand(game.getName());
button.addActionListener(this);
listpanel.add(button);
}
}
public void actionPerformed(ActionEvent e){
String command=e.getActionCommand();
Iterator<playable> iterator=gameList.descendingIterator();
while(iterator.hasNext()){
playable game=iterator.next();
if (game.getName().equals(command)){
game.play();
break;
}
}
}
public static void main(String[] args){
MAIN main=new MAIN();
}
}
| [
"chedlyrd2000@gmail.com"
] | chedlyrd2000@gmail.com |
252d97d3316602fcdbf43ec6fce196d2161b8b9c | 40ca9982db43fd96b9bcea6346d0e76449a9c2a8 | /tomcat6/src/main/java/de/javakaffee/web/msm/MemcachedBackupSessionManager.java | 84b9e943995c415b58cfa7c901e9c89a3c35d3f6 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | zhangwei5095/memcached-session-manager | 083fe8124a5b46d94483c43ed182fa6a9ea1d006 | 18c2da228dae7fb9d62335f2bb204d1125e5464f | refs/heads/master | 2021-01-17T21:51:43.419543 | 2016-09-21T05:36:09 | 2016-09-21T05:36:09 | 33,032,283 | 1 | 0 | null | 2016-09-21T05:36:09 | 2015-03-28T12:19:24 | Java | UTF-8 | Java | false | false | 38,724 | java | /*
* Copyright 2009 Martin Grotzke
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package de.javakaffee.web.msm;
import static de.javakaffee.web.msm.Statistics.StatsType.*;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.lang.reflect.Method;
import java.security.Principal;
import java.util.Map;
import java.util.regex.Pattern;
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import de.javakaffee.web.msm.storage.StorageClient;
import org.apache.catalina.Container;
import org.apache.catalina.Context;
import org.apache.catalina.Globals;
import org.apache.catalina.Lifecycle;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.LifecycleListener;
import org.apache.catalina.Manager;
import org.apache.catalina.Session;
import org.apache.catalina.authenticator.Constants;
import org.apache.catalina.connector.Response;
import org.apache.catalina.deploy.LoginConfig;
import org.apache.catalina.deploy.SecurityConstraint;
import org.apache.catalina.ha.session.SerializablePrincipal;
import org.apache.catalina.realm.GenericPrincipal;
import org.apache.catalina.session.ManagerBase;
import org.apache.catalina.session.StandardSession;
import org.apache.catalina.util.LifecycleSupport;
import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
import de.javakaffee.web.msm.LockingStrategy.LockingMode;
/**
* This {@link Manager} stores session in configured memcached nodes after the
* response is finished (committed).
* <p>
* Use this session manager in a Context element, like this <code><pre>
* <Context path="/foo">
* <Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager"
* memcachedNodes="n1.localhost:11211 n2.localhost:11212" failoverNodes="n2"
* connectionType="SASL" non-required
* username="username" non-required
* password="password" non-required
* requestUriIgnorePattern=".*\.(png|gif|jpg|css|js)$" />
* </Context>
* </pre></code>
* </p>
*
* @author <a href="mailto:martin.grotzke@javakaffee.de">Martin Grotzke</a>
* @version $Id$
*/
public class MemcachedBackupSessionManager extends ManagerBase implements Lifecycle, PropertyChangeListener, MemcachedSessionService.SessionManager {
protected static final String NAME = MemcachedBackupSessionManager.class.getSimpleName();
private static final String INFO = NAME + "/1.0";
protected final Log _log = LogFactory.getLog( getClass() );
private final LifecycleSupport _lifecycle = new LifecycleSupport( this );
/** Can be used to override Context.sessionTimeout (to allow tests to set more fine grained session timeouts) */
private Integer _maxInactiveInterval;
private int _maxActiveSessions = -1;
private int _rejectedSessions;
/**
* Has this component been _started yet?
*/
protected boolean _started = false;
protected MemcachedSessionService _msm;
private Boolean _contextHasFormBasedSecurityConstraint;
public MemcachedBackupSessionManager() {
_msm = new MemcachedSessionService( this );
}
/**
* Return descriptive information about this Manager implementation and the
* corresponding version number, in the format
* <code><description>/<version></code>.
*
* @return the info string
*/
@Override
public String getInfo() {
return INFO;
}
/**
* Return the descriptive short name of this Manager implementation.
*
* @return the short name
*/
@Override
public String getName() {
return NAME;
}
@Nonnull
@Override
public Context getContext() {
return (Context) getContainer();
}
/**
* Initialize this manager. The storageClient parameter is there for testing
* purposes. If the storageClient is provided it's used, otherwise a "real"/new
* storage client is created based on the configuration (like {@link #setMemcachedNodes(String)} etc.).
*
* @param storageClient the storage client to use, for normal operations this should be <code>null</code>.
*/
protected void startInternal(final StorageClient storageClient ) throws LifecycleException {
_msm.setStorageClient(storageClient);
_msm.startInternal();
}
/**
* {@inheritDoc}
*/
@Override
public void setContainer( final Container container ) {
// De-register from the old Container (if any)
if ( this.container != null && this.container instanceof Context ) {
( (Context) this.container ).removePropertyChangeListener( this );
}
// Default processing provided by our superclass
super.setContainer( container );
// Register with the new Container (if any)
if ( this.container != null && this.container instanceof Context ) {
setMaxInactiveInterval( ( (Context) this.container ).getSessionTimeout() * 60 );
( (Context) this.container ).addPropertyChangeListener( this );
}
}
/**
* {@inheritDoc}
*/
@Override
public String generateSessionId() {
return _msm.newSessionId( super.generateSessionId() );
}
/**
* {@inheritDoc}
*/
@Override
public void expireSession( final String sessionId ) {
if ( _log.isDebugEnabled() ) {
_log.debug( "expireSession invoked: " + sessionId );
}
super.expireSession( sessionId );
_msm.deleteFromMemcached( sessionId );
}
/**
* {@inheritDoc}
*/
@Override
public void remove( final Session session ) {
remove( session, session.getNote( MemcachedSessionService.NODE_FAILURE ) != Boolean.TRUE );
}
@Override
public void removeInternal( final Session session, final boolean update ) {
// update is there for tomcat7, not available in tomcat6
super.remove( session );
}
private void remove( final Session session, final boolean removeFromMemcached ) {
if ( _log.isDebugEnabled() ) {
_log.debug( "remove invoked, removeFromMemcached: " + removeFromMemcached +
", id: " + session.getId() );
}
if ( removeFromMemcached ) {
_msm.deleteFromMemcached( session.getId() );
}
super.remove( session );
_msm.sessionRemoved((MemcachedBackupSession) session);
}
/**
* Return the active Session, associated with this Manager, with the
* specified session id (if any); otherwise return <code>null</code>.
*
* @param id
* The session id for the session to be returned
* @return the session or <code>null</code> if no session was found locally
* or in memcached.
*
* @exception IllegalStateException
* if a new session cannot be instantiated for any reason
* @exception IOException
* if an input/output error occurs while processing this
* request
*/
@Override
public Session findSession( final String id ) throws IOException {
return _msm.findSession( id );
}
/**
* {@inheritDoc}
*/
@Override
public MemcachedBackupSession createSession( final String sessionId ) {
return _msm.createSession( sessionId );
}
/**
* {@inheritDoc}
*/
@Override
public MemcachedBackupSession createEmptySession() {
return _msm.createEmptySession();
}
@Override
public MemcachedBackupSession newMemcachedBackupSession() {
return new MemcachedBackupSession( this );
}
@Override
public void changeSessionId( final Session session ) {
// e.g. invoked by the AuthenticatorBase (for BASIC auth) on login to prevent session fixation
// so that session backup won't be omitted we must store this event
super.changeSessionId( session );
((MemcachedBackupSession)session).setSessionIdChanged( true );
}
@Override
public boolean isMaxInactiveIntervalSet() {
return _maxInactiveInterval != null;
}
public int getMaxInactiveInterval() {
return _maxInactiveInterval;
}
public void setMaxInactiveInterval(int interval) {
Integer oldMaxInactiveInterval = _maxInactiveInterval;
_maxInactiveInterval = interval;
support.firePropertyChange("maxInactiveInterval",
oldMaxInactiveInterval,
_maxInactiveInterval);
}
/**
* Set the maximum number of active Sessions allowed, or -1 for no limit.
*
* @param max
* The new maximum number of sessions
*/
public void setMaxActiveSessions( final int max ) {
final int oldMaxActiveSessions = _maxActiveSessions;
_maxActiveSessions = max;
support.firePropertyChange( "maxActiveSessions",
Integer.valueOf( oldMaxActiveSessions ),
Integer.valueOf( _maxActiveSessions ) );
}
@Override
public int getMaxActiveSessions() {
return _maxActiveSessions;
}
@Override
public void setRejectedSessions( final int rejectedSessions ) {
_rejectedSessions = rejectedSessions;
}
@Override
public int getRejectedSessions() {
return _rejectedSessions;
}
/**
* {@inheritDoc}
*/
@Override
public void load() throws ClassNotFoundException, IOException {
}
/**
* {@inheritDoc}
*/
@Override
public void unload() throws IOException {
}
/**
* Set the memcached nodes space or comma separated.
* <p>
* E.g. <code>n1.localhost:11211 n2.localhost:11212</code>
* </p>
* <p>
* When the memcached nodes are set when this manager is already initialized,
* the new configuration will be loaded.
* </p>
*
* @param memcachedNodes
* the memcached node definitions, whitespace or comma separated
*/
@Override
public void setMemcachedNodes( final String memcachedNodes ) {
_msm.setMemcachedNodes( memcachedNodes );
}
/**
* The memcached nodes configuration as provided in the server.xml/context.xml.
* <p>
* This getter is there to make this configuration accessible via jmx.
* </p>
* @return the configuration string for the memcached nodes.
*/
public String getMemcachedNodes() {
return _msm.getMemcachedNodes();
}
/**
* The node ids of memcached nodes, that shall only be used for session
* backup by this tomcat/manager, if there are no other memcached nodes
* left. Node ids are separated by whitespace or comma.
* <p>
* E.g. <code>n1 n2</code>
* </p>
* <p>
* When the failover nodes are set when this manager is already initialized,
* the new configuration will be loaded.
* </p>
*
* @param failoverNodes
* the failoverNodes to set, whitespace or comma separated
*/
@Override
public void setFailoverNodes( final String failoverNodes ) {
_msm.setFailoverNodes( failoverNodes );
}
/**
* The memcached failover nodes configuration as provided in the server.xml/context.xml.
* <p>
* This getter is there to make this configuration accessible via jmx.
* </p>
* @return the configuration string for the failover nodes.
*/
public String getFailoverNodes() {
return _msm.getFailoverNodes();
}
/**
* Set the regular expression for request uris to ignore for session backup.
* This should include static resources like images, in the case they are
* served by tomcat.
* <p>
* E.g. <code>.*\.(png|gif|jpg|css|js)$</code>
* </p>
*
* @param requestUriIgnorePattern
* the requestUriIgnorePattern to set
* @author Martin Grotzke
*/
public void setRequestUriIgnorePattern( final String requestUriIgnorePattern ) {
_msm.setRequestUriIgnorePattern( requestUriIgnorePattern );
}
/**
* Return the compiled pattern used for including session attributes to a session-backup.
*
* @return the sessionAttributePattern
*/
@CheckForNull
Pattern getSessionAttributePattern() {
return _msm.getSessionAttributePattern();
}
/**
* Return the string pattern used for including session attributes to a session-backup.
*
* @return the sessionAttributeFilter
*/
@CheckForNull
public String getSessionAttributeFilter() {
return _msm.getSessionAttributeFilter();
}
/**
* Set the pattern used for including session attributes to a session-backup.
* If not set, all session attributes will be part of the session-backup.
* <p>
* E.g. <code>^(userName|sessionHistory)$</code>
* </p>
*
* @param sessionAttributeFilter
* the sessionAttributeNames to set
*/
public void setSessionAttributeFilter( @Nullable final String sessionAttributeFilter ) {
_msm.setSessionAttributeFilter( sessionAttributeFilter );
}
/**
* The class of the factory that creates the
* {@link net.spy.memcached.transcoders.Transcoder} to use for serializing/deserializing
* sessions to/from memcached (requires a default/no-args constructor).
* The default value is the {@link JavaSerializationTranscoderFactory} class
* (used if this configuration attribute is not specified).
* <p>
* After the {@link TranscoderFactory} instance was created from the specified class,
* {@link TranscoderFactory#setCopyCollectionsForSerialization(boolean)}
* will be invoked with the currently set <code>copyCollectionsForSerialization</code> propery, which
* has either still the default value (<code>false</code>) or the value provided via
* {@link #setCopyCollectionsForSerialization(boolean)}.
* </p>
*
* @param transcoderFactoryClassName the {@link TranscoderFactory} class name.
*/
public void setTranscoderFactoryClass( final String transcoderFactoryClassName ) {
_msm.setTranscoderFactoryClass( transcoderFactoryClassName );
}
/**
* Specifies, if iterating over collection elements shall be done on a copy
* of the collection or on the collection itself. The default value is <code>false</code>
* (used if this configuration attribute is not specified).
* <p>
* This option can be useful if you have multiple requests running in
* parallel for the same session (e.g. AJAX) and you are using
* non-thread-safe collections (e.g. {@link java.util.ArrayList} or
* {@link java.util.HashMap}). In this case, your application might modify a
* collection while it's being serialized for backup in memcached.
* </p>
* <p>
* <strong>Note:</strong> This must be supported by the {@link TranscoderFactory}
* specified via {@link #setTranscoderFactoryClass(String)}: after the {@link TranscoderFactory} instance
* was created from the specified class, {@link TranscoderFactory#setCopyCollectionsForSerialization(boolean)}
* will be invoked with the provided <code>copyCollectionsForSerialization</code> value.
* </p>
*
* @param copyCollectionsForSerialization
* <code>true</code>, if iterating over collection elements shall be done
* on a copy of the collection, <code>false</code> if the collections own iterator
* shall be used.
*/
public void setCopyCollectionsForSerialization( final boolean copyCollectionsForSerialization ) {
_msm.setCopyCollectionsForSerialization( copyCollectionsForSerialization );
}
/**
* Custom converter allow you to provide custom serialization of application specific
* types. Multiple converter classes are separated by comma (with optional space following the comma).
* <p>
* This option is useful if reflection based serialization is very verbose and you want
* to provide a more efficient serialization for a specific type.
* </p>
* <p>
* <strong>Note:</strong> This must be supported by the {@link TranscoderFactory}
* specified via {@link #setTranscoderFactoryClass(String)}: after the {@link TranscoderFactory} instance
* was created from the specified class, {@link TranscoderFactory#setCustomConverterClassNames(String[])}
* is invoked with the provided custom converter class names.
* </p>
* <p>Requirements regarding the specific custom converter classes depend on the
* actual serialization strategy, but a common requirement would be that they must
* provide a default/no-args constructor.<br/>
* For more details have a look at
* <a href="http://code.google.com/p/memcached-session-manager/wiki/SerializationStrategies">SerializationStrategies</a>.
* </p>
*
* @param customConverterClassNames a list of class names separated by comma
*/
public void setCustomConverter( final String customConverterClassNames ) {
_msm.setCustomConverter( customConverterClassNames );
}
/**
* Specifies if statistics (like number of requests with/without session) shall be
* gathered. Default value of this property is <code>true</code>.
* <p>
* Statistics will be available via jmx and the Manager mbean (
* e.g. in the jconsole mbean tab open the attributes node of the
* <em>Catalina/Manager/<context-path>/<host name></em>
* mbean and check for <em>msmStat*</em> values.
* </p>
*
* @param enableStatistics <code>true</code> if statistics shall be gathered.
*/
public void setEnableStatistics( final boolean enableStatistics ) {
_msm.setEnableStatistics( enableStatistics );
}
/**
* Specifies the number of threads that are used if {@link #setSessionBackupAsync(boolean)}
* is set to <code>true</code>.
*
* @param backupThreadCount the number of threads to use for session backup.
*/
public void setBackupThreadCount( final int backupThreadCount ) {
_msm.setBackupThreadCount( backupThreadCount );
}
/**
* The number of threads to use for session backup if session backup shall be
* done asynchronously.
* @return the number of threads for session backup.
*/
public int getBackupThreadCount() {
return _msm.getBackupThreadCount();
}
/**
* Specifies the memcached protocol to use, either "text" (default) or "binary".
*
* @param memcachedProtocol one of "text" or "binary".
*/
public void setMemcachedProtocol( final String memcachedProtocol ) {
_msm.setMemcachedProtocol( memcachedProtocol );
}
/**
* Enable/disable memcached-session-manager (default <code>true</code> / enabled).
* If disabled, sessions are neither looked up in memcached nor stored in memcached.
*
* @param enabled specifies if msm shall be disabled or not.
* @throws IllegalStateException it's not allowed to disable this session manager when running in non-sticky mode.
*/
@Override
public void setEnabled( final boolean enabled ) throws IllegalStateException {
_msm.setEnabled( enabled );
}
/**
* Specifies, if msm is enabled or not.
*
* @return <code>true</code> if enabled, otherwise <code>false</code>.
*/
public boolean isEnabled() {
return _msm.isEnabled();
}
@Override
public void setSticky( final boolean sticky ) {
_msm.setSticky( sticky );
}
public boolean isSticky() {
return _msm.isSticky();
}
@Override
public void setOperationTimeout(final long operationTimeout ) {
_msm.setOperationTimeout(operationTimeout);
}
public long getOperationTimeout() {
return _msm.getOperationTimeout();
}
/**
* Sets the session locking mode. Possible values:
* <ul>
* <li><code>none</code> - does not lock the session at all (default for non-sticky sessions).</li>
* <li><code>all</code> - the session is locked for each request accessing the session.</li>
* <li><code>auto</code> - locks the session for each request except for those the were detected to access the session only readonly.</li>
* <li><code>uriPattern:<regexp></code> - locks the session for each request with a request uri (with appended querystring) matching
* the provided regular expression.</li>
* </ul>
*/
@Override
public void setLockingMode( @Nullable final String lockingMode ) {
_msm.setLockingMode( lockingMode );
}
@Override
public void setLockingMode( @Nullable final LockingMode lockingMode, @Nullable final Pattern uriPattern, final boolean storeSecondaryBackup ) {
_msm.setLockingMode( lockingMode, uriPattern, storeSecondaryBackup );
}
@Override
public void setUsername(final String username) {
_msm.setUsername(username);
}
@Override
public void setPassword(final String password) {
_msm.setPassword(password);
}
public void setStorageKeyPrefix(final String storageKeyPrefix) {
_msm.setStorageKeyPrefix(storageKeyPrefix);
}
/**
* {@inheritDoc}
*/
@Override
public void addLifecycleListener( final LifecycleListener arg0 ) {
_lifecycle.addLifecycleListener( arg0 );
}
/**
* {@inheritDoc}
*/
@Override
public LifecycleListener[] findLifecycleListeners() {
return _lifecycle.findLifecycleListeners();
}
/**
* {@inheritDoc}
*/
@Override
public void removeLifecycleListener( final LifecycleListener arg0 ) {
_lifecycle.removeLifecycleListener( arg0 );
}
/**
* {@inheritDoc}
*/
@Override
public void start() throws LifecycleException {
if( ! initialized ) {
init();
}
// Validate and update our current component state
if (_started) {
return;
}
_lifecycle.fireLifecycleEvent(START_EVENT, null);
_started = true;
// Force initialization of the random number generator
if (log.isDebugEnabled()) {
log.debug("Force random number initialization starting");
}
super.generateSessionId();
if (log.isDebugEnabled()) {
log.debug("Force random number initialization completed");
}
startInternal( null );
}
/**
* {@inheritDoc}
*/
@Override
public void stop() throws LifecycleException {
if (log.isDebugEnabled()) {
log.debug("Stopping");
}
// Validate and update our current component state
if (!_started) {
throw new LifecycleException
(sm.getString("standardManager.notStarted"));
}
_lifecycle.fireLifecycleEvent(STOP_EVENT, null);
_started = false;
// Require a new random number generator if we are restarted
random = null;
if ( initialized ) {
if ( _msm.isSticky() ) {
_log.info( "Removing sessions from local session map." );
for( final Session session : sessions.values() ) {
swapOut( (StandardSession) session );
}
}
_msm.shutdown();
destroy();
}
}
private void swapOut( @Nonnull final StandardSession session ) {
// implementation like the one in PersistentManagerBase.swapOut
if (!session.isValid()) {
return;
}
session.passivate();
remove( session, false );
session.recycle();
}
/**
* {@inheritDoc}
*/
@Override
public void backgroundProcess() {
_msm.updateExpirationInMemcached();
super.backgroundProcess();
}
/**
* {@inheritDoc}
*/
@Override
public void propertyChange( final PropertyChangeEvent event ) {
// Validate the source of this event
if ( !( event.getSource() instanceof Context ) ) {
return;
}
// Process a relevant property change
if ( event.getPropertyName().equals( "sessionTimeout" ) ) {
try {
setMaxInactiveInterval( ( (Integer) event.getNewValue() ).intValue() * 60 );
} catch ( final NumberFormatException e ) {
_log.warn( "standardManager.sessionTimeout: " + event.getNewValue().toString() );
}
}
}
/**
* Specifies if the session shall be stored asynchronously in memcached as
* {@link StorageClient#set(String, int, byte[])} supports it. If this is
* false, the timeout set via {@link #setSessionBackupTimeout(int)} is
* evaluated. If this is <code>true</code>, the {@link #setBackupThreadCount(int)}
* is evaluated.
* <p>
* By default this property is set to <code>true</code> - the session
* backup is performed asynchronously.
* </p>
*
* @param sessionBackupAsync
* the sessionBackupAsync to set
*/
public void setSessionBackupAsync( final boolean sessionBackupAsync ) {
_msm.setSessionBackupAsync( sessionBackupAsync );
}
/**
* Specifies if the session shall be stored asynchronously in memcached as
* {@link StorageClient#set(String, int, byte[])} supports it. If this is
* false, the timeout from {@link #getSessionBackupTimeout()} is
* evaluated.
*/
public boolean isSessionBackupAsync() {
return _msm.isSessionBackupAsync();
}
/**
* The timeout in milliseconds after that a session backup is considered as
* beeing failed.
* <p>
* This property is only evaluated if sessions are stored synchronously (set
* via {@link #setSessionBackupAsync(boolean)}).
* </p>
* <p>
* The default value is <code>100</code> millis.
*
* @param sessionBackupTimeout
* the sessionBackupTimeout to set (milliseconds)
*/
public void setSessionBackupTimeout( final int sessionBackupTimeout ) {
_msm.setSessionBackupTimeout( sessionBackupTimeout );
}
/**
* The timeout in milliseconds after that a session backup is considered as
* beeing failed when {@link #getSessionBackupAsync()}) is <code>false</code>.
*/
public long getSessionBackupTimeout() {
return _msm.getSessionBackupTimeout();
}
// ------------------------- statistics via jmx ----------------
/**
* @return
* @see de.javakaffee.web.msm.Statistics#getRequestsWithBackupFailure()
*/
public long getMsmStatNumBackupFailures() {
return _msm.getStatistics().getRequestsWithBackupFailure();
}
/**
* @return
* @see de.javakaffee.web.msm.Statistics#getRequestsWithMemcachedFailover()
*/
public long getMsmStatNumTomcatFailover() {
return _msm.getStatistics().getRequestsWithTomcatFailover();
}
/**
* @return
* @see de.javakaffee.web.msm.Statistics#getRequestsWithMemcachedFailover()
*/
public long getMsmStatNumMemcachedFailover() {
return _msm.getStatistics().getRequestsWithMemcachedFailover();
}
/**
* @return
* @see de.javakaffee.web.msm.Statistics#getRequestsWithoutSession()
*/
public long getMsmStatNumRequestsWithoutSession() {
return _msm.getStatistics().getRequestsWithoutSession();
}
/**
* @return
* @see de.javakaffee.web.msm.Statistics#getRequestsWithoutSessionAccess()
*/
public long getMsmStatNumNoSessionAccess() {
return _msm.getStatistics().getRequestsWithoutSessionAccess();
}
/**
* @return
* @see de.javakaffee.web.msm.Statistics#getRequestsWithoutAttributesAccess()
*/
public long getMsmStatNumNoAttributesAccess() {
return _msm.getStatistics().getRequestsWithoutAttributesAccess();
}
/**
* @return
* @see de.javakaffee.web.msm.Statistics#getRequestsWithoutSessionModification()
*/
public long getMsmStatNumNoSessionModification() {
return _msm.getStatistics().getRequestsWithoutSessionModification();
}
/**
* @return
* @see de.javakaffee.web.msm.Statistics#getRequestsWithSession()
*/
public long getMsmStatNumRequestsWithSession() {
return _msm.getStatistics().getRequestsWithSession();
}
public long getMsmStatNumNonStickySessionsPingFailed() {
return _msm.getStatistics().getNonStickySessionsPingFailed();
}
public long getMsmStatNumNonStickySessionsReadOnlyRequest() {
return _msm.getStatistics().getNonStickySessionsReadOnlyRequest();
}
/**
* Returns a string array with labels and values of count, min, avg and max
* of the time that took the attributes serialization.
* @return a String array for statistics inspection via jmx.
*/
public String[] getMsmStatAttributesSerializationInfo() {
return _msm.getStatistics().getProbe( ATTRIBUTES_SERIALIZATION ).getInfo();
}
/**
* Returns a string array with labels and values of count, min, avg and max
* of the time that session backups took in the request thread (including omitted
* session backups e.g. because the session attributes were not accessed).
* This time was spent in the request thread.
*
* @return a String array for statistics inspection via jmx.
*/
public String[] getMsmStatEffectiveBackupInfo() {
return _msm.getStatistics().getProbe( EFFECTIVE_BACKUP ).getInfo();
}
/**
* Returns a string array with labels and values of count, min, avg and max
* of the time that session backups took (excluding backups where a session
* was relocated). This time was spent in the request thread if session backup
* is done synchronously, otherwise another thread used this time.
*
* @return a String array for statistics inspection via jmx.
*/
public String[] getMsmStatBackupInfo() {
return _msm.getStatistics().getProbe( BACKUP ).getInfo();
}
/**
* Returns a string array with labels and values of count, min, avg and max
* of the time that loading sessions from memcached took (including deserialization).
* @return a String array for statistics inspection via jmx.
* @see #getMsmStatSessionDeserializationInfo()
* @see #getMsmStatNonStickyAfterLoadFromMemcachedInfo()
*/
public String[] getMsmStatSessionsLoadedFromMemcachedInfo() {
return _msm.getStatistics().getProbe( LOAD_FROM_MEMCACHED ).getInfo();
}
/**
* Returns a string array with labels and values of count, min, avg and max
* of the time that deleting sessions from memcached took.
* @return a String array for statistics inspection via jmx.
* @see #getMsmStatNonStickyAfterDeleteFromMemcachedInfo()
*/
public String[] getMsmStatSessionsDeletedFromMemcachedInfo() {
return _msm.getStatistics().getProbe( DELETE_FROM_MEMCACHED ).getInfo();
}
/**
* Returns a string array with labels and values of count, min, avg and max
* of the time that deserialization of session data took.
* @return a String array for statistics inspection via jmx.
*/
public String[] getMsmStatSessionDeserializationInfo() {
return _msm.getStatistics().getProbe( SESSION_DESERIALIZATION ).getInfo();
}
/**
* Returns a string array with labels and values of count, min, avg and max
* of the size of the data that was sent to memcached.
* @return a String array for statistics inspection via jmx.
*/
public String[] getMsmStatCachedDataSizeInfo() {
return _msm.getStatistics().getProbe( CACHED_DATA_SIZE ).getInfo();
}
/**
* Returns a string array with labels and values of count, min, avg and max
* of the time that storing data in memcached took (excluding serialization,
* including compression).
* @return a String array for statistics inspection via jmx.
*/
public String[] getMsmStatMemcachedUpdateInfo() {
return _msm.getStatistics().getProbe( MEMCACHED_UPDATE ).getInfo();
}
/**
* Info about locks acquired in non-sticky mode.
*/
public String[] getMsmStatNonStickyAcquireLockInfo() {
return _msm.getStatistics().getProbe( ACQUIRE_LOCK ).getInfo();
}
/**
* Lock acquiration in non-sticky session mode.
*/
public String[] getMsmStatNonStickyAcquireLockFailureInfo() {
return _msm.getStatistics().getProbe( ACQUIRE_LOCK_FAILURE ).getInfo();
}
/**
* Lock release in non-sticky session mode.
*/
public String[] getMsmStatNonStickyReleaseLockInfo() {
return _msm.getStatistics().getProbe( RELEASE_LOCK ).getInfo();
}
/**
* Tasks executed (in the request thread) for non-sticky sessions at the end of requests that did not access
* the session (validity load/update, ping session, ping 2nd session backup, update validity backup).
*/
public String[] getMsmStatNonStickyOnBackupWithoutLoadedSessionInfo() {
return _msm.getStatistics().getProbe( NON_STICKY_ON_BACKUP_WITHOUT_LOADED_SESSION ).getInfo();
}
/**
* Tasks executed for non-sticky sessions after session backup (ping session, store validity info / meta data,
* store additional backup in secondary memcached).
*/
public String[] getMsmStatNonStickyAfterBackupInfo() {
return _msm.getStatistics().getProbe( NON_STICKY_AFTER_BACKUP ).getInfo();
}
/**
* Tasks executed for non-sticky sessions after a session was loaded from memcached (load validity info / meta data).
*/
public String[] getMsmStatNonStickyAfterLoadFromMemcachedInfo() {
return _msm.getStatistics().getProbe( NON_STICKY_AFTER_LOAD_FROM_MEMCACHED ).getInfo();
}
/**
* Tasks executed for non-sticky sessions after a session was deleted from memcached (delete validity info and backup data).
*/
public String[] getMsmStatNonStickyAfterDeleteFromMemcachedInfo() {
return _msm.getStatistics().getProbe( NON_STICKY_AFTER_DELETE_FROM_MEMCACHED ).getInfo();
}
// ---------------------------------------------------------------------------
@Override
public String getSessionCookieName() {
String result = getSessionCookieNameFromContext((Context) getContainer());
if ( result == null ) {
result = Globals.SESSION_COOKIE_NAME;
_log.debug( "Using session cookie name from context: " + result );
}
return result;
}
@CheckForNull
private String getSessionCookieNameFromContext( final Context context ) {
// since 6.0.27 the session cookie name, domain and path is configurable per context,
// see issue http://issues.apache.org/bugzilla/show_bug.cgi?id=48379
try {
final Method getSessionCookieName = Context.class.getDeclaredMethod( "getSessionCookieName" );
final String result = (String) getSessionCookieName.invoke( context );
if ( result != null ) {
_log.debug( "Using session cookie name from context: " + result );
}
return result;
} catch( final NoSuchMethodException e ) {
// the context does not provide the method getSessionCookieName
} catch ( final Exception e ) {
throw new RuntimeException( "Could not read session cookie name from context.", e );
}
return null;
}
@Override
public MemcachedBackupSession getSessionInternal( final String sessionId ) {
return (MemcachedBackupSession) sessions.get( sessionId );
}
@Override
public Map<String, Session> getSessionsInternal() {
return sessions;
}
@Override
public String getString( final String key ) {
return sm.getString( key );
}
@Override
public void incrementSessionCounter() {
sessionCounter++;
}
@Override
public void incrementRejectedSessions() {
_rejectedSessions++;
}
@Override
public boolean isInitialized() {
return initialized;
}
@Override
public String getString( final String key, final Object ... args ) {
return sm.getString( key, args );
}
@Override
public ClassLoader getContainerClassLoader() {
return getContainer().getLoader().getClassLoader();
}
@Override
public void writePrincipal( @Nonnull Principal principal, @Nonnull ObjectOutputStream oos) throws IOException {
SerializablePrincipal.writePrincipal((GenericPrincipal) principal, oos );
}
@Override
public Principal readPrincipal( final ObjectInputStream ois ) throws ClassNotFoundException, IOException {
return SerializablePrincipal.readPrincipal( ois, getContainer().getRealm() );
}
@Override
public boolean contextHasFormBasedSecurityConstraint(){
if(_contextHasFormBasedSecurityConstraint != null) {
return _contextHasFormBasedSecurityConstraint.booleanValue();
}
final Context context = getContext();
final SecurityConstraint[] constraints = context.findConstraints();
final LoginConfig loginConfig = context.getLoginConfig();
_contextHasFormBasedSecurityConstraint = constraints != null && constraints.length > 0
&& loginConfig != null && Constants.FORM_METHOD.equals( loginConfig.getAuthMethod() );
return _contextHasFormBasedSecurityConstraint;
}
@Override
public MemcachedSessionService getMemcachedSessionService() {
return _msm;
}
@Override
public String[] getSetCookieHeaders(final Response response) {
return response.getHeaderValues("Set-Cookie");
}
}
| [
"martin.grotzke@javakaffee.de"
] | martin.grotzke@javakaffee.de |
e1cd29e3cfe60e6b3aa97f03ffc2f6337a17957d | 10d5a763269301b1e0452710d8d267d46b0c4f1c | /src/test/java/com/learncamel/routes/aggregate/test/AggregatorWithCompletionTimeoutRouteTest.java | 7b8def704bb30daf16a47eed82b1f9286d3e5c96 | [] | no_license | kumaresanb/learncamel-aggregate-eip | 90e57774bacd5b3c14d336885aea8d402f55286b | b0e289bdee0459fcc88efdb862233ba5cb4d906f | refs/heads/master | 2023-06-22T22:41:03.362590 | 2018-10-08T08:57:55 | 2018-10-08T08:57:55 | 152,027,360 | 0 | 0 | null | 2023-06-20T02:13:33 | 2018-10-08T06:14:23 | Java | UTF-8 | Java | false | false | 1,055 | java | package com.learncamel.routes.aggregate.test;
import org.apache.camel.RoutesBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
import com.learncamel.routes.AggregatorWithCompletionTimeoutRoute;
public class AggregatorWithCompletionTimeoutRouteTest extends CamelTestSupport {
@Override
protected RoutesBuilder createRouteBuilder() throws Exception {
return new AggregatorWithCompletionTimeoutRoute();
}
@Test
public void aggregateTimeout() throws InterruptedException {
MockEndpoint mock=getMockEndpoint("mock:output");
mock.expectedBodiesReceived("12");
template.sendBodyAndHeader("direct:simpleAggregator", "1", "aggregatorId", 1);
template.sendBodyAndHeader("direct:simpleAggregator", "2", "aggregatorId", 1);
Thread.sleep(5000);
template.sendBodyAndHeader("direct:simpleAggregator", "4", "aggregatorId", 2);
template.sendBodyAndHeader("direct:simpleAggregator", "3", "aggregatorId", 1);
assertMockEndpointsSatisfied();
}
}
| [
"EVOLVUS\\kumaresanb@ELPBLR-035.evolvus.com"
] | EVOLVUS\kumaresanb@ELPBLR-035.evolvus.com |
d0ee32c81a452ef31e6e239cf5cb74f9a6ede0f2 | d6872ffc70718337f633be0aa61be88bc26f09ab | /wc-client/wc-client-user/src/main/java/top/wingcloud/request/LoginRequest.java | 46759efadee39fef65833ddd77dd1fa19385517b | [
"Apache-2.0"
] | permissive | BestJex/wingcloud | 953d9082350d853565a6ad00f99ffc94cd85cba5 | 611090e202fbd9e05da9e5057428f908229aa414 | refs/heads/master | 2023-03-06T14:46:42.694312 | 2021-02-19T10:39:26 | 2021-02-19T10:39:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 750 | java | package top.wingcloud.request;
import org.hibernate.validator.constraints.NotEmpty;
/**
* 登录请求的参数
*/
public class LoginRequest {
@NotEmpty
private String user_name;
@NotEmpty
private String user_password;
private String token;
public String getUser_name() {
return user_name;
}
public void setUser_name(String user_name) {
this.user_name = user_name;
}
public String getUser_password() {
return user_password;
}
public void setUser_password(String user_password) {
this.user_password = user_password;
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
}
| [
"xulinjie0105@gmail.com"
] | xulinjie0105@gmail.com |
d07929ea58191bf239233f2ccdf97e3811b63a92 | 6b2a8dd202fdce77c971c412717e305e1caaac51 | /solutions_1483488_1/java/JcChen/QualifiRound2012C.java | ebee9314542055f56fb6cee489ad6e9d8edab93e | [] | no_license | alexandraback/datacollection | 0bc67a9ace00abbc843f4912562f3a064992e0e9 | 076a7bc7693f3abf07bfdbdac838cb4ef65ccfcf | refs/heads/master | 2021-01-24T18:27:24.417992 | 2017-05-23T09:23:38 | 2017-05-23T09:23:38 | 84,313,442 | 2 | 4 | null | null | null | null | UTF-8 | Java | false | false | 1,710 | java | import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashMap;
public class QualifiRound2012C {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
try {
BufferedReader br = new BufferedReader(new FileReader(args[0]));
PrintWriter pw = new PrintWriter(args[1]);
String line = br.readLine();
System.out.println(line);
int T = Integer.valueOf(line.trim());
for (int i=0; i<T; i++)
{
line = br.readLine();
System.out.println(line);
String[] input = line.trim().split(" ");
int A = Integer.valueOf(input[0]);
int B = Integer.valueOf(input[1]);
long result = 0;
for(int j=A; j<=B; j++)
{
int bit = (int)Math.floor(Math.log10(j));
HashMap<Integer, Boolean> map = new HashMap<Integer, Boolean>();
map.put(j, true);
int pair = (j%10)*(int)Math.pow(10, bit)+ j/10;
while(!map.containsKey(pair))
{
if(j>pair)
{
map.put(pair, true);
pair = (pair%10)*(int)Math.pow(10, bit)+ pair/10;
continue;
}
if(A<=pair && pair<=B)
result++;
pair = (pair%10)*(int)Math.pow(10, bit)+ pair/10;
continue;
}
}
pw.println("Case #"+(i+1)+": "+result);
System.out.println("Case #"+(i+1)+": "+result);
}
pw.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
| [
"eewestman@gmail.com"
] | eewestman@gmail.com |
d8c2748eda7002d8dacabb2f6ab727398f9dc306 | 9972840639f5bf81385fc55458e28fcfea18b3a9 | /src/main/pmlib/MovieRepository.java | 5bcd36df993290ee48ee554ecddea8707058abce | [] | no_license | adaptiv/tdd-projektdag | af49dd2ecd53beb7e47030436ce8670c8fd45cce | 7247498c292ae4d5696edccb6dfd2370230aaebc | refs/heads/master | 2020-05-19T14:06:02.794410 | 2014-01-24T07:23:47 | 2014-01-24T07:23:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 667 | java | package pmlib;
import org.yaml.snakeyaml.Yaml;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.*;
@SuppressWarnings({"rawtypes", "unchecked"})
public class MovieRepository {
@SuppressWarnings("serial")
public void save(final MovieLibrary library) throws IOException {
new Yaml().dump(new HashMap() {{
put("library", library);
}}, new FileWriter("movies.yml"));
}
public MovieLibrary load() throws FileNotFoundException {
return (MovieLibrary) ((Map) new Yaml().load(new FileReader("movies.yml"))).get("library");
}
}
| [
"johan.behe.lind@gmail.com"
] | johan.behe.lind@gmail.com |
2d61f0e80acb27e9a8ff24c9595981796e70d988 | 2f13a0ca513f2483283ae3ad0ba5f6962fb8e679 | /demo/src/main/java/hybridmediaplayer/demo/MainActivity.java | bdc9cab8e1f2d0ef0aab4e5677b806d78672d379 | [] | no_license | SagarDep/HybridMediaPlayer | 07a8908674910e2e0958ea55c56349ba1e7bba34 | ef5cfb76aeb4872b8baa9f572a92a3cf566e4471 | refs/heads/master | 2020-04-08T16:12:21.207497 | 2018-09-26T16:03:46 | 2018-09-26T16:03:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,999 | java | package hybridmediaplayer.demo;
import android.media.AudioManager;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.app.MediaRouteButton;
import android.view.Menu;
import android.view.SurfaceView;
import android.view.View;
import android.widget.Button;
import com.google.android.exoplayer2.Player;
import com.google.android.gms.cast.framework.CastButtonFactory;
import com.google.android.gms.cast.framework.CastContext;
import com.google.android.gms.cast.framework.CastState;
import com.google.android.gms.cast.framework.CastStateListener;
import com.socks.library.KLog;
import java.util.ArrayList;
import java.util.List;
import hybridmediaplayer.ExoMediaPlayer;
import hybridmediaplayer.HybridMediaPlayer;
import hybridmediaplayer.MediaSourceInfo;
import hybridplayer.demo.R;
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
private ExoMediaPlayer mediaPlayer;
private boolean isPrepared;
private int time;
float speed = 1;
private SurfaceView playerView;
//Chromecast
private CastContext castContext;
private MediaRouteButton mediaRouteButton;
private List<MediaSourceInfo> sources;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button btPlay = findViewById(R.id.btPlay);
Button btPause = findViewById(R.id.btPause);
Button btFastForward = findViewById(R.id.fastForward);
Button btSpeed = findViewById(R.id.btSpeed);
Button btStop = findViewById(R.id.btStop);
Button btNext = findViewById(R.id.btNext);
Button btCreatePlayer = findViewById(R.id.btCreatePlayer);
btPlay.setOnClickListener(this);
btPause.setOnClickListener(this);
btFastForward.setOnClickListener(this);
btSpeed.setOnClickListener(this);
btStop.setOnClickListener(this);
btNext.setOnClickListener(this);
btCreatePlayer.setOnClickListener(this);
playerView = findViewById(R.id.playerView);
//Chromecast:
mediaRouteButton = findViewById(R.id.media_route_button);
castContext = CastContext.getSharedInstance(this);
castContext.addCastStateListener(new CastStateListener() {
@Override
public void onCastStateChanged(int state) {
if (state == CastState.NO_DEVICES_AVAILABLE)
mediaRouteButton.setVisibility(View.GONE);
else {
if (mediaRouteButton.getVisibility() == View.GONE)
mediaRouteButton.setVisibility(View.VISIBLE);
}
}
});
CastButtonFactory.setUpMediaRouteButton(this, mediaRouteButton);
setVolumeControlStream(AudioManager.STREAM_MUSIC);
}
@Override
protected void onPause() {
super.onPause();
if (mediaPlayer != null)
mediaPlayer.pause();
}
@Override
protected void onDestroy() {
super.onDestroy();
if (mediaPlayer != null)
mediaPlayer.release();
}
private void createPlayer() {
if (mediaPlayer != null) {
mediaPlayer.stop();
mediaPlayer.release();
}
String url = "https://play.podtrac.com/npr-510289/npr.mc.tritondigital.com/NPR_510289/media/anon.npr-mp3/npr/pmoney/2017/03/20170322_pmoney_20170322_pmoney_pmpod.mp3";
String url2 = "http://217.74.72.11/RADIOFONIA";
String url3 = "https://github.com/mediaelement/mediaelement-files/blob/master/big_buck_bunny.mp4?raw=true";
mediaPlayer = new ExoMediaPlayer(this, castContext, 0);
//mediaPlayer.setDataSource(url);
MediaSourceInfo source1 = new MediaSourceInfo.Builder().setUrl(url)
.setTitle("Podcast 0")
.setImageUrl("https://cdn.dribbble.com/users/20781/screenshots/573506/podcast_logo.jpg")
.build();
MediaSourceInfo source3 = new MediaSourceInfo.Builder().setUrl("http://rss.art19.com/episodes/d93a35f0-e171-4a92-887b-35cee645f835.mp3")
.setTitle("Podcast 1")
.setImageUrl("https://cdn.dribbble.com/users/20781/screenshots/573506/podcast_logo.jpg")
.build();
MediaSourceInfo source4 = new MediaSourceInfo.Builder().setUrl("http://rss.art19.com/episodes/d93a35f0-e171-4a92-887b-35cee645f835.mp3") //http://stream3.polskieradio.pl:8904/;
.setTitle("Podcast 2")
.setImageUrl("https://cdn.dribbble.com/users/20781/screenshots/573506/podcast_logo.jpg")
.build();
MediaSourceInfo source2 = new MediaSourceInfo.Builder().setUrl(url2)
.setTitle("Movie")
.setImageUrl("http://www.pvhc.net/img29/amkulkkbogfvmihgspru.png")
.isVideo(true)
.build();
sources = new ArrayList<>();
// sources.add(source1);
sources.add(source2);
sources.add(source4);
// sources.add(source2);
mediaPlayer.setPlayerView(this, playerView);
mediaPlayer.setSupportingSystemEqualizer(true);
mediaPlayer.setOnTrackChangedListener(new ExoMediaPlayer.OnTrackChangedListener() {
@Override
public void onTrackChanged(boolean isFinished) {
KLog.w("abc isFinished " + isFinished + " " + mediaPlayer.getDuration() + " window = " + mediaPlayer.getCurrentWindow());
}
});
mediaPlayer.setOnPreparedListener(new HybridMediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(HybridMediaPlayer player) {
KLog.w(mediaPlayer.hasVideo());
KLog.d("ppp " + mediaPlayer.getCurrentPlayer());
}
});
mediaPlayer.setOnPlayerStateChanged(new ExoMediaPlayer.OnPlayerStateChanged() {
@Override
public void onPlayerStateChanged(boolean playWhenReady, int playbackState) {
KLog.d("cvv " + playbackState);
if(mediaPlayer.isCasting() && playbackState == Player.STATE_IDLE)
mediaPlayer.pause();
}
});
mediaPlayer.setOnCompletionListener(new HybridMediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(HybridMediaPlayer player) {
KLog.i("cvv complete");
}
});
mediaPlayer.setOnLoadingChanged(new ExoMediaPlayer.OnLoadingChanged() {
@Override
public void onLoadingChanged(boolean isLoading) {
KLog.d("loadd "+isLoading);
}
});
mediaPlayer.setInitialWindowNum(0);
mediaPlayer.setDataSource(sources, sources);
mediaPlayer.setOnAudioSessionIdSetListener(new ExoMediaPlayer.OnAudioSessionIdSetListener() {
@Override
public void onAudioSessionIdset(int audioSessionId) {
KLog.d("audio session id = "+audioSessionId);
}
});
mediaPlayer.prepare();
mediaPlayer.play();
}
@Override
public void onClick(View view) {
if (view.getId() == R.id.btPlay) {
if (mediaPlayer == null)
createPlayer();
else {
mediaPlayer.play();
}
} else if (view.getId() == R.id.btPause) {
mediaPlayer.pause();
KLog.d(mediaPlayer.getCurrentPosition());
KLog.i(mediaPlayer.getDuration());
} else if (view.getId() == R.id.fastForward) {
mediaPlayer.seekTo(mediaPlayer.getCurrentPosition() + 2000);
} else if (view.getId() == R.id.btSpeed) {
// if (speed == 1)
// speed = 2f;
// else speed = 1;
// mediaPlayer.setPlaybackParams(speed, 1);
// int msec = mediaPlayer.getCurrentPosition() - 2000;
// if(msec<0)
// msec = 1;
// mediaPlayer.seekTo(msec);
loadOtherSources();
} else if (view.getId() == R.id.btStop) {
mediaPlayer.release();
mediaPlayer = null;
} else if (view.getId() == R.id.btNext) {
// pm.selectQueueItem(pm.getCurrentItemIndex()+1);
KLog.i("abc "+ mediaPlayer.getCurrentWindow() + " / "+mediaPlayer.getWindowCount());
mediaPlayer.seekTo((mediaPlayer.getCurrentWindow() + 1) % mediaPlayer.getWindowCount(), 0);
} else if (view.getId() == R.id.btCreatePlayer) {
// pm = PlayerManager.createPlayerManager(new PlayerManager.QueuePositionListener() {
// @Override
// public void onQueuePositionChanged(int previousIndex, int newIndex) {
//
// }
// }, this, castContext);
// MediaSourceInfo source2 = new MediaSourceInfo.Builder().setUrl("http://rss.art19.com/episodes/d93a35f0-e171-4a92-887b-35cee645f835.mp3")
// .setTitle("Movie")
// .setImageUrl("http://www.pvhc.net/img29/amkulkkbogfvmihgspru.png")
// .build();
// MediaSourceInfo source3 = new MediaSourceInfo.Builder().setUrl("http://rss.art19.com/episodes/d93a35f0-e171-4a92-887b-35cee645f835.mp3")
// .setTitle("Source 3")
// .setImageUrl("http://www.pvhc.net/img29/amkulkkbogfvmihgspru.png")
// .build();
// pm.addItem(source2);
// pm.addItem(source2);
// pm.selectQueueItem(0);
createPlayer();
}
}
private void loadOtherSources() {
List<MediaSourceInfo> sources2 = new ArrayList<>();
MediaSourceInfo source = new MediaSourceInfo.Builder().setUrl("http://api.spreaker.com/download/episode/14404535/dlaczego_rezygnujemy.mp3")
.setTitle("NEW Podcast")
.setImageUrl("https://github.com/mkaflowski/HybridMediaPlayer/blob/master/images/cover.jpg?raw=true")
.build();
MediaSourceInfo source2 = new MediaSourceInfo.Builder().setUrl("http://api.spreaker.com/download/episode/14404535/dlaczego_rezygnujemy.mp3")
.setTitle("NEW Podcast 2")
.setImageUrl("https://github.com/mkaflowski/HybridMediaPlayer/blob/master/images/cover.jpg?raw=true")
.build();
sources2.add(source);
sources2.add(source2);
sources2.add(source2);
mediaPlayer.setInitialWindowNum(2);
mediaPlayer.setDataSource(sources2, sources2);
mediaPlayer.prepare();
mediaPlayer.seekTo(10000);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
getMenuInflater().inflate(R.menu.options, menu);
CastButtonFactory.setUpMediaRouteButton(this, menu, R.id.media_route_menu_item);
return true;
}
} | [
"mkaflowski@gmail.com"
] | mkaflowski@gmail.com |
9568649c50fd95d37de515546cb292f9d63c0d24 | 66410dfede70b5909ddf336d8415363fcee4a2f4 | /app/src/main/java/com/luminous/dsys/youthconnect/home/DashboardFragment.java | 089b2a27dd1a2a60c48469a4daaddd7eb11ba96b | [] | no_license | sheikhlipl/youthconnect | 25cf8e8a39d3d2b5500ff0700e1ee206db298d21 | 44b20a9c301c858247ad457b7702eae00606189b | refs/heads/master | 2021-01-10T03:49:00.534740 | 2016-03-07T11:33:11 | 2016-03-07T11:33:11 | 52,427,720 | 0 | 0 | null | 2016-03-07T11:33:11 | 2016-02-24T08:49:21 | Java | UTF-8 | Java | false | false | 18,788 | java | package com.luminous.dsys.youthconnect.home;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.widget.SwipeRefreshLayout;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.AdapterView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TabHost;
import android.widget.TextView;
import com.couchbase.lite.LiveQuery;
import com.couchbase.lite.QueryEnumerator;
import com.couchbase.lite.replicator.Replication;
import com.luminous.dsys.youthconnect.R;
import com.luminous.dsys.youthconnect.activity.Application;
import com.luminous.dsys.youthconnect.activity.DocListActivity;
import com.luminous.dsys.youthconnect.activity.MainActivity;
import com.luminous.dsys.youthconnect.activity.QAAnsweredActivity;
import com.luminous.dsys.youthconnect.activity.QAPendingActivity;
import com.luminous.dsys.youthconnect.helper.LiveQueryAdapter;
import com.luminous.dsys.youthconnect.util.Constants;
/**
* A simple {@link Fragment} subclass.
* Activities that contain this fragment must implement the
* {@link OnFragmentInteractionListener} interfaces
* to handle interaction events.
* Use the {@link DashboardFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class DashboardFragment extends Fragment implements
AbsListView.OnItemClickListener,
SwipeRefreshLayout.OnRefreshListener, View.OnClickListener,
Replication.ChangeListener {
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_CAMP_CODE = "campcode";
private static final String ARG_PARAM2 = "param2";
// TODO: Rename and change types of parameters
private String mParamCampCode;
private String mParam2;
private OnFragmentInteractionListener mListener;
protected String[] mXValuesQA = new String[] {
"Pending", "Answered", "Published"
};
protected String[] mXValuesFeedback = new String[] {
"Pending", "Submitted"
};
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment HomeFragment.
*/
// TODO: Rename and change types and number of parameters
public static DashboardFragment newInstance(String param1, String param2) {
DashboardFragment fragment = new DashboardFragment();
Bundle args = new Bundle();
args.putString(ARG_CAMP_CODE, param1);
args.putString(ARG_PARAM2, param2);
fragment.setArguments(args);
return fragment;
}
public DashboardFragment() {
// Required empty public constructor
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mParamCampCode = getArguments().getString(ARG_CAMP_CODE);
mParam2 = getArguments().getString(ARG_PARAM2);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
final View view = inflater.inflate(R.layout.fragment_dashboard, container, false);
if(getView() != null){
init(getView());
}
LinearLayout layoutQAnswered = (LinearLayout) view.findViewById(R.id.layoutQAnswered);
layoutQAnswered.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getActivity(), QAAnsweredActivity.class);
startActivity(intent);
}
});
LinearLayout layoutPendinQA = (LinearLayout) view.findViewById(R.id.layoutPendinQA);
layoutPendinQA.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getActivity(), QAPendingActivity.class);
startActivity(intent);
}
});
LinearLayout layoutShowcase = (LinearLayout) view.findViewById(R.id.layoutShowcase);
layoutShowcase.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(getActivity() != null) {
TabLayout tabLayout = (TabLayout) getActivity().findViewById(R.id.tabView);
TabLayout.Tab tab = tabLayout.getTabAt(1);
tab.select();
}
}
});
LinearLayout layoutDoc = (LinearLayout) view.findViewById(R.id.layoutDoc);
layoutDoc.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getActivity(), DocListActivity.class);
startActivity(intent);
}
});
return view;
}
private void init(View view){
Application application = ((MainActivity) getActivity()).application;
final TextView tvQuestionsAnswered = (TextView) view.findViewById(R.id.tvQuestionsAnswered);
final TextView tvPendingQuestions = (TextView) view.findViewById(R.id.tvPendingQuestions);
final TextView tvShowcaseEvents = (TextView) view.findViewById(R.id.tvShowcaseEvents);
final TextView tvDocuments = (TextView) view.findViewById(R.id.tvDocuments);
int user_type_id = getActivity().getSharedPreferences(Constants.SHAREDPREFERENCE_KEY, 1).getInt(Constants.SP_USER_ID, 0);
if(user_type_id == 1){
LiveQuery liveQuery1 = application.getQAAnsweredForAdminQuery(application.getDatabase()).toLiveQuery();
liveQuery1.addChangeListener(new LiveQuery.ChangeListener() {
@Override
public void changed(final LiveQuery.ChangeEvent event) {
//TODO: Revise
(getActivity()).runOnUiThread(new Runnable() {
@Override
public void run() {
QueryEnumerator enumerator = event.getRows();
if (enumerator != null) {
int totalAnsweredForCurrentlyLoggedInNodalUser = enumerator.getCount();
tvQuestionsAnswered.setText(totalAnsweredForCurrentlyLoggedInNodalUser + "");
}
}
});
}
});
liveQuery1.start();
LiveQuery liveQuery2 = application.getQAUnAnsweredForAdminQuery(application.getDatabase()).toLiveQuery();
liveQuery2.addChangeListener(new LiveQuery.ChangeListener() {
@Override
public void changed(final LiveQuery.ChangeEvent event) {
//TODO: Revise
(getActivity()).runOnUiThread(new Runnable() {
@Override
public void run() {
QueryEnumerator enumerator = event.getRows();
if (enumerator != null) {
int totalAnsweredForCurrentlyLoggedInNodalUser = enumerator.getCount();
tvPendingQuestions.setText(totalAnsweredForCurrentlyLoggedInNodalUser + "");
}
}
});
}
});
liveQuery2.start();
LiveQuery liveQuery4 = application.getDocForAdminQuery(application.getDatabase()).toLiveQuery();
liveQuery4.addChangeListener(new LiveQuery.ChangeListener() {
@Override
public void changed(final LiveQuery.ChangeEvent event) {
//TODO: Revise
(getActivity()).runOnUiThread(new Runnable() {
@Override
public void run() {
QueryEnumerator enumerator = event.getRows();
if (enumerator != null) {
int totalAnsweredForCurrentlyLoggedInNodalUser = enumerator.getCount();
tvDocuments.setText(totalAnsweredForCurrentlyLoggedInNodalUser + "");
}
}
});
}
});
liveQuery4.start();
} else{
LiveQuery liveQuery1 = application.getQAAnsweredForNodalQuery(application.getDatabase()).toLiveQuery();
liveQuery1.addChangeListener(new LiveQuery.ChangeListener() {
@Override
public void changed(final LiveQuery.ChangeEvent event) {
//TODO: Revise
(getActivity()).runOnUiThread(new Runnable() {
@Override
public void run() {
QueryEnumerator enumerator = event.getRows();
if(enumerator != null){
int totalAnsweredForCurrentlyLoggedInNodalUser = enumerator.getCount();
tvQuestionsAnswered.setText(totalAnsweredForCurrentlyLoggedInNodalUser+"");
}
}
});
}
});
liveQuery1.start();
LiveQuery liveQuery2 = application.getQAUnAnsweredForNodalQuery(application.getDatabase()).toLiveQuery();
liveQuery2.addChangeListener(new LiveQuery.ChangeListener() {
@Override
public void changed(final LiveQuery.ChangeEvent event) {
//TODO: Revise
(getActivity()).runOnUiThread(new Runnable() {
@Override
public void run() {
QueryEnumerator enumerator = event.getRows();
if (enumerator != null) {
int totalAnsweredForCurrentlyLoggedInNodalUser = enumerator.getCount();
tvPendingQuestions.setText(totalAnsweredForCurrentlyLoggedInNodalUser + "");
}
}
});
}
});
liveQuery2.start();
LiveQuery liveQuery4 = application.getDocForNodalQuery(application.getDatabase()).toLiveQuery();
liveQuery4.addChangeListener(new LiveQuery.ChangeListener() {
@Override
public void changed(final LiveQuery.ChangeEvent event) {
//TODO: Revise
(getActivity()).runOnUiThread(new Runnable() {
@Override
public void run() {
QueryEnumerator enumerator = event.getRows();
if (enumerator != null) {
int totalAnsweredForCurrentlyLoggedInNodalUser = enumerator.getCount();
tvDocuments.setText(totalAnsweredForCurrentlyLoggedInNodalUser + "");
}
}
});
}
});
liveQuery4.start();
}
LiveQuery liveQuery3 = application.getPublishedDocQuery(application.getDatabase()).toLiveQuery();
liveQuery3.addChangeListener(new LiveQuery.ChangeListener() {
@Override
public void changed(final LiveQuery.ChangeEvent event) {
//TODO: Revise
(getActivity()).runOnUiThread(new Runnable() {
@Override
public void run() {
QueryEnumerator enumerator = event.getRows();
if (enumerator != null) {
int totalAnsweredForCurrentlyLoggedInNodalUser = enumerator.getCount();
tvShowcaseEvents.setText(totalAnsweredForCurrentlyLoggedInNodalUser + "");
}
}
});
}
});
liveQuery3.start();
}
@Override
public void onClick(View view) {
if(getActivity() == null){
return;
}
int user_type_id = getActivity().getSharedPreferences(Constants.SHAREDPREFERENCE_KEY, 1).getInt(Constants.SP_USER_TYPE, 0);
int id = view.getId();
FragmentTransaction ft = getActivity().getSupportFragmentManager().beginTransaction();
switch (id){
case R.id.layoutQAnswered:
if(getActivity() != null) {
Intent intent = new Intent(getActivity(), QAAnsweredActivity.class);
startActivity(intent);
}
break;
case R.id.layoutPendinQA:
if(getActivity() != null) {
Intent intent = new Intent(getActivity(), QAPendingActivity.class);
startActivity(intent);
}
break;
case R.id.layoutShowcase:
ShowcaseFragment fragmentShowcase = ShowcaseFragment.newInstance("", "");
ft.addToBackStack(Constants.FRAGMENT_HOME_SHOWCASE_PAGE);
ft.commitAllowingStateLoss();
ft.attach(fragmentShowcase);
ft.commitAllowingStateLoss();
break;
case R.id.layoutDoc:
if(getActivity() != null) {
Intent intent = new Intent(getActivity(), DocListActivity.class);
startActivity(intent);
}
break;
default:
//TODO
break;
}
}
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
/**
* Showing Swipe Refresh animation on activity create
* As animation won't start on onCreate, post runnable is used
*/
final View _view = view;
fetchData(_view);
}
/**
* This method is called when swipe refresh is pulled down
*/
@Override
public void onRefresh() {
if (getView() != null) {
fetchData(getView());
}
}
@Override
public void changed(Replication.ChangeEvent event) {
fetchData(getView());
}
public void fetchData(View view) {
if(view == null){
return;
}
if(getView() != null){
init(getView());
}
}
// TODO: Rename method, update argument and hook method into UI event
public void onButtonPressed(String str) {
if (mListener != null) {
mListener.onDashboardFragmentInteraction(this);
}
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (null != mListener) {
// Notify the active callbacks interfaces (the activity, if the
// fragment is attached to one) that an item has been selected.
mListener.onDashboardFragmentInteraction(this);
}
}
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
try {
mListener = (OnFragmentInteractionListener) activity;
} catch (ClassCastException e) {
throw new ClassCastException(activity.toString()
+ " must implement OnFragmentInteractionListener");
}
}
@Override
public void onDetach() {
super.onDetach();
mListener = null;
}
/**
* This interfaces must be implemented by activities that contain this
* fragment to allow an interaction in this fragment to be communicated
* to the activity and potentially other fragments contained in that
* activity.
* <p/>
* See the Android Training lesson <a href=
* "http://developer.android.com/training/basics/fragments/communicating.html"
* >Communicating with Other Fragments</a> for more information.
*/
public interface OnFragmentInteractionListener {
// TODO: Update argument type and name
public void onDashboardFragmentInteraction(DashboardFragment dashboardFragment);
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
if(getActivity() == null){
return;
}
if(getView() == null){
return;
}
getView().setFocusableInTouchMode(true);
getView().requestFocus();
getView().setOnKeyListener(new View.OnKeyListener() {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) {
Log.e("gif--", "fragment back key is clicked");
getActivity().finish();
return true;
}
return false;
}
});
setHasOptionsMenu(true);
}
public void setUserVisibleHint(boolean visible)
{
super.setUserVisibleHint(visible);
if (visible && isResumed())
{
//Only manually call onResume if fragment is already visible
//Otherwise allow natural fragment lifecycle to call onResume
onResume();
}
}
@Override
public void onResume()
{
super.onResume();
if (!getUserVisibleHint() || getView() == null)
{
return;
}
fetchData(getView());
}
@Override
public void onDestroyView() {
System.gc();
super.onDestroyView();
}
@Override
public void onDestroy() {
System.gc();
super.onDestroy();
}
} | [
"suhasini.reddy@lipl.in"
] | suhasini.reddy@lipl.in |
a2042d5ffbaea84a733f05630389b68a94bda18b | 8204f77c1f6b345bdb5c8886c7dd6bf257477b18 | /src/main/java/com/fkapi/service/p2p_cust_location_logService.java | 573d12baf37e99fcc06b93ecc4aecf4957ead940 | [] | no_license | JRICHub/ApiTest | 996d655fc5af839916171a86bc55344417be50b6 | a494a583f1eef26e875bdd8a96d5dcd6b71fe907 | refs/heads/master | 2021-08-23T08:08:29.766473 | 2017-12-04T08:04:41 | 2017-12-04T08:04:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,134 | java | package com.fkapi.service;
import com.fkapi.datebase.dao.p2p_cust_location_logMapper;
import com.fkapi.datebase.domain.p2p_cust_location_log;
import com.fkapi.utils.CommonUtils;
import org.apache.ibatis.session.SqlSession;
import org.json.JSONObject;
import org.testng.Reporter;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* Created by Administrator on 2017/7/12.
*/
public class p2p_cust_location_logService {
p2p_cust_location_logMapper pcllMapper ;
p2p_customerService pcService ;
ex_collegesService ecService ;
p2p_cust_location_log pcll ;
p2p_dictionaryService pdService ;
public void addCustLocationLog(Map<String, String> userInfoMap, JSONObject json, SqlSession session, String option){
delCustLocationLog(userInfoMap.get("oldCustId"), session);
pcllMapper = session.getMapper(p2p_cust_location_logMapper.class);
pcService = new p2p_customerService();
pcll = new p2p_cust_location_log();
ecService = new ex_collegesService();
pdService = new p2p_dictionaryService();
List<p2p_cust_location_log> list ;
if(option.equals("VA_F012")){
if(json.get("isSame").equals("Y")){
for(int i=0;i<json.getInt("loginNum");i++){
list = new ArrayList<>();
pcll.setCustId(Long.valueOf(userInfoMap.get("custId")));
pcll.setCreateTime(CommonUtils.getCurDate("second"));
pcll.setMobileSign("88888888");
pcll.setDeviceMac("88888888");
list.add(pcll);
try{
pcllMapper.insert(list);
Reporter.log("根据custId: " + userInfoMap.get("custId") + "添加p2p_cust_location_log表数据成功");
}catch (Exception e){
Reporter.log("根据custId: " + userInfoMap.get("custId") + "添加p2p_cust_location_log表时发生异常,添加失败" + e.getMessage());
}
}
}else {
for(int i=0;i<json.getInt("loginNum");i++){
list = new ArrayList<>();
pcll.setCustId(Long.valueOf(userInfoMap.get("custId")));
pcll.setCreateTime(CommonUtils.subMin(CommonUtils.getCurDate("second"), 5));
pcll.setMobileSign("88888888" + i);
pcll.setDeviceMac("88888888" + i);
list.add(pcll);
try{
pcllMapper.insert(list);
Reporter.log("根据custId: " + userInfoMap.get("custId") + "添加p2p_cust_location_log表数据成功");
}catch (Exception e){
Reporter.log("根据custId: " + userInfoMap.get("custId") + "添加p2p_cust_location_log表时发生异常,添加失败" + e.getMessage());
}
}
}
}
if (option.equals("VA_F014")){
List<String> cityList = new ArrayList<>();
Map<Object, Object> schoolCityMap = null;
if (!userInfoMap.get("educationAuth").isEmpty()){
if (new JSONObject(userInfoMap.get("educationAuth")).getString("educationAuthStatus").equals("AS")){
schoolCityMap = ecService.getCollegesDate(new JSONObject(userInfoMap.get("educationAuth")).getString("collegeName"), session);
}
}
if (!userInfoMap.get("schoolRollAuth").isEmpty()){
if (new JSONObject(userInfoMap.get("schoolRollAuth")).getString("schoolRollAuthStatus").equals("AS")){
schoolCityMap = ecService.getCollegesDate(new JSONObject(userInfoMap.get("schoolRollAuth")).getString("collegeName"), session);
}
}
String parentCity = pdService.getDictCode(new JSONObject(userInfoMap.get("contractor").toString()).getString("city"), session);
if(json.getString("isSchool").toUpperCase().equals("Y") || json.getString("isParent").toUpperCase().equals("Y") || json.getString("isHome").toUpperCase().equals("Y")){
for (int i=0;i<json.getInt("effectiveNum");i++){
list = new ArrayList<>();
pcll.setCustId(Long.valueOf(userInfoMap.get("custId")));
pcll.setCreateTime(CommonUtils.getCurDate("second"));
pcll.setLongitude("120");
pcll.setLatitude("31");
if(json.getString("isSchool").toUpperCase().equals("Y") && json.getString("isParent").toUpperCase().equals("Y")){
pcll.setCityCode(String.valueOf(schoolCityMap.get("city")));
}
if(json.getString("isSchool").toUpperCase().equals("Y") && !json.getString("isParent").toUpperCase().equals("Y")){
pcll.setCityCode(String.valueOf(schoolCityMap.get("city")));
}
if(!json.getString("isSchool").toUpperCase().equals("Y") && json.getString("isParent").toUpperCase().equals("Y")){
pcll.setCityCode(parentCity);
}
list.add(pcll);
try{
pcllMapper.insert(list);
Reporter.log("根据custId: " + userInfoMap.get("custId") + "添加p2p_cust_location_log表数据成功");
}catch (Exception e){
Reporter.log("根据custId: " + userInfoMap.get("custId") + "添加p2p_cust_location_log表时发生异常,添加失败" + e.getMessage());
}
}
}else {
cityList.add(schoolCityMap.get("city").toString());
cityList.add(parentCity);
for (int i=0;i<json.getInt("effectiveNum");i++){
list = new ArrayList<>();
pcll.setCustId(Long.valueOf(userInfoMap.get("custId")));
pcll.setCreateTime(CommonUtils.getCurDate("second"));
pcll.setLongitude("120");
pcll.setLatitude("31");
pcll.setCityCode(pdService.getOtherDictCode(cityList, session));
list.add(pcll);
try{
pcllMapper.insert(list);
Reporter.log("根据custId: " + userInfoMap.get("custId") + "添加p2p_cust_location_log表数据成功");
}catch (Exception e){
Reporter.log("根据custId: " + userInfoMap.get("custId") + "添加p2p_cust_location_log表时发生异常,添加失败" + e.getMessage());
}
}
}
for (int j = 0; j < json.getInt("allNum") - json.getInt("effectiveNum"); j++) {
list = new ArrayList<>();
pcll.setCustId(Long.valueOf(userInfoMap.get("custId")));
pcll.setCreateTime(CommonUtils.getCurDate("second"));
pcll.setLongitude("0");
pcll.setLatitude("0");
pcll.setCityCode(null);
list.add(pcll);
try{
pcllMapper.insert(list);
Reporter.log("根据custId: " + userInfoMap.get("custId") + "添加p2p_cust_location_log表数据成功");
}catch (Exception e){
Reporter.log("根据custId: " + userInfoMap.get("custId") + "添加p2p_cust_location_log表时发生异常,添加失败" + e.getMessage());
}
}
}
}
public void delCustLocationLog(String oldCustId, SqlSession session){
pcllMapper = session.getMapper(p2p_cust_location_logMapper.class);
pcService = new p2p_customerService();
try{
pcllMapper.deleteByCustId(Long.valueOf(oldCustId));
}catch (Exception e){
Reporter.log("根据custId: " + oldCustId + "删除p2p_cust_location_log表中的数据时发生异常,删除失败" + e.getMessage());
}
}
}
| [
"243303098@qq.com"
] | 243303098@qq.com |
5d8121b42ad10a67c191ef7bd27f67cc444828e4 | 020dde393c56de396e39cd9c63efc2f404a17ea5 | /src/com/hcss/action/ViewPassportDetailsAction.java | f4c4c8e8f3f9a30f5cbf4b8d21796540c206ca49 | [] | no_license | chaithanyagogineni/Probabilistic-Aspect-Mining-Model | 0c1d27fb361e7c00521e2cbec0f450635b08bd97 | 46346b79cbaf826f0ed053ae17053285e18bc59d | refs/heads/master | 2023-02-11T12:19:01.508983 | 2023-01-27T03:55:04 | 2023-01-27T03:55:04 | 157,014,357 | 0 | 0 | null | 2023-01-27T03:55:05 | 2018-11-10T19:29:49 | Java | UTF-8 | Java | false | false | 1,930 | java | /*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package com.hcss.action;
import java.util.Vector;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.hcss.bean.PassportTO;
import com.hcss.delegate.UserPersonalDelegate;
import com.hcss.utill.UtilConstants;
/**
* MyEclipse Struts Creation date: 09-01-2012
*
* XDoclet definition:
*
* @struts.action validate="true"
* @struts.action-forward name="failure" path="/Status.jsp"
* @struts.action-forward name="success" path="/ViewPassportDetails.jsp"
*/
public class ViewPassportDetailsAction extends Action {
/*
* Generated Methods
*/
/**
* Method execute
*
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
// TODO Auto-generated method stub
HttpSession session = request.getSession();
int userid = (Integer) session.getAttribute("userid");
Vector<PassportTO> vPassportTOs = null;
try {
vPassportTOs = new UserPersonalDelegate()
.viewPassportDetails(userid);
if (vPassportTOs != null) {
request.setAttribute("vPassportTOs", vPassportTOs);
request.setAttribute("status",
UtilConstants._VIEW_PASSPORT_DETAILS);
return mapping.findForward("success");
} else {
request.setAttribute("status",
UtilConstants._VIEW_PASSPORT_DETAILS_FAIL);
return mapping.findForward("failure");
}
} catch (Exception ce) {
request.setAttribute("status", ce.getMessage());
return mapping.findForward("failure");
}
}
} | [
"krishnagogineni.1994@gmail.com"
] | krishnagogineni.1994@gmail.com |
206e773e77db7612fbe5788bab4bdf69191b293e | a636258c60406f8db850d695b064836eaf75338b | /src-gen/com/redcarpet/epcg/data/EpcgInsurancetype.java | 223e1b4ba636b17f975f85bcaef23dce95d1a194 | [] | no_license | Afford-Solutions/openbravo-payroll | ed08af5a581fa41455f4e9b233cb182d787d5064 | 026fee4fe79b1f621959670fdd9ae6dec33d263e | refs/heads/master | 2022-03-10T20:43:13.162216 | 2019-11-07T18:31:05 | 2019-11-07T18:31:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,335 | java | /*
*************************************************************************
* The contents of this file are subject to the Openbravo Public License
* Version 1.1 (the "License"), being the Mozilla Public License
* Version 1.1 with a permitted attribution clause; you may not use this
* file except in compliance with the License. You may obtain a copy of
* the License at http://www.openbravo.com/legal/license.html
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
* The Original Code is Openbravo ERP.
* The Initial Developer of the Original Code is Openbravo SLU
* All portions are Copyright (C) 2008-2011 Openbravo SLU
* All Rights Reserved.
* Contributor(s): ______________________________________.
************************************************************************
*/
package com.redcarpet.epcg.data;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.openbravo.base.structure.ActiveEnabled;
import org.openbravo.base.structure.BaseOBObject;
import org.openbravo.base.structure.ClientEnabled;
import org.openbravo.base.structure.OrganizationEnabled;
import org.openbravo.base.structure.Traceable;
import org.openbravo.model.ad.access.User;
import org.openbravo.model.ad.system.Client;
import org.openbravo.model.common.enterprise.Organization;
/**
* Entity class for entity Epcg_Insurancetype (stored in table Epcg_Insurancetype).
*
* NOTE: This class should not be instantiated directly. To instantiate this
* class the {@link org.openbravo.base.provider.OBProvider} should be used.
*/
public class EpcgInsurancetype extends BaseOBObject implements Traceable, ClientEnabled, OrganizationEnabled, ActiveEnabled {
private static final long serialVersionUID = 1L;
public static final String TABLE_NAME = "Epcg_Insurancetype";
public static final String ENTITY_NAME = "Epcg_Insurancetype";
public static final String PROPERTY_ID = "id";
public static final String PROPERTY_CLIENT = "client";
public static final String PROPERTY_ORGANIZATION = "organization";
public static final String PROPERTY_ACTIVE = "active";
public static final String PROPERTY_CREATIONDATE = "creationDate";
public static final String PROPERTY_CREATEDBY = "createdBy";
public static final String PROPERTY_UPDATED = "updated";
public static final String PROPERTY_UPDATEDBY = "updatedBy";
public static final String PROPERTY_SEARCHKEY = "searchKey";
public static final String PROPERTY_COMMERCIALNAME = "commercialName";
public static final String PROPERTY_DESCRIPTION = "description";
public static final String PROPERTY_DEFAULT = "default";
public static final String PROPERTY_EPCGBPINSURANCELIST = "epcgBpinsuranceList";
public static final String PROPERTY_EPCGCOSTENQUIRYLIST = "epcgCostenquiryList";
public EpcgInsurancetype() {
setDefaultValue(PROPERTY_ACTIVE, true);
setDefaultValue(PROPERTY_DEFAULT, false);
setDefaultValue(PROPERTY_EPCGBPINSURANCELIST, new ArrayList<Object>());
setDefaultValue(PROPERTY_EPCGCOSTENQUIRYLIST, new ArrayList<Object>());
}
@Override
public String getEntityName() {
return ENTITY_NAME;
}
public String getId() {
return (String) get(PROPERTY_ID);
}
public void setId(String id) {
set(PROPERTY_ID, id);
}
public Client getClient() {
return (Client) get(PROPERTY_CLIENT);
}
public void setClient(Client client) {
set(PROPERTY_CLIENT, client);
}
public Organization getOrganization() {
return (Organization) get(PROPERTY_ORGANIZATION);
}
public void setOrganization(Organization organization) {
set(PROPERTY_ORGANIZATION, organization);
}
public Boolean isActive() {
return (Boolean) get(PROPERTY_ACTIVE);
}
public void setActive(Boolean active) {
set(PROPERTY_ACTIVE, active);
}
public Date getCreationDate() {
return (Date) get(PROPERTY_CREATIONDATE);
}
public void setCreationDate(Date creationDate) {
set(PROPERTY_CREATIONDATE, creationDate);
}
public User getCreatedBy() {
return (User) get(PROPERTY_CREATEDBY);
}
public void setCreatedBy(User createdBy) {
set(PROPERTY_CREATEDBY, createdBy);
}
public Date getUpdated() {
return (Date) get(PROPERTY_UPDATED);
}
public void setUpdated(Date updated) {
set(PROPERTY_UPDATED, updated);
}
public User getUpdatedBy() {
return (User) get(PROPERTY_UPDATEDBY);
}
public void setUpdatedBy(User updatedBy) {
set(PROPERTY_UPDATEDBY, updatedBy);
}
public String getSearchKey() {
return (String) get(PROPERTY_SEARCHKEY);
}
public void setSearchKey(String searchKey) {
set(PROPERTY_SEARCHKEY, searchKey);
}
public String getCommercialName() {
return (String) get(PROPERTY_COMMERCIALNAME);
}
public void setCommercialName(String commercialName) {
set(PROPERTY_COMMERCIALNAME, commercialName);
}
public String getDescription() {
return (String) get(PROPERTY_DESCRIPTION);
}
public void setDescription(String description) {
set(PROPERTY_DESCRIPTION, description);
}
public Boolean isDefault() {
return (Boolean) get(PROPERTY_DEFAULT);
}
public void setDefault(Boolean deflt) {
set(PROPERTY_DEFAULT, deflt);
}
@SuppressWarnings("unchecked")
public List<Epcg_Bpinsurance> getEpcgBpinsuranceList() {
return (List<Epcg_Bpinsurance>) get(PROPERTY_EPCGBPINSURANCELIST);
}
public void setEpcgBpinsuranceList(List<Epcg_Bpinsurance> epcgBpinsuranceList) {
set(PROPERTY_EPCGBPINSURANCELIST, epcgBpinsuranceList);
}
@SuppressWarnings("unchecked")
public List<EpcgCostenquiry> getEpcgCostenquiryList() {
return (List<EpcgCostenquiry>) get(PROPERTY_EPCGCOSTENQUIRYLIST);
}
public void setEpcgCostenquiryList(List<EpcgCostenquiry> epcgCostenquiryList) {
set(PROPERTY_EPCGCOSTENQUIRYLIST, epcgCostenquiryList);
}
}
| [
"rcss@ubuntu-server.administrator"
] | rcss@ubuntu-server.administrator |
c57aff9c47abcd2ac79aacdee6072f7c1bca27fc | 592c07d0b69161fb8db35cfdf699eaf0358cf403 | /gen/com/saad/hiphop/R.java | 68a0ae118e43d302ded63ab00f2747d3b4f33c81 | [] | no_license | arunov/HipHop | 9db8437107d51b9e11b69a90b0f1ceb1dacbb737 | 9c7dc31a0edfb25031f87ea2543eb9b5b04012aa | refs/heads/master | 2021-01-23T17:30:30.110552 | 2015-01-19T02:33:06 | 2015-01-19T02:33:06 | 29,450,092 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,156 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package com.saad.hiphop;
public final class R {
public static final class attr {
}
public static final class dimen {
/** Default screen margins, per the Android Design guidelines.
Customize dimensions originally defined in res/values/dimens.xml (such as
screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.
*/
public static final int activity_horizontal_margin=0x7f050000;
public static final int activity_vertical_margin=0x7f050001;
}
public static final class drawable {
public static final int ic_launcher=0x7f020000;
}
public static final class id {
public static final int action_settings=0x7f090004;
public static final int btnBlaah=0x7f090002;
public static final int btnReset=0x7f090003;
public static final int btnTapMe=0x7f090000;
public static final int progressBar2=0x7f090001;
}
public static final class layout {
public static final int activity_main=0x7f030000;
}
public static final class menu {
public static final int main=0x7f080000;
}
public static final class raw {
public static final int bd0000=0x7f040000;
public static final int cb=0x7f040001;
public static final int cl=0x7f040002;
public static final int ds=0x7f040003;
public static final int ds1=0x7f040004;
public static final int ds2=0x7f040005;
public static final int ds3=0x7f040006;
public static final int h=0x7f040007;
public static final int ma=0x7f040008;
public static final int rs=0x7f040009;
}
public static final class string {
public static final int action_settings=0x7f060001;
public static final int app_name=0x7f060000;
public static final int hello_world=0x7f060002;
}
public static final class style {
/**
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
Base application theme for API 11+. This theme completely replaces
AppBaseTheme from res/values/styles.xml on API 11+ devices.
API 11 theme customizations can go here.
Base application theme for API 14+. This theme completely replaces
AppBaseTheme from BOTH res/values/styles.xml and
res/values-v11/styles.xml on API 14+ devices.
API 14 theme customizations can go here.
*/
public static final int AppBaseTheme=0x7f070000;
/** Application theme.
All customizations that are NOT specific to a particular API-level can go here.
*/
public static final int AppTheme=0x7f070001;
}
}
| [
"arunov1986@gmail.com"
] | arunov1986@gmail.com |
2a06b7f1560f653a8b7fffd124d1181d716aa1ef | 509e6e1c3fd76a3c3bffa061d73d8e47d4a12a1d | /main/java/mobapde/machineproject/thenessfit/WeightLogListActivity.java | c165dfbe2e78dcf879c3dc1876793ff90d6cf0cb | [] | no_license | mjarenyap/NessFIT-Mobile-App | 341220f6534e66134653d77c42cb210ba4cdbc0d | 36300c445d89ce90cadfd5fe5c5584b98feb1bda | refs/heads/master | 2021-05-06T07:32:23.720054 | 2017-12-12T11:44:26 | 2017-12-12T11:44:26 | 113,983,116 | 0 | 0 | null | 2017-12-12T14:26:57 | 2017-12-12T11:39:03 | Java | UTF-8 | Java | false | false | 366 | java | package mobapde.machineproject.thenessfit;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class WeightLogListActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_weight_log_list);
}
}
| [
"mjaren.yap@gmail.com"
] | mjaren.yap@gmail.com |
91b2bf09cce02dae7b0630bfbdda06059312df9d | 89038dc485353803d0210bf5d3d92701d52bd1df | /school/src/com/movie/web/grade/GradeService.java | 4aa48de7b8c017bff1bae71d381c686507e03130 | [] | no_license | kimmiri415/school | ed415ae216354ac7e00f64482a5d1e11adfcf97a | 24250016d49e6883bcdcbe443ee14702d3a998b1 | refs/heads/master | 2021-01-10T08:26:50.234154 | 2016-03-23T06:36:02 | 2016-03-23T06:36:02 | 54,099,119 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 873 | java | package com.movie.web.grade;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* CRUD C : create 생성 R : read 조회 U : update 수정 D : delete 삭제
*/
public interface GradeService {
// C 성적표 등록
public void input(GradeBean grade);// 추상 메소드
// R 성적표 리스트 출력
public List<GradeMemberBean> getList();
// R 성적표 조회(학번)
public GradeMemberBean getGradeByHak(int hak);
// R 성적표 조회(아이디)
public GradeMemberBean getGradeById(String id);
// R 성적표 조회(이름)
public List<GradeMemberBean> getGradesByName(String name);
// R 카운트 조회
public int getCount();
// R 이름조회시 카운트조회
public void getCountByName();
// U 성적표 수정
public String update(GradeBean grade);
// D 성적표 삭제
public String delete(int hak);
}
| [
"rlaalfl92@gmail.com"
] | rlaalfl92@gmail.com |
c2148cde0f8eb40e5f3c251f43ce2c6e0e9d9aad | 2715095ad647e3b27dd0beb113c42f594eea6275 | /src/main/java/com/examcreator/finalproject/entities/classEntities/Users/Name.java | 5c48c5ef361fea1c6fd21388065a42d2dda92526 | [] | no_license | sajjadRabiee/exam-creator | 9ea3a0c6665d4b5d6f029bfd5bac465ed67868a7 | 924ce47e882c2fb45886509877247110a45b8c1a | refs/heads/master | 2023-02-17T05:51:35.473177 | 2021-01-19T11:09:26 | 2021-01-19T11:09:26 | 319,075,807 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 647 | java | package com.examcreator.finalproject.entities.classEntities.Users;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import javax.persistence.Embeddable;
@Component
@Scope("prototype")
@Embeddable
public class Name {
private String firstName;
private String lastName;
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
}
| [
"Rabiee.614@gmail.com"
] | Rabiee.614@gmail.com |
f749373ff22105e1ae4c5af90c8cc21eb18e0585 | d0913528f329ac62ee887c9e61c50d805597c75a | /ComponentEx/src/JComponentEx.java | f96201fdcab8edd8c4bebda4cd4b615de6ce9b2e | [] | no_license | jiwonan/2019java | 88a83e0e227093b40aaa1f3e15dbb9137c76804a | 3346fc8bfb69bd486c37b0bdb778f697c351b60c | refs/heads/master | 2021-08-17T08:36:38.256681 | 2020-05-09T14:32:06 | 2020-05-09T14:32:06 | 179,186,488 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,115 | java | import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class JComponentEx extends JFrame {
public JComponentEx() {
super("JComponent의 공통 메소드 예제");
Container c = getContentPane();
c.setLayout(new FlowLayout());
JButton b1 = new JButton("Magenta/Yellow Button");
JButton b2 = new JButton(" Disabled Button ");
JButton b3 = new JButton("getX(), getY()");
b1.setBackground(Color.YELLOW); // 배경색 설정
b1.setForeground(Color.MAGENTA); // 글자색 설정
b1.setFont(new Font("Arial", Font.ITALIC, 20)); // Arial, 20픽셀 폰트 설정
b2.setEnabled(false); // 버튼 비활성화
b3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JButton b = (JButton)e.getSource();
JComponentEx frame = (JComponentEx)b.getTopLevelAncestor();
frame.setTitle(b.getX() + "," + b.getY()); // 타이틀에 버튼 좌표 출력
}
});
c.add(b1); c.add(b2); c.add(b3); // 컨텐트팬에 버튼 부착
setSize(260,200);
setVisible(true);
}
public static void main(String[] args) {
new JComponentEx();
}
} | [
"s2018s31@e-mirim.hs.kr"
] | s2018s31@e-mirim.hs.kr |
c151ab13b17e9a6c4dc75b4b773c3d795f1e78b9 | 017a6c2777229cd10d68d9a86aaf17cc693f6a50 | /app/src/main/java/com/tdt/easyroute/ViewModel/VentasDiaVM.java | b5847797c1fb7604be70f90a06c0c3cd08e7aa37 | [] | no_license | edgar9528/EasyRoute | 2711cf2531c5d2ebc6fc6cc727c2e2621176c9f0 | 7481e8a5dba675a6d911d7f02255a2c047e6041b | refs/heads/master | 2023-02-22T02:10:29.919969 | 2021-01-27T01:28:00 | 2021-01-27T01:28:00 | 217,073,715 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 864 | java | package com.tdt.easyroute.ViewModel;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
import com.tdt.easyroute.Model.DataTableLC;
import java.util.ArrayList;
public class VentasDiaVM extends ViewModel {
private final MutableLiveData<ArrayList<DataTableLC.Dtcobros> > dtCobros = new MutableLiveData<>();
private final MutableLiveData<String > botonClick = new MutableLiveData<>();
public LiveData<ArrayList<DataTableLC.Dtcobros>> getDtCobros(){
return dtCobros;
}
public void setDtCobros(ArrayList<DataTableLC.Dtcobros> Dtcobros){
this.dtCobros.setValue(Dtcobros);
}
public LiveData<String> getBotonClick(){
return botonClick;
}
public void setBotonClick(String BotonClick){
this.botonClick.setValue(BotonClick);
}
} | [
"edgar9528@gmai.com"
] | edgar9528@gmai.com |
fc99b9da7de7d7f8ab77067b9794583db696c80b | b980b0c6ed35428da01c47ae77e01af455307bca | /src/test/java/com/cesgroup/java8/TestB.java | 485b200da92f5735e98f7dd1971821e96ea353d2 | [] | no_license | zdkGitHub/java8 | dcf3dba00a38a662c9ce0d89ff08d75c0aa3f6c2 | a51c34f7f9196e0141b6120767635da6b307f5a9 | refs/heads/master | 2023-01-31T04:38:10.725288 | 2020-12-14T05:24:29 | 2020-12-14T05:24:29 | 76,639,260 | 0 | 0 | null | 2020-12-14T08:21:53 | 2016-12-16T09:11:12 | Java | UTF-8 | Java | false | false | 196 | java | package com.cesgroup.java8;
/**
* @ClassName TestB
* @Description: TODO
* @Author zk
* @Date 2020/4/10
**/
public class TestB implements Test{
@Override
public void f_a() {
}
}
| [
"zhengke@rgbinfor.com"
] | zhengke@rgbinfor.com |
9a8e8f872be7606b4163d6253537921a252137cf | 5fa06a98a3cd760bcea0b5e66e03032b4d88f310 | /struts205_servletapi/src/cn/sxt/action/LoginAction1.java | d1d2eaca07c407ce86ce7d41d2453458bbd337c9 | [] | no_license | xubao0413/struts2 | d671e4fc298ad6f21edafafb974c7b419a222f93 | dcb1eebfab98c7372539d1c8775a01ae9b2e2854 | refs/heads/master | 2022-11-15T01:42:15.208421 | 2020-06-29T02:05:48 | 2020-06-29T02:05:48 | 275,706,893 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 1,049 | java | package cn.sxt.action;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts2.StrutsStatics;
import com.opensymphony.xwork2.ActionContext;
public class LoginAction1 {
private String name;
private String pwd;
//处理方法
public String execute(){
System.out.println(name+"---"+pwd);
if("siggy".equals(name)&&"1111".equals(pwd)){
HttpServletRequest request=(HttpServletRequest)ActionContext.getContext().get(StrutsStatics.HTTP_REQUEST);
request.getSession().setAttribute("user", name);
System.out.println("name===="+request.getParameter("name"));
return "success";
}else{
return "login";
}
}
public String logout(){
ActionContext.getContext().getSession().remove("user");
System.out.println("退出");
return "success";
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPwd() {
return pwd;
}
public void setPwd(String pwd) {
this.pwd = pwd;
}
}
| [
"xuebao0413@sina.com"
] | xuebao0413@sina.com |
e592168c8862c41a46116fae74c2921ae88b478f | e0ff90a193f2de79fc210962e11b53cdef7f074f | /Model.java | 915faead23246c8d757444cbc3a94db3e100a35c | [] | no_license | dcho6/CS425 | 3710d3324c0565a48650c607db499412fa131cac | 182705cfd65cf024b51d5cde701196f3c9ef4d54 | refs/heads/master | 2022-05-23T02:13:09.110532 | 2020-04-29T23:29:20 | 2020-04-29T23:29:20 | 258,059,862 | 0 | 1 | null | 2020-04-23T20:41:13 | 2020-04-23T01:13:09 | null | UTF-8 | Java | false | false | 482 | java | package CS425;
public class Model {
private int model_number, sale_price;
private String manufacturer;
public Model(int model_number, int sale_price, String manufacturer)
{
this.model_number = model_number;
this.sale_price = sale_price;
this.manufacturer = manufacturer;
}
public int getModelNumber()
{
return model_number;
}
public int getSalePrice()
{
return sale_price;
}
public String getManufacturer()
{
return manufacturer;
}
}
| [
"dcho6@hawk.iit.edu"
] | dcho6@hawk.iit.edu |
f9b4cec86ca1d164a3669fe6d31160037149a081 | 374badaebc25a238a2cd12b0f1cdf88ac26cc462 | /app/src/androidTest/java/com/example/android/inclassassignment04/ExampleInstrumentedTest.java | a923bdd57b4ad4f878541a150181dac9bb578601 | [] | no_license | CathyLiao/AndroidS | 8c97cff24135bb90dd529cc25c8c353e1523e330 | 6eb7820c5bc48f9affcabdc9422bdfc68d86aef8 | refs/heads/master | 2020-12-25T18:23:28.485721 | 2017-02-20T01:37:17 | 2017-02-20T01:37:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 782 | java | package com.example.android.inclassassignment04;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.android.inclassassignment04", appContext.getPackageName());
}
}
| [
"yy93618400"
] | yy93618400 |
10b9bd7857d8cb6b0eb15a2c5877ce6e7b4112de | b926b7eaa274f2a92ea904e8e84cd6917f969830 | /app/src/main/java/com/example/firechatapps/Fragments/ProfileFragment.java | 2cc197a5c04298d0394219e81a8833726adc30ec | [] | no_license | RenFrost/FirechatApps | 827e88702988f12fa8829332c65016329c6c76a8 | d13dc2bdd0e3a3c28d1e94846e5c54cc2b9e20ec | refs/heads/master | 2023-05-11T22:44:19.753633 | 2021-06-02T11:13:48 | 2021-06-02T11:13:48 | 371,062,871 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,692 | java | package com.example.firechatapps.Fragments;
import android.app.ProgressDialog;
import android.content.ContentResolver;
import android.content.Intent;
import android.media.Image;
import android.net.Uri;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.MimeTypeMap;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import com.bumptech.glide.Glide;
import com.example.firechatapps.Model.Users;
import com.example.firechatapps.R;
import com.google.android.gms.tasks.Continuation;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import com.google.firebase.storage.FirebaseStorage;
import com.google.firebase.storage.StorageReference;
import com.google.firebase.storage.StorageTask;
import com.google.firebase.storage.UploadTask;
import java.util.HashMap;
import static android.app.Activity.RESULT_OK;
public class ProfileFragment extends Fragment {
TextView username;
ImageView imageView;
DatabaseReference reference;
FirebaseUser fuser;
// Profile Image
StorageReference storageReference;
private static final int IMAGE_REQUEST = 1;
private Uri imageUri;
private StorageTask uploadTask;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_profile, container, false);
imageView = view.findViewById(R.id.profile_image);
username = view.findViewById(R.id.usernamer);
// Profile Image reference in storage
storageReference = FirebaseStorage.getInstance().getReference("Uploads");
fuser = FirebaseAuth.getInstance().getCurrentUser();
reference = FirebaseDatabase.getInstance().getReference("MyUsers").child(fuser.getUid());
reference.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
Users user = dataSnapshot.getValue(Users.class);
username.setText(user.getUsername());
if (user.getImageURL().equals("default")){
imageView.setImageResource(R.mipmap.ic_launcher);
}else{
Glide.with(getContext()).load(user.getImageURL()).into(imageView);
}
}
@Override
public void onCancelled(@NonNull DatabaseError error) {
}
});
imageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SelectImage();
}
});
return view;
}
private void SelectImage() {
Intent i = new Intent();
i.setType("image/*");
i.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(i,IMAGE_REQUEST);
}
private String getFileExtention(Uri uri){
ContentResolver contentResolver = getContext().getContentResolver();
MimeTypeMap mimeTypeMape = MimeTypeMap.getSingleton();
return mimeTypeMape.getExtensionFromMimeType(contentResolver.getType(uri));
}
private void UploadMyImage(){
final ProgressDialog progressDialog = new ProgressDialog(getContext());
progressDialog.setMessage("Uploading");
progressDialog.show();
if(imageUri != null){
final StorageReference fileReference = storageReference.child(System.currentTimeMillis()
+ "." +getFileExtention(imageUri));
uploadTask = fileReference.putFile(imageUri);
uploadTask.continueWithTask(new Continuation <UploadTask.TaskSnapshot, Task<Uri>>() {
@Override
public Task<Uri> then(@NonNull Task<UploadTask.TaskSnapshot> task) throws Exception {
if (!task.isSuccessful()) {
throw task.getException();
}
return fileReference.getDownloadUrl();
}
}).addOnCompleteListener(new OnCompleteListener<Uri>() {
@Override
public void onComplete(@NonNull Task<Uri> task) {
if (task.isSuccessful()) {
Uri downloadUri = task.getResult();
String mUri = downloadUri.toString();
reference = FirebaseDatabase.getInstance().getReference("MyUsers").child(fuser.getUid());
HashMap<String, Object> map = new HashMap<>();
map.put("imageURL", mUri);
reference.updateChildren(map);
progressDialog.dismiss();
}else{
Toast.makeText(getContext(), "Failed!!", Toast.LENGTH_SHORT).show();
}
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Toast.makeText(getContext(), e.getMessage(), Toast.LENGTH_SHORT).show();
progressDialog.dismiss();
}
});
}else
{
Toast.makeText(getContext(), "No Image Selected", Toast.LENGTH_SHORT).show();
}
}
@Override
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == IMAGE_REQUEST && resultCode == RESULT_OK
&& data != null && data.getData() != null){
imageUri = data.getData();
if(uploadTask != null && uploadTask.isInProgress()){
Toast.makeText(getContext(), "Upload in progress..", Toast.LENGTH_SHORT).show();
}else{
UploadMyImage();
}
}
}
} | [
"diidnugroho@gmail.com"
] | diidnugroho@gmail.com |
a464ebce74f2db8c20b77999838e755ae219ca72 | fb2b39da4b6a1f7c052f8af22fae941eb3235713 | /src/main/java/web/command/book/AddAuthorCommand.java | 70f7860547898cb931de97f66b923f516a457c5e | [] | no_license | yuriikondakov/book-library-servlets | 02c34b902898b0713369bac2ff47319b3fb2043e | 2a3a40e0905fd882d084cf3360c803af0228d631 | refs/heads/master | 2021-07-24T08:48:46.008930 | 2020-01-22T10:00:14 | 2020-01-22T10:00:14 | 224,703,131 | 0 | 0 | null | 2020-10-13T17:50:07 | 2019-11-28T17:43:44 | Java | UTF-8 | Java | false | false | 1,322 | java | package web.command.book;
import domain.Author;
import org.apache.log4j.Logger;
import service.AuthorService;
import web.command.ActionType;
import web.command.Command;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class AddAuthorCommand implements Command {
private static final Logger LOGGER = Logger.getLogger(AddAuthorCommand.class);
private final AuthorService authorService;
public AddAuthorCommand(AuthorService authorService) {
this.authorService = authorService;
}
@Override
public String execute(HttpServletRequest request, HttpServletResponse response, ActionType actionType) {
LOGGER.debug("execute");
if (actionType == ActionType.GET) {
return "add_author.jsp";
} else {
final String firstName = request.getParameter("firstName");
final String lastName = request.getParameter("lastName");
request.setAttribute("firstName", firstName);
request.setAttribute("lastName", lastName);
Author author = new Author(firstName, lastName);
Author savedAuthor = authorService.save(author);
request.setAttribute("addAuthorSuccessful", "Author added.");
return "add_author.jsp";
}
}
}
| [
"ozaets24@gmail.com"
] | ozaets24@gmail.com |
d45bf3d11c521bcb1bdd7c10c6a7a88aca71e23a | 0738217767b6ac9a59da91b4be09694032a13425 | /src/math/math_279_PerfectSquares.java | ee5326621ccf6f53a3e6900cb68c8219b2fbade9 | [] | no_license | boyangyuu/leetcode | 3a72a68e01572872d01ea803db8fe0fbe67a79ea | 84ac680fabd055ef6f7d579ca03ee8ffe0befd9a | refs/heads/master | 2021-07-06T21:16:32.849266 | 2017-10-01T04:46:35 | 2017-10-01T04:46:35 | 65,533,552 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,290 | java | package math;
public class math_279_PerfectSquares {
public static void main(String[] args) {
int[] nums = {0,0,0,0};
//System.out.println(a_18_4Sum.fourSum(nums, 0));
}
public int numSquares(int n) {
int[] dp = new int[n + 1]; //todo bug1
for (int i = 0; i < n + 1; i++) {
if (i != 0) dp[i] = Integer.MAX_VALUE;
for (int j = 0; j * j <= i; j++) {
dp[i] = Math.min(dp[i], 1 + dp[i - j * j]);
}
}
return dp[n]; // todo bug1
}
}
/** 题
*
* http:
*
*/
/** Solution
* 时间 空间
*
*
*
参考网站
TODO solotion
思想 :
暴力法
尝试所有的方法, 并取最小值,
其中会有大量重复运算, 故可以用dp 来避免
todo tips: u should ask , could I use O(n) space to apply dynamic programming
dp[i] : the number of perfect square numbers which sum to n , 12 = 4 + 4 + 4, then dp[12] = 3
dp[i] = min{
1 + dp[i - 1*1] // because 1*1 + dp[i-1*1]
1 + dp[i - 2*2] // 2*2 + dp[i-2*2]
1 + dp[i - 3*3] // 3*3 + dp[i-3*3]
..
}
TODO case
TODO bug
bug1
int[] dp = new int[n]; // bug1
=>
int[] dp = new int[n + 1]; // bug1 int[i] 代表总和为i时, 故应该返回的是dp[n]
bug2
bug3
*/
/*
TODO tutorial
*/
| [
"415098820@qq.com"
] | 415098820@qq.com |
b9078c6786acfad3a4463358e71b9b049188384f | 4ddaca5dae1ac44ecbb8030734b4cb77cd16becd | /CodingNinjas/LanguageTools/ExtractUniqueCharacter.java | 1f2382c9ea95f4af415529d11aa854defa65d9c5 | [
"Apache-2.0"
] | permissive | dgr8akki/DS-Algo-Made-Easy-With-Aakash | 55aad8cb22226322773871df4be2b53d12ec366a | ccb6f6323af47858a6647b72fbde79fe81538eb9 | refs/heads/develop | 2021-06-28T06:09:06.239674 | 2020-10-27T14:26:08 | 2020-10-27T14:26:08 | 144,481,699 | 9 | 0 | Apache-2.0 | 2020-10-05T09:13:49 | 2018-08-12T16:14:25 | Java | UTF-8 | Java | false | false | 507 | java | package CodingNinjas.LanguageTools;
import java.util.Set;
import java.util.HashSet;
class solution {
public static String uniqueChar(String str) {
StringBuilder builder = new StringBuilder();
Set<Character> set = new HashSet<>();
for (int i = 0; i < str.length(); i++) {
char currentCharacter = str.charAt(i);
if (!set.contains(currentCharacter)) {
builder.append(currentCharacter);
set.add(currentCharacter);
}
}
return builder.toString();
}
}
| [
"pahujaaakash5@gmail.com"
] | pahujaaakash5@gmail.com |
ec97bcf931735449c1b8992bcf99be9ef8f9e858 | 58d6b40c6dbbab91f1cd66a12452104427112ec6 | /Pweb/src/java/util/DAOFactory.java | 727b9ff5a920631084386f9dcbf5294bff27979a | [] | no_license | Lui5Edu4rdo/Desenvolvimento-Web | 9ab2bb498ea82d9f1fcfe5f8c8d8cc5f5cc0c91e | 44e5b23f084e75657928caa2c68a3e8f83dcc7bb | refs/heads/master | 2020-12-31T07:32:27.370686 | 2017-06-28T02:19:57 | 2017-06-28T02:19:57 | 86,582,159 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 393 | java | /*
* 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 util;
import ConexaoDAO.JDBCproduto;
import ConexaoDAO.ProdutoDAO;
public class DAOFactory {
public static ProdutoDAO createProdutoDAO(){
return new JDBCproduto();
}
}
| [
"luizedurn@gmail.com"
] | luizedurn@gmail.com |
6cb606f4d0e1ce0a3e8e573d80adada01af5de62 | 22ac0e3decb28484681968d16edd7c03621ba1bf | /src/main/java/com/gsms/cn/entity/authorization/UserRoleExample.java | a22518a40b5573cd35318004f0af3727738e4fc9 | [] | no_license | helloLiKun/gsms | 3bd35dc8b115a70442ad0f054c13443eb8546fc0 | 13eb0438198908748bcdb3bf715a449ad3cad818 | refs/heads/master | 2021-03-27T20:52:03.861088 | 2018-01-29T12:59:00 | 2018-01-29T12:59:00 | 118,340,338 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,027 | java | package com.gsms.cn.entity.authorization;
import java.util.ArrayList;
import java.util.List;
public class UserRoleExample {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table T_USER_ROLE_TAB
*
* @mbggenerated Mon Jan 22 10:18:56 CST 2018
*/
protected String orderByClause;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table T_USER_ROLE_TAB
*
* @mbggenerated Mon Jan 22 10:18:56 CST 2018
*/
protected boolean distinct;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table T_USER_ROLE_TAB
*
* @mbggenerated Mon Jan 22 10:18:56 CST 2018
*/
protected List<Criteria> oredCriteria;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table T_USER_ROLE_TAB
*
* @mbggenerated Mon Jan 22 10:18:56 CST 2018
*/
public UserRoleExample() {
oredCriteria = new ArrayList<Criteria>();
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table T_USER_ROLE_TAB
*
* @mbggenerated Mon Jan 22 10:18:56 CST 2018
*/
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table T_USER_ROLE_TAB
*
* @mbggenerated Mon Jan 22 10:18:56 CST 2018
*/
public String getOrderByClause() {
return orderByClause;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table T_USER_ROLE_TAB
*
* @mbggenerated Mon Jan 22 10:18:56 CST 2018
*/
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table T_USER_ROLE_TAB
*
* @mbggenerated Mon Jan 22 10:18:56 CST 2018
*/
public boolean isDistinct() {
return distinct;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table T_USER_ROLE_TAB
*
* @mbggenerated Mon Jan 22 10:18:56 CST 2018
*/
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table T_USER_ROLE_TAB
*
* @mbggenerated Mon Jan 22 10:18:56 CST 2018
*/
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table T_USER_ROLE_TAB
*
* @mbggenerated Mon Jan 22 10:18:56 CST 2018
*/
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table T_USER_ROLE_TAB
*
* @mbggenerated Mon Jan 22 10:18:56 CST 2018
*/
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table T_USER_ROLE_TAB
*
* @mbggenerated Mon Jan 22 10:18:56 CST 2018
*/
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table T_USER_ROLE_TAB
*
* @mbggenerated Mon Jan 22 10:18:56 CST 2018
*/
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table T_USER_ROLE_TAB
*
* @mbggenerated Mon Jan 22 10:18:56 CST 2018
*/
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("ID is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("ID is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(String value) {
addCriterion("ID =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(String value) {
addCriterion("ID <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(String value) {
addCriterion("ID >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(String value) {
addCriterion("ID >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(String value) {
addCriterion("ID <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(String value) {
addCriterion("ID <=", value, "id");
return (Criteria) this;
}
public Criteria andIdLike(String value) {
addCriterion("ID like", value, "id");
return (Criteria) this;
}
public Criteria andIdNotLike(String value) {
addCriterion("ID not like", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<String> values) {
addCriterion("ID in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<String> values) {
addCriterion("ID not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(String value1, String value2) {
addCriterion("ID between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(String value1, String value2) {
addCriterion("ID not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andUIdIsNull() {
addCriterion("U_ID is null");
return (Criteria) this;
}
public Criteria andUIdIsNotNull() {
addCriterion("U_ID is not null");
return (Criteria) this;
}
public Criteria andUIdEqualTo(String value) {
addCriterion("U_ID =", value, "uId");
return (Criteria) this;
}
public Criteria andUIdNotEqualTo(String value) {
addCriterion("U_ID <>", value, "uId");
return (Criteria) this;
}
public Criteria andUIdGreaterThan(String value) {
addCriterion("U_ID >", value, "uId");
return (Criteria) this;
}
public Criteria andUIdGreaterThanOrEqualTo(String value) {
addCriterion("U_ID >=", value, "uId");
return (Criteria) this;
}
public Criteria andUIdLessThan(String value) {
addCriterion("U_ID <", value, "uId");
return (Criteria) this;
}
public Criteria andUIdLessThanOrEqualTo(String value) {
addCriterion("U_ID <=", value, "uId");
return (Criteria) this;
}
public Criteria andUIdLike(String value) {
addCriterion("U_ID like", value, "uId");
return (Criteria) this;
}
public Criteria andUIdNotLike(String value) {
addCriterion("U_ID not like", value, "uId");
return (Criteria) this;
}
public Criteria andUIdIn(List<String> values) {
addCriterion("U_ID in", values, "uId");
return (Criteria) this;
}
public Criteria andUIdNotIn(List<String> values) {
addCriterion("U_ID not in", values, "uId");
return (Criteria) this;
}
public Criteria andUIdBetween(String value1, String value2) {
addCriterion("U_ID between", value1, value2, "uId");
return (Criteria) this;
}
public Criteria andUIdNotBetween(String value1, String value2) {
addCriterion("U_ID not between", value1, value2, "uId");
return (Criteria) this;
}
public Criteria andRIdIsNull() {
addCriterion("R_ID is null");
return (Criteria) this;
}
public Criteria andRIdIsNotNull() {
addCriterion("R_ID is not null");
return (Criteria) this;
}
public Criteria andRIdEqualTo(String value) {
addCriterion("R_ID =", value, "rId");
return (Criteria) this;
}
public Criteria andRIdNotEqualTo(String value) {
addCriterion("R_ID <>", value, "rId");
return (Criteria) this;
}
public Criteria andRIdGreaterThan(String value) {
addCriterion("R_ID >", value, "rId");
return (Criteria) this;
}
public Criteria andRIdGreaterThanOrEqualTo(String value) {
addCriterion("R_ID >=", value, "rId");
return (Criteria) this;
}
public Criteria andRIdLessThan(String value) {
addCriterion("R_ID <", value, "rId");
return (Criteria) this;
}
public Criteria andRIdLessThanOrEqualTo(String value) {
addCriterion("R_ID <=", value, "rId");
return (Criteria) this;
}
public Criteria andRIdLike(String value) {
addCriterion("R_ID like", value, "rId");
return (Criteria) this;
}
public Criteria andRIdNotLike(String value) {
addCriterion("R_ID not like", value, "rId");
return (Criteria) this;
}
public Criteria andRIdIn(List<String> values) {
addCriterion("R_ID in", values, "rId");
return (Criteria) this;
}
public Criteria andRIdNotIn(List<String> values) {
addCriterion("R_ID not in", values, "rId");
return (Criteria) this;
}
public Criteria andRIdBetween(String value1, String value2) {
addCriterion("R_ID between", value1, value2, "rId");
return (Criteria) this;
}
public Criteria andRIdNotBetween(String value1, String value2) {
addCriterion("R_ID not between", value1, value2, "rId");
return (Criteria) this;
}
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table T_USER_ROLE_TAB
*
* @mbggenerated do_not_delete_during_merge Mon Jan 22 10:18:56 CST 2018
*/
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table T_USER_ROLE_TAB
*
* @mbggenerated Mon Jan 22 10:18:56 CST 2018
*/
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
} | [
"13923813589@163.com"
] | 13923813589@163.com |
09d7572e1e3a591acf339db50c146afe09a7f0f8 | 73fea15631b31be9cf35cf8925ba6f254b5b24ca | /zigBeeDevice/src/cn/jdbc/domain/User.java | 14469d69c6871deb640c72ebd574fac8c8a208a0 | [] | no_license | chengwangjian/suy | afead663ebcde13feb43a0d4ffbf09ba4f0b42da | 14009f415db7b2c95d9d852c039a399126df8b8c | refs/heads/master | 2020-12-02T08:02:42.359006 | 2017-07-10T14:36:30 | 2017-07-10T14:36:30 | 96,763,823 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,412 | java | package cn.jdbc.domain;
import java.util.Date;
/**
*
* 2008-12-6
*
* @author <a href="mailto:liyongibm@gmail.com">liyong</a>
*
*/
public class User {
private int id;
private String name;
private Date birthday;
private float money;
private Date registDate;
public User() {
}
public User(String name) {
this.name = name;
}
public User(float money) {
this.money = money;
}
public void showName() {
System.out.println(this.name);
}
@Override
public String toString() {
return "id=" + this.id + " name=" + this.name + " birthday="
+ this.birthday + " money=" + this.money;
}
private void test() {
}
public int getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Date getBirthday() {
return birthday;
}
public void setBirthday(Date birthday) {
this.birthday = birthday;
}
public void setBirthday(java.sql.Date birthday) {
this.birthday = birthday;
}
public float getMoney() {
return money;
}
public void setMoney(Float money) {
this.money = money;
}
public Date getRegistDate() {
return registDate;
}
public void setRegistDate(Date registDate) {
this.registDate = registDate;
}
public void setId(int id) {
this.id = id;
}
public void setMoney(float money) {
this.money = money;
}
}
| [
"wangjian@xample.com"
] | wangjian@xample.com |
35c5d8eb937c8132faaae53a57799c49682b3b50 | c90d796ebd637f298cf6a757c67ab88b1d332a51 | /src/MyPointTest.java | 8fa1a20208c6e1715ada9d2fb963c8fbc4b7f7cd | [] | no_license | Mavinkea/CSE114 | 4aa7dcff53ff3ac5e354af59d8e78d0b457901d7 | 3ce2483a42c5674b439bdfbe15d781bc1a08d9fd | refs/heads/master | 2020-08-10T20:14:29.253682 | 2015-02-17T20:59:12 | 2015-02-17T20:59:12 | 30,937,455 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 342 | java | //Aril Mavinkere, 109681869
public class MyPointTest {
public static void main(String[] args){
MyPoint p=new MyPoint(-2,-3);
MyPoint p2=new MyPoint(-4,4);
System.out.println("getX test :"+p.getX());
System.out.println("getY test :"+p.getY());
System.out.println(p.distance(-4,4));
System.out.println(p.distance(p2));
}
}
| [
"mavinkea@bxscience.edu"
] | mavinkea@bxscience.edu |
62d50ddd84ad344d2272fc4815900011e1da619e | 81b5076fa769987d522a8e83ad5f9c57c8ea981c | /modules/customCss/src/main/java/com/css/test/constants/CSSTestingPortletKeys.java | 1b1d04483e8fae8f6a0e0f3ea17fe6c9e11d0482 | [] | no_license | krystian95200/liferay | bd1cdade9535389b9673803dbc83dbba78d07041 | 5a4f2e79b4dcdea3fda77e9b6b6af02136807395 | refs/heads/master | 2021-05-12T00:56:38.437086 | 2018-01-15T13:30:20 | 2018-01-15T13:30:20 | 117,548,763 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 165 | java | package com.css.test.constants;
/**
* @author Krystian
*/
public class CSSTestingPortletKeys {
public static final String CSSTesting = "CSSTesting";
} | [
"Krystian@156.17.25.147"
] | Krystian@156.17.25.147 |
f0d8785c7dd5006bad84932cc697831bed8b23f5 | 3e216665a8716064d5af532038bfe7c7b6910103 | /src/main/java/art/chapter01/quack/Squeak.java | 7f57cc95f8ba3253358d3d131d97effe77369c89 | [] | no_license | art-sov/HeadFirstPatterns | a9f4a9bbfc1578df9ce181bdc5004b6076a92861 | cc06aacf5a81b45def330da1cd0c7c977a6a821a | refs/heads/master | 2020-04-07T18:04:52.335978 | 2018-11-30T09:43:36 | 2018-11-30T09:43:36 | 158,596,083 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 149 | java | package art.chapter01.quack;
public class Squeak implements QuackBehavior {
public void quack() {
System.out.println("Squeak");
}
}
| [
"artsovalov@gmail.com"
] | artsovalov@gmail.com |
e3709549412ea8ce14b72f03e9791cecc131df59 | c5fca8e0daf25fb97a0e85b0913c096a621a457e | /springboot-demo4/src/main/java/com/yzl/study/spingboot/vo/validateGroup/Login.java | ccf9e048003a76ce31252995f607475f39a28130 | [] | no_license | yangzhonglei/learnSpring | a37c12b31de098670ab262efa72183ed7b0247ea | cfbfee891466e32e9247b6995941b5df97eb21b1 | refs/heads/master | 2022-12-21T08:56:56.768551 | 2020-03-27T06:42:25 | 2020-03-27T06:42:25 | 248,230,876 | 0 | 0 | null | 2022-12-16T10:04:01 | 2020-03-18T12:52:34 | Java | UTF-8 | Java | false | false | 84 | java | package com.yzl.study.spingboot.vo.validateGroup;
public interface Login {
}
| [
"yangzl@imch.com.cn"
] | yangzl@imch.com.cn |
db046bf911bf2e89a5e91940965b4f631010a092 | 65df20d14d5c6565ec135c9351d753436d3de0f5 | /jo_sm/src/jo/sm/ui/act/edit/SoftenAction.java | d2a516ba6ef6110018c999383ac62fee46073cf2 | [
"Apache-2.0"
] | permissive | cadox8/SMEdit | caf70575e27ea450e7998bf6e92f73b825cf42a1 | f9bd01fc794886be71580488b656ec1c5c94afe3 | refs/heads/master | 2021-05-30T17:35:31.035736 | 2016-01-03T21:39:58 | 2016-01-03T21:39:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,626 | java | /**
* Copyright 2014
* SMEdit https://github.com/StarMade/SMEdit
* SMTools https://github.com/StarMade/SMTools
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
**/
package jo.sm.ui.act.edit;
import java.awt.event.ActionEvent;
import jo.sm.data.SparseMatrix;
import jo.sm.logic.StarMadeLogic;
import jo.sm.ship.data.Block;
import jo.sm.ship.logic.HullLogic;
import jo.sm.ui.RenderFrame;
import jo.sm.ui.act.GenericAction;
/**
* @Auther Jo Jaquinta for SMEdit Classic - version 1.0
**/
@SuppressWarnings("serial")
public class SoftenAction extends GenericAction {
private final RenderFrame mFrame;
public SoftenAction(RenderFrame frame) {
mFrame = frame;
setName("Soften");
setToolTipText("Convert all hardened hull blocks to unhardened hull blocks");
}
@Override
public void actionPerformed(ActionEvent ev) {
SparseMatrix<Block> grid = StarMadeLogic.getModel();
if (grid == null) {
return;
}
mFrame.getClient().getUndoer().checkpoint(grid);
HullLogic.unpower(grid);
StarMadeLogic.setModel(grid);
}
}
| [
"bobbybighoof@gmail.com"
] | bobbybighoof@gmail.com |
c3c948387586c425c12d850281d76792d69459b0 | 789613cffd99e62e86114f1ee743256ddb13003e | /omod/src/test/java/org/raxa/module/raxacore/web/v1_0/controller/RaxaEncounterControllerTest.java | 4a7235664c35f888e3ce9c843923a7f3fe3004b1 | [] | no_license | johnstoecker/raxacore | 6558c8c346701c03dbddf752a78fee467424a3cc | 345ff1186b128471b9141fc20c32cc475ed93eb4 | refs/heads/master | 2021-01-15T18:26:28.722895 | 2013-01-07T20:11:10 | 2013-01-07T20:11:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,132 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.raxa.module.raxacore.web.v1_0.controller;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.codehaus.jackson.map.ObjectMapper;
import org.junit.Assert;
import org.junit.Test;
import static org.junit.Assert.*;
import org.junit.Before;
import org.openmrs.Encounter;
import org.openmrs.api.EncounterService;
import org.openmrs.api.context.Context;
import org.openmrs.module.webservices.rest.SimpleObject;
import org.openmrs.test.BaseModuleContextSensitiveTest;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
public class RaxaEncounterControllerTest extends BaseModuleContextSensitiveTest {
private static final String TEST_DATA_PATH = "org/raxa/module/raxacore/include/";
private static final String MODULE_TEST_DATA_XML = TEST_DATA_PATH + "moduleTestData.xml";
private MockHttpServletRequest request = null;
private MockHttpServletResponse response = null;
private RaxaEncounterController controller = null;
private EncounterService service = null;
@Before
public void before() throws Exception {
executeDataSet(MODULE_TEST_DATA_XML);
this.request = new MockHttpServletRequest();
this.response = new MockHttpServletResponse();
this.controller = new RaxaEncounterController();
this.service = Context.getService(EncounterService.class);
}
/**
* Test of createNewEncounter method, of class RaxaEncounterController.
*/
@Test
public void testCreateNewEncounter() throws Exception {
String json = "{ \"patient\":\"da7f524f-27ce-4bb2-86d6-6d1d05312bd5\",\"encounterDatetime\":\"2013-01-07T12:40:20Z\", \"encounterType\": \"61ae96f4-6afe-4351-b6f8-cd4fc383cce1\", \"location\": \"9356400c-a5a2-4532-8f2b-2361b3446eb8\", \"obs\": [{\"person\":\"da7f524f-27ce-4bb2-86d6-6d1d05312bd5\",\"concept\":\"92afda7c-78c9-47bd-a841-0de0817027d4\", \"obsDatetime\": \"2013-01-07T12:40:20Z\", \"value\": \"hello\", \"location\": \"9356400c-a5a2-4532-8f2b-2361b3446eb8\"}]}";
//, \"obs\": [{\"person\":\"da7f524f-27ce-4bb2-86d6-6d1d05312bd5\",\"concept\":\"b055abd8-a420-4a11-8b98-02ee170a7b54\", \"obsDatetime\": \"2013-01-07T12:40:20Z\", \"value\": \"500\", \"location\": \"9356400c-a5a2-4532-8f2b-2361b3446eb8\"}, {\"name\":\"Test inner Drug Inventory 2\",\"description\":\"Test drug inventory2\", \"drug\": \"05ec820a-d297-44e3-be6e-698531d9dd3f\", \"quantity\": 500, \"supplier\": \"test supplier\", \"expiryDate\":\"Sep 26, 2012 12:00:00 AM\"}]}
SimpleObject post = new ObjectMapper().readValue(json, SimpleObject.class);
controller.createNewEncounter(post, request, response);
List<Encounter> encs = service.getEncountersByPatient(Context.getPatientService().getPatientByUuid(
"da7f524f-27ce-4bb2-86d6-6d1d05312bd5"));
System.out.println(encs);
// Provider p = Context.getProviderService().getProviderByUuid("68547121-1b70-465e-99ee-c9df45jf9j32");
// List<DrugPurchaseOrder> dPOs = Context.getService(DrugPurchaseOrderService.class).getDrugPurchaseOrderByProvider(
// p.getId());
// List<DrugInventory> dis = Context.getService(DrugInventoryService.class).getDrugInventoriesByLocation(2);
// Assert.assertNotNull(dis);
// Assert.assertEquals(2, dis.size());
// Assert.assertEquals("Test inner Drug Inventory", dis.get(0).getName());
// Assert.assertNotNull(dis.get(0).getExpiryDate());
// Assert.assertEquals(dis.get(1).getSupplier(), "test supplier");
// Assert.assertEquals(true, dPOs.get(0).isReceived());
}
/**
* Test of getEncounterByUuidFull method, of class RaxaEncounterController.
*/
@Test
public void testGetEncounterByUuidFull() throws Exception {
String result = controller.getEncounterByUuidFull("6519d653-393b-4118-9c83-a3715b82d4ac", request);
SimpleObject encounter = SimpleObject.parseJson(result);
System.out.println(result);
Assert.assertNotNull(result);
Assert.assertEquals("6519d653-393b-4118-9c83-a3715b82d4ac", encounter.get("uuid"));
}
}
| [
"johnstoecker@gmail.com"
] | johnstoecker@gmail.com |
d4d8e3d60dd8f1cbeba8615182d57b174156165c | dfae0f9e16c7f5986e3eae83a46afddd96ca9c03 | /app/src/main/java/com/android/espresso/activities/SearchViewActivity.java | 79f33ace09107bfd22e7b56a06ff9ba2406cac1d | [] | no_license | aleesha711/Instrumentation-Testing-with-Espresso- | aa6f7809e014486c8476d06c90fdff4f6fcbf343 | 2e549612cd2b768456acf26a3af5d2f8948e67a7 | refs/heads/master | 2020-04-05T02:52:24.228427 | 2018-12-07T11:59:39 | 2018-12-07T11:59:39 | 156,492,743 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,041 | java | package com.android.espresso.activities;
import android.app.SearchManager;
import android.content.ComponentName;
import android.content.Context;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.widget.SearchView;
import android.view.Menu;
import com.android.espresso.R;
public class SearchViewActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_search_view);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_search_view, menu);
SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView();
searchView.setSearchableInfo(searchManager.getSearchableInfo(new ComponentName(this, SearchableActivity.class)));
return true;
}
}
| [
"aleesha_kanwal@yahoo.com"
] | aleesha_kanwal@yahoo.com |
ab0df3cecc72cde8209d745cff364dbd275714ac | 91ab2a04a42d15f89f531f905c03919f94cfd46e | /EjResueltos/ReconstruyendoLaPelicula6/src/reconstruyendo_la_pelicula/Empalme.java | 54b817c6fcbf8332cb79fdc452c0d21f4a3a9d61 | [] | no_license | juliancarroccio/Grafos | 640f8b88d2d5ae7e7b1f21fae5f5667d4a6e2a50 | 6264e50d8e78cd78d9f7efb4a05f86002d8ccafd | refs/heads/master | 2020-12-03T04:14:39.774124 | 2017-06-30T20:15:48 | 2017-06-30T20:15:48 | 95,837,431 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 734 | java | package reconstruyendo_la_pelicula;
public class Empalme {
public Segmento s1;
public Segmento s2;
public int costo;
public Empalme(Segmento s1,Segmento s2,int costo)
{
this.s1=s1;
this.s2=s2;
this.costo=costo;
}
public Empalme(Empalme e)
{
this.s1=e.s1;
this.s2=e.s2;
this.costo=e.costo;
}
public Segmento getS1() {
return s1;
}
public void setS1(Segmento s1) {
this.s1 = s1;
}
public Segmento getS2() {
return s2;
}
public void setS2(Segmento s2) {
this.s2 = s2;
}
public int getCosto() {
return costo;
}
public void setCosto(int costo) {
this.costo = costo;
}
public String toString() {
return "Empalme entre " + s1 + " y " + s2 + ", costo: " + costo;
}
}
| [
"juliancarroccio@gmail.com"
] | juliancarroccio@gmail.com |
a7c693c33f95f82b833c407a55c74c6814826c84 | a6b1aa7bfb0e3a4149b2117a1f13a8f1c2b96b2d | /studyset/algorithm/java/MaxSum.java | a43c0c09a685a8107b4ea7055022c041ff9dbcae | [] | no_license | cbajs12/til | 79ce66f7aefe7e024e96e1db8b40aafaaa631e1e | a9978bdd4746ad9fe15c4750ed4398fd8388fb4d | refs/heads/master | 2020-12-05T09:09:02.003445 | 2019-06-08T06:44:28 | 2019-06-08T06:44:28 | 66,318,146 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,512 | java | package Algorithm;
import java.io.IOException;
import java.util.Scanner;
public class MaxSum {
static int MIN = -99999;
public static void main(String[] args) throws IOException {
Scanner scanner = new Scanner(System.in);
String temp = scanner.nextLine().trim();
int number = Integer.parseInt(temp);
int[] result;
int tempInt;
String[] strArray;
int[] intArray;
if (number < 1 || number > 10)
return;
result = new int[number];
for(int i = 0; i < number; ++i){
temp = scanner.nextLine().trim();
tempInt = Integer.parseInt(temp);
if (tempInt < 1 || tempInt > 10000)
return;
temp = scanner.nextLine().trim();
strArray = temp.split(" ");
intArray = new int[strArray.length];
for(int j=0; j < strArray.length; ++j){
intArray[j] = Integer.parseInt(strArray[j]);
}
result[i] = findSolution(intArray);
}
for(int i : result){
System.out.println(i);
}
scanner.close();
}
static int findSolution(int[] array){
int result, sum=0;
result = MIN;
for(int i=0; i<array.length; ++i){
sum = sum + array[i];
if(result < sum){
result = sum;
}
if(sum < 0){
sum = 0;
}
}
return result;
}
}
| [
"cbajs20@gmail.com"
] | cbajs20@gmail.com |
72b61de966c365fb487bbadb6ffe132d3dfd894c | e307a6dde8c5307181eaf01a999a53e6094cfd03 | /src/org/sosy_lab/cpachecker/cpa/value/symbolic/type/PointerExpression.java | b92c2f3859d894c545f0915a930c78b8bd6bbaf6 | [
"Apache-2.0"
] | permissive | EboYu/cpachecker | bd9ea4bd14501171ac4a6cf2beacb2cf3961a34a | 4ce5b13e243eb05ced153f8c7790da3ed5c2bbe7 | refs/heads/trunk | 2020-04-25T08:27:14.614489 | 2019-10-17T09:35:07 | 2019-10-17T09:35:07 | 172,647,673 | 0 | 0 | NOASSERTION | 2019-10-17T09:35:12 | 2019-02-26T05:58:07 | C | UTF-8 | Java | false | false | 2,007 | java | /*
* CPAchecker is a tool for configurable software verification.
* This file is part of CPAchecker.
*
* Copyright (C) 2007-2015 Dirk Beyer
* 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.
* 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.
*
*
* CPAchecker web page:
* http://cpachecker.sosy-lab.org
*/
package org.sosy_lab.cpachecker.cpa.value.symbolic.type;
import org.sosy_lab.cpachecker.cfa.types.Type;
import org.sosy_lab.cpachecker.util.states.MemoryLocation;
/**
* {@link SymbolicExpression} that represents a pointer expression.
*
* <p>This can be a classic pointer expression like <code>*p</code> in C or a reference as in Java.</p>
*/
public class PointerExpression extends UnarySymbolicExpression {
private static final long serialVersionUID = -7348176261979912313L;
protected PointerExpression(SymbolicExpression pOperand, Type pType) {
super(pOperand, pType);
}
protected PointerExpression(
final SymbolicExpression pOperand,
final Type pType,
final MemoryLocation pRepresentedLocation
) {
super(pOperand, pType, pRepresentedLocation);
}
@Override
public PointerExpression copyForLocation(MemoryLocation pRepresentedLocation) {
return new PointerExpression(getOperand(), getType(), pRepresentedLocation);
}
@Override
public <VisitorReturnT> VisitorReturnT accept(SymbolicValueVisitor<VisitorReturnT> pVisitor) {
return pVisitor.visit(this);
}
@Override
public String getOperationString() {
return "*";
}
}
| [
"lemberge@4712c6d2-40bb-43ae-aa4b-fec3f1bdfe4c"
] | lemberge@4712c6d2-40bb-43ae-aa4b-fec3f1bdfe4c |
27bc1e5f5e6f1bc8b959599b9ebb7e3729ec85f5 | 74b47b895b2f739612371f871c7f940502e7165b | /aws-java-sdk-sagemaker/src/main/java/com/amazonaws/services/sagemaker/model/transform/DeleteImageRequestProtocolMarshaller.java | 7a2260cefe5cf6ef3c1dd30b0c7f535794543a23 | [
"Apache-2.0"
] | permissive | baganda07/aws-sdk-java | fe1958ed679cd95b4c48f971393bf03eb5512799 | f19bdb30177106b5d6394223a40a382b87adf742 | refs/heads/master | 2022-11-09T21:55:43.857201 | 2022-10-24T21:08:19 | 2022-10-24T21:08:19 | 221,028,223 | 0 | 0 | Apache-2.0 | 2019-11-11T16:57:12 | 2019-11-11T16:57:11 | null | UTF-8 | Java | false | false | 2,639 | java | /*
* Copyright 2017-2022 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.sagemaker.model.transform;
import javax.annotation.Generated;
import com.amazonaws.SdkClientException;
import com.amazonaws.Request;
import com.amazonaws.http.HttpMethodName;
import com.amazonaws.services.sagemaker.model.*;
import com.amazonaws.transform.Marshaller;
import com.amazonaws.protocol.*;
import com.amazonaws.protocol.Protocol;
import com.amazonaws.annotation.SdkInternalApi;
/**
* DeleteImageRequest Marshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
@SdkInternalApi
public class DeleteImageRequestProtocolMarshaller implements Marshaller<Request<DeleteImageRequest>, DeleteImageRequest> {
private static final OperationInfo SDK_OPERATION_BINDING = OperationInfo.builder().protocol(Protocol.AWS_JSON).requestUri("/")
.httpMethodName(HttpMethodName.POST).hasExplicitPayloadMember(false).hasPayloadMembers(true).operationIdentifier("SageMaker.DeleteImage")
.serviceName("AmazonSageMaker").build();
private final com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory;
public DeleteImageRequestProtocolMarshaller(com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory) {
this.protocolFactory = protocolFactory;
}
public Request<DeleteImageRequest> marshall(DeleteImageRequest deleteImageRequest) {
if (deleteImageRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
final ProtocolRequestMarshaller<DeleteImageRequest> protocolMarshaller = protocolFactory.createProtocolMarshaller(SDK_OPERATION_BINDING,
deleteImageRequest);
protocolMarshaller.startMarshalling();
DeleteImageRequestMarshaller.getInstance().marshall(deleteImageRequest, protocolMarshaller);
return protocolMarshaller.finishMarshalling();
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
}
}
| [
""
] | |
f5b6419730623cc98c1d7d11654fcd6b38d370e9 | 2181c70b4da3a227af4d6a9fea4d8c3aac0371c8 | /src/main/java/com/hpd/hpdspringbootdemos/bean/User2.java | 74632c56f7def737b3fa4ad11c929d68aa114d3e | [] | no_license | 602041937/hpd-springboot-demos | cef4584007a5f1f842ceeb949d3360ce5f8e05b0 | 7d00b1d7e71d0ba9c18e73178930de065b009d56 | refs/heads/master | 2020-04-30T16:21:29.665858 | 2019-03-28T15:20:50 | 2019-03-28T15:20:50 | 176,945,962 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 266 | java | package com.hpd.hpdspringbootdemos.bean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@Component
public class User2 {
@Value("hpd")
private String name;
@Value("1")
private int age;
}
| [
"602041937@qq.com"
] | 602041937@qq.com |
1585e7efa3a759ba42497a11d5a20b6c886bf343 | cb70f2cf7bdfd3e90d5f748b7f719e2e9dda10e7 | /src/main/java/com/amakhnev/problems/interviewbit/twopointers/MinimizeTheAbsoluteDifference.java | fe68bc97ea736439e3db65023f4712f5f5cffc74 | [] | no_license | amakhnev/problems | 3a09d8ddd96c8a89985f1a38ac5d815b4a9da7aa | 38f01a6da3e8510755c647ae87341308b73216db | refs/heads/master | 2022-11-10T16:19:37.765106 | 2022-11-10T11:51:35 | 2022-11-10T11:51:35 | 138,568,759 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,318 | java | package com.amakhnev.problems.interviewbit.twopointers;
import java.util.ArrayList;
import java.util.Arrays;
public class MinimizeTheAbsoluteDifference {
public static void main(String[] args) {
ArrayList<Integer> a = new ArrayList<Integer>(Arrays.asList(1, 4, 5, 8, 10));
ArrayList<Integer> b = new ArrayList<Integer>(Arrays.asList(6, 9, 10));
ArrayList<Integer> c = new ArrayList<Integer>(Arrays.asList(2, 3, 6, 10));
System.out.println("Result = " + new MinimizeTheAbsoluteDifference().solve(a, b, c));
}
public int solve(ArrayList<Integer> A, ArrayList<Integer> B, ArrayList<Integer> C) {
int i = 0, j = 0, k = 0, minDiff = Integer.MAX_VALUE;
while (i < A.size() && j < B.size() && k < C.size()) {
minDiff = Math.min(minDiff, Math.max(Math.max(A.get(i), B.get(j)), C.get(k)) - Math.min(Math.min(A.get(i), B.get(j)), C.get(k)));
if (A.get(i) <= Math.min(B.get(j), C.get(k))) {
i++;
continue;
}
if (B.get(j) <= Math.min(A.get(i), C.get(k))) {
j++;
continue;
}
if (C.get(k) <= Math.min(A.get(i), B.get(j))) {
k++;
continue;
}
}
return minDiff;
}
}
| [
"alexey@integrace.co.uk"
] | alexey@integrace.co.uk |
305e104a148e459825dd8788eea3046c73a50c4f | dcd6457ddf7a639ea41b4408eb820f5ea3792f61 | /app/src/test/java/com/github/lookchunkuen/petlloassignment/ExampleUnitTest.java | e4d749b3cd4bcd53126c80e5223806170ded66c9 | [] | no_license | JackerLau/PetlloAssignment-master | 363d7819f417a3eab8df52c4284380f823fef5ab | 3cbdd1333527f8fb5b15ad2a13dfd19fffb093bc | refs/heads/master | 2020-04-16T23:37:57.193984 | 2019-01-16T10:17:23 | 2019-01-16T10:17:23 | 166,019,274 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 401 | java | package com.github.lookchunkuen.petlloassignment;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"laukg-wm17@student.tarc.edu.my"
] | laukg-wm17@student.tarc.edu.my |
0aac3e143dfe28610b82b4459614e66958af00ce | 300a1be4b2fbfc0e320cb1a7ece816077ce68e16 | /app/src/main/java/com/android/eve/tools.java | c21116a80116ca84233f474f76bc3a5e037394da | [] | no_license | MarkAguirre26/eve | 6312303cc270d40026b4ae374ef7da2a698b1433 | be882725efe44f8b79aebed06d399fd5db929e6c | refs/heads/master | 2020-12-30T13:39:53.599618 | 2017-05-14T11:59:29 | 2017-05-14T11:59:29 | 91,222,981 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,042 | java | package com.android.eve;
import android.app.Activity;
import android.view.WindowManager;
import java.util.List;
/**
* Created by Mark on 3/11/2017.
*/
public class tools {
public static void setFullScreen(Activity activity) {
activity.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
public static void ReadPlayer(Activity activity) {
PlayerHelper db = new PlayerHelper(activity);
List<Player> players = db.getAllPlayer();
for (Player player : players) {
player.setCn(player.getCn());
player.setName(player.getName());
player.setBirdayDay(player.getBirdayDay());
player.setEmail(player.getEmail());
userInfo.id = player.getCn() + "";
userInfo.name = player.getName();
userInfo.bday = player.getBirdayDay();
userInfo.emal = player.getBirdayDay();
// Variables.CustomListViewValuesArr.add(player);
}
}
}
| [
"markaguirre26@gmail.com"
] | markaguirre26@gmail.com |
0d3e2095cc173fa899a1faa3a0f2617c99539227 | 57cdc016c995b982d7ce1443a7605f9aa2aec503 | /app/src/main/java/com/samimi/nusapay/preference/PrefManager.java | 8c1a7f7bd5c5c6080dffb44b8e725e7a06b1098d | [
"Apache-2.0"
] | permissive | arisembekss/nusapay | 48cd324d2231b5462a08cb57c1d3a9eb7770eb2c | 58f8c121af2e752f5ecd1d950ada8291223ee4ae | refs/heads/master | 2021-01-19T09:03:14.342730 | 2018-09-04T07:25:14 | 2018-09-04T07:25:14 | 87,716,206 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,061 | java | package com.samimi.nusapay.preference;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
/**
* Created by aris on 01/10/16.
*/
public class PrefManager {
SharedPreferences pref;
public SharedPreferences.Editor editor;
String userDisplayName;
Context _context;
// shared pref mode
int PRIVATE_MODE = 0;
// Shared preferences file name
private static final String PREF_NAME = "app-welcome";
private static final String IS_FIRST_TIME_LAUNCH = "IsFirstTimeLaunch";
private static final String IS_FIRST_TIME_TEMP = "IsFirstTimeTemp";
/*private static final String IS_FIRST_TIME_ADD = "IsFirstTimeAdd";
private static final String IS_FIRST_TIME_DOMPET = "IsFirstTimeDompet";*/
private static final String IS_FIRST_TIME_TR = "IsFirstTimeTr";
private static final String DISPLAY_NAME = "displayName";
private static final String DISPLAY_NUMBER = "displayNumber";
private static final String DISPLAY_EMAIL = "displayEmail";
private static final String DISPLAY_POIN = "poin";
private static final String DISPLAY_FIREBASE_ID = "firebaseId";
private static final String DISPLAY_ID = "id";
private static final String DISPLAY_IDUSR = "idUsr";
private static final String DISPLAY_STATUS = "status";
private static final String HARGA_TRI = "th";
private static final String KODE_TRI = "tk";
private static final String KODE_STATUS_SERVER = "kodeStatusServer";
public PrefManager(Context context) {
this._context = context;
pref = _context.getSharedPreferences(PREF_NAME, PRIVATE_MODE);
editor = pref.edit();
/*String userDisplayName = pref.getString(DISPLAY_NAME,"");
this.userDisplayName=userDisplayName;*/
}
public void setTempFirstTimeLaunch(boolean isFirstTime) {
editor.putBoolean(IS_FIRST_TIME_TEMP, isFirstTime);
editor.commit();
}
public boolean isTempFirstTimeLaunch() {
return pref.getBoolean(IS_FIRST_TIME_TEMP, true);
}
/*public void setAddFirstTimeLaunch(boolean isFirstTime) {
editor.putBoolean(IS_FIRST_TIME_ADD, isFirstTime);
editor.commit();
}
public boolean isAddFirstTimeLaunch() {
return pref.getBoolean(IS_FIRST_TIME_ADD, true);
}
public void setDompetFirstTimeLaunch(boolean isFirstTime) {
editor.putBoolean(IS_FIRST_TIME_DOMPET, isFirstTime);
editor.commit();
}
public boolean isDompetFirstTimeLaunch() {
return pref.getBoolean(IS_FIRST_TIME_DOMPET, true);
}*/
public void setTrFirstTimeLaunch(boolean isFirstTime) {
editor.putBoolean(IS_FIRST_TIME_TR, isFirstTime);
editor.commit();
}
public boolean isTrFirstTimeLaunch() {
return pref.getBoolean(IS_FIRST_TIME_TR, true);
}
public void setFirstTimeLaunch(boolean isFirstTime) {
editor.putBoolean(IS_FIRST_TIME_LAUNCH, isFirstTime);
editor.commit();
}
public boolean isFirstTimeLaunch() {
return pref.getBoolean(IS_FIRST_TIME_LAUNCH, true);
}
public void setUserDisplay(String displayName) {
editor.putString(DISPLAY_NAME, displayName);
editor.commit();
//userDisplayName = displayName;
}
public void setUserNumber(String displayNumber) {
editor.putString(DISPLAY_NUMBER, displayNumber);
editor.commit();
}
public void setUserEmail(String displayEmail) {
editor.putString(DISPLAY_EMAIL, displayEmail);
editor.commit();
}
public void setFirebaseId(String firebaseId) {
editor.putString(DISPLAY_FIREBASE_ID, firebaseId);
editor.commit();
}
public void setPoin(String poin) {
editor.putString(DISPLAY_POIN, poin);
editor.commit();
}
public void setUri(String uri) {
editor.putString(DISPLAY_ID, uri);
editor.commit();
}
public void setStatus(String status) {
editor.putString(DISPLAY_STATUS, status);
editor.commit();
}
public void setIdUsr(String idUsr) {
editor.putString(DISPLAY_IDUSR, idUsr);
editor.commit();
}
public void setHargaTri(String hargaTri) {
editor.putString(HARGA_TRI, hargaTri);
editor.commit();
}
public void setKodeTri(String kodeTri) {
editor.putString(KODE_TRI, kodeTri);
editor.commit();
}
public void setKodeStatusServer(String kodeServer) {
//String kodeStatusServer = Integer.toString(kodeServer);
editor.putString(KODE_STATUS_SERVER, kodeServer);
editor.commit();
}
public String getUserDisplay() {
userDisplayName = PreferenceManager.getDefaultSharedPreferences(_context).getString(DISPLAY_NAME, "");
return userDisplayName;
}
public String getUserDisplayName() {
return userDisplayName;
}
public void setUserDisplayName(String userDisplayName) {
this.userDisplayName = userDisplayName;
}
}
| [
"aris300312"
] | aris300312 |
3c42422d02a67b85d560400970a78e7950e4c101 | 198b020a82e4c75365c6aec9aa4a4cac53e5aaa8 | /wlglpt/src/com/cy/common/bo/HyPcHwxxHdqdMx.java | 688687472a6c767e4577c7148d6e7a0e3f00b2da | [] | no_license | kenjs/Java | 8cc2a6c4a13bddc12f15d62350f3181acccc48ec | 8cb9c7c93bc0cfa57d77cf3805044e5fe18778f2 | refs/heads/master | 2020-12-14T09:46:07.493930 | 2015-08-19T08:11:59 | 2015-08-19T08:11:59 | null | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 1,945 | java | package com.cy.common.bo;
import java.io.Serializable;
/**
* The persistent class For HY_PC_HWXX_HDQD_MX is created by tools.
* @author HJH
*/
public class HyPcHwxxHdqdMx implements Serializable {
//default serial version id, required for serializable classes.
private static final long serialVersionUID = 1L;
private String hdqdDjxh; // 回单清单登记序号
private String hdDjxh; // 回单登记序号
private String jszt; // 接收状态(0 初始,1 发送,2 接收,3 退回)
private String fsGsbm; // 发送公司编码
private String jsGsbm; // 接收公司编码
private String dqztbz;
public HyPcHwxxHdqdMx() {
}
//获取回单清单登记序号
public String getHdqdDjxh() {
return this.hdqdDjxh;
}
//设置回单清单登记序号
public void setHdqdDjxh(String hdqdDjxh) {
this.hdqdDjxh=hdqdDjxh;
}
//获取回单登记序号
public String getHdDjxh() {
return this.hdDjxh;
}
//设置回单登记序号
public void setHdDjxh(String hdDjxh) {
this.hdDjxh=hdDjxh;
}
//获取接收状态(0 初始,1 发送,2 接收,3 退回)
public String getJszt() {
return this.jszt;
}
//设置接收状态(0 初始,1 发送,2 接收,3 退回)
public void setJszt(String jszt) {
this.jszt=jszt;
}
//获取发送公司编码
public String getFsGsbm() {
return this.fsGsbm;
}
//设置发送公司编码
public void setFsGsbm(String fsGsbm) {
this.fsGsbm=fsGsbm;
}
//获取接收公司编码
public String getJsGsbm() {
return this.jsGsbm;
}
//设置接收公司编码
public void setJsGsbm(String jsGsbm) {
this.jsGsbm=jsGsbm;
}
public String getDqztbz() {
return dqztbz;
}
public void setDqztbz(String dqztbz) {
this.dqztbz = dqztbz;
}
} | [
"haoyongvv@163.com"
] | haoyongvv@163.com |
ef2a3e8629b111ccc6cab5452593ee39c9cf17cd | 8f4e9540acbfc2c7a2ab97978c87376369536fd9 | /fixmecore/src/main/java/MessageBody/TargetCompID.java | d9ab7688ae3db6784a31e4ed40c807b2e964a9af | [] | no_license | Snoopgtg/fixme | 57d2712e6d3fe043b61d4d49cf0f166210b0453b | e3e69f07a606675efe1baafa6312f4eca398f8b2 | refs/heads/master | 2020-04-26T20:53:47.256640 | 2019-04-15T08:51:11 | 2019-04-15T08:51:11 | 173,825,350 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 457 | java | package MessageBody;
import nio.ListOfClients;
import java.util.Random;
public class TargetCompID extends MessageParent{
public TargetCompID(Integer value) {
super(value, 34);
}
public TargetCompID() {
super(0,34);
}
@Override
public String toString() {
return (this.tag.toString() + "=" + String.format("%06d", Integer.parseInt(this.value.toString())) + (char)1).replace((char)1, '\u2401');
}
}
| [
"snoopgtg@gmail.com"
] | snoopgtg@gmail.com |
ce6fd6f62a62315685c64715e0f10e630a70cea5 | 0a4b6c5a20c11b0584c48ac2d51c35eaa53d6d17 | /CountSay38.java | fea0ebf928681cbbfe98f352975b412913fd62d1 | [] | no_license | sangomax/Leetcode | e0d0d6e45af51914591bdfdbade04eede0bd2694 | 3bff82e0bebcd2f2d9118b5e81b53cd730f1eb30 | refs/heads/main | 2023-07-13T01:25:48.154002 | 2021-08-27T00:08:13 | 2021-08-27T00:08:13 | 395,492,666 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,079 | java | public class CountSay38 {
public String countAndSay(int n) {
String say = "1";
if(n == 1) {
return say;
}
String lastNum = "";
int count = 0;
int startIndex = 0;
for(int i = 2; i <= n; i++) {
String newSay = "";
for(int j = 0; j < say.length(); j++) {
String num = say.substring(j, j + 1);
if (lastNum.isEmpty()) {
count++;
lastNum = num;
} else if (lastNum.equals(num)) {
count++;
} else {
newSay = newSay + count + lastNum;
lastNum = num;
count = 1;
}
}
newSay = newSay + count + lastNum;
say = newSay;
count = 0;
lastNum = "";
}
return say;
}
public static void main(String[] args) {
CountSay38 obj = new CountSay38();
System.out.println(obj.countAndSay(4));
}
}
| [
"adriano.gaiotto@gmail.com"
] | adriano.gaiotto@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.