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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0902e76a2a3837d2d2e307b916719a51be0a861a | 88ecf575a22f41920bccf92e04ed40691937f7df | /src/org/apache/hadoop/mapreduce/lib/input/package-info.java | a9a832467fbe13bc85d851a4e444d99211d582ac | [
"Apache-2.0"
] | permissive | Puchengh/hadoop-mapreduce | 4028c9d4b8f3f84851845fb4c4fbcd1216d1fb29 | 215b299f0b3350341fe52010d30da5e719e4c700 | refs/heads/master | 2020-05-25T14:33:04.024704 | 2019-06-29T09:21:30 | 2019-06-29T09:21:30 | 187,847,343 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 303 | java | /**
* Title: package-info.java
* Description:
* @author Puchen
* @date 2019年6月28日 下午5:32:40
* @version 1.0
*/
/**
* <p>Title: package-info</p>
* <p>Description: </p>
* @author puchen
* @date 2019年6月28日 下午5:32:40
*/
package org.apache.hadoop.mapreduce.lib.input; | [
"740495380@qq.com"
] | 740495380@qq.com |
cd43d5aa3abe83725c5192b76e63bbf1c0f16a19 | cffcf3d5daf2505519bda75d5b413283e896fdc0 | /bindings/java/src/test/java/co/jp/freemind/fmcp/PutFile.java | 8d44fed16e622968c64a302623f449e3c78f88ef | [
"MIT"
] | permissive | koo-inc/fm-cache-proxy | f04273f1e590b82594bfa8252c7b804f8a8f89cf | 70f16f85cede5536ef8d08799c0640a4fc6c9ded | refs/heads/master | 2021-01-13T16:40:08.407551 | 2017-01-18T07:11:40 | 2017-01-18T07:11:40 | 78,193,379 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 870 | java | package co.jp.freemind.fmcp;
import java.io.File;
import java.io.IOException;
import java.net.URL;
public class PutFile {
private static final String secretKey = "abcdefghijklmnop";
private static final String iv = "1234567890123456";
private static final String fmcpUrl = "http://localhost:3000/";
public static void main(String[] args) throws IOException {
URL resource = Thread.currentThread().getContextClassLoader().getResource("test.png");
File file = new File(resource.getFile());
Parameter param = Parameter.builder()
.url("http://www.freemind.co.jp/common/images/dot01.gif")
.method("GET")
.build();
FmcpClient client = FmcpClient.getInstance(fmcpUrl, secretKey, iv);
client.put(param, file);
System.out.println(client.getUrl(param));
}
}
| [
"tasuku@freemind.co.jp"
] | tasuku@freemind.co.jp |
df6376f81fc02ee0dfcd5659fecae1eaff99092e | 83e8752534fba87d7c81e49b3c4b69b48fdc05b8 | /src/main/java/com/hl/wiki/util/CopyUtil.java | ea84c58366342bd5a632656b97b00afcf1d8cdca | [] | no_license | hl961403370/Wiki | 0913da335eb1e82104b46860b8453c80449dcb21 | df931bf9ce90d20c0d253a17bf611eaab0a144f4 | refs/heads/master | 2023-08-17T06:56:26.930289 | 2021-09-26T08:23:52 | 2021-09-26T08:23:52 | 371,031,602 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 972 | java | package com.hl.wiki.util;
import org.springframework.beans.BeanUtils;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
public class CopyUtil {
/**
* 单体复制
*/
public static <T> T copy(Object source, Class<T> clazz) {
if (source == null) {
return null;
}
T obj = null;
try {
obj = clazz.newInstance();
} catch (Exception e) {
e.printStackTrace();
return null;
}
BeanUtils.copyProperties(source, obj);
return obj;
}
/**
* 列表复制
*/
public static <T> List<T> copyList(List source, Class<T> clazz) {
List<T> target = new ArrayList<>();
if (!CollectionUtils.isEmpty(source)){
for (Object c: source) {
T obj = copy(c, clazz);
target.add(obj);
}
}
return target;
}
}
| [
"961403370@qq.com"
] | 961403370@qq.com |
dffa35f7d47a3d7763e75c6d16e458beead676ae | 5a7a1703675de6189b229b9592f673c9d6595cb7 | /src/main/java/com/gearupnepal/web/service/impl/SellServiceImpl.java | 1309f4e6b0267393bc5f19f89b32d024b251dc3a | [] | no_license | das-rajesh/GearUp1.4 | 6d7793f8dfd1bde872a2ea8b3c60cd1072644fcc | 3f75e25c5a2d9feb35a2a1ac968bb12b9e9e4618 | refs/heads/master | 2020-03-31T03:09:07.536156 | 2018-11-03T13:26:13 | 2018-11-03T13:26:13 | 151,854,895 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,699 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.gearupnepal.web.service.impl;
import com.gearupnepal.web.entity.Sale;
import com.gearupnepal.web.entity.repository.SaleRepository;
import com.gearupnepal.web.service.SaleService;
import java.util.Base64;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
/**
*
* @author admin
*/
@Service
public class SellServiceImpl implements SaleService {
@Autowired
private SaleRepository saleRepository;
@Cacheable(value = "categories")
@Override
public List<Sale> getAll() {
for (Sale sale : saleRepository.findAll()) {
if (sale.getPhoto()!= null) {
byte[] blob = sale.getPhoto();
String base64Image = Base64.getEncoder().encodeToString(blob);
sale.setBase64Image(base64Image);
}
}
return saleRepository.findAll();
}
@CacheEvict(allEntries = true, value = "categories")
@Override
public void save(Sale sale) {
saleRepository.save(sale);
}
@Override
public void delete(long id) {
saleRepository.deleteById(id);
}
@Override
public Sale findById(long id) {
for (Sale c : getAll()) {
if (c.getId() == id) {
return saleRepository.findById(id).get();
}
}
return null;
}
}
| [
"39552295+das-rajesh@users.noreply.github.com"
] | 39552295+das-rajesh@users.noreply.github.com |
25264d7b103af07ebc9db5d7ab4220fafc10c74c | 52e88f278b230d6fb811cf77766e77b5c4dd12ec | /src/main/java/com/company/controller/dealer/DealerGameObjectController.java | 1da4638f21f36ead0af5ead9380576f57a992cf9 | [] | no_license | Shotim/DealerStat | fdb12be4034eda76b95350dbc8c36421523b811e | 301d70d9972f5ccb30170378db84e3977abb4aaa | refs/heads/master | 2022-12-21T16:02:06.229599 | 2019-09-21T20:25:05 | 2019-09-21T20:25:05 | 207,125,082 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,314 | java | package com.company.controller.dealer;
import com.company.controller.ControllerUtility;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
@Controller
@RequestMapping("/id{dealerId}")
@AllArgsConstructor
public class DealerGameObjectController {
private ControllerUtility controllerUtility;
@GetMapping("/gameObjects")
public ModelAndView showGameObjects() {
int dealerId = controllerUtility.sessionDealerId();
ModelAndView modelAndView = controllerUtility.viewGameObjectsPage(
"dealer/showEntities/gameObjects");
modelAndView.addObject("dealerId", dealerId);
return modelAndView;
}
@GetMapping("/gameObjects/{id}")
public ModelAndView showGameObjectWithId(@PathVariable("id") String id) {
int dealerId = controllerUtility.sessionDealerId();
ModelAndView modelAndView = controllerUtility.viewGameObjectWithId(
"dealer/entity/gameObject", id);
modelAndView.addObject("dealerId", dealerId);
return modelAndView;
}
}
| [
"39776975+Shotim@users.noreply.github.com"
] | 39776975+Shotim@users.noreply.github.com |
71272d5b188278d8cef771cc9f17d9f82ad155c0 | 4b7afd114f9706d46bdff09d9fad552d4af5c6fb | /src/main/java/com/wyp/java8/controller/UserController.java | 44a656dbf07baae36b201c199764dc81a0e0399f | [] | no_license | wyp001/java8 | a0da176bcd028d523f5db8e0d1d45e74628b3f5c | f0dbe06813817534a64df1dfa88f2d19981b528f | refs/heads/master | 2022-12-12T03:54:53.973413 | 2020-08-21T10:14:01 | 2020-08-21T10:14:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 545 | java | package com.wyp.java8.controller;
import com.wyp.java8.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
public class UserController {
@Autowired
UserService userService;
@GetMapping("/user/list")
public List getUserList(){
return userService.getAllUser();
}
}
| [
"wangyupeng_ly@163.com"
] | wangyupeng_ly@163.com |
a786a4de02dd54884bbf7ed8beed42933be29454 | aa182e0798f13eeba5e0f4feed04b96edbc43206 | /src/org/openstreetmap/josm/gsoc2015/opengl/osm/search/RelationSearcher.java | 545fea7613d7912d854b1df8096304fb1d30c34c | [] | no_license | michaelzangl/josm-plugin-opengl | a727efb2b4d43c6109b5a92f6bd9419d8371e760 | 3a0291e3918e4c2af5ae056b83695a7a6cea7dc8 | refs/heads/master | 2021-01-10T06:37:22.748236 | 2016-08-21T13:26:20 | 2016-08-21T13:26:20 | 36,139,826 | 8 | 2 | null | 2017-12-27T01:17:21 | 2015-05-23T19:51:19 | Java | UTF-8 | Java | false | false | 918 | java | package org.openstreetmap.josm.gsoc2015.opengl.osm.search;
import java.util.List;
import org.openstreetmap.josm.data.osm.BBox;
import org.openstreetmap.josm.data.osm.DataSet;
import org.openstreetmap.josm.data.osm.Relation;
/**
* This class searches for relations in a given bounding box.
* @author Michael Zangl
*/
public class RelationSearcher extends PrimitiveSearcher<Relation> {
/**
* Creates a new relation searcher
*
* @param handler
* The handler to send the found primitives to. It may be invoked
* multiple times in the future.
* @param data
* The data to search in.
* @param bbox
* The bounding box to search.
*/
public RelationSearcher(OsmPrimitiveHandler<Relation> handler,
DataSet data, BBox bbox) {
super(handler, data, bbox);
}
@Override
public List<Relation> searchElements() {
return data.searchRelations(bbox);
}
} | [
"michael.zangl@student.kit.edu"
] | michael.zangl@student.kit.edu |
20fa61e5bb72ebe280f1c536e84e601b05d02a5a | 104096d773c633903d08eb5c99d012260c366c3d | /app/src/main/java/com/bilbubble/movie_app/network/MovieApiClient.java | fd7fc621708aaa5b6e1d0ad07b31da51515fb231 | [] | no_license | bilbubble/final_project | 11c9cc94cfb11e8793db4fbdd469fa3b0cab6a17 | 828de75ace1f004d87bc9cd9c6b538c28b260354 | refs/heads/master | 2023-05-26T14:48:35.434509 | 2021-06-10T14:44:10 | 2021-06-10T14:44:10 | 375,730,922 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 481 | java | package com.bilbubble.movie_app.network;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
public class MovieApiClient {
private static Retrofit retrofit;
public static Retrofit getRetrofit() {
if(retrofit == null){
retrofit = new Retrofit.Builder().baseUrl(Const.BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.build();
}
return retrofit;
}
}
| [
"putrinabila065@gmail.com"
] | putrinabila065@gmail.com |
fc71108a1705dc029c59016ca63201e9ae949d56 | e2afee2d1701503ec8a69304896044c385e5d516 | /dataset_1/5.java | 4565884fe918a76d1181889db11344ac2dccba1d | [] | no_license | zibranm/dataset | 63f6d0dc441eda1a29064e16d8390664246f5c30 | 080415841316bb8d21ad6609109d2dcd1e5c0296 | refs/heads/master | 2020-03-18T22:29:38.905519 | 2018-05-29T20:37:44 | 2018-05-29T20:37:44 | 135,348,517 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 795 | java | class Box {
double width;
double height;
double depth;
Box() {
}
Box(double w, double h, double d) {
width = w;
height = h;
depth = d;
}
void getVolume() {
System.out.println("Volume is : " + width * height * depth);
}
}
public class MatchBox extends Box {
double weight;
MatchBox() {
}
MatchBox(double w, double h, double d, double m) {
super(w, h, d);
weight = m;
}
public static void main(String args[]) {
MatchBox mb1 = new MatchBox(10, 10, 10, 10);
mb1.getVolume();
System.out.println("width of MatchBox 1 is " + mb1.width);
System.out.println("height of MatchBox 1 is " + mb1.height);
System.out.println("depth of MatchBox 1 is " + mb1.depth);
System.out.println("weight of MatchBox 1 is " + mb1.weight);
}
} | [
"zibranm@hotmail.com"
] | zibranm@hotmail.com |
9d624b55f3d292f5a8e2cd0288800d89cb5f9a5b | 1ef3e452e088af90c5a9fbf2af67895e0cbe8396 | /src/cn/leolam10/uml/composition/IDCard.java | 8819276ceef719f43f6c72da0186b001d9177e28 | [] | no_license | LeoLam10/DesignPattern | ac225344fc21b424cc6c7c94ba35e0243d717922 | f15e96099d72b30414a2fc038f4ca658d8d77694 | refs/heads/master | 2022-12-07T01:34:37.183966 | 2020-08-26T14:44:55 | 2020-08-26T14:44:55 | 289,693,693 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 63 | java | package cn.leolam10.uml.composition;
public class IDCard {
}
| [
"LeoLam101010@gmail.com"
] | LeoLam101010@gmail.com |
f571e08c8548d223bc73102417c80f34d1ad2384 | 31e6d6620f0b33d7ccefd821dd1a6ab039fbc468 | /uros/src/main/java/com/bamboocloud/uros/client/CookieManager.java | 156e05bca43f2a0a88966fa9507d03c760152d91 | [] | no_license | leoly521/uros_project | cac99cde2bc5fe3e0b348beb2a48be01e348e5fc | 06fdf6f4e60371dc0cd19243f3845ec1760c3d8f | refs/heads/master | 2020-06-08T07:12:36.728822 | 2015-12-23T03:56:48 | 2015-12-23T03:56:48 | 32,430,601 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,440 | java | package com.bamboocloud.uros.client;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.concurrent.ConcurrentHashMap;
import java.util.List;
import java.util.Map.Entry;
import java.util.TimeZone;
import com.bamboocloud.uros.io.UrosHelper;
public class CookieManager {
private static final TimeZone utc = TimeZone.getTimeZone("UTC");
private static int parseMonth(String str) {
str = str.toLowerCase();
switch (str.charAt(0) + str.charAt(1) + str.charAt(2) - 300) {
case 13: return 0;
case 1: return 1;
case 20: return 2;
case 23: return 3;
case 27: return 4;
case 33: return 5;
case 31: return 6;
case 17: return 7;
case 28: return 8;
case 26: return 9;
case 39: return 10;
case 0: return 11;
default: return 0;
}
}
private static Calendar parseCalendar(String str) {
Calendar calendar = Calendar.getInstance(utc);
if (str == null || str.equals("")) {
return calendar;
}
String[] datetime = UrosHelper.split(str, ' ', 0);
int day, month, year, hour, minute, second;
String[] time;
if (datetime[1].indexOf('-') > 0) {
String[] date = UrosHelper.split(datetime[1], '-', 0);
day = Integer.parseInt(date[0]);
month = parseMonth(date[1]);
year = Integer.parseInt(date[2]);
time = UrosHelper.split(datetime[2], ':', 0);
}
else {
day = Integer.parseInt(datetime[1]);
month = parseMonth(datetime[2]);
year = Integer.parseInt(datetime[3]);
time = UrosHelper.split(datetime[4], ':', 0);
}
hour = Integer.parseInt(time[0]);
minute = Integer.parseInt(time[1]);
second = Integer.parseInt(time[2]);
calendar.set(Calendar.YEAR, year);
calendar.set(Calendar.MONTH, month);
calendar.set(Calendar.DATE, day);
calendar.set(Calendar.HOUR_OF_DAY, hour);
calendar.set(Calendar.MINUTE, minute);
calendar.set(Calendar.SECOND, second);
calendar.set(Calendar.MILLISECOND, 0);
return calendar;
}
private final ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentHashMap<String, String>>> container = new ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentHashMap<String, String>>>();
public CookieManager() {
}
public synchronized void setCookie(List<String> cookieList, String host) {
if (cookieList == null) {
return;
}
for (int i = 0, n = cookieList.size(); i < n; ++i) {
String cookieString = cookieList.get(i);
if (cookieString.equals("")) {
continue;
}
String[] cookies = UrosHelper.split(cookieString.trim(), ';', 0);
ConcurrentHashMap<String, String> cookie = new ConcurrentHashMap<String, String>();
String[] value = UrosHelper.split(cookies[0].trim(), '=', 2);
cookie.put("name", value[0]);
if (value.length == 2) {
cookie.put("value", value[1]);
} else {
cookie.put("value", "");
}
for (int j = 1, m = cookies.length; j < m; j++) {
value = UrosHelper.split(cookies[j].trim(), '=', 2);
if (value.length == 2) {
cookie.put(value[0].toUpperCase(), value[1]);
} else {
cookie.put(value[0].toUpperCase(), "");
}
}
// Tomcat can return SetCookie2 with path wrapped in "
if (cookie.containsKey("PATH")) {
String path = cookie.get("PATH");
if (path.charAt(0) == '"') {
path = path.substring(1);
}
if (path.charAt(path.length() - 1) == '"') {
path = path.substring(0, path.length() - 1);
}
cookie.put("PATH", path);
} else {
cookie.put("PATH", "/");
}
if (cookie.containsKey("DOMAIN")) {
cookie.put("DOMAIN", cookie.get("DOMAIN").toLowerCase());
} else {
cookie.put("DOMAIN", host);
}
if (!container.containsKey(cookie.get("DOMAIN"))) {
container.put(cookie.get("DOMAIN"), new ConcurrentHashMap<String, ConcurrentHashMap<String, String>>());
}
container.get(cookie.get("DOMAIN")).put(cookie.get("name"), cookie);
}
}
public synchronized String getCookie(String host, String path, boolean secure) {
StringBuilder cookies = new StringBuilder();
for (Entry<String, ConcurrentHashMap<String, ConcurrentHashMap<String, String>>> entry : container.entrySet()) {
String domain = entry.getKey();
ConcurrentHashMap<String, ConcurrentHashMap<String, String>> cookieList = entry.getValue();
if (host.endsWith(domain)) {
ArrayList<String> names = new ArrayList<String>(cookieList.size());
for (Entry<String, ConcurrentHashMap<String, String>> entry2 : cookieList.entrySet()) {
ConcurrentHashMap<String, String> cookie = entry2.getValue();
if (cookie.containsKey("EXPIRES") && Calendar.getInstance(utc).after(parseCalendar(cookie.get("EXPIRES")))) {
names.add(entry2.getKey());
}
else if (path.startsWith(cookie.get("PATH"))) {
if (((secure && cookie.containsKey("SECURE")) || !cookie.containsKey("SECURE")) && !cookie.get("value").equals("")) {
if (cookies.length() != 0) {
cookies.append("; ");
}
cookies.append(cookie.get("name"));
cookies.append('=');
cookies.append(cookie.get("value"));
}
}
}
for (int i = 0, n = names.size(); i < n; ++i) {
container.get(domain).remove(names.get(i));
}
}
}
return cookies.toString();
}
}
| [
"leoly521@163.com"
] | leoly521@163.com |
9897ee6ffaff2e790bc3252da7660c262a1a9f39 | cfb0cec9882dcbdd22cf0c3c87345f4c2264f821 | /src/trace/ot/TransformationResult.java | 693826113301b4e7ffdf3597cbb31a4530f3b14f | [] | no_license | Ziqiao1992/ColabTeaching | a6fca79473ce7c8d2354a652e53262c1c05d2000 | 6edad555aaee5d9a9680fcb152600d61973cfc66 | refs/heads/master | 2021-01-19T23:58:44.174808 | 2014-08-25T13:55:21 | 2014-08-25T13:55:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,096 | java | package trace.ot;
import trace.echo.modular.ListEditInfo;
import trace.echo.modular.OperationName;
public class TransformationResult extends OTListEditInfo{
public TransformationResult(String aMessage, String aLocatable,
ListEditInfo aListEdit, UserOTTimeStampInfo anOTTimeStamp,
Object aFinder) {
super(aMessage, aLocatable, aListEdit, anOTTimeStamp, aFinder);
}
public TransformationResult(String aMessage,
OTListEditInfo aSuperClassInfo) {
super(aMessage, aSuperClassInfo);
}
public static TransformationResult toTraceable(String aMessage) {
OTListEditInfo aSuperClassInfo = OTListEditInfo.toTraceable(aMessage);
return new TransformationResult(aMessage,
aSuperClassInfo);
}
// public static String toString (String aLocatable, ListEditInfo aListEdit, UserOTTimeStampInfo anOTTimeStamp) {
// return "@" + aLocatable + UserOTTimeStampedListEditInfo.toString(aListEdit, anOTTimeStamp);
// }
public static TransformationResult newCase(String aLocatable,
ListEditInfo aListEdit, UserOTTimeStampInfo anOTTimeStamp/*, String aSourceOrDestination*/,
Object aFinder) {
String aMessage = toString(aLocatable, aListEdit, anOTTimeStamp);
TransformationResult retVal = new TransformationResult(aMessage, aLocatable, aListEdit, anOTTimeStamp, aFinder);
retVal.announce();
return retVal;
}
public static TransformationResult newCase(String aLocatable,
ListEditInfo aListEdit, OTTimeStampInfo anOTTimeStamp/*, String aSourceOrDestination*/,
String aUserName, boolean anIsServer,
Object aFinder) {
UserOTTimeStampInfo userOTTimeStampInfo = new UserOTTimeStampInfo(aLocatable, aUserName, anOTTimeStamp, anIsServer);
return newCase(aLocatable, aListEdit, userOTTimeStampInfo, aFinder);
}
public static TransformationResult newCase(String aLocatable,
OperationName aName, int anIndex, Object anElement,
int aLocalCount, int aRemoteCount,
String aUserName, boolean anIsServer,
Object aFinder) {
ListEditInfo aListEditInfo = new ListEditInfo(aName, anIndex, null, anElement);
OTTimeStampInfo anOTTimeStampInfo = new OTTimeStampInfo(aLocalCount, aRemoteCount);
return newCase(aLocatable, aListEditInfo, anOTTimeStampInfo, aUserName, anIsServer, aFinder);
}
// public static UserOTTimeStampedListEditSent newCase(/*String aLocatable,*/
// ListEditInfo aListEdit, UserOTTimeStampInfo anOTTimeStamp, String aSourceOrDestination,
// Object aFinder) {
// String aMessage = toString(aListEdit, anOTTimeStamp);
// UserOTTimeStampedListEditSent retVal = new UserOTTimeStampedListEditSent(aMessage/*, aLocatable*/, aListEdit, anOTTimeStamp, aFinder);
// retVal.announce();
// return retVal;
// }
// public static UserOTTimeStampedListEditSent newCase(/*String aLocatable,*/
// UserOTTimeStampedListEditInfo otTimeStampedListEditInfo, String aSourceOrDestination,
// Object aFinder) {
// return newCase(/*aLocatable,*/ otTimeStampedListEditInfo.getListEdit(), otTimeStampedListEditInfo.getOTTimeStamp(), aSourceOrDestination, aFinder);
// }
}
| [
"dewan@cs.unc.edu"
] | dewan@cs.unc.edu |
ef120af36715e11a8e49ea2f170a271e8a4affdf | 9b19a99ae236775dd98bbcd4fc945867cee91b07 | /build/generated-sources/ap-source-output/com/polidemo/db/Receipts_.java | 6cd8e7c5a25205848530f9ce23f87dc6aa1ebd19 | [] | no_license | poli-bapi/java | 2b2ce2796c43700b824329ff99b0d50995c58019 | bfc8ed78bd2a5e8e9c387544da9f6adbe6b80024 | refs/heads/master | 2021-01-16T00:10:02.034474 | 2012-09-20T02:24:06 | 2012-09-20T02:24:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,354 | java | package com.polidemo.db;
import java.util.Date;
import javax.annotation.Generated;
import javax.persistence.metamodel.SingularAttribute;
import javax.persistence.metamodel.StaticMetamodel;
@Generated(value="EclipseLink-2.3.0.v20110604-r9504", date="2012-09-20T07:53:35")
@StaticMetamodel(Receipts.class)
public class Receipts_ {
public static volatile SingularAttribute<Receipts, String> errorMessage;
public static volatile SingularAttribute<Receipts, String> financialInstitutionCountryCode;
public static volatile SingularAttribute<Receipts, String> countryName;
public static volatile SingularAttribute<Receipts, Date> startDateTime;
public static volatile SingularAttribute<Receipts, String> financialInstitutionName;
public static volatile SingularAttribute<Receipts, Date> bankReceiptDateTime;
public static volatile SingularAttribute<Receipts, Date> establishedDateTime;
public static volatile SingularAttribute<Receipts, String> merchantDefinedData;
public static volatile SingularAttribute<Receipts, Float> paymentAmount;
public static volatile SingularAttribute<Receipts, String> currencyName;
public static volatile SingularAttribute<Receipts, Date> merchantEstablishedDateTime;
public static volatile SingularAttribute<Receipts, String> transactionRefNo;
public static volatile SingularAttribute<Receipts, String> merchantAcctName;
public static volatile SingularAttribute<Receipts, String> merchantAcctSuffix;
public static volatile SingularAttribute<Receipts, String> financialInstitutionCode;
public static volatile SingularAttribute<Receipts, String> currencyCode;
public static volatile SingularAttribute<Receipts, String> merchantAcctNumber;
public static volatile SingularAttribute<Receipts, String> countryCode;
public static volatile SingularAttribute<Receipts, String> merchantReference;
public static volatile SingularAttribute<Receipts, String> transactionID;
public static volatile SingularAttribute<Receipts, Date> endDateTime;
public static volatile SingularAttribute<Receipts, String> bankReceipt;
public static volatile SingularAttribute<Receipts, String> merchantAcctSortCode;
public static volatile SingularAttribute<Receipts, String> errorCode;
public static volatile SingularAttribute<Receipts, Float> amountPaid;
} | [
"x@x-500"
] | x@x-500 |
37a4815f3babae57bf6034457c84463ef7820a00 | 6fa701cdaa0d83caa0d3cbffe39b40e54bf3d386 | /google/analytics/admin/v1alpha/google-analytics-admin-v1alpha-java/proto-google-analytics-admin-v1alpha-java/src/main/java/com/google/analytics/admin/v1alpha/ProvisionAccountTicketRequestOrBuilder.java | 2342e6903b571f1f9c2edafaabe438b5a291daa2 | [
"Apache-2.0"
] | permissive | oltoco/googleapis-gen | bf40cfad61b4217aca07068bd4922a86e3bbd2d5 | 00ca50bdde80906d6f62314ef4f7630b8cdb6e15 | refs/heads/master | 2023-07-17T22:11:47.848185 | 2021-08-29T20:39:47 | 2021-08-29T20:39:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | true | 1,666 | java | // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/analytics/admin/v1alpha/analytics_admin.proto
package com.google.analytics.admin.v1alpha;
public interface ProvisionAccountTicketRequestOrBuilder extends
// @@protoc_insertion_point(interface_extends:google.analytics.admin.v1alpha.ProvisionAccountTicketRequest)
com.google.protobuf.MessageOrBuilder {
/**
* <pre>
* The account to create.
* </pre>
*
* <code>.google.analytics.admin.v1alpha.Account account = 1;</code>
* @return Whether the account field is set.
*/
boolean hasAccount();
/**
* <pre>
* The account to create.
* </pre>
*
* <code>.google.analytics.admin.v1alpha.Account account = 1;</code>
* @return The account.
*/
com.google.analytics.admin.v1alpha.Account getAccount();
/**
* <pre>
* The account to create.
* </pre>
*
* <code>.google.analytics.admin.v1alpha.Account account = 1;</code>
*/
com.google.analytics.admin.v1alpha.AccountOrBuilder getAccountOrBuilder();
/**
* <pre>
* Redirect URI where the user will be sent after accepting Terms of Service.
* Must be configured in Developers Console as a Redirect URI
* </pre>
*
* <code>string redirect_uri = 2;</code>
* @return The redirectUri.
*/
java.lang.String getRedirectUri();
/**
* <pre>
* Redirect URI where the user will be sent after accepting Terms of Service.
* Must be configured in Developers Console as a Redirect URI
* </pre>
*
* <code>string redirect_uri = 2;</code>
* @return The bytes for redirectUri.
*/
com.google.protobuf.ByteString
getRedirectUriBytes();
}
| [
"bazel-bot-development[bot]@users.noreply.github.com"
] | bazel-bot-development[bot]@users.noreply.github.com |
6d6d26094efd29de33dcfe9b6eaa863fe7c9947a | f6387819bb45e0cd67a30bee376bdd5922b6ae85 | /src/test/java/com/example/demo/VeraTestProjectApplicationTests.java | 763b8069d53f51c65e1547276bc30e6e8ab12b52 | [] | no_license | Punit5/vera | d1007b4da86572dd408ab8ca8a9e2fad05c13dd8 | 159141b612f4a00f364a8a662e9b40f3e16ced3d | refs/heads/master | 2020-04-13T16:41:11.059541 | 2018-12-27T19:07:28 | 2018-12-27T19:07:28 | 163,327,601 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 343 | java | package com.example.demo;
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 VeraTestProjectApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"moeddie@hotmail.com"
] | moeddie@hotmail.com |
7511026acaf08535889ac6689549fac64e3272b4 | 6ac768a4f10caf60274795b07d98e098b1ded910 | /src/test/java/com/sample/project/expensereport/ExpensereportApplicationTests.java | 70ca09f95edbcf58a99a1d9a9aef0dc0566a2997 | [] | no_license | Hima6/sample | 9294ff43600538893086da4671f7356956d7aef9 | 3fef13d5c1b8cfbe32eed4ca674d803d491d5980 | refs/heads/master | 2020-04-23T07:30:40.908754 | 2019-03-03T16:54:49 | 2019-03-03T16:54:49 | 171,008,404 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 357 | java | package com.sample.project.expensereport;
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 ExpensereportApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"hima.t@tavant.com"
] | hima.t@tavant.com |
84c75d03a9b16198d87aa48a79f2d34fb46fa78f | d734f452914b51f565f8626eb86f721b2833db76 | /src/main/java/org/cc/ICCMap.java | d55195e80b251bad11d4e1fbfaadf190836e9790 | [] | no_license | williamyyj/mcc2 | eee779a092f98b44a13518042ccbbb36d7a10c3d | 735e42b3872450b292a1309c0354bba9272953a9 | refs/heads/master | 2020-06-12T15:46:30.796899 | 2017-11-24T01:59:19 | 2017-11-24T01:59:19 | 75,796,552 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,624 | java | package org.cc;
import java.util.Date;
import java.util.Map;
import org.cc.util.CCCast;
import org.cc.util.CCJSON;
/**
*
* @author william
*/
public interface ICCMap extends Map<String, Object> {
default int asInt(String key) {
return asInt(key, 0);
}
default int asInt(String key, int dv) {
return CCCast._int(get(key), dv);
}
default long asLong(String key) {
return asLong(key, 0L);
}
default long asLong(String key, Long dv) {
return CCCast._long(get(key), dv);
}
default double asDouble(String key) {
return asDouble(key, 0.0);
}
default double asDouble(String key, double dv) {
return CCCast._double(get(key), dv);
}
default boolean asBool(String key) {
return asBool(key, false);
}
default boolean asBool(String key, boolean dv) {
return CCCast._bool(get(key), dv);
}
default Date asDate(String key) {
return CCCast._date(get(key));
}
default String asString(String key) {
return asString(key, "");
}
default String asString(String key, String dv) {
return CCCast._string(get(key), dv);
}
default ICCMap map(String key) {
Object o = get(key);
return (o instanceof ICCMap) ? (ICCMap) o : null;
}
default ICCList list(String key) {
Object o = get(key);
return (o instanceof ICCList) ? (ICCList) o : null;
}
default String toString(int indent) {
return CCJSON.toString(this, indent);
}
}
| [
"williamyyj@gmail.com"
] | williamyyj@gmail.com |
c4312b10a3e91db07425232bec20785c2a5c2e4c | 60d641cc6dc6b4ee17dc3cfb3c07e41796c5cce9 | /DIT953/polygons/polygon/Square.java | 537b55e28ea8b16889b5a91ca15c94d06c585c94 | [] | no_license | carl-stewart/block51exercise | 457a535788297f8d3cce69cb1261a2093f015b0c | 91da016edde3cd51496ea48e0635d11c891b07fa | refs/heads/master | 2021-10-19T04:04:35.260622 | 2019-02-17T21:14:15 | 2019-02-17T21:14:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 338 | java | package DIT953.polygons.polygon;
import java.awt.*;
/**
* Created by Niklas on 2016-01-19.
*/
public class Square extends Polygon {
public Square(int x, int y) {
super(x,y);
}
@Override
public void paint(Graphics g){
g.drawRect(centerPoint.x - 10, centerPoint.y - 10, 20, 20);
}
}
| [
"noreply@github.com"
] | noreply@github.com |
db91e89a9982507649a633267c21ed5d6966d2cc | 8f15a39110d886e82ea04214c269ab73d5568849 | /Faculdade/src/controle/RelatorioFaltasController.java | a44eec80a4a12cd035ad8d23bcb43a888a2b9176 | [] | no_license | httpsbruno/AtvLabBD_2_3 | 8c0e94d8f6e45832dc10ad6921f3dc7b6b5dd98f | 7331bf3b74e8913bd46cafae4a29f284d1fdfc2a | refs/heads/master | 2022-11-10T19:15:37.524000 | 2020-06-29T18:07:29 | 2020-06-29T18:07:29 | 275,891,089 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,601 | java | package controle;
import java.awt.Desktop;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.HashMap;
import javax.swing.JOptionPane;
import dao.DBUtils;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.JasperRunManager;
import net.sf.jasperreports.engine.util.JRLoader;
public class RelatorioFaltasController {
public void gerarRelatorio(int codigo, String sigla, String turno) {
String erro="";
String codigo_disciplina = String.valueOf(codigo);
String jasper = "C:\\Users\\Bruno Barbosa\\Desktop\\Relatorios\\RelatorioFaltas.jasper";
HashMap<String,Object> param = new HashMap<String,Object>();
param.put("CODIGO_DISCIPLINA", codigo_disciplina);
byte[] bytes = null;
try {
JasperReport relatorio = (JasperReport) JRLoader.loadObjectFromFile(jasper);
Connection con = DBUtils.getInstance().getConnection();
bytes = JasperRunManager.runReportToPdf(relatorio, param,con);
//onde vou salvar
File file = new File("C:\\Users\\Bruno Barbosa\\Desktop\\Relatorios", sigla +"-"+ turno + "-Faltas.pdf");
if(file.exists()) {
file.delete();
}
FileOutputStream fos = new FileOutputStream(file);
fos.write(bytes);
fos.flush();
fos.close();
Desktop desk = Desktop.getDesktop();
desk.open(file);
} catch (JRException | IOException | SQLException e) {
erro = e.getMessage();
JOptionPane.showMessageDialog(null, erro);
}
}
} | [
"bruno-bbs80@hotmail.com"
] | bruno-bbs80@hotmail.com |
703c116c7d4cfdfdfb3ae7f508409d1f496270b8 | 0e86d617a73972b4d0de0867679e9b5dc95ed3e5 | /Phylotastic_BuildTree_OCR_Android_Application/src/edu/nmsu/cs/phylotastic/ocr/BeepManager.java | 490cc1e287b0cb139eacdbc77e0ff9aaacd7cc68 | [] | no_license | phylotastic/Pt_Mobile_Application | e1d733b30b6239eed1698d857c28a9607ccf635d | d7552e9c9fede62ae20cb4f23500583b7b2e2bc4 | refs/heads/master | 2021-01-18T20:32:37.653803 | 2018-09-21T22:28:25 | 2018-09-21T22:28:25 | 45,148,459 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,534 | java | /*
* Copyright (C) 2010 ZXing authors
* Copyright 2011 Robert Theis
*
* 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 edu.nmsu.cs.phylotastic.ocr;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.AssetFileDescriptor;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.preference.PreferenceManager;
import android.util.Log;
import edu.nmsu.cs.phylotastic.ocr.R;
import java.io.IOException;
/**
* Manages beeps and vibrations for {@link CaptureActivity}.
*
* The code for this class was adapted from the ZXing project: http://code.google.com/p/zxing/
*/
public final class BeepManager {
private static final String TAG = BeepManager.class.getSimpleName();
private static final float BEEP_VOLUME = 0.10f;
private final Activity activity;
private MediaPlayer mediaPlayer;
private boolean playBeep;
public BeepManager(Activity activity) {
this.activity = activity;
this.mediaPlayer = null;
updatePrefs();
}
public void updatePrefs() {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
playBeep = shouldBeep(prefs, activity);
if (playBeep && mediaPlayer == null) {
// The volume on STREAM_SYSTEM is not adjustable, and users found it too loud,
// so we now play on the music stream.
activity.setVolumeControlStream(AudioManager.STREAM_MUSIC);
mediaPlayer = buildMediaPlayer(activity);
}
}
public void playBeepSoundAndVibrate() {
if (playBeep && mediaPlayer != null) {
mediaPlayer.start();
}
}
private static boolean shouldBeep(SharedPreferences prefs, Context activity) {
boolean shouldPlayBeep = prefs.getBoolean(PreferencesActivity.KEY_PLAY_BEEP, CaptureActivity.DEFAULT_TOGGLE_BEEP);
if (shouldPlayBeep) {
// See if sound settings overrides this
AudioManager audioService = (AudioManager) activity.getSystemService(Context.AUDIO_SERVICE);
if (audioService.getRingerMode() != AudioManager.RINGER_MODE_NORMAL) {
shouldPlayBeep = false;
}
}
return shouldPlayBeep;
}
private static MediaPlayer buildMediaPlayer(Context activity) {
MediaPlayer mediaPlayer = new MediaPlayer();
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
// When the beep has finished playing, rewind to queue up another one.
mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
public void onCompletion(MediaPlayer player) {
player.seekTo(0);
}
});
AssetFileDescriptor file = activity.getResources().openRawResourceFd(R.raw.beep);
try {
mediaPlayer.setDataSource(file.getFileDescriptor(), file.getStartOffset(), file.getLength());
file.close();
mediaPlayer.setVolume(BEEP_VOLUME, BEEP_VOLUME);
mediaPlayer.prepare();
} catch (IOException ioe) {
Log.w(TAG, ioe);
mediaPlayer = null;
}
return mediaPlayer;
}
}
| [
"thanhnh2911@gmail.com"
] | thanhnh2911@gmail.com |
f24df33fa7d1c6924d0fd62a92367100c90a4052 | b24818a948152b06c7d85ac442e9b37cb6becbbc | /src/main/java/com/ash/experiments/performance/whitespace/Class879.java | a13e73861980dab932db54641c1d454704f3e535 | [] | no_license | ajorpheus/whitespace-perf-test | d0797b6aa3eea1435eaa1032612f0874537c58b8 | d2b695aa09c6066fbba0aceb230fa4e308670b32 | refs/heads/master | 2020-04-17T23:38:39.420657 | 2014-06-02T09:27:17 | 2014-06-02T09:27:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 40 | java | public class Class879 {}
| [
"Ashutosh.Jindal@monitise.com"
] | Ashutosh.Jindal@monitise.com |
0b0230fdce45e679cf708782af431ad44203ed6d | a1f48992d8396ebaa3fccf95ae443a0c59739ac7 | /IfElseProgram.java | 43bd6b1178840f4b3dbee46f7d582384b0287dd2 | [] | no_license | JoshGuad/ClassAs3.3 | 24eff6399b7f3497b19596237b7b3380ea54fb99 | c5086013192bda19d1dae42f3e10a10ef76c0b9f | refs/heads/master | 2020-12-30T10:23:19.488288 | 2015-11-10T01:51:43 | 2015-11-10T01:51:43 | 42,900,868 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,170 | java |
import javax.swing.JOptionPane;
public class IfElseProgram {
public static void main(String[] args)
{
String numPeopleStr = JOptionPane.showInputDialog("Enter the number of people.");
int numPeople = Integer.parseInt(numPeopleStr);
int groupSize=0;
if (numPeople > 10)
{
groupSize = numPeople / 2;
JOptionPane. showMessageDialog(null,"The number of people is "+numPeople+". The group size is "+groupSize + ".");
}
else if ((numPeople >=3) && (numPeople <=10))
{
groupSize = numPeople/3;
JOptionPane. showMessageDialog(null,"The number of people is "+numPeople+". The group size is "+groupSize + ".");
}
else
{
JOptionPane.showMessageDialog(null, "The number of people has to be at least 3.");
}
String numPlayersStr = JOptionPane.showInputDialog("Enter the number of players.");
int numPlayers = Integer.parseInt(numPlayersStr);
int teamSize;
if ((numPlayers >= 11) && (numPlayers <= 55))
{
teamSize = numPlayers/11;
}
else
{
teamSize = 1;
}
JOptionPane. showMessageDialog(null,"The number of players is "+numPlayers+". The team size is "+teamSize+ ".");
}
} | [
"jguad.sv@gmail.com"
] | jguad.sv@gmail.com |
e90db6207fafd365bd2ab597cbb7b74647172317 | 1146391cfaec285187b4b39c2b8bf425dfe66c58 | /app/src/main/java/com/example/inter/helloworld/MainActivity.java | dca7999f4a679abfbc6270dc90f6ca98904f97ed | [] | no_license | NathanDanTaylor/HelloWorld | aba458f0f2c7fd45fa2a84c0e3a9eafcef5fbc80 | 4c779a5877b6d6359cdc8c58ad00b9997d09c5b2 | refs/heads/master | 2020-04-13T17:54:00.095780 | 2018-12-28T03:57:41 | 2018-12-28T03:57:41 | 163,359,274 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 588 | java | package com.example.inter.helloworld;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toast.makeText(this, "Hello Nata!", Toast.LENGTH_SHORT).show();
}
public void btnPopup(View view) {
Toast.makeText(this, "Hello Nata!!!!", Toast.LENGTH_SHORT).show();
}
}
| [
"thenathanforall@gmail.com"
] | thenathanforall@gmail.com |
71de5c5b096d1dd99e8648feb655e0805202757c | 3cc42d28866558de1f9c9debbabd4fedfe6b8133 | /base-application/src/test/java/com/huangxj/ers/ApplicationTests.java | 6bbd3debe096253d9be9a2f3d03d7a9cc77a14d3 | [] | no_license | HuangXianJin/base | 15c1fe45ad81b77ed358f57047fc0a0682c05244 | ecec4230daf4acada2c68b277cddf3f6da08fb0c | refs/heads/master | 2022-07-17T04:33:34.227348 | 2020-04-07T03:42:44 | 2020-04-07T03:42:44 | 253,676,083 | 0 | 0 | null | 2022-06-21T03:09:28 | 2020-04-07T03:20:50 | Java | UTF-8 | Java | false | false | 360 | java | package com.huangxj.base;
import org.junit.Ignore;
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
@Ignore
public class ApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"914103719@qq.com"
] | 914103719@qq.com |
ccc3128c1145055632f044dde3ad5de5ab6d5fa1 | b99400e9f14d98ca383565854b32106e0389f11c | /src/main/java/com/imooc/service/OrderService.java | 64aa395b9211bb8071adc2c8c6af8de08668c006 | [] | no_license | chenkeren1994/sell | 1d7952f91cddbf4eb5caa79f290c9b3e0532dd00 | 56953054741003c9c3a2f67ce5715078942a3db3 | refs/heads/master | 2021-01-01T06:25:29.607484 | 2017-07-22T08:04:20 | 2017-07-22T08:04:20 | 97,426,161 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 699 | java | package com.imooc.service;
import com.imooc.dto.OrderDto;
import org.hibernate.criterion.Order;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
/**
* Created by seal on 7/17/17.
*/
public interface OrderService {
/** 创建订单. */
OrderDto create(OrderDto orderDto);
/** 查询单个订单. */
OrderDto findOne(String orderId);
/** 查询订单列表. */
Page<OrderDto> findList (String buyerOpenId, Pageable pageable);
/** 取消订单. */
OrderDto cancel(OrderDto orderDto);
/** 完结订单. */
OrderDto finish(OrderDto orderDto);
/** 支付订单. */
OrderDto paid(OrderDto orderDto);
}
| [
"chenkerenqiqi@163.com"
] | chenkerenqiqi@163.com |
25c9e87b2f4e8f5228eb21076ae4b359fdb70376 | b5175657de274d638e1b5831d269b7f2ab1e325d | /src/main/java/com/oci/wade/decompiler/instruction/DLOAD.java | 8d519f7e294e8f0d14680eb976372f2c5e825af8 | [] | no_license | wadec4615/decompiler | b1983d50a076a4121aa14fbecd78a7c2c4011dd3 | 2243abcf8893218c02a24791ad3dbd99d41deb02 | refs/heads/master | 2020-05-07T20:28:59.968859 | 2019-04-19T20:05:19 | 2019-04-19T20:05:19 | 180,861,959 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 429 | java | package com.oci.wade.decompiler.instruction;
import com.oci.wade.decompiler.constants.Opcode;
import com.oci.wade.decompiler.generic.LoadInstruction;
public class DLOAD extends LoadInstruction {
public DLOAD(Opcode opcode) {
super(opcode);
}
public DLOAD(Opcode opcode, int index) {
super(opcode, index, false);
}
public DLOAD(Opcode opcode, int index, boolean wide) {
super(opcode, index, wide);
}
}
| [
"wadec@objectcomputing.com"
] | wadec@objectcomputing.com |
b53ae31c0a46eae16bd59000d5a02b8ddcd7ea26 | abaa15d85936c347216365cb3b3f4c66c41516b9 | /src/main/java/com/jonki/Config/WebInit.java | 514bdc05eb95e9fa8e4382742ccc0a17457cf378 | [] | no_license | JonkiPro/Movie-Database-with-Social-Network | 57b159e0869effee45d16ccdb1bf0c4e5a01ecad | 9139bbd3647f09b82178554db69fcd289175dc04 | refs/heads/master | 2021-01-20T07:13:18.379182 | 2017-07-01T13:33:28 | 2017-07-01T13:33:28 | 89,978,025 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 605 | java | package com.jonki.Config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;
@Configuration
public class WebInit extends AbstractAnnotationConfigDispatcherServletInitializer {
@Override
protected Class<?>[] getRootConfigClasses() {
return null;
}
@Override
protected Class<?>[] getServletConfigClasses() {
return new Class[] {WebConfig.class};
}
@Override
protected String[] getServletMappings() {
return new String[] {"/"};
}
}
| [
"slugocki.jonatan@gmail.com"
] | slugocki.jonatan@gmail.com |
65fb25666cd7b07892a210f7381ffc9afb3f1e08 | 5eb61dc67145c1b1d5a908b803520ba9da83f82d | /Day56_Mybatis02/src/main/java/com/nys/dao/OrdersMapper.java | f39d99b7ba6d84c2fa4772cd7ea8c4e02dc7d706 | [] | no_license | OnTheRightWay/workspace | 27549e5344a8d56575a5b5798bdabf9fe661872d | f6767929db06f66defdee50dcf87fb7441207e87 | refs/heads/master | 2021-09-09T15:06:33.482564 | 2018-03-17T06:07:57 | 2018-03-17T06:07:57 | 113,117,366 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 243 | java | package com.nys.dao;
import com.nys.domain.Orders;
import com.nys.domain.OrdersExt;
import java.util.List;
public interface OrdersMapper {
List<Orders> findOrdersUser();
List<Orders> findOrdersAll();
List<Orders> findItems();
}
| [
"34029301+OnTheRightWay@users.noreply.github.com"
] | 34029301+OnTheRightWay@users.noreply.github.com |
fcbb35e1867e2528c2e0afa2beb392d7d09d1238 | ee84e66e62d421f7a73dac1071025596695036e2 | /clouddriver-kubernetes/src/main/java/com/netflix/spinnaker/clouddriver/kubernetes/converter/manifest/KubernetesEnableManifestConverter.java | 02e31fe7aeef76a2663ac33432cce90b3164dd1b | [
"Apache-2.0"
] | permissive | spinnaker/clouddriver | 454918499187caf19aad7fe1aba32dc37fb665e3 | 98204860175e00f8b1e01b43f8fa06670cc4cd2e | refs/heads/master | 2023-09-04T09:32:14.381228 | 2023-08-29T18:44:20 | 2023-08-29T18:44:20 | 37,556,951 | 462 | 1,334 | Apache-2.0 | 2023-09-14T03:13:59 | 2015-06-16T21:26:02 | Groovy | UTF-8 | Java | false | false | 2,212 | java | /*
* Copyright 2018 Google, Inc.
*
* 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 com.netflix.spinnaker.clouddriver.kubernetes.converter.manifest;
import static com.netflix.spinnaker.clouddriver.orchestration.AtomicOperations.ENABLE_MANIFEST;
import com.netflix.spinnaker.clouddriver.kubernetes.KubernetesOperation;
import com.netflix.spinnaker.clouddriver.kubernetes.deploy.converters.KubernetesAtomicOperationConverterHelper;
import com.netflix.spinnaker.clouddriver.kubernetes.description.manifest.KubernetesEnableDisableManifestDescription;
import com.netflix.spinnaker.clouddriver.kubernetes.op.OperationResult;
import com.netflix.spinnaker.clouddriver.kubernetes.op.manifest.KubernetesEnableManifestOperation;
import com.netflix.spinnaker.clouddriver.kubernetes.security.KubernetesNamedAccountCredentials;
import com.netflix.spinnaker.clouddriver.orchestration.AtomicOperation;
import com.netflix.spinnaker.clouddriver.security.AbstractAtomicOperationsCredentialsConverter;
import java.util.Map;
import org.springframework.stereotype.Component;
@KubernetesOperation(ENABLE_MANIFEST)
@Component
public class KubernetesEnableManifestConverter
extends AbstractAtomicOperationsCredentialsConverter<KubernetesNamedAccountCredentials> {
@Override
public AtomicOperation<OperationResult> convertOperation(Map<String, Object> input) {
return new KubernetesEnableManifestOperation(convertDescription(input));
}
@Override
public KubernetesEnableDisableManifestDescription convertDescription(Map<String, Object> input) {
return KubernetesAtomicOperationConverterHelper.convertDescription(
input, this, KubernetesEnableDisableManifestDescription.class);
}
}
| [
"noreply@github.com"
] | noreply@github.com |
afc6b09b1f662d58e3a28189a5fcc24abcead2d2 | 1bc2322f2a165f498c339e85ff4dcb3c464bf546 | /app/src/main/java/com/zmy/knowledge/webx5/FullScreenActivity.java | b9ac537514a7c3f4aaa636163aa307741c8d3915 | [] | no_license | zmyqucai8/knowledge_demo | e97307e7295cab83d1183ed392c12eb19d564f5d | 234fc9e9bacc1781835f6815615c546c27d78a63 | refs/heads/master | 2021-01-21T10:08:35.861668 | 2017-08-16T07:04:47 | 2017-08-16T07:04:47 | 91,679,872 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,934 | java | package com.zmy.knowledge.webx5;
import android.app.Activity;
import android.content.res.Configuration;
import android.graphics.PixelFormat;
import android.os.Bundle;
import android.view.View;
import android.webkit.JavascriptInterface;
import android.widget.Toast;
import com.zmy.knowledge.R;
import com.zmy.knowledge.webx5.utils.WebViewJavaScriptFunction;
import com.zmy.knowledge.webx5.utils.X5WebView;
public class FullScreenActivity extends Activity {
/**
* 用于演示X5webview实现视频的全屏播放功能 其中注意 X5的默认全屏方式 与 android 系统的全屏方式
*/
X5WebView webView;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.filechooser_layout);
webView = (X5WebView) findViewById(R.id.web_filechooser);
webView.loadUrl("file:///android_asset/webpage/fullscreenVideo.html");
getWindow().setFormat(PixelFormat.TRANSLUCENT);
webView.getView().setOverScrollMode(View.OVER_SCROLL_ALWAYS);
webView.addJavascriptInterface(new WebViewJavaScriptFunction() {
@Override
public void onJsFunctionCalled(String tag) {
// TODO Auto-generated method stub
}
@JavascriptInterface
public void onX5ButtonClicked() {
FullScreenActivity.this.enableX5FullscreenFunc();
}
@JavascriptInterface
public void onCustomButtonClicked() {
FullScreenActivity.this.disableX5FullscreenFunc();
}
@JavascriptInterface
public void onLiteWndButtonClicked() {
FullScreenActivity.this.enableLiteWndFunc();
}
@JavascriptInterface
public void onPageVideoClicked() {
FullScreenActivity.this.enablePageVideoFunc();
}
}, "Android");
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
// TODO Auto-generated method stub
try {
super.onConfigurationChanged(newConfig);
if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
} else if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
}
} catch (Exception e) {
e.printStackTrace();
}
}
// /////////////////////////////////////////
// 向webview发出信息
private void enableX5FullscreenFunc() {
if (webView.getX5WebViewExtension() != null) {
Toast.makeText(this, "开启X5全屏播放模式", Toast.LENGTH_LONG).show();
Bundle data = new Bundle();
data.putBoolean("standardFullScreen", false);// true表示标准全屏,false表示X5全屏;不设置默认false,
data.putBoolean("supportLiteWnd", false);// false:关闭小窗;true:开启小窗;不设置默认true,
data.putInt("DefaultVideoScreen", 2);// 1:以页面内开始播放,2:以全屏开始播放;不设置默认:1
webView.getX5WebViewExtension().invokeMiscMethod("setVideoParams",
data);
}
}
private void disableX5FullscreenFunc() {
if (webView.getX5WebViewExtension() != null) {
Toast.makeText(this, "恢复webkit初始状态", Toast.LENGTH_LONG).show();
Bundle data = new Bundle();
data.putBoolean("standardFullScreen", true);// true表示标准全屏,会调起onShowCustomView(),false表示X5全屏;不设置默认false,
data.putBoolean("supportLiteWnd", false);// false:关闭小窗;true:开启小窗;不设置默认true,
data.putInt("DefaultVideoScreen", 2);// 1:以页面内开始播放,2:以全屏开始播放;不设置默认:1
webView.getX5WebViewExtension().invokeMiscMethod("setVideoParams",
data);
}
}
private void enableLiteWndFunc() {
if (webView.getX5WebViewExtension() != null) {
Toast.makeText(this, "开启小窗模式", Toast.LENGTH_LONG).show();
Bundle data = new Bundle();
data.putBoolean("standardFullScreen", false);// true表示标准全屏,会调起onShowCustomView(),false表示X5全屏;不设置默认false,
data.putBoolean("supportLiteWnd", true);// false:关闭小窗;true:开启小窗;不设置默认true,
data.putInt("DefaultVideoScreen", 2);// 1:以页面内开始播放,2:以全屏开始播放;不设置默认:1
webView.getX5WebViewExtension().invokeMiscMethod("setVideoParams",
data);
}
}
private void enablePageVideoFunc() {
if (webView.getX5WebViewExtension() != null) {
Toast.makeText(this, "页面内全屏播放模式", Toast.LENGTH_LONG).show();
Bundle data = new Bundle();
data.putBoolean("standardFullScreen", false);// true表示标准全屏,会调起onShowCustomView(),false表示X5全屏;不设置默认false,
data.putBoolean("supportLiteWnd", false);// false:关闭小窗;true:开启小窗;不设置默认true,
data.putInt("DefaultVideoScreen", 1);// 1:以页面内开始播放,2:以全屏开始播放;不设置默认:1
webView.getX5WebViewExtension().invokeMiscMethod("setVideoParams",
data);
}
}
}
| [
"zmy_1592@163.com"
] | zmy_1592@163.com |
0e4e3483c042928df4ffc94bf1f723917a04f366 | 748efbc1c28aa66417bf1c4a9109e1024d1fb225 | /IdeaProjects/WebDemo/src/Model/TestCountDownLatch.java | 370318aff3313a65ebce76a594942f2fb1236509 | [] | no_license | jinxiangjian/TestRepository | 94b9584b47d9ed5030eb322116b4507f6fc02196 | 9ea31c50aeb0d560fc24016a27f89ee920fd864a | refs/heads/master | 2021-01-01T18:03:12.301766 | 2018-07-04T07:40:17 | 2018-07-04T07:40:17 | 41,987,414 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,091 | java | package Model;
import java.util.concurrent.CountDownLatch;
public class TestCountDownLatch {
public static void testCountDownLatch(){
int threadCount = 10;
final CountDownLatch latch = new CountDownLatch(threadCount);
for(int i = 0; i < threadCount; i++){
new Thread(new Runnable() {
@Override
public void run() {
System.out.println("线程" + Thread.currentThread().getId() + "开始出发");
try {
Thread.sleep(1000);
} catch (InterruptedException e){
e.printStackTrace();
}
System.out.println("线程" + Thread.currentThread().getId() + "已到达终点");
latch.countDown();
}
}).start();
}
try {
latch.await();
} catch (InterruptedException e){
e.printStackTrace();
}
System.out.println("10个线程计算完毕,开始计算排名");
}
}
| [
"jinxiangjian1991@163.com"
] | jinxiangjian1991@163.com |
f6dd2a6b50f82b19989b6326f64e3a0edb431d71 | 1c483e8ddad6b6cf2b32d294449a125e14e9d31b | /src/lt/LinasJu/Entities/Edges/SpreadTypeEnum.java | 6f3802f061855d1b8436f27012857598af7beac0 | [] | no_license | LinasJu/GeneticAlgorithmForTrafficSim | f0761076c43773a0cdc94c505a9a9a3b6926fcf8 | ce22d47bdfe30811d7ea57e2eeb61a440e7f60d5 | refs/heads/master | 2022-09-04T00:15:21.355342 | 2020-05-24T17:49:24 | 2020-05-24T17:49:24 | 258,966,312 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 938 | java | package lt.LinasJu.Entities.Edges;
import java.util.HashMap;
import java.util.Map;
//https://sumo.dlr.de/userdoc/Networks/PlainXML.html#spreadtype
public enum SpreadTypeEnum {
RIGHT("right"), CENTER("center"), ROAD_CENTER("roadCenter");
private final String spreadType;
SpreadTypeEnum(String spreadType) {
this.spreadType = spreadType;
}
@Override
public String toString() {
return spreadType;
}
//****** Reverse Lookup Implementation************//
//Lookup table
private static final Map<String, SpreadTypeEnum> lookup = new HashMap<>();
//Populate the lookup table on loading time
static {
for (SpreadTypeEnum env : SpreadTypeEnum.values()) {
lookup.put(env.toString(), env);
}
}
//This method can be used for reverse lookup purpose
public static SpreadTypeEnum get(String label) {
return lookup.get(label);
}
} | [
"linas.jurgelenas@gmail.com"
] | linas.jurgelenas@gmail.com |
c5cc3f30d15aec3cc587f3fe522eced2c88f1927 | 96f24caba3511efb342fd9bb991698e7a0ba1c63 | /2.OOP_n/src/ru/javabegin/training/fastjava2/shop_31/goods/Plate.java | a2199a388e2cd49697805f38c146313491500f83 | [] | no_license | Abergaz/JavaBeginWork | 877f87b0f21b6fdac6d24ad14f6d28d574a14742 | a443adacfd8265839ced00b1eeab22294e9fb42d | refs/heads/master | 2020-06-30T11:15:53.414126 | 2019-11-16T06:00:45 | 2019-11-16T06:00:45 | 200,809,640 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 228 | java | package ru.javabegin.training.fastjava2.shop_31.goods;
public class Plate extends AbstractGoods {// тарелка - не эл. устройство, не должно уметь включать и выключаться
}
| [
"zagreba@gmail.com"
] | zagreba@gmail.com |
9becb048e7a836330bae5f05567a0163cab132b1 | 97b6e2647f22856e3c435e2af311bee3e944a348 | /412_fizzBuzz.java | 6d160061fcaf5173eb7b6719fef86512c66cdba8 | [] | no_license | xiaoyaoworm/Leetcode-java | 16c82f5fe3a8732643d19c9bef1c7e58ec826060 | 1567d5b3d5109584c3af553076b872379399ebf0 | refs/heads/master | 2022-07-26T15:20:28.390682 | 2022-07-18T06:55:32 | 2022-07-18T06:55:32 | 34,633,995 | 0 | 3 | null | null | null | null | UTF-8 | Java | false | false | 411 | java | public class Solution {
public List<String> fizzBuzz(int n) {
List<String> res = new LinkedList<String>();
if(n == 0) return res;
for(int i = 1; i <= n; i++){
if(i%15 == 0) res.add("FizzBuzz");
else if(i%3 == 0) res.add("Fizz");
else if(i %5 == 0) res.add("Buzz");
else res.add(String.valueOf(i));
}
return res;
}
} | [
"xiaoyaoworm@gmail.com"
] | xiaoyaoworm@gmail.com |
1294bafb4270206c582aacbce4a9eedbfa1f09c2 | b7c85c7ba5f2c96a483ff0bea3a3397c75925d8b | /src/br/com/caelum/vraptor/model/Cliente.java | 1018cd8e307225217ca48e231399bef2cfaa57d6 | [
"Apache-2.0"
] | permissive | msulista/marcus-projeto-aula | d84d69c9b16e781457373c0236a9f4de22e93d8e | 47af4194474f94d402b22cc8715c33bf8b6e972d | refs/heads/master | 2016-09-05T21:20:25.274219 | 2014-10-31T16:28:01 | 2014-10-31T16:28:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 622 | java | package br.com.caelum.vraptor.model;
import br.com.caelum.vraptor.ioc.Component;
@Component
public class Cliente extends Pessoa{
private String idCliente;
public Cliente(String nome, String cpf, String id_cliente){
super(nome, cpf);
this.idCliente = id_cliente;
}
public String getIdCliente() {
return idCliente;
}
public void setIdCliente(String idCliente) {
this.idCliente = idCliente;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getCpf() {
return cpf;
}
public void setCpf(String cpf) {
this.cpf = cpf;
}
}
| [
"hbraga.santos@gmail.com"
] | hbraga.santos@gmail.com |
f26f61f8d43b8ff1b3a4c66776ef2db7a2d01be6 | e2c8820e4737311fc702391aa43a9fca33425757 | /ch03 Function/src/com/switchTest01/MoneyModel/impl/CommissionedPay.java | 28ab6e2a41570e73a590861c2427e29e11f585c1 | [] | no_license | hungmans6779/Clean-Code | e262a5fe10564a345e75af45157f83eb117c5603 | 21e4a6104dc47beb686a217918436a55276dbebb | refs/heads/master | 2020-04-14T01:33:30.061013 | 2018-12-30T05:06:02 | 2018-12-30T05:06:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 203 | java | package com.switchTest01.MoneyModel.impl;
import com.switchTest01.MoneyModel.Money;
public class CommissionedPay implements Money {
public String showPay(){
return "CommissionedPay";
}
}
| [
"hungmans6779@msn.com"
] | hungmans6779@msn.com |
9ca81f933d54dabdf6b983f9cb4c881c79a40b50 | 3a55c8dffd8bd89a2d2acccc04d4d8708ed1fac7 | /sy_core/src/main/java/com/sy/modules/dao/sys/PaymentDao.java | 5ecb1d6307d25a3687e28d4de2db1e7b086699a7 | [] | no_license | szsuoyuan/sybusiness | feb448617ecf4eabc07e40b7a547ff544ad90e05 | 0dd09e813f61e549eb62dfa59f2736582e69d6bc | refs/heads/master | 2020-03-21T04:26:57.580616 | 2018-06-28T10:59:26 | 2018-06-28T10:59:26 | 138,108,726 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 398 | java | package com.sy.modules.dao.sys;
import java.util.List;
import org.springframework.stereotype.Component;
import com.sy.modules.common.MyBatisRepository;
import com.sy.modules.common.ParentDao;
import com.sy.modules.entity.sys.Payment;
@Component
@MyBatisRepository
public interface PaymentDao extends ParentDao<Payment, Long> {
//find all payments
public List<Payment> findAllPayments();
}
| [
"shishengbinbdh@163.com"
] | shishengbinbdh@163.com |
f0116563d5164db3c69eb9fd56184177648fc99e | 7f1289083ff9d55d8a5dd82b37b6386e47a74886 | /src/wave/action/api/ListInfoJsonAction.java | 2d46c8e43b1b4f32209e2d6d036d2111b783fd2f | [] | no_license | sbear123/Wave_backend | 577030208630b7bb2288c017b615fb753b8c2c66 | 0cc9b257e831193604e293704db2d816ee9bb195 | refs/heads/master | 2023-05-26T09:02:55.572636 | 2021-06-02T01:48:50 | 2021-06-02T01:48:50 | 284,200,373 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 844 | java | package wave.action.api;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.io.IOUtils;
import com.google.gson.Gson;
import bean.ListInfoDBBean;
import bean.PlayListBean;
import wave.action.Action;
public class ListInfoJsonAction implements Action {
@Override
public String requestProcess(HttpServletRequest request, HttpServletResponse response) throws Throwable {
request.setCharacterEncoding("UTF-8");
Gson gson = new Gson();
// input
String str = IOUtils.toString(request.getReader());
PlayListBean requestList = gson.fromJson(str, PlayListBean.class);
System.out.println(requestList.getPlaylistid());
PlayListBean list = ListInfoDBBean.getInstance().getList(requestList.getPlaylistid());
return gson.toJson(list, PlayListBean.class);
}
} | [
"sbear123@naver.com"
] | sbear123@naver.com |
8640ddb5c31eb78d1b429d04495d8252cf5d4d21 | 15d540711ef0e17433e57c98152216ba0d5c9d6f | /WEB-INF/src/com/bright/framework/mail/service/EmailManager.java | 18a51d387297039060e37631626bc064bd63d557 | [] | no_license | brightinteractive/product-tracker | cdd12668ca6fb8b767d2de6afb452b5be0fe0e4b | 4537436582d3d8671252ca84da9acd0cb7533166 | refs/heads/master | 2021-01-09T20:03:07.866789 | 2017-02-08T08:21:42 | 2017-02-08T08:21:42 | 81,217,082 | 0 | 0 | null | 2017-02-07T15:32:46 | 2017-02-07T14:30:20 | JavaScript | UTF-8 | Java | false | false | 35,694 | java | package com.bright.framework.mail.service;
/**
* bn2web, framework
*
* Copyright 2002 bn2web, All Rights Reserved.
* EmailManager.java
*
*
*/
/*
Ver Date Who Comments
--------------------------------------------------------------------------------
d1 29-Apr-2003 Matt Stevenson Created.
d2 30-Apr-2003 Matt Stevenson Added missing exception check
and changed to accept control parameter
for where to send the email to
d3 22-Oct-2003 James Home Added subject param version of sendFeedbackEmail
d4 27-Oct-2003 James Home Added sendTemplatedEmail
d5 03-Mar-2004 James Home Added getTemplatedEmailPreview
d6 29-Mar-2004 Martin Wilson Added support for attachments
d7 05-Apr-2004 Martin Wilson Added support for HTML emails
d8 08-Apr-2004 Martin Wilson Added sendEmail
d9 22-Jul-2004 Matt Stevenson Added sendHtmlEmail method
d10 26-Jul-2010 Kevin Bennett Added smtpEmailPort option
--------------------------------------------------------------------------------
*/
import java.io.IOException;
import java.util.*;
import javax.mail.*;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import org.apache.commons.mail.EmailAttachment;
import org.apache.commons.mail.HtmlEmail;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;
import com.bn2web.common.exception.Bn2Exception;
import com.bn2web.common.service.Bn2Manager;
import com.bn2web.common.xml.EmptyEntityResolver;
import com.bright.framework.constant.FrameworkConstants;
import com.bright.framework.constant.FrameworkSettings;
import com.bright.framework.mail.bean.BatchEmail;
import com.bright.framework.mail.bean.BatchRecipient;
import com.bright.framework.mail.bean.EmailPreview;
import com.bright.framework.util.StringUtil;
import com.bright.framework.util.TextPatternReplacer;
/**
* EmailManager. Provides functionality to send emails, either constructed just from
* input parameters, or from parameters plus a template XMl file.
*
* Note: ++todo: The templates should really be cached so that their files don't
* have to be read and parsed each time an email is sent. This will mean that the
* templates will have to be re-loaded when a template file is changed, however.
*
* @author bn2web
* @version d1
*/
public class EmailManager extends Bn2Manager implements FrameworkConstants
{
/*
* See sendTemplatedEmail(HashMap a_hmParams, String[] a_asAttachments)
* for description.
*
* Sends emails without attachments.
*
*@param HashMap a_hmParams - the parameters
*@throws Bn2Exception - on error
*/
public void sendTemplatedEmail(HashMap a_hmParams) throws Bn2Exception
/*
------------------------------------------------------------------------
d6 29-Mar-2004 Martin Wilson Added for backward compatibility.
------------------------------------------------------------------------
*/
{
sendTemplatedEmail(a_hmParams, null);
}
/**
* Constructs and sends one or more emails using templates found in a template
* XML file. The name of the template specification is supplied as one of the
* parameters contained in the HashMap a_hmParams - the parameter name is
* defined by the constant k_sTemplateParam. This is turned into a filename
* using app settings, and this file is read to get the templates fields and
* addresses for sending the email(s). A sample XML file is provided in a comment
* in this file below the class definition.
*
* In the template, parameter names can be given, enclosed in parenthesis
* substrings k_sTemplateVariableStart and k_sTemplateVariableStart. Where
* one of these parameter names is found in the template it will be replaced
* with the value of the parameter in a_hmParams. Note that in the address
* fields the field text should contain nothing but the parameter name and
* its parenthesis.
*
* Email addresses supplied in the address fields of the template, and as
* parameter values, are assumed to be correct enough to make it through JavaMail.
* If supplying address parameters directly from a publis html form the address
* validation will have to be performed before reaching this method.
*
*@param HashMap a_hmParams - the parameters
*@param String[] - an array containing full paths to the attachments
*@throws Bn2Exception - on error
*
*/
public void sendTemplatedEmail(HashMap a_hmParams, EmailAttachment[] a_attachments)
throws Bn2Exception
/*
------------------------------------------------------------------------
d3 22-Oct-2003 James Home Created
d6 29-Mar-2004 Martin Wilson Added support for attachments
d7 05-Apr-2004 Martin Wilson Added support for HTML emails
------------------------------------------------------------------------
*/
{
String sTemplateFilepath = null;
String sBody = null;
String sHtmlBody = null;
String sHtmlFilePath = null;
String sSubject = null;
Set setParams = null;
Iterator itParams = null;
String sParam = null;
String sParamValue = null;
String sTemplateName = null;
String sFromAddress = null;
Vector vTO = null;
Vector vCC = null;
Vector vBCC = null;
// Get the name of the template
sTemplateName = (String)a_hmParams.get(k_sTemplateParam);
// Get the email template directory
String sTemplateDirectory = FrameworkSettings.getEmailTemplateDirectory();
// Fully qualify the template directory if necessary
if(FrameworkSettings.getUseRelativeDirectories())
{
sTemplateDirectory = FrameworkSettings.getApplicationPath() +
"/" + FrameworkSettings.getCmsFileStoreRoot() +
FrameworkSettings.getEmailTemplateDirectory();
}
// Construct the filepath
sTemplateFilepath = sTemplateDirectory + "/" + sTemplateName + k_sEmailTemplateFileSuffix;
//-- Now read the XMl template file and build the fields we need --
SAXBuilder saxBuilder = new SAXBuilder();
// Don't worry about the dtd:
saxBuilder.setDTDHandler(null);
// Create an empty resolver as we do not need to resolve against the DTD:
EmptyEntityResolver emptyResolver = new EmptyEntityResolver();
saxBuilder.setEntityResolver(emptyResolver);
try
{
// Read from the file:
Document document = saxBuilder.build(sTemplateFilepath);
Element root = document.getRootElement();
// Get the email templates
List lstTemplates = root.getChildren("email-template");
ListIterator lstiTemplates = (ListIterator)(lstTemplates.iterator());
if (lstTemplates.size() == 0)
{
m_logger.error("Email template file " + sTemplateFilepath + " has no template elements.");
throw new Bn2Exception("Email template file " + sTemplateFilepath + " has no template elements.");
}
// Get the parameter names as a set
setParams = a_hmParams.keySet();
// Iterate through the templates, sending an email for each
for (int iTemplate = 0; iTemplate < lstTemplates.size(); iTemplate++)
{
Element xmlTemplate = (Element)(lstiTemplates.next());
// Get the subject line
Element subject = xmlTemplate.getChild("subject");
if(subject!=null)
{
sSubject = subject.getTextTrim();
}
// Get the body
Element body = xmlTemplate.getChild("body");
if(body!=null)
{
sBody = body.getTextTrim();
}
// Get the HTML file:
Element htmlFile = xmlTemplate.getChild("htmlbodyfile");
if(htmlFile != null)
{
sHtmlFilePath = htmlFile.getTextTrim();
}
// Get the address info
Element xmlAddresses = xmlTemplate.getChild("addresses");
vTO = com.bright.framework.util.XMLUtil.getTextFromChildren(xmlAddresses,"to");
vCC = com.bright.framework.util.XMLUtil.getTextFromChildren(xmlAddresses,"cc");
vBCC = com.bright.framework.util.XMLUtil.getTextFromChildren(xmlAddresses,"bcc");
sFromAddress = xmlAddresses.getChild("from").getTextTrim();
try
{
// Create an HTMLEmail object:
HtmlEmail message = new HtmlEmail();
message.setHostName(FrameworkSettings.getEmailSMTP());
String sPort = FrameworkSettings.getEmailSMTPPort();
if(StringUtil.stringIsInteger(sPort))
{
message.setPort(Integer.parseInt(sPort));
}
// Get the html body text from the html file (if applicable):
if (sHtmlFilePath != null)
{
// Get the html and attach any image files:
sHtmlBody = createHtmlText(message, sTemplateDirectory, sHtmlFilePath);
}
// Get an interator for the parameter names
itParams = setParams.iterator();
// Iterate over the parameters filling in the templated fields (subject, body
// and addresses)
while(itParams.hasNext())
{
sParam = (String)itParams.next();
sParamValue = (String)a_hmParams.get(sParam);
// Add the variable delimiters to the param name
sParam = k_sTemplateVariableStart + sParam + k_sTemplateVariableEnd;
sSubject = StringUtil.replaceString(sSubject, sParam, sParamValue);
sBody = StringUtil.replaceString(sBody, sParam, sParamValue);
sHtmlBody = StringUtil.replaceString(sHtmlBody, sParam, sParamValue);
// Replace and tokenised TO addresses with the parameter value
for(int i=0; i<vTO.size(); i++)
{
if(((String)vTO.elementAt(i)).equalsIgnoreCase(sParam))
{
if(sParamValue!=null && sParamValue.trim().length()>0)
{
vTO.setElementAt(sParamValue,i);
}
else
{
vTO.removeElementAt(i);
}
}
}
// Replace and tokenised CC addresses with the parameter value
for(int i=0; i<vCC.size(); i++)
{
if(((String)vCC.elementAt(i)).equalsIgnoreCase(sParam))
{
if(sParamValue!=null && sParamValue.trim().length()>0)
{
vCC.setElementAt(sParamValue,i);
}
else
{
vCC.removeElementAt(i);
}
}
}
// Replace and tokenised BCC addresses with the parameter value
for(int i=0; i<vBCC.size(); i++)
{
if(((String)vBCC.elementAt(i)).equalsIgnoreCase(sParam))
{
if(sParamValue!=null && sParamValue.trim().length()>0)
{
vBCC.setElementAt(sParamValue,i);
}
else
{
vBCC.removeElementAt(i);
}
}
}
// Replace and tokenised FROM address with the parameter value
if(sFromAddress.equalsIgnoreCase(sParam))
{
if(sParamValue!=null && sParamValue.trim().length()>0)
{
sFromAddress = sParamValue;
}
}
}
message.setFrom(sFromAddress);
//set the sent date to be the date now
Date dateNow = new Date();
message.setSentDate(dateNow);
//-- set the recipients --
// TO addresses
for(int i=0; i<vTO.size(); i++)
{
message.addTo((String)vTO.elementAt(i));
}
// CC addresses
for(int i=0; i<vCC.size(); i++)
{
message.addCc((String)vCC.elementAt(i));
}
// BCC addresses
for(int i=0; i<vBCC.size(); i++)
{
message.addBcc((String)vBCC.elementAt(i));
}
// Set the subject
if(sSubject!=null)
{
message.setSubject(sSubject);
}
// Set the text (if not empty):
if (sBody != null && sBody.length() > 0)
{
message.setTextMsg(sBody);
}
// Set the HTML body:
if (sHtmlBody != null && sHtmlBody.length() > 0)
{
message.setHtmlMsg(sHtmlBody);
}
// Add the attachments:
if (a_attachments != null)
{
for (int i=0; i<a_attachments.length; i++)
{
message.attach(a_attachments[i]);
}
}
// Now send the message
message.send();
}
catch (NoSuchProviderException e)
{
m_logger.error("FEEDBACK EMAIL ERROR : NO SUCH PROVIDER EXCEPTION : "+e);
throw new Bn2Exception("FEEDBACK EMAIL ERROR : NO SUCH PROVIDER EXCEPTION : "+e);
}
catch (AuthenticationFailedException e)
{
m_logger.error("FEEDBACK EMAIL ERROR : AUTHENTICATION FAILED EXCEPTION : "+e);
throw new Bn2Exception("FEEDBACK EMAIL ERROR : AUTHENTICATION FAILED EXCEPTION : "+e);
}
catch (SendFailedException e)
{
m_logger.error("FEEDBACK EMAIL ERROR : SEND FAILED EXCEPTION : "+e);
if (e.getNextException() != null)
{
throw new Bn2Exception(e.getNextException().getMessage());
}
throw new Bn2Exception(e.getMessage());
}
catch (MessagingException e)
{
m_logger.error("FEEDBACK EMAIL ERROR : MESSAGING EXCEPTION : "+e);
throw new Bn2Exception("FEEDBACK EMAIL ERROR : MESSAGING EXCEPTION : "+e);
}
}
}
catch(JDOMException jdome)
{
m_logger.error("JDOM Exception caught during EmailManager.sendTemplatedEmail : " + jdome);
throw new Bn2Exception("JDOM Exception caught during EmailManager.sendTemplatedEmail", jdome);
}
}
/**
* Used to send the same email to multiple recipients.
* All reciepients will be in the 'to' field, and the subject and from address will be the same.
* The body text can be personalised - the body text and contents of the html file can contain
* fields (in the #value# format) which will be replaced with values from the HashMap.
*
*@param BatchEmail a_batchEmail
*@throws Bn2Exception - on error
*
*/
public void sendBatchEmail(BatchEmail a_batchEmail)
throws Bn2Exception
/*
------------------------------------------------------------------------
d8 08-Apr-2004 Martin Wilson Created.
------------------------------------------------------------------------
*/
{
// Create an HTMLEmail object:
HtmlEmail message = new HtmlEmail();
message.setHostName(FrameworkSettings.getEmailSMTP());
String sPort = FrameworkSettings.getEmailSMTPPort();
if(StringUtil.stringIsInteger(sPort))
{
message.setPort(Integer.parseInt(sPort));
}
// Get the html body text from the html file (if applicable):
String sHtmlBody = null;
if (a_batchEmail.getHtmlFilename() != null)
{
// Get the html and attach any image files:
try
{
sHtmlBody = createHtmlText( message,
a_batchEmail.getDirectoryContainingHtmlFile(),
a_batchEmail.getHtmlFilename());
}
catch (MessagingException me)
{
throw new Bn2Exception("Error building batch email from HTML file:", me);
}
}
// Go through each of the recipients:
Vector vecRecipients = a_batchEmail.getRecipients();
for (int iRecipCount = 0; iRecipCount < vecRecipients.size(); iRecipCount++)
{
String sPersonalisedBody = a_batchEmail.getBody();
String sPersonalisedHtmlBody = sHtmlBody;
// Get the recipient:
BatchRecipient recipient = (BatchRecipient)vecRecipients.get(iRecipCount);
// Personalise the bodytext and html if applicable:
if (recipient.getPersonalisation() != null)
{
// Get this recipient's parameter names as a set:
Set setParams = recipient.getPersonalisation().keySet();
// Get an interator for the parameter names
Iterator itParams = setParams.iterator();
// Iterate over the parameters filling in the templated fields:
while(itParams.hasNext())
{
String sParam = (String)itParams.next();
String sParamValue = (String)recipient.getPersonalisation().get(sParam);
// Add the variable delimiters to the param name
sParam = k_sTemplateVariableStart + sParam + k_sTemplateVariableEnd;
// Replace the tags:
sPersonalisedBody = StringUtil.replaceString(sPersonalisedBody, sParam, sParamValue);
sPersonalisedHtmlBody = StringUtil.replaceString(sPersonalisedHtmlBody, sParam, sParamValue);
}
}
try
{
message.setFrom(a_batchEmail.getFromAddress());
//set the sent date to be the date now
Date dateNow = new Date();
message.setSentDate(dateNow);
// Set this recipient:
message.addTo(recipient.getEmailAddress());
// Set the subject
if(a_batchEmail.getSubject()!=null)
{
message.setSubject(a_batchEmail.getSubject());
}
// Set the text:
message.setTextMsg(sPersonalisedBody);
// Set the HTML body:
message.setHtmlMsg(sPersonalisedHtmlBody);
// Now send the message:
message.send();
}
catch (MessagingException e)
{
m_logger.error("Error sending email to batch recipient: " + recipient.getEmailAddress(), e);
}
} // End recipient loop.
}
/**
* Used to send html email
*
*@param String a_sHtmlFileName
*@throws Bn2Exception - on error
*
*/
public void sendHtmlEmail(String a_sHtmlFileDirectory, String a_sHtmlFileName, String a_sNoHtmlSupportMessage,
String a_sFromAddress, String a_sToAddress, String a_sSubject)
throws Bn2Exception
/*
------------------------------------------------------------------------
d9 22-Jul-2004 Matt Stevenson Created
------------------------------------------------------------------------
*/
{
// Create an HTMLEmail object:
HtmlEmail message = new HtmlEmail();
message.setHostName(FrameworkSettings.getEmailSMTP());
String sPort = FrameworkSettings.getEmailSMTPPort();
if(StringUtil.stringIsInteger(sPort))
{
message.setPort(Integer.parseInt(sPort));
}
// Get the html body text from the html file (if applicable):
String sHtmlBody = null;
// Get the html and attach any image files:
try
{
sHtmlBody = createHtmlText( message, a_sHtmlFileDirectory, a_sHtmlFileName);
}
catch (MessagingException me)
{
throw new Bn2Exception("Error building email from HTML file:", me);
}
//try to send the message
try
{
message.setFrom(a_sFromAddress);
//set the sent date to be the date now
Date dateNow = new Date();
message.setSentDate(dateNow);
// Set this recipient:
message.addTo(a_sToAddress);
message.setSubject(a_sSubject);
// Set the text:
message.setTextMsg(a_sNoHtmlSupportMessage);
// Set the HTML body:
message.setHtmlMsg(sHtmlBody);
// Now send the message:
message.send();
}
catch (MessagingException e)
{
m_logger.error("Error sending html email: " + e);
}
}
/**
* Creates HTML text for an email from an HTML file.
*
*@param HtmlEmail - the email in which to set the text
*@param String - the full path to the html file
*@throws Bn2Exception - on error
*
*/
private String createHtmlText(HtmlEmail a_message, String a_sTemplateDirectory, String a_sHtmlFilename)
throws Bn2Exception, MessagingException
/*
------------------------------------------------------------------------
d7 05-Apr-2004 Martin Wilson Created.
------------------------------------------------------------------------
*/
{
m_logger.debug("Adding HTML body text from file: " + a_sHtmlFilename);
// Create a TextPatternReplacer object to replace the image paths:
TextPatternReplacer replacer = new TextPatternReplacer();
// Load from the HTML file:
String sFullHtmlFilePath = a_sTemplateDirectory + "/" + a_sHtmlFilename;
try
{
replacer.loadFromFile(sFullHtmlFilePath);
}
catch(IOException ioe)
{
m_logger.error("HTML file not found while creating a HTML based email: " + sFullHtmlFilePath);
}
// Set the regular expression to use:
replacer.setPattern(FrameworkSettings.getMatchImageFileRegularExpression());
// Loop through all different file names:
while (replacer.matchNext())
{
// Get the current image path:
String sImagePath = replacer.getCurrentMatch();
m_logger.debug("Image path found in html doc = " + sImagePath);
String sFullImagePath = a_sTemplateDirectory + "/" + sImagePath;
// Embed the file:
String sCid = a_message.embed(sFullImagePath, sImagePath);
// Replace the filename with the cid in the html:
replacer.addReplacementForCurrentMatch("cid:" + sCid);
}
// Replace all the filenames:
replacer.makeReplacements();
return (replacer.getContents());
}
/**
* Returns a Vector of EmailPreview objects each containing the subject and body of a templated email
* constructed from the templates xml file and the passed parameters.
*/
public Vector getTemplatedEmailPreviews(HashMap a_hmParams)
throws Bn2Exception
/*
------------------------------------------------------------------------
d3 03-Mar-2003 James Home Created
------------------------------------------------------------------------
*/
{
String sTemplateFilepath = null;
String sBody = null;
String sSubject = null;
Set setParams = null;
Iterator itParams = null;
String sParam = null;
String sParamValue = null;
String sTemplateName = null;
EmailPreview email = null;
Vector vEmails = new Vector();
// Get the name of the template
sTemplateName = (String)a_hmParams.get(k_sTemplateParam);
// Get the email template directory
sTemplateFilepath = FrameworkSettings.getEmailTemplateDirectory();
// Fully qualify the template directory if necessary
if(FrameworkSettings.getUseRelativeDirectories())
{
sTemplateFilepath = FrameworkSettings.getApplicationPath() +
"/" + FrameworkSettings.getCmsFileStoreRoot() +
FrameworkSettings.getEmailTemplateDirectory();
}
// Construct the filepath
sTemplateFilepath += "/" + sTemplateName + k_sEmailTemplateFileSuffix;
//-- Now read the XMl template file and build the fields we need --
SAXBuilder saxBuilder = new SAXBuilder();
// Don't worry about the dtd:
saxBuilder.setDTDHandler(null);
// Create an empty resolver as we do not need to resolve against the DTD:
EmptyEntityResolver emptyResolver = new EmptyEntityResolver();
saxBuilder.setEntityResolver(emptyResolver);
try
{
// Read from the file:
Document document = saxBuilder.build(sTemplateFilepath);
Element root = document.getRootElement();
// Get the email templates
List lstTemplates = root.getChildren("email-template");
ListIterator lstiTemplates = (ListIterator)(lstTemplates.iterator());
if (lstTemplates.size() == 0)
{
m_logger.error("Email template file " + sTemplateFilepath + " has no template elements.");
throw new Bn2Exception("Email template file " + sTemplateFilepath + " has no template elements.");
}
// Get the parameter names as a set
setParams = a_hmParams.keySet();
// Iterate through the templates, sending an email for each
for (int iTemplate = 0; iTemplate < lstTemplates.size(); iTemplate++)
{
Element xmlTemplate = (Element)(lstiTemplates.next());
// Get the subject line
Element subject = xmlTemplate.getChild("subject");
if(subject!=null)
{
sSubject = subject.getTextTrim();
}
// Get the body
Element body = xmlTemplate.getChild("body");
if(body!=null)
{
sBody = body.getTextTrim();
}
// Get an interator for the parameter names
itParams = setParams.iterator();
// Iterate over the parameters filling in the templated fields (subject, body
// and addresses)
while(itParams.hasNext())
{
sParam = (String)itParams.next();
sParamValue = (String)a_hmParams.get(sParam);
// Add the variable delimiters to the param name
sParam = k_sTemplateVariableStart + sParam + k_sTemplateVariableEnd;
sSubject = StringUtil.replaceString(sSubject, sParam, sParamValue);
sBody = StringUtil.replaceString(sBody, sParam, sParamValue);
}
email = new EmailPreview();
email.setBody(sBody);
email.setSubject(sSubject);
vEmails.add(email);
}
}
catch(JDOMException jdome)
{
m_logger.error("JDOM Exception caught during EmailManager.sendTemplatedEmail : " + jdome);
throw new Bn2Exception("JDOM Exception caught during EmailManager.sendTemplatedEmail", jdome);
}
return vEmails;
}
/**
* Send a feedback email without a custom subject line. The email contains name/value
* pairs as provided in the HashMap parameter.
*
* @param HashMap params - the name/value pairs that will make up the body of the email
*/
public void sendFeedbackEmail(HashMap params) throws Bn2Exception
/*
------------------------------------------------------------------------
d3 22-Oct-2003 James Home Created
------------------------------------------------------------------------
*/
{
sendFeedbackEmail(params,null);
}
/**
* Construct and send a feedback email with the subject line provided. The email contains
* name/value pairs as provided in the HashMap parameter.
*
* @param HashMap params - the name/value pairs that will make up the body of the email
* @param String a_sSubject - the subject line of the email
*/
public void sendFeedbackEmail(HashMap params, String a_sSubject) throws Bn2Exception
/*
------------------------------------------------------------------------
d1 29-Apr-2003 Matt Stevenson Created.
d2 30-Apr-2003 Matt Stevenson Added missing exception check
and check to see if a to email
has been provided
d3 22-Oct-2003 James Home Added subject param
------------------------------------------------------------------------
*/
{
try
{
String sEmailAddress = FrameworkSettings.getEmailAddress();
//construct a body from all the input params in the hash
String sBodyText = "";
Set keys = params.keySet();
Iterator keyIterate = keys.iterator();
while (keyIterate.hasNext())
{
String sParamName = (String)keyIterate.next();
//don't output format or destination params
if ((!sParamName.equals("x")) && (!sParamName.equals("y")) && (!sParamName.equals(k_sTOEMAILParam)) && (!sParamName.equals(k_sFEEDBACKSUCCESSParam)) && (!sParamName.equals(k_sFEEDBACKFAILUREParam)))
{
String sParam = (String)params.get(sParamName);
sBodyText = sBodyText + sParamName + " : " + sParam + "\n";
}
//if a too email address is supplied use this to send to
if (sParamName.equals(k_sTOEMAILParam))
{
sEmailAddress = (String)params.get(sParamName);
}
}
//construct the connection Properties
Properties props = new Properties();
props.put("mail.host",FrameworkSettings.getEmailSMTP());
//use the properties to get a mail session
Session mailSession = Session.getDefaultInstance(props, null);
//construct the message to send
Message newMessage = new MimeMessage(mailSession);
//set the from value of the message
InternetAddress fromAddress = new InternetAddress(sEmailAddress);
newMessage.setFrom(fromAddress);
//set the list of params to be the string just constructed
newMessage.setText(sBodyText);
//set the sent date to be the date now
Date dateNow = new Date();
newMessage.setSentDate(dateNow);
//now set the recipient
InternetAddress emailAddress = new InternetAddress(sEmailAddress);
newMessage.setRecipient(Message.RecipientType.TO,emailAddress);
if(a_sSubject!=null)
{
newMessage.setSubject(a_sSubject);
}
//now send the message
Transport.send(newMessage);
}
catch (NoSuchProviderException e)
{
m_logger.error("FEEDBACK EMAIL ERROR : NO SUCH PROVIDER EXCEPTION : "+e);
throw new Bn2Exception("FEEDBACK EMAIL ERROR : NO SUCH PROVIDER EXCEPTION : "+e);
}
catch (AuthenticationFailedException e)
{
m_logger.error("FEEDBACK EMAIL ERROR : AUTHENTICATION FAILED EXCEPTION : "+e);
throw new Bn2Exception("FEEDBACK EMAIL ERROR : AUTHENTICATION FAILED EXCEPTION : "+e);
}
catch (SendFailedException e)
{
m_logger.error("FEEDBACK EMAIL ERROR : SEND FAILED EXCEPTION : "+e);
if (e.getNextException() != null)
{
throw new Bn2Exception(e.getNextException().getMessage());
}
throw new Bn2Exception(e.getMessage());
}
catch (MessagingException e)
{
m_logger.error("FEEDBACK EMAIL ERROR : MESSAGING EXCEPTION : "+e);
throw new Bn2Exception("FEEDBACK EMAIL ERROR : MESSAGING EXCEPTION : "+e);
}
}
}
/*
<email-templates>
<email-template>
<addresses>
<from>aaa@aaa.com</from>
<to>aaa@aaa.com</to>
<to>#this#</to>
<cc>aaa@aaa.com</cc>
<cc>#this#</cc>
<bcc>aaa@aaa.com</bcc>
<bcc>aaa@aaa.com</bcc>
</addresses>
<subject>
[subject, with #this# being a parameter name to replace with its value]
</subject>
<body>
[body, with #this# being a parameter name to replace with its value]
</body>
</email-template>
<email-template>
<addresses>
<from>aaa@aaa.com</from>
<to>aaa@aaa.com</to>
<to>#this#</to>
<cc>aaa@aaa.com</cc>
<cc>#this#</cc>
<bcc>aaa@aaa.com</bcc>
<bcc>aaa@aaa.com</bcc>
</addresses>
<subject>
[subject, with #this# being a parameter name to replace with its value]
</subject>
<body>
[body, with #this# being a parameter name to replace with its value]
</body>
</email-template>
</email-templates>
*/
| [
"matt@bright-interactive.com"
] | matt@bright-interactive.com |
46ae92a310d53deda418686a7e3ced37d9dcf369 | 9a97089ff54e84691d5fe72765f68fd49f531452 | /src/com/wuyg/auth/obj/AuthFunctionObj.java | ed95868b1bf9c547a8a43d3795409934ca145a51 | [] | no_license | missingu924/renshi | 88f08c3ac35b3320a5be7595de9bab525af5964c | e77cb44cfb230101fb44f892b1a023821dd9c999 | refs/heads/master | 2021-08-14T19:58:01.539003 | 2017-11-16T16:07:27 | 2017-11-16T16:07:27 | 110,991,683 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,962 | java | package com.wuyg.auth.obj;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import com.alibaba.fastjson.JSON;
import com.wuyg.common.dao.BaseDbObj;
public class AuthFunctionObj extends BaseDbObj
{
private Long id;
private String functioncode;
private String functionname;
private String functiondiscription;
@Override
public String findKeyColumnName()
{
return "id";
}
@Override
public String findParentKeyColumnName()
{
// TODO Auto-generated method stub
return null;
}
@Override
public String findTableName()
{
return "auth_function";
}
@Override
public String findDefaultOrderBy()
{
return super.findDefaultOrderBy();
}
@Override
public String getBasePath()
{
return "AuthFunction";
}
@Override
public String getCnName()
{
return "权限项";
}
@Override
public List<String> findUniqueIndexProperties()
{
return Arrays.asList(new String[]
{ "functioncode" });
}
public LinkedHashMap<String, String> findProperties()
{
LinkedHashMap<String, String> pros = new LinkedHashMap<String, String>();
pros.put("id", "流水号");
pros.put("functioncode", "权限项编码");
pros.put("functionname", "权限项名称");
pros.put("functiondiscription", "备注");
return pros;
}
public Long getId()
{
return id;
}
public void setId(Long id)
{
this.id = id;
}
public String getFunctioncode()
{
return functioncode;
}
public void setFunctioncode(String functioncode)
{
this.functioncode = functioncode;
}
public String getFunctionname()
{
return functionname;
}
public void setFunctionname(String functionname)
{
this.functionname = functionname;
}
public String getFunctiondiscription()
{
return functiondiscription;
}
public void setFunctiondiscription(String functiondiscription)
{
this.functiondiscription = functiondiscription;
}
@Override
public String toString()
{
return JSON.toJSONString(this);
}
}
| [
"missingu924@163.com"
] | missingu924@163.com |
25ba280e6498802645d04435f84b044df1b695b7 | 51d3ba1d1ecfb84ce9fcedad7b73714f227454ad | /main/snap-compile/src/main/java/org/snapscript/compile/validate/TypeValidator.java | 66a7e887795b526ad68a041dbc283de354ff3ba1 | [] | no_license | ngallagher/snapscript | 35c7342cfea851d2f7c6a9b48ea4f0992b40fa05 | 24db79d4c28108d0c985dbccac4eb93faeb1000b | refs/heads/master | 2023-08-24T19:28:49.455702 | 2016-08-07T20:44:35 | 2016-08-07T20:44:35 | 42,607,765 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,448 | java | package org.snapscript.compile.validate;
import static org.snapscript.core.Reserved.ANY_TYPE;
import static org.snapscript.core.Reserved.TYPE_CLASS;
import static org.snapscript.core.Reserved.TYPE_CONSTRUCTOR;
import static org.snapscript.core.Reserved.TYPE_SUPER;
import static org.snapscript.core.Reserved.TYPE_THIS;
import java.util.List;
import java.util.Set;
import org.snapscript.core.InternalStateException;
import org.snapscript.core.Module;
import org.snapscript.core.Type;
import org.snapscript.core.TypeTraverser;
import org.snapscript.core.convert.ConstraintMatcher;
import org.snapscript.core.function.Function;
import org.snapscript.core.property.Property;
public class TypeValidator {
private static final String[] PROPERTIES = { TYPE_THIS, TYPE_SUPER, TYPE_CLASS };
private static final String[] TYPES = { ANY_TYPE };
private final FunctionValidator validator;
private final TypeTraverser traverser;
public TypeValidator(ConstraintMatcher matcher) {
this.traverser = new TypeTraverser();
this.validator = new FunctionValidator(matcher, traverser);
}
public void validate(Type type) throws Exception {
Class real = type.getType();
if(real == null) {
validateModule(type);
validateHierarchy(type);
validateFunctions(type);
validateProperties(type);
}
}
private void validateModule(Type type) throws Exception {
Module module = type.getModule();
if(module == null) {
throw new InternalStateException("Type '" + type + "' has no module");
}
}
private void validateHierarchy(Type type) throws Exception {
Set<Type> types = traverser.traverse(type);
for(int i = 0; i < TYPES.length; i++) {
String require = TYPES[i];
int matches = 0;
for(Type base : types) {
String name = base.getName();
if(name.equals(require)) {
matches++;
}
}
if(matches == 0) {
Module module = type.getModule();
String resource = module.getName();
String name = type.getName();
throw new InternalStateException("Type '" + resource + "." + name + "' not defined");
}
}
}
private void validateProperties(Type type) throws Exception {
List<Property> properties = type.getProperties();
for(int i = 0; i < PROPERTIES.length; i++) {
String require = PROPERTIES[i];
int matches = 0;
for(Property property : properties) {
String name = property.getName();
if(name.equals(require)) {
matches++;
}
}
if(matches == 0) {
Module module = type.getModule();
String resource = module.getName();
String name = type.getName();
throw new InternalStateException("Type '" + resource + "." + name + "' have property '" + require + "'");
}
}
}
private void validateFunctions(Type type) throws Exception {
List<Function> functions = type.getFunctions();
for(Function function : functions) {
String name = function.getName();
if(!name.equals(TYPE_CONSTRUCTOR)) {
validator.validate(function);
}
}
}
}
| [
"gallagher_niall@yahoo.com"
] | gallagher_niall@yahoo.com |
44e2ae86f73c94ebdfefb66b726100267fcac842 | 27e424f0626e6d9bbdcd2b7aef04e7f17e275b5e | /DMS-lab8/app/src/androidTest/java/com/example/dms_lab8/ExampleInstrumentedTest.java | d37889ee4944e6a87ff7aa6165a6e6cae5ce8c40 | [] | no_license | HicirTech/AUT-DMS | 1f79b492657576f0dd9e4825fc579b13b3c54739 | a439e5162220465c7dc04677507b825d734dbfc0 | refs/heads/master | 2022-07-13T10:49:17.343243 | 2019-06-08T03:22:35 | 2019-06-08T03:22:35 | 172,983,401 | 1 | 0 | null | 2022-06-29T19:32:22 | 2019-02-27T20:14:15 | Java | UTF-8 | Java | false | false | 724 | java | package com.example.dms_lab8;
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.*;
/**
* Instrumented 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() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.dms_lab8", appContext.getPackageName());
}
}
| [
"luozeting97@gmail.com"
] | luozeting97@gmail.com |
fc07b447d9d38d040cedc6ec9558ff87eb4995a1 | 7c5551baa746eb3f5eb19ca029c8ee9a43ec0bef | /src/main/java/org/buojira/stressator/rabbit/PropCustomizer.java | 5ccefe3c96c93c81c51e8ee0e28da1c74ca07e3a | [
"MIT"
] | permissive | buojira/stressator | a27c8e676dc85cf1a15f0050dde8d310c8f47241 | 017bcc8d9a5c871fe6dea263a06fc3d017161f72 | refs/heads/master | 2022-03-10T02:36:06.228711 | 2019-12-11T17:38:34 | 2019-12-11T17:38:34 | 222,688,281 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,028 | java | package org.buojira.stressator.rabbit;
public class PropCustomizer {
public BrokerProperties customizeProps(BrokerProperties source, String prefix) {
BrokerProperties res = new BrokerProperties();
res.setBrokerHost(source.getBrokerHost());
res.setBrokerPort(source.getBrokerPort());
res.setVirtualHost(source.getVirtualHost());
res.setBrokerUserName(source.getBrokerUserName());
res.setBrokerPassword(source.getBrokerPassword());
res.setAppCode(source.getAppCode());
res.setTags(prefix + "_tag");
res.setExchangeName(getExchange(prefix));
res.setQueueName(getQueue(prefix));
res.setBrokerStatusQueue(getCallbackQueue(prefix));
return res;
}
public String getExchange(String prefix) {
return prefix + "_exchange";
}
public String getQueue(String prefix) {
return prefix + "_queue";
}
public String getCallbackQueue(String prefix) {
return prefix + "_callback_queue";
}
}
| [
"rafael.buzzi@fluig.com"
] | rafael.buzzi@fluig.com |
8fbac1b2a5273bcac51ec82daa0c325a5a3d5b5c | e00e1de197995c8a4f014a9e8563967a94f87fd9 | /src/squares/Squares_main.java | 6fac179fa7ff9a815e23502d01e95d609ed0faa5 | [] | no_license | f0213015/Squares | 937e68427ce642a7e127940d2777d78d6e816f97 | 1090cb60065a53f540a0282d32b3d6c7f75850b1 | refs/heads/master | 2021-08-19T00:05:13.746586 | 2017-11-24T08:33:14 | 2017-11-24T08:33:14 | 111,894,618 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 669 | java | package squares;
public class Squares_main {
public static void main(String[] args) {
// TODO Auto-generated method stub
//double x[] = {0.0, 0.2, 0.4, 0.6, 0.8, 1.0, 1.2};
//double y[] = {1.0, 1.9, 3.2, 4.3, 4.8, 6.1, 7.2};
double x[] = {0.0, 0.3, 0.45, 0.6, 0.73, 1.1, 1.5};
double y[] = {0.0, 1.0, 2.1, 1.8, 2.9, 3.1, 5,3};
double theta[] = new double[2];
Squares_lib slib = new Squares_lib(x, y);
for(int i =0; i < 100; i++) {
theta = slib.getDx();
System.out.println(i + "theta[0] = " + theta[0]);
System.out.println(i + "theta[1] = " + theta[1]);
System.out.println(i + "Objective function = " + slib.getObject());
}
}
}
| [
"itoutakahiro@192.168.11.2"
] | itoutakahiro@192.168.11.2 |
0820820e927bb27e29d6348f7fa5ab01252d17da | e3b1c5262055a11d4889547523cfeb28eac8b4ee | /app/controllers/ActorRating.java | 33858f4e4adc73f829ea72062a80156eb7e6d641 | [] | no_license | sanjeevkr12/Diffen_Application | e884141dcf5ab4a6b3dd31300d90b5f9f6fa1e80 | e6dfd12963075a70101ae48454f98c485ec0b8b9 | refs/heads/master | 2021-04-12T11:40:50.640334 | 2016-06-26T16:56:37 | 2016-06-26T16:56:37 | 61,998,471 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,540 | java | package controllers;
import models.Addactor;
import models.Addcompareactor;
import play.data.DynamicForm;
import play.data.Form;
import play.db.ebean.Model;
import play.mvc.Controller;
import play.mvc.Result;
import views.html.actorRating;
import views.html.displayactor;
/**
* Created by user on 25-06-2016.
*/
public class ActorRating extends Controller {
public static Result displayrating(){
final DynamicForm dynamicForm= Form.form().bindFromRequest();
String s1=dynamicForm.get("user1");
String s2=dynamicForm.get("user2");
Addactor user1=Addactor.find.where().like("firstname", "%" + s1+ "%").findUnique();
Addactor user2=Addactor.find.where().like("firstname", "%" + s2+ "%").findUnique();
Integer aid1=user1.getId();
Integer aid2=user2.getId();
System.out.println(aid1+"========"+aid2);
// Addcompareactor addcompareactor=new Addcompareactor();
//addcompareactor.actor1id=aid1;
// addcompareactor.actor2id=aid2;
// System.out.println(addcompareactor.getActor1id()+"============="+addcompareactor.getActor2id());
//finding compare table id
Addcompareactor cmp1=Addcompareactor.find.where().eq("id",aid1).findUnique();
//Addcompareactor cmp2=Addcompareactor.find.byId(addcompareactor.actor2id);
//System.out.println(cmp1+"=========="+cmp2);
Addcompareactor cmp2=Addcompareactor.find.where().eq("id",aid2).findUnique();
return ok(actorRating.render(user1,user2,cmp1,cmp2));
}
}
| [
"sanjeev.gimit@gmail.com"
] | sanjeev.gimit@gmail.com |
2195d702ef95c70fd0009bb485243e36c1acff54 | 30b1babf171384281079c6bfe1087952d9d6c25c | /app/src/main/java/com/example/hp/assessment/dbhelper/dao/MovieDao.java | 543a1c3ec70cde9974e601b767446143bb724770 | [] | no_license | codecameo/MovieList | 391f6084da98ed9e083561b330ebc8169fecb035 | 06be45cf0693f041c235e429a4e8b6f30c919c2a | refs/heads/master | 2021-05-08T18:18:12.531280 | 2018-01-13T10:25:09 | 2018-01-13T10:25:09 | 119,510,513 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,311 | java | package com.example.hp.assessment.dbhelper.dao;
import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Insert;
import android.arch.persistence.room.OnConflictStrategy;
import android.arch.persistence.room.Query;
import android.arch.persistence.room.Update;
import com.example.hp.assessment.dbhelper.DbConstants;
import com.example.hp.assessment.dbhelper.entities.MovieEntity;
import java.util.List;
import io.reactivex.Single;
/**
* Created by Md. Sifat-Ul Haque on 12/01/2018.
*/
@Dao
public interface MovieDao {
@Insert(onConflict = OnConflictStrategy.REPLACE)
void insert(MovieEntity... movieEntities);
@Insert(onConflict = OnConflictStrategy.REPLACE)
void insertMovieEntities(List<MovieEntity> movieEntities);
@Insert(onConflict = OnConflictStrategy.IGNORE)
long createMovieIfNotExists(MovieEntity subject);
@Query("SELECT * FROM "+ DbConstants.MOVIE_TABLE_NAME)
Single<List<MovieEntity>> getAllMovies();
/*@Query("SELECT * FROM "+ DbConstants.MOVIE_TABLE_NAME+" WHERE user_id = :id LIMIT 1")
LiveData<MovieEntity> getSubject(int id);
@Query("SELECT * FROM "+ DbConstants.MOVIE_TABLE_NAME+" WHERE user_id = :id LIMIT 1")
MovieEntity getSubjectEntity(int id);*/
@Update
void updateMovie(MovieEntity... users);
}
| [
"sifat.oshan@gmail.com"
] | sifat.oshan@gmail.com |
b7184ca97a481c474ff3e472ba693179baccb928 | 5f76e74de8dc0a25af21f0f278776dcba52092e3 | /src/com/uniplore/graph/util/mybatisutils/MybatisUtils.java | 8c552628a538ba28e6d93c22653a8aa907db845f | [
"MIT"
] | permissive | kingsaction/GraphAnalysis | a54ac502aa6dbdf4f12b85f5bd970bfba26ff113 | 59ffe2d41618190bf336e100619a03a661a2c638 | refs/heads/master | 2020-03-21T05:44:37.350934 | 2018-04-23T02:18:10 | 2018-04-23T02:18:10 | 138,177,223 | 13 | 3 | null | 2018-06-21T13:55:59 | 2018-06-21T13:55:58 | null | UTF-8 | Java | false | false | 8,492 | java | package com.uniplore.graph.util.mybatisutils;
import com.alibaba.druid.pool.DruidDataSource;
import com.uniplore.graph.dsm.db.entity.DbPO;
import java.sql.Connection;
import java.util.Properties;
import javax.sql.DataSource;
import org.apache.ibatis.datasource.DataSourceFactory;
import org.apache.ibatis.mapping.Environment;
import org.apache.ibatis.session.Configuration;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.apache.ibatis.transaction.TransactionFactory;
import org.apache.ibatis.transaction.jdbc.JdbcTransactionFactory;
public class MybatisUtils implements DataSourceFactory {
private Properties properties;
@Override
public DataSource getDataSource() {
//MyBatis自带的数据库连接
//PooledDataSource dataSource = new PooledDataSource();
//dataSource.setDriver(properties.getProperty("driverName"));
//dataSource.setUrl(properties.getProperty("url"));
//dataSource.setUsername(properties.getProperty("userName"));
//dataSource.setPassword(properties.getProperty("password"));
//return dataSource;
//本例采用阿里巴巴druid连接池,当然你也可以采用c3p0、DBCP等连接池,但是Druid的性能最好
DruidDataSource dataSource = new DruidDataSource();
dataSource.setDriverClassName(properties.getProperty("driverName"));
dataSource.setUrl(properties.getProperty("url"));
dataSource.setUsername(properties.getProperty("userName"));
return dataSource;
}
@Override
public void setProperties(Properties properties) {
this.properties = properties;
}
/**
* 功能: 使用mybatis创建Connection对象,使用了mybatis的特性.
* @param dbPo 数据库连接参数
* @return 返回值
*/
public static Connection getConnection(DbPO dbPo) {
String driverName = dbPo.getDriverName();
String url = null;
String dataBaseName = dbPo.getDataBaseName();
if (driverName != null && driverName.contains("mysql")) {
if (dataBaseName == null) {
url = "jdbc:mysql://" + dbPo.getIpAddress() + ":" + dbPo.getPortNumber();
} else {
url = "jdbc:mysql://" + dbPo.getIpAddress() + ":" + dbPo.getPortNumber() + "/"
+ dataBaseName;
}
} else if (driverName != null && driverName.contains("postgresql")) {
if (dataBaseName == null) {
url = "jdbc:postgresql://" + dbPo.getIpAddress() + ":" + dbPo.getPortNumber() + "/?";
} else {
url = "jdbc:postgresql://" + dbPo.getIpAddress() + ":" + dbPo.getPortNumber() + "/"
+ dataBaseName ;
}
} else if (driverName != null && driverName.contains("pivotal")) {
url = "jdbc:pivotal:greenplum://" + dbPo.getIpAddress() + ":" + dbPo.getPortNumber()
+ ";DatabaseName=" + dataBaseName ;
} else if (driverName != null && driverName.contains("oracle")) {
url = "jdbc:oracle:thin:@" + dbPo.getIpAddress() + ":" + dbPo.getPortNumber() + ":"
+ dataBaseName ;
}
String userName = dbPo.getUserName();
String password = dbPo.getPassword();
Properties properties = new Properties();
properties.setProperty("driverName", driverName);
properties.setProperty("url", url);
properties.setProperty("userName", userName);
properties.setProperty("password", password);
MybatisUtils mybatisUtils = new MybatisUtils();
mybatisUtils.setProperties(properties);
DataSource dataSource = mybatisUtils.getDataSource();
TransactionFactory transactionFactory = new JdbcTransactionFactory();
Environment environment = new Environment("development", transactionFactory, dataSource);
Configuration config = new Configuration(environment);
SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(config);
SqlSession sesssion = sqlSessionFactory.openSession();
Connection connection = null;
try {
connection = sesssion.getConnection();
} catch (Exception ex) {
throw new RuntimeException(ex.getMessage());
}
return connection;
}
/**
* 功能:获取mybatis连接session.
* @param dbPo 数据库连接参数
* @return 返回值
*/
public static SqlSession getSqlSession(DbPO dbPo) {
String driverName = dbPo.getDriverName();
String url = null;
String dataBaseName = dbPo.getDataBaseName();
if (driverName != null && driverName.contains("mysql")) {
if (dataBaseName == null) {
url = "jdbc:mysql://" + dbPo.getIpAddress() + ":" + dbPo.getPortNumber();
} else {
url = "jdbc:mysql://" + dbPo.getIpAddress() + ":" + dbPo.getPortNumber() + "/"
+ dataBaseName;
}
} else if (driverName != null && driverName.contains("postgresql")) {
if (dataBaseName == null) {
url = "jdbc:postgresql://" + dbPo.getIpAddress() + ":" + dbPo.getPortNumber() + "/?";
} else {
url = "jdbc:postgresql://" + dbPo.getIpAddress() + ":" + dbPo.getPortNumber() + "/"
+ dataBaseName ;
}
} else if (driverName != null && driverName.contains("pivotal")) {
url = "jdbc:pivotal:greenplum://" + dbPo.getIpAddress() + ":" + dbPo.getPortNumber()
+ ";DatabaseName=" + dataBaseName ;
} else if (driverName != null && driverName.contains("oracle")) {
url = "jdbc:oracle:thin:@" + dbPo.getIpAddress() + ":" + dbPo.getPortNumber() + ":"
+ dataBaseName ;
}
String userName = dbPo.getUserName();
String password = dbPo.getPassword();
Properties properties = new Properties();
properties.setProperty("driverName", driverName);
properties.setProperty("url", url);
properties.setProperty("userName", userName);
properties.setProperty("password", password);
MybatisUtils mybatisUtils = new MybatisUtils();
mybatisUtils.setProperties(properties);
DataSource dataSource = mybatisUtils.getDataSource();
TransactionFactory transactionFactory = new JdbcTransactionFactory();
Environment environment = new Environment("development", transactionFactory, dataSource);
Configuration config = new Configuration(environment);
SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(config);
SqlSession sesssion = sqlSessionFactory.openSession();
return sesssion;
}
/**
* 功能: 测试上述代码是否能够正常工作.
* @param args 主函数参数
*/
public static void main(String[] args) {
Properties prop = new Properties();
prop.setProperty("driverName", "com.mysql.jdbc.Driver");
prop.setProperty("url", "jdbc:mysql://192.168.100.172:3306");
prop.setProperty("userName", "root");
prop.setProperty("password", "mysql");
/*
MybatisUtils mybatisUtils = new MybatisUtils();
mybatisUtils.setProperties(prop);
DataSource dataSource = mybatisUtils.getDataSource();*/
/*try {
connection = dataSource.getConnection();
System.out.println(connection);
} catch (SQLException ex) {
String message = ex.getMessage();
System.out.println(message);
}*/
//System.out.println(dataSource == null ? "dataSource为空" : "dataSource不为空") ;
/*TransactionFactory transactionFactory = new JdbcTransactionFactory();
Environment environment = new Environment("development", transactionFactory, dataSource);
Configuration configuration = new Configuration(environment);
SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(configuration);
SqlSession session = sqlSessionFactory.openSession();
System.out.println("session:" + session);
try {
Connection connection = session.getConnection();
System.out.println(connection);
} catch (Exception ex) {
String message = ex.getMessage();
System.out.println(message);
}*/
// 参考资料 http://stackoverflow.com/questions/22517318/cant-find-some-mybatis-classes-to-import-in-getting-started-guide
// mybatis中获取session http://www.programcreek.com/java-api-examples/index.php?class=org.apache.ibatis.session.SqlSession&method=getConnection
// Druidp配置,不适用Spring,使用Java代码实现 http://www.itdadao.com/articles/c15a617684p0.html
}
}
| [
"jpzhu@uniplore.io"
] | jpzhu@uniplore.io |
ec7c583c396fc764d9a8344323e415918972b6e3 | eb4d2316e514fd48d58c18095dff00c8675e1830 | /src/net/sf/cherry/scripting/reactor/ReactorActionManager.java | 3d4dece33e30ca4c34998e43a9d0bb262e4f8d8c | [] | no_license | qiandingqin/MaplestoryCms079 | ed730b321a6c41572696829ee15fc6017d5fc0c7 | 2faee9ffbb9663a905aa9bdbc023c41a40877367 | refs/heads/master | 2022-01-23T11:47:58.146007 | 2019-05-25T16:51:27 | 2019-05-25T16:51:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,753 | java | package net.sf.cherry.scripting.reactor;
import net.sf.cherry.client.*;
import net.sf.cherry.net.channel.ChannelServer;
import net.sf.cherry.scripting.AbstractPlayerInteraction;
import net.sf.cherry.server.MapleItemInformationProvider;
import net.sf.cherry.server.MaplePortal;
import net.sf.cherry.server.life.MapleLifeFactory;
import net.sf.cherry.server.life.MapleMonster;
import net.sf.cherry.server.life.MapleMonsterInformationProvider.DropEntry;
import net.sf.cherry.server.life.MapleNPC;
import net.sf.cherry.server.maps.*;
import net.sf.cherry.tools.MaplePacketCreator;
import java.awt.*;
import java.util.List;
import java.util.*;
public class ReactorActionManager extends AbstractPlayerInteraction {
private MapleReactor reactor;
private MapleClient c;
public ReactorActionManager(MapleClient c, MapleReactor reactor) {
super(c);
this.reactor = reactor;
}
public void dropItems() {
dropItems(false, 0, 0, 0, 0);
}
public void dropItems(boolean meso, int mesoChance, int minMeso, int maxMeso) {
dropItems(meso, mesoChance, minMeso, maxMeso, 0);
}
public void dropItems(boolean meso, int mesoChance, int minMeso, int maxMeso, int minItems) {
List<DropEntry> chances = getDropChances();
List<DropEntry> items = new LinkedList<DropEntry>();
int numItems = 0;
if ((meso) && (Math.random() < 1.0D / mesoChance)) {
items.add(new DropEntry(0, mesoChance, 0));
}
Iterator iter = chances.iterator();
while (iter.hasNext()) {
DropEntry d = (DropEntry) iter.next();
if (Math.random() < (1 / (double) d.chance)) {
numItems++;
items.add(d);
}
}
while (items.size() < minItems) {
items.add(new DropEntry(0, mesoChance));
numItems++;
}
Collections.shuffle(items);
Point dropPos = this.reactor.getPosition();
dropPos.x -= 12 * numItems;
for (DropEntry d : items) {
if (d.itemid == 0) {
int range = maxMeso - minMeso;
int mesoDrop = ((int) (Math.random() * range) + minMeso) * ChannelServer.getInstance(getClient().getChannel()).getMesoRate();
this.reactor.getMap().spawnMesoDrop(mesoDrop, dropPos, this.reactor, getPlayer(), meso);
} else {
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
IItem drop;
if (ii.getInventoryType(d.itemid) != MapleInventoryType.EQUIP) {
drop = new Item(d.itemid, (byte) 0, (short) 1);
} else {
drop = ii.randomizeStats((Equip) ii.getEquipById(d.itemid));
}
this.reactor.getMap().spawnItemDrop(this.reactor, getPlayer(), drop, dropPos, false, true);
}
dropPos.x += 25;
}
}
private List<DropEntry> getDropChances() {
return ReactorScriptManager.getInstance().getDrops(reactor.getId());
}
public void spawnMonster(int id) {
spawnMonster(id, 1, getPosition());
}
public void spawnMonster(int id, int x, int y) {
spawnMonster(id, 1, new Point(x, y));
}
public void spawnMonster(int id, int qty) {
spawnMonster(id, qty, getPosition());
}
public void spawnMonster(int id, int qty, int x, int y) {
spawnMonster(id, qty, new Point(x, y));
}
private void spawnMonster(int id, int qty, Point pos) {
for (int i = 0; i < qty; i++) {
MapleMonster mob = MapleLifeFactory.getMonster(id);
this.reactor.getMap().spawnMonsterOnGroundBelow(mob, pos);
if (getPlayer().getEventInstance() != null) {
getPlayer().getEventInstance().registerMonster(mob);
}
}
}
public Point getPosition() {
Point pos = this.reactor.getPosition();
pos.y -= 10;
return pos;
}
public void spawnNpc(int npcId) {
spawnNpc(npcId, getPosition());
}
public void spawnNpc(int npcId, MapleCharacter owner) {
spawnNpc(npcId, getPosition(), owner);
}
public void spawnNpc(int npcId, int x, int y) {
spawnNpc(npcId, new Point(x, y));
}
public void spawnNpc(int npcId, Point pos) {
MapleNPC npc = MapleLifeFactory.getNPC(npcId);
if ((npc != null) && (!npc.getName().equals("MISSINGNO"))) {
npc.setPosition(pos);
npc.setCy(pos.y);
npc.setRx0(pos.x + 50);
npc.setRx1(pos.x - 50);
npc.setFh(this.reactor.getMap().getFootholds().findBelow(pos).getId());
npc.setCustom(true);
this.reactor.getMap().addMapObject(npc);
this.reactor.getMap().broadcastMessage(MaplePacketCreator.spawnNPC(npc));
}
}
public void spawnNpc(int npcId, Point pos, MapleCharacter owner) {
MapleNPC npc = MapleLifeFactory.getNPC(npcId);
if ((npc != null) && (!npc.getName().equals("MISSINGNO"))) {
npc.setPosition(pos);
npc.setCy(pos.y);
npc.setRx0(pos.x + 50);
npc.setRx1(pos.x - 50);
npc.setFh(this.reactor.getMap().getFootholds().findBelow(pos).getId());
npc.setCustom(true);
npc.setOwner(owner);
this.reactor.getMap().addMapObject(npc);
this.reactor.getMap().broadcastMessage(MaplePacketCreator.spawnNPC(npc));
}
}
public MapleReactor getReactor() {
return this.reactor;
}
public void spawnFakeMonster(int id) {
spawnFakeMonster(id, 1, getPosition());
}
public void spawnFakeMonster(int id, int x, int y) {
spawnFakeMonster(id, 1, new Point(x, y));
}
public void spawnFakeMonster(int id, int qty) {
spawnFakeMonster(id, qty, getPosition());
}
public void spawnFakeMonster(int id, int qty, int x, int y) {
spawnFakeMonster(id, qty, new Point(x, y));
}
private void spawnFakeMonster(int id, int qty, Point pos) {
for (int i = 0; i < qty; i++) {
MapleMonster mob = MapleLifeFactory.getMonster(id);
this.reactor.getMap().spawnFakeMonsterOnGroundBelow(mob, pos);
}
}
public void killAll() {
this.reactor.getMap().killAllMonsters();
}
public void killMonster(int monsId) {
this.reactor.getMap().killMonster(monsId);
}
public void warpMap(int mapId, int portal) {
Collection<MapleCharacter> mchc = new LinkedHashSet<MapleCharacter>(getClient().getPlayer().getMap().getCharacters());
for (MapleCharacter mch : mchc) {
if (mch != null) {
MapleMap target = ChannelServer.getInstance(getClient().getChannel()).getMapFactory().getMap(mapId);
mch.changeMap(target, target.getPortal(portal));
}
}
}
public void createMapMonitor(int mapId, boolean closePortal, int portalMap, String portalName, int reactorMap, int reactor) {
MaplePortal portal = null;
if (closePortal) {
portal = this.c.getChannelServer().getMapFactory().getMap(portalMap).getPortal(portalName);
portal.setPortalState(false);
}
MapleReactor r = null;
if (reactor > -1) {
r = c.getChannelServer().getMapFactory().getMap(reactorMap).getReactorById(reactor);
r.setState((byte) 1);
this.c.getChannelServer().getMapFactory().getMap(reactorMap).broadcastMessage(MaplePacketCreator.triggerReactor(r, 1));
}
new MapMonitor(this.c.getChannelServer().getMapFactory().getMap(mapId), closePortal ? portal : null, this.c.getChannel(), r);
}
public void createMapMonitor(int type, int pMapId, String pName, String sMobId, short type2, int trigger) {
switch (type) {
case 1:
createMapMonitor(type, pMapId, pName);
break;
case 2:
MapleMap pMap = getClient().getChannelServer().getMapFactory().getMap(pMapId);
MaplePortal portal = pMap.getPortal(pName);
String[] st = sMobId.split(",");
int[] data = new int[st.length];
for (int i = 0; i < st.length; i++) {
data[i] = Integer.parseInt(st[i]);
}
SBossMapMonitor sbmm = new SBossMapMonitor(getPlayer().getMap(), pMap, portal, data, getClient().getChannelServer(), type2, trigger);
sbmm.start();
}
}
public void createMapMonitor(int type, int pMapId, String pName) {
switch (type) {
case 1:
MapleMap pMap = getClient().getChannelServer().getMapFactory().getMap(pMapId);
MaplePortal portal = pMap.getPortal(pName);
BossMapMonitor bmm = new BossMapMonitor(getPlayer().getMap(), pMap, portal);
bmm.start();
}
}
public void closePortal(int mapid, String pName) {
getClient().getChannelServer().getMapFactory().getMap(mapid).getPortal(pName).setPortalState(false);
}
public void openPortal(int mapid, String pName) {
getClient().getChannelServer().getMapFactory().getMap(mapid).getPortal(pName).setPortalState(true);
}
}
| [
"alan1995wang@outlook.com"
] | alan1995wang@outlook.com |
63c021e6317977bb8d65a32deb02c2261bd9f57b | 5d7a2cd91d7a2d9b4088f9ea03519743bd35e121 | /javajungsuk_basic_src/ch07/src/com/codechobo/book/PackageTest.java | 5af78bcf64df1671917f82173e6bdc27951afc76 | [] | no_license | castello/javajungsuk_basic | d2e7424d6ace57b0eb98e8ab7480b68be1accae5 | 59300902f26cc3b1e6d0c8a39e763664983d2c68 | refs/heads/master | 2023-03-16T01:36:08.755528 | 2023-03-07T18:10:16 | 2023-03-07T18:10:16 | 204,616,795 | 588 | 290 | null | null | null | null | UTF-8 | Java | false | false | 142 | java | package com.codechobo.book;
public class PackageTest {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}
| [
"castello@naver.com"
] | castello@naver.com |
539704079f3b5d76533daa5249263ae47a58169f | ac3e6d30e244044a66a64be7938e8c986834d5b0 | /EasyDear/app/src/main/java/com/google/zxing/multi/qrcode/detector/MultiDetector.java | b88e6c9b54714ee14cd35281cd106eaa61ae8a48 | [] | no_license | Aaroa/hukefang | 08a4e1d706fb6fb5084d55809aadcfe19c4e1c9e | 1278cf7b478ef79a75ba27b5810024d0187562c6 | refs/heads/master | 2021-01-13T03:35:05.044973 | 2017-06-06T00:42:22 | 2017-06-06T00:42:22 | 77,506,901 | 0 | 3 | null | 2017-06-06T00:42:23 | 2016-12-28T05:54:47 | Java | UTF-8 | Java | false | false | 2,427 | java | /*
* Copyright 2009 ZXing 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 com.google.zxing.multi.qrcode.detector;
import com.google.zxing.DecodeHintType;
import com.google.zxing.exception.NotFoundException;
import com.google.zxing.exception.ReaderException;
import com.google.zxing.ResultPointCallback;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.common.DetectorResult;
import com.google.zxing.qrcode.detector.Detector;
import com.google.zxing.qrcode.detector.FinderPatternInfo;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* <p>Encapsulates logic that can detect one or more QR Codes in an image, even if the QR Code
* is rotated or skewed, or partially obscured.</p>
*
* @author Sean Owen
* @author Hannes Erven
*/
public final class MultiDetector extends Detector {
private static final DetectorResult[] EMPTY_DETECTOR_RESULTS = new DetectorResult[0];
public MultiDetector(BitMatrix image) {
super(image);
}
public DetectorResult[] detectMulti(Map<DecodeHintType,?> hints) throws NotFoundException {
BitMatrix image = getImage();
ResultPointCallback resultPointCallback =
hints == null ? null : (ResultPointCallback) hints.get(DecodeHintType.NEED_RESULT_POINT_CALLBACK);
MultiFinderPatternFinder finder = new MultiFinderPatternFinder(image, resultPointCallback);
FinderPatternInfo[] infos = finder.findMulti(hints);
if (infos.length == 0) {
throw NotFoundException.getNotFoundInstance();
}
List<DetectorResult> result = new ArrayList<>();
for (FinderPatternInfo info : infos) {
try {
result.add(processFinderPatternInfo(info));
} catch (ReaderException e) {
// ignore
}
}
if (result.isEmpty()) {
return EMPTY_DETECTOR_RESULTS;
} else {
return result.toArray(new DetectorResult[result.size()]);
}
}
}
| [
"wuhezhi@wayto.com.cn"
] | wuhezhi@wayto.com.cn |
4ee75f46a5035efd794c2b2192ff959325873082 | d1a6d1e511df6db8d8dd0912526e3875c7e1797d | /genny_JavaWithoutLambdas/applicationModule/src/main/java/applicationModulepackageJava3/Foo947.java | 97b54a207e33409491538efd40cae30f06435d9c | [] | no_license | NikitaKozlov/generated-project-for-desugaring | 0bc1443ab3ddc84cd289331c726761585766aea7 | 81506b3711004185070ca4bb9a93482b70011d36 | refs/heads/master | 2020-03-20T00:35:06.996525 | 2018-06-12T09:30:37 | 2018-06-12T09:30:37 | 137,049,317 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 346 | java | package applicationModulepackageJava3;
public class Foo947 {
public void foo0() {
new applicationModulepackageJava3.Foo946().foo5();
}
public void foo1() {
foo0();
}
public void foo2() {
foo1();
}
public void foo3() {
foo2();
}
public void foo4() {
foo3();
}
public void foo5() {
foo4();
}
}
| [
"nikita.e.kozlov@gmail.com"
] | nikita.e.kozlov@gmail.com |
5c2731ad36ab2f44c94304737e4b0e72f4eea3b8 | 6331ae93c2108962c68b2594cedf4527d70fdfa0 | /app/src/main/java/steven/com/myapp3/Main3Activity.java | 99821c500a70bc80acf1c1358c17a0a5be4db0ed | [] | no_license | Steven-Lion/test | bb43bc770460dca95f44cc496ba11a70b7fc4834 | 208374d102420e55941708a4e43ae6dcbf268f58 | refs/heads/master | 2021-04-09T13:41:57.149333 | 2018-03-19T15:47:13 | 2018-03-19T15:47:13 | 125,614,172 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 332 | java | package steven.com.myapp3;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class Main3Activity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main3);
}
}
| [
"823961237@qq.com"
] | 823961237@qq.com |
8e572057f8a0f30384c912098a4bcbecaa8a4ef3 | 648f31df5c5133a21e2b07dcb8411b30514e9073 | /chapter5/Encapsulation/Exercise38/Printer.java | ed56829856a72690b6b3d8e8182022dd20dad120 | [] | no_license | ajikan/Java_Notes | c78bc00d58118785d6c8e1e3bbfb8f4d5fd8850b | 23b07299156612233fe6d74f78d73e7b6721ed05 | refs/heads/master | 2023-04-08T22:20:59.697276 | 2021-04-21T14:59:31 | 2021-04-21T14:59:31 | 290,296,511 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,259 | java | public class Printer {
private int tonerLevel = 50;
private int pagesPrinted;
private boolean isDuplex;
public Printer(int tonerLevel, boolean isDuplex) {
if (tonerLevel >= 0 && tonerLevel <= 100) {
this.tonerLevel = tonerLevel;
}
this.pagesPrinted = 0;
this.isDuplex = isDuplex;
}
public int fillTonerLevel(int addToner) {
if (addToner > 0 && addToner <= 100) {
if (this.tonerLevel + addToner <= 100) {
this.tonerLevel += addToner;
return this.tonerLevel;
}
else {
System.out.println("Too much tonerLevel, going over 100%.");
return -1;
}
}
else {
System.out.println("Give a correct amount between 1 and 100 inclusive");
return -1;
}
}
public int print(int pages) {
if (this.isDuplex) {
pages = pages / 2 + pages % 2;
System.out.println("Printing in duplex mode.");
}
this.pagesPrinted += pages;
System.out.println(pages + " pages has been printed");
return pages;
}
public int getPagesPrinted() {
return pagesPrinted;
}
}
| [
"az3@illinois.edu"
] | az3@illinois.edu |
5c0864e2a70e5620a55d22347822664acc4764cd | 00612b09f2df51b1ceb00b4065076c4606d49558 | /Algorithm/src/hw/prac_2072.java | 8fb1e658cc890218174049a7428d68750826dbc2 | [] | no_license | kimin0412/kmj_ssafy | 2cfa2bbadd78f1f4f24949da4c4c0249148635c7 | 3ccb10678e152c8deef0d6ca4cd73bcd25202b83 | refs/heads/master | 2023-03-14T21:39:18.752251 | 2021-03-13T01:50:08 | 2021-03-13T01:50:08 | 238,176,303 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 345 | java | package hw;
import java.util.Scanner;
public class prac_2072 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc= new Scanner(System.in);
int T = sc.nextInt();
int t = sc.nextInt();
int sum=0;
int i;
for(i=0;i<=10;i++) {
if(t%2!=0) {
sum+=t;
}
}
System.out.println(sum);
}
}
| [
"kimin0412@gmail.com"
] | kimin0412@gmail.com |
9d07459fdced4b455cf5828ca47a1e98741a45b0 | baf22bf556885d1c85aed290e06a3b021af796d8 | /hu.sze.aut.ros.middleware.statepubsub.hybriddsl.parent/hu.sze.aut.ros.middleware.statepubsub.hybriddsl.ui/src/hu/sze/aut/ros/middleware/statepubsub/ui/labeling/RosNetworkDslLabelProvider.java | 60f8af74befb51f11376253fdad3f0624281c91f | [] | no_license | kyberszittya/simple-ros-code-generator | 1009146c5893999a35880db293e26eb8a8fcb63a | 98fb7a067e0373baed53bff010f1f9489af0a65e | refs/heads/master | 2022-12-04T04:39:52.018985 | 2020-08-31T12:29:18 | 2020-08-31T12:29:18 | 261,557,652 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 784 | java | /*
* generated by Xtext 2.21.0
*/
package hu.sze.aut.ros.middleware.statepubsub.ui.labeling;
import com.google.inject.Inject;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
import org.eclipse.xtext.ui.label.DefaultEObjectLabelProvider;
/**
* Provides labels for EObjects.
*
* See https://www.eclipse.org/Xtext/documentation/310_eclipse_support.html#label-provider
*/
public class RosNetworkDslLabelProvider extends DefaultEObjectLabelProvider {
@Inject
public RosNetworkDslLabelProvider(AdapterFactoryLabelProvider delegate) {
super(delegate);
}
// Labels and icons can be computed like this:
// String text(Greeting ele) {
// return "A greeting to " + ele.getName();
// }
//
// String image(Greeting ele) {
// return "Greeting.gif";
// }
}
| [
"kyberszittya@protonmail.ch"
] | kyberszittya@protonmail.ch |
3964b0b32d49f730bb0af4e6e9337713e72ddf7c | b0349cae932e3b663345809c5c5cdf8932dd59bf | /Coffe_proj/src/kr/or/dgit/Coffe_service/BackupService.java | a058d48f726bc169950bf7a85a8ce81b16558b67 | [] | no_license | jinhobae1/Coffee_ProjectGradle | 622e421fe54be633e5b19e1387edae9bfe85b583 | 91a1ba66a1fb71d9dd4493d50f87689509378e6f | refs/heads/master | 2020-03-16T21:22:36.757891 | 2018-05-12T07:31:18 | 2018-05-12T07:31:18 | 132,996,390 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,639 | java | package kr.or.dgit.Coffe_service;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Properties;
import kr.or.dgit.Coffe_application.jdbc.LoadProperties;
import kr.or.dgit.dao.ExecuteSql;
public class BackupService implements DaoService {
private static final BackupService instance = new BackupService();
public static BackupService getInstance() {
return instance;
}
private BackupService() {
}
@Override
public void service() {
LoadProperties loadProperties = new LoadProperties();
Properties properteis = loadProperties.getProperties();
ExecuteSql.getInstance().execSQL("use " + properteis.getProperty("dbname"));
checkBackupDir();
String[] tables = properteis.get("tables").toString().split(",");
for (String tblName : tables) {
String sql = String.format("select * from %s", tblName);
exportData(sql, tblName);
}
}
private void exportData(String sql, String tblName) {
try {
ResultSet rs = ExecuteSql.getInstance().execQuerySQL(sql);
int columnCnt = rs.getMetaData().getColumnCount();
StringBuilder sb = new StringBuilder();
// System.out.println("column Cnt " + columnCnt);
while (rs.next()) {
for (int i = 1; i <= columnCnt; i++) {
sb.append(rs.getObject(i) + ",");
}
sb.replace(sb.length() - 1, sb.length(), "");
sb.append("\r\n");
}
writeBackupFile(sb.toString(), tblName);
} catch (SQLException e) {
e.printStackTrace();
}
}
private void writeBackupFile(String result, String tblName) {
String resPath = System.getProperty("user.dir") + "\\BackupFiles\\" + tblName + ".csv";
resPath = resPath.replace("\\", "/");
try (OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream(resPath), "euc-kr");) {
osw.write(result);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
private void checkBackupDir() {
File backupDir = new File(System.getProperty("user.dir") + "\\BackupFiles");
if (backupDir.exists()) {
for (File file : backupDir.listFiles()) {
file.delete();
System.out.printf("%s Delete Success! %n", file.getName());
}
} else {
backupDir.mkdir();
System.out.printf("%s Create Success! %n", backupDir.getName());
}
}
}
| [
"pookgoon@naver.com"
] | pookgoon@naver.com |
71ce087e5bfc6554bee40e35e3018438bd6a2f4e | a952f9abd9f3ec7cf6db5bdc708f880abd931978 | /EGRShopping/src/com/beanpai/egr/shopping/view/RetrievePasswordView.java | 5686304c1304a08642584be668305a8afed66514 | [] | no_license | Win0818/BBPaw_Code | 7d46d1d614e187d42ce08dc7c41a23b871a4d47b | 902779d42695abaadbcb7b07f60659da5c26e059 | refs/heads/master | 2021-01-01T20:12:56.987144 | 2017-07-30T08:44:48 | 2017-07-30T08:44:48 | 98,784,927 | 1 | 0 | null | null | null | null | GB18030 | Java | false | false | 4,237 | java | package com.beanpai.egr.shopping.view;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import com.beanpai.egr.shopping.entity.MemberInfo;
import com.beanpai.egr.shopping.entity.MsgResult;
import com.beanpai.egr.shopping.secret.MD5Util;
import com.beanpai.egr.shopping.utils.Common;
import com.beanpai.egr.shopping.utils.MsgWhat;
import com.beanpai.egr.shopping.utils.Utils;
import com.beanpai.egr.shopping.utils.WebServiceLoader;
import com.mgle.shopping.R;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.TextView;
import android.widget.Toast;
/**
* 找回密码
* @author WGQ
*/
public class RetrievePasswordView extends FrameLayout implements View.OnClickListener {
private Context mContext;
private Handler mHandler;
private MemberInfo mMemberInfo;
private WebServiceLoader mWebServiceLoader = null;
private EditText mEtRetrievePasswordIpone;@SuppressLint("HandlerLeak")
private Handler mSMSHandler = new Handler()
{
@Override
public void handleMessage(Message msg)
{
switch (msg.what)
{
case MsgWhat.NO_NET:
Log.e("SMSVerificationView", "Net Error!");
break;
case MsgWhat.SEND_MSG_INFO_RESULT:
if (msg.obj == null)
{
Log.e("SMSVerificationView", "SEND_MSG_INFO_RESULT OBJ null!");
return;
}
MsgResult result = (MsgResult) msg.obj;
Log.e("SMSVerificationView", "SEND_MSG_INFO_RESULT..result="+result);
break;
default:
break;
}
super.handleMessage(msg);
}
};
private TextView mTvRetrievePasswordNextStep;
public RetrievePasswordView(Context context,Handler mHandler,MemberInfo mMemberInfo)
{
super(context);
this.mContext = context;
this.mHandler = mHandler;
this.mMemberInfo = mMemberInfo;
mWebServiceLoader = new WebServiceLoader();
initView();
}
//初始化布局
@SuppressLint("InflateParams")
private void initView()
{
View localView = LayoutInflater.from(mContext).inflate(R.layout.retrieve_password_view,null);
addView(localView);
mEtRetrievePasswordIpone = (EditText) localView.findViewById(R.id.et_retrieve_pwd_ipone);
mTvRetrievePasswordNextStep = (TextView) localView.findViewById(R.id.tv_retrieve_password_next_step);
initListener();
}
//绑定监听
private void initListener()
{
mTvRetrievePasswordNextStep.setOnClickListener(this);
mEtRetrievePasswordIpone.requestFocus();
}
@Override
public void onClick(View view)
{
switch (view.getId())
{
case R.id.tv_retrieve_password_next_step://确认
String mobile = mEtRetrievePasswordIpone.getText().toString().trim();
if(mMemberInfo.mobile.equals(mobile))
{
sendMessage(mMemberInfo.mobile);
mHandler.sendEmptyMessage(Common.INPUT_VERIFICATION_CODE);
}else{
Toast.makeText(mContext, "手机号码不正确!", Toast.LENGTH_LONG).show();
}
break;
default:
break;
}
}
private void sendMessage(String phoneNum)
{
@SuppressWarnings("static-access")
SharedPreferences sp = mContext.getSharedPreferences("code", mContext.MODE_PRIVATE);
Random random = new Random();
int x = random.nextInt(8999);
String number = "" + (x + 1000);
sp.edit().putString("code", number).commit();
Map<String ,String> rawParams = new HashMap<String, String>();
rawParams.put("account", Utils.SEND_MSG_ACCOUNT);
String pwd = MD5Util.string2MD5(Utils.SEND_MSG_PASSWORD);
rawParams.put("password",Utils.SEND_MSG_PASSWORD);
rawParams.put("mobile", mMemberInfo.mobile);
rawParams.put("content","您的验证码是:"+ number +"。请不要把验证码泄露给其他人。");
Log.e("SMSVerificationView", "sendMessage..account="+Utils.SEND_MSG_ACCOUNT
+"; pwd="+Utils.SEND_MSG_PASSWORD+"; md5 pwd="+pwd
+"; phoneNum="+phoneNum+"; msg=您的验证码是:"+number+"。请不要把验证码泄露给其他人。");
mWebServiceLoader.sendMsgResult(mSMSHandler,mContext, Utils.SEND_MSG_URL, rawParams);
}
} | [
"756745821@qq.com"
] | 756745821@qq.com |
0cc757f5a3bbfbeb873e32c2336a8e95d1a6123d | c7118bc1d0187583b880257879e35b7a2964147f | /packages/apps/Dialer/java/com/android/dialer/common/ConfigProviderFactory.java | aeb4f303a28ace2f0a829067c52bf5dae8413ba9 | [
"Apache-2.0"
] | permissive | paultcn/android_aosp_8.0 | 9bf6fff95eac0754255b7a3e9f6b63f8bdbb8296 | d4a08b5696e4f404c242ee87eb84eefd5defe419 | refs/heads/master | 2022-04-20T08:26:21.239571 | 2020-04-10T06:00:53 | 2020-04-10T06:00:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 882 | java | /*
* Copyright (C) 2016 The Android Open Source Project
*
* 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 com.android.dialer.common;
/**
* This interface should be implementated by the Application subclass. It allows dialer code to get
* references to a config provider.
*/
public interface ConfigProviderFactory {
ConfigProvider getConfigProvider();
}
| [
"574926365@qq.com"
] | 574926365@qq.com |
4acb66513c635959a4e69489ccf5524c6b163bf7 | 6b2dfeede68f4bf6148a84bfececbdefdc32c8e2 | /GreensWork/src/com/training/org/AbsA.java | f355e2c8f7b5f9021383c95f807440ed55db74b8 | [] | no_license | Raguraman8988/Login | 6216e2dd2c990650933a0ba119952874255fe34a | 305bb002d3138b6833b7bc1153f49ac0dd816489 | refs/heads/master | 2023-02-17T20:54:59.969062 | 2021-01-12T07:21:07 | 2021-01-12T07:21:07 | 328,903,789 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 186 | java | package com.training.org;
public abstract class AbsA {
public void sampleA() {
System.out.println("sampleA from DemoAbstractA");
}
public abstract void sampleB();
}
| [
"Raghu@DESKTOP-BJSJULN"
] | Raghu@DESKTOP-BJSJULN |
4bca407616a912e469544740a35e1e2f172ead60 | 59b37376c005b3ca6d3076d291528167251d4c62 | /patterns/design-patterns-structural/src/main/java/com/baeldung/hexagonal/bridge/ProductService.java | e68cd28cf117e886504a3ea3eb4b48cd1b732dc7 | [
"MIT"
] | permissive | Kaitis/tutorials | 84d4c3f889cfe9ec28369c1103c61402e0ec20db | 5985f1d2f2e30266e31b17929a6a65a87722413a | refs/heads/master | 2020-12-27T05:48:36.930980 | 2020-02-20T17:43:11 | 2020-02-20T17:43:11 | 237,784,104 | 0 | 0 | MIT | 2020-02-02T14:33:42 | 2020-02-02T14:33:41 | null | UTF-8 | Java | false | false | 1,166 | java | package com.baeldung.hexagonal.bridge;
import com.baeldung.hexagonal.adapter.driven.EmailNotifyingAdapter;
import com.baeldung.hexagonal.adapter.driven.ProductRepositoryAdapter;
import com.baeldung.hexagonal.domain.Product;
import com.baeldung.hexagonal.domain.ProductVO;
import com.baeldung.hexagonal.ports.driven.INotify;
import java.util.List;
import java.util.stream.Collectors;
public class ProductService implements IBridge<ProductRequest, ProductResponse> {
private EmailNotifyingAdapter notifier;
public ProductService(EmailNotifyingAdapter notifier) {
this.notifier = notifier;
}
@Override public ProductResponse create(ProductRequest productRequest) {
Product product = ProductRepositoryAdapter.getInstance().create(productRequest.getProduct());
return new ProductResponse(new ProductVO(product.getName()));
}
@Override public List<ProductResponse> list() {
return ProductRepositoryAdapter.getInstance().list().stream().map(p -> new ProductResponse(new ProductVO(p.getName()))).collect(Collectors.toList());
}
@Override public INotify getNotifier() {
return notifier;
}
}
| [
"kaitis@vevivo.com"
] | kaitis@vevivo.com |
1894439c9d02520dea1db0f5f20beb990f08404a | d74687c24223e041230f922d47905b60df90f2ef | /app/src/main/java/com/example/nikhil/finddev/MainActivity.java | 071b4c432c380300b58da0b15be567539da4bca8 | [] | no_license | Nik142/FindDev | be223d8141044dba9bd70f8802466cb8e367f904 | fcdeadd6d5047f6ab02d3359165c970ad27450e8 | refs/heads/master | 2020-03-08T22:10:35.787933 | 2018-04-27T16:45:44 | 2018-04-27T16:45:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 840 | java | package com.example.nikhil.finddev;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
public class MainActivity extends AppCompatActivity {
FirebaseUser user;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
user = FirebaseAuth.getInstance().getCurrentUser();
if(user != null){
startActivity(new Intent(MainActivity.this, MainDisplay.class));
MainActivity.this.finish();
}
else{
startActivity(new Intent(MainActivity.this, SignIn.class));
MainActivity.this.finish();
}
}
}
| [
"nikhilgoel142@gmail.com"
] | nikhilgoel142@gmail.com |
6d51c2fe91b85453f17584e90adce1f9baef4cfa | 7b26778c00077d11da544884f2a41b0254e2d84b | /src/main/java/web/upload/controller/UploadController.java | 8b39ff8ab2e54ed42216976498f926d67939cb50 | [] | no_license | gaobingqiu/userSafe | 9599143df48e5a4b2f7426870ede33a08b4e5fe4 | 9b31c7391212611142416cc77a4b6e068eb043ab | refs/heads/master | 2020-05-21T23:58:28.749803 | 2016-11-25T09:22:43 | 2016-11-25T09:22:43 | 56,495,287 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,183 | java | package web.upload.controller;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.multipart.commons.CommonsMultipartResolver;
import com.base.BaseController;
import com.table.user.entity.User;
import com.table.user.service.UserService;
@Controller
@RequestMapping("/file")
public class UploadController extends BaseController {
@Autowired
private UserService userService;
@Autowired
private UploadService uploadService;
@RequestMapping("/toImage")
public String toImage() {
return "test/upload/image";
}
/**
* 应用解析器上传文件。
*
* @param request
* @param response
* @return
* @throws IllegalStateException
* @throws IOException
*/
@RequestMapping("/upload")
public String upload(HttpServletRequest request, HttpServletResponse response)
throws IllegalStateException, IOException {
// 创建一个通用的多部分解析器
CommonsMultipartResolver multipartResolver = new CommonsMultipartResolver(
request.getSession().getServletContext());
// 判断 request 是否有文件上传,即多部分请求
if (multipartResolver.isMultipart(request)) {
// 转换成多部分request
MultipartHttpServletRequest multiRequest = (MultipartHttpServletRequest) request;
// 取得request中的所有文件名
Iterator<String> iter = multiRequest.getFileNames();
while (iter.hasNext()) {
// 记录上传过程起始时的时间,用来计算上传时间
int pre = (int) System.currentTimeMillis();
// 取得上传文件
MultipartFile file = multiRequest.getFile(iter.next());
// 文件类型限制
List<String> fileTypes = new ArrayList<String>();
fileTypes.add("jpg");
fileTypes.add("jpeg");
fileTypes.add("bmp");
fileTypes.add("gif");
if (file != null) {
// 取得当前上传文件的文件名称
String myFileName = file.getOriginalFilename();
String ext = myFileName.substring(myFileName.lastIndexOf(".") + 1, myFileName.length());
if (!fileTypes.contains(ext)) {
return "/404";
}
// 如果名称不为“”,说明该文件存在,否则说明该文件不存在
if (myFileName.trim() != "") {
System.out.println(myFileName);
// 重命名上传后的文件名
String fileName = "demoUpload" + file.getOriginalFilename();
// 定义上传路径
String path = "F:/design/files/" + fileName;
File localFile = new File(path);
file.transferTo(localFile);
}
}
// 记录上传该文件后的时间
int finaltime = (int) System.currentTimeMillis();
System.out.println(finaltime - pre);
}
return "/success";
}
return "/404";
}
@RequestMapping("/uploadImg")
@ResponseBody
public boolean uploadImg(HttpServletRequest request, String image) {
if (image == null) // 图像数据为空
{
return false;
}
// 生成jpeg图片
String imgFilePath = "E:/workplace/userSafe/src/main/webapp/images/upload/images/";// 新生成的图片F
HttpSession session = request.getSession();
String userId = (String) session.getAttribute("userId");
User user = userService.getUser(userId);
Long time = System.currentTimeMillis();// 获取当前时间戳
imgFilePath = imgFilePath + userId + time + ".png";
String truePath = "/images/upload/images/" + userId + time + ".png";
if (uploadService.SaveManager(image, imgFilePath)) {
user.setImage(truePath);
userService.saveOrUpdate(user);
return true;
}
return false;
}
} | [
"990924291@qq.com"
] | 990924291@qq.com |
3ec444a44e56140f98a7068f0182118cff4ab511 | 752e6c7fef25eb3feedca9f79803b8fa6cbe80a1 | /ogham-core/src/test/java/fr/sii/ogham/ut/subject/provider/MultiContentSubjectProviderTest.java | 49ef3ff610ab98666ca5f35ef84fce22d8d191ae | [
"Apache-2.0"
] | permissive | demkada/ogham | 57a77df8f021446a2896101c022b4660253b302a | f399f2c8f3eb3d43b46cfa62da86cee384b23390 | refs/heads/master | 2020-05-24T07:43:39.285995 | 2019-05-25T07:36:33 | 2019-05-25T07:36:33 | 187,167,117 | 0 | 0 | Apache-2.0 | 2019-05-17T07:20:46 | 2019-05-17T07:20:46 | null | UTF-8 | Java | false | false | 2,546 | java | package fr.sii.ogham.ut.subject.provider;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner;
import fr.sii.ogham.core.message.content.MultiContent;
import fr.sii.ogham.core.message.content.StringContent;
import fr.sii.ogham.core.subject.provider.MultiContentSubjectProvider;
import fr.sii.ogham.core.subject.provider.SubjectProvider;
import fr.sii.ogham.email.message.Email;
import fr.sii.ogham.helper.rule.LoggingTestRule;
@RunWith(MockitoJUnitRunner.class)
public class MultiContentSubjectProviderTest {
@Rule
public final LoggingTestRule loggingRule = new LoggingTestRule();
private MultiContentSubjectProvider provider;
@Mock
private SubjectProvider delegate;
@Before
public void setUp() {
provider = new MultiContentSubjectProvider(delegate);
Mockito.when(delegate.provide(new Email().content("single content"))).thenReturn("single subject");
Mockito.when(delegate.provide(new Email().content("txt"))).thenReturn("txt subject");
Mockito.when(delegate.provide(new Email().content("html"))).thenReturn("html subject");
Mockito.when(delegate.provide(new Email().content("none"))).thenReturn(null);
Mockito.when(delegate.provide(new Email().content("empty"))).thenReturn("");
}
@Test
public void single() {
String subject = provider.provide(new Email().content("single content"));
Assert.assertNull("Subject should be null", subject);
}
@Test
public void htmlAndTxt() {
String subject = provider.provide(new Email().content(new MultiContent(new StringContent("html"), new StringContent("txt"))));
Assert.assertEquals("Subject should be provided by html", "html subject", subject);
}
@Test
public void noneAndTxt() {
String subject = provider.provide(new Email().content(new MultiContent(new StringContent("none"), new StringContent("txt"))));
Assert.assertEquals("Subject should be provided by txt", "txt subject", subject);
}
@Test
public void noneAndNone() {
String subject = provider.provide(new Email().content(new MultiContent(new StringContent("none"), new StringContent("none"))));
Assert.assertNull("No subject should be provided", subject);
}
@Test
public void noneAndEmpty() {
String subject = provider.provide(new Email().content(new MultiContent(new StringContent("none"), new StringContent("empty"))));
Assert.assertEquals("Subject should be provided by empty", "", subject);
}
}
| [
"abaudet@sii.fr"
] | abaudet@sii.fr |
df75216e52b31c337d9c046086a414dc074f3e2c | 762d18f3fa93ffeb7e15c1a9f96d1ff61934e70c | /src/test/com.bankonet/TestCompteEpargne.java | e8c0ddb445550f1fd5069f4ee0f9caea57357bfe | [] | no_license | tmaulon/java-bankonet | 4577433a55c6d3a22193fdc910ec70b82a9d4094 | 5b2cf59c23ebc8d131843b7613846074fae47a35 | refs/heads/master | 2020-05-16T19:14:42.483288 | 2019-04-25T15:46:05 | 2019-04-25T15:46:05 | 183,253,339 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,547 | java | package com.bankonet;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
class TestCompteEpargne {
@Test
public void testInstanceCompteEpargne() {
CompteEpargne compteEpargne1 = new CompteEpargne("36655463", "Compte épargne de M.Dupont", 15000.56, 0.05);
System.out.println("Compte Epargne numéro1 : " + compteEpargne1.getNumero());
System.out.println("Solde du compte épargne1 : " + compteEpargne1.getSolde() + "€");
compteEpargne1.crediter(200.0);
assertEquals(15200.56, compteEpargne1.getSolde(), "Le solde après avoir crédité le " + compteEpargne1.getIntitule() + " n'est pas le bon.");
compteEpargne1.debiter(50.0);
assertEquals(15150.56, compteEpargne1.getSolde(), "Le solde après avoir débité le " + compteEpargne1.getIntitule() + " n'est pas le bon.");
System.out.println(compteEpargne1.toString());
// CompteCourant compteCourant2 = new CompteEpargne("36655495", "Mme Durant", 250.1, 100.0);
// System.out.println("compteCourant numéro2 : " + compteCourant2.getNumero());
// System.out.println("Solde du compte courant2 : " + compteCourant2.getSolde() + "€");
// compteCourant2.crediter(150.0);
// assertEquals(400.1, compteCourant2.getSolde(), "Le solde après avoir crédité " + compteCourant2.getIntitule() + " n'est pas le bon.");
// compteCourant2.debiter(100.0);
// assertEquals(300.1, compteCourant2.getSolde(), "Le solde après avoir débité " + compteCourant2.getIntitule() + " n'est pas le bon.");
// System.out.println(compteCourant2.toString());
//
// CompteCourant compteCourant3 = new CompteEpargne("36652005", "Toto", 25000.35, 150.0);
// System.out.println("compteCourant numéro3 : " + compteCourant3.getNumero());
// System.out.println("Solde du compte courant3 : " + compteCourant3.getSolde() + "€");
// assertEquals(3, compteCourant3.getNbComptesCourants(), "Ce n'est pas le bon nombre de compte courant");
// compteCourant3.crediter(1000.0);
// assertEquals(26000.35, compteCourant3.getSolde(), "Le solde après avoir crédité " + compteCourant3.getIntitule() + " n'est pas le bon.");
// compteCourant3.debiter(500.0);
// assertEquals(25500.35, compteCourant3.getSolde(), "Le solde après avoir débité " + compteCourant3.getIntitule() + " n'est pas le bon.");
// System.out.println(compteCourant3.toString());
//
//
// CompteCourant compteCourant4 = new CompteEpargne("86623247", "Michael Jordan-Is-Poor", -10.50, 150.0);
// assertEquals(0, compteCourant4.getSolde(), "Nous avons un problêlme avec " + compteCourant4.getIntitule() + " car nous ne pouvons pas créer de compte avec un solde négatif ..");
// System.out.println("compteCourant numéro4 : " + compteCourant4.getNumero());
// System.out.println("Solde du compte courant4 : " + compteCourant4.getSolde() + "€");
// assertEquals(4, compteCourant4.getNbComptesCourants(), "Ce n'est pas le bon nombre de compte courant");
// compteCourant4.crediter(1000.0);
// assertEquals(1000.0, compteCourant4.getSolde(), "Le solde après avoir crédité " + compteCourant4.getIntitule() + " n'est pas le bon.");
// compteCourant4.debiter(500.0);
// assertEquals(500, compteCourant4.getSolde(), "Le solde après avoir débité " + compteCourant4.getIntitule() + " n'est pas le bon.");
// System.out.println(compteCourant4.toString());
}
}
| [
"thomas.maulon@gmail.com"
] | thomas.maulon@gmail.com |
c2c19500ffed6abfacffede0771383f6043be181 | 7d4386c754b24140b1a06f81a581be2f08c38286 | /excercises/MVCJsonGuiado/MVCJsonGuiado/app/src/main/java/com/example/digitalhouse/mvcjsonguiado/v4Refactor/DAOProductoInternet.java | 3388c0f4828c3a4fad40098a5e1910d96de11ad5 | [] | no_license | DiegoLFE/Exercises | e98b2861495ecadec2f27a41438cab0b94e07ff0 | f8b3909f3208c4d69645c7282fdbf09797ff64a2 | refs/heads/main | 2023-06-05T08:29:29.160845 | 2021-06-25T20:18:08 | 2021-06-25T20:18:08 | 380,337,141 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,052 | java | package com.example.digitalhouse.mvcjsonguiado.v4Refactor;
import java.util.ArrayList;
import java.util.List;
/**
* Created by digitalhouse on 24/05/17.
*/
public class DAOProductoInternet {
public List<Producto> obtenerProductosDeInternet(){
List<Producto>productos = null;
//Obtengo algun objeto que me permite hacer comunicaciones con Internet
//Le pido que se conecte con Mercado Abierto
//esto me devuelve un choclo de texto con tota la informacion
//tengo que pasarla a una lista de productos y luego devolverla
productos = new ArrayList<>();
productos.add(new Producto("PS4","La ultima PlayStation, diversion asegurada",12000.0));
productos.add(new Producto("PS3","La ante-ultima PlayStation, diversion casi-asegurada",12000.0));
productos.add(new Producto("PS2","La segunda PlayStation, diversion notan-asegurada",12000.0));
productos.add(new Producto("PS1","La primer Play, diversion solo para entendidos",12000.0));
return productos;
}
}
| [
"diegolf1000@gmail.com"
] | diegolf1000@gmail.com |
6be9faaba25b3d1c0a3012c0afdd31d2430677f6 | bac0b2749b39ae862f968286221704252b65483c | /app/src/androidTest/java/com/veryworks/android/rxbasic5binding/ExampleInstrumentedTest.java | f508cc33348175e7953c836b7ec99db285a73bfb | [] | no_license | javafa/RxBasic5Binding | 1febd8f808bf17d14e2a0b035158e8d0be7d41e0 | 8b6fc97d97ab4786b57737ff961b8afaa1b50639 | refs/heads/master | 2021-01-22T22:23:57.103144 | 2017-03-20T05:09:49 | 2017-03-20T05:09:49 | 85,537,411 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 778 | java | package com.veryworks.android.rxbasic5binding;
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.veryworks.android.rxbasic5binding", appContext.getPackageName());
}
}
| [
"nigne2016@gmail.com"
] | nigne2016@gmail.com |
061ef836498fdfab256c8225a7b16fce2c18dcc9 | 37f8cb6758676578025f95360d9d92a547234b15 | /src/main/java/com/lx/shorturl/entity/Link.java | 0b7518b41e4a117599311ea62a615331c6942b04 | [] | no_license | TravelAlone1/short-url-service | 76ec7c2cc05f9ce11e0411bb67eda9d7597e2fcb | 22ee36881a0b09c2308fd6286d796500525a7ef9 | refs/heads/master | 2022-06-23T13:16:03.598537 | 2019-11-14T12:16:04 | 2019-11-14T12:16:04 | 210,978,339 | 0 | 0 | null | 2022-06-21T01:56:43 | 2019-09-26T02:04:58 | JavaScript | UTF-8 | Java | false | false | 572 | java | package com.lx.shorturl.entity;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
*@Author: lx
*@Date: 2019/9/25 16:07
*/
@Data
public class Link implements Serializable {
private static final long serialVersionUID = -8289770787953160443L;
/**
* 主键
*/
private String shortCode;
/**
* 长链接
*/
private String longUrl;
/**
* 短链接
*/
private String shortUrl;
private Date createTime;
private Date updateTime;
private Date expireTime;
private int status;
} | [
"2734572804@qq.com"
] | 2734572804@qq.com |
f8c3a90769e045ed2e5ea07729f2b44914102087 | 504f0ba5c18ccc7393e6715f1ce9b236c4f6d99f | /vcs-20200515/src/main/java/com/aliyun/vcs20200515/models/DescribeDevicesResponse.java | 0306019074b23ee6113125d1e4a2b1535941c869 | [
"Apache-2.0"
] | permissive | jhz-duanmeng/alibabacloud-java-sdk | 77f69351dee8050f9c40d7e19b05cf613d2448d6 | ac8bfeb15005d3eac06091bbdf50e7ed3e891c38 | refs/heads/master | 2023-01-16T04:30:12.898713 | 2020-11-25T11:45:31 | 2020-11-25T11:45:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,803 | java | // This file is auto-generated, don't edit it. Thanks.
package com.aliyun.vcs20200515.models;
import com.aliyun.tea.*;
public class DescribeDevicesResponse extends TeaModel {
@NameInMap("Code")
@Validation(required = true)
public String code;
@NameInMap("Message")
@Validation(required = true)
public String message;
@NameInMap("RequestId")
@Validation(required = true)
public String requestId;
@NameInMap("Data")
@Validation(required = true)
public DescribeDevicesResponseData data;
public static DescribeDevicesResponse build(java.util.Map<String, ?> map) throws Exception {
DescribeDevicesResponse self = new DescribeDevicesResponse();
return TeaModel.build(map, self);
}
public DescribeDevicesResponse setCode(String code) {
this.code = code;
return this;
}
public String getCode() {
return this.code;
}
public DescribeDevicesResponse setMessage(String message) {
this.message = message;
return this;
}
public String getMessage() {
return this.message;
}
public DescribeDevicesResponse setRequestId(String requestId) {
this.requestId = requestId;
return this;
}
public String getRequestId() {
return this.requestId;
}
public DescribeDevicesResponse setData(DescribeDevicesResponseData data) {
this.data = data;
return this;
}
public DescribeDevicesResponseData getData() {
return this.data;
}
public static class DescribeDevicesResponseDataRecords extends TeaModel {
@NameInMap("InProtocol")
@Validation(required = true)
public String inProtocol;
@NameInMap("CreateTime")
@Validation(required = true)
public String createTime;
@NameInMap("DeviceAddress")
@Validation(required = true)
public String deviceAddress;
@NameInMap("DeviceId")
@Validation(required = true)
public String deviceId;
@NameInMap("DeviceName")
@Validation(required = true)
public String deviceName;
@NameInMap("DeviceType")
@Validation(required = true)
public String deviceType;
@NameInMap("Latitude")
@Validation(required = true)
public String latitude;
@NameInMap("Longitude")
@Validation(required = true)
public String longitude;
@NameInMap("Status")
@Validation(required = true)
public String status;
@NameInMap("Vendor")
@Validation(required = true)
public String vendor;
@NameInMap("CorpId")
@Validation(required = true)
public String corpId;
public static DescribeDevicesResponseDataRecords build(java.util.Map<String, ?> map) throws Exception {
DescribeDevicesResponseDataRecords self = new DescribeDevicesResponseDataRecords();
return TeaModel.build(map, self);
}
public DescribeDevicesResponseDataRecords setInProtocol(String inProtocol) {
this.inProtocol = inProtocol;
return this;
}
public String getInProtocol() {
return this.inProtocol;
}
public DescribeDevicesResponseDataRecords setCreateTime(String createTime) {
this.createTime = createTime;
return this;
}
public String getCreateTime() {
return this.createTime;
}
public DescribeDevicesResponseDataRecords setDeviceAddress(String deviceAddress) {
this.deviceAddress = deviceAddress;
return this;
}
public String getDeviceAddress() {
return this.deviceAddress;
}
public DescribeDevicesResponseDataRecords setDeviceId(String deviceId) {
this.deviceId = deviceId;
return this;
}
public String getDeviceId() {
return this.deviceId;
}
public DescribeDevicesResponseDataRecords setDeviceName(String deviceName) {
this.deviceName = deviceName;
return this;
}
public String getDeviceName() {
return this.deviceName;
}
public DescribeDevicesResponseDataRecords setDeviceType(String deviceType) {
this.deviceType = deviceType;
return this;
}
public String getDeviceType() {
return this.deviceType;
}
public DescribeDevicesResponseDataRecords setLatitude(String latitude) {
this.latitude = latitude;
return this;
}
public String getLatitude() {
return this.latitude;
}
public DescribeDevicesResponseDataRecords setLongitude(String longitude) {
this.longitude = longitude;
return this;
}
public String getLongitude() {
return this.longitude;
}
public DescribeDevicesResponseDataRecords setStatus(String status) {
this.status = status;
return this;
}
public String getStatus() {
return this.status;
}
public DescribeDevicesResponseDataRecords setVendor(String vendor) {
this.vendor = vendor;
return this;
}
public String getVendor() {
return this.vendor;
}
public DescribeDevicesResponseDataRecords setCorpId(String corpId) {
this.corpId = corpId;
return this;
}
public String getCorpId() {
return this.corpId;
}
}
public static class DescribeDevicesResponseData extends TeaModel {
@NameInMap("PageNum")
@Validation(required = true)
public Integer pageNum;
@NameInMap("PageSize")
@Validation(required = true)
public Integer pageSize;
@NameInMap("TotalCount")
@Validation(required = true)
public Integer totalCount;
@NameInMap("TotalPage")
@Validation(required = true)
public Integer totalPage;
@NameInMap("Records")
@Validation(required = true)
public java.util.List<DescribeDevicesResponseDataRecords> records;
public static DescribeDevicesResponseData build(java.util.Map<String, ?> map) throws Exception {
DescribeDevicesResponseData self = new DescribeDevicesResponseData();
return TeaModel.build(map, self);
}
public DescribeDevicesResponseData setPageNum(Integer pageNum) {
this.pageNum = pageNum;
return this;
}
public Integer getPageNum() {
return this.pageNum;
}
public DescribeDevicesResponseData setPageSize(Integer pageSize) {
this.pageSize = pageSize;
return this;
}
public Integer getPageSize() {
return this.pageSize;
}
public DescribeDevicesResponseData setTotalCount(Integer totalCount) {
this.totalCount = totalCount;
return this;
}
public Integer getTotalCount() {
return this.totalCount;
}
public DescribeDevicesResponseData setTotalPage(Integer totalPage) {
this.totalPage = totalPage;
return this;
}
public Integer getTotalPage() {
return this.totalPage;
}
public DescribeDevicesResponseData setRecords(java.util.List<DescribeDevicesResponseDataRecords> records) {
this.records = records;
return this;
}
public java.util.List<DescribeDevicesResponseDataRecords> getRecords() {
return this.records;
}
}
}
| [
"sdk-team@alibabacloud.com"
] | sdk-team@alibabacloud.com |
a2936b7a27e981db738a623ace532d3293b87c30 | 9f56d700a4f05046fd105542d8e0cc65e60fcab6 | /4.JavaCollections/src/com/javarush/task/task31/task3104/Solution.java | 71ccf29a54f748d6dba9220f3dc1cd41165f51fb | [] | no_license | Chepell/JavaRushTasks | f146483807190d501f18d48c88516376f73db25e | d7f08f5408cc24c64242241e16b6185bb72c409e | refs/heads/master | 2020-04-10T06:55:17.604215 | 2018-12-08T20:04:17 | 2018-12-08T20:04:17 | 152,577,114 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,789 | java | package com.javarush.task.task31.task3104;
import java.io.File;
import java.io.IOException;
import java.nio.file.*;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
/*
Поиск скрытых файлов
*/
public class Solution extends SimpleFileVisitor<Path> {
public static void main(String[] args) throws IOException {
EnumSet<FileVisitOption> options = EnumSet.of(FileVisitOption.FOLLOW_LINKS);
final Solution solution = new Solution();
Files.walkFileTree(Paths.get("D:/"), options, 20, solution);
List<String> result = solution.getArchived();
System.out.println("All archived files:");
for (String path : result) {
System.out.println("\t" + path);
}
List<String> failed = solution.getFailed();
System.out.println("All failed files:");
for (String path : failed) {
System.out.println("\t" + path);
}
}
private List<String> archived = new ArrayList<>();
private List<String> failed = new ArrayList<>();
public List<String> getArchived() {
return archived;
}
public List<String> getFailed() {
return failed;
}
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
String name = file.getFileName().toString();
if (name.endsWith(".zip") || name.endsWith(".rar")) {
archived.add(file.toString());
}
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException {
failed.add(file.toString());
return FileVisitResult.SKIP_SUBTREE;
}
} | [
"av.voytenko@gmail.com"
] | av.voytenko@gmail.com |
6402d33450c07e68c3e2dc5251ffd2db41456d6c | 09d0ddd512472a10bab82c912b66cbb13113fcbf | /TestApplications/WhereYouGo-0.9.3-beta/DecompiledCode/JADX/src/main/java/org/mapsforge/android/maps/mapgenerator/databaserenderer/DatabaseRenderer.java | 88e6d282b2c5e6397ac22e38b504052533cb7ea6 | [] | no_license | sgros/activity_flow_plugin | bde2de3745d95e8097c053795c9e990c829a88f4 | 9e59f8b3adacf078946990db9c58f4965a5ccb48 | refs/heads/master | 2020-06-19T02:39:13.865609 | 2019-07-08T20:17:28 | 2019-07-08T20:17:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,150 | java | package org.mapsforge.android.maps.mapgenerator.databaserenderer;
import android.graphics.Bitmap;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.parsers.ParserConfigurationException;
import org.mapsforge.android.maps.mapgenerator.MapGenerator;
import org.mapsforge.android.maps.mapgenerator.MapGeneratorJob;
import org.mapsforge.core.model.GeoPoint;
import org.mapsforge.core.model.Point;
import org.mapsforge.core.model.Tag;
import org.mapsforge.core.model.Tile;
import org.mapsforge.core.util.MercatorProjection;
import org.mapsforge.graphics.android.AndroidGraphics;
import org.mapsforge.map.graphics.Paint;
import org.mapsforge.map.graphics.Style;
import org.mapsforge.map.reader.MapDatabase;
import org.mapsforge.map.reader.MapReadResult;
import org.mapsforge.map.reader.PointOfInterest;
import org.mapsforge.map.reader.Way;
import org.mapsforge.map.reader.header.MapFileInfo;
import org.mapsforge.map.rendertheme.GraphicAdapter.Color;
import org.mapsforge.map.rendertheme.RenderCallback;
import org.mapsforge.map.rendertheme.XmlRenderTheme;
import org.mapsforge.map.rendertheme.rule.RenderTheme;
import org.mapsforge.map.rendertheme.rule.RenderThemeHandler;
import org.xml.sax.SAXException;
public class DatabaseRenderer implements MapGenerator, RenderCallback {
private static final Byte DEFAULT_START_ZOOM_LEVEL = Byte.valueOf(STROKE_MIN_ZOOM_LEVEL);
private static final byte LAYERS = (byte) 11;
private static final Logger LOGGER = Logger.getLogger(DatabaseRenderer.class.getName());
private static final Paint PAINT_WATER_TILE_HIGHTLIGHT = AndroidGraphics.INSTANCE.getPaint();
private static final double STROKE_INCREASE = 1.5d;
private static final byte STROKE_MIN_ZOOM_LEVEL = (byte) 12;
private static final Tag TAG_NATURAL_WATER = new Tag("natural", "water");
private static final Point[][] WATER_TILE_COORDINATES = getTilePixelCoordinates();
private static final byte ZOOM_MAX = (byte) 22;
private final List<PointTextContainer> areaLabels = new ArrayList(64);
private final CanvasRasterer canvasRasterer = new CanvasRasterer();
private Point[][] coordinates;
private Tile currentTile;
private List<List<ShapePaintContainer>> drawingLayers;
private final LabelPlacement labelPlacement = new LabelPlacement();
private MapDatabase mapDatabase;
private List<PointTextContainer> nodes = new ArrayList(64);
private Point poiPosition;
private final List<SymbolContainer> pointSymbols = new ArrayList(64);
private XmlRenderTheme previousJobTheme;
private float previousTextScale;
private byte previousZoomLevel;
private RenderTheme renderTheme;
private ShapeContainer shapeContainer;
private final List<WayTextContainer> wayNames = new ArrayList(64);
private final List<SymbolContainer> waySymbols = new ArrayList(64);
private final List<List<List<ShapePaintContainer>>> ways = new ArrayList(11);
private static RenderTheme getRenderTheme(XmlRenderTheme jobTheme) {
RenderTheme renderTheme = null;
try {
return RenderThemeHandler.getRenderTheme(AndroidGraphics.INSTANCE, jobTheme);
} catch (ParserConfigurationException e) {
LOGGER.log(Level.SEVERE, renderTheme, e);
return renderTheme;
} catch (SAXException e2) {
LOGGER.log(Level.SEVERE, renderTheme, e2);
return renderTheme;
} catch (IOException e3) {
LOGGER.log(Level.SEVERE, renderTheme, e3);
return renderTheme;
}
}
private static Point[][] getTilePixelCoordinates() {
Point point1 = new Point(0.0d, 0.0d);
Point point2 = new Point(256.0d, 0.0d);
Point point3 = new Point(256.0d, 256.0d);
Point point4 = new Point(0.0d, 256.0d);
Point[][] pointArr = new Point[1][];
pointArr[0] = new Point[]{point1, point2, point3, point4, point1};
return pointArr;
}
private static byte getValidLayer(byte layer) {
if (layer < (byte) 0) {
return (byte) 0;
}
if (layer >= LAYERS) {
return (byte) 10;
}
return layer;
}
public DatabaseRenderer() {
PAINT_WATER_TILE_HIGHTLIGHT.setStyle(Style.FILL);
PAINT_WATER_TILE_HIGHTLIGHT.setColor(AndroidGraphics.INSTANCE.getColor(Color.CYAN));
}
public DatabaseRenderer(MapDatabase mapDatabase) {
this.mapDatabase = mapDatabase;
PAINT_WATER_TILE_HIGHTLIGHT.setStyle(Style.FILL);
PAINT_WATER_TILE_HIGHTLIGHT.setColor(AndroidGraphics.INSTANCE.getColor(Color.CYAN));
}
public boolean executeJob(MapGeneratorJob mapGeneratorJob, Bitmap bitmap) {
if (mapGeneratorJob == null) {
return false;
}
this.currentTile = mapGeneratorJob.tile;
XmlRenderTheme jobTheme = mapGeneratorJob.jobParameters.jobTheme;
if (!jobTheme.equals(this.previousJobTheme)) {
if (this.renderTheme != null) {
this.renderTheme.destroy();
}
this.renderTheme = getRenderTheme(jobTheme);
if (this.renderTheme == null) {
this.previousJobTheme = null;
return false;
}
createWayLists();
this.previousJobTheme = jobTheme;
this.previousZoomLevel = Byte.MIN_VALUE;
this.previousTextScale = -1.0f;
}
byte zoomLevel = this.currentTile.zoomLevel;
if (zoomLevel != this.previousZoomLevel) {
setScaleStrokeWidth(zoomLevel);
this.previousZoomLevel = zoomLevel;
}
float textScale = mapGeneratorJob.jobParameters.textScale;
if (Float.compare(textScale, this.previousTextScale) != 0) {
this.renderTheme.scaleTextSize(textScale);
this.previousTextScale = textScale;
}
if (this.mapDatabase != null) {
processReadMapData(this.mapDatabase.readMapData(this.currentTile));
}
this.nodes = this.labelPlacement.placeLabels(this.nodes, this.pointSymbols, this.areaLabels, this.currentTile);
this.canvasRasterer.setCanvasBitmap(bitmap);
this.canvasRasterer.fill(this.renderTheme.getMapBackground());
this.canvasRasterer.drawWays(this.ways);
this.canvasRasterer.drawSymbols(this.waySymbols);
this.canvasRasterer.drawSymbols(this.pointSymbols);
this.canvasRasterer.drawWayNames(this.wayNames);
this.canvasRasterer.drawNodes(this.nodes);
this.canvasRasterer.drawNodes(this.areaLabels);
if (mapGeneratorJob.debugSettings.drawTileFrames) {
this.canvasRasterer.drawTileFrame();
}
if (mapGeneratorJob.debugSettings.drawTileCoordinates) {
this.canvasRasterer.drawTileCoordinates(this.currentTile);
}
clearLists();
return true;
}
public GeoPoint getStartPoint() {
if (this.mapDatabase == null || !this.mapDatabase.hasOpenFile()) {
return null;
}
MapFileInfo mapFileInfo = this.mapDatabase.getMapFileInfo();
if (mapFileInfo.startPosition != null) {
return mapFileInfo.startPosition;
}
return mapFileInfo.boundingBox.getCenterPoint();
}
public Byte getStartZoomLevel() {
if (this.mapDatabase != null && this.mapDatabase.hasOpenFile()) {
MapFileInfo mapFileInfo = this.mapDatabase.getMapFileInfo();
if (mapFileInfo.startZoomLevel != null) {
return mapFileInfo.startZoomLevel;
}
}
return DEFAULT_START_ZOOM_LEVEL;
}
public byte getZoomLevelMax() {
return ZOOM_MAX;
}
public void renderArea(Paint fill, Paint stroke, int level) {
List<ShapePaintContainer> list = (List) this.drawingLayers.get(level);
list.add(new ShapePaintContainer(this.shapeContainer, fill));
list.add(new ShapePaintContainer(this.shapeContainer, stroke));
}
public void renderAreaCaption(String caption, float verticalOffset, Paint fill, Paint stroke) {
Point centerPosition = GeometryUtils.calculateCenterOfBoundingBox(this.coordinates[0]);
this.areaLabels.add(new PointTextContainer(caption, centerPosition.f68x, centerPosition.f69y, fill, stroke));
}
public void renderAreaSymbol(org.mapsforge.map.graphics.Bitmap symbol) {
Point centerPosition = GeometryUtils.calculateCenterOfBoundingBox(this.coordinates[0]);
this.pointSymbols.add(new SymbolContainer(symbol, new Point(centerPosition.f68x - ((double) (symbol.getWidth() / 2)), centerPosition.f69y - ((double) (symbol.getHeight() / 2)))));
}
public void renderPointOfInterestCaption(String caption, float verticalOffset, Paint fill, Paint stroke) {
this.nodes.add(new PointTextContainer(caption, this.poiPosition.f68x, this.poiPosition.f69y + ((double) verticalOffset), fill, stroke));
}
public void renderPointOfInterestCircle(float radius, Paint fill, Paint stroke, int level) {
List<ShapePaintContainer> list = (List) this.drawingLayers.get(level);
list.add(new ShapePaintContainer(new CircleContainer(this.poiPosition, radius), fill));
list.add(new ShapePaintContainer(new CircleContainer(this.poiPosition, radius), stroke));
}
public void renderPointOfInterestSymbol(org.mapsforge.map.graphics.Bitmap symbol) {
this.pointSymbols.add(new SymbolContainer(symbol, new Point(this.poiPosition.f68x - ((double) (symbol.getWidth() / 2)), this.poiPosition.f69y - ((double) (symbol.getHeight() / 2)))));
}
public void renderWay(Paint stroke, int level) {
((List) this.drawingLayers.get(level)).add(new ShapePaintContainer(this.shapeContainer, stroke));
}
public void renderWaySymbol(org.mapsforge.map.graphics.Bitmap symbolBitmap, boolean alignCenter, boolean repeatSymbol) {
WayDecorator.renderSymbol(symbolBitmap, alignCenter, repeatSymbol, this.coordinates, this.waySymbols);
}
public void renderWayText(String textKey, Paint fill, Paint stroke) {
WayDecorator.renderText(textKey, fill, stroke, this.coordinates, this.wayNames);
}
public boolean requiresInternetConnection() {
return false;
}
public void setMapDatabase(MapDatabase mapDatabase) {
this.mapDatabase = mapDatabase;
}
private void clearLists() {
for (int i = this.ways.size() - 1; i >= 0; i--) {
List<List<ShapePaintContainer>> innerWayList = (List) this.ways.get(i);
for (int j = innerWayList.size() - 1; j >= 0; j--) {
((List) innerWayList.get(j)).clear();
}
}
this.areaLabels.clear();
this.nodes.clear();
this.pointSymbols.clear();
this.wayNames.clear();
this.waySymbols.clear();
}
private void createWayLists() {
int levels = this.renderTheme.getLevels();
this.ways.clear();
for (byte i = (byte) 10; i >= (byte) 0; i = (byte) (i - 1)) {
List<List<ShapePaintContainer>> innerWayList = new ArrayList(levels);
for (int j = levels - 1; j >= 0; j--) {
innerWayList.add(new ArrayList(0));
}
this.ways.add(innerWayList);
}
}
private void processReadMapData(MapReadResult mapReadResult) {
if (mapReadResult != null) {
for (PointOfInterest pointOfInterest : mapReadResult.pointOfInterests) {
renderPointOfInterest(pointOfInterest);
}
for (Way way : mapReadResult.ways) {
renderWay(way);
}
if (mapReadResult.isWater) {
renderWaterBackground();
}
}
}
private void renderPointOfInterest(PointOfInterest pointOfInterest) {
this.drawingLayers = (List) this.ways.get(getValidLayer(pointOfInterest.layer));
this.poiPosition = scaleGeoPoint(pointOfInterest.position);
this.renderTheme.matchNode(this, pointOfInterest.tags, this.currentTile.zoomLevel);
}
private void renderWaterBackground() {
this.drawingLayers = (List) this.ways.get(0);
this.coordinates = WATER_TILE_COORDINATES;
this.shapeContainer = new WayContainer(this.coordinates);
this.renderTheme.matchClosedWay(this, Arrays.asList(new Tag[]{TAG_NATURAL_WATER}), this.currentTile.zoomLevel);
}
private void renderWay(Way way) {
this.drawingLayers = (List) this.ways.get(getValidLayer(way.layer));
GeoPoint[][] geoPoints = way.geoPoints;
this.coordinates = new Point[geoPoints.length][];
for (int i = 0; i < this.coordinates.length; i++) {
this.coordinates[i] = new Point[geoPoints[i].length];
for (int j = 0; j < this.coordinates[i].length; j++) {
this.coordinates[i][j] = scaleGeoPoint(geoPoints[i][j]);
}
}
this.shapeContainer = new WayContainer(this.coordinates);
if (GeometryUtils.isClosedWay(this.coordinates[0])) {
this.renderTheme.matchClosedWay(this, way.tags, this.currentTile.zoomLevel);
} else {
this.renderTheme.matchLinearWay(this, way.tags, this.currentTile.zoomLevel);
}
}
private Point scaleGeoPoint(GeoPoint geoPoint) {
return new Point((double) ((float) (MercatorProjection.longitudeToPixelX(geoPoint.longitude, this.currentTile.zoomLevel) - ((double) this.currentTile.getPixelX()))), (double) ((float) (MercatorProjection.latitudeToPixelY(geoPoint.latitude, this.currentTile.zoomLevel) - ((double) this.currentTile.getPixelY()))));
}
private void setScaleStrokeWidth(byte zoomLevel) {
this.renderTheme.scaleStrokeWidth((float) Math.pow(STROKE_INCREASE, (double) Math.max(zoomLevel - 12, 0)));
}
public void destroy() {
if (this.renderTheme != null) {
this.renderTheme.destroy();
this.renderTheme = null;
}
}
}
| [
"crash@home.home.hr"
] | crash@home.home.hr |
3c09099e793662cc9912595f5ad43a136ff95163 | c95864699ad2734ac9d4ab9cd786b7f45278e0a3 | /Lesson15(upd)/TaskMaster/app/src/main/java/com/codingblocks/taskmasterdb/MainActivity.java | 3cab5ee89340226af4364077caef318c27cc6b8c | [] | no_license | LazyInsomaniac/Android | f4ec6fdcb34002f955b56e94be8a5049111ccfab | decb4bd370ebfa4def35e5e8d44d59ccce52dd1b | refs/heads/master | 2020-03-21T14:10:23.132510 | 2018-08-12T13:22:39 | 2018-08-12T13:22:39 | 138,644,409 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,274 | java | package com.codingblocks.taskmasterdb;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import java.util.ArrayList;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final TaskDatabase taskDatabase = new TaskDatabase(this);
Button btnInsert = findViewById(R.id.btnInsert);
btnInsert.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Task task = new Task("The time ",
"is " + System.currentTimeMillis(),
System.currentTimeMillis(),
false);
taskDatabase.insertTask(task);
ArrayList<Task> taskArrayList = taskDatabase.getAllTasks();
Log.e("TAG", "onClick: " + taskArrayList.size());
Log.e("TAG", "onClick: " + taskArrayList
.get(taskArrayList.size() - 1)
.getTitle());
}
});
}
}
| [
"sambhavsharma2@gmail.com"
] | sambhavsharma2@gmail.com |
724df372ea57ede7d6cfa483814eabdc9520aa29 | 3d1bc9934ca6aceea49d4f63dd59432eef82c8eb | /oa_core/src/main/java/com/hotent/platform/controller/system/AliasScriptController.java | 906fa56426840289f1af831e84c5e3162ef1acd8 | [] | no_license | sdzx3783/project2018 | 570c5d878cc0afb5bda93003b5dc66d78e42fb79 | 52e0cae652fbd83b5712636e15a2e14401a5a50a | refs/heads/master | 2020-03-12T04:28:04.856156 | 2018-04-21T06:58:25 | 2018-04-21T06:58:25 | 130,445,510 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 20,495 | java | package com.hotent.platform.controller.system;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import com.hotent.core.api.util.ContextUtil;
import com.hotent.core.db.IRollBack;
import com.hotent.core.db.RollbackJdbcTemplate;
import com.hotent.core.engine.GroovyScriptEngine;
import com.hotent.core.engine.IScript;
import com.hotent.core.log.SysAuditThreadLocalHolder;
import com.hotent.core.util.AppUtil;
import com.hotent.core.util.BeanUtils;
import com.hotent.core.util.DateFormatUtil;
import com.hotent.core.util.FileUtil;
import com.hotent.core.util.StringUtil;
import com.hotent.core.util.TimeUtil;
import com.hotent.core.util.UniqueIdUtil;
import com.hotent.core.web.ResultMessage;
import com.hotent.core.web.controller.BaseController;
import com.hotent.core.web.query.QueryFilter;
import com.hotent.core.web.util.RequestUtil;
import com.hotent.platform.annotion.Action;
import com.hotent.platform.model.system.AliasScript;
import com.hotent.platform.model.system.PersonScript;
import com.hotent.platform.service.system.AliasScriptService;
import com.hotent.platform.xml.util.MsgUtil;
/**
*<pre>
* 对象功能:自定义别名脚本表 控制器类
* 开发公司:广州宏天软件有限公司
* 开发人员:ray
* 创建时间:2013-12-19 11:26:03
*</pre>
*/
@Controller
@RequestMapping("/platform/system/aliasScript/")
public class AliasScriptController extends BaseController
{
@Resource
private RollbackJdbcTemplate rollbackJdbcTemplate;
@Resource
private AliasScriptService aliasScriptService;
@Resource
private GroovyScriptEngine groovyScriptEngine;
/**
* 添加或更新自定义别名脚本表。
* @param request
* @param response
* @param aliasScript 添加或更新的实体
* @param bindResult
* @param viewName
* @return
* @throws Exception
*/
@RequestMapping("save")
@Action(description="添加或更新自定义别名脚本表")
public void save(HttpServletRequest request, HttpServletResponse response,AliasScript aliasScript) throws Exception
{
String resultMsg=null;
try{
//如果是自定义类型的,以下属性都为空!
if("custom".equals(aliasScript.getScriptType())){
aliasScript.setClassName("");
aliasScript.setClassInsName("");
aliasScript.setMethodName("");
aliasScript.setMethodDesc("");
aliasScript.setReturnType("");
aliasScript.setArgument("");
}else{
aliasScript.setScriptComten("");
}
if(aliasScript.getId()==null||aliasScript.getId()==0){
aliasScript.setId(UniqueIdUtil.genId());
aliasScriptService.add(aliasScript);
resultMsg="新增别名脚本成功!";
}else{
aliasScriptService.update(aliasScript);
resultMsg="修改别名脚本成功!";
}
writeResultMessage(response.getWriter(),resultMsg,ResultMessage.Success);
}catch(Exception e){
writeResultMessage(response.getWriter(),resultMsg+","+e.getMessage(),ResultMessage.Fail);
}
}
/**
* 取得自定义别名脚本表分页列表
* @param request
* @param response
* @param page
* @return
* @throws Exception
*/
@RequestMapping("list")
@Action(description="查看自定义别名脚本表分页列表")
public ModelAndView list(HttpServletRequest request,HttpServletResponse response) throws Exception
{
List<AliasScript> list=aliasScriptService.getAll(new QueryFilter(request,"aliasScriptItem"));
ModelAndView mv=this.getAutoView().addObject("aliasScriptList",list);
return mv;
}
/**
* 删除自定义别名脚本表
* @param request
* @param response
* @throws Exception
*/
@RequestMapping("del")
@Action(description="删除自定义别名脚本表")
public void del(HttpServletRequest request, HttpServletResponse response) throws Exception
{
String preUrl= RequestUtil.getPrePage(request);
ResultMessage message=null;
try{
Long[] lAryId =RequestUtil.getLongAryByStr(request, "id");
aliasScriptService.delByIds(lAryId);
message=new ResultMessage(ResultMessage.Success, "删除别名脚本成功!");
}catch(Exception ex){
message=new ResultMessage(ResultMessage.Fail, "删除别名脚本失败:" + ex.getMessage());
}
addMessage(message, request);
response.sendRedirect(preUrl);
}
/**
* 编辑自定义别名脚本表
* @param request
* @param response
* @throws Exception
*/
@RequestMapping("edit")
@Action(description="编辑自定义别名脚本表")
public ModelAndView edit(HttpServletRequest request) throws Exception
{
//获取IScript的实现类
List<Class> implClasses = AppUtil.getImplClass(IScript.class);
Long id=RequestUtil.getLong(request,"id",0L);
String returnUrl=RequestUtil.getPrePage(request);
AliasScript aliasScript=aliasScriptService.getById(id);
//添加系统日志信息 -B
SysAuditThreadLocalHolder.putParamerter("isAdd", aliasScript==null );
return getAutoView().addObject("aliasScript",aliasScript)
.addObject("implClasses",implClasses)
.addObject("returnUrl", returnUrl);
}
/**
* 取得自定义别名脚本表明细
* @param request
* @param response
* @return
* @throws Exception
*/
@RequestMapping("get")
@Action(description="查看自定义别名脚本表明细")
public ModelAndView get(HttpServletRequest request, HttpServletResponse response) throws Exception
{
Long id=RequestUtil.getLong(request,"id");
AliasScript aliasScript = aliasScriptService.getById(id);
return getAutoView().addObject("aliasScript", aliasScript);
}
/**
* 通过类名获取类的所有方法
* @param request
* @param response
* @return
* @throws Exception
*/
@RequestMapping("getMethodsByName")
@ResponseBody
public String getMethodsByName(HttpServletRequest request, HttpServletResponse response) throws Exception{
String name = RequestUtil.getString(request, "name");
JSONObject jobject = new JSONObject();
try{
JSONArray jarray = aliasScriptService.getMethodsByName(name);
jobject.accumulate("result", true).accumulate("methods", jarray);
}
catch(Exception ex){
jobject.accumulate("result", false).accumulate("message", ex.getMessage());
}
return jobject.toString();
}
/**
* 测试自定义别名脚本内容
* @param request
* @param response
* @return
* @throws Exception
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
@RequestMapping("preview")
@Action(description="测试自定义别名脚本内容")
public void preview(HttpServletRequest request, HttpServletResponse response) throws Exception{
PrintWriter writer = response.getWriter();
final String scriptStr=RequestUtil.getString(request, "scriptStr", "");
String alias=RequestUtil.getString(request, "alias", "");
Map returnMap=new HashMap();
if("".equals(scriptStr)){
returnMap.put("isSuccess", 1);
returnMap.put("msg", "删除");
returnMap.put("result", "自定义别名脚本内容不能为空!");
}else{
//[{"paraName":"argo","paraType":"java.lang.String","paraValue":"te"},{"paraName":"arg1","paraType":"java.lang.String","paraValue":"gg"}]
Map map=new HashMap();
boolean mark = false;
if(!"".equals(alias)){
JSONArray array = JSONArray.fromObject(alias);
for (int i = 0; i < array.size(); i++){
JSONObject obj = array.getJSONObject(i);
String paraValue = obj.getString("paraValue");
String paraType = obj.getString("paraType");
if(obj.containsKey("isRequired")&&"1".equals(obj.getString("isRequired"))){
if(StringUtil.isEmpty(paraValue)){
mark = true;
returnMap.put("isSuccess", 2);
returnMap.put("msg", obj.getString("paraName")+"别名脚本参数是必填的!");
returnMap.put("result", "");
break;
}
}
Object javaObj = paraValue;
//类型转换
if(obj.containsKey("paraType")&&StringUtil.isNotEmpty(paraType)&&StringUtil.isNotEmpty(paraValue)){
javaObj = this.getValueObject(paraValue,paraType);
}
map.put(obj.getString("paraName"),javaObj);
}
}
if(!mark){
Object result = rollbackJdbcTemplate.executeRollBack(new IRollBack(){
@Override
public Object execute(String script, Map<String, Object> map){
return groovyScriptEngine.executeObject(scriptStr, map);
}
}, scriptStr, map);
returnMap.put("isSuccess", 0);
returnMap.put("msg","自定义别名脚本内容测试成功");
returnMap.put("result", result);
}
}
JSONObject obj = JSONObject.fromObject(returnMap);
writer.print(obj.toString());
}
/**
* 测试自定义类型的别名脚本
* @param request
* @param response
* @return
* @throws Exception
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
@RequestMapping("customPreview")
@Action(description="测试自定义别名脚本内容")
public void customPreview(HttpServletRequest request, HttpServletResponse response) throws Exception{
PrintWriter writer = response.getWriter();
final String scriptComten =RequestUtil.getString(request, "scriptComten", "", false);
Map returnMap=new HashMap();
Map map = RequestUtil.getParameterValueMap(request, false, false);
if("".equals(scriptComten)){
returnMap.put("isSuccess", 1);
returnMap.put("msg", "自定义别名脚本内容不能为空!");
returnMap.put("result", "");
}else{
//回滚事务的调用方式
Object result = rollbackJdbcTemplate.executeRollBack(new IRollBack(){
@Override
public Object execute(String script, Map<String, Object> map){
return groovyScriptEngine.executeObject(scriptComten, map);
}
}, scriptComten, map);
// Object result = groovyScriptEngine.executeObject(scriptComten, map);
returnMap.put("isSuccess", 0);
returnMap.put("msg", "自定义别名脚本内容测试成功");
returnMap.put("result", result);
}
JSONObject obj = JSONObject.fromObject(returnMap);
writer.print(obj.toString());
}
/**
* 取得自定义别名脚本表明细
* @param request
* @param response
* @return
* @throws Exception
*/
@RequestMapping("toCustomPreview")
@Action(description="查看自定义别名脚本表明细")
public ModelAndView toCustomPreview(HttpServletRequest request, HttpServletResponse response) throws Exception
{
String scriptComten =RequestUtil.getString(request, "scriptComten", "", false);
/*if(!"".equals(scriptComten)){
scriptComten = new String(scriptComten.getBytes("ISO-8859-1"),"UTF-8");
}*/
return getAutoView().addObject("scriptComten", scriptComten);
}
/**
* 取得自定义别名脚本表明细
* @param request
* @param response
* @return
* @throws Exception
*/
@RequestMapping("toPreview")
@Action(description="查看自定义别名脚本表明细")
public ModelAndView toPreview(HttpServletRequest request, HttpServletResponse response) throws Exception
{
String scriptStr=RequestUtil.getString(request, "scriptStr", "");
String alias=RequestUtil.getString(request, "alias", "");
return getAutoView().addObject("scriptStr", scriptStr).addObject("alias", alias);
}
/**
* 检查自定义别名脚本的别名有没有重复
* @param request
* @param response
* @return
* @throws Exception
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
@RequestMapping("checkAliasName")
@Action(description="测试自定义别名脚本的别名是否重复")
public void checkAliasName(HttpServletRequest request, HttpServletResponse response) throws Exception{
PrintWriter writer = response.getWriter();
String aliasName=RequestUtil.getString(request, "aliasName", "");
Map returnMap=new HashMap();
if("".equals(aliasName)){
returnMap.put("isSuccess", 2);
returnMap.put("msg", "别名脚本的别名为空!");
}else{
Map map=new HashMap();
map.put("aliasName",aliasName);
AliasScript as= aliasScriptService.getAliasScriptByName(aliasName);
if(BeanUtils.isNotEmpty(as)&&BeanUtils.isNotEmpty(as.getAliasName())){
returnMap.put("isSuccess", 1);
returnMap.put("msg", "别名脚本的别名:"+aliasName+"已存在!");
}else{
returnMap.put("isSuccess", 0);
returnMap.put("msg", "别名脚本的别名:"+aliasName+"可以使用!");
}
}
JSONObject obj = JSONObject.fromObject(returnMap);
writer.print(obj.toString());
}
/**
* 通过别名获取脚本并执行别名脚本返回数据
* @param request
* @param response
* @return
* @throws Exception
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
@RequestMapping("executeAliasScript")
@Action(description="测试自定义别名脚本内容")
public void executeAliasScript(HttpServletRequest request, HttpServletResponse response) throws Exception{
PrintWriter writer = response.getWriter();
String aliasName=RequestUtil.getString(request, "aliasName", ""); // 兼容旧版本
Map returnMap=new HashMap();
try {
if("".equals(aliasName)){
throw new RuntimeException("别名为空,执行失败!");
}else{
Map map=new HashMap();
map.put("aliasName",aliasName);
AliasScript as= aliasScriptService.getAliasScriptByName(aliasName);
if(as!= null && StringUtil.isNotEmpty(as.getAliasName())){
if("1".equals(as.getEnable().toString())){ //别名脚本禁用了!( 0为可用,1为禁用)
throw new RuntimeException("别名脚本已被禁用!");
}else{
//自定义脚本类型custom
if("custom".equals(as.getScriptType())){
//自动获取Request中的参数
map = RequestUtil.getParameterValueMap(request, false, false);
Object result = groovyScriptEngine.executeObject(as.getScriptComten(), map);
returnMap.put("isSuccess", 0);
returnMap.put("msg", "别名脚本执行成功!");
returnMap.put("result", result);
}else{
String scriptStr ="";
scriptStr += as.getClassInsName()+"."+as.getMethodName();
String jsonStr = as.getArgument();
if(StringUtil.isNotEmpty(jsonStr)&&!"[]".equals(jsonStr)){
JSONArray arry = JSONArray.fromObject(jsonStr);
String str = "";
for (int i = 0; i < arry.size(); i++){
JSONObject obj = arry.getJSONObject(i);
String paraName = obj.getString("paraName");
String paraValue = RequestUtil.getString(request, paraName, "");
String paraType = obj.getString("paraType");
if(obj.containsKey("isRequired")&&"1".equals(obj.getString("isRequired"))){
if(StringUtil.isEmpty(paraValue)){
throw new RuntimeException("别名脚本:"+aliasName+"的"+paraName+"参数不能为空!");
}
}
Object javaObj = paraValue;
//类型转换
if(obj.containsKey("paraType")&&StringUtil.isNotEmpty(paraType)&&StringUtil.isNotEmpty(paraValue)){
javaObj = this.getValueObject(paraValue,paraType);
}
map.put(paraName,javaObj);
str += paraName+",";
}
str = str.substring(0, str.length()-1);
scriptStr += "("+str+")";
}else{
scriptStr +="()";
}
Object result = groovyScriptEngine.executeObject(scriptStr, map);
returnMap.put("isSuccess", 0);
returnMap.put("msg", "paraName");
returnMap.put("result", result);
}
}
}else{
throw new RuntimeException("别名脚本异常,别名为空!");
}
}
} catch (Exception e) {
returnMap.put("isSuccess", 1);
returnMap.put("msg", e.getMessage());
returnMap.put("result", "");
}
JSONObject obj = JSONObject.fromObject(returnMap);
writer.print(obj.toString());
}
/**
* 别名脚本开发帮助
* @param request
* @param response
* @return
* @throws Exception
*/
@RequestMapping("goToHelp")
@Action(description="查看自定义别名脚本表明细")
public ModelAndView goToHelp(HttpServletRequest request, HttpServletResponse response) throws Exception
{
return getAutoView();
}
/**
* 脚本参数的格式转换
* @param paraValue
* @param paraType
* @return
* Object
* @exception
* @since 1.0.0
*/
public Object getValueObject(String paraValue,String paraType){
Object javaObj = paraValue;
paraType = paraType.toLowerCase();
if(paraType.contains("string")){
javaObj = paraValue.toString();
}else if(paraType.contains("date")){
javaObj = TimeUtil.convertString(paraValue, "yyyy-MM-dd");
}else if(paraType.contains("long")){
javaObj = Long.parseLong(paraValue);
}else if(paraType.contains("byte")){
javaObj = paraValue.getBytes();
}else if(paraType.contains("short")){
javaObj = Short.parseShort(paraValue);
}else if(paraType.contains("float")){
javaObj = Float.parseFloat(paraValue);
}else if(paraType.contains("char")){
char[] a = paraValue.toCharArray();
javaObj = a[0];
}else if(paraType.contains("double")){
javaObj = Double.parseDouble(paraValue);
}else if(paraType.contains("boolean")){
javaObj = Boolean.parseBoolean(paraValue);
}else if(paraType.contains("int")){
javaObj = Integer.parseInt(paraValue);
}else if(paraType.contains("map")){
//暂时不处理
}else if(paraType.contains("list")){
//暂时不处理
}
return javaObj;
}
/**
* 获取自定义别名脚本列表
* @param request
* @param response
* @param page
* @return
* @throws Exception
*/
@RequestMapping("getAllAliasScripts")
@ResponseBody
@Action(description="获取自定义别名脚本列表,不分页")
public List<AliasScript> getAllAliasScripts(HttpServletRequest request,HttpServletResponse response) throws Exception{
return aliasScriptService.getAll(new QueryFilter(request, false));
}
/**
* 导出别名脚本xml。
*
* @param request
* @param response
* @throws Exception
*/
@RequestMapping("exportXml")
@Action(description = "导出别名脚本", detail = "导出别名脚本:" + "<#list StringUtils.split(tableIds,\",\") as item>" + "<#assign entity=bpmFormTableService.getById(Long.valueOf(item))/>" + "【${entity.tableDesc}(${entity.tableName})】" + "</#list>")
public void exportXml(HttpServletRequest request,
HttpServletResponse response) throws Exception {
String strXml = null;
String fileName = null;
Long[] tableIds = RequestUtil.getLongAryByStr(request, "tableIds");
List<AliasScript> list = aliasScriptService.getAll();
try {
if (BeanUtils.isEmpty(tableIds)) {
if (BeanUtils.isNotEmpty(list)) {
strXml = aliasScriptService.exportXml(list);
fileName = "全部别名脚本_"
+ DateFormatUtil.getNowByString("yyyyMMddHHmmdd")
+ ".xml";
}
} else {
strXml = aliasScriptService.exportXml(tableIds);
fileName = DateFormatUtil.getNowByString("yyyyMMddHHmmdd")
+ ".xml";
if (tableIds.length == 1) {
AliasScript aliasScript = aliasScriptService
.getById(tableIds[0]);
fileName = aliasScript.getAliasName() + "_" + fileName;
} else if (tableIds.length == list.size()) {
fileName = "全部别名脚本_" + fileName;
} else {
fileName = "多条别名脚本_" + fileName;
}
}
FileUtil.downLoad(request, response, strXml, fileName);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 导入别名脚本的XML
* @param request
* @param response
* @throws Exception
*/
@RequestMapping("importXml")
@Action(description = "导入别名脚本")
public void importXml(MultipartHttpServletRequest request, HttpServletResponse response) throws Exception {
MultipartFile fileLoad = request.getFile("xmlFile");
ResultMessage message = null;
try {
aliasScriptService.importXml(fileLoad.getInputStream());
message = new ResultMessage(ResultMessage.Success, MsgUtil.getMessage());
} catch (Exception e) {
e.printStackTrace();
message = new ResultMessage(ResultMessage.Fail, "导入文件异常,请检查文件格式!");
}
writeResultMessage(response.getWriter(), message);
}
}
| [
"378377084@qq.com"
] | 378377084@qq.com |
df2c8371a204f006f6b0feb6aee6ad94ce6ac5aa | a769053255ec153803ecea6d285d477af7aefe2c | /Prova2/src/br/edu/univas/Main.java | d8a18cce723febbf7ace46f8a0e20d59264eb927 | [] | no_license | DanielEduardoA/TecnicaProgramacao2 | 8e1f1a2ce4f901cd5499abdd2b3eea076ce64900 | f0379353d50202266be92a81305c1639a45c0ef0 | refs/heads/master | 2023-01-18T15:37:13.907389 | 2020-12-01T00:16:48 | 2020-12-01T00:16:48 | 295,563,817 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 2,543 | java | package br.edu.univas;
import java.util.Scanner;
import br.edu.univas.vo.Conta;
public class Main {
private static Conta[] contas = new Conta[100];
private static int i = 0;
private static final String TIPO_DESPESA = "despesa";
private static final String TIPO_RECEITA = "receita";
public static void main(String[] args) {
mostrarMenu();
}
public static void executarOpcao(int opcao) {
switch (opcao) {
case 1:
cadastrarConta();
break;
case 2:
mostrarSaldo();
break;
case 3:
System.out.println("Finalizando a aplicação.");
System.exit(0);
break;
default:
System.out.println("Opção inválida");
}
mostrarMenu();
}
@SuppressWarnings("resource")
private static void mostrarMenu() {
Scanner leitura = new Scanner(System.in);
System.out.println("Escolha uma opção");
System.out.println("-------------------------");
System.out.println("1 - Cadastrar conta");
System.out.println("2 - Saldo");
System.out.println("3 - Sair");
System.out.println("-------------------------");
int opcao = leitura.nextInt();
executarOpcao(opcao);
}
private static void mostrarSaldo() {
float receita = 0;
float despesa = 0;
for (int j = 0; j < contas.length; j++) {
if (contas[j] != null && contas[j].tipo.equalsIgnoreCase(TIPO_DESPESA)) {
despesa += contas[j].valor;
} else if (contas[j] != null && contas[j].tipo.equalsIgnoreCase(TIPO_RECEITA)) {
receita += contas[j].valor;
}
}
float saldo = receita - despesa;
System.out.println("O Saldo é:" + saldo);
}
@SuppressWarnings("resource")
private static void cadastrarConta() {
Scanner leitura = new Scanner(System.in);
Conta conta = new Conta();
System.out.println("Digite a descrição da conta:");
conta.descricao = leitura.nextLine();
System.out.println("Digite a data de vencimento da conta:");
conta.dataVencimento = leitura.nextLine();
System.out.println("Digite o tipo da conta:");
conta.tipo = leitura.nextLine();
System.out.println("Digite o valor da conta:");
conta.valor = leitura.nextFloat();
contas[i] = conta;
i++;
}
}
| [
"danieleduardoalm@gmail.com"
] | danieleduardoalm@gmail.com |
7cf15a7acce2a1f5bbdeb764e6e562b5735a50f5 | 1ccc79f83437df1e905bac7c0cff3fb4d51c0c73 | /OpentracingTest/src/test/java/HelloOpenTracing.java | bae5a5999e7b80754407826ca25725cf7a699209 | [] | no_license | Pikachu15103123/graduation_test | 055def4d78568a2d530c0d5fe6993e15650e2a17 | 745252b4d61b370d93a6ca5f14d2bc7db9c9f1f7 | refs/heads/master | 2021-07-04T09:53:34.101086 | 2019-05-23T05:35:18 | 2019-05-23T05:35:18 | 188,167,502 | 0 | 0 | null | 2020-10-13T13:23:59 | 2019-05-23T05:32:16 | JavaScript | UTF-8 | Java | false | false | 1,532 | java |
import com.google.common.collect.ImmutableMap;
import io.jaegertracing.internal.JaegerTracer;
import io.opentracing.Span;
import io.opentracing.Tracer;
//import lib.Tracing;
public class HelloOpenTracing {
private final Tracer tracer; // 来自Opentracing的开发接口Tracer,里面有SpanBuilder初始化Span的attribute
public HelloOpenTracing(Tracer tracer) {
this.tracer = tracer; //tracer接口是来自与Opentracing API
}
private void sayHellotoOpentracing(String helloTo) {
Span span = tracer.buildSpan("sayHello").start();// tracer创建一个span并使激活它
span.setTag("hello-to", helloTo); // 设置span的tag标签
String helloStr = String.format("Hello, %s!", helloTo);
span.log(ImmutableMap.of("event", "string-format", "value", helloStr));
// 对span设置日志
System.out.println(helloStr);
span.log(ImmutableMap.of("event", "println"));
// ImmutableMap是一个不可变集合,简单地说,如果一个
//对象实例不能被更改就是一个Immutable的对象,Java SDK提供的大量值对象,
//比如String等都是Immutable的对象。
span.finish();
}
public static void main(String[] args) {
if (args.length != 1) {
throw new IllegalArgumentException("Expecting one argument");
}
String helloTo = args[0];
try (JaegerTracer tracer = Tracing.init("Hello-Opentracing")) {
//for(int i=0;i<1000000;i++) {
new HelloOpenTracing(tracer).sayHellotoOpentracing(helloTo);
//}
//new HelloOpenTracing(tracer).sayHello(helloTo);
}
}
}
| [
"2637206895@qq.com"
] | 2637206895@qq.com |
2b43b9ff4f2201334d93849d7f481171275de809 | c833b01cb8d6a2d52e93e091fe44c2354ea5027f | /app/src/main/java/com/example/simpletodo/ItemsAdapter.java | 1fa37001e6f1d95f12c1b32facd44618d00ef6b1 | [
"Apache-2.0"
] | permissive | Paramadon/SimpleTodoFinal | fb71d2e3789276dc2da570a99adb9b4c2a6ddd96 | 66287dc22c31fb8f30510f77dc6fe68f5b1a8efc | refs/heads/master | 2023-02-15T13:49:30.868919 | 2021-01-12T04:03:07 | 2021-01-12T04:03:07 | 328,859,181 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,911 | java | package com.example.simpletodo;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import java.util.List;
//Responsible for displaying data from the model into a row in the recycler view
public class ItemsAdapter extends RecyclerView.Adapter<ItemsAdapter.ViewHolder>{
public interface OnClickListener{
void onItemClicked(int position);
}
public interface OnLongClickListener{
void onItemLongClicked(int position);
}
List<String>items;
OnLongClickListener longClickListener;
OnClickListener clickListener;
public ItemsAdapter(List<String> items,OnLongClickListener longClickListener,OnClickListener clickListener) {
this.items = items;
this.longClickListener = longClickListener;
this.clickListener = clickListener;
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
//Use layout inflator to inflate a view
View todoView = LayoutInflater.from(parent.getContext()).inflate(android.R.layout.simple_expandable_list_item_1,parent,false);
//wrap it inside a view holder and return it
return new ViewHolder(todoView);
}
//Responsible for binding data to a articular view holder
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
//Grab the item at the position
String item = items.get(position);
//Bind the item into the specified view holder
holder.bind(item);
}
//Tells the RV how many items are int the list
@Override
public int getItemCount() {
return items.size();
}
//Container to provide easy acess to vies that represents each row of the list
class ViewHolder extends RecyclerView.ViewHolder{
TextView tvItem;
public ViewHolder(@NonNull View itemView) {
super(itemView);
tvItem = itemView.findViewById(android.R.id.text1);
}
//Update the view inside of the view holder with this data
public void bind(String item) {
tvItem.setText(item);
tvItem.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
clickListener.onItemClicked(getAdapterPosition());
}
});
tvItem.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
//Notfiy the listener which position was long pressed
longClickListener.onItemLongClicked(getAdapterPosition());
return true;
}
});
}
}
}
| [
"parampreet0623@gmail.com"
] | parampreet0623@gmail.com |
59d7a48867ce9f41a20f00d7cca8fade6daa1552 | ff978881a37811e6d334456c89436a6f07586d73 | /src/main/java/org/suites/.svn/text-base/AbstractFunctionalTestCase.java.svn-base | 709b49de3ef7c3dcc3cbc9cf6161e18b4deb24c0 | [] | no_license | oleksiizozulenko/parallelrunner | eb9594e1be46e5d816455410c0596aef3998f64b | de6bee1dbf78b073b5ada60f9d61d0f231ac2616 | refs/heads/master | 2020-04-04T19:52:55.196735 | 2011-11-01T19:36:06 | 2011-11-01T19:36:06 | 2,673,946 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,757 | /**
*
*/
package org.suites;
/**
* @author oleksii.zozulenko
*/
public abstract class AbstractFunctionalTestCase
{
protected FuncTestStatus testStatus;
protected Integer testExecId;
/**
*
*/
public AbstractFunctionalTestCase()
{
}
public FuncTestStatus getTestStatus()
{
return testStatus;
}
public void setTestStatus(FuncTestStatus testStatus)
{
this.testStatus = testStatus;
}
/**
* Runs the test case and collects the results in TestResult.
*
* @throws Throwable
*/
public FuncTestResult run()
{
try
{
runBare();
if (this.testStatus == null)
{
this.testStatus = FuncTestStatus.passed;
}
}
catch (Throwable e)
{
Throwable cause = e.getCause();
e.printStackTrace(System.err);
if (cause != null)
{
cause.printStackTrace(System.err);
}
this.setTestStatus(FuncTestStatus.repead);
}
return getTestResult();
}
private FuncTestResult getTestResult()
{
return new FuncTestResult(this.testExecId, this.testStatus);
}
/**
* Runs the bare test sequence.
*
* @throws Throwable
* if any exception is thrown
*/
public void runBare() throws Throwable
{
Throwable exception = null;
try
{
setUp();
runTest();
}
catch (Throwable running)
{
exception = running;
}
finally
{
try
{
tearDown();
}
catch (Throwable tearingDown)
{
if (exception == null)
exception = tearingDown;
}
}
if (exception != null)
throw exception;
}
public abstract void tearDown() throws Throwable;
public abstract void runTest() throws Throwable;
public abstract void setUp() throws Throwable;
@Override
public String toString()
{
return this.getClass().getName();
}
}
| [
"akeem@goldenplanet.com"
] | akeem@goldenplanet.com | |
73b91b86d6aa9ecda5e03537676e1d78cff406c4 | 8e9c31052aa9855b84c813a7b274ec7d61196ad8 | /Milestone 3/src/main/java/de/tum/i13/shared/Utility.java | 8d83be01c7cffcda82c3656294828c938f182586 | [] | no_license | saurya1995/Practical-Course-Cloud-DataBases | c85e72ebe50a7d00dcdf3e36f30d369dab76fe52 | cc280e77c56fbe05ccd75c5275a6c95f6af51f4f | refs/heads/master | 2023-09-02T17:58:29.103224 | 2021-10-31T16:47:33 | 2021-10-31T16:47:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 970 | java | package de.tum.i13.shared;
import java.io.IOException;
import java.net.ServerSocket;
/**
* @authors Yacouba Cisse, Luca Corbucci, Fabian Danisch
*/
public class Utility {
/**
* Used to print an error message
*/
public static void retUnknownCommand() {
printEchoLine("Unknown command");
}
/**
* Used to print a message
* @param msg message that we want to print
*/
public static void printEchoLine(String msg) {
System.out.print("EchoClient> " + msg + "\n");
}
public static String byteToHex(byte[] in) {
StringBuilder sb = new StringBuilder();
for(byte b : in) {
sb.append(String.format("%02x", b));
}
return sb.toString();
}
public static int getFreePort() throws IOException {
try (ServerSocket socket = new ServerSocket(0)) {
socket.setReuseAddress(true);
return socket.getLocalPort();
}
}
}
| [
"tankado@live.it"
] | tankado@live.it |
8e29517a884d0249afdb6d2ca8b8e4446d0bfd72 | 4530c560c9c727bbb8aa98b1f938c3896d5ff276 | /src/main/java/DIMain.java | 7255146af003562461dfa2b338bf53e8a8d2532b | [] | no_license | Daniyyalh/playingWithDagger | b08731c0ef10a5486b8ae869f283de6c50d303f4 | d1e1c7e0e5c459d5088289506cecb0f0294e0721 | refs/heads/master | 2021-01-05T00:35:32.391565 | 2020-02-16T02:06:34 | 2020-02-16T02:06:34 | 240,816,679 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 140 | java | public class DIMain {
public static void main(String [] args){
Car car = new Car();
System.out.println(car);
}
}
| [
"22643013+Daniyyalh@users.noreply.github.com"
] | 22643013+Daniyyalh@users.noreply.github.com |
cf1cc36a4db2b452db50a36373ba49ffc9d0b501 | deb8130870dbed1836a957300713642c68c080d7 | /AgileD365Integration/src/main/java/com/x/agile/integration/exception/CustomException.java | 433ca9cffda3ab00dd554c62176e122bf80fe3ab | [] | no_license | vkeygarg/AgileD365 | 91e8d6e98676251eec36c55b4239f37c171122dd | d8506c79ced4e037dc74f1ba35141f1656a2f98b | refs/heads/main | 2023-03-02T01:53:24.123579 | 2021-02-13T22:20:14 | 2021-02-13T22:20:14 | 338,679,620 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 436 | java | package com.x.agile.integration.exception;
public class CustomException
extends Exception
{
private static final long serialVersionUID = 1L;
public CustomException() {}
public CustomException(String message, Throwable throwable)
{
super(message, throwable);
}
}
/* Location:
* Qualified Name: com.x.agile.integration.exception.CustomException
* Java Class Version: 8 (52.0)
* JD-Core Version: 0.7.1
*/ | [
"ravi.jig.patel@gmail.com"
] | ravi.jig.patel@gmail.com |
9f7b7a225c5b671992593550648ad4d8556413fa | 8238bc5b3398bca1bdfab9a18225eb3fbd893cfd | /app/src/main/java/com/example/hjy/movenurse/activity/ChildFirstNurseOrderActivity.java | 0226b0a426f18fd59665fad773b512cc66d1b2d7 | [] | no_license | SetAdapter/MoveNurse | 2a890ff9a456b9284df69f44fe2616bb306de386 | c4770363d3b136cbe1a3cf1237d39c07151be2af | refs/heads/master | 2020-04-23T14:02:05.946825 | 2019-02-18T05:12:30 | 2019-02-18T05:12:30 | 171,218,203 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,858 | java | package com.example.hjy.movenurse.activity;
import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.view.MotionEvent;
import android.view.inputmethod.InputMethodManager;
import android.widget.TextView;
import com.example.hjy.movenurse.R;
import com.example.hjy.movenurse.fragment.ChildEditFragment;
import com.example.hjy.movenurse.nursing.PatientInfoFragment;
import com.fy.base.BaseActivity;
import butterknife.BindView;
/**
* Created by Gab on 2017/9/15 0015.
*
*/
public class ChildFirstNurseOrderActivity extends BaseActivity {
@BindView(R.id.tvSelectLabel)
TextView tvSelectLabel;
@Override
protected int getContentView() {
return R.layout.activity_child_edit;
}
@Override
protected void init(Bundle savedInstanceState) {
tvTitle.setText("护理评估");
initInfoFragment();
}
private void initInfoFragment(){
PatientInfoFragment infoFragment = new PatientInfoFragment();
FragmentManager manager = getSupportFragmentManager();
FragmentTransaction transaction = manager.beginTransaction();
transaction.replace(R.id.fmPatientInfo, infoFragment);
ChildEditFragment editFragment = new ChildEditFragment();
transaction.replace(R.id.fmContent, editFragment);
transaction.commit();
}
/**
* 点击空白位置 隐藏软键盘
*/
@Override
public boolean onTouchEvent(MotionEvent event) {
if (null != this.getCurrentFocus()) {
InputMethodManager mInputMethodManager = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
return mInputMethodManager.hideSoftInputFromWindow(this.getCurrentFocus().getWindowToken(), 0);
}
return super.onTouchEvent(event);
}
}
| [
"383411934@qq.com"
] | 383411934@qq.com |
ee521c68dbfe407a34d58095785533b7b3c1efce | caf8e6e3649ee294c231cc6e36a539e0e0337184 | /DataBase project/src/LoginMain/View.java | 68513779213a193718863328db39e1a387caf23b | [] | no_license | Vitvicky/java | 7071ef400ae7ef4303d5190fbff5ce3ec8428f2f | 1be454e8157806427ae4c8386ee895f00ecec29a | refs/heads/master | 2021-01-10T19:27:02.747135 | 2013-05-23T13:36:47 | 2013-05-23T13:36:47 | null | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 2,120 | java | package LoginMain;
import java.sql.*;
import java.awt.*;
import javax.swing.*;
//import java.awt.event.*;
public class View extends JPanel {
private String user = "root"; // 数据库用户
private String password = "12345"; // 数据库用户密码
String url = "jdbc:mysql://localhost:3306/student?useUnicode=true&characterEncoding=utf-8";
private JTable table;
public View() {
super(); // 调用父类构造函数
String[] columnNames = { "编号", "姓名", "性别", "年龄", "院系", "学号","选择课程" }; // 列名
Object[][] rowData = new Object[20][7]; // 表格数据
setBackground(new Color(60, 70, 221));
try {
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection(url, user, password);
String sqlStr = "select * from student"; // 查询语句
PreparedStatement ps = con.prepareStatement(sqlStr); // 获取
// PreparedStatement
// 对象
ResultSet rs = ps.executeQuery(); // 执行查询
int count = 0;
while (rs.next()) { // 遍历查询结果
rowData[count][0] = rs.getInt("Number"); // 初始化数组内容
rowData[count][1] = rs.getString("Name");
rowData[count][2] = rs.getString("Sex");
//
rowData[count][3] = rs.getInt("Age");
rowData[count][4] = rs.getString("DepartName");
rowData[count][5] = rs.getInt("StudentNumber");
rowData[count][6] = rs.getInt("Course");
count++;
}
con.close(); // 关闭连接
} catch (Exception ex) {
ex.printStackTrace();
}
table = new JTable(rowData, columnNames); // 实例化表格
table.getColumn("编号").setMaxWidth(50);
table.getColumn("姓名").setMaxWidth(50);
table.getColumn("性别").setMaxWidth(50);
table.getColumn("年龄").setMaxWidth(50);
table.getColumn("院系").setMaxWidth(150);
table.getColumn("学号").setMaxWidth(100);
table.getColumn("选择课程").setMaxWidth(50);
add(new JScrollPane(table), BorderLayout.CENTER); // 增加组 件
// setSize(470, 440); //设置窗口尺寸
setBounds(0, 0, 500, 450);
setVisible(true); // 设置窗口可视
}
}
| [
"sduwzy1992@gmail.com"
] | sduwzy1992@gmail.com |
23ca1b754d15886ca7a4b3c64f893769d1b772e7 | e75607b8f38e46e5ee735db036a81a89826038e9 | /hy-service/src/test/java/com/chenfeng/hy/service/AppTest.java | c8121b90b882a0e9ded88507341831e4774a0183 | [] | no_license | wyh-chenfeng/hy | 7743a466cfa6a7759f52e9a4a98acbc41f866ef4 | f4d5478cbc66edf29c4db397b7a6310aa75b5853 | refs/heads/master | 2020-05-22T00:02:45.756421 | 2017-07-21T07:46:54 | 2017-07-21T07:46:54 | 62,778,742 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 651 | java | package com.chenfeng.hy.service;
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 );
}
}
| [
"xiaolyuh@163.com"
] | xiaolyuh@163.com |
5813e6f2b1466814a49d7fb5a6dce881abab2531 | 2e3c48d2f268d654f5f40eacaec2390884e884f7 | /AndroidDesktopPets/gen/com/luoxl/androidDesktopPets/BuildConfig.java | aa23f364efb5186be56adde23a3e7758abb19bd3 | [] | no_license | jiangeZh/AndroidDesktopPets | 95307ea7236b7d37b9d36c27dc3ddf0f4804723d | 4cf63efa158dbcfa74d27a81107c5d5104cd4abf | refs/heads/master | 2021-01-21T13:56:59.815211 | 2016-05-09T11:38:21 | 2016-05-09T11:38:21 | 54,715,731 | 3 | 5 | null | 2016-05-01T11:54:28 | 2016-03-25T11:50:43 | Java | UTF-8 | Java | false | false | 170 | java | /** Automatically generated file. DO NOT MODIFY */
package com.luoxl.androidDesktopPets;
public final class BuildConfig {
public final static boolean DEBUG = true;
} | [
"352072876@qq.com"
] | 352072876@qq.com |
62646d5be6d311ff6fea0e5953e71fec6a2ae976 | 68465e463a662b9ccd12525c02326aa359e912b6 | /huboot-task-client/src/main/java/com/task/client/exception/CronSequenceErrorException.java | 2364ae33156f7d413cf5e3d8ec73d2167a3ef502 | [] | no_license | qiangli524/myproject | d868e94daca660275eaac456e2117075cd901d41 | 56a605367606f7d7259e49a74454d8cbcdef45ce | refs/heads/master | 2020-07-02T03:45:13.010861 | 2019-03-25T02:04:43 | 2019-03-25T02:04:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 295 | java | package com.task.client.exception;
/**
* Created by Administrator on 2018/8/23 0023.
*/
public class CronSequenceErrorException extends RuntimeException{
public CronSequenceErrorException() {
}
public CronSequenceErrorException(String message) {
super(message);
}
}
| [
"437954760@qq.com"
] | 437954760@qq.com |
fa5c8cc872fb8ca82490be62264d1c2f7bd9186f | 6ee8b282388590ecfcaf03dd20d69bdb9abec5af | /gmall-admin-web/src/main/java/com/zmy/gmall/admin/pms/controller/PmsBrandController.java | db53a584d91c96a1887726063559e38305500c61 | [] | no_license | mingyve/gmall-parent | 10ad04c5cc8d9694cf5c7951dc8bb02d07350c5b | eb4537c43eb0060ae29ab8d5a5657f07f6ff510b | refs/heads/master | 2022-06-23T22:04:14.324414 | 2020-02-11T03:02:34 | 2020-02-11T03:02:34 | 238,656,378 | 2 | 0 | null | 2022-06-21T02:45:29 | 2020-02-06T09:53:36 | Java | UTF-8 | Java | false | false | 4,106 | java | package com.zmy.gmall.admin.pms.controller;
import com.alibaba.dubbo.config.annotation.Reference;
import com.zmy.gmall.pms.service.BrandService;
import com.zmy.gmall.pms.vo.PmsBrandParam;
import com.zmy.gmall.to.CommonResult;
import com.zmy.gmall.vo.PageInfoVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.log4j.Log4j2;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 品牌功能Controller
*/
@Log4j2
@CrossOrigin
@RestController
@Api(tags = "PmsBrandController",description = "商品品牌管理")
@RequestMapping("/brand")
public class PmsBrandController {
@Reference(version = "1.0")
private BrandService brandService;
@ApiOperation(value = "获取全部品牌列表")
@GetMapping(value = "/listAll")
public Object getList() {
//TODO 获取全部品牌列表 brandService.listAll()
return new CommonResult().success(null);
}
@ApiOperation(value = "添加品牌")
@PostMapping(value = "/create")
public Object create(@Validated @RequestBody PmsBrandParam pmsBrand, BindingResult result) {
CommonResult commonResult = new CommonResult();
//TODO 添加品牌
return commonResult;
}
@ApiOperation(value = "更新品牌")
@PostMapping(value = "/update/{id}")
public Object update(@PathVariable("id") Long id,
@Validated @RequestBody PmsBrandParam pmsBrandParam,
BindingResult result) {
CommonResult commonResult = new CommonResult();
//TODO 更新品牌
return commonResult;
}
@ApiOperation(value = "删除品牌")
@GetMapping(value = "/delete/{id}")
public Object delete(@PathVariable("id") Long id) {
CommonResult commonResult = new CommonResult();
//TODO 删除品牌
return commonResult;
}
@ApiOperation(value = "根据品牌名称分页获取品牌列表")
@GetMapping(value = "/list")
public Object getList(@RequestParam(value = "keyword", required = false) String keyword,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize) {
CommonResult commonResult = new CommonResult();
//TODO 根据品牌名称分页获取品牌列表
log.info(keyword);
PageInfoVo pageInfoVo = brandService.beandPageInfo(keyword,pageNum,pageSize);
return commonResult.success(pageInfoVo);
}
@ApiOperation(value = "根据编号查询品牌信息")
@GetMapping(value = "/{id}")
public Object getItem(@PathVariable("id") Long id) {
CommonResult commonResult = new CommonResult();
//TODO 根据编号查询品牌信息
return commonResult;
}
@ApiOperation(value = "批量删除品牌")
@PostMapping(value = "/delete/batch")
public Object deleteBatch(@RequestParam("ids") List<Long> ids) {
CommonResult commonResult = new CommonResult();
//TODO 批量删除品牌
return commonResult;
}
@ApiOperation(value = "批量更新显示状态")
@PostMapping(value = "/update/showStatus")
public Object updateShowStatus(@RequestParam("ids") List<Long> ids,
@RequestParam("showStatus") Integer showStatus) {
CommonResult commonResult = new CommonResult();
//TODO 批量更新显示状态
return commonResult;
}
@ApiOperation(value = "批量更新厂家制造商状态")
@PostMapping(value = "/update/factoryStatus")
public Object updateFactoryStatus(@RequestParam("ids") List<Long> ids,
@RequestParam("factoryStatus") Integer factoryStatus) {
CommonResult commonResult = new CommonResult();
//TODO 批量更新厂家制造商状态
return commonResult;
}
}
| [
"ZMY_gbl@qq.com"
] | ZMY_gbl@qq.com |
f719bf07a569ab3c6901dc6d47936e10f7dcd5e0 | 35d622faef7eee6a936ad8cec22053be613f0fd5 | /kps-sample-xmlsec/src/main/java/org/apache/xml/security/signature/XMLSignatureInput.java | eceead117ab94112ed9a42b4ba58aae956760ecb | [] | no_license | harunergul/KPS-Java | 8b05f474520dc1406e03ce29babd8d1f58847949 | d50d57d3a50d681e8408541094551c9a127a5fee | refs/heads/main | 2023-08-02T15:48:58.074017 | 2021-09-07T14:40:40 | 2021-09-07T14:40:40 | 397,215,532 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 19,828 | java | /*
* Copyright 1999-2009 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.xml.security.signature;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.xml.security.c14n.CanonicalizationException;
import org.apache.xml.security.c14n.implementations.CanonicalizerBase;
import org.apache.xml.security.c14n.implementations.Canonicalizer20010315OmitComments;
import org.apache.xml.security.c14n.implementations.Canonicalizer11_OmitComments;
import org.apache.xml.security.exceptions.XMLSecurityRuntimeException;
import org.apache.xml.security.utils.JavaUtils;
import org.apache.xml.security.utils.XMLUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.xml.sax.SAXException;
/**
* Class XMLSignatureInput
*
* @author Christian Geuer-Pollmann
* $todo$ check whether an XMLSignatureInput can be _both_, octet stream _and_ node set?
*/
@SuppressWarnings({"rawtypes", "unchecked"})
public class XMLSignatureInput implements Cloneable {
static org.apache.commons.logging.Log log =
org.apache.commons.logging.LogFactory.getLog
(XMLSignatureInput.class.getName());
/*
* The XMLSignature Input can be either:
* A byteArray like with/or without InputStream.
* Or a nodeSet like defined either:
* * as a collection of nodes
* * or as subnode excluding or not commets and excluding or
* not other nodes.
*/
/**
* Some InputStreams do not support the {@link java.io.InputStream#reset}
* method, so we read it in completely and work on our Proxy.
*/
InputStream _inputOctetStreamProxy = null;
/**
* The original NodeSet for this XMLSignatureInput
*/
Set _inputNodeSet = null;
/**
* The original Element
*/
Node _subNode = null;
/**
* Exclude Node *for enveloped transformations*
*/
Node excludeNode = null;
/**
*
*/
boolean excludeComments = false;
boolean isNodeSet = false;
/**
* A cached bytes
*/
byte[] bytes = null;
/**
* Some Transforms may require explicit MIME type, charset (IANA registered
* "character set"), or other such information concerning the data they are
* receiving from an earlier Transform or the source data, although no
* Transform algorithm specified in this document needs such explicit
* information. Such data characteristics are provided as parameters to the
* Transform algorithm and should be described in the specification for the
* algorithm.
*/
private String _MIMEType = null;
/**
* Field _SourceURI
*/
private String _SourceURI = null;
/**
* Node Filter list.
*/
List nodeFilters = new ArrayList();
boolean needsToBeExpanded = false;
OutputStream outputStream = null;
/**
* Construct a XMLSignatureInput from an octet array.
* <p>
* This is a comfort method, which internally converts the byte[] array into
* an InputStream
* <p>NOTE: no defensive copy</p>
* @param inputOctets an octet array which including XML document or node
*/
public XMLSignatureInput(byte[] inputOctets) {
// NO defensive copy
this.bytes = inputOctets;
}
/**
* Constructs a <code>XMLSignatureInput</code> from an octet stream. The
* stream is directly read.
*
* @param inputOctetStream
*/
public XMLSignatureInput(InputStream inputOctetStream) {
this._inputOctetStreamProxy=inputOctetStream;
}
/**
* Construct a XMLSignatureInput from a String.
* <p>
* This is a comfort method, which internally converts the String into a byte
* [] array using the {@link java.lang.String#getBytes()} method.
* @deprecated
* @param inputStr the input String which including XML document or node
*/
public XMLSignatureInput(String inputStr) {
try {
this.bytes = inputStr.getBytes("UTF-8");
} catch(UnsupportedEncodingException e) {
throw new RuntimeException("UTF-8 not supported", e);
}
}
/**
* Construct a XMLSignatureInput from a String with a given encoding.
* <p>
* This is a comfort method, which internally converts the String into a byte
* [] array using the {@link java.lang.String#getBytes()} method.
*
* @deprecated
* @param inputStr the input String with encoding <code>encoding</code>
* @param encoding the encoding of <code>inputStr</code>
* @throws UnsupportedEncodingException
*/
public XMLSignatureInput(String inputStr, String encoding)
throws UnsupportedEncodingException {
this(inputStr.getBytes(encoding));
}
/**
* Construct a XMLSignatureInput from a subtree rooted by rootNode. This
* method included the node and <I>all</I> his descendants in the output.
*
* @param rootNode
*/
public XMLSignatureInput(Node rootNode) {
this._subNode = rootNode;
}
/**
* Constructor XMLSignatureInput
*
* @param inputNodeSet
* @param usedXPathAPI
*/
public XMLSignatureInput(Set inputNodeSet) {
this._inputNodeSet = inputNodeSet;
}
/**
* Check if the structure needs to be expanded.
* @return true if so.
*/
public boolean isNeedsToBeExpanded() {
return needsToBeExpanded;
}
/**
* Set if the structure needs to be expanded.
* @param needsToBeExpanded true if so.
*/
public void setNeedsToBeExpanded(boolean needsToBeExpanded) {
this.needsToBeExpanded = needsToBeExpanded;
}
/**
* Returns the node set from input which was specified as the parameter of
* {@link XMLSignatureInput} constructor
*
* @return the node set
* @throws SAXException
* @throws IOException
* @throws ParserConfigurationException
* @throws CanonicalizationException
*/
public Set getNodeSet() throws CanonicalizationException,
ParserConfigurationException, IOException, SAXException {
return getNodeSet(false);
}
/**
* Returns the node set from input which was specified as the parameter of
* {@link XMLSignatureInput} constructor
* @param circumvent
*
* @return the node set
* @throws SAXException
* @throws IOException
* @throws ParserConfigurationException
* @throws CanonicalizationException
*/
public Set getNodeSet(boolean circumvent)
throws ParserConfigurationException, IOException, SAXException,
CanonicalizationException {
if (_inputNodeSet != null) {
return _inputNodeSet;
}
if (_inputOctetStreamProxy == null && _subNode != null) {
if (circumvent) {
XMLUtils.circumventBug2650(XMLUtils.getOwnerDocument(_subNode));
}
_inputNodeSet = new HashSet();
XMLUtils.getSet
(_subNode, _inputNodeSet, excludeNode, excludeComments);
return _inputNodeSet;
} else if (this.isOctetStream()) {
convertToNodes();
HashSet result = new HashSet();
XMLUtils.getSet(_subNode, result, null, false);
return result;
}
throw new RuntimeException(
"getNodeSet() called but no input data present");
}
/**
* Returns the Octect stream(byte Stream) from input which was specified as
* the parameter of {@link XMLSignatureInput} constructor
*
* @return the Octect stream(byte Stream) from input which was specified as
* the parameter of {@link XMLSignatureInput} constructor
* @throws IOException
*/
public InputStream getOctetStream() throws IOException {
if (_inputOctetStreamProxy instanceof FileInputStream) {
return _inputOctetStreamProxy;
} else {
return getResetableInputStream();
}
}
/**
* @return real octect stream
*/
public InputStream getOctetStreamReal () {
return this._inputOctetStreamProxy;
}
/**
* Returns the byte array from input which was specified as the parameter of
* {@link XMLSignatureInput} constructor
*
* @return the byte[] from input which was specified as the parameter of
* {@link XMLSignatureInput} constructor
*
* @throws CanonicalizationException
* @throws IOException
*/
public byte[] getBytes() throws IOException, CanonicalizationException {
if (bytes != null) {
return bytes;
}
InputStream is = getResetableInputStream();
if (is != null) {
// resetable can read again bytes.
if (bytes == null) {
is.reset();
bytes=JavaUtils.getBytesFromStream(is);
}
return bytes;
}
Canonicalizer20010315OmitComments c14nizer =
new Canonicalizer20010315OmitComments();
bytes = c14nizer.engineCanonicalize(this);
return bytes;
}
/**
* Determines if the object has been set up with a Node set
*
* @return true if the object has been set up with a Node set
*/
public boolean isNodeSet() {
return ((this._inputOctetStreamProxy == null
&& this._inputNodeSet != null) || isNodeSet);
}
/**
* Determines if the object has been set up with an Element
*
* @return true if the object has been set up with a Node set
*/
public boolean isElement() {
return (this._inputOctetStreamProxy == null && this._subNode != null
&& this._inputNodeSet == null && !isNodeSet);
}
/**
* Determines if the object has been set up with an octet stream
*
* @return true if the object has been set up with an octet stream
*/
public boolean isOctetStream() {
return ((this._inputOctetStreamProxy != null || bytes != null)
&& (this._inputNodeSet == null && _subNode == null));
}
/**
* Determines if {@link #setOutputStream} has been called with a
* non-null OutputStream.
*
* @return true if {@link #setOutputStream} has been called with a
* non-null OutputStream
*/
public boolean isOutputStreamSet() {
return outputStream != null;
}
/**
* Determines if the object has been set up with a ByteArray
*
* @return true is the object has been set up with an octet stream
*/
public boolean isByteArray() {
return (bytes != null
&& (this._inputNodeSet == null && _subNode == null));
}
/**
* Is the object correctly set up?
*
* @return true if the object has been set up correctly
*/
public boolean isInitialized() {
return this.isOctetStream() || this.isNodeSet();
}
/**
* Returns MIMEType
*
* @return MIMEType
*/
public String getMIMEType() {
return this._MIMEType;
}
/**
* Sets MIMEType
*
* @param MIMEType
*/
public void setMIMEType(String MIMEType) {
this._MIMEType = MIMEType;
}
/**
* Return SourceURI
*
* @return SourceURI
*/
public String getSourceURI() {
return this._SourceURI;
}
/**
* Sets SourceURI
*
* @param SourceURI
*/
public void setSourceURI(String SourceURI) {
this._SourceURI = SourceURI;
}
/**
* Method toString
* @inheritDoc
*/
public String toString() {
if (this.isNodeSet()) {
return "XMLSignatureInput/NodeSet/" + this._inputNodeSet.size()
+ " nodes/" + this.getSourceURI();
}
if (this.isElement()) {
return "XMLSignatureInput/Element/" + this._subNode
+ " exclude "+ this.excludeNode + " comments:" +
this.excludeComments +"/" + this.getSourceURI();
}
try {
return "XMLSignatureInput/OctetStream/" + this.getBytes().length
+ " octets/" + this.getSourceURI();
} catch (IOException iex) {
return "XMLSignatureInput/OctetStream//" + this.getSourceURI();
} catch (CanonicalizationException cex) {
return "XMLSignatureInput/OctetStream//" + this.getSourceURI();
}
}
/**
* Method getHTMLRepresentation
*
* @throws XMLSignatureException
* @return The HTML representation for this XMLSignature
*/
public String getHTMLRepresentation() throws XMLSignatureException {
XMLSignatureInputDebugger db = new XMLSignatureInputDebugger(this);
return db.getHTMLRepresentation();
}
/**
* Method getHTMLRepresentation
*
* @param inclusiveNamespaces
* @throws XMLSignatureException
* @return The HTML representation for this XMLSignature
*/
public String getHTMLRepresentation(Set inclusiveNamespaces)
throws XMLSignatureException {
XMLSignatureInputDebugger db = new XMLSignatureInputDebugger(this,
inclusiveNamespaces);
return db.getHTMLRepresentation();
}
/**
* Gets the exclude node of this XMLSignatureInput
* @return Returns the excludeNode.
*/
public Node getExcludeNode() {
return excludeNode;
}
/**
* Sets the exclude node of this XMLSignatureInput
* @param excludeNode The excludeNode to set.
*/
public void setExcludeNode(Node excludeNode) {
this.excludeNode = excludeNode;
}
/**
* Gets the node of this XMLSignatureInput
* @return The excludeNode set.
*/
public Node getSubNode() {
return _subNode;
}
/**
* @return Returns the excludeComments.
*/
public boolean isExcludeComments() {
return excludeComments;
}
/**
* @param excludeComments The excludeComments to set.
*/
public void setExcludeComments(boolean excludeComments) {
this.excludeComments = excludeComments;
}
/**
* @param diOs
* @throws IOException
* @throws CanonicalizationException
*/
public void updateOutputStream(OutputStream diOs)
throws CanonicalizationException, IOException {
updateOutputStream(diOs, false);
}
public void updateOutputStream(OutputStream diOs, boolean c14n11)
throws CanonicalizationException, IOException {
if (diOs == outputStream) {
return;
}
if (bytes != null) {
diOs.write(bytes);
} else if (_inputOctetStreamProxy == null) {
CanonicalizerBase c14nizer = null;
if (c14n11) {
c14nizer = new Canonicalizer11_OmitComments();
} else {
c14nizer = new Canonicalizer20010315OmitComments();
}
c14nizer.setWriter(diOs);
c14nizer.engineCanonicalize(this);
} else {
if (_inputOctetStreamProxy instanceof FileInputStream) {
byte[] buffer = new byte[4 * 1024];
int bytesread = 0;
while ((bytesread = _inputOctetStreamProxy.read(buffer)) != -1 ) {
diOs.write(buffer, 0, bytesread);
}
} else {
InputStream is = getResetableInputStream();
if (bytes != null) {
// already read write it, can be rea.
diOs.write(bytes, 0, bytes.length);
} else {
is.reset();
byte[] bytesT = new byte[1024];
int num = 0;
while ((num = is.read(bytesT)) > 0) {
diOs.write(bytesT, 0, num);
}
}
}
}
}
/**
* @param os
*/
public void setOutputStream(OutputStream os) {
outputStream = os;
}
protected InputStream getResetableInputStream() throws IOException {
if (_inputOctetStreamProxy instanceof ByteArrayInputStream) {
if (!_inputOctetStreamProxy.markSupported()) {
throw new RuntimeException("Accepted as Markable but not truly been"+_inputOctetStreamProxy);
}
return _inputOctetStreamProxy;
}
if (bytes != null) {
_inputOctetStreamProxy = new ByteArrayInputStream(bytes);
return _inputOctetStreamProxy;
}
if (_inputOctetStreamProxy == null)
return null;
if (_inputOctetStreamProxy.markSupported()) {
log.info("Mark Suported but not used as reset");
}
bytes = JavaUtils.getBytesFromStream(_inputOctetStreamProxy);
_inputOctetStreamProxy.close();
_inputOctetStreamProxy = new ByteArrayInputStream(bytes);
return _inputOctetStreamProxy;
}
/**
* @param filter
*/
public void addNodeFilter(NodeFilter filter) {
if (isOctetStream()) {
try {
convertToNodes();
} catch (Exception e) {
throw new XMLSecurityRuntimeException("signature.XMLSignatureInput.nodesetReference",e);
}
}
nodeFilters.add(filter);
}
/**
* @return the node filters
*/
public List getNodeFilters() {
// TODO Auto-generated method stub
return nodeFilters;
}
/**
* @param b
*/
public void setNodeSet(boolean b) {
isNodeSet = b;
}
void convertToNodes() throws CanonicalizationException,
ParserConfigurationException, IOException, SAXException {
DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
dfactory.setValidating(false);
dfactory.setNamespaceAware(true);
DocumentBuilder db = dfactory.newDocumentBuilder();
// select all nodes, also the comments.
try {
db.setErrorHandler(new org.apache.xml.security.utils
.IgnoreAllErrorHandler());
Document doc = db.parse(this.getOctetStream());
this._subNode = doc;
} catch (SAXException ex) {
// if a not-wellformed nodeset exists, put a container around it...
ByteArrayOutputStream baos = new ByteArrayOutputStream();
baos.write("<container>".getBytes("UTF-8"));
baos.write(this.getBytes());
baos.write("</container>".getBytes("UTF-8"));
byte result[] = baos.toByteArray();
Document document = db.parse(new ByteArrayInputStream(result));
this._subNode = document.getDocumentElement().getFirstChild().getFirstChild();
}
this._inputOctetStreamProxy = null;
this.bytes = null;
}
}
| [
"harunergul@outlook.com"
] | harunergul@outlook.com |
38065c2ea44ee52af05ea9b86b414498382a78cb | 282384a29e665595d813093ccd60712c9f923757 | /InstitutoBenedictoXVI/src/dominio/RegistroDuplicado.java | a28d02d2517ee4d4dd78cb877f81c946f17af28c | [] | no_license | wsinti/ProyectoPOO | 03f58809921beff5695100a79c2237900dafe71f | 38b9c1d307dc416f0d33531e098a8b126f2d82cd | refs/heads/master | 2021-01-24T03:08:55.846322 | 2012-08-03T02:21:59 | 2012-08-03T02:21:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 200 | java | package upc.edu.pe;
public class RegistroDuplicado extends Exception {
private static final long serialVersionUID = 1L;
public RegistroDuplicado(String message) {
super(message);
}
}
| [
"rdelgado1101@gmail.com"
] | rdelgado1101@gmail.com |
7db06ca3bf40474a8f806a4a0d65229161418d19 | 9d4990b15890ff10f887aae66a38887812c1f28f | /src/main/java/com/tennis/model/Player.java | 9fd70d8ac9bbac7ca35c8951bbf766378eba7cd7 | [] | no_license | aga-mn/TennisWebApplication | 626dda43bd918c3f86df553f2631972fa45379f7 | cdd1258e4f43ebb620c148fdb4606a90b688cbd7 | refs/heads/master | 2021-01-21T17:47:32.060103 | 2015-10-24T19:38:07 | 2015-10-24T19:38:07 | 26,825,604 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,085 | java | package com.tennis.model;
import javax.persistence.*;
import javax.persistence.Entity;
import javax.persistence.Table;
import org.hibernate.annotations.*;
import org.hibernate.annotations.CascadeType;
import java.util.Set;
@Entity
@Table (name = "player")
public class Player {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "player_id")
private int playerId;
@OneToOne(mappedBy="player")
///kasowanie na raz profilu i pleyera
@Cascade(value= CascadeType.DELETE)
private PlayerProfile playerProfile;
@Column(name = "first_name")
private String firstName;
@Column(name = "last_name")
private String lastName;
@Column(name = "gender")
private String gender;
@Column(name = "username", unique = true)
private String username;
@ManyToOne
@JoinColumn(name="club_id")
private Club club;
@OneToMany(mappedBy="player")
private Set<PlayerRanking> playerRankings;
public PlayerProfile getPlayerProfile() {
return playerProfile;
}
public void setPlayerProfile(PlayerProfile playerProfile) {
this.playerProfile = playerProfile;
}
public Club getClub() {
return this.club;
}
public void setClub(Club club) {
this.club = club;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public int getPlayerId() {
return playerId;
}
public void setPlayerId(int playerId) {
this.playerId = playerId;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
//testowy commit
} | [
"molda.nieweglowska@gmail.com"
] | molda.nieweglowska@gmail.com |
3534e89fb1ee9e27efe9b461114e4be9a5e08776 | ea604762a16d55dffb7dce62ed10d48cca3abba5 | /org.eclipse.scout.contacts.server/src/main/java/org/eclipse/scout/contacts/server/ServerServletFilter.java | 4e0f8595c3935f1321f8691800c2f03ce883c8a5 | [] | no_license | CarmenP55/contactos | e510ec84aae3ee0eb7460840c65eb69a7c4144e5 | 85ef09c44b6a496fb0a9562506523cb91d6c0504 | refs/heads/master | 2020-03-22T04:21:44.260681 | 2018-07-02T21:22:08 | 2018-07-02T21:22:08 | 139,492,813 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,296 | java | package org.eclipse.scout.contacts.server;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.eclipse.scout.rt.platform.BEANS;
import org.eclipse.scout.rt.server.commons.authentication.DevelopmentAccessController;
import org.eclipse.scout.rt.server.commons.authentication.ServiceTunnelAccessTokenAccessController;
import org.eclipse.scout.rt.server.commons.authentication.TrivialAccessController;
import org.eclipse.scout.rt.server.commons.authentication.TrivialAccessController.TrivialAuthConfig;
/**
* This is the main server side servlet filter.
*
* @author Camy
*/
public class ServerServletFilter implements Filter {
private TrivialAccessController m_trivialAccessController;
private ServiceTunnelAccessTokenAccessController m_tunnelAccessController;
private DevelopmentAccessController m_developmentAccessController;
@Override
public void init(FilterConfig filterConfig) throws ServletException {
m_trivialAccessController = BEANS.get(TrivialAccessController.class)
.init(new TrivialAuthConfig().withExclusionFilter(filterConfig.getInitParameter("filter-exclude")));
m_tunnelAccessController = BEANS.get(ServiceTunnelAccessTokenAccessController.class).init();
m_developmentAccessController = BEANS.get(DevelopmentAccessController.class).init();
}
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
final HttpServletRequest req = (HttpServletRequest) request;
final HttpServletResponse resp = (HttpServletResponse) response;
if (m_trivialAccessController.handle(req, resp, chain)) {
return;
}
if (m_tunnelAccessController.handle(req, resp, chain)) {
return;
}
if (m_developmentAccessController.handle(req, resp, chain)) {
return;
}
resp.sendError(HttpServletResponse.SC_FORBIDDEN);
}
@Override
public void destroy() {
m_developmentAccessController.destroy();
m_tunnelAccessController.destroy();
m_trivialAccessController.destroy();
}
}
| [
"camyp_p55@hotmail.com"
] | camyp_p55@hotmail.com |
b3df577070f6e575e174d841b1cae98a47ff34dd | b184fab16761f67eac0727724d698cb160a52507 | /src/main/java/com/itsure/front/mapper/BlogMapper.java | e0293b543dc5e0120df1d2d8ac6c855d4ab386dc | [] | no_license | loveblog1314/blog-front | 8807965043cf8ecd4312192fc45acf877828fe32 | 3963a70e3520e7ef661293ef46ab8a20336df354 | refs/heads/master | 2022-07-02T06:27:54.534093 | 2019-08-23T16:05:56 | 2019-08-23T16:05:56 | 202,967,229 | 0 | 0 | null | 2022-06-21T01:41:41 | 2019-08-18T06:16:19 | HTML | UTF-8 | Java | false | false | 1,042 | java | package com.itsure.front.mapper;
import com.itsure.front.entity.Article;
import com.itsure.front.entity.Menu;
import com.itsure.front.entity.Permission;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
@Mapper
public interface BlogMapper {
@Select("select * from sys_menu where parent_id = #{parentId}")
List<Menu> getMenus(Integer parentId);
@Select("select * from sys_permission where parent_id = #{parentId}")
List<Permission> getFrontMenu(Integer parentId);
@Select("select * from sys_article where menu_id = #{menuId} order by update_time desc limit #{index},#{limit}")
List<Article> getArticleByTimeDesc(@Param("menuId") int menuId,@Param("index") int index, @Param("limit") int limit);
@Select("select * from sys_article where id = #{id}")
Article getArticleById(int id);
@Select("select count(id) from sys_article where menu_id = #{id}")
Integer getArticleCountsById(int id);
}
| [
"zhangxiao@aifunai.com"
] | zhangxiao@aifunai.com |
a9ad3cf2924d7f3eb9cc1d16f488c37d32ed3ff2 | 0593962a764ff10febd8a1778ba5f9faf4b48567 | /app/src/main/java/mobisocial/musubi/feed/presence/SpamPresence.java | 012c86057eaa80b9f24e2a90fc52791c83fb3ea6 | [] | no_license | Jwu1317/MusubiCodes | 29f27cb65e84c71c8280ee913af8be8ef55c1cbc | 05e38fa209165f2a4acbe9be2a662b33383723d8 | refs/heads/master | 2020-04-06T03:36:38.312647 | 2016-07-10T01:52:19 | 2016-07-10T01:52:19 | 62,976,723 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,571 | java | /*
* Copyright 2012 The Stanford MobiSocial Laboratory
*
* 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 mobisocial.musubi.feed.presence;
import mobisocial.musubi.Helpers;
import mobisocial.musubi.feed.iface.FeedPresence;
import mobisocial.musubi.model.MObject;
import mobisocial.musubi.objects.StatusObj;
import mobisocial.socialkit.obj.MemObj;
import android.content.Context;
import android.net.Uri;
import android.widget.Toast;
/**
* Sends messages rapidly. For testing, not annoying friends!
*
*/
public class SpamPresence extends FeedPresence {
private boolean mShareSpam = false;
private SpamThread mSpamThread;
@Override
public String getName() {
return "Spam";
}
@Override
public void onPresenceUpdated(final Context context, final Uri feedUri, boolean present) {
if (mShareSpam) {
if (getFeedsWithPresence().size() == 0) {
Toast.makeText(context, "No longer spamming", Toast.LENGTH_SHORT).show();
mShareSpam = false;
mSpamThread = null;
}
} else {
if (getFeedsWithPresence().size() > 0) {
Toast.makeText(context, "Now spamming your friends", Toast.LENGTH_SHORT).show();
mShareSpam = true;
mSpamThread = new SpamThread(context);
mSpamThread.start();
}
}
}
class SpamThread extends Thread {
long WAIT_TIME = 500;
final Context mContext;
public SpamThread(Context context) {
mContext = context;
}
@Override
public void run() {
MemObj obj = StatusObj.from("StatusObj spam, StatusObj spam.");
while (mShareSpam) {
try {
Thread.sleep(WAIT_TIME);
} catch (InterruptedException e) {}
if (!mShareSpam) {
break;
}
Helpers.sendToFeeds(mContext, obj, getFeedsWithPresence());
}
}
}
}
| [
"Jeffrey@Jeffreys-MacBook-Pro-2.local"
] | Jeffrey@Jeffreys-MacBook-Pro-2.local |
a20e43d1bd1f04807a4e736c06a75fe5d0c91ca7 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/1/1_57dd917049de210bdabdeba04a5d1d06fa7322d6/ExperimentRunner/1_57dd917049de210bdabdeba04a5d1d06fa7322d6_ExperimentRunner_t.java | 02ac2da2871e4b2074ee39e7b4d9139cf7bb4337 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 2,439 | java | package pacman.experimentclient;
import static pacman.game.Constants.DELAY;
import java.util.Random;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
import pacman.controllers.Controller;
import pacman.entries.pacman.Parameters;
import pacman.entries.pacman.MyPacMan;
import pacman.game.Constants.MOVE;
import pacman.game.Game;
/**
* Provides methods for running a game of Ms Pac-Man with the parameters
* specified by some JavaScript.
*/
public class ExperimentRunner
{
private ScriptEngine engine;
public ExperimentRunner()
{
ScriptEngineManager factory = new ScriptEngineManager();
engine = factory.getEngineByName("JavaScript");
}
/**
* Runs a game using the specified script to set parameters, and returns
* the score.
* @param script
* @return The final score of the game.
* @throws ScriptException
*/
public int run(String script) throws ScriptException
{
Parameters parameters = new Parameters();
engine.put("parameters", parameters);
engine.eval(
"importPackage(Packages.pacman.entries.pacman);" +
"importPackage(Packages.pacman.entries.pacman.evaluators);" +
"importPackage(Packages.pacman.entries.pacman.evaluators.ensemble);" +
"importPackage(Packages.pacman.entries.pacman.neuralnetworks);" +
"importPackage(Packages.pacman.entries.pacman.neuralnetworks.ghosts);" +
"importPackage(Packages.pacman.entries.pacman.neuralnetworks.moveselectionstrategies);" +
"importPackage(Packages.pacman.entries.pacman.selectionpolicies);" +
"importPackage(Packages.pacman.controllers.examples);" +
"with (parameters) { " +
script +
"}");
return run(parameters);
}
/**
* Runs a game using the specified parameters, and returns the score.
* @param parameters
* @return The final score of the game.
*/
public int run(Parameters parameters)
{
Random random = new Random();
Game game = new Game(random.nextLong());
Controller<MOVE> pacman = new MyPacMan(parameters);
while (!game.gameOver())
{
game.advanceGame(
pacman.getMove(game.copy(), System.currentTimeMillis() + DELAY),
parameters.opponent.getMove(game.copy(), System.currentTimeMillis() + DELAY)
);
}
return game.getScore();
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
61f6976ac0829113aa0b64029bee8dda25d8fb8b | 4b48ec67582196958421220298aea14c97fa98bb | /Code/app/src/main/java/iut/cours/lifehealth/view/adapter/AdapterStepView.java | b962d3fa37ff12b49ce389673c6dcfb6c02c66ac | [] | no_license | guilhemelias/Ulfhednar | 16115a9f0bff804f95062c241b8c50581fd30498 | 45c77a573da8bd29ea7644ab7c4170523a14bcb7 | refs/heads/master | 2023-04-15T02:43:38.470191 | 2021-04-30T19:47:09 | 2021-04-30T19:47:09 | 363,240,312 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,226 | java | package iut.cours.lifehealth.view.adapter;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
import java.util.Date;
import java.util.Map;
import iut.cours.lifehealth.R;
import iut.cours.lifehealth.model.utils.DateUtil;
import iut.cours.lifehealth.view.holder.StepViewHolder;
/**
* A clas to adapt the display of the stepHistory
*/
public class AdapterStepView extends RecyclerView.Adapter {
private Map<Date, Integer> stepHistory;
private ArrayList<Date> date;
private ArrayList<Integer> step;
/**
* The constructor which create two list, splitting the map in two, for facilitate the display
* @param history the History Step Map
*/
public AdapterStepView(Map<Date,Integer> history){
this.stepHistory = history;
date = new ArrayList<Date>(stepHistory.keySet());
step = new ArrayList<Integer>(stepHistory.values());
}
/**
* a method for instanciete the view of a cell of the display
* @param parent the parent to get the context
* @param viewType the view
* @return the a new Holder with the cell
*/
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
LinearLayout stepLayout = (LinearLayout)LayoutInflater.from(parent.getContext()).inflate(R.layout.step_view_cell,parent,false);
return new StepViewHolder(stepLayout);
}
/**
* a method to bind the list to the modek
* @param holder the recycler view
* @param position the index of the lists
*/
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
((StepViewHolder)holder).getTextViewDate().setText(DateUtil.getStringFromDate(date.get(position)));
((StepViewHolder)holder).getTextViewStep().setText(step.get(position).toString());
}
/**
* a method to get the size of the map
* @return the size of the map
*/
@Override
public int getItemCount() {
return stepHistory.size();
}
}
| [
"guilhem.elias@gmail.com"
] | guilhem.elias@gmail.com |
2438aa3b9686ec1734bc3524a1fb4e2664b5cc88 | 493a8065cf8ec4a4ccdf136170d505248ac03399 | /net.sf.ictalive.service.owlseditor/src/control/impl/ControlConstructImpl.java | 867ab3c90d7fe60aa02c2a2fecb2686f56c05e8e | [] | no_license | ignasi-gomez/aliveclipse | 593611b2d471ee313650faeefbed591c17beaa50 | 9dd2353c886f60012b4ee4fe8b678d56972dff97 | refs/heads/master | 2021-01-14T09:08:24.839952 | 2014-10-09T14:21:01 | 2014-10-09T14:21:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 783 | java | /**
* <copyright>
* </copyright>
*
* $Id$
*/
package control.impl;
import control.ControlConstruct;
import control.ControlPackage;
import org.eclipse.emf.ecore.EClass;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Construct</b></em>'.
* <!-- end-user-doc -->
* <p>
* </p>
*
* @generated
*/
public abstract class ControlConstructImpl extends NamedElementImpl implements ControlConstruct
{
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ControlConstructImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return ControlPackage.Literals.CONTROL_CONSTRUCT;
}
} //ControlConstructImpl
| [
"salvarez@lsi.upc.edu"
] | salvarez@lsi.upc.edu |
a2a00c569092be51b24b0b80bb4996a5a8a1da81 | bb0c27eea9dfb84b0edbe86bbf4bbbd5ae37c099 | /app/src/main/java/com/example/thecountryapp/MainActivity.java | f1629864d4d70f8cd616605ec6487c4717d58040 | [] | no_license | PratiwiAshari/Country-App | ae1267702f40456375dc1fa0581084928b4e4a55 | 399edf7ee452560b0be8be62a5f391759821c00e | refs/heads/master | 2020-05-24T23:00:52.716396 | 2019-05-19T17:23:48 | 2019-05-19T17:23:48 | 187,506,647 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,269 | java | package com.example.thecountryapp;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
public class MainActivity extends Activity {
ImageView asia, afrika, amerika, australia, eropa;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
asia = (ImageView) findViewById(R.id.asia);
asia.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = null;
i = new Intent(getApplicationContext(), NegaraAsiaActivity.class);
startActivity(i);
}
});
afrika = (ImageView) findViewById(R.id.afrika);
afrika.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = null;
i = new Intent(getApplicationContext(), NegaraAfrikaActivity.class);
startActivity(i);
}
});
amerika = (ImageView) findViewById(R.id.amerika);
amerika.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = null;
i = new Intent(getApplicationContext(), NegaraAmerikaActivity.class);
startActivity(i);
}
});
australia = (ImageView) findViewById(R.id.australia);
australia.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = null;
i = new Intent(getApplicationContext(), NegaraAustraliaActivity.class);
startActivity(i);
}
});
eropa = (ImageView) findViewById(R.id.eropa);
eropa.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = null;
i = new Intent(getApplicationContext(), NegaraEropaActivity.class);
startActivity(i);
}
});
}
}
| [
"pratiwi.ashari101@gmail.com"
] | pratiwi.ashari101@gmail.com |
949b8e35d7082e0e573e222f3ccb61a3c23e2a17 | 516c94ffafa16079a1986b9d7ce7329de5df5b9f | /src/main/java/com/lllockkk/mbg/plugins/PrefixBaseColumnPlugin.java | 49b5938e47563fd6cd75b25c57b7b676bdf6734b | [] | no_license | lllockkk/mbgplugin | 8eee8ff86beddf14cbe28ea6431137065b1bb014 | 6aa3328894b3567c4162bb6f85081d13fe60531e | refs/heads/master | 2021-01-24T04:07:34.451796 | 2018-02-26T06:08:29 | 2018-02-26T06:08:29 | 122,920,572 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,073 | java | package com.lllockkk.mbg.plugins;
import org.mybatis.generator.api.GeneratedXmlFile;
import org.mybatis.generator.api.IntrospectedColumn;
import org.mybatis.generator.api.IntrospectedTable;
import org.mybatis.generator.api.PluginAdapter;
import org.mybatis.generator.api.dom.xml.*;
import org.mybatis.generator.config.MergeConstants;
import java.util.List;
public class PrefixBaseColumnPlugin extends PluginAdapter {
public static final String SQL_ID = "Prefix_Base_Column_List";
public boolean validate(List<String> warnings) {
return true;
}
@Override
public boolean sqlMapGenerated(GeneratedXmlFile sqlMap, IntrospectedTable introspectedTable) {
return super.sqlMapGenerated(sqlMap, introspectedTable);
}
@Override
public boolean sqlMapDocumentGenerated(Document document, IntrospectedTable introspectedTable) {
XmlElement root = document.getRootElement();
removeOrigin(root);
XmlElement sqlEle = new XmlElement("sql");
root.addElement(3, sqlEle);
sqlEle.addAttribute(new Attribute("id", SQL_ID));
// @mbggenerated 添加注释码,每次生成才会删除元素
String comment = "<!--" + MergeConstants.NEW_ELEMENT_TAG + "-->";
sqlEle.addElement(new TextElement(comment));
List<IntrospectedColumn> baseColumns = introspectedTable.getNonBLOBColumns();
String pre1 = "${pre}.";
String pre2 = " ${pre}_";
int maxSize = 100;
StringBuilder sb = new StringBuilder();
for (IntrospectedColumn columns : baseColumns) {
String columnName = columns.getActualColumnName();
sb.append(pre1).append(columnName).append(pre2).append(columnName).append(", ");
}
String text = sb.deleteCharAt(sb.length()-2).toString();
while (true) {
int index = text.lastIndexOf(",", maxSize - 1);
if (text.length() < maxSize || index == -1) {
sqlEle.addElement(new TextElement(text));
break;
} else {
String startStr = text.substring(0, index + 1);
sqlEle.addElement(new TextElement(startStr));
text = text.substring(index + 1);
}
}
return true;
}
// 删除原来的元素
private void removeOrigin(XmlElement root) {
for (Element element : root.getElements()) {
if (element instanceof XmlElement) {
XmlElement xmlElement = (XmlElement) element;
if (!"sql".equals(xmlElement.getName()))
continue;
List<Attribute> attributes = xmlElement.getAttributes();
for (Attribute attribute : attributes) {
if (!"id".equals(attribute.getName()))
continue;
if (SQL_ID.equals(attribute.getValue())) {
root.getElements().remove(xmlElement);
break;
}
}
}
}
}
}
| [
"link@jikon.cn"
] | link@jikon.cn |
05aa8db8e5da5f0c75dbd6a30f76913a76461356 | a378e495a6d805a6f620148bd204a90fff8356da | /vendor/Jat/jat/attitude/util/TextFieldPanel.java | 34667f9fbd0f934e6ca60c359454e68aea30ea3e | [] | no_license | zhufengGNSS/odtbx_nasa | 815a4b7b7075fb201efdfe020a132b6ef0f9bd38 | ce195f5b7d32b4972ee46e76fe9a04ccf3c3e2a7 | refs/heads/master | 2021-06-07T23:45:18.676574 | 2015-07-28T21:50:02 | 2015-07-28T21:50:02 | 74,735,982 | 2 | 2 | null | null | null | null | UTF-8 | Java | false | false | 5,148 | java | /* JAT: Java Astrodynamics Toolkit
*
* Copyright (c) 2003 United States Government as represented by the
* administrator of the National Aeronautics and Space Administration.
* All rights reserved.
*
* This file is part of JAT. JAT is free software; you can
* redistribute it and/or modify it under the terms of the
* NASA Open Source Agreement, version 1.3 or later.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* NASA Open Source Agreement for more details.
*
* You should have received a copy of the NASA Open Source Agreement
* along with this program; if not, write to the NASA Goddard
* Space Flight Center at opensource@gsfc.nasa.gov.
*
*/
package jat.attitude.util;
import java.awt.*;
import java.awt.event.*;
/**
* <P>
* The TextFieldPanel provides an efficient way of creating and organizing
* TextField objects.
* The main objective of this class is to create input fields with labels
* identifying the fields.
*
* @author Noriko Takada
* @version 1.0
*/
public class TextFieldPanel extends Panel // TextFieldPanel is itself a panel
{
// Create Font variables
Font titlef = new Font("Dialog", Font.BOLD, 16);
Font boldf = new Font("Dialog", Font.BOLD, 12);
Font italicf = new Font("Dialog", Font.ITALIC, 12);
Font normalf = new Font("Dialog", Font.PLAIN, 12);
// theFrame is used in main() for demonstration purpose
private static Frame theFrame;
GridBagConstraints constraint = new GridBagConstraints();
/**
* Construct a CheckboxPanel object
* @param title (String) Title of the panel
* @param labels (String[]) Labels
* @param fields (Strnig[]) Array of TextField
* @param c (Color) Background color of the panel
*
*/
public TextFieldPanel(String title, String labels[], TextField fields[], Color c)
{
// Since labels are supposed to be associated with the text fields,
// labels[] and fields[] are assumed to have the same length.
super();
int length = labels.length;
setLayout(new GridBagLayout());
constraint.fill = GridBagConstraints.BOTH; // components grow in both dimensions.
constraint.insets = new Insets(5,5,5,5); // 5-pixel mergins on all sides
this.setBackground(c);
Label titleLabel = new Label(title);
titleLabel.setFont(titlef);
setConstraint(0, 0, 3, 1, 0.0, 0.0);
add(titleLabel, constraint);
for(int i=0;i<length;++i)
{
Label label = new Label(labels[i], Label.RIGHT);
// column, row
setConstraint(0, i+1, 1, 1, 0.0, 0.0);
add(label ,constraint);
setConstraint(1, i+1, 1, 1, 0.0, 0.0);
add(fields[i], constraint);
}
Label label = new Label("");
setConstraint(0, length+1, 2, 1, 1.0, 1.0);
add(label ,constraint);
}// End of constructor
/**
* Demonstrates the use of TextFieldPanel class
* @param args (String[]) Argument
*/
public static void main(String[] args)
{
String title = "This is the title.";
String hobby[] = {"hobby1", "hobby2","hobby3"};
TextField hobbyfields[] = new TextField[3];
hobbyfields[0] = new TextField(5);
hobbyfields[1] = new TextField(5);
hobbyfields[2] = new TextField(5);
TextFieldPanel thePanel = new TextFieldPanel(title, hobby, hobbyfields, Color.red);
theFrame = new Frame();
theFrame.setTitle("TextFieldPanel Demo");
theFrame.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);}
});
theFrame.add( thePanel, BorderLayout.CENTER );
theFrame.setSize( 200, 300 );
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
theFrame.setLocation( (d.width - theFrame.getSize().width) / 2,
(d.height - theFrame.getSize().height) / 2);
theFrame.setVisible( true );
}
/**
* Sets the necessary constraint for the GridBagLayout layout
* @param gridx (int)
* @param gridy (int)
* @param gridwidth (int)
* @param gridheight (int)
* @param weightx (int)
* @param weighty (int)
*/
void setConstraint(int gridx, int gridy,int gridwidth,
int gridheight, double weightx, double weighty)
{
constraint.gridx = gridx;
constraint.gridy = gridy;
constraint.gridwidth = gridwidth;
constraint.gridheight = gridheight;
constraint.weightx = weightx;
constraint.weighty = weighty;
}
/*
public boolean getState(String label)
{
TextField fields[] = (TextField[])getComponents();
for(int i=0;i<fields.length;++i)
if(label.equals(fields[i].getLabel()))
return fields[i].getState();
return false;
}
public void setState(String label,boolean state)
{
TextField fields[] = (TextField[])getComponents();
for(int i=0;i<fields.length;++i)
if(label.equals(fields[i].getLabel()))
fields[i].setState(state);
}
*/
}// End of TextFieldPanel
| [
"eric.grejda@emergentspace.com"
] | eric.grejda@emergentspace.com |
e505bbe44afc3deacf96bcbeae307c02276bef4b | 4b2f1db2133964264ef92783600fdecc35e9cf7d | /app/src/test/java/ua/com/amicablesoft/android/wr/ExampleUnitTest.java | 3f4686eea374f3956ac7ce8a57f6a7454e2d456f | [] | no_license | OlhaTymoshenko/workout_reporter | 94d9e94d44cc53ced426869d9e1f1ad592dfeef5 | 44cd4403bb61f198b05a991d8c8879c3989a183d | refs/heads/master | 2021-01-11T00:28:58.666563 | 2018-05-18T10:54:25 | 2018-05-18T10:54:25 | 70,525,664 | 1 | 1 | null | 2018-05-31T15:44:23 | 2016-10-10T20:23:11 | Java | UTF-8 | Java | false | false | 408 | java | package ua.com.amicablesoft.android.wr;
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);
}
} | [
"olga.galiba@gmail.com"
] | olga.galiba@gmail.com |
5425aed302c1a467988d91180424e8020b668bd5 | 65da299462a02516cd735206bc695343e14733f4 | /src/Persistance/JDBCTaskCategory.java | 9bcebf261a2877816e2fd5b938ec08779cbd9863 | [] | no_license | Leyk/BuilDreams | 95dc400fff1bc2363b47d7c892d1a89d80ce50c5 | acb7dc34332963f52eb66663f21ed1049ebbfad6 | refs/heads/master | 2021-01-10T16:55:45.159823 | 2016-03-31T15:38:19 | 2016-03-31T15:38:19 | 54,191,737 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,250 | java | package Persistance;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import BusinessLogic.AbstractTaskCategory;
public class JDBCTaskCategory extends AbstractTaskCategory{
public JDBCTaskCategory() {
super();
// TODO Auto-generated constructor stub
}
public JDBCTaskCategory(int idTaskCategory, String name, int idSuperTaskCategory) {
super(idTaskCategory, name, idSuperTaskCategory);
// TODO Auto-generated constructor stub
}
@Override
public ArrayList<ArrayList<String>> loadAllDB() throws SQLException {
ArrayList<ArrayList<String>> res = new ArrayList<ArrayList<String>>();
String query = "Select idTaskCategory, name From TaskCategory;";
try {
ResultSet rs = JDBCSingleton.getInstance().RequestWithResultSet(query);
int i = 0;
while (rs.next()) {
ArrayList<String> temp = new ArrayList<String>();
for (int j= 0; j<2; j++){
temp.add(j,rs.getString(j+1));
}
res.add(i, temp);
i++;
}
}
catch (SQLException e) {
throw new SQLException("Erreur, loadAllDB");
}
return res;
}
@Override
public int saveInsertDB() throws SQLException {
String query = "INSERT INTO TaskCategory (name) VALUES ('" + this.getName() + "');";
try {
ResultSet rs = JDBCSingleton.getInstance().UpdateWithResultSet(query);
int id_AutoIncrement = 0;
if (rs.next()){
id_AutoIncrement=rs.getInt(1);
}
return id_AutoIncrement;
} catch (SQLException e) {
throw new SQLException("Erreur, saveInsertDB");
}
}
@Override
public void saveUpdateDB() throws SQLException {
String queryGeneralTask = "UPDATE TaskCategory Set name = '" + this.getName() + "' WHERE idTaskCategory = '" + this.getIdTaskCategory() + "');";
try {
JDBCSingleton.getInstance().UpdateWithoutResultSet(queryGeneralTask);
} catch (SQLException e) {
throw new SQLException("Erreur, saveInsertDB");
}
}
@Override
public void deleteDB() throws SQLException {
String queryGeneralTask = "Delete from TaskCategory where idTaskCategory = '" + this.getIdTaskCategory() + "';";
try {
JDBCSingleton.getInstance().UpdateWithoutResultSet(queryGeneralTask);
} catch (SQLException e) {
throw new SQLException("Erreur, saveInsertDB");
}
}
}
| [
"alexandreleconquerant@gmail.com"
] | alexandreleconquerant@gmail.com |
20c10b88368155ba99dbd2c0bdf5dda6a99842c2 | 2645b1bdae95a8a72bf204101f8504528e2c092c | /src/main/java/com/ywt/eureka_client/ServletInitializer.java | 3d9df2de41706efe1c4609d27476daf1e049d9a2 | [] | no_license | NeverMore93/eureka_client | 1a1f02095eca55c4bd37e5deb194c2ee50027853 | c9c61a1a584170aa695a38234ac56b278d0721f5 | refs/heads/master | 2020-03-18T19:17:20.899655 | 2018-06-01T09:46:05 | 2018-06-01T09:46:05 | 135,145,517 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 432 | java | package com.ywt.eureka_client;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
public class ServletInitializer extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(EurekaClientApplication.class);
}
}
| [
"1305882275@qq.com"
] | 1305882275@qq.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.