text stringlengths 10 2.72M |
|---|
package com.ybg.company.qvo;
import com.ybg.company.domain.Department;
public class DepartmentQvo extends Department {
}
|
package com.example.didiorder.biz;
import android.content.Context;
import android.util.Log;
import com.example.didiorder.bean.Dishes;
import com.example.didiorder.bean.Order;
import com.example.didiorder.bean.User;
import com.example.didiorder.bean.under_order;
import com.example.didiorder.tools.ErrorList;
import java.io.File;
import java.util.List;
import cn.bmob.v3.BmobObject;
import cn.bmob.v3.BmobQuery;
import cn.bmob.v3.BmobUser;
import cn.bmob.v3.datatype.BmobFile;
import cn.bmob.v3.listener.FindListener;
import cn.bmob.v3.listener.SaveListener;
import cn.bmob.v3.listener.UpdateListener;
import cn.bmob.v3.listener.UploadFileListener;
import rx.Observable;
/**
* Created by qqq34 on 2016/1/19.
*/
public class DishesBiz implements IDishesBiz {
@Override
public Observable<Dishes> updata(Context context, String name, Integer price, File file) {
Observable<Dishes> observable = Observable.create(subscriber -> {
if (file!=null){
BmobFile bmobFile = new BmobFile(file);
bmobFile.uploadblock(context, new UploadFileListener() {
@Override
public void onSuccess() {
Dishes dishes = new Dishes();
dishes.setName(name);
dishes.setPrice(price);
dishes.setImageUrl(bmobFile.getFileUrl(context));
dishes.save(context, new SaveListener() {
@Override
public void onSuccess() {
subscriber.onNext(dishes);
subscriber.onCompleted();
}
@Override
public void onFailure(int code, String msg) {
subscriber.onError(new Throwable(new ErrorList().getErrorMsg(code)));
}
});
}
@Override
public void onFailure(int i, String s) {
subscriber.onError(new Throwable(new ErrorList().getErrorMsg(i)));
}
});
}else {
Dishes dishes = new Dishes();
dishes.setPrice(price);
dishes.setName(name);
dishes.save(context, new SaveListener() {
@Override
public void onSuccess() {
subscriber.onNext(dishes);
subscriber.onCompleted();
}
@Override
public void onFailure(int code, String msg) {
subscriber.onError(new Throwable(new ErrorList().getErrorMsg(code)));
}
});
}
});
return observable;
}
@Override
public Observable<List<Dishes>> getDishesList(Context context,int page) {
Observable<List<Dishes>> observable = Observable.create(subscriber -> {
BmobQuery<Dishes> dishesBmobQuery = new BmobQuery<Dishes>();
dishesBmobQuery.setLimit(20);
dishesBmobQuery.setSkip((page-1)*20);
dishesBmobQuery.findObjects(context, new FindListener<Dishes>() {
@Override
public void onSuccess(List<Dishes> list) {
if (list.size()==0){
subscriber.onError(new Throwable("没有数据"));
}else {
subscriber.onNext(list);
subscriber.onCompleted();
}
}
@Override
public void onError(int i, String s) {
subscriber.onError(new Throwable(new ErrorList().getErrorMsg(i)));
}
});
});
return observable;
}
@Override
public Observable<Order> updataDeshes(Context context, Order order) {
Observable<Order> observable = Observable.create(subscriber -> {
order.save(context, new SaveListener() {
@Override
public void onSuccess() {
subscriber.onNext(order);
subscriber.onCompleted();
}
@Override
public void onFailure(int i, String s) {
subscriber.onError(new Throwable(new ErrorList().getErrorMsg(i)));
}
});
});
return observable;
}
@Override
public Observable<Boolean> updataUnderOrder(Context context, List<BmobObject> lis) {
Observable<Boolean> observable = Observable.create(subscriber -> {
new BmobObject().insertBatch(context, lis, new SaveListener() {
@Override
public void onSuccess() {
subscriber.onNext(true);
subscriber.onCompleted();
}
@Override
public void onFailure(int i, String s) {
subscriber.onError(new Throwable(new ErrorList().getErrorMsg(i)));
}
});
});
return observable;
}
@Override
public Observable<List<Order>> getOrderList(Context context,int page) {
Observable<List<Order>> observable = Observable.create(subscriber -> {
BmobQuery<Order> dishesBmobQuery = new BmobQuery<Order>();
dishesBmobQuery.setLimit(20);
dishesBmobQuery.order("-createdAt");
dishesBmobQuery.setSkip((page-1)*5);
dishesBmobQuery.findObjects(context, new FindListener<Order>() {
@Override
public void onSuccess(List<Order> list) {
if (list.size()==0){
subscriber.onError(new Throwable("没有数据"));
}
Log.d("TAG",list.size()+"");
subscriber.onNext(list);
subscriber.onCompleted();
}
@Override
public void onError(int i, String s) {
subscriber.onError(new Throwable(new ErrorList().getErrorMsg(i)));
}
});
});
return observable;
}
}
|
package org.buaa.ly.MyCar.logic;
import org.buaa.ly.MyCar.entity.Order;
import org.buaa.ly.MyCar.entity.Vehicle;
import org.buaa.ly.MyCar.entity.VehicleInfo;
import org.buaa.ly.MyCar.http.dto.OrderDTO;
import org.buaa.ly.MyCar.http.dto.VehicleDTO;
import org.buaa.ly.MyCar.http.dto.VehicleInfoDTO;
import javax.annotation.Nonnull;
import java.sql.Timestamp;
import java.util.Collection;
import java.util.List;
import java.util.Map;
public interface OrderLogic {
Order find(int id);
List<Order> find(Integer sid, Integer viid, Integer status);
List<Order> find(String identity, String phone, List<Integer> status, boolean exclude);
List<Order> find(String identity, List<Integer> status);
Order find(String oid);
// void find(String identity, String phone, List<Integer> status, boolean exclude,
// List<Order> orders,
// Map<Integer, Vehicle> vehicleMap,
// Map<Integer, VehicleInfo> vehicleInfoMap);
//
// void find(Integer sid, Integer viid, Integer status,
// List<Order> orders,
// Map<Integer, Vehicle> vehicleMap,
// Map<Integer, VehicleInfo> vehicleInfoMap);
List<Order> findHistoryOrders(Integer viid, Integer vid, Timestamp begin, Timestamp end);
List<Order> findRentingOrders(Integer sid, Integer viid, @Nonnull Timestamp begin, Timestamp end);
List<Order> findRentingOrders(Collection<Integer> sids, Integer viid, @Nonnull Timestamp begin, Timestamp end);
List<Order> findPendingOrders(Integer sid, Integer viid, Timestamp begin, @Nonnull Timestamp end);
List<Order> findPendingOrders(Collection<Integer> sids, Integer viid, Timestamp begin, @Nonnull Timestamp end);
void countByStatus(Integer status,
Map<Integer, Integer> viidStatusCount);
Order insert(Order order);
Order update(Order order);
Order update(int id, int status);
Order delete(int id);
}
|
package com.rc.portal.webapp.action;
import java.io.IOException;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import javax.servlet.http.HttpServletResponse;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import com.rc.app.framework.webapp.action.BaseAction;
import com.rc.portal.service.ICartManager;
import com.rc.portal.service.OpenSqlManage;
import com.rc.portal.service.TCartItemManager;
import com.rc.portal.service.TCartManager;
import com.rc.portal.service.TGoodsManager;
import com.rc.portal.service.TGroupGoodsManager;
import com.rc.portal.service.TMemberCollectManager;
import com.rc.portal.util.cookieManager;
import com.rc.portal.vo.TCart;
import com.rc.portal.vo.TCartExample;
import com.rc.portal.vo.TCartItem;
import com.rc.portal.vo.TCartItemExample;
import com.rc.portal.vo.TMember;
import com.rc.portal.vo.TMemberCollect;
import com.rc.portal.webapp.model.cart.CartItem;
import com.rc.portal.webapp.model.cart.CartParam;
import com.rc.portal.webapp.model.cart.CartSum;
public class CartAction extends BaseAction {
private static final long serialVersionUID = -8356530130533759951L;
private ICartManager cartmanager;
private OpenSqlManage opensqlmanage;
private TCartItemManager tcartitemmanager;
private TMemberCollectManager tmembercollectmanager;
private TGoodsManager tgoodsmanager;
private TGroupGoodsManager tgroupgoodsmanager;
public static String cartKey = "111yao";
private TCartManager tcartmanager;
private CartParam arg = new CartParam();
/**
* 只选择医卡通商品
*
* @throws IOException
* @throws SQLException
* @throws NumberFormatException
*/
public void chooseYKT() throws IOException, NumberFormatException, SQLException {
PrintWriter out = this.getResponse().getWriter();
// 1:只选医卡通(选中);2:取消医卡通按钮(非选中状态);3:全部选中;4全部不选中;
String type = this.getRequest().getParameter("type");
String cartId = this.getRequest().getParameter("cartId");
if (cartId == null || "".equals(cartId)) {// 为空
return;
}
if (type == null || "".equals(type)) {
type = "3";// 默认全选
}
Map<String,List<Long>> resultMap = cartmanager.updateCheckStatus(Long.valueOf(cartId),Integer.valueOf(type));
Map<String, Object> result = new HashMap<String, Object>();
result.put("status", "1");
result.put("check", resultMap.get("check"));
result.put("uncheck", resultMap.get("uncheck"));
JSONObject json = JSONObject.fromObject(result);
out.print(json);
out.close();
}
public static void main(String[] args) {
String uuid = UUID.randomUUID().toString().toUpperCase();
System.out.println(uuid);
}
public void getCartSum() throws IOException, SQLException{
HttpServletResponse reponse = this.getResponse();
reponse.setContentType("text/html;charset=utf-8");
PrintWriter out = reponse.getWriter();
String key = cookieManager.getCookieValueByName(this.getRequest(), CartAction.cartKey);
System.out.println("getcartsum = "+key);
TMember user = (TMember) this.getSession().getAttribute("member");
Map<String,Object> map = new HashMap<String,Object>();
map.put("uuid", key);
if(user!=null){
map.put("userid", user.getId());
}
// if(user!=null){
// System.out.println("同步.......");
// System.out.println("用户ID="+user.getId());
// }
map.put("priceType", "pc");
List<Map<String,Object>> list = opensqlmanage.selectForListByMap(map, "mycart.get-cart-item");
int cnt = 0;
for(Map<String,Object> m : list){
cnt = cnt + ((Integer)m.get("quantity"));
}
// System.out.println("cnt----------->"+cnt);
if(user!=null){
arg.setUserId(user.getId());
arg.setIslogin(true);
}else{
if(key==null || "null".equals(key) || "".equals(key)){ // 客户端 已经存在一个key
arg.setCartkey(createKey());
}else{
arg.setCartkey(key);
}
arg.setIslogin(false);
}
Map<String,Object> mp = cartmanager.accounts(arg);
BigDecimal money = (BigDecimal) mp.get("money");
BigDecimal youhui = (BigDecimal) mp.get("youhui");
CartSum cs = new CartSum();
cs.setCnt(cnt);
cs.setList(list);
cs.setYouhui(youhui);
cs.setZongjia(money);
JSONObject json = JSONObject.fromObject(cs);
out.print(json.toString());
out.close();
}
public void recommend() throws IOException{
PrintWriter out = this.getResponse().getWriter();
String key = cookieManager.getCookieValueByName(this.getRequest(), cartKey);
Map<String,Object> map = new HashMap<String,Object>();
map.put("key", key);
List<HashMap<String,Object>> list = opensqlmanage.selectForListByMap(map, "mycart.cart-recommend");
JSONArray json = JSONArray.fromObject(list);
out.print(json.toString());
out.close();
}
public String createKey(){
return UUID.randomUUID().toString().toUpperCase();
}
/**
* 再次购买
*
* @return
* @throws NumberFormatException
* @throws SQLException
*/
public String rebuy() throws NumberFormatException, SQLException {
String orderid = this.getRequest().getParameter("orderid");
if(orderid!=null&& !"".equals(orderid)){
cartmanager.againBuy(Long.parseLong(orderid));
}
return "rebuy";
}
public void addCart() throws SQLException, IOException{
// this.getResponse().setContentType("text/html");
Map<String,Object> rs = new HashMap<String,Object>();
PrintWriter out = this.getResponse().getWriter();
String gid = this.getRequest().getParameter("gid");
String cnt = this.getRequest().getParameter("cnt");
String key = cookieManager.getCookieValueByName(this.getRequest(), cartKey);
if(gid==null||"".equals(gid)||cnt==null||"".equals(cnt)){
writeObjectToResponse("参数有误", ContentType.text_html);
return;
}
int count = 1;
if(cnt!=null && !"0".equals(cnt) && !"".equals(cnt)){
count = Integer.parseInt(cnt);
}
arg = new CartParam();
TMember user = (TMember) this.getSession().getAttribute("member");
if(user!=null){
arg.setUserId(user.getId());
arg.setIslogin(true);
}else{
arg.setIslogin(false);
if(key==null){ // 客户端 已经存在一个key
key = createKey();
}
arg.setCartkey(key);
cookieManager.addCookie(this.getRequest(), this.getResponse(), cartKey, key, 1000000);
}
// arg.setCartkey(key);
arg.setGoodsId(Long.parseLong(gid));
// TGoods goods = tgoodsmanager.selectByPrimaryKey(Long.parseLong(gid));
long id = 0;
// if(goods.getIsSuit()==1){ // 如果是套装
// TGroupGoodsExample example = new TGroupGoodsExample();
// example.createCriteria().andGroupIdEqualTo(Long.parseLong(gid));
// List<TGroupGoods> list = tgroupgoodsmanager.selectByExample(example);
// for(TGroupGoods t : list){
// arg.setGoodsId(t.getGoodsid());
// id = cartmanager.addCart(arg,t.getGoodsNum());
// }
// }else{ // 正常商品
// id = cartmanager.addCart(arg,count);
// }
//pc端状态以这些为准,不够依次往下加;(WWF20160510)
//0:参数错误;-1:库存不足,-2:下架;-3:处方药;-4:商品数大于促销;-5:已经购买过该促销商品的促销个数;-6:剩一条不能在减了;-99:内部错误
//-7:单品不能超过199个
id = cartmanager.addCart(arg,count);
rs.put("status",id);
rs.put("key", key);
JSONObject json = JSONObject.fromObject(rs);
out.print(json.toString());
out.close();
}
/*public String getCart() throws SQLException{
String cookie = cookieManager.getCookieValueByName(this.getRequest(), "111yao");
System.out.println("cookie==============="+cookie);
String key = this.getRequest().getParameter("key");
arg.setCartkey(key);
TMember user = (TMember) this.getSession().getAttribute("member");
if(user!=null){
arg.setUserId(user.getId());
arg.setIslogin(true);
}
TCart c = cartmanager.getCart(arg);
this.getRequest().setAttribute("cart", c);
return "cart-detail";
}*/
public void checked() throws IOException, SQLException{
PrintWriter out = this.getResponse().getWriter();
String flag= this.getRequest().getParameter("x"); // 1选中 0不选中
String id = this.getRequest().getParameter("id");
// CartParam arg = nRew CartParam();
// cartmanager.updateGoodsCount(arg, flag);
String key = cookieManager.getCookieValueByName(this.getRequest(), cartKey);
arg = new CartParam();
TMember user = (TMember) this.getSession().getAttribute("member");
if(user!=null){
arg.setUserId(user.getId());
arg.setIslogin(true);
}else{
arg.setIslogin(false);
if(key==null){ // 客户端 已经存在一个key
key = createKey();
}
arg.setCartkey(key);
}
// arg.setCartkey(key);
Map<String,Object> map = new HashMap<String,Object>();
map.put("id", id);
map.put("flag", flag);
int n = opensqlmanage.updateByMap_drug(map, "mycart.check-cart-item");
//:0:医卡通不选全部选,1:医卡通选;2:全选
int ifYkt = cartmanager.ifYktOrAll(arg);
Map<String, Object> result = new HashMap<String, Object>();
result.put("data", n);
result.put("ifYkt", ifYkt);
JSONObject json = JSONObject.fromObject(result);
out.print(json.toString());
out.close();
}
public void allChecked() throws IOException, SQLException{
PrintWriter out = this.getResponse().getWriter();
String flag= this.getRequest().getParameter("x"); // 1选中 0不选中
String id = this.getRequest().getParameter("id");
Map<String,Object> map = new HashMap<String,Object>();
map.put("id", id);
map.put("flag", flag);
int n = opensqlmanage.updateByMap_drug(map, "mycart.all-check-cart-item");
out.print(n);
out.close();
}
public void del() throws IOException, NumberFormatException, SQLException{
this.getResponse().setContentType("text/html");
PrintWriter out = this.getResponse().getWriter();
String id = this.getRequest().getParameter("id");
tcartitemmanager.deleteByPrimaryKey(Long.parseLong(id));
out.print(1);
out.close();
}
public void collect() throws IOException, NumberFormatException, SQLException{
PrintWriter out = this.getResponse().getWriter();
String cartid = this.getRequest().getParameter("cartid");
String goodsid = this.getRequest().getParameter("goodsid");
TMember user = (TMember) this.getSession().getAttribute("member");
TMemberCollect record = new TMemberCollect();
record.setRelevanceId(Long.parseLong(goodsid));
record.setMemberId(user.getId());
record.setCollectType(0);
record.setCreateDate(new Date());
long a = tmembercollectmanager.insert(record);
int n = 0;
if(a>0){
n = tcartitemmanager.deleteByPrimaryKey(Long.parseLong(cartid));
}
out.print(1);
out.close();
}
public void isLogin() throws IOException{
PrintWriter out = this.getResponse().getWriter();
TMember user = (TMember) this.getSession().getAttribute("member");
int n= 1;
if(user==null){
n = 0;
}
out.print(n);
out.close();
}
public String page() throws SQLException{
// String key = this.getRequest().getParameter("key");
String key = cookieManager.getCookieValueByName(this.getRequest(), cartKey);
if("null".equals(key) || key==null){
key = cookieManager.getCookieValueByName(this.getRequest(), cartKey);
}
System.out.println("cookie==============="+key);
TMember user = (TMember) this.getSession().getAttribute("member");
Map<String,Object> map = new HashMap<String,Object>();
map.put("uuid", key);
if(user!=null){
map.put("userid", user.getId());
}
List<CartItem> list = new ArrayList<CartItem>();
map.put("priceType", "pc");
list = opensqlmanage.selectForListByMap(map, "mycart.get-cart-item");
this.getRequest().setAttribute("l", list);
TCartExample tCartExample = new TCartExample();
TCart tCart = null;
List<TCart> tCartList = null;
if(user!=null){
tCartExample.createCriteria().andMemberIdEqualTo(user.getId());
tCartList = tcartmanager.selectByExample(tCartExample);
}else if(key!=null&&!"".equals(key)){
tCartExample.createCriteria().andCartKeyEqualTo(key);
tCartList = tcartmanager.selectByExample(tCartExample);
}
if(tCartList!=null&&tCartList.size()>0){
tCart = tCartList.get(0);
}
this.getRequest().setAttribute("tcart", tCart);
if(user!=null){
arg.setUserId(user.getId());
arg.setIslogin(true);
}else{
arg.setIslogin(false);
if(key==null){ // 客户端 已经存在一个key
key = createKey();
}
arg.setCartkey(key);
}
//:0:医卡通不选全部选,1:医卡通选;2:全选
int ifYkt = cartmanager.ifYktOrAll(arg);
this.getRequest().setAttribute("ifYkt", ifYkt);
return "cart-page";
}
//异步获取购物车列表
public void getCartList() throws SQLException
{
String key = cookieManager.getCookieValueByName(this.getRequest(), cartKey);
if("null".equals(key) || key==null)
{
key = cookieManager.getCookieValueByName(this.getRequest(), cartKey);
}
TMember user = (TMember) this.getSession().getAttribute("member");
Map<String,Object> map = new HashMap<String,Object>();
map.put("uuid", key);
if(user != null)
{
map.put("userid", user.getId());
}
List<CartItem> list = new ArrayList<CartItem>();
list = opensqlmanage.selectForListByMap(map, "mycart.get-cart-item");
writeObjectToResponse(list, ContentType.application_json);
}
public void update() throws IOException, SQLException{
PrintWriter out = this.getResponse().getWriter();
String cartid = this.getRequest().getParameter("cartid");
String flag = this.getRequest().getParameter("flag");
String goodsid = this.getRequest().getParameter("goodsid");
String cnt = this.getRequest().getParameter("count");
String key = cookieManager.getCookieValueByName(this.getRequest(), cartKey);
Map<String,Object> rs = new HashMap<String,Object>();
int count = 1;
if(cnt!=null && !"".equals(cnt)){
count = Integer.parseInt(cnt);
}
if(cartid==null||"".equals(cartid)){
rs.put("data",0);
JSONObject json = JSONObject.fromObject(rs);
writeObjectToResponse(json.toString(), ContentType.application_json);
return;
}
TCartItem _item = tcartitemmanager.selectByPrimaryKey(Long.valueOf(cartid));
if(_item==null){
rs.put("data",-100);
JSONObject json = JSONObject.fromObject(rs);
writeObjectToResponse(json.toString(), ContentType.application_json);
return;
}
int n = cartmanager.updateGoodsCount(cartid,goodsid.trim(),count,flag);
if(n>0){ // 操作成功
CartParam arg = new CartParam();
arg.setCartkey(key);
TMember user = (TMember) this.getSession().getAttribute("member");
if(user!=null){
arg.setUserId(user.getId());
arg.setIslogin(true);
}else{
if("null".equals(key) || key==null){ // 客户端 已经存在一个key
arg.setCartkey(createKey());
}else{
arg.setCartkey(key);
}
arg.setIslogin(false);
}
//rs = cartmanager.accounts(arg);
}else{
if(n==-1){ // 购物车中只剩下一个商品了,不能做再减动作
}else if(n==-2){ // 库存不足
}else if(n==-3){ // 该商品正在做单品促销,超过了限制数量
}
TCartItem item = tcartitemmanager.selectByPrimaryKey(Long.parseLong(cartid));
rs.put("cnt", item==null?1:item.getQuantity());
}
System.out.println("update n = "+n);
rs.put("data",n);
JSONObject json = JSONObject.fromObject(rs);
out.print(json.toString());
out.close();
}
public void batchDelete() throws SQLException, IOException{
PrintWriter out = this.getResponse().getWriter();
String idstr = this.getRequest().getParameter("str");
List<Long> l = new ArrayList<Long>();
String[] array = idstr.split(",");
for(String s : array){
l.add(Long.parseLong(s));
}
TCartItemExample example = new TCartItemExample();
example.createCriteria().andIdIn(l);
int n = tcartitemmanager.deleteByExample(example);
out.print(n);
out.close();
}
public void money() throws IOException, SQLException{
PrintWriter out = this.getResponse().getWriter();
// String key = this.getRequest().getParameter("key");
String key = cookieManager.getCookieValueByName(this.getRequest(), cartKey);
System.out.println("money key = "+key);
CartParam arg = new CartParam();
arg.setCartkey(key);
TMember user = (TMember) this.getSession().getAttribute("member");
if(user!=null){
arg.setUserId(user.getId());
arg.setIslogin(true);
}else{
if("null".equals(key) || key==null){ // 客户端 已经存在一个key
arg.setCartkey(createKey());
}else{
arg.setCartkey(key);
}
arg.setIslogin(false);
}
Map<String,Object> map = new HashMap<String,Object>();
if (arg.isIslogin()) {
map.put("userid", arg.getUserId());
} else {
map.put("key", arg.getCartkey());
}
Map<String,Object> rs = cartmanager.accounts(arg);
// BigDecimal money = (BigDecimal)rs.get("money");
// int count = (Integer)rs.get("count");
// List<CartGift> giftList = (List<CartGift>)rs.get("gift");
map.put("isSelected", 1);
int cnt = (Integer)opensqlmanage.selectForObjectByMap(map, "mycart.get-cart-sum");
rs.put("count", cnt);
JSONObject j = JSONObject.fromObject(rs);
out.print(j.toString());
out.close();
}
/**
* 点击结算判断
* @throws IOException
* @throws SQLException
* @throws NumberFormatException
*/
public void jiesuanJudge() throws IOException, NumberFormatException, SQLException{
Map<String,Object> rs = new HashMap<String,Object>();
PrintWriter out = this.getResponse().getWriter();
String cartId = this.getRequest().getParameter("cartId");
TCart tCart = tcartmanager.selectByPrimaryKey(Long.valueOf(cartId));
if(tCart==null){//购物车为空
rs.put("status", -1);//
} else {
List<Map<String, Object>> cartItemList = cartmanager.jiesuanJudge(tCart.getId());
if (cartItemList == null || cartItemList.size() <= 0) {// 不存在库存不足,下架,处方药
rs.put("status", 1);
} else {//存在(库存不足,下架,处方药)
rs.put("status", -2);
rs.put("cartData", cartItemList);
//{"stock":3,"status":1,"quantity":7,"is_suit":0,"itemId":8973}
}
}
JSONObject json = JSONObject.fromObject(rs);
System.out.println(json.toString());
out.print(json.toString());
out.close();
}
/**
* 推荐商品加入购物车,不刷新当前页面;
* @throws IOException
*/
public void ajaxCartItemByGoodsId() throws IOException{
Map<String,Object> rs = new HashMap<String,Object>();
String goodId = this.getRequest().getParameter("goodsId");
TMember user = (TMember) this.getSession().getAttribute("member");
Map<String, Object> map = null;
Map<String, Object> param = new HashMap<String, Object>();
String key = cookieManager.getCookieValueByName(this.getRequest(), cartKey);
if(goodId!=null&&user!=null){
param.put("memberId", user.getId());
param.put("goodsId", goodId);
}else if(goodId!=null&&key!=null){
param.put("key", key);
param.put("goodsId", goodId);
}
map = (Map<String, Object>) opensqlmanage.selectObjectByObject(param, "mycart.selectDataByUserIdGoodId");
if(map==null){
rs.put("status", 0);
rs.put("dataItm", "");
}else{
rs.put("status", 1);
rs.put("dataItm", map);
}
JSONObject json = JSONObject.fromObject(rs);
this.writeObjectToResponse(json.toString(), ContentType.application_json);
// System.out.println(json.toString());
// out.print(json.toString());
// out.close();
}
public ICartManager getCartmanager() {
return cartmanager;
}
public void setCartmanager(ICartManager cartmanager) {
this.cartmanager = cartmanager;
}
public OpenSqlManage getOpensqlmanage() {
return opensqlmanage;
}
public void setOpensqlmanage(OpenSqlManage opensqlmanage) {
this.opensqlmanage = opensqlmanage;
}
public TCartItemManager getTcartitemmanager() {
return tcartitemmanager;
}
public void setTcartitemmanager(TCartItemManager tcartitemmanager) {
this.tcartitemmanager = tcartitemmanager;
}
public TMemberCollectManager getTmembercollectmanager() {
return tmembercollectmanager;
}
public void setTmembercollectmanager(TMemberCollectManager tmembercollectmanager) {
this.tmembercollectmanager = tmembercollectmanager;
}
@Override
public Object getModel() {
return null;
}
@Override
public void setModel(Object o) {
}
public TGoodsManager getTgoodsmanager() {
return tgoodsmanager;
}
public void setTgoodsmanager(TGoodsManager tgoodsmanager) {
this.tgoodsmanager = tgoodsmanager;
}
public TGroupGoodsManager getTgroupgoodsmanager() {
return tgroupgoodsmanager;
}
public void setTgroupgoodsmanager(TGroupGoodsManager tgroupgoodsmanager) {
this.tgroupgoodsmanager = tgroupgoodsmanager;
}
public TCartManager getTcartmanager() {
return tcartmanager;
}
public void setTcartmanager(TCartManager tcartmanager) {
this.tcartmanager = tcartmanager;
}
}
|
package com.jack.jkbase.service.impl;
import com.jack.jkbase.annotation.Operation;
import com.jack.jkbase.entity.SysArea;
import com.jack.jkbase.mapper.SysAreaMapper;
import com.jack.jkbase.service.ISysAreaService;
import com.jack.jkbase.util.Helper;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author LIBO
* @since 2020-09-23
*/
@Service
public class SysAreaServiceImpl extends ServiceImpl<SysAreaMapper, SysArea> implements ISysAreaService {
@Override
public List<SysArea> list() {
return list(Wrappers.lambdaQuery(SysArea.class).
orderByAsc(SysArea::getaLevel,SysArea::getaShoworder));
}
// 生成 树形的 easyui-treegrid 接受的数据格式 需要指定 _parentId ,可选字段 iconCls
public JSONObject getTreeArea() {
JSONObject jo = new JSONObject();
List<SysArea> list = list();
JSONArray ja = new JSONArray();
for (SysArea area : list) {
JSONObject joArea = (JSONObject) JSON.toJSON(area);
if (area.getaParentid() != 0)
joArea.put("_parentId", area.getaParentid());
// 第一层(顶层
if (area.getaLevel() == 1) {
joArea.put("iconCls", "fa fa-circle-o");
} else {
joArea.put("iconCls", "fa fa-circle");
}
ja.add(joArea);
}
jo.put("rows", ja);
return jo;
}
// 返回json格式的树形选择菜单
public JSONArray getTreeSelect(){
return tree(list(), 0);
}
// 菜单树形结构
private JSONArray tree(List<SysArea> menuList, int parentId) {
JSONArray childMenu = new JSONArray();
for (SysArea menu : menuList) {
if (parentId == menu.getaParentid()) {
JSONObject jo = new JSONObject();
jo.put("text",menu.getaAreaname());
jo.put("tags",new String[]{String.valueOf(menu.getAreaid())});
JSONArray c_node = tree(menuList, menu.getAreaid());
if(c_node.size()>0)jo.put("nodes", c_node);
childMenu.add(jo);
}
}
return childMenu;
}
//delete from sys_Area where AreaId = #{param1} or A_ParentId = #{param1}
/**
* 删除行政区连同子级
*/
@Operation(type=Helper.logTypeOperation,desc="删除行政区(连同其子级行政区)",arguDesc={"行政区ID"})
public boolean deleteAllByParent(int parentId){
return remove(Wrappers.lambdaQuery(SysArea.class).eq(SysArea::getAreaid, parentId).
or().eq(SysArea::getaParentid, parentId));
}
}
|
/*
* [y] hybris Platform
*
* Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved.
*
* This software is the confidential and proprietary information of SAP
* ("Confidential Information"). You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the
* license agreement you entered into with SAP.
*/
package de.hybris.platform.cmsfacades.media.validator.predicate;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import de.hybris.bootstrap.annotations.UnitTest;
import org.junit.Before;
import org.junit.Test;
@UnitTest
public class ValidFileTypePredicateTest
{
private static final String SUPPORTED_TYPES = "gif,png,jpeg,pdf";
private static final String VALID_TYPE = "png";
private static final String VALID_UPPER_CASE_TYPE = "PNG";
private static final String INVALID_TYPE = "invalid";
private final ValidFileTypePredicate predicate = new ValidFileTypePredicate();
@Before
public void setUp()
{
predicate.setSupportedTypes(SUPPORTED_TYPES);
}
@Test
public void shouldSupportFileType()
{
final boolean result = predicate.test(VALID_TYPE);
assertTrue(result);
}
@Test
public void shouldNotSupportFileType()
{
final boolean result = predicate.test(INVALID_TYPE);
assertFalse(result);
}
@Test
public void shouldSupportFileTypeCaseInsensitive()
{
final boolean result = predicate.test(VALID_UPPER_CASE_TYPE);
assertTrue(result);
}
}
|
package sickbook.Background;
public class Config {
public static final String EMAIL ="thesickbook@gmail.com";
public static final String PASSWORD ="TheSickestBook";
} |
package net.my.test.view;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import androidx.appcompat.app.AppCompatActivity;
import android.view.MotionEvent;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import java.util.ArrayList;
import net.my.test.utils.PrefManager;
import net.my.test.model.FallingItem;
import net.my.test.model.Player;
import net.my.test.model.Position;
import net.my.test.R;
public class GameView extends SurfaceView implements Runnable {
volatile boolean playing;
private Thread gameThread = null;
private Player player;
private AppCompatActivity context;
private Paint paint;
private Canvas canvas;
private SurfaceHolder surfaceHolder;
private int screenX;
private int screenY;
private ArrayList<FallingItem> fallingItems;
private Bitmap livesBitmap;
private Bitmap monitorBitmap;
private int bonusLives;
private Bitmap bgBitmap;
private GameOverListener listener;
private int intervalAnimation;
private Position futurePlayerPosition;
private int futurePlayerX;
private Bitmap tempLivesBitmap;
private Bitmap live1;
private Bitmap live2;
private Bitmap live3;
private Bitmap live4;
private Bitmap live5;
public GameView(AppCompatActivity context, int screenX, int screenY) {
super(context);
this.screenX = screenX;
this.screenY = screenY;
player = new Player(context, screenX, screenY);
this.context = context;
surfaceHolder = getHolder();
paint = new Paint();
fallingItems = new ArrayList<>();
fallingItems.add(new FallingItem(context, screenX, screenY));
BitmapFactory.Options options = new BitmapFactory.Options();
monitorBitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.monitor);
bgBitmap = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(context.getResources(), R.drawable.bg), screenX, screenY, false);
live1 = BitmapFactory.decodeResource(context.getResources(), R.drawable.live_1);
live2 = BitmapFactory.decodeResource(context.getResources(), R.drawable.live_2);
live3 = BitmapFactory.decodeResource(context.getResources(), R.drawable.live_3);
live4 = BitmapFactory.decodeResource(context.getResources(), R.drawable.live_4);
live5 = BitmapFactory.decodeResource(context.getResources(), R.drawable.live_5);
}
@Override
public void run() {
while (playing) {
update();
draw();
control();
}
}
private void update() {
int fallingItemMinY = screenY;
Player.State state = Player.State.NORMAL;
ArrayList<FallingItem> itemsForDelete = new ArrayList<>();
for (int i = 0; i < fallingItems.size(); i++) {
FallingItem fallingItem = fallingItems.get(i);
fallingItem.update();
if (fallingItemMinY > fallingItem.getY())
fallingItemMinY = fallingItem.getY();
if (fallingItem.getY() > fallingItem.getMaxY() + fallingItem.getBitmap().getHeight()) {
itemsForDelete.add(fallingItem);
}
//if collision occurs with player
if (fallingItem.getPosition().equals(player.getPosition())) {
if (Rect.intersects(player.getDetectCollision(), fallingItem.getDetectCollision())) {
switch (fallingItem.getType()) {
case BOOMB:
PrefManager.decreaseLives(context);
break;
case MACHINE_GUN:
PrefManager.saveNewPoints(50, context);
break;
case GUN:
PrefManager.saveNewPoints(40, context);
break;
case GAS_MASK:
PrefManager.saveNewPoints(30, context);
break;
case STRAPS:
PrefManager.saveNewPoints(20, context);
break;
case RESIDENT:
PrefManager.saveNewPoints(10, context);
break;
}
itemsForDelete.add(fallingItem);
}
}
}
if (fallingItems.size() > 0)
fallingItems.removeAll(itemsForDelete);
if (fallingItemMinY > 500)
fallingItems.add(new FallingItem(context, screenX, screenY));
player.update(state);
}
private void draw() {
if (surfaceHolder.getSurface().isValid()) {
canvas = surfaceHolder.lockCanvas();
canvas.drawBitmap(bgBitmap, 0, 0, paint);
paint.setColor(Color.WHITE);
if (intervalAnimation < 1)
canvas.drawBitmap(
player.getBitmap(),
player.getX(),
player.getY(),
paint);
else {
if (intervalAnimation == 3) {
player.setX(futurePlayerX);
player.setPosition(futurePlayerPosition);
}
Bitmap bitmap = player.getBitmap();
if (intervalAnimation == 4 || intervalAnimation == 3) {
Bitmap scaledBitmap = Bitmap.createScaledBitmap(bitmap, bitmap.getWidth() / 4, bitmap.getHeight() / 4, false);
canvas.drawBitmap(
scaledBitmap,
player.getX() + (bitmap.getWidth() - scaledBitmap.getWidth()) / 2,
player.getY() + (bitmap.getHeight() - scaledBitmap.getHeight()) / 2,
paint);
}
if (intervalAnimation == 5 || intervalAnimation == 2) {
Bitmap scaledBitmap = Bitmap.createScaledBitmap(bitmap, bitmap.getWidth() / 2, bitmap.getHeight() / 2, false);
canvas.drawBitmap(
scaledBitmap,
player.getX() + (bitmap.getWidth() - scaledBitmap.getWidth()) / 2,
player.getY() + (bitmap.getHeight() - scaledBitmap.getHeight()) / 2,
paint);
}
if (intervalAnimation == 6 || intervalAnimation == 1) {
Bitmap scaledBitmap = Bitmap.createScaledBitmap(bitmap, (int) (bitmap.getWidth() / 1.5), (int) (bitmap.getHeight() / 1.5), false);
canvas.drawBitmap(
scaledBitmap,
player.getX() + (bitmap.getWidth() - scaledBitmap.getWidth()) / 2,
player.getY() + (bitmap.getHeight() - scaledBitmap.getHeight()) / 2,
paint);
}
intervalAnimation--;
}
//drawing the enemies
for (int i = 0; i < fallingItems.size(); i++) {
canvas.drawBitmap(
fallingItems.get(i).getBitmap(),
fallingItems.get(i).getX(),
fallingItems.get(i).getY(),
paint
);
}
//lives
if (PrefManager.getLives(context) == 0) {
((GameOverListener) context).onGameOver();
playing = false;
gameThread.interrupt();
}
int lives = PrefManager.getLives(context);
if (lives != 0) {
switch (lives) {
case 1:
tempLivesBitmap = live1;
break;
case 2:
tempLivesBitmap = live2;
break;
case 3:
tempLivesBitmap = live3;
break;
case 4:
tempLivesBitmap = live4;
break;
case 5:
tempLivesBitmap = live5;
break;
}
canvas.drawBitmap(
tempLivesBitmap,
screenX / 2 - tempLivesBitmap.getWidth() / 2,
tempLivesBitmap.getHeight() / 2,
paint
);
}
int points = PrefManager.getPoints(context);
if (points / 1000 > bonusLives) {
if (PrefManager.getLives(context) < 5)
PrefManager.increaseLives(context);
bonusLives++;
}
String text = String.valueOf(points);
int measureText = (int) paint.measureText(text);
paint.setTextSize((float) (monitorBitmap.getHeight() * 0.9));
canvas.drawBitmap(
monitorBitmap,
screenX / 2 - monitorBitmap.getWidth() / 2,
(float) (tempLivesBitmap.getHeight() * 2.5),
paint
);
canvas.drawText(text, screenX / 2 - measureText / 2, (float) (tempLivesBitmap.getHeight() * 2.5 + (monitorBitmap.getHeight() * 0.8)), paint);
surfaceHolder.unlockCanvasAndPost(canvas);
}
}
private void control() {
try {
gameThread.sleep(17);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
public void pause() {
playing = false;
try {
gameThread.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
public void resume() {
playing = true;
gameThread = new Thread(this);
gameThread.start();
}
@Override
public boolean onTouchEvent(MotionEvent motionEvent) {
switch (motionEvent.getAction() & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_DOWN:
if (motionEvent.getX() > screenX * 2 / 3) {
intervalAnimation = 6;
futurePlayerX = ((screenX * 5 / 6) - (player.getBitmap().getWidth() / 2));
futurePlayerPosition = Position.RIGHT;
} else if (motionEvent.getX() > screenX / 3) {
intervalAnimation = 6;
futurePlayerX = ((screenX / 2) - (player.getBitmap().getWidth() / 2));
futurePlayerPosition = Position.CENTER;
} else {
intervalAnimation = 6;
futurePlayerX = ((screenX / 6) - (player.getBitmap().getWidth() / 2));
futurePlayerPosition = Position.LEFT;
}
break;
}
return true;
}
public interface GameOverListener {
void onGameOver();
}
} |
package kz.ogfox.serialization;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
public class serData {
public static void serData(String file_name, Object obj)
{
try {
FileOutputStream fos = new FileOutputStream(file_name + ".ser");
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(obj);
fos.close();
oos.close();
} catch (FileNotFoundException e) {
System.out.println("File not found");
System.exit(1);
} catch (IOException e) {
System.out.println("Object stream out/in error");
System.exit(2);
}
}
}
|
package com.yirmio.lockawayadmin.BL;
import java.util.ArrayList;
/**
* Created by yirmio on 3/24/2015.
*/
public enum OrderStatusEnum {
Active,
OnHold,
OnDelay,
OnMake,
Ready,
WaitingToStart,
Finish,
Canceled;
public static String[] getAllValues(){
String[] res = new String[OrderStatusEnum.values().length];
OrderStatusEnum[] r = OrderStatusEnum.values();
for (int i = 0; i < OrderStatusEnum.values().length; i++) {
res[i] = r[i].name();
}
return res;
}
public static OrderStatusEnum fromInt(int i) {
return values()[i];
}
}
|
// Make sure the downloaded jar file is in the classpath
public class CreateSubscription {
public static void main(String[] args)
{
//Specify your credentials
String username = "myAfricasTalkingUsername";
String apiKey = "myAfricasTalkingAPIKey";
// Specify the number that you want to subscribe
// Please ensure you include the country code (+254 for Kenya in this case)
String subscriptionPhoneNumber = "+254711YYYZZZ";
//Specify your Africa's Talking short code and keyword
String shortCode = "myAfricasTalkingShortCode";
String keyword = "myAfricasTalkingKeyword";
//Create an instance of our awesome gateway class and pass your credentials
AfricasTalkingGateway gateway = new AfricasTalkingGateway(username, apiKey);
// Thats it, submit data and we'll take care of the rest. Any errors will
// be captured in the Exception class as shown below
try {
JSONObject result = gateway.createSubscription(subscriptionPhoneNumber, shortCode, keyword);
//Only status Success signifies the subscription was successfully
System.out.println(result.getString("status"));
System.out.println(result.getString("description"));
}
catch(Exception e){
System.out.println(e.getMessage());
}
}
}
|
package com.osce.server.rest.system.org;
import com.osce.api.system.org.PfOrgService;
import com.osce.dto.common.PfBachChangeStatusDto;
import com.osce.entity.SysOrg;
import com.osce.enums.OperationTypeEnum;
import com.osce.server.security.CurrentUserUtils;
import com.osce.vo.PfTreeSelectVo;
import com.sm.open.care.core.ErrorCode;
import com.sm.open.care.core.ErrorMessage;
import com.sm.open.care.core.ResultObject;
import com.sm.open.care.core.enums.Status;
import com.sm.open.care.core.enums.YesOrNoNum;
import com.sm.open.care.core.utils.Assert;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @ClassName: PfOrgRestController
* @Description: 机构rest服务
* @Author yangtongbin
* @Date 2018/9/20 13:59
*/
@RestController
public class PfOrgRestController {
@Reference
private PfOrgService pfOrgService;
/**
* 机构zTree树
*
* @return
*/
@PreAuthorize("hasAnyRole('ROLE_ORG_MG','ROLE_SUPER')")
@PostMapping(value = "/pf/r/org/tree")
public ResultObject selectOrgTree() {
return ResultObject.createSuccess("selectOrgTree", ResultObject.DATA_TYPE_LIST,
pfOrgService.selectOrgTree());
}
/**
* 详情
*
* @return
*/
@PreAuthorize("hasAnyRole('ROLE_ORG_MG','ROLE_SUPER')")
@PostMapping(value = "/pf/r/org/detail")
public ResultObject selectOrgDetail(@RequestBody SysOrg dto) {
return ResultObject.createSuccess("selectOrgDetail", ResultObject.DATA_TYPE_LIST,
pfOrgService.selectOrgDetail(dto.getIdOrg()));
}
/**
* 新增
*
* @param dto
* @return
*/
@PreAuthorize("hasAnyRole('ROLE_ORG_MG','ROLE_SUPER')")
@PostMapping(value = "/pf/r/org/save")
public ResultObject addOrg(@RequestBody SysOrg dto) {
/* 参数校验 */
Assert.isTrue(StringUtils.isNotBlank(dto.getNaOrg()), "naOrg");
dto.setOperator(CurrentUserUtils.getCurrentUsername());
if (dto.getIdOrg() == null) {
dto.setCreator(CurrentUserUtils.getCurrentUsername());
}
return ResultObject.createSuccess("addOrg", ResultObject.DATA_TYPE_OBJECT, pfOrgService.addOrg(dto));
}
/**
* 删除
*
* @param dto
* @return
*/
@PreAuthorize("hasAnyRole('ROLE_ORG_MG','ROLE_SUPER')")
@PostMapping(value = "/pf/r/org/del")
public ResultObject delOrg(@RequestBody PfBachChangeStatusDto dto) {
/* 参数校验 */
Assert.isTrue(CollectionUtils.isNotEmpty(dto.getList()), "入参不能为空");
dto.setStatus(YesOrNoNum.YES.getCode());
dto.setOperator(CurrentUserUtils.getCurrentUsername());
return pfOrgService.delOrg(dto) ? ResultObject.createSuccess("delOrg", ResultObject.DATA_TYPE_OBJECT, true)
: ResultObject.create("delOrg", ErrorCode.ERROR_SYS_160002, ErrorMessage.MESSAGE_SYS_160002);
}
/**
* 停用、启用
*
* @param dto
* @return
*/
@PreAuthorize("hasAnyRole('ROLE_ORG_MG','ROLE_SUPER')")
@RequestMapping(value = "/pf/r/org/updateStatus")
public ResultObject updateOrgStatus(@RequestBody PfBachChangeStatusDto dto) {
/* 参数校验 */
Assert.isTrue(CollectionUtils.isNotEmpty(dto.getList()), "list");
dto.setOperator(CurrentUserUtils.getCurrentUsername());
dto.setOperationType(OperationTypeEnum.UPDATE_STATUS.getCode());
return pfOrgService.delOrg(dto) ? ResultObject.createSuccess("updateOrgStatus", ResultObject.DATA_TYPE_OBJECT, true)
: ResultObject.create("updateOrgStatus", ErrorCode.ERROR_SYS_160002, ErrorMessage.MESSAGE_SYS_160002);
}
/**
* 机构treeSelect
*
* @return
*/
@PreAuthorize("hasAnyRole('ROLE_ORG_MG','ROLE_SUPER')")
@PostMapping(value = "/pf/r/org/tree/select")
public List<PfTreeSelectVo> selectOrgTreeSelect() {
return pfOrgService.selectOrgTreeSelect();
}
}
|
package ru.usu.cs.fun.lang.reader_operations;
import ru.usu.cs.fun.back.Scope;
import ru.usu.cs.fun.back.Term;
import ru.usu.cs.fun.back.TermsSubstitutor;
import ru.usu.cs.fun.lang.UnaryOpearations;
import ru.usu.cs.fun.lang.types.FunReader;
import ru.usu.cs.fun.lang.types.FunString;
public class OpenString extends UnaryOpearations {
@Override
public Term calculate(Term arg, Scope scope) {
return new FunReader(((FunString) arg.eval(scope)).value);
}
@Override
public String toString(TermsSubstitutor substitutor) {
return "openString";
}
}
|
package fr.cp.translate.server;
import javax.inject.Singleton;
import fr.cp.translate.api.Translate;
@Singleton
public class TranslateProvider {
public Translate getTranslate(String comment){
return new Translate("Tr:" + comment);
}
}
|
/*
* GNUnetWebUI - A Web User Interface for P2P networks. <https://gitorious.org/gnunet-webui>
* Copyright 2013 Sébastien Moratinos <sebastien.moratinos@gmail.com>
*
*
* This file is part of GNUnetWebUI.
*
* GNUnetWebUI is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNUnetWebUI is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with GNUnetWebUI. If not, see <http://www.gnu.org/licenses/>.
*/
package org.gnunet.integration.fs;
import java.util.Date;
import org.gnunet.integration.internal.actorsystem.GMessage;
import org.gnunet.integration.internal.execute.CLIMsg;
import org.gnunet.integration.internal.execute.CLIResultMsg;
/**
*
* @author smoratinos
*
*/
@GMessage
public final class SearchResultMsg extends CLIResultMsg {
final String outputFileName;
final String uri;
public SearchResultMsg(final String msgId, final String reqId, final CLIMsg command, final Date date,
final String outputFileName,
final String uri) {
super(msgId, reqId, command, date);
this.outputFileName = outputFileName;
this.uri = uri;
}
public String getOutputFileName() {
return outputFileName;
}
public String getUri() {
return uri;
}
@Override
public String toString() {
return "SearchResultMsg [msgId=" + getMsgId() + ", reqId=" + getReqId() + ", outputFileName=" + outputFileName
+ ", uri=" + uri
+ ", command=" + getCommand() + ", date=" + getDate() + "]";
}
} |
package com.ittr.services.connector;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
public class Connection {
public HttpResponse getResponse(String url, DefaultHttpClient httpClient) throws IOException {
try {
HttpGet httpGet = new HttpGet(url);
httpGet.addHeader("accept", "application/json");
HttpResponse response = httpClient.execute(httpGet);
return response;
} catch (IOException e) {
throw e;
}
}
public String readData(HttpResponse response) throws Exception {
BufferedReader reader = null;
try {
reader = new BufferedReader(new InputStreamReader(
response.getEntity().getContent()));
StringBuffer data = new StringBuffer();
char[] dataLength = new char[1024];
int read;
while (((read = reader.read(dataLength)) != -1)) {
data.append(dataLength, 0, read);
}
return data.toString();
} finally {
if (reader != null)
reader.close();
}
}
}
|
package view;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import javax.swing.JButton;
public class FunctionButton extends JButton {
private static final long serialVersionUID = -6333664793255443487L;
private String text;
public FunctionButton(String text) {
this.text = text;
}
private void drawAlignedText(Graphics g, String text, int x, int y) {
g.drawString(text, x - g.getFontMetrics().stringWidth(text) / 2, y + g.getFont().getSize() / 2);
}
private void setFontSize(Graphics g, int newSize) {
g.setFont(new Font(g.getFont().getFontName(), Font.PLAIN, newSize));
}
@Override
public void paint(Graphics g) {
super.paint(g);
RenderingHints rh = new RenderingHints(
RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_GASP);
((Graphics2D)g).setRenderingHints(rh);
int strokeWidth = (int)((getWidth() > getHeight() ? getHeight() : getWidth()) * 0.05);
g.fillRect(0, 0, getWidth(), getHeight());
g.setColor(Color.WHITE);
g.fillRect(strokeWidth, strokeWidth, getWidth() - 2*strokeWidth, getHeight() - 2*strokeWidth);
setFontSize(g, (int)((getWidth() > getHeight() ? getHeight() : getWidth()) * 0.4));
g.setColor(Color.BLACK);
drawAlignedText(g, text, getWidth() / 2, getHeight() / 2);
}
}
|
package com.technology.share.service;
import com.technology.share.domain.Permission;
import java.util.List;
public interface PermissionService extends BaseService<Permission> {
/**
* 获取权限树
* @return 返回权限树
*/
List<Permission> permissionTree();
}
|
package com.geektech.todo.fragments;
import android.content.Intent;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import com.geektech.todo.R;
import com.geektech.todo.Storage;
import com.geektech.todo.Task;
import com.geektech.todo.TaskAdapter;
import java.util.ArrayList;
import static android.app.Activity.RESULT_OK;
/**
* A simple {@link Fragment} subclass.
*/
public class MainFragment extends Fragment {
Task task;
ArrayList<Task> tasks = new ArrayList<>();
ArrayList<String> getTodoList = new ArrayList<>();
TaskAdapter adapter;
private Task Task;
AddTaskFragment addTaskFragment = new AddTaskFragment();
public MainFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_main, container, false);
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
//getList();
ArrayList<Task> savedTasks = Storage.read(getContext());
tasks = savedTasks;
adapter = new TaskAdapter(tasks);
RecyclerView recyclerView = view.findViewById(R.id.recyclerview);
recyclerView.setAdapter(adapter);
Button button = view.findViewById(R.id.open);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
changeFragmet(addTaskFragment);
}
});
}
@Override
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK && requestCode == 42) {
Task task = (Task) data.getSerializableExtra("task");
tasks.add(task);
adapter.notifyDataSetChanged();
Storage.save(tasks, getContext());
}
}
public void changeFragmet(Fragment fragment) {
FragmentManager manager = getFragmentManager();
FragmentTransaction transaction = manager.beginTransaction();
transaction.replace(R.id.container, fragment);
transaction.commit();
}
public void getList() {
task = (Task) getArguments().getSerializable("list");
tasks.add(task);
}
}
|
package script.memodb.data;
import java.io.File;
import java.util.Collection;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.filefilter.FileFilterUtils;
import script.memodb.MemoData;
import script.memodb.MemoTable;
public class MemoTableImpl extends MemoTable {
private static final String EXTENSION_INDEXFILE = ".index";
private static final String EXTENSION_KEYSFILE = ".keys";
private static final String EXTENSION_CHUNKFILE = ".chunk";
private MDataFileGroup<IndexMDataFile> indexFileGroup;
private MDataFileGroup<KeysMDataFile> keysFileGroup;
private MDataFileGroup<ChunkMDataFile> chunkFileGroup;
public static final int STATUS_STANDBY = 0;
public static final int STATUS_OPENNING = 1;
public static final int STATUS_OPENNED = 10;
public static final int STATUS_CLOSED = 20;
private AtomicInteger status = new AtomicInteger(STATUS_STANDBY);
private static final String TAG = MemoTableImpl.class.getSimpleName();
@Override
public void addMemoData(MemoData data) {
}
@Override
public MemoCursor find(MemoIndexer byIndexer) {
return null;
}
@Override
public void open() {
if(status.compareAndSet(STATUS_STANDBY, STATUS_OPENNING)) {
// keysFile = new KeysMDataFile(path);
String tablePath = basePath + "/" + name;
} else {
throw new IllegalStateException("MemoTable " + getName() + " open failed because of illegal status " + status.get() + " expected " + STATUS_STANDBY);
}
}
@Override
public void close() {
}
}
|
package leetcode;
/*
* You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list.
You may assume the two numbers do not contain any leading zero, except the number 0 itself.
Example:
Input: (2 -> 4 -> 3) + (5 -> 6 -> 4)
Output: 7 -> 0 -> 8
Explanation: 342 + 465 = 807.
*/
public class _2_Add_Two_Numbers {
public static void main(String[] args) {
// TODO Auto-generated method stub
_2_Add_Two_Numbers o = new _2_Add_Two_Numbers();
int nums[]={2,4,3},nums2[]={5,6,4};
ListNode l1=ListNode.retListNode(nums),
l2 = ListNode.retListNode(nums2);
ListNode ret= o.addTwoNumbers(l1, l2);
ListNode.cout(ret);
}
public ListNode addTwoNumbers(ListNode l1, ListNode l2) {
if(l1==null)return l2;
else if(l2==null)return l1;
else{
ListNode ret=new ListNode(-1);
ListNode r=ret;
int tag=0;
while(l1!=null&&l2!=null){
int t1=l1.val+l2.val+tag;
tag=0;
if(t1>=10){
tag=1;
t1=t1%10;
}
ret.next= new ListNode(t1);
l1=l1.next;
l2=l2.next;
ret=ret.next;
}
while(l1!=null){
int t1=l1.val+tag;
tag=0;
if(t1>=10){
tag=1;
t1=t1%10;
}
ret.next= new ListNode(t1);
l1=l1.next;
ret=ret.next;
}
while(l2!=null){
int t1=l2.val+tag;
tag=0;
if(t1>=10){
tag=1;
t1=t1%10;
}
ret.next= new ListNode(t1);
l2=l2.next;
ret=ret.next;
}
if(tag==1){
ret.next= new ListNode(tag);
ret=ret.next;
}
return r.next;
}
}
}
|
package eu.lsem.bakalarka.webfrontend.action.secure;
import net.sourceforge.stripes.action.Resolution;
import net.sourceforge.stripes.action.ForwardResolution;
import net.sourceforge.stripes.action.DefaultHandler;
import net.sourceforge.stripes.integration.spring.SpringBean;
import eu.lsem.bakalarka.model.BasicThesis;
import eu.lsem.bakalarka.model.Thesis;
import eu.lsem.bakalarka.model.ThesesSelector;
import eu.lsem.bakalarka.dao.ThesesDao;
import eu.lsem.bakalarka.service.ThesesService;
import eu.lsem.bakalarka.webfrontend.action.BaseActionBean;
import java.util.List;
public class ThesesListActionBean extends BaseActionBean{
@SpringBean
private ThesesDao thesesDao;
@SpringBean
private ThesesService thesesService;
private List<BasicThesis> theses;
public List<BasicThesis> getTheses() {
return theses;
}
@DefaultHandler
public Resolution uncompleteMetadata() {
theses = thesesDao.getTheses(null, null, true, ThesesSelector.UNCOMPLETE_METADATA, null);
return new ForwardResolution("/WEB-INF/pages/secure/thesesList.jsp");
}
public Resolution missingData() {
theses = thesesDao.getTheses(null, null, true, ThesesSelector.MISSING_DATA, null);
return new ForwardResolution("/WEB-INF/pages/secure/thesesList.jsp");
}
public Resolution notSelectedDocumentation() {
theses = thesesDao.getTheses(null, null, true, ThesesSelector.NOT_SELECTED_DOCUMENTATION, null);
return new ForwardResolution("/WEB-INF/pages/secure/thesesList.jsp");
}
}
|
package 旋转数组中的最小数字;
public class RotateArray {
public static void main(String[] args) {
int[] a = {3,4,5,1,2};
System.out.println(rotate(a));
}
private static int rotate(int[] a){
int r = a.length - 1;
int l = 0;
while (l < r-1){
int mid = (l + r) >> 1;
if (a[l] <= a[mid]){
l = mid;
}else if (a[r] >= a[mid]){
r = mid;
}
}
return a[r];
}
}
|
package com.voiceman.cg.service;
import java.util.List;
import com.voiceman.cg.entities.CMD;
import com.voiceman.cg.entities.Users;
public interface IUserService {
public Users authentification(String login, String password);
public Users addUser(Users user);
public boolean updateUser(Users user);
public int deleteUser(int id);
public Users getUserByType(String typeUser);
public List<Users> getAllUser();
}
|
/**
* This part responsible for abstract factory and state pattern
*
*/
public class MDA_EFSM {
State state;
State ls[];
public MDA_EFSM(Data d,String type) {
ls = new State[8];
ls[0] = new Start(d,type,this);
ls[1] = new S0(d,type,this);
ls[2] = new S1(d,type,this);
ls[3] = new S2(d,type,this);
ls[4] = new S3(d,type,this);
ls[5] = new S4(d,type,this);
ls[6] = new S5(d,type,this);
ls[7] = new S6(d,type,this);
state = ls[0];
}
public void Activate(){
state.Activate();
}
public void Start(){
state.Start();
}
public void PayType(int t){
state.PayType(t);
}
public void Reject(){
state.Reject();
}
public void Cancel(){
state.Cancel();
}
public void Approved(){
state.Approved();
}
public void StartPump(){
state.StartPump();
}
public void Pump(){
state.Pump();
}
public void StopPump(){
state.StopPump();
}
public void SelectGas(int g){
state.SelectGas(g);
}
public void Receipt(){
state.Receipt();
}
public void NoReceipt(){
state.NoReceipt();
}
public void stateChangeop(int id){
state = ls[id];
}
}
|
package com.wipe.zc.journey.util;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import com.wipe.zc.journey.R;
import com.wipe.zc.journey.global.MyApplication;
import com.wipe.zc.journey.ui.activity.HomeActivity;
import com.wipe.zc.journey.ui.activity.MessageActivity;
/**
* 通知栏工具包
*/
public class NotificationUtil {
public static void notificationShow(String inviter, Context packageContext) {
NotificationManager nManager = (NotificationManager) MyApplication.getContext().getSystemService(Context.NOTIFICATION_SERVICE);
// Notification notification = new Notification(R.drawable.icon_icon, "行程好友邀请", System.currentTimeMillis());
Intent notificationIntent = new Intent(packageContext, MessageActivity.class);
PendingIntent contentIntent = PendingIntent.getActivity(packageContext, 0, notificationIntent, 0);
Context context = MyApplication.getContext();
CharSequence contentTitle = "好友邀请提示";
CharSequence contentText = inviter + " 想要添加你为好友";
Notification notification = new Notification.Builder(context)
.setTicker("行程好友邀请")
.setSmallIcon(R.drawable.icon_icon)
.setWhen(System.currentTimeMillis())
.setContentTitle(contentTitle)
.setContentText(contentText)
.setContentIntent(contentIntent)
.build();
// notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);
nManager.notify(0, notification);
}
}
|
/*
* 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 isc.isma4.figuras;
/**
*
* @author Alvarez
*/
public class Rombo extends Figura{
// D es igual a Diagonal mayor (Base)
// d es igual a Diagonal manor (Altura)
double D;
double d;
public Rombo (double D, double d){
this.D=D ;
this.d=d ;
}
@Override
public double getArea() {
return (D *d)/2;
}
} |
package com.tumit.test;
public interface IntegrationTest {
}
|
package pageObjects;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.How;
import org.openqa.selenium.support.PageFactory;
import core.BaseClass;
public class SearchProductPageObjects extends BaseClass {
public SearchProductPageObjects() {
PageFactory.initElements(driver, this);
}
@FindBy(how = How.XPATH, using = "//input[@id='search-field']")
private WebElement searchInputKey;
@FindBy(how = How.XPATH, using = "//a[@href='https://www.williams-sonoma.com/products/"
+ "le-creuset-signature-fry-pan/?pkey=s%7Cfry%20pan%7C333']/span")
private WebElement clickOnQuicklookLink;
public void SearchInputKey() {
searchInputKey.sendKeys("fry pan");
searchInputKey.sendKeys(Keys.ENTER);
}
public void ClickOnQuicklookLink() {
clickOnQuicklookLink.click();
}
}
|
package com.example.rikvanbelle.drinksafe;
import com.example.rikvanbelle.drinksafe.models.Beer;
import com.example.rikvanbelle.drinksafe.models.DrinkActivity;
import com.example.rikvanbelle.drinksafe.models.User;
import org.junit.Test;
import java.util.Date;
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 DrinkActivityTest {
User user = new User("Rik", "Van Belle", "rik_van_belle@live.be", "test", new Date(), 68, 180, 'M');
DrinkActivity drinkActivity = new DrinkActivity(user);
@Test
public void addBeer() throws Exception {
Beer beerOne = new Beer("Witkap", 5.4, "Bier uit Ninove", "");
Beer beerTwo = new Beer("Jupiler", 4.6, "Gewoon bier", "");
drinkActivity.addBeerToList(beerOne);
assertEquals(drinkActivity.getListOfBeers().size(), 1);
drinkActivity.addBeerToList(beerOne);
assertEquals(drinkActivity.getListOfBeers().size(), 1);
drinkActivity.addBeerToList(beerTwo);
assertEquals(drinkActivity.getListOfBeers().size(), 2);
}
@Test
public void checkTime() throws Exception {
assertNotNull(drinkActivity.getStartTime());
assertNull(drinkActivity.getEndTime());
drinkActivity.stopActivity();
assertNotNull(drinkActivity.getEndTime());
}
} |
/**
*
*/
package ucl.cs.testingEmulator.core;
import java.awt.GridBagLayout;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Dimension;
import javax.swing.JCheckBox;
import java.awt.GridBagConstraints;
import javax.swing.JButton;
import javax.swing.JScrollPane;
import javax.swing.JEditorPane;
/**
* @author -Michele Sama- aka -RAX-
*
* University College London
* Dept. of Computer Science
* Gower Street
* London WC1E 6BT
* United Kingdom
*
* Email: M.Sama (at) cs.ucl.ac.uk
*
* Group:
* Software Systems Engineering
*
*/
public class ConsoleJPanel extends JPanel {
private static final long serialVersionUID = 1L;
private JPanel jPanelSouth = null;
private JCheckBox jCheckBoxUseColors = null;
private JCheckBox jCheckBoxPrintInfo = null;
private JButton jButtonSave = null;
private JButton jButtonClear = null;
private JScrollPane jScrollPane = null;
private JEditorPane jEditorPane = null;
/**
* This is the default constructor
*/
public ConsoleJPanel() {
super();
initialize();
}
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
this.setSize(459, 200);
this.setLayout(new BorderLayout());
this.add(getJPanelSouth(), BorderLayout.SOUTH);
this.add(getJScrollPane(), BorderLayout.CENTER);
}
/**
* This method initializes jPanelSouth
*
* @return javax.swing.JPanel
*/
private JPanel getJPanelSouth() {
if (jPanelSouth == null) {
GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
gridBagConstraints3.gridx = 3;
gridBagConstraints3.gridy = 0;
GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
gridBagConstraints2.gridx = 2;
gridBagConstraints2.gridy = 0;
GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
gridBagConstraints1.gridx = 1;
gridBagConstraints1.gridy = 0;
GridBagConstraints gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
jPanelSouth = new JPanel();
jPanelSouth.setLayout(new GridBagLayout());
jPanelSouth.add(getJCheckBoxUseColors(), gridBagConstraints);
jPanelSouth.add(getJCheckBoxPrintInfo(), gridBagConstraints1);
jPanelSouth.add(getJButtonSave(), gridBagConstraints2);
jPanelSouth.add(getJButtonClear(), gridBagConstraints3);
}
return jPanelSouth;
}
/**
* This method initializes jCheckBoxUseColors
*
* @return javax.swing.JCheckBox
*/
private JCheckBox getJCheckBoxUseColors() {
if (jCheckBoxUseColors == null) {
jCheckBoxUseColors = new JCheckBox();
jCheckBoxUseColors.setText("UseColors");
}
return jCheckBoxUseColors;
}
/**
* This method initializes jCheckBoxPrintInfo
*
* @return javax.swing.JCheckBox
*/
private JCheckBox getJCheckBoxPrintInfo() {
if (jCheckBoxPrintInfo == null) {
jCheckBoxPrintInfo = new JCheckBox();
jCheckBoxPrintInfo.setText("PrintInfo");
}
return jCheckBoxPrintInfo;
}
/**
* This method initializes jButtonSave
*
* @return javax.swing.JButton
*/
private JButton getJButtonSave() {
if (jButtonSave == null) {
jButtonSave = new JButton();
jButtonSave.setText("Save");
}
return jButtonSave;
}
/**
* This method initializes jButtonClear
*
* @return javax.swing.JButton
*/
private JButton getJButtonClear() {
if (jButtonClear == null) {
jButtonClear = new JButton();
jButtonClear.setText("Clear");
}
return jButtonClear;
}
/**
* This method initializes jScrollPane
*
* @return javax.swing.JScrollPane
*/
private JScrollPane getJScrollPane() {
if (jScrollPane == null) {
jScrollPane = new JScrollPane();
jScrollPane.setViewportView(getJEditorPane());
}
return jScrollPane;
}
/**
* This method initializes jEditorPane
*
* @return javax.swing.JEditorPane
*/
private JEditorPane getJEditorPane() {
if (jEditorPane == null) {
jEditorPane = new JEditorPane();
}
return jEditorPane;
}
} // @jve:decl-index=0:visual-constraint="10,10"
|
package com.cloudogu.smeagol.wiki.infrastructure;
import org.springframework.hateoas.RepresentationModel;
import java.util.Objects;
public class DirectoryEntryResource extends RepresentationModel<DirectoryResource> {
private final String name;
private final String type;
public DirectoryEntryResource(String name, String type) {
this.name = name;
this.type = type;
}
public String getName() {
return name;
}
public String getType() {
return type;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
if (!super.equals(o)) {
return false;
}
DirectoryEntryResource resource = (DirectoryEntryResource) o;
return Objects.equals(name, resource.name) &&
Objects.equals(type, resource.type);
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode(), name, type);
}
}
|
package br.com.conspesca.service;
import java.util.List;
import javax.ejb.Stateless;
import javax.inject.Inject;
import br.com.conspesca.model.Peixe;
import br.com.conspesca.repository.PeixeRepository;
@Stateless
public class PeixeService {
@Inject
private PeixeRepository peixeRepository;
public void salvar(Peixe peixe){
this.peixeRepository.save(peixe);
}
public Peixe findPeixeByID(int id){
return this.peixeRepository.find(id);
}
public void removePeixeByID(int id){
this.peixeRepository.delete(id);
}
public List<Peixe> findAllPeixe(){
return this.peixeRepository.findAll();
}
public List<Peixe> findPeixeByQuery(String query){
return this.peixeRepository.findPeixeByQuery(query);
}
}
|
/*
* [y] hybris Platform
*
* Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved.
*
* This software is the confidential and proprietary information of SAP
* ("Confidential Information"). You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the
* license agreement you entered into with SAP.
*/
package de.hybris.platform.commerceservices.util;
import de.hybris.bootstrap.annotations.UnitTest;
import de.hybris.platform.commerceservices.search.pagedata.PageableData;
import de.hybris.platform.commerceservices.search.pagedata.SearchPageData;
import org.junit.Assert;
import org.junit.Test;
/**
* The integration test for {@link CommerceSearchUtils}.
*/
@UnitTest
public class CommerceSearchUtilsTest
{
@Test
public void shouldGetAllOnOnePagePageableData()
{
final PageableData pageableData = CommerceSearchUtils.getAllOnOnePagePageableData();
Assert.assertNotNull("pageableData", pageableData);
Assert.assertEquals("CurrentPage", 0, pageableData.getCurrentPage());
Assert.assertEquals("PageSize", -1, pageableData.getPageSize());
Assert.assertEquals("Sort", "asc", pageableData.getSort());
}
@Test
public void shouldCreateEmptySearchPageData()
{
final SearchPageData searchPageData = CommerceSearchUtils.createEmptySearchPageData();
Assert.assertNotNull("searchPageData", searchPageData);
Assert.assertNotNull("Results", searchPageData.getResults());
Assert.assertEquals("ResultsSize", 0, searchPageData.getResults().size());
Assert.assertNotNull("Pagination", searchPageData.getPagination());
Assert.assertEquals("Pagination result size", 0, searchPageData.getPagination().getTotalNumberOfResults());
Assert.assertNotNull("Sorts", searchPageData.getSorts());
Assert.assertEquals("Sort Size", 0, searchPageData.getSorts().size());
}
}
|
// Sun Certified Java Programmer
// Chapter 2, P117_2
// Object Orientation
class DogTest {
public static void main(String[] args) {
Animal animal = new Animal();
Dog d = (Dog) animal; // compiles but fails later
}
}
|
package com.cristovantamayo.ubsvoce.repositories;
/**
* Repositório para Geocode implementando JpaRepository<Local>.
*/
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import com.cristovantamayo.ubsvoce.entities.Local;
@Repository
public interface LocalRepository extends JpaRepository<Local, Long> {
}
|
package com.api.conf;
public class DefaultConf {
public static void initialize(Configuration conf){
if(conf.get(VarConstants.VAR_MYIBTAIS_DATASOURCE)==null){
conf.set(VarConstants.VAR_MYIBTAIS_DATASOURCE,"ds-meta-hsqldb.xml");
}
if(conf.get(VarConstants.VAR_FILE_ROOT_DIR)==null){
conf.set(VarConstants.VAR_FILE_ROOT_DIR,"/home/k8s/tomcat/tmp/");
}
if(conf.get(VarConstants.VAR_ICE_KEY_PASSWORD)==null){
conf.set(VarConstants.VAR_ICE_KEY_PASSWORD,"abcd123");
}
}
}
|
/*
* @(#)ViewSourceAction.java 1.0 19. Mai 2007
*
* Copyright (c) 2007 by the original authors of JHotDraw
* and all its contributors.
* All rights reserved.
*
* The copyright of this software is owned by the authors and
* contributors of the JHotDraw project ("the copyright holders").
* You may not use, copy or modify this software, except in
* accordance with the license agreement you entered into with
* the copyright holders. For details see accompanying license terms.
*/
package org.jhotdraw.samples.svg.action;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.util.prefs.Preferences;
import org.jhotdraw.app.*;
import org.jhotdraw.app.action.*;
import javax.swing.*;
import org.jhotdraw.samples.svg.*;
import org.jhotdraw.samples.svg.io.*;
import org.jhotdraw.util.ResourceBundleUtil;
import org.jhotdraw.util.prefs.PreferencesUtil;
/**
* ViewSourceAction.
*
* @author Werner Randelshofer
* @version 1.0 19. Mai 2007 Created.
*/
public class ViewSourceAction extends AbstractViewAction {
private ResourceBundleUtil labels = ResourceBundleUtil.getLAFBundle("org.jhotdraw.samples.svg.Labels");
public final static String ID = "viewSource";
/** Creates a new instance. */
public ViewSourceAction(Application app) {
super(app);
labels.configureAction(this, ID);
}
public void actionPerformed(ActionEvent e) {
SVGView p = (SVGView) getActiveView();
SVGOutputFormat format = new SVGOutputFormat();
format.setPrettyPrint(true);
ByteArrayOutputStream buf = new ByteArrayOutputStream();
try {
format.write(buf, p.getDrawing());
String source = buf.toString("UTF-8");
final JDialog dialog = new JDialog(
(Frame) SwingUtilities.getWindowAncestor(p.getComponent())
);
dialog.setTitle(p.getTitle());
dialog.setResizable(true);
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
JTextArea ta = new JTextArea(source);
ta.setWrapStyleWord(true);
ta.setLineWrap(true);
JScrollPane sp = new JScrollPane(ta);
//sp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
dialog.getContentPane().add(sp);
dialog.setSize(400, 400);
dialog.setLocationByPlatform(true);
Preferences prefs = Preferences.userNodeForPackage(getClass());
PreferencesUtil.installFramePrefsHandler(prefs, "viewSource", dialog);
dialog.addWindowListener(new WindowAdapter() {
@Override public void windowClosed(WindowEvent evt) {
getApplication().removeWindow(dialog);
}
});
getApplication().addWindow(dialog, getActiveView());
dialog.setVisible(true);
} catch (IOException ex) {
ex.printStackTrace();
}
}
}
|
package com.javarush.task.task24.task2401;
/*
Создание своего интерфейса-маркера
*/
public class Solution {
public static void main(String[] args) throws UnsupportedInterfaceMarkerException {
SelfInterfaceMarkerImpl obj = new SelfInterfaceMarkerImpl();
Util.testClass(obj);
}
public class Util {
// Пример того, как можно использовать интерфейс-маркер
// Этот метод подходит только для классов, реализующих SelfInterfaceMarker
public static void testClass(SelfInterfaceMarker interfaceMarker) throws UnsupportedInterfaceMarkerException {
if (interfaceMarker == null) {
throw new UnsupportedInterfaceMarkerException();
} else {
for (Method method : interfaceMarker.getClass().getDeclaredMethods()) {
System.out.println(method);
}
}
}
}
public interface SelfInterfaceMarker {
}
public class UnsupportedInterfaceMarkerException extends Exception {
}
public class SelfInterfaceMarkerImpl implements SelfInterfaceMarker {
public void a() {
}
public void b() {
}
}
}
|
package interviews.others;
public class Peloton {
// how garbage collector recycle memory
// does synchronized can be used on Constructor and class?
// four lunch mode
class MyHashMap {
}
}
|
package chapterTwo;
public class LinkedListUtil {
public static ListNode createList(int[] data) {
ListNode head = null;
if (data.length > 0) {
head = new ListNode(data[0]);
}
for (int i = 1; i < data.length; i++) {
head.appendToTail(data[i]);
}
return head;
}
public static void printList(ListNode head) {
if (head == null) {
return;
}
ListNode curr = head;
System.out.print(curr.val);
while (curr.next != null) {
curr = curr.next;
System.out.print(", ");
System.out.print(curr.val);
}
System.out.println();
}
}
|
package com.ace.easyteacher.Activity;
import android.app.Activity;
import android.os.Bundle;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import com.ace.easyteacher.Adapter.ScheduleAdapter;
import com.ace.easyteacher.DataBase.DBUtils;
import com.ace.easyteacher.DataBase.TeacherSchedule;
import com.ace.easyteacher.EasyTeacherApplication;
import com.ace.easyteacher.Http.HttpUtils;
import com.ace.easyteacher.Http.MHttpClient;
import com.ace.easyteacher.R;
import com.ace.easyteacher.Utils.ToastUtils;
import com.magicare.mutils.common.Callback;
import org.xutils.DbManager;
import org.xutils.ex.DbException;
import org.xutils.x;
import java.util.ArrayList;
import java.util.List;
import butterknife.Bind;
import butterknife.ButterKnife;
import me.drakeet.materialdialog.MaterialDialog;
/**
* Created by Xman on 2016/3/25
*/
public class TeacherScheduleActivity extends Activity {
@Bind(R.id.rv_note)
RecyclerView recyclerView;
ScheduleAdapter adapter;
List<TeacherSchedule> mList = new ArrayList<>();
List<TeacherSchedule> newList = new ArrayList<>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.teacher_schedule);
ButterKnife.bind(this);
recyclerView.setLayoutManager(new GridLayoutManager(TeacherScheduleActivity.this, 5));
adapter = new ScheduleAdapter(newList);
recyclerView.setAdapter(adapter);
adapter.setOnItemClickListener(new ScheduleAdapter.OnItemClickListener() {
@Override
public void onItemClick(View view, int position) {
final MaterialDialog mMaterialDialog = new MaterialDialog(TeacherScheduleActivity.this);
mMaterialDialog.setTitle("课程信息")
.setMessage("教师: " + newList.get(position).getTeacher_name() + "\n"
+ "教室: " + newList.get(position).getRoom() + "\n"
+ "课程名称: " + newList.get(position).getSubject_name())
.setPositiveButton("关闭", new View.OnClickListener() {
@Override
public void onClick(View v) {
mMaterialDialog.dismiss();
}
});
mMaterialDialog.show();
}
});
initDatas();
}
private void initDatas() {
newList.clear();
String class_name = EasyTeacherApplication.mApp.getWhichClass();
class_name = class_name == null ? "高二19班" : class_name;
getScheduleByClass(class_name);
}
private void getScheduleByClass(String class_name) {
HttpUtils.HttpCallback<TeacherSchedule> callback = new HttpUtils.HttpCallback<TeacherSchedule>() {
@Override
public void onError(Throwable ex, boolean isOnCallback) {
Log.d("ian", "fail");
Log.d("ian", "fail");
DbManager db = x.getDb(DBUtils.getStutdentInfoDaoConfig());
try {
List<TeacherSchedule> result = db.findAll(TeacherSchedule.class);
mList = result;
for (int i = 1; i <= 7; i++) {
for (TeacherSchedule teacher : mList) {
if (Integer.valueOf(teacher.getNumber()) == i) {
newList.add(teacher);
}
}
}
adapter.notifyDataSetChanged();
} catch (DbException e) {
ToastUtils.Toast(TeacherScheduleActivity.this, "获取课表信息失败,请检查网络或联系管理员", 500);
e.printStackTrace();
}
}
@Override
public void onSuccess(TeacherSchedule result) {
Log.d("ian", "success");
}
@Override
public void onSuccess(List<TeacherSchedule> result) {
DbManager db = x.getDb(DBUtils.getStutdentInfoDaoConfig());
try {
db.delete(TeacherSchedule.class);
} catch (DbException e) {
e.printStackTrace();
}
for (TeacherSchedule studentInfo : result) {
try {
db.save(studentInfo);
} catch (DbException e) {
e.printStackTrace();
}
}
mList = result;
for (int i = 1; i <= 7; i++) {
for (TeacherSchedule teacher : mList) {
if (Integer.valueOf(teacher.getNumber()) == i) {
newList.add(teacher);
}
}
}
adapter.notifyDataSetChanged();
}
@Override
public void onCancelled(Callback.CancelledException cex) {
}
@Override
public void onFinished() {
}
};
MHttpClient.getScheduleByClass(class_name, callback);
}
private void getList(List<TeacherSchedule> mList, int i) {
TeacherSchedule ss = new TeacherSchedule();
ss.setNumber("" + i);
ss.setSubject_name("物理");
mList.add(ss);
TeacherSchedule ss1 = new TeacherSchedule();
ss1.setNumber("" + i);
ss1.setSubject_name("化学");
mList.add(ss1);
TeacherSchedule ss2 = new TeacherSchedule();
ss2.setNumber("" + i);
ss2.setSubject_name("生物");
mList.add(ss2);
TeacherSchedule ss3 = new TeacherSchedule();
ss3.setNumber("" + i);
ss3.setSubject_name("政治");
mList.add(ss3);
TeacherSchedule ss4 = new TeacherSchedule();
ss4.setNumber("" + i);
ss4.setSubject_name("历史");
mList.add(ss4);
}
}
|
package sellwin.gui;
import sellwin.domain.*;
// SellWin http://sourceforge.net/projects/sellwincrm
//Contact support@open-app.com for commercial help with SellWin
//This software is provided "AS IS", without a warranty of any kind.
/**
* This interface provides a way for dialogs
* to listen for product selections thru the
* product selection dialog
*/
public interface InventoryListener {
/**
* receive a quote line from the product
* selection dialog
* @param x the QuoteLine to receive
*/
public void addQuoteLine(QuoteLine x);
}
|
package cn.edu.zucc.music.dao;
import cn.edu.zucc.music.model.Collection;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface CollectionMapper {
int deleteByPrimaryKey(Integer collection);
int insert(Collection record);
int insertSelective(Collection record);
Collection selectByPrimaryKey(Integer collection);
int updateByPrimaryKeySelective(Collection record);
int updateByPrimaryKey(Collection record);
} |
package com.serhii.cryptobook;
import javax.crypto.*;
import java.io.UnsupportedEncodingException;
import java.security.*;
public class IbmDevOps {
private static String plainText = "Hello world!!!";
public static void main(String[] args) throws UnsupportedEncodingException, NoSuchAlgorithmException, InvalidKeyException, NoSuchPaddingException, BadPaddingException, IllegalBlockSizeException, SignatureException {
System.out.println("Original text: " + plainText);
System.out.println("1. Message digest: " + new String(messageDigest(plainText, "MD5"), "UTF-8"));
System.out.println("2. HMAC: " + new String(hmac(plainText, "HmacMD5"), "UTF-8"));
System.out.println("3. Symetric:");
KeyGenerator keyGenerator = KeyGenerator.getInstance("DES");
keyGenerator.init(56);
Key key = keyGenerator.generateKey();
byte[] cipherText = cryptoWithSecretKey(plainText.getBytes("UTF-8"), key, Cipher.ENCRYPT_MODE);
System.out.println(" - Encrypt: " + new String(cipherText, "UTF-8"));
System.out.println(" - Decrypt: " + new String(cryptoWithSecretKey(cipherText, key, Cipher.DECRYPT_MODE), "UTF-8"));
System.out.println("4. Asymetric:");
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA");
keyPairGenerator.initialize(1024);
KeyPair keyPair = keyPairGenerator.generateKeyPair();
byte[] cipherText1 = encryptWithPublicKeyDecryptWithPrivateKey(plainText.getBytes("UTF-8"), keyPair.getPublic(), Cipher.ENCRYPT_MODE);
System.out.println(" - Encrypt: " + new String(cipherText1, "UTF-8"));
System.out.println(" - Decrypt: " + new String(encryptWithPublicKeyDecryptWithPrivateKey(cipherText1, keyPair.getPrivate(), Cipher.DECRYPT_MODE)));
System.out.println("5. Signature:");
KeyPairGenerator keyPairGenerator1 = KeyPairGenerator.getInstance("RSA");
keyPairGenerator1.initialize(1024);
KeyPair keyPair1 = keyPairGenerator1.generateKeyPair();
byte[] sign = sign(plainText.getBytes("UTF-8"), keyPair1.getPrivate());
System.out.println(" - Signature: " + new String(sign, "UTF-8"));
verifySign(plainText.getBytes("UTF-8"), sign, keyPair1.getPublic());
}
public static byte[] sign(byte[] data, PrivateKey privateKey) throws NoSuchAlgorithmException, InvalidKeyException, UnsupportedEncodingException, SignatureException {
Signature signature = Signature.getInstance("MD5WithRSA");
signature.initSign(privateKey);
signature.update(data);
return signature.sign();
}
public static boolean verifySign(byte[] data, byte[] sign, PublicKey publicKey) throws NoSuchAlgorithmException, SignatureException, InvalidKeyException {
Signature signature = Signature.getInstance("MD5WithRSA");
signature.initVerify(publicKey);
signature.update(data);
if (signature.verify(sign)) {
System.out.println(" - Signature verified!");
return true;
} else {
System.out.println(" - Signature failed!");
return false;
}
}
public static byte[] encryptWithPublicKeyDecryptWithPrivateKey(byte[] data, Key key, int mode) throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException {
Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");
cipher.init(mode, key);
return cipher.doFinal(data);
}
public static byte[] cryptoWithSecretKey(byte[] data, Key key, int mode) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, UnsupportedEncodingException, BadPaddingException, IllegalBlockSizeException {
Cipher cipher = Cipher.getInstance("DES/ECB/PKCS5Padding");
cipher.init(mode, key);
return cipher.doFinal(data);
}
public static byte[] messageDigest(String plainText, String algorithm) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest messageDigest = MessageDigest.getInstance(algorithm);
messageDigest.update(plainText.getBytes("UTF-8"));
return messageDigest.digest();
}
public static byte[] hmac(String plainText, String algorithm) throws NoSuchAlgorithmException, InvalidKeyException, UnsupportedEncodingException {
KeyGenerator keyGenerator = KeyGenerator.getInstance(algorithm);
SecretKey secretKey = keyGenerator.generateKey();
Mac mac = Mac.getInstance(algorithm);
mac.init(secretKey);
mac.update(plainText.getBytes("UTF-8"));
return mac.doFinal();
}
}
|
class Person7{
String name;
int age;
int height;
Person7(int x){
this();
//n에 톰만들기
this.name = "Tom";
}
Person7(String n, int h){
this(h);//키
//name에 값 넣기
}
Person7(String name, int age, int height){
this.name = name;
//this.age = age;
this.height = height;
this(age);
}
//필요한 생성ㅇ자 만들기
public static void main(String ar[]){
Person7 p = new Person("Mike", 30, 180);
}
} |
/*
* [y] hybris Platform
*
* Copyright (c) 2000-2016 SAP SE
* All rights reserved.
*
* This software is the confidential and proprietary information of SAP
* Hybris ("Confidential Information"). You shall not disclose such
* Confidential Information and shall use it only in accordance with the
* terms of the license agreement you entered into with SAP Hybris.
*/
package com.cnk.travelogix.b2c.facades.customer.converters.populator;
import de.hybris.platform.commercefacades.user.converters.populator.CustomerReversePopulator;
import de.hybris.platform.commercefacades.user.data.CustomerData;
import de.hybris.platform.core.model.user.CustomerModel;
import de.hybris.platform.servicelayer.dto.converter.ConversionException;
import de.hybris.platform.servicelayer.exceptions.UnknownIdentifierException;
import org.apache.commons.lang.BooleanUtils;
/**
*
*/
public class B2cCustomerReversePopulator extends CustomerReversePopulator
{
@Override
public void populate(final CustomerData source, final CustomerModel target) throws ConversionException
{
super.populate(source, target);
if (source.getCurrency() != null && !"0".equals(source.getCurrency().getIsocode()))
{
final String isocode = source.getCurrency().getIsocode();
try
{
target.setSessionCurrency(getCommonI18NService().getCurrency(isocode));
}
catch (final UnknownIdentifierException e)
{
throw new ConversionException("No currency with the code " + isocode + " found.", e);
}
}
if (source.getLanguage() != null && !"0".equals(source.getLanguage().getIsocode()))
{
final String isocode = source.getLanguage().getIsocode();
try
{
target.setSessionLanguage(getCommonI18NService().getLanguage(isocode));
}
catch (final UnknownIdentifierException e)
{
throw new ConversionException("No language with the code " + isocode + " found.", e);
}
}
if (source.getDefaultWebSite() != null && !"0".equals(source.getDefaultWebSite().getIsocode()))
{
final String isocode = source.getDefaultWebSite().getIsocode();
try
{
target.setDefaultWebSite(getCommonI18NService().getCountry(isocode));
}
catch (final UnknownIdentifierException e)
{
throw new ConversionException("No country with the code " + isocode + " found.", e);
}
}
target.setEmails(source.getEmails());
target.setSubscribe(new Boolean(BooleanUtils.isTrue(source.getSubscribe())));
target.setMobiles(source.getMobiles());
target.setDefaultCountryCode(source.getDefaultCountryCode());
target.setIsActive(new Boolean(source.isActive()));
}
}
|
import java.util.*;
public class SpencerHiltonBank
{
public static void main (String[] args)
{
Scanner in = new Scanner(System.in);
String accountName; //User account name
String selection = " "; //User selection 1-4
double userDeposit; //Used for amount to be deposited
double userWithdrawl; //Used for amount to be withdrawn
boolean toProceed = true;
boolean depositCheck = true;
boolean withdrawlCheck = true;
//Asks user for name and creates an instance "account"
System.out.println("Welcome to the Bank of Spencer! \n");
System.out.print("Please enter your name to create an account: ");
accountName = in.nextLine();
BankAccount account = new BankAccount(accountName, 35478265);
//Ask user what they would like to do from selection
do
{
System.out.println("\nPress 1 to make a deposit");
System.out.println("Press 2 to make a withdrawl");
System.out.println("Press 3 to get account information");
System.out.println("Press 4 to quit");
selection = in.nextLine();
//Check that user enters a 1, 2 ,3, or 4
do
{
if (!selection.equals("1") && !selection.equals("2") && !selection.equals("3") && !selection.equals("4"))
{
System.out.print("Invalid choice, please try again\n");
selection = in.nextLine();
}
}while(!selection.equals("1") && !selection.equals("2") && !selection.equals("3") && !selection.equals("4"));
//Used to make deposit to an account and warn user of invalid input
if(selection.equals("1"))
{
do
{
try
{
System.out.print("Please enter the amount to deposit: ");
userDeposit = in.nextDouble();
account.deposit(userDeposit);
in.nextLine();
depositCheck = false;
}
catch(InputMismatchException e)
{
System.out.println("Invalid Input.");
in.nextLine();
depositCheck = true;
}
}while(depositCheck);
}
//Used to withdraw money from account and warn user of invalid input
else if(selection.equals("2"))
{
do
{
try
{
System.out.print("Please enter the amount to withdrawl: ");
userWithdrawl = in.nextDouble();
account.withdraw(userWithdrawl);
in.nextLine();
withdrawlCheck = false;
}
catch(InputMismatchException e)
{
System.out.println("Invalid Input.");
in.nextLine();
withdrawlCheck = true;
}
}while(withdrawlCheck);
}
//Print account information
else if(selection.equals("3"))
{
System.out.print("Name: " + account.getName() + "\nAccount #: " +account.getAccountNum() + "\nBalance: $" + account.getBalance() +"\n");
}
//Quit the program
else if(selection.equals("4"))
{
System.out.print("Thank you for your business!");
toProceed = false;
}
}while(toProceed);
}
} |
package cn.edu.zucc.web.controller;
import cn.edu.zucc.web.model.User;
import cn.edu.zucc.web.model.ViewRun;
import cn.edu.zucc.web.model.ViewTotal;
import cn.edu.zucc.web.security.RoleSign;
import cn.edu.zucc.web.service.SearchService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
import java.util.List;
/**
* Created by zxy on 11/20/2016.
*/
@Controller("searchController")
public class SearchController {
private static final Log logger = LogFactory.getLog(SearchController.class);
@Resource
private SearchService searchService;
@RequestMapping(value = "/admin/search", method = RequestMethod.GET)
@RequiresRoles(value = RoleSign.ADMIN)
public ModelAndView search(@RequestParam("type") String type, @RequestParam("keyword") String keyword, @RequestParam("page") int page, Model model) {
if (page <= 0) {
return new ModelAndView("admin/search?type=" + type + "&keyword=" + keyword + "&page=1");
}
int size = 50;
if ("all".equals(type)) {
List<User> result = searchService.selectByKeyword(keyword, (page - 1) * size, size);
model.addAttribute("searchResult", result);
} else if ("details".equals(type)) {
List<ViewRun> result_list = searchService.selectRunsByUserno(keyword, (page - 1) * size, size);
ViewTotal result_total = searchService.selectRunByUserno(keyword);
model.addAttribute("searchDetailsList", result_list);
model.addAttribute("searchDetailsTotal", result_total);
}
return new ModelAndView("admin/search");
}
@RequestMapping(value = "/admin/getSearchPage", method = RequestMethod.GET)
@RequiresRoles(value = RoleSign.ADMIN)
@ResponseBody
public String getSearchPage(@RequestParam("type") String type, @RequestParam("keyword") String keyword) {
Integer page = 0;
if ("all".equals(type)) {
page = searchService.getPageAll(keyword);
} else if ("details".equals(type)) {
page = searchService.getPageDetails(keyword);
}
if (page == null) {
page = 1;
}
if (page <= 50) {
page = 1;
} else {
page /= 50;
}
logger.info("get search page, type=" + type + ",keyword=" + keyword + ",page=" + page);
return "{\"page\":" + page + "}";
}
}
|
package com.tencent.weui.base.preference;
import android.content.Context;
import android.preference.Preference;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.View;
import android.widget.TextView;
import com.tencent.mm.bw.a$g;
import com.tencent.mm.bw.a.c;
import com.tencent.mm.bw.a.f;
import com.tencent.mm.ui.widget.MMSwitchBtn;
public class CheckBoxPreference extends Preference {
private MMSwitchBtn kAq;
private TextView piP;
private int piQ;
private String piR;
private int piS;
boolean qpJ;
public CheckBoxPreference(Context context, AttributeSet attributeSet) {
this(context, attributeSet, 0);
}
public CheckBoxPreference(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
this.qpJ = false;
this.piQ = -1;
this.piR = "";
this.piS = 8;
setLayoutResource(a$g.mm_preference_summary_checkbox);
}
public void onBindView(View view) {
super.onBindView(view);
this.kAq = (MMSwitchBtn) view.findViewById(f.checkbox);
this.kAq.setSwitchListener(new 1(this));
this.kAq.setCheck(this.qpJ);
if (!isEnabled()) {
this.kAq.setEnabled(false);
((TextView) view.findViewById(16908310)).setTextColor(view.getResources().getColor(c.black_text_color_disabled));
}
this.piP = (TextView) view.findViewById(f.tipicon);
String str = this.piR;
int i = this.piQ;
this.piQ = i;
this.piR = str;
if (this.piP != null) {
if (i > 0) {
this.piP.setBackgroundResource(this.piQ);
}
if (!TextUtils.isEmpty(this.piR)) {
this.piP.setText(this.piR);
}
}
this.piS = this.piS;
if (this.piP != null) {
this.piP.setVisibility(this.piS);
}
}
public final boolean isChecked() {
if (this.kAq != null) {
return this.kAq.uGQ;
}
return this.qpJ;
}
}
|
package com.dennistjahyadigotama.soaya.activities.ThreadEditActivity.adapter;
import android.net.Uri;
/**
* Created by Denn on 7/4/2016.
*/
public class ImageGetter {
String id;
String caption;
String encoded;
String imageUrl;
Uri uri;
public String getImageUrl() {
return imageUrl;
}
public void setImageUrl(String imageUrl) {
this.imageUrl = imageUrl;
}
public Uri getUri() {
return uri;
}
public void setUri(Uri uri) {
this.uri = uri;
}
public String getCaption() {
return caption;
}
public void setCaption(String caption) {
this.caption = caption;
}
public String getEncoded() {
return encoded;
}
public void setEncoded(String encoded) {
this.encoded = encoded;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("numele primului jucator:");
String player1Name = scanner.nextLine();
System.out.println("numele celui de-al doilea jucator:");
String player2Name = scanner.nextLine();
Player player1 = new Player(player1Name);
Player player2 = new Player(player2Name);
MyTicTacToe myTicTacToe = new MyTicTacToe(player1, player2);
myTicTacToe.playGame();
}
}
|
package com.yougou.merchant.api.help.vo;
import java.io.Serializable;
/**
* 商家帮助中心内容实体
*
* @author huang.tao
*
*/
public class HelpCenterContent implements Serializable {
private static final long serialVersionUID = 237061146051351385L;
private String id;
/** 菜单ID */
private String menuId;
/** 帮助内容 */
private String content;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getMenuId() {
return menuId;
}
public void setMenuId(String menuId) {
this.menuId = menuId;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
}
|
package com.leetcode.oj;
//55 https://leetcode.com/problems/jump-game/
public class JumpGame_55 {
public boolean canJump_0(int[] nums) {
if(nums==null){
return false;
}
int reach = 0;
for(int i=0;i<=reach&&reach<nums.length-1;i++){
reach = Math.max(nums[i]+i,reach);
}
return reach>=nums.length-1;
}
public boolean canJump(int[] nums) {
int[] f=new int[nums.length];
f[0] = 0;
for(int i=1;i<nums.length;i++){
f[i] = Math.max(f[i-1], nums[i-1])-1;
if(f[i]<0){
return false;
}
}
return f[nums.length-1]>=0;
}
}
|
package com.qiyi.openapi.demo.activity;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.SeekBar;
import android.widget.TextView;
import android.widget.Toast;
import com.bumptech.glide.Glide;
import com.qiyi.apilib.ApiLib;
import com.qiyi.apilib.KeyConstant;
import com.qiyi.apilib.model.VideoInfo;
import com.qiyi.apilib.utils.LogUtils;
import com.qiyi.apilib.utils.StringUtils;
import com.qiyi.apilib.utils.UiUtils;
import com.qiyi.openapi.demo.R;
import com.qiyi.video.playcore.ErrorCode;
import com.qiyi.video.playcore.IQYPlayerHandlerCallBack;
import com.qiyi.video.playcore.QiyiVideoView;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.concurrent.TimeUnit;
public class PlayerActivity extends BaseActivity {
private static final int PERMISSION_REQUEST_CODE = 7171;
private static final String TAG = PlayerActivity.class.getSimpleName();
private static final int HANDLER_MSG_UPDATE_PROGRESS = 1;
private static final int HANDLER_MSG_CLOSE_SMALL_CONTROL = 2;
private static final int HANDLER_DEPLAY_UPDATE_PROGRESS = 1000; // 1s
private static final int HANDLER_DEPLAY_CLOSE_SMALL_CONTROL = 3000; // 3s
private boolean isFullScreen;
private int[] screen;
private QiyiVideoView mVideoView;
private SeekBar mSeekBar;
private ImageButton mPlayPauseIb;
private TextView mCurrentTimeTv;
private TextView mTotalTimeTv;
private LinearLayout mBottomControlLly;
private String mTid;
private String mAid;
private VideoInfo mVideoInfo;
private LinearLayout mTopControlLly;
private boolean mIsPlayFinish;
private static int sCurrentPosition;
private TextView mCurrentSystemTimeTv;
private SimpleDateFormat mSdf;
private View mPlayLoadingLly;
@Override
protected int getLayoutResourceId() {
return R.layout.activity_player;
}
@Override
protected void initView() {
super.initView();
screen = UiUtils.getScreenWidthAndHeight(this);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
mAid = getIntent().getStringExtra(KeyConstant.AID);
mTid = getIntent().getStringExtra(KeyConstant.TID);
mVideoInfo = (VideoInfo) getIntent().getSerializableExtra(KeyConstant.VIDEOINFO);
if (StringUtils.isEmpty(mTid)) {
finish();
return;
}
mVideoView = (QiyiVideoView) findViewById(R.id.player_vv);
mVideoView.setPlayData(mTid);
//设置回调,监听播放器状态
setPlayerCallback();
mVideoView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
displayControlLly();
}
});
mPlayLoadingLly = findViewById(R.id.play_loading_lly);
isFullScreen = getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE;
if (isFullScreen) {
initTopControlView();
} else {
initNonPlayerView();
}
initBottomControlView();
}
private void initNonPlayerView() {
((TextView) findViewById(R.id.video_info_title_tv)).setText(mVideoInfo.title);
((TextView) findViewById(R.id.video_info_play_count)).setText(ApiLib.CONTEXT.getString(R.string.play_count, mVideoInfo.playCountText));
if (!mVideoInfo.dateFormat.equals("1970-01-01")) {
((TextView) findViewById(R.id.video_info_date_format)).setText(ApiLib.CONTEXT.getString(R.string.upload_time, mVideoInfo.dateFormat));
}
LinearLayout episodeLly = (LinearLayout) findViewById(R.id.episode_lly);
RelativeLayout episodeRly = (RelativeLayout) findViewById(R.id.episode_rly);
// 1: 单视频专辑, 2: 电视剧, 3: 综艺
if ("2".equals(mVideoInfo.pType)) {
episodeRly.setVisibility(View.VISIBLE);
if (mVideoInfo.updateNum.equals(mVideoInfo.totalNum)) {
((TextView) findViewById(R.id.episode_more_tv)).setText(ApiLib.CONTEXT.getString(R.string.episode_more_finished, mVideoInfo.totalNum));
} else {
((TextView) findViewById(R.id.episode_more_tv)).setText(ApiLib.CONTEXT.getString(R.string.episode_more, mVideoInfo.updateNum, mVideoInfo.totalNum));
}
int currentUpdateNum = Integer.valueOf(mVideoInfo.updateNum);
for (int i = 0; i < currentUpdateNum; i++) {
Button button = new Button(this);
button.setText(i + 1 + "");
button.setBackgroundResource(R.drawable.episodu_button);
episodeLly.addView(button);
LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) button.getLayoutParams();
lp.width = getResources().getDimensionPixelSize(R.dimen.card_episode_button);
lp.height = getResources().getDimensionPixelSize(R.dimen.card_episode_button);
lp.setMargins(getResources().getDimensionPixelSize(R.dimen.card_episode), getResources().getDimensionPixelSize(R.dimen.card_episode), getResources().getDimensionPixelSize(R.dimen.card_episode), getResources().getDimensionPixelSize(R.dimen.card_episode));
button.requestLayout();
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(ApiLib.CONTEXT, "爱奇艺程序猿哥哥给的API接口不足,未实现ing", Toast.LENGTH_SHORT).show();
}
});
}
} else {
findViewById(R.id.separate_line).setVisibility(View.GONE);
}
}
private void initTopControlView() {
mTopControlLly = (LinearLayout) findViewById(R.id.top_control_lly);
ImageButton playerBackIb = (ImageButton) findViewById(R.id.player_back_ib);
playerBackIb.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
openOrCloseFullScreen();
}
});
ImageButton playerSetIb = (ImageButton) findViewById(R.id.player_set_ib);
playerSetIb.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(ApiLib.CONTEXT, "setting", Toast.LENGTH_SHORT).show();
}
});
((TextView) findViewById(R.id.video_title_tv)).setText(mVideoInfo.title);
mSdf = new SimpleDateFormat("HH:mm", Locale.CHINA);
mCurrentSystemTimeTv = (TextView) findViewById(R.id.system_time_tv);
mCurrentSystemTimeTv.setText(mSdf.format(new Date(System.currentTimeMillis())));
}
private void initBottomControlView() {
mBottomControlLly = (LinearLayout) findViewById(R.id.bottom_control_lly);
mCurrentTimeTv = (TextView) findViewById(R.id.current_time_tv);
mTotalTimeTv = (TextView) findViewById(R.id.total_time_tv);
mPlayPauseIb = (ImageButton) findViewById(R.id.player_pause_ib);
mPlayPauseIb.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
clickPlay();
}
});
Glide.with(ApiLib.CONTEXT).load(R.drawable.player_pause).into(mPlayPauseIb);
ImageButton playerFullIb = (ImageButton) findViewById(R.id.play_full_ib);
playerFullIb.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
openOrCloseFullScreen();
}
});
mSeekBar = (SeekBar) findViewById(R.id.progress_seekbar);
mSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
private int mProgress = 0;
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
LogUtils.d(TAG, "onProgressChanged, progress = " + progress + ", fromUser = " + fromUser);
if (fromUser) {
mProgress = progress;
}
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
mSeekBar.setProgress(mProgress);
mVideoView.seekTo(mProgress);
}
});
}
private void clickPlay() {
if (mVideoView.isPlaying()) {
mVideoView.pause();
Glide.with(ApiLib.CONTEXT).load(R.drawable.player_play).into(mPlayPauseIb);
mMainHandler.removeMessages(HANDLER_MSG_UPDATE_PROGRESS);
} else if (!mIsPlayFinish) {
mVideoView.start();
Glide.with(ApiLib.CONTEXT).load(R.drawable.player_pause).into(mPlayPauseIb);
mMainHandler.sendEmptyMessageDelayed(HANDLER_MSG_UPDATE_PROGRESS, HANDLER_DEPLAY_UPDATE_PROGRESS);
} else {
mIsPlayFinish = false;
mVideoView.seekTo(0);
Glide.with(ApiLib.CONTEXT).load(R.drawable.player_pause).into(mPlayPauseIb);
}
}
private void displayControlLly() {
if (mBottomControlLly.getVisibility() != View.VISIBLE) {
if (isFullScreen) {
mTopControlLly.setVisibility(View.VISIBLE);
}
mBottomControlLly.setVisibility(View.VISIBLE);
mMainHandler.sendEmptyMessageDelayed(HANDLER_MSG_CLOSE_SMALL_CONTROL, HANDLER_DEPLAY_CLOSE_SMALL_CONTROL);
} else {
if (isFullScreen) {
mTopControlLly.setVisibility(View.GONE);
}
mBottomControlLly.setVisibility(View.GONE);
mMainHandler.removeMessages(HANDLER_MSG_CLOSE_SMALL_CONTROL);
}
}
private void openOrCloseFullScreen() {
sCurrentPosition = mVideoView.getCurrentPosition();
if (isFullScreen) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
} else {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
}
}
private void setPlayerCallback() {
mVideoView.setPlayerCallBack(mCallBack);
}
@Override
protected void onStart() {
super.onStart();
if (null != mVideoView) {
mVideoView.start();
}
mMainHandler.sendEmptyMessageDelayed(HANDLER_MSG_UPDATE_PROGRESS, HANDLER_DEPLAY_UPDATE_PROGRESS);
}
@Override
protected void onStop() {
super.onStop();
if (null != mVideoView) {
mVideoView.pause();
}
mMainHandler.removeMessages(HANDLER_MSG_UPDATE_PROGRESS);
}
@Override
protected void onDestroy() {
super.onDestroy();
mMainHandler.removeCallbacksAndMessages(null);
mVideoView.release();
mVideoView = null;
}
/**
* Convert ms to hh:mm:ss
*
* @param millis
* @return
*/
private String ms2hms(int millis) {
return String.format("%02d:%02d:%02d", TimeUnit.MILLISECONDS.toHours(millis),
TimeUnit.MILLISECONDS.toMinutes(millis) % TimeUnit.HOURS.toMinutes(1),
TimeUnit.MILLISECONDS.toSeconds(millis) % TimeUnit.MINUTES.toSeconds(1));
}
/**
* 每一秒查询和更新进度条
*/
private Handler mMainHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
LogUtils.d(TAG, "handleMessage, msg.what = " + msg.what);
switch (msg.what) {
case HANDLER_MSG_UPDATE_PROGRESS:
int duration = mVideoView.getDuration();
int progress = mVideoView.getCurrentPosition();
LogUtils.d(TAG, "HANDLER_MSG_UPDATE_PROGRESS, duration = " + duration + ", currentPosition = " + progress);
if (duration > 0) {
mSeekBar.setMax(duration);
mSeekBar.setProgress(progress);
mTotalTimeTv.setText(ms2hms(duration));
mCurrentTimeTv.setText(ms2hms(progress));
}
if(isFullScreen) {
mCurrentSystemTimeTv.setText(mSdf.format(new Date(System.currentTimeMillis())));
}
mMainHandler.sendEmptyMessageDelayed(HANDLER_MSG_UPDATE_PROGRESS, HANDLER_DEPLAY_UPDATE_PROGRESS);
break;
case HANDLER_MSG_CLOSE_SMALL_CONTROL:
if (isFullScreen) {
mTopControlLly.setVisibility(View.GONE);
}
mBottomControlLly.setVisibility(View.GONE);
default:
break;
}
}
};
IQYPlayerHandlerCallBack mCallBack = new IQYPlayerHandlerCallBack() {
/**
* SeekTo 成功,可以通过该回调获取当前准确时间点。
*/
@Override
public void OnSeekSuccess(long l) {
}
/**
* 是否因数据加载而暂停播放
*/
@Override
public void OnWaiting(boolean b) {
LogUtils.i(TAG, "OnWaiting: " + b);
}
/**
* 播放内核发生错误
*/
@Override
public void OnError(ErrorCode errorCode) {
LogUtils.i(TAG, "OnError: " + errorCode);
mMainHandler.removeMessages(HANDLER_MSG_UPDATE_PROGRESS);
}
/**
* 播放器状态码 {@link com.iqiyi.player.nativemediaplayer.MediaPlayerState}
* 0 空闲状态
* 1 已经初始化
* 2 调用PrepareMovie,但还没有进入播放
* 4 可以获取视频信息(比如时长等)
* 8 广告播放中
* 16 正片播放中
* 32 一个影片播放结束
* 64 错误
* 128 播放结束(没有连播)
*/
@Override
public void OnPlayerStateChanged(int i) {
if (i == 1) {
mPlayLoadingLly.setVisibility(View.VISIBLE);
} else if (i == 16) {
runOnUiThread(new Runnable() {
@Override
public void run() {
//点击全屏按钮后三秒后也自动隐藏布局
mMainHandler.sendEmptyMessageDelayed(HANDLER_MSG_CLOSE_SMALL_CONTROL, HANDLER_DEPLAY_CLOSE_SMALL_CONTROL);
mPlayLoadingLly.setVisibility(View.GONE);
if (isFullScreen) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
mVideoView.seekTo(sCurrentPosition);
}
});
} else if (i == 128) {
mIsPlayFinish = true;
runOnUiThread(new Runnable() {
@Override
public void run() {
Glide.clear(mPlayPauseIb);
Glide.with(ApiLib.CONTEXT).load(R.drawable.player_play).into(mPlayPauseIb);
}
});
}
LogUtils.i(TAG, " OnPlayerStateChanged: " + i);
}
};
}
|
package pattern_test.visitor;
/**
* Description:
*
* @author Baltan
* @date 2019-04-04 15:17
*/
public class ComputerPriceTable implements PriceTable {
@Override
public void showPrice(CPU cpu) {
System.out.println("cpu的价格是: 2000元");
}
@Override
public void showPrice(GPU gpu) {
System.out.println("gpu的价格是: 1500元");
}
@Override
public void showPrice(HardDisk hardDisk) {
System.out.println("hardDisk的价格是: 1000元");
}
@Override
public void showPrice(Keyboard keyboard) {
System.out.println("keyboard的价格是: 500元");
}
@Override
public void showPrice(Memory memory) {
System.out.println("memory的价格是: 200元");
}
@Override
public void showPrice(Monitor monitor) {
System.out.println("monitor的价格是: 1500元");
}
@Override
public void showPrice(Mouse mouse) {
System.out.println("mouse的价格是: 200元");
}
}
|
package rugal.westion.jiefanglu.core.service.impl;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.apache.http.HttpRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import rugal.common.hibernate.Updater;
import rugal.westion.jiefanglu.core.dao.AccountDao;
import rugal.westion.jiefanglu.core.dao.GaoDeCityDao;
import rugal.westion.jiefanglu.core.dao.GaoDeProvinceDao;
import rugal.westion.jiefanglu.core.dao.QQThirdPartDao;
import rugal.westion.jiefanglu.core.dao.RelationShipDao;
import rugal.westion.jiefanglu.core.dao.WBThirdPartDao;
import rugal.westion.jiefanglu.core.entity.Account;
import rugal.westion.jiefanglu.core.entity.GaoDeCity;
import rugal.westion.jiefanglu.core.entity.GaoDeProvince;
import rugal.westion.jiefanglu.core.entity.QQThirdPart;
import rugal.westion.jiefanglu.core.entity.RelationShip;
import rugal.westion.jiefanglu.core.entity.WBThirdPart;
import rugal.westion.jiefanglu.core.service.AccountService;
import rugal.westion.jiefanglu.core.service.ProvinceAndCityService;
import rugal.westion.jiefanglu.exception.NoSuchEntityException;
@Service
public class ProvinceAndCityServiceImpl implements ProvinceAndCityService {
@Autowired
private GaoDeProvinceDao gaoDeProvinceDao;
@Autowired
private GaoDeCityDao gaoDeCityDao;
@Override
public List<GaoDeProvince> listProvince() {
return gaoDeProvinceDao.list();
}
@Override
public List<GaoDeCity> listCityByProvinceId(Integer id) {
return gaoDeCityDao.listByProvince(gaoDeProvinceDao.findById(id));
}
}
|
/*
* 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 resourcemanagementapp.locations;
import com.jfoenix.controls.JFXRadioButton;
import com.jfoenix.controls.JFXTextField;
import java.io.IOException;
import java.net.URL;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ResourceBundle;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType;
import javafx.scene.control.Label;
import javafx.scene.control.ToggleGroup;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;
import resourcemanagementapp.database.DBConnection;
/**
* FXML Controller class
*
* @author thilr_88qp6ap
*/
public class AddLocationController implements Initializable {
@FXML
private AnchorPane addlocationpane;
@FXML
private JFXTextField txtBuildingName;
@FXML
private JFXTextField txtRoomName;
@FXML
private JFXRadioButton rbtnLectureHall;
@FXML
private ToggleGroup roomType;
@FXML
private JFXRadioButton rbtnLaboratory;
@FXML
private JFXTextField txtCapacity;
@FXML
private Label errLbl;
// DB Connection
Connection connection = DBConnection.DBConnector();
PreparedStatement pst = null;
ResultSet rs = null;
/**
* Initializes the controller class.
*/
@Override
public void initialize(URL url, ResourceBundle rb) {
// Radio button
radioButton();
}
// Radio Button
public void radioButton() {
rbtnLectureHall.setToggleGroup(roomType);
rbtnLaboratory.setToggleGroup(roomType);
}
// Load Auto Increment ID
int AID;
public int autoIncrementID() throws SQLException {
String query = "SELECT id FROM location ORDER BY id DESC LIMIT 1";
pst = connection.prepareStatement(query);
rs = pst.executeQuery();
if(rs.next()) {
AID = rs.getInt("id");
AID = AID + 1;
} else {
AID = 1;
}
System.out.println("Auto Increment ID : " + AID);
rs.close();
pst.close();
return AID;
}
// Validation
public boolean Validation() {
if("".equals(txtBuildingName.getText())) {
errLbl.setText("* Please, fill the building name");
return true;
}
if(!(rbtnLectureHall.isSelected() || rbtnLaboratory.isSelected())) {
errLbl.setText("* Please, pick the Room Type");
return true;
}
if("".equals(txtCapacity.getText())) {
errLbl.setText("* Please, fill the capacity of the room");
return true;
}
return false;
}
@FXML
private void backBtnPressed() throws IOException {
// when user clicked Add Lecturer button
this.addlocationpane.getScene().getWindow().hide();
Parent root = null;
root = FXMLLoader.load(getClass().getResource("ManageLocations.fxml"));
Scene scene = new Scene(root);
Stage stage = new Stage();
stage.setScene(scene);
stage.setTitle("Manage Locations - Resouce Management Application");
stage.show();
}
@FXML
private void clearBtnPressed() {
txtBuildingName.setText("");
txtRoomName.setText("");
rbtnLectureHall.setSelected(false);
rbtnLaboratory.setSelected(false);
txtCapacity.setText("");
}
// add location
String rt;
@FXML
private void saveBtnPressed() throws SQLException {
if(Validation() == true) {
System.out.println("== Statement FALSE ==");
} else {
autoIncrementID();
errLbl.setText("");
// Add data to DB
String building_name = txtBuildingName.getText();
String room_name = txtRoomName.getText();
if(rbtnLectureHall.isSelected()) {
rt = "Lecture Hall";
} else if(rbtnLaboratory.isSelected()){
rt = "Laboratory";
} else {
System.out.println("Please Check Save Button -> Radio Button ");
}
String capacity = txtCapacity.getText();
int capInt = Integer.parseInt(capacity);
String query = "INSERT INTO location (id, building_name, room_name, room_type, capacity) VALUES (?,?,?,?,?)";
pst = null;
try {
pst = connection.prepareStatement(query);
pst.setInt(1, AID);
pst.setString(2, building_name);
pst.setString(3, room_name);
pst.setString(4, rt);
pst.setInt(5, capInt);
int connectStatus = pst.executeUpdate();
pst.close();
if(connectStatus == 1) {
Alert alert = new Alert(Alert.AlertType.INFORMATION);
// Get the Stage.
Stage stage = (Stage) alert.getDialogPane().getScene().getWindow();
// Add a custom icon.
alert.setTitle("Add Location");
alert.setHeaderText("Successfully Inserted.");
alert.setContentText("Location Add Successfully");
alert.showAndWait().ifPresent(rs -> {
if (rs == ButtonType.OK)
{
System.out.println("Pressed OK.");
clearBtnPressed();
}
});
} else {
Alert alert = new Alert(Alert.AlertType.ERROR);
// Get the Stage.
Stage stage = (Stage) alert.getDialogPane().getScene().getWindow();
// Add a custom icon.
alert.setTitle("Add Location Error");
alert.setHeaderText("Sorry, we can not add Location at this momoment.");
alert.setContentText("Please Try Again Later");
alert.showAndWait().ifPresent(rs -> {
if (rs == ButtonType.OK)
{
System.out.println("Pressed OK.");
}
});
}
} catch(SQLException e) {
System.out.println(e);
}
finally {
pst.close();
}
}
}
}
|
package com.tencent.mm.plugin.account.bind.ui;
import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.telephony.TelephonyManager;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.tencent.mm.ab.e;
import com.tencent.mm.al.b$a;
import com.tencent.mm.kernel.g;
import com.tencent.mm.model.q;
import com.tencent.mm.modelsimple.r;
import com.tencent.mm.plugin.account.a.f;
import com.tencent.mm.plugin.account.a.j;
import com.tencent.mm.plugin.account.friend.a.l;
import com.tencent.mm.plugin.account.friend.a.l.a;
import com.tencent.mm.plugin.account.friend.a.y;
import com.tencent.mm.plugin.account.friend.ui.i;
import com.tencent.mm.plugin.account.friend.ui.i.b;
import com.tencent.mm.sdk.platformtools.bi;
import com.tencent.mm.sdk.platformtools.x;
import com.tencent.mm.ui.MMWizardActivity;
import com.tencent.mm.ui.base.h;
import com.tencent.mm.ui.base.p;
public class BindMContactIntroUI extends MMWizardActivity implements e {
private String bTi;
private ImageView eFS;
private TextView eFT;
private TextView eFU;
private Button eFV;
private Button eFW;
private a eFX;
private i eFY;
private String eFZ = null;
private boolean eFl = false;
private String eGa = null;
private boolean eGb = false;
private boolean eGc = false;
private int eGd = 0;
private p tipDialog = null;
static /* synthetic */ void WM() {
int GJ = q.GJ();
l.Xz();
g.Ei().DT().set(7, Integer.valueOf(GJ & -131073));
com.tencent.mm.plugin.account.a.a.ezo.vl();
}
static /* synthetic */ void a(BindMContactIntroUI bindMContactIntroUI) {
boolean z = false;
switch (20.eGg[bindMContactIntroUI.eFX.ordinal()]) {
case 1:
bindMContactIntroUI.cg(false);
return;
case 2:
String str = bindMContactIntroUI.bTi;
if (bindMContactIntroUI.eFY == null) {
bindMContactIntroUI.eFY = new i(b.eNI, bindMContactIntroUI, new 25(bindMContactIntroUI, str));
bindMContactIntroUI.getContentResolver().registerContentObserver(Uri.parse("content://sms/"), true, bindMContactIntroUI.eFY);
}
i iVar = bindMContactIntroUI.eFY;
if (!(bindMContactIntroUI.eGb || bindMContactIntroUI.eGc)) {
z = true;
}
iVar.eND = z;
bindMContactIntroUI.eFY.pE(str);
return;
case 3:
g.Ei().DT().set(12322, Boolean.valueOf(false));
((com.tencent.mm.plugin.account.a.a.a) g.n(com.tencent.mm.plugin.account.a.a.a.class)).showAddrBookUploadConfirm(bindMContactIntroUI, new 18(bindMContactIntroUI), true, bindMContactIntroUI.eGd);
return;
case 4:
bindMContactIntroUI.startActivity(new Intent(bindMContactIntroUI, MobileFriendUI.class));
return;
default:
return;
}
}
static /* synthetic */ void b(BindMContactIntroUI bindMContactIntroUI) {
switch (20.eGg[bindMContactIntroUI.eFX.ordinal()]) {
case 2:
l.XD();
bindMContactIntroUI.initView();
return;
case 3:
bindMContactIntroUI.cg(true);
return;
case 4:
bindMContactIntroUI.cg(true);
return;
default:
return;
}
}
protected final int getLayoutId() {
return com.tencent.mm.plugin.account.a.g.bindmcontact_intro;
}
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
g.DF().a(132, this);
g.DF().a(com.tencent.mm.plugin.game.gamewebview.jsapi.biz.b.CTRL_BYTE, this);
g.DF().a(254, this);
setMMTitle(j.bind_mcontact_title_setting);
}
public void onDestroy() {
g.DF().b(132, this);
g.DF().b(com.tencent.mm.plugin.game.gamewebview.jsapi.biz.b.CTRL_BYTE, this);
g.DF().b(254, this);
if (this.eFY != null) {
getContentResolver().unregisterContentObserver(this.eFY);
this.eFY.recycle();
}
super.onDestroy();
}
protected void onResume() {
super.onResume();
initView();
}
protected final void initView() {
this.eGb = getIntent().getBooleanExtra("is_bind_for_safe_device", false);
this.eGc = getIntent().getBooleanExtra("is_bind_for_contact_sync", false);
this.eFl = getIntent().getBooleanExtra("KEnterFromBanner", false);
this.eGd = getIntent().getIntExtra("key_upload_scene", 0);
this.eFX = l.XC();
x.d("MicroMsg.BindMContactIntroUI", "state " + this.eFX);
this.bTi = (String) g.Ei().DT().get(6, null);
if (this.bTi == null || this.bTi.equals("")) {
this.bTi = (String) g.Ei().DT().get(4097, null);
}
this.eFS = (ImageView) findViewById(f.setting_bind_moblie_state_icon);
this.eFT = (TextView) findViewById(f.setting_bind_mobile_msg_title);
this.eFU = (TextView) findViewById(f.setting_bind_mobile_msg_hit);
this.eFV = (Button) findViewById(f.setting_bind_mobile_main_btn);
this.eFW = (Button) findViewById(f.setting_bind_mobile_sub_btn);
this.eFV.setOnClickListener(new 1(this));
this.eFW.setOnClickListener(new OnClickListener() {
public final void onClick(View view) {
BindMContactIntroUI.b(BindMContactIntroUI.this);
}
});
if (getIntent().getBooleanExtra("skip", false)) {
addTextOptionMenu(0, getString(j.app_ignore_it), new 21(this));
} else {
setBackBtn(new 22(this));
}
if (this.eFX == a.eKu || this.eFX == a.eKt) {
String value = com.tencent.mm.k.g.AT().getValue("ShowUnbindPhone");
int i = 2;
if (!bi.oW(value)) {
i = bi.WU(value);
}
if (i != 0) {
addIconOptionMenu(1, com.tencent.mm.plugin.account.a.e.mm_title_btn_menu, new 23(this, i));
}
}
switch (20.eGg[this.eFX.ordinal()]) {
case 1:
showOptionMenu(1, false);
this.eFS.setImageResource(com.tencent.mm.plugin.account.a.i.mobile_unbind_icon);
this.eFU.setVisibility(0);
this.eFW.setVisibility(8);
this.eFT.setText(j.bind_mcontact_hint_title);
this.eFU.setText(j.bind_mcontact_hint);
this.eFV.setText(j.bind_mcontact_bind_btn_text);
return;
case 2:
showOptionMenu(1, false);
this.eFS.setImageResource(com.tencent.mm.plugin.account.a.i.mobile_unbind_icon);
this.eFU.setVisibility(0);
this.eFW.setVisibility(0);
this.eFT.setText(String.format(getString(j.bind_mcontact_verify_mobile), new Object[]{this.bTi}));
this.eFU.setText(j.bind_mcontact_unverify_mobile);
this.eFV.setText(j.bind_mcontact_verify_btn_text);
this.eFW.setText(j.bind_mcontact_del_btn_text);
return;
case 3:
showOptionMenu(1, true);
this.eFS.setImageResource(com.tencent.mm.plugin.account.a.i.mobile_binded_icon);
this.eFU.setVisibility(0);
this.eFW.setVisibility(0);
this.eFT.setText(String.format(getString(j.bind_mcontact_verify_mobile), new Object[]{this.bTi}));
this.eFU.setText(j.bind_mcontact_change_hint);
this.eFV.setText(j.bind_mcontact_upload_btn_text);
this.eFW.setText(j.bind_mcontact_change_mobile_text);
return;
case 4:
showOptionMenu(1, true);
this.eFS.setImageResource(com.tencent.mm.plugin.account.a.i.mobile_binded_icon);
this.eFU.setVisibility(0);
this.eFW.setVisibility(0);
this.eFT.setText(String.format(getString(j.bind_mcontact_verify_mobile), new Object[]{this.bTi}));
this.eFU.setText(j.bind_mcontact_change_hint);
this.eFV.setText(j.bind_mcontact_friend_btn_text);
this.eFW.setText(j.bind_mcontact_change_mobile_text);
return;
default:
return;
}
}
public boolean onKeyDown(int i, KeyEvent keyEvent) {
if (i != 4) {
return super.onKeyDown(i, keyEvent);
}
WL();
return true;
}
private void WL() {
YC();
if (this.eGc) {
cancel();
finish();
return;
}
DT(1);
}
private void cg(boolean z) {
Intent intent = new Intent(this, BindMContactUI.class);
intent.putExtra("is_bind_for_safe_device", this.eGb);
intent.putExtra("is_bind_for_contact_sync", this.eGc);
intent.putExtra("is_bind_for_change_mobile", z);
String simCountryIso = ((TelephonyManager) getSystemService("phone")).getSimCountryIso();
if (!bi.oW(simCountryIso)) {
b$a j = com.tencent.mm.al.b.j(this, simCountryIso, getString(j.country_code));
if (j != null) {
intent.putExtra("country_name", j.dYy);
intent.putExtra("couttry_code", j.dYx);
}
}
MMWizardActivity.D(this, intent);
}
public final void a(int i, int i2, String str, com.tencent.mm.ab.l lVar) {
x.i("MicroMsg.BindMContactIntroUI", "summerunbind onSceneEnd type: " + lVar.getType() + " errType = " + i + " errCode = " + i2 + " errMsg = " + str);
if (lVar.getType() == 132 && i == 0 && i2 == 0) {
if (this.tipDialog != null) {
this.tipDialog.dismiss();
this.tipDialog = null;
}
if (((com.tencent.mm.plugin.account.friend.a.x) lVar).Oh() == 3) {
((com.tencent.mm.plugin.account.a.a.a) g.n(com.tencent.mm.plugin.account.a.a.a.class)).removeSelfAccount(this);
if (bi.oW(this.eGa)) {
MMWizardActivity.D(this, new Intent(this, BindMContactStatusUI.class));
return;
} else {
h.a(this, this.eGa, "", getString(j.app_i_known), new 26(this));
return;
}
}
return;
}
Object obj;
if (!com.tencent.mm.plugin.account.a.a.ezo.a(this, i, i2, str)) {
obj = null;
switch (i2) {
case -214:
com.tencent.mm.h.a eV = com.tencent.mm.h.a.eV(str);
if (eV != null) {
eV.a(this, null, null);
}
obj = 1;
break;
case -43:
Toast.makeText(this, j.bind_mcontact_err_binded, 0).show();
obj = 1;
break;
case -41:
Toast.makeText(this, j.bind_mcontact_err_format, 0).show();
obj = 1;
break;
case -36:
Toast.makeText(this, j.bind_mcontact_err_unbinded_notbinded, 0).show();
obj = 1;
break;
case -35:
Toast.makeText(this, j.bind_mcontact_err_binded_by_other, 0).show();
obj = 1;
break;
case -34:
Toast.makeText(this, j.bind_mcontact_err_freq_limit, 0).show();
obj = 1;
break;
}
}
obj = 1;
if (obj == null) {
com.tencent.mm.plugin.account.friend.a.x xVar;
ActionBarActivity actionBarActivity;
if (lVar.getType() == 254) {
if (this.tipDialog != null) {
this.tipDialog.dismiss();
this.tipDialog = null;
}
if (i == 0 && i2 == 0) {
this.eGa = ((y) lVar).XM().rsV;
this.eFZ = ((y) lVar).XL();
if (bi.oW(this.eGa)) {
g.DF().a(new r(2), 0);
return;
}
xVar = new com.tencent.mm.plugin.account.friend.a.x(this.bTi, 3, "", 0, "");
g.DF().a(xVar, 0);
actionBarActivity = this.mController.tml;
getString(j.app_tip);
this.tipDialog = h.a(actionBarActivity, getString(j.bind_mcontact_unbinding), true, new 27(this, xVar));
return;
} else if (i2 == -3) {
x.d("MicroMsg.BindMContactIntroUI", "summerunbind MMFunc_QueryHasPasswd err and set psw");
h.a(this.mController.tml, getString(j.settings_unbind_tips_set_user_password), null, getString(j.settings_unbind_tips_unbind_btn), getString(j.settings_unbind_tips_cancel_btn), true, new 2(this), new 3(this));
} else if (i2 == -81) {
h.a(this, j.setting_unbind_qq_err_norbindqq, j.app_tip, new 4(this));
} else if (i2 == -82) {
h.a(this, j.setting_unbind_qq_err_one_left, j.app_tip, new 5(this));
} else if (i2 == -83) {
h.a(this, j.setting_unbind_qq_err_has_unbind, j.app_tip, new 6(this));
} else if (i2 == -84) {
h.a(this, j.setting_unbind_qq_err_hasbinded, j.app_tip, new 7(this));
} else if (i2 == -85) {
h.a(this, j.setting_unbind_mobile_err_bindedbyother, j.app_tip, new DialogInterface.OnClickListener() {
public final void onClick(DialogInterface dialogInterface, int i) {
}
});
} else if (i2 == -86) {
h.a(this, j.setting_unbind_qq_err_qmail, j.app_tip, new 9(this));
}
}
if (lVar.getType() == com.tencent.mm.plugin.game.gamewebview.jsapi.biz.b.CTRL_BYTE) {
if (this.tipDialog != null) {
this.tipDialog.dismiss();
this.tipDialog = null;
}
if (i2 == 0) {
xVar = new com.tencent.mm.plugin.account.friend.a.x(this.bTi, 3, "", 0, "");
g.DF().a(xVar, 0);
actionBarActivity = this.mController.tml;
getString(j.app_tip);
this.tipDialog = h.a(actionBarActivity, getString(j.bind_mcontact_unbinding), true, new 10(this, xVar));
} else {
x.i("MicroMsg.BindMContactIntroUI", "summerunbind old err_password");
h.a(this.mController.tml, getString(j.settings_unbind_tips_set_user_password), null, getString(j.settings_unbind_tips_unbind_btn), getString(j.settings_unbind_tips_cancel_btn), true, new 11(this), new 13(this));
}
}
if (lVar.getType() == 132) {
if (this.tipDialog != null) {
this.tipDialog.dismiss();
this.tipDialog = null;
}
if (((com.tencent.mm.plugin.account.friend.a.x) lVar).Oh() != 3) {
return;
}
if (i2 == -82) {
h.a(this, j.setting_unbind_qq_err_one_left, j.app_tip, new DialogInterface.OnClickListener() {
public final void onClick(DialogInterface dialogInterface, int i) {
}
});
} else if (i2 == -83) {
h.a(this, j.setting_unbind_qq_err_has_unbind, j.app_tip, new 15(this));
} else if (i2 == -84) {
h.a(this, j.setting_unbind_qq_err_hasbinded, j.app_tip, new DialogInterface.OnClickListener() {
public final void onClick(DialogInterface dialogInterface, int i) {
}
});
} else if (i2 == -85) {
h.a(this, j.setting_unbind_mobile_err_bindedbyother, j.app_tip, new 17(this));
} else {
Toast.makeText(this, getString(j.bind_mcontact_unbind_err, new Object[]{Integer.valueOf(i), Integer.valueOf(i2)}), 0).show();
}
}
} else if (this.tipDialog != null) {
this.tipDialog.dismiss();
this.tipDialog = null;
}
}
public void onActivityResult(int i, int i2, Intent intent) {
super.onActivityResult(i, i2, intent);
x.d("MicroMsg.BindMContactIntroUI", "summerunbind onAcvityResult requestCode:%d, resultCode:%d", new Object[]{Integer.valueOf(i), Integer.valueOf(i2)});
switch (i) {
case 1:
if (i2 == -1) {
x.i("MicroMsg.BindMContactIntroUI", "summerunbind REQUEST_CODE_SET_PSW ok and start NetSceneCheckUnBind again mobile: " + this.bTi);
g.DF().a(new y(y.eKQ), 0);
getString(j.app_tip);
this.tipDialog = h.a(this, getString(j.app_loading), true, new OnCancelListener() {
public final void onCancel(DialogInterface dialogInterface) {
}
});
return;
}
return;
default:
return;
}
}
public void onRequestPermissionsResult(int i, String[] strArr, int[] iArr) {
if (iArr == null || iArr.length <= 0) {
String str = "MicroMsg.BindMContactIntroUI";
String str2 = "summerper onRequestPermissionsResult, grantResults length is:%d requestCode:%d, permissions:%s, stack:%s";
Object[] objArr = new Object[4];
objArr[0] = Integer.valueOf(iArr == null ? -1 : iArr.length);
objArr[1] = Integer.valueOf(i);
objArr[2] = strArr;
objArr[3] = bi.cjd();
x.w(str, str2, objArr);
return;
}
x.i("MicroMsg.BindMContactIntroUI", "summerper onRequestPermissionsResult requestCode[%d],grantResults[%d] tid[%d]", new Object[]{Integer.valueOf(i), Integer.valueOf(iArr[0]), Long.valueOf(Thread.currentThread().getId())});
switch (i) {
case 128:
if (iArr[0] == 0 && this.eFY != null) {
this.eFY.Yh();
return;
}
return;
default:
return;
}
}
}
|
package artistmanagmentsystem.util;
public class SqlStatements {
public final static String ADD_STATMENT = "INSERT into artist (name,last_name,age) values(?,?,?)";
public final static String DELETE_STATMENT = "DELETE from artist where id = ?;";
public final static String UPDATE_NAME_STATMENT = "UPDATE artist SET name = ? WHERE id = ?;";
public final static String UPDATE_LAST_NAME_STATMENT = "UPDATE artist SET last_name = ? WHERE id = ?;";
public final static String UPDATE_AGE_STATMENT = "UPDATE artist SET age = ? WHERE id = ?;";
public final static String SHOW_ALL_STATMENT = "SELECT name, last_name, age from artist;";
public final static String FIND_BY_ID_STATMENT = "SELECT id,name, last_name, age from artist where id = ?;";
public final static String FIND_BY_NAME_STATMENT = "SELECT id,name, last_name, age from artist where name = ?;";
public final static String FIND_BY_AGE_STATMENT = "SELECT id,name, last_name, age from artist where age = ?;";
}
|
public class TestaProduto {
public static void main(String[] args) {
ProdutoPrecerivel produtoPrecivel = new ProdutoPrecerivel();
produtoPrecivel.setDataValidade("11/01/2021");
System.out.println(produtoPrecivel.dataValida("12/01/2021"));
}
} |
package com.doomcrow.toadgod.components;
import com.artemis.Component;
public class Velocity extends Component {
public float x;
public float y;
public Velocity(float x, float y) {
this.x = x;
this.y = y;
}
public Velocity() {
this(0f, 0f);
}
}
|
package com.tencent.mm.plugin.setting.ui.qrcode;
import android.view.MenuItem;
import android.view.MenuItem.OnMenuItemClickListener;
class ShareMicroMsgChoiceUI$1 implements OnMenuItemClickListener {
final /* synthetic */ ShareMicroMsgChoiceUI mPB;
ShareMicroMsgChoiceUI$1(ShareMicroMsgChoiceUI shareMicroMsgChoiceUI) {
this.mPB = shareMicroMsgChoiceUI;
}
public final boolean onMenuItemClick(MenuItem menuItem) {
this.mPB.YC();
this.mPB.finish();
return true;
}
}
|
/*
* 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.mycompany.crud_proj;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import javafx.scene.control.Alert;
/**
*
* @author 80010-92-01
*/
public class Connect {
// param connexion à la base
private static final String URL = "jdbc:mysql://localhost:3307/hotel?zeroDateTimeBehavior=CONVERT_TO_NULL&serverTimezone=UTC";
private static final String LOGIN = "root";
private static final String MDP = "";
private static Connection con;
public static Connection getConnection(){
try {
///connexion base
con = DriverManager.getConnection(URL, LOGIN , MDP);
} catch (SQLException ex) {
//pop-up si erreur lors de la connexion
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setHeaderText("Erreur connection à la base");
alert.setContentText(ex.getMessage());
alert.show();
}
// retourne la connexion
return con;
}
}
|
package com.tt.option.ad;
import com.tt.miniapphost.AppBrandLogger;
import com.tt.miniapphost.util.NativeDimenUtil;
import org.json.JSONObject;
public final class h {
public String a;
public String b;
public int c;
public int d;
public int e;
public int f;
public int g;
public h(String paramString) {
try {
JSONObject jSONObject1 = new JSONObject(paramString);
this.a = jSONObject1.optString("adUnitId");
this.b = jSONObject1.optString("type");
JSONObject jSONObject2 = jSONObject1.optJSONObject("style");
if (jSONObject2 != null) {
this.c = NativeDimenUtil.convertRxToPx(jSONObject2.optInt("left", 0));
this.d = NativeDimenUtil.convertRxToPx(jSONObject2.optInt("top", 0));
this.e = NativeDimenUtil.convertRxToPx(jSONObject2.optInt("width", 0));
}
this.g = jSONObject1.optInt("adIntervals");
return;
} catch (Exception exception) {
AppBrandLogger.stacktrace(6, "GameAdModel", exception.getStackTrace());
return;
}
}
public final String toString() {
StringBuilder stringBuilder = new StringBuilder("GameAdModel{adUnitId='");
stringBuilder.append(this.a);
stringBuilder.append('\'');
stringBuilder.append(", type='");
stringBuilder.append(this.b);
stringBuilder.append('\'');
stringBuilder.append(", left=");
stringBuilder.append(this.c);
stringBuilder.append(", top=");
stringBuilder.append(this.d);
stringBuilder.append(", width=");
stringBuilder.append(this.e);
stringBuilder.append(", height=");
stringBuilder.append(this.f);
stringBuilder.append(", adIntervals=");
stringBuilder.append(this.g);
stringBuilder.append('}');
return stringBuilder.toString();
}
}
/* Location: C:\Users\august\Desktop\tik\df_miniapp\classes.jar!\com\tt\option\ad\h.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 1.1.3
*/ |
package com.mapr.music.api.graphql.errors;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonValue;
import graphql.ErrorType;
import graphql.ExceptionWhileDataFetching;
import graphql.execution.ExecutionPath;
import graphql.language.SourceLocation;
import java.util.List;
import java.util.Map;
public class GraphQLErrorWrapper extends ExceptionWhileDataFetching {
private final ExceptionWhileDataFetching inner;
public GraphQLErrorWrapper(ExceptionWhileDataFetching inner) {
super(ExecutionPath.rootPath(), new Exception(), null);
if (inner == null) {
throw new IllegalArgumentException("Exception can not be null");
}
this.inner = inner;
}
@JsonValue
public Throwable getCause() {
return inner.getException();
}
@Override
@JsonIgnore
public Throwable getException() {
return super.getException();
}
@Override
@JsonIgnore
public String getMessage() {
return null;
}
@Override
@JsonIgnore
public List<SourceLocation> getLocations() {
return null;
}
@Override
@JsonIgnore
public List<Object> getPath() {
return null;
}
@Override
@JsonIgnore
public Map<String, Object> getExtensions() {
return null;
}
@Override
@JsonIgnore
public ErrorType getErrorType() {
return null;
}
}
|
package com.solomon.service.impl;
import com.solomon.common.Constant;
import com.solomon.domain.*;
import com.solomon.service.ArticleService;
import com.solomon.service.LoggingDataService;
import com.solomon.service.QuestionService;
import com.solomon.vo.ArticleForm;
import com.solomon.vo.FormData;
import com.solomon.vo.QuestionForm;
import org.apache.commons.lang3.StringUtils;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.net.SocketTimeoutException;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.IntStream;
/**
* Created by xuehaipeng on 2017/6/13.
*/
@Service
public class LoggingDataServiceImpl implements LoggingDataService {
private static final Logger logger = LoggerFactory.getLogger(LoggingDataServiceImpl.class);
@Autowired
SimpMessagingTemplate messagingTemplate;
@Autowired
ArticleService articleService;
@Autowired
QuestionService questionService;
private static ThreadLocal<Integer> count = ThreadLocal.withInitial(() -> 0);
private static final AtomicInteger total = new AtomicInteger(1);
@Override
public Integer insertArticleOrQuestion(FormData form, String url, String random) {
if (form.getMenuId() == null) {
throw new RuntimeException("MenuId为空");
}
Map<String, String> resultMap = fetchArticleOrQuestion(form, url);
Matcher matcher = Constant.DATE_PATTERN.matcher(resultMap.get("originDate"));
String dateStr = matcher.find() ? matcher.group(0) : null;
if (dateStr == null) {
throw new RuntimeException("未发现合法日期字符串");
}
String[] dateArr = dateStr.split(Constant.DATE_DELIMITER);
if (dateArr[1].length() == 1) {
dateArr[1] = "0" + dateArr[1];
}
if (dateArr[2].length() == 1) {
dateArr[2] = "0" + dateArr[2];
}
java.sql.Date date = java.sql.Date.valueOf(StringUtils.join(dateArr, "-"));
final String destination = "/topic/progress/" + random + "_" + form.getStartIndex() + "_" + form.getEndIndex();
if (form instanceof ArticleForm) {
Article article = new Article();
article.setTitle(resultMap.get("title"));
article.setPublishedTime(date);
article.setContent(resultMap.get("content"));
article.setMenuId(form.getMenuId());
article.setKeyword(resultMap.get("keyword"));
try {
// articleService.insertArticle(article);
articleService.sentToPrd(article);
// articleService.insertMongoArticle((MongoArticle) MongoConverter.entityToMongo(article));
count.set(count.get() + 1);
messagingTemplate.convertAndSend(destination, count.get() + ":" + total.getAndIncrement());
System.out.println(article);
} catch (Exception e) {
logger.error("send article to prd failed: {}" ,e.getMessage());
}
} else if (form instanceof QuestionForm){
Question question = new Question();
question.setTitle(resultMap.get("title"));
question.setPublishedTime(date);
question.setQuestion(resultMap.get("question"));
question.setAnswer(resultMap.get("answer"));
question.setMenuId(form.getMenuId());
question.setKeyword(resultMap.get("keyword"));
try {
// questionService.insertMongoQuestion((MongoQuestion) MongoConverter.entityToMongo(question));
// questionService.insertQuestion(question);
questionService.sentToPrd(question);
count.set(count.get() + 1);
messagingTemplate.convertAndSend(destination, count.get() + ":" + total.getAndIncrement());
System.out.println(question);
} catch (Exception e) {
logger.error("send question to prd failed: {}" ,e.getMessage());
}
}
return count.get();
}
/**
* 抓取文章元素原始值,返回<字符串形式的k,v>
* @param form
* @param url
* @return
*/
@Override
public Map<String, String> fetchArticleOrQuestion(FormData form, String url) {
if (!url.contains("https://") && url.replace("http://", "").contains("//")) {
url = "http://" + url.replace("http://", "").replace("//", "/");
}
if (!url.startsWith("http://") && !url.startsWith("https://")) {
url = "http://" + url;
}
logger.info("Fetching {} ... ", url);
Map<String, String> resultMap = new ConcurrentHashMap<>();
Document doc = null;
try {
doc = Jsoup.connect(url).timeout(3000).get();
} catch (Exception e) {
try {
doc = Jsoup.connect(url).timeout(10_000).get();
} catch (IOException e1) {
if (e1 instanceof SocketTimeoutException) {
try {
doc = Jsoup.connect(url).timeout(60_000).get();
} catch (IOException ioe) {
logger.error("页面无法访问:{}\n{}", url, ioe.getMessage());
}
} else {
logger.error("IO异常:{}\n{}", url, e1.getMessage());
}
}
}
Element title = doc.select(form.getTitle()) == null ? null : doc.select(form.getTitle()).first();
if (title == null && !StringUtils.isEmpty(form.getTitle2())) {
title = doc.select(form.getTitle2()).first();
}
if (title == null || StringUtils.isBlank(title.text())) {
throw new RuntimeException("标题为空");
}
Element publish_date = doc.select(form.getPubDate1()) == null ? null : doc.select(form.getPubDate1()).first();
int j = 1;
while (doc.select(form.getPubDate1()).size() >= j && !publish_date.text().contains("20") && !publish_date.text().contains("19") && !publish_date.text().contains("分钟前")
&& !publish_date.text().contains("小时前") && !publish_date.text().contains("昨天") && !publish_date.text().replace("\\s+", "").contains("1天前")) {
publish_date = doc.select(form.getPubDate1()).get(j++);
}
if (publish_date == null && !StringUtils.isEmpty(form.getPubDate2())) {
publish_date = doc.select(form.getPubDate2()) == null ? null : doc.select(form.getPubDate2()).first();
}
if (publish_date == null && !StringUtils.isEmpty(form.getPubDate3())) {
publish_date = doc.select(form.getPubDate3()) == null ? null : doc.select(form.getPubDate3()).first();
}
if (publish_date == null) {
throw new RuntimeException("发布日期为空");
}
Element content = null;
Element question = null;
Element answer = null;
String exFirst = "";
String exLast = "";
String exclude2 = "";
if (form instanceof ArticleForm) {
ArticleForm articleForm = (ArticleForm) form;
content = doc.select(articleForm.getContent()).first();
if (content == null && StringUtils.isEmpty(articleForm.getContent2())) {
content = doc.select(articleForm.getContent2()) == null ? null : doc.select(articleForm.getContent2()).first();
}
if (content == null || StringUtils.isBlank(content.html())) {
throw new RuntimeException("内容为空");
}
if (articleForm.getExFirst() != null && articleForm.getExFirst()) {
exFirst = content.children().first().html();
}
if (articleForm.getExLast() != null && articleForm.getExLast()) {
exLast = content.children().last().html();
}
if (!StringUtils.isEmpty(articleForm.getExcluded2())) {
exclude2 = content.select(articleForm.getExcluded2()).first().html();
}
resultMap.put("content", content.html().replaceAll(Constant.REGEX_SCRIPT_TAG, "")
.replace(exFirst, "").replace(exLast, "").replace(exclude2, ""));
} else if (form instanceof QuestionForm) {
QuestionForm questionForm = (QuestionForm) form;
question = doc.select(questionForm.getQuestion()).first();
if (question == null) {
throw new RuntimeException("问题为空");
}
if (questionForm.getExFirst() != null && questionForm.getExFirst()) {
exFirst = question.children().first().html();
}
if (questionForm.getExLast() != null && questionForm.getExLast()) {
exLast = question.children().last().html();
}
if (!StringUtils.isEmpty(questionForm.getExcluded2())) {
exclude2 = question.select(questionForm.getExcluded2()).first().html();
}
String questionStr = StringUtils.isBlank(question.html()) ? title.html(): question.html();
resultMap.put("question", questionStr);
answer = doc.select(questionForm.getAnswer()).first();
if (answer != null) {
if (answer.children().size() > 3) {
final int size = answer.children().size();
for (int i = 3; i < size; i ++) {
answer.children().last().remove();
}
// IntStream.range(4, answer.children().size()).forEach(i -> answer.children().last().remove());
}
resultMap.put("answer", answer.html());
}
}
Elements keywords = StringUtils.isEmpty(form.getKeyword()) ? null : doc.select(form.getKeyword());
StringBuilder keywordStr = new StringBuilder("");
if (keywords != null) {
keywords.forEach(kw -> {
if (keywordStr.length() > 0) {
keywordStr.append("," + kw.text());
} else {
keywordStr.append(kw.text());
}
});
}
String originDate = publish_date.text();
if (originDate.contains("小时前") || originDate.contains("分钟前")) {
originDate = LocalDate.now().format(DateTimeFormatter.ISO_DATE);
}
if (originDate.contains("天前")) {
originDate = LocalDate.now().minusDays(1).format(DateTimeFormatter.ISO_DATE);
}
logger.info(title.text());
resultMap.put("title", title.text());
resultMap.put("originDate", originDate);
resultMap.put("keyword", keywordStr.toString());
return resultMap;
}
}
|
package ssh.thread;
import org.apache.hadoop.util.ToolRunner;
import ssh.eum.MRInfo;
import ssh.eum.MRLock;
import ssh.mr.ImportToHBase;
import ssh.util.HUtils;
/**
* 提交MR任务线程
*
* @author fansy
*
*/
public class Hdfs2HBaseRunnable implements Runnable {
private String hdfsFile;
private String tableName;
private String colDescription;
private String splitter;
private String dateFormat;
public Hdfs2HBaseRunnable(String hdfsFile, String tableName,
String colDesc, String splitter, String dateFormat) {
this.hdfsFile = hdfsFile;
this.tableName = tableName;
this.colDescription = colDesc;
this.splitter = splitter;
this.dateFormat = dateFormat;
}
@Override
public void run() {
// 提交MR任务
String[] args = new String[] { hdfsFile,// "/user/root/user.txt",
tableName,// "user",
splitter,// ",", 分隔符是否要转义?
colDescription,// "rk,info:name,info:birthday,info:gender,info:address,info:phone,info:bank",
dateFormat,// "yyyy-MM-dd HH:mm"
};
int ret = -1;
try {
ret = ToolRunner.run(HUtils.getConf(), new ImportToHBase(),
args);
} catch (Exception e) {
e.printStackTrace();
HUtils.addMrError(MRInfo.ERROR, "提交任务异常!");
return;
}
HUtils.addMrError(MRInfo.JOBRETURNCODE, String.valueOf(ret));
// no matter what ,unlock MRLock
HUtils.setMrLock(MRLock.NOTLOCKED);
}
public String getTableName() {
return tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
public String getColDescription() {
return colDescription;
}
public void setColDescription(String colDescription) {
this.colDescription = colDescription;
}
public String getSplitter() {
return splitter;
}
public void setSplitter(String splitter) {
this.splitter = splitter;
}
public String getDateFormat() {
return dateFormat;
}
public void setDateFormat(String dateFormat) {
this.dateFormat = dateFormat;
}
public String getHdfsFile() {
return hdfsFile;
}
public void setHdfsFile(String hdfsFile) {
this.hdfsFile = hdfsFile;
}
}
|
/*
* Copyright 2013 SciFY NPO <info@scify.org>.
*
* This product is part of the NewSum Free Software.
* For more information about NewSum visit
*
* http://www.scify.gr/site/en/our-projects/completed-projects/newsum-menu-en
*
* 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.
*
* If this code or its output is used, extended, re-engineered, integrated,
* or embedded to any extent in another software or hardware, there MUST be
* an explicit attribution to this work in the resulting source code,
* the packaging (where such packaging exists), or user interface
* (where such an interface exists).
* The attribution must be of the form "Powered by NewSum, SciFY"
*/
package org.scify.NewSumServer.Server.NewSumFreeService;
import gr.demokritos.iit.jinsect.storage.INSECTDB;
import gr.demokritos.iit.jinsect.storage.INSECTFileDB;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Locale;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import org.scify.NewSumServer.Server.Comms.Communicator;
import org.scify.NewSumServer.Server.Searching.Indexer;
import org.scify.NewSumServer.Server.Sources.RSSSources;
import org.scify.NewSumServer.Server.Storage.IDataStorage;
import org.scify.NewSumServer.Server.Storage.InsectFileIO;
import org.scify.NewSumServer.Server.Structures.Article;
import org.scify.NewSumServer.Server.Structures.Topic;
import org.scify.NewSumServer.Server.Summarisation.ArticleClusterer;
import org.scify.NewSumServer.Server.Summarisation.Summariser;
import org.scify.NewSumServer.Server.Utils.Utilities;
/**
*
* @author gkioumis
*/
@WebService(serviceName = "NewSumFreeService")
//@Stateless()
/**
* Executes all client calls and sends the appropriate responses.
*/
public class NewSumFreeService {
private static HashMap Switches = null;
protected IDataStorage ids;
protected RSSSources r;
protected ArticleClusterer ac;
protected INSECTDB idb;
protected Summariser sum;
protected Indexer ind;
protected Communicator cm;
public NewSumFreeService() {
Logger.getAnonymousLogger()
.log(Level.INFO, "Yahoo! {0}", new File(".").getAbsolutePath());
Switches = Communicator.getSwitches();
String sPath = (String) Switches.get("PathToSources");
Locale loc = sPath.endsWith("GR.txt") ? new Locale("el") : new Locale("en");
Logger.getAnonymousLogger().log(Level.INFO,
"Sending {0} messages", sPath.endsWith("EN.txt")?"ENg":"GRe");
ids = new InsectFileIO((String) Switches.get("BaseDir"));
r = new RSSSources((String) Switches.get("PathToSources"));
ac = new ArticleClusterer((ArrayList<Article>)ids.loadObject("AllArticles", "feeds"),
ids, (String) Switches.get("ArticlePath"));
idb = new INSECTFileDB((String) Switches.get("SummaryPath"), "");
sum = new Summariser(new HashSet<Topic>(
ids.readClusteredTopics().values()), idb);
ind = new Indexer((String) Switches.get("ArticlePath"),
(String) Switches.get("indexPath"), loc);
cm = new Communicator(ids, ac, sum, ind);
}
/**
* @deprecated
*/
@WebMethod(operationName = "getCategorySources")
public String getCategorySources(@WebParam(name = "sCategory") String sCategory) {
return cm.getCategorySources(sCategory);
}
/**
* Traverses the User Sources preference and returns the Categories that
* correspond to these Sources. <p>The Categories are packed in the
* format <br>Cat1-FLS-Cat2-FLS, etc.</p>
* @param sUserSources The user selected Sources. if "All", all sources
* are considered valid
* @return the categories that correspond to the specified user sources
*/
@WebMethod(operationName = "getCategories")
public String getCategories(@WebParam(name = "sUserSources") String sUserSources) {
String sCats = cm.getCategories(sUserSources);
Logger.getAnonymousLogger()
.log(Level.INFO, "Returning sources {0}", sCats);
return sCats;
}
/**
* Returns the Topics that correspond to the specified category and user
* sources. The Topics are packed in the format: <p>
* TopicID-SLS-TopicTitle-SLS-TopicDate-FLS-TopicID-SLS-TopicTitle-SLS-
* TopicDate</p> where <br>FLS is the First Level Separator, and <br>SLS is
* the Second Level Separator.<p>The Topics are sorted first of all by date,
* and secondly by each Topic's article count for the specific date.
* @param sUserSources the user sources preference
* @param sCategory the category of interest
* @return the Topics that correspond to the specified category and
* user sources.
*/
@WebMethod(operationName = "getTopicTitles")
public String getTopicTitles(@WebParam(name = "sUserSources") String sUserSources, @WebParam(name = "sCategory") String sCategory) {
// String sTopicTitles = cm.getTopicTitles(sUserSources, sCategory); // version Beta
// version 1.0
String sTopicTitles = cm.getTopics(sUserSources, sCategory);
// String sTopicTitles = cm.getTopicTitlesSorted(sUserSources, sCategory);
// cm.checkTopicTitles(sUserSources, sCategory);
Logger.getAnonymousLogger()
.log(Level.INFO, "Got Category {0}", sCategory);
Logger.getAnonymousLogger()
.log(Level.INFO, "Got User Sources {0}", sUserSources);
Logger.getAnonymousLogger()
.log(Level.INFO, "Returning Titles {0}", sTopicTitles);
return sTopicTitles;
}
/**
* Returns the summary for the specified ID. <p>The summary is packed in the
* format: Object-FLS-Object-FLS-Object <br>where<br>FLS is the First Level
* Separator.(@see {@link #getFirstLevelSeparator() })
* <br>The First object of the summary is the data containing the
* sources with their corresponding labels, i.e. if the summary is derived
* from two sources, the first object will be like <br>Source-TLS-Label-SLS-
* Source-TLS-Label<br>The remaining objects are the summary contents, i.e. if
* the summary contains only two sentences, it will be like <br>Sentence-SLS
* - SourceLink-SLS-feed-SLS-Label<br>FLS<br>Sentence-SLS-SourceLink-SLS-feed-SLS
* -Label<br></p><p>Sentence is a specific snippet of a topic,
* <br>SourceLink is the URL Link to the article that the snippet comes from,
* <br>feed is the RSS feed that the snippet was taken from, and <br>Label is
* the label for the specified SourceLink. <br>Likewise,
* </p><p>SLS corresponds to the Second Level Separator, @see
* {@link #getSecondLevelSeparator() },and<br>TLS to the Third Level
* Separator (@see {@link #getThirdLevelSeparator() })
* </p>
* @param sTopicID The topic ID of interest
* @param sUserSources The user selected sources. If "All", all sources
* are considered valid
* @return The summary that corresponds to the specified ID
*/
@WebMethod(operationName = "getSummary")
public String getSummary(@WebParam(name = "sTopicID") String sTopicID, @WebParam(name = "sUserSources") String sUserSources) {
if (sTopicID == null || sTopicID.equals("") || sTopicID.equals("anyType{}")) {
return "";
}
// debug
String Title = cm.getTopicTitleByID(sTopicID);
String str = "Got Topic ID " + sTopicID + " = " + Title;
Logger.getAnonymousLogger()
.log(Level.INFO, str);
// debug
String summary = cm.getSummary(sTopicID, sUserSources);
if (summary.contains(cm.getFirstLevelSeparator())) {
// debug
String [] aSum = summary.split(cm.getFirstLevelSeparator());
int count = Utilities.countDiffArticles(aSum);
Logger.getAnonymousLogger()
.log(Level.INFO, "Summary From {0} Articles", count);
Logger.getAnonymousLogger()
.log(Level.INFO, "Returning Summary: {0}", summary);
// debug
return summary;
} else if (!summary.equals("")) {
return summary+cm.getFirstLevelSeparator();
} else {
// debug
Logger.getAnonymousLogger()
.log(Level.INFO, "Returning Summary: \" \" {0}", summary);
// debug
return summary; // = ""
}
}
/**
* @deprecated
*/
@WebMethod(operationName = "getTopicTitlesByIDs")
public String getTopicTitlesByIDs(@WebParam(name = "sTopicIDs") String sTopicIDs) {
String str = "Got Topic IDs: " + sTopicIDs;
Logger.getAnonymousLogger()
.log(Level.INFO, str);
String Titles = cm.getTopicTitlesByIDs(sTopicIDs);
Logger.getAnonymousLogger()
.log(Level.INFO, "Returning Topic Titles {0}", Titles);
return Titles;
}
/**
* Web service operation
*/
@WebMethod(operationName = "getTopicTitlesByID")
public String getTopicTitlesByID(@WebParam(name = "sTopicID") String sTopicID) {
return cm.getTopicTitlesByID(sTopicID);
}
/**
* Web service operation
*/
@WebMethod(operationName = "getTopicIDs")
public String getTopicIDs(@WebParam(name = "sUserSources") String sUserSources, @WebParam(name = "sCategory") String sCategory) {
String sTopicIDs = cm.getTopicIDs(sUserSources, sCategory);
Logger.getAnonymousLogger()
.log(Level.INFO, "Got Category {0}", sCategory);
Logger.getAnonymousLogger()
.log(Level.INFO, "Returning Topic IDs {0}", sTopicIDs);
return sTopicIDs;
}
/**
* @deprecated
*/
@WebMethod(operationName = "getTopicIDsByKeyword")
public String getTopicIDsByKeyword(@WebParam(name = "sKeyword") String sKeyword, @WebParam(name = "sUserSources") String sUserSources) {
Logger.getAnonymousLogger().
log(Level.INFO, "INDEXPATH: {0}", (String) Switches.get("indexPath"));
String sTopicIDs = cm.getTopicIDsByKeyword(this.ind, sKeyword, sUserSources);
Logger.getAnonymousLogger()
.log(Level.INFO, "Got Keyword {0}", sKeyword);
Logger.getAnonymousLogger()
.log(Level.INFO, "Returning Topic IDs {0}", sTopicIDs);
return sTopicIDs;
}
/**
*
* @return The links (i.e. RSS feeds) and their assigned labels
*/
@WebMethod(operationName = "getLinkLabels")
public String getLinkLabels() {
String linkLabels = cm.getLinkLabelsFromFile();
Logger.getAnonymousLogger()
.log(Level.INFO, "Returning LinksLabels {0} ", linkLabels);
return linkLabels;
}
/**
* The First level separator is used for level one unpacking of
* transferred strings.
* @return The first level separator
*/
@WebMethod(operationName = "getFirstLevelSeparator")
public String getFirstLevelSeparator() {
return cm.getFirstLevelSeparator();
}
/**
* The Second level separator is used for level two unpacking of
* transferred strings.
* @return The second level separator
*/
@WebMethod(operationName = "getSecondLevelSeparator")
public String getSecondLevelSeparator() {
return cm.getSecondLevelSeparator();
}
/**
* The Third level separator is used for level three unpacking of
* transferred strings.
* @return The third level separator
*/
@WebMethod(operationName = "getThirdLevelSeparator")
public String getThirdLevelSeparator() {
return cm.getThirdLevelSeparator();
}
/**
* Searches the Topic index for the specified keyword, and returns all topics
* that correspond to that keyword. The topics are sorted by the number of
* appearances of the keyword. The Topics are packed in the format: <p>
* TopicID-SLS-TopicTitle-SLS-TopicDate-FLS-TopicID-SLS-TopicTitle-SLS-
* TopicDate</p> where <br>FLS is the First Level Separator, and <br>SLS is
* the Second Level Separator.
* @param sKeyword the user search entry
* @param sUserSources the user sources preference. if "All", all sources
* are considered valid
* @return the topics found for the specified keyword
*/
@WebMethod(operationName = "getTopicsByKeyword")
public String getTopicsByKeyword(@WebParam(name = "sKeyword") String sKeyword, @WebParam(name = "sUserSources") String sUserSources) {
//TODO write your implementation code here:
String sTopics = cm.getTopicsByKeyword(this.ind, sKeyword, sUserSources);
Logger.getAnonymousLogger()
.log(Level.INFO, "Got Keyword {0}", sKeyword);
Logger.getAnonymousLogger()
.log(Level.INFO, "Returning Topics {0}", sTopics);
if (sTopics.contains(cm.getFirstLevelSeparator())) { // if more than one topics found
return sTopics;
} else if (sTopics.contains(cm.getSecondLevelSeparator())) { // if only one Topic found
return sTopics;
} else { // no topics found
return "";
}
}
}
|
/*
* 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 rh.gob.igm.ec;
import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
/**
*
* @author TOAPANTA_JUAN
*/
@Entity
@Table(name = "T_TIPOS_CONTRATO")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "TTiposContrato.findAll", query = "SELECT t FROM TTiposContrato t")
, @NamedQuery(name = "TTiposContrato.findByCContrato", query = "SELECT t FROM TTiposContrato t WHERE t.cContrato = :cContrato")
, @NamedQuery(name = "TTiposContrato.findByDescrip", query = "SELECT t FROM TTiposContrato t WHERE t.descrip = :descrip")
, @NamedQuery(name = "TTiposContrato.findByLDuracion", query = "SELECT t FROM TTiposContrato t WHERE t.lDuracion = :lDuracion")
, @NamedQuery(name = "TTiposContrato.findByTTiempo", query = "SELECT t FROM TTiposContrato t WHERE t.tTiempo = :tTiempo")
, @NamedQuery(name = "TTiposContrato.findByDuracion", query = "SELECT t FROM TTiposContrato t WHERE t.duracion = :duracion")
, @NamedQuery(name = "TTiposContrato.findByLValido", query = "SELECT t FROM TTiposContrato t WHERE t.lValido = :lValido")})
public class TTiposContrato implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@NotNull
@Column(name = "C_CONTRATO")
private Short cContrato;
@Size(max = 100)
@Column(name = "DESCRIP")
private String descrip;
@Column(name = "L_DURACION")
private Short lDuracion;
@Size(max = 1)
@Column(name = "T_TIEMPO")
private String tTiempo;
@Column(name = "DURACION")
private Short duracion;
@Column(name = "L_VALIDO")
private Short lValido;
@OneToMany(mappedBy = "cContrato")
private List<TContrataciones> tContratacionesList;
public TTiposContrato() {
}
public TTiposContrato(Short cContrato) {
this.cContrato = cContrato;
}
public Short getCContrato() {
return cContrato;
}
public void setCContrato(Short cContrato) {
this.cContrato = cContrato;
}
public String getDescrip() {
return descrip;
}
public void setDescrip(String descrip) {
this.descrip = descrip;
}
public Short getLDuracion() {
return lDuracion;
}
public void setLDuracion(Short lDuracion) {
this.lDuracion = lDuracion;
}
public String getTTiempo() {
return tTiempo;
}
public void setTTiempo(String tTiempo) {
this.tTiempo = tTiempo;
}
public Short getDuracion() {
return duracion;
}
public void setDuracion(Short duracion) {
this.duracion = duracion;
}
public Short getLValido() {
return lValido;
}
public void setLValido(Short lValido) {
this.lValido = lValido;
}
@XmlTransient
public List<TContrataciones> getTContratacionesList() {
return tContratacionesList;
}
public void setTContratacionesList(List<TContrataciones> tContratacionesList) {
this.tContratacionesList = tContratacionesList;
}
@Override
public int hashCode() {
int hash = 0;
hash += (cContrato != null ? cContrato.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof TTiposContrato)) {
return false;
}
TTiposContrato other = (TTiposContrato) object;
if ((this.cContrato == null && other.cContrato != null) || (this.cContrato != null && !this.cContrato.equals(other.cContrato))) {
return false;
}
return true;
}
@Override
public String toString() {
return "gob.igm.ec.rh.TTiposContrato[ cContrato=" + cContrato + " ]";
}
}
|
package com.team_linne.digimov.exception;
public class MovieSessionNotFoundException extends RuntimeException {
public static final String MOVIE_NOT_FOUND = "Movie Session not found";
public MovieSessionNotFoundException() {
super(MOVIE_NOT_FOUND);
}
}
|
package pl.lua.aws.core.filter;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.oauth2.client.authentication.OAuth2AuthenticationToken;
import org.springframework.security.oauth2.core.oidc.user.DefaultOidcUser;
import pl.lua.aws.core.model.PokerPlayerEntity;
import pl.lua.aws.core.model.RoleEntity;
import pl.lua.aws.core.model.UserEntity;
import pl.lua.aws.core.repository.PokerPlayerRepository;
import pl.lua.aws.core.repository.UserRepository;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Slf4j
@Data
public class UserFilter implements Filter {
@Autowired
private UserRepository userRepository;
@Autowired
private PokerPlayerRepository pokerPlayerRepository;
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) servletRequest;
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if(authentication !=null && authentication.getPrincipal()!=null && request.getRequestURI().equals("/loginSuccess") ){
if(authentication.getPrincipal() instanceof DefaultOidcUser){
if(userRepository.existsById(authentication.getName())){
log.info("User with id {} already registered in application. Log in success",authentication.getName());
}else{
createUserAndRoles(authentication);
log.info("Create new user with id {} in application. Log in success",authentication.getName());
}
}
}
filterChain.doFilter(servletRequest,servletResponse);
}
private void createUserAndRoles(Authentication authentication) {
DefaultOidcUser oidcUser = (DefaultOidcUser)authentication.getPrincipal();
OAuth2AuthenticationToken auth2AuthenticationToken = (OAuth2AuthenticationToken) authentication;
UserEntity userEntity = new UserEntity();
userEntity.setId(authentication.getName());
userEntity.setEmail(oidcUser.getEmail());
userEntity.setName(oidcUser.getFullName());
userEntity.setRegistrationDate(new Date());
userEntity.setAuthenticationProvider(auth2AuthenticationToken.getAuthorizedClientRegistrationId());
PokerPlayerEntity pokerPlayerEntity = new PokerPlayerEntity();
pokerPlayerEntity.setNickName(oidcUser.getFullName());
pokerPlayerEntity = pokerPlayerRepository.save(pokerPlayerEntity);
userEntity.setPlayerId(pokerPlayerEntity.getId());
List<RoleEntity> roles = new ArrayList<>();
RoleEntity roleUser = new RoleEntity();
roleUser.setAuthority("User");
roles.add(roleUser);
if (oidcUser.getEmail().equals("luafanti@gmail.com")) {
RoleEntity roleAdmin = new RoleEntity();
roleAdmin.setAuthority("Admin");
roles.add(roleAdmin);
}
userEntity.setRoles(roles);
userRepository.save(userEntity);
}
}
|
package solutions.lab1;
import lab1.RubiksCube;
import aima.core.search.framework.HeuristicFunction;
public class CornerManhattanDistance implements HeuristicFunction{
private int [][][] goal;
private int n;
public CornerManhattanDistance(RubiksCube rc) {
n = rc.getState().length;
goal = new int[n][n][n];
int counter = 1;
for (int i = 0; i < n; i++){
for (int j = 0; j < n; j++){
for (int k = 0; k < n; k++){
goal[i][j][k] = counter;
counter++;
}
}
}
}
@Override
public double h(Object state) {
RubiksCube rc = (RubiksCube) state;
int cornerVal = 0;
for (int i = 0; i < n; i++){
for (int j = 0; j < n; j++){
for (int k = 0; k < n; k++){
if(isCorner(i, j, k, n-1))
cornerVal += evaluateManhattanDistanceOf(rc.getState()[i][j][k].getId(), i, j, k, goal);
}
}
}
return (((double)cornerVal)/4);
}
private int evaluateManhattanDistanceOf(int id, int i, int j, int k, int[][][] goal) {
for (int i1 = 0; i1 < goal.length; i1++){
for (int j1 = 0; j1 < goal.length; j1++){
for (int k1 = 0; k1 < goal.length; k1++){
if(goal[i1][j1][k1] == id){
return (Math.abs(i1-i)+Math.abs(j1-j)+Math.abs(k1-k));
}
}
}
}
return 0;
}
private boolean isCorner(int i, int j, int k, int n){
if((i == 0 || i == n) && (j == 0 || j == n) && (k == 0 || k == n)) return true;
return false;
}
}
|
/**
* Created by SeAxiAoD on 2019/11/25.
*/
import java.util.ArrayList;
import java.util.Comparator;
public class MultiTreeNode {
private int message_value;
private int spine_value;
private RNG rng;
private double cost;
private MultiTreeNode parent;
private ArrayList<MultiTreeNode> child;
/**
* Multi-tree node.
*
* @param message_value Integer array of message values.
* @param spine_value Integer array of spine values.
* @param rng Random number generator.
*
*/
public MultiTreeNode(int message_value, int spine_value, RNG rng) {
this.message_value = message_value;
this.spine_value = spine_value;
this.rng = rng;
}
/**
* @return A 32-bit value, the last c bits contains the random number.
*/
public int getNextRNGValue() {
return this.rng.next();
}
/**
* Getters and setters.
*/
public double getCost() {
return cost;
}
public void setCost(double cost) {
this.cost = cost;
}
public int getMessage_value() {
return message_value;
}
public void setMessage_value(int message_value) {
this.message_value = message_value;
}
public int getSpine_value() {
return spine_value;
}
public void setSpine_value(int spine_value) {
this.spine_value = spine_value;
}
public MultiTreeNode getParent() {
return parent;
}
public void setParent(MultiTreeNode parent) {
this.parent = parent;
}
public ArrayList<MultiTreeNode> getChild() {
return child;
}
public void setChild(ArrayList<MultiTreeNode> child) {
this.child = child;
}
}
|
package controllers;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.input.MouseEvent;
import javafx.stage.Stage;
import java.io.IOException;
public class step3Controller {
public void toStep2(MouseEvent mouseEvent) throws IOException {
Stage stage = (Stage) ((Node)mouseEvent.getSource()).getScene().getWindow();
Parent root = FXMLLoader.load(getClass().getResource("/resources/step2.fxml"));
stage.setScene(new Scene(root));
}
public void toStep4(MouseEvent mouseEvent) throws IOException {
Stage stage = (Stage) ((Node)mouseEvent.getSource()).getScene().getWindow();
Parent root = FXMLLoader.load(getClass().getResource("/resources/step4.fxml"));
stage.setScene(new Scene(root));
}
}
|
package com.leetcode.wangruns;
import com.leetcode.wangruns.Leetcode.TreeNode;
//22、sum-root-to-leaf-numbers[树]
/**
* Given a binary tree containing digits from0-9only, each root-to-leaf path could represent a number.
* An example is the root-to-leaf path1->2->3which represents the number123
* Find the total sum of all root-to-leaf numbers.
* For example,
1
/ \
2 3
* The root-to-leaf path1->2represents the number12.
* The root-to-leaf path1->3represents the number13.
* Return the sum = 12 + 13 =25.
*
* 可以观察到当前节点的路径和为上一个节点的和*10+当前节点的值
* 0*10+1=1
* 1*10+2=12
* 1*10+3=13
*/
public class SumRootToLeafNumbers022 {
public int sumNumbers(TreeNode root) {
int sum = 0;
sum = preorderSum(root, 0);
return sum;
}
// 获取根节点到当前节点的路径和
private int preorderSum(TreeNode root, int sum) {
if (root == null)
return 0;
sum = sum * 10 + root.val;
//如果已经到了叶节点,则完成了一条路径,返回
if (root.left == null && root.right == null)
return sum;
return preorderSum(root.left, sum) + preorderSum(root.right, sum);
}
}
|
package zm.gov.moh.core.repository.database.dao.domain;
import org.threeten.bp.LocalDateTime;
import androidx.lifecycle.LiveData;
import java.util.List;
import androidx.room.*;
import zm.gov.moh.core.repository.database.dao.Synchronizable;
import zm.gov.moh.core.repository.database.entity.domain.Person;
import zm.gov.moh.core.repository.database.entity.domain.PersonName;
@Dao
public interface PersonDao extends Synchronizable<Person> {
//gets all persons
@Query("SELECT * FROM person")
LiveData<List<Person>> getAll();
@Query("SELECT MAX(datetime) AS datetime FROM (SELECT CASE WHEN COALESCE(date_created,'1970-01-01T00:00:00') >= COALESCE(date_changed,'1970-01-01T00:00:00') THEN date_created ELSE date_changed END datetime FROM person WHERE person_id IN (SELECT DISTINCT patient_id FROM patient_identifier WHERE location_id = :locationId) AND uuid IS NOT NULL)")
LocalDateTime getMaxDatetime(long locationId);
@Query("SELECT * FROM person")
List<Person> getAllT();
@Query("SELECT person_id FROM person")
List<Long> getIds();
// Inserts single getPersons
@Insert(onConflict = OnConflictStrategy.REPLACE)
void insert(Person person);
@Insert(onConflict = OnConflictStrategy.REPLACE)
void insert(List<Person> person);
// Inserts single getPersons
@Insert(onConflict = OnConflictStrategy.REPLACE)
void insert(Person... persons);
//get getPersons by id
@Query("SELECT * FROM person WHERE person_id = :id")
Person findById(long id);
@Query("SELECT uuid FROM person WHERE person_id = :patientId")
String findByPatientId(long patientId);
@Query("UPDATE person SET person_id = :remote WHERE person_id = :local ")
void replacePerson(long local, long remote );
@Query("SELECT MAX(person_id) FROM person")
Long getMaxId();
@Override
@Query("SELECT * FROM (SELECT * FROM person WHERE person_id NOT IN (:id)) WHERE person_id >= :offsetId")
Person[] findEntityNotWithId(long offsetId,long[] id);
//get persons phone number
@Query("SELECT value from person_attribute WHERE person_id=:personID AND person_attribute_type_id=8 ")
String getPersonPhoneumberById(Long personID);
//get person nrc number
@Query("SELECT value from person_attribute WHERE person_id=:personID AND person_attribute_type_id=12")
String getPersonNRCNumberbyId(Long personID);
//update person nrc number
@Query("Update person_attribute SET value=:newNRCNumber,date_changed=:lastDateModified WHERE person_id=:personID AND person_attribute_type_id=8")
void updateNRCNumberBydID(Long personID, String newNRCNumber, LocalDateTime lastDateModified);
} |
package com.timmy.rxjava.ui.adapter;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.timmy.rxjava.R;
import com.timmy.rxjava.model.AppInfo;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Administrator on 2016/7/14 0014.
*/
public class AppInfoAdapter extends RecyclerView.Adapter<AppInfoAdapter.AppHolder> {
private Context mContext;
private List<AppInfo> mData = new ArrayList<>();
public AppInfoAdapter(Context context) {
this.mContext = context;
}
public void setData(List<AppInfo> listData) {
this.mData = listData;
notifyDataSetChanged();
}
@Override
public AppHolder onCreateViewHolder(ViewGroup parent, int viewType) {
return new AppHolder(LayoutInflater.from(mContext).inflate(R.layout.item_app_info, parent, false));
}
@Override
public void onBindViewHolder(AppHolder holder, int position) {
AppInfo appInfo = mData.get(position);
holder.mAppIcon.setImageDrawable(appInfo.getAppIcon());
// ImageUtil.load(holder.mAppIcon, appInfo.getIcon());
holder.mAppName.setText(appInfo.getAppName());
holder.mAppInfo.setText(appInfo.getPackageName() + "-" + appInfo.getVersionName());
holder.mIsSystem.setText(appInfo.isSystem() ? "系统应用" : "普通应用");
}
@Override
public int getItemCount() {
return mData.size();
}
public class AppHolder extends RecyclerView.ViewHolder {
private ImageView mAppIcon;
private TextView mAppName;
private TextView mAppInfo;
private TextView mIsSystem;
public AppHolder(View itemView) {
super(itemView);
mAppIcon = (ImageView) itemView.findViewById(R.id.iv_icon);
mAppName = (TextView) itemView.findViewById(R.id.tv_name);
mAppInfo = (TextView) itemView.findViewById(R.id.tv_app_info);
mIsSystem = (TextView) itemView.findViewById(R.id.tv_system);
}
}
}
|
package com.example.thenewbostonapplicationtest;
import java.io.IOException;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.app.Activity;
import android.os.AsyncTask;
import android.os.Bundle;
import android.widget.TextView;
import android.widget.Toast;
public class HttpExample extends Activity{
TextView httpStuff;
HttpClient client ;
JSONObject jsonTweet;
final static String URL = "http://api.twitter.com/1/statuses/user_timeline.json?screen_name=";
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.httpexample);
httpStuff = (TextView) findViewById(R.id.tvHttp);
client = new DefaultHttpClient();
new Read().execute("text");
/* uncomment this block to get page source
GetMethodEx test = new GetMethodEx();
String returned;
try {
returned = test.getInternetData();
httpStuff.setText(returned);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
*/
}
public JSONObject lastTweet(String username) throws ClientProtocolException, IOException, JSONException{
StringBuilder sbUrl = new StringBuilder(URL);
sbUrl.append(username);
HttpGet get = new HttpGet(sbUrl.toString());
HttpResponse httpResponse = client.execute(get);
//check for successful connection
int status = httpResponse.getStatusLine().getStatusCode();
if(status == 200){
HttpEntity httpEntity = httpResponse.getEntity();
String data = EntityUtils.toString(httpEntity);
JSONArray timeline = new JSONArray(data);
JSONObject lastTweet = timeline.getJSONObject(0);
return lastTweet;
}else {
Toast.makeText(HttpExample.this, "error", Toast.LENGTH_LONG).show();
return null;
}
}
public class Read extends AsyncTask<String, Integer, String>{
@Override
protected String doInBackground(String... str) {
// TODO Auto-generated method stub
try {
jsonTweet = lastTweet("ivandimitrov24");
return jsonTweet.getString(str[0]);
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(String result) {
// TODO Auto-generated method stub
httpStuff.setText(result);
}
}
}
|
package com.jim.multipos.ui.discount.fragments;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.SimpleItemAnimator;
import com.jim.mpviews.MpButton;
import com.jim.multipos.R;
import com.jim.multipos.core.BaseFragment;
import com.jim.multipos.data.db.model.Discount;
import com.jim.multipos.ui.discount.adapters.DiscountListAdapter;
import com.jim.multipos.ui.discount.model.DiscountApaterDetials;
import com.jim.multipos.ui.discount.presenters.DiscountAddingPresenter;
import com.jim.multipos.ui.discount.presenters.DiscountAddingPresenterImpl;
import com.jim.multipos.utils.RxBus;
import com.jim.multipos.utils.WarningDialog;
import com.jim.multipos.utils.rxevents.main_order_events.DiscountEvent;
import java.util.List;
import javax.inject.Inject;
import butterknife.BindView;
/**
* Created by developer on 23.10.2017.
*/
public class DiscountAddingFragment extends BaseFragment implements DiscountAddingView {
@Inject
DiscountListAdapter discountListAdapter;
@Inject
DiscountAddingPresenter presenter;
@Inject
RxBus rxBus;
@BindView(R.id.rvDiscounts)
RecyclerView rvDiscounts;
@BindView(R.id.btnCancel)
MpButton btnCancel;
@Override
protected int getLayout() {
return R.layout.discount_adding_list;
}
@Override
protected void init(Bundle savedInstanceState) {
presenter.onCreateView(savedInstanceState);
discountListAdapter.setListners(new DiscountListAdapter.OnDiscountCallback() {
@Override
public void onAddPressed(double amount, int amountTypeAbbr, String discription, int usedTypeAbbr, boolean active) {
presenter.onAddPressed(amount, amountTypeAbbr, discription, usedTypeAbbr, active);
}
@Override
public void onSave(double amount, int amountTypeAbbr, String discription, int usedTypeAbbr, boolean active, Discount discount) {
presenter.onSave(amount, amountTypeAbbr, discription, usedTypeAbbr, active, discount);
}
@Override
public void onDelete(Discount discount) {
presenter.onDelete(discount);
}
@Override
public void sortList(DiscountAddingPresenterImpl.DiscountSortTypes discountSortTypes) {
presenter.sortList(discountSortTypes);
}
});
rvDiscounts.setLayoutManager(new LinearLayoutManager(getContext()));
rvDiscounts.setAdapter(discountListAdapter);
((SimpleItemAnimator) rvDiscounts.getItemAnimator()).setSupportsChangeAnimations(false);
btnCancel.setOnClickListener(view -> {
presenter.onCloseAction();
});
}
@Override
public void refreshList(List<DiscountApaterDetials> objects) {
discountListAdapter.setData(objects);
discountListAdapter.notifyDataSetChanged();
}
@Override
public void refreshList() {
discountListAdapter.notifyDataSetChanged();
}
@Override
public void notifyItemChanged(int pos) {
discountListAdapter.notifyItemChanged(pos);
}
@Override
public void notifyItemAddRange(int from, int to) {
discountListAdapter.notifyItemRangeInserted(from, to);
}
@Override
public void notifyItemAdd(int pos) {
discountListAdapter.notifyItemInserted(pos);
}
@Override
public void notifyItemRemove(int pos) {
discountListAdapter.notifyItemRemoved(pos);
}
@Override
public void notifyItemRemoveRange(int from, int to) {
discountListAdapter.notifyItemRangeRemoved(from, to);
}
@Override
public void closeAction() {
presenter.onCloseAction();
}
@Override
public void closeDiscountActivity() {
getActivity().finish();
}
@Override
public void openWarning() {
WarningDialog warningDialog = new WarningDialog(getActivity());
warningDialog.setWarningMessage(getString(R.string.discard_discounts));
warningDialog.setOnYesClickListener(view1 -> warningDialog.dismiss());
warningDialog.setOnNoClickListener(view1 -> closeDiscountActivity());
warningDialog.setPositiveButtonText(getString(R.string.cancel));
warningDialog.setNegativeButtonText(getString(R.string.discard));
warningDialog.show();
}
@Override
public void sendEvent(int event, Discount discount) {
rxBus.send(new DiscountEvent(discount, event));
}
@Override
public void sendChangeEvent(int event, Discount updated) {
DiscountEvent discountEvent = new DiscountEvent(updated, event);
rxBus.send(discountEvent);
}
}
|
/**
* UserRolesAuthorizer.java
*
* Skarpetis Dimitris 2016, all rights reserved.
*/
package dskarpetis.elibrary.ui;
import org.apache.wicket.Session;
import org.apache.wicket.authroles.authorization.strategies.role.IRoleCheckingStrategy;
import org.apache.wicket.authroles.authorization.strategies.role.Roles;
/**
* Class that defines the strategy for doing role checking
*
* @author dskarpetis
*/
public class UserRolesAuthorizer implements IRoleCheckingStrategy {
/**
* Default constructor.
*/
public UserRolesAuthorizer() {
}
/**
* Check if any of the given roles matches.
*/
@Override
public boolean hasAnyRole(Roles roles) {
ElibrarySession authSession = (ElibrarySession) Session.get();
try {
return authSession.getUserLogin().hasAnyRole(roles);
} catch (NullPointerException e) {
}
return false;
}
}
|
package org.fuserleer;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.util.Objects;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.AbstractHandler;
import org.eclipse.jetty.server.handler.ContextHandler;
import org.fuserleer.crypto.Hash;
import org.fuserleer.exceptions.StartupException;
import org.fuserleer.exceptions.TerminationException;
import org.fuserleer.ledger.SearchResult;
import org.fuserleer.ledger.StateAddress;
import org.fuserleer.ledger.StateSearchQuery;
import org.fuserleer.ledger.atoms.Atom;
import org.fuserleer.ledger.atoms.HostedFileParticle;
import org.java_websocket.WebSocketImpl;
public class WebServer implements Service
{
private class Handler extends AbstractHandler
{
@Override
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
String pathInfo = baseRequest.getPathInfo().toLowerCase();
StateAddress stateAddress = new StateAddress(HostedFileParticle.class, Hash.from(pathInfo));
Future<SearchResult> searchFuture = Context.get().getLedger().get(new StateSearchQuery(stateAddress, Atom.class));
try
{
SearchResult searchResult = searchFuture.get(5, TimeUnit.SECONDS);
if (searchResult == null)
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
else
{
Atom atom = searchResult.getPrimitive();
if (atom == null)
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
else
{
boolean found = false;
for (HostedFileParticle hostedFileParticle : atom.getParticles(HostedFileParticle.class))
{
if (hostedFileParticle.getPath().compareToIgnoreCase(pathInfo) != 0)
continue;
response.setContentType(hostedFileParticle.getContentType());
response.getOutputStream().write(hostedFileParticle.getData());
response.getOutputStream().flush();
found = true;
break;
}
if (found == true)
response.setStatus(HttpServletResponse.SC_OK);
else
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
}
}
}
catch (TimeoutException toex)
{
response.setStatus(HttpServletResponse.SC_REQUEST_TIMEOUT);
}
catch (Exception ex)
{
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
ex.printStackTrace();
}
baseRequest.setHandled(true);
}
}
private final Context context;
private final Server server;
private final Handler handler;
public WebServer(final Context context)
{
super();
this.context = Objects.requireNonNull(context, "Context is null");
this.server = new Server(new InetSocketAddress(context.getConfiguration().get("webserver.address", "0.0.0.0"), context.getConfiguration().get("webserver.port", WebSocketImpl.DEFAULT_PORT)));
this.handler = new Handler();
ContextHandler con = new ContextHandler();
con.setContextPath("/");
con.setHandler(this.handler);
this.server.setHandler(con);
}
@Override
public void start() throws StartupException
{
try
{
this.server.start();
}
catch (Exception ex)
{
throw new StartupException(ex);
}
}
@Override
public void stop() throws TerminationException
{
try
{
this.server.stop();
}
catch (Exception ex)
{
throw new TerminationException(ex);
}
}
}
|
package com.milos.config;
public class ServerPort {
private int value;
public ServerPort(int value) throws IllegalArgumentException {
if (value < 1) {
throw new IllegalArgumentException("Server port value must be greater than zero");
}
this.value = value;
}
public int getValue() {
return this.value;
}
@Override
public String toString() {
return String.valueOf(value);
}
}
|
import java.util.Scanner;
class Main
{
public static void main(String args[])
{
Scanner in=new Scanner(System.in);
int n=in.nextInt();
switch(n)
{
case 4:
System.out.println("24");
break;
case 8:
System.out.println("40320");
break;
}
}
} |
/**
*
*/
/**
* @author Matt
*
*/
public class Prob4 {
/**
* @param args
*/
// test si nb est un palindrom
public boolean palindrom(int nb) {
boolean palindrom = false;
if ((nb / 100000 == nb % 10 && (nb / 10000) % 10 == (nb / 10) % 10)
&& (nb / 1000) % 10 == (nb % 1000) / 100)
palindrom = true;
return palindrom;
}
// effectue des produits et affiche le plus grand palindrom
public void prod() {
int prod = 0;
int a = 0;
int b = 0;
for (int i = 100; i < 1000; i++)
for (int j = 100; j < 1000; j++)
if (palindrom(i * j) && (prod < i * j)) {
prod = i * j;
a = i;
b = j;
}
System.out.println(prod + " = " + a + " * " + b);
}
public static void main(String[] args) {
// TODO Auto-generated method stub
Prob4 ap = new Prob4();
ap.prod();
}
}
|
package com.meridal.examples.domain;
/**
* Vehicle.
* @author Martin Ingram
*/
public class Vehicle extends SimpleVehicle {
private static final long serialVersionUID = 1L;
private Certificate inspection;
private Certificate insurance;
private Certificate tax;
public Certificate getInspection() {
return inspection;
}
public void setInspection(Certificate inspection) {
this.inspection = inspection;
}
public Certificate getInsurance() {
return insurance;
}
public void setInsurance(Certificate insurance) {
this.insurance = insurance;
}
public Certificate getTax() {
return tax;
}
public void setTax(Certificate tax) {
this.tax = tax;
}
}
|
package com.zwh.action;
import com.google.code.kaptcha.impl.DefaultKaptcha;
import com.zwh.model.Img;
import com.zwh.model.User;
import com.zwh.service.ImgService;
import com.zwh.service.UserService;
import com.zwh.util.UpImg;
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.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.imageio.ImageIO;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.util.List;
import java.util.Map;
@Controller
public class IndexAction {
@Resource
private UserService userService;
@Resource
private ImgService imgService;
@Autowired
DefaultKaptcha defaultKaptcha;
@RequestMapping("/index")
public String IndexPage(Map<String,List<Img>> map){
List<Img> list = imgService.selectBy();
map.put("imgList",list);
return "index";
}
@ResponseBody
@RequestMapping("/login")
public String Login(HttpSession httpSession, String username, String password,String code){
User user = userService.Login(username,password);
String captchaId = (String) httpSession.getAttribute("vrifyCode");
if (!code.equals(captchaId)){
return "验证码错误";
}
if (user!=null){
httpSession.setAttribute("userId",user.getUserId());
httpSession.setAttribute("userName",user.getUserName());
httpSession.setAttribute("userPic",user.getUserPic());
return "登陆成功";
}else{
return "error";
}
}
@ResponseBody
@RequestMapping("/enroll")
public String Enroll(String username, String password1, @RequestParam(value = "file") MultipartFile file, String password2){
System.out.println(password2);
User user = userService.selectName(username);
if (user!=null){
return "用户名已存在";
}else {
if (file.isEmpty()) {
return "文件不能为空";
}
UpImg upImg =new UpImg();
String fileName = upImg.getImgName(file,"E:/zwh/image/");
if (file.equals("false")){
return "上传文件失败";
}else {
int i = userService.Enroll(username,password1,"image/"+fileName);
if (i>0){
return "注册成功";
}
return "注册失败";
}
}
}
@RequestMapping("/loginClose")
public String loginClose(HttpSession httpSession){
httpSession.removeAttribute("userId");
httpSession.removeAttribute("userName");
return "redirect:/index";
}
//生成验证码图片
@RequestMapping("/defaultKaptcha")
public void defaultKaptcha(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception{
byte[] captchaChallengeAsJpeg = null;
ByteArrayOutputStream jpegOutputStream = new ByteArrayOutputStream();
try {
//生产验证码字符串并保存到session中
String createText = defaultKaptcha.createText();
httpServletRequest.getSession().setAttribute("vrifyCode", createText);
//使用生产的验证码字符串返回一个BufferedImage对象并转为byte写入到byte数组中
BufferedImage challenge = defaultKaptcha.createImage(createText);
ImageIO.write(challenge, "jpg", jpegOutputStream);
} catch (IllegalArgumentException e) {
httpServletResponse.sendError(HttpServletResponse.SC_NOT_FOUND);
return;
}
//定义response输出类型为image/jpeg类型,使用response输出流输出图片的byte数组
captchaChallengeAsJpeg = jpegOutputStream.toByteArray();
httpServletResponse.setHeader("Cache-Control", "no-store");
httpServletResponse.setHeader("Pragma", "no-cache");
httpServletResponse.setDateHeader("Expires", 0);
httpServletResponse.setContentType("image/jpeg");
ServletOutputStream responseOutputStream =
httpServletResponse.getOutputStream();
responseOutputStream.write(captchaChallengeAsJpeg);
responseOutputStream.flush();
responseOutputStream.close();
}
}
|
package com.example.marek.komunikator.model;
import java.util.ArrayList;
import java.util.List;
/**
* Created by marek on 21.01.18.
*/
public class ContactList {
private static List<Contact> contactList = new ArrayList<>();
public static void addToList(Contact contact){
contactList.add(contact);
}
public static List<Contact> getContactList() {
return contactList;
}
public static void setContactList(List<Contact> contactList) {
ContactList.contactList = contactList;
}
public static void changeContactStatus(String contactName, boolean active){
for (Contact c : contactList) {
if (c.getLogin().equals(contactName)){
c.setActive(active);
}
}
}
public static void changeContactNewMessages(String contactName, boolean newMessage){
for (Contact c :contactList){
if (c.getLogin().equals(contactName)){
c.setNewMessage(newMessage);
}
}
}
}
|
package com.research.hadoop.mr.serablition;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
import java.io.IOException;
/**
* @fileName: FlowCountMapper.java
* @description: FlowCountMapper.java类说明
* @author: by echo huang
* @date: 2020-07-19 16:19
*/
public class FlowCountMapper extends Mapper<LongWritable, Text, Text, Phone> {
@Override
protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
//将value序列化为Phone
String valueStr= value.toString();
// private String phone;
// private String ip;
// private Integer upFlow;
// private Integer downFlow;
// private Integer sumFlow;
// private Integer status;
// 1,15983211174,192.168.2.45,19,20,200
String[] valueArr = valueStr.split(",");
for (String val: valueArr) {
}
}
}
|
package util.scheduler;
/**
* Created by william.luo on 9/19/2017.
*/
public class FileNotDeletedException extends Exception {
public FileNotDeletedException(String message) {
super(message);
}
}
|
package com.projeto.view.produto;
import java.util.List;
import javax.swing.table.AbstractTableModel;
import com.projeto.model.models.Produto;
public class TabelaProdutoModel extends AbstractTableModel{
private static final long serialVersionUID = -4218080616820337048L;
private final String colunas[] = {"Código", "Nome", "Valor de Venda", "Descrição"};
private static final int CODIGO = 0;
private static final int NOME = 1;
private static final int VALOR_VENDA = 2;
private static final int DESCRICAO = 3;
private List<Produto> listaProduto;
public List<Produto> getListaProduto() {
return listaProduto;
}
public void setListaProduto(List<Produto> listaProduto) {
this.listaProduto = listaProduto;
}
public Produto getProduto(int rowIndex) {
return getListaProduto().get(rowIndex);
}
public void saveProduto(Produto produto) {
getListaProduto().add(produto);
fireTableRowsInserted(getRowCount()-1, getColumnCount()-1);
}
public void updateProduto(Produto produto, int rowIndex) {
getListaProduto().set(rowIndex, produto);
fireTableRowsInserted(rowIndex, rowIndex);
}
public void removeProduto(int rowIndex) {
getListaProduto().remove(rowIndex);
fireTableRowsInserted(rowIndex, rowIndex);
}
public void removeAll() {
getListaProduto().clear();
fireTableDataChanged();
}
@Override
public int getRowCount() {
return getListaProduto().size();
}
@Override
public int getColumnCount() {
return getColunas().length;
}
public String getColumnName(int columnIndex) {
return colunas[columnIndex];
}
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
Produto produto = getListaProduto().get(rowIndex);
switch(columnIndex) {
case CODIGO:
return produto.getId();
case NOME:
return produto.getNome();
case VALOR_VENDA:
return produto.getValor_venda();
case DESCRICAO:
return produto.getDescricao();
default:
return produto;
}
}
public Class<?> getColumnClass(int columnIndex){
switch(columnIndex) {
case CODIGO:
return Integer.class;
case NOME:
return String.class;
case VALOR_VENDA:
return String.class;
case DESCRICAO:
return String.class;
default:
return null;
}
}
public String[] getColunas() {
return colunas;
}
}
|
package com.tao.service;
import java.util.ArrayList;
import com.tao.model.Commodity;
import com.tao.model.User;
public class FixService extends CommodityService{
public ArrayList<Commodity> queryAllCommodity(){
ArrayList<Commodity>total = super.queryAllCommodity();
ArrayList<Commodity>fix = new ArrayList<Commodity>();
for(Commodity element:total){
if(Commodity.FIX == element.getType()){
fix.add(element);
}
}
return fix;
}
public ArrayList<Commodity>seperateConceret(int start,int length,ArrayList<Commodity> commodityList){
ArrayList<Commodity> commodities = new ArrayList<Commodity>();
int num = 0;
for(int i = start;num < length && i < commodityList.size();i ++){
if(Commodity.FIX == commodityList.get(i).getType()){
commodities.add( commodityList.get(i));
num++;
}
}
return commodities;
}
@Override
public ArrayList<Commodity> queryCommodity(String commodityName) {
// TODO Auto-generated method stub
ArrayList<Commodity>total = super.queryCommodity(commodityName);
ArrayList<Commodity>fix = new ArrayList<Commodity>();
for(Commodity element:total){
if(Commodity.FIX == element.getType()){
fix.add(element);
}
}
return fix;
}
}
|
package com.zhowin.miyou.http;
import androidx.lifecycle.LifecycleOwner;
import com.uber.autodispose.AutoDispose;
import com.uber.autodispose.android.lifecycle.AndroidLifecycleScopeProvider;
import com.zhowin.base_library.http.HttpCallBack;
import com.zhowin.base_library.http.RetrofitFactory;
import com.zhowin.base_library.model.UserInfo;
import com.zhowin.base_library.qiniu.QiNiuYunBean;
import com.zhowin.base_library.utils.RxSchedulers;
import com.zhowin.miyou.BuildConfig;
import com.zhowin.miyou.login.model.DefaultImageList;
import com.zhowin.miyou.login.model.LabelList;
import com.zhowin.miyou.main.model.BannerList;
import com.zhowin.miyou.message.model.SystemMessage;
import com.zhowin.miyou.mine.model.AttentionUserList;
import com.zhowin.miyou.mine.model.KnighthoodMessageInfo;
import com.zhowin.miyou.mine.model.MyWalletBalance;
import com.zhowin.miyou.mine.model.RoomBackgroundList;
import com.zhowin.miyou.mine.model.ShopMallPropsList;
import com.zhowin.miyou.mine.model.VerifiedStatus;
import com.zhowin.miyou.mine.model.VipMessageInfo;
import com.zhowin.miyou.recommend.model.GZBUserList;
import com.zhowin.miyou.recommend.model.GiftList;
import com.zhowin.miyou.recommend.model.GuardUserList;
import com.zhowin.miyou.recommend.model.HomeCategory;
import com.zhowin.miyou.recommend.model.RecommendList;
import com.zhowin.miyou.recommend.model.RoomCategory;
import com.zhowin.miyou.recommend.model.RoomDataInfo;
import com.zhowin.miyou.recommend.model.RoomWaterBean;
import com.zhowin.miyou.recommend.model.ToadyUserList;
import com.zhowin.miyou.recommend.model.WeekStarUserList;
import com.zhowin.miyou.recommend.model.ZABUserList;
import java.util.HashMap;
import java.util.List;
/**
* description:
*/
public class HttpRequest {
private static ApiRequest apiRequest;
static {
apiRequest = RetrofitFactory.getInstance().initRetrofit(BuildConfig.API_HOST).create(ApiRequest.class);
}
/**
* 获取用户信息
*/
public static void getUserInfoMessage(LifecycleOwner activity, final HttpCallBack<UserInfo> callBack) {
apiRequest.getUserInfoMessage(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken())
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<UserInfo>() {
@Override
public void onSuccess(UserInfo demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 获取七牛云的信息
*/
public static void getQiNiuYunBean(LifecycleOwner activity, final HttpCallBack<QiNiuYunBean> callBack) {
apiRequest.getQiNiuYunBean(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken())
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<QiNiuYunBean>() {
@Override
public void onSuccess(QiNiuYunBean demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 获取验证码
*/
public static void getVerificationCode(LifecycleOwner activity, int event, String mobile, final HttpCallBack<Object> callBack) {
apiRequest.getVerificationCode(ApiRequest.SEND_EMS_CODE, event, mobile)
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<Object>() {
@Override
public void onSuccess(Object demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 手机号 +验证码 登录
*/
public static void mobileVerificationCodeLogin(LifecycleOwner activity, String mobile, String semCode, final HttpCallBack<UserInfo> callBack) {
apiRequest.mobileVerificationCodeLogin(mobile, semCode)
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<UserInfo>() {
@Override
public void onSuccess(UserInfo demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 手机号 + 密码登录
*/
public static void loginMobileAndPassword(LifecycleOwner activity, String mobile, String password, final HttpCallBack<UserInfo> callBack) {
apiRequest.loginMobileAndPassword(mobile, password)
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<UserInfo>() {
@Override
public void onSuccess(UserInfo demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 账号 + 密码 登录
*/
public static void nameAndPasswordLogin(LifecycleOwner activity, String username, String password, final HttpCallBack<UserInfo> callBack) {
apiRequest.nameAndPasswordLogin(username, password)
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<UserInfo>() {
@Override
public void onSuccess(UserInfo demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 获取默认图像
*/
public static void getDefaultAvatar(LifecycleOwner activity, final HttpCallBack<List<DefaultImageList>> callBack) {
apiRequest.getDefaultAvatar(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken())
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<List<DefaultImageList>>() {
@Override
public void onSuccess(List<DefaultImageList> demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 获取默认标签
*/
public static void getDefaultTagList(LifecycleOwner activity, final HttpCallBack<List<LabelList>> callBack) {
apiRequest.getDefaultTagList(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken())
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<List<LabelList>>() {
@Override
public void onSuccess(List<LabelList> demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 提交用户信息
*/
public static void submitUserInfoMessage(LifecycleOwner activity, HashMap<String, Object> map, final HttpCallBack<UserInfo> callBack) {
apiRequest.submitUserInfoMessage(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken(), map)
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<UserInfo>() {
@Override
public void onSuccess(UserInfo demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 修改用户信息
*/
public static void changeUserInfoMessage(LifecycleOwner activity, HashMap<String, Object> map, final HttpCallBack<Object> callBack) {
apiRequest.changeUserInfoMessage(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken(), map)
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<Object>() {
@Override
public void onSuccess(Object demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 获取别人的主页信息,传自己id 时,就是获取自己的数据
*/
public static void getOtherUserInfoMessage(LifecycleOwner activity, int userId, final HttpCallBack<UserInfo> callBack) {
apiRequest.getOtherInfoMessage(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken(), userId)
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<UserInfo>() {
@Override
public void onSuccess(UserInfo demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 首页banner
*/
public static void getHomeBannerList(LifecycleOwner activity, final HttpCallBack<List<BannerList>> callBack) {
apiRequest.getHomeBannerList(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken())
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<List<BannerList>>() {
@Override
public void onSuccess(List<BannerList> demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 首页滚动信息
*/
public static void getHomeNoticeMessageList(LifecycleOwner activity, final HttpCallBack<List<String>> callBack) {
apiRequest.getHomeNoticeMessageList(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken())
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<List<String>>() {
@Override
public void onSuccess(List<String> demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 设置用户密码
*/
public static void setUserPassword(LifecycleOwner activity, String password, final HttpCallBack<Boolean> callBack) {
apiRequest.setUserPassword(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken(), password)
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<Boolean>() {
@Override
public void onSuccess(Boolean demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 修改用户密码
*/
public static void changeUserPassword(LifecycleOwner activity, String oldPwd, String newPwd, final HttpCallBack<Object> callBack) {
apiRequest.changeUserPassword(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken(), oldPwd, newPwd)
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<Object>() {
@Override
public void onSuccess(Object demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 忘记 密码
*/
public static void forgetPassword(LifecycleOwner activity, String mobileNum, String msgCode, String newPwd, final HttpCallBack<Object> callBack) {
apiRequest.forgetPassword(mobileNum, msgCode, newPwd)
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<Object>() {
@Override
public void onSuccess(Object demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 获取直播间类型
*/
public static void getRoomCategory(LifecycleOwner activity, final HttpCallBack<List<RoomCategory>> callBack) {
apiRequest.getRoomCategory(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken())
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<List<RoomCategory>>() {
@Override
public void onSuccess(List<RoomCategory> demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 获取房间id
*/
public static void getRoomID(LifecycleOwner activity, final HttpCallBack<Integer> callBack) {
apiRequest.getRoomID(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken())
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<Integer>() {
@Override
public void onSuccess(Integer demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 创建房间
*/
public static void createChatRoom(LifecycleOwner activity, HashMap<String, Object> map, final HttpCallBack<RecommendList> callBack) {
apiRequest.createChatRoom(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken(), map)
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<RecommendList>() {
@Override
public void onSuccess(RecommendList demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 获取我创建或者我收藏的room
*/
public static void getMyCreateOrCollectionRoomList(LifecycleOwner activity, boolean isMyCreate, final HttpCallBack<BaseResponse<RecommendList>> callBack) {
String url = isMyCreate ? ApiRequest.MY_COLLECTION_ROOM_LIST : ApiRequest.GET_MY_CREATE_ROOM_LIST;
apiRequest.getMyCreateOrCollectionRoomList(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken(), url)
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<BaseResponse<RecommendList>>() {
@Override
public void onSuccess(BaseResponse<RecommendList> demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 获取我的钱包余额
*/
public static void getMyWalletBalance(LifecycleOwner activity, final HttpCallBack<MyWalletBalance> callBack) {
apiRequest.getMyWalletBalance(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken())
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<MyWalletBalance>() {
@Override
public void onSuccess(MyWalletBalance demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 获取礼物列表
*/
public static void getGiftList(LifecycleOwner activity, final HttpCallBack<List<GiftList>> callBack) {
apiRequest.getGiftList(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken())
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<List<GiftList>>() {
@Override
public void onSuccess(List<GiftList> demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 获取直播间背景
*/
public static void getRoomBackgroundList(LifecycleOwner activity, final HttpCallBack<List<RoomBackgroundList>> callBack) {
apiRequest.getRoomBackgroundList(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken())
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<List<RoomBackgroundList>>() {
@Override
public void onSuccess(List<RoomBackgroundList> demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 市民认证的状态
*/
public static void getVerifiedStatus(LifecycleOwner activity, final HttpCallBack<VerifiedStatus> callBack) {
apiRequest.getVerifiedStatus(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken())
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<VerifiedStatus>() {
@Override
public void onSuccess(VerifiedStatus demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 获取每日魅力和贡献榜单
*/
public static void getTodayUserList(LifecycleOwner activity, boolean is_MLB, final HttpCallBack<List<ToadyUserList>> callBack) {
String url = is_MLB ? ApiRequest.GET_MRML_LIST_URL : ApiRequest.GET_MRGX_LIST_URL;
apiRequest.getTodayUserList(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken(), url)
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<List<ToadyUserList>>() {
@Override
public void onSuccess(List<ToadyUserList> demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 获取贵族榜单
*/
public static void getGZBUserList(LifecycleOwner activity, final HttpCallBack<List<GZBUserList>> callBack) {
apiRequest.getGZBUserList(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken())
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<List<GZBUserList>>() {
@Override
public void onSuccess(List<GZBUserList> demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 守护榜单
*/
public static void getGuardUserList(LifecycleOwner activity, final HttpCallBack<List<GuardUserList>> callBack) {
apiRequest.getGuardUserList(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken())
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<List<GuardUserList>>() {
@Override
public void onSuccess(List<GuardUserList> demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 获取每日魅力和贡献榜单
*/
public static void getWeekStarUserList(LifecycleOwner activity, boolean is_MLB, final HttpCallBack<WeekStarUserList> callBack) {
String url = is_MLB ? ApiRequest.GET_MZML_LIST_URL : ApiRequest.GET_MZGX_LIST_URL;
apiRequest.getWeekStarUserList(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken(), url)
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<WeekStarUserList>() {
@Override
public void onSuccess(WeekStarUserList demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 真爱榜单
*/
public static void getZABUserList(LifecycleOwner activity, final HttpCallBack<List<ZABUserList>> callBack) {
apiRequest.getZABUserList(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken())
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<List<ZABUserList>>() {
@Override
public void onSuccess(List<ZABUserList> demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 提交认证信息
*/
public static void submitUserVerifiedInfo(LifecycleOwner activity, HashMap<String, Object> map, final HttpCallBack<Object> callBack) {
apiRequest.submitUserVerifiedInfo(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken(), map)
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<Object>() {
@Override
public void onSuccess(Object demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 添加/移除关注 添加/移除黑名单
*/
public static void addAttentionOrBlackList(LifecycleOwner activity, int requestType, int target, final HttpCallBack<Object> callBack) {
String url;
switch (requestType) {
case 1://添加关注
url = ApiRequest.ADD_ATTENTION_LIST_URL;
break;
case 2: //移除关注
url = ApiRequest.REMOVE_ATTENTION_LIST_URL;
break;
case 3: //添加黑名单
url = ApiRequest.ADD_BLACK_LIST_URL;
break;
case 4: //移除黑名单
url = ApiRequest.REMOVE_BLACK_LIST_URL;
break;
default:
throw new IllegalStateException("Unexpected value: " + requestType);
}
apiRequest.addAttentionOrBlackList(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken(), url, target)
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<Object>() {
@Override
public void onSuccess(Object demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 获取关注/粉丝/访客列表
*/
public static void getAttentionOrFansUserList(LifecycleOwner activity, int requestType, int target, final HttpCallBack<BaseResponse<AttentionUserList>> callBack) {
String url;
switch (requestType) {
case 1: //关注
url = ApiRequest.GET_ATTENTION_LIST_URL;
break;
case 2: //粉丝
url = ApiRequest.GET_FANS_LIST_URL;
break;
case 3: //访客
url = ApiRequest.GET_VISITOR_LIST_URL;
break;
default:
throw new IllegalStateException("Unexpected value: " + requestType);
}
apiRequest.getAttentionOrFansUserList(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken(), url, target)
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<BaseResponse<AttentionUserList>>() {
@Override
public void onSuccess(BaseResponse<AttentionUserList> demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 获取黑名单列表
*/
public static void getBlackListUserList(LifecycleOwner activity, int target, final HttpCallBack<BaseResponse<AttentionUserList>> callBack) {
apiRequest.getBlackListUserList(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken(), target)
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<BaseResponse<AttentionUserList>>() {
@Override
public void onSuccess(BaseResponse<AttentionUserList> demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 商城列表
*/
public static void getShopMallPropsList(LifecycleOwner activity, int type, final HttpCallBack<List<ShopMallPropsList>> callBack) {
String url = null;
switch (type) {
case 0:
url = ApiRequest.SHOP_MALL_HEADER_PHOTO_URL;
break;
case 1:
url = ApiRequest.SHOP_MALL_ZJ_PHOTO_URL;
break;
case 2:
url = ApiRequest.SHOP_MALL_DJ_PHOTO_URL;
break;
}
apiRequest.getShopMallPropsList(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken(), url)
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<List<ShopMallPropsList>>() {
@Override
public void onSuccess(List<ShopMallPropsList> demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 购买道具/座驾
*/
public static void userBuyProps(LifecycleOwner activity, String goodId, int number, final HttpCallBack<Object> callBack) {
apiRequest.userBuyProps(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken(), goodId, number)
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<Object>() {
@Override
public void onSuccess(Object demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 搜索房间
*/
public static void searchRoomResultList(LifecycleOwner activity, String keyWord, int currentPage, int pageNumber, final HttpCallBack<BaseResponse<RecommendList>> callBack) {
apiRequest.searchRoomResultList(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken(), keyWord, currentPage, pageNumber)
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<BaseResponse<RecommendList>>() {
@Override
public void onSuccess(BaseResponse<RecommendList> demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 搜索用户
*/
public static void searchUserResultList(LifecycleOwner activity, String keyWord, int currentPage, int pageNumber, final HttpCallBack<BaseResponse<UserInfo>> callBack) {
apiRequest.searchUserResultList(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken(), keyWord, currentPage, pageNumber)
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<BaseResponse<UserInfo>>() {
@Override
public void onSuccess(BaseResponse<UserInfo> demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 获取首页分类
*/
public static void getHomeCategoryList(LifecycleOwner activity, final HttpCallBack<List<HomeCategory>> callBack) {
apiRequest.getHomeCategoryList(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken())
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<List<HomeCategory>>() {
@Override
public void onSuccess(List<HomeCategory> demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 获取首页的直播房间
*/
public static void getHomeRoomList(LifecycleOwner activity, int type, final HttpCallBack<List<RecommendList>> callBack) {
apiRequest.getHomeRoomList(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken(), type)
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<List<RecommendList>>() {
@Override
public void onSuccess(List<RecommendList> demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 提交举报房间/用户原因
*/
public static void submitReportMessage(LifecycleOwner activity, boolean isReportRoom, int target, String type, String content, String pictures, final HttpCallBack<Object> callBack) {
String url = isReportRoom ? ApiRequest.SUBMIT_REPORT_ROOM_MESSAGE_URL : ApiRequest.SUBMIT_REPORT_USER_MESSAGE_URL;
apiRequest.submitReportMessage(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken(), url, target, type, content, pictures)
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<Object>() {
@Override
public void onSuccess(Object demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 加入直播间
*/
public static void joinLiveRoom(LifecycleOwner activity, int roomId, String roomPassword, final HttpCallBack<RecommendList> callBack) {
apiRequest.joinLiveRoom(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken(), roomId, roomPassword)
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<RecommendList>() {
@Override
public void onSuccess(RecommendList demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 获取vip 信息
*/
public static void getVipMessageInfo(LifecycleOwner activity, final HttpCallBack<VipMessageInfo> callBack) {
apiRequest.getVipMessageInfo(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken())
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<VipMessageInfo>() {
@Override
public void onSuccess(VipMessageInfo demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 获取爵位得信息
*/
public static void getKnighthoodMessageInfo(LifecycleOwner activity, final HttpCallBack<KnighthoodMessageInfo> callBack) {
apiRequest.getKnighthoodMessageInfo(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken())
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<KnighthoodMessageInfo>() {
@Override
public void onSuccess(KnighthoodMessageInfo demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 开通或者续费爵位
*/
public static void openKnighthoodLevel(LifecycleOwner activity, int rankId, final HttpCallBack<Object> callBack) {
apiRequest.openKnighthoodLevel(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken(), rankId)
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<Object>() {
@Override
public void onSuccess(Object demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 获取系统消息
*/
public static void getSystemMessageList(LifecycleOwner activity, final HttpCallBack<BaseResponse<SystemMessage>> callBack) {
apiRequest.getSystemMessageList(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken())
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<BaseResponse<SystemMessage>>() {
@Override
public void onSuccess(BaseResponse<SystemMessage> demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 查询青少年模式状态
*/
public static void checkYouthMode(LifecycleOwner activity, final HttpCallBack<Boolean> callBack) {
apiRequest.checkYouthMode(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken())
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<Boolean>() {
@Override
public void onSuccess(Boolean demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 开启或者关闭青少年模式
*/
public static void openOrCloseYouthMode(LifecycleOwner activity, boolean isOpenMode, String password, final HttpCallBack<Object> callBack) {
String url = isOpenMode ? ApiRequest.OPEN_YOUTH_MODE_URL : ApiRequest.CLOSE_YOUTH_MODE_URL;
apiRequest.openOrCloseYouthMode(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken(), url, password)
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<Object>() {
@Override
public void onSuccess(Object demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 找回青少年模式密码
*/
public static void findYouthModePassword(LifecycleOwner activity, String msgCode, String newPwd, final HttpCallBack<Object> callBack) {
apiRequest.findYouthModePassword(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken(), msgCode, newPwd)
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<Object>() {
@Override
public void onSuccess(Object demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 验证手机号码
*/
public static void verifyMobileNumber(LifecycleOwner activity, String mobile, String msgCode, final HttpCallBack<String> callBack) {
apiRequest.verifyMobileNumber(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken(), mobile, msgCode)
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<String>() {
@Override
public void onSuccess(String demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 换绑手机
*/
public static void verifyChangeMobileNumber(LifecycleOwner activity, String msgCode, String mobile, String validCode, final HttpCallBack<Object> callBack) {
apiRequest.verifyChangeMobileNumber(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken(), msgCode, mobile, validCode)
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<Object>() {
@Override
public void onSuccess(Object demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 永久注销
*/
public static void longTimeOutLogin(LifecycleOwner activity, String mobile, String msgCode, final HttpCallBack<Object> callBack) {
apiRequest.longTimeOutLogin(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken())
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<Object>() {
@Override
public void onSuccess(Object demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 获取房间信息
*/
public static void getRoomDataInfo(LifecycleOwner activity, int roomId, final HttpCallBack<RoomDataInfo> callBack) {
apiRequest.getRoomDataInfo(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken(), roomId)
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<RoomDataInfo>() {
@Override
public void onSuccess(RoomDataInfo demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 获取房间每日魅力和贡献榜单
*/
public static void getRoomTodayUserList(LifecycleOwner activity, boolean is_MLB, int roomId, final HttpCallBack<List<ToadyUserList>> callBack) {
String url = is_MLB ? ApiRequest.GET_LIVE_ROOM_MLB_LIST_URL : ApiRequest.GET_LIVE_ROOM_DAY_GXB_LIST_URL;
apiRequest.getRoomTodayUserList(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken(), url, roomId)
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<List<ToadyUserList>>() {
@Override
public void onSuccess(List<ToadyUserList> demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 获取房间魅力和贡献榜单
*/
public static void getRoomWeekStarUserList(LifecycleOwner activity, boolean is_MLB, int roomId, final HttpCallBack<WeekStarUserList> callBack) {
String url = is_MLB ? ApiRequest.GET_LIVE_ROOM_WEEK_MLB_LIST_URL : ApiRequest.GET_LIVE_ROOM_WEEK_GXB_LIST_URL;
apiRequest.getRoomWeekStarUserList(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken(), url, roomId)
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<WeekStarUserList>() {
@Override
public void onSuccess(WeekStarUserList demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 根据id 批量查询用户信息
*/
public static void queryUserMessageList(LifecycleOwner activity, String userIds, final HttpCallBack<BaseResponse<UserInfo>> callBack) {
apiRequest.queryUserMessageList(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken(), userIds)
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<BaseResponse<UserInfo>>() {
@Override
public void onSuccess(BaseResponse<UserInfo> demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 房间操作返回object的通用处理
*
* @param type
* @param roomId
* @param callBack
*/
public static void roomItemOperating(LifecycleOwner activity, int type, int roomId, final HttpCallBack<Object> callBack) {
String url = "";
switch (type) {
case 1: //清空麦序
url = ApiRequest.CLEAR_ROW_LIST_URL;
break;
}
apiRequest.roomItemOperating(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken(), url, roomId)
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<Object>() {
@Override
public void onSuccess(Object demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 获取房间流水
*/
public static void getRoomWaterList(LifecycleOwner activity, boolean isTodayWater, int roomId, final HttpCallBack<RoomWaterBean> callBack) {
String url = isTodayWater ? ApiRequest.GET_LIVE_ROOM_WATER_URL : ApiRequest.GET_LIVE_ROOM_WEEK_WATER_URL;
apiRequest.getRoomWaterList(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken(), url, roomId)
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<RoomWaterBean>() {
@Override
public void onSuccess(RoomWaterBean demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 设置房间密码
*/
public static void setRoomPassword(LifecycleOwner activity, String password, int roomId, final HttpCallBack<Object> callBack) {
apiRequest.setRoomPassword(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken(), password, roomId)
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<Object>() {
@Override
public void onSuccess(Object demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 禁麦 解麦
*/
public static void lockOrUnLockMicro(LifecycleOwner activity, boolean isLockMicro, int roomId, int target, final HttpCallBack<Object> callBack) {
String url = isLockMicro ? ApiRequest.PROHIBIT_MICROPHONE_URL : ApiRequest.PROHIBIT_UNLOCK_MICROPHONE_URL;
apiRequest.lockOrUnLockMicro(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken(), url, roomId, target)
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<Object>() {
@Override
public void onSuccess(Object demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
/**
* 设置麦位状态
*/
public static void setMicroStatus(LifecycleOwner activity, int position, int roomId, int state, final HttpCallBack<Object> callBack) {
apiRequest.setMicroStatus(ApiRequest.TOKEN_VALUE + UserInfo.getUserToken(), position, roomId, state)
.compose(RxSchedulers.io_main())
.as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(activity)))
.subscribe(new ApiObserver<Object>() {
@Override
public void onSuccess(Object demo) {
callBack.onSuccess(demo);
}
@Override
public void onFail(int errorCode, String errorMsg) {
callBack.onFail(errorCode, errorMsg);
}
});
}
}
|
package business.api;
import java.util.Calendar;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import data.entities.Court;
import data.entities.User;
import business.api.exceptions.AlreadyExistLessonIdException;
import business.api.exceptions.DeleteStudentException;
import business.api.exceptions.NotFoundLessonIdException;
import business.controllers.LessonController;
import business.wrapper.LessonWrapper;
@RestController
@RequestMapping(Uris.SERVLET_MAP + Uris.LESSONS)
public class LessonResource {
private LessonController lessonController;
@Autowired
public void setLessonController(LessonController lessonController) {
this.lessonController = lessonController;
}
@RequestMapping(method = RequestMethod.POST)
public void createLesson(@RequestParam(required = true) User trainer, Court court, Calendar timeTable,
Calendar beginDate, Calendar endDate) throws AlreadyExistLessonIdException {
if (!this.lessonController.createLesson(new LessonWrapper(trainer, court, timeTable, beginDate, endDate))) {
throw new AlreadyExistLessonIdException();
}
}
@RequestMapping(method = RequestMethod.DELETE)
public void deleteLesson(@RequestParam(required = true) int id) throws NotFoundLessonIdException {
if (!lessonController.deleteLesson(id)) {
throw new NotFoundLessonIdException("id: " + id);
}
}
@RequestMapping(method = RequestMethod.GET)
public List<LessonWrapper> showLessons() {
return lessonController.showLessons();
}
@RequestMapping(value = Uris.ID + Uris.STUDENTS, method = RequestMethod.DELETE)
public void deleteStudent(@AuthenticationPrincipal User trainer, @PathVariable int id, @RequestBody String studentUsername)
throws DeleteStudentException {
if (!lessonController.deleteStudent(id, studentUsername)) {
throw new DeleteStudentException();
}
}
} |
package com.example.unicornrecorder.ui.main;
import android.os.Build;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.lifecycle.ViewModelProviders;
import com.example.unicornrecorder.MainActivity;
import com.example.unicornrecorder.R;
public class ListTabFragment extends TabFragment {
public static ListTabFragment newInstance(int index) { // static constructor-like method
ListTabFragment fragment = new ListTabFragment();
Bundle bundle = new Bundle();
bundle.putInt(ARG_SECTION_NUMBER, index);
fragment.setArguments(bundle);
return fragment;
}
@RequiresApi(api = Build.VERSION_CODES.O)
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
pageViewModel = ViewModelProviders.of(this).get(PageViewModel.class);
int index = 1;
if (getArguments() != null) {
index = getArguments().getInt(ARG_SECTION_NUMBER);
}
pageViewModel.setIndex(index);
}
@RequiresApi(api = Build.VERSION_CODES.M)
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View root = inflater.inflate(R.layout.listfragment, container, false); //we should look like listfragment.xml
AdapterFileList fileWrapper = ((MainActivity)getActivity()).getAdapterWrapper(); // get the adapter + file object from mainActivity
fileWrapper.createAdapter(root.getContext(), this); // create the adapter inside the object
ListView listView = root.findViewById(R.id.file_list); // this is where the files will be listed
listView.setAdapter(fileWrapper.getAdapter()); // get adapter and pass it to listView
return root;
}
public void removeElement(FileListElement element) {
((MainActivity)getActivity()).getAdapterWrapper().removeElement(element);
}
} |
package com.quizcore.quizapp.model.repository;
import com.quizcore.quizapp.model.entity.Quiz;
import org.springframework.data.repository.CrudRepository;
import java.util.List;
import java.util.UUID;
public interface QuizRepository extends CrudRepository<Quiz, UUID> {
List<Quiz> findAllByPartnerId(UUID partnerId);
}
|
package com.montwell.moviecentral;
import android.database.ContentObserver;
import android.database.Cursor;
import android.database.DataSetObserver;
import android.os.Handler;
import android.support.v7.widget.RecyclerView;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Jonathan Montwell on 10/27/2015.
*/
public abstract class RecyclerPagerAdapter<VH extends RecyclerView.ViewHolder, E> extends RecyclerView.Adapter<VH> {
protected List<E> mElements;
protected int mPageSize;
public RecyclerPagerAdapter(List<E> elements, int pageSize) {
if(elements == null) {
mElements = new ArrayList<>();
} else {
mElements = elements;
}
mPageSize = pageSize;
}
@Override
public int getItemCount() {
return mElements.size();
}
public List<E> swap(List<E> elements) {
List<E> oldElements = mElements;
mElements = elements;
if(getItemCount() > mPageSize) {
notifyItemRangeInserted(oldElements.size(), mElements.size());
} else {
notifyDataSetChanged();
}
return oldElements;
}
}
|
package com.tencent.mm.plugin.webview.ui.tools.game;
import com.tencent.mm.sdk.platformtools.x;
class GameWebViewUI$8 implements Runnable {
final /* synthetic */ GameWebViewUI qgm;
GameWebViewUI$8(GameWebViewUI gameWebViewUI) {
this.qgm = gameWebViewUI;
}
public final void run() {
if (GameWebViewUI.G(this.qgm) != null) {
if (GameWebViewUI.B(this.qgm) != null) {
GameWebViewUI.B(this.qgm).aVl();
}
x.i("MicroMsg.Wepkg.GameWebViewUI", "home page, reload url:%s from net", new Object[]{GameWebViewUI.H(this.qgm)});
GameWebViewUI.I(this.qgm).stopLoading();
GameWebViewUI.K(this.qgm).loadUrl(GameWebViewUI.J(this.qgm));
}
}
}
|
package bangundatar;
public class Persegi implements BangunDatar {
private double sisi;
//Konsep Encapsulation
public double getSisi(){
return sisi;
}
public void setSisi(double sisi){
this.sisi = sisi;
}
@Override
public double Hitung(){
System.out.println("hitung luas");
return this.sisi * this.sisi;
}
@Override
public double Keliling() {
System.out.println("hitung keliling");
return 4*sisi;
}
}
|
package ejercicio5;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
public class AnalizadorAtom {
public static void main(String[] args) throws TransformerException {
System.out.println("**EJERCICIO 1.5**");
final String documentoEntrada = "xml/plantilla/acacias-38.xml";
final String documentoSalida = "xml/plantilla/programaAtom.xml";
final String transformacion = "xml/plantilla/plantillaAtom.xsl";
TransformerFactory factoria = TransformerFactory.newInstance();
Transformer transformador = factoria.newTransformer(new StreamSource(transformacion));
Source origen = new StreamSource(documentoEntrada);
Result destino = new StreamResult(documentoSalida);
transformador.transform(origen, destino);
System.out.println("Ver programaAtom.xml");
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.