blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2 values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557 values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82 values | src_encoding stringclasses 28 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 7 5.41M | extension stringclasses 11 values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
849256f9dd3ea0e23ddf2a384eaa9aee8e708278 | 31bffe17456ff4d0118e10701b208788db4b51bd | /CifPag/src/br/com/cifpag/entity/Usuario_.java | e28071fbabe3ca34f209a67ea968bf3f9ae50419 | [] | no_license | michellx03/CifPag | 2d668e453cf65261710c480c3918946f1013e6dd | f89d99d49391ed9822e7786f47bdd9cc7451c6a9 | refs/heads/master | 2021-04-30T08:46:55.801871 | 2018-08-07T19:53:41 | 2018-08-07T19:53:41 | 121,383,523 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 516 | java | package br.com.cifpag.entity;
import javax.annotation.Generated;
import javax.persistence.metamodel.SingularAttribute;
import javax.persistence.metamodel.StaticMetamodel;
@Generated(value="Dali", date="2018-08-01T13:54:10.348-0300")
@StaticMetamodel(Usuario.class)
public class Usuario_ {
public static volatile SingularAttribute<Usuario, Integer> usuaId;
public static volatile SingularAttribute<Usuario, String> usuaSenha;
public static volatile SingularAttribute<Usuario, String> usuaUsuario;
}
| [
"michellx03@gmail.com"
] | michellx03@gmail.com |
45414e76fd0e4cc31cd0aafca13ab46b46d2a7f7 | 0ed74bfe48552bdbd7448a1952918cb5c1abd1d4 | /producer-client/src/test/java/com/ttyc/producer/client/ProducerClientApplicationTests.java | 195fbef030a5514173dd4fd9a5ef2d2504d60b48 | [] | no_license | GreedyPirate/Spring-Cloud-Stack | d9bbdec636778feac2b4595f5fa9d3e80cfa43c6 | eb435185908dbd22dff77615078f7216b015ac32 | refs/heads/master | 2022-09-17T21:24:36.882704 | 2020-08-18T06:41:52 | 2020-08-18T06:41:52 | 127,503,850 | 1 | 0 | null | 2022-09-01T23:10:39 | 2018-03-31T06:00:39 | Java | UTF-8 | Java | false | false | 349 | java | package com.ttyc.producer.client;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class ProducerClientApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"yangjie@songguo7.com"
] | yangjie@songguo7.com |
cf08cf716450d31e61a9ca3e1a23ee233914079d | 756ec5ba4c971c2b70c3a6a0dd2c169099d88e81 | /compupie-api/src/main/java/com/sw/compupie/daoBean/PhysicalHealthItem.java | d57b8d0a0c45ab4be1cbecc97a67a5833346bf64 | [] | no_license | pravinarr/compuPIE | 89e37b2f666362b43ded03bff2188293591377ca | 9eb5c181e19a4cc34ff3bd75b18f9415eed20086 | refs/heads/master | 2020-12-25T14:33:42.165224 | 2018-03-12T10:51:21 | 2018-03-12T10:51:21 | 66,494,290 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 502 | java | package com.sw.compupie.daoBean;
public class PhysicalHealthItem {
private int id;
private String ICD_CODE;
private String item;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getICD_CODE() {
return ICD_CODE;
}
public void setICD_CODE(String iCD_CODE) {
ICD_CODE = iCD_CODE;
}
public String getItem() {
return item;
}
public void setItem(String item) {
this.item = item;
}
}
| [
"pravinarr@gmail.com"
] | pravinarr@gmail.com |
75c282f498f4080c4c8ed69ca1fe3244a9d9932c | 424f1433e3459f23e486c5c3501e8034539d3808 | /src/main/java/com/simiacryptus/mindseye/test/integration/CaltechProblemData.java | e843bac660f32a92a207c5d873d20263622dcad9 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | SimiaCryptus/mindseye-test | 114aad566b36a408b0566291b3bc2cb0cf3e6b17 | ad6869ebb18dcf80a53efb25f7d45d398f127b32 | refs/heads/master | 2022-12-22T00:17:58.633835 | 2020-12-28T05:41:15 | 2020-12-28T05:41:15 | 160,087,002 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,741 | java | /*
* Copyright (c) 2019 by Andrew Charneski.
*
* The author 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 com.simiacryptus.mindseye.test.integration;
import com.simiacryptus.mindseye.lang.Tensor;
import com.simiacryptus.mindseye.test.data.Caltech101;
import com.simiacryptus.mindseye.util.ImageUtil;
import com.simiacryptus.ref.wrappers.RefStream;
import com.simiacryptus.util.test.LabeledObject;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.awt.image.BufferedImage;
import java.util.List;
import java.util.stream.Collectors;
/**
* The type Caltech problem data.
*/
public class CaltechProblemData implements ImageProblemData {
private final int imageSize;
@Nullable
private List<CharSequence> labels = null;
/**
* Instantiates a new Caltech problem data.
*/
public CaltechProblemData() {
this(256);
}
/**
* Instantiates a new Caltech problem data.
*
* @param imageSize the image size
*/
public CaltechProblemData(int imageSize) {
this.imageSize = imageSize;
}
/**
* Gets image size.
*
* @return the image size
*/
public int getImageSize() {
return imageSize;
}
/**
* Gets labels.
*
* @return the labels
*/
@Nullable
public List<CharSequence> getLabels() {
if (null == labels) {
synchronized (this) {
if (null == labels) {
labels = trainingData().map(x -> {
String label = x.label;
x.freeRef();
return label;
}).distinct().sorted().collect(Collectors.toList());
}
}
}
return labels;
}
@Nonnull
@Override
public RefStream<LabeledObject<Tensor>> trainingData() {
return Caltech101.trainingDataStream().parallel()
.map(x -> {
LabeledObject<Tensor> map = x.map(y -> {
BufferedImage image = y.get();
Tensor tensor = Tensor.fromRGB(ImageUtil.resize(image, getImageSize()));
y.freeRef();
return tensor;
});
x.freeRef();
return map;
});
}
@Nonnull
@Override
public RefStream<LabeledObject<Tensor>> validationData() {
return trainingData();
}
}
| [
"acharneski@gmail.com"
] | acharneski@gmail.com |
cd46a1fa805f2257cc443dfd0b6d65bfec8f013a | 72925bfc61b0aa5f4d61f024cb7f01576ee61e95 | /src/test/java/macys/ReadP.java | 313df4b6ffb3d0eb3bf52477442cc443743f1970 | [] | no_license | asmatalukder3134/sayan_new | 960c0023c8d43bbf935ada2df1e38319f0703f0e | f0ed1f7fbc482b7a7ce231ce50b06f1210146112 | refs/heads/master | 2023-04-04T12:01:58.974121 | 2021-01-24T19:36:37 | 2021-01-24T19:36:37 | 332,538,872 | 0 | 0 | null | 2021-04-12T03:06:43 | 2021-01-24T19:38:17 | HTML | UTF-8 | Java | false | false | 826 | java | package macys;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;
import org.testng.annotations.Test;
public class ReadP {
@Test
public String readProperty(String name ,String p) throws IOException {
File f = new File( "C:\\Users\\asmat\\eclipse-workspace\\macys\\src\\test\\resources"+ "\\com");
File f2=new File(f,"\\sweety.properties");
FileInputStream fis = new FileInputStream(f2.getAbsolutePath());
Properties prop = new Properties();
prop.load(fis);
String uname = prop.getProperty("userName");
String pw=prop.getProperty("passWord");
System.out.println("user name is:" + " " + uname);
System.out.println("password is:" + " " + pw);
return readProperty(name, p);
}
}
| [
"asma.talukder@yahoo.com"
] | asma.talukder@yahoo.com |
cdf10ca03f75c2c98eae3440d23baf60d2ea3ff1 | 7b92bd4af99dd76d108b7b5f1983ec9e5b43c5bf | /gmall-sms/src/main/java/com/java/gmall/sms/entity/SkuFullReduction.java | 86761ad6fd3f7ed0dab4fd5e4c09d78ebb7eae08 | [
"Apache-2.0"
] | permissive | wangkunkey/gmall-0722 | d6d91bded75ad610251011f5aaaefd1c4da7ad44 | 70c2dfb61332ca8941f19f8e474d97f6d89c902b | refs/heads/master | 2022-10-20T18:56:03.867409 | 2020-03-03T14:58:12 | 2020-03-03T14:58:12 | 244,554,094 | 0 | 0 | Apache-2.0 | 2022-10-12T20:37:17 | 2020-03-03T05:57:08 | Java | UTF-8 | Java | false | false | 1,129 | java | package com.java.gmall.sms.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 商品满减信息
* @author wangkun
* @since 2020-03-03 21:46:54
*/
@ApiModel
@Data
@TableName("sms_sku_full_reduction")
public class SkuFullReduction implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id
*/
@TableId
@ApiModelProperty(name = "id",value = "id")
private Long id;
/**
* spu_id
*/
@ApiModelProperty(name = "skuId",value = "spu_id")
private Long skuId;
/**
* 满多少
*/
@ApiModelProperty(name = "fullPrice",value = "满多少")
private BigDecimal fullPrice;
/**
* 减多少
*/
@ApiModelProperty(name = "reducePrice",value = "减多少")
private BigDecimal reducePrice;
/**
* 是否参与其他优惠
*/
@ApiModelProperty(name = "addOther",value = "是否参与其他优惠")
private Integer addOther;
}
| [
"wangkunkey@163.com"
] | wangkunkey@163.com |
8aea646fa26b4eb4f78fa0ef3c2abdf298f97bd6 | 7ce853c3a9ad230830a95db59d9627597097fd82 | /src/main/java/com/alexmonjaraz/invoicetracker/controller/StoreController.java | 3e06a45a2ba90732aad766030a5a310b2e73fd7d | [] | no_license | amonjaraz/invoice-tracker | 37ff4bc04f7f84643d3e13b26819c9212667f311 | 85460b07c2d6d76b67be1abbc84e225fdccdd8e0 | refs/heads/master | 2022-04-16T21:47:52.657832 | 2020-04-07T21:00:01 | 2020-04-07T21:00:01 | 250,346,627 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,205 | java | package com.alexmonjaraz.invoicetracker.controller;
import java.util.List;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindException;
import org.springframework.validation.BindingResult;
import org.springframework.validation.Errors;
import org.springframework.validation.SmartValidator;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import com.alexmonjaraz.invoicetracker.DAO.StoreRepo;
import com.alexmonjaraz.invoicetracker.entity.Store;
@Controller
@RequestMapping("/dashboard/store")
public class StoreController {
@Autowired
private StoreRepo storeRepo;
@GetMapping("/")
public String getStoreList(Model model) {
List<Store> allStores = storeRepo.findAll();
model.addAttribute("stores", allStores);
return "store/index";
}
@GetMapping("/create")
public String showAddForm(Model model) {
model.addAttribute("store", new Store());
return "store/create-form";
}
@PostMapping("/save")
public String save(@ModelAttribute("store") Store store) {
storeRepo.save(store);
return "redirect:/dashboard/store/";
}
@GetMapping("/update")
public String updateForm(@RequestParam("id") int id ,Model model) {
Optional<Store> value = storeRepo.findById(id);
Store store;
if (value.isPresent()) {
store = value.get();
model.addAttribute("store", store);
return "store/create-form";
}
else return "redirect:/dashboard/store/";
}
@GetMapping("/{id}")
public String getStore(@PathVariable int id ,Model model) {
Optional<Store> value = storeRepo.findById(id);
Store store;
if (value.isPresent()) {
store = value.get();
model.addAttribute("store", store);
return "store/store-detail";
}
else return "redirect:/dashboard/store/";
}
}
| [
"monjaraz.alexandro@gmail.com"
] | monjaraz.alexandro@gmail.com |
5898871788d6138467ed2ce0495e882b4f9479fb | 26ae61e1d8b6fa96ffdc972239e79719f0b9e290 | /src/lection9_innerclass/ShapeUtils.java | 59b59b9029bf2ed53a710461f93e3f3827b2fbff | [] | no_license | hohterd/IT-Academy | fafe5b457a9d94552e9bb5d6f983d90d82d32aa4 | fd85295f3833e62047ea11166b9a4e326b2e52e3 | refs/heads/master | 2020-06-27T02:46:20.040089 | 2019-10-04T12:17:59 | 2019-10-04T12:17:59 | 199,824,320 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,117 | java | package lection9_innerclass;
public enum ShapeUtils {
TRIANGLE ("Треугольник"),
RECTANGLE ("Прямоугольник"),
SHAPE ("Это не треугольник и не прямоугольник");
private String shape;
ShapeUtils(String shape){
this.shape = shape;
}
public String getShape() {
return shape;
}
static boolean isRectangle(Polygon polygon) {
if (polygon.points.length != 4) {
return false;
}
double angle1 = (double) Math.atan2(polygon.points[0].y - polygon.points[1].y, polygon.points[0].x - polygon.points[1].x);
double angle2 = (double) Math.atan2(polygon.points[0].y - polygon.points[3].y, polygon.points[0].x - polygon.points[3].x);
double calculatedAngle = (double) Math.toDegrees(angle1 - angle2);
if (calculatedAngle < 0) {
calculatedAngle += 360;
}
if (calculatedAngle != 90) {
return false;
}
if (polygon.points[0].distance(polygon.points[2]) != polygon.points[1].distance(polygon.points[3])) {
return false;
}
return true;
}
static boolean isTriangle(Polygon polygon) {
if (polygon.points.length != 3) {
return false;
}
double length1 = polygon.points[0].distance(polygon.points[1]);
double length2 = polygon.points[1].distance(polygon.points[2]);
double length3 = polygon.points[0].distance(polygon.points[2]);
if ((length1+length2 <= length3) | (length2+length3 <= length1) | (length1+length3 <= length2)) {
return false;
}
return true;
}
static ShapeUtils isShape(Polygon polygon){
if(isRectangle(polygon)){
System.out.println("Это фигура ");
return RECTANGLE;
}
else if (isTriangle(polygon)){
System.out.println("Это фигура ");
return TRIANGLE;
}
else {
System.out.println("Это фигура ");
return SHAPE;
}
}
}
| [
"hohterd@gmail.com"
] | hohterd@gmail.com |
9e32bc77a856d4c5fd70ec0232b2fe2eb6997e57 | 7798c8bfc2823f6c0de57b82f410518dcaf931a1 | /src/test/java/ru/netology/RadioTest.java | 31027f906ccb9c782f03ca2577c7a572f4066be5 | [] | no_license | MVGIC/RadioLover | 20fc003f701bdd61e08f9fc33cccd0b4d6a35528 | 7e10139c219ecbc10609500f9de5537bfdf84952 | refs/heads/master | 2023-01-08T22:13:27.505343 | 2020-10-22T04:26:23 | 2020-10-22T04:26:23 | 306,220,496 | 0 | 0 | null | 2020-11-12T13:22:09 | 2020-10-22T04:18:44 | Java | UTF-8 | Java | false | false | 1,805 | java | package ru.netology;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
class RadioTest {
@Test
void nextRadioStation() {
Radio radio = new Radio();
radio.setCurrentRadioStation(5);
radio.nextRadioStation();
assertEquals(6, radio.getCurrentRadioStation());
}
@Test
void prevRadioStation() {
Radio radio = new Radio();
radio.setCurrentRadioStation(5);
radio.prevRadioStation();
assertEquals(4, radio.getCurrentRadioStation());
}
@Test
void radioStationOverMax(){
Radio radio = new Radio();
radio.setCurrentRadioStation(9);
radio.nextRadioStation();
assertEquals(0, radio.getCurrentRadioStation());
}
@Test
void radioStationUnderMax(){
Radio radio = new Radio();
radio.setCurrentRadioStation(0);
radio.prevRadioStation();
assertEquals(9, radio.getCurrentRadioStation());
}
@Test
void minusVolume() {
Radio radio = new Radio();
radio.setCurrentVolume(5);
radio.minusVolume();
assertEquals(4, radio.getCurrentVolume());
}
@Test
void plusVolume() {
Radio radio = new Radio();
radio.setCurrentVolume(5);
radio.plusVolume();
assertEquals(6, radio.getCurrentVolume());
}
@Test
void plusVolumeOverMax(){
Radio radio = new Radio();
radio.setCurrentVolume(10);
radio.plusVolume();
assertEquals(10, radio.getCurrentVolume());
}
@Test
void minusVolumeUnderMin(){
Radio radio = new Radio();
radio.setCurrentVolume(0);
radio.minusVolume();
assertEquals(0, radio.getCurrentVolume());
}
} | [
"ex3ct@mail.ru"
] | ex3ct@mail.ru |
63f8ad951674915021c42aa57a1f18021d8359b8 | 472bad246f49b43fe6e22a602dd1c71294b14cc8 | /src/main/java/org/dailywork/ui/tray/AwtTray.java | b510424a482e736ad06b6615299e3f9dab4a8fd4 | [
"Apache-2.0"
] | permissive | piotr-sobczyk/daily-work | db0c8f8e49fb3efad0c04a6ae48435022b308582 | 1d69c66ed4151c60733b30eef25cd75a34962c03 | refs/heads/master | 2020-12-28T20:30:56.944447 | 2014-05-16T22:59:33 | 2014-05-16T22:59:33 | 18,688,867 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 898 | java | /*
* Copyright (c) 2010-2012 Célio Cidral Junior.
*
* 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.dailywork.ui.tray;
import java.awt.Dimension;
import java.awt.SystemTray;
public class AwtTray implements Tray {
@Override
public Dimension iconSize() {
return SystemTray.getSystemTray().getTrayIconSize();
}
}
| [
"piotr.sobczyk@nsn.com"
] | piotr.sobczyk@nsn.com |
aed101d9d3e09ec3130bb2451c078ec6b3cd87e9 | dd7d36e1d2fc67f266d789a16af047711dcafaa9 | /EmpresaJSF/src/java/utng/data/SaleDAO.java | 5c8d097ae2d7ababfb1c594cabf1a080771d1670 | [] | no_license | aruiz16/unidad5 | c7254899609877c419ccd538daca7e69c8f000f2 | e402034999ef9ee003216b0884c534e1b6f687e9 | refs/heads/master | 2021-08-28T10:07:17.867764 | 2017-12-11T22:58:28 | 2017-12-11T22:58:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 549 | 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 utng.data;
import org.hibernate.HibernateException;
import utng.model.Sale;
/**
*
* @author Alejandro RG
*/
public class SaleDAO extends DAO<Sale>{
public SaleDAO() {
super(new Sale());
}
public Sale getOneById(Sale sale)
throws HibernateException {
return super.getOneById(sale.getIdSale());
}
}
| [
"Alejandroruizg98@gmail.com"
] | Alejandroruizg98@gmail.com |
4c4e55b0ac7b1233d0e0fa9e3179e9cfe15fed2c | b6d4cd2271ccc9dd639536c92e7b92a825715e5b | /src/main/java/ssn/lmj/user/jwt/JWT.java | e2af991b5621aee3e672e7947404faf1d20343fa | [] | no_license | lingminjun/soph | 8b67ea28be9ff0e7c2418f33dd665536fc631e01 | 39271cf906f515fea28c906a57f356871376d68e | refs/heads/master | 2020-03-08T07:42:26.513051 | 2018-06-30T08:16:09 | 2018-06-30T08:16:09 | 128,001,239 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 27,059 | java | package ssn.lmj.user.jwt;
import com.alibaba.fastjson.JSON;
import com.lmj.stone.core.algorithm.Base64Util;
import com.lmj.stone.core.encrypt.Encryptable;
import com.lmj.stone.core.encrypt.Encryption;
import com.lmj.stone.core.sign.Signable;
import com.lmj.stone.core.sign.Signature;
import java.io.*;
import java.nio.charset.Charset;
import java.util.concurrent.atomic.AtomicInteger;
/**
* Created with IntelliJ IDEA.
* Description: JSON Web Token (JWT) header.claims.signature
* User: lingminjun
* Date: 2018-05-07
* Time: 下午10:00
*/
public final class JWT {
public static final String UTF_8 = "utf-8";
public static final Charset UTF8 = Charset.forName(UTF_8);
// 算法
public enum Algorithm {
CRC16("crc16"),
CRC32("crc32"),
MD5("md5"),
SHA1("sha1"),
HMAC("hmac"),
RSA("rsa"),
ECC("ecc");
public final String name;
Algorithm(String name) { this.name=name; }
public static Algorithm get(String name) {
if (CRC16.hit(name)) {
return CRC16;
} else if (CRC32.hit(name)) {
return CRC32;
} else if (MD5.hit(name)) {
return MD5;
} else if (SHA1.hit(name)) {
return SHA1;
} else if (HMAC.hit(name)) {
return HMAC;
} else if (RSA.hit(name)) {
return RSA;
} else if (ECC.hit(name)) {
return ECC;
} else {
return CRC32;
}
}
//命中
public boolean hit(String algorithm) {
return name.equalsIgnoreCase(algorithm);
}
}
public enum Grant {
None(0), //无权限
Integrated(3), //服务合作方
Device(6), //终端设备注册
OAuth(9), //终端合作方
Cross(12), //SSO 用于跨域免认证
Account(15), //账户认证 (有些平台到这个级别即可)
User(18), //用户认证
Merchant(21), //MC 合作企业后台用户 Merchant Controller
Admin(24); //AC 系统管理员
public final int code;
Grant(int code) {
this.code = code;
}
public static Grant valueOf(int code) {
//循环输出 值
for (Grant e : Grant.values()) {
if (e.code == code) {
return e;
}
}
return Grant.None;
}
public boolean eval(Grant standard) {
return this.code >= standard.code;
}
}
static public class Head {
public final Algorithm alg; //加密方式
public final Grant grt; //grant 授予作用,自行定义 :did(设备注册)
public final long exp; //过期时间点
public final long iat; //签发时间(秒)
public final String iss; //jwt签发者、一般放域名 lmj.com 与 domain一个含义
private Head(Algorithm alg, Grant grt, long age, String iss) {
this.alg = alg;
this.grt = grt;
this.iat = System.currentTimeMillis() / 1000;
this.exp = age <= 0 ? 0 : age + this.iat;
this.iss = iss;
}
private Head(Algorithm alg, Grant grt, long exp, long iat, String iss) {
this.alg = alg;
this.grt = grt;
this.iat = iat;
this.exp = exp;
this.iss = iss;
}
}
static public class Body {
public final int aid; //应用id
public final String did; //设备id
public final String uid; //用户id
public final String cnt; //accountId
public final String oid; //open id
public final String pid; //partner id
public final String key; //下发到客户端的公钥,与token中csrf(私钥)对应(用于客户端回传服务端验证签名,网关算法仅依赖)
public final String nk; //用户名(实际没啥作用)
public final long log; //用于记录日志标记
private Body(int aid,String did,String uid,String cnt,String oid,String pid,String key,String nk,long log) {
this.aid = aid;
this.did = did;
this.uid = uid;
this.cnt = cnt;
this.oid = oid;
this.pid = pid;
this.key = key;
this.nk = nk;
this.log = log;
}
}
static public class Sign {
public final Algorithm stp; //签名方式 CRC32
public final String sgn; //签名
private Sign(Algorithm alg, String sgn) {
this.stp = alg;
this.sgn = sgn;
}
}
public final Head head; //必须存在
public final Body body; //必须存在
public final Sign sign; //签名,防篡改,意义不大,可为空
private JWT(Head head,Body body,Sign sign) {
this.head = head;
this.body = body;
this.sign = sign;
}
public String toCipher(String pubKey) {
StringBuilder builder = new StringBuilder();
Builder.appendToJSON(builder,"l",head.alg.name);
Builder.appendToJSON(builder,"g",head.grt.code);
Builder.appendToJSON(builder,"e",head.exp);
Builder.appendToJSON(builder,"x",head.iat);
Builder.appendToJSON(builder,"i",head.iss);
Builder.appendToJSON(builder,"a",body.aid);
Builder.appendToJSON(builder,"d",body.did);
Builder.appendToJSON(builder,"u",body.uid);
Builder.appendToJSON(builder,"c",body.cnt);
Builder.appendToJSON(builder,"o",body.oid);
Builder.appendToJSON(builder,"p",body.pid);
Builder.appendToJSON(builder,"k",body.key);
Builder.appendToJSON(builder,"n",body.nk);
Builder.appendToJSON(builder,"f",body.log);
Builder.appendToJSON(builder,"t",sign == null ? null : sign.stp.name);
Builder.appendToJSON(builder,"s",sign == null ? null : sign.sgn);
builder.insert(0,"{");
builder.append("}");
Encryptable encryptor = Encryption.getEncryptable(head.alg.name,pubKey,null);
// byte[] data = GZIP.compress(builder.toString(),UTF_8);
byte[] data = builder.toString().getBytes(UTF8);
byte[] cipher = encryptor.encrypt(data);
return Base64Util.encodeToString(cipher);
}
public String toBinaryCipher(String pubKey) {
Scanner scanner = new Scanner();
scanner.fillJWT(this);
Encryptable encryptor = Encryption.getEncryptable(head.alg.name,pubKey,null);
byte[] data = scanner.toBinaryToken();
byte[] cipher = encryptor.encrypt(data);
return Base64Util.encodeToString(cipher);
}
//产生一个唯一的
private static final long TIME_2018_01_01 = 1514736000000l;
private static final AtomicInteger SEQUENCER = new AtomicInteger(1);
private static final int SEQ_SIZE = 1000;
//分布式系统不完全唯一,由于随机数引入,基本可以忽略其冲突(用户行为观察不受影响)
public static long genDID() {
int random = (int)(Math.random()*SEQ_SIZE);//取小数位,具有不可预测性
int num = SEQUENCER.getAndIncrement();
num = num > 0 ? num % SEQ_SIZE : -num % SEQ_SIZE;
return (System.currentTimeMillis() - TIME_2018_01_01) * SEQ_SIZE * SEQ_SIZE + random * SEQ_SIZE + num;
}
static private class Scanner {
public String l; //加密方式
public int g; //grant 授予作用,自行定义 :did(设备注册)
public long e; //过期时间点
public long x; //颁发时间点
public String i; //jwt签发者
public int a; //应用id
public String d; //设备id
public String u; //用户id
public String c; //AccountId
public String o; //open id
public String p; //partner id
public String k; //下发到客户端的公钥,与token中csrf对应(用于客户端回传服务端验证签名)
public String n; //用户名(实际没啥作用)
public long f; //日志标记
public String t; //签名方式 CRC32
public String s; //签名
public JWT toJWT() {
return new JWT(new Head(Algorithm.get(l),Grant.valueOf(g),e,x,i),new Body(a,d,u,c,o,p,k,n,f),s == null ? null : new Sign(Algorithm.get(t),s));
}
public void fillJWT(JWT jwt) {
this.l = jwt.head.alg.name;
this.g = jwt.head.grt.code;
this.e = jwt.head.exp;
this.x = jwt.head.iat;
this.i = jwt.head.iss;
this.a = jwt.body.aid;
this.d = jwt.body.did;
this.u = jwt.body.uid;
this.c = jwt.body.cnt;
this.o = jwt.body.oid;
this.p = jwt.body.pid;
this.k = jwt.body.key;
this.n = jwt.body.nk;
this.f = jwt.body.log;
if (jwt.sign != null) {
this.t = jwt.sign.stp.name;
this.s = jwt.sign.sgn;
}
}
private static String readStringFromStream(DataInputStream inputStream) throws IOException {
if (inputStream.available() <= 0) {//非必填
return null;
}
short len = inputStream.readShort();
if (len > 0) {
byte[] bys = new byte[len];
if (len != inputStream.read(bys)) {
return null;
}
return new String(bys,UTF8);
}
return null;
}
private static void writeStringFromStream(DataOutputStream outputStream, String string) throws IOException {
byte[] bys = null;
if (string != null && string.length() > 0) {
bys = string.getBytes(UTF8);
} else {
bys = new byte[0];
}
outputStream.writeShort(bys.length);
outputStream.write(bys);
}
/**
* 二级制 jwt 支持,会大幅度降低jwt长度
*/
private static Scanner parseFromBinaryToken(byte[] token) {
DataInputStream dis = null;
Scanner client = null;
try {
dis = new DataInputStream(new ByteArrayInputStream(token));
client = new Scanner();
client.l = readStringFromStream(dis);
client.g = dis.readInt();
client.e = dis.readLong();
client.x = dis.readLong();
client.i = readStringFromStream(dis);
client.a = dis.readInt();
client.d = readStringFromStream(dis);
client.u = readStringFromStream(dis);
client.o = readStringFromStream(dis);
client.p = readStringFromStream(dis);
client.k = readStringFromStream(dis);
client.n = readStringFromStream(dis);
client.f = dis.readLong();
if (dis.available() > 0) {//非必填
client.t = readStringFromStream(dis);
client.s = readStringFromStream(dis);
}
//发现还有数据,退出
if (dis.available() > 0) {
return null;
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (dis != null) {
try {
dis.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return client;
}
/**
* 生成token
*/
private byte[] toBinaryToken() {
ByteArrayOutputStream baos = new ByteArrayOutputStream(64);
DataOutputStream dos = new DataOutputStream(baos);
byte[] token = null;
try {
writeStringFromStream(dos,this.l);
dos.writeInt(this.g);
dos.writeLong(this.e);
dos.writeLong(this.x);
writeStringFromStream(dos,this.i);
dos.writeInt(this.a);
writeStringFromStream(dos,this.d);
writeStringFromStream(dos,this.u);
writeStringFromStream(dos,this.o);
writeStringFromStream(dos,this.p);
writeStringFromStream(dos,this.k);
writeStringFromStream(dos,this.n);
dos.writeLong(this.f);
if (this.s != null && this.s.length() > 0) {//签名
writeStringFromStream(dos,this.t);
writeStringFromStream(dos,this.s);
}
token = baos.toByteArray();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
dos.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return token;
}
}
static public class Builder {
private Algorithm alg = Algorithm.RSA;
private Grant grt = Grant.User;
private long age;
private String iss;
private Algorithm stp = Algorithm.CRC32;
private int aid; //应用id
private String did; //设备id
private String uid; //用户id
private String cnt; //AccountId
private String oid; //open id
private String pid; //partner id
private String key; //下发到客户端的公钥,与token中csrf(授予的私钥)对应(用于客户端回传服务端验证签名)
private String nk; //用户名(实际没啥作用)
private long log; //日志log flag
private String salt; //签名秘钥(加盐)
private String cipher;//密文
private boolean binary = false;
private String pubKey;//公钥
private String priKey;//私钥
private JWT jwt;
//设置加密算法
public Builder setBinaryEncode(boolean binary) {
if (this.binary != binary) {
this.jwt = null;
}
this.binary = binary;
return this;
}
//设置加密算法
public Builder setEncryptAlgorithm(Algorithm algorithm) {
if (this.alg != algorithm) {
this.jwt = null;
}
this.alg = algorithm;
return this;
}
//设置jwt作用范围,或者说jwt的权限
public Builder setJWTGrant(Grant grant) {
if (this.grt != grant) {
this.jwt = null;
}
this.grt = grant;
return this;
}
//设置过期时长,设置小于零表示不过期 单位秒(s)
public Builder setAging(long aging) {
if (this.age != aging) {
this.jwt = null;
}
this.age = aging;
return this;
}
// 设置颁发者所在域
public Builder setIssue(String domain) {
if (!stringEquals(this.iss,domain)) {
this.jwt = null;
}
this.iss = domain;
return this;
}
public Builder setUserId(String userId) {
if (!stringEquals(this.uid,userId)) {
this.jwt = null;
}
this.uid = userId;
return this;
}
public Builder setAccountId(String accountId) {
if (!stringEquals(this.cnt,accountId)) {
this.jwt = null;
}
this.cnt = accountId;
return this;
}
public Builder setApplicationId(int appId) {
if (this.aid != appId) {
this.jwt = null;
}
this.aid = appId;
return this;
}
public Builder setDeviceId(String deviceId) {
if (!stringEquals(this.did,deviceId)) {
this.jwt = null;
}
this.did = deviceId;
return this;
}
public Builder setOpenId(String openId) {
if (!stringEquals(this.oid,openId)) {
this.jwt = null;
}
this.oid = openId;
return this;
}
public Builder setPartnerId(String partnerId) {
if (!stringEquals(this.pid,partnerId)) {
this.jwt = null;
}
this.pid = partnerId;
return this;
}
public Builder setLogFlag(long flag) {
if (this.log != flag) {
this.jwt = null;
}
this.log = flag;
return this;
}
// 颁发的公钥(隐藏公钥,主要是返回到验证机上进行验证签名)
public Builder setIssuedPublicKey(String key) {
if (!stringEquals(this.key,key)) {
this.jwt = null;
}
this.key = key;
return this;
}
public Builder setNick(String nick) {
if (!stringEquals(this.nk,nick)) {
this.jwt = null;
}
this.nk = nick;
return this;
}
public Builder setSignatureAlgorithm(Algorithm algorithm) {
if (this.stp != algorithm) {
this.jwt = null;
}
this.stp = algorithm;
return this;
}
public Builder setSignSalt(String salt) {
if (!stringEquals(this.salt,salt)) {
this.jwt = null;
}
this.salt = salt;
return this;
}
public Builder setCipherText(String cipherText) {
if (!stringEquals(this.cipher,cipherText)) {
this.jwt = null;
}
this.cipher = cipherText;
return this;
}
public Builder setEncryptKey(String pubkey,String priKey) {
if (!stringEquals(this.pubKey,pubkey) || !stringEquals(this.priKey,priKey)) {
this.jwt = null;
}
this.pubKey = pubkey;
this.priKey = priKey;
return this;
}
private static boolean stringEquals(String str1, String str2) {
if ((str1 == null || str1.length() == 0) && (str2 == null || str2.length() == 0)) {
return true;
}
if (str1 != null) {
return str1.equals(str2);
}
return false;
}
private static void appendToJSON(StringBuilder builder, String key, Object value) {
if (key == null || key.length() == 0 || value == null) {
return;
}
if (value instanceof String) {
String v = (String)value;
if (v == null || v.length() == 0) {
return;
}
}
if (builder.length() > 1) {
builder.append(",");
}
if (value instanceof String) {
builder.append("\"" + key + "\":\"" + value + "\"");
} else {
builder.append("\"" + key + "\":" + value);
}
}
//支持两种格式的jwt解析
public JWT build() {
if (jwt != null) {
return jwt;
}
if (cipher != null && cipher.length() > 0) {
if (priKey == null || priKey.length() == 0) {
throw new RuntimeException("无法创建JWT,请设置加密公私秘钥");
}
Encryptable encryptor = Encryption.getEncryptable(alg.name,pubKey,priKey);
byte[] data = Base64Util.decode(cipher);
// byte[] text = GZIP.uncompress(encryptor.decrypt(data));
byte[] text = encryptor.decrypt(data);
Scanner scanner = null;
if (binary) {
scanner = Scanner.parseFromBinaryToken(text);
} else {
scanner = JSON.parseObject(text, Scanner.class);
}
jwt = scanner.toJWT();
return jwt;
}
StringBuilder builder = new StringBuilder();
Head head = new Head(alg,grt,age,iss);
Body body = new Body(aid,did,uid,cnt,oid,pid,key,nk,log);
appendToJSON(builder,"l",alg.name);
appendToJSON(builder,"g",grt.code);
appendToJSON(builder,"e",head.exp);
appendToJSON(builder,"x",head.iat);
appendToJSON(builder,"i",iss);
appendToJSON(builder,"a",aid);
appendToJSON(builder,"d",did);
appendToJSON(builder,"u",uid);
appendToJSON(builder,"o",oid);
appendToJSON(builder,"p",pid);
appendToJSON(builder,"k",key);
appendToJSON(builder,"n",nk);
appendToJSON(builder,"f",log);
Sign sign = null;
if (salt != null && salt.length() > 0) {
Signable s = Signature.getSignable(stp.name, salt,null);
String sgn = s.sign(builder.toString().getBytes(UTF8));
sign = new Sign(stp,sgn);
// appendToJSON(builder,"t",stp.name);
// appendToJSON(builder,"s",sgn);
}
// builder.insert(0,"{");
// builder.append("}");
jwt = new JWT(head,body,sign);
return jwt;
}
public String buildCipher() {
if (this.pubKey == null || this.pubKey.length() == 0) {
throw new RuntimeException("无法加密JWT,请设置加密公钥");
}
JWT jwt = build();
if (binary) {
return jwt.toBinaryCipher(this.pubKey);
} else {
return jwt.toCipher(this.pubKey);
}
}
}
//head
/*{
"alg" : "AES256",
"typ" : "JWT",
"exp" : "3000"
}*/
//claim
/*{
"sub": "1234567890",
"name": "John Doe",
"admin": true
}*/
/*
public static void main(String[] args) throws NoSuchProviderException, NoSuchAlgorithmException {
{
String pubkey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDoIjY+VacM/v0q47oQkbE4eVo4AS/Px07EMCmlYmRjY9x1OeippSppQ1eNRIuFCbZRqpMoayDO68UdWPCSqOt1I8Uw03MzVDmy38ZBo6dVTRrqWW9z7vbQQ1nWkEcUWcRTIQIktQ2ptO4AOlZa1x1/zvsNBodTNqhqCGPeTNUwyQIDAQAB";
String prikey = "MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAOgiNj5Vpwz+/SrjuhCRsTh5WjgBL8/HTsQwKaViZGNj3HU56KmlKmlDV41Ei4UJtlGqkyhrIM7rxR1Y8JKo63UjxTDTczNUObLfxkGjp1VNGupZb3Pu9tBDWdaQRxRZxFMhAiS1Dam07gA6VlrXHX/O+w0Gh1M2qGoIY95M1TDJAgMBAAECgYEAy6jIYmQPTc2hHDHzmnnYPC3rw1r3MZoxNtryjtEGNlT0pDyMLdpknTmh5KUQq0XcGUZIGZvzitc7dwYC+wkMmWsEQXMt3pYGaNDvhz967zrGvHk7NX6KDqK7ExsBRsjGdoXd8ohZjt4DsN2egrqhASr5iKd7G9pJuKQLuRWMwAkCQQD+hb4pQ4rixQ7qkDVCqRjrsFM6YBWwRTFL0HRkVeejcV8MKVtnWWh0pDwj1J44qZ+3mFj9YAITvdu63xNvjHJHAkEA6XsyMpTzEtbWV+QZFNJlI3CqqIXL/vTPbnWrV0L0unfSZMXe/nPHnYtM4mP+YjkEN7cab08R/wO5ptb37yE8bwJASLSpwp3Rsb+66BRzsmwde04uKDHEYEsTruWIKhVECzNahF3YB2jJ5u/3YgDdhbAmuMpjOVXQohUNDI+mvKmxBwJAGyorP/lWgqWeUKGITYThIYt1P6A5iNNg4wArzD5NDPjt8K2Y8U/1NJ5Fdr2dlj3+AKF8IOE5PctoKUIvnJHoXwJBAJFFf3kuqC0JhfelmlaLV1atcCuCp8QtvyHgtOE3IuDobhgwThVZYOc066/fzEqjQRrGs4GKmjN+SPH92WHAXqE=";
Builder builder = new Builder();
builder.setAging(3600 * 24);
builder.setApplicationId(4);
builder.setDeviceId("21434323243433");
builder.setUserId("76534");
builder.setIssuedPublicKey("bY7813NzNt548KAC4QI+PwpK1khDkWPQC+SHbT1njRs=");
builder.setSignSalt("lmj.xxxx.com");
builder.setNick("杨世亮");
builder.setLogFlag(12);
JWT jwt = builder.build();
String code = jwt.toCipher(pubkey);
System.out.println("jwt编码后:" + code);
Builder builder1 = new Builder();
builder1.setEncryptKey(pubkey, prikey);
builder1.setCipherText(code);
JWT jwt1 = builder1.build();
System.out.println("jwt解码后:" + JSON.toJSONString(jwt1));
{
String code1 = jwt.toBinaryCipher(pubkey);
System.out.println("jwt编码后1:" + code1);
Builder builder2 = new Builder();
builder2.setEncryptKey(pubkey, prikey);
builder2.setBinaryEncode(true);
builder2.setCipherText(code1);
JWT jwt2 = builder2.build();
System.out.println("jwt解码后1:" + JSON.toJSONString(jwt2));
}
}
{
KeyPairGenerator keygen = KeyPairGenerator.getInstance("EC", "BC");
keygen.initialize(192, SecureRandom.getInstance("SHA1PRNG"));
KeyPair kp = keygen.generateKeyPair();
String pubkey = Base64Util.encodeToString(kp.getPublic().getEncoded());
String prikey = Base64Util.encodeToString(kp.getPrivate().getEncoded());
System.out.println(pubkey);
System.out.println(prikey);
Builder builder = new Builder();
builder.setAging(3600 * 24);
builder.setApplicationId(4);
builder.setDeviceId("21434323243433");
builder.setUserId("76534");
builder.setIssuedPublicKey("bY7813NzNt548KAC4QI+PwpK1khDkWPQC+SHbT1njRs=");
// builder.setSignSalt("lmj.xxxx.com");
builder.setNick("杨世亮");
builder.setLogFlag(12);
builder.setEncryptAlgorithm(Algorithm.ECC);
JWT jwt = builder.build();
String code = jwt.toCipher(pubkey);
System.out.println("jwt编码后:" + code);
Builder builder1 = new Builder();
builder1.setEncryptKey(pubkey, prikey);
builder1.setCipherText(code);
builder1.setEncryptAlgorithm(Algorithm.ECC);
JWT jwt1 = builder1.build();
System.out.println("jwt解码后:" + JSON.toJSONString(jwt1));
{
String code1 = jwt.toBinaryCipher(pubkey);
System.out.println("jwt编码后1:" + code1);
Builder builder2 = new Builder();
builder2.setEncryptKey(pubkey, prikey);
builder2.setBinaryEncode(true);
builder2.setCipherText(code1);
builder2.setEncryptAlgorithm(Algorithm.ECC);
JWT jwt2 = builder2.build();
System.out.println("jwt解码后1:" + JSON.toJSONString(jwt2));
}
}
}*/
}
| [
"lingminjun@lingminjun-MacBook-Pro.local"
] | lingminjun@lingminjun-MacBook-Pro.local |
195d23f0f6042706809c60c34762a04926a3953e | be16083cf6b9befbf18ecb3742cf9372cbab42a1 | /hotelserver/src/main/java/com/codeclan/hotelserver/hotelserver/repositories/StaffRepository.java | 122b4526443a0767608d129dd38a27acddd07c1e | [] | no_license | ianbone1/ClanLodging | 43925cfb371e54a97042f3fe3d071eebd94477c0 | 54824e48b45ddaf2e4bad7ab673c3c20f6a52177 | refs/heads/master | 2020-05-09T09:32:47.265897 | 2019-04-24T09:16:33 | 2019-04-24T09:16:33 | 181,005,366 | 3 | 3 | null | null | null | null | UTF-8 | Java | false | false | 405 | java | package com.codeclan.hotelserver.hotelserver.repositories;
import com.codeclan.hotelserver.hotelserver.models.people.Staff;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface StaffRepository extends JpaRepository<Staff, Long> {
List<Staff> findAllStaffByLastname(String lastname);
}
| [
"ianbone1@googlemail.com"
] | ianbone1@googlemail.com |
6e2b6cf396b8e638e205a646a4578799a1c51237 | 586c669e61c242a9fd67bba5a41f1a9defde4ce8 | /cooperation/src/main/java/com/reache/cooperation/test/entity/TestDataMain.java | bf4ce3bf83bbd724df71713292c9c837ffc86e20 | [] | no_license | shockw/cooperation | 15366dcf541078ef9befec74ca3a23fbfc7e04c2 | d8d4dcf5218bcd350f875424767d44077a73f237 | refs/heads/master | 2021-08-28T05:05:19.304363 | 2017-12-11T08:09:23 | 2017-12-11T08:09:23 | 104,889,256 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,232 | java | /**
* Copyright © 2012-2016 <a href="https://github.com/reache/cooperation">Cooperation</a> All rights reserved.
*/
package com.reache.cooperation.test.entity;
import com.reache.cooperation.modules.sys.entity.User;
import com.reache.cooperation.modules.sys.entity.Office;
import com.reache.cooperation.modules.sys.entity.Area;
import org.hibernate.validator.constraints.Length;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.List;
import com.google.common.collect.Lists;
import com.reache.cooperation.common.persistence.DataEntity;
/**
* 主子表生成Entity
* @author ThinkGem
* @version 2015-04-06
*/
public class TestDataMain extends DataEntity<TestDataMain> {
private static final long serialVersionUID = 1L;
private User user; // 归属用户
private Office office; // 归属部门
private Area area; // 归属区域
private String name; // 名称
private String sex; // 性别
private Date inDate; // 加入日期
private List<TestDataChild> testDataChildList = Lists.newArrayList(); // 子表列表
public TestDataMain() {
super();
}
public TestDataMain(String id){
super(id);
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public Office getOffice() {
return office;
}
public void setOffice(Office office) {
this.office = office;
}
public Area getArea() {
return area;
}
public void setArea(Area area) {
this.area = area;
}
@Length(min=0, max=100, message="名称长度必须介于 0 和 100 之间")
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Length(min=0, max=1, message="性别长度必须介于 0 和 1 之间")
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
public Date getInDate() {
return inDate;
}
public void setInDate(Date inDate) {
this.inDate = inDate;
}
public List<TestDataChild> getTestDataChildList() {
return testDataChildList;
}
public void setTestDataChildList(List<TestDataChild> testDataChildList) {
this.testDataChildList = testDataChildList;
}
}
| [
"wz19831129"
] | wz19831129 |
bb29eea5256b4f259d0844728a652617f341ead3 | 627ea7aee310995b75dfcffc684c79e315352a7a | /src/test/java/br/ufg/inf/sempreufg/servico/MontadorSQLTest.java | bdafd6f4beb2ccc653787da826924e71ebdcfc72 | [] | no_license | ES-INF-UFG-2016-2/Sempre-UFG | 970dbbe3c290769d58ab5ee2e0766d147f05945b | d42ff68f0f9adcd41b41aa4a0303337c71a61c4b | refs/heads/develop | 2021-05-03T14:58:17.198514 | 2016-12-20T18:33:50 | 2016-12-20T18:33:50 | 66,892,784 | 10 | 7 | null | 2021-01-25T15:12:44 | 2016-08-30T00:54:02 | Java | UTF-8 | Java | false | false | 944 | java | package br.ufg.inf.sempreufg.servico;
import org.junit.BeforeClass;
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
public class MontadorSQLTest {
private static MontadorSQL montadorSQL;
@BeforeClass
public static void setup() {
montadorSQL = new MontadorSQL();
}
@Test
public void testMontarConsultaComSucesso() {
List<String> atributos = getAtributosParaTeste();
String clausulaWhere = "WHERE curso_da_ufg.nome";
// String consultaObtida = montadorSQL.montarConsulta(atributos, clausulaWhere);
String consultaEsperada ="SELECT A, B, C FROM TABLE " + clausulaWhere;
// assertEquals(consultaEsperada, consultaObtida);
}
private List<String> getAtributosParaTeste() {
return new ArrayList<String>() {{
add("A");
add("B");
add("C");
}};
}
}
| [
"daniel.olivervas@gmail.com"
] | daniel.olivervas@gmail.com |
61c67906fd2c6ab216e1a3b1ba859d48f6cf49cf | cee3c04657c55858d01178d3452e4cc9ad91051d | /src/net/jve/scene/geometry/Mesh.java | 12dc5e5d20daed8ca3dc1137dd92b1a0817f996c | [] | no_license | JustBrenkman/JVE-Core | 3172c58cc2514d7455ff2e923bf136c6f0c8d573 | 3041021eaa35fbbcb53fd33ed92ddcab91993863 | refs/heads/master | 2020-05-17T01:51:12.620419 | 2014-05-12T18:43:34 | 2014-05-12T18:43:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,259 | java | /*
* Copyright (c) 2014
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those
* of the authors and should not be interpreted as representing official policies,
* either expressed or implied, of the FreeBSD Project.
*/
package net.jve.scene.geometry;
import net.jve.math.Vertex3f;
import net.jve.scene.geometry.MeshData.VertexBufferObject;
/**
* Created by ben on 02/05/14.
*/
public class Mesh {
private VertexBufferObject vertexBufferObject = null;
public Mesh() {
vertexBufferObject = new VertexBufferObject();
}
public int getVertexCount() {
if (vertexBufferObject == null)
return 0;
// return vertexBufferObject.getBuffer().capacity() / 3;
return vertexBufferObject.verticies.size();
}
/**
* VertexBufferObject Wrappers
*
* adds support for all the VertexBufferObject commands
*/
// wrappers for VertexBufferObject
public void addVerticies(Vertex3f... vertex3fs) {
vertexBufferObject.setVerticies(vertex3fs);
}
public void addVertex(Vertex3f vertex) {
vertexBufferObject.addVertex3f(vertex);
}
public void addVertex(int index, Vertex3f vertex) {
vertexBufferObject.addVertexAt(vertex, index);
}
/**
* Adds a vertex at a specific stop
* @param vertex
* @param index
*/
public void addVertexAt(Vertex3f vertex, int index) {
vertexBufferObject.addVertexAt(vertex, index);
}
/**
* Adds vertex in first stop and shifts everything down
* @param vertex
*/
public void addVertexFirst(Vertex3f vertex) {
vertexBufferObject.addVertexFirst(vertex);
}
/**
* Adds a vertex to the bottom
* @param vertex
* @return
*/
public int addVertexLast(Vertex3f vertex) {
return vertexBufferObject.addVertexLast(vertex);
}
/**
* Removes a vertex
* @param vertex
*/
public void removeVertex(Vertex3f vertex) {
vertexBufferObject.removeVertex(vertex);
}
/**
* removes a vertex from certian position
* @param index
*/
public void removeVertex(int index) {
vertexBufferObject.removeVertex(index);
}
/**
* Creates FloatBuffer and sends to GPU
*/
public void compile() {
vertexBufferObject.compile();
}
/**
* Updates buffer on GPU
*/
public void updateBuffer() {
vertexBufferObject.updateBuffer();
}
public float[] getVerticies() {
return vertexBufferObject.getVerticies();
}
// End of wrapper
/**
* End of VertexBufferObject wrapper
*/
public int getVboID() {
return vertexBufferObject.getVboID();
}
public void printOut() {
vertexBufferObject.printOut();
}
public void destory() {
vertexBufferObject.destroy();
}
}
| [
"JustBrenkman@gmail.com"
] | JustBrenkman@gmail.com |
fabaef5def5ed35f5e5a9db2b7b345f6e4d52c4d | 393b1ddeec1beef62a4efda9a639738caf2b9d9a | /src/test/java/com/isharp/polozilla/topologies/snap/SnapRouteTest.java | 65082a058396fe154f83188fb12cd118f796b82e | [] | no_license | jeremycward/polozilla | 600ca5fb09d00e599cb4fa4830347bc112dda8d5 | abe7ffbc8c32ab6b53d980ec048ba1bc277ed9bf | refs/heads/master | 2023-04-01T11:41:56.422375 | 2021-04-06T21:08:46 | 2021-04-06T21:08:46 | 323,150,461 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,236 | java | package com.isharp.polozilla.topologies.snap;
import com.isharp.polozilla.components.PoloniexSerdes;
import com.isharp.polozilla.topologies.TopologyTestUtil;
import com.isharp.polozilla.vo.KeyedPoloCaptureWindow;
import com.isharp.polozilla.vo.Snap;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.kafka.common.serialization.Serdes;
import org.apache.kafka.streams.TestInputTopic;
import org.apache.kafka.streams.TestOutputTopic;
import org.apache.kafka.streams.Topology;
import org.apache.kafka.streams.TopologyTestDriver;
import org.apache.kafka.streams.kstream.TimeWindows;
import org.apache.kafka.streams.kstream.Windowed;
import org.apache.kafka.streams.kstream.WindowedSerdes;
import org.apache.kafka.streams.test.TestRecord;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.time.Duration;
import java.util.List;
import static com.isharp.polozilla.topologies.TopologyTestUtil.FEB_2_2021_17_30_Instant;
import static com.isharp.polozilla.topologies.TopologyTestUtil.receivingFrom;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
public class SnapRouteTest {
private static final String INPUT_TOPIC= RandomStringUtils.randomAlphabetic(15);
private static final String OUTPUT_TOPIC= RandomStringUtils.randomAlphabetic(15);
private static final com.isharp.polozilla.topologies.snap.Config WINDOW_CONFIG =
new com.isharp.polozilla.topologies.snap.Config(INPUT_TOPIC,OUTPUT_TOPIC, Duration.ofMinutes(1),Duration.ofSeconds(1));
TopologyTestUtil.TimedDataSender priceSender;
TestOutputTopic<Windowed<String>, Snap> windowedMinsTestOutput;
TopologyTestDriver driver;
TestInputTopic<String, KeyedPoloCaptureWindow> inputTopic;
SnapRoute snapRoute = new SnapRoute();
Topology underTest = snapRoute.build(WINDOW_CONFIG);
@Before
public void setup(){
driver = TopologyTestUtil.driverFor(underTest,TopologyTestUtil.FRI_8_JAN_2021_17_30_ld);
driver.getAllStateStores().clear();
inputTopic=driver.createInputTopic(INPUT_TOPIC, Serdes.String().serializer(),PoloniexSerdes.keyedPoloCaptureWindow.serializer() , FEB_2_2021_17_30_Instant,Duration.ofMillis(0));
windowedMinsTestOutput =
driver.createOutputTopic(OUTPUT_TOPIC,
WindowedSerdes.timeWindowedSerdeFrom(String.class).deserializer(),
PoloniexSerdes.snap.deserializer());
priceSender = new TopologyTestUtil.TimedDataSender(driver,inputTopic,TopologyTestUtil.FRI_8_JAN_2021_17_30_ld);
}
@After
public void tearDown(){
driver.close();
}
@Test
public void shouldEmitOneRecWithThreePricesAfterOneInterval()throws Exception{
priceSender
.send(TopologyTestUtil.aPoloCaptureWindow("eurusd", 0.001d,10))
.addTimes(Duration.ofMillis(1))
.send(TopologyTestUtil.aPoloCaptureWindow("eurusd", 0.002d,9))
.addTimes(Duration.ofMillis(1))
.send(TopologyTestUtil.aPoloCaptureWindow("gbpusd", 0.001d,8))
.addTimes(Duration.ofMillis(1))
.send(TopologyTestUtil.aPoloCaptureWindow("gbpusd", 1.002d,7))
.addTimes(Duration.ofMinutes(5))
.send(TopologyTestUtil.aPoloCaptureWindow("gbpusd", 2.002d,17));
List<TestRecord<Windowed<String>, Snap>> results = receivingFrom(windowedMinsTestOutput)
.expect(1).messages()
.within(Duration.ofSeconds(10)).results();
assertThat(results.get(0).getValue().getCapture().get("eurusd").size(), is(19));
assertThat(results.get(0).getValue().getCapture().get("eurusd").get(18).getValue(),is(0.002d));
assertThat(results.get(0).getValue().getCapture().get("gbpusd").size(), is(15));
assertThat(results.get(0).getValue().getCapture().get("gbpusd").get(0).getValue(),is(0.001d));
assertThat(results.get(0).getValue().getCapture().get("gbpusd").get(14).getValue(),is(1.002d));
assertThat(results.get(0).getKey().key(),containsString("2021-02-20:1730"));
}
}
| [
"jeremy_c_ward@yahoo.co.uk"
] | jeremy_c_ward@yahoo.co.uk |
ca92ed51eab3a57f1af5eb0758305259bc0eb6f9 | 687c0a1b8b2fe3a2700810a13b4e8e13301c3087 | /leetcode/tree_graph/EvaluateDivision.java | c9d441033225354ba6e83edfd40cf452b0ad28e0 | [
"MIT"
] | permissive | hzheng/algo-problems | 871f40e07d92636513ffcceef30f2b387ca0cbae | 780f6cc6799cb82954b2ba2386aa7391f71d5003 | refs/heads/main | 2023-02-19T06:57:38.417365 | 2023-02-14T19:08:41 | 2023-02-14T19:08:41 | 153,545,000 | 4 | 1 | null | null | null | null | UTF-8 | Java | false | false | 11,757 | java | import java.util.*;
import org.junit.Test;
import static org.junit.Assert.*;
// LC399: https://leetcode.com/problems/evaluate-division/
//
// Equations are given in the format A / B = k, where A and B are variables
// represented as strings, and k is a real number (floating point number). Given
// some queries, return the answers. If the answer does not exist, return -1.0.
//
// Example:
// Given a / b = 2.0, b / c = 3.0.
// queries are: a / c = ?, b / a = ?, a / e = ?, a / a = ?, x / x = ? .
// return [6.0, 0.5, -1.0, 1.0, -1.0 ].
// The input is: vector<pair<string, string>> equations, vector<double>& values,
// vector<pair<string, string>> queries , where equations.size() == values.size(),
// and the values are positive. This represents the equations. Return vector<double>.
// The input is always valid. You may assume that evaluating the queries will
// result in no division by zero and there is no contradiction.
public class EvaluateDivision {
// Solution of Choice
// Hash Table + Recursion + DFS
// beats 77.38%(3 ms for 11 tests)
public double[] calcEquation(String[][] equations, double[] values,
String[][] queries) {
Map<String, Map<String, Double> > relations = new HashMap<>();
for (int i = 0; i < equations.length; i++) {
String[] equation = equations[i];
double value = values[i];
save(relations, equation[0], equation[1], value);
save(relations, equation[1], equation[0], 1.0 / value);
}
double[] res = new double[queries.length];
for (int i = 0; i < queries.length; i++) {
String[] query = queries[i];
res[i] = calc(relations, query[0], query[1]);
}
return res;
}
private void save(Map<String, Map<String, Double> > relations,
String x, String y, double value) {
Map<String, Double> map = relations.get(x);
if (map == null) {
relations.put(x, map = new HashMap<>());
}
map.put(y, value);
}
private double calc(Map<String, Map<String, Double> > relations,
String x, String y) {
if (!relations.containsKey(x)) return -1.0;
return x.equals(y) ? 1.0 : calc(relations, x, y, new HashSet<>());
}
private double calc(Map<String, Map<String, Double> > relations,
String x, String y, Set<String> visited) {
visited.add(x);
Map<String, Double> values = relations.get(x);
Double val = values.get(y);
if (val != null) return val;
for (String var : values.keySet()) {
if (!visited.contains(var)) {
double res = calc(relations, var, y, visited);
if (res >= 0) return values.get(var) * res;
}
}
return -1.0;
}
// Hash Table
// beats 14.77%(6 ms for 11 tests)
public double[] calcEquation2(String[][] equations, double[] values,
String[][] queries) {
Map<String, Map<String, Double> > relations = new HashMap<>();
for (int i = 0; i < equations.length; i++) {
String[] equation = equations[i];
double value = values[i];
save(relations, equation[0], equation[1], value);
save(relations, equation[1], equation[0], 1.0 / value);
}
for (String z : relations.keySet()) {
Map<String, Double> map1 = relations.get(z);
Set<String> relation = map1.keySet();
for (String x : relation) {
Map<String, Double> map2 = relations.get(x);
for (String y : relation) {
save(relations, x, y, map1.get(y) * map2.get(z));
}
}
}
double[] res = new double[queries.length];
for (int i = 0; i < queries.length; i++) {
String[] query = queries[i];
Map<String, Double> map = relations.get(query[0]);
res[i] = (map == null) ? -1.0 : map.getOrDefault(query[1], -1.0);
}
return res;
}
// Hash Table + Queue + BFS
// beats 41.57%(4 ms for 11 tests)
public double[] calcEquation3(String[][] equations, double[] values,
String[][] queries) {
Map<String, Map<String, Double> > relations = new HashMap<>();
for (int i = 0; i < equations.length; i++) {
String[] equation = equations[i];
double value = values[i];
save(relations, equation[0], equation[1], value);
save(relations, equation[1], equation[0], 1.0 / value);
}
double[] res = new double[queries.length];
for (int i = 0; i < queries.length; i++) {
String[] query = queries[i];
res[i] = calc3(relations, query[0], query[1]);
}
return res;
}
private double calc3(Map<String, Map<String, Double> > relations,
String x, String y) {
Map<String, Double> values = relations.get(x);
if (values == null) return -1.0;
Queue<Value> queue = new LinkedList<>();
queue.offer(new Value(x, 1));
Set<String> visited = new HashSet<>();
visited.add(x);
while (!queue.isEmpty()) {
Value v = queue.poll();
Map<String, Double> map = relations.get(v.x);
Double val = map.get(y);
if (val != null) return v.val * val;
for (String key : map.keySet()) {
if (!visited.contains(key)) {
visited.add(key);
double newVal = v.val * map.get(key);
queue.offer(new Value(key, newVal));
values.put(key, newVal); // improve performance or not?
}
}
}
return -1.0;
}
private static class Value {
String x;
double val;
Value(String x, double val) {
this.x = x;
this.val = val;
}
}
// Hash Table
// beats 77.38%(3 ms for 11 tests)
public double[] calcEquation4(String[][] equations, double[] values,
String[][] queries) {
Map<String, Integer> nodes = new HashMap<>();
int n = 0;
for (String[] equation : equations) { // indexing nodes
String src = equation[0];
String dest = equation[1];
if (!nodes.containsKey(src)) {
nodes.put(src, n++);
}
if (!nodes.containsKey(dest)) {
nodes.put(dest, n++);
}
}
double[][] relations = new double[n][n];
for (int i = equations.length - 1; i >= 0; i--) {
int src = nodes.get(equations[i][0]);
int dest = nodes.get(equations[i][1]);
relations[src][src] = relations[dest][dest] = 1.0;
relations[src][dest] = values[i];
relations[dest][src] = 1.0 / values[i];
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
for (int k = 0; k < n; k++) {
if (relations[i][j] != 0 && relations[j][k] != 0) {
relations[i][k] = relations[i][j] * relations[j][k];
}
}
}
}
double res[] = new double[queries.length];
for (int i = queries.length - 1; i >= 0; i--) {
res[i] = -1.0;
String[] query = queries[i];
Integer src = nodes.get(query[0]);
Integer dest = nodes.get(query[1]);
if (src != null && dest != null) {
double val = relations[src][dest];
if (val != 0) {
res[i] = val;
}
}
}
return res;
}
// Union Find + Hash Table
// https://discuss.leetcode.com/topic/58577/0ms-c-union-find-solution-easy-to-understand/2
public double[] calcEquation5(String[][] equations, double[] values,
String[][] queries) {
Map<String, Integer> sets = new HashMap<>();
Map<String, Double> vals = new HashMap<>();
List<List<String> > list = new ArrayList<>();
for (int i = 0, n = 0; i < equations.length; i++) {
String a = equations[i][0];
Integer setA = sets.get(a);
String b = equations[i][1];
Integer setB = sets.get(b);
if (setA == null && setB == null) {
sets.put(a, n);
sets.put(b, n++);
vals.put(a, values[i]);
vals.put(b, 1.0);
list.add(new LinkedList<>(Arrays.asList(a, b)));
} else if (setB == null) {
sets.put(b, setA);
vals.put(b, vals.get(a) / values[i]);
list.get(setA).add(b);
} else if (setA == null) {
sets.put(a, setB);
vals.put(a, vals.get(b) * values[i]);
list.get(setB).add(a);
} else if (!setA.equals(setB)) {
double factor = vals.get(a) / values[i] / vals.get(b);
for (String x : list.get(setB)) {
sets.put(x, setA);
vals.put(x, vals.get(x) * factor);
}
}
}
double[] res = new double[queries.length];
for (int i = 0; i < queries.length; i++) {
Integer setA = sets.get(queries[i][0]);
Integer setB = sets.get(queries[i][1]);
res[i] = (setA != null && setA.equals(setB))
? vals.get(queries[i][0]) / vals.get(queries[i][1]) : -1;
}
return res;
}
@FunctionalInterface
interface Function<A, B, C, D> {
public D apply(A a, B b, C c);
}
void test(Function<String[][], double[], String[][], double[]> calc,
String[][] equations, double[] values, String[][] queries,
double ... expected) {
double[] res = calc.apply(equations, values, queries);
assertArrayEquals(expected, res, 1E-8);
}
void test(String[][] equations, double[] values, String[][] queries,
double ... expected) {
EvaluateDivision e = new EvaluateDivision();
test(e::calcEquation, equations, values, queries, expected);
test(e::calcEquation2, equations, values, queries, expected);
test(e::calcEquation3, equations, values, queries, expected);
test(e::calcEquation4, equations, values, queries, expected);
test(e::calcEquation5, equations, values, queries, expected);
}
@Test
public void test1() {
test(new String[][] {{"a", "b"}, {"b", "c"}}, new double[] {2.0, 3.0},
new String[][] {{"a", "c"}, {"b", "a"}, {"a", "e"}, {"a", "a"},
{"x", "x"}},
6.0, 0.5, -1.0, 1.0, -1.0);
test(new String[][] {{"x1","x2"},{"x2","x3"},{"x3","x4"},{"x4","x5"}},
new double[] {3.0,4.0,5.0,6.0},
new String[][] {{"x1","x5"}, {"x5","x2"}, {"x2","x4"}, {"x2","x2"},
{"x2","x9"}, {"x9","x9"}},
360, 0.00833333, 20, 1, -1, -1);
test(new String[][] {{"a", "b"}, {"e", "f"}, {"b", "e"}},
new double[] {3.4, 1.4, 2.3},
new String[][] {{"b", "a"}, {"a", "f"}, {"f", "f"}, {"e", "e"},
{"c", "c"}, {"a", "c"}, {"f", "e"}},
0.294117647, 10.948, 1, 1, -1, -1, 0.714285714);
}
public static void main(String[] args) {
org.junit.runner.JUnitCore.main("EvaluateDivision");
}
}
| [
"xyzdll@gmail.com"
] | xyzdll@gmail.com |
b613937894eed1c27148a666555641e5af1399f6 | 28bc610cfa9bd33e88937eb0b0343c975f24cf97 | /src/net/sourceforge/appgen/generator/StyleFileGenerator.java | 681603487687cf0ce9558de7a7981a27f4da2878 | [] | no_license | woozoo73/appgen | 5e4a882aea9852a9e97552247d958aabe75c0ab8 | add454b9998c556df83eab090c24f33919123439 | refs/heads/master | 2021-01-18T13:37:51.337500 | 2017-09-25T04:15:46 | 2017-09-25T04:15:46 | 80,606,884 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,847 | java | /*
* Copyright 2009 the original author or 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 net.sourceforge.appgen.generator;
import java.io.File;
import net.sourceforge.appgen.model.Entity;
import net.sourceforge.appgen.model.GenerationInformation;
import net.sourceforge.appgen.util.FileUtils;
/**
* @author Byeongkil Woo
*/
public class StyleFileGenerator extends OnceFileGenerator {
public static final String TEMPLATE = "style.css";
public StyleFileGenerator(GenerationInformation generationInformation) {
super(generationInformation);
}
public File generateFile(Entity entity, File in, File out) throws Exception {
FileUtils.copy(in, out);
return out;
}
@Override
public File generate(Entity entity) throws Exception {
if (!alreadyGenerated) {
alreadyGenerated = true;
return this.generateFile(entity, new File(templateDir.getPath(), TEMPLATE), getFile(entity));
}
return null;
}
@Override
public File getFile(Entity entity) {
return new File(getDirectory(), TEMPLATE);
}
@Override
public File getDirectory() {
return new File(outputDir.getPath() + File.separator + "WebContent" + File.separator + "css");
}
@Override
public String getTemplate() {
return TEMPLATE;
}
}
| [
"lab@lab"
] | lab@lab |
530b750fa2404f92d3f56508e7bccfdd7d1c3b53 | 16145411f7a6f5bff9a2d9b462221bed7981cdef | /app/src/main/java/com/example/missy/rate/MyList2Activity.java | 489142f2e41533e2d2188940eca0458adf8736b6 | [] | no_license | realmiss/Rate | 9673d0c89eb9d89ef921fc4f0c3c7026519cf600 | bffee1827e0d55fd883649dc4cce25973b4c7a8b | refs/heads/master | 2020-03-30T06:23:04.887088 | 2018-10-18T12:04:23 | 2018-10-18T12:04:23 | 150,856,836 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,869 | java | package com.example.missy.rate;
import android.app.ListActivity;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.widget.SimpleAdapter;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.io.IOException;
import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class MyList2Activity extends ListActivity implements Runnable{
Handler handler;
private ArrayList<HashMap<String, String>> listItems;
MyAdapter myAdapter;
private int msgWhat = 7;
private void initListView() {
listItems = new ArrayList<HashMap<String, String>>();
for (int i = 0; i < 10; i++) {
HashMap<String, String> map = new HashMap<String, String>();
map.put("ItemTitle", "Rate: " + i); // 标题文字
map.put("ItemDetail", "detail" + i); // 详情描述
listItems.add(map);
}
// 生成适配器的Item和动态数组对应的元素
myAdapter = new MyAdapter(this,R.layout.list_item,listItems);
}
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
initListView();
this.setListAdapter(myAdapter);
Thread t = new Thread(this); // 创建新线程
t.start(); // 开启线程
handler = new Handler() {
public void handleMessage(Message msg) {
if (msg.what == msgWhat) {
List<HashMap<String, String>> retList = (List<HashMap<String, String>>) msg.obj;
/* MyAdapter adapter = new MyAdapter(MyListActivity2.this,
R.layout.list_item,retList);*/// ListItem的XML布局实现
SimpleAdapter adapter = new SimpleAdapter(MyList2Activity.this, retList,
R.layout.list_item, // ListItem的XML布局实现
new String[]{"ItemTitle", "ItemDetail"},
new int[]{R.id.itemTitle, R.id.itemDetail});
setListAdapter(adapter);
Log.i("handler", "reset list...");
}
super.handleMessage(msg);
}
};
}
@Override
public void run() {
Log.i("thread", "run.....");
boolean marker = false;
List<HashMap<String, String>> rateList = new ArrayList<HashMap<String, String>>();
try {
Document doc = Jsoup.connect("http://www.usd-cny.com/icbc.htm").get();
Elements tbs = doc.getElementsByClass("tableDataTable");
Element table = tbs.get(0);
Elements tds = table.getElementsByTag("td");
for (int i = 0; i < tds.size(); i += 5) {
Element td = tds.get(i);
Element td2 = tds.get(i + 3);
String tdStr = td.text();
String pStr = td2.text();
HashMap<String, String> map = new HashMap<String, String>();
map.put("ItemTitle", tdStr);
map.put("ItemDetail", pStr);
rateList.add(map);
Log.i("td", tdStr + "=>" + pStr);
}
marker = true;
} catch (MalformedURLException e) {
Log.e("www", e.toString());
e.printStackTrace();
} catch (IOException e) {
Log.e("www", e.toString());
e.printStackTrace();
}
Message msg = handler.obtainMessage();
msg.what = msgWhat;
if (marker) {
msg.arg1 = 1;
} else {
msg.arg1 = 0;
}
msg.obj = rateList;
handler.sendMessage(msg);
Log.i("thread", "sendMessage.....");
}
}
| [
"854494748@qq.com"
] | 854494748@qq.com |
8c0559207fcddf905a60375ce3c020eccbab04af | b47489e86b1779013a98b18eb8430030dd7afb83 | /spring3.x/extraLib/xstream-1.4/xstream/src/test/com/thoughtworks/xstream/io/path/PathTrackingReaderTest.java | 29968f2a819000403deb5107743eb77593dd0b34 | [
"Apache-2.0",
"BSD-3-Clause"
] | permissive | cuiyuemin365/books | 66be7059d309745a8045426fc193439b95a288e4 | 4ffdd959b4fc894f085ee5e80031ff8f77d475e6 | refs/heads/master | 2023-01-09T19:30:48.718134 | 2021-04-08T07:52:00 | 2021-04-08T07:52:00 | 120,096,744 | 0 | 0 | Apache-2.0 | 2023-01-02T21:56:51 | 2018-02-03T14:08:45 | Java | UTF-8 | Java | false | false | 1,777 | java | /*
* Copyright (C) 2004, 2005 Joe Walnes.
* Copyright (C) 2006, 2007, 2009 XStream Committers.
* All rights reserved.
*
* The software in this package is published under the terms of the BSD
* style license a copy of which has been included with this distribution in
* the LICENSE.txt file.
*
* Created on 03. March 2004 by Joe Walnes
*/
package com.thoughtworks.xstream.io.path;
import com.thoughtworks.xstream.io.HierarchicalStreamReader;
import com.thoughtworks.xstream.io.xml.XppReader;
import junit.framework.TestCase;
import org.xmlpull.mxp1.MXParser;
import java.io.Reader;
import java.io.StringReader;
public class PathTrackingReaderTest extends TestCase {
public void testDecoratesReaderAndTracksPath() {
Reader input = new StringReader("" +
"<a>" +
" <b><c/></b>" +
" <b/>" +
" <d/>" +
"</a>");
HierarchicalStreamReader reader = new XppReader(input, new MXParser());
PathTracker pathTracker = new PathTracker();
reader = new PathTrackingReader(reader, pathTracker);
assertEquals(new Path("/a"), pathTracker.getPath());
reader.moveDown();
assertEquals(new Path("/a/b"), pathTracker.getPath());
reader.moveDown();
assertEquals(new Path("/a/b/c"), pathTracker.getPath());
reader.moveUp();
assertEquals(new Path("/a/b"), pathTracker.getPath());
reader.moveUp();
reader.moveDown();
assertEquals(new Path("/a/b[2]"), pathTracker.getPath());
reader.moveUp();
reader.moveDown();
assertEquals(new Path("/a/d"), pathTracker.getPath());
reader.moveUp();
assertEquals(new Path("/a"), pathTracker.getPath());
}
}
| [
"cuiyuemin@mofanghr.com"
] | cuiyuemin@mofanghr.com |
178f4296e01c412bd1b3a54334dc59b658d395cd | 012e9bd5bfbc5ceca4e36af55a7ddf4fce98b403 | /code/wallet_demo/src/main/java/com/yzb/card_wallet/AuthorizeActivity.java | 5bbf77c85ddc991f48f17590c7cd0fb782bf0c88 | [] | no_license | litliang/ms | a7152567c2f0e4d663efdda39503642edd33b4b6 | d7483bc76d43e060906c47acc1bc2c3179838249 | refs/heads/master | 2021-09-01T23:51:50.934321 | 2017-12-29T07:30:49 | 2017-12-29T07:30:49 | 115,697,248 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,477 | java | package com.yzb.card_wallet;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import com.yzb.R;
import com.yzb.wallet.openInterface.PayAuthorizeHandle;
import com.yzb.wallet.openInterface.WalletBackListener;
import com.yzb.wallet.util.StringUtil;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Pattern;
public class AuthorizeActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_old_authorize);
final EditText amount = (EditText) findViewById(R.id.amount);
amount.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
String amountStr = amount.getText().toString();
String temp = s.toString();
int len = temp.length();
// 如果第一位是0则第二位不允许输入数字
if (len == 2 && "0".equals(temp.substring(0, 1))) {
if (Pattern.matches("(\\d)", temp.substring(1, 2)))
s.delete(1, 2);
}
// 保留2位小数
int posDot = temp.indexOf(".");
if (posDot == 0) s.clear();
if (posDot < 0) return;
if (temp.length() - posDot - 1 > 2) {
s.delete(posDot + 3, posDot + 4);
}
}
});
((Button) findViewById(R.id.settleBtn)).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
TextView creditId = (TextView) findViewById(R.id.creditId);
TextView amount = (TextView) findViewById(R.id.amount);
TextView summary = (TextView) findViewById(R.id.summary);
TextView sessionId = (TextView) findViewById(R.id.sessionId);
TextView UUID = (TextView) findViewById(R.id.UUID);
Map<String, String> params = new HashMap<String, String>();
// 授权支付
params.put("creditId", creditId.getText().toString());
String amountStr = amount.getText().toString();
amountStr = StringUtil.isEmpty(amountStr) ? "" : new BigDecimal(amountStr).setScale(2).toString();
params.put("amount", amountStr);
params.put("summary", summary.getText().toString());
params.put("sessionId", sessionId.getText().toString());
params.put("UUID", UUID.getText().toString());
PayAuthorizeHandle payHandle = new PayAuthorizeHandle(AuthorizeActivity.this);
payHandle.pay(params);
payHandle.setCallBack(new WalletBackListener() {
@Override
public void setSuccess(String RESULT_CODE) {
System.out.println("======授权支付=======>" + RESULT_CODE);
WalletToastCustom.sendDialog(AuthorizeActivity.this, getWindow().peekDecorView(), "支付成功", 140);
}
@Override
public void setSuccess(Map<String, String> resultMap, String RESULT_CODE) {
}
@Override
public void setError(String RESULT_CODE, String ERROR_MSG) {
System.out.println("======授权支付=======>" + RESULT_CODE);
WalletToastCustom.sendDialog(AuthorizeActivity.this, getWindow().peekDecorView(), ERROR_MSG, 140);
}
});
}
});
((Button) findViewById(R.id.back)).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
setResult(0x0);
finish();
}
});
}
}
| [
"litliang@126.com"
] | litliang@126.com |
10611e1485e2d56bc5c7fcca965e38959acccab5 | 762a01b9b544344a6b49009e24f689241f43313e | /GiftCertificateService/src/ws/ActivateGiftCertificateRes.java | 20aa71ba9e005c7f870b6c786aad248bdace6805 | [] | no_license | anshukas/rough-project | 47d26f7e7c0d1a45b23564669ce5aa87aed84dc9 | 69759d1fd5e94a5768d4d95744d006648ffc0041 | refs/heads/master | 2021-10-27T10:20:55.465268 | 2021-10-15T14:48:40 | 2021-10-15T14:48:40 | 88,153,616 | 0 | 0 | null | 2021-10-15T14:36:34 | 2017-04-13T10:30:18 | Java | UTF-8 | Java | false | false | 793 | java | package ws;
public class ActivateGiftCertificateRes implements java.io.Serializable {
/**
*
*/
private static final long serialVersionUID = -5672331925390293736L;
private ws.GiftCertificate[] giftCertificate;
private ws.Result result;
public ActivateGiftCertificateRes() {
}
public ActivateGiftCertificateRes(GiftCertificate[] giftCertificate,
Result result) {
super();
this.giftCertificate = giftCertificate;
this.result = result;
}
public ws.Result getResult() {
return result;
}
public void setResult(ws.Result result) {
this.result = result;
}
public ws.GiftCertificate[] getGiftCertificate() {
return giftCertificate;
}
public void setGiftCertificate(ws.GiftCertificate[] giftCertificate) {
this.giftCertificate = giftCertificate;
}
}
| [
"anshubtechinit@gmail.com"
] | anshubtechinit@gmail.com |
331a7b24693a90af96018d8b0abb3f4044e61328 | 8375c46ae4a2c74007a24fb740386e177d7e4853 | /week01/17413_semi-cloud.java | 87d8d95a55cc7a59a07c1d5d7ddfc2fd43044fd4 | [] | no_license | hyeji1221/SMU_Algorithm | 36f96f3423a8cc6e82511d4aa7ba481e76f59c8d | 7d22529b2467e8c2c6f25770a7926bdf0c419b0d | refs/heads/main | 2023-08-13T22:00:20.139790 | 2021-10-10T14:02:12 | 2021-10-10T14:02:12 | 348,924,731 | 4 | 1 | null | null | null | null | UTF-8 | Java | false | false | 890 | java | import java.io.*;
import java.util.Stack;
public class Main {
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter wr = new BufferedWriter(new OutputStreamWriter(System.out));
Stack<Character> stack = new Stack<>();
char[] arr = (br.readLine() + "\n").toCharArray();
boolean istag = false;
for(int i = 0; i < arr.length; ++i){
char c = arr[i];
if(c == '<') istag = true;
if(istag || c == ' ' || c == '\n'){
while(!stack.isEmpty()){
wr.write(stack.pop());
}
if(c != '\n') wr.write(c);
} else {
stack.push(c);
}
if(c == '>') istag = false;
}
wr.flush();
}
}
| [
"noreply@github.com"
] | noreply@github.com |
3b89315969bbeae3f27e16d783852b9bbefa0374 | 137584bc6911e100d3ebdec79723ca70716415ca | /src/shape/Square.java | f00c10603ef539533ac93f833ba56a2cfe1fd6f1 | [] | no_license | dudq/m2_inheritance | 4d5e3d6281523935a72e731da58a19ef7c282945 | 0f51eef0f07a81c9fc22280d1713ec8fccc90378 | refs/heads/master | 2020-08-31T14:09:54.775685 | 2019-10-31T09:46:15 | 2019-10-31T09:46:15 | 218,707,896 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 821 | java | package shape;
public class Square extends Rectangle {
public Square() {
}
public Square(double side) {
super(side, side);
}
public Square(String color, boolean filled, double side) {
super(color, filled, side, side);
}
public double getSide() {
return super.getWidth();
}
public void setSide(double side) {
super.setWidth(side);
super.setHeight(side);
}
@Override
public void setWidth(double width) {
setSide(width);
}
@Override
public void setHeight(double height) {
setSide(height);
}
@Override
public String toString() {
return "A square with side = "
+ this.getSide()
+ ", which a subclass of "
+ super.toString();
}
}
| [
"dudq.xmt@gmail.com"
] | dudq.xmt@gmail.com |
643c57f6a532d89ae76571e0ea13a124b5179d2d | 74b47b895b2f739612371f871c7f940502e7165b | /aws-java-sdk-rekognition/src/main/java/com/amazonaws/services/rekognition/model/GetContentModerationResult.java | 331a5d23ce8ce7875ca5a9ea2e305a9d4eb7ef8d | [
"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 | 17,176 | 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.rekognition.model;
import java.io.Serializable;
import javax.annotation.Generated;
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class GetContentModerationResult extends com.amazonaws.AmazonWebServiceResult<com.amazonaws.ResponseMetadata> implements Serializable, Cloneable {
/**
* <p>
* The current status of the content moderation analysis job.
* </p>
*/
private String jobStatus;
/**
* <p>
* If the job fails, <code>StatusMessage</code> provides a descriptive error message.
* </p>
*/
private String statusMessage;
/**
* <p>
* Information about a video that Amazon Rekognition analyzed. <code>Videometadata</code> is returned in every page
* of paginated responses from <code>GetContentModeration</code>.
* </p>
*/
private VideoMetadata videoMetadata;
/**
* <p>
* The detected inappropriate, unwanted, or offensive content moderation labels and the time(s) they were detected.
* </p>
*/
private java.util.List<ContentModerationDetection> moderationLabels;
/**
* <p>
* If the response is truncated, Amazon Rekognition Video returns this token that you can use in the subsequent
* request to retrieve the next set of content moderation labels.
* </p>
*/
private String nextToken;
/**
* <p>
* Version number of the moderation detection model that was used to detect inappropriate, unwanted, or offensive
* content.
* </p>
*/
private String moderationModelVersion;
/**
* <p>
* The current status of the content moderation analysis job.
* </p>
*
* @param jobStatus
* The current status of the content moderation analysis job.
* @see VideoJobStatus
*/
public void setJobStatus(String jobStatus) {
this.jobStatus = jobStatus;
}
/**
* <p>
* The current status of the content moderation analysis job.
* </p>
*
* @return The current status of the content moderation analysis job.
* @see VideoJobStatus
*/
public String getJobStatus() {
return this.jobStatus;
}
/**
* <p>
* The current status of the content moderation analysis job.
* </p>
*
* @param jobStatus
* The current status of the content moderation analysis job.
* @return Returns a reference to this object so that method calls can be chained together.
* @see VideoJobStatus
*/
public GetContentModerationResult withJobStatus(String jobStatus) {
setJobStatus(jobStatus);
return this;
}
/**
* <p>
* The current status of the content moderation analysis job.
* </p>
*
* @param jobStatus
* The current status of the content moderation analysis job.
* @return Returns a reference to this object so that method calls can be chained together.
* @see VideoJobStatus
*/
public GetContentModerationResult withJobStatus(VideoJobStatus jobStatus) {
this.jobStatus = jobStatus.toString();
return this;
}
/**
* <p>
* If the job fails, <code>StatusMessage</code> provides a descriptive error message.
* </p>
*
* @param statusMessage
* If the job fails, <code>StatusMessage</code> provides a descriptive error message.
*/
public void setStatusMessage(String statusMessage) {
this.statusMessage = statusMessage;
}
/**
* <p>
* If the job fails, <code>StatusMessage</code> provides a descriptive error message.
* </p>
*
* @return If the job fails, <code>StatusMessage</code> provides a descriptive error message.
*/
public String getStatusMessage() {
return this.statusMessage;
}
/**
* <p>
* If the job fails, <code>StatusMessage</code> provides a descriptive error message.
* </p>
*
* @param statusMessage
* If the job fails, <code>StatusMessage</code> provides a descriptive error message.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public GetContentModerationResult withStatusMessage(String statusMessage) {
setStatusMessage(statusMessage);
return this;
}
/**
* <p>
* Information about a video that Amazon Rekognition analyzed. <code>Videometadata</code> is returned in every page
* of paginated responses from <code>GetContentModeration</code>.
* </p>
*
* @param videoMetadata
* Information about a video that Amazon Rekognition analyzed. <code>Videometadata</code> is returned in
* every page of paginated responses from <code>GetContentModeration</code>.
*/
public void setVideoMetadata(VideoMetadata videoMetadata) {
this.videoMetadata = videoMetadata;
}
/**
* <p>
* Information about a video that Amazon Rekognition analyzed. <code>Videometadata</code> is returned in every page
* of paginated responses from <code>GetContentModeration</code>.
* </p>
*
* @return Information about a video that Amazon Rekognition analyzed. <code>Videometadata</code> is returned in
* every page of paginated responses from <code>GetContentModeration</code>.
*/
public VideoMetadata getVideoMetadata() {
return this.videoMetadata;
}
/**
* <p>
* Information about a video that Amazon Rekognition analyzed. <code>Videometadata</code> is returned in every page
* of paginated responses from <code>GetContentModeration</code>.
* </p>
*
* @param videoMetadata
* Information about a video that Amazon Rekognition analyzed. <code>Videometadata</code> is returned in
* every page of paginated responses from <code>GetContentModeration</code>.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public GetContentModerationResult withVideoMetadata(VideoMetadata videoMetadata) {
setVideoMetadata(videoMetadata);
return this;
}
/**
* <p>
* The detected inappropriate, unwanted, or offensive content moderation labels and the time(s) they were detected.
* </p>
*
* @return The detected inappropriate, unwanted, or offensive content moderation labels and the time(s) they were
* detected.
*/
public java.util.List<ContentModerationDetection> getModerationLabels() {
return moderationLabels;
}
/**
* <p>
* The detected inappropriate, unwanted, or offensive content moderation labels and the time(s) they were detected.
* </p>
*
* @param moderationLabels
* The detected inappropriate, unwanted, or offensive content moderation labels and the time(s) they were
* detected.
*/
public void setModerationLabels(java.util.Collection<ContentModerationDetection> moderationLabels) {
if (moderationLabels == null) {
this.moderationLabels = null;
return;
}
this.moderationLabels = new java.util.ArrayList<ContentModerationDetection>(moderationLabels);
}
/**
* <p>
* The detected inappropriate, unwanted, or offensive content moderation labels and the time(s) they were detected.
* </p>
* <p>
* <b>NOTE:</b> This method appends the values to the existing list (if any). Use
* {@link #setModerationLabels(java.util.Collection)} or {@link #withModerationLabels(java.util.Collection)} if you
* want to override the existing values.
* </p>
*
* @param moderationLabels
* The detected inappropriate, unwanted, or offensive content moderation labels and the time(s) they were
* detected.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public GetContentModerationResult withModerationLabels(ContentModerationDetection... moderationLabels) {
if (this.moderationLabels == null) {
setModerationLabels(new java.util.ArrayList<ContentModerationDetection>(moderationLabels.length));
}
for (ContentModerationDetection ele : moderationLabels) {
this.moderationLabels.add(ele);
}
return this;
}
/**
* <p>
* The detected inappropriate, unwanted, or offensive content moderation labels and the time(s) they were detected.
* </p>
*
* @param moderationLabels
* The detected inappropriate, unwanted, or offensive content moderation labels and the time(s) they were
* detected.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public GetContentModerationResult withModerationLabels(java.util.Collection<ContentModerationDetection> moderationLabels) {
setModerationLabels(moderationLabels);
return this;
}
/**
* <p>
* If the response is truncated, Amazon Rekognition Video returns this token that you can use in the subsequent
* request to retrieve the next set of content moderation labels.
* </p>
*
* @param nextToken
* If the response is truncated, Amazon Rekognition Video returns this token that you can use in the
* subsequent request to retrieve the next set of content moderation labels.
*/
public void setNextToken(String nextToken) {
this.nextToken = nextToken;
}
/**
* <p>
* If the response is truncated, Amazon Rekognition Video returns this token that you can use in the subsequent
* request to retrieve the next set of content moderation labels.
* </p>
*
* @return If the response is truncated, Amazon Rekognition Video returns this token that you can use in the
* subsequent request to retrieve the next set of content moderation labels.
*/
public String getNextToken() {
return this.nextToken;
}
/**
* <p>
* If the response is truncated, Amazon Rekognition Video returns this token that you can use in the subsequent
* request to retrieve the next set of content moderation labels.
* </p>
*
* @param nextToken
* If the response is truncated, Amazon Rekognition Video returns this token that you can use in the
* subsequent request to retrieve the next set of content moderation labels.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public GetContentModerationResult withNextToken(String nextToken) {
setNextToken(nextToken);
return this;
}
/**
* <p>
* Version number of the moderation detection model that was used to detect inappropriate, unwanted, or offensive
* content.
* </p>
*
* @param moderationModelVersion
* Version number of the moderation detection model that was used to detect inappropriate, unwanted, or
* offensive content.
*/
public void setModerationModelVersion(String moderationModelVersion) {
this.moderationModelVersion = moderationModelVersion;
}
/**
* <p>
* Version number of the moderation detection model that was used to detect inappropriate, unwanted, or offensive
* content.
* </p>
*
* @return Version number of the moderation detection model that was used to detect inappropriate, unwanted, or
* offensive content.
*/
public String getModerationModelVersion() {
return this.moderationModelVersion;
}
/**
* <p>
* Version number of the moderation detection model that was used to detect inappropriate, unwanted, or offensive
* content.
* </p>
*
* @param moderationModelVersion
* Version number of the moderation detection model that was used to detect inappropriate, unwanted, or
* offensive content.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public GetContentModerationResult withModerationModelVersion(String moderationModelVersion) {
setModerationModelVersion(moderationModelVersion);
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getJobStatus() != null)
sb.append("JobStatus: ").append(getJobStatus()).append(",");
if (getStatusMessage() != null)
sb.append("StatusMessage: ").append(getStatusMessage()).append(",");
if (getVideoMetadata() != null)
sb.append("VideoMetadata: ").append(getVideoMetadata()).append(",");
if (getModerationLabels() != null)
sb.append("ModerationLabels: ").append(getModerationLabels()).append(",");
if (getNextToken() != null)
sb.append("NextToken: ").append(getNextToken()).append(",");
if (getModerationModelVersion() != null)
sb.append("ModerationModelVersion: ").append(getModerationModelVersion());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof GetContentModerationResult == false)
return false;
GetContentModerationResult other = (GetContentModerationResult) obj;
if (other.getJobStatus() == null ^ this.getJobStatus() == null)
return false;
if (other.getJobStatus() != null && other.getJobStatus().equals(this.getJobStatus()) == false)
return false;
if (other.getStatusMessage() == null ^ this.getStatusMessage() == null)
return false;
if (other.getStatusMessage() != null && other.getStatusMessage().equals(this.getStatusMessage()) == false)
return false;
if (other.getVideoMetadata() == null ^ this.getVideoMetadata() == null)
return false;
if (other.getVideoMetadata() != null && other.getVideoMetadata().equals(this.getVideoMetadata()) == false)
return false;
if (other.getModerationLabels() == null ^ this.getModerationLabels() == null)
return false;
if (other.getModerationLabels() != null && other.getModerationLabels().equals(this.getModerationLabels()) == false)
return false;
if (other.getNextToken() == null ^ this.getNextToken() == null)
return false;
if (other.getNextToken() != null && other.getNextToken().equals(this.getNextToken()) == false)
return false;
if (other.getModerationModelVersion() == null ^ this.getModerationModelVersion() == null)
return false;
if (other.getModerationModelVersion() != null && other.getModerationModelVersion().equals(this.getModerationModelVersion()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getJobStatus() == null) ? 0 : getJobStatus().hashCode());
hashCode = prime * hashCode + ((getStatusMessage() == null) ? 0 : getStatusMessage().hashCode());
hashCode = prime * hashCode + ((getVideoMetadata() == null) ? 0 : getVideoMetadata().hashCode());
hashCode = prime * hashCode + ((getModerationLabels() == null) ? 0 : getModerationLabels().hashCode());
hashCode = prime * hashCode + ((getNextToken() == null) ? 0 : getNextToken().hashCode());
hashCode = prime * hashCode + ((getModerationModelVersion() == null) ? 0 : getModerationModelVersion().hashCode());
return hashCode;
}
@Override
public GetContentModerationResult clone() {
try {
return (GetContentModerationResult) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
}
| [
""
] | |
ce9235e323f96bb89e6d56e5d3317f3154de54f2 | bf2966abae57885c29e70852243a22abc8ba8eb0 | /aws-java-sdk-mgn/src/main/java/com/amazonaws/services/mgn/model/ParticipatingServer.java | d1fe7e789bee4d7fa57a1377c8d1b62060ae88d9 | [
"Apache-2.0"
] | permissive | kmbotts/aws-sdk-java | ae20b3244131d52b9687eb026b9c620da8b49935 | 388f6427e00fb1c2f211abda5bad3a75d29eef62 | refs/heads/master | 2021-12-23T14:39:26.369661 | 2021-07-26T20:09:07 | 2021-07-26T20:09:07 | 246,296,939 | 0 | 0 | Apache-2.0 | 2020-03-10T12:37:34 | 2020-03-10T12:37:33 | null | UTF-8 | Java | false | false | 6,190 | java | /*
* Copyright 2016-2021 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.mgn.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
* <p>
* Server participating in Job.
* </p>
*
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mgn-2020-02-26/ParticipatingServer" target="_top">AWS API
* Documentation</a>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class ParticipatingServer implements Serializable, Cloneable, StructuredPojo {
/**
* <p>
* Participating server launch status.
* </p>
*/
private String launchStatus;
/**
* <p>
* Participating server Source Server ID.
* </p>
*/
private String sourceServerID;
/**
* <p>
* Participating server launch status.
* </p>
*
* @param launchStatus
* Participating server launch status.
* @see LaunchStatus
*/
public void setLaunchStatus(String launchStatus) {
this.launchStatus = launchStatus;
}
/**
* <p>
* Participating server launch status.
* </p>
*
* @return Participating server launch status.
* @see LaunchStatus
*/
public String getLaunchStatus() {
return this.launchStatus;
}
/**
* <p>
* Participating server launch status.
* </p>
*
* @param launchStatus
* Participating server launch status.
* @return Returns a reference to this object so that method calls can be chained together.
* @see LaunchStatus
*/
public ParticipatingServer withLaunchStatus(String launchStatus) {
setLaunchStatus(launchStatus);
return this;
}
/**
* <p>
* Participating server launch status.
* </p>
*
* @param launchStatus
* Participating server launch status.
* @return Returns a reference to this object so that method calls can be chained together.
* @see LaunchStatus
*/
public ParticipatingServer withLaunchStatus(LaunchStatus launchStatus) {
this.launchStatus = launchStatus.toString();
return this;
}
/**
* <p>
* Participating server Source Server ID.
* </p>
*
* @param sourceServerID
* Participating server Source Server ID.
*/
public void setSourceServerID(String sourceServerID) {
this.sourceServerID = sourceServerID;
}
/**
* <p>
* Participating server Source Server ID.
* </p>
*
* @return Participating server Source Server ID.
*/
public String getSourceServerID() {
return this.sourceServerID;
}
/**
* <p>
* Participating server Source Server ID.
* </p>
*
* @param sourceServerID
* Participating server Source Server ID.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ParticipatingServer withSourceServerID(String sourceServerID) {
setSourceServerID(sourceServerID);
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getLaunchStatus() != null)
sb.append("LaunchStatus: ").append(getLaunchStatus()).append(",");
if (getSourceServerID() != null)
sb.append("SourceServerID: ").append(getSourceServerID());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof ParticipatingServer == false)
return false;
ParticipatingServer other = (ParticipatingServer) obj;
if (other.getLaunchStatus() == null ^ this.getLaunchStatus() == null)
return false;
if (other.getLaunchStatus() != null && other.getLaunchStatus().equals(this.getLaunchStatus()) == false)
return false;
if (other.getSourceServerID() == null ^ this.getSourceServerID() == null)
return false;
if (other.getSourceServerID() != null && other.getSourceServerID().equals(this.getSourceServerID()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getLaunchStatus() == null) ? 0 : getLaunchStatus().hashCode());
hashCode = prime * hashCode + ((getSourceServerID() == null) ? 0 : getSourceServerID().hashCode());
return hashCode;
}
@Override
public ParticipatingServer clone() {
try {
return (ParticipatingServer) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.mgn.model.transform.ParticipatingServerMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}
| [
""
] | |
6f17a85476292ed91ea6147c4d17c48cac7f2384 | 8c88a17ef68d0312b61ff1b29519531ea32b0994 | /src/ex7/test/LinkEntity_isOccupiedValueTest.java | 0a04176ee2353542dcd0b9a99526bfe3d7bd68d6 | [] | no_license | PascalGe/Informatik-II | 000dcd043d93d719a385882cd606505fe5bf12eb | 3c8eba2a5a251bd2b2d2f4185c11fb26abae6f35 | refs/heads/master | 2020-05-16T09:38:10.189747 | 2019-07-11T05:52:30 | 2019-07-11T05:52:30 | 182,955,548 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 353 | java | package ex7.test;
import org.junit.jupiter.api.Test;
import ex7.main.Snake;
import junit.framework.TestCase;
class LinkEntity_isOccupiedValueTest extends TestCase {
@Test
void test() {
Snake snake = new Snake(2, 1, 1, 1);
snake.setNext(new Snake(2, 2, 1, 1));
boolean b = snake.isOccupied(2, 1);
assertEquals(true, b);
}
} | [
"i13004@hb.dhbw-stuttgart.de"
] | i13004@hb.dhbw-stuttgart.de |
5193875d6dc07a3cc3a61c407d68ccde99835ca3 | a80689755a42985d372ff78e1edcf8bdd7623b5b | /app/src/main/java/com/wilbrom/movieudacity/utilities/JsonUtils.java | 2632970150a2cd707ed9c3101558bb973c66dbcd | [] | no_license | willbrom/MovieUdacity | d87529dad9e3b2cd848eaeb3391e4b1d86129b87 | 7f0ef6c90ce691ffd7463bd9a0bc4952d531e5bd | refs/heads/master | 2021-04-28T10:30:55.177443 | 2020-12-02T10:03:51 | 2020-12-02T10:03:51 | 122,067,266 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,592 | java | package com.wilbrom.movieudacity.utilities;
import com.wilbrom.movieudacity.models.Genre;
import com.wilbrom.movieudacity.models.Movies;
import com.wilbrom.movieudacity.models.Results;
import com.wilbrom.movieudacity.models.Reviews;
import com.wilbrom.movieudacity.models.Videos;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
public class JsonUtils {
public static Movies parseMovieJson(String rawJson) {
Movies movies = null;
Results results = null;
List<Results> resultsList = new ArrayList<>();
try {
movies = new Movies();
JSONObject rootObject = new JSONObject(rawJson);
JSONArray resultsArray = rootObject.getJSONArray("results");
movies.setPage(rootObject.getInt("page"));
movies.setTotalResults(rootObject.getInt("total_results"));
movies.setTotalPages(rootObject.getInt("total_pages"));
int[] genreId = null;
for (int i = 0; i < resultsArray.length(); i++) {
results = new Results();
JSONArray genreIds = resultsArray.getJSONObject(i).getJSONArray("genre_ids");
genreId = new int[genreIds.length()];
results.setVoteCount(resultsArray.getJSONObject(i).getInt("vote_count"));
results.setId(resultsArray.getJSONObject(i).getInt("id"));
results.setVideo(resultsArray.getJSONObject(i).getBoolean("video"));
results.setVoteAverage(resultsArray.getJSONObject(i).getDouble("vote_average"));
results.setTitle(resultsArray.getJSONObject(i).getString("title"));
results.setPopularity(resultsArray.getJSONObject(i).getDouble("popularity"));
results.setPosterPath(resultsArray.getJSONObject(i).getString("poster_path"));
results.setOriginalLanguage(resultsArray.getJSONObject(i).getString("original_language"));
results.setOriginalTitle(resultsArray.getJSONObject(i).getString("original_title"));
results.setBackdropPath(resultsArray.getJSONObject(i).getString("backdrop_path"));
results.setAdult(resultsArray.getJSONObject(i).getBoolean("adult"));
results.setOverView(resultsArray.getJSONObject(i).getString("overview"));
results.setReleaseDate(resultsArray.getJSONObject(i).getString("release_date"));
for (int j = 0; j < genreIds.length(); j++) {
genreId[j] = genreIds.getInt(j);
}
results.setGenreIds(genreId);
resultsList.add(results);
}
movies.setResults(resultsList);
} catch (JSONException e) {
e.printStackTrace();
}
return movies;
}
public static Reviews parseReviewJson(String rawJson) {
Reviews reviews = null;
try {
reviews = new Reviews();
JSONObject rootObject = new JSONObject(rawJson);
reviews.setId(rootObject.getInt("id"));
reviews.setPage(rootObject.getInt("page"));
reviews.setTotalPages(rootObject.getInt("total_pages"));
reviews.setTotalResults(rootObject.getInt("total_results"));
JSONArray resultsArray = rootObject.getJSONArray("results");
for (int i = 0; i < resultsArray.length(); i++) {
JSONObject resultObj = resultsArray.getJSONObject(i);
reviews.setReviewsResults(resultObj.getString("id"),
resultObj.getString("author"),
resultObj.getString("content"),
resultObj.getString("url"));
}
} catch (JSONException e) {
e.printStackTrace();
}
return reviews;
}
public static Videos parseVideoJson(String rawJson) {
Videos videos = null;
try {
videos = new Videos();
JSONObject rootObject = new JSONObject(rawJson);
videos.setId(rootObject.getInt("id"));
JSONArray resultsArray = rootObject.getJSONArray("results");
for (int i = 0; i < resultsArray.length(); i++) {
JSONObject resultObj = resultsArray.getJSONObject(i);
videos.addVideoResultsListItem(resultObj.getString("id"),
resultObj.getString("iso_639_1"),
resultObj.getString("iso_3166_1"),
resultObj.getString("key"),
resultObj.getString("name"),
resultObj.getString("site"),
resultObj.getInt("size"),
resultObj.getString("type"));
}
} catch (JSONException e) {
e.printStackTrace();
}
return videos;
}
public static ArrayList<Genre> parseGenreJson(String rawJson) {
ArrayList<Genre> genreList = new ArrayList<>();
try {
JSONObject rootObject = new JSONObject(rawJson);
JSONArray genreArray = rootObject.getJSONArray("genres");
for (int i = 0; i < genreArray.length(); i++) {
int id = genreArray.getJSONObject(i).getInt("id");
String name = genreArray.getJSONObject(i).getString("name");
genreList.add(new Genre(name, id));
}
} catch (JSONException e) {
e.printStackTrace();
}
return genreList;
}
}
| [
"alisajid552@yahoo.com"
] | alisajid552@yahoo.com |
6f220c89d04f8ffe51d58478d2d41ecf01fdee2e | 2701bf3fb86709da49fbb622cef7bcc2889972ab | /cubeexchange-web-api/src/test/java/com/cubeexchange/web/api/rabbitmq/rabbitmqTest.java | 18bc35ada244bc5a1f3d63a0a2d11e8dd85622d5 | [] | no_license | alimogh/forResume | 76037563f034d21e69ac49e00d462356292c872c | 8fb56c91167594b49f1f33375a44aa7dba6b3e9b | refs/heads/master | 2022-04-13T13:15:45.302665 | 2020-01-23T06:27:37 | 2020-01-23T06:27:37 | 272,169,212 | 1 | 0 | null | 2020-06-14T09:18:34 | 2020-06-14T09:18:33 | null | UTF-8 | Java | false | false | 1,112 | java | package com.cubeexchange.web.api.rabbitmq;
import com.cubeexchange.web.api.CubeexchangeWebApiApplication;
import org.junit.Test;
// import org.springframework.amqp.rabbit.connection.CachingConnectionFactory;
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ActiveProfiles;
@ActiveProfiles("local")
public class rabbitmqTest {
@Test
public void sendMessageTest() {
RabbitTemplate rabbitTemplate = new RabbitTemplate();
CachingConnectionFactory factory = new CachingConnectionFactory("192.168.56.101", 5672);
factory.setUsername("rabbitmq");
factory.setPassword("0909");
SampleMessage message = new SampleMessage();
message.setName("smsService");
message.setContent("test content!!!!!");
rabbitTemplate.setExchange("test-queue-1-exchange");
rabbitTemplate.setQueue("test-queue-1");
rabbitTemplate.convertAndSend(message);
}
}
| [
"jane@JANEui-MacBookPro.local"
] | jane@JANEui-MacBookPro.local |
8c7d75595839f4e8fe7c44c57f2b616ac21d4173 | 3b2ce1c290241e59f7c052dd3c0a6e565067405b | /GitAssociated/src/Thirteenth/Test.java | 4eafb4e6901ff182710b9f6b54c01b2d881139d9 | [
"MIT"
] | permissive | BitWeb17/LectureContents | 85d2d770a56acab425fd9854788d09eeb4ab3f02 | f28bb554847fa15ba462b29db1f728f1f924524e | refs/heads/main | 2023-03-08T21:35:11.793619 | 2021-02-26T05:25:07 | 2021-02-26T05:25:07 | 325,429,451 | 25 | 9 | null | null | null | null | UTF-8 | Java | false | false | 484 | java | package Thirteenth;
public class Test {
public static void main(String[] args) {
if(3 > 5) {
System.out.println("3이 더 크다.");
}
// A, B 클래스 내부에 value 값이 가정
// A, B를 비교하고 싶은것
// if(A.getValue() > B.getValue())
// A, B -> C, D -> E, F -> value
// A.getC().getTest().getValue() > B.getD().getF().getValue()
// A.compareTo(B)
// 핵심: 재활용
}
}
| [
"gcccompil3r@gmail.com"
] | gcccompil3r@gmail.com |
0487253ad9f782818ccc5b3aaacf9836b0ae3bf7 | 20fee383d53193524bd4dd8a32c8a2b63274d7e1 | /android/src/ti/compression/Constants.java | cb2582f8697be23a0e2f2f66e3dc790a111272e1 | [
"Apache-2.0"
] | permissive | markive/ti.compression | f69511b51c1337c24b43b512c687204f685ea9bd | 123f8e3b4e396b39e9ceaf30e361497d9c0c849d | refs/heads/master | 2021-01-18T01:46:09.590150 | 2018-04-06T09:36:48 | 2018-04-06T09:36:48 | 65,665,642 | 2 | 0 | null | 2016-08-14T12:40:22 | 2016-08-14T12:40:22 | null | UTF-8 | Java | false | false | 382 | java | /**
* Ti.Compression Module
* Copyright (c) 2010-2013 by Appcelerator, Inc. All Rights Reserved.
* Please see the LICENSE included with this distribution for details.
*/
package ti.compression;
import org.appcelerator.kroll.common.TiConfig;
public class Constants
{
public static final String LCAT = "CompressionModule";
public static final boolean DBG = TiConfig.LOGD;
} | [
"jon@local"
] | jon@local |
2ff160593b5f65f0bdf68d68fc1b7160848661a9 | 9beb8a4399e206f026c17dbf6542a8db19037793 | /src/main/java/com/thebubblenetwork/bubblebungee/command/commands/TokenCommand.java | 7b4963642cf780049620e1bbf3b334649ccdc527 | [] | no_license | BubbleNetwork/BubbleBungee | a0c1febb592913a5fef002e77f36747914d3b5d4 | ed1df876f7fdbcfd127bf36e5be72cb7fc11b3de | refs/heads/master | 2016-09-01T04:17:23.907266 | 2016-05-08T07:39:35 | 2016-05-08T07:39:35 | 49,325,049 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,289 | java | package com.thebubblenetwork.bubblebungee.command.commands;
import com.thebubblenetwork.api.global.data.PlayerData;
import com.thebubblenetwork.api.global.sql.SQLConnection;
import com.thebubblenetwork.api.global.sql.SQLUtil;
import com.thebubblenetwork.bubblebungee.BubbleBungee;
import com.thebubblenetwork.bubblebungee.command.CommandException;
import com.thebubblenetwork.bubblebungee.command.SimpleCommand;
import com.thebubblenetwork.bubblebungee.player.ProxiedBubblePlayer;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.UUID;
import java.util.logging.Level;
/**
* The Bubble Network 2016
* BubbleBungee
* 16/02/2016 {21:16}
* Created February 2016
*/
public class TokenCommand extends SimpleCommand {
private static BubbleBungee instance = BubbleBungee.getInstance();
public TokenCommand() {
super("tokens", null, "/tokens [other]", "token", "gettokens");
}
public BaseComponent[] Iexecute(CommandSender sender, String[] args) throws CommandException {
TextComponent c;
TextComponent amt;
if (args.length == 0 && sender instanceof ProxiedPlayer) {
ProxiedPlayer proxiedPlayer = (ProxiedPlayer) sender;
ProxiedBubblePlayer bubblePlayer = ProxiedBubblePlayer.getObject(proxiedPlayer.getUniqueId());
if (bubblePlayer == null) {
throw new CommandException("Your not online!", this);
}
c = new TextComponent("Your tokens: ");
c.setColor(ChatColor.GOLD);
c.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText(ChatColor.GOLD + "The current amount of tokens you have")));
amt = new TextComponent(String.valueOf(bubblePlayer.getTokens()));
amt.setColor(ChatColor.RED);
} else {
if (args.length == 0) {
throw invalidUsage();
}
String other = args[0];
ProxiedBubblePlayer target = ProxiedBubblePlayer.getObject(other);
if (target == null) {
UUID u = instance.getUUID(other);
if (u == null) {
throw new CommandException("Player not found", this);
}
try {
target = instance.getBubblePlayer(u);
} catch (Exception e) {
throw new CommandException("Player not found", this);
}
}
c = new TextComponent(target.getNickName() + "\'s tokens: ");
c.setColor(ChatColor.GOLD);
c.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText(ChatColor.GOLD + "The current amount of tokens " + target.getNickName() + " has")));
amt = new TextComponent(String.valueOf(target.getTokens()));
amt.setColor(ChatColor.RED);
}
return new BaseComponent[]{c, amt};
}
}
| [
"clipcojnh@gmail.com"
] | clipcojnh@gmail.com |
cf0414002c808e50f1bdf44fcffdd94cac2937b1 | 14043ff95b86ef359012202ca9448bc8fdbe33fd | /src/main/java/com/share/pojo/Bill.java | 18fc4162da273181f431c43bd9e4ca7fe85809a5 | [] | no_license | THORSU/shareManagement | e8de817194ecd8dd478a7f8af9cdb99e1f84474d | b9d29f6c3e4f762239da4d62143f56b14d3386e0 | refs/heads/master | 2020-03-12T05:17:13.541709 | 2018-06-03T00:56:29 | 2018-06-03T00:56:29 | 130,460,747 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 417 | java | package com.share.pojo;
/**
* Created by weixin on 17-8-30.
*/
public class Bill {
public volatile static double bill;
// private static double bill2;
//
// public void setBill(double bill) {
// bill=this.bill;
//
//// System.out.println(this.getBill());
// }
public double getBill(){
System.out.println(bill+"-------------000--------------");
return bill;
}
}
| [
"1571104304@qq.com"
] | 1571104304@qq.com |
8db9c85048e654e6c54dafaac436a98e7685b02f | 98eaa74d6581e1aa125481d340b97732d97b940a | /GemsGalleriaFrontend/src/main/java/com/sara/controller/ProductController.java | 1471969db2b0c49b7185d591ff46bb9415728587 | [] | no_license | TheSarikaSharma/NewWorkSpace1 | 9e65351d85f572cdd49a9e9888bb9bf571cf47cd | 945da84838e744796c77ba8ce935c702e7a1ee12 | refs/heads/master | 2020-04-22T15:35:13.836021 | 2019-03-04T07:52:24 | 2019-03-04T07:52:24 | 170,481,933 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,953 | java | package com.sara.controller;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.util.LinkedHashMap;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
import com.sara.dao.CategoryDAO;
import com.sara.dao.ProductDAO;
import com.sara.model.Category;
import com.sara.model.Product;
@Controller
public class ProductController
{
@Autowired
CategoryDAO categoryDAO;
@Autowired
ProductDAO productDAO;
@RequestMapping("/product")
public String showProduct(Model m)
{
Product product = new Product();
m.addAttribute(product);
List<Product> listProducts = productDAO.listProducts();
m.addAttribute("productList", listProducts);
m.addAttribute("categoryList", this.getCategories());
m.addAttribute("pageinfo", "Manage Product");
return "Product";
}
@PostMapping(value="/InsertProduct")
public String InsertProduct(@ModelAttribute("product")Product product, @RequestParam("pimage")MultipartFile filedetail,Model m)
{
productDAO.addProduct(product);
Product product1 = new Product();
m.addAttribute(product1);
m.addAttribute("pageinfo" , "Manage Product");
m.addAttribute("categoryList", this.getCategories());
String imagepath="E:\\NewWorkSpace\\GemsGalleriaFrontend\\src\\main\\resources\\images";
imagepath=imagepath+String.valueOf(product.getProductId())+".png";
File image=new File(imagepath);
if(!filedetail.isEmpty())
{
try
{
byte buff[]=filedetail.getBytes();
FileOutputStream fos=new FileOutputStream(image);
BufferedOutputStream bs=new BufferedOutputStream(fos);
bs.write(buff);
bs.close();
}
catch(Exception e)
{
m.addAttribute("errorInfo", "Exception occured during uploading:"+e.getMessage());
}
}
else
{
m.addAttribute("errorInfo","Problem occured during Uploading:");
}
List<Product> listProducts = productDAO.listProducts();
m.addAttribute("productList", listProducts);
return "Product";
}
@PostMapping(value="editProduct/UpdateProduct")
public String UpdateProduct(@ModelAttribute("product")Product product, Model m)
{
productDAO.updateProduct(product);
Product product1 = new Product();
m.addAttribute(product1);
m.addAttribute("pageinfo" , "Manage Product");
m.addAttribute("categoryList", this.getCategories());
List<Product> listProducts = productDAO.listProducts();
m.addAttribute("productList", listProducts);
return "Product";
}
@RequestMapping("/ProductDisplay")
public String displayAllProduct(@ModelAttribute("product")Product product, Model m)
{
m.addAttribute("pageinfo" , "Product Catalog" );
List<Product> listProducts = productDAO.listProducts();
m.addAttribute("productList", listProducts);
return "ProductDisplay";
}
@RequestMapping(value="/totalProductDisplay/{productId}")
public String totalProductDisplay(@PathVariable("productId")int productId , Model m)
{
m.addAttribute("pageinfo", "Product Info");
Product product = productDAO.getProduct(productId);
m.addAttribute("product", product);
return "TotalProductDisplay";
}
public LinkedHashMap<Integer,String> getCategories()
{
List<Category> listCategories=categoryDAO.listCategories();
LinkedHashMap<Integer,String> categoryList=new LinkedHashMap<Integer,String>();
for(Category category:listCategories)
{
categoryList.put(category.getCategoryID(), category.getCategoryName());
}
return categoryList;
}
@RequestMapping(value="/deleteProduct/{productId}")
public String deleteProduct(@PathVariable("productId")int productId,Model m)
{
Product product = productDAO.getProduct(productId);
productDAO.deleteProduct(product);
Product product1 = new Product();
m.addAttribute(product1);
m.addAttribute("pageinfo" , "Manage Product");
m.addAttribute("categoryList", this.getCategories());
List<Product> listProducts = productDAO.listProducts();
m.addAttribute("productList", listProducts);
return "Product";
}
@RequestMapping(value="/editProduct/{productId}")
public String editProduct(@PathVariable("productId")int productId,Model m)
{
Product product = productDAO.getProduct(productId);
m.addAttribute("product", product);
m.addAttribute("pageinfo", "Manage Product");
m.addAttribute("categoryList", this.getCategories());
return "UpdateProduct";
}
} | [
"sarikasharma21293@gmail.com"
] | sarikasharma21293@gmail.com |
974bd9261c95d8c87d1cbf4dc3ac05a7f7c0b3d1 | c0fe124ac11018f3cef8a8c5559fea73bcb0c178 | /app/src/main/java/com/example/ridorianto/bangun_datar/Dashboard.java | a4130462a05d6fd1b6b351116409684ad1a21d8d | [
"MIT"
] | permissive | oeloem/bangun_datar-master | e949b177aed4c5723a491e8a8f2be850173f6602 | 7f657faded45f48a5cb7783def2e5288884cba3d | refs/heads/master | 2020-04-01T00:42:03.399455 | 2018-10-12T06:10:40 | 2018-10-12T06:10:40 | 152,709,023 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,094 | java | package com.example.ridorianto.bangun_datar;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
public class Dashboard extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_dashboard);
}
public void btn_pesg(View view){
Intent psg = new Intent(Dashboard.this, Persegi.class);
startActivity(psg);
}
public void btn_sgt (View view){
Intent sgt = new Intent(Dashboard.this, Segitiga.class);
startActivity(sgt);
}
public void btn_jajar(View view) {
Intent jjr = new Intent(Dashboard.this, JajarGenjang.class);
startActivity(jjr);
}
public void btn_bk(View view){
Intent bk = new Intent(Dashboard.this, BelahKetupat.class);
startActivity(bk);
}
public void btn_psg(View view){
Intent psg = new Intent(Dashboard.this, Persegi.class);
startActivity(psg);
}
}
| [
"rosihululum2@gmail.com"
] | rosihululum2@gmail.com |
5e249e1043a69c1b930f03d9ecc21eb40a70efe2 | 18998caf342fcf9c28d196400c11e7b2db2dd675 | /src/HelloWorld.java | 583c24a03a795b13338df6f467422fe121a92236 | [] | no_license | Maksaft/FileSystem | 95cb6ea5ce7727e25894ca1bfd3beec605aa99b5 | 1823b8a1cc67fc6af6208da4e4f6c7a603bf9569 | refs/heads/master | 2021-07-11T12:50:43.528586 | 2017-10-12T18:21:23 | 2017-10-12T18:21:23 | 106,710,901 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 643 | java | import models.userFunctions.Impl.UsersImpl;
import models.userFunctions.Users;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Application;
// The Java class will be hosted at the URI path "/helloworld"
@Path("/helloworld")
public class HelloWorld {
// The Java method will process HTTP GET requests
@GET
// The Java method will produce content identified by the MIME Media type "text/plain"
public String getClichedMessage() {
return "<p><a href=\"http://localhost:8080/FileSystem_war_exploded/Users\">USERS</a></p>";
}
} | [
"maksaft@gmail.com"
] | maksaft@gmail.com |
f55c7866e3b82b2e34dd546fe3db2883d785a6a0 | ba8a975b2492c10fcde5c07d0161c7c89d13df16 | /quanty-cloud-service-zk/src/main/java/com/quanty/cloud/service/zk/service/impl/UserServiceImpl.java | 094b23761432178497bfe6b36181d8da96faf5f0 | [] | no_license | ggmango/quanty-cloud-demo4 | ff113bcf67a18b5e440a347ede68d2f66b5b8d4c | fb089a99efaacf1fa75977a60589416c48b8c6e5 | refs/heads/master | 2023-04-20T04:34:29.706695 | 2021-05-10T09:32:30 | 2021-05-10T09:32:30 | 362,744,894 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 768 | java | package com.quanty.cloud.service.zk.service.impl;
import com.quanty.cloud.service.zk.entity.User;
import com.quanty.cloud.service.zk.mapper.mapper2.UserMapper;
import com.quanty.cloud.service.zk.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* @Classname UserServiceImpl
* @Description TODO
* @Date 2020/12/21 16:47
* @Created by willi
*/
@Service
@Transactional(readOnly = true)
public class UserServiceImpl implements UserService {
@Autowired
private UserMapper userMapper;
@Override
public List<User> findallUser() {
return userMapper.selectAll();
}
}
| [
"1252324263@qq.com"
] | 1252324263@qq.com |
c12516aa4f014a727063f3e6370bd00a1c1b44b5 | 9c982aa81913a6c9e51a47b8ba8adf92ce9d53c2 | /ProgramacionOOGladysYaguache/src/programacionoogladysyaguache/ConstructoresYherencias/Triangulo4.java | 41d8ba3cc7b9fe8cacb2e19b4862f455b95d1d84 | [] | no_license | istloja/ProgramacionOOGladysYaguache1 | 169ddffb1ef121cc86ac2be82a515307b74bbba4 | 4b3e7761173b1f1ce302426e400e27e63ecabd26 | refs/heads/master | 2020-06-18T10:31:49.151543 | 2019-10-16T03:37:19 | 2019-10-16T03:37:19 | 196,271,776 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,015 | java |
package programacionoogladysyaguache.ConstructoresYherencias;
public class Triangulo4 extends DosDimensiones4{
private String estilo;
//Constructor
Triangulo4(String s, double b, double h){
setBase(b);
setAltura(h);
estilo=s;
}
double area(){
return getBase()*getAltura()/2;
}
void mostrarEstilo(){
System.out.println("Triangulo es: "+estilo);
}
}
class ladoss3{
public static void main(String[] args) {
Triangulo4 t1=new Triangulo4("Estilo 1",4.0,4.0);
Triangulo4 t2=new Triangulo4("Estilo 2",8.0,12.0);
System.out.println("Información para T1: ");
t1.mostrarEstilo();
t1.mostrarDimension();
System.out.println("Su área es: "+t1.area());
System.out.println();
System.out.println("Información para T2: ");
t2.mostrarEstilo();
t2.mostrarDimension();
System.out.println("Su área es: "+t2.area());
}
}
| [
"HOGAR@DESKTOP-TFPS095"
] | HOGAR@DESKTOP-TFPS095 |
3435c4bbe28423a959f05f6db74f8b93723bbcd6 | 74bbf7dc3f8f56aced885e55828ced6663cf2060 | /src/com/company/employees/Subcontractor.java | 173a6623249598b23030ef0dd7cf219722aa5704 | [] | no_license | Takcaa/WSB_JAVA_APPSTORE | 60f71ce55d10a70152ef6c197af7d3217888e180 | 41ce854dcc3bff2657e1dcec7003d8ba5e15fd3f | refs/heads/master | 2022-11-22T09:50:03.289477 | 2020-07-10T14:47:20 | 2020-07-10T14:47:20 | 277,602,722 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,129 | java | package com.company.employees;
import java.util.concurrent.ThreadLocalRandom;
public class Subcontractor extends Employee {
private int type;
private double mistakeChance;
private double cost;
private double possibleDelay; //days
public int getType() {
return type;
}
public double getMistakeChance() {
return mistakeChance;
}
public double getCost() {
return cost;
}
public double getPossibleDelay() {
return possibleDelay;
}
public Subcontractor(int type) {
this.type = type;
this.cost = 10 * (type + 1) * 10;
this.possibleDelay = 0;
if (this.type == 3) { //najlepszy
this.mistakeChance = 0;
}
if (this.type == 2) { //sredni
this.mistakeChance = 20;
}
if (this.type == 1) { //najtanszy/najslabszy
this.mistakeChance = 0;
int i = ThreadLocalRandom.current().nextInt(1, 5 + 1);
if (i == 3) {
this.possibleDelay = 10;
}
}
}
}
| [
"dawidkawka11@gmail.com"
] | dawidkawka11@gmail.com |
dc0e9a3cda0a6c1e5226dff563ed959effbf8c8e | 5ea4a8c138790c249f1c8e8fbc6cf3a4e7ebf72a | /QuestionIndexingService/src/stackoverflow/question/indexer/model/Question.java | f2aed3d0e8e0ddae169c00ac3384e9a9f0977a03 | [] | no_license | chenkaigithub/automatic-tag-recommender-stack-overflow | 85238e8e81e866243c33e2b138b0211a9926e997 | 5e10cec9f42eed534a8fda012eed5deb435618d7 | refs/heads/master | 2021-01-22T14:46:38.936704 | 2014-12-16T21:07:54 | 2014-12-16T21:07:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,152 | java | package stackoverflow.question.indexer.model;
import java.util.Set;
public class Question {
private Integer questionId;
private String questionTitle;
private String questionBody;
private Set<String> questionTags;
public Integer getQuestionId() {
return questionId;
}
public void setQuestionId(Integer qId) {
this.questionId = qId;
}
public Set<String> getQuestionTags() {
return questionTags;
}
public String getQuestionTagsForTestData() {
StringBuilder tagString = new StringBuilder();
for(String tag : questionTags) {
tagString.append(tag + ",");
}
return tagString.substring(0, tagString.length()-1);
}
public void setQuestionTags(Set<String> qTags) {
this.questionTags = qTags;
}
//Returns the Question title and body concatenated as contents.
public String getQuestionContent() {
return questionTitle + " " + questionBody;
}
public void setQuestionTitle(String qTitle) {
this.questionTitle = qTitle;
}
public void setQuestionBody(String qBody) {
this.questionBody = qBody;
}
@Override
public String toString() {
return this.questionId + ":" + this.questionTitle + "\n";
}
}
| [
"manishjain181289@gmail.com"
] | manishjain181289@gmail.com |
3b6d79d06f674ab112eef95888bf5e55c97c57ff | 1ae21577ea859591f3c8c3b7364f80dba9524809 | /core/src/test/java/groovy/transform/Internal.java | b441a43c2dae084feed94bef84ade9d7163c2ba4 | [
"Apache-2.0"
] | permissive | vlsi/testng | ce997024cabc41ede0d75f050249468b89212201 | 25b8202656ce9ab6313805e8c8e5d2e00ce6578f | refs/heads/master | 2023-06-05T13:03:44.035790 | 2021-05-17T11:19:50 | 2021-05-17T11:19:50 | 369,911,225 | 0 | 0 | Apache-2.0 | 2021-05-22T21:44:50 | 2021-05-22T21:44:49 | null | UTF-8 | Java | false | false | 348 | java | package groovy.transform;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target({ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.TYPE, ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
public @interface Internal {
}
| [
"ian.springer@salesforce.com"
] | ian.springer@salesforce.com |
aad31a06709ace1703ab62616ab467da15ac5809 | 9f823486164363fb92a69f9bab23f6aa8955ba94 | /app/src/main/java/cawabanga/com/tnb_examples/Email.java | 6e9c143d28b33cdce0ffede98c86770d9ae71b30 | [] | no_license | krajacic/TNB_Examples | 43542a3449e3aefd75259d45c75686b4dc0cb045 | 40bb02016a6bc096c955289af9e7c647db6ac2ca | refs/heads/master | 2021-01-10T07:59:52.872325 | 2016-03-08T20:31:40 | 2016-03-08T20:31:40 | 47,552,022 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,023 | java | package cawabanga.com.tnb_examples;
/**
* Created by croatan on 11.12.2015..
*/
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class Email extends Activity implements View.OnClickListener {
EditText personsEmail, intro, personsName, stupidThings, hatefulAction, outro;
String emailAdd, beginning, name, stupidAction, hatefulAct, out;
Button sendEmail;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_email);
initializeVars();
sendEmail.setOnClickListener(this);
}
private void initializeVars() {
// TODO Auto-generated method stub
personsEmail = (EditText) findViewById(R.id.etEmails);
intro = (EditText) findViewById(R.id.etIntro);
personsName = (EditText) findViewById(R.id.etName);
stupidThings = (EditText) findViewById(R.id.etThings);
hatefulAction = (EditText) findViewById(R.id.etAction);
outro = (EditText) findViewById(R.id.etOutro);
sendEmail = (Button) findViewById(R.id.bSentEmail);
}
public void onClick(View v) {
// TODO Auto-generated method stub
convertEditTextVarsIntoStringsAndYesThisIsAMethodWeCreated();
String emailaddress[] = { emailAdd };
String message = "Well hello "
+ name
+ " I just wanted to say "
+ beginning
+ ". Not only that but I hate when you "
+ stupidAction
+ ", that just really makes me crazy. I just want to make you "
+ hatefulAct
+ ". Welp, thats all I wanted to chit-chatter about, oh and"
+ out
+ ". Oh also if you get bored you should check out www.juricakrajacic.com"
+ '\n' + "PS. I think I love you... :(";
Intent emailIntent = new Intent(Intent.ACTION_SEND);
emailIntent.putExtra(Intent.EXTRA_EMAIL, emailaddress);
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "May the force be with you!");
emailIntent.setType("plain/text");
emailIntent.putExtra(Intent.EXTRA_TEXT, message);
startActivity(emailIntent);
}
private void convertEditTextVarsIntoStringsAndYesThisIsAMethodWeCreated() {
// stringName = initializeVarsName.getText().toString();
emailAdd = personsEmail.getText().toString();
beginning = intro.getText().toString();
name = personsName.getText().toString();
stupidAction = stupidThings.getText().toString();
hatefulAct = hatefulAction.getText().toString();
out = outro.getText().toString();
}
@Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
finish();
}
} | [
"krajacic_jurica@yahoo.com"
] | krajacic_jurica@yahoo.com |
2776bebd4fa45fd9ff276e7d2ae1db1b7675d139 | 835fe382c4e6be93401fbd07d06633176a0e100f | /src/main/java/cn/zhouyafeng/wechat/component/MyOkHttpClient.java | 58f87bc84f9218e988b300a4da2eca636864865d | [] | no_license | yaphone/spring-boot-learning | 698c1263fe63904cc341d23e3248a75a6e152075 | e3c03c7790b971de400b2feb387f288100e0f6f7 | refs/heads/master | 2021-01-21T07:08:27.868966 | 2017-06-04T17:05:32 | 2017-06-04T17:05:32 | 91,599,761 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,396 | java | package cn.zhouyafeng.wechat.component;
import java.util.HashMap;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import okhttp3.Call;
import okhttp3.HttpUrl;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
/**
* OkHttpClient工具类
*
* @author https://github.com/yaphone
* @date 创建时间:2017年5月24日 上午12:11:34
* @version 1.0
*
*/
@Component
public class MyOkHttpClient {
private static Logger LOG = LoggerFactory.getLogger(MyOkHttpClient.class);
private static OkHttpClient client = new OkHttpClient();
/**
* okHttp get请求
*
* @date 2017年5月24日 上午12:14:44
* @param url
* @param paramsMap
* @return
*/
public Response doGet(String url, HashMap<String, String> params) {
HttpUrl.Builder httpBuider = HttpUrl.parse(url).newBuilder();
if (params != null) {
for (Map.Entry<String, String> param : params.entrySet()) {
httpBuider.addQueryParameter(param.getKey(), param.getValue());
}
}
Request request = new Request.Builder().url(httpBuider.build()).build();
// Request request = new Request.Builder().url(url).build();
Call call = client.newCall(request);
try {
Response response = call.execute();
return response;
} catch (Exception e) {
LOG.debug(e.getMessage());
}
return null;
}
}
| [
"zhouyaphone@163.com"
] | zhouyaphone@163.com |
4c53626b8eabed00aa5ded5463d0f0227f54191b | 202b4888bb6b7ca138c6b32a53397f5af4bfb216 | /training-business/src/main/java/com/msclub/training/module/training/repository/TrainingRepository.java | b698dbd295ee7d2f91b41dc7bd3e9ebc44aa7a3e | [] | no_license | mengeli/TrainingBackend | b70ed707a04de1c723a1bc35189d781e6f66c287 | c21bf1e3d6bff7dcf109184dac1c87e9557177de | refs/heads/master | 2020-03-19T18:29:35.316127 | 2018-06-10T06:40:07 | 2018-06-10T06:40:07 | 136,811,746 | 0 | 0 | null | 2018-06-10T13:35:09 | 2018-06-10T13:35:09 | null | UTF-8 | Java | false | false | 260 | java | package com.msclub.training.module.training.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import com.msclub.training.module.training.dto.Training;
public interface TrainingRepository extends JpaRepository<Training, Integer> {
}
| [
"zhihua.kang@accenture.com"
] | zhihua.kang@accenture.com |
41b168d1f97835a5dc58725286e676631123439d | 44b03b9d78b25f2e18bece4b5ea73d549ff31cbc | /babytun-seckill/src/main/java/com/itlaoqi/babytunseckill/controller/SecKillController.java | 4bf6e1bdde8e46c7bb5afe4118e52130f6af9a97 | [
"Apache-2.0"
] | permissive | wyb01/large-commerce-seckill | 789b46420254f1db6d1ef12ecc36188989554fb5 | 1bd62b56454a4b9da93608664aa34eac100cc60e | refs/heads/master | 2020-09-08T14:35:37.093332 | 2019-11-12T09:58:45 | 2019-11-12T09:58:45 | 221,160,548 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,225 | java | package com.itlaoqi.babytunseckill.controller;
import com.itlaoqi.babytunseckill.entity.Order;
import com.itlaoqi.babytunseckill.service.PromotionSecKillService;
import com.itlaoqi.babytunseckill.service.exception.SecKillException;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
/**
* @Description: 秒杀控制器
* @Author: wyb
* @Date: 2019-11-12 16:06:52
*/
@Controller
public class SecKillController {
@Resource
PromotionSecKillService promotionSecKillService;
/**
* @Description:
* @param psid: 活动id
* @param userid: 当前用户id
* @Return java.util.Map
* @Author: wyb
* @Date: 2019-11-12 16:20:43
*/
@RequestMapping("/seckill")
@ResponseBody
public Map processSecKill(Long psid , String userid){
Map result = new HashMap();
try {
promotionSecKillService.processSecKill(psid , userid , 1); //当前用户是否可以抢到该商品
String orderNo = promotionSecKillService.sendOrderToQueue(userid);
Map data = new HashMap();
data.put("orderNo", orderNo);
result.put("code", "0");
result.put("message", "success");
result.put("data", data);
} catch (SecKillException e) {
result.put("code", "500");
result.put("message", e.getMessage());
}
return result;
}
@GetMapping("/checkorder")
public ModelAndView checkOrder(String orderNo){
Order order = promotionSecKillService.checkOrder(orderNo);
ModelAndView mav = new ModelAndView();
if(order != null){
mav.addObject("order", order);
mav.setViewName("/order");
}else{
mav.addObject("orderNo", orderNo);
mav.setViewName("/waiting");
}
return mav;
}
}
| [
"zhangsitun@sina.com"
] | zhangsitun@sina.com |
ed48b13e0f44681c60d6a7a4c505244bfc479b72 | bfe60491cc010f2fe44a5106cab45b0d24bca930 | /mdd-core/src/main/java/io/mateu/mdd/vaadinport/vaadin/components/oldviews/ListViewComponent.java | 56396173205de18fa0bc5b2c3cba079279bf815d | [
"Beerware"
] | permissive | dhuamanr/mateu-mdd | 51137c4d5ee7f43cb4de79f58f45d225cd297527 | 7b6d3805175916dadb481338038a8af7ebcf0efe | refs/heads/master | 2020-03-28T02:25:48.940592 | 2018-09-05T12:25:49 | 2018-09-05T12:25:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 29,359 | java | package io.mateu.mdd.vaadinport.vaadin.components.oldviews;
import com.byteowls.vaadin.chartjs.ChartJs;
import com.byteowls.vaadin.chartjs.config.DonutChartConfig;
import com.byteowls.vaadin.chartjs.data.Dataset;
import com.byteowls.vaadin.chartjs.data.PieDataset;
import com.google.common.base.Strings;
import com.kbdunn.vaadin.addons.fontawesome.FontAwesome;
import com.vaadin.data.HasDataProvider;
import com.vaadin.data.ValueProvider;
import com.vaadin.data.provider.ListDataProvider;
import com.vaadin.data.provider.QuerySortOrder;
import com.vaadin.event.ShortcutAction;
import com.vaadin.icons.VaadinIcons;
import com.vaadin.shared.data.sort.SortDirection;
import com.vaadin.ui.*;
import com.vaadin.ui.components.grid.SortOrderProvider;
import com.vaadin.ui.renderers.HtmlRenderer;
import com.vaadin.ui.themes.ValoTheme;
import io.mateu.mdd.core.MDD;
import io.mateu.mdd.core.annotations.*;
import io.mateu.mdd.core.data.ChartData;
import io.mateu.mdd.core.data.ChartValue;
import io.mateu.mdd.core.data.MDDBinder;
import io.mateu.mdd.core.data.SumData;
import io.mateu.mdd.core.dataProviders.JPQLListDataProvider;
import io.mateu.mdd.core.interfaces.ICellStyleGenerator;
import io.mateu.mdd.core.interfaces.StyledEnum;
import io.mateu.mdd.core.model.common.Resource;
import io.mateu.mdd.core.reflection.FieldInterfaced;
import io.mateu.mdd.core.reflection.ReflectionHelper;
import io.mateu.mdd.core.util.Helper;
import io.mateu.mdd.vaadinport.vaadin.MDDUI;
import io.mateu.mdd.vaadinport.vaadin.components.fieldBuilders.components.WeekDaysComponent;
import org.javamoney.moneta.FastMoney;
import javax.money.MonetaryAmount;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.ManyToOne;
import javax.persistence.Transient;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public abstract class ListViewComponent extends AbstractViewComponent<ListViewComponent> {
private ResultsComponent resultsComponent;
private List<ListViewComponentListener> listeners = new ArrayList<>();
private int count;
private Label countLabel;
public FiltersComponent filtersComponent;
private HorizontalLayout sumsComponent;
private HorizontalLayout chartsComponent;
private Button excelButton;
private Button pdfButton;
@Override
public ListViewComponent build() throws InstantiationException, IllegalAccessException {
addStyleName("listviewcomponent");
addComponent(filtersComponent = new FiltersComponent(this));
super.build();
setSizeFull();
addComponent(sumsComponent = new HorizontalLayout());
sumsComponent.setVisible(false);
addComponent(chartsComponent = new HorizontalLayout());
chartsComponent.setVisible(false);
HorizontalLayout hcl;
addComponent(hcl = new HorizontalLayout(excelButton = new Button(FontAwesome.FILE_EXCEL_O, e -> excel()), pdfButton = new Button(FontAwesome.FILE_PDF_O, e -> pdf()), countLabel = new Label()));
countLabel.addStyleName("resultsmessage");
excelButton.addStyleName(ValoTheme.BUTTON_LINK);
excelButton.addStyleName("botondeicono");
pdfButton.addStyleName(ValoTheme.BUTTON_LINK);
pdfButton.addStyleName("botondeicono");
addComponentsAndExpand(resultsComponent = buildResultsComponent());
return this;
}
private void pdf() {
try {
getUI().getPage().open(Helper.listViewComponentToPdf(this, getModelForSearchFilters()).toString(), "_blank");
} catch (Throwable throwable) {
MDD.alert(throwable);
}
}
private void excel() {
try {
getUI().getPage().open(Helper.listViewComponentToExcel(this, getModelForSearchFilters()).toString(), "_blank");
} catch (Throwable throwable) {
MDD.alert(throwable);
} }
private ResultsComponent buildResultsComponent() {
return new ResultsComponent(this);
}
public void buildColumns(Grid grid) {
List<FieldInterfaced> colFields = getColumnFields(getColumnType());
buildColumns(grid, colFields, this instanceof JPAListViewComponent);
}
public static void buildColumns(Grid grid, List<FieldInterfaced> colFields, boolean isJPAListViewComponent) {
buildColumns(grid, colFields, isJPAListViewComponent, false);
}
public static void buildColumns(Grid grid, List<FieldInterfaced> colFields, boolean isJPAListViewComponent, boolean editable) {
buildColumns(grid, colFields, isJPAListViewComponent, editable, null);
}
public static void buildColumns(Grid grid, List<FieldInterfaced> colFields, boolean isJPAListViewComponent, boolean editable, MDDBinder binder) {
int pos = 0;
for (FieldInterfaced f : colFields) {
int finalPos = 1 + pos++;
Grid.Column col;
ICellStyleGenerator csg = null;
if (f.isAnnotationPresent(CellStyleGenerator.class)) {
try {
csg = (ICellStyleGenerator) f.getAnnotation(CellStyleGenerator.class).value().newInstance();
} catch (Exception e) {
MDD.alert(e);
}
}
if (boolean.class.equals(f.getType()) || Boolean.class.equals(f.getType())) {
csg = new ICellStyleGenerator() {
@Override
public String getStyles(Object row, Object value) {
return (value != null && ((Boolean)value))?"rowyes":"rowno";
}
@Override
public boolean isContentShown() {
return false;
}
};
}
ICellStyleGenerator finalCsg = csg;
col = grid.addColumn(new ValueProvider() {
@Override
public Object apply(Object o) {
if (finalCsg != null && !finalCsg.isContentShown()) return null;
Object v = null;
if (isJPAListViewComponent) {
v = ((Object[]) o)[finalPos + 1];
} else {
try {
v = ReflectionHelper.getValue(f, o);
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
if (boolean[].class.equals(f.getType()) && f.isAnnotationPresent(WeekDays.class)) {
if (o == null) return null;
boolean[] wds = (boolean[]) v;
String s = "";
for (int i = 0; i < wds.length; i++) if (wds[i]) {
if (!"".equals(s)) s += ",";
s += WeekDaysComponent.days.get(i);
}
return s;
} else {
return (v != null)?"" + v:null;
}
}
});
if (csg != null) col.setStyleGenerator(new StyleGenerator() {
@Override
public String apply(Object o) {
try {
Object v = null;
if (isJPAListViewComponent) {
v = ((Object[]) o)[finalPos + 1];
} else {
try {
v = ReflectionHelper.getValue(f, o);
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
return finalCsg.getStyles(o, v);
} catch (Exception e) {
MDD.alert(e);
}
return null;
}
});
if (f.isAnnotationPresent(HtmlCol.class)) col.setRenderer(new HtmlRenderer(""));
if (Integer.class.equals(f.getType()) || int.class.equals(f.getType())
|| Long.class.equals(f.getType()) || long.class.equals(f.getType())
|| Double.class.equals(f.getType()) || double.class.equals(f.getType())
|| BigInteger.class.equals(f.getType()) || BigDecimal.class.equals(f.getType()) || Number.class.equals(f.getType())
|| FastMoney.class.equals(f.getType()) || MonetaryAmount.class.equals(f.getType())
) {
col.setStyleGenerator(c -> "v-align-right");
}
if (editable) {
if (Boolean.class.equals(f.getType()) || boolean.class.equals(f.getType())) {
col.setEditorComponent(new CheckBox(), (o, v) -> {
try {
ReflectionHelper.setValue(f, o, v);
if (binder != null) binder.refresh();
} catch (Exception e) {
MDD.alert(e);
}
});
col.setEditable(true);
} else if (String.class.equals(f.getType())) {
col.setEditorComponent(new TextField(), (o, v) -> {
try {
ReflectionHelper.setValue(f, o, v);
if (binder != null) binder.refresh();
} catch (Exception e) {
MDD.alert(e);
}
});
col.setEditable(true);
} else if (Integer.class.equals(f.getType()) || int.class.equals(f.getType())
|| Long.class.equals(f.getType()) || long.class.equals(f.getType())) {
TextField nf = new TextField();
col.setEditorComponent(nf, (o, v) -> {
try {
//todo: validar entero
ReflectionHelper.setValue(f, o, v);
if (binder != null) binder.refresh();
} catch (Exception e) {
MDD.alert(e);
}
});
col.setEditable(true);
} else if (Double.class.equals(f.getType()) || double.class.equals(f.getType())) {
TextField nf = new TextField();
col.setEditorComponent(nf, (o, v) -> {
try {
//todo: validar doble
//todo: falta float y long
ReflectionHelper.setValue(f, o, v);
if (binder != null) binder.refresh();
} catch (Exception e) {
MDD.alert(e);
}
});
col.setEditable(true);
} else if (f.getType().isEnum()) {
ComboBox tf = new ComboBox();
tf.setDataProvider(new ListDataProvider(Arrays.asList(f.getType().getEnumConstants())));
col.setEditorComponent(tf, (o, v) -> {
try {
ReflectionHelper.setValue(f, o, v);
if (binder != null) binder.refresh();
} catch (Exception e) {
MDD.alert(e);
}
});
col.setEditable(true);
} else if (f.isAnnotationPresent(ManyToOne.class)) {
ComboBox cb = new ComboBox();
//AbstractBackendDataProvider
//FetchItemsCallback
//newItemProvider
if (f.isAnnotationPresent(DataProvider.class)) {
try {
DataProvider a = f.getAnnotation(DataProvider.class);
cb.setDataProvider(a.dataProvider().newInstance());
cb.setItemCaptionGenerator(a.itemCaptionGenerator().newInstance());
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
} else {
if (f.isAnnotationPresent(DataProvider.class)) {
try {
DataProvider a = f.getAnnotation(DataProvider.class);
((HasDataProvider)cb).setDataProvider(a.dataProvider().newInstance());
cb.setItemCaptionGenerator(a.itemCaptionGenerator().newInstance());
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
} else {
try {
Helper.notransact((em) -> cb.setDataProvider(new JPQLListDataProvider(em, f)));
} catch (Throwable throwable) {
throwable.printStackTrace();
}
}
FieldInterfaced fName = ReflectionHelper.getNameField(f.getType());
if (fName != null) cb.setItemCaptionGenerator((i) -> {
try {
return "" + ReflectionHelper.getValue(fName, i);
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
return "Error";
});
}
col.setEditorComponent(cb, (o, v) -> {
try {
ReflectionHelper.setValue(f, o, v);
if (binder != null) binder.refresh();
} catch (Exception e) {
MDD.alert(e);
}
});
col.setEditable(true);
}
//todo: acabar
}
col.setCaption(Helper.capitalize(f.getName()));
if (colFields.size() == 1) col.setExpandRatio(1);
else col.setWidth(getColumnWidth(f));
col.setSortOrderProvider(new SortOrderProvider() {
@Override
public Stream<QuerySortOrder> apply(SortDirection sortDirection) {
return Stream.of(new QuerySortOrder(f.getName(), sortDirection));
}
}).setId(f.getName());
}
}
private static double getColumnWidth(FieldInterfaced f) {
if (f.isAnnotationPresent(ColumnWidth.class)) return f.getAnnotation(ColumnWidth.class).value();
else {
Class t = f.getType();
if (
int.class.equals(t)
|| Integer.class.equals(t)
|| long.class.equals(t)
|| Long.class.equals(t)
|| float.class.equals(t)
|| Float.class.equals(t)
|| double.class.equals(t)
|| Double.class.equals(t)
|| boolean.class.equals(t)
|| Boolean.class.equals(t)
|| BigInteger.class.equals(t)
|| BigDecimal.class.equals(t)
|| Number.class.equals(t)
) return 120;
else if (LocalDate.class.equals(t)) return 120;
else if (LocalDateTime.class.equals(t)) return 220;
else return 250;
}
}
public void search(Object filters) throws Throwable {
setModelForSearchFilters(filters);
resultsComponent.search(filters);
}
public void addListener(ListViewComponentListener listener) {
listeners.add(listener);
}
public void edit(Object id) {
for (ListViewComponentListener l : listeners) l.onEdit(id);
};
public void select(Object id) {
for (ListViewComponentListener l : listeners) l.onSelect(id);
};
public abstract List findAll(Object filters, List<QuerySortOrder> sortOrders, int offset, int limit);
public int count(Object filters) throws Throwable {
count = gatherCount(filters);
String s = (count == 1)?"" + count + " match.":"" + count + " matches";
s += toCountLabel(filters);
s += ".";
countLabel.setValue(s);
List<SumData> sums = getSums(filters);
if (sums != null && sums.size() > 0) {
sumsComponent.removeAllComponents();
for (SumData d : sums) {
sumsComponent.addComponent(buildSum(d));
}
sumsComponent.setVisible(true);
} else {
sumsComponent.setVisible(false);
}
List<ChartData> charts = getCharts(filters);
if (charts != null && charts.size() > 0) {
chartsComponent.removeAllComponents();
for (ChartData d : charts) {
chartsComponent.addComponent(buildChart(d));
}
chartsComponent.setVisible(true);
} else {
chartsComponent.setVisible(false);
}
return count;
}
private String toCountLabel(Object filters) {
String s = "";
if (filters != null) for (FieldInterfaced f : getFilterFields()) if (!f.isAnnotationPresent(Ignored.class)) {
try {
Object v = f.getValue(filters);
if (v != null) {
if (!(v instanceof String) || !Strings.isNullOrEmpty((String) v)) {
if (!"".equals(s)) s += ", ";
s += ReflectionHelper.getCaption(f) + " = " + v;
s += "";
}
}
} catch (Exception e) {
MDD.alert(e);
}
}
if (!"".equals(s)) s = " where " + s;
return s;
}
private Component buildChart(ChartData d) {
DonutChartConfig config = new DonutChartConfig();
config
.data()
.labelsAsList(d.getValues().stream().map(v -> v.getTitle()).collect(Collectors.toList()))
.addDataset(new PieDataset().label(d.getTitle()))
.and();
config.
options()
.rotation(Math.PI)
.circumference(Math.PI)
.responsive(true)
.title()
.display(true)
.text(d.getTitle())
.and()
.animation()
.animateScale(false)
.animateRotate(true)
.and()
.done();
double total = 0;
for (ChartValue v : d.getValues()) {
total += v.getValue();
}
List<String> labels = config.data().getLabels();
for (Dataset<?, ?> ds : config.data().getDatasets()) {
PieDataset lds = (PieDataset) ds;
String[] colors = d.getValues().stream().map(v -> v.getStyle().toLowerCase().replaceAll("mdd-", "").replaceAll("-bgd", "")).collect(Collectors.toList()).toArray(new String[0]);
if (colors.length > 0 && !Strings.isNullOrEmpty(colors[0])) lds.backgroundColor(colors);
else lds.randomBackgroundColors(true);
List<Double> data = new ArrayList<>();
for (int i = 0; i < d.getValues().size(); i++) {
//data.add(100d * d.getValues().get(i).getValue() / total);
data.add(d.getValues().get(i).getValue());
}
lds.dataAsList(data);
}
ChartJs chart = new ChartJs(config);
chart.setJsLoggingEnabled(true);
if (d.getField() != null) {
chart.addClickListener((a,b) -> {
Object bean = filtersComponent.getBinder().getBean();
try {
ReflectionHelper.setValue(d.getField(), bean, d.getValues().get(b).getKey());
filtersComponent.getBinder().setBean(bean);
search(bean);
} catch (Throwable throwable) {
MDD.alert(throwable);
}
//DemoUtils.notification(a, b, config.data().getDatasets().get(a));
});
}
return chart;
}
private Component buildSum(SumData d) {
Label l = new Label(d.getTitle() + ": " + d.getValue());
l.addStyleName("sum");
if (!Strings.isNullOrEmpty(d.getStyle())) l.addStyleName(d.getStyle());
return l;
}
protected abstract int gatherCount(Object filters) throws Throwable;
protected abstract List<SumData> getSums(Object filters);
protected abstract List<ChartData> getCharts(Object filters);
public abstract Object deserializeId(String id);
public String getPathForEditor(Object id) {
return "" + id;
}
public String getPathForFilters() {
return "filters";
}
public abstract Object getModelForSearchFilters() throws InstantiationException, IllegalAccessException;
public abstract void setModelForSearchFilters(Object filters);
public Component getFiltersViewComponent() {
return filtersComponent.getFiltersViewComponent();
}
public Class getModelType() {
return getClass();
}
public Method getMethod(String methodName) {
Method a = null;
for (Method m : ReflectionHelper.getAllMethods(getModelType())) {
if (Modifier.isStatic(m.getModifiers()) && m.getName().equals(methodName)) {
a = m;
break;
}
}
return a;
}
public Set getSelection() {
return resultsComponent.getSelection();
}
public static List<FieldInterfaced> getColumnFields(Class objectType) {
List<FieldInterfaced> explicitColumns = ReflectionHelper.getAllFields(objectType).stream().filter(
(f) -> f.isAnnotationPresent(ListColumn.class)
).collect(Collectors.toList());
if (explicitColumns.size() > 0) {
return explicitColumns;
} else
return ReflectionHelper.getAllFields(objectType).stream().filter(
(f) -> !f.isAnnotationPresent(Transient.class)
&& !f.isAnnotationPresent(NotInList.class)
&& !f.isAnnotationPresent(Ignored.class)
&& !Modifier.isTransient(f.getModifiers())
&& !Collection.class.isAssignableFrom(f.getType())
&& !Map.class.isAssignableFrom(f.getType())
&& !f.isAnnotationPresent(GeneratedValue.class)
&& (ReflectionHelper.isBasico(f.getType()) || f.getType().isEnum() || f.getType().isAnnotationPresent(Entity.class))
).collect(Collectors.toList());
}
public abstract Class getColumnType();
public List<FieldInterfaced> getFilterFields() {
return getFilterFields(getFiltersType());
}
public List<FieldInterfaced> getFilterFields(Class filtersType) {
List<FieldInterfaced> explicitFilters = ReflectionHelper.getAllFields(filtersType).stream().filter(
(f) -> !f.isAnnotationPresent(Ignored.class) && f.isAnnotationPresent(SearchFilter.class) || f.isAnnotationPresent(MainSearchFilter.class)
).collect(Collectors.toList());
if (explicitFilters.size() > 0) {
return explicitFilters;
} else {
return ReflectionHelper.getAllFields(filtersType).stream().filter(
(f) -> !f.isAnnotationPresent(Ignored.class) && !f.isAnnotationPresent(Output.class) && !Resource.class.equals(f.getType()) && (String.class.equals(f.getType()) || LocalDate.class.equals(f.getType()) || LocalDateTime.class.equals(f.getType()) || Date.class.equals(f.getType()) || boolean.class.equals(f.getType()) || Boolean.class.equals(f.getType()) || f.getType().isEnum() || f.isAnnotationPresent(ManyToOne.class))
).collect(Collectors.toList());
}
}
public abstract Class getFiltersType();
public boolean isAddEnabled() {
return false;
}
public boolean isDeleteEnabled() {
return false;
}
@Override
public void addViewActionsMenuItems(MenuBar bar) {
if (isAddEnabled()) {
MenuBar.Command cmd;
MenuBar.MenuItem i = bar.addItem("New", VaadinIcons.PLUS, cmd = new MenuBar.Command() {
@Override
public void menuSelected(MenuBar.MenuItem menuItem) {
try {
MDDUI.get().getNavegador().go("new");
} catch (Throwable throwable) {
MDD.alert(throwable);
}
}
});
i.setDescription("Click Ctrl + ALt + N to fire");
Button b;
addComponent(b = new Button());
b.addStyleName("hidden");
b.addClickListener(e -> cmd.menuSelected(i));
b.setClickShortcut(ShortcutAction.KeyCode.N, ShortcutAction.ModifierKey.CTRL, ShortcutAction.ModifierKey.ALT);
}
if (isDeleteEnabled()) {
MenuBar.Command cmd;
MenuBar.MenuItem i = bar.addItem("Delete", VaadinIcons.MINUS, cmd = new MenuBar.Command() {
@Override
public void menuSelected(MenuBar.MenuItem menuItem) {
MDD.confirm("Are you sure you want to delete the selected items?", new Runnable() {
@Override
public void run() {
try {
delete(getSelection());
resultsComponent.refresh();
} catch (Throwable throwable) {
MDD.alert(throwable);
}
}
});
}
});
i.setDescription("Click Ctrl + DELETE to fire");
Button b;
addComponent(b = new Button());
b.addStyleName("hidden");
b.addClickListener(e -> cmd.menuSelected(i));
b.setClickShortcut(ShortcutAction.KeyCode.DELETE, ShortcutAction.ModifierKey.CTRL);
}
super.addViewActionsMenuItems(bar);
}
protected void delete(Set selection) {
}
public Object toId(Object row) {
return ReflectionHelper.getId(row);
}
public Grid getGrid() {
return resultsComponent.getGrid();
}
public void decorateGridMain(Grid grid) {
int pos = 2;
for (FieldInterfaced f : getColumnFields(getColumnType())) {
if (StyledEnum.class.isAssignableFrom(f.getType())) {
Grid.Column col = grid.getColumn(f.getName());
int finalPos = pos;
col.setStyleGenerator(o -> {
if (o instanceof Object[]) {
return ((StyledEnum)((Object[])o)[finalPos]).getStyle();
} else {
try {
return ((StyledEnum)ReflectionHelper.getValue(f, o)).getStyle();
} catch (Exception e) {
MDD.alert(e);
}
return null;
}
});
}
pos++;
}
decorateGrid(grid);
}
public abstract void decorateGrid(Grid grid);
}
| [
"miguelperezcolom@gmail.com"
] | miguelperezcolom@gmail.com |
9a1867a5b70e9855ddfb4486c52b9a77dde7b6cb | 85b8061ac8976a0ac1a1b1861e5d13d93f7299cf | /ejb/src/main/java/br/com/seta/processo/bean/DadosFinanceiroFornecedor.java | 3c21993c7975eea460cb273625680a218d9a521d | [] | no_license | sergiovictoria/bpm-portal | 20e0175e673ac38cd6b5ddc9c5897e238e6f1c9a | 3c6f97f1c9f928fe2dcf611998573f284648cb46 | refs/heads/master | 2021-06-26T15:53:27.366441 | 2017-09-11T21:57:14 | 2017-09-11T21:57:14 | 103,188,369 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,996 | java | package br.com.seta.processo.bean;
import java.util.StringTokenizer;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.ejb.LocalBean;
import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
import javax.ejb.TransactionManagement;
import javax.ejb.TransactionManagementType;
import javax.inject.Inject;
import javax.interceptor.Interceptors;
import org.jboss.logging.Logger;
import br.com.seta.processo.dao.GenericJpaDaoConSinco;
import br.com.seta.processo.dto.FormularioFornecedor;
import br.com.seta.processo.entity.FiForncontaEntity;
import br.com.seta.processo.entity.FiForncontaId;
import br.com.seta.processo.interceptor.LogInterceptor;
@Stateless(name="DadosFinanceiroFornecedor")
@TransactionManagement(TransactionManagementType.CONTAINER)
@Interceptors({LogInterceptor.class})
@LocalBean
public class DadosFinanceiroFornecedor extends GenericJpaDaoConSinco<FiForncontaEntity> {
private static final long serialVersionUID = 1L;
@Inject
private Logger logger;
@PostConstruct
public void init() {
logger.info("Acessando EJB - DadosFinanceiroFornecedor ");
}
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public void create(FormularioFornecedor formularioFornecedor, Integer seqpessoa) {
logger.info("Criando dados financeiros ");
FiForncontaEntity fiForncontaEntity = new FiForncontaEntity();
FiForncontaId forncontaId = new FiForncontaId();
forncontaId.setSeqpessoa(seqpessoa);
forncontaId.setSeqconta(new Short("1"));
fiForncontaEntity.setId(forncontaId);
if (formularioFornecedor.getBancoTitularConta()!=null) {
fiForncontaEntity.setBanco(new Short(getBanco(formularioFornecedor.getBancoTitularConta())));
}
if (formularioFornecedor.getAgenciaTitularConta()!=null)
fiForncontaEntity.setAgencia(new Integer(formularioFornecedor.getAgenciaTitularConta()));
if (formularioFornecedor.getDigitoAgenciaTitularConta()!=null)
fiForncontaEntity.setDigagencia(formularioFornecedor.getDigitoAgenciaTitularConta());
if (formularioFornecedor.getContaTitularConta()!=null)
fiForncontaEntity.setNroconta(formularioFornecedor.getContaTitularConta());
if (formularioFornecedor.getDigitoContaTitularConta()!=null)
fiForncontaEntity.setDigconta(formularioFornecedor.getDigitoContaTitularConta());
if (formularioFornecedor.getCpfCnpjTitularConta()!=null)
fiForncontaEntity.setCnpjcpf(new Long(formularioFornecedor.getCpfCnpjTitularConta()));
if (formularioFornecedor.getCpfCnpjTitularConta()!=null) {
if (formularioFornecedor.getCpfCnpjTitularConta().length()==11) {
fiForncontaEntity.setCnpjcpf(new Long(formularioFornecedor.getCpfCnpjTitularConta().substring(0, 9)));
fiForncontaEntity.setDigcnpjcpf(new Integer(formularioFornecedor.getCpfCnpjTitularConta().substring(9, 11)));
fiForncontaEntity.setTipoinscricao(new Integer(1));
}else if (formularioFornecedor.getCpfCnpjTitularConta().length()==14) {
fiForncontaEntity.setTipoinscricao(new Integer(2));
fiForncontaEntity.setCnpjcpf(new Long(formularioFornecedor.getCpfCnpjTitularConta().substring(0, 12)));
fiForncontaEntity.setDigcnpjcpf(new Integer(formularioFornecedor.getCpfCnpjTitularConta().substring(12, 14)));
}
}
if (formularioFornecedor.getNomeTitularConta()!=null)
fiForncontaEntity.setNome(formularioFornecedor.getNomeTitularConta());
if (formularioFornecedor.getEnderecoTitularConta()!=null)
fiForncontaEntity.setEndereco(formularioFornecedor.getEnderecoTitularConta());
if (formularioFornecedor.getNumero()!=null)
fiForncontaEntity.setNumero(new Integer(formularioFornecedor.getNumeroTitularConta()));
if (formularioFornecedor.getBairroTitularConta()!=null)
fiForncontaEntity.setBairro(formularioFornecedor.getBairroTitularConta());
if (formularioFornecedor.getCidadeTitularConta()!=null)
fiForncontaEntity.setCidade(formularioFornecedor.getCidadeTitularConta());
if (formularioFornecedor.getCepTitularConta() != null) {
String cep = formularioFornecedor.getCepTitularConta();
cep = cep.replace("-", "");
if(cep.length() < 8){
cep = preencheZerosAEsquerda(cep, 8);
}
fiForncontaEntity.setCep(new Integer(cep.substring(0, 5)));
fiForncontaEntity.setComplcep(new Short(cep.substring(5, 8)));
}
fiForncontaEntity.setDtaalteracao(new java.util.Date());
fiForncontaEntity.setSituacao("A");
if (formularioFornecedor.getUfTitularConta()!=null)
fiForncontaEntity.setEstado(formularioFornecedor.getUfTitularConta());
fiForncontaEntity.setUsualteracao("BPMSETA");
if (formularioFornecedor.getObservacaoTitularConta()!=null)
fiForncontaEntity.setObservacao(formularioFornecedor.getObservacaoTitularConta());
if (formularioFornecedor.getTipoDaConta()!=null) {
if (formularioFornecedor.getTipoDaConta().equals("CONTA PARA PAGAMENTOS VIA DEPOSITO")) {
fiForncontaEntity.setContapadrao("S");
}else {
fiForncontaEntity.setContapadrao("N");
}
if (formularioFornecedor.getTipoDaConta().equals("CONTA DE TERCEIRO")) {
fiForncontaEntity.setPropterceiro("T");
}else {
fiForncontaEntity.setPropterceiro("P");
}
if (formularioFornecedor.getTipoDaConta().equals("CONTA PESSOA JURIDICA")) {
fiForncontaEntity.setContapessoajuridica("S");
}else {
fiForncontaEntity.setContapessoajuridica("N");
}
}else {
if (formularioFornecedor.getTipoDaConta().equals("CONTA PARA PAGAMENTOS VIA DEPOSITO")) {
}else {
fiForncontaEntity.setContapadrao("N");
}
if (formularioFornecedor.getTipoDaConta().equals("CONTA DE TERCEIRO")) {
}else {
fiForncontaEntity.setPropterceiro("P");
}
if (formularioFornecedor.getTipoDaConta().equals("CONTA PESSOA JURIDICA")) {
}else {
fiForncontaEntity.setContapessoajuridica("N");
}
}
if (formularioFornecedor.getTipoDeConta()!=null) {
if (formularioFornecedor.getTipoDeConta().equals("CONTA CORRENTE INDIVIDUAL")) {
fiForncontaEntity.setTipoconta("C");
}else if (formularioFornecedor.getTipoDeConta().equals("CONTA CORRENTE CONJUNTA")) {
fiForncontaEntity.setTipoconta("X");
}else if (formularioFornecedor.getTipoDeConta().equals("DEPOSITO JUDICIAL INDIVIDUAL")) {
fiForncontaEntity.setTipoconta("J");
}else if (formularioFornecedor.getTipoDeConta().equals("DEPOSITO JUDICIAL CONJUNTA")) {
fiForncontaEntity.setTipoconta("D");
}else if (formularioFornecedor.getTipoDeConta().equals("POUPANCA INDIVIDUAL")) {
fiForncontaEntity.setTipoconta("P");
}else if (formularioFornecedor.getTipoDeConta().equals("POUPANCA CONJUNTA")) {
fiForncontaEntity.setTipoconta("R");
}
}else {
}
if (formularioFornecedor.getCpfCnpjTitularConta().length()==11) {
fiForncontaEntity.setTipoinscricao(1);
}else {
fiForncontaEntity.setTipoinscricao(2);
}
if (formularioFornecedor.getUfTitularConta()!=null) {
fiForncontaEntity.setEstado(getUF(formularioFornecedor.getUfTitularConta()));
}
if (formularioFornecedor.getComplementoTitularConta()!=null)
fiForncontaEntity.setComplemento(formularioFornecedor.getComplementoTitularConta());
insert(fiForncontaEntity);
logger.info("Criando dados financeiros com sucesso ! ");
}
private String preencheZerosAEsquerda(String nro, int tamanhoMaximo) {
int tamanho = nro.length();
while(tamanho < tamanhoMaximo){
nro = "0" + nro;
tamanho++;
}
return nro;
}
private String getUF(String estado){
StringTokenizer tokenizer = new StringTokenizer(estado, "/");
if(tokenizer.countTokens() == 2){
tokenizer.nextToken();
return tokenizer.nextToken();
}
return "";
}
public String getBanco(String value) {
if (value!=null) {
return value.substring(0,value.indexOf(" ")).trim();
}else {
return "";
}
}
@PreDestroy
public void destroy() {
logger.info("Destruindo EJB - DadosFinanceiroFornecedor ");
}
}
| [
"sergiodavictoria@hotamil.com"
] | sergiodavictoria@hotamil.com |
f408020579f2add12532be3cfd5236cce00bbfb9 | eb97ee5d4f19d7bf028ae9a400642a8c644f8fe3 | /tags/2011-12-23/seasar2-2.4.45/seasar2/s2-framework/src/main/java/org/seasar/framework/container/util/SmartDeployUtil.java | 90e4ba78a0adbeb69cc7756eba489ac1af5fc988 | [
"Apache-2.0"
] | permissive | svn2github/s2container | 54ca27cf0c1200a93e1cb88884eb8226a9be677d | 625adc6c4e1396654a7297d00ec206c077a78696 | refs/heads/master | 2020-06-04T17:15:02.140847 | 2013-08-09T09:38:15 | 2013-08-09T09:38:15 | 10,850,644 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,596 | java | /*
* Copyright 2004-2011 the Seasar Foundation and the Others.
*
* 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.seasar.framework.container.util;
import org.seasar.framework.beans.BeanDesc;
import org.seasar.framework.beans.factory.BeanDescFactory;
import org.seasar.framework.container.S2Container;
import org.seasar.framework.container.cooldeploy.S2ContainerFactoryCoolProvider;
import org.seasar.framework.container.factory.S2ContainerFactory;
import org.seasar.framework.container.factory.S2ContainerFactory.Provider;
import org.seasar.framework.container.hotdeploy.HotdeployUtil;
import org.seasar.framework.container.impl.S2ContainerBehavior;
import org.seasar.framework.container.warmdeploy.WarmdeployBehavior;
import org.seasar.framework.util.FieldUtil;
/**
* SMART deploy用のユーティリティクラスです。
*
* @author shot
*
*/
public class SmartDeployUtil {
/**
* インスタンスを構築します。
*/
protected SmartDeployUtil() {
}
/**
* SMART deployかどうか返します。
*
* @param container
* @return SMART deployかどうか
*/
public static boolean isSmartdeployMode(S2Container container) {
return isHotdeployMode(container) || isCooldeployMode(container)
|| isWarmdeployMode(container);
}
/**
* HOT deployかどうか返します。
*
* @param container
* @return HOT deployかどうか
*/
public static boolean isHotdeployMode(S2Container container) {
return HotdeployUtil.isHotdeploy();
}
/**
* COOL deployかどうか返します。
*
* @param container
* @return COOL deployかどうか
*/
public static boolean isCooldeployMode(S2Container container) {
BeanDesc bd = BeanDescFactory.getBeanDesc(S2ContainerFactory.class);
S2ContainerFactory.Provider provider = (Provider) FieldUtil.get(bd
.getField("provider"), null);
if (provider instanceof S2ContainerFactoryCoolProvider) {
return true;
}
return false;
}
/**
* WARM deployかどうか返します。
*
* @param container
* @return WARM deployかどうか
*/
public static boolean isWarmdeployMode(S2Container container) {
S2ContainerBehavior.Provider provider = S2ContainerBehavior
.getProvider();
return provider instanceof WarmdeployBehavior;
}
/**
* Deployモードを返します。
*
* @param container
* @return Deployモード
*/
public static String getDeployMode(S2Container container) {
if (isHotdeployMode(container)) {
return "Hot Deploy";
} else if (isCooldeployMode(container)) {
return "Cool Deploy";
} else if (isWarmdeployMode(container)) {
return "Warm Deploy";
} else {
return "Normal Mode";
}
}
}
| [
"koichik@319488c0-e101-0410-93bc-b5e51f62721a"
] | koichik@319488c0-e101-0410-93bc-b5e51f62721a |
4f384e5072dd75916db3abbae30538174bee9447 | c7e7a66589c2d317990474a4bacda6f63bfc64d1 | /consumer/src/test/java/top/cardone/func/vx/usercenter/province/U0002FuncTest.java | d1f49f3c34a9ae135099aa5fb49e63dc97b71c5e | [] | no_license | yht-fand/cardone-usercenter | 8cabba7d83e3355d7ba4c2dcd5d7d8078f9b92e1 | fb772fe7baa6d90d09b622d49ecccb626bf6c833 | refs/heads/master | 2021-01-16T22:03:18.874986 | 2019-01-02T02:54:03 | 2019-01-02T02:54:03 | 48,280,884 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,258 | java | package top.cardone.func.vx.usercenter.province;
import com.google.common.base.Charsets;
import lombok.extern.log4j.Log4j2;
import lombok.val;
import org.apache.commons.io.FileUtils;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.core.io.Resource;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.util.StopWatch;
import top.cardone.ConsumerApplication;
import top.cardone.context.ApplicationContextHolder;
import java.io.IOException;
@Log4j2
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = ConsumerApplication.class, value = {"spring.profiles.active=test"}, webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
public class U0002FuncTest {
@Value("http://localhost:${server.port:8765}${server.servlet.context-path:}/vx/usercenter/province/u0002.json")
private String funcUrl;
@Value("file:src/test/resources/top/cardone/func/vx/usercenter/province/U0002FuncTest.func.input.json")
private Resource funcInputResource;
@Value("file:src/test/resources/top/cardone/func/vx/usercenter/province/U0002FuncTest.func.output.json")
private Resource funcOutputResource;
private HttpEntity<String> httpEntity;
private int pressure = 10000;
@Before
public void setup() throws Exception {
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
headers.set("Accept", MediaType.APPLICATION_JSON_UTF8_VALUE);
headers.set("token", ApplicationContextHolder.getBean(org.apache.shiro.authc.credential.PasswordService.class).encryptPassword("admin"));
headers.set("username", "admin");
if (!funcInputResource.exists()) {
FileUtils.write(funcInputResource.getFile(), "{}", Charsets.UTF_8);
}
String input = FileUtils.readFileToString(funcInputResource.getFile(), Charsets.UTF_8);
httpEntity = new HttpEntity<>(input, headers);
}
@Test
public void func() throws RuntimeException {
String output = new org.springframework.boot.test.web.client.TestRestTemplate().postForObject(funcUrl, httpEntity, String.class);
try {
FileUtils.write(funcOutputResource.getFile(), output, Charsets.UTF_8);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
@Test
public void pressureFunc() throws Exception {
for (int i = 0; i < pressure; i++) {
val sw = new StopWatch();
sw.start(funcUrl);
new org.springframework.boot.test.web.client.TestRestTemplate().postForObject(funcUrl, httpEntity, String.class);
sw.stop();
if (sw.getTotalTimeMillis() > 500) {
log.error(sw.prettyPrint());
} else if (log.isDebugEnabled()) {
log.debug(sw.prettyPrint());
}
log.debug("pressured:" + (i + 1));
}
}
} | [
"addday@gmail.com"
] | addday@gmail.com |
7c607715163534b6be6eb2b768ac554c7a8cd7a6 | 6bac6201fca69bdabf88312b7d115e338ecdec3a | /web24/src/main/java/shop/db/회원DAO2.java | eaea979c020acdf8e411f938e17223f834f270e8 | [] | no_license | rang26/java_project | cbc5953980c196f531be22759a542df4d23e5432 | e1100c4603a97a06f85bce473c00e31f3fc80436 | refs/heads/main | 2023-08-11T22:41:55.033894 | 2021-10-05T09:28:05 | 2021-10-05T09:28:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,922 | java | package shop.db;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import shop.dto.회원Bag;
public class 회원DAO2 {
// 메서드(변수들)
// 메서드 호출할 때 값을 전달할 목적으로 만들어지는 매개 역할을 해주는 변수
// (=매개 변수 = parameter)
public void create(회원Bag bag) {
// 변수 선언의 위치가 생존 범위를 결정한다.
// 매개 변수 (parameter) 는 지역 변수이다.
// 지역 변수는 자동 초기화가 되어 있지 않다.
System.out.println("전달된 id는 " + bag.getId());
System.out.println("전달된 pw는 " + bag.getPw());
System.out.println("전달된 name는 " + bag.getName());
System.out.println("전달된 tel은 " + bag.getTel());
try {
// 1. connector 연결
Class.forName("com.mysql.cj.jdbc.Driver");
// 2. db 연결
String url = "jdbc:mysql://localhost:3306/shop";
String username = "root";
String pw = "cnzk0531";
Connection con = DriverManager.getConnection(url, username, pw);
// 3. sql문 작성
String sql = "insert into member values (?, ?, ?, ?)";
PreparedStatement ps = con.prepareStatement(sql);
ps.setString(1, bag.getId());
ps.setString(2, bag.getPw());
ps.setString(3, bag.getName());
ps.setString(4, bag.getTel());
// 4. sql문 전송
int result = ps.executeUpdate();
System.out.println(result);
} catch (ClassNotFoundException e) {
System.out.println("1번 에러>> 드라이버 없음");
} catch (SQLException e) {
System.out.println("2-4번 에러>> DB 관련된 처리 에러발생");
}
}
// 다형성 (오버로딩)
// 하나의 메서드 명이 다수 존재할 수 있다. 입력값의 형태가 다양해야 한다.
public void read(String id) {
}
public void read() {
}
public void update() {
}
public void delete() {
}
} // class
| [
"noreply@github.com"
] | noreply@github.com |
99f12ffb4325f819723e6c8d4c87615083463fa6 | 449bf43206df20a0a8ea5c72a59efbd0c2e764c3 | /src/main/java/com/example/wiki/resp/EbookQueryResp.java | 5568b58c3bb850327b45ca0a0941c20f6266fd91 | [] | no_license | midasism/wiki | 4285e61d76569049ae8e5a0ff09eed5046cf022c | 2d8d0b1e9e0de94237df5a10681d0b71a60d66ab | refs/heads/master | 2023-06-26T19:28:46.039974 | 2021-08-01T15:40:42 | 2021-08-01T15:40:42 | 367,309,412 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,425 | java | package com.example.wiki.resp;
public class EbookQueryResp {
private Long id;
private String name;
private Long category1Id;
private Long category2Id;
private String description;
private String cover;
private Integer docCount;
private Integer viewCount;
private Integer voteCount;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Long getCategory1Id() {
return category1Id;
}
public void setCategory1Id(Long category1Id) {
this.category1Id = category1Id;
}
public Long getCategory2Id() {
return category2Id;
}
public void setCategory2Id(Long category2Id) {
this.category2Id = category2Id;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getCover() {
return cover;
}
public void setCover(String cover) {
this.cover = cover;
}
public Integer getDocCount() {
return docCount;
}
public void setDocCount(Integer docCount) {
this.docCount = docCount;
}
public Integer getViewCount() {
return viewCount;
}
public void setViewCount(Integer viewCount) {
this.viewCount = viewCount;
}
public Integer getVoteCount() {
return voteCount;
}
public void setVoteCount(Integer voteCount) {
this.voteCount = voteCount;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", name=").append(name);
sb.append(", category1Id=").append(category1Id);
sb.append(", category2Id=").append(category2Id);
sb.append(", description=").append(description);
sb.append(", cover=").append(cover);
sb.append(", docCount=").append(docCount);
sb.append(", viewCount=").append(viewCount);
sb.append(", voteCount=").append(voteCount);
sb.append("]");
return sb.toString();
}
} | [
"1719671503@qq.com"
] | 1719671503@qq.com |
9be9a60209e1eec8f32ec31555756155a1c07fdf | d552a137acd9b268a8e5ace3a8f6ef6f51be4bd9 | /EnglishStorm-manager-service/src/main/java/com/english/storm/service/utils/UserManager.java | d6cb04c234184c0dc61584b41e1502241d060d29 | [] | no_license | guobaolun/EnglishStorm | 770dcf2434915fc9e370e96e629017833784ee1b | 13c3b24506a1c7f129ea0b406796559a5697c0c4 | refs/heads/master | 2022-12-21T09:37:54.769855 | 2017-12-22T08:56:13 | 2017-12-22T08:56:13 | 224,499,919 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,971 | java | package com.english.storm.service.utils;
import com.english.storm.entity.User;
import com.english.storm.modle.UserResponse;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@Component
public class UserManager {
@Value("${IMAGE_SERVER_BASE_URL}")
private String IMAGE_SERVER_BASE_URL;
@Value("${IMAGE_THUMBNAIL_360}")
private String IMAGE_THUMBNAIL_360;
public UserResponse getUserResponse(User user, String token){
UserResponse userResponse = new UserResponse();
userResponse.setToken(token);
userResponse.setUserId(user.getUserId());
userResponse.setNickname(user.getNickname());
userResponse.setIntroduce(user.getIntroduce());
userResponse.setPortrait(IMAGE_SERVER_BASE_URL+user.getPortrait());
userResponse.setPortraitThumbnail(IMAGE_SERVER_BASE_URL+user.getPortrait()+IMAGE_THUMBNAIL_360);
userResponse.setSex(user.getIsSex());
if (user.getBirthday() !=null){
userResponse.setBirthday(user.getBirthday().getTime());
}else{
userResponse.setBirthday(0L);
}
userResponse.setSchool(user.getSchool());
userResponse.setDegree(user.getDegree());
userResponse.setSpeciality(user.getSpeciality());
userResponse.setLv(user.getLv());
userResponse.setPermission(user.getPermission());
userResponse.setCurrentCountry(user.getCurrentCountry());
userResponse.setCurrentProvince(user.getCurrentProvince());
userResponse.setCurrentCity(user.getCurrentCity());
userResponse.setCurrentArea(user.getCurrentArea());
userResponse.setHometownCountry(user.getHometownCountry());
userResponse.setHometownProvince(user.getHometownProvince());
userResponse.setHometownCity(user.getHometownCity());
userResponse.setHometownArea(user.getHometownArea());
return userResponse;
}
}
| [
"398464028@qq.com"
] | 398464028@qq.com |
a5fa80e5a33813ecff1e03c932d35b884881598a | 486f213ab48199d2cd967e59a41b32b645976ebd | /activemq-in-action/src/test/java/activemq/example/AppTest.java | 1c9eeea5cdd4e52954901f8c9434bf17e98527fd | [] | no_license | albertopires/JavaProjects | 3304083561863cb9141651c5c6abe442e2a3b86e | c91fff7347f06ad2b66d308bad41832b77a7ea98 | refs/heads/master | 2020-12-26T14:22:17.384938 | 2018-01-19T15:43:26 | 2018-01-19T15:43:26 | 16,285,807 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 644 | java | package activemq.example;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit test for simple App.
*/
public class AppTest
extends TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName )
{
super( testName );
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
}
/**
* Rigourous Test :-)
*/
public void testApp()
{
assertTrue( true );
}
}
| [
"mrpenguin2005@gmail.com"
] | mrpenguin2005@gmail.com |
caa0db743e1d879eb6a65c457a1db25ce4949240 | 26c4030a6e2a54635e34aae4f05391ce54e214f6 | /src/operationSets/ProcessDataSet.java | 79c7f6a50aabe82b2bffc2b1bcb1fac62f023d02 | [] | no_license | mfshao/WormCalc | 89b4462cc17ab1d86097579f03503648a0233f5b | 368ba5a7047e98da5916723cbec505d04e8ceb28 | refs/heads/master | 2021-03-22T02:59:02.922605 | 2016-11-28T16:46:19 | 2016-11-28T16:46:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 972 | java | package operationSets;
import java.util.ArrayList;
import operations.GlobalCentroids;
import operations.PathAnimation;
import operations.CellOccupancy;
import com.kylelmoy.WormCalc.DataSetOperator;
import com.kylelmoy.WormCalc.DataSetOperator.DataSetOperation;
public class ProcessDataSet extends DataSetOperation {
public static void main(String[] args) throws Exception {
DataSetOperator.operate(new ProcessDataSet());
}
public void go(String project) throws Exception {
//Operation Set
ArrayList<DataSetOperation> opSet = new ArrayList<DataSetOperation>();
opSet.add(new PreProcessLogs());
opSet.add(new GlobalCentroids());
opSet.add(new CalculateMovementData());
opSet.add(new PathAnimation());
opSet.add(new CellOccupancy());
//Go!
for (DataSetOperation op : opSet) {
DataSetOperator.operate(op, project);
}
}
}
| [
"MSHAO1@MEDIXWS3.cstcis.cti.depaul.edu"
] | MSHAO1@MEDIXWS3.cstcis.cti.depaul.edu |
41de6414233bb869c4190ada8607507de57324a9 | 786be22a6379e6f55512e7d6e33f848f628c3774 | /web-servlet-embedded/src/main/java/com/hao/learnjava/servlet/HelloServlet.java | f5e942fb6ab3810281e0f03f3ee3d66c1ddcebaf | [] | no_license | haokw/Java-101 | 1ce139682911c5ffd43db5d087a6bbf762ecb961 | 2089dc183fa1bc9cfa3df7035c294f02efffc261 | refs/heads/master | 2023-02-04T20:44:09.649743 | 2020-12-26T01:24:52 | 2020-12-26T01:24:52 | 300,130,511 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 735 | java | package com.hao.learnjava.servlet;
import java.io.IOException;
import java.io.PrintWriter;
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(urlPatterns = "/")
public class HelloServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
resp.setContentType("text/html");
String name = req.getParameter("name");
if (name == null) {
name = "world";
}
PrintWriter pw = resp.getWriter();
pw.write("<h1>Hello, " + name + "!</h1>");
pw.flush();
}
}
| [
"atwanghao@gmail.com"
] | atwanghao@gmail.com |
432e82695ae0645ea4b59509ec04a0466384c4ce | f3dd743ff3cb7496f53e897834919868b4c4d2aa | /novice/01-06/java_framework/hash_map/HashMapDemo.java | 8d8fc9f64b746bde9ed493c04c26f06b6e0f135f | [] | no_license | CindoddCindy/Praxis-Academy | b7a4441507f40cf33427bc4e30f7189b731aab1c | d74635d7f419caef32cb6f5eae5dd930b77bbbca | refs/heads/master | 2020-08-17T20:09:20.119289 | 2019-11-11T04:51:50 | 2019-11-11T04:51:50 | 215,706,542 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 622 | java | import java.util.HashMap;
import java.util.Iterator;
public class HashMapDemo {
public static void main(String[] args) {
HashMap<String, String> map = new HashMap<String, String>();
map.put("rumah", "Tipe 45");
map.put("mobil", "BMW");
map.put("bunga", "Mawar");
System.out.println("Sebelum diubah");
Iterator<String> ite = map.keySet().iterator();
while(ite.hasNext()) {
System.out.println(map.get(ite.next()));
}
System.out.println("Setelah diubah");
map.put("mobil", "Ferrari");
for(String key : map.keySet()) {
System.out.println(map.get(key));
}
}
} | [
"cindodcindy@gmail.com"
] | cindodcindy@gmail.com |
ad170aec00be49e07f1bd5a204eb3fbaae3f9c92 | 63719ab8c488e9b33e00f354c1262aa42a746711 | /app/src/main/java/me/devsaki/hentoid/activities/bundles/ContentItemBundle.java | 7931f0adc4bc9c7c13d13d5b42f0f4afa13e2588 | [
"Apache-2.0"
] | permissive | SirBlackEnergy/Hentoid | d096ec1b9a98e75f8f19a38e882a96bad0ea4602 | 937501b6c1156cea173b996cdb8bbb17d00c3a96 | refs/heads/master | 2022-12-16T08:35:56.652772 | 2020-08-09T07:15:56 | 2020-08-09T07:15:56 | 289,051,797 | 0 | 1 | Apache-2.0 | 2020-09-03T09:01:16 | 2020-08-20T16:11:43 | null | UTF-8 | Java | false | false | 2,404 | java | package me.devsaki.hentoid.activities.bundles;
import android.os.Bundle;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* Helper class to transfer payload data to {@link me.devsaki.hentoid.viewholders.ContentItem}
* through a Bundle
* <p>
* Use Builder class to set data; use Parser class to get data
*/
public class ContentItemBundle {
private static final String KEY_DELETE_PROCESSING = "is_being_deleted";
private static final String KEY_FAV_STATE = "favourite";
private static final String KEY_READS = "reads";
private static final String KEY_COVER_URI = "cover_uri";
private ContentItemBundle() {
throw new UnsupportedOperationException();
}
public static final class Builder {
private final Bundle bundle = new Bundle();
public void setIsBeingDeleted(boolean isBeingDeleted) {
bundle.putBoolean(KEY_DELETE_PROCESSING, isBeingDeleted);
}
public void setIsFavourite(boolean isFavourite) {
bundle.putBoolean(KEY_FAV_STATE, isFavourite);
}
public void setReads(long reads) {
bundle.putLong(KEY_READS, reads);
}
public void setCoverUri(String uri) {
bundle.putString(KEY_COVER_URI, uri);
}
public boolean isEmpty() {
return bundle.isEmpty();
}
public Bundle getBundle() {
return bundle;
}
}
public static final class Parser {
private final Bundle bundle;
public Parser(@Nonnull Bundle bundle) {
this.bundle = bundle;
}
@Nullable
public Boolean isBeingDeleted() {
if (bundle.containsKey(KEY_DELETE_PROCESSING))
return bundle.getBoolean(KEY_DELETE_PROCESSING);
else return null;
}
@Nullable
public Boolean isFavourite() {
if (bundle.containsKey(KEY_FAV_STATE)) return bundle.getBoolean(KEY_FAV_STATE);
else return null;
}
@Nullable
public Long getReads() {
if (bundle.containsKey(KEY_READS)) return bundle.getLong(KEY_READS);
else return null;
}
@Nullable
public String getCoverUri() {
if (bundle.containsKey(KEY_COVER_URI)) return bundle.getString(KEY_COVER_URI);
else return null;
}
}
}
| [
"35880555+RobbWatershed@users.noreply.github.com"
] | 35880555+RobbWatershed@users.noreply.github.com |
2b9502715daebafa8250b22e7e40b35ac3b04bd7 | ee1244b10de45679f053293e366f192af307be74 | /sources/com/google/android/gms/measurement/internal/zzy.java | 2ba918729eb68d6d81313ee0efb705ab2fdcac86 | [] | no_license | scarletstuff/Turbogram | a086e50b3f4d7036526075199616682a0d7c9c45 | 21b8862573953add9260f1eb586f0985d2c71e8e | refs/heads/master | 2021-09-23T14:34:23.323880 | 2018-09-24T17:48:43 | 2018-09-24T17:48:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,157 | java | package com.google.android.gms.measurement.internal;
import android.os.Bundle;
import android.text.TextUtils;
import com.google.android.gms.common.internal.Preconditions;
import java.util.Iterator;
public final class zzy {
final String name;
private final String origin;
final long timestamp;
final long zzaic;
final zzaa zzaid;
final String zztt;
private zzy(zzbt zzbt, String str, String str2, String str3, long j, long j2, zzaa zzaa) {
Preconditions.checkNotEmpty(str2);
Preconditions.checkNotEmpty(str3);
Preconditions.checkNotNull(zzaa);
this.zztt = str2;
this.name = str3;
if (TextUtils.isEmpty(str)) {
str = null;
}
this.origin = str;
this.timestamp = j;
this.zzaic = j2;
if (this.zzaic != 0 && this.zzaic > this.timestamp) {
zzbt.zzgo().zzjg().zze("Event created with reverse previous/current timestamps. appId, name", zzap.zzbv(str2), zzap.zzbv(str3));
}
this.zzaid = zzaa;
}
zzy(zzbt zzbt, String str, String str2, String str3, long j, long j2, Bundle bundle) {
zzaa zzaa;
Preconditions.checkNotEmpty(str2);
Preconditions.checkNotEmpty(str3);
this.zztt = str2;
this.name = str3;
if (TextUtils.isEmpty(str)) {
str = null;
}
this.origin = str;
this.timestamp = j;
this.zzaic = j2;
if (this.zzaic != 0 && this.zzaic > this.timestamp) {
zzbt.zzgo().zzjg().zzg("Event created with reverse previous/current timestamps. appId", zzap.zzbv(str2));
}
if (bundle == null || bundle.isEmpty()) {
zzaa = new zzaa(new Bundle());
} else {
Bundle bundle2 = new Bundle(bundle);
Iterator it = bundle2.keySet().iterator();
while (it.hasNext()) {
String str4 = (String) it.next();
if (str4 == null) {
zzbt.zzgo().zzjd().zzbx("Param name can't be null");
it.remove();
} else {
Object zzh = zzbt.zzgm().zzh(str4, bundle2.get(str4));
if (zzh == null) {
zzbt.zzgo().zzjg().zzg("Param value can't be null", zzbt.zzgl().zzbt(str4));
it.remove();
} else {
zzbt.zzgm().zza(bundle2, str4, zzh);
}
}
}
zzaa = new zzaa(bundle2);
}
this.zzaid = zzaa;
}
final zzy zza(zzbt zzbt, long j) {
return new zzy(zzbt, this.origin, this.zztt, this.name, this.timestamp, j, this.zzaid);
}
public final String toString() {
String str = this.zztt;
String str2 = this.name;
String valueOf = String.valueOf(this.zzaid);
return new StringBuilder(((String.valueOf(str).length() + 33) + String.valueOf(str2).length()) + String.valueOf(valueOf).length()).append("Event{appId='").append(str).append("', name='").append(str2).append("', params=").append(valueOf).append('}').toString();
}
}
| [
"root@linuxhub.it"
] | root@linuxhub.it |
4ce5d613875aa79bfbb03e308c6ec0a6a208f5e2 | 4bc12609c5c6af8d214e182381f69f4efc68440d | /server-api/src/main/java/com/bin/serverapi/order/mapper/OrderOutDetailMapper.java | 7051551e6bd0032911356cedd45268cc8e9be4ec | [] | no_license | soda0516/ygc-server | 51d269039ea1071a055585f06deeb5f7eb5ac5e7 | 5fdcee9489ffc2fcf961f67f942e9b3129a0c5a3 | refs/heads/master | 2023-02-21T15:32:04.519861 | 2021-01-26T07:37:51 | 2021-01-26T07:37:51 | 326,727,120 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,397 | java | package com.bin.serverapi.order.mapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.bin.serverapi.order.bo.OrderInOutSearchDataBo;
import com.bin.serverapi.order.entity.OrderInDetail;
import com.bin.serverapi.order.entity.OrderOutDetail;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bin.serverapi.report.vo.ReportStoreAccountVo;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;
import java.util.Map;
/**
* <p>
* Mapper 接口
* </p>
*
* @author Soda
* @since 2020-12-29
*/
public interface OrderOutDetailMapper extends BaseMapper<OrderOutDetail> {
/**
* 查询今天的回收单据
* @param page
* @return
*/
IPage<Map<String,Object>> selectWithOrderInToday(IPage<?> page);
/**
* 查询一个有key的,用来设置库
* @param searchData
* @return
*/
IPage<Map<String,Object>> selectWithOrderOut(IPage<?> page, @Param("searchData") OrderInOutSearchDataBo searchData);
/**
* 查询一个有key的,用来设置库存
* @param queryWrapper
* @return
*/
@MapKey("productDetailId")
Map<Long, ReportStoreAccountVo> selectForStoreAccount(@Param(Constants.WRAPPER) Wrapper<OrderOutDetail> queryWrapper);
}
| [
"434898928@qq.com"
] | 434898928@qq.com |
cce5f48353d0aaf2a536af110963032943181d21 | 063dea6b873c3927f3fa023b18516c47fefb5d67 | /Java/06-io/src/com/psl/client/Engine.java | b0b79159342ec18f1158648c964077b23adb0592 | [] | no_license | Gramastha/backup | b0603675d2d94c42ff95ec93397197794639ce00 | 5967a700675a4a5812ebe85eae1f844a703dd1ad | refs/heads/master | 2021-01-13T11:19:27.769614 | 2017-02-09T07:06:12 | 2017-02-09T07:06:12 | 81,420,030 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,075 | java | package com.psl.client;
import java.io.Serializable;
public class Engine implements Serializable{
/**
*
*/
private static final long serialVersionUID = 1962098352167680170L;
private int cubicCapacity;
private double horsepower;
public FuelType fuelType;
public int getCubicCapacity() {
return cubicCapacity;
}
public void setCubicCapacity(int cubicCapacity) {
this.cubicCapacity = cubicCapacity;
}
public double getHorsepower() {
return horsepower;
}
public void setHorsepower(double horsepower) {
this.horsepower = horsepower;
}
@Override
public String toString() {
return " [cubicCapacity=" + cubicCapacity + ", horsepower="
+ horsepower + ", fuelType=" + fuelType + "]";
}
public FuelType getFuleType() {
return fuelType;
}
public void setFuleType(FuelType fuelType) {
this.fuelType = fuelType;
}
public Engine(int cubicCapacity, double horsepower, FuelType fuelType) {
super();
this.cubicCapacity = cubicCapacity;
this.horsepower = horsepower;
this.fuelType = fuelType;
}
public Engine() {
super();
}
}
| [
"abhishek_gramastha@persistent.co.in"
] | abhishek_gramastha@persistent.co.in |
1f66a3f63b4ccb2ea576ea158fc4fbd26c86504a | f77d46dcfe5362c35f0df23f800bacc168096d89 | /app/src/main/java/com/bawei/MainActivity.java | 798566a6431050f2f8b2de0080f68200f0f6d383 | [] | no_license | libokang321/Even0609 | 50cf6e2f654155a6071fcf4689645eeb21ab534a | 0f8f687239f6ac2c9dadbbca35a78848ddd66bf6 | refs/heads/master | 2020-06-02T03:01:50.235932 | 2019-06-09T14:10:50 | 2019-06-09T14:10:50 | 191,014,239 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,701 | java | package com.bawei;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.FormBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
login("16619948760","123");
}
private void login(String s, String s1) {
OkHttpClient okHttpClient = new OkHttpClient.Builder()
.connectTimeout(10, TimeUnit.SECONDS)
.readTimeout(10,TimeUnit.SECONDS)
.writeTimeout(10,TimeUnit.SECONDS)
.build();
// 通过表单请求体请求,请求方式为post
RequestBody requestBody = new FormBody.Builder()
.add("phone",s)
.add("pwd",s1).build();
Request request = new Request.Builder()
.url("http://172.17.8.100/small/user/v1/login")
.post(requestBody)
.build();
Call call = okHttpClient.newCall(request);
call.enqueue(new Callback() {
@Override
public void onFailure(Call call, IOException e) {
}
@Override
public void onResponse(Call call, Response response) throws IOException {
String string = response.body().string();
System.out.println("result =="+string);
}
});
}
}
| [
"978866518@qq.com"
] | 978866518@qq.com |
e67eb4504656636c21f2de66726e65bd668ddc81 | 786b6f42b57e45f4413cceb1ce93005f3d989c2a | /psi-integ/src/main/java/org/muhia/app/psi/integ/wsdl/crba/transunion/Product105.java | e467c3a89a6615ba8fd06921b5f75b57b4563bba | [] | no_license | wangqi7/psi | 8ee99dfaa9ae7dc68dfe754d94fdfbf682d2f9a1 | 851338b1953f43682a271e66af5cdae34b3b956c | refs/heads/master | 2020-03-17T09:55:35.206617 | 2017-05-02T08:56:23 | 2017-05-02T08:56:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 20,781 | java | package org.muhia.app.psi.integ.wsdl.crba.transunion;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import java.util.ArrayList;
import java.util.List;
/**
* <p>Java class for product105 complex type.
* <p>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p>
* <pre>
* <complexType name="product105">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="accountList" type="{http://ws.crbws.transunion.ke.co/}account" maxOccurs="unbounded" minOccurs="0"/>
* <element name="alsoKnownAsList" type="{http://ws.crbws.transunion.ke.co/}alsoKnownAsConsumer" maxOccurs="unbounded" minOccurs="0"/>
* <element name="bouncedChequeList" type="{http://ws.crbws.transunion.ke.co/}bouncedCheque" maxOccurs="unbounded" minOccurs="0"/>
* <element name="collateralList" type="{http://ws.crbws.transunion.ke.co/}collateral" maxOccurs="unbounded" minOccurs="0"/>
* <element name="creditApplicationList" type="{http://ws.crbws.transunion.ke.co/}creditApplication" maxOccurs="unbounded" minOccurs="0"/>
* <element name="directorshipList" type="{http://ws.crbws.transunion.ke.co/}directorShip" maxOccurs="unbounded" minOccurs="0"/>
* <element name="disputeStatementList" type="{http://ws.crbws.transunion.ke.co/}disputeStatement" maxOccurs="unbounded" minOccurs="0"/>
* <element name="emailList" type="{http://ws.crbws.transunion.ke.co/}email" maxOccurs="unbounded" minOccurs="0"/>
* <element name="employmentList" type="{http://ws.crbws.transunion.ke.co/}employment" maxOccurs="unbounded" minOccurs="0"/>
* <element name="fraudList" type="{http://ws.crbws.transunion.ke.co/}fraud" maxOccurs="unbounded" minOccurs="0"/>
* <element name="guarantorList" type="{http://ws.crbws.transunion.ke.co/}guarantor" maxOccurs="unbounded" minOccurs="0"/>
* <element name="header" type="{http://ws.crbws.transunion.ke.co/}header" minOccurs="0"/>
* <element name="personalProfile" type="{http://ws.crbws.transunion.ke.co/}personalProfile" minOccurs="0"/>
* <element name="phoneList" type="{http://ws.crbws.transunion.ke.co/}phone" maxOccurs="unbounded" minOccurs="0"/>
* <element name="physicalAddressList" type="{http://ws.crbws.transunion.ke.co/}physicalAddress" maxOccurs="unbounded" minOccurs="0"/>
* <element name="postalAddressList" type="{http://ws.crbws.transunion.ke.co/}postalAddress" maxOccurs="unbounded" minOccurs="0"/>
* <element name="recentEnquiryList" type="{http://ws.crbws.transunion.ke.co/}recentEnquiry" maxOccurs="unbounded" minOccurs="0"/>
* <element name="responseCode" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
* <element name="shareholdingList" type="{http://ws.crbws.transunion.ke.co/}shareholding" maxOccurs="unbounded" minOccurs="0"/>
* <element name="summary" type="{http://ws.crbws.transunion.ke.co/}summary105" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "product105", propOrder = {"accountList", "alsoKnownAsList", "bouncedChequeList", "collateralList", "creditApplicationList", "directorshipList", "disputeStatementList", "emailList", "employmentList", "fraudList", "guarantorList", "header", "personalProfile", "phoneList", "physicalAddressList", "postalAddressList", "recentEnquiryList", "responseCode", "shareholdingList", "summary"})
public class Product105 {
@XmlElement(nillable = true)
protected List<Account> accountList;
@XmlElement(nillable = true)
protected List<AlsoKnownAsConsumer> alsoKnownAsList;
@XmlElement(nillable = true)
protected List<BouncedCheque> bouncedChequeList;
@XmlElement(nillable = true)
protected List<Collateral> collateralList;
@XmlElement(nillable = true)
protected List<CreditApplication> creditApplicationList;
@XmlElement(nillable = true)
protected List<DirectorShip> directorshipList;
@XmlElement(nillable = true)
protected List<DisputeStatement> disputeStatementList;
@XmlElement(nillable = true)
protected List<Email> emailList;
@XmlElement(nillable = true)
protected List<Employment> employmentList;
@XmlElement(nillable = true)
protected List<Fraud> fraudList;
@XmlElement(nillable = true)
protected List<Guarantor> guarantorList;
protected Header header;
protected PersonalProfile personalProfile;
@XmlElement(nillable = true)
protected List<Phone> phoneList;
@XmlElement(nillable = true)
protected List<PhysicalAddress> physicalAddressList;
@XmlElement(nillable = true)
protected List<PostalAddress> postalAddressList;
@XmlElement(nillable = true)
protected List<RecentEnquiry> recentEnquiryList;
protected Integer responseCode;
@XmlElement(nillable = true)
protected List<Shareholding> shareholdingList;
protected Summary105 summary;
/**
* Gets the value of the accountList property.
* <p>
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the accountList property.
* <p>
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getAccountList().add(newItem);
* </pre>
* <p>
* <p>
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Account }
*/
public List<Account> getAccountList() {
if (accountList == null) {
accountList = new ArrayList<Account>();
}
return this.accountList;
}
/**
* Gets the value of the alsoKnownAsList property.
* <p>
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the alsoKnownAsList property.
* <p>
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getAlsoKnownAsList().add(newItem);
* </pre>
* <p>
* <p>
* <p>
* Objects of the following type(s) are allowed in the list
* {@link AlsoKnownAsConsumer }
*/
public List<AlsoKnownAsConsumer> getAlsoKnownAsList() {
if (alsoKnownAsList == null) {
alsoKnownAsList = new ArrayList<AlsoKnownAsConsumer>();
}
return this.alsoKnownAsList;
}
/**
* Gets the value of the bouncedChequeList property.
* <p>
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the bouncedChequeList property.
* <p>
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getBouncedChequeList().add(newItem);
* </pre>
* <p>
* <p>
* <p>
* Objects of the following type(s) are allowed in the list
* {@link BouncedCheque }
*/
public List<BouncedCheque> getBouncedChequeList() {
if (bouncedChequeList == null) {
bouncedChequeList = new ArrayList<BouncedCheque>();
}
return this.bouncedChequeList;
}
/**
* Gets the value of the collateralList property.
* <p>
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the collateralList property.
* <p>
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getCollateralList().add(newItem);
* </pre>
* <p>
* <p>
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Collateral }
*/
public List<Collateral> getCollateralList() {
if (collateralList == null) {
collateralList = new ArrayList<Collateral>();
}
return this.collateralList;
}
/**
* Gets the value of the creditApplicationList property.
* <p>
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the creditApplicationList property.
* <p>
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getCreditApplicationList().add(newItem);
* </pre>
* <p>
* <p>
* <p>
* Objects of the following type(s) are allowed in the list
* {@link CreditApplication }
*/
public List<CreditApplication> getCreditApplicationList() {
if (creditApplicationList == null) {
creditApplicationList = new ArrayList<CreditApplication>();
}
return this.creditApplicationList;
}
/**
* Gets the value of the directorshipList property.
* <p>
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the directorshipList property.
* <p>
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getDirectorshipList().add(newItem);
* </pre>
* <p>
* <p>
* <p>
* Objects of the following type(s) are allowed in the list
* {@link DirectorShip }
*/
public List<DirectorShip> getDirectorshipList() {
if (directorshipList == null) {
directorshipList = new ArrayList<DirectorShip>();
}
return this.directorshipList;
}
/**
* Gets the value of the disputeStatementList property.
* <p>
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the disputeStatementList property.
* <p>
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getDisputeStatementList().add(newItem);
* </pre>
* <p>
* <p>
* <p>
* Objects of the following type(s) are allowed in the list
* {@link DisputeStatement }
*/
public List<DisputeStatement> getDisputeStatementList() {
if (disputeStatementList == null) {
disputeStatementList = new ArrayList<DisputeStatement>();
}
return this.disputeStatementList;
}
/**
* Gets the value of the emailList property.
* <p>
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the emailList property.
* <p>
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getEmailList().add(newItem);
* </pre>
* <p>
* <p>
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Email }
*/
public List<Email> getEmailList() {
if (emailList == null) {
emailList = new ArrayList<Email>();
}
return this.emailList;
}
/**
* Gets the value of the employmentList property.
* <p>
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the employmentList property.
* <p>
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getEmploymentList().add(newItem);
* </pre>
* <p>
* <p>
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Employment }
*/
public List<Employment> getEmploymentList() {
if (employmentList == null) {
employmentList = new ArrayList<Employment>();
}
return this.employmentList;
}
/**
* Gets the value of the fraudList property.
* <p>
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the fraudList property.
* <p>
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getFraudList().add(newItem);
* </pre>
* <p>
* <p>
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Fraud }
*/
public List<Fraud> getFraudList() {
if (fraudList == null) {
fraudList = new ArrayList<Fraud>();
}
return this.fraudList;
}
/**
* Gets the value of the guarantorList property.
* <p>
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the guarantorList property.
* <p>
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getGuarantorList().add(newItem);
* </pre>
* <p>
* <p>
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Guarantor }
*/
public List<Guarantor> getGuarantorList() {
if (guarantorList == null) {
guarantorList = new ArrayList<Guarantor>();
}
return this.guarantorList;
}
/**
* Gets the value of the header property.
*
* @return possible object is
* {@link Header }
*/
public Header getHeader() {
return header;
}
/**
* Sets the value of the header property.
*
* @param value allowed object is
* {@link Header }
*/
public void setHeader(Header value) {
this.header = value;
}
/**
* Gets the value of the personalProfile property.
*
* @return possible object is
* {@link PersonalProfile }
*/
public PersonalProfile getPersonalProfile() {
return personalProfile;
}
/**
* Sets the value of the personalProfile property.
*
* @param value allowed object is
* {@link PersonalProfile }
*/
public void setPersonalProfile(PersonalProfile value) {
this.personalProfile = value;
}
/**
* Gets the value of the phoneList property.
* <p>
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the phoneList property.
* <p>
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getPhoneList().add(newItem);
* </pre>
* <p>
* <p>
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Phone }
*/
public List<Phone> getPhoneList() {
if (phoneList == null) {
phoneList = new ArrayList<Phone>();
}
return this.phoneList;
}
/**
* Gets the value of the physicalAddressList property.
* <p>
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the physicalAddressList property.
* <p>
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getPhysicalAddressList().add(newItem);
* </pre>
* <p>
* <p>
* <p>
* Objects of the following type(s) are allowed in the list
* {@link PhysicalAddress }
*/
public List<PhysicalAddress> getPhysicalAddressList() {
if (physicalAddressList == null) {
physicalAddressList = new ArrayList<PhysicalAddress>();
}
return this.physicalAddressList;
}
/**
* Gets the value of the postalAddressList property.
* <p>
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the postalAddressList property.
* <p>
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getPostalAddressList().add(newItem);
* </pre>
* <p>
* <p>
* <p>
* Objects of the following type(s) are allowed in the list
* {@link PostalAddress }
*/
public List<PostalAddress> getPostalAddressList() {
if (postalAddressList == null) {
postalAddressList = new ArrayList<PostalAddress>();
}
return this.postalAddressList;
}
/**
* Gets the value of the recentEnquiryList property.
* <p>
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the recentEnquiryList property.
* <p>
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getRecentEnquiryList().add(newItem);
* </pre>
* <p>
* <p>
* <p>
* Objects of the following type(s) are allowed in the list
* {@link RecentEnquiry }
*/
public List<RecentEnquiry> getRecentEnquiryList() {
if (recentEnquiryList == null) {
recentEnquiryList = new ArrayList<RecentEnquiry>();
}
return this.recentEnquiryList;
}
/**
* Gets the value of the responseCode property.
*
* @return possible object is
* {@link Integer }
*/
public Integer getResponseCode() {
return responseCode;
}
/**
* Sets the value of the responseCode property.
*
* @param value allowed object is
* {@link Integer }
*/
public void setResponseCode(Integer value) {
this.responseCode = value;
}
/**
* Gets the value of the shareholdingList property.
* <p>
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the shareholdingList property.
* <p>
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getShareholdingList().add(newItem);
* </pre>
* <p>
* <p>
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Shareholding }
*/
public List<Shareholding> getShareholdingList() {
if (shareholdingList == null) {
shareholdingList = new ArrayList<Shareholding>();
}
return this.shareholdingList;
}
/**
* Gets the value of the summary property.
*
* @return possible object is
* {@link Summary105 }
*/
public Summary105 getSummary() {
return summary;
}
/**
* Sets the value of the summary property.
*
* @param value allowed object is
* {@link Summary105 }
*/
public void setSummary(Summary105 value) {
this.summary = value;
}
}
| [
"deniskalenga94@gmail.com"
] | deniskalenga94@gmail.com |
28e267febb9e069273f45ac5befd09ad2f4f450b | 0e5fa8732c43932bdc06f6ad75d2d08d6f9e24e9 | /desktop/src/uk/co/daentech/helio/desktop/DesktopLauncher.java | 26c2539e2c923b47b50329a0ed17c589128c0f8b | [] | no_license | daentech/Helio | b982227ac30801f6739a98f754083866fb27e8e1 | 22bd3c5acdd2ecd5147ef683419bab015244135c | refs/heads/master | 2020-04-27T00:35:35.133969 | 2014-04-14T23:22:08 | 2014-04-14T23:22:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 403 | java | package uk.co.daentech.helio.desktop;
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
import uk.co.daentech.helio.Helio;
public class DesktopLauncher {
public static void main (String[] arg) {
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
new LwjglApplication(new Helio(), config);
}
}
| [
"dan.gilbert@smilemachine.com"
] | dan.gilbert@smilemachine.com |
cd7ace4588754482d5dbc5b4b70c8efeae78a894 | 14c14941608233cc6d447fa9ce82074ccb489711 | /model/src/main/java/io/superbiz/baby/model/Music.java | 9ca2b49e72e423bee3a97cefa40dbb66e9924c5c | [] | no_license | tomitribe/babystore-demo | f98a04573d4c05370397219c50e2abcd19c06c6f | ec311b12351d2043be13c36a98817e84eaddf67f | refs/heads/master | 2020-03-30T06:59:59.085759 | 2018-10-24T02:50:43 | 2018-10-24T02:50:43 | 150,906,934 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,699 | 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
* <p/>
* http://www.apache.org/licenses/LICENSE-2.0
* <p/>
* 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.superbiz.baby.model;
public class Music {
private long id;
private String category;
private String name;
private String singer;
public Music() {
}
public Music(String category, String name, String singer) {
this.category = category;
this.name = name;
this.singer = singer;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSinger() {
return singer;
}
public void setSinger(String singer) {
this.singer = singer;
}
}
| [
"ijunckes@tomitribe.com"
] | ijunckes@tomitribe.com |
82747abcef4d0332f36d3a4fb5133f99d27cec48 | a94d20a6346d219c84cc97c9f7913f1ce6aba0f8 | /saksbehandling/webapp/src/main/java/no/nav/foreldrepenger/web/app/tjenester/behandling/dto/behandling/SimuleringApplikasjonUrlTjeneste.java | 07f6e4ee6ee992eb2bd07d8b74c372cea36e0768 | [
"MIT"
] | permissive | junnae/spsak | 3c8a155a1bf24c30aec1f2a3470289538c9de086 | ede4770de33bd896d62225a9617b713878d1efa5 | refs/heads/master | 2020-09-11T01:56:53.748986 | 2019-02-06T08:14:42 | 2019-02-06T08:14:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 639 | java | package no.nav.foreldrepenger.web.app.tjenester.behandling.dto.behandling;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import no.nav.vedtak.konfig.KonfigVerdi;
@ApplicationScoped
public class SimuleringApplikasjonUrlTjeneste {
private String baseUrl;
public SimuleringApplikasjonUrlTjeneste() {
//for CDI proxy
}
@Inject
public SimuleringApplikasjonUrlTjeneste(@KonfigVerdi("fpoppdrag.url") String baseUrl) {
this.baseUrl = baseUrl;
}
public String getUrlForSimuleringsresultat(){
return baseUrl + "/fpoppdrag/api/simulering/resultat";
}
}
| [
"roy.andre.gundersen@nav.no"
] | roy.andre.gundersen@nav.no |
910dc2414bea80535aa9c3429934040a17efab2d | 2d532773b19f9d9c501629f77de95be36b9028ec | /Standalone/src/main/java/prompto/config/DebugEventAdapterConfiguration.java | 20937d2edf5b93ab6d7376817b5d7f6849d46e92 | [] | no_license | prompto/prompto-java | 463c4ada242d49834ffd0e668c24dd70ede555ac | e629ddd3bb43bd90ba91774c970acff3d7e38d70 | refs/heads/master | 2022-12-08T09:50:36.000257 | 2022-11-27T22:33:55 | 2022-11-27T22:33:55 | 32,623,616 | 5 | 2 | null | 2022-02-16T08:12:15 | 2015-03-21T07:16:21 | Java | UTF-8 | Java | false | false | 121 | java | package prompto.config;
public class DebugEventAdapterConfiguration extends IDebugEventAdapterConfiguration.Inline {
}
| [
"eric.vergnaud@wanadoo.fr"
] | eric.vergnaud@wanadoo.fr |
3a96c01b377f048e9e2332f9badc21b6d609a6e9 | 7317f11d870ddd49f6d4d2b3e8e4319a2da07ba7 | /FileOperationsExamples/src/com/json/pojo/example/MutltiTreadFileDataMapCreation.java | 2f56b2c39e26141391e862d57eaef7ae3b9820bc | [] | no_license | SkrGitRepo/CoreJavaRepo | 5eea5d56774b34f3d4611507f8801b5e25f86661 | 5d1420a6e9a1045844dcc1c58c13ccae17d8393b | refs/heads/master | 2021-01-11T19:03:00.133805 | 2017-01-18T04:17:37 | 2017-01-18T04:17:37 | 79,302,618 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,859 | java | package com.json.pojo.example;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.time.Duration;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.filefilter.WildcardFileFilter;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
public class MutltiTreadFileDataMapCreation {
public static void main(String args[]) throws Exception {
final int MYTHREADS = 10;
ExecutorService executor = Executors.newFixedThreadPool(MYTHREADS);
List<Map<String, Object>> superJsonResponse = new ArrayList<Map<String, Object>>();
Instant start = Instant.now();
String[] lifecycle = { "DEV","PRD","LT","STG","POC" };
for (int i = 0; i < lifecycle.length; i++) {
String lc = lifecycle[i];
Runnable worker = new MyRunnable(lc, superJsonResponse);
executor.execute(worker);
}
executor.shutdown();
// Wait until all threads are finish
while (!executor.isTerminated()) {
}
if (superJsonResponse != null) {
Gson gson = new GsonBuilder().setPrettyPrinting().create();
String outputJson = gson.toJson(superJsonResponse);
//System.out.println(json);
//String outputJson = new Gson().toJson(superJsonResponse);
System.out.println(outputJson);
//System.out.println(outputJson);
}
Instant end = Instant.now();
System.out.println("TOTAL TIME TAKEN TO EXECUTE :"+Duration.between(start, end));
System.out.println("\nFinished all threads");
}
public static class MyRunnable implements Runnable {
String folderLoc = "/opt/brms/shared/scripts/";
Collection<File> fileList = new ArrayList<File>();
Iterator<File> fileListIterator = null;
String searchDomain = null;
String searchApp =null;
private final String lc;
List<Map<String, Object>> superJsonResponse;
MyRunnable(String lc, List<Map<String, Object>> superJsonResponse) {
this.lc = lc;
this.superJsonResponse = superJsonResponse;
}
@Override
public void run() {
try {
System.out.println("RUN Start for LIFECYCLE :"+lc);
final String fileFilterString = "brms_vm_cfg_*" + lc + ".txt";
fileList = FileUtils.listFiles(new File(folderLoc), new WildcardFileFilter(fileFilterString), null);
File file;
JsonResponse jsonResponse = new JsonResponse();
List<String> hostList = null;
Map<String, Object> appMap = new HashMap<String, Object>();
Map<String, Object> tempMap = new HashMap<String, Object>();
Map<String, Object> domainMap = new HashMap<String, Object>();
Map<String, Object> lifecycleMap = new HashMap<String, Object>();
Map<String, Object> finalJsonMap = new HashMap<String, Object>();
Map<String, Object> hostMap = null;
fileListIterator = fileList.iterator();
while (fileListIterator.hasNext()) {
file = (File) fileListIterator.next();
System.out.println("-----------------------------------------------");
System.out.println("Read config file"+file.getName());
System.out.println("-----------------------------------------------");
if (file.exists()) {
List<String> lines = FileUtils.readLines(file);
for (String line : lines) {
if ((!line.contains("CONTEXT")) || (!line.contains(""))) {
if (!line.contains("#")) {
String[] tokens = line.split(",");
String[] domainPath = tokens[9].split("/");
String allOutput = tokens[10] + "|" + tokens[0] + "|" + tokens[1] + "|" + tokens[2]
+ "|" + tokens[3] + "|" + tokens[4] + "|" + tokens[5] + "|" + tokens[6]
+ "|" + tokens[7] + "|" + tokens[8] + "|" + tokens[9];
//System.out.println("All input line:(lc,host,)" + allOutput);
if ((domainPath[1].equals(searchDomain)) && ((domainPath.length >= 2))
&& (searchApp == null)) {
finalJsonMap = createJson(jsonResponse, domainPath, hostList, tokens, hostMap,
domainMap, lifecycleMap, appMap, tempMap);
} else if ((domainPath[1].equals(searchDomain)) && (domainPath.length == 3)
&& (domainPath[2].equals(searchApp))) {
finalJsonMap = createJson(jsonResponse, domainPath, hostList, tokens, hostMap,
domainMap, lifecycleMap, appMap, tempMap);
} else if ((searchDomain == null) && (searchApp == null)) {
finalJsonMap = createJson(jsonResponse, domainPath, hostList, tokens, hostMap,
domainMap, lifecycleMap, appMap, tempMap);
}
}
}
}
} else {
System.out.println("No matching file exists to read...!");
}
}
if (!finalJsonMap.isEmpty()) {
superJsonResponse.add(finalJsonMap);
}
System.out.println("RUN END for LIFECYCLE :"+lc);
} catch (Exception e) {
System.err.println("Exception ocured while excecuting RUN thread for LIFECYCLE :"+lc+" \n EXCEPTION :: "+e);
}
System.out.println(lc + "\t\tStatus:");
}
private Map<String, Object> createJson(JsonResponse jsonResponse, String[] domainPath, List<String> hostList,
String[] tokens, Map<String, Object> hostMap, Map<String, Object> domainMap,
Map<String, Object> lifecycleMap, Map<String, Object> appMap, Map<String, Object> tempMap) {
// TODO Auto-generated method stub
if ( !(null == jsonResponse.getDomain()) && jsonResponse.getDomain().containsKey(domainPath[1]) ) {
if (domainPath.length == 3) {
@SuppressWarnings("unchecked")
Map<String, Object> domainLevelApps = (Map<String, Object>) jsonResponse.getDomain().get(domainPath[1]);
@SuppressWarnings("unchecked")
Map<String, Object> apps = (Map<String, Object>) domainLevelApps.get("APPS");
if (!domainLevelApps.containsKey("APPS")) {
hostList = new ArrayList<String>();
hostList.add(tokens[0] + ":" + tokens[3]);
hostMap = new HashMap<String, Object>();
hostMap.put("HOSTS", hostList);
String emanResponse = emanStatusResponse(tokens[10], domainPath[1], domainPath[2]);
hostMap.put("STATUS", emanResponse);
hostMap.put("DateTime", new Date(System.currentTimeMillis()));
Map<String, Object> newApp = new HashMap<String, Object>();
newApp.put(domainPath[2], hostMap);
domainLevelApps.put("APPS", newApp);
jsonResponse.setApp(domainLevelApps);
domainMap.put(domainPath[1], domainLevelApps);
jsonResponse.setDomain(domainMap);
} else if (!apps.containsKey(domainPath[2])) {
hostList = new ArrayList<>();
hostList.add(tokens[0] + ":" + tokens[3]);
hostMap = new HashMap<String, Object>();
hostMap.put("HOSTS", hostList);
String emanResponse = emanStatusResponse(tokens[10], domainPath[1], domainPath[2]);
hostMap.put("STATUS", emanResponse);
hostMap.put("DateTime", new Date(System.currentTimeMillis()));
@SuppressWarnings("unchecked")
Map<String, Object> existingAppMap = (Map<String, Object>) domainLevelApps.get("APPS");
existingAppMap.put(domainPath[2], hostMap);
domainLevelApps.put("APPS", existingAppMap);
jsonResponse.setApp(domainLevelApps);
domainMap.put(domainPath[1], domainLevelApps);
jsonResponse.setDomain(domainMap);
} else if (apps.containsKey(domainPath[2])) {
@SuppressWarnings("unchecked")
Map<String, Object> existingAppMap = (Map<String, Object>) domainLevelApps.get("APPS");
@SuppressWarnings("unchecked")
Map<String, Object> value = (Map<String, Object>) existingAppMap.get(domainPath[2]);
@SuppressWarnings("unchecked")
List<String> existingHosts = (List<String>) value.get("HOSTS");
existingHosts.add(tokens[0] + ":" + tokens[3]);
hostMap = new HashMap<String, Object>();
hostMap.put("HOSTS", existingHosts);
String emanResponse = emanStatusResponse(tokens[10], domainPath[1], domainPath[2]);
hostMap.put("STATUS", emanResponse);
hostMap.put("DateTime", new Date(System.currentTimeMillis()));
existingAppMap.put(domainPath[2], hostMap);
domainLevelApps.put("APPS", existingAppMap);
jsonResponse.setApp(domainLevelApps);
domainMap.put(domainPath[1], domainLevelApps);
jsonResponse.setDomain(domainMap);
}
} else {
@SuppressWarnings("unchecked")
Map<String, Object> dHosts = (Map<String, Object>) jsonResponse.getDomain().get(domainPath[1]);
if (!dHosts.containsKey("HOSTS")) {
hostList = new ArrayList<>();
hostList.add(tokens[0] + ":" + tokens[3]);
@SuppressWarnings("unchecked")
Map<String, Object> map = (Map<String, Object>) jsonResponse.getDomain().get(domainPath[1]);
map.put("HOSTS", hostList);
String emanResponse = emanStatusResponse(tokens[10], domainPath[1], null);
map.put("STATUS", emanResponse);
map.put("DateTime", new Date(System.currentTimeMillis()));
jsonResponse.setHost(map);
domainMap.put(domainPath[1], map);
jsonResponse.setDomain(domainMap);
} else {
@SuppressWarnings("unchecked")
Map<String, Object> domMap = (Map<String, Object>) jsonResponse.getDomain().get(domainPath[1]);
@SuppressWarnings("unchecked")
List<String> existingHosts = (List<String>) domMap.get("HOSTS");
existingHosts.add(tokens[0] + ":" + tokens[3]);
hostMap = new HashMap<String, Object>();
hostMap.put("HOSTS", existingHosts);
String emanResponse = emanStatusResponse(tokens[10], domainPath[1], null);
hostMap.put("STATUS", emanResponse);
hostMap.put("DateTime", new Date(System.currentTimeMillis()));
hostMap.putAll(domMap);
jsonResponse.setHost(hostMap);
domainMap.put(domainPath[1], hostMap);
jsonResponse.setDomain(domainMap);
}
}
lifecycleMap.put(tokens[10], domainMap);
jsonResponse.setLifecycle(lifecycleMap);
} else {
if (!(null == jsonResponse.getLifecycle()) && jsonResponse.getLifecycle().containsKey(tokens[10])) {
@SuppressWarnings("unchecked")
Map<String, Object> lifeCycleMap = (Map<String, Object>) jsonResponse.getLifecycle().get(tokens[10]);
if (domainPath.length == 3) {
hostList = new ArrayList<String>();
hostList.add(tokens[0] + ":" + tokens[3]);
hostMap = new HashMap<String, Object>();
hostMap.put("HOSTS", hostList);
String emanResponse = emanStatusResponse(tokens[10], domainPath[1], domainPath[2]);
hostMap.put("STATUS", emanResponse);
hostMap.put("DateTime", new Date(System.currentTimeMillis()));
appMap.put(domainPath[2], hostMap);
jsonResponse.setApp(appMap);
tempMap.put("APPS", appMap);
lifeCycleMap.put(domainPath[1], tempMap);
jsonResponse.setDomain(lifeCycleMap);
} else {
hostList = new ArrayList<>();
hostList.add(tokens[0] + ":" + tokens[3]);
hostMap = new HashMap<String, Object>();
hostMap.put("HOSTS", hostList);
String emanResponse = emanStatusResponse(tokens[10], domainPath[1], null);
hostMap.put("STATUS", emanResponse);
hostMap.put("DateTime", new Date(System.currentTimeMillis()));
lifeCycleMap.put(domainPath[1], hostMap);
jsonResponse.setDomain(lifeCycleMap);
}
lifecycleMap.put(tokens[10], lifeCycleMap);
jsonResponse.setLifecycle(lifecycleMap);
} else {
if (domainPath.length == 3) {
hostList = new ArrayList<String>();
hostList.add(tokens[0] + ":" + tokens[3]);
hostMap = new HashMap<String, Object>();
hostMap.put("HOSTS", hostList);
String emanResponse = emanStatusResponse(tokens[10], domainPath[1], domainPath[2]);
hostMap.put("STATUS", emanResponse);
hostMap.put("DateTime", new Date(System.currentTimeMillis()));
appMap.put(domainPath[2], hostMap);
jsonResponse.setApp(appMap);
tempMap.put("APPS", appMap);
domainMap.put(domainPath[1], tempMap);
jsonResponse.setDomain(domainMap);
} else {
hostList = new ArrayList<>();
hostList.add(tokens[0] + ":" + tokens[3]);
hostMap = new HashMap<String, Object>();
hostMap.put("HOSTS", hostList);
String emanResponse = emanStatusResponse(tokens[10], domainPath[1], null);
hostMap.put("STATUS", emanResponse);
hostMap.put("DateTime", new Date(System.currentTimeMillis()));
domainMap.put(domainPath[1], hostMap);
jsonResponse.setDomain(domainMap);
}
lifecycleMap.put(tokens[10], domainMap);
jsonResponse.setLifecycle(lifecycleMap);
}
}
return lifecycleMap;
}
private String emanStatusResponse(String lifecycle,String domain,String dApp) {
// TODO Auto-generated method stub
String webPage = null;
String resMessage = null;
if (lifecycle.equals("dev")){
if(dApp == null) {
webPage = "https://ibpm-dev.cisco.com/"+domain+"/brmsadmin/eman";
} else {
webPage = "https://ibpm-dev.cisco.com/"+domain+"/"+dApp+"/brmsadmin/eman";
}
} else if(lifecycle.equals("stage")) {
if(dApp == null) {
webPage = "https://ibpm-stage.cisco.com/"+domain+"/brmsadmin/eman";
} else {
webPage = "https://ibpm-stage.cisco.com/"+domain+"/"+dApp+"/brmsadmin/eman";
}
} else if(lifecycle.equals("lt")) {
if(dApp == null) {
webPage = "https://ibpm-lt.cisco.com/"+domain+"/brmsadmin/eman";
} else {
webPage = "https://ibpm-lt.cisco.com/"+domain+"/"+dApp+"/brmsadmin/eman";
}
} else if (lifecycle.equals("poc")) {
if(dApp == null) {
webPage = "https://ibpm-poc.cisco.com/"+domain+"/brmsadmin/eman";
} else {
webPage = "https://ibpm-poc.cisco.com/"+domain+"/"+dApp+"/brmsadmin/eman";
}
} else if (lifecycle.equals("prod")) {
if(dApp == null) {
webPage = "https://ibpm.cisco.com/"+domain+"/brmsadmin/eman";
} else {
webPage = "https://ibpm.cisco.com/"+domain+"/"+dApp+"/brmsadmin/eman";
}
}
//webPage="https://ibpm.cisco.com/gssc/brmsadmin/eman";
try {
System.out.println("INPUT EMAN URL TO CHECK::"+webPage);
URL url = new URL(webPage);
HttpURLConnection httpCon = (HttpURLConnection)url.openConnection();
//httpCon.setRequestProperty("Authorization", "Basic " + authStringEnc);
int statusCode = httpCon.getResponseCode();
InputStream is = httpCon.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
//String resContent = http.getContentEncoding().toString();
int numCharsRead;
char[] charArray = new char[1024];
StringBuffer sb = new StringBuffer();
while ((numCharsRead = isr.read(charArray)) > 0) {
sb.append(charArray, 0, numCharsRead);
}
String emanResponse = sb.toString();
/*System.out.println(" ******* URL RESPONSE IS : *****");
System.out.println("URL : "+webPage);
System.out.println("Response STATUS CODE is :"+statusCode);*/
System.out.println(emanResponse);
if (emanResponse.contains("EMAN OK")) {
//System.out.println(emanResponse);
System.out.println("SUCCESS EMAN Response"+emanResponse);
resMessage = "Up";
} else {
System.out.println("Failure EMAN Response"+emanResponse);
resMessage = "Down";
}
//System.out.println(" *******************************");
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (resMessage == null) {
resMessage = "Down";
}
}
return resMessage;
}
}
} | [
"sumkuma2@SUMKUMA2-0WX8H.cisco.com"
] | sumkuma2@SUMKUMA2-0WX8H.cisco.com |
147a165f10475c4544ca260920081d7350be8a0b | 6a0000b66675fe809235f5c38725eda70db2d609 | /app/src/main/java/engineer/davidauza/veterinariavetcare/models/Ave.java | 590f10afc2c067cd0c1232f9b8a75a0ee33dcbd3 | [] | no_license | davidauza-engineer/Android-VeterinariaVetCare | 5614c8913b317092f3cc790412282d30c185359a | 8d34a7064f3830ed1d01ae5315bb1eeb8bae1902 | refs/heads/master | 2020-06-03T18:28:30.701560 | 2019-10-26T15:26:12 | 2019-10-26T15:26:12 | 191,682,662 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 763 | java | package engineer.davidauza.veterinariavetcare.models;
/**
* Esta clase representa un {@link Ave}, que es una {@link Especie}. Su nombre es "Ave" y
* contiene un arreglo de Strings con nombres de diferentes razas de {@link Ave}s.
*/
public class Ave extends Especie {
/**
* El nombre de la {@link Especie}: {@link Ave}
*/
public static final String NOMBRE = "Ave";
/**
* Las razas de la {@link Especie}: {@link Ave}
*/
public static final String[] RAZAS = {"Águila", "Azulejo", "Cacatúa", "Canario", "Desconocida",
"Gallina", "Gallo", "Halcón", "Loro", "Otra", "Perico", "Pollo"};
/**
* Constructor para crear un nuevo objeto {@link Ave}.
*/
public Ave() {
super(NOMBRE);
}
}
| [
"davidauza01@gmail.com"
] | davidauza01@gmail.com |
ba47cd7a979f801708f1a8c263679c97dca4a4e6 | 5f363d8bd0d944e9961b33143af04a4fa5ecee39 | /src/gcle/fonction/Fonction.java | 7168443a09dc98bfad637b384ebd6f1a8c4e9923 | [] | no_license | terredeciels/IAGCLEv0.9.2 | 20a39a04b295920327ed8ebb317d86ba09da216d | 620560e066145097dfc02427c498890f300fe66a | refs/heads/master | 2020-05-27T14:41:02.537687 | 2012-10-26T23:50:27 | 2012-10-26T23:50:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 177 | java | package gcle.fonction;
import gcle.Contexte;
import gcle.graphe.Noeud;
public abstract class Fonction extends Noeud {
public abstract Contexte exec(Contexte c);
}
| [
"maildecontact@sfr.fr"
] | maildecontact@sfr.fr |
3f16d75774c899d5a276d43ab90ee79be6a9b1c5 | 57cd19bc232c78f05e3f63bff809003f1fb733b5 | /app/src/main/java/com/dedpp/dedppmvvm/data/retrofit/RetrofitClient.java | 8b6d802a6e384bd5c341590e702c07389433486c | [
"Apache-2.0"
] | permissive | eeeeeccccc/DedppMVVM | 54cc63587f8eace27cab9642f32b3811879e2bcf | fd5645dcf7011f2071c0f179df2e99aa87c00532 | refs/heads/master | 2021-09-12T02:03:44.107567 | 2018-04-13T14:15:08 | 2018-04-13T14:15:08 | 103,517,869 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,590 | java | package com.dedpp.dedppmvvm.data.retrofit;
import android.Manifest;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Environment;
import android.support.v4.app.ActivityCompat;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import com.blankj.utilcode.util.EncodeUtils;
import com.blankj.utilcode.util.NetworkUtils;
import com.blankj.utilcode.util.ToastUtils;
import com.dedpp.dedppmvvm.base.MyApplication;
import com.dedpp.dedppmvvm.R;
import com.trello.rxlifecycle2.LifecycleTransformer;
import java.io.File;
import java.io.IOException;
import java.net.CookieManager;
import java.net.CookiePolicy;
import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Enumeration;
import java.util.concurrent.TimeUnit;
import io.reactivex.Observable;
import io.reactivex.ObservableSource;
import io.reactivex.ObservableTransformer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Consumer;
import io.reactivex.schedulers.Schedulers;
import okhttp3.Cache;
import okhttp3.CacheControl;
import okhttp3.Interceptor;
import okhttp3.JavaNetCookieJar;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;
/**
* RetrofitClient
* Created by Dedpp on 2017/8/29.
*/
public class RetrofitClient {
private static final long TIMEOUT = 10;
// private static final String BASE_URL = "http://api.baidu.com/";
private static final String BASE_URL = "http://101.200.157.103:8898/";
// public static final String BASE_URL = "http://192.168.200.12:8080/";//白海安
private static String sCacheDir;
public static String NET_CACHE = sCacheDir + File.separator + "NetCache";
public class Values {
public static final int C_TYPE_ANDROID = 2;
}
private static RetrofitApi retrofitApi;
public static RetrofitApi getInstance() {
if (retrofitApi == null) {
instanceApi(MyApplication.getAppContent());
}
return retrofitApi;
}
private static synchronized void instanceApi(final Context context) {
if (retrofitApi == null) {
final String cid = String.valueOf(getIMei(context));
final String ctype = String.valueOf(Values.C_TYPE_ANDROID);
final String phoneInfo = getFingerprint();
final String version = String.valueOf(getVersion(context));
final String ip = String.valueOf(getHostIP());
final Interceptor headerInterceptor = new Interceptor() {
@Override
public Response intercept(Chain chain) throws IOException {
Request original = chain.request();
Request request = original.newBuilder()
.header("cid", cid)
.header("ctype", ctype)
.header("phone_info", phoneInfo)
.header("version", version)
.header("ip", ip)
.method(original.method(), original.body())
.build();
return chain.proceed(request);
}
};
/*
* 如果存在SD卡则将缓存写入SD卡,否则写入手机内存
*/
Interceptor cacheInterceptor = null;
Cache cache = null;
Context appContext = MyApplication.getAppContent();
if (appContext != null && TextUtils.isEmpty(sCacheDir)) {
if (appContext.getExternalCacheDir() != null && Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
sCacheDir = appContext.getExternalCacheDir().toString();
} else {
sCacheDir = appContext.getCacheDir().toString();
}
// 缓存 http://www.jianshu.com/p/93153b34310e
File cacheFile = new File(NET_CACHE);
cache = new Cache(cacheFile, 1024 * 1024 * 50);
cacheInterceptor = new Interceptor() {
@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request();
if (!NetworkUtils.isConnected()) {
request = request.newBuilder()
.cacheControl(CacheControl.FORCE_CACHE)
.build();
}
Response response = chain.proceed(request);
Response.Builder newBuilder = response.newBuilder();
if (NetworkUtils.isConnected()) {
int maxAge = 0;
// 有网络时 设置缓存超时时间0个小时
newBuilder.header("Cache-Control", "public, max-age=" + maxAge);
} else {
// 无网络时,设置超时为4周
int maxStale = 60 * 60 * 24 * 28;
newBuilder.header("Cache-Control", "public, only-if-cached, max-stale=" + maxStale);
}
return newBuilder.build();
}
};
}
CookieManager cookieManager = new CookieManager();
cookieManager.setCookiePolicy(CookiePolicy.ACCEPT_ALL);
OkHttpClient okHttpClient = new OkHttpClient.Builder()
// .cache(cache)
// .addInterceptor(cacheInterceptor)
.connectTimeout(TIMEOUT, TimeUnit.SECONDS)
.readTimeout(TIMEOUT, TimeUnit.SECONDS)
.writeTimeout(TIMEOUT, TimeUnit.SECONDS)
//错误重连
.retryOnConnectionFailure(true)
.cookieJar(new JavaNetCookieJar(cookieManager))
// .cookieJar(new PersistentCookieJar(new SetCookieCache(), new SharedPrefsCookiePersistor(context)))
.addInterceptor(headerInterceptor)
.build();
retrofitApi = new Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.client(okHttpClient)
.build()
.create(RetrofitApi.class);
}
}
/**
* 线程调度
*/
public static <T> ObservableTransformer<T, T> compose(
final LifecycleTransformer<T> lifecycle) {
return new ObservableTransformer<T, T>() {
@Override
public ObservableSource<T> apply(Observable<T> observable) {
return observable
.subscribeOn(Schedulers.io())
.doOnSubscribe(new Consumer<Disposable>() {
@Override
public void accept(Disposable disposable) throws Exception {
// 可添加网络连接判断等
if (!NetworkUtils.isConnected()) {
ToastUtils.showShort(R.string.toast_network_error);
}
}
})
.observeOn(AndroidSchedulers.mainThread())
.compose(lifecycle);
}
};
}
private static String getIMei(Context context) {
String iMei = "";
try {
TelephonyManager telephonyMgr = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
if (telephonyMgr != null) {
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) {
return iMei;
}
iMei = telephonyMgr.getDeviceId();
}
} catch (Exception e) {
e.printStackTrace();
}
return iMei;
}
private static String getFingerprint() {
String fingerprint = "";
try {
fingerprint = EncodeUtils.base64Encode2String(Build.FINGERPRINT.getBytes());
} catch (Exception e) {
e.printStackTrace();
}
if (TextUtils.isEmpty(fingerprint))
fingerprint = "";
return fingerprint;
}
private static String getVersion(Context context) {
String info = "";
try {
PackageManager pm = context.getPackageManager();
PackageInfo pi = pm.getPackageInfo(context.getPackageName(), PackageManager.GET_CONFIGURATIONS);
if (pi != null) {
int versionCode = pi.versionCode;
String versionName = pi.versionName;
info = versionCode + "|" + versionName;
}
} catch (Exception e) {
e.printStackTrace();
}
return info;
}
private static String getHostIP() {
String hostIp = null;
try {
Enumeration nis = NetworkInterface.getNetworkInterfaces();
InetAddress ia = null;
while (nis.hasMoreElements()) {
NetworkInterface ni = (NetworkInterface) nis.nextElement();
Enumeration<InetAddress> ias = ni.getInetAddresses();
while (ias.hasMoreElements()) {
ia = ias.nextElement();
if (ia != null) {
if (ia instanceof Inet6Address) {
continue;// skip ipv6
}
String ip = ia.getHostAddress();
if (!"127.0.0.1".equals(ip)) {
hostIp = ia.getHostAddress();
break;
}
}
}
}
} catch (SocketException e) {
e.printStackTrace();
}
if (TextUtils.isEmpty(hostIp))
hostIp = "";
return hostIp;
}
}
| [
"248136940@qq.com"
] | 248136940@qq.com |
afd1c465c279a8593d333b3a0bfb8fa1007b3334 | 6a462ada3abf5e313cc84eb4cbaad1e213322a39 | /chapter04/src/main/java/collection/Gugudan.java | 6b9ce44ec7046d58290774feac83120003291f00 | [] | no_license | douzone-bipa/javastudy | 4927d3118593c6ae8dea79c048df5c31bf734d33 | c993ce278ea7e68d79e2dbb14bb5ae174822d153 | refs/heads/master | 2023-08-03T11:57:19.479055 | 2021-09-28T08:13:50 | 2021-09-28T08:13:50 | 403,795,835 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 641 | java | package collection;
import java.util.Objects;
public class Gugudan {
private int left;
private int right;
public Gugudan(int left, int right) {
this.left = left;
this.right = right;
}
@Override
public int hashCode() {
return Objects.hash(left*right);
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Gugudan other = (Gugudan) obj;
return left * right == other.left * other.right;
}
@Override
public String toString() {
return "Gugudan [left=" + left + ", right=" + right + "]";
}
}
| [
"douzone.bipa@gmail.com"
] | douzone.bipa@gmail.com |
8918965f94e57c1bf7c5beea34dafb6d9cdaedcd | 0447a636d20cc8a60b843a921c1a8e3876339bd1 | /src/main/java/com/outofmemory/entity/ComplainInfo.java | 4ea9c7f3bff12db749c40a625d44c3212b9cc058 | [] | no_license | Elya2305/ParkingMania | 7062494228c8053dffa6e1b678ee3524975ee709 | d1bec0ce397abefb9f10e77283052d9815b5c5f0 | refs/heads/master | 2023-04-01T00:07:09.224976 | 2021-03-31T19:00:41 | 2021-03-31T19:00:41 | 329,099,657 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 816 | java | package com.outofmemory.entity;
import com.outofmemory.dto.LocationDto;
import com.outofmemory.entity.common.AuditableEntity;
import com.outofmemory.utils.converer.impl.LocationConverter;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.Type;
import javax.persistence.*;
@EqualsAndHashCode(callSuper = true)
@Entity
@Data
public class ComplainInfo extends AuditableEntity {
@Id
@GeneratedValue
private Integer id;
private String description;
private String photoUrl;
private String autoNumber;
@Enumerated(EnumType.STRING)
private ComplaintStatus status = ComplaintStatus.NEW;
@Column(columnDefinition = "TEXT")
@Convert(converter = LocationConverter.class)
private LocationDto location;
private String locationAddress;
}
| [
"elinafromua@gmail.com"
] | elinafromua@gmail.com |
fa6f8f1a5636e721b2e981cb7d070651548021be | 7c801300e0a03af9c3231a709b2e618039d55061 | /src/GeneticImplemenations/Ten/Implementation/Game.java | e066fcbd2d811f0505573748b67152b7cff87514 | [] | no_license | MohammedEseifan/AI-Genetic-Algorithm | eab459e269f7c2b42d428aff2680fdf6df1a4cfc | 1edae8892061a7f03083350e033a6d63c1291418 | refs/heads/master | 2021-01-11T17:53:34.333181 | 2017-01-27T20:55:21 | 2017-01-27T20:55:21 | 79,862,285 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,481 | java | package GeneticImplemenations.Ten.Implementation;
import GeneticImplemenations.Ten.AI.TenAI;
import GeneticImplemenations.Ten.AI.TenDNA;
/**
* Created by Mohammed on 23-Jan-17.
*/
public class Game {
private XOGrid.GridPiece currentTurn;
private MainGrid gameGrid = new MainGrid();
private TenAI players[] = new TenAI[2];
private GameVizualizer gameVizualizer;
public Game(TenDNA player1DNA, TenDNA player2DNA) {
players[0] = new TenAI(player1DNA, XOGrid.GridPiece.X);
players[1] = new TenAI(player2DNA, XOGrid.GridPiece.O);
}
public Game(TenDNA player1DNA, TenDNA player2DNA, boolean visualizeGame) {
players[0] = new TenAI(player1DNA, XOGrid.GridPiece.X);
players[1] = new TenAI(player2DNA, XOGrid.GridPiece.O);
if (visualizeGame) {
gameVizualizer = new GameVizualizer(gameGrid, 800);
}
}
public XOGrid.GridPiece beginGame() {
resetGame();
while (gameGrid.getWinner() == XOGrid.GridPiece.NONE && gameGrid.getValidSpots().size() > 0) {
doTurn();
}
return gameGrid.getWinner();
}
private void resetGame() {
currentTurn = XOGrid.GridPiece.X;
gameGrid = new MainGrid();
}
private void doTurn() {
players[currentTurn.ordinal()].playTurn(gameGrid);
//Flipping the current turn
currentTurn = currentTurn == XOGrid.GridPiece.X ? XOGrid.GridPiece.O : XOGrid.GridPiece.X;
}
}
| [
"m.eseifansilicon@gmail.com"
] | m.eseifansilicon@gmail.com |
72e6883f66e295192d532c982f7631b3ea886a8a | 5219cf5c6b7d6a674eab22741b6275580540bd1d | /app/src/androidTest/java/com/yendry/recyclerview2/ExampleInstrumentedTest.java | febe0dcc1e4d399de8b241ed4b893a121d3ce2ab | [] | no_license | yktoledo/RecyclerView2 | 69b63a2e9168ff918723ddbd813dba96f04421de | 81d6d8db9aac75b753645bcf4f9faddff11318eb | refs/heads/master | 2021-01-13T12:07:22.070804 | 2016-10-03T22:21:42 | 2016-10-03T22:21:42 | 69,915,767 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 752 | java | package com.yendry.recyclerview2;
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.yendry.recyclerview2", appContext.getPackageName());
}
}
| [
"yktoledo@hotmail.com"
] | yktoledo@hotmail.com |
6be93733cb68df28c3457960dac7e71a1fe03151 | 7e4c6eda31b3e0b8d797c7251cecc907afe86220 | /app/src/main/java/com/jeck/demo/entities/FirstEvent.java | 18b0dff54c529d1b90432060d96f6298a8538e39 | [] | no_license | jidishengguang123/AndroidDemo | 08e566e1081c8c194d3a15d955f525790c3e0a40 | f8e58c9f68d873010ad20b251cb241361c528a1b | refs/heads/master | 2021-01-10T09:08:46.992570 | 2016-02-19T09:23:53 | 2016-02-19T09:23:53 | 49,187,217 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 418 | java | package com.jeck.demo.entities;
/**
* Author:liyang
* Email:jidishengguang123@163.com
* Date: 2016-01-20
* Time: 16:53
* Description:
*/
public class FirstEvent {
private String message;
public FirstEvent(String msg) {
this.message = msg;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}
| [
"jidishengguang123@gmail.com"
] | jidishengguang123@gmail.com |
a00e3ee55683b208e326f377947379ca028c3a87 | 972326078fc118e0e1d1fcf402f8736c3ad80178 | /src/main/java/br/com/casadocodigo/loja/validation/UsuarioValidator.java | 557ca84d95985f6c98fd7b8e24cf486ac0969154 | [] | no_license | imerljak/formacao-java-alura | 290ba2e7bd89b3ffed6a2ffbdb6a8263712ef901 | eea67952a0baf92c513f22772eb5c38277d0b03f | refs/heads/master | 2020-03-22T02:15:55.215997 | 2018-07-01T20:35:59 | 2018-07-01T20:35:59 | 139,359,930 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,606 | java | package br.com.casadocodigo.loja.validation;
import br.com.casadocodigo.loja.dao.UsuarioDAO;
import br.com.casadocodigo.loja.models.Usuario;
import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import org.springframework.validation.Validator;
public class UsuarioValidator implements Validator {
private UsuarioDAO usuarioDAO;
public UsuarioValidator(UsuarioDAO usuarioDAO) {
this.usuarioDAO = usuarioDAO;
}
@Override
public boolean supports(Class<?> aClass) {
return Usuario.class.isAssignableFrom(aClass);
}
@Override
public void validate(Object o, Errors errors) {
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "nome", "field.required");
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "email", "field.required");
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "senha", "field.required");
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "confirmaSenha", "field.required");
Usuario u = (Usuario) o;
if (u.getSenha() != null) {
if (u.getSenha().length() < 5) {
errors.rejectValue("senha", "field.length.password");
}
if (!u.getSenha().equals(u.getConfirmaSenha())) {
errors.rejectValue("senha", "field.mismatch.password");
errors.rejectValue("confirmaSenha", "field.mismatch.password");
}
}
if (usuarioDAO.findByEmail(u.getEmail()).isPresent()) {
errors.rejectValue("email", "field.unique.email");
}
}
}
| [
"imerljak@gmail.com"
] | imerljak@gmail.com |
4afc26d35b0d0550bf86ff4116b256751c37ab06 | b5a62331f8c5b605151ebd900a8321440f0617f4 | /Sources/concept/components/admin/edit/SWDocEditGeneric.java | 08471d497ba00d8c15b1c39e9753698cdc5476d4 | [] | no_license | jfveillette/soloweb | 12dbc953c1254193608e4b9a6be2cd516b391bdf | fbb05e6a204e2e61c72f3275c745aea32700826a | refs/heads/master | 2016-09-10T06:48:50.028201 | 2014-04-16T08:53:09 | 2014-04-16T08:53:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 520 | java | package concept.components.admin.edit;
import com.webobjects.appserver.WOContext;
import concept.CPAdminComponent;
import concept.data.SWDocument;
/**
* Document editing for generic binary documents.
*/
public abstract class SWDocEditGeneric extends CPAdminComponent {
private SWDocument _document;
public SWDocEditGeneric( WOContext context ) {
super( context );
}
public void setDocument( SWDocument newDocument ) {
_document = newDocument;
}
public SWDocument document() {
return _document;
}
} | [
"hugi@karlmenn.is"
] | hugi@karlmenn.is |
ed38f41959f6678bf5401dac230a6b9398c831fa | d4267e9296c1a5ea58563bdf44360477b6b4d383 | /app/src/test/java/com/nathanaganoglu/artbook/ExampleUnitTest.java | 94b2f7da1157209ecaf20688a1ea1042a6f5f87e | [] | no_license | NathanAganoglu/ArtBook | bcf57537f60f08f98135ded51533aa5ffd77dcf3 | 6c02ec26fe7271d61d01e202475693deeaaf0f53 | refs/heads/master | 2021-05-03T05:48:30.861679 | 2018-02-07T09:16:33 | 2018-02-07T09:16:33 | 120,584,631 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 404 | java | package com.nathanaganoglu.artbook;
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() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"nathanaganoglu@windowslive.com"
] | nathanaganoglu@windowslive.com |
1d4b5480cd18b4901bcb364fe58665aeaaa2a63a | c259cc20aeebbfc5f40099e5d89a368ddf05459e | /onlineClassroom/src/main/java/com/ocr/info/controller/InfoIndexController.java | 4b963baf437646c8c074541b32d7223294fb0c70 | [] | no_license | air-teng/graduate_onlineClassroom_manage | 0db89bfff9cd5f7c0e751a7fc28f103022aa0898 | c370736c488471c2276ec111b4e9fc67d05d280b | refs/heads/master | 2020-05-24T19:50:34.432058 | 2019-06-04T11:25:34 | 2019-06-04T11:25:34 | 187,443,708 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,564 | java | package com.ocr.info.controller;
import java.io.IOException;
import java.io.OutputStream;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.servlet.http.Part;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.gridfs.GridFsTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.mongodb.gridfs.GridFSDBFile;
import com.mongodb.gridfs.GridFSFile;
import com.ocr.common.fileUpAndDown.UploadFileTool;
import com.ocr.common.pojo.UploadFilePOJO;
import com.ocr.common.pojo.User;
import com.ocr.common.resultEntity.AjaxResult;
import com.ocr.gate.service.UserService;
import com.ocr.info.service.UploadFilePOJOService;
/**
* 个人信息及课程管理
* @author 滕云飞
* @date 2019年3月31日
* @version ocr1.0.1
*/
@Controller
@RequestMapping("/user/{account}/info/")
public class InfoIndexController {
@Autowired
private UploadFilePOJOService uploadFilePOJOService;
@Autowired
private UploadFileTool uploadFileTool;
@Autowired
private GridFsTemplate gridFsTemplate;
@Autowired
private UserService userService;
@RequestMapping("")
public String infoIndex() {
return "info";
}
@RequestMapping("{pageName}")
public String navicatOpen(@PathVariable("pageName") String pageName) {
return "info-"+pageName;
}
/**
* 上传头像
* @param request 请求
* @return Ajax请求的值
*/
@RequestMapping("uploadAvatar")
@ResponseBody
public AjaxResult uploadAvatar(HttpServletRequest request){
//获取用户信息
HttpSession session = request.getSession();
User user = (User) session.getAttribute("userPermission");
if(user == null) {
return AjaxResult.error("账号登录已失效,请重新登录");
}
try {
Part part = request.getPart("userAvatar");
if(!"Picture".equals(UploadFileTool.fileType(part.getSubmittedFileName()))) {
return AjaxResult.error("只能上传图片文件");
}
GridFSFile store = uploadFileTool.uploadFile("userAvatar", request);
UploadFilePOJO uploadFilePOJO = new UploadFilePOJO();
uploadFilePOJO.setFieldId(store.getId().toString());
uploadFilePOJO.setUserAccount(user.getUserAccount());
//将域id和userAccount保存在数据库里面,然后通过域id获取下载文件
uploadFilePOJOService.save(uploadFilePOJO);
} catch (IOException | ServletException e) {
return AjaxResult.error(e.getMessage());
}
return AjaxResult.oK();
}
@RequestMapping("download")
public void download(HttpServletRequest request,HttpServletResponse response) throws IOException {
//获取用户信息
HttpSession session = request.getSession();
User user = (User) session.getAttribute("userPermission");
if(user == null) {
return ;
}
UploadFilePOJO uploadFilePOJO = uploadFilePOJOService.get(user.getUserAccount());
Query query = new Query(Criteria.where("_id").is(uploadFilePOJO.getFieldId()));
//查询单个文件
GridFSDBFile fileOne = gridFsTemplate.findOne(query);
OutputStream os = response.getOutputStream();
response.setContentType("image/jpeg");
String fileName = fileOne.getFilename().replaceAll(",", "");
//处理中文文件名乱码
if (request.getHeader("User-Agent").toUpperCase().contains("MSIE") ||
request.getHeader("User-Agent").toUpperCase().contains("TRIDENT")
|| request.getHeader("User-Agent").toUpperCase().contains("EDGE")) {
fileName = java.net.URLEncoder.encode(fileName, "UTF-8");
} else {
//非IE浏览器的处理:
fileName = new String(fileName.getBytes("UTF-8"), "ISO-8859-1");
}
response.addHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
// 向客户端输出文件
fileOne.writeTo(os);
os.flush();
os.close();
}
@RequestMapping("show")
public void show(HttpServletRequest request, HttpServletResponse resp){
//获取用户信息
HttpSession session = request.getSession();
User user = (User) session.getAttribute("userPermission");
if(user == null) {
return ;
}
try {
UploadFilePOJO uploadFilePOJO = uploadFilePOJOService.get(user.getUserAccount());
Query query = new Query(Criteria.where("_id").is(uploadFilePOJO.getFieldId()));
//查询单个文件
GridFSDBFile fileOne = gridFsTemplate.findOne(query);
OutputStream out = resp.getOutputStream();
resp.setContentType("image/png");
fileOne.writeTo(out);
out.flush();
out.close();
} catch (Exception e) {
e.printStackTrace();
}
}
@RequestMapping("editInfo")
@ResponseBody
public AjaxResult editInfo(User user,HttpServletRequest request) {
try {
userService.updateUser(user);
} catch (Exception e) {
return AjaxResult.error(e.getMessage());
}
/**
* 更新session里面的值
*/
HttpSession session = request.getSession();
User updatedUser = userService.queryByUserAccount(user.getUserAccount());
updatedUser.setPassword(null);
session.setAttribute("userPermission", updatedUser);
return AjaxResult.oK();
}
}
| [
"paincloudfly@163.com"
] | paincloudfly@163.com |
e38b55d62bf09578e7b02bffcdd2423881793551 | 3ff64f7f8c56ed3393038703662c98a91472f80c | /launcher3/src/main/java/com/vdroid/launcher3/MarkedIconProducer.java | 5d9e6172e343a507ada653d1784fb839a437b92d | [
"Apache-2.0"
] | permissive | jushenziao/LauncherDemo | 07f337dc6893806184d4413c0617f85b406a2314 | 79d27c74061ab96cc435539bd445f9d21d4fedb7 | refs/heads/master | 2020-12-06T20:04:26.952380 | 2016-09-01T08:20:34 | 2016-09-01T08:20:34 | 66,349,886 | 8 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,185 | java | package com.vdroid.launcher3;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
/**
* Created by cloud on 2016/8/17 14:47.
* mail:1032863320@qq.com
* 生成带数字的bitmap
*/
public class MarkedIconProducer {
private static final int MARK_CIRCLE_RADIU = 10;
public static Bitmap createMarkedIcon(Bitmap bitmap, int number) {
BitmapFactory.Options options = new BitmapFactory.Options();
Bitmap copyBitmap = bitmap.copy(Bitmap.Config.ARGB_8888, true);
Canvas canvas = new Canvas(copyBitmap);
if (!bitmap.isRecycled()){
bitmap.recycle();
}
Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
Paint numPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
numPaint.setColor(Color.WHITE);
paint.setColor(Color.RED);
canvas.drawCircle(options.outWidth - MARK_CIRCLE_RADIU, MARK_CIRCLE_RADIU, MARK_CIRCLE_RADIU, paint);
canvas.drawText("" + number, options.outWidth - MARK_CIRCLE_RADIU / 2, options.outHeight / 2, numPaint);
return copyBitmap;
}
}
| [
"1032863320@qq.com"
] | 1032863320@qq.com |
b34a0220cd153786434a66011f006d6e8f2699c0 | c3cf33e7b9fe20ff3124edcfc39f08fa982b2713 | /pocs/custom-metrics-error-ob-fun/src/main/java/com/github/diegopacheco/sandboxspring/service/SimpleDateService.java | f6f1021fa7179b8769032c8ec87938bdec535d59 | [
"Unlicense"
] | permissive | diegopacheco/java-pocs | d9daa5674921d8b0d6607a30714c705c9cd4c065 | 2d6cc1de9ff26e4c0358659b7911d2279d4008e1 | refs/heads/master | 2023-08-30T18:36:34.626502 | 2023-08-29T07:34:36 | 2023-08-29T07:34:36 | 107,281,823 | 47 | 57 | Unlicense | 2022-03-23T07:24:08 | 2017-10-17T14:42:26 | Java | UTF-8 | Java | false | false | 994 | java | package com.github.diegopacheco.sandboxspring.service;
import com.github.diegopacheco.sandboxspring.metrics.OperationMonitor;
import org.springframework.stereotype.Service;
import java.util.Date;
@Service
public class SimpleDateService implements DateService{
@Override
public String getCurrentDate() {
long init = System.currentTimeMillis();
try{
if (Math.random()*2000>1000){
OperationMonitor.recordSuccess("getCurrentDate");
return new Date().toString();
}
throw new RuntimeException("Random Exception!");
}catch(Exception e){
OperationMonitor.recordError("getCurrentDate");
OperationMonitor.recordException("getCurrentDate",e);
throw new RuntimeException(e);
}finally{
long end = System.currentTimeMillis();
long diff = end - init;
OperationMonitor.recordLatency("getCurrentDate",diff);
}
}
}
| [
"diego.pacheco.it@gmail.com"
] | diego.pacheco.it@gmail.com |
3e68b2bbbf81585689e8cc415e9d844bdafa399c | b2ae79db1708aa83d90fe5273709c72c087fd09b | /mall2/src/main/java/com/lxc/mall2/common/RedisShardedPool.java | f8d2a2061a8ddf1040f37dd873f1d1712417677d | [] | no_license | cnlxc/mmall2 | dbaf46c3538c5b2fe3c6ae26127a395bd6a7c92e | 50e25538beeac64be5dfaa3adee743eef5cb4b13 | refs/heads/master | 2022-12-06T21:41:00.147128 | 2020-02-06T13:08:41 | 2020-02-06T13:08:41 | 184,527,196 | 0 | 0 | null | 2022-12-05T23:44:04 | 2019-05-02T05:41:32 | Java | UTF-8 | Java | false | false | 3,117 | java | package com.lxc.mall2.common;
import com.lxc.mall2.util.PropertiesUtil;
import redis.clients.jedis.*;
import redis.clients.util.Hashing;
import redis.clients.util.Sharded;
import java.util.ArrayList;
import java.util.List;
/**
* Created by 82138 on 2019/5/3.
*/
public class RedisShardedPool {
private static ShardedJedisPool pool;//jedis连接池
private static Integer maxTotal = Integer.parseInt(PropertiesUtil.getProperty("redis.max.total","20")); //最大连接数
private static Integer maxIdle = Integer.parseInt(PropertiesUtil.getProperty("redis.max.idle","20"));//在jedispool中最大的idle状态(空闲的)的jedis实例的个数
private static Integer minIdle = Integer.parseInt(PropertiesUtil.getProperty("redis.min.idle","20"));//在jedispool中最小的idle状态(空闲的)的jedis实例的个数
private static Boolean testOnBorrow = Boolean.parseBoolean(PropertiesUtil.getProperty("redis.test.borrow","true"));//在borrow一个jedis实例的时候,是否要进行验证操作,如果赋值true。则得到的jedis实例肯定是可以用的。
private static Boolean testOnReturn = Boolean.parseBoolean(PropertiesUtil.getProperty("redis.test.return","true"));//在return一个jedis实例的时候,是否要进行验证操作,如果赋值true。则放回jedispool的jedis实例肯定是可以用的。
private static String redisIp_1 = PropertiesUtil.getProperty("redis_1.ip");
private static Integer redisPort_1 = Integer.parseInt(PropertiesUtil.getProperty("redis_1.port"));
private static String redisIp_2 = PropertiesUtil.getProperty("redis_2.ip");
private static Integer redisPort_2 = Integer.parseInt(PropertiesUtil.getProperty("redis_2.port"));
private static void initPool(){
//**********************CONFIGURATION****************
JedisPoolConfig config = new JedisPoolConfig();
config.setMaxTotal(maxTotal);
config.setMaxIdle(maxIdle);
config.setMinIdle(minIdle);
config.setTestOnBorrow(testOnBorrow);
config.setTestOnReturn(testOnReturn);
config.setBlockWhenExhausted(true);//连接耗尽的时候,是否阻塞,false会抛出异常,true阻塞直到超时。默认为true。
//**********************CONFIGURATION****************
//SHARD REDIS
List<JedisShardInfo> jedisShardInfoList = new ArrayList<>(2);
JedisShardInfo info1 = new JedisShardInfo(redisIp_1,redisPort_1,1000*2,"redis_1");
JedisShardInfo info2 = new JedisShardInfo(redisIp_2,redisPort_2,1000*2,"redis_2");
jedisShardInfoList.add(info1);
jedisShardInfoList.add(info2);
pool = new ShardedJedisPool(config,jedisShardInfoList, Hashing.MURMUR_HASH, Sharded.DEFAULT_KEY_TAG_PATTERN);
}
static{
initPool();
}
public static ShardedJedis getJedis(){
return pool.getResource();
}
public static void returnBrokenResource(ShardedJedis jedis){
pool.returnBrokenResource(jedis);
}
public static void returnResource(ShardedJedis jedis){
pool.returnResource(jedis);
}
}
| [
"821382992@qq.com"
] | 821382992@qq.com |
9b515fafd59c174f44dd39b4d378ef4a54fb5462 | 7e509f9748dbe9a21cab52a52e035f33079b8672 | /src/main/java/com/stuportal/usermanager/exceptions/userExceptions/DuplicateUserException.java | b054674ce3c6f63184b9188f5df5d756ef17cb56 | [] | no_license | sajadkhosravi/stuportal-usermanager | a27f6b0534ca9ca8036a6ecc2b9728b2be67224e | ceeee3474ce94bdb51044310faa63bf78eed92a4 | refs/heads/master | 2023-05-13T03:54:57.142957 | 2020-08-12T18:02:43 | 2020-08-12T18:02:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 305 | java | package com.stuportal.usermanager.exceptions.userExceptions;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseStatus(value = HttpStatus.BAD_REQUEST, reason="Duplicate User!")
public class DuplicateUserException extends UserException {}
| [
"sajadkh@partdp.ir"
] | sajadkh@partdp.ir |
119eeea320ce5bf23266de8e80a839b8a5e57dc9 | f466306588747fa4f1108735f22ac229f3f0296b | /src/main/java/com/veera/RetailWebScrapApplicationConfig.java | 4ed4bf75c3da2f3a2f62a7d007d008c991a82278 | [] | no_license | veeraguru1/RetailWebScaperApp-Spring-Jsoup | 429e80576f055dc6140e1f31b30aa5be6596ee10 | 22be986e4391d2f424cd4cdbc89869be79f4e478 | refs/heads/master | 2020-03-13T00:00:05.167501 | 2018-04-25T15:52:34 | 2018-04-25T15:52:34 | 130,878,176 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 500 | java | package com.veera;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class RetailWebScrapApplicationConfig {
@Bean
public ObjectMapper objectMapper() {
ObjectMapper mapper = new ObjectMapper();
mapper.enable(SerializationFeature.INDENT_OUTPUT);
return mapper;
}
} | [
"veeraguru.s@sainsburys.co.uk"
] | veeraguru.s@sainsburys.co.uk |
c391fbb1893df5b57d87312791984de328b78573 | 629d3d6d518efe645bec19459dc2e6324af8a3c4 | /src/model/LineUp.java | f2f509179c73d296fd1ddbe27c5cc6b10b53a6aa | [] | no_license | danieljaraba/TareaIntegradora3 | aa01de9427e6ed8c0ce2896c74e905093ee7aa64 | 14d1417b4a855f7dad85f6bebd6f44a071734aa4 | refs/heads/master | 2023-01-30T17:01:32.050477 | 2020-12-11T23:19:39 | 2020-12-11T23:19:39 | 317,667,010 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,637 | java | package model;
public class LineUp {
//Atributes
private String date;
private String formation;
private int[][] positions;
//Relationships
private Tactic tactic;
//Builder
public LineUp(String date, String tactic, String formation){
this.date = date;
Tactic aTactic = Tactic.valueOf(tactic);
this.tactic = aTactic;
this.formation = formation;
this.positions = new int[10][7];
}
public void actualizeLineUp(){
String[] numbers = formation.split("-");
int advance = (int)10/numbers.length;
int index = 0;
String number = "";
for(int i = positions.length-1; i>=0 && index<numbers.length; i = i-advance){
number = numbers[index];
switch(number){
case "1":
positions[i][3] = 1;
break;
case "2":
positions[i][2] = 1;
positions[i][4] = 1;
break;
case "3":
positions[i][1] = 1;
positions[i][3] = 1;
positions[i][5] = 1;
break;
case "4":
positions[i][1] = 1;
positions[i][2] = 1;
positions[i][4] = 1;
positions[i][5] = 1;
break;
case "5":
positions[i][1] = 1;
positions[i][2] = 1;
positions[i][3] = 1;
positions[i][4] = 1;
positions[i][5] = 1;
break;
case "6":
positions[i][1] = 1;
positions[i][2] = 1;
positions[i][3] = 1;
positions[i][4] = 1;
positions[i][5] = 1;
positions[i][6] = 1;
break;
case "7":
positions[i][1] = 1;
positions[i][2] = 1;
positions[i][3] = 1;
positions[i][4] = 1;
positions[i][5] = 1;
positions[i][6] = 1;
positions[i][0] = 1;
break;
}
index++;
}
}
public String showLineUp(){
actualizeLineUp();
String text = "\n********** LineUp *********\n" +
"Date: " + date + "\n" +
"Tactic: " + tactic + "\n" +
"Formation: " + formation + "\n";
for(int i = 0; i<positions.length; i++){
for(int j = 0; j<positions[0].length; j++){
text += positions[i][j] + "\t";
}
text += "\n";
}
text += "\n";
return text;
}
/**
* @return String return the date
*/
public String getDate() {
return date;
}
/**
* @param date the date to set
*/
public void setDate(String date) {
this.date = date;
}
/**
* @return int[][] return the positions
*/
public int[][] getPositions() {
return positions;
}
/**
* @param positions the positions to set
*/
public void setPositions(int[][] positions) {
this.positions = positions;
}
/**
* @return Tactic return the tactic
*/
public Tactic getTactic() {
return tactic;
}
/**
* @param tactic the tactic to set
*/
public void setTactic(Tactic tactic) {
this.tactic = tactic;
}
}
| [
"daesjaga2003@gmail.com"
] | daesjaga2003@gmail.com |
5c21f5fedc7c251be2d512fbde038d9b1b500635 | f56a7f73fd1e05d6fc8366798cd89fa1d6d730e1 | /lzccommon/src/main/java/com/njcool/lzccommon/network/http/request/BaseHttpRequest.java | edc1658b621e37ec9d496b9a94ff11d9c470363b | [] | no_license | lizhichuan/SHEducationAPP | 824ff6fc94fe6b0ffe520b206fa4fb61d8772343 | 0c09e75f48cc46ca5fbb6de3f56a6dcfbde27078 | refs/heads/master | 2020-04-30T21:27:44.172355 | 2019-03-22T07:37:04 | 2019-03-22T07:37:04 | 177,093,420 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,261 | java | package com.njcool.lzccommon.network.http.request;
import android.text.TextUtils;
import com.njcool.lzccommon.network.common.ViseConfig;
import com.njcool.lzccommon.network.http.CoolHttp;
import com.njcool.lzccommon.network.http.api.ApiService;
import com.njcool.lzccommon.network.http.callback.ACallback;
import com.njcool.lzccommon.network.http.func.ApiFunc;
import com.njcool.lzccommon.network.http.func.ApiRetryFunc;
import com.njcool.lzccommon.network.http.mode.ApiHost;
import com.njcool.lzccommon.network.http.mode.CacheMode;
import com.njcool.lzccommon.network.http.mode.CacheResult;
import java.lang.reflect.Type;
import java.util.LinkedHashMap;
import java.util.Map;
import io.reactivex.Observable;
import io.reactivex.ObservableSource;
import io.reactivex.ObservableTransformer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import okhttp3.ResponseBody;
/**
* @Description: 通用的请求基类
* @author: <a href="http://www.xiaoyaoyou1212.com">DAWI</a>
* @date: 17/7/22 15:23.
*/
public abstract class BaseHttpRequest<R extends BaseHttpRequest> extends BaseRequest<R> {
protected ApiService apiService;//通用接口服务
protected String suffixUrl = "";//链接后缀
protected int retryDelayMillis;//请求失败重试间隔时间
protected int retryCount;//重试次数
protected boolean isLocalCache;//是否使用本地缓存
protected CacheMode cacheMode;//本地缓存类型
protected String cacheKey;//本地缓存Key
protected long cacheTime;//本地缓存时间
protected Map<String, String> params = new LinkedHashMap<>();//请求参数
public BaseHttpRequest() {
}
public BaseHttpRequest(String suffixUrl) {
if (!TextUtils.isEmpty(suffixUrl)) {
this.suffixUrl = suffixUrl;
}
}
public <T> Observable<T> request(Type type) {
generateGlobalConfig();
generateLocalConfig();
return execute(type);
}
public <T> Observable<CacheResult<T>> cacheRequest(Type type) {
generateGlobalConfig();
generateLocalConfig();
return cacheExecute(type);
}
public <T> void request(ACallback<T> callback) {
generateGlobalConfig();
generateLocalConfig();
execute(callback);
}
@Override
protected void generateLocalConfig() {
super.generateLocalConfig();
if (httpGlobalConfig.getGlobalParams() != null) {
params.putAll(httpGlobalConfig.getGlobalParams());
}
if (retryCount <= 0) {
retryCount = httpGlobalConfig.getRetryCount();
}
if (retryDelayMillis <= 0) {
retryDelayMillis = httpGlobalConfig.getRetryDelayMillis();
}
if (isLocalCache) {
if (cacheKey != null) {
CoolHttp.getApiCacheBuilder().cacheKey(cacheKey);
} else {
CoolHttp.getApiCacheBuilder().cacheKey(ApiHost.getHost());
}
if (cacheTime > 0) {
CoolHttp.getApiCacheBuilder().cacheTime(cacheTime);
} else {
CoolHttp.getApiCacheBuilder().cacheTime(ViseConfig.CACHE_NEVER_EXPIRE);
}
}
if (baseUrl != null && isLocalCache && cacheKey == null) {
CoolHttp.getApiCacheBuilder().cacheKey(baseUrl);
}
apiService = retrofit.create(ApiService.class);
}
protected abstract <T> Observable<T> execute(Type type);
protected abstract <T> Observable<CacheResult<T>> cacheExecute(Type type);
protected abstract <T> void execute(ACallback<T> callback);
protected <T> ObservableTransformer<ResponseBody, T> norTransformer(final Type type) {
return new ObservableTransformer<ResponseBody, T>() {
@Override
public ObservableSource<T> apply(Observable<ResponseBody> apiResultObservable) {
return apiResultObservable
.subscribeOn(Schedulers.io())
.unsubscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.map(new ApiFunc<T>(type))
.retryWhen(new ApiRetryFunc(retryCount, retryDelayMillis));
}
};
}
/**
* 添加请求参数
*
* @param paramKey
* @param paramValue
* @return
*/
public R addParam(String paramKey, String paramValue) {
if (paramKey != null && paramValue != null) {
this.params.put(paramKey, paramValue);
}
return (R) this;
}
/**
* 添加请求参数
*
* @param params
* @return
*/
public R addParams(Map<String, String> params) {
if (params != null) {
this.params.putAll(params);
}
return (R) this;
}
/**
* 移除请求参数
*
* @param paramKey
* @return
*/
public R removeParam(String paramKey) {
if (paramKey != null) {
this.params.remove(paramKey);
}
return (R) this;
}
/**
* 设置请求参数
*
* @param params
* @return
*/
public R params(Map<String, String> params) {
if (params != null) {
this.params = params;
}
return (R) this;
}
/**
* 设置请求失败重试间隔时间(毫秒)
*
* @param retryDelayMillis
* @return
*/
public R retryDelayMillis(int retryDelayMillis) {
this.retryDelayMillis = retryDelayMillis;
return (R) this;
}
/**
* 设置请求失败重试次数
*
* @param retryCount
* @return
*/
public R retryCount(int retryCount) {
this.retryCount = retryCount;
return (R) this;
}
/**
* 设置是否进行本地缓存
*
* @param isLocalCache
* @return
*/
public R setLocalCache(boolean isLocalCache) {
this.isLocalCache = isLocalCache;
return (R) this;
}
/**
* 设置本地缓存类型
*
* @param cacheMode
* @return
*/
public R cacheMode(CacheMode cacheMode) {
this.cacheMode = cacheMode;
return (R) this;
}
/**
* 设置本地缓存Key
*
* @param cacheKey
* @return
*/
public R cacheKey(String cacheKey) {
this.cacheKey = cacheKey;
return (R) this;
}
/**
* 设置本地缓存时间(毫秒),默认永久
*
* @param cacheTime
* @return
*/
public R cacheTime(long cacheTime) {
this.cacheTime = cacheTime;
return (R) this;
}
public String getSuffixUrl() {
return suffixUrl;
}
public int getRetryDelayMillis() {
return retryDelayMillis;
}
public int getRetryCount() {
return retryCount;
}
public boolean isLocalCache() {
return isLocalCache;
}
public CacheMode getCacheMode() {
return cacheMode;
}
public String getCacheKey() {
return cacheKey;
}
public long getCacheTime() {
return cacheTime;
}
public Map<String, String> getParams() {
return params;
}
}
| [
"524003992@qq.com"
] | 524003992@qq.com |
556100291835c8df01ed8302e9ae1f1169efd0d0 | 37d9b47f1e38ac642a024b4cd1078a1355ae078a | /butterknife-compiler/src/main/java/com/example/BindingClass.java | 704f69f92f730589038789c33e9e4f6aaf8c2085 | [] | no_license | HpWens/WSAnnotation | 538c9c3397617c3c48b1389002bce3d5933249ba | 39ac30a83127ed18de0c4717ce01d668e82df3fe | refs/heads/master | 2021-01-16T17:49:50.682477 | 2017-09-11T10:07:57 | 2017-09-11T10:07:57 | 100,016,395 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,048 | java | package com.example;
import com.squareup.javapoet.AnnotationSpec;
import com.squareup.javapoet.ClassName;
import com.squareup.javapoet.JavaFile;
import com.squareup.javapoet.MethodSpec;
import com.squareup.javapoet.ParameterizedTypeName;
import com.squareup.javapoet.TypeSpec;
import com.squareup.javapoet.TypeVariableName;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;
import javax.lang.model.element.Modifier;
/**
* desc: 绑定处理类,一个 BindingClass 对应一个要生成的类
* author: wens
* date: 2017/7/18.
*/
public final class BindingClass {
private static final ClassName FINDER = ClassName.get("com.github.butterknifelib", "Finder");
private static final ClassName VIEW_BINDER = ClassName.get("com.github.butterknifelib", "ViewBinder");
private static final ClassName VIEW = ClassName.get("android.view", "View");
private static final ClassName UTILS = ClassName.get("com.github.butterknifelib", "Utils");
private static final ClassName CONTEXT = ClassName.get("android.content", "Context");
private static final ClassName RESOURCES = ClassName.get("android.content.res", "Resources");
private static final ClassName CONTEXT_COMPAT = ClassName.get("android.support.v4.content", "ContextCompat");
private static final ClassName ON_CLICK_LISTENER = ClassName.get("android.view.View", "OnClickListener");
private final List<FieldResourceBinding> resourceBindings = new ArrayList<>();
private final String classPackage; // com.butterknife
private final String className; // MainActivity$$ViewBinder
private final String targetClass; // com.butterknife.MainActivity
private final String classFqcn; // 全路径 com.butterknife.MainActivity$$ViewBinder
private static final ClassName ILL = ClassName.get("java.lang", "IllegalAccessException");
private BindingClass parentBinding;
/**
* 绑定处理类
*
* @param classPackage 包名:com.butterknife
* @param className 生成的类:MainActivity$$ViewBinder
* @param targetClass 目标类:com.butterknife.MainActivity
* @param classFqcn 生成Class的完全限定名称:com.butterknife.MainActivity$$ViewBinder
*/
public BindingClass(String classPackage, String className, String targetClass, String classFqcn) {
this.classPackage = classPackage;
this.className = className;
this.targetClass = targetClass;
this.classFqcn = classFqcn;
}
/**
* @return JavaFile
*/
public JavaFile brewJava() {
//构建一个类
TypeSpec.Builder result = TypeSpec.classBuilder(className) //MainActivity$$ViewBinder
.addModifiers(Modifier.PUBLIC)
.addTypeVariable(TypeVariableName.get("T", ClassName.bestGuess(targetClass)));
// T extends MainActivity
if (_hasParentBinding()) {
result.superclass(ParameterizedTypeName.get(ClassName.bestGuess(parentBinding.classFqcn),
TypeVariableName.get("T")));
} else {
result.addSuperinterface(ParameterizedTypeName.get(VIEW_BINDER, TypeVariableName.get("T")));
}
//实现 ViewBinder 接口的接口方法
result.addMethod(_createBindMethod());
return JavaFile.builder(classPackage, result.build())
.addFileComment("Generated code from Butter Knife. Do not modify!")
.build();
}
private MethodSpec _createBindMethod() {
MethodSpec.Builder result = MethodSpec.methodBuilder("bind")
.addAnnotation(Override.class)
.addModifiers(Modifier.PUBLIC)
.addParameter(FINDER, "finder", Modifier.FINAL)
.addParameter(TypeVariableName.get("T"), "target", Modifier.FINAL)
.addParameter(Object.class, "source");
if (_hasParentBinding()) {
// 调用父类的bind()方法
result.addStatement("super.bind(finder, target, source)");
}
if (_hasResourceBinding()) {
// 过滤警告
result.addAnnotation(AnnotationSpec.builder(SuppressWarnings.class)
.addMember("value", "$S", "ResourceType")
.build());
result.addStatement("$T context = finder.getContext(source)", CONTEXT);
result.addStatement("$T res = context.getResources()", RESOURCES);
// Resource
//重点了解$S $T $L
for (FieldResourceBinding binding : resourceBindings) {
// if (binding.getId() == -1) {
// getBindingId(result, binding.getId(), binding.getName());
// }
result.addStatement("target.$L = res.$L($L)", binding.getName(), binding.getMethod(),
binding.getId());
}
}
return result.build();
}
private void getBindingId(MethodSpec.Builder builder, int id, String name) {
builder.addStatement("Class idClass = R.string.class");
builder.addCode(" try {");
builder.addStatement("$T field = idClass.getField(target.$N)", Field.class, name);
builder.addCode("if (field != null) {");
builder.addStatement("$T = field.getInt(idClass)", id);
builder.addCode("}");
builder.addCode(" } catch (NoSuchFieldException e) { } catch ($T e) { }", ILL);
}
/**
* @param binding
*/
public void addResourceBinding(FieldResourceBinding binding) {
if (!resourceBindings.contains(binding)) {
resourceBindings.add(binding);
}
}
/**
* 设置父类
*
* @param parentBinding
*/
public void setParentBinding(BindingClass parentBinding) {
this.parentBinding = parentBinding;
}
private boolean _hasResourceBinding() {
return !(resourceBindings.isEmpty());
}
private boolean _hasParentBinding() {
return parentBinding != null;
}
}
| [
"373872690@qq.com"
] | 373872690@qq.com |
0f5d654fcbbc5ba5fcf573fe451d4ccc3aa34330 | 7d6f7868d644293522871881bdc9bfe6408cdf68 | /src/lesson04Task/Wheel.java | 04d6c4880b151b81d7bc2035f6ce1e7b0ed0b553 | [] | no_license | MarharytaKavalevich/JD2019-07 | 33cdcc778b6efee1921584605f541a1c1811a8b9 | 1a3f9dca5ba79aa4935bef384b57a112660ef97d | refs/heads/master | 2020-06-19T14:28:04.901031 | 2019-09-09T18:24:17 | 2019-09-09T18:24:17 | 196,743,345 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,460 | java | package lesson04Task;
import java.util.Objects;
public class Wheel {
private int idWheel;
private int price;
private String wheelModel;
public Wheel(){
}
public Wheel(int idWheel, int price, String wheelModel) {
this.idWheel = idWheel;
this.price = price;
this.wheelModel = wheelModel;
}
public int getIdWheel() {
return idWheel;
}
public void setIdWheel(int idWheel) {
this.idWheel = idWheel;
}
public int getPrice() {
return price;
}
public void setPrice(int price) {
this.price = price;
}
public String getWheelModel() {
return wheelModel;
}
public void setWheelModel(String wheelModel) {
this.wheelModel = wheelModel;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Wheel wheel = (Wheel) o;
return idWheel == wheel.idWheel &&
price == wheel.price &&
Objects.equals(wheelModel, wheel.wheelModel);
}
@Override
public int hashCode() {
return Objects.hash(idWheel, price, wheelModel);
}
@Override
public String toString() {
return "Wheel{" +
"idWheel=" + idWheel +
", price=" + price +
", wheelModel='" + wheelModel + '\'' +
'}';
}
}
| [
"ritavalerievna@gmail.com"
] | ritavalerievna@gmail.com |
62921483faca7f588ab5b5dceb124286b5a5854b | 0931acdad63362f55aa5b2cfa74a1a59cbac7327 | /src/main/java/TestMyLinkedList.java | ea41ae376c6fd65dd20ba4d4f054ef9113a6fda5 | [] | no_license | dohuunghia11/Seaoson6Java | 8ef7d054b46bad065b8268eb3234d559917d3bf4 | e1adad2d0be929136b7f78bd7db743c38d2b3c2f | refs/heads/master | 2020-06-12T08:41:22.849278 | 2019-06-28T09:41:00 | 2019-06-28T09:41:00 | 194,248,186 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 332 | java | public class TestMyLinkedList {
public static void main(String[] args) {
System.out.println("/=/=/=/= TESTING /=/=/=/=");
MyLinkedList1 ll = new MyLinkedList1(10);
ll.addFirst(11);
ll.addFirst(12);
ll.addFirst(6);
ll.add(4,9);
ll.add(4,9);
ll.printList();
}
} | [
"huunghiado1995@gmail.com"
] | huunghiado1995@gmail.com |
fdbe20363ecb81bf033521e835e888896c8b59a9 | 37caedd3f478e0df8831b15441fc5d3c6164ecf3 | /app/src/main/java/com/example/com/w4d3homeworkrecyclerexpreso/MainActivity.java | e95fb8842bbaac0e790161bc9bdc4575f50d4a02 | [] | no_license | linker85/W4D3RecyclerTest | cd74218d99e142a7e19496081af690fad4b5ebc2 | 2268442b3af2c0635e68e17882b6d676a9b21517 | refs/heads/master | 2020-12-24T07:59:29.432726 | 2016-11-10T04:56:07 | 2016-11-10T04:56:07 | 73,348,394 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,585 | java | package com.example.com.w4d3homeworkrecyclerexpreso;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import java.util.ArrayList;
public class MainActivity extends AppCompatActivity {
private RecyclerView notificationRecyclerView;
private ArrayList<Notification> notificationArrayList;
private NotificationsAdapter notificationAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// 1. get a reference to recyclerView
notificationRecyclerView = (RecyclerView) findViewById(R.id.a_notifications_recycler);
// 2. set layoutManger
notificationRecyclerView.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
// 3. Get data from database
notificationArrayList = new ArrayList<>();
notificationArrayList.add(new Notification("title09", "body1", "30/10/2016"));
notificationArrayList.add(new Notification("title10", "body2", "30/10/2016"));
notificationArrayList.add(new Notification("title11", "body3", "30/10/2016"));
notificationArrayList.add(new Notification("title12", "body4", "30/10/2016"));
notificationArrayList.add(new Notification("title13", "body5", "30/10/2016"));
notificationArrayList.add(new Notification("title14", "body6", "30/10/2016"));
notificationArrayList.add(new Notification("title15", "body7", "30/10/2016"));
notificationArrayList.add(new Notification("title16", "body8", "30/10/2016"));
notificationArrayList.add(new Notification("title17", "body9", "30/10/2016"));
notificationArrayList.add(new Notification("title18", "body10", "30/10/2016"));
notificationArrayList.add(new Notification("title19", "body11", "30/10/2016"));
// 4. set adapter
notificationAdapter = new NotificationsAdapter(notificationArrayList);
notificationRecyclerView.setAdapter(notificationAdapter);
notificationRecyclerView.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
notificationRecyclerView.setItemAnimator(new DefaultItemAnimator());
notificationRecyclerView.addItemDecoration(new SimpleDecorator(getApplicationContext(), LinearLayoutManager.VERTICAL));
// 5. notify changes
notificationAdapter.notifyDataSetChanged();
}
}
| [
"linker85@hotmail.com"
] | linker85@hotmail.com |
4d107fd4e1732c53b4b621ba280e1173f45170ec | fb24b2ee9e35812573fef478d6458230abb253c7 | /Java/gol_07/cli/src/main/java/ru/sbt/rgrtu/gol/cli/Starter.java | 62694251ae3fa36273a7fe32e2dd6fe01753b6df | [] | no_license | MaxElmanov/SberTech | ee3cabceb4d1dae2efa17e07c87ad1ea09659b3e | 440f936bc681db54d69cabcb4f9e1b55138bb60b | refs/heads/master | 2021-06-29T00:38:47.876595 | 2020-07-13T16:33:11 | 2020-07-13T16:33:11 | 154,541,181 | 0 | 0 | null | 2020-10-13T23:29:29 | 2018-10-24T17:28:02 | Java | UTF-8 | Java | false | false | 2,386 | java | package ru.sbt.rgrtu.gol.cli;
import ru.sbt.rgrtu.gol.boardfilling.BitmapFilling;
import ru.sbt.rgrtu.gol.boardfilling.Filling;
import ru.sbt.rgrtu.gol.boardfilling.RandomFilling;
import ru.sbt.rgrtu.gol.boardfilling.TxtFilling;
import ru.sbt.rgrtu.gol.config.Configuration;
import ru.sbt.rgrtu.gol.config.ConfigurationPropertiesLoader;
import ru.sbt.rgrtu.gol.config.ConfigurationProvider;
import ru.sbt.rgrtu.gol.controller.Controller;
import ru.sbt.rgrtu.gol.controller.FrameByFrameController;
import ru.sbt.rgrtu.gol.game.Gol;
import ru.sbt.rgrtu.gol.controller.TimedController;
import ru.sbt.rgrtu.gol.presentation.AtAndSpacePresentation;
import ru.sbt.rgrtu.gol.presentation.ColoredPresentation;
import ru.sbt.rgrtu.gol.presentation.Presentation;
import ru.sbt.rgrtu.gol.presentation.SmilePresentation;
import java.io.IOException;
public class Starter {
public static void main(String[] args) throws IOException {
//ConfigurationProvider cpl = createHardCodedConfigurationProvider();
//ConfigurationProvider cpl = createInlineConfigurationProvider();
ConfigurationProvider cpl = createConfigurationPropertiesLoader();
//Filling fill = new TxtFilling();
//Filling fill = new RandomFilling(20180921);
Filling fill = new BitmapFilling("bitmap.bmp");
Gol gol = new Gol(cpl, fill);
//Presentation presentation = new AtAndSpacePresentation(gol);
Presentation presentation = new SmilePresentation(gol);
//Presentation presentation = new ColoredPresentation(gol);
//Controller controller = new FrameByFrameController(gol, presentation);
Controller controller = new TimedController(gol, presentation, 100);
controller.run();
}
private static ConfigurationProvider createConfigurationPropertiesLoader() {
return new ConfigurationPropertiesLoader("config.properties");
}
private static ConfigurationProvider createHardCodedConfigurationProvider() {
return new HardCodedConfigurationProvider();
}
private static ConfigurationProvider createInlineConfigurationProvider() {
return () -> {
Configuration configuration = new Configuration();
configuration.setSizeX(150);
configuration.setSizeY(100);
configuration.setSpeed(1000);
return configuration;
};
}
}
| [
"89106232571@yandex.ru"
] | 89106232571@yandex.ru |
a3f5828581736559e489251c22e0875b16be4e6c | 85746eae9552db13301fd03ad6f9eb64b61d3d1a | /LegislativoApp/app/src/main/java/zimmermann/larissa/legislativoapp/communication/PropListResponse.java | 6ccfa51ae3bef31121bbc02e87528977b0a4c951 | [] | no_license | larissacazi/ExampleConsumeJSON | 487ba40efb285a065fd0e0822fe0457bcea98891 | 676350f04fc3082577e3de494631747ae30302f6 | refs/heads/master | 2021-03-19T06:38:54.718208 | 2017-08-24T14:50:16 | 2017-08-24T14:50:16 | 99,115,795 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 750 | java | package zimmermann.larissa.legislativoapp.communication;
import java.io.Serializable;
import java.util.List;
/**
* Created by laris on 11/08/2017.
*/
public class PropListResponse implements Serializable {
private List<Proposicao> dados;
private List<Link> links;
public PropListResponse(List<Proposicao> dados, List<Link> links) {
this.dados = dados;
this.links = links;
}
public List<Proposicao> getDados() {
return dados;
}
public void setDados(List<Proposicao> dados) {
this.dados = dados;
}
public List<Link> getLinks() {
return links;
}
public void setLinks(List<Link> links) {
this.links = links;
}
}
| [
"larissacazi@hotmail.com"
] | larissacazi@hotmail.com |
adeb8313f0872352c47e3913093aaa2fd60b2d84 | 29cc7ca772f82b1aa9c4ac3f3285cb80e60c2ee8 | /src/com/my/desinger/observer/subs/SubjectImpl.java | 55ea975cfc8e279608dd0615fe3455f09c843288 | [] | no_license | InitialCoder/arithmetic | e6fc7b8f0d2b62acdfc970006e4a768f39dfd376 | c3cd663118d7a5588d8e7e1358ebaf752cc855aa | refs/heads/master | 2020-03-28T10:42:08.922316 | 2019-03-01T07:41:44 | 2019-03-01T07:41:44 | 148,135,938 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 842 | java | package com.my.desinger.observer.subs;
import java.util.ArrayList;
import java.util.List;
import com.my.desinger.observer.NotifyMessage;
import com.my.desinger.observer.Observer;
import com.my.desinger.observer.Subject;
public class SubjectImpl implements Subject{
private List<Observer> obss=new ArrayList<Observer>();
private NotifyMessage msg;
@Override
public void registerObserver(Observer obs) {
if(obss.contains(obs)){
System.out.println("this obs is exists!");
return ;
}
obss.add(obs);
}
@Override
public void removeObserver(Observer obs) {
if(obss.contains(obs)){
obss.remove(obs);
}
}
@Override
public void notifyObservers(NotifyMessage msg) {
obss.forEach(item->{item.update(msg);});
}
public void setData(NotifyMessage msg){
this.msg=msg;
}
}
| [
"792165336@qq.com"
] | 792165336@qq.com |
9da1fd00aa303cfe83da1b175b83c98d90d488cb | 70e8fe540b34691cb4b659baad0e6b08e07a4f53 | /src/main/java/cn/tr/coalgas/dao/order/IOrderDao.java | 9b5e94e05d23b0dfea968a9139793bde862c8b8d | [] | no_license | Air-TR/coal-gas-system | a776b12e568f6b5b53d50c0115f3accb5f587d0a | 3df09f0d5edc277ac01b9964185b6c99164218a8 | refs/heads/master | 2020-04-05T13:32:28.954820 | 2017-08-25T04:37:26 | 2017-08-25T04:37:26 | 94,870,586 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 374 | java | package cn.tr.coalgas.dao.order;
import java.util.List;
import org.springframework.stereotype.Repository;
import cn.tr.coalgas.entity.Order;
@Repository
public interface IOrderDao {
int deleteById(Integer id);
int insert(Order record);
Order selectById(Integer id);
int updateById(Order record);
List<Order> selectList(Order record);
} | [
"tr1838@163.com"
] | tr1838@163.com |
69813cdfbac267d1dc740d5b4df7ce906251c4c7 | 6ebb9fc6c54ef5a5aaa9369d0db8efae3db81b28 | /MoomanowWeb/MoomanowService/src/main/java/com/moomanow/phone/process/PhoneProcessImpl.java | 19cc7bb4d45c5c32031d5f6aca589d8995fceaed | [
"Apache-2.0"
] | permissive | moomanow/MoomanowWeb | b3888b0cf1541d3220c4c86ca2f7e2081f6640b5 | 044cab29ca73ca294d40b18d00d2dede8b5e25c6 | refs/heads/master | 2023-03-19T13:54:28.735168 | 2017-03-02T09:38:08 | 2017-03-02T09:38:08 | 63,307,295 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 950 | java | package com.moomanow.phone.process;
import java.util.Collection;
import org.springframework.beans.factory.annotation.Autowired;
import com.moomanow.core.common.bean.PagingBean;
import com.moomanow.core.common.exception.NonRollBackException;
import com.moomanow.core.common.exception.RollBackException;
import com.moomanow.core.common.processhandler.IProcessResult;
import com.moomanow.phone.service.PhoneService;
import com.moomanow.web.common.bean.Phone;
public class PhoneProcessImpl implements PhoneProcess {
@Autowired
private PhoneService phoneService;
@Override
public IProcessResult<Phone> userAddPhone(Phone phone) throws RollBackException, NonRollBackException {
// TODO Auto-generated method stub
return null;
}
@Override
public IProcessResult<Collection<Phone>> userSearchPhone(Phone phone, PagingBean pagingBean)throws RollBackException, NonRollBackException {
return phoneService.searchPhone(phone, pagingBean);
}
}
| [
"kwan@node-nqm.pool-180-180.dynamic.totbb.net"
] | kwan@node-nqm.pool-180-180.dynamic.totbb.net |
7c77723aa0c96c4e550edb70072b100296bf1b48 | 91f68b26d20375adc927631ff48db6246ae6c1b5 | /src/main/java/com/amt/time_tracker/controller/LoginController.java | ead564a33982977fe9ab956f599ad639bd88e9ed | [] | no_license | AmritMalla/task-tracker | 389550227d94793f9d543da41a43b01fe2ca8f0c | 30dc6bc70c529dccc0b45a115df96344c75f54d5 | refs/heads/master | 2023-04-10T10:48:02.795792 | 2021-05-04T08:58:58 | 2021-05-04T08:58:58 | 364,179,654 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,714 | java | package com.amt.time_tracker.controller;
import com.amt.time_tracker.dao.LoginDao;
import com.amt.time_tracker.model.Login;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet("/login")
public class LoginController extends HttpServlet {
private static final long serialVersionUID = 370099810739794720L;
private LoginDao loginDao;
public void init() {
loginDao = new LoginDao();
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
response.sendRedirect("login/login.jsp");
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
authenticate(request, response);
}
private void authenticate(HttpServletRequest request, HttpServletResponse response) throws IOException {
String username = request.getParameter("username");
String password = request.getParameter("password");
Login login = new Login(username, password);
try {
if (loginDao.validate(login)) {
RequestDispatcher dispatcher = request.getRequestDispatcher("task/task-list.jsp");
dispatcher.forward(request, response);
}
} catch (ServletException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
}
| [
"amritmalla09@gmail.com"
] | amritmalla09@gmail.com |
550f7e5db2f4a7bbc6266f399d634e10eec6ee8c | 430cd9587108f6025b026d7a11fe78811566bafe | /src/main/java/ArraysECollections/Lista.java | f625fd328d4d8aaeac7799e5f95a5a754358f8bc | [] | no_license | AlineCelestrini/TreinandoJava | b7efb5ad29a21a3270d6d41265ef62fd41d36158 | 8588fd201a1cb32ce8c9a9bd25e508ebebf0aa97 | refs/heads/master | 2023-07-07T21:45:30.234391 | 2021-08-12T19:00:10 | 2021-08-12T19:00:10 | 368,900,597 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 631 | java | package ArraysECollections;
import java.util.ArrayList;
public class Lista {
public static void main(String[] args) {
ArrayList<Usuario> lista = new ArrayList<>();
lista.add(new Usuario("Ana"));
lista.add(new Usuario("Carlos"));
lista.add(new Usuario("Lucas"));
lista.add(new Usuario("Maria"));
lista.add(new Usuario("Luzia"));
lista.add(new Usuario("Angelo"));
System.out.println(lista.get(5)); //acesso pelo indice
for (Usuario u: lista) {
System.out.println(u.nome);
}
lista.remove(2);
lista.clear();
}
}
| [
"aline.santana@sergipetec.org.br"
] | aline.santana@sergipetec.org.br |
1ea0ce278c0fdfd424a274e26b6afeb5ca852ece | 1cb53c59063568bd31d59557b57ff5c7ecd30b97 | /cornucopia-allqrpay/src/main/java/com/easypay/cornucopiaallqrpay/dal/dao/impl/TMchInfoMapperImpl.java | 2d3d35685c700443cef4e808227a5d5f2be2a491 | [] | no_license | trcflyer/cornucopia | 2108d1bc29ecdbdaa67c6faf1fcd0ab52e8ea8aa | ce8cb1ca1fc058fe76238fb8d7e5ef531d1a00b3 | refs/heads/master | 2022-07-31T14:03:51.025206 | 2020-05-24T08:21:43 | 2020-05-24T08:21:43 | 240,221,570 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 408 | java | package com.easypay.cornucopiaallqrpay.dal.dao.impl;
import com.easypay.cornucopiaallqrpay.dal.dao.TMchInfoMapper;
import com.easypay.cornucopiaallqrpay.dal.pojo.TMchInfo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
@Repository
public interface TMchInfoMapperImpl extends TMchInfoMapper {
public TMchInfo selectByMchId(@Param("mchId") String mchId);
}
| [
"trc_cn@163.com"
] | trc_cn@163.com |
aa271429a98a442fe84090f3e47da3a08c10503e | dab4bd42575d53a1393987461ca6acdb012396a4 | /src/main/procedure_testing/Money.java | 300931b6b521d150e44aaa41ef3ec0561db93129 | [] | no_license | SasinduDilshara/java-postgre-connect | 7c4e9fd42028c2cbffc6b54a82d9cd5133fdd5d1 | 70535c56ddf0e652c2c9fdb80fed8ea6e0cfafa6 | refs/heads/master | 2023-01-24T11:48:50.806615 | 2020-12-05T17:20:36 | 2020-12-05T17:20:36 | 312,373,718 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,036 | java | package main.procedure_testing;
import org.json.JSONObject;
import org.postgresql.util.PGmoney;
import org.postgresql.util.PGobject;
import java.math.BigDecimal;
import java.sql.*;
import java.util.Properties;
import java.util.UUID;
/**
* This program demonstrates how to make database connection to PostgreSQL
* server using JDBC.
* @author www.codejava.net
*
*/
public class Money {
public static void procedurecall() {
// create three connections to three different databases on localhost
Connection conn = null;
try {
// Connect method #1
try {
Class.forName("org.postgresql.Driver");
} catch (ClassNotFoundException e) {
System.out.println("Driver not found");
e.printStackTrace();
}
String url = "jdbc:postgresql://localhost:5432/java_procedure_test";
Properties props = new Properties();
props.setProperty("user","postgres");
props.setProperty("password","postgres");
conn = DriverManager.getConnection(url, props);
System.out.println("Connectio got success");
String callableSQL = "call moneytest(?,?)";
CallableStatement callableStatement = null;
try {
String query3 = "set lc_monetary to \"en_US.utf8\"";
// create the java statement
Statement st3 = conn.createStatement();
// execute the query, and get a java resultset
st3.execute(query3);
callableStatement = conn.prepareCall(callableSQL);
// callableStatement.setString(1, "lowercase to uppercase");
PGmoney money = new PGmoney(123);
callableStatement.setObject(1, money);
//register multiple output parameters to match all return values
callableStatement.registerOutParameter(2, Types.DOUBLE); //any data type here
callableStatement.setObject(2, money);
callableStatement.execute();
query3 = "set lc_monetary to \"en_US.utf8\"";
// create the java statement
st3 = conn.createStatement();
// execute the query, and get a java resultset
st3.execute(query3);
//do something with your return values
Object obj = callableStatement.getObject(2);
//... for other items you have registered.
System.out.println(obj);
System.out.println(obj.getClass());
System.out.println(obj.toString());
} catch (SQLException up) {
throw up; //haha!
} finally {
//Silently close off
if (conn != null) {
callableStatement.close();
}
}
} catch (SQLException ex) {
ex.printStackTrace();
}
}}
| [
"dilsharasasindu@gmail.com"
] | dilsharasasindu@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.