blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 28 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
af7165cc7cc85b78c92e1de6461ba20b45c83c1f | cfc6be21a73f6fe30946fc40d9c60b88423be584 | /app/src/main/java/com/shichuang/sendnar/entify/ExamplesGift.java | 7a82e668d4936b2300de01b513fae2d34f8a661d | [] | no_license | ixingzhi/Sendnar | ad4dcc0c21e7e5d653a699e19d3d6adb14dfbd84 | 00a2178d1f654f7b0ed31d12ba61ac0fae49508b | refs/heads/master | 2020-03-19T07:47:27.885177 | 2018-07-09T11:01:43 | 2018-07-09T11:01:43 | 136,148,252 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 252 | java | package com.shichuang.sendnar.entify;
/**
* Created by Administrator on 2018/5/10.
*/
public class ExamplesGift {
private int id;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
}
| [
"xiedongdong.dev@gmail.com"
] | xiedongdong.dev@gmail.com |
94eb42f55cfcf8a358e6591b16623b8e7c61e14a | bdadec99175c665787ec1acc078b4e4809e95aab | /src/main/java/algorithm/DataStructures/Maps/HashMap.java | 4bd9357bde1b7bfae25d8a3b5747ba87e61a262f | [] | no_license | jdavid-araujo-zz/algorithms | fda1c8439ab9dd38671e97c87af1871450fb7a74 | ccb69bf7b2fa82f3825a685c958e2334ccf00356 | refs/heads/master | 2023-06-09T06:17:06.909980 | 2019-01-18T16:16:10 | 2019-01-18T16:16:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,586 | java | package algorithm.DataStructures.Maps;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
public class HashMap<K, V> implements Map<K, V> {
//private List<LinkedList<Entry<K, V>>> buckets = new List<LinkedList<Entry<K,V>>>();
private List[]buckets = new List[100];
private int size;
@Override
public int size() {
// TODO Auto-generated method stub
return 0;
}
@Override
public boolean isEmpty() {
// TODO Auto-generated method stub
return false;
}
@Override
public V get(K key) {
// TODO Auto-generated method stub
return null;
}
@Override
public V put(K key, V value) {
/*Entry<K, V> entry = new Entry<K, V>(key, value);
LinkedList<Entry<K, V>> list = new LinkedList<Entry<K, V>>();
int index = 0;
int bucket = key.hashCode() % (this.buckets.size());
try {
list = this.buckets.get(bucket);
} catch (Exception e) {
list = null;
}
if(list == null) {
list = new LinkedList<Entry<K, V>>();
list.addLast(entry);
this.buckets.add(bucket, list);
++this.size;
} else {
for(Entry<K, V> temp : list ) {
if(temp.key.equals(key)) {
list.add(index, entry);
++index;
return temp.value;
}
}
list.addLast(entry);
this.buckets.add(bucket, list);
++this.size;
return value;
}*/
// TODO Auto-generated method stub
return null;
}
@Override
public V remove(K key) {
// TODO Auto-generated method stub
return null;
}
}
| [
"j.davidsousaaraujo@gmail.com"
] | j.davidsousaaraujo@gmail.com |
c60d7d4352ce6b639191aad1114c3548f3bb1fef | 5d49ca1743fb929cb37814a24cc8b058d089ff27 | /mall-product/src/main/java/com/zmm/mall/product/app/controller/SkuImagesController.java | 378f67059528fe78b3d873565cccf40117fc09ab | [] | no_license | MingHub0313/social-mall | 69be7237470998eb76da3a85cac9e1dc71e7edd9 | 85cc461e97a5384d4f857a101f5ea3b82124067a | refs/heads/master | 2023-04-17T13:13:14.760823 | 2021-04-30T08:03:09 | 2021-04-30T08:03:09 | 306,238,679 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,936 | java | package com.zmm.mall.product.app.controller;
import java.util.Arrays;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.zmm.mall.product.entity.SkuImagesEntity;
import com.zmm.mall.product.service.SkuImagesService;
import com.zmm.common.utils.PageUtils;
import com.zmm.common.utils.R;
/**
* sku图片
*
* @author zhangmingming
* @email 1805783671@qq.com
* @date 2020-08-21 10:45:46
*/
@RestController
@RequestMapping("product/skuimages")
public class SkuImagesController {
@Autowired
private SkuImagesService skuImagesService;
/**
* 列表
*/
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params){
PageUtils page = skuImagesService.queryPage(params);
return R.ok().put("page", page);
}
/**
* 信息
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
SkuImagesEntity skuImages = skuImagesService.getById(id);
return R.ok().put("skuImages", skuImages);
}
/**
* 保存
*/
@RequestMapping("/save")
public R save(@RequestBody SkuImagesEntity skuImages){
skuImagesService.save(skuImages);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody SkuImagesEntity skuImages){
skuImagesService.updateById(skuImages);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
skuImagesService.removeByIds(Arrays.asList(ids));
return R.ok();
}
}
| [
"zhangmingmig@adpanshi.com"
] | zhangmingmig@adpanshi.com |
c73e50a954764638208e9e8a6ab5d32a363af9e1 | 7186735c7189831503a51becde6512b0fb99eb69 | /src/main/java/br/com/caelum/ingresso/model/Ingresso.java | 375298138a4c1897c87b7ef363555e44ae0d8357 | [] | no_license | mmfalcao/fj22-ingressos | 420e0ebe9a2b5552e3ea093b14e2383b793835b4 | 5e0b368d0691ca6d0417f6cf1f882b862b895671 | refs/heads/master | 2021-06-21T13:47:07.047611 | 2017-08-19T01:11:02 | 2017-08-19T01:11:02 | 100,319,745 | 1 | 0 | null | 2017-08-15T00:04:33 | 2017-08-15T00:04:32 | null | UTF-8 | Java | false | false | 1,470 | java | package br.com.caelum.ingresso.model;
import java.math.BigDecimal;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
@Entity
public class Ingresso {
@Id
@GeneratedValue
private Integer id;
@ManyToOne
private Sessao sessao;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public void setSessao(Sessao sessao) {
this.sessao = sessao;
}
public void setLugar(Lugar lugar) {
this.lugar = lugar;
}
public void setPreco(BigDecimal preco) {
this.preco = preco;
}
@ManyToOne
private Lugar lugar;
private BigDecimal preco;
@Enumerated(EnumType.STRING)
private TipoDeIngresso tipoDeIngresso;
public TipoDeIngresso getTipoDeIngresso() {
return tipoDeIngresso;
}
public void setTipoDeIngresso(TipoDeIngresso tipoDeIngresso) {
this.tipoDeIngresso = tipoDeIngresso;
}
public Lugar getLugar() {
return lugar;
}
public Sessao getSessao() {
return sessao;
}
public BigDecimal getPreco() {
return preco;
}
/**
* @deprecated hibernate only
* */
public Ingresso() {
}
public Ingresso(Sessao sessao, TipoDeIngresso tipoDeIngresso, Lugar lugar) {
this.sessao = sessao;
this.tipoDeIngresso = tipoDeIngresso;
this.preco = this.tipoDeIngresso.aplicaDesconto(sessao.getPreco());
this.lugar = lugar;
}
} | [
"marcelmf@msn.com"
] | marcelmf@msn.com |
5533f2d8b99ce37e64c2572b810a1dea85d115b0 | 141267b171bf3a37a30f6b7988d2ff4a469b5b6d | /ListApp/app/src/androidTest/java/org/westada/listapp/ExampleInstrumentedTest.java | f6ab0addba53610b7d59f053808b232a59e13b95 | [] | no_license | cosmo4/QuicklauncherFixedPeaches | 932b5ce26654adc337ab5c83d50f416796f0e02b | 34ad983da090445ad4d1e2ad95a293c90d3c36af | refs/heads/master | 2020-05-29T09:57:15.503028 | 2019-05-28T18:34:05 | 2019-05-28T18:34:05 | 189,082,994 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 722 | java | package org.westada.listapp;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("org.westada.listapp", appContext.getPackageName());
}
}
| [
"warner.luke0102@gmail.com"
] | warner.luke0102@gmail.com |
2c499643db8acef697b41afbc5a9da2cb7cafe24 | 3adbc2cf4437b62ed470f2d6f0c119dcf62ec5c8 | /day11_news_by_activity_fragmentcommunication/src/main/java/com/zsmome/day11_news_by_activity_fragmentcommunication/MainActivity.java | 1035442a363b2808257f5e0a193da0104f2bcf22 | [] | no_license | zsmome/Teacher | 4cbf21f0603170e73b318aa0a8f3427b6ffb28d4 | 233d9d5fc352ff7c9196125ba3d1b55f1165bd93 | refs/heads/master | 2021-01-23T16:07:58.418486 | 2017-06-04T02:37:27 | 2017-06-04T02:37:27 | 93,284,887 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,549 | java | package com.zsmome.day11_news_by_activity_fragmentcommunication;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.FrameLayout;
import com.zsmome.day11_news_by_activity_fragmentcommunication.fragments.LeftFragment;
import com.zsmome.day11_news_by_activity_fragmentcommunication.fragments.RightFragment;
/**
* 中转:
* MainActivity:中转方法
* LeftFragment:返回字符串方法
* RightFragment:设置字符串方法
*/
public class MainActivity extends AppCompatActivity {
//声明
private FrameLayout mLeftFl;
private FrameLayout mRightFl;
//Fragment
private LeftFragment left;
private RightFragment right;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
initViews();
initFragments();
}
/**
* 加载Fragments
*/
private void initFragments() {
left = new LeftFragment();
right = new RightFragment();
//设置回调
getSupportFragmentManager().beginTransaction()
.add(R.id.left_fl, left)
.add(R.id.right_fl, right)
.commit();
}
/**
* 初始化组件
*/
private void initViews() {
mLeftFl = (FrameLayout) findViewById(R.id.left_fl);
mRightFl = (FrameLayout) findViewById(R.id.right_fl);
}
public void left2Right() {
//中转
right.showTitle(left.getTitle());
}
}
| [
"2632699904@qq.com"
] | 2632699904@qq.com |
718940beea4eae08b14d8dd4d9055b74eadefbfc | f0cb4b02e7d4255d55bc0df9d158ef69dad5eee7 | /app/src/main/java/com/koala/koalamall/base/MainActivity.java | 47384cb4b1dc5bf1203b8e7f30907885e7189e18 | [] | no_license | echoblade/koalamall | 7d04fb99b65006ca31c8d1383b1915814e9eb603 | a698518071c02428a83cb215574bf5ee8cf6c935 | refs/heads/master | 2021-01-25T12:49:10.907540 | 2018-03-02T02:11:40 | 2018-03-02T02:11:40 | 123,513,227 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,811 | java | package com.koala.koalamall.base;
import android.support.v4.app.Fragment;
import android.support.v4.content.ContextCompat;
import android.support.v4.view.ViewPager;
import android.view.KeyEvent;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.koala.koalamall.R;
import com.koala.koalamall.adapter.PagerAdapter;
import com.koala.koalamall.customview.NoScrollMainPager;
import com.koala.koalamall.ui.cart.cart.CartFragment;
import com.koala.koalamall.ui.home.home.HomeFragment;
import com.koala.koalamall.ui.me.me.MeFragment;
import com.koala.koalamall.ui.order.order.OrderFragment;
import com.koala.koalamall.ui.sorts.sorts.SortsFragment;
import java.util.ArrayList;
import butterknife.BindView;
import butterknife.OnClick;
public class MainActivity extends BaseActivity implements ViewPager.OnPageChangeListener {
@BindView(R.id.layout_home)
NoScrollMainPager layout_home;
@BindView(R.id.iv_home)
ImageView iv_home;
@BindView(R.id.tv_home)
TextView tv_home;
@BindView(R.id.iv_sorts)
ImageView iv_sorts;
@BindView(R.id.tv_sorts)
TextView tv_sorts;
@BindView(R.id.iv_cart)
ImageView iv_cart;
@BindView(R.id.tv_cart)
TextView tv_cart;
@BindView(R.id.iv_order)
ImageView iv_order;
@BindView(R.id.tv_order)
TextView tv_order;
@BindView(R.id.iv_me)
ImageView iv_me;
@BindView(R.id.tv_me)
TextView tv_me;
private long exitTime = 0;
@Override
protected int getLayout() {
return R.layout.activity_main;
}
protected void init() {
initListener();
initFragment();
}
private void initListener() {
layout_home.addOnPageChangeListener(this);
layout_home.setOffscreenPageLimit(4);
}
private void initFragment() {
ArrayList<Fragment> fragmentList = new ArrayList<>();
HomeFragment homeFragment = new HomeFragment();
fragmentList.add(homeFragment);
SortsFragment sortsFragment = new SortsFragment();
fragmentList.add(sortsFragment);
CartFragment cartFragment = new CartFragment();
fragmentList.add(cartFragment);
OrderFragment orderFragment = new OrderFragment();
fragmentList.add(orderFragment);
MeFragment meFragment = new MeFragment();
fragmentList.add(meFragment);
PagerAdapter adapter = new PagerAdapter(getSupportFragmentManager(), fragmentList);
layout_home.setAdapter(adapter);
}
@OnClick({R.id.ll_home, R.id.ll_sorts, R.id.ll_cart, R.id.ll_order, R.id.ll_me})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.ll_home:
setTabSelection(0);
break;
case R.id.ll_sorts:
setTabSelection(1);
break;
case R.id.ll_cart:
setTabSelection(2);
break;
case R.id.ll_order:
setTabSelection(3);
break;
case R.id.ll_me:
setTabSelection(4);
break;
}
}
public void setTabSelection(int index) {
// 每次选中之前先清除掉上次的选中状态
clearSelection();
switch (index) {
case 0:
iv_home.setImageResource(R.drawable.menu_home_y);
tv_home.setTextColor(ContextCompat.getColor(this, R.color.main_color));
break;
case 1:
iv_sorts.setImageResource(R.drawable.menu_sorts_y);
tv_sorts.setTextColor(ContextCompat.getColor(this, R.color.main_color));
break;
case 2:
iv_cart.setImageResource(R.drawable.menu_cart_y);
tv_cart.setTextColor(ContextCompat.getColor(this, R.color.main_color));
break;
case 3:
iv_order.setImageResource(R.drawable.menu_order_y);
tv_order.setTextColor(ContextCompat.getColor(this, R.color.main_color));
break;
case 4:
iv_me.setImageResource(R.drawable.menu_me_y);
tv_me.setTextColor(ContextCompat.getColor(this, R.color.main_color));
break;
}
layout_home.setCurrentItem(index);
}
private void clearSelection() {
iv_home.setImageResource(R.drawable.menu_home_n);
iv_sorts.setImageResource(R.drawable.menu_sorts_n);
iv_cart.setImageResource(R.drawable.menu_cart_n);
iv_order.setImageResource(R.drawable.menu_order_n);
iv_me.setImageResource(R.drawable.menu_me_n);
tv_home.setTextColor(0XFF333333);
tv_sorts.setTextColor(0XFF333333);
tv_cart.setTextColor(0XFF333333);
tv_order.setTextColor(0XFF333333);
tv_me.setTextColor(0XFF333333);
}
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
@Override
public void onPageSelected(int position) {
setTabSelection(position);
}
@Override
public void onPageScrollStateChanged(int state) {
}
/**
* 2次退出效果
*/
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
exit();
return false;
}
return super.onKeyDown(keyCode, event);
}
public void exit() {
if ((System.currentTimeMillis() - exitTime) > 2000) {
Toast.makeText(getApplicationContext(), "再按一次退出程序", Toast.LENGTH_SHORT).show();
exitTime = System.currentTimeMillis();
} else {
finish();
System.exit(0);
}
}
}
| [
"466302603@qq.com"
] | 466302603@qq.com |
7ce328aa3c84705c74fcc960b5c9eae88bcb9cdb | b1f73bbeeb8a2b549f8204140edf7a5b36278212 | /src/Main.java | 46bf0e4b862e7ee370639e687a153d0f7d154e8b | [] | no_license | abatwara/Upgrad | 362315daeb778ebcd39aa6555112f05c2102550a | cb4d311db24b71b862922edc4a8db24953e1afa2 | refs/heads/master | 2022-11-27T21:56:28.871245 | 2020-08-12T09:57:38 | 2020-08-12T09:57:38 | 286,760,362 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 644 | java | import java.io.IOException;
public class Main {
public static void main(String args[]) {
int a[] = {1,2,3,4,5};
for (int num1 : a)
{
for(int num2 : a)
{
System.out.println(num1+num2);
}
}
}
static void fun1() {
try {
fun2();
System.out.print("B");
} catch (Exception e) {
System.out.print("C");
}
}
static void fun2() throws IOException {
fun3();
System.out.print("D");
}
static void fun3() throws IOException {
throw new IOException();
}
} | [
"anuj.batwara@gmail.com"
] | anuj.batwara@gmail.com |
70bd776c84f40bf981dae52f49904b2fbe8630ff | d557fe04f706e7d008b2bcd8bf8aa861776a15fb | /core/src/main/java/com/es/core/dao/order/JdbcOrderDao.java | 252339f868d44ae3db8a415288de91b6bf18852f | [] | no_license | PlusqRED/phoneshop | add6ca055a0397cea0b971f6797ae9ffb6126f5c | 055b73535312d6be371a8f7c516dc4b4888dcb7c | refs/heads/master | 2020-05-27T15:33:29.720314 | 2019-12-20T08:34:45 | 2019-12-20T08:34:45 | 188,681,567 | 0 | 0 | null | 2019-12-20T08:34:47 | 2019-05-26T12:43:18 | TSQL | UTF-8 | Java | false | false | 5,010 | java | package com.es.core.dao.order;
import com.es.core.dao.phone.PhoneDao;
import com.es.core.model.order.Order;
import com.es.core.model.order.OrderItem;
import com.es.core.model.order.OrderStatus;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.simple.SimpleJdbcInsert;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@Component
public class JdbcOrderDao implements OrderDao {
//language=SQL
private final static String FIND_BY_ID =
"select * from ORDERS where ID = ?";
//language=SQL
private final static String FIND_ORDER_ITEMS_BY_ORDER_ID =
"select * from ORDER_ITEMS where ORDER_ID = ?";
//language=SQL
private final static String FIND_ALL =
"select * from (select * from ORDERS offset ? limit ?) t " +
"left join ORDER_ITEMS on t.ID = ORDER_ITEMS.ORDER_ID " +
"left join PHONES on PHONES.ID = ORDER_ITEMS.PHONE_ID";
//language=SQL
private final static String UPDATE_STATUS =
"update ORDERS set ORDER_STATUS = ? where ID = ?";
//language=SQL
private final static String GET_STATUS =
"select ORDER_STATUS from ORDERS where ID = ?";
@Resource
private PhoneDao phoneDao;
@Resource
private JdbcTemplate jdbcTemplate;
@Override
public long save(Order order) {
SimpleJdbcInsert simpleJdbcInsert = new SimpleJdbcInsert(jdbcTemplate)
.withTableName("ORDERS")
.usingGeneratedKeyColumns("ID");
long orderId = simpleJdbcInsert.executeAndReturnKey(getOrderParameters(order)).longValue();
order.getOrderItems().forEach(orderItem -> saveOrderItem(orderId, orderItem));
return orderId;
}
private void saveOrderItem(long orderId, OrderItem orderItem) {
new SimpleJdbcInsert(jdbcTemplate)
.withTableName("ORDER_ITEMS")
.execute(getOrderItemParameters(orderId, orderItem));
phoneDao.decreasePhoneStockById(orderItem.getPhone().getId(), orderItem.getQuantity());
}
@Override
public List<OrderItem> findOrderItemsByOrderId(Long orderId) {
return jdbcTemplate.query(FIND_ORDER_ITEMS_BY_ORDER_ID, new OrderItemRowMapper(phoneDao), orderId);
}
@Override
public void setOrderStatusById(Long id, OrderStatus status) {
if (OrderStatus.NEW.equals(getOrderStatusById(id))) {
jdbcTemplate.update(UPDATE_STATUS, status.toString(), id);
}
}
@Override
public OrderStatus getOrderStatusById(Long id) {
return OrderStatus.valueOf(jdbcTemplate.queryForObject(
GET_STATUS,
(resultSet, i) -> resultSet.getString("ORDER_STATUS"),
id
).toUpperCase());
}
private Map<String, Object> getOrderParameters(Order order) {
Map<String, Object> parameters = new HashMap<>();
parameters.put("SUBTOTAL", order.getSubtotal());
parameters.put("DELIVERY_PRICE", order.getDeliveryPrice());
parameters.put("OVERALL_WRAPPING_PRICE", order.getOverallWrappingPrice());
parameters.put("FIRST_NAME", order.getFirstName());
parameters.put("LAST_NAME", order.getLastName());
parameters.put("DELIVERY_ADDRESS", order.getDeliveryAddress());
parameters.put("CONTACT_PHONE_NO", order.getContactPhoneNo());
parameters.put("ADDITIONAL_INFO", order.getAdditionalInformation());
parameters.put("ORDER_STATUS", order.getStatus().toString());
parameters.put("DATE", order.getDate());
return parameters;
}
private Map<String, Object> getOrderItemParameters(Long orderId, OrderItem orderItem) {
Map<String, Object> parameters = new HashMap<>();
parameters.put("ORDER_ID", orderId);
parameters.put("PHONE_ID", orderItem.getPhone().getId());
parameters.put("ID", orderItem.getId());
parameters.put("QUANTITY", orderItem.getQuantity());
parameters.put("WRAPPING", orderItem.getWrapping());
parameters.put("WRAPPING_ADDITIONAL", orderItem.getWrappingAdditional());
return parameters;
}
@Override
public Optional<Order> find(Long id) {
try {
Order order = jdbcTemplate.queryForObject(FIND_BY_ID, new OrderRowMapper(), id);
order.setOrderItems(findOrderItemsByOrderId(id));
return Optional.of(order);
} catch (DataAccessException e) {
return Optional.empty();
}
}
@Override
public void update(Order model) {
}
@Override
public void delete(Order model) {
}
@Override
public List<Order> findAll(int offset, int limit) {
return jdbcTemplate.query(FIND_ALL, new OrderResultSetExtractor(phoneDao), offset, limit);
}
}
| [
"rickes.oleg@gmail.com"
] | rickes.oleg@gmail.com |
593889025ad15d1dbc430a6feb55f9d54030fc7a | be29c33e03cf20cd1b7e11f7fcadcafa1aa29e1c | /src/main/java/org/jtwig/render/listeners/RenderListener.java | 95ffd01bae63e11766c926e5a458b1e2ebc30bea | [
"Apache-2.0"
] | permissive | MakerTim/jtwig-core | 65f30171325c5b17dca72870db2401845a8aaa3b | 0f9e980534830295c7dc47c0a5ee050e0b524891 | refs/heads/master | 2021-07-10T07:46:03.735353 | 2017-10-06T15:59:09 | 2017-10-06T15:59:09 | 106,023,443 | 0 | 0 | null | 2017-10-06T15:56:21 | 2017-10-06T15:56:21 | null | UTF-8 | Java | false | false | 154 | java | package org.jtwig.render.listeners;
import org.jtwig.render.RenderRequest;
public interface RenderListener {
void listen (RenderRequest request);
}
| [
"jmelo@lyncode.com"
] | jmelo@lyncode.com |
113cc4d4d0b7fb30199f7c8b218ca7e97131d003 | 180445e7fcf7d4143984f9d95d924df47c66c711 | /src/gui/page/subpage/LG_Iptv.java | 8ab59db8847fadba4e4163112f3138559975d79d | [] | no_license | HanSJin/PhonePro | 1fde278b90071018f0536c67e4692287d554de3c | c52dd30b9035c2a4e8fc7f35350396eeabb981eb | refs/heads/master | 2021-01-22T04:48:50.402771 | 2016-10-27T12:27:30 | 2016-10-27T12:27:30 | 72,104,797 | 1 | 0 | null | null | null | null | UHC | Java | false | false | 8,593 | java | package gui.page.subpage;
import gui.constvalue.ConstV;
import gui.page.LG_Page;
import java.awt.Color;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import model.LGData;
import control.Controller;
@SuppressWarnings("serial")
public class LG_Iptv extends JFrame implements MouseMotionListener, MouseListener, KeyListener{
private int tmpX, tmpY;
private JLabel titleBar,
iptvPanel,
exitBtn;
private JLabel select1, select2, select3;
public LG_Iptv() {
// TODO Auto-generated constructor stub
setUndecorated(true);
setSize(711,263+20);
setOpacity(0.98f);
setLocation(
(int) (ConstV.windowSizeX * 0.85 - 711 - 5), // 1088
(int) (ConstV.windowSizeY * 0.4525)); // 370
setVisible(true);
setLayout(null);
setAlwaysOnTop(true);
setFocusable(true);
setComponent();
setBackground(Color.black);
addWindowListener(new EventHandler());
addKeyListener(this);
titleBar.addMouseMotionListener(this);
titleBar.addMouseListener(this);
}
private void setComponent() {
// TODO Auto-generated method stub
/*
* 타이틀 바
*/
titleBar = new JLabel(new ImageIcon(Controller.loadLGImage.getIptvTitleImg()));
this.add(titleBar);
titleBar.setBounds(
0,
0,
711,
20);
/*
* cardPanel
*/
iptvPanel = new JLabel(new ImageIcon(Controller.loadLGImage.getIptvPanelImg()));
this.add(iptvPanel);
iptvPanel.setBounds(
0,
20,
711,
263);
/*
* 종료버튼
*/
exitBtn = new JLabel(new ImageIcon(Controller.loadCommonImage.getCardExitImg()));
titleBar.add(exitBtn);
exitBtn.setBounds(
691,
0,
18,
18);
exitBtn.addMouseListener(this);
/*
* 선택버튼1
*/
if (LG_Page.isSel_Iptv_1)
select1 = new JLabel(new ImageIcon(Controller.loadSelectImage.getSelectYesImg()));
else
select1 = new JLabel(new ImageIcon(Controller.loadSelectImage.getSelectNoImg()));
iptvPanel.add(select1);
select1.setBounds(660, 70, 31, 26);
select1.addMouseListener(this);
/*
* 선택버튼2
*/
if (LG_Page.isSel_Iptv_2)
select2 = new JLabel(new ImageIcon(Controller.loadSelectImage.getSelectYesImg()));
else
select2 = new JLabel(new ImageIcon(Controller.loadSelectImage.getSelectNoImg()));
iptvPanel.add(select2);
select2.setBounds(660, 123, 31, 26);
select2.addMouseListener(this);
/*
* 선택버튼3
*/
if (LG_Page.isSel_Iptv_3)
select3 = new JLabel(new ImageIcon(Controller.loadSelectImage.getSelectYesImg()));
else
select3 = new JLabel(new ImageIcon(Controller.loadSelectImage.getSelectNoImg()));
iptvPanel.add(select3);
select3.setBounds(660, 177, 31, 26);
select3.addMouseListener(this);
}
// event of exit
class EventHandler implements WindowListener {
public void windowClosed(WindowEvent we) {}
public void windowIconified(WindowEvent we) {}
public void windowOpened(WindowEvent we) {}
public void windowDeiconified(WindowEvent we) {}
public void windowActivated(WindowEvent we) {}
public void windowDeactivated(WindowEvent we) {}
public void windowClosing(WindowEvent we) {
LG_Page.isOpenIPTV = false;
dispose();
}
}
/*
* 드레그를 위한 마우스 이벤트들 (non-Javadoc)
* @see java.awt.event.MouseMotionListener#mouseDragged(java.awt.event.MouseEvent)
*/
@Override
public void mouseDragged(MouseEvent e) {
// TODO Auto-generated method stub
if (e.getSource() == titleBar) {
int x = e.getXOnScreen() - tmpX;
int y = e.getYOnScreen() - tmpY;
this.setLocation(x, y);
}
}
@Override
public void mouseMoved(MouseEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void mouseClicked(MouseEvent arg0) {
// TODO Auto-generated method stub
if (arg0.getSource() == exitBtn) {
LG_Page.isOpenIPTV = false;
dispose();
}
}
@Override
public void mouseEntered(MouseEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void mouseExited(MouseEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void mousePressed(MouseEvent arg0) {
// TODO Auto-generated method stub
if (arg0.getSource() == titleBar) {
tmpX = arg0.getXOnScreen() - this.getX();
tmpY = arg0.getYOnScreen() - this.getY();
}
/*
* 버튼 선택 이벤트 입니다.
*/
// 선택 버튼 1
else if (arg0.getSource() == select1) {
if (LG_Page.isSel_Iptv_1 == true) {
sel1_fromYes_toNo();
} else {
if (LG_Page.isSel_Iptv_2 == true) sel2_fromYes_toNo();
if (LG_Page.isSel_Iptv_3 == true) sel3_fromYes_toNo();
sel1_fromNo_toYes();
}
}
// 선택 버튼 2
else if (arg0.getSource() == select2) {
if (LG_Page.isSel_Iptv_2 == true) {
sel2_fromYes_toNo();
} else {
if (LG_Page.isSel_Iptv_1 == true) sel1_fromYes_toNo();
if (LG_Page.isSel_Iptv_3 == true) sel3_fromYes_toNo();
sel2_fromNo_toYes();
}
}
// 선택 버튼 3
else if (arg0.getSource() == select3) {
if (LG_Page.isSel_Iptv_3 == true) {
sel3_fromYes_toNo();
} else {
if (LG_Page.isSel_Iptv_1 == true) sel1_fromYes_toNo();
if (LG_Page.isSel_Iptv_2 == true) sel2_fromYes_toNo();
sel3_fromNo_toYes();
}
}
// 수식 대입
Controller.lgData.calculData();
}
/*
* Click - 1
*/
private void sel1_fromNo_toYes() {
select1.setIcon(new ImageIcon(Controller.loadSelectImage.getSelectYesImg()));
for (int i=1; i<11; i++) {
if (i==3 || (i>6 && i<11)) {
int price = Integer.parseInt(LGData.dataLabel[i][14].getText());
price = price - 8800;
LGData.dataLabel[i][14].setText(price + "");
}
}
LG_Page.isSel_Iptv_1 = true;
}
private void sel1_fromYes_toNo() {
select1.setIcon(new ImageIcon(Controller.loadSelectImage.getSelectNoImg()));
for (int i=1; i<11; i++) {
if (i==3 || (i>6 && i<11)) {
int price = Integer.parseInt(LGData.dataLabel[i][14].getText());
price = price + 8800;
LGData.dataLabel[i][14].setText(price + "");
}
}
LG_Page.isSel_Iptv_1 = false;
}
/*
* Click - 2
*/
private void sel2_fromNo_toYes() {
select2.setIcon(new ImageIcon(Controller.loadSelectImage.getSelectYesImg()));
for (int i=1; i<11; i++) {
if (i==1 || i==2 || i==4 || i==5 || i==6) {
int price = Integer.parseInt(LGData.dataLabel[i][14].getText());
price = price - 5500;
LGData.dataLabel[i][14].setText(price + "");
}
}
LG_Page.isSel_Iptv_2 = true;
}
private void sel2_fromYes_toNo() {
select2.setIcon(new ImageIcon(Controller.loadSelectImage.getSelectNoImg()));
for (int i=1; i<11; i++) {
if (i==1 || i==2 || i==4 || i==5 || i==6) {
int price = Integer.parseInt(LGData.dataLabel[i][14].getText());
price = price + 5500;
LGData.dataLabel[i][14].setText(price + "");
}
}
LG_Page.isSel_Iptv_2 = false;
}
/*
* Click - 3
*/
private void sel3_fromNo_toYes() {
select3.setIcon(new ImageIcon(Controller.loadSelectImage.getSelectYesImg()));
for (int i=1; i<11; i++) {
int price = Integer.parseInt(LGData.dataLabel[i][15].getText());
price = price - 2200;
LGData.dataLabel[i][15].setText(price + "");
}
LG_Page.isSel_Iptv_3 = true;
}
private void sel3_fromYes_toNo() {
select3.setIcon(new ImageIcon(Controller.loadSelectImage.getSelectNoImg()));
for (int i=1; i<11; i++) {
int price = Integer.parseInt(LGData.dataLabel[i][15].getText());
price = price + 2200;
LGData.dataLabel[i][15].setText(price + "");
}
LG_Page.isSel_Iptv_3 = false;
}
@Override
public void mouseReleased(MouseEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void keyPressed(KeyEvent e) {
// TODO Auto-generated method stub
if (e.getKeyCode() == 27) {
// esc
LG_Page.isOpenIPTV = false;
dispose();
}
}
@Override
public void keyReleased(KeyEvent e) {
// TODO Auto-generated method stub
}
@Override
public void keyTyped(KeyEvent e) {
// TODO Auto-generated method stub
}
} | [
"kksd9900@naver.com"
] | kksd9900@naver.com |
7b548e8ffacc1e1dc13266424d499d84dc17cd1b | 1f5235f925f7a66138bd2948fdac8a3a05079479 | /src/io/github/wwqgtxx/soilqualitymonitor/action/ParseDataAction.java | afc5de7430675ce393669028c8099a9dd12b0597 | [] | no_license | wwqgtxx/SoilQualityMonitor | de99b43fae2ebe05fda1690a0cd221d811559f0c | 57730da433ea1e57a7a6b4466784aebd563977f0 | refs/heads/master | 2020-05-30T15:08:54.072042 | 2016-11-08T08:29:48 | 2016-11-08T08:29:48 | 59,478,084 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,080 | java | package io.github.wwqgtxx.soilqualitymonitor.action;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import com.opensymphony.xwork2.ActionSupport;
import io.github.wwqgtxx.soilqualitymonitor.common.DataSave;
import io.github.wwqgtxx.soilqualitymonitor.bean.SettingBean;
import io.github.wwqgtxx.soilqualitymonitor.sensor.SensorDataGetter;
import io.github.wwqgtxx.soilqualitymonitor.sensor.SensorDataUpdater;
/**
* Created by Administrator on 2016/5/16.
*/
public class ParseDataAction extends ActionSupport{
public SettingBean getSetting() {
return setting;
}
public void setSetting(SettingBean setting) {
this.setting = setting;
}
private SettingBean setting;
private Map<String,Object> dataMap= new HashMap<>();
public boolean isNeedAll() {
return needAll;
}
public void setNeedAll(boolean needAll) {
this.needAll = needAll;
}
private boolean needAll;
public String doSet() {
if (setting == null){
dataMap.put("success", false);
dataMap.put("info", "sensorData == null!");
dataMap.put("timestamp", System.currentTimeMillis());
return ERROR;
}
DataSave.setSetting(setting);
SensorDataUpdater.getSensorDataUpdater().changeUpdateTime(setting.getUpdatetime(), TimeUnit.SECONDS);
SensorDataUpdater.getSensorDataUpdater().getSensorConnector().command("K"+String.format("%03d",new Long(setting.getDetectiontime()).intValue()));
return doGet();
}
public String doGet() {
if (needAll)
dataMap.put("dataLists", SensorDataGetter.getSensorDataGetter().getSensorDataList());
else
dataMap.put("dataList", DataSave.getSensorData());
dataMap.put("success", true);
dataMap.put("lastTimestamp",DataSave.getLastDataTimestamp());
dataMap.put("timestamp", System.currentTimeMillis());
return SUCCESS;
}
public Map<String, Object> getDataMap() {
return dataMap;
}
}
| [
"wwqgtxx@gmail.com"
] | wwqgtxx@gmail.com |
5e7ca104529d765849f34380cfd23f5ca4d7fb84 | 40104bacf59d3525929f4b82bae393f33e04fefd | /src/tarea1/imprimir.java | 5d53899d53a20d9f2326a571dccf48c42be7d187 | [] | no_license | dagr27/Tareas | 85a42d67cf710aff1beac4d2494bebf8b6427fc6 | 36b55577c85dee2ace1ceb95829961ec7a024198 | refs/heads/master | 2021-09-10T11:05:25.693174 | 2018-03-25T05:55:43 | 2018-03-25T05:55:43 | 126,128,440 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 800 | java | package tarea1;
/*
* 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.
*/
/**
*
* @author maria
*/
public class imprimir {
String nombre;
String apellido;
String carrera;
String fechaNac;
int edad;
public imprimir(String name, String lastname, String ca, String date, int age){
this.nombre = name;
this.apellido = lastname;
carrera = ca;
fechaNac = date;
edad = age;
}
public void mostrar(){
System.out.println("Nombre: "+nombre+ ", apellido: "+apellido+", "+"carrera: "+carrera+", "+"fecha de nacimiento: "+fechaNac+", "+"edad: "+edad);
}
}
| [
"37205358+dagr27@users.noreply.github.com"
] | 37205358+dagr27@users.noreply.github.com |
61530345b534def5ef69e1fe344e291aee1515f9 | 2045c33511031af0dd69151e0dd7e331f7538a46 | /src/com/fengkun/design_pattern/state/advance/EldState.java | 1ebdc0b8869d87a75abcb0786b687bc8775fedc6 | [] | no_license | fengkunangel/DesignPattern | 028b13834b6154bcedaf2264e9be1d110c5fb830 | 1f5bc6e75966bf411f617b91ca1186a8d5ac6976 | refs/heads/master | 2020-03-27T20:24:54.397641 | 2018-09-28T16:38:05 | 2018-09-28T16:38:05 | 147,067,377 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 303 | java | package com.fengkun.design_pattern.state.advance;
/**
* Created by fengkunangel on 2018/9/16.
*/
public class EldState implements State {
@Override
public void perform() {
System.out.println("老年");
}
@Override
public State nextState() {
return null;
}
}
| [
"fengkunangel@outlook.com"
] | fengkunangel@outlook.com |
a8a1ba971bf1b5e2e50b9b73dabdb2bca77afcf1 | d53b67e25c361db8ccc868c9ebd650981fee9e35 | /CollabBackEnd2.2/src/main/java/com/niit/model/Friend.java | 0d87db848b0e100b66dd7ef807eb90fd15622e41 | [] | no_license | Shuganya/collaborationNew | 88a106774dd61c2fd210bd703ce79fee8271e50a | 8d905a242a2eb0925bb69e2a87f8a50eda840a5e | refs/heads/master | 2020-06-23T03:03:38.009563 | 2016-12-09T09:09:43 | 2016-12-09T09:09:43 | 74,670,015 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,037 | java | package com.niit.model;
import java.util.UUID;
import javax.persistence.*;
import org.springframework.stereotype.Component;
@Entity
@Component
@Table(name="Friend")
public class Friend extends BaseDomain {
@Id
private String id;
private String userid;
private String friendid;
private String status;
private char is_online;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getUserid() {
return userid;
}
public void setUserid(String userid) {
this.userid = userid;
}
public String getFriendid() {
return friendid;
}
public void setFriendid(String friendid) {
this.friendid = friendid;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public char getIs_online() {
return is_online;
}
public void setIs_online(char is_online) {
this.is_online = is_online;
}
public Friend()
{
this.id="FRIEND" + UUID.randomUUID().toString().substring(24).toUpperCase();
}
}
| [
"shuganyaravi29@gmail.com"
] | shuganyaravi29@gmail.com |
70d27f2ce6247c98e094213e7e9b6e4a0ee3dbb2 | 19b774dcbdf8a1df6132a12f43df9811d57d2aca | /src/gui/controladores/GUIConfirmation.java | db79c5e6e69af40d115fe78c48fc872ff5b2504c | [] | no_license | vinesnts/ProjetoBD | 75aeb42759333db0928f4bb873d6ccd72553e4e7 | 9c2e8e3c409ea6f862ff27fa7fa6c88b69a2baa1 | refs/heads/master | 2020-04-01T12:55:20.812860 | 2018-12-20T00:20:55 | 2018-12-20T00:20:55 | 153,229,692 | 0 | 0 | null | 2018-12-20T00:20:56 | 2018-10-16T05:52:10 | Java | UTF-8 | Java | false | false | 1,025 | java | package gui.controladores;
import fachada.Fachada;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType;
public class GUIConfirmation {
private boolean escolha;
Fachada fachada = Fachada.getInstance();
public boolean janelaConfirmacao(String pergunta, String aviso) {
Alert dialogoPergunta = new Alert(Alert.AlertType.CONFIRMATION);
ButtonType btnSim = new ButtonType("Sim");
ButtonType btnNao = new ButtonType("Nao");
dialogoPergunta.getButtonTypes().setAll(btnSim, btnNao);
dialogoPergunta.setTitle("Voce tem certeza?");
dialogoPergunta.setHeaderText(pergunta);
dialogoPergunta.setContentText(aviso);
dialogoPergunta.showAndWait().ifPresent(b -> {
if (b == btnSim) {
dialogoPergunta.close();
escolha = true;
} else if (b == btnNao) {
dialogoPergunta.close();
escolha = false;
}
});
return escolha;
}
}
| [
"v.santos0406@gmail.com"
] | v.santos0406@gmail.com |
d6a96c1a8a9da406fc61b02d2cdc044f879428c1 | 575c19e81594666f51cceb55cb1ab094b218f66b | /octopusconsortium/src/main/java/OctopusConsortium/Models/RCS/XActMoodIntentEventX.java | 3c33355a5d45f5dfb3a60093e980e4ce33a10a31 | [
"Apache-2.0"
] | permissive | uk-gov-mirror/111online.ITK-MessagingEngine | 62b702653ea716786e2684e3d368898533e77534 | 011e8cbe0bcb982eedc2204318d94e2bb5d4adb2 | refs/heads/master | 2023-01-22T17:47:54.631879 | 2020-12-01T14:18:05 | 2020-12-01T14:18:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,005 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-257
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2012.10.24 at 03:44:55 PM BST
//
package OctopusConsortium.Models.RCS;
import javax.xml.bind.annotation.XmlEnum;
/**
* <p>Java class for x_ActMoodIntentEvent_X.
*
* <p>The following schema fragment specifies the expected content contained within this class.
* <p>
* <pre>
* <simpleType name="x_ActMoodIntentEvent_X">
* <restriction base="{urn:hl7-org:v3}cs">
* <enumeration value="EVN"/>
* </restriction>
* </simpleType>
* </pre>
*
*/
@XmlEnum
public enum XActMoodIntentEventX {
EVN;
public String value() {
return name();
}
public static XActMoodIntentEventX fromValue(String v) {
return valueOf(v);
}
}
| [
"tom.axworthy@nhs.net"
] | tom.axworthy@nhs.net |
771b3840b67bd25727644fd23e4f7f1b68816ce8 | 11172896910e04db7828bf2976438e5b79d6e65d | /financas/src/br/com/alura/financas/dao/MovimentacaoDao.java | e3a65be22bdda43888461e186f264de42df37370 | [] | no_license | MateuVieira/Java | d8679ffba26b595ef4b305cd45147a1e0d1c4c59 | 9f1734bafe1bd97b7729c43d4657b6d7fe950119 | refs/heads/master | 2020-04-27T18:38:54.678185 | 2019-03-27T15:32:02 | 2019-03-27T15:32:02 | 174,580,592 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 804 | java | package br.com.alura.financas.dao;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.TypedQuery;
import com.mysql.cj.Query;
import br.com.alura.financas.modelo.Conta;
import br.com.alura.financas.modelo.TipoMovimentacao;
public class MovimentacaoDao {
private EntityManager em;
public MovimentacaoDao(EntityManager em) {
this.em = em;
}
public List<Double> getMediasPorDIaETipo(TipoMovimentacao saida, Conta conta) {
String jpql = "select distinct avg(m.valor) from Movimentacao m where m.conta = :pConta"
+ "and m.tipo = :pTipo group by m.data";
TypedQuery<Double> query = em.createQuery(jpql, Double.class);
query.setParameter("pConta", conta);
query.setParameter("pTipo", TipoMovimentacao.SAIDA);
return query.getResultList();
}
}
| [
"35344433+MateuVieira@users.noreply.github.com"
] | 35344433+MateuVieira@users.noreply.github.com |
94812890cae3973940857b56ed84f3e0114d5054 | e5bb7ef8376d0aad44905816003ddd9906d95969 | /alien/src/main/java/com/andrew/apollo/loaders/WrappedAsyncTaskLoader.java | 9e155f023d60dbbc0f49888def849797c3169ed2 | [] | no_license | EitlerPereira/Music | d6f50c47937a17a04138bf46bdf2ed4a8a1ef5d0 | 4ac5d4f41228ccfe2821102ab40e221c7e30ad74 | refs/heads/master | 2021-06-05T05:24:23.844862 | 2016-08-16T09:02:26 | 2016-08-16T09:02:26 | 109,279,856 | 0 | 1 | null | 2017-11-02T15:02:48 | 2017-11-02T15:02:48 | null | UTF-8 | Java | false | false | 1,527 | java |
package com.andrew.apollo.loaders;
import android.content.Context;
import android.support.v4.content.AsyncTaskLoader;
/**
* <a href="http://code.google.com/p/android/issues/detail?id=14944">Issue
* 14944</a>
*
* @author Alexander Blom
*/
public abstract class WrappedAsyncTaskLoader<D> extends AsyncTaskLoader<D> {
private D mData;
/**
* Constructor of <code>WrappedAsyncTaskLoader</code>
*
* @param context The {@link android.content.Context} to use.
*/
public WrappedAsyncTaskLoader(Context context) {
super(context);
}
/**
* {@inheritDoc}
*/
@Override
public void deliverResult(D data) {
if (!isReset()) {
this.mData = data;
super.deliverResult(data);
} else {
// An asynchronous query came in while the loader is stopped
}
}
/**
* {@inheritDoc}
*/
@Override
protected void onStartLoading() {
if (this.mData != null) {
deliverResult(this.mData);
} else if (takeContentChanged() || this.mData == null) {
forceLoad();
}
}
/**
* {@inheritDoc}
*/
@Override
protected void onStopLoading() {
// Attempt to cancel the current load task if possible
cancelLoad();
}
/**
* {@inheritDoc}
*/
@Override
protected void onReset() {
super.onReset();
// Ensure the loader is stopped
onStopLoading();
this.mData = null;
}
}
| [
"zaiyongs@gmail.com"
] | zaiyongs@gmail.com |
1ef52bab60661c4b093368e1cee835ac1281d7f9 | 8979c7fbc2cdc3e08220847f843d7816fd8d5d08 | /app/src/main/java/com/lzx/zhihudaily/module/common/AboutAppActivity.java | 045fd9944548c83f9b0271d3d219cb050a81c89f | [
"Apache-2.0"
] | permissive | zhumengguang/FindDaily | be82b9d39d493da7051db618a173e33a4e77a07d | 3ce47fe650e46e25feb0d986477025271b2b4622 | refs/heads/master | 2020-03-17T12:27:55.744382 | 2017-07-28T02:37:26 | 2017-07-28T02:37:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,577 | java | package com.lzx.zhihudaily.module.common;
import android.os.Bundle;
import android.support.design.widget.CollapsingToolbarLayout;
import android.support.v7.app.ActionBar;
import android.support.v7.widget.Toolbar;
import com.lzx.zhihudaily.R;
import com.lzx.zhihudaily.base.BaseActivity;
/**
* Created by lzx on 2016/10/24.
* 功能:关于App
*/
public class AboutAppActivity extends BaseActivity {
private Toolbar mToolbar;
private CollapsingToolbarLayout mCollapsingToolbarLayout;
@Override
public int getLayoutId() {
return R.layout.activity_about_app;
}
@Override
protected void initViews(Bundle savedInstanceState) {
mToolbar = (Toolbar) findViewById(R.id.toolbar);
mCollapsingToolbarLayout = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
}
@Override
protected void initToolBar() {
setSupportActionBar(mToolbar);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null)
actionBar.setDisplayHomeAsUpEnabled(true);
mCollapsingToolbarLayout.setTitle("关于App v 1.0");
mToolbar.setNavigationOnClickListener(view -> finish());
// //设置StatusBar透明
// SystemBarHelper.immersiveStatusBar(this);
// SystemBarHelper.setHeightAndPadding(this, mToolbar);
}
@Override
protected void initData() {
}
@Override
protected void initAction() {
//关于app,评论,我的收藏
//详情,写评论,主编,主编资料,关于我页被顶上去
}
}
| [
"386707112@qq.com"
] | 386707112@qq.com |
6f45131cf5e2ea54256ad685b76c0027d9c2890c | ceb4bf1fab1c5af248463ebe0ccb6c4ad3b1e49a | /Session6/src/Controller/Colliable.java | 139862dd6cfb1b7540e76fba0bdfcf9a97f61d03 | [] | no_license | cknguyen96/TuyenCI5 | ee458bc61fb17a79663bf01e9b171278bb1ae949 | af0c7bef33c318f9dc651925bb6ec64ed3d6d952 | refs/heads/master | 2021-01-20T19:19:38.200270 | 2016-08-13T11:08:26 | 2016-08-13T11:08:26 | 64,072,899 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 206 | java | package Controller;
import models.GameObject;
/**
* Created by PhamTuyen on 8/1/2016.
*/
public interface Colliable {
GameObject getGameObject();
void onCollide(Colliable colliable);
}
| [
"cknguyen96@gmail.com"
] | cknguyen96@gmail.com |
5df26ad2ff61f3a06180723e2dd981868f5077cf | 1e8a5381b67b594777147541253352e974b641c5 | /com/google/android/gms/playlog/internal/PlayLoggerContext.java | ed3292894acb93fc877f97ab8cd0c60eda3137b2 | [] | no_license | jramos92/Verify-Prueba | d45f48829e663122922f57720341990956390b7f | 94765f020d52dbfe258dab9e36b9bb8f9578f907 | refs/heads/master | 2020-05-21T14:35:36.319179 | 2017-03-11T04:24:40 | 2017-03-11T04:24:40 | 84,623,529 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,320 | java | package com.google.android.gms.playlog.internal;
import android.os.Parcel;
import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
import com.google.android.gms.common.internal.zzw;
import com.google.android.gms.common.internal.zzx;
public class PlayLoggerContext
implements SafeParcelable
{
public static final zze CREATOR = new zze();
public final String packageName;
public final int versionCode;
public final int zzaRR;
public final int zzaRS;
public final String zzaRT;
public final String zzaRU;
public final boolean zzaRV;
public final String zzaRW;
public final boolean zzaRX;
public final int zzaRY;
public PlayLoggerContext(int paramInt1, String paramString1, int paramInt2, int paramInt3, String paramString2, String paramString3, boolean paramBoolean1, String paramString4, boolean paramBoolean2, int paramInt4)
{
this.versionCode = paramInt1;
this.packageName = paramString1;
this.zzaRR = paramInt2;
this.zzaRS = paramInt3;
this.zzaRT = paramString2;
this.zzaRU = paramString3;
this.zzaRV = paramBoolean1;
this.zzaRW = paramString4;
this.zzaRX = paramBoolean2;
this.zzaRY = paramInt4;
}
@Deprecated
public PlayLoggerContext(String paramString1, int paramInt1, int paramInt2, String paramString2, String paramString3, boolean paramBoolean)
{
this.versionCode = 1;
this.packageName = ((String)zzx.zzw(paramString1));
this.zzaRR = paramInt1;
this.zzaRS = paramInt2;
this.zzaRW = null;
this.zzaRT = paramString2;
this.zzaRU = paramString3;
this.zzaRV = paramBoolean;
this.zzaRX = false;
this.zzaRY = 0;
}
public int describeContents()
{
return 0;
}
public boolean equals(Object paramObject)
{
if (this == paramObject) {}
do
{
return true;
if (!(paramObject instanceof PlayLoggerContext)) {
break;
}
paramObject = (PlayLoggerContext)paramObject;
} while ((this.versionCode == ((PlayLoggerContext)paramObject).versionCode) && (this.packageName.equals(((PlayLoggerContext)paramObject).packageName)) && (this.zzaRR == ((PlayLoggerContext)paramObject).zzaRR) && (this.zzaRS == ((PlayLoggerContext)paramObject).zzaRS) && (zzw.equal(this.zzaRW, ((PlayLoggerContext)paramObject).zzaRW)) && (zzw.equal(this.zzaRT, ((PlayLoggerContext)paramObject).zzaRT)) && (zzw.equal(this.zzaRU, ((PlayLoggerContext)paramObject).zzaRU)) && (this.zzaRV == ((PlayLoggerContext)paramObject).zzaRV) && (this.zzaRX == ((PlayLoggerContext)paramObject).zzaRX) && (this.zzaRY == ((PlayLoggerContext)paramObject).zzaRY));
return false;
return false;
}
public int hashCode()
{
return zzw.hashCode(new Object[] { Integer.valueOf(this.versionCode), this.packageName, Integer.valueOf(this.zzaRR), Integer.valueOf(this.zzaRS), this.zzaRW, this.zzaRT, this.zzaRU, Boolean.valueOf(this.zzaRV), Boolean.valueOf(this.zzaRX), Integer.valueOf(this.zzaRY) });
}
public String toString()
{
StringBuilder localStringBuilder = new StringBuilder();
localStringBuilder.append("PlayLoggerContext[");
localStringBuilder.append("versionCode=").append(this.versionCode).append(',');
localStringBuilder.append("package=").append(this.packageName).append(',');
localStringBuilder.append("packageVersionCode=").append(this.zzaRR).append(',');
localStringBuilder.append("logSource=").append(this.zzaRS).append(',');
localStringBuilder.append("logSourceName=").append(this.zzaRW).append(',');
localStringBuilder.append("uploadAccount=").append(this.zzaRT).append(',');
localStringBuilder.append("loggingId=").append(this.zzaRU).append(',');
localStringBuilder.append("logAndroidId=").append(this.zzaRV).append(',');
localStringBuilder.append("isAnonymous=").append(this.zzaRX).append(',');
localStringBuilder.append("qosTier=").append(this.zzaRY);
localStringBuilder.append("]");
return localStringBuilder.toString();
}
public void writeToParcel(Parcel paramParcel, int paramInt)
{
zze.zza(this, paramParcel, paramInt);
}
}
/* Location: C:\Users\julian\Downloads\Veryfit 2 0_vV2.0.28_apkpure.com-dex2jar.jar!\com\google\android\gms\playlog\internal\PlayLoggerContext.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"ramos.marin92@gmail.com"
] | ramos.marin92@gmail.com |
53b45fc215a69f4ef890a961310c160adc332d21 | be74e1dbaab580a7e4024a595958d1893469863a | /Java/src/ReorderedPowerof2.java | 1db423d5123ccc03cb6fb41047f62f325937df7c | [] | no_license | super0xie/Solution | 0392b2577c31415c60ebcbeedb3dedcb01c66f02 | d028c2d076b1136ee30673faae5844954674961d | refs/heads/master | 2021-06-21T12:34:40.968649 | 2020-12-06T05:27:34 | 2020-12-06T05:27:34 | 130,928,761 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,762 | java |
public class ReorderedPowerof2 {
private static int[] n = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912, 1073741824};
private static int[] len = {1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10};
private static int[][] count = {{0, 1, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 1, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 1, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 1, 0}, {0, 1, 0, 0, 0, 0, 1, 0, 0, 0}, {0, 0, 1, 1, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 1, 0, 1, 0, 0, 0}, {0, 1, 1, 0, 0, 0, 0, 0, 1, 0}, {0, 0, 1, 0, 0, 1, 1, 0, 0, 0}, {0, 1, 1, 0, 0, 1, 0, 0, 0, 0}, {1, 1, 1, 0, 1, 0, 0, 0, 0, 0}, {1, 0, 1, 0, 1, 0, 0, 0, 1, 0}, {1, 0, 0, 0, 1, 0, 1, 0, 0, 1}, {0, 1, 1, 0, 0, 0, 0, 0, 1, 1}, {0, 1, 0, 1, 1, 0, 1, 0, 1, 0}, {0, 0, 1, 1, 0, 0, 1, 1, 1, 0}, {0, 0, 0, 1, 0, 2, 2, 0, 0, 0}, {1, 2, 1, 1, 0, 0, 0, 1, 0, 0}, {0, 1, 2, 0, 2, 0, 1, 0, 0, 0}, {0, 0, 2, 0, 1, 1, 0, 0, 2, 0}, {1, 1, 0, 0, 1, 1, 1, 1, 1, 0}, {1, 1, 2, 0, 0, 1, 0, 1, 0, 1}, {1, 1, 0, 1, 3, 0, 0, 0, 0, 1}, {1, 0, 0, 1, 0, 0, 1, 0, 4, 0}, {0, 2, 1, 0, 0, 0, 2, 3, 0, 0}, {0, 0, 1, 3, 2, 2, 0, 0, 0, 0}, {1, 1, 0, 0, 1, 0, 2, 1, 2, 0}, {0, 2, 2, 1, 1, 0, 0, 2, 1, 0}, {0, 0, 1, 1, 2, 2, 2, 0, 1, 0}, {1, 1, 1, 1, 0, 1, 1, 1, 1, 1}, {1, 2, 1, 1, 2, 0, 0, 2, 1, 0}};
public boolean reorderedPowerOf2(int N) {
int[] c = new int[10];
int length = 0;
while(N > 0) {
int d = (int) (N % 10);
c[d]++;
N = N / 10;
length++;
}
for(int i = 0; i < 31; i++) {
if(length != len[i]) continue;
int j = 0;
for(; j < 10; j++) {
if(count[i][j] != c[j]) break;
}
if(j == 10) return true;
}
return false;
}
public static void main(String[] args) {
int[] n = new int [31];
n[0] = 1;
for(int i = 1; i < n.length; i++) {
n[i] = n[i-1] * 2;
}
int[][] count = new int[31][10];
for(int i = 0; i < count.length; i++) {
int num = n[i];
while(num > 0) {
int d = num % 10;
count[i][d]++;
num = num / 10;
}
}
for(int i = 0; i < count.length; i++) {
System.out.print("{");
for(int j = 0; j < 10; j++) {
System.out.print(count[i][j]);
if(j != 9) System.out.print(", ");
}
System.out.print("}, ");
}
}
}
| [
"sxie@alpine-la.com"
] | sxie@alpine-la.com |
6823f61c32e0d602fa3d237f7c50ee76f0833b55 | d27e4313736792d454fa87ce815030c666c94871 | /Design/src/main/java/建造者模式/Meal/MealBuilder.java | db60ed6c302d9086cdc976ac970b6e714369bd2b | [] | no_license | yefeixue/design_pattern | d1a002296fb5b63c361bd9514b2442cee73a996e | a0a2ce4ff22a55de9475c0daa7d1583233807218 | refs/heads/master | 2020-04-13T22:02:58.031390 | 2018-12-29T02:59:12 | 2018-12-29T02:59:12 | 163,471,321 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 538 | java | package 建造者模式.Meal;
import 建造者模式.Item.ChickenBurger;
import 建造者模式.Item.Coke;
import 建造者模式.Item.Pepsi;
import 建造者模式.Item.VegBurger;
public class MealBuilder {
public Meal prepareVegMeal (){
Meal meal = new Meal();
meal.addItem(new VegBurger());
meal.addItem(new Coke());
return meal;
}
public Meal prepareNonVegMeal (){
Meal meal = new Meal();
meal.addItem(new ChickenBurger());
meal.addItem(new Pepsi());
return meal;
}
} | [
"dingjinlong@huobi.com"
] | dingjinlong@huobi.com |
6512e2f19c24785c35b08cda1e464d2ff16c69c8 | d5515553d071bdca27d5d095776c0e58beeb4a9a | /src/net/sourceforge/plantuml/activitydiagram3/InstructionPartition.java | 6de5e25cd6db478ff32dc6126b3817e8e0c19e75 | [] | no_license | ccamel/plantuml | 29dfda0414a3dbecc43696b63d4dadb821719489 | 3100d49b54ee8e98537051e071915e2060fe0b8e | refs/heads/master | 2022-07-07T12:03:37.351931 | 2016-12-14T21:01:03 | 2016-12-14T21:01:03 | 77,067,872 | 1 | 0 | null | 2022-05-30T09:56:21 | 2016-12-21T16:26:58 | Java | UTF-8 | Java | false | false | 2,543 | java | /* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2017, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.activitydiagram3;
import java.util.Set;
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.sequencediagram.NotePosition;
import net.sourceforge.plantuml.sequencediagram.NoteType;
public class InstructionPartition implements Instruction {
private final InstructionList list = new InstructionList();
private final Instruction parent;
public InstructionPartition(Instruction parent, String partitionTitle) {
this.parent = parent;
}
public Instruction getParent() {
return parent;
}
public Set<Swimlane> getSwimlanes() {
return list.getSwimlanes();
}
public Swimlane getSwimlaneIn() {
return list.getSwimlaneIn();
}
public Swimlane getSwimlaneOut() {
return list.getSwimlaneOut();
}
public Ftile createFtile(FtileFactory factory) {
return list.createFtile(factory);
}
public void add(Instruction other) {
list.add(other);
}
public boolean kill() {
return list.kill();
}
public LinkRendering getInLinkRendering() {
return list.getInLinkRendering();
}
public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors) {
throw new UnsupportedOperationException();
}
}
| [
"plantuml@gmail.com"
] | plantuml@gmail.com |
ddcc5f1e9a2013b6ab1679d4842ce04c429740e0 | 66e2f35b7b56865552616cf400e3a8f5928d12a2 | /src/main/java/com/alipay/api/response/AlipayUserApplepayOtpresolutionmethodsQueryResponse.java | 201127dde6f48cdce33d7562ae0842f620ecbb05 | [
"Apache-2.0"
] | permissive | xiafaqi/alipay-sdk-java-all | 18dc797400847c7ae9901566e910527f5495e497 | 606cdb8014faa3e9125de7f50cbb81b2db6ee6cc | refs/heads/master | 2022-11-25T08:43:11.997961 | 2020-07-23T02:58:22 | 2020-07-23T02:58:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,245 | java | package com.alipay.api.response;
import com.alipay.api.internal.mapping.ApiField;
import com.alipay.api.domain.OpenApiResolutionMethod;
import com.alipay.api.domain.OpenApiResponseHeader;
import com.alipay.api.AlipayResponse;
/**
* ALIPAY API: alipay.user.applepay.otpresolutionmethods.query response.
*
* @author auto create
* @since 1.0, 2020-05-29 10:25:32
*/
public class AlipayUserApplepayOtpresolutionmethodsQueryResponse extends AlipayResponse {
private static final long serialVersionUID = 5552122263837433269L;
/**
* OpenApi的Otp校验方法负责对象
*/
@ApiField("resolution_methods")
private OpenApiResolutionMethod resolutionMethods;
/**
* 响应头
*/
@ApiField("response_header")
private OpenApiResponseHeader responseHeader;
public void setResolutionMethods(OpenApiResolutionMethod resolutionMethods) {
this.resolutionMethods = resolutionMethods;
}
public OpenApiResolutionMethod getResolutionMethods( ) {
return this.resolutionMethods;
}
public void setResponseHeader(OpenApiResponseHeader responseHeader) {
this.responseHeader = responseHeader;
}
public OpenApiResponseHeader getResponseHeader( ) {
return this.responseHeader;
}
}
| [
"ben.zy@antfin.com"
] | ben.zy@antfin.com |
cb0fb1aa38d8cfdb326e3c9673cc118c329cb605 | 71dac425176f1c661454c5b24d16c4330690a818 | /src/org/freemars/colony/manager/ColonyFertilizerRenderer.java | f41e77c0cc6b2130eeb3ebf05a8976cf95250fee | [] | no_license | masmangan/ducking-octo-boo | 5059ac99e5cfb07090af06ee98c670654f878e64 | 3fc846d771bb5c245dcc715f885ed80b23193d27 | refs/heads/master | 2020-12-24T16:34:10.314307 | 2016-05-12T01:06:53 | 2016-05-12T01:06:53 | 35,245,987 | 0 | 2 | null | 2016-05-12T01:06:53 | 2015-05-07T22:07:18 | Visual Basic | UTF-8 | Java | false | false | 1,795 | java | package org.freemars.colony.manager;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
import java.awt.Image;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTable;
import javax.swing.table.TableCellRenderer;
import org.freemars.ui.image.FreeMarsImageManager;
/**
*
* @author Deniz ARIKAN
*/
public class ColonyFertilizerRenderer extends JPanel implements TableCellRenderer {
public ColonyFertilizerRenderer() {
super(new BorderLayout());
}
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
removeAll();
int[] fertilizerValues = (int[]) value;
JLabel fertilizerLabel = new JLabel();
fertilizerLabel.setFont(table.getFont());
String fertilizerLabelText = String.valueOf(fertilizerValues[0]);
if (fertilizerValues[1] > 0) {
fertilizerLabelText = fertilizerValues[0] + "(-" + fertilizerValues[1] + ")";
}
fertilizerLabel.setText(fertilizerLabelText);
if (fertilizerValues[0] == 0) {
Image warningImage = FreeMarsImageManager.getInstance().getImage("ERROR");
fertilizerLabel.setIcon(new ImageIcon(warningImage));
} else if (fertilizerValues[0] > 0 && fertilizerValues[1] > 0 && fertilizerValues[0] / fertilizerValues[1] < 2) {
Image warningImage = FreeMarsImageManager.getInstance().getImage("WARNING");
fertilizerLabel.setIcon(new ImageIcon(warningImage));
}
add(fertilizerLabel, BorderLayout.CENTER);
if (isSelected) {
setBackground(new Color(212, 123, 123));
}
return this;
}
}
| [
"10067320@l181796.portoalegre.pucrsnet.br"
] | 10067320@l181796.portoalegre.pucrsnet.br |
00b45ff6766fddde087fc0f42d15bef1269bce61 | 1fdd9f8d783fdeadbeeee4c2e27718e6c2f673d9 | /day9/代码/days9/src/BGeneric/GInteface/service/impl/Uzi.java | fba80fdd4e4e3c760552992640c97ddb40c4eb88 | [] | no_license | ywz147258/mnuSE1802 | c4b8eb92cb7457f6d41b384168c8208711fc2841 | 1c2e406f2d9d901b1e7f87a999c41fa70f87b556 | refs/heads/main | 2023-08-24T05:06:43.922825 | 2021-10-19T01:43:54 | 2021-10-19T01:43:54 | 406,188,734 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 366 | java | package BGeneric.GInteface.service.impl;
import BGeneric.GInteface.service.Gun;
import BGeneric.GInteface.entity.NineMiBullet;
public class Uzi implements Gun<NineMiBullet> {
@Override
public void shoot(NineMiBullet nineMiBullet) {
System.out.println("uzi使用"+nineMiBullet.getName()+"进行设计,威力是"+nineMiBullet.getPower());
}
}
| [
"1094769835@qq.com"
] | 1094769835@qq.com |
91bd5a807cbb7a3bb65dd908dc29cab2354c8dad | 67c89388e84c4e28d1559ee6665304708e5bf0b2 | /messaging/netty/src/main/java/io/atomix/messaging/netty/MessageEncoder.java | 6873339553c1aa60910168cb20f75c012f8fdbcf | [
"Apache-2.0"
] | permissive | maniacs-ops/atomix | f66e4eca65466fdda7dee9aec08b3a1cb51724dc | c28f884754f26edfec3677849e864eb3311738e7 | refs/heads/master | 2021-01-02T08:55:42.350924 | 2017-07-28T23:48:05 | 2017-07-28T23:48:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,185 | java | /*
* Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.atomix.messaging.netty;
import com.google.common.base.Charsets;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import io.atomix.messaging.Endpoint;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;
import java.io.IOException;
import java.net.InetAddress;
/**
* Encode InternalMessage out into a byte buffer.
*/
@ChannelHandler.Sharable
public class MessageEncoder extends MessageToByteEncoder<Object> {
// Effectively MessageToByteEncoder<InternalMessage>,
// had to specify <Object> to avoid Class Loader not being able to find some classes.
private final Logger log = LoggerFactory.getLogger(getClass());
private final int preamble;
public MessageEncoder(int preamble) {
super();
this.preamble = preamble;
}
@Override
protected void encode(
ChannelHandlerContext context,
Object rawMessage,
ByteBuf out) throws Exception {
InternalMessage message = (InternalMessage) rawMessage;
out.writeInt(this.preamble);
// write message id
out.writeLong(message.id());
Endpoint sender = message.sender();
InetAddress senderIp = sender.host();
byte[] senderIpBytes = senderIp.getAddress();
out.writeByte(senderIpBytes.length);
out.writeBytes(senderIpBytes);
// write sender port
out.writeInt(sender.port());
byte[] messageTypeBytes = message.type().getBytes(Charsets.UTF_8);
// write length of message type
out.writeShort(messageTypeBytes.length);
// write message type bytes
out.writeBytes(messageTypeBytes);
// write message status value
InternalMessage.Status status = message.status();
if (status == null) {
out.writeByte(-1);
} else {
out.writeByte(status.id());
}
byte[] payload = message.payload();
// write payload length
out.writeInt(payload.length);
// write payload.
out.writeBytes(payload);
}
@Override
public void exceptionCaught(ChannelHandlerContext context, Throwable cause) {
if (cause instanceof IOException) {
log.debug("IOException inside channel handling pipeline.", cause);
} else {
log.error("non-IOException inside channel handling pipeline.", cause);
}
context.close();
}
// Effectively same result as one generated by MessageToByteEncoder<InternalMessage>
@Override
public final boolean acceptOutboundMessage(Object msg) throws Exception {
return msg instanceof InternalMessage;
}
}
| [
"jordan.halterman@gmail.com"
] | jordan.halterman@gmail.com |
5c7116e744648f3f957d52a415a87c0bb80e0e2a | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/30/30_fbdf1a70dd0b934355d535d544c9ebe136d2d6f5/PlasticClassPool/30_fbdf1a70dd0b934355d535d544c9ebe136d2d6f5_PlasticClassPool_t.java | c2eb75c480c113f94aad891227ca5b22ef7a4edf | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 25,033 | java | // Copyright 2011-2013 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package org.apache.tapestry5.internal.plastic;
import org.apache.tapestry5.internal.plastic.asm.ClassReader;
import org.apache.tapestry5.internal.plastic.asm.ClassWriter;
import org.apache.tapestry5.internal.plastic.asm.Opcodes;
import org.apache.tapestry5.internal.plastic.asm.tree.*;
import org.apache.tapestry5.plastic.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.annotation.Annotation;
import java.lang.reflect.Modifier;
import java.util.*;
import java.util.concurrent.CopyOnWriteArrayList;
/**
* Responsible for managing a class loader that allows ASM {@link ClassNode}s
* to be instantiated as runtime classes.
*/
@SuppressWarnings("rawtypes")
public class PlasticClassPool implements ClassLoaderDelegate, Opcodes, PlasticClassListenerHub
{
private static final Logger LOGGER = LoggerFactory.getLogger(PlasticClassPool.class);
final PlasticClassLoader loader;
private final PlasticManagerDelegate delegate;
private final Set<String> controlledPackages;
// Would use Deque, but that's added in 1.6 and we're still striving for 1.5 code compatibility.
private final Stack<String> activeInstrumentClassNames = new Stack<String>();
/**
* Maps class names to instantiators for that class name.
* Synchronized on the loader.
*/
private final Map<String, ClassInstantiator> instantiators = PlasticInternalUtils.newMap();
private final InheritanceData emptyInheritanceData = new InheritanceData();
private final StaticContext emptyStaticContext = new StaticContext();
private final List<PlasticClassListener> listeners = new CopyOnWriteArrayList<PlasticClassListener>();
private final Cache<String, TypeCategory> typeName2Category = new Cache<String, TypeCategory>()
{
protected TypeCategory convert(String typeName)
{
ClassNode cn = constructClassNodeFromBytecode(typeName);
return Modifier.isInterface(cn.access) ? TypeCategory.INTERFACE : TypeCategory.CLASS;
}
};
static class BaseClassDef
{
final InheritanceData inheritanceData;
final StaticContext staticContext;
public BaseClassDef(InheritanceData inheritanceData, StaticContext staticContext)
{
this.inheritanceData = inheritanceData;
this.staticContext = staticContext;
}
}
/**
* Map from FQCN to BaseClassDef. Synchronized on the loader.
*/
private final Map<String, BaseClassDef> baseClassDefs = PlasticInternalUtils.newMap();
private final Map<String, FieldInstrumentations> instrumentations = PlasticInternalUtils.newMap();
private final Map<String, String> transformedClassNameToImplementationClassName = PlasticInternalUtils.newMap();
private final FieldInstrumentations placeholder = new FieldInstrumentations(null);
private final Set<TransformationOption> options;
/**
* Creates the pool with a set of controlled packages; all classes in the controlled packages are loaded by the
* pool's class loader, and all top-level classes in the controlled packages are transformed via the delegate.
*
* @param parentLoader typically, the Thread's context class loader
* @param delegate responsible for end stages of transforming top-level classes
* @param controlledPackages set of package names (note: retained, not copied)
* @param options used when transforming classes
*/
public PlasticClassPool(ClassLoader parentLoader, PlasticManagerDelegate delegate, Set<String> controlledPackages,
Set<TransformationOption> options)
{
loader = new PlasticClassLoader(parentLoader, this);
this.delegate = delegate;
this.controlledPackages = controlledPackages;
this.options = options;
}
public ClassLoader getClassLoader()
{
return loader;
}
public Class realizeTransformedClass(ClassNode classNode, InheritanceData inheritanceData,
StaticContext staticContext)
{
synchronized (loader)
{
Class result = realize(PlasticInternalUtils.toClassName(classNode.name), ClassType.PRIMARY, classNode);
baseClassDefs.put(result.getName(), new BaseClassDef(inheritanceData, staticContext));
return result;
}
}
public Class realize(String primaryClassName, ClassType classType, ClassNode classNode)
{
synchronized (loader)
{
if (!listeners.isEmpty())
{
fire(toEvent(primaryClassName, classType, classNode));
}
byte[] bytecode = toBytecode(classNode);
String className = PlasticInternalUtils.toClassName(classNode.name);
return loader.defineClassWithBytecode(className, bytecode);
}
}
private PlasticClassEvent toEvent(final String primaryClassName, final ClassType classType,
final ClassNode classNode)
{
return new PlasticClassEvent()
{
public ClassType getType()
{
return classType;
}
public String getPrimaryClassName()
{
return primaryClassName;
}
public String getDissasembledBytecode()
{
return PlasticInternalUtils.dissasembleBytecode(classNode);
}
public String getClassName()
{
return PlasticInternalUtils.toClassName(classNode.name);
}
};
}
private void fire(PlasticClassEvent event)
{
for (PlasticClassListener listener : listeners)
{
listener.classWillLoad(event);
}
}
private byte[] toBytecode(ClassNode classNode)
{
ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
classNode.accept(writer);
return writer.toByteArray();
}
public AnnotationAccess createAnnotationAccess(String className)
{
try
{
final Class<?> searchClass = loader.loadClass(className);
return new AnnotationAccess()
{
public <T extends Annotation> boolean hasAnnotation(Class<T> annotationType)
{
return getAnnotation(annotationType) != null;
}
public <T extends Annotation> T getAnnotation(Class<T> annotationType)
{
return searchClass.getAnnotation(annotationType);
}
};
} catch (Exception ex)
{
throw new RuntimeException(ex);
}
}
public AnnotationAccess createAnnotationAccess(List<AnnotationNode> annotationNodes)
{
if (annotationNodes == null)
{
return EmptyAnnotationAccess.SINGLETON;
}
final Map<String, Object> cache = PlasticInternalUtils.newMap();
final Map<String, AnnotationNode> nameToNode = PlasticInternalUtils.newMap();
for (AnnotationNode node : annotationNodes)
{
nameToNode.put(PlasticInternalUtils.objectDescriptorToClassName(node.desc), node);
}
return new AnnotationAccess()
{
public <T extends Annotation> boolean hasAnnotation(Class<T> annotationType)
{
return nameToNode.containsKey(annotationType.getName());
}
public <T extends Annotation> T getAnnotation(Class<T> annotationType)
{
String className = annotationType.getName();
Object result = cache.get(className);
if (result == null)
{
result = buildAnnotation(className);
if (result != null)
cache.put(className, result);
}
return annotationType.cast(result);
}
private Object buildAnnotation(String className)
{
AnnotationNode node = nameToNode.get(className);
if (node == null)
return null;
return createAnnotation(className, node);
}
};
}
Class loadClass(String className)
{
try
{
return loader.loadClass(className);
} catch (Exception ex)
{
throw new RuntimeException(String.format("Unable to load class %s: %s", className,
PlasticInternalUtils.toMessage(ex)), ex);
}
}
protected Object createAnnotation(String className, AnnotationNode node)
{
AnnotationBuilder builder = new AnnotationBuilder(loadClass(className), this);
node.accept(builder);
return builder.createAnnotation();
}
public boolean shouldInterceptClassLoading(String className)
{
int searchFromIndex = className.length() - 1;
while (true)
{
int dotx = className.lastIndexOf('.', searchFromIndex);
if (dotx < 0)
break;
String packageName = className.substring(0, dotx);
if (controlledPackages.contains(packageName))
return true;
searchFromIndex = dotx - 1;
}
return false;
}
// Hopefully the synchronized will not cause a deadlock
public synchronized Class<?> loadAndTransformClass(String className) throws ClassNotFoundException
{
// Inner classes are not transformed, but they are loaded by the same class loader.
if (className.contains("$"))
{
return loadInnerClass(className);
}
// TODO: What about interfaces, enums, annotations, etc. ... they shouldn't be in the package, but
// we should generate a reasonable error message.
if (activeInstrumentClassNames.contains(className))
{
StringBuilder builder = new StringBuilder("");
String sep = "";
for (String name : activeInstrumentClassNames)
{
builder.append(sep);
builder.append(name);
sep = ", ";
}
throw new IllegalStateException(String.format("Unable to transform class %s as it is already in the process of being transformed; there is a cycle among the following classes: %s.",
className, builder));
}
activeInstrumentClassNames.push(className);
try
{
InternalPlasticClassTransformation transformation = getPlasticClassTransformation(className);
delegate.transform(transformation.getPlasticClass());
ClassInstantiator createInstantiator = transformation.createInstantiator();
ClassInstantiator configuredInstantiator = delegate.configureInstantiator(className, createInstantiator);
instantiators.put(className, configuredInstantiator);
return transformation.getTransformedClass();
} finally
{
activeInstrumentClassNames.pop();
}
}
private Class loadInnerClass(String className)
{
ClassNode classNode = constructClassNodeFromBytecode(className);
interceptFieldAccess(classNode);
return realize(className, ClassType.INNER, classNode);
}
private void interceptFieldAccess(ClassNode classNode)
{
for (MethodNode method : classNode.methods)
{
interceptFieldAccess(classNode.name, method);
}
}
private void interceptFieldAccess(String classInternalName, MethodNode method)
{
InsnList insns = method.instructions;
ListIterator it = insns.iterator();
while (it.hasNext())
{
AbstractInsnNode node = (AbstractInsnNode) it.next();
int opcode = node.getOpcode();
if (opcode != GETFIELD && opcode != PUTFIELD)
{
continue;
}
FieldInsnNode fnode = (FieldInsnNode) node;
String ownerInternalName = fnode.owner;
if (ownerInternalName.equals(classInternalName))
{
continue;
}
FieldInstrumentation instrumentation = getFieldInstrumentation(ownerInternalName, fnode.name, opcode == GETFIELD);
if (instrumentation == null)
{
continue;
}
// Replace the field access node with the appropriate method invocation.
insns.insertBefore(fnode, new MethodInsnNode(INVOKEVIRTUAL, ownerInternalName, instrumentation.methodName, instrumentation.methodDescription));
it.remove();
}
}
/**
* For a fully-qualified class name of an <em>existing</em> class, loads the bytes for the class
* and returns a PlasticClass instance.
*
* @throws ClassNotFoundException
*/
public InternalPlasticClassTransformation getPlasticClassTransformation(String className)
throws ClassNotFoundException
{
assert PlasticInternalUtils.isNonBlank(className);
ClassNode classNode = constructClassNodeFromBytecode(className);
String baseClassName = PlasticInternalUtils.toClassName(classNode.superName);
instrumentations.put(classNode.name, new FieldInstrumentations(classNode.superName));
// TODO: check whether second parameter should really be null
return createTransformation(baseClassName, classNode, null, false);
}
/**
* @param baseClassName class from which the transformed class extends
* @param classNode node for the class
* @param implementationClassNode node for the implementation class. May be null.
* @param proxy if true, the class is a new empty class; if false an existing class that's being transformed
* @throws ClassNotFoundException
*/
private InternalPlasticClassTransformation createTransformation(String baseClassName, ClassNode classNode, ClassNode implementationClassNode, boolean proxy)
throws ClassNotFoundException
{
if (shouldInterceptClassLoading(baseClassName))
{
loader.loadClass(baseClassName);
BaseClassDef def = baseClassDefs.get(baseClassName);
assert def != null;
return new PlasticClassImpl(classNode, implementationClassNode, this, def.inheritanceData, def.staticContext, proxy);
}
// When the base class is Object, or otherwise not in a transformed package,
// then start with the empty
return new PlasticClassImpl(classNode, implementationClassNode, this, emptyInheritanceData, emptyStaticContext, proxy);
}
/**
* Constructs a class node by reading the raw bytecode for a class and instantiating a ClassNode
* (via {@link ClassReader#accept(org.apache.tapestry5.internal.plastic.asm.ClassVisitor, int)}).
*
* @param className fully qualified class name
* @return corresponding ClassNode
*/
public ClassNode constructClassNodeFromBytecode(String className)
{
byte[] bytecode = readBytecode(className);
if (bytecode == null)
return null;
return PlasticInternalUtils.convertBytecodeToClassNode(bytecode);
}
private byte[] readBytecode(String className)
{
ClassLoader parentClassLoader = loader.getParent();
return PlasticInternalUtils.readBytecodeForClass(parentClassLoader, className, true);
}
public PlasticClassTransformation createTransformation(String baseClassName, String newClassName) {
return createTransformation(baseClassName, newClassName, null);
}
public PlasticClassTransformation createTransformation(String baseClassName, String newClassName, String implementationClassName)
{
try
{
ClassNode newClassNode = new ClassNode();
final String internalNewClassNameinternalName = PlasticInternalUtils.toInternalName(newClassName);
final String internalBaseClassName = PlasticInternalUtils.toInternalName(baseClassName);
newClassNode.visit(V1_5, ACC_PUBLIC, internalNewClassNameinternalName, null, internalBaseClassName, null);
ClassNode implementationClassNode = null;
if (implementationClassName != null)
{
// When decorating or advising a service, implementationClassName is the name
// of a proxy class already, such as "$ServiceName_[random string]",
// which doesn't exist as a file in the classpath, just in memory.
// So we need to keep what's the original implementation class name
// for each proxy, even a proxy around a proxy.
if (transformedClassNameToImplementationClassName.containsKey(implementationClassName))
{
implementationClassName =
transformedClassNameToImplementationClassName.get(implementationClassName);
}
if (!implementationClassName.startsWith("com.sun.proxy")) {
try {
implementationClassNode = readClassNode(implementationClassName);
}
catch (IOException e) {
LOGGER.warn(String.format("Unable to load class %s as the implementation of service %s",
implementationClassName, baseClassName));
// Go on. Probably a proxy class
}
}
transformedClassNameToImplementationClassName.put(newClassName, implementationClassName);
}
return createTransformation(baseClassName, newClassNode, implementationClassNode, true);
} catch (ClassNotFoundException ex)
{
throw new RuntimeException(String.format("Unable to create class %s as sub-class of %s: %s", newClassName,
baseClassName, PlasticInternalUtils.toMessage(ex)), ex);
}
}
private ClassNode readClassNode(String className) throws IOException
{
return readClassNode(className, getClassLoader());
}
static ClassNode readClassNode(String className, ClassLoader classLoader) throws IOException
{
ClassNode classNode = new ClassNode();
final String location = PlasticInternalUtils.toInternalName(className) + ".class";
InputStream inputStream = classLoader.getResourceAsStream(location);
BufferedInputStream bis = new BufferedInputStream(inputStream);
ClassReader classReader = new ClassReader(inputStream);
inputStream.close();
bis.close();
classReader.accept(classNode, 0);
return classNode;
}
public ClassInstantiator getClassInstantiator(String className)
{
synchronized (loader)
{
if (!instantiators.containsKey(className))
{
try
{
loader.loadClass(className);
} catch (ClassNotFoundException ex)
{
throw new RuntimeException(ex);
}
}
ClassInstantiator result = instantiators.get(className);
if (result == null)
{
// TODO: Verify that the problem is incorrect package, and not any other failure.
StringBuilder b = new StringBuilder();
b.append("Class '")
.append(className)
.append("' is not a transformed class. Transformed classes should be in one of the following packages: ");
String sep = "";
List<String> names = new ArrayList<String>(controlledPackages);
Collections.sort(names);
for (String name : names)
{
b.append(sep);
b.append(name);
sep = ", ";
}
String message = b.append(".").toString();
throw new IllegalArgumentException(message);
}
return result;
}
}
TypeCategory getTypeCategory(String typeName)
{
synchronized (loader)
{
// TODO: Is this the right place to cache this data?
return typeName2Category.get(typeName);
}
}
public void addPlasticClassListener(PlasticClassListener listener)
{
assert listener != null;
listeners.add(listener);
}
public void removePlasticClassListener(PlasticClassListener listener)
{
assert listener != null;
listeners.remove(listener);
}
boolean isEnabled(TransformationOption option)
{
return options.contains(option);
}
void setFieldReadInstrumentation(String classInternalName, String fieldName, FieldInstrumentation fi)
{
instrumentations.get(classInternalName).read.put(fieldName, fi);
}
private FieldInstrumentations getFieldInstrumentations(String classInternalName)
{
FieldInstrumentations result = instrumentations.get(classInternalName);
if (result != null)
{
return result;
}
String className = PlasticInternalUtils.toClassName(classInternalName);
// If it is a top-level (not inner) class in a controlled package, then we
// will recursively load the class, to identify any field instrumentations
// in it.
if (!className.contains("$") && shouldInterceptClassLoading(className))
{
try
{
loadAndTransformClass(className);
// The key is written into the instrumentations map as a side-effect
// of loading the class.
return instrumentations.get(classInternalName);
} catch (Exception ex)
{
throw new RuntimeException(PlasticInternalUtils.toMessage(ex), ex);
}
}
// Either a class outside of controlled packages, or an inner class. Use a placeholder
// that contains empty maps.
result = placeholder;
instrumentations.put(classInternalName, result);
return result;
}
FieldInstrumentation getFieldInstrumentation(String ownerClassInternalName, String fieldName, boolean forRead)
{
String currentName = ownerClassInternalName;
while (true)
{
if (currentName == null)
{
return null;
}
FieldInstrumentations instrumentations = getFieldInstrumentations(currentName);
FieldInstrumentation instrumentation = instrumentations.get(fieldName, forRead);
if (instrumentation != null)
{
return instrumentation;
}
currentName = instrumentations.superClassInternalName;
}
}
void setFieldWriteInstrumentation(String classInternalName, String fieldName, FieldInstrumentation fi)
{
instrumentations.get(classInternalName).write.put(fieldName, fi);
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
231cd46bcaf3c90cf96213829346dc2336693a4a | 3478884fc5d7eda7b38937ee528a472c5cc47f7a | /zebra-engine/src/main/java/com/hongru/spider/impl/CrawlerLauncher.java | 86ae234b96f5c37ac9ac7dabe7c791bd0e8dd6af | [] | no_license | chenhy8208/zebra-searcher | 396a5cf6b3903c1ddb23bc36a8628f5c01fc12f8 | 4f6a71e924765a3c76f66e980d7d69621901b60f | refs/heads/master | 2020-05-26T17:10:03.862141 | 2017-03-15T01:32:38 | 2017-03-15T01:32:38 | 85,015,079 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,752 | java | package com.hongru.spider.impl;
import com.hongru.common.lucene.conf.ConfigManager;
import com.hongru.config.AppConfig;
import com.hongru.spider.SpiderLauncher;
import edu.uci.ics.crawler4j.crawler.CrawlConfig;
import edu.uci.ics.crawler4j.crawler.CrawlController;
import edu.uci.ics.crawler4j.crawler.WebCrawler;
import edu.uci.ics.crawler4j.fetcher.PageFetcher;
import edu.uci.ics.crawler4j.robotstxt.RobotstxtConfig;
import edu.uci.ics.crawler4j.robotstxt.RobotstxtServer;
import static com.hongru.config.AppConfig.maxDepthOfCrawling;
/**
* Created by chenhongyu on 16/9/28.
*/
public class CrawlerLauncher implements SpiderLauncher {
@Override
public void spiderLaunch() {
CrawlConfig config = new CrawlConfig();
config.setResumableCrawling(true); //可恢复
config.setUserAgentString(userAgent);
config.setCrawlStorageFolder(AppConfig.crawlStorageFolder);
config.setMaxDepthOfCrawling(maxDepthOfCrawling);
config.setPolitenessDelay(AppConfig.politenessDelay);
/*
* Instantiate the controller for this crawl.
*/
PageFetcher pageFetcher = new PageFetcher(config);
RobotstxtConfig robotstxtConfig = new RobotstxtConfig();
RobotstxtServer robotstxtServer = new RobotstxtServer(robotstxtConfig, pageFetcher);
try {
controller = new CrawlController(config, pageFetcher, robotstxtServer);
} catch (Exception e) {
//构造出错,程序停止
throw new RuntimeException(e);
}
/*
* For each crawl, you need to add some seed urls. These are the first
* URLs that are fetched and then the crawler starts following links
* which are found in these pages
*/
for (String url :
AppConfig.seeds) {
controller.addSeed(url);
}
/*
* Start the crawl. This is a blocking operation, meaning that your code
* will reach the line after this only when crawling is finished.
*/
controller.startNonBlocking(this.crawlerClass, AppConfig.numberOfCrawlers);
}
@Override
public void shutdown() {
controller.shutdown();
controller.waitUntilFinish();
ConfigManager.closeIndexWriter();
}
public CrawlerLauncher(Class<? extends WebCrawler> crawlerClass) {
this.crawlerClass = crawlerClass;
}
private CrawlerLauncher(){}
//模拟User-Agent
private static final String userAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36";
private CrawlController controller;
private Class<? extends WebCrawler> crawlerClass;
}
| [
"37799400@qq.com"
] | 37799400@qq.com |
00639d2a92c96f8c7b0bb9f4d22e3e83126d2ab6 | 647ec12ce50f06e7380fdbfb5b71e9e2d1ac03b4 | /com.tencent.minihd.qq/assets/exlibs.1.jar/classes.jar/tencent/im/s2c/msgtype0x211/submsgtype0x8/C2CType0x211_SubC2CType0x8$UpdateInfo.java | 5a8911989b473761aa19a758c490b2fd6073c36b | [] | no_license | tsuzcx/qq_apk | 0d5e792c3c7351ab781957bac465c55c505caf61 | afe46ef5640d0ba6850cdefd3c11badbd725a3f6 | refs/heads/main | 2022-07-02T10:32:11.651957 | 2022-02-01T12:41:38 | 2022-02-01T12:41:38 | 453,860,108 | 36 | 9 | null | 2022-01-31T09:46:26 | 2022-01-31T02:43:22 | Java | UTF-8 | Java | false | false | 1,051 | java | package tencent.im.s2c.msgtype0x211.submsgtype0x8;
import com.tencent.mobileqq.pb.MessageMicro;
import com.tencent.mobileqq.pb.MessageMicro.FieldMap;
import com.tencent.mobileqq.pb.PBEnumField;
import com.tencent.mobileqq.pb.PBField;
public final class C2CType0x211_SubC2CType0x8$UpdateInfo
extends MessageMicro
{
public static final int MSG_USER_FIELD_NUMBER = 2;
public static final int TYPE_FIELD_NUMBER = 1;
static final MessageMicro.FieldMap __fieldMap__ = MessageMicro.initFieldMap(new int[] { 8, 18 }, new String[] { "type", "msg_user" }, new Object[] { Integer.valueOf(1), null }, UpdateInfo.class);
public C2CType0x211_SubC2CType0x8.UserProfile msg_user = new C2CType0x211_SubC2CType0x8.UserProfile();
public final PBEnumField type = PBField.initEnum(1);
}
/* Location: L:\local\mybackup\temp\qq_apk\com.tencent.minihd.qq\assets\exlibs.1.jar\classes.jar
* Qualified Name: tencent.im.s2c.msgtype0x211.submsgtype0x8.C2CType0x211_SubC2CType0x8.UpdateInfo
* JD-Core Version: 0.7.0.1
*/ | [
"98632993+tsuzcx@users.noreply.github.com"
] | 98632993+tsuzcx@users.noreply.github.com |
22a8797b019b46e79b3c8ec97af7589af22dbd41 | b2f9eebdf9c6d4df7baa57c4084f9620995ab19e | /core/src/main/java/rocks/astroid/astroid/core/Movable.java | f3d43fe2b405450f9370367c68802d39aaac697f | [] | no_license | skipperguy12/astroid.rocks | bfbf772969593fb87ce8585c7d77b6ee74bd960e | b9a96354961cc812047f7bb2a354bdd6e5542c81 | refs/heads/master | 2021-06-01T01:38:12.147704 | 2016-06-27T04:27:34 | 2016-06-27T04:27:34 | 61,580,861 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 292 | java | package rocks.astroid.astroid.core;
import com.badlogic.gdx.math.Vector3;
/**
* Has speed and can be moved
*/
public interface Movable {
public float getSpeed();
public void setSpeed(float speed);
public Vector3 getLocation();
public void setLocation(Vector3 location);
}
| [
"dnlisrl@gmail.com"
] | dnlisrl@gmail.com |
96ad24975cf2b3b7066c7b8509c9099ed718b00e | f0af840b868f529353ac233ab203b543098ead66 | /src/main/java/com/bolsadeideas/springboot/reactor/app/SpringBootReactorApplication.java | 04c4a9d20b20bd0015e849007158fd9772da1987 | [] | no_license | oelsacte/springboot-reactor | 4b0221b06bca5a66994f9020b6531161f3a9236b | 746467ceb269e7e4f7cccbe82a9b21491cc65d8c | refs/heads/master | 2020-08-29T08:09:53.457247 | 2019-10-28T06:16:39 | 2019-10-28T06:16:39 | 217,977,678 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,757 | java | package com.bolsadeideas.springboot.reactor.app;
import javax.management.RuntimeErrorException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import com.bolsadeideas.springboot.reactor.app.models.Usuario;
import reactor.core.publisher.Flux;
@SpringBootApplication
public class SpringBootReactorApplication implements CommandLineRunner {
private static final Logger log = LoggerFactory.getLogger(SpringBootReactorApplication.class);
public static void main(String[] args) {
SpringApplication.run(SpringBootReactorApplication.class, args);
}
@Override
public void run(String... args) throws Exception {
Flux<String> nombres = Flux.just("Andres Guzman", "Pedro Fulano", "María Fulana", "Diego Sultano",
"Juan Mengano", "Bruce Lee", "Bruce Willis");
Flux<Usuario> usuarios = nombres.map(nombre -> new Usuario(nombre.split(" ")[0].toUpperCase(), nombre.split(" ")[1].toUpperCase()))
.filter(usuario -> usuario.getNombre().equalsIgnoreCase("bruce")).doOnNext(usuario -> {
if (usuario == null) {
throw new RuntimeException("Nombres no pueden ser vacíos");
}
System.out.println(usuario.getNombre().concat(" ").concat(usuario.getApellido()));
}).map(usuario -> {
String nombre = usuario.getNombre().toLowerCase();
usuario.setNombre(nombre);
return usuario;
});
usuarios.subscribe(usuario -> log.info(usuario.toString()), error -> log.error(error.getMessage()),
new Runnable() {
@Override
public void run() {
log.info("Ha terminado la ejecución del observable");
}
});
}
}
| [
"oelsacte@gmail.com"
] | oelsacte@gmail.com |
1b5edd4f86b436c9ffb0523c47fec2235df3f638 | 13c948b38ae50abcac9a45687b05b176f7df9872 | /oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/core/ClaimAccessor.java | 4e68579f4f7e0b2c055118932f176ac933a3fba3 | [
"Apache-2.0"
] | permissive | bghgu/spring-security | 19317a19c203aef8d6b15ff32b641db4ba57f523 | 54547f35b7bb2a35657dfd2713cbdd6543bc9597 | refs/heads/master | 2021-05-15T12:53:21.760748 | 2017-10-26T16:19:57 | 2017-10-26T16:22:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,910 | java | /*
* Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.security.oauth2.core;
import org.springframework.util.Assert;
import java.net.MalformedURLException;
import java.net.URL;
import java.time.Instant;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* An "accessor" for a set of claims that may be used for assertions.
*
* @author Joe Grandja
* @since 5.0
*/
public interface ClaimAccessor {
Map<String, Object> getClaims();
default Boolean containsClaim(String claim) {
Assert.notNull(claim, "claim cannot be null");
return this.getClaims().containsKey(claim);
}
default String getClaimAsString(String claim) {
return (this.containsClaim(claim) ? this.getClaims().get(claim).toString() : null);
}
default Boolean getClaimAsBoolean(String claim) {
return (this.containsClaim(claim) ? Boolean.valueOf(this.getClaimAsString(claim)) : null);
}
default Instant getClaimAsInstant(String claim) {
if (!this.containsClaim(claim)) {
return null;
}
try {
return Instant.ofEpochSecond(Long.valueOf(this.getClaimAsString(claim)));
} catch (NumberFormatException ex) {
throw new IllegalArgumentException("Unable to convert claim '" + claim + "' to Instant: " + ex.getMessage(), ex);
}
}
default URL getClaimAsURL(String claim) {
if (!this.containsClaim(claim)) {
return null;
}
try {
return new URL(this.getClaimAsString(claim));
} catch (MalformedURLException ex) {
throw new IllegalArgumentException("Unable to convert claim '" + claim + "' to URL: " + ex.getMessage(), ex);
}
}
default Map<String, Object> getClaimAsMap(String claim) {
if (!this.containsClaim(claim) || !Map.class.isAssignableFrom(this.getClaims().get(claim).getClass())) {
return null;
}
Map<String, Object> claimValues = new HashMap<>();
((Map<?, ?>)this.getClaims().get(claim)).forEach((k, v) -> claimValues.put(k.toString(), v));
return claimValues;
}
default List<String> getClaimAsStringList(String claim) {
if (!this.containsClaim(claim) || !List.class.isAssignableFrom(this.getClaims().get(claim).getClass())) {
return null;
}
List<String> claimValues = new ArrayList<>();
((List<?>)this.getClaims().get(claim)).forEach(e -> claimValues.add(e.toString()));
return claimValues;
}
}
| [
"jgrandja@pivotal.io"
] | jgrandja@pivotal.io |
648f0c1abfdae128a4f2aeb171f7951d732e333a | 264ca7893309005d3e6b74118541beaa45de73bd | /Java8Reduces/src/Ex1/ListaNum.java | 26c61b5ee2e253c10b839f70c26ca5bf0e87a9df | [] | no_license | GuilhermeSantosJS/Java8Exercises | 6e480d5c1f75ec9a34ba2e8ad1259e77d8f82981 | 918ad3c5546a470974e2e4b10a2b34651f29e9dd | refs/heads/master | 2023-03-14T05:33:18.514638 | 2021-03-14T21:34:25 | 2021-03-14T21:34:25 | 335,525,036 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,345 | java | package Ex1;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
public class ListaNum {
public void ListaSomaNumeros() {
for (int i = 0; i < 100; i++) {
int numAleatorio = (int)(Math.random() * 100 ) + 1;
List<Integer> lista = Arrays.asList(numAleatorio);
Integer reduce = lista.stream()
.reduce(numAleatorio, (a, b) -> numAleatorio + numAleatorio);
System.out.println(reduce);
}
}
public void ListaMultiplicaNumeros() {
for (int i = 0; i < 100; i++) {
int numAleatorio = (int)(Math.random() * 100 ) + 1;
List<Integer> lista = Arrays.asList(numAleatorio);
Integer reduce = lista.stream()
.reduce(numAleatorio, (a, b) -> numAleatorio * numAleatorio);
System.out.println(reduce);
}
}
public void ListaMenorNumero() {
int menor = Integer.MAX_VALUE;
int indiceMenor = -1;
int fim = 100;
for (int i = 0; i < fim; i++) {
int numAleatorio = (int)(Math.random() * fim ) + 1;
List<Integer> lista = Arrays.asList(numAleatorio);
if(fim < menor) {
Integer reduce = lista.stream()
.reduce(indiceMenor, (a, b) -> numAleatorio + numAleatorio) ;
menor = fim;
indiceMenor = i;
System.out.println("Lista: " + reduce);
}
}
}
public void ListaMaiorNumero() {
int maior = Integer.MIN_VALUE;
int indiceMaior = -1;
int fim = 100;
for (int i = 0; i < fim; i++) {
int numAleatorio = (int)(Math.random() * fim ) + 1;
List<Integer> lista = Arrays.asList(numAleatorio);
if (fim > maior) {
Integer reduce = lista.stream()
.reduce(indiceMaior, (a, b) -> numAleatorio + numAleatorio);
maior = fim;
indiceMaior = i;
System.out.println("Lista: " + reduce);
}
}
}
}
| [
"santos.g@aluno.ifsp.edu.br"
] | santos.g@aluno.ifsp.edu.br |
94a49561ee3298dc602d61488f728c3d0a5c9fd1 | 53d677a55e4ece8883526738f1c9d00fa6560ff7 | /com/tencent/mm/y/c.java | 39ded1435ee3c6012e839cc7d83e788a6491e6aa | [] | no_license | 0jinxing/wechat-apk-source | 544c2d79bfc10261eb36389c1edfdf553d8f312a | f75eefd87e9b9ecf2f76fc6d48dbba8e24afcf3d | refs/heads/master | 2020-06-07T20:06:03.580028 | 2019-06-21T09:17:26 | 2019-06-21T09:17:26 | 193,069,132 | 9 | 4 | null | null | null | null | UTF-8 | Java | false | false | 11,238 | java | package com.tencent.mm.y;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.PaintFlagsDrawFilter;
import android.graphics.PointF;
import android.graphics.Rect;
import android.graphics.drawable.NinePatchDrawable;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.api.k;
import com.tencent.mm.sdk.platformtools.ab;
import com.tencent.mm.sdk.platformtools.d;
import java.util.ArrayList;
import java.util.List;
public class c
implements Cloneable
{
private Rect eHc;
public String eHf;
public k eHg;
public Bitmap eHh;
public PointF eHi;
private float eHj;
public PointF eHk;
private float eHl;
private float eHm;
public boolean eHn;
List<PointF> eHo;
private float eHp;
private float eHq;
public boolean ejw;
protected Context mContext;
private Matrix mMatrix;
public int mRotation;
public float mScale;
public c(Context paramContext, Matrix paramMatrix, String paramString, Rect paramRect)
{
AppMethodBeat.i(116275);
this.mRotation = 0;
this.mScale = 1.0F;
this.eHj = 1.0F;
this.eHn = false;
this.eHo = new ArrayList();
this.eHf = paramString;
this.mMatrix = paramMatrix;
this.mContext = paramContext;
this.eHc = paramRect;
this.eHi = new PointF();
this.eHk = new PointF();
AppMethodBeat.o(116275);
}
public c(Context paramContext, Matrix paramMatrix, String paramString, k paramk, Rect paramRect)
{
AppMethodBeat.i(116274);
this.mRotation = 0;
this.mScale = 1.0F;
this.eHj = 1.0F;
this.eHn = false;
this.eHo = new ArrayList();
this.eHf = paramString;
this.mMatrix = paramMatrix;
this.eHg = paramk;
this.mContext = paramContext;
this.eHc = paramRect;
this.eHi = new PointF();
this.eHk = new PointF();
AppMethodBeat.o(116274);
}
private int Qd()
{
AppMethodBeat.i(116282);
int i;
if (this.eHh != null)
{
i = this.eHh.getWidth();
AppMethodBeat.o(116282);
}
while (true)
{
return i;
i = 0;
AppMethodBeat.o(116282);
}
}
private int Qe()
{
AppMethodBeat.i(116283);
int i;
if (this.eHh != null)
{
i = this.eHh.getHeight();
AppMethodBeat.o(116283);
}
while (true)
{
return i;
i = 0;
AppMethodBeat.o(116283);
}
}
private PointF ac(float paramFloat)
{
AppMethodBeat.i(116287);
float f = this.mScale / this.eHj / 2.0F;
double d1 = Qd() * 1.0F / 2.0F * f;
double d2 = f * (Qe() * 1.0F / 2.0F);
this.eHq = ((float)Math.sqrt(d2 * d2 + d1 * d1));
PointF localPointF = new PointF();
d1 = (this.mRotation + paramFloat) * 3.141592653589793D / 180.0D;
localPointF.x = (this.eHi.x + (float)(this.eHq * Math.cos(d1)));
paramFloat = this.eHi.y;
d2 = this.eHq;
localPointF.y = (paramFloat + (float)(Math.sin(d1) * d2));
AppMethodBeat.o(116287);
return localPointF;
}
private Bitmap q(Bitmap paramBitmap)
{
AppMethodBeat.i(116285);
int i = (int)(paramBitmap.getWidth() + 80.0F);
int j = (int)(paramBitmap.getHeight() + 80.0F);
Bitmap localBitmap = Bitmap.createBitmap(i, j, Bitmap.Config.ARGB_8888);
Canvas localCanvas = new Canvas(localBitmap);
localCanvas.drawBitmap(paramBitmap, 40.0F, 40.0F, null);
paramBitmap = BitmapFactory.decodeResource(this.mContext.getResources(), 2130838546).getNinePatchChunk();
paramBitmap = new NinePatchDrawable(this.mContext.getResources(), BitmapFactory.decodeResource(this.mContext.getResources(), 2130838546), paramBitmap, new Rect(), null);
paramBitmap.setBounds(0, 0, i, j);
paramBitmap.draw(localCanvas);
AppMethodBeat.o(116285);
return localBitmap;
}
public final boolean D(float paramFloat1, float paramFloat2)
{
AppMethodBeat.i(116278);
this.eHo.clear();
this.eHo.add(ac(this.eHp - 180.0F));
this.eHo.add(ac(-this.eHp));
this.eHo.add(ac(this.eHp));
this.eHo.add(ac(-this.eHp + 180.0F));
c.a locala = new c.a(this, this.eHo);
int i = locala.eHt - 1;
int j = 0;
boolean bool1 = false;
if (j < locala.eHt)
{
if ((locala.eHs[j] >= paramFloat2) || (locala.eHs[i] < paramFloat2))
{
bool2 = bool1;
if (locala.eHs[i] < paramFloat2)
{
bool2 = bool1;
if (locala.eHs[j] < paramFloat2);
}
}
else
{
float f1 = locala.eHr[j];
float f2 = (paramFloat2 - locala.eHs[j]) / (locala.eHs[i] - locala.eHs[j]);
bool2 = bool1;
if ((locala.eHr[i] - locala.eHr[j]) * f2 + f1 < paramFloat1)
if (bool1)
break label274;
}
label274: for (boolean bool2 = true; ; bool2 = false)
{
i = j;
j++;
bool1 = bool2;
break;
}
}
AppMethodBeat.o(116278);
return bool1;
}
public final boolean Qc()
{
AppMethodBeat.i(116277);
ab.d("MicroMsg.EmojiItem", "[checkBitmap]");
boolean bool;
if ((this.eHh == null) || (this.eHh.isRecycled()))
{
this.eHh = q(Qf());
bool = true;
AppMethodBeat.o(116277);
}
while (true)
{
return bool;
bool = false;
AppMethodBeat.o(116277);
}
}
protected Bitmap Qf()
{
AppMethodBeat.i(116284);
if ((this.eHh == null) || (this.eHh.isRecycled()))
this.eHh = this.eHg.w(this.mContext, 480);
if (this.eHh == null)
{
ab.e("MicroMsg.EmojiItem", "[getEmojiBitmap] NULL!");
new d();
this.eHh = d.createBitmap(120, 120, Bitmap.Config.ARGB_4444);
new Canvas(this.eHh).drawColor(-7829368);
}
Bitmap localBitmap = this.eHh;
AppMethodBeat.o(116284);
return localBitmap;
}
public final void Qg()
{
AppMethodBeat.i(116286);
float f = this.eHj;
double d1 = Qd() * 1.0F / 2.0F * f;
double d2 = f * (Qe() * 1.0F / 2.0F);
this.eHq = ((float)Math.sqrt(d1 * d1 + d2 * d2));
this.eHp = ((float)Math.toDegrees(Math.atan(d2 / d1)));
AppMethodBeat.o(116286);
}
// ERROR //
public final c Qh()
{
// Byte code:
// 0: ldc_w 277
// 3: invokestatic 50 com/tencent/matrix/trace/core/AppMethodBeat:i (I)V
// 6: aload_0
// 7: invokespecial 281 java/lang/Object:clone ()Ljava/lang/Object;
// 10: checkcast 2 com/tencent/mm/y/c
// 13: astore_1
// 14: new 73 android/graphics/PointF
// 17: astore_2
// 18: aload_2
// 19: aload_0
// 20: getfield 76 com/tencent/mm/y/c:eHi Landroid/graphics/PointF;
// 23: getfield 123 android/graphics/PointF:x F
// 26: aload_0
// 27: getfield 76 com/tencent/mm/y/c:eHi Landroid/graphics/PointF;
// 30: getfield 129 android/graphics/PointF:y F
// 33: invokespecial 284 android/graphics/PointF:<init> (FF)V
// 36: aload_1
// 37: aload_2
// 38: putfield 76 com/tencent/mm/y/c:eHi Landroid/graphics/PointF;
// 41: aload_1
// 42: aload_0
// 43: getfield 86 com/tencent/mm/y/c:eHg Lcom/tencent/mm/api/k;
// 46: putfield 86 com/tencent/mm/y/c:eHg Lcom/tencent/mm/api/k;
// 49: ldc_w 277
// 52: invokestatic 81 com/tencent/matrix/trace/core/AppMethodBeat:o (I)V
// 55: aload_1
// 56: areturn
// 57: astore_2
// 58: aconst_null
// 59: astore_1
// 60: ldc 224
// 62: aload_2
// 63: ldc_w 286
// 66: iconst_0
// 67: anewarray 4 java/lang/Object
// 70: invokestatic 290 com/tencent/mm/sdk/platformtools/ab:printErrStackTrace (Ljava/lang/String;Ljava/lang/Throwable;Ljava/lang/String;[Ljava/lang/Object;)V
// 73: goto -24 -> 49
// 76: astore_2
// 77: goto -17 -> 60
//
// Exception table:
// from to target type
// 6 14 57 java/lang/CloneNotSupportedException
// 14 49 76 java/lang/CloneNotSupportedException
}
public final void a(float paramFloat1, float paramFloat2, float paramFloat3, int paramInt)
{
AppMethodBeat.i(116276);
this.eHh = q(Qf());
this.eHl = (1.2F * this.eHc.width() / this.eHh.getWidth());
this.eHm = (0.1F * this.eHc.width() / this.eHh.getWidth());
this.eHj = paramFloat3;
this.mRotation = paramInt;
this.mScale *= paramFloat3;
ab.i("MicroMsg.EmojiItem", "MAX_SCALE:%s MIN_SCALE:%s mInitScale:%s", new Object[] { Float.valueOf(this.eHl), Float.valueOf(this.eHm), Float.valueOf(this.eHj) });
this.eHi.set(paramFloat1, paramFloat2);
ab.d("MicroMsg.EmojiItem", "[setPoint] point:%s", new Object[] { this.eHi });
Qg();
AppMethodBeat.o(116276);
}
public final void b(float paramFloat1, float paramFloat2, float paramFloat3, int paramInt)
{
AppMethodBeat.i(116279);
this.eHi.offset(paramFloat1, paramFloat2);
if (0.0F != paramFloat3)
this.mScale = paramFloat3;
this.mRotation = paramInt;
AppMethodBeat.o(116279);
}
public final void clear()
{
AppMethodBeat.i(116280);
ab.i("MicroMsg.EmojiItem", "[clear]");
if ((this.eHh != null) && (!this.eHh.isRecycled()))
{
ab.i("MicroMsg.EmojiItem", "bitmap recycle %s", new Object[] { this.eHh.toString() });
this.eHh.recycle();
this.eHh = null;
}
AppMethodBeat.o(116280);
}
public final void draw(Canvas paramCanvas)
{
AppMethodBeat.i(116281);
if ((this.eHh == null) || (this.eHh.isRecycled()))
{
ab.w("MicroMsg.EmojiItem", "[draw] null == bitmap || bitmap isRecycled");
AppMethodBeat.o(116281);
return;
}
paramCanvas.setDrawFilter(new PaintFlagsDrawFilter(0, 3));
if (this.eHl < this.mScale * this.eHj)
{
this.mScale = (this.eHl / this.eHj);
label81: paramCanvas.save();
paramCanvas.translate(this.eHi.x, this.eHi.y);
paramCanvas.rotate(this.mRotation);
paramCanvas.scale(this.mScale, this.mScale);
if (!this.ejw)
break label208;
paramCanvas.drawBitmap(this.eHh, -Qd() / 2, -Qe() / 2, null);
}
while (true)
{
paramCanvas.restore();
paramCanvas.setDrawFilter(null);
AppMethodBeat.o(116281);
break;
if (this.eHm <= this.mScale * this.eHj)
break label81;
this.mScale = (this.eHm / this.eHj);
break label81;
label208: paramCanvas.clipRect(-Qd() / 2 + 40.0F, -Qe() / 2 + 40.0F, this.eHh.getWidth() / 2 - 40.0F, this.eHh.getHeight() / 2 - 40.0F);
paramCanvas.drawBitmap(this.eHh, -Qd() / 2, -Qe() / 2, null);
}
}
public void setSelected(boolean paramBoolean)
{
this.ejw = paramBoolean;
}
}
/* Location: C:\Users\Lin\Downloads\dex-tools-2.1-SNAPSHOT\dex-tools-2.1-SNAPSHOT\classes5-dex2jar.jar
* Qualified Name: com.tencent.mm.y.c
* JD-Core Version: 0.6.2
*/ | [
"172601673@qq.com"
] | 172601673@qq.com |
7f3c9145257e4c3be269a34427534102c801316e | 81cfa4100ac99a1453a92e10417edc19dc84b0dd | /src/test/java/com/thoughtworks/martdhis2sync/responseHandler/EventResponseHandlerTest.java | 5d3d7f7caef6d8dcfa4a6faad67e9af7a038f8f0 | [] | no_license | psi-zimb/mart-dhis2-sync | 3c0d1339fa78228c5066a2fd7ac1ce2418c75829 | 6ff45dc02d3b14739256447fad216e8340200a2c | refs/heads/master | 2021-06-01T15:46:28.834236 | 2020-01-24T07:00:49 | 2020-01-24T07:00:49 | 145,549,357 | 0 | 0 | null | 2020-01-24T07:00:50 | 2018-08-21T10:37:27 | Java | UTF-8 | Java | false | false | 32,847 | java | package com.thoughtworks.martdhis2sync.responseHandler;
import com.thoughtworks.martdhis2sync.model.Conflict;
import com.thoughtworks.martdhis2sync.model.EnrollmentAPIPayLoad;
import com.thoughtworks.martdhis2sync.model.EnrollmentImportSummary;
import com.thoughtworks.martdhis2sync.model.Event;
import com.thoughtworks.martdhis2sync.model.EventTracker;
import com.thoughtworks.martdhis2sync.model.ImportCount;
import com.thoughtworks.martdhis2sync.model.ImportSummary;
import com.thoughtworks.martdhis2sync.model.Response;
import com.thoughtworks.martdhis2sync.service.LoggerService;
import com.thoughtworks.martdhis2sync.util.EventUtil;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.powermock.modules.junit4.PowerMockRunner;
import org.slf4j.Logger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import static com.thoughtworks.martdhis2sync.CommonTestHelper.setValuesForMemberFields;
import static com.thoughtworks.martdhis2sync.model.ImportSummary.IMPORT_SUMMARY_RESPONSE_ERROR;
import static com.thoughtworks.martdhis2sync.model.ImportSummary.IMPORT_SUMMARY_RESPONSE_SUCCESS;
import static com.thoughtworks.martdhis2sync.model.ImportSummary.IMPORT_SUMMARY_RESPONSE_WARNING;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
@RunWith(PowerMockRunner.class)
public class EventResponseHandlerTest {
@Mock
private LoggerService loggerService;
@Mock
private Logger logger;
private String prefix = "New Completed Evens:";
private EventResponseHandler responseHandler;
private EnrollmentAPIPayLoad payLoad1;
private EnrollmentAPIPayLoad payLoad2;
private EnrollmentAPIPayLoad payLoad3;
private Event event1;
private Event event2;
private Event event3;
private String enrReference1 = "enrReference1";
private String enrReference2 = "enrReference2";
private String enrReference3 = "enrReference3";
private String envReference1 = "envReference1";
private String envReference2 = "envReference2";
private String envReference3 = "envReference3";
private String instanceId1 = "instance1";
private String instanceId2 = "instance2";
private String instanceId3 = "instance3";
private String enrDate = "2018-10-13";
private String eventDate = "2018-10-14";
private Map<String, String> dataValues1 = new HashMap<>();
private Map<String, String> dataValues2 = new HashMap<>();
private Map<String, String> dataValues3 = new HashMap<>();
@Before
public void setUp() throws Exception {
dataValues1.put("gXNu7zJBTDN", "no");
dataValues1.put("jkEjtKqlJtN", "event value1");
dataValues2.put("gXNu7zJBTDN", "yes");
dataValues2.put("jkEjtKqlJtN", "event value2");
dataValues3.put("gXNu7zJBTDN", "yes");
dataValues3.put("jkEjtKqlJtN", "event value3");
responseHandler = new EventResponseHandler();
setValuesForMemberFields(responseHandler, "loggerService", loggerService);
}
@Test
public void shouldAddAllEventTrackerToTheEventsToSaveInTrackerWhenAllAreNewEvents() {
EventUtil.eventsToSaveInTracker.clear();
event1 = getEvents(instanceId1, eventDate, dataValues1, "1", "");
List<Event> events1 = new LinkedList<>();
events1.add(event1);
payLoad1 = getEnrollmentPayLoad(instanceId1, enrDate, events1, "1", enrReference1);
event2 = getEvents(instanceId2, eventDate, dataValues2, "2", "");
List<Event> events2 = new LinkedList<>();
events2.add(event2);
payLoad2 = getEnrollmentPayLoad(instanceId2, enrDate, events2, "2", enrReference2);
event3 = getEvents(instanceId3, eventDate, dataValues3, "3", "");
List<Event> events3 = new LinkedList<>();
events3.add(event3);
payLoad3 = getEnrollmentPayLoad(instanceId3, enrDate, events3, "3", enrReference3);
List<EnrollmentAPIPayLoad> enrollmentAPIPayLoads = Arrays.asList(payLoad1, payLoad2, payLoad3);
EventTracker eventTracker1 = getEventTracker("", instanceId1, "1");
EventTracker eventTracker2 = getEventTracker("", instanceId2, "2");
EventTracker eventTracker3 = getEventTracker("", instanceId3, "3");
List<EventTracker> eventTrackers = Arrays.asList(eventTracker1, eventTracker2, eventTracker3);
List<EnrollmentImportSummary> importSummaries = Arrays.asList(
new EnrollmentImportSummary("", IMPORT_SUMMARY_RESPONSE_SUCCESS, new ImportCount(1, 0, 0, 0),
null, new ArrayList<>(), enrReference1, new Response("ImportSummaries",
IMPORT_SUMMARY_RESPONSE_SUCCESS, 2, 0, 0, 0,
Collections.singletonList(
new ImportSummary("", IMPORT_SUMMARY_RESPONSE_SUCCESS, new ImportCount(2, 0, 0, 0),
null, new ArrayList<>(), envReference1)),
1
)
),
new EnrollmentImportSummary("", IMPORT_SUMMARY_RESPONSE_SUCCESS, new ImportCount(1, 0, 0, 0),
null, new ArrayList<>(), enrReference2, new Response("ImportSummaries",
IMPORT_SUMMARY_RESPONSE_SUCCESS, 2, 0, 0, 0,
Collections.singletonList(
new ImportSummary("", IMPORT_SUMMARY_RESPONSE_SUCCESS, new ImportCount(2, 0, 0, 0),
null, new ArrayList<>(), envReference2)),
1
)
),
new EnrollmentImportSummary("", IMPORT_SUMMARY_RESPONSE_SUCCESS, new ImportCount(1, 0, 0, 0),
null, new ArrayList<>(), enrReference3, new Response("ImportSummaries",
IMPORT_SUMMARY_RESPONSE_SUCCESS, 2, 0, 0, 0,
Collections.singletonList(
new ImportSummary("", IMPORT_SUMMARY_RESPONSE_SUCCESS, new ImportCount(2, 0, 0, 0),
null, new ArrayList<>(), envReference3)),
1
)
)
);
EventTracker expectedET1 = getEventTracker(envReference1, instanceId1, "1");
EventTracker expectedET2 = getEventTracker(envReference2, instanceId2, "2");
EventTracker expectedET3 = getEventTracker(envReference3, instanceId3, "3");
List<EventTracker> expectedEventTracker = Arrays.asList(expectedET1, expectedET2, expectedET3);
responseHandler.process(enrollmentAPIPayLoads, importSummaries, eventTrackers, logger, prefix);
assertEquals(expectedEventTracker, EventUtil.eventsToSaveInTracker);
EventUtil.eventsToSaveInTracker.clear();
}
@Test
public void shouldNotAddEventTrackerToTheEventsToSaveInTrackerWhenAllAreUpdatedEvents() {
EventUtil.eventsToSaveInTracker.clear();
event1 = getEvents(instanceId1, eventDate, dataValues1, "1", "");
List<Event> events1 = new LinkedList<>();
events1.add(event1);
payLoad1 = getEnrollmentPayLoad(instanceId1, enrDate, events1, "1", enrReference1);
event2 = getEvents(instanceId2, eventDate, dataValues2, "2", "");
List<Event> events2 = new LinkedList<>();
events2.add(event2);
payLoad2 = getEnrollmentPayLoad(instanceId2, enrDate, events2, "2", enrReference2);
event3 = getEvents(instanceId3, eventDate, dataValues3, "3", "");
List<Event> events3 = new LinkedList<>();
events3.add(event3);
payLoad3 = getEnrollmentPayLoad(instanceId3, enrDate, events3, "3", enrReference3);
List<EnrollmentAPIPayLoad> enrollmentAPIPayLoads = Arrays.asList(payLoad1, payLoad2, payLoad3);
EventTracker eventTracker1 = getEventTracker(envReference1, instanceId1, "1");
EventTracker eventTracker2 = getEventTracker(envReference2, instanceId2, "2");
EventTracker eventTracker3 = getEventTracker(envReference3, instanceId3, "3");
List<EventTracker> eventTrackers = Arrays.asList(eventTracker1, eventTracker2, eventTracker3);
List<EnrollmentImportSummary> importSummaries = Arrays.asList(
new EnrollmentImportSummary("", IMPORT_SUMMARY_RESPONSE_SUCCESS, new ImportCount(1, 0, 0, 0),
null, new ArrayList<>(), enrReference1, new Response("ImportSummaries",
IMPORT_SUMMARY_RESPONSE_SUCCESS, 0, 2, 0, 0,
Collections.singletonList(
new ImportSummary("", IMPORT_SUMMARY_RESPONSE_SUCCESS, new ImportCount(0, 2, 0, 0),
null, new ArrayList<>(), envReference1)),
1
)
),
new EnrollmentImportSummary("", IMPORT_SUMMARY_RESPONSE_SUCCESS, new ImportCount(1, 0, 0, 0),
null, new ArrayList<>(), enrReference2, new Response("ImportSummaries",
IMPORT_SUMMARY_RESPONSE_SUCCESS, 0, 2, 0, 0,
Collections.singletonList(
new ImportSummary("", IMPORT_SUMMARY_RESPONSE_SUCCESS, new ImportCount(0, 2, 0, 0),
null, new ArrayList<>(), envReference2)),
1
)
),
new EnrollmentImportSummary("", IMPORT_SUMMARY_RESPONSE_SUCCESS, new ImportCount(1, 0, 0, 0),
null, new ArrayList<>(), enrReference3, new Response("ImportSummaries",
IMPORT_SUMMARY_RESPONSE_SUCCESS, 0, 2, 0, 0,
Collections.singletonList(
new ImportSummary("", IMPORT_SUMMARY_RESPONSE_SUCCESS, new ImportCount(0, 2, 0, 0),
null, new ArrayList<>(), envReference3)),
1
)
)
);
responseHandler.process(enrollmentAPIPayLoads, importSummaries, eventTrackers, logger, prefix);
assertEquals(0, EventUtil.eventsToSaveInTracker.size());
EventUtil.eventsToSaveInTracker.clear();
}
@Test
public void shouldLogDescriptionAndThrowExceptionWhenRequestBodyHasIncorrectProgramForNewEvents() {
EventUtil.eventsToSaveInTracker.clear();
List<Event> events1 = new LinkedList<>();
event1 = getEvents(instanceId1, eventDate, dataValues1, "1", "");
event2 = getEvents(instanceId1, eventDate, dataValues2, "2", "");
event3 = getEvents(instanceId1, eventDate, dataValues3, "3", "");
events1.add(event1);
events1.add(event2);
events1.add(event3);
payLoad1 = getEnrollmentPayLoad(instanceId1, enrDate, events1, "1", enrReference1);
List<EnrollmentAPIPayLoad> enrollmentAPIPayLoads = Arrays.asList(payLoad1);
EventTracker eventTracker1 = getEventTracker("", instanceId1, "1");
EventTracker eventTracker2 = getEventTracker("", instanceId1, "2");
EventTracker eventTracker3 = getEventTracker("", instanceId1, "3");
List<EventTracker> eventTrackers = Arrays.asList(eventTracker1, eventTracker2, eventTracker3);
String description = "Event.program does not point to a valid program: rleFtLk_1";
List<EnrollmentImportSummary> importSummaries = Collections.singletonList(
new EnrollmentImportSummary("", IMPORT_SUMMARY_RESPONSE_SUCCESS, new ImportCount(1, 0, 0, 0),
null, new ArrayList<>(), enrReference1, new Response("ImportSummaries",
IMPORT_SUMMARY_RESPONSE_ERROR, 0, 0, 0, 6,
Arrays.asList(
new ImportSummary("", IMPORT_SUMMARY_RESPONSE_ERROR,
new ImportCount(0, 0, 2, 0),
description, new ArrayList<>(), null),
new ImportSummary("", IMPORT_SUMMARY_RESPONSE_ERROR,
new ImportCount(0, 0, 2, 0),
description, new ArrayList<>(), null),
new ImportSummary("", IMPORT_SUMMARY_RESPONSE_ERROR,
new ImportCount(0, 0, 2, 0),
description, new ArrayList<>(), null)
),
1
)
)
);
responseHandler.process(enrollmentAPIPayLoads, importSummaries, eventTrackers, logger, prefix);
assertEquals(0, EventUtil.eventsToSaveInTracker.size());
verify(logger, times(3)).error(prefix + description);
verify(loggerService, times(3)).collateLogMessage(description);
EventUtil.eventsToSaveInTracker.clear();
}
@Test
public void shouldUpdateReferencesForFirstAndThirdEventAndLogDescriptionForSecondEventWhenFirstEventHasCorrectProgramAndSecondHasIncorrectProgram() {
EventUtil.eventsToSaveInTracker.clear();
List<Event> events1 = new LinkedList<>();
event1 = getEvents(instanceId1, eventDate, dataValues1, "1", "");
event2 = getEvents(instanceId1, eventDate, dataValues2, "2", "");
event3 = getEvents(instanceId1, eventDate, dataValues3, "3", "");
events1.add(event1);
events1.add(event2);
events1.add(event3);
payLoad1 = getEnrollmentPayLoad(instanceId1, enrDate, events1, "1", enrReference1);
List<EnrollmentAPIPayLoad> enrollmentAPIPayLoads = Arrays.asList(payLoad1);
EventTracker eventTracker1 = getEventTracker("", instanceId1, "1");
EventTracker eventTracker2 = getEventTracker("", instanceId1, "2");
EventTracker eventTracker3 = getEventTracker("", instanceId1, "3");
List<EventTracker> eventTrackers = Arrays.asList(eventTracker1, eventTracker2, eventTracker3);
String description = "Event.program does not point to a valid program: incorrectProgram";
List<EnrollmentImportSummary> importSummaries = Collections.singletonList(
new EnrollmentImportSummary("", IMPORT_SUMMARY_RESPONSE_SUCCESS, new ImportCount(1, 0, 0, 0),
null, new ArrayList<>(), enrReference1, new Response("ImportSummaries",
IMPORT_SUMMARY_RESPONSE_ERROR, 0, 0, 0, 6,
Arrays.asList(
new ImportSummary("", IMPORT_SUMMARY_RESPONSE_SUCCESS,
new ImportCount(2, 0, 0, 0),
null, new ArrayList<>(), envReference1),
new ImportSummary("", IMPORT_SUMMARY_RESPONSE_ERROR,
new ImportCount(0, 0, 2, 0),
description, new ArrayList<>(), null),
new ImportSummary("", IMPORT_SUMMARY_RESPONSE_SUCCESS,
new ImportCount(2, 0, 0, 0),
null, new ArrayList<>(), envReference3)
),
1
)
)
);
EventTracker expectedET1 = getEventTracker(envReference1, instanceId1, "1");
EventTracker expectedET3 = getEventTracker(envReference3, instanceId1, "3");
List<EventTracker> expectedEventTracker = Arrays.asList(expectedET1, expectedET3);
responseHandler.process(enrollmentAPIPayLoads, importSummaries, eventTrackers, logger, prefix);
assertEquals(expectedEventTracker, EventUtil.eventsToSaveInTracker);
verify(logger, times(1)).error(prefix + description);
verify(loggerService, times(1)).collateLogMessage(description);
EventUtil.eventsToSaveInTracker.clear();
}
@Test
public void shouldUpdateReferencesForSecondAndThirdEventAndLogDescriptionForFirstEventWhenFirstEventHasIncorrectProgramAndSecondHasCorrectProgram() {
EventUtil.eventsToSaveInTracker.clear();
List<Event> events1 = new LinkedList<>();
event1 = getEvents(instanceId1, eventDate, dataValues1, "1", "");
event2 = getEvents(instanceId1, eventDate, dataValues2, "2", "");
event3 = getEvents(instanceId1, eventDate, dataValues3, "3", "");
events1.add(event1);
events1.add(event2);
events1.add(event3);
payLoad1 = getEnrollmentPayLoad(instanceId1, enrDate, events1, "1", enrReference1);
List<EnrollmentAPIPayLoad> enrollmentAPIPayLoads = Arrays.asList(payLoad1);
EventTracker eventTracker1 = getEventTracker("", instanceId1, "1");
EventTracker eventTracker2 = getEventTracker("", instanceId1, "2");
EventTracker eventTracker3 = getEventTracker("", instanceId1, "3");
List<EventTracker> eventTrackers = Arrays.asList(eventTracker1, eventTracker2, eventTracker3);
String description = "Event.program does not point to a valid program: incorrectProgram";
List<EnrollmentImportSummary> importSummaries = Collections.singletonList(
new EnrollmentImportSummary("", IMPORT_SUMMARY_RESPONSE_SUCCESS, new ImportCount(1, 0, 0, 0),
null, new ArrayList<>(), enrReference1, new Response("ImportSummaries",
IMPORT_SUMMARY_RESPONSE_ERROR, 0, 0, 0, 6,
Arrays.asList(
new ImportSummary("", IMPORT_SUMMARY_RESPONSE_ERROR,
new ImportCount(0, 0, 2, 0),
description, new ArrayList<>(), null),
new ImportSummary("", IMPORT_SUMMARY_RESPONSE_SUCCESS,
new ImportCount(2, 0, 0, 0),
null, new ArrayList<>(), envReference2),
new ImportSummary("", IMPORT_SUMMARY_RESPONSE_SUCCESS,
new ImportCount(2, 0, 0, 0),
null, new ArrayList<>(), envReference3)
),
1
)
)
);
EventTracker expectedET2 = getEventTracker(envReference2, instanceId1, "2");
EventTracker expectedET3 = getEventTracker(envReference3, instanceId1, "3");
List<EventTracker> expectedEventTracker = Arrays.asList(expectedET2, expectedET3);
responseHandler.process(enrollmentAPIPayLoads, importSummaries, eventTrackers, logger, prefix);
assertEquals(expectedEventTracker, EventUtil.eventsToSaveInTracker);
verify(logger, times(1)).error(prefix + description);
verify(loggerService, times(1)).collateLogMessage(description);
EventUtil.eventsToSaveInTracker.clear();
}
@Test
public void shouldLogConflictMessageAndDoNotUpdateTrackerWhenTheResponseHasErrorWithConflict() {
EventUtil.eventsToSaveInTracker.clear();
List<Event> events1 = new LinkedList<>();
event1 = getEvents(instanceId1, eventDate, dataValues1, "1", "");
event2 = getEvents(instanceId1, eventDate, dataValues2, "2", "");
event3 = getEvents(instanceId1, eventDate, dataValues3, "3", "");
events1.add(event1);
events1.add(event2);
events1.add(event3);
payLoad1 = getEnrollmentPayLoad(instanceId1, enrDate, events1, "1", enrReference1);
List<EnrollmentAPIPayLoad> enrollmentAPIPayLoads = Arrays.asList(payLoad1);
EventTracker eventTracker1 = getEventTracker("", instanceId1, "1");
EventTracker eventTracker2 = getEventTracker("", instanceId1, "2");
EventTracker eventTracker3 = getEventTracker("", instanceId1, "3");
List<EventTracker> eventTrackers = Arrays.asList(eventTracker1, eventTracker2, eventTracker3);
List<Conflict> conflicts = Collections.singletonList(new Conflict("jfDdErl", "value_not_true_only"));
List<EnrollmentImportSummary> importSummaries = Collections.singletonList(
new EnrollmentImportSummary("", IMPORT_SUMMARY_RESPONSE_SUCCESS, new ImportCount(1, 0, 0, 0),
null, new ArrayList<>(), enrReference1, new Response("ImportSummaries",
IMPORT_SUMMARY_RESPONSE_ERROR, 0, 0, 0, 6,
Arrays.asList(
new ImportSummary("", IMPORT_SUMMARY_RESPONSE_ERROR,
new ImportCount(0, 0, 2, 0),
null, conflicts, null),
new ImportSummary("", IMPORT_SUMMARY_RESPONSE_ERROR,
new ImportCount(0, 0, 2, 0),
null, conflicts, null),
new ImportSummary("", IMPORT_SUMMARY_RESPONSE_ERROR,
new ImportCount(0, 0, 2, 0),
null, conflicts, null)
),
1
)
)
);
responseHandler.process(enrollmentAPIPayLoads, importSummaries, eventTrackers, logger, prefix);
assertEquals(0, EventUtil.eventsToSaveInTracker.size());
verify(logger, times(3)).error(prefix + "jfDdErl: value_not_true_only");
verify(loggerService, times(3)).collateLogMessage("jfDdErl: value_not_true_only");
EventUtil.eventsToSaveInTracker.clear();
}
@Test
public void shouldLogConflictMessageAndUpdateTrackerWhenResponseHasWarning() {
EventUtil.eventsToSaveInTracker.clear();
List<Event> events1 = new LinkedList<>();
event1 = getEvents("", eventDate, dataValues1, "1", "");
events1.add(event1);
payLoad1 = getEnrollmentPayLoad(instanceId1, enrDate, events1, "1", enrReference1);
List<EnrollmentAPIPayLoad> enrollmentAPIPayLoads = Collections.singletonList(payLoad1);
EventTracker eventTracker1 = getEventTracker("", instanceId1, "1");
List<EventTracker> eventTrackers = Collections.singletonList(eventTracker1);
List<Conflict> conflicts = Collections.singletonList(new Conflict("jfDdErl", "value_not_true_only"));
List<EnrollmentImportSummary> importSummaries = Collections.singletonList(
new EnrollmentImportSummary("", IMPORT_SUMMARY_RESPONSE_SUCCESS, new ImportCount(1, 0, 0, 0),
null, new ArrayList<>(), enrReference1, new Response("ImportSummaries",
IMPORT_SUMMARY_RESPONSE_ERROR, 0, 0, 0, 2,
Arrays.asList(
new ImportSummary("", IMPORT_SUMMARY_RESPONSE_WARNING,
new ImportCount(0, 0, 2, 0),
null, conflicts, null)
),
1
)
)
);
responseHandler.process(enrollmentAPIPayLoads, importSummaries, eventTrackers, logger, prefix);
assertEquals(0, EventUtil.eventsToSaveInTracker.size());
verify(logger, times(1)).error(prefix + "jfDdErl: value_not_true_only");
verify(loggerService, times(1)).collateLogMessage("jfDdErl: value_not_true_only");
EventUtil.eventsToSaveInTracker.clear();
}
@Test
public void shouldAddOnlyNewToTheTrackerWhenComboEventsAreSynced() {
EventUtil.eventsToSaveInTracker.clear();
List<Event> events1 = new LinkedList<>();
event1 = getEvents(instanceId1, eventDate, dataValues1, "1", "");
event2 = getEvents(instanceId1, eventDate, dataValues2, "2", envReference2);
event3 = getEvents(instanceId1, eventDate, dataValues3, "3", "");
events1.add(event1);
events1.add(event2);
events1.add(event3);
payLoad1 = getEnrollmentPayLoad(instanceId1, enrDate, events1, "1", enrReference1);
List<EnrollmentAPIPayLoad> enrollmentAPIPayLoads = Arrays.asList(payLoad1);
EventTracker eventTracker1 = getEventTracker("", instanceId1, "1");
EventTracker eventTracker2 = getEventTracker(envReference2, instanceId1, "2");
EventTracker eventTracker3 = getEventTracker("", instanceId1, "3");
List<EventTracker> eventTrackers = Arrays.asList(eventTracker1, eventTracker3, eventTracker2);
List<Conflict> conflicts = Collections.singletonList(new Conflict("jfDdErl", "value_not_true_only"));
List<EnrollmentImportSummary> importSummaries = Collections.singletonList(
new EnrollmentImportSummary("", IMPORT_SUMMARY_RESPONSE_SUCCESS, new ImportCount(1, 0, 0, 0),
null, new ArrayList<>(), enrReference1, new Response("ImportSummaries",
IMPORT_SUMMARY_RESPONSE_SUCCESS, 0, 2, 0, 4,
Arrays.asList(
new ImportSummary("", IMPORT_SUMMARY_RESPONSE_SUCCESS,
new ImportCount(2, 0, 0, 0),
null, conflicts, envReference1),
new ImportSummary("", IMPORT_SUMMARY_RESPONSE_SUCCESS,
new ImportCount(2, 0, 0, 0),
null, conflicts, envReference3),
new ImportSummary("", IMPORT_SUMMARY_RESPONSE_SUCCESS,
new ImportCount(0, 2, 0, 0),
null, conflicts, envReference2)
),
1
)
)
);
EventTracker expectedET1 = getEventTracker(envReference1, instanceId1, "1");
EventTracker expectedET3 = getEventTracker(envReference3, instanceId1, "3");
List<EventTracker> expectedEventTracker = Arrays.asList(expectedET1, expectedET3);
responseHandler.process(enrollmentAPIPayLoads, importSummaries, eventTrackers, logger, prefix);
assertEquals(expectedEventTracker, EventUtil.eventsToSaveInTracker);
EventUtil.eventsToSaveInTracker.clear();
}
@Test
public void shouldAddReferenceToTheCorrectEventWhenSecondImportSummaryDoesNotHaveAnyEventImportSummaryResponse() {
EventUtil.eventsToSaveInTracker.clear();
event1 = getEvents(instanceId1, eventDate, dataValues1, "1", "");
List<Event> events1 = new LinkedList<>();
events1.add(event1);
payLoad1 = getEnrollmentPayLoad(instanceId1, enrDate, events1, "1", enrReference1);
payLoad2 = getEnrollmentPayLoad(instanceId2, enrDate, new LinkedList<>(), "2", enrReference2);
event3 = getEvents(instanceId3, eventDate, dataValues3, "3", "");
List<Event> events3 = new LinkedList<>();
events3.add(event3);
payLoad3 = getEnrollmentPayLoad(instanceId3, enrDate, events3, "3", enrReference3);
List<EnrollmentAPIPayLoad> enrollmentAPIPayLoads = Arrays.asList(payLoad1, payLoad2, payLoad3);
EventTracker eventTracker1 = getEventTracker("", instanceId1, "1");
EventTracker eventTracker3 = getEventTracker("", instanceId3, "3");
List<EventTracker> eventTrackers = Arrays.asList(eventTracker1, eventTracker3);
List<EnrollmentImportSummary> importSummaries = Arrays.asList(
new EnrollmentImportSummary("", IMPORT_SUMMARY_RESPONSE_SUCCESS, new ImportCount(1, 0, 0, 0),
null, new ArrayList<>(), enrReference1, new Response("ImportSummaries",
IMPORT_SUMMARY_RESPONSE_SUCCESS, 2, 0, 0, 0,
Collections.singletonList(
new ImportSummary("", IMPORT_SUMMARY_RESPONSE_SUCCESS, new ImportCount(2, 0, 0, 0),
null, new ArrayList<>(), envReference1)),
1
)
),
new EnrollmentImportSummary("", IMPORT_SUMMARY_RESPONSE_SUCCESS, new ImportCount(1, 0, 0, 0),
null, new ArrayList<>(), enrReference2, new Response("ImportSummaries",
IMPORT_SUMMARY_RESPONSE_SUCCESS, 0, 0, 0, 0,
null, 1
)
),
new EnrollmentImportSummary("", IMPORT_SUMMARY_RESPONSE_SUCCESS, new ImportCount(1, 0, 0, 0),
null, new ArrayList<>(), enrReference3, new Response("ImportSummaries",
IMPORT_SUMMARY_RESPONSE_SUCCESS, 2, 0, 0, 0,
Collections.singletonList(
new ImportSummary("", IMPORT_SUMMARY_RESPONSE_SUCCESS, new ImportCount(2, 0, 0, 0),
null, new ArrayList<>(), envReference3)),
1
)
)
);
EventTracker expectedET1 = getEventTracker(envReference1, instanceId1, "1");
EventTracker expectedET3 = getEventTracker(envReference3, instanceId3, "3");
List<EventTracker> expectedEventTracker = Arrays.asList(expectedET1, expectedET3);
responseHandler.process(enrollmentAPIPayLoads, importSummaries, eventTrackers, logger, prefix);
assertEquals(expectedEventTracker, EventUtil.eventsToSaveInTracker);
EventUtil.eventsToSaveInTracker.clear();
}
@Test
public void shouldLogConflictMessageAndUpdateTrackerWhenResponseHasWarningWithImport() {
EventUtil.eventsToSaveInTracker.clear();
List<Event> events1 = new LinkedList<>();
event1 = getEvents("", eventDate, dataValues1, "1", "");
events1.add(event1);
payLoad1 = getEnrollmentPayLoad(instanceId1, enrDate, events1, "1", enrReference1);
List<EnrollmentAPIPayLoad> enrollmentAPIPayLoads = Collections.singletonList(payLoad1);
EventTracker eventTracker1 = getEventTracker("", instanceId1, "1");
List<EventTracker> eventTrackers = Collections.singletonList(eventTracker1);
List<Conflict> conflicts = Collections.singletonList(new Conflict("jfDdErl", "value_not_true_only"));
List<EnrollmentImportSummary> importSummaries = Collections.singletonList(
new EnrollmentImportSummary("", IMPORT_SUMMARY_RESPONSE_SUCCESS, new ImportCount(1, 0, 0, 0),
null, new ArrayList<>(), enrReference1, new Response("ImportSummaries",
IMPORT_SUMMARY_RESPONSE_ERROR, 1, 0, 0, 1,
Arrays.asList(
new ImportSummary("", IMPORT_SUMMARY_RESPONSE_WARNING,
new ImportCount(1, 0, 1, 0),
null, conflicts, null)
),
1
)
)
);
responseHandler.process(enrollmentAPIPayLoads, importSummaries, eventTrackers, logger, prefix);
assertEquals(1, EventUtil.eventsToSaveInTracker.size());
verify(logger, times(1)).error(prefix + "jfDdErl: value_not_true_only");
verify(loggerService, times(1)).collateLogMessage("jfDdErl: value_not_true_only");
EventUtil.eventsToSaveInTracker.clear();
}
private EnrollmentAPIPayLoad getEnrollmentPayLoad(String instanceId, String enrDate, List<Event> events, String programUniqueId, String enrollmentId) {
return new EnrollmentAPIPayLoad(
enrollmentId,
instanceId,
"xhjKKwoq",
"jSsoNjesL",
enrDate,
enrDate,
"ACTIVE",
programUniqueId,
events
);
}
private Event getEvents(String instanceId, String eventDate, Map<String, String> dataValues, String eventUniqueId, String eventId) {
return new Event(
eventId,
instanceId,
"",
"xhjKKwoq",
"FJTkwmaP",
"jSsoNjesL",
eventDate,
"COMPLETED",
eventUniqueId,
dataValues
);
}
private EventTracker getEventTracker(String eventId, String instanceId, String eventUniqueId) {
return new EventTracker(
eventId,
instanceId,
"xhjKKwoq",
eventUniqueId,
"FJTkwmaP"
);
}
}
| [
"mahitha.arveti@gmail.com"
] | mahitha.arveti@gmail.com |
c605c96aa1bf6c8b7cb4613db614cccdc9bf0c37 | b796403692acd9cd1dcae90ee41c37ef4bc56f44 | /CobolPorterParser/src/main/java/tr/com/vbt/natural/parser/datalayout/db/patern/PaternDBDataTypeNatural.java | 7c6c52a1bc4b5900d125c6c9755e3e87556eafd1 | [] | no_license | latift/PorterEngine | 7626bae05f41ef4e7828e13f2a55bf77349e1bb3 | c78a12f1cb2e72c90b1b22d6f50f71456d0c4345 | refs/heads/master | 2023-09-02T05:16:24.793958 | 2021-09-29T12:02:52 | 2021-09-29T12:02:52 | 95,788,676 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,952 | java | package tr.com.vbt.natural.parser.datalayout.db.patern;
import tr.com.vbt.cobol.parser.AbstractCommand;
import tr.com.vbt.lexer.ReservedNaturalKeywords;
import tr.com.vbt.natural.parser.datalayout.db.ElementDBDataTypeNatural;
import tr.com.vbt.patern.AbstractDataTypePattern;
import tr.com.vbt.token.AbstractToken;
import tr.com.vbt.token.KarakterToken;
import tr.com.vbt.token.KelimeToken;
import tr.com.vbt.token.SayiToken;
/**S**
02 T-BLOCKFUEL (N8) //N8 optional
**/
public class PaternDBDataTypeNatural extends AbstractDataTypePattern{
public PaternDBDataTypeNatural() {
super();
//01
AbstractToken astSource=new SayiToken();
astSource.setTekrarlayabilir("+");
astSource.setSourceFieldName("levelNumber");
patternTokenList.add(astSource);
//CLIENT-ID
AbstractToken astSource2=new KelimeToken<String>();
astSource2.setTekrarlayabilir("+");
astSource2.setSourceFieldName("dataName");
astSource2.setPojoVariable(true);
patternTokenList.add(astSource2);
AbstractToken astSource3=new KarakterToken('(', 0,0,0);
//astSource3.setOptional(true);
patternTokenList.add(astSource3);
// * N8
AbstractToken astSource4=new KelimeToken();
astSource4.setSourceFieldName("dataType");
//astSource4.setOptional(true);
patternTokenList.add(astSource4);
// * N8.5
AbstractToken astSource6=new SayiToken();
astSource6.setSourceFieldName("lengthAfterDot");
astSource6.setOptional(true);
patternTokenList.add(astSource6);
///) Mandatory
AbstractToken astSource5=new KarakterToken(')', 0,0,0);
//astSource5.setOptional(true);
patternTokenList.add(astSource5);
}
@Override
public void setTokenToElement(AbstractCommand matchedCommand,
AbstractToken currentTokenForMatch,
AbstractToken abstractTokenInPattern) {
ElementDBDataTypeNatural matchedCommandAdd=(ElementDBDataTypeNatural) matchedCommand;
super.setSatirNumarasi(matchedCommand,currentTokenForMatch, abstractTokenInPattern);if(abstractTokenInPattern.getSourceFieldName()==null){
}else if(abstractTokenInPattern.getSourceFieldName().equals("levelNumber")){
matchedCommandAdd.setLevelNumber(((Long)currentTokenForMatch.getDeger()));
matchedCommandAdd.getParameters().put("levelNumber", matchedCommandAdd.getLevelNumber());
matchedCommandAdd.setDataType("A");
matchedCommandAdd.getParameters().put("type","String");
}
else if(abstractTokenInPattern.getSourceFieldName().equals("dataName")){
if(currentTokenForMatch.getColumnNameToken()!=null){
matchedCommandAdd.setDataName((String) currentTokenForMatch.getColumnNameToken().getDeger());
}else{
matchedCommandAdd.setDataName((String) currentTokenForMatch.getDeger());
}
matchedCommandAdd.getParameters().put("dataName", matchedCommandAdd.getDataName());
}
else if(abstractTokenInPattern.getSourceFieldName().equals("dataType")){
matchedCommandAdd.setDataType((String) currentTokenForMatch.getDeger());
matchedCommandAdd.getParameters().put("dataType", matchedCommandAdd.getDataType());
}
else if(abstractTokenInPattern.getSourceFieldName().equals("lengthAfterDot")){
Double lenghtD;
Long lengthInt;
if(currentTokenForMatch.getDeger() instanceof Double){
lenghtD=(Double) currentTokenForMatch.getDeger();
matchedCommandAdd.setLengthAfterDot(lenghtD.longValue());
matchedCommandAdd.getParameters().put("lengthAfterDot", matchedCommandAdd.getLengthAfterDot());
}else if(currentTokenForMatch.getDeger() instanceof Long){
lengthInt=(Long) currentTokenForMatch.getDeger();
matchedCommandAdd.setLengthAfterDot(lengthInt);
matchedCommandAdd.getParameters().put("lengthAfterDot", matchedCommandAdd.getLengthAfterDot());
}
}
}
@Override
public AbstractCommand createElement() {
ElementDBDataTypeNatural createdElement = new ElementDBDataTypeNatural(ReservedNaturalKeywords.DB_DATA_TYPE, "DATABASE.DB_DATA_TYPE");
return createdElement;
}
}
| [
"latiftopcu@gmail.com"
] | latiftopcu@gmail.com |
17ad62bace6851a3539028631e93ce85bff86b6f | 8e310f1a5177af0d48af09993f589b9638ce9cf0 | /src/main/java/com/si/mapbuilder/gmap/Line.java | 39aaf42ed3dfc89fb50813c39558ded71d5191fd | [] | no_license | pingandezhufu/MapBuilder | 72bf371427a94806fe2118eb6b379d932a0e33d8 | 8d8d785ebba8aa5121089226b399a98425fa1449 | refs/heads/master | 2021-01-18T12:29:16.644374 | 2012-04-23T07:38:52 | 2012-04-23T07:38:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 838 | java | package com.si.mapbuilder.gmap;
import java.util.*;
/**
*
* User: simonvandersluis
* Date: 6/03/12
* Time: 7:14 PM
*/
public class Line {
private List<Point> points = new LinkedList<Point>();
public Line() {
super();
}
public Line(List<Point> initialPoints) {
this.points.addAll(initialPoints);
}
public Iterator<Point> iterate() {
return points.iterator();
}
public List<Point> getPoints() {
return Collections.unmodifiableList(points);
}
public void addPoint(Point point) {
points.add(point);
}
@Override
public boolean equals(Object other) {
if (!(other instanceof Line))
{
return false;
}
Line l = (Line) other;
return points.equals(l.getPoints());
}
@Override
public String toString() {
return points.toString();
}
}
| [
"svanders38@gmail.com"
] | svanders38@gmail.com |
16ffcc1afd09b356d08f5f6216114db14a48026d | 98f56f179d04418e3df7e1934aea16e8c2168538 | /src/test/java/com/github/hanavan99/conwaygameoflife/network/packets/HelloPacketTest.java | a9b78921fd9b05e65e97cfe5ceeb53b988ca1c8f | [] | no_license | Hanavan99/ConwayGameOfLife | a10fbe69578f64376ef317db58ae9eb2481fb14f | e4e1550454137e725edbab0c24f57defe91494cd | refs/heads/master | 2020-12-24T19:05:14.866523 | 2016-06-10T01:20:53 | 2016-06-10T01:20:53 | 56,821,197 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 275 | java | package com.github.hanavan99.conwaygameoflife.network.packets;
public class HelloPacketTest extends AbstractPacketTest {
@Override
protected IPacket packetA() {
return new HelloPacket(42);
}
@Override
protected IPacket packetB() {
return new HelloPacket(53);
}
}
| [
"zachdeibert@gmail.com"
] | zachdeibert@gmail.com |
a9b857218e95fdc7ab46027731bc136784b1bf71 | deb6f7cbffe4ce4c916470646036ea38bbf3b314 | /keerthisri/12 & 13 October/12oct2020/StudentMongo/src/main/java/com/example/demo/resource/EmployeeController.java | c3d8035656d38f14e22c183fa860ff649fb51a13 | [] | no_license | USTGLOBLE-2020/springassignments | 805956d995c0601930ebb64659ac0327856d0b53 | d0e98af9b1053e7e153dd073b983c4cfa4017ca3 | refs/heads/master | 2022-12-20T11:43:37.680268 | 2020-10-28T12:23:04 | 2020-10-28T12:23:04 | 301,422,153 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,464 | java | package com.example.demo.resource;
import java.util.List;
import java.util.Optional;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.example.demo.exception.ResourceNotFoundException;
import com.example.demo.model.Employee;
import com.example.demo.model.repository.EmployeeRepository;
@RestController
@RequestMapping("/api")
public class EmployeeController {
@Autowired
private EmployeeRepository empRepository;
private static final Logger LOGGER = LogManager.getLogger(EmployeeController.class);
/*
Creating and saving the Employee
*/
@PostMapping("/saveEmployee")
public ResponseEntity<Employee> saveEmployee(@RequestBody Employee employee)
{
try {
Employee emp = empRepository.save(
new Employee(employee.getId(),employee.getName(),employee.getEmpAddress(), employee.getEmail(),
employee.getSalary()));
LOGGER.info("Employee data saved");
return new ResponseEntity<>(emp, HttpStatus.CREATED);
} catch(Exception e) {
return new ResponseEntity<>(null, HttpStatus.INTERNAL_SERVER_ERROR);
}
}
/*
* Listing
*/
@GetMapping("/listEmployees")
public ResponseEntity<List<Employee>> getAllEmployees() {
List<Employee> empList = empRepository.findAll();
if(list.isEmpty())
{
LOGGER.info("Employee list is empty");
}
return new ResponseEntity<>(empList, HttpStatus.OK);
}
/* View selected row using id */
@GetMapping("/getEmployeeByID/{id}")
public ResponseEntity<EmployeeMon> getEmployeeByID(@PathVariable Integer id) throws Exception {
Employee employee = empRepository.findById(id)
.orElseThrow(() -> new ResourceNotFoundException("Employee not found :: " + id));
return ResponseEntity.ok().body(employee);
}
/* update */
@PutMapping("/updateEmployee/{id}")
public ResponseEntity<Employee> updateEmployee(@PathVariable Integer id, @RequestBody Employee employee) {
Optional<EmployeeMon> empModel = empRepository.findById(id);
if (empModel.isPresent()) {
EmployeeMon emp = empModel.get();
emp.setId(employee.getId());
emp.setName(employee.getName());
emp.setAddress(employee.getAddress());
emp.setEmail(employee.getEmail());
emp.setSalary(employee.getSalary());
LOGGER.info("Updated employee details "+id);
return new ResponseEntity<>(repository.save(emp), HttpStatus.OK);
} else {
return new ResponseEntity<>(HttpStatus.NOT_FOUND);
}
}
/* Delete by ID */
@DeleteMapping("/deleteByID/{id}")
public ResponseEntity deleteByID(@PathVariable Integer id) {
Optional<Employee> emp = repository.findById(id);
if(emp.isPresent()) {
repository.deleteById(id);
return new ResponseEntity<>(HttpStatus.OK);
} else {
return new ResponseEntity<>(HttpStatus.NOT_FOUND);
}
}
}
| [
"estatereal747@gmail.com"
] | estatereal747@gmail.com |
3493d89d5f8ac2d306e10b827a2b8719a273a042 | 90145d7706df4afae89474bf2163104b67a35330 | /app/src/main/java/com/example/cindywong/notes/SavedNote.java | c730e687e7f5628ba40821a2471393219f7b5398 | [] | no_license | CindyWong95/Notes | b97c4bccc95e655b424b9c149f05299d2be09851 | f912cecb0f33f99e698bf8cc010e4ebf26f6f19d | refs/heads/master | 2021-08-19T02:08:13.119439 | 2017-11-14T09:48:33 | 2017-11-14T09:48:33 | 110,346,012 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,039 | java | package com.example.cindywong.notes;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.content.Intent;
import android.view.View;
import android.widget.*;
public class SavedNote extends AppCompatActivity {
TextView tvNote, tvFileName;
Button btnHome;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_saved_note);
tvNote=(TextView)findViewById(R.id.tvNote);
tvFileName=(TextView)findViewById(R.id.tvFileName);
btnHome=(Button)findViewById(R.id.btnHome);
Intent intent = getIntent();
String note = intent.getStringExtra("note");
String file = intent.getStringExtra("fileChosen");
btnHome.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
tvFileName.setText(file);
tvNote.setText(note);
}
}
| [
"cindy.wys@hotmail.com"
] | cindy.wys@hotmail.com |
5c3e85a25cc826eba52d7635ceee1262edd42139 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/26/26_d66cc191951542105ad9770081b1807ee2f78091/GitCommitHandlerV1/26_d66cc191951542105ad9770081b1807ee2f78091_GitCommitHandlerV1_s.java | b3418b5c660c063445445f1e2cbfc33ef9658c6b | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 17,347 | java | /*******************************************************************************
* Copyright (c) 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.orion.server.git.servlets;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.*;
import java.util.Map.Entry;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.eclipse.core.runtime.*;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.MergeResult;
import org.eclipse.jgit.api.errors.*;
import org.eclipse.jgit.errors.AmbiguousObjectException;
import org.eclipse.jgit.errors.MissingObjectException;
import org.eclipse.jgit.lib.*;
import org.eclipse.jgit.revwalk.*;
import org.eclipse.jgit.storage.file.FileRepository;
import org.eclipse.jgit.treewalk.TreeWalk;
import org.eclipse.jgit.treewalk.filter.*;
import org.eclipse.orion.internal.server.core.IOUtilities;
import org.eclipse.orion.internal.server.servlets.ProtocolConstants;
import org.eclipse.orion.internal.server.servlets.ServletResourceHandler;
import org.eclipse.orion.server.core.ServerStatus;
import org.eclipse.orion.server.git.GitConstants;
import org.eclipse.orion.server.servlets.OrionServlet;
import org.eclipse.osgi.util.NLS;
import org.json.*;
/**
*
*/
public class GitCommitHandlerV1 extends ServletResourceHandler<String> {
private ServletResourceHandler<IStatus> statusHandler;
GitCommitHandlerV1(ServletResourceHandler<IStatus> statusHandler) {
this.statusHandler = statusHandler;
}
@Override
public boolean handleRequest(HttpServletRequest request, HttpServletResponse response, String path) throws ServletException {
Repository db = null;
try {
Path p = new Path(path);
switch (getMethod(request)) {
case GET :
return handleGet(request, response, db, p);
case PUT :
return handlePut(request, response, db, p);
case POST :
return handlePost(request, response, db, p);
// case DELETE :
// return handleDelete(request, response, p);
}
} catch (Exception e) {
String msg = NLS.bind("Failed to process an operation on commits for {0}", path); //$NON-NLS-1$
return statusHandler.handleRequest(request, response, new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, msg, e));
} finally {
if (db != null)
db.close();
}
return false;
}
private boolean createCommitLocation(HttpServletRequest request, HttpServletResponse response, Repository db, String newCommitToCreatelocation) throws IOException, JSONException, URISyntaxException {
URI u = getURI(request);
IPath p = new Path(u.getPath());
IPath np = new Path("/"); //$NON-NLS-1$
for (int i = 0; i < p.segmentCount(); i++) {
String s = p.segment(i);
if (i == 2) {
s += ".." + newCommitToCreatelocation; //$NON-NLS-1$
}
np = np.append(s);
}
URI nu = new URI(u.getScheme(), u.getUserInfo(), u.getHost(), u.getPort(), np.toString(), u.getQuery(), u.getFragment());
response.setHeader(ProtocolConstants.HEADER_LOCATION, nu.toString());
response.setStatus(HttpServletResponse.SC_OK);
return true;
}
private boolean handleGet(HttpServletRequest request, HttpServletResponse response, Repository db, Path path) throws CoreException, IOException, ServletException, JSONException, URISyntaxException {
File gitDir = GitUtils.getGitDir(path.removeFirstSegments(1).uptoSegment(2));
if (gitDir == null)
return false; // TODO: or an error response code, 405?
db = new FileRepository(gitDir);
// /{ref}/file/{projectId}...}
String parts = request.getParameter("parts"); //$NON-NLS-1$
if (path.segmentCount() > 3 && "body".equals(parts)) { //$NON-NLS-1$
return handleGetCommitBody(request, response, db, path);
}
if (path.segmentCount() > 2 && (parts == null || "log".equals(parts))) { //$NON-NLS-1$
return handleGetCommitLog(request, response, db, path);
}
return false;
}
private boolean handleGetCommitBody(HttpServletRequest request, HttpServletResponse response, Repository db, Path path) throws AmbiguousObjectException, IOException, ServletException {
ObjectId refId = db.resolve(path.segment(0));
if (refId == null) {
String msg = NLS.bind("Failed to generate commit log for ref {0}", path.segment(0)); //$NON-NLS-1$
return statusHandler.handleRequest(request, response, new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_BAD_REQUEST, msg, null));
}
RevWalk walk = new RevWalk(db);
String p = path.removeFirstSegments(3).toString();
walk.setTreeFilter(AndTreeFilter.create(PathFilterGroup.createFromStrings(Collections.singleton(p)), TreeFilter.ANY_DIFF));
RevCommit commit = walk.parseCommit(refId);
final TreeWalk w = TreeWalk.forPath(db, p, commit.getTree());
if (w == null) {
// TODO:
}
ObjectId blobId = w.getObjectId(0);
ObjectStream stream = db.open(blobId, Constants.OBJ_BLOB).openStream();
IOUtilities.pipe(stream, response.getOutputStream(), true, false);
return true;
}
private boolean handleGetCommitLog(HttpServletRequest request, HttpServletResponse response, Repository db, Path path) throws AmbiguousObjectException, IOException, ServletException, JSONException, URISyntaxException {
String refIdsRange = path.segment(0);
ObjectId toRefId = null;
ObjectId fromRefId = null;
if (refIdsRange.contains("..")) { //$NON-NLS-1$
String[] commits = refIdsRange.split("\\.\\."); //$NON-NLS-1$
if (commits.length != 2) {
String msg = NLS.bind("Failed to generate commit log for ref {0}", refIdsRange); //$NON-NLS-1$
return statusHandler.handleRequest(request, response, new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_BAD_REQUEST, msg, null));
}
fromRefId = db.resolve(commits[0]);
if (fromRefId == null) {
String msg = NLS.bind("Failed to generate commit log for ref {0}", commits[0]); //$NON-NLS-1$
return statusHandler.handleRequest(request, response, new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_BAD_REQUEST, msg, null));
}
toRefId = db.resolve(commits[1]);
if (toRefId == null) {
String msg = NLS.bind("Failed to generate commit log for ref {0}", commits[1]); //$NON-NLS-1$
return statusHandler.handleRequest(request, response, new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_BAD_REQUEST, msg, null));
}
} else {
toRefId = db.resolve(refIdsRange);
if (toRefId == null) {
String msg = NLS.bind("Failed to generate commit log for ref {0}", refIdsRange); //$NON-NLS-1$
return statusHandler.handleRequest(request, response, new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_BAD_REQUEST, msg, null));
}
}
RevWalk walk = new RevWalk(db);
// set the commit range
walk.markStart(walk.lookupCommit(toRefId));
if (fromRefId != null)
walk.markUninteresting(walk.parseCommit(fromRefId));
// set the path filter
String p = path.removeFirstSegments(3).toString();
if (p != null && !"".equals(p)) //$NON-NLS-1$
walk.setTreeFilter(AndTreeFilter.create(PathFilterGroup.createFromStrings(Collections.singleton(p)), TreeFilter.ANY_DIFF));
JSONObject result = toJSON(db, OrionServlet.getURI(request), walk);
result.put(GitConstants.KEY_REMOTE, getRemoteBranchLocation(getURI(request), db));
OrionServlet.writeJSONResponse(request, response, result);
walk.dispose();
return true;
}
private URI getRemoteBranchLocation(URI base, Repository db) throws IOException, URISyntaxException {
for (Entry<String, Ref> refEntry : db.getRefDatabase().getRefs(Constants.R_REMOTES).entrySet()) {
if (!refEntry.getValue().isSymbolic()) {
Ref ref = refEntry.getValue();
String name = ref.getName();
name = Repository.shortenRefName(name).substring(Constants.DEFAULT_REMOTE_NAME.length() + 1);
if (db.getBranch().equals(name)) {
return baseToRemoteLocation(base, Constants.DEFAULT_REMOTE_NAME, name);
}
}
}
return null;
}
private URI baseToRemoteLocation(URI u, String remote, String branch) throws URISyntaxException {
// URIUtil.append(baseLocation, configName)
IPath p = new Path(u.getPath());
p = p.uptoSegment(1).append(GitConstants.REMOTE_RESOURCE).append(remote).append(branch).addTrailingSeparator().append(p.removeFirstSegments(3));
return new URI(u.getScheme(), u.getUserInfo(), u.getHost(), u.getPort(), p.toString(), u.getQuery(), u.getFragment());
}
private JSONObject toJSON(Repository db, URI baseLocation, Iterable<RevCommit> commits) throws JSONException, URISyntaxException, MissingObjectException, IOException {
JSONObject result = new JSONObject();
JSONArray children = new JSONArray();
for (RevCommit revCommit : commits) {
children.put(toJSON(db, revCommit, baseLocation));
}
result.put(ProtocolConstants.KEY_CHILDREN, children);
return result;
}
private JSONObject toJSON(Repository db, RevCommit revCommit, URI baseLocation) throws JSONException, URISyntaxException, IOException {
JSONObject commit = new JSONObject();
commit.put(ProtocolConstants.KEY_LOCATION, createCommitLocation(baseLocation, revCommit.getName(), null));
commit.put(ProtocolConstants.KEY_CONTENT_LOCATION, createCommitLocation(baseLocation, revCommit.getName(), "parts=body"));
commit.put(GitConstants.KEY_DIFF, createDiffLocation(baseLocation, revCommit.getName()));
commit.put(ProtocolConstants.KEY_NAME, revCommit.getName());
commit.put(GitConstants.KEY_AUTHOR_NAME, revCommit.getAuthorIdent().getName());
commit.put(GitConstants.KEY_COMMIT_TIME, ((long) revCommit.getCommitTime()) * 1000 /* time in milliseconds */);
commit.put(GitConstants.KEY_COMMIT_MESSAGE, revCommit.getFullMessage());
commit.put(ProtocolConstants.KEY_CHILDREN, toJSON(getTagsForCommit(db, revCommit)));
return commit;
}
private JSONArray toJSON(Set<Ref> tags) {
JSONArray children = new JSONArray();
for (Ref ref : tags) {
children.put(ref.getName());
}
return children;
}
private URI createCommitLocation(URI baseLocation, String commitName, String parameters) throws URISyntaxException {
return new URI(baseLocation.getScheme(), baseLocation.getAuthority(), GitServlet.GIT_URI + "/" + GitConstants.COMMIT_RESOURCE + "/" + commitName + "/" + new Path(baseLocation.getPath()).removeFirstSegments(3), parameters, null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
private URI createDiffLocation(URI baseLocation, String commitName) throws URISyntaxException {
return new URI(baseLocation.getScheme(), baseLocation.getAuthority(), GitServlet.GIT_URI + "/" + GitConstants.DIFF_RESOURCE + "/" + commitName + "/" + new Path(baseLocation.getPath()).removeFirstSegments(3), null, null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
private boolean handlePost(HttpServletRequest request, HttpServletResponse response, Repository db, Path path) throws ServletException, NoFilepatternException, IOException, JSONException, CoreException, URISyntaxException {
File gitDir = GitUtils.getGitDir(path.removeFirstSegments(1).uptoSegment(2));
if (gitDir == null)
return false; // TODO: or an error response code, 405?
db = new FileRepository(gitDir);
JSONObject requestObject = OrionServlet.readJSONRequest(request);
String commitToMerge = requestObject.optString(GitConstants.KEY_MERGE, null);
if (commitToMerge != null) {
return merge(request, response, db, commitToMerge);
}
// continue with creating new commit location
String newCommitToCreatelocation = requestObject.optString(GitConstants.KEY_COMMIT_NEW, null);
if (newCommitToCreatelocation != null)
return createCommitLocation(request, response, db, newCommitToCreatelocation);
// continue with commit
if (path.segmentCount() > 3) {
return statusHandler.handleRequest(request, response, new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_NOT_IMPLEMENTED, "Committing by path is not yet supported.", null));
}
ObjectId refId = db.resolve(path.segment(0));
if (refId == null || !Constants.HEAD.equals(path.segment(0))) {
String msg = NLS.bind("Commit failed. Ref must be HEAD and is {0}", path.segment(0)); //$NON-NLS-1$
return statusHandler.handleRequest(request, response, new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_BAD_REQUEST, msg, null));
}
String message = requestObject.optString(GitConstants.KEY_COMMIT_MESSAGE, null);
if (message == null || message.isEmpty()) {
return statusHandler.handleRequest(request, response, new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_BAD_REQUEST, "Missing commit message.", null));
}
boolean amend = Boolean.parseBoolean(requestObject.optString(GitConstants.KEY_COMMIT_AMEND, null));
Git git = new Git(db);
// "git commit [--amend] -m '{message}' [-a|{path}]"
try {
git.commit().setAmend(amend).setMessage(message).call();
return true;
} catch (GitAPIException e) {
return statusHandler.handleRequest(request, response, new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_BAD_REQUEST, "An error occured when commiting.", e));
} catch (JGitInternalException e) {
return statusHandler.handleRequest(request, response, new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "An internal error occured when commiting.", e));
}
}
private boolean merge(HttpServletRequest request, HttpServletResponse response, Repository db, String commitToMerge) throws ServletException, JSONException {
try {
ObjectId objectId = db.resolve(commitToMerge);
Git git = new Git(db);
MergeResult mergeResult = git.merge().include(objectId).call();
JSONObject result = new JSONObject();
result.put(GitConstants.KEY_RESULT, mergeResult.getMergeStatus().name());
OrionServlet.writeJSONResponse(request, response, result);
return true;
} catch (IOException e) {
return statusHandler.handleRequest(request, response, new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "An error occured when merging.", e));
} catch (GitAPIException e) {
return statusHandler.handleRequest(request, response, new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "An error occured when merging.", e));
}
}
private boolean handlePut(HttpServletRequest request, HttpServletResponse response, Repository db, Path path) throws ServletException, IOException, JSONException, CoreException, URISyntaxException, JGitInternalException, GitAPIException {
File gitDir = GitUtils.getGitDir(path.removeFirstSegments(1));
if (gitDir == null)
return false; // TODO: or an error response code, 405?
db = new FileRepository(gitDir);
JSONObject toPut = OrionServlet.readJSONRequest(request);
String tagName = toPut.getString(ProtocolConstants.KEY_NAME);
if (tagName != null) {
return tag(request, response, db, path.segment(0), tagName);
}
return false;
}
private boolean tag(HttpServletRequest request, HttpServletResponse response, Repository db, String commitId, String tagName) throws AmbiguousObjectException, IOException, JGitInternalException, GitAPIException, JSONException, URISyntaxException {
Git git = new Git(db);
ObjectId objectId = db.resolve(commitId);
RevWalk walk = new RevWalk(db);
RevCommit revCommit = walk.lookupCommit(objectId);
walk.parseBody(revCommit);
GitTagHandlerV1.tag(git, revCommit, tagName);
JSONObject result = toJSON(db, revCommit, OrionServlet.getURI(request));
OrionServlet.writeJSONResponse(request, response, result);
walk.dispose();
return true;
}
// from https://gist.github.com/839693, credits to zx
private static Set<Ref> getTagsForCommit(Repository repo, RevCommit commit) throws MissingObjectException, IOException {
final Set<Ref> tags = new HashSet<Ref>();
final RevWalk walk = new RevWalk(repo);
walk.reset();
for (final Ref ref : repo.getTags().values()) {
final RevObject obj = walk.parseAny(ref.getObjectId());
final RevCommit tagCommit;
if (obj instanceof RevCommit) {
tagCommit = (RevCommit) obj;
} else if (obj instanceof RevTag) {
tagCommit = walk.parseCommit(((RevTag) obj).getObject());
} else {
continue;
}
if (commit.equals(tagCommit) || walk.isMergedInto(commit, tagCommit)) {
tags.add(ref);
}
}
return tags;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
4488d63cf18e4b24b54180cd1c42f0c6bad3e82e | 13653238ee42303f5f7659ca9d6ded8239f31c70 | /src/main/java/org/team2053/GUI.java | 076f0cb6d8f676e67d9b04b1c75da9b8fb28f9b3 | [] | no_license | frc2053/MecanumPathGenerator | 773b40727034a879338d8f6cb18a4712e5d0b920 | 1b5cc54beb17b6dd054431d5bc33c1603ce24992 | refs/heads/master | 2021-10-24T01:25:34.508238 | 2019-03-21T10:16:32 | 2019-03-21T10:16:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 153 | java | package org.team2053;
public class GUI {
public static void main(String[] args) {
Main main = new Main();
main.runMe(args);
}
} | [
"williams.r.drew@gmail.com"
] | williams.r.drew@gmail.com |
df393acb5d8b6325e964ca429c8a0d8eb9e4b8fb | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/7/7_265a55954d10ff9e4cd1f2b3a6b11852b1e8323c/SAML2AuthenticationHandler/7_265a55954d10ff9e4cd1f2b3a6b11852b1e8323c_SAML2AuthenticationHandler_s.java | 4322a14c917f9b94b80b1317c9f550ee3e425dcd | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 16,536 | java | /*
* JBoss, Home of Professional Open Source.
* Copyright 2008, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.picketlink.identity.federation.web.handlers.saml2;
import java.io.StringWriter;
import java.security.Principal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpSession;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
import org.apache.log4j.Logger;
import org.picketlink.identity.federation.api.saml.v2.request.SAML2Request;
import org.picketlink.identity.federation.api.saml.v2.response.SAML2Response;
import org.picketlink.identity.federation.core.exceptions.ConfigurationException;
import org.picketlink.identity.federation.core.exceptions.ProcessingException;
import org.picketlink.identity.federation.core.saml.v2.common.IDGenerator;
import org.picketlink.identity.federation.core.saml.v2.constants.JBossSAMLURIConstants;
import org.picketlink.identity.federation.core.saml.v2.exceptions.IssueInstantMissingException;
import org.picketlink.identity.federation.core.saml.v2.holders.IDPInfoHolder;
import org.picketlink.identity.federation.core.saml.v2.holders.IssuerInfoHolder;
import org.picketlink.identity.federation.core.saml.v2.holders.SPInfoHolder;
import org.picketlink.identity.federation.core.saml.v2.interfaces.SAML2HandlerRequest;
import org.picketlink.identity.federation.core.saml.v2.interfaces.SAML2HandlerResponse;
import org.picketlink.identity.federation.core.saml.v2.interfaces.SAML2HandlerRequest.GENERATE_REQUEST_TYPE;
import org.picketlink.identity.federation.core.saml.v2.util.AssertionUtil;
import org.picketlink.identity.federation.core.saml.v2.util.StatementUtil;
import org.picketlink.identity.federation.saml.v2.assertion.AssertionType;
import org.picketlink.identity.federation.saml.v2.assertion.AttributeStatementType;
import org.picketlink.identity.federation.saml.v2.assertion.AttributeType;
import org.picketlink.identity.federation.saml.v2.assertion.EncryptedElementType;
import org.picketlink.identity.federation.saml.v2.assertion.NameIDType;
import org.picketlink.identity.federation.saml.v2.assertion.SubjectType;
import org.picketlink.identity.federation.saml.v2.protocol.AuthnRequestType;
import org.picketlink.identity.federation.saml.v2.protocol.ResponseType;
import org.picketlink.identity.federation.saml.v2.protocol.StatusType;
import org.picketlink.identity.federation.web.constants.GeneralConstants;
import org.picketlink.identity.federation.web.core.HTTPContext;
import org.picketlink.identity.federation.web.core.IdentityServer;
import org.picketlink.identity.federation.web.interfaces.IRoleValidator;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
/**
* Handles for dealing with SAML2 Authentication
* @author Anil.Saldhana@redhat.com
* @since Oct 8, 2009
*/
public class SAML2AuthenticationHandler extends BaseSAML2Handler
{
private static Logger log = Logger.getLogger(SAML2AuthenticationHandler.class);
private boolean trace = log.isTraceEnabled();
private IDPAuthenticationHandler idp = new IDPAuthenticationHandler();
private SPAuthenticationHandler sp = new SPAuthenticationHandler();
public void handleRequestType(SAML2HandlerRequest request, SAML2HandlerResponse response) throws ProcessingException
{
if(request.getSAML2Object() instanceof AuthnRequestType == false)
return ;
if(getType() == HANDLER_TYPE.IDP)
{
idp.handleRequestType(request, response);
}
else
{
sp.handleRequestType(request, response);
}
}
public void handleStatusResponseType(SAML2HandlerRequest request, SAML2HandlerResponse response)
throws ProcessingException
{
if(request.getSAML2Object() instanceof ResponseType == false)
return ;
if(getType() == HANDLER_TYPE.IDP)
{
idp.handleStatusResponseType(request, response);
}
else
{
sp.handleStatusResponseType(request, response);
}
}
public void generateSAMLRequest(SAML2HandlerRequest request, SAML2HandlerResponse response)
throws ProcessingException
{
if(GENERATE_REQUEST_TYPE.AUTH != request.getTypeOfRequestToBeGenerated())
return;
if(getType() == HANDLER_TYPE.IDP)
{
idp.generateSAMLRequest(request, response);
response.setSendRequest(true);
}
else
{
sp.generateSAMLRequest(request, response);
response.setSendRequest(true);
}
}
private class IDPAuthenticationHandler
{
public void generateSAMLRequest(SAML2HandlerRequest request,
SAML2HandlerResponse response) throws ProcessingException
{
}
public void handleStatusResponseType( SAML2HandlerRequest request,
SAML2HandlerResponse response ) throws ProcessingException
{
}
@SuppressWarnings("unchecked")
public void handleRequestType( SAML2HandlerRequest request,
SAML2HandlerResponse response ) throws ProcessingException
{
HTTPContext httpContext = (HTTPContext) request.getContext();
ServletContext servletContext = httpContext.getServletContext();
AuthnRequestType art = (AuthnRequestType) request.getSAML2Object();
HttpSession session = BaseSAML2Handler.getHttpSession(request);
Principal userPrincipal = (Principal) session.getAttribute(GeneralConstants.PRINCIPAL_ID);
if(userPrincipal == null)
userPrincipal = httpContext.getRequest().getUserPrincipal();
List<String> roles = (List<String>) session.getAttribute(GeneralConstants.ROLES_ID);
try
{
Map<String,Object> attribs = (Map<String, Object>) request.getOptions().get(GeneralConstants.ATTRIBUTES);
long assertionValidity = (Long) request.getOptions().get(GeneralConstants.ASSERTIONS_VALIDITY);
String destination = art.getAssertionConsumerServiceURL();
Document samlResponse = this.getResponse(destination,
userPrincipal, roles, request.getIssuer().getValue(),
attribs,
assertionValidity);
//Update the Identity Server
IdentityServer identityServer = (IdentityServer) servletContext.getAttribute(GeneralConstants.IDENTITY_SERVER);
identityServer.stack().register(session.getId(), destination);
response.setDestination(destination);
response.setResultingDocument(samlResponse);
response.setRelayState(request.getRelayState());
}
catch(Exception e)
{
log.error("Exception in processing authentication:", e);
throw new ProcessingException("authentication issue");
}
}
public Document getResponse( String assertionConsumerURL,
Principal userPrincipal,
List<String> roles,
String identityURL,
Map<String, Object> attribs,
long assertionValidity)
throws ConfigurationException, IssueInstantMissingException
{
Document samlResponseDocument = null;
if(trace)
log.trace("AssertionConsumerURL=" + assertionConsumerURL +
"::assertion validity=" + assertionValidity);
ResponseType responseType = null;
SAML2Response saml2Response = new SAML2Response();
//Create a response type
String id = IDGenerator.create("ID_");
IssuerInfoHolder issuerHolder = new IssuerInfoHolder(identityURL);
issuerHolder.setStatusCode(JBossSAMLURIConstants.STATUS_SUCCESS.get());
IDPInfoHolder idp = new IDPInfoHolder();
idp.setNameIDFormatValue(userPrincipal.getName());
idp.setNameIDFormat(JBossSAMLURIConstants.NAMEID_FORMAT_PERSISTENT.get());
SPInfoHolder sp = new SPInfoHolder();
sp.setResponseDestinationURI(assertionConsumerURL);
responseType = saml2Response.createResponseType(id, sp, idp, issuerHolder);
//Add information on the roles
AssertionType assertion = (AssertionType) responseType.getAssertionOrEncryptedAssertion().get(0);
AttributeStatementType attrStatement = StatementUtil.createAttributeStatement(roles);
assertion.getStatementOrAuthnStatementOrAuthzDecisionStatement().add(attrStatement);
//Add timed conditions
saml2Response.createTimedConditions(assertion, assertionValidity);
//Add in the attributes information
if(attribs != null)
{
AttributeStatementType attStatement = StatementUtil.createAttributeStatement(attribs);
assertion.getStatementOrAuthnStatementOrAuthzDecisionStatement().add(attStatement);
}
//Lets see how the response looks like
if(log.isTraceEnabled())
{
StringWriter sw = new StringWriter();
try
{
saml2Response.marshall(responseType, sw);
}
catch (JAXBException e)
{
log.trace(e);
}
catch (SAXException e)
{
log.trace(e);
}
log.trace("Response="+sw.toString());
}
try
{
samlResponseDocument = saml2Response.convert(responseType);
}
catch (Exception e)
{
if(trace)
log.trace(e);
}
return samlResponseDocument;
}
}
private class SPAuthenticationHandler
{
public void generateSAMLRequest(SAML2HandlerRequest request,
SAML2HandlerResponse response) throws ProcessingException
{
String issuerValue = request.getIssuer().getValue();
SAML2Request samlRequest = new SAML2Request();
String id = IDGenerator.create("ID_");
try
{
AuthnRequestType authn = samlRequest.createAuthnRequestType(id,
issuerValue, response.getDestination(), issuerValue);
response.setResultingDocument(samlRequest.convert(authn));
response.setSendRequest(true);
}
catch (Exception e)
{
throw new ProcessingException(e);
}
}
public void handleStatusResponseType( SAML2HandlerRequest request,
SAML2HandlerResponse response ) throws ProcessingException
{
HTTPContext httpContext = (HTTPContext) request.getContext();
ResponseType responseType = (ResponseType) request.getSAML2Object();
List<Object> assertions = responseType.getAssertionOrEncryptedAssertion();
if(assertions.size() == 0)
throw new IllegalStateException("No assertions in reply from IDP");
Object assertion = assertions.get(0);
if(assertion instanceof EncryptedElementType)
{
responseType = this.decryptAssertion(responseType);
}
Principal userPrincipal = handleSAMLResponse(responseType, response);
if(userPrincipal == null)
{
response.setError(403, "User Principal not determined: Forbidden");
}
else
{
//add it to the session
HttpSession session = httpContext.getRequest().getSession(false);
session.setAttribute(GeneralConstants.PRINCIPAL_ID, userPrincipal);
}
}
public void handleRequestType( SAML2HandlerRequest request,
SAML2HandlerResponse response ) throws ProcessingException
{
}
private ResponseType decryptAssertion(ResponseType responseType)
{
throw new RuntimeException("This authenticator does not handle encryption");
}
@SuppressWarnings("unchecked")
private Principal handleSAMLResponse(ResponseType responseType, SAML2HandlerResponse response)
throws ProcessingException
{
if(responseType == null)
throw new IllegalArgumentException("response type is null");
StatusType statusType = responseType.getStatus();
if(statusType == null)
throw new IllegalArgumentException("Status Type from the IDP is null");
String statusValue = statusType.getStatusCode().getValue();
if(JBossSAMLURIConstants.STATUS_SUCCESS.get().equals(statusValue) == false)
throw new SecurityException("IDP forbid the user");
List<Object> assertions = responseType.getAssertionOrEncryptedAssertion();
if(assertions.size() == 0)
throw new IllegalStateException("No assertions in reply from IDP");
AssertionType assertion = (AssertionType)assertions.get(0);
//Check for validity of assertion
boolean expiredAssertion;
try
{
expiredAssertion = AssertionUtil.hasExpired(assertion);
}
catch (ConfigurationException e)
{
throw new ProcessingException(e);
}
if(expiredAssertion)
{
throw new ProcessingException("Assertion has expired");
}
SubjectType subject = assertion.getSubject();
JAXBElement<NameIDType> jnameID = (JAXBElement<NameIDType>) subject.getContent().get(0);
NameIDType nameID = jnameID.getValue();
final String userName = nameID.getValue();
List<String> roles = new ArrayList<String>();
//Let us get the roles
AttributeStatementType attributeStatement = (AttributeStatementType) assertion.getStatementOrAuthnStatementOrAuthzDecisionStatement().get(0);
List<Object> attList = attributeStatement.getAttributeOrEncryptedAttribute();
for(Object obj:attList)
{
AttributeType attr = (AttributeType) obj;
String roleName = (String) attr.getAttributeValue().get(0);
roles.add(roleName);
}
response.setRoles(roles);
Principal principal = new Principal()
{
public String getName()
{
return userName;
}
};
if(handlerChainConfig.getParameter(GeneralConstants.ROLE_VALIDATOR_IGNORE) == null)
{
//Validate the roles
IRoleValidator roleValidator =
(IRoleValidator) handlerChainConfig.getParameter(GeneralConstants.ROLE_VALIDATOR);
if(roleValidator == null)
throw new ProcessingException("Role Validator not provided");
boolean validRole = roleValidator.userInRole(principal, roles);
if(!validRole)
{
if(trace)
log.trace("Invalid role:" + roles);
principal = null;
}
}
return principal;
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
bfca3670f49998a3fffc160cc066542f5f5861d0 | 486fa1feab52d801dc26876f8a4fa3c423805f5e | /src/j_collection/ArrayListTest.java | 6e817ab47e0fdbe860463cb99a75834f415bb2e8 | [] | no_license | YooDaYeon/ddit-myBasicJava | f6625d21410d45019dfae94e7b049750cc7ddc02 | 3dbf97cfe8bf6777de93557bd6c854a3a83dbf0d | refs/heads/master | 2020-07-14T09:00:59.084347 | 2019-08-30T02:25:20 | 2019-08-30T09:44:44 | 205,288,666 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,060 | java | package j_collection;
import java.util.*;
public class ArrayListTest {
public static void main(String[] args) {
List<Integer> list1 = new ArrayList<Integer>();
list1.add(new Integer(5));
list1.add(new Integer(2));
list1.add(3);
list1.add(1);
list1.add(4);
System.out.println(list1); //toString메서드가 오버라이딩 되어있어서 값이 나옴
//정렬해주는 메서드
Collections.sort(list1);
System.out.println(list1);
ArrayList<Integer> list2 = new ArrayList<Integer>(list1.subList(1, 4));
System.out.println(list2);
//delete
System.out.println(list2.remove(new Integer(1))); //지우면 true 값없어서 못지우면 false
//select
System.out.println(list2.get(1));
//insert
list2.add(1, 15); //2 15 3 4
System.out.println(list2);
//update
list2.set(2, 22); //2번방 값을 22로 변경
System.out.println(list2);
System.out.println(list1.contains(4));
System.out.println(list1.containsAll(list2));
}
}
| [
"ekfdus789934@gmail.com"
] | ekfdus789934@gmail.com |
dfac4949d6ad4bd63a712bc81326eba23eeb0f53 | 1d9121f9363709298392f11b2ea40d8fcb21c870 | /app/build/generated/source/buildConfig/androidTest/debug/com/example/sqlite/test/BuildConfig.java | 49a29c48a7ea81c0f98da33caadecc7de13a4678 | [] | no_license | MGarcia28/Sqlite | 3a8da603dc1395d2a4a899da01392deed01a6e7c | 9362a229aee5fab63943010d54e28997441dd381 | refs/heads/master | 2020-03-30T03:27:24.266583 | 2018-09-28T05:30:45 | 2018-09-28T05:30:45 | 150,690,185 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 451 | java | /**
* Automatically generated file. DO NOT MODIFY
*/
package com.example.sqlite.test;
public final class BuildConfig {
public static final boolean DEBUG = Boolean.parseBoolean("true");
public static final String APPLICATION_ID = "com.example.sqlite.test";
public static final String BUILD_TYPE = "debug";
public static final String FLAVOR = "";
public static final int VERSION_CODE = -1;
public static final String VERSION_NAME = "";
}
| [
"mgl.inf28@gmail.com"
] | mgl.inf28@gmail.com |
ed27a8623e57ab2ad07f8b1dfb9cde84141f1ec4 | 7f6e5801622089f9db49eb0ca86e5d6877f11695 | /src/main/java/fr/manu/petitesannonces/web/constantes/Constantes.java | cdf189ad9d06a7460d3c5efa447539033ce7dca5 | [] | no_license | manumura/spring-mvc-petitesannonces | ed3f7a5d846d261a745a13cc7fa0e8be0f075b4c | c98fc99cc0ee74eecfcc91ec0bb052790b29632e | refs/heads/master | 2020-03-22T04:02:35.684925 | 2019-01-05T08:09:55 | 2019-01-05T08:09:55 | 136,021,448 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,417 | java | /**
*
*/
package fr.manu.petitesannonces.web.constantes;
/**
* @author Manu
*
*/
public final class Constantes {
public static final String APPLICATION_NAME = "petitesannonces";
public static final String ROLE_PREFIX = "ROLE_";
public static final String ROLE_USER = "ROLE_USER";
public static final String ROLE_ADMIN = "ROLE_ADMIN";
public static final String DATE_FORMAT = "dd/MM/yyyy";
public static final String FACEBOOK_DATE_FORMAT = "MM/dd/yyyy";
public static final String FACEBOOK_YEAR_FORMAT = "yyyy";
public static final String FACEBOOK_MONTH_AND_DAY_FORMAT = "MM/dd";
public static final String TOKEN_SECRET = "manu_punk";
public static final String REMEMBER_ME_KEY = "remember-me-secret-key";
public static final String AUTHENTICATION_USER_LOGIN = "AUTHENTICATION_USER_LOGIN";
public static final String AUTHENTICATION_LAST_EXCEPTION = "AUTHENTICATION_LAST_EXCEPTION";
public static final String USER_LOGIN = "USER_LOGIN";
public static final String REDIRECT_TO = "redirect:%s";
public static final String CHANGE_PASSWORD_PRIVILEGE = "CHANGE_PASSWORD_PRIVILEGE";
public static final String LOGIN_PARAMETER = "login";
public static final String PASSWORD_PARAMETER = "password";
public static final String TOKEN_PARAMETER = "token";
public static final String KEY_PARAMETER = "key";
private Constantes() {
}
}
| [
"manumura@yahoo.com"
] | manumura@yahoo.com |
85df536b6b7694f79bb341cd78e20ba7e07b851b | 01c0b091fd9833e94ea3b104bafdadafdb3c3e0a | /src/ru/spbstu/telematics/stud/annotations/AnnotationExample.java | b2ab404b686783c8e7ba457467be9f87c83e7ffa | [] | no_license | 1ukash/java_examples_2010au | 7e53742c5395668e1afca60d947eea7b296f8c73 | cfe1217abb9f8e980d546fa9711a0d8a9013bb7b | refs/heads/master | 2021-01-22T06:02:12.759293 | 2010-12-14T09:24:06 | 2010-12-14T09:24:06 | 994,807 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 463 | java | package ru.spbstu.telematics.stud.annotations;
import java.util.ArrayList;
import java.util.List;
/**
*
* @author lukash
*/
public class AnnotationExample {
@Description(title = "foo", version = 2)
class Foo {
int field;
@SuppressWarnings({ "rawtypes", "unused" })
void bar() {
List l = new ArrayList();
}
}
class Baz extends Foo {
@Override
void bar() {
super.bar();
}
}
@Deprecated
private void foo() {
}
}
| [
"alexey@lukash.spb.ru"
] | alexey@lukash.spb.ru |
3c1631b2673e2ad284ba53c3b05b8667ac5775a3 | 4ed1c0e3898559ed9b9f9830c9f82ba308d12b8b | /src/gti350/slalom/activities/ContestantListActivity.java | 07f9ef146efb44847445457d3fce9e74b6dd426e | [] | no_license | Samy104/GTI350TP1 | 5aadf204c675ad8b8f7e28478171f165b2de0e03 | ad170d62b3a961451aac4cb254b070178026338b | refs/heads/master | 2020-05-29T15:19:39.387771 | 2015-06-24T15:07:40 | 2015-06-24T15:07:40 | 37,990,988 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,810 | java | package gti350.slalom.activities;
import gti350.slalom.R;
import gti350.slalom.models.Contestant;
import gti350.slalom.models.ContestantList;
import java.util.ArrayList;
import java.util.List;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
public class ContestantListActivity extends Activity implements OnClickListener {
ListView listView;
Button buttonBack;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_contestant_list);
// find controls
listView = (ListView)findViewById(R.id.genericListView);
buttonBack = (Button)findViewById(R.id.buttonBack);
// fill list view
fillListView();
// add listeners
buttonBack.setOnClickListener(this);
}
private void fillListView() {
ArrayList<Contestant> all = ContestantList.getInstance().getContestants();
List<String> raw = new ArrayList<String>();
for (Contestant c: all) {
raw.add(c.toString());
}
ArrayAdapter<String> adapter1 = new ArrayAdapter<String>(getBaseContext(), R.layout.simple_list_item_1, raw);
listView.setAdapter(adapter1);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.contestant_list, menu);
return true;
}
@Override
public void onClick(View arg0) {
if (arg0 == buttonBack) {
Intent i = new Intent(getBaseContext(), MainActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
startActivity(i);
}
}
}
| [
"samy104@gmail.com"
] | samy104@gmail.com |
401013f59b0e2ae1c8d909ea5092440d27a4d77a | 2d0096a122580f73fdb1f410323185abbfe7f819 | /ClientOnboading-camunda/src/main/java/com/realcoderz/services/InterviwerServiceImpl.java | c4f5e815618f78755152f6a9dbf33568184e19bd | [
"Apache-2.0"
] | permissive | arvindrealcoderz/camunda | 5a58f8eed00b91b827d55b9771ceb296afd99d11 | 78ee20318110acb11eb45b26c5840fee889a1882 | refs/heads/master | 2023-07-12T11:56:36.402149 | 2021-08-13T14:30:09 | 2021-08-13T14:30:09 | 379,547,021 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,429 | java | package com.realcoderz.services;
import java.util.List;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.realcoderz.entity.InterView;
import com.realcoderz.repository.IInterviwerRepo;
@Service("interviwerService")
public class InterviwerServiceImpl implements IInterviwerService {
@Autowired
private IInterviwerRepo repo;
@Override
public String saveInterviewerDeatils(InterView interview) {
return repo.save( interview)!=null?"interviwer data has save ":"Interview Data has not save";
}
@Override
public List<InterView> getAllInterviwer(String profile,String category){
return repo.getAllInterviwer(profile, category);
}
@Override
public List<InterView> getAllInterviwerDetails() {
return repo.getAllInterviwerDetails();
}
@Override
public Long countInterviewer() {
return repo.count();
}
@Override
public List<InterView> getAllInterviwerProfileBased(String category) {
System.out.println("-----------------category--------"+category);
return repo.getAllInterviwerProfileBased(category);
}
@Override
public String delete(Integer id) {
Optional<InterView> opt= repo.findById(id);
if(opt!=null) {
repo.deleteById(id);
return "Your Recored are deleted ";
}
else
return "Your Recored are not deleted ";
}
} | [
"Arvind@DESKTOP-4NONCLR.Dlink"
] | Arvind@DESKTOP-4NONCLR.Dlink |
b13581ec98e133d986f6adfe548aacaa605a99a1 | 9cc8f13406161c1c56d9cab8be32d2210c679222 | /java/src/Coffee/CoffeeWithHook.java | 39758e00fb5e3926c82865e4a164630965cfecd8 | [] | no_license | codegold/Design_Patterns | 5cc3c6c2f6dcd52d289b19dc86f672bf0bf52cda | 73b7b8e424c31c9876e7fb235cd5adf51ddd5c8a | refs/heads/master | 2022-11-13T09:27:00.209897 | 2020-06-29T20:06:08 | 2020-06-29T20:06:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,097 | java | package src.Coffee;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class CoffeeWithHook extends CaffeineBeverage {
@Override
void brew() {
System.out.println("Dripping Coffee through filter.");
}
@Override
void addCondiments() {
System.out.println("Adding sugar and milk.");
}
public boolean customerWantsCondiments() {
String answer = getUserInput();
if (answer.toLowerCase().startsWith("y")) {
return true;
} else {
return false;
}
}
private String getUserInput() {
String answer = null;
System.out.println("Would you like milk and sugar with your coffee (y/n)?");
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
try {
answer = in.readLine();
} catch (IOException ioe) {
System.err.println("IO error trying to read your answer");
}
if (answer == null) {
return "no";
}
return answer;
}
}
| [
"38310511+MaxRubshik@users.noreply.github.com"
] | 38310511+MaxRubshik@users.noreply.github.com |
2801814ac51ccf43db477c737306e288e81eeab4 | b42a2d6010c30dcdbc9056197cb641f86e85b196 | /app/src/main/java/com/exalogic/inmeghschool/API/MyRequestInterceptor.java | 205c134d48802c1bc5b37369abb0eabe167e750e | [] | no_license | akshay027/inMegh-Android | 5fe0693ec5c8a4cd2d3224701ff7ea10ad99591b | e192b3b752eba816871296e93cae9438d0e4390c | refs/heads/master | 2020-04-06T14:29:08.046451 | 2018-11-14T12:07:56 | 2018-11-14T12:07:56 | 157,542,961 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,051 | java | package com.exalogic.inmeghschool.API;
import android.content.Context;
import android.util.Log;
import com.exalogic.inmeghschool.Database.PreferencesManger;
import com.exalogic.inmeghschool.Utility.Constants;
import retrofit.RequestInterceptor;
/**
* Created by Shrey on 05-06-2016.
*/
public class MyRequestInterceptor implements RequestInterceptor {
Context context;
public MyRequestInterceptor(Context context) {
this.context = context;
}
@Override
public void intercept(RequestFacade request) {
String token = PreferencesManger.getStringFields(this.context, Constants.Pref.KEY_TOKEN);
if (token != null) {
Log.e("Token", "token-------------------------------" + token);
request.addHeader("Authorization", "Token token=" + token.replace("\"", ""));
//request.addHeader("Authorization", "Bearer 9e4952c254fedaa2c1e6eda30ed745ee9af8129432b99eb45c2d46744bac6b3f");
// 9e4952c254fedaa2c1e6eda30ed745ee9af8129432b99eb45c2d46744bac6b3f
}
}
}
| [
"akshay@exalogic.in"
] | akshay@exalogic.in |
53f3e5370661c605c55bb6b088d96c24164a97d5 | 3912e0becd6d9b42751c1e57d473447361309d2b | /src/main/java/com/abinbev/admin/requestDto/SignupDto.java | f49d4f26e1d231cdefd25d07a99766662cca08a3 | [] | no_license | sruthychandran/ABC | d1a67100c0065afb25d12de161eb44f5cc0b123d | ff7741346de0a0df1c5991f2db9e995f4e814ca4 | refs/heads/master | 2023-03-19T19:25:43.217522 | 2021-03-12T09:30:48 | 2021-03-12T09:30:48 | 337,995,733 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 374 | java | package com.abinbev.admin.requestDto;
import javax.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SignupDto {
@NotNull
private String username;
private String password;
private String reEnterPassword;
}
| [
"sruthy.kc@ndimensionz.com"
] | sruthy.kc@ndimensionz.com |
73cd9cc359f21cde9715f7cd1bcfea574833e71c | 4a6cc69db16aec71b8ac69abbe86ef427a71353e | /ebx/src/main/java/com/metservice/krypton/GridDecoder.java | e19defcb481253931b91057360cbc233fdaa82f3 | [] | no_license | craig-a-roach/geowx | 0532c1d4dbea383ad229200b208aaebbdbbe2b5d | 7cd7e2b7254f4a6b38762f4965dacb290f47bad1 | refs/heads/master | 2021-03-12T22:04:17.573558 | 2014-04-28T06:39:09 | 2014-04-28T06:39:09 | 9,379,471 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,890 | java | /*
* Copyright 2011 Meteorological Service of New Zealand Limited all rights reserved. No part of this work may be stored
* in a retrievable system, transmitted or reproduced in any way without the prior written permission of the
* Meteorological Service of New Zealand
*/
package com.metservice.krypton;
import com.metservice.cobalt.CobaltGeoLatitudeLongitude;
import com.metservice.cobalt.CobaltGeoMercator;
import com.metservice.cobalt.CobaltResolution;
/**
* @author roach
*/
class GridDecoder {
public KryptonGridDecode newGrid(SectionGD1Type00Reader r) {
if (r == null) throw new IllegalArgumentException("object is null");
final double lat1 = r.latitude1();
final double lon1 = r.longitude1();
final double lat2 = r.latitude2();
final double lon2 = r.longitude2();
final KryptonThinGrid oThin = r.createThinGrid();
final int nx = oThin == null ? r.NX() : oThin.nx;
final int ny = oThin == null ? r.NY() : oThin.ny;
final double dx = oThin == null ? r.DX() : oThin.dx;
final double dy = oThin == null ? r.DY() : oThin.dy;
final KryptonArrayFactory af = new KryptonArrayFactory(nx, ny);
final GridScan scan = new GridScan(af, r.scanningMode());
final GeoProjectorLatitudeLongitude prj = new GeoProjectorLatitudeLongitude(scan, dx, dy, lat1, lon1, lat2, lon2, oThin);
final CobaltGeoLatitudeLongitude geo = CobaltGeoLatitudeLongitude.newInstance(prj.nlat, prj.wlon, prj.slat, prj.elon);
final CobaltResolution resolution = CobaltResolution.newDegrees(dy, dx);
return new KryptonGridDecode(af, geo, resolution, prj);
}
public KryptonGridDecode newGrid(SectionGD1Type01Reader r) {
if (r == null) throw new IllegalArgumentException("object is null");
final double lat1 = r.latitude1();
final double lon1 = r.longitude1();
final double lat2 = r.latitude2();
final double lon2 = r.longitude2();
final double latin = r.latitudeCylinderIntersection();
final double dx = r.DX();
final double dy = r.DY();
final KryptonArrayFactory af = new KryptonArrayFactory(r.NX(), r.NY());
final CobaltGeoMercator geo = CobaltGeoMercator.newInstance(lat1, lon1, lat2, lon2, latin);
final CobaltResolution resolution = CobaltResolution.newMetres(dy, dx);
return new KryptonGridDecode(af, geo, resolution, null);
}
public KryptonGridDecode newGrid(SectionGD2Template00Reader r)
throws KryptonCodeException {
if (r == null) throw new IllegalArgumentException("object is null");
final String Template = "3.0";
final int resolutionFlags = r.resolutionFlags();
final boolean resolutionGivenX = (resolutionFlags & 0x20) != 0;
final boolean resolutionGivenY = (resolutionFlags & 0x10) != 0;
if (!resolutionGivenX) {
final String m = "No X (" + resolutionFlags + ")";
throw new KryptonCodeException(CSection.GD2(Template, "resolutionFlags"), m);
}
if (!resolutionGivenY) {
final String m = "No Y (" + resolutionFlags + ")";
throw new KryptonCodeException(CSection.GD2(Template, "resolutionFlags"), m);
}
final double angleUnit = r.angleUnit();
final double lat1 = angleUnit * r.latitude1();
final double lon1 = angleUnit * r.longitude1();
final double lat2 = angleUnit * r.latitude2();
final double lon2 = angleUnit * r.longitude2();
final int nx = r.NX();
final int ny = r.NY();
final double dx = angleUnit * r.DX();
final double dy = angleUnit * r.DY();
final KryptonArrayFactory af = new KryptonArrayFactory(nx, ny);
final GridScan scan = new GridScan(af, r.scanningMode());
final GeoProjectorLatitudeLongitude prj = new GeoProjectorLatitudeLongitude(scan, dx, dy, lat1, lon1, lat2, lon2, null);
final CobaltGeoLatitudeLongitude geo = CobaltGeoLatitudeLongitude.newInstance(prj.nlat, prj.wlon, prj.slat, prj.elon);
final CobaltResolution resolution = CobaltResolution.newDegrees(dy, dx);
return new KryptonGridDecode(af, geo, resolution, prj);
}
public GridDecoder() {
}
}
| [
"roach@metservice.com"
] | roach@metservice.com |
537822634fdedffebbd379691a17f7d88101b958 | 4dcd41ddff22a91533d12bea454f6004dd72debc | /li3j/proj-java/src/main/java/engine/BaseDeDados/ParsePosts.java | a7726c8315bd1958d7192662233078d59611b6f8 | [] | no_license | FlavioMartins93/LI3 | d5a3ee8e43e0eeb5acb39f3723b65f79debe5fb3 | f966a3223139fd58a2112a697d60d36bbf081f25 | refs/heads/master | 2022-12-26T07:03:24.246981 | 2020-09-23T15:37:04 | 2020-09-23T15:37:04 | 298,016,293 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,337 | java | package engine.BaseDeDados;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
import Utilizadores.*;
import Posts.*;
import EstruturasAuxiliares.*;
/**
* Nesta classe é implementado o parse do ficheiro "Posts.xml"
*
* @author Flávio Martins, Mário Santos, Pedro Costa
*/
public class ParsePosts extends DefaultHandler {
//listas de perguntas, respostas e utilizadores
private HashPerguntas hashPerg = new HashPerguntas();
private Pergunta perg = null;
private HashRespostas hashResp = new HashRespostas();
private Resposta resp = null;
private HashRespostasPorPergunta respsPorPergunta = new HashRespostasPorPergunta();
private HashUtilizadores hashUtil;
private Utilizador util = null;
private TreeMapPosts treeRespsDate = new TreeMapPosts();
private TreeMapPosts treePergsDate = new TreeMapPosts();
private long owner;
private List<Long> listaIds;
private ParIdDate parIdDate;
//set lista de utilizador já inicializada anteriormente
public void setHashUtil(HashUtilizadores hu) {
hashUtil = new HashUtilizadores(hu);
}
//getters listas de Utilizadores, perguntas e respostas
public HashPerguntas getHashPerg() {
return this.hashPerg;
}
public HashRespostas getHashResp() {
return this.hashResp;
}
public HashUtilizadores getHashUtil() {
return this.hashUtil;
}
public HashRespostasPorPergunta getHashRespostasPorPergunta(){
return this.respsPorPergunta;
}
public TreeMapPosts getTreeRespsDate() {
return this.treeRespsDate;
}
public TreeMapPosts getTreePergsDate() {
return this.treePergsDate;
}
@Override
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
if (qName.equalsIgnoreCase("row")) {
if(attributes.getValue("PostTypeId").equals("1")) {
//inicializar pergunta e sets
perg = new Pergunta();
String temp = attributes.getValue("Id");
perg.setId(Long.parseLong(temp));
temp = attributes.getValue("OwnerUserId");
perg.setOwner(Long.parseLong(temp));
owner = Long.parseLong(temp);
temp = attributes.getValue("Title");
perg.setTitle(temp);
temp = attributes.getValue("Tags");
perg.setTags(temp);
temp = attributes.getValue("CreationDate");
StringTokenizer st = new StringTokenizer(temp, "T");
String data = (String) st.nextElement();
perg.setCreationDate(data);
this.hashPerg.inserirNovaPergunta(perg);
//if (this.hashUtil.existeUtilizador(owner)) {
util = this.hashUtil.getUtilizador(owner).clone();
util.incTotalPosts();
parIdDate = new ParIdDate();
parIdDate.setDate(perg.getCreationDate());
parIdDate.setId(perg.getId());
util.adicionaPost(parIdDate);
this.hashUtil.removerUtilizador(owner);
this.hashUtil.inserirNovoUtilizador(util);
//}
if (this.treePergsDate.containsKey(perg.getCreationDate())) {
this.listaIds = this.treePergsDate.getListaIds(perg.getCreationDate());
} else {
this.listaIds = new ArrayList<Long>();
}
this.listaIds.add(perg.getId());
this.treePergsDate.adicionaListaIds(perg.getCreationDate(), this.listaIds);
}
if (attributes.getValue("PostTypeId").equals("2")) {
//inicializar resposta e sets
resp = new Resposta();
String temp = attributes.getValue("Id");
resp.setId(Long.parseLong(temp));
temp = attributes.getValue("OwnerUserId");
resp.setOwner(Long.parseLong(temp));
owner = Long.parseLong(temp);
temp = attributes.getValue("Score");
resp.setScore(Long.parseLong(temp));
temp = attributes.getValue("ParentId");
resp.setParentid(Long.parseLong(temp));
temp = attributes.getValue("CommentCount");
resp.setComCount(Long.parseLong(temp));
temp = attributes.getValue("CreationDate");
StringTokenizer st = new StringTokenizer(temp, "T");
String data = (String) st.nextElement();
resp.setCreationDate(data);
this.hashResp.inserirNovaResposta(resp);
// if (this.hashUtil.existeUtilizador(owner)) {
util = this.hashUtil.getUtilizador(owner).clone();
util.incTotalPosts();
parIdDate = new ParIdDate();
parIdDate.setDate(resp.getCreationDate());
parIdDate.setId(resp.getId());
util.adicionaPost(parIdDate);
this.hashUtil.removerUtilizador(owner);
this.hashUtil.inserirNovoUtilizador(util);
//}
if (this.treeRespsDate.containsKey(resp.getCreationDate())) {
this.listaIds = this.treeRespsDate.getListaIds(resp.getCreationDate());
} else {
this.listaIds = new ArrayList<Long>();
}
this.listaIds.add(resp.getId());
this.treeRespsDate.adicionaListaIds(resp.getCreationDate(), this.listaIds);
if (this.respsPorPergunta.containsKey(resp.getParentid())) {
this.listaIds = this.respsPorPergunta.getListaIds(resp.getParentid());
} else {
this.listaIds = new ArrayList<Long>();
}
this.listaIds.add(resp.getId());
this.respsPorPergunta.adicionaListaIds(resp.getParentid(), this.listaIds);
}
}
}
}
| [
"36973672+FlavioMartins93@users.noreply.github.com"
] | 36973672+FlavioMartins93@users.noreply.github.com |
e9b019e8c6b03489bad8c995205fd72f08d09603 | 085cfc7d0b52e5a51dcd272de5154151f7de173c | /ones-common/src/main/java/com/wsx/ones/common/util/ObjectByteUtil.java | c4752c3dd99a96a766964aae9886939aa5274570 | [] | no_license | jintian767/ones | e3e345a06c62b7766f731aabe3fe2e07ca9758ae | 1842c561fe859393536bb5df53796378b118bff1 | refs/heads/master | 2020-06-15T11:59:37.800649 | 2016-12-02T06:06:01 | 2016-12-02T06:06:01 | 75,296,349 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 828 | java | package com.wsx.ones.common.util;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
public class ObjectByteUtil {
public static byte[] object2Bytes(Object obj) throws IOException {
ByteArrayOutputStream boo = new ByteArrayOutputStream();
ObjectOutputStream oo = new ObjectOutputStream(boo);
oo.writeObject(obj);
byte[] bytes = boo.toByteArray();
oo.close();
boo.close();
return bytes;
}
public static Object bytes2Object(byte[] bytes) throws IOException, ClassNotFoundException {
ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
ObjectInputStream ois = new ObjectInputStream(bis);
Object obj = ois.readObject();
ois.close();
bis.close();
return obj;
}
}
| [
"513079859@qq.com"
] | 513079859@qq.com |
347c2ef8924bbb81ad5cc1f3b30767ff4507f8d2 | 29903674d6108262b016b4132300a8153917e6a5 | /eventuate-client-java-tests-example-domain/src/main/java/io/eventuate/example/banking/domain/AccountEvent.java | 142d26bb6c4b06787d96baab2a056341037995ed | [
"Apache-2.0"
] | permissive | eventuate-local/eventuate-local | 17bbcc7cfc88aeead2afe501ffa624ce91efd8e5 | 5bea88f7ddd41f53f7850724f3745f130a83d8c7 | refs/heads/master | 2023-08-31T08:06:27.246682 | 2023-08-23T04:43:40 | 2023-08-23T04:43:40 | 65,101,930 | 813 | 253 | NOASSERTION | 2023-01-27T02:50:46 | 2016-08-06T21:02:28 | Java | UTF-8 | Java | false | false | 223 | java | package io.eventuate.example.banking.domain;
import io.eventuate.Event;
import io.eventuate.EventEntity;
@EventEntity(entity="io.eventuate.example.banking.domain.Account")
public interface AccountEvent extends Event {
}
| [
"chris@chrisrichardson.net"
] | chris@chrisrichardson.net |
ba6ff3fe520fac511de66d4c1fc41ff111a9ba11 | ede98a99897fd14ae79b29436e5edb896f081a64 | /src/main/java/dao/Connector.java | 6175911ba5b44cda0db309fcdfc049d6d47835a1 | [] | no_license | alexandrgonchar/test | 9553db4779a7aef3d628e457f31e8482cda79868 | 90f84dfcd580a55efc1e1a7e62afee0ce9a31631 | refs/heads/master | 2021-07-10T09:37:29.706027 | 2017-10-10T10:39:00 | 2017-10-10T10:39:00 | 106,054,524 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,767 | java | package dao;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
/**
* Класс для предоставления доступа
* к базе данных
* @autor Александр
* @version 1.0
*/
public final class Connector {
/**
* Данные пользователя для доступа к базе
*/
private final String username;
private final String password;
private final String url;
private final String driver;
private final Connection connection;
/**
* @param username Логин пользователя
* @param password Пароль пользователя
* @param url URL адрес базы данных
* @param driver Имя драйвера
*/
Connector(String username, String password, String url, String driver) {
this.username = username;
this.password = password;
this.url = url;
this.driver = driver;
this.connection = createConnection();
}
/**
* @return соединение с базой данных
*/
Connection getConnection () {
return connection;
}
/**
* Метод создает доступ к базе данных с помощью данных пользователя.
* @return Connection
*/
private Connection createConnection () {
Connection createdConnection = null;
try {
Class.forName(driver);
createdConnection = DriverManager.getConnection(url, username, password);
System.out.println("ok");
} catch (ClassNotFoundException | SQLException e) {
e.printStackTrace();
}
return createdConnection;
}
}
| [
"alexandrgoncharuk45@gmail.com"
] | alexandrgoncharuk45@gmail.com |
9e23adc80f0c8bf15530019dc9d9b53b5eac42ef | 8290989b5bf2957b809765d5574a1345b31ee512 | /sort/Shell.java | 9c88354b5cf9d018ee325f1a5bfe80ddc75b3435 | [] | no_license | ht0919/java3 | b6ff4eb595268bed21a2659c760252a6556f396b | d1fb1a8f44e4d4b27c8009a26c7f338f62a0c1cc | refs/heads/master | 2020-08-03T20:09:21.554787 | 2017-03-04T06:16:12 | 2017-03-04T06:16:12 | 73,537,438 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 559 | java | public class Shell extends Sort {
TimerCount timer = new TimerCount();
public void sort(int[] a) {
timer.start(getClass().getSimpleName(), a.length);
int inc = 4;
while (inc > 0) {
for (int i=0; i < a.length; i++) {
int j = i;
int tmp = a[i];
while ((j >= inc) && (a[j-inc] > tmp)) {
a[j] = a[j - inc];
j = j - inc;
}
a[j] = tmp;
}
if (inc/2 != 0) inc = inc/2;
else if (inc == 1) inc = 0;
else inc = 1;
}
timer.stop();
}
}
| [
"ht0919@gmail.com"
] | ht0919@gmail.com |
32e2797777acdc09b57317fcb5c62f9015a43863 | 22bc654dbbba1a55ee0675479a71c438cf910776 | /NoCoinState.java | dab68a8a75eb022a545630f6f3adf94ffeb2f8ba | [] | no_license | gandhihardikm/Gumball_java_pattern_Interface | eec7e9fcd15a209fea813099ef4c96159f804cd8 | c5ea605292f5a30a39f67d02d4a0fa414b5764d4 | refs/heads/master | 2021-01-15T13:48:22.281950 | 2015-03-03T06:17:31 | 2015-03-03T06:17:31 | 31,582,783 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,097 | java | /**
* NoCoinState Class is used to indicate currently no coin present in GumballMachine.
* @author - Hardik Gandhi
* @date - 02/18/2015
*/
public class NoCoinState implements State {
GumballMachine gumballMachine;
// Constructor initialize gumballmachine object
public NoCoinState(GumballMachine gumballMachine) {
this.gumballMachine = gumballMachine;
}
//Coin insertion logic
public void insertCoin() {
gumballMachine.setState(gumballMachine.getHasCoinState()); // Assign HasCoinState
}
// Eject coin logic
public void ejectCoin() {
System.out.println("You haven't inserted a coin");
}
// crank turn logic when machine is at NoCoinState
public void turnCrank() {
System.out.println("You turned, but there's no coin");
}
// Dispense gumball from gumballmachine when machine has no coin
public void dispense() {
System.out.println("You need to pay first");
}
// Override toString method to print class message
public String toString() {
return "waiting for coin";
}
}
| [
"gandhihardikm@gmail.com"
] | gandhihardikm@gmail.com |
ebcd68f1573d457f100930c531162e5cd4635bbe | 29c28ac3270afe2df42c4119d5ebe18e24303248 | /phprpc/src/main/java/com/lvmama/phprpc/config/AbstractConfig.java | 3537c7380901ce21c6542ccb18c35d95a9a022be | [] | no_license | gqy2468/pjservice | 3a31975ce15106ce9cce9c34f235699553d97c1c | 253fe1ab9a7b81ef07a2fdf44225011c4ffab33b | refs/heads/master | 2022-11-07T09:39:02.399079 | 2020-06-12T08:30:32 | 2020-06-12T08:30:32 | 113,385,633 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 23,011 | java | /*
* Copyright 1999-2016 Joyo Group.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.lvmama.phprpc.config;
import java.io.Serializable;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.lvmama.phprpc.common.Constants;
import com.lvmama.phprpc.common.URL;
import com.lvmama.phprpc.common.extension.ExtensionLoader;
import com.lvmama.phprpc.common.utils.CollectionUtils;
import com.lvmama.phprpc.common.utils.ConfigUtils;
import com.lvmama.phprpc.common.utils.ReflectUtils;
import com.lvmama.phprpc.common.utils.StringUtils;
import com.lvmama.phprpc.common.Parameter;
/**
* 配置解析的工具方法、公共方法
*
* @author flashguo
* @export
*/
public abstract class AbstractConfig implements Serializable {
private static final long serialVersionUID = 4267533505537413570L;
protected static final Logger logger = LoggerFactory.getLogger(AbstractConfig.class);
private static final int MAX_LENGTH = 100;
private static final int MAX_PATH_LENGTH = 200;
private static final Pattern PATTERN_NAME = Pattern.compile("[\\-._0-9a-zA-Z]+");
private static final Pattern PATTERN_MULTI_NAME = Pattern.compile("[,\\-._0-9a-zA-Z]+");
private static final Pattern PATTERN_METHOD_NAME = Pattern.compile("[a-zA-Z][0-9a-zA-Z]*");
private static final Pattern PATTERN_PATH = Pattern.compile("[/\\-$._0-9a-zA-Z]+");
private static final Pattern PATTERN_NAME_HAS_SYMBOL = Pattern.compile("[:*,/\\-._0-9a-zA-Z]+");
private static final Pattern PATTERN_KEY = Pattern.compile("[*,\\-._0-9a-zA-Z]+");
protected String id;
@Parameter(excluded = true)
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
private static final Map<String, String> legacyProperties = new HashMap<String, String>();
static {
legacyProperties.put("thrift.protocol.name", "thrift.service.protocol");
legacyProperties.put("thrift.protocol.host", "thrift.service.server.host");
legacyProperties.put("thrift.protocol.port", "thrift.service.server.port");
legacyProperties.put("thrift.protocol.threads", "thrift.service.max.thread.pool.size");
legacyProperties.put("thrift.consumer.timeout", "thrift.service.invoke.timeout");
legacyProperties.put("thrift.consumer.retries", "thrift.service.max.retry.providers");
legacyProperties.put("thrift.consumer.check", "thrift.service.allow.no.provider");
legacyProperties.put("thrift.service.url", "thrift.service.address");
}
private static String convertLegacyValue(String key, String value) {
if (value != null && value.length() > 0) {
if ("thrift.service.max.retry.providers".equals(key)) {
return String.valueOf(Integer.parseInt(value) - 1);
} else if ("thrift.service.allow.no.provider".equals(key)) {
return String.valueOf(! Boolean.parseBoolean(value));
}
}
return value;
}
protected void appendAnnotation(Class<?> annotationClass, Object annotation) {
Method[] methods = annotationClass.getMethods();
for (Method method : methods) {
if (method.getDeclaringClass() != Object.class
&& method.getReturnType() != void.class
&& method.getParameterTypes().length == 0
&& Modifier.isPublic(method.getModifiers())
&& ! Modifier.isStatic(method.getModifiers())) {
try {
String property = method.getName();
if ("interfaceClass".equals(property) || "interfaceName".equals(property)) {
property = "interface";
}
String setter = "set" + property.substring(0, 1).toUpperCase() + property.substring(1);
Object value = method.invoke(annotation, new Object[0]);
if (value != null && ! value.equals(method.getDefaultValue())) {
Class<?> parameterType = ReflectUtils.getBoxedClass(method.getReturnType());
if ("filter".equals(property) || "listener".equals(property)) {
parameterType = String.class;
value = StringUtils.join((String[]) value, ",");
} else if ("parameters".equals(property)) {
parameterType = Map.class;
value = CollectionUtils.toStringMap((String[]) value);
}
try {
Method setterMethod = getClass().getMethod(setter, new Class<?>[] { parameterType });
setterMethod.invoke(this, new Object[] { value });
} catch (NoSuchMethodException e) {
// ignore
}
}
} catch (Throwable e) {
logger.error(e.getMessage(), e);
}
}
}
}
protected static void appendProperties(AbstractConfig config) {
if (config == null) {
return;
}
String prefix = "thrift." + getTagName(config.getClass()) + ".";
Method[] methods = config.getClass().getMethods();
for (Method method : methods) {
try {
String name = method.getName();
if (name.length() > 3 && name.startsWith("set") && Modifier.isPublic(method.getModifiers())
&& method.getParameterTypes().length == 1 && isPrimitive(method.getParameterTypes()[0])) {
String property = StringUtils.camelToSplitName(name.substring(3, 4).toLowerCase() + name.substring(4), "-");
String value = null;
if (config.getId() != null && config.getId().length() > 0) {
String pn = prefix + config.getId() + "." + property;
value = System.getProperty(pn);
if(! StringUtils.isBlank(value)) {
logger.info("Use System Property " + pn + " to config thrift");
}
}
if (value == null || value.length() == 0) {
String pn = prefix + property;
value = System.getProperty(pn);
if(! StringUtils.isBlank(value)) {
logger.info("Use System Property " + pn + " to config thrift");
}
}
if (value == null || value.length() == 0) {
Method getter;
try {
getter = config.getClass().getMethod("get" + name.substring(3), new Class<?>[0]);
} catch (NoSuchMethodException e) {
try {
getter = config.getClass().getMethod("is" + name.substring(3), new Class<?>[0]);
} catch (NoSuchMethodException e2) {
getter = null;
}
}
if (getter != null) {
if (getter.invoke(config, new Object[0]) == null) {
if (config.getId() != null && config.getId().length() > 0) {
value = ConfigUtils.getProperty(prefix + config.getId() + "." + property);
}
if (value == null || value.length() == 0) {
value = ConfigUtils.getProperty(prefix + property);
}
if (value == null || value.length() == 0) {
String legacyKey = legacyProperties.get(prefix + property);
if (legacyKey != null && legacyKey.length() > 0) {
value = convertLegacyValue(legacyKey, ConfigUtils.getProperty(legacyKey));
}
}
}
}
}
if (value != null && value.length() > 0) {
method.invoke(config, new Object[] {convertPrimitive(method.getParameterTypes()[0], value)});
}
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
}
}
private static String getTagName(Class<?> cls) {
String tag = cls.getSimpleName();
for (String suffix : SUFFIXS) {
if (tag.endsWith(suffix)) {
tag = tag.substring(0, tag.length() - suffix.length());
break;
}
}
tag = tag.toLowerCase();
return tag;
}
protected static void appendParameters(Map<String, String> parameters, Object config) {
appendParameters(parameters, config, null);
}
@SuppressWarnings("unchecked")
protected static void appendParameters(Map<String, String> parameters, Object config, String prefix) {
if (config == null) {
return;
}
Method[] methods = config.getClass().getMethods();
for (Method method : methods) {
try {
String name = method.getName();
if ((name.startsWith("get") || name.startsWith("is"))
&& ! "getClass".equals(name)
&& Modifier.isPublic(method.getModifiers())
&& method.getParameterTypes().length == 0
&& isPrimitive(method.getReturnType())) {
Parameter parameter = method.getAnnotation(Parameter.class);
if (method.getReturnType() == Object.class || parameter != null && parameter.excluded()) {
continue;
}
int i = name.startsWith("get") ? 3 : 2;
String prop = StringUtils.camelToSplitName(name.substring(i, i + 1).toLowerCase() + name.substring(i + 1), ".");
String key;
if (parameter != null && parameter.key() != null && parameter.key().length() > 0) {
key = parameter.key();
} else {
key = prop;
}
Object value = method.invoke(config, new Object[0]);
String str = String.valueOf(value).trim();
if (value != null && str.length() > 0) {
if (parameter != null && parameter.escaped()) {
str = URL.encode(str);
}
if (parameter != null && parameter.append()) {
String pre = (String)parameters.get(Constants.DEFAULT_KEY + "." + key);
if (pre != null && pre.length() > 0) {
str = pre + "," + str;
}
pre = (String)parameters.get(key);
if (pre != null && pre.length() > 0) {
str = pre + "," + str;
}
}
if (prefix != null && prefix.length() > 0) {
key = prefix + "." + key;
}
parameters.put(key, str);
} else if (parameter != null && parameter.required()) {
throw new IllegalStateException(config.getClass().getSimpleName() + "." + key + " == null");
}
} else if ("getParameters".equals(name)
&& Modifier.isPublic(method.getModifiers())
&& method.getParameterTypes().length == 0
&& method.getReturnType() == Map.class) {
Map<String, String> map = (Map<String, String>) method.invoke(config, new Object[0]);
if (map != null && map.size() > 0) {
String pre = (prefix != null && prefix.length() > 0 ? prefix + "." : "");
for (Map.Entry<String, String> entry : map.entrySet()) {
parameters.put(pre + entry.getKey().replace('-', '.'), entry.getValue());
}
}
}
} catch (Exception e) {
throw new IllegalStateException(e.getMessage(), e);
}
}
}
protected static void appendAttributes(Map<Object, Object> parameters, Object config) {
appendAttributes(parameters, config, null);
}
protected static void appendAttributes(Map<Object, Object> parameters, Object config, String prefix) {
if (config == null) {
return;
}
Method[] methods = config.getClass().getMethods();
for (Method method : methods) {
try {
String name = method.getName();
if ((name.startsWith("get") || name.startsWith("is"))
&& ! "getClass".equals(name)
&& Modifier.isPublic(method.getModifiers())
&& method.getParameterTypes().length == 0
&& isPrimitive(method.getReturnType())) {
Parameter parameter = method.getAnnotation(Parameter.class);
if (parameter == null || !parameter.attribute())
continue;
String key;
if (parameter != null && parameter.key() != null && parameter.key().length() > 0) {
key = parameter.key();
} else {
int i = name.startsWith("get") ? 3 : 2;
key = name.substring(i, i + 1).toLowerCase() + name.substring(i + 1);
}
Object value = method.invoke(config, new Object[0]);
if (value != null) {
if (prefix != null && prefix.length() > 0) {
key = prefix + "." + key;
}
parameters.put(key, value);
}
}
} catch (Exception e) {
throw new IllegalStateException(e.getMessage(), e);
}
}
}
private static boolean isPrimitive(Class<?> type) {
return type.isPrimitive()
|| type == String.class
|| type == Character.class
|| type == Boolean.class
|| type == Byte.class
|| type == Short.class
|| type == Integer.class
|| type == Long.class
|| type == Float.class
|| type == Double.class
|| type == Object.class;
}
private static Object convertPrimitive(Class<?> type, String value) {
if (type == char.class || type == Character.class) {
return value.length() > 0 ? value.charAt(0) : '\0';
} else if (type == boolean.class || type == Boolean.class) {
return Boolean.valueOf(value);
} else if (type == byte.class || type == Byte.class) {
return Byte.valueOf(value);
} else if (type == short.class || type == Short.class) {
return Short.valueOf(value);
} else if (type == int.class || type == Integer.class) {
return Integer.valueOf(value);
} else if (type == long.class || type == Long.class) {
return Long.valueOf(value);
} else if (type == float.class || type == Float.class) {
return Float.valueOf(value);
} else if (type == double.class || type == Double.class) {
return Double.valueOf(value);
}
return value;
}
protected static void checkExtension(Class<?> type, String property, String value) {
checkName(property, value);
if (value != null && value.length() > 0
&& ! ExtensionLoader.getExtensionLoader(type).hasExtension(value)) {
throw new IllegalStateException("No such extension " + value + " for " + property + "/" + type.getName());
}
}
protected static void checkMultiExtension(Class<?> type, String property, String value) {
checkMultiName(property, value);
if (value != null && value.length() > 0) {
String[] values = value.split("\\s*[,]+\\s*");
for (String v : values) {
if (v.startsWith(Constants.REMOVE_VALUE_PREFIX)) {
v = v.substring(1);
}
if (Constants.DEFAULT_KEY.equals(v)) {
continue;
}
if (! ExtensionLoader.getExtensionLoader(type).hasExtension(v)) {
throw new IllegalStateException("No such extension " + v + " for " + property + "/" + type.getName());
}
}
}
}
protected static void checkLength(String property, String value) {
checkProperty(property, value, MAX_LENGTH, null);
}
protected static void checkPathLength(String property, String value) {
checkProperty(property, value, MAX_PATH_LENGTH, null);
}
protected static void checkName(String property, String value) {
checkProperty(property, value, MAX_LENGTH, PATTERN_NAME);
}
protected static void checkNameHasSymbol(String property, String value) {
checkProperty(property, value, MAX_LENGTH, PATTERN_NAME_HAS_SYMBOL);
}
protected static void checkKey(String property, String value) {
checkProperty(property, value, MAX_LENGTH, PATTERN_KEY);
}
protected static void checkMultiName(String property, String value) {
checkProperty(property, value, MAX_LENGTH, PATTERN_MULTI_NAME);
}
protected static void checkPathName(String property, String value) {
checkProperty(property, value, MAX_PATH_LENGTH, PATTERN_PATH);
}
protected static void checkMethodName(String property, String value) {
checkProperty(property, value, MAX_LENGTH, PATTERN_METHOD_NAME);
}
protected static void checkParameterName(Map<String, String> parameters) {
if (parameters == null || parameters.size() == 0) {
return;
}
for (Map.Entry<String, String> entry : parameters.entrySet()) {
//change by tony.chenl parameter value maybe has colon.for example napoli address
checkNameHasSymbol(entry.getKey(), entry.getValue());
}
}
protected static void checkProperty(String property, String value, int maxlength, Pattern pattern) {
if (value == null || value.length() == 0) {
return;
}
if(value.length() > maxlength){
throw new IllegalStateException("Invalid " + property + "=\"" + value + "\" is longer than " + maxlength);
}
if (pattern != null) {
Matcher matcher = pattern.matcher(value);
if(! matcher.matches()) {
throw new IllegalStateException("Invalid " + property + "=\"" + value + "\" contain illegal charactor, only digit, letter, '-', '_' and '.' is legal.");
}
}
}
static {
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
public void run() {
if (logger.isInfoEnabled()) {
logger.info("Run shutdown hook now.");
}
ProtocolConfig.destroyAll();
}
}, "ThriftShutdownHook"));
}
private static final String[] SUFFIXS = new String[] {"Config", "Bean"};
@Override
public String toString() {
try {
StringBuilder buf = new StringBuilder();
buf.append("<thrift:");
buf.append(getTagName(getClass()));
Method[] methods = getClass().getMethods();
for (Method method : methods) {
try {
String name = method.getName();
if ((name.startsWith("get") || name.startsWith("is"))
&& ! "getClass".equals(name) && ! "get".equals(name) && ! "is".equals(name)
&& Modifier.isPublic(method.getModifiers())
&& method.getParameterTypes().length == 0
&& isPrimitive(method.getReturnType())) {
int i = name.startsWith("get") ? 3 : 2;
String key = name.substring(i, i + 1).toLowerCase() + name.substring(i + 1);
Object value = method.invoke(this, new Object[0]);
if (value != null) {
buf.append(" ");
buf.append(key);
buf.append("=\"");
buf.append(value);
buf.append("\"");
}
}
} catch (Exception e) {
logger.warn(e.getMessage(), e);
}
}
buf.append(" />");
return buf.toString();
} catch (Throwable t) { // 防御性容错
logger.warn(t.getMessage(), t);
return super.toString();
}
}
} | [
"guoqiya@lvmama.com"
] | guoqiya@lvmama.com |
e05c0e93bd0ac532fcd6f6603533a4560d51c8bc | 1f2fdba7ca64f7ee2450a78cfda592287d73cbd8 | /ORS_3/src/main/java/in/co/rays/ors/util/EmailBuilder.java | 3a931ae80270d202bce80c3c705098426b2d2fd2 | [] | no_license | AmitPal9770/TestProject | 8c325d1b8c46e89902f0091f433c27cdc81efdf2 | 538f0a23dad8da1d56347753b2d37c5509c2c8f8 | refs/heads/master | 2023-08-03T04:14:39.388146 | 2020-02-14T01:36:05 | 2020-02-14T01:36:05 | 240,401,523 | 0 | 0 | null | 2023-07-23T05:35:42 | 2020-02-14T01:11:07 | HTML | UTF-8 | Java | false | false | 3,587 | java | package in.co.rays.ors.util;
import java.util.HashMap;
/**
* Class that build Application Email messages
*
* @author SunilOS
* @version 1.0
* Copyright (c) SunilOS
*
*/
public class EmailBuilder {
/**
* Returns Successful User Registration Message
*
* @param map
* : Message parameters
* @return
*/
public static String getUserRegistrationMessage(HashMap<String, String> map) {
StringBuilder msg = new StringBuilder();
msg.append("<HTML><BODY>");
msg.append("Registration is successful for ORS Project SunilOS");
msg.append("<H1>Hi! Greetings from SunilOS!</H1>");
msg.append("<P>Congratulations for registering on ORS! You can now access your ORS account online - anywhere, anytime and enjoy the flexibility to check the Marksheet Details.</P>");
msg.append("<P>Log in today at <a href='http://ors.sunraystechnologies.com'>http://ors.sunraystechnologies.com</a> with your following credentials:</P>");
msg.append("<P><B>Login Id : " + map.get("login") + "<BR>"
+ " Password : " + map.get("password") + "</B></p>");
msg.append("<P> As a security measure, we recommended that you change your password after you first log in.</p>");
msg.append("<p>For any assistance, please feel free to call us at +91 98273 60504 or 0731-4249244 helpline numbers.</p>");
msg.append("<p>You may also write to us at hrd@sunrays.co.in.</p>");
msg.append("<p>We assure you the best service at all times and look forward to a warm and long-standing association with you.</p>");
msg.append("<P><a href='http://www.sunrays.co.in' >-SUNRAYS Technolgies</a></P>");
msg.append("</BODY></HTML>");
return msg.toString();
}
/**
* Returns Email message of Forget Password
*
* @param map
* : params
* @return
*/
public static String getForgetPasswordMessage(HashMap<String, String> map) {
StringBuilder msg = new StringBuilder();
msg.append("<HTML><BODY>");
msg.append("<H1>Your password is reccovered !! " + map.get("firstName")
+ " " + map.get("lastName") + "</H1>");
/*
* msg.append("<P>To access account user login ID : " + map.get("login")
* + " and password " + map.get("password") + "</P>");
*/
msg.append("<P><B>To access account user Login Id : "
+ map.get("login") + "<BR>" + " Password : "
+ map.get("password") + "</B></p>");
msg.append("</BODY></HTML>");
return msg.toString();
}
/**
* Returns Email message of Change Password
*
* @param map
* @return
*/
public static String getChangePasswordMessage(HashMap<String, String> map) {
StringBuilder msg = new StringBuilder();
msg.append("<HTML><BODY>");
msg.append("<H1>Your Password has been changed Successfully !! "
+ map.get("firstName") + " " + map.get("lastName") + "</H1>");
/*
* msg.append("<P>To access account user login ID : " + map.get("login")
* + " and password " + map.get("password") + "</P>");
*/
msg.append("<P><B>To access account user Login Id : "
+ map.get("login") + "<BR>" + " Password : "
+ map.get("password") + "</B></p>");
msg.append("</BODY></HTML>");
return msg.toString();
}
}
| [
"hp@DESKTOP-7FO480J"
] | hp@DESKTOP-7FO480J |
6e9f355aa1dc0a834acbdfadbad4a53fd7c01d89 | 684f7d1a71e103ea639c7564409fa112e4c56db0 | /src/Nhap/Example2/Activity411.java | a2c4c9b266cfb5f06bcd21f72a1321825207cb22 | [] | no_license | vietanh294/SpringFramework | ed8fa47bb26b42fb65378ca05b15ed52341ce73d | 0057ca4c5d60dd2ea64cd95922823b70df713fe3 | refs/heads/master | 2023-04-01T11:13:53.787570 | 2021-04-10T10:48:57 | 2021-04-10T10:48:57 | 354,233,167 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,292 | java | package Nhap.Example2;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Random;
public class Activity411 {
public static boolean flag = true;
public static HashMap<String,String> hashMap1 = new HashMap<String, String>();
public static Object weekday ;
public static Object ngay ;
public static ArrayList<String > stringArrayList ;
public static void main(String[] args) {
hashMap1.put("Mon","Thứ 2");
hashMap1.put("Tue","Thứ 3");
hashMap1.put("Wed","Thứ 4");
hashMap1.put("Thu","Thứ 5");
hashMap1.put("Fri","Thứ 6");
hashMap1.put("Sat","Thứ 7");
hashMap1.put("Sun","Chủ Nhật");
System.out.println("Hash Map Show");
stringArrayList= new ArrayList<>(Activity411.hashMap1.keySet());
System.out.println(stringArrayList);
System.out.println("___________");
ThuNgayTiengAnh thuNgayTiengAnh = new ThuNgayTiengAnh();
thuNgayTiengAnh.start();
ThuNgayTiengViet thuNgayTiengViet = new ThuNgayTiengViet();
thuNgayTiengViet.start();
}
}
class ThuNgayTiengAnh extends Thread {
@Override
public void run() {
while (true){
if (Activity411.flag == true) {
Random random = new Random();
int a = random.nextInt(Activity411.hashMap1.size());
Activity411.weekday = Activity411.stringArrayList.get(a);
System.out.print(Activity411.weekday + ": ");
Activity411.flag = false;
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
}
class ThuNgayTiengViet extends Thread {
@Override
public void run() {
while (true){
String ngay = Activity411.hashMap1.get(Activity411.weekday);
if (Activity411.flag == false){
System.out.println(Activity411.ngay);
Activity411.flag = true;
try {
Thread.sleep(1100);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
}
| [
"nva.clsp@gmail.com"
] | nva.clsp@gmail.com |
3269c31df7052ce144802193e70b8a128be30168 | 0053a771efbcaff5cfe7dbee88018836d510e21d | /arduinoled/src/main/java/es/fjaraba/arduinoled/MainActivity.java | d7306ff62993d51767fd64d486eb48b4eedf40e8 | [] | no_license | fjaraba/arduinoled | 54784f070ad3a517811428b3803bff00dc4f924f | 7c2be1e27f37e098bd467e2df50eb388ee675216 | refs/heads/master | 2021-01-10T11:29:31.991218 | 2016-02-26T09:17:41 | 2016-02-26T09:17:41 | 51,524,063 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,964 | java | package es.fjaraba.arduinoled;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.view.Gravity;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
/*
Fernando Jaraba Nieto. Febrero 2016
App que permite enviar comandos a una ESP8266 conectada a un Arduino.
La aplicación recibe información del estado del LED del Arduino y muestra una imagen indicándolo.
Tambien tiene incorpora una pantalla de configuración.
https://github.com/fjaraba/arduinoled
*/
public class MainActivity extends Activity implements View.OnClickListener {
//Strings de preferencias
public final static String PREF_IP = "PREF_IP_ADDRESS";
public final static String PREF_PORT = "PREF_PORT_NUMBER";
public final static String PREF_LEDS = "PREF_LEDS";
public final static String PREF_MIN_PIN = "PREF_MIN_PIN";
public final static String PREF_MULTIPLE = "PREF_MULTIPLE";
public final static String PREF_PIN_TEMPERATURA = "PREF_PIN_TEMPERATURA";
//Preferencias
private SharedPreferences m_prefs;
private String m_sIP;
private int m_nPort;
private int m_nLeds;
private int m_nPinInicial;
private boolean m_bMultiplesConex;
private int m_nSensorTemperatura;
private TextView m_tvTemperatura;
//Constantes
public final static int MAX_LED = 20;
public final static int BUTTON_INDEX = 2000;
private TextView m_txtConf;
private ImageView m_aImagenes[];
public MainActivity() {
//Inicializo las variables miembro
m_aImagenes = new ImageView[MAX_LED];
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
m_tvTemperatura = new TextView(MainActivity.this);
//Parseo la configuración.
m_txtConf = (TextView)findViewById(R.id.direccionRemota);
m_prefs = PreferenceManager.getDefaultSharedPreferences(MainActivity.this);
parseaPreferencias();
}
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
//Inflo el XML con el menú
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu_main, menu);
return true;
}
/*
@Override
public boolean onMenuOpened(int featureId, Menu menu) {
//Permite mostrar/ocutal elementos del menu
}
*/
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle item selection
switch (item.getItemId()) {
case R.id.about: {
//Muestro el Intent de About
Intent intent = new Intent(MainActivity.this, AboutActivity.class);
startActivity(intent);
return true;
}
case R.id.refrescar: {
//Solicito al ESP8266 el estado de los leds del arduino
preguntaEstadoGlobal();
return true;
}
case R.id.configuracion: {
//Muestro el Intent de las preferencias indicando que quiero respuesta.
Intent intent = new Intent(MainActivity.this, PrefsActivity.class);
startActivityForResult(intent, 0);
return true;
}
default:
return super.onOptionsItemSelected(item);
}
}
/*Nos avisa cuando se finalice el intent de preferencias*/
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
parseaPreferencias();
}
public void parseaPreferencias() {
int nLeds = m_nLeds;
int nPinInicial = m_nPinInicial;
//Leo las preferencias
m_sIP = m_prefs.getString(PREF_IP, "");
m_nPort = Integer.parseInt(m_prefs.getString(PREF_PORT, "80"));
m_nPinInicial = Integer.parseInt(m_prefs.getString(PREF_MIN_PIN, "11"));
m_bMultiplesConex = m_prefs.getBoolean(PREF_MULTIPLE, false);
m_nLeds = Integer.parseInt(m_prefs.getString(PREF_LEDS, "3"));
if (m_nLeds>=(MAX_LED-m_nPinInicial))
m_nLeds = MAX_LED-m_nPinInicial-1;
m_nSensorTemperatura = Integer.parseInt(m_prefs.getString(PREF_PIN_TEMPERATURA, "0"));
//Pongo un literal indicando las preferencias seleccionadas
String strConf = "Dirección remota:" + m_sIP;
strConf += ":" + Integer.toString(m_nPort);
//strConf += "\nPin inicial:" + Integer.toString(m_nPinInicial);
//strConf += ", total leds:" + Integer.toString(m_nLeds);
m_txtConf.setText(strConf);
//Compruebo si se ha modificado el número de botones
if (nLeds!=m_nLeds || nPinInicial!=m_nPinInicial){
//Elimino los botones anteriores
LinearLayout ll = (LinearLayout) findViewById(R.id.layout_botones);
ll.removeAllViews();
//Añado dinámicamente tantos layout horizontales con botón e imagen
//como leds se quieran controlar
for (int n = 0; n < m_nLeds; n++)
incorporaBotonLed(m_nPinInicial + n);
}
/* if (m_nSensorTemperatura!=0){
incorporaBotonLed(m_nSensorTemperatura);
}
*/
ponMensaje("");
}
/* Incorporo un layout con el botón y la imagen */
/* Si nPin = m_nSensorTemperatura entonces se pinta el botón de temperatura */
public void incorporaBotonLed(int nPin) {
int nResId;
/*Layout horizontal*/
LinearLayout lHor = new LinearLayout(this);
lHor.setOrientation(LinearLayout.HORIZONTAL);
lHor.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
LinearLayout ll = (LinearLayout)findViewById(R.id.layout_botones);
ll.addView(lHor);
/*Boton*/
Button btnLed = new Button(this);
btnLed.setOnClickListener(this);
if (nPin==m_nSensorTemperatura){
//Sensor de temperatura
btnLed.setText("Sensor de temperatura (Pin:" + Integer.toString(m_nSensorTemperatura) + ")");
} else {
//Led
btnLed.setText("Pin " + Integer.toString(nPin));
}
btnLed.setId(BUTTON_INDEX + nPin);
lHor.addView(btnLed, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT, 1));
/*Imagen*/
if (nPin==m_nSensorTemperatura){
//Sensor de temperatura
//nResId = R.drawable.termometro;
lHor.addView(m_tvTemperatura, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT, 3));
m_tvTemperatura.setText("?");
m_tvTemperatura.setGravity(Gravity.CENTER);
m_tvTemperatura.setTextSize(20);
// m_aImagenes[nPin]=m_tvTemperatura;
} else {
//Led
ImageView imgLed = new ImageView(MainActivity.this);
nResId = R.drawable.off;
imgLed.setImageResource(nResId);
lHor.addView(imgLed, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT, 3));
m_aImagenes[nPin]=imgLed;
}
}
public void habilitaBotones(boolean bHabilitar){
if (!m_bMultiplesConex) {
//Botones de los leds
for (int n = 0; n < m_nLeds; n++) {
Button btn = (Button) findViewById(BUTTON_INDEX + m_nPinInicial + n);
btn.setEnabled(bHabilitar);
btn.setClickable(bHabilitar);
}
//Botón refrescar
/*Button btnRefrescar = (Button) findViewById(R.id.btn_refrescar);
btnRefrescar.setEnabled(bHabilitar);*/
}
}
public void onClickImagen(View view) {
//Muestro el Intent de About
Intent intent = new Intent(MainActivity.this, AboutActivity.class);
startActivity(intent);
}
@Override
public void onClick(View view) {
String strParametro;
synchronized(this) {
//Si no se permiten múltiple conexiones deshabilito los botones
habilitaBotones(false);
// Obtengo el número del PIN
String parameterValue = Integer.toString(view.getId() - BUTTON_INDEX);
if (Integer.parseInt(parameterValue)==m_nSensorTemperatura){
//Temperstura
strParametro = "tem";
}
else{
//Leds
strParametro = "pin";
}
// Ejecuto la petición
if (m_sIP.length() > 0 && m_nPort > 0) {
new HttpRequestAsyncTask(
view.getContext(), parameterValue, m_sIP, Integer.toString(m_nPort), strParametro
).execute();
}
}
}
/*Hace una consulta del estado de todos los leds y los actualiza dependiendo la respuesta de la placa.*/
public void preguntaEstadoGlobal(){
habilitaBotones(false);
// Ejecuto la petición
if (m_sIP.length() > 0 && m_nPort > 0) {
new HttpRequestAsyncTask(
getApplicationContext(), Integer.toString(m_nPinInicial), m_sIP, Integer.toString(m_nPort), "global"
).execute();
}
}
public void cambiaImagen(int nLed, String sEstado){
if ((nLed!=0) && !(sEstado==null)){
int resImagenLed = getResources().getIdentifier(sEstado, "drawable", getPackageName());
ImageView imgLed = m_aImagenes[nLed];
imgLed.setImageResource(resImagenLed);
}
}
public void ponTemperatura(int nLed, String sEstado){
if ((nLed!=0) && !(sEstado==null)){
m_tvTemperatura.setText(sEstado);
}
}
void parseaLed(String str){
//Respuesta a un único Led. Ej: led11:on
String[] sParts = str.split(":");
String sPin = sParts[0].substring(3, 5);
int nLed = Integer.parseInt(sPin);
if (nLed==m_nSensorTemperatura){
//Temperatura
ponTemperatura(nLed, sParts[1]);
} else{
//Led
String sEstado = (sParts[1].substring(0, 2).equals("ON")) ? "on" : "off";
cambiaImagen(nLed, sEstado);
}
}
void parseaRespuestaHTTP(String requestReply){
try {
if (requestReply.contains("global&")) {
//Respuesta global. Ej: global&led11:on&led12:off&led13:on
String[] sParts = requestReply.split("&");
for (int n=1; n<sParts.length;n++){
parseaLed(sParts[n]);
}
} else if (requestReply.contains(":")) {
//Respuesta a un único Led. Ej: led11:on
parseaLed(requestReply);
}
} catch (Exception e){
e.printStackTrace();
} finally {
//Habilito los botones
habilitaBotones(true);
}
}
public void ponMensaje(String sMensaje) {
try {
TextView t = (TextView) findViewById(R.id.info);
t.setText(sMensaje);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* An AsyncTask is needed to execute HTTP requests in the background so that they do not
* block the user interface.
*/
private class HttpRequestAsyncTask extends AsyncTask< Void, Void, Void> {
// declare variables needed
private String requestReply,ipAddress, portNumber;
private Context context;
private String parameter;
private String parameterValue;
/**
* Description: The asyncTask class constructor. Assigns the values used in its other methods.
* @param context the application context, needed to create the dialog
* @param parameterValue the pin number to toggle
* @param ipAddress the ip address to send the request to
* @param portNumber the port number of the ip address
*/
public HttpRequestAsyncTask(Context context, String parameterValue, String ipAddress, String portNumber, String parameter)
{
this.context = context;
this.ipAddress = ipAddress;
this.parameterValue = parameterValue;
this.portNumber = portNumber;
this.parameter = parameter;
}
/**
* Name: doInBackground
* Description: Sends the request to the ip address
* @param voids parámetros
* @return retorno
*/
@Override
protected Void doInBackground(Void... voids) {
ponMensaje("Datos enviados, esperando respuesta del servidor...");
try {
requestReply = sendRequest(parameterValue ,ipAddress, portNumber, parameter);
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
/**
* Name: onPostExecute
* Description: This function is executed after the HTTP request returns from the ip address.
* @param aVoid void parameter
*/
@Override
protected void onPostExecute(Void aVoid) {
ponMensaje("Respuesta del servidor: " + requestReply);
parseaRespuestaHTTP(requestReply);
}
/**
* Name: onPreExecute
* Description: This function is executed before the HTTP request is sent to ip address.
* The function will set the dialog's message and display the dialog.
*/
@Override
protected void onPreExecute() {
ponMensaje("Enviando datos al servidor...");
}
}
/**
* Description: Send an HTTP Get request to a specified ip address and port.
* Also send a parameter "parameterName" with the value of "parameterValue".
* @param parameterValue the pin number to toggle
* @param ipAddress the ip address to send the request to
* @param portNumber the port number of the ip address
* @param parameterName Nombre del parametro a enviar
* @return The ip address' reply text, or an ERROR message is it fails to receive one
*/
public String sendRequest(String parameterValue, String ipAddress, String portNumber, String parameterName) throws IOException {
InputStream is =null;
try {
URL url = new URL("http://"+ipAddress+":"+portNumber+"/?"+parameterName+"="+parameterValue);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setReadTimeout(10000);
conn.setConnectTimeout(15000);
conn.setRequestMethod("GET");
conn.setDoInput(true);
// Starts the query
conn.connect();
int response = conn.getResponseCode();
is = conn.getInputStream();
// Paso los datos del InputStream a un String
java.util.Scanner s = new java.util.Scanner(is);
String str = s.useDelimiter("\\A").hasNext() ? s.next(): "";
s.close();
return str;
// Makes sure that the InputStream is closed after the app is finished using it.
} finally {
if (is != null) {
is.close();
}
}
}
}
| [
"fjaraba@gmail.com"
] | fjaraba@gmail.com |
b07f04a4f3da0ec951132c096578792ceeac8636 | da181f89e0b26ffb3fc5f9670a3a5f8f1ccf0884 | /CoreGestionTextilLevel/src/ar/com/textillevel/facade/impl/NotaDebitoFacade.java | 206d678faf83b658472c0e9102b3d9fca941d1fc | [] | no_license | nacho270/GTL | a1b14b5c95f14ee758e6b458de28eae3890c60e1 | 7909ed10fb14e24b1536e433546399afb9891467 | refs/heads/master | 2021-01-23T15:04:13.971161 | 2020-09-18T00:58:24 | 2020-09-18T00:58:24 | 34,962,369 | 2 | 1 | null | 2016-08-22T22:12:57 | 2015-05-02T20:31:49 | Java | UTF-8 | Java | false | false | 609 | java | package ar.com.textillevel.facade.impl;
import java.util.List;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import ar.com.textillevel.dao.api.local.NotaDebitoDAOLocal;
import ar.com.textillevel.entidades.documentos.factura.NotaDebito;
import ar.com.textillevel.facade.api.remote.NotaDebitoFacadeRemote;
@Stateless
public class NotaDebitoFacade implements NotaDebitoFacadeRemote {
@EJB
private NotaDebitoDAOLocal notaDebitoDAO;
public List<NotaDebito> getNotaDebitoPendientePagarList(Integer idCliente) {
return notaDebitoDAO.getNotaDebitoPendientePagarList(idCliente);
}
}
| [
"ignaciocicero@gmail.com@9de48aec-ec99-11dd-b2d9-215335d0b316"
] | ignaciocicero@gmail.com@9de48aec-ec99-11dd-b2d9-215335d0b316 |
14fea96f4b9dae64127be73be1c5cd14b1cb3f39 | e8b4cacfda678d9e1af143f8b2b21582d5541c81 | /src/practice02/Prob03.java | 7f3004a74540b5757b3987f193654bc20d828498 | [] | no_license | sdw1508/practice02 | 2eb472ddd346574ea8298d480f545118a6fc7e68 | b1c0b804ee50d736a27c28a1150a97da072b8066 | refs/heads/master | 2021-04-28T05:32:24.960273 | 2018-02-20T09:52:24 | 2018-02-20T09:52:24 | 122,180,293 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 622 | java | package practice02;
public class Prob03 {
public static void main(String[] args) {
// TODO Auto-generated method stub
char c[] = { 'T', 'h', 'i', 's', ' ', 'i', 's', ' ', 'a', ' ', 'p', 'e', 'n', 'c', 'i', 'l', '.' };
printCharArray(c); // 원래 배열 원소 출력
replaceSpace(c); // 공백 문자 바꾸기
printCharArray(c); // 수정된 배열 원소 출력
}
public static void replaceSpace(char a[]) {
for (int i = 0; i < a.length; i++) {
if(a[i]==' ') {
a[i] = ',';
}
}
}
public static void printCharArray(char a[]) {
System.out.println(a);
}
}
| [
"BIT@DESKTOP-IMJNJL2"
] | BIT@DESKTOP-IMJNJL2 |
8706e4aad8d0d4cf8def4d58f8008d28d152642b | c5de6d7588a0265dbe98376d2679a4e87d81cdf7 | /src/org/usfirst/frc/team3374/robot/commands/AutonomousDriveDeadReckon.java | 7cfd956303cb89d173c8ca00f079aee848e2d8fd | [
"MIT"
] | permissive | Team3374/Hobbs-2017 | 246576386da038dae3a0dd7931c4d342dd121b0d | f3514704e467bdb77a5f5152170f463298e9a880 | refs/heads/master | 2021-08-22T11:25:49.290621 | 2017-11-30T03:51:47 | 2017-11-30T03:51:47 | 112,560,289 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,589 | java | /* */ package org.usfirst.frc.team3374.robot.commands;
/* */
/* */ import com.ctre.CANTalon;
/* */ import edu.wpi.first.wpilibj.RobotDrive;
/* */ import edu.wpi.first.wpilibj.Timer;
/* */ import edu.wpi.first.wpilibj.command.Command;
/* */ import java.io.PrintStream;
/* */ import org.usfirst.frc.team3374.robot.OI;
/* */ import org.usfirst.frc.team3374.robot.Robot;
/* */ import org.usfirst.frc.team3374.robot.RobotMap;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class AutonomousDriveDeadReckon
/* */ extends Command
/* */ {
/* */ protected void initialize() {}
/* */
/* */ protected void execute()
/* */ {
/* 26 */ OI oi = Robot.oi;
/* 27 */ System.out.println("STARTING ARM RAISE");
/* 28 */ Robot.oi.getGear().setPID(1.5D, 0.001D, 100.0D);
/* */
/* 30 */ oi.Target_Position = RobotMap.centergear;
/* */
/* */
/* 33 */ System.out.println("STARTING BLIND DRIVE FORWARD");
/* 34 */ oi.Drive().arcadeDrive(0.0D, -0.6D);
/* 35 */ Timer.delay(1.0D);
/* 36 */ oi.Drive().arcadeDrive(0.0D, 0.0D);
/* 37 */ Timer.delay(2.0D);
/* */
/* */
/* 40 */ System.out.println("STARTING BLIND ROTATE");
/* 41 */ oi.Drive().arcadeDrive(-0.6D, 0.0D);
/* 42 */ Timer.delay(1.0D);
/* 43 */ oi.Drive().arcadeDrive(0.0D, 0.0D);
/* 44 */ Timer.delay(2.0D);
/* */
/* */
/* 47 */ System.out.println("BRING GEAR TO VERTICAL");
/* */
/* 49 */ oi.Target_Position = RobotMap.topgear;
/* 50 */ Timer.delay(1.0D);
/* */
/* */
/* 53 */ System.out.println("STARTING BLIND DRIVE FORWARD");
/* 54 */ oi.Drive().arcadeDrive(0.0D, -0.6D);
/* 55 */ Timer.delay(1.0D);
/* 56 */ oi.Drive().arcadeDrive(0.0D, 0.0D);
/* 57 */ Timer.delay(2.0D);
/* */
/* */
/* 60 */ System.out.println("STARTING TO PLACE THE GEAR");
/* */
/* 62 */ oi.Target_Position = RobotMap.placegear;
/* 63 */ Timer.delay(1.0D);
/* */
/* */
/* 66 */ System.out.println("STARTING BLIND DRIVE BACKWARD");
/* 67 */ oi.Drive().arcadeDrive(0.0D, 0.7D);
/* 68 */ Timer.delay(1.0D);
/* 69 */ oi.Drive().arcadeDrive(0.0D, 0.0D);
/* */ }
/* */
/* */ protected boolean isFinished()
/* */ {
/* 74 */ return true;
/* */ }
/* */
/* */ protected void end() {}
/* */
/* */ protected void interrupted() {}
/* */ }
| [
"eric@ericbalsa.com"
] | eric@ericbalsa.com |
55308ed34dff29cd5fda46b6f59392d6790d3370 | 54e5c4f1357ea07f678c838dde582d16c1768621 | /src/main/java/com/revature/ncu/web/util/security/JwtConfig.java | 8f29ca78d40893066d9ae19a52368741555bf866 | [] | no_license | 210726-java-react-serverless/Cody-Heather_api_p1 | ccd5ab62da8288a43907f0495a2eebdb0bb61451 | c58f34624d9ec4d527763e8926df3c2526a2792d | refs/heads/main | 2023-07-18T09:36:51.082549 | 2021-09-09T14:02:02 | 2021-09-09T14:02:02 | 395,380,195 | 0 | 2 | null | 2021-08-30T00:57:23 | 2021-08-12T16:26:20 | Java | UTF-8 | Java | false | false | 1,895 | java | package com.revature.ncu.web.util.security;
import io.jsonwebtoken.SignatureAlgorithm;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.crypto.spec.SecretKeySpec;
import javax.xml.bind.DatatypeConverter;
import java.io.IOException;
import java.security.Key;
import java.util.Properties;
// Used for token creation
public class JwtConfig {
private final Logger logger = LoggerFactory.getLogger(JwtConfig.class);
private String header;
private String prefix;
private String secret;
private int expiration;
private SignatureAlgorithm sigAlg = SignatureAlgorithm.HS256;
private Key signingKey;
public JwtConfig() {
try {
Properties appProperties = new Properties();
ClassLoader loader = Thread.currentThread().getContextClassLoader();
appProperties.load(loader.getResourceAsStream("application.properties"));
this.header = appProperties.getProperty("jwt.header");
this.prefix = appProperties.getProperty("jwt.prefix");
this.secret = appProperties.getProperty("jwt.secret");
this.expiration = Integer.parseInt(appProperties.getProperty("jwt.expiration"));
byte[] secretBytes = DatatypeConverter.parseBase64Binary(this.secret);
signingKey = new SecretKeySpec(secretBytes, sigAlg.getJcaName());
} catch (IOException e) {
e.printStackTrace();
logger.error(e.getMessage(), e);
}
}
public String getHeader() {
return header;
}
public String getPrefix() {
return prefix;
}
public String getSecret() {
return secret;
}
public int getExpiration() {
return expiration;
}
public SignatureAlgorithm getSigAlg() {
return sigAlg;
}
public Key getSigningKey() {
return signingKey;
}
} | [
"csmcdn@gmail.com"
] | csmcdn@gmail.com |
12be3f981e2e90b318e3b87db64baf7ee1fc8e8b | 5ad4db3d5a25a9593caf803c58dafdb017d75e55 | /NeoCrypto/trunk/NeoProvider5/src/main/java/com/neo/security/util/ResourcesMgr.java | 8cbb06d79a27264f36ec6c56665db39ddde57be5 | [] | no_license | highjava12/Yoon_Neo10 | ab34ea3926869f0f8e101f8ea20bd348256bed2c | 9a1e7898683bfe1ba28cf1a2f57fe88d8e3114fb | refs/heads/master | 2020-03-24T20:15:21.872951 | 2018-07-31T05:57:57 | 2018-07-31T05:57:57 | 142,968,044 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,583 | java | /*
* Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.neo.security.util;
/**
*/
public class ResourcesMgr {
// intended for java.security, javax.security and sun.security resources
private static java.util.ResourceBundle bundle;
// intended for com.sun.security resources
private static java.util.ResourceBundle altBundle;
public static String getString(String s) {
if (bundle == null) {
// only load if/when needed
bundle = java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<java.util.ResourceBundle>() {
public java.util.ResourceBundle run() {
return (java.util.ResourceBundle.getBundle
("sun.security.util.Resources"));
}
});
}
return bundle.getString(s);
}
public static String getString(String s, final String altBundleName) {
if (altBundle == null) {
// only load if/when needed
altBundle = java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<java.util.ResourceBundle>() {
public java.util.ResourceBundle run() {
return (java.util.ResourceBundle.getBundle(altBundleName));
}
});
}
return altBundle.getString(s);
}
}
| [
"highjava12@gmail.com"
] | highjava12@gmail.com |
388a11b076fcf06b9a0f3a82ddd728bef54b6c7f | 0e81a16504d921b894b67689991e5fa5db967af8 | /src/test/java/CreatureTest.java | a689e543bb111ab7b16e9c2a2a861361ef73d875 | [] | no_license | BYGX-wcr/Java-Final-Project | d85b2cb8ee52b8d3d0033e1d02d59453207e3b44 | 26bf2d410009265708e7ece6a2a0e1a1efa96988 | refs/heads/master | 2020-04-13T02:00:02.999335 | 2019-01-05T02:05:29 | 2019-01-05T02:05:29 | 162,890,008 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 844 | java | package test.java;
import main.java.creature.Creature;
import main.java.environment.Battlefield;
import main.java.environment.Game;
import org.junit.Test;
import static org.junit.Assert.*;
public class CreatureTest {
@Test
public void testHurt() {
Creature testObj = new Creature(new Game(".", "."), new Battlefield(11), "Tester") {
@Override
public void run() {
}
};
testObj.setCampId(Game.Camp.GOOD);
testObj.setLife(50);
assertEquals(testObj.hurt(100), false);
testObj = new Creature(new Game(".", "."), new Battlefield(11), "Tester") {
@Override
public void run() {
}
};
testObj.setCampId(Game.Camp.GOOD);
testObj.setLife(50);
assertEquals(testObj.hurt(20), true);
}
}
| [
"wcr@live.cn"
] | wcr@live.cn |
9cf70f042e2ee90fbd7421ac41eba2ba6d309dad | 61757382ad1fdfefc7bca24abaa8f037141ea934 | /Civilization IV/src/iu/edu/civ/unit/Cannon.java | d38486cb74552325a5ccb9bb23bc086b9e2b35ad | [] | no_license | shrutikapoyrekar/CivilizationIV-CBR-AI | f82024018f4d4411171de5989c38e44045d5926b | ee39068dc15bf0c67544f37f857b0a1660d53f29 | refs/heads/master | 2021-01-13T01:37:44.224593 | 2013-04-07T00:04:06 | 2013-04-07T00:04:06 | 9,021,369 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,604 | java | package iu.edu.civ.unit;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class Cannon extends MilitaryUnit {
static{
baseStrength = 12;
cost = 150;
upgradeList = new ArrayList<MilitaryUnit>();
requireTech = new ArrayList<String>();
requireTech.add("Steel");
requireResource = "Iron";
}
public Cannon(){
super(0, new ArrayList<String>());
this.name="Cannon";
this.unitType = "Siege";
this.baseMovement = 1;
this.canBombard = true;
this.possiblePromotions = new ArrayList<String>();
this.possiblePromotions.add("Combat I");
this.possiblePromotions.add("City Raider I");
this.possiblePromotions.add("Barrage I");
this.possiblePromotions.add("Drill I");
}
public Cannon(int exp){
super(exp, new ArrayList<String>());
this.name="Cannon";
this.baseMovement = 1;
this.canBombard = true;
this.unitType = "Siege";
this.possiblePromotions = new ArrayList<String>();
this.possiblePromotions.add("Combat I");
this.possiblePromotions.add("City Raider I");
this.possiblePromotions.add("Barrage I");
this.possiblePromotions.add("Drill I");
}
public Cannon(int exp, List<String> prom){
super(exp, new ArrayList<String>());
this.name="Cannon";
this.canBombard = true;
this.unitType = "Siege";
this.baseMovement = 1;
Iterator<String> i = prom.iterator();
this.possiblePromotions = new ArrayList<String>();
this.possiblePromotions.add("Combat I");
this.possiblePromotions.add("City Raider I");
this.possiblePromotions.add("Barrage I");
this.possiblePromotions.add("Drill I");
for (;i.hasNext();){
this.promote(i.next(),false);
}
}
@Override
public double getDefenseBonus(MilitaryUnit u) {
double i = super.getDefenseBonus(u);
if (this.getTerrain()!=null) i -= this.getTerrain().getDefenseBonus();
return i;
}
protected void promote(String s,boolean costExp){
super.promote(s, costExp);
if(s.equals("Combat I")){
possiblePromotions.add("Shock");
possiblePromotions.add("Medic I");
}else if (s.equals("Combat II")){
possiblePromotions.add("Ambush");
possiblePromotions.add("Amphibious");
}else if (s.equals("Medic I")){
possiblePromotions.add("March");
}else if (s.equals("Flanking I")){
possiblePromotions.add("Sentry");
}else if (s.equals("Flanking II")){
possiblePromotions.add("Mobility");
}else if (s.equals("Combat III")){
possiblePromotions.add("Blitz");
}else if (s.equals("City Raider I") || s.equals("Barrage I")){
possiblePromotions.add("Accuracy");
}
}
@Override
public MilitaryUnit upgrade(String s) {
return null;
}
}
| [
"rashirishi@gmail.com"
] | rashirishi@gmail.com |
b4001cdb0662d0e61907d66b1737b1a9bb34fbd3 | 4b50a6368208807c751ce191082ebe1cb1a63cd9 | /app/src/main/java/com/example/mobilecw02/IMDBResultAdapter.java | 774cfd7d4c2603ecfffca421955309ee6c5d595d | [] | no_license | venushi/Movie-Mobile-app-android- | 8c6ece97b031c94adf6a88ea5a51c5ff1e783bed | a258f107411ebca0c0533ee0bd3b8d68f06e1df9 | refs/heads/master | 2023-05-07T09:54:33.127613 | 2021-05-30T14:20:07 | 2021-05-30T14:20:07 | 372,232,506 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,996 | java | package com.example.mobilecw02;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
import java.util.List;
public class IMDBResultAdapter extends RecyclerView.Adapter<IMDBResultAdapter.ViewHolder> {
//https://www.youtube.com/watch?v=y2xtLqP8dSQ
//https://www.youtube.com/watch?v=e3MDW87mbR8
private List<String> movie_names;
private List<String> movie_id;
private List<String> movie_url;
private LayoutInflater mInflater;
private Context context;
// data is passed into the constructor
public IMDBResultAdapter(Context context, ArrayList<String> movie_names, ArrayList<String> movie_ids, ArrayList<String> movie_url) {
this.context = context;
this.movie_names = movie_names;
this.movie_id = movie_ids;
this.movie_url = movie_url;
this.mInflater = LayoutInflater.from(context);
}
// inflates the cell layout from xml when needed
@Override
public IMDBResultAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = mInflater.inflate(R.layout.row_edit_movie, parent, false);
return new IMDBResultAdapter.ViewHolder(view);
}
// binds the data to the textview in each cell
@SuppressLint({"ResourceAsColor", "SetTextI18n"})
@Override
public void onBindViewHolder(final IMDBResultAdapter.ViewHolder holder, @SuppressLint("RecyclerView") final int position) {
holder.movie_name.setText(movie_names.get(position));
holder.movie_name.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent2 = new Intent(context, TotalRating.class);
intent2.putExtra("id", movie_id.get(position));
intent2.putExtra("url", movie_url.get(position));
intent2.putExtra("title", movie_names.get(position));
context.startActivity(intent2);
}
});
}
public void onActivityResult(int requestCode, int resultCode) {
this.notifyDataSetChanged();
Log.d("myz" , "Changes happen on complete adapter");
}
// total number of cells
@Override
public int getItemCount() {
return movie_names.size();
}
// stores and recycles views as they are scrolled off screen
public class ViewHolder extends RecyclerView.ViewHolder {
TextView movie_name;
ViewHolder(View itemView) {
super(itemView);
movie_name = itemView.findViewById(R.id.title);
}
}
// convenience method for getting data at click position
public String getItem(int id) {
return movie_id.get(id);
}
}
| [
"venushikavitha06@gmail.com"
] | venushikavitha06@gmail.com |
6a9d955ab533b380c2720d97981cddcac8a572eb | 93ec64ed38c0bba8ef73031f502288771114e7a0 | /app/src/test/java/lemond/annoying/gamerscompanion/RxSchedulerRule.java | 78f3fe9d71f3a5ff248c5964ab87380bdc12ba4b | [] | no_license | annoyinglemon/gamersCompanionAndroid | 1f7870226714e82583f606ea717b44dd9ceac5b7 | 55c23687b40fa5729a30c8e2b3f547c851b12c62 | refs/heads/master | 2021-09-24T10:50:19.301883 | 2018-10-08T15:37:48 | 2018-10-08T15:37:48 | 114,503,979 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,472 | java | package lemond.annoying.gamerscompanion;
import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
import java.util.concurrent.Callable;
import io.reactivex.Scheduler;
import io.reactivex.android.plugins.RxAndroidPlugins;
import io.reactivex.functions.Function;
import io.reactivex.plugins.RxJavaPlugins;
import io.reactivex.schedulers.Schedulers;
public class RxSchedulerRule implements TestRule {
private Scheduler trampoline = Schedulers.trampoline();
private Function<Scheduler, Scheduler> schedulerFunction = scheduler -> trampoline;
private Function<Callable<Scheduler>, Scheduler> schedulerFunctionLazy = schedulerCallable -> trampoline;
@Override
public Statement apply(final Statement base, Description description) {
return new Statement() {
@Override
public void evaluate() throws Throwable {
RxAndroidPlugins.reset();
RxAndroidPlugins.setInitMainThreadSchedulerHandler(schedulerFunctionLazy);
RxJavaPlugins.reset();
RxJavaPlugins.setIoSchedulerHandler(schedulerFunction);
RxJavaPlugins.setComputationSchedulerHandler(schedulerFunction);
RxJavaPlugins.setNewThreadSchedulerHandler(schedulerFunction);
base.evaluate();
RxAndroidPlugins.reset();
RxJavaPlugins.reset();
}
};
}
} | [
"kurt.lemond@icemobile.com"
] | kurt.lemond@icemobile.com |
e5cbf6325efffcaf4fd38a2f924fcfd09baecc92 | c8fea9a6e62baa1899dbf959287314f9756663ef | /src/inmobiliaria/superficies/Superficie.java | f956bda19d78fbcb8a8d70c5b699ec09dc678472 | [] | no_license | AndresMeza199689/Inmobiliaria | a8e7306a20b727dd70b38a20312eb73d217010a6 | d99e465a85ab1cc0fa61f6f5afcba12a46828e8f | refs/heads/master | 2020-05-24T03:19:47.250519 | 2019-05-16T17:09:44 | 2019-05-16T17:09:44 | 187,069,676 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,100 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package inmobiliaria.superficies;
import inmobiliaria.Inmueble;
public abstract class Superficie implements Inmueble{
protected int precio;
String constructora;
String ubicacion;
int espacio;
public Superficie(int precio, String constructora, String ubicacion, int espacio) {
this.precio = precio;
this.constructora = constructora;
this.ubicacion = ubicacion;
this.espacio = espacio;
}
@Override
public int precio() {
return this.espacio;
}
@Override
public String muestra() {
return "";
}
@Override
public String getConstructora() {
return this.constructora;
}
@Override
public String getUbicacion() {
return this.ubicacion;
}
@Override
public int getEspacio() {
return this.espacio;
}
}
| [
"HP_142@DESKTOP-GL45V2I"
] | HP_142@DESKTOP-GL45V2I |
ef736602ac8c957f2236fd756d02735f443db228 | 7f20b1bddf9f48108a43a9922433b141fac66a6d | /core3/search-impl/tags/search-impl-3.0.0-alpha2/src/main/java/org/cytoscape/search/internal/IndexAndSearchTask.java | f190681b035bf4b8e04d6cdbffc4594a60032107 | [] | no_license | ahdahddl/cytoscape | bf783d44cddda313a5b3563ea746b07f38173022 | a3df8f63dba4ec49942027c91ecac6efa920c195 | refs/heads/master | 2020-06-26T16:48:19.791722 | 2013-08-28T04:08:31 | 2013-08-28T04:08:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,572 | java | /*
Copyright (c) 2006, 2007, The Cytoscape Consortium (www.cytoscape.org)
The Cytoscape Consortium is:
- Institute for Systems Biology
- University of California San Diego
- Memorial Sloan-Kettering Cancer Center
- Institut Pasteur
- Agilent Technologies
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2.1 of the License, or
any later version.
This library 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. The software and
documentation provided hereunder is on an "as is" basis, and the
Institute for Systems Biology and the Whitehead Institute
have no obligations to provide maintenance, support,
updates, enhancements or modifications. In no event shall the
Institute for Systems Biology and the Whitehead Institute
be liable to any party for direct, indirect, special,
incidental or consequential damages, including lost profits, arising
out of the use of this software and its documentation, even if the
Institute for Systems Biology and the Whitehead Institute
have been advised of the possibility of such damage. See
the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
package org.cytoscape.search.internal;
import java.util.ArrayList;
import java.util.List;
import java.util.Iterator;
import org.apache.lucene.store.RAMDirectory;
import org.cytoscape.model.CyNetwork;
import org.cytoscape.view.model.CyNetworkView;
import org.cytoscape.model.CyNode;
import org.cytoscape.model.CyEdge;
import org.cytoscape.task.AbstractNetworkViewTask;
import org.cytoscape.work.TaskMonitor;
//import org.cytoscape.work.Tunable;
import org.cytoscape.model.CyTableManager;
import org.cytoscape.model.events.RowsAboutToChangeEvent;
import org.cytoscape.model.events.RowsFinishedChangingEvent;
public class IndexAndSearchTask extends AbstractNetworkViewTask {
private boolean interrupted = false;
private EnhancedSearch enhancedSearch;
private CyNetwork network;
private CyTableManager tableMgr;
//@Tunable(description="Search for:")
public String query;
/**
* The constructor. Any necessary data that is <i>not</i> provided by
* the user should be provided as arguments to the constructor.
*/
public IndexAndSearchTask(final CyNetworkView networkView, EnhancedSearch enhancedSearch,
CyTableManager tableMgr, String query) {
// Will set a CyNetwork field called "net".
super(networkView);
network = networkView.getModel();
this.enhancedSearch = enhancedSearch;
this.tableMgr = tableMgr;
this.query = query;
}
@Override
public void run(final TaskMonitor taskMonitor) {
// Give the task a title.
taskMonitor.setTitle("Searching the network");
// Index the given network or use existing index
RAMDirectory idx = null;
String status = enhancedSearch.getNetworkIndexStatus(network);
if (status != null && status.equalsIgnoreCase(EnhancedSearch.INDEX_SET)) {
idx = enhancedSearch.getNetworkIndex(network);
} else {
taskMonitor.setStatusMessage("Indexing network");
EnhancedSearchIndex indexHandler = new EnhancedSearchIndex(network);
idx = indexHandler.getIndex();
enhancedSearch.setNetworkIndex(network, idx);
}
if (interrupted) {
return;
}
// Execute query
taskMonitor.setStatusMessage("Executing query");
EnhancedSearchQuery queryHandler = new EnhancedSearchQuery(network, idx, tableMgr);
queryHandler.executeQuery(query);
if (interrupted) {
return;
}
if (network != null && network.getNodeList().size() > 0){
try {
EnhancedSearchPlugin.eventHelper.fireSynchronousEvent(new RowsAboutToChangeEvent(this, network.getDefaultNodeTable()));
EnhancedSearchPlugin.eventHelper.fireSynchronousEvent(new RowsAboutToChangeEvent(this, network.getDefaultEdgeTable()));
showResults(queryHandler, taskMonitor);
}
finally {
EnhancedSearchPlugin.eventHelper.fireAsynchronousEvent(new RowsFinishedChangingEvent(this, network.getDefaultNodeTable()));
EnhancedSearchPlugin.eventHelper.fireAsynchronousEvent(new RowsFinishedChangingEvent(this, network.getDefaultEdgeTable()));
}
}
}
private void showResults(EnhancedSearchQuery queryHandler, final TaskMonitor taskMonitor){
// Display results
if (network == null || network.getNodeList().size() == 0){
return;
}
List<CyNode> nodeList = network.getNodeList();
for (CyNode n : nodeList) {
n.getCyRow().set("selected",false);
}
List<CyEdge> edgeList = network.getEdgeList();
for (CyEdge e : edgeList) {
e.getCyRow().set("selected",false);
}
int nodeHitCount = queryHandler.getNodeHitCount();
int edgeHitCount = queryHandler.getEdgeHitCount();
if (nodeHitCount == 0 && edgeHitCount == 0) {
return;
}
taskMonitor.setStatusMessage("Selecting " + nodeHitCount + " and " + edgeHitCount + " edges");
ArrayList<String> nodeHits = queryHandler.getNodeHits();
ArrayList<String> edgeHits = queryHandler.getEdgeHits();
Iterator nodeIt = nodeHits.iterator();
int numCompleted = 0;
while (nodeIt.hasNext() && !interrupted) {
int currESPIndex = Integer.parseInt(nodeIt.next().toString());
CyNode currNode = network.getNode(currESPIndex);
if (currNode != null) {
currNode.getCyRow().set("selected", true);
} else {
System.out.println("Unknown node identifier " + (currESPIndex));
}
taskMonitor.setProgress(numCompleted++ / nodeHitCount);
}
Iterator edgeIt = edgeHits.iterator();
numCompleted = 0;
while (edgeIt.hasNext() && !interrupted) {
int currESPIndex = Integer.parseInt(edgeIt.next().toString());
CyEdge currEdge = network.getEdge(currESPIndex);
if (currEdge != null) {
currEdge.getCyRow().set("selected", true);
} else {
System.out.println("Unknown edge identifier " + (currESPIndex));
}
taskMonitor.setProgress(numCompleted++ / edgeHitCount);
}
// Refresh view to show selected nodes and edges
view.updateView();
}
@Override
public void cancel() {
this.interrupted = true;
}
} | [
"mes@0ecc0d97-ab19-0410-9704-bfe1a75892f5"
] | mes@0ecc0d97-ab19-0410-9704-bfe1a75892f5 |
9bc4c32bf2791f18742518f94f7a9d2a3b40e0f8 | bce1e210182b186554efbf496263ba4392eccd92 | /FORMULARIOS/Login FORM PRI/Prospectoss/output/webnxj/compilation/nxjLayout/Modulo/MediospFRM_nxjLayoutAttr.java | 6d88238fa89a55d1baed59c12b5b2fdcf517b636 | [] | no_license | rokcrow/SIP | d267eb1acff4e329a4c8b66be2c87975094f2c39 | 27802c09d3295a1d2f3d80a33cace9ff86f9091c | refs/heads/master | 2020-12-24T14:46:13.804760 | 2013-08-22T22:12:31 | 2013-08-22T22:12:31 | 10,773,608 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 39,914 | java | package nxjLayout.Modulo;
import com.unify.nxj.awebView.*;
public class
MediospFRM_nxjLayoutAttr
extends FormWidget
{
public MediospFRM_nxjLayoutAttr()
{
this.isLocalized = false;
setAttrFor_this(this);
DivPanelWidget div_view1__10 = new DivPanelWidget();
dodiv_view1__10(div_view1__10);
}
private void setAttrFor_this(Widget widget)
{
widget.addAttribute("footer","none");
widget.addAttribute("resize_browser","true");
widget.addAttribute("displaywidth","1135");
widget.addAttribute("name","NXJForm");
widget.addAttribute("stylesheets","");
widget.addStyle("background-color","#999999");
widget.addAttribute("displayheight","712");
widget.addAttribute("fieldheight","722");
widget.addAttribute("fieldwidth","1140");
widget.setClass("form");
}
private void setAttrFor_div_view1__10(Widget widget)
{
widget.addStyle("left","50px");
widget.addStyle("top","33px");
widget.addStyle("width","1005px");
widget.addStyle("height","566px");
}
private void setAttrFor_view1__20(Widget widget)
{
widget.addAttribute("field_weight","99");
widget.addAttribute("displayheight","566");
widget.addAttribute("displaytop","33");
widget.addAttribute("id","view1.");
widget.addAttribute("displayleft","50");
widget.addStyle("overflow","hidden");
}
private void setAttrFor_div_RepeatingArea1__30(Widget widget)
{
}
private void setAttrFor_RepeatingArea1__40(Widget widget)
{
widget.addAttribute("_id","view1:(Modulo.MediospDVW)RepeatingArea1.");
widget.addAttribute("id","view1:RepeatingArea1.");
widget.addStyle("overflow","hidden");
}
private void setAttrFor_div_Box__50(Widget widget)
{
}
private void setAttrFor_Box__60(Widget widget)
{
widget.addAttribute("_id","view1:(Modulo.MediospDVW)Box.");
widget.addAttribute("id","view1:Box.");
widget.addStyle("overflow","hidden");
}
private void setAttrFor_div_Label__70(Widget widget)
{
}
private void setAttrFor_Label__80(Widget widget)
{
widget.addAttribute("_id","view1:(Modulo.MediospDVW)Box:(Modulo.MediospDVW)Label.");
widget.addAttribute("id","view1:Box:Label.");
widget.addStyle("overflow","hidden");
}
private void setAttrFor_div_Label1__70(Widget widget)
{
}
private void setAttrFor_Label1__80(Widget widget)
{
widget.addAttribute("_id","view1:(Modulo.MediospDVW)Box:(Modulo.MediospDVW)Label1.");
widget.addAttribute("id","view1:Box:Label1.");
widget.addStyle("overflow","hidden");
}
private void setAttrFor_div_Label1__71(Widget widget)
{
}
private void setAttrFor_Label1__81(Widget widget)
{
widget.addAttribute("_id","view1:(Modulo.MediospDVW)Box:(Modulo.MediospDVW)Label1.");
widget.addAttribute("id","view1:Box:Label1.");
widget.addStyle("overflow","hidden");
}
private void setAttrFor_div_vmp_categoria__50(Widget widget)
{
}
private void setAttrFor_vmp_categoria__60(Widget widget)
{
widget.addAttribute("_name","view1:(Modulo.MediospDVW)vmp_categoria.");
widget.addAttribute("name","view1:vmp_categoria.");
widget.addAttribute("type","text");
widget.addStyle("overflow","hidden");
}
private void setAttrFor_div_vmp_codigo__50(Widget widget)
{
}
private void setAttrFor_vmp_codigo__60(Widget widget)
{
widget.addAttribute("_name","view1:(Modulo.MediospDVW)vmp_codigo.");
widget.addAttribute("name","view1:vmp_codigo.");
widget.addAttribute("type","text");
widget.addStyle("overflow","hidden");
}
private void setAttrFor_div_vmp_descripcion__50(Widget widget)
{
}
private void setAttrFor_vmp_descripcion__60(Widget widget)
{
widget.addAttribute("_name","view1:(Modulo.MediospDVW)vmp_descripcion.");
widget.addAttribute("name","view1:vmp_descripcion.");
widget.addAttribute("type","text");
widget.addStyle("overflow","hidden");
}
private void setAttrFor_div_vmp_categoria_0_50(Widget widget)
{
}
private void setAttrFor_vmp_categoria_0_60(Widget widget)
{
widget.addAttribute("type","text");
widget.addAttribute("_name","view1:(Modulo.MediospDVW)vmp_categoria.0");
widget.addAttribute("name","view1:vmp_categoria.0");
widget.addStyle("overflow","hidden");
}
private void setAttrFor_div_vmp_categoria_1_50(Widget widget)
{
}
private void setAttrFor_vmp_categoria_1_60(Widget widget)
{
widget.addAttribute("type","text");
widget.addAttribute("_name","view1:(Modulo.MediospDVW)vmp_categoria.1");
widget.addAttribute("name","view1:vmp_categoria.1");
widget.addStyle("overflow","hidden");
}
private void setAttrFor_div_vmp_categoria_2_50(Widget widget)
{
}
private void setAttrFor_vmp_categoria_2_60(Widget widget)
{
widget.addAttribute("type","text");
widget.addAttribute("_name","view1:(Modulo.MediospDVW)vmp_categoria.2");
widget.addAttribute("name","view1:vmp_categoria.2");
widget.addStyle("overflow","hidden");
}
private void setAttrFor_div_vmp_categoria_3_50(Widget widget)
{
}
private void setAttrFor_vmp_categoria_3_60(Widget widget)
{
widget.addAttribute("type","text");
widget.addAttribute("_name","view1:(Modulo.MediospDVW)vmp_categoria.3");
widget.addAttribute("name","view1:vmp_categoria.3");
widget.addStyle("overflow","hidden");
}
private void setAttrFor_div_vmp_categoria_4_50(Widget widget)
{
}
private void setAttrFor_vmp_categoria_4_60(Widget widget)
{
widget.addAttribute("type","text");
widget.addAttribute("_name","view1:(Modulo.MediospDVW)vmp_categoria.4");
widget.addAttribute("name","view1:vmp_categoria.4");
widget.addStyle("overflow","hidden");
}
private void setAttrFor_div_vmp_categoria_5_50(Widget widget)
{
}
private void setAttrFor_vmp_categoria_5_60(Widget widget)
{
widget.addAttribute("type","text");
widget.addAttribute("_name","view1:(Modulo.MediospDVW)vmp_categoria.5");
widget.addAttribute("name","view1:vmp_categoria.5");
widget.addStyle("overflow","hidden");
}
private void setAttrFor_div_vmp_categoria_6_50(Widget widget)
{
}
private void setAttrFor_vmp_categoria_6_60(Widget widget)
{
widget.addAttribute("type","text");
widget.addAttribute("_name","view1:(Modulo.MediospDVW)vmp_categoria.6");
widget.addAttribute("name","view1:vmp_categoria.6");
widget.addStyle("overflow","hidden");
}
private void setAttrFor_div_vmp_categoria_7_50(Widget widget)
{
}
private void setAttrFor_vmp_categoria_7_60(Widget widget)
{
widget.addAttribute("type","text");
widget.addAttribute("_name","view1:(Modulo.MediospDVW)vmp_categoria.7");
widget.addAttribute("name","view1:vmp_categoria.7");
widget.addStyle("overflow","hidden");
}
private void setAttrFor_div_vmp_categoria_8_50(Widget widget)
{
}
private void setAttrFor_vmp_categoria_8_60(Widget widget)
{
widget.addAttribute("type","text");
widget.addAttribute("_name","view1:(Modulo.MediospDVW)vmp_categoria.8");
widget.addAttribute("name","view1:vmp_categoria.8");
widget.addStyle("overflow","hidden");
}
private void setAttrFor_div_vmp_codigo_0_50(Widget widget)
{
}
private void setAttrFor_vmp_codigo_0_60(Widget widget)
{
widget.addAttribute("type","text");
widget.addAttribute("_name","view1:(Modulo.MediospDVW)vmp_codigo.0");
widget.addAttribute("name","view1:vmp_codigo.0");
widget.addStyle("overflow","hidden");
}
private void setAttrFor_div_vmp_codigo_1_50(Widget widget)
{
}
private void setAttrFor_vmp_codigo_1_60(Widget widget)
{
widget.addAttribute("type","text");
widget.addAttribute("_name","view1:(Modulo.MediospDVW)vmp_codigo.1");
widget.addAttribute("name","view1:vmp_codigo.1");
widget.addStyle("overflow","hidden");
}
private void setAttrFor_div_vmp_codigo_2_50(Widget widget)
{
}
private void setAttrFor_vmp_codigo_2_60(Widget widget)
{
widget.addAttribute("type","text");
widget.addAttribute("_name","view1:(Modulo.MediospDVW)vmp_codigo.2");
widget.addAttribute("name","view1:vmp_codigo.2");
widget.addStyle("overflow","hidden");
}
private void setAttrFor_div_vmp_codigo_3_50(Widget widget)
{
}
private void setAttrFor_vmp_codigo_3_60(Widget widget)
{
widget.addAttribute("type","text");
widget.addAttribute("_name","view1:(Modulo.MediospDVW)vmp_codigo.3");
widget.addAttribute("name","view1:vmp_codigo.3");
widget.addStyle("overflow","hidden");
}
private void setAttrFor_div_vmp_codigo_4_50(Widget widget)
{
}
private void setAttrFor_vmp_codigo_4_60(Widget widget)
{
widget.addAttribute("type","text");
widget.addAttribute("_name","view1:(Modulo.MediospDVW)vmp_codigo.4");
widget.addAttribute("name","view1:vmp_codigo.4");
widget.addStyle("overflow","hidden");
}
private void setAttrFor_div_vmp_codigo_5_50(Widget widget)
{
}
private void setAttrFor_vmp_codigo_5_60(Widget widget)
{
widget.addAttribute("type","text");
widget.addAttribute("_name","view1:(Modulo.MediospDVW)vmp_codigo.5");
widget.addAttribute("name","view1:vmp_codigo.5");
widget.addStyle("overflow","hidden");
}
private void setAttrFor_div_vmp_codigo_6_50(Widget widget)
{
}
private void setAttrFor_vmp_codigo_6_60(Widget widget)
{
widget.addAttribute("type","text");
widget.addAttribute("_name","view1:(Modulo.MediospDVW)vmp_codigo.6");
widget.addAttribute("name","view1:vmp_codigo.6");
widget.addStyle("overflow","hidden");
}
private void setAttrFor_div_vmp_codigo_7_50(Widget widget)
{
}
private void setAttrFor_vmp_codigo_7_60(Widget widget)
{
widget.addAttribute("type","text");
widget.addAttribute("_name","view1:(Modulo.MediospDVW)vmp_codigo.7");
widget.addAttribute("name","view1:vmp_codigo.7");
widget.addStyle("overflow","hidden");
}
private void setAttrFor_div_vmp_codigo_8_50(Widget widget)
{
}
private void setAttrFor_vmp_codigo_8_60(Widget widget)
{
widget.addAttribute("type","text");
widget.addAttribute("_name","view1:(Modulo.MediospDVW)vmp_codigo.8");
widget.addAttribute("name","view1:vmp_codigo.8");
widget.addStyle("overflow","hidden");
}
private void setAttrFor_div_vmp_descripcion_0_50(Widget widget)
{
}
private void setAttrFor_vmp_descripcion_0_60(Widget widget)
{
widget.addAttribute("type","text");
widget.addAttribute("_name","view1:(Modulo.MediospDVW)vmp_descripcion.0");
widget.addAttribute("name","view1:vmp_descripcion.0");
widget.addStyle("overflow","hidden");
}
private void setAttrFor_div_vmp_descripcion_1_50(Widget widget)
{
}
private void setAttrFor_vmp_descripcion_1_60(Widget widget)
{
widget.addAttribute("type","text");
widget.addAttribute("_name","view1:(Modulo.MediospDVW)vmp_descripcion.1");
widget.addAttribute("name","view1:vmp_descripcion.1");
widget.addStyle("overflow","hidden");
}
private void setAttrFor_div_vmp_descripcion_2_50(Widget widget)
{
}
private void setAttrFor_vmp_descripcion_2_60(Widget widget)
{
widget.addAttribute("type","text");
widget.addAttribute("_name","view1:(Modulo.MediospDVW)vmp_descripcion.2");
widget.addAttribute("name","view1:vmp_descripcion.2");
widget.addStyle("overflow","hidden");
}
private void setAttrFor_div_vmp_descripcion_3_50(Widget widget)
{
}
private void setAttrFor_vmp_descripcion_3_60(Widget widget)
{
widget.addAttribute("type","text");
widget.addAttribute("_name","view1:(Modulo.MediospDVW)vmp_descripcion.3");
widget.addAttribute("name","view1:vmp_descripcion.3");
widget.addStyle("overflow","hidden");
}
private void setAttrFor_div_vmp_descripcion_4_50(Widget widget)
{
}
private void setAttrFor_vmp_descripcion_4_60(Widget widget)
{
widget.addAttribute("type","text");
widget.addAttribute("_name","view1:(Modulo.MediospDVW)vmp_descripcion.4");
widget.addAttribute("name","view1:vmp_descripcion.4");
widget.addStyle("overflow","hidden");
}
private void setAttrFor_div_vmp_descripcion_5_50(Widget widget)
{
}
private void setAttrFor_vmp_descripcion_5_60(Widget widget)
{
widget.addAttribute("type","text");
widget.addAttribute("_name","view1:(Modulo.MediospDVW)vmp_descripcion.5");
widget.addAttribute("name","view1:vmp_descripcion.5");
widget.addStyle("overflow","hidden");
}
private void setAttrFor_div_vmp_descripcion_6_50(Widget widget)
{
}
private void setAttrFor_vmp_descripcion_6_60(Widget widget)
{
widget.addAttribute("type","text");
widget.addAttribute("_name","view1:(Modulo.MediospDVW)vmp_descripcion.6");
widget.addAttribute("name","view1:vmp_descripcion.6");
widget.addStyle("overflow","hidden");
}
private void setAttrFor_div_vmp_descripcion_7_50(Widget widget)
{
}
private void setAttrFor_vmp_descripcion_7_60(Widget widget)
{
widget.addAttribute("type","text");
widget.addAttribute("_name","view1:(Modulo.MediospDVW)vmp_descripcion.7");
widget.addAttribute("name","view1:vmp_descripcion.7");
widget.addStyle("overflow","hidden");
}
private void setAttrFor_div_vmp_descripcion_8_50(Widget widget)
{
}
private void setAttrFor_vmp_descripcion_8_60(Widget widget)
{
widget.addAttribute("type","text");
widget.addAttribute("_name","view1:(Modulo.MediospDVW)vmp_descripcion.8");
widget.addAttribute("name","view1:vmp_descripcion.8");
widget.addStyle("overflow","hidden");
}
private void setAttrFor_div_box11__30(Widget widget)
{
}
private void setAttrFor_box11__40(Widget widget)
{
widget.addAttribute("_id","view1:(Modulo.MediospDVW)box11.");
widget.addAttribute("id","view1:box11.");
widget.addStyle("overflow","hidden");
}
private void setAttrFor_div_image1__50(Widget widget)
{
}
private void setAttrFor_image1__60(Widget widget)
{
widget.addAttribute("_id","view1:(Modulo.MediospDVW)box11:(Modulo.MediospDVW)image1.");
widget.addAttribute("id","view1:box11:image1.");
widget.addStyle("overflow","hidden");
}
private void setAttrFor_div_box111__30(Widget widget)
{
}
private void setAttrFor_box111__40(Widget widget)
{
widget.addAttribute("_id","view1:(Modulo.MediospDVW)box111.");
widget.addAttribute("id","view1:box111.");
widget.addStyle("overflow","hidden");
}
private void setAttrFor_div_label1__50(Widget widget)
{
}
private void setAttrFor_label1__60(Widget widget)
{
widget.addAttribute("_id","view1:(Modulo.MediospDVW)box111:(Modulo.MediospDVW)label1.");
widget.addAttribute("id","view1:box111:label1.");
widget.addStyle("overflow","hidden");
}
private void setAttrFor_div_label211__50(Widget widget)
{
}
private void setAttrFor_label211__60(Widget widget)
{
widget.addAttribute("_id","view1:(Modulo.MediospDVW)box111:(Modulo.MediospDVW)label211.");
widget.addAttribute("id","view1:box111:label211.");
widget.addStyle("overflow","hidden");
}
private void setAttrFor_div_textfield1__50(Widget widget)
{
}
private void setAttrFor_textfield1__60(Widget widget)
{
widget.addAttribute("_name","view1:(Modulo.MediospDVW)box111:(Modulo.MediospDVW)textfield1.");
widget.addAttribute("name","view1:box111:textfield1.");
widget.addAttribute("type","text");
widget.addStyle("overflow","hidden");
}
private void setAttrFor_div_textfield11__50(Widget widget)
{
}
private void setAttrFor_textfield11__60(Widget widget)
{
widget.addAttribute("_name","view1:(Modulo.MediospDVW)box111:(Modulo.MediospDVW)textfield11.");
widget.addAttribute("name","view1:box111:textfield11.");
widget.addAttribute("type","text");
widget.addStyle("overflow","hidden");
}
private void setAttrFor_div_label11__30(Widget widget)
{
}
private void setAttrFor_label11__40(Widget widget)
{
widget.addAttribute("_id","view1:(Modulo.MediospDVW)label11.");
widget.addAttribute("id","view1:label11.");
widget.addStyle("overflow","hidden");
}
private void dodiv_view1__10(Widget div_view1__10)
{
((ContainerWidget)this).addComponent(div_view1__10,"div_view1_");
setAttrFor_div_view1__10(div_view1__10);
nxjLayout.Modulo.MediospDVW_nxjLayoutAttr view1__20 = new nxjLayout.Modulo.MediospDVW_nxjLayoutAttr();
{
((ContainerWidget)div_view1__10).addComponent(view1__20,"view1_");
setAttrFor_view1__20(view1__20);
Widget div_RepeatingArea1__30 = ((ContainerWidget)view1__20).getComponent("div_RepeatingArea1_");
if (div_RepeatingArea1__30 != null)
{
setAttrFor_div_RepeatingArea1__30(div_RepeatingArea1__30);
Widget RepeatingArea1__40 = ((ContainerWidget)div_RepeatingArea1__30).getComponent("RepeatingArea1_");
if (RepeatingArea1__40 != null)
{
setAttrFor_RepeatingArea1__40(RepeatingArea1__40);
Widget div_Box__50 = ((ContainerWidget)RepeatingArea1__40).getComponent("div_Box_");
if (div_Box__50 != null)
{
setAttrFor_div_Box__50(div_Box__50);
Widget Box__60 = ((ContainerWidget)div_Box__50).getComponent("Box_");
if (Box__60 != null)
{
setAttrFor_Box__60(Box__60);
Widget div_Label__70 = ((ContainerWidget)Box__60).getComponent("div_Label_");
if (div_Label__70 != null)
{
setAttrFor_div_Label__70(div_Label__70);
Widget Label__80 = ((ContainerWidget)div_Label__70).getComponent("Label_");
if (Label__80 != null)
{
setAttrFor_Label__80(Label__80);
}
}
Widget div_Label1__70 = ((ContainerWidget)Box__60).getComponent("div_Label1_");
if (div_Label1__70 != null)
{
setAttrFor_div_Label1__70(div_Label1__70);
Widget Label1__80 = ((ContainerWidget)div_Label1__70).getComponent("Label1_");
if (Label1__80 != null)
{
setAttrFor_Label1__80(Label1__80);
}
}
Widget div_Label1__71 = ((ContainerWidget)Box__60).getComponent("div_Label1_");
if (div_Label1__71 != null)
{
setAttrFor_div_Label1__71(div_Label1__71);
Widget Label1__81 = ((ContainerWidget)div_Label1__71).getComponent("Label1_");
if (Label1__81 != null)
{
setAttrFor_Label1__81(Label1__81);
}
}
}
}
Widget div_vmp_categoria__50 = ((ContainerWidget)RepeatingArea1__40).getComponent("div_vmp_categoria_");
if (div_vmp_categoria__50 != null)
{
setAttrFor_div_vmp_categoria__50(div_vmp_categoria__50);
Widget vmp_categoria__60 = ((ContainerWidget)div_vmp_categoria__50).getComponent("vmp_categoria_");
if (vmp_categoria__60 != null)
{
setAttrFor_vmp_categoria__60(vmp_categoria__60);
}
}
Widget div_vmp_codigo__50 = ((ContainerWidget)RepeatingArea1__40).getComponent("div_vmp_codigo_");
if (div_vmp_codigo__50 != null)
{
setAttrFor_div_vmp_codigo__50(div_vmp_codigo__50);
Widget vmp_codigo__60 = ((ContainerWidget)div_vmp_codigo__50).getComponent("vmp_codigo_");
if (vmp_codigo__60 != null)
{
setAttrFor_vmp_codigo__60(vmp_codigo__60);
}
}
Widget div_vmp_descripcion__50 = ((ContainerWidget)RepeatingArea1__40).getComponent("div_vmp_descripcion_");
if (div_vmp_descripcion__50 != null)
{
setAttrFor_div_vmp_descripcion__50(div_vmp_descripcion__50);
Widget vmp_descripcion__60 = ((ContainerWidget)div_vmp_descripcion__50).getComponent("vmp_descripcion_");
if (vmp_descripcion__60 != null)
{
setAttrFor_vmp_descripcion__60(vmp_descripcion__60);
}
}
Widget div_vmp_categoria_0_50 = ((ContainerWidget)RepeatingArea1__40).getComponent("div_vmp_categoria_0");
if (div_vmp_categoria_0_50 != null)
{
setAttrFor_div_vmp_categoria_0_50(div_vmp_categoria_0_50);
Widget vmp_categoria_0_60 = ((ContainerWidget)div_vmp_categoria_0_50).getComponent("vmp_categoria_0");
if (vmp_categoria_0_60 != null)
{
setAttrFor_vmp_categoria_0_60(vmp_categoria_0_60);
}
}
Widget div_vmp_categoria_1_50 = ((ContainerWidget)RepeatingArea1__40).getComponent("div_vmp_categoria_1");
if (div_vmp_categoria_1_50 != null)
{
setAttrFor_div_vmp_categoria_1_50(div_vmp_categoria_1_50);
Widget vmp_categoria_1_60 = ((ContainerWidget)div_vmp_categoria_1_50).getComponent("vmp_categoria_1");
if (vmp_categoria_1_60 != null)
{
setAttrFor_vmp_categoria_1_60(vmp_categoria_1_60);
}
}
Widget div_vmp_categoria_2_50 = ((ContainerWidget)RepeatingArea1__40).getComponent("div_vmp_categoria_2");
if (div_vmp_categoria_2_50 != null)
{
setAttrFor_div_vmp_categoria_2_50(div_vmp_categoria_2_50);
Widget vmp_categoria_2_60 = ((ContainerWidget)div_vmp_categoria_2_50).getComponent("vmp_categoria_2");
if (vmp_categoria_2_60 != null)
{
setAttrFor_vmp_categoria_2_60(vmp_categoria_2_60);
}
}
Widget div_vmp_categoria_3_50 = ((ContainerWidget)RepeatingArea1__40).getComponent("div_vmp_categoria_3");
if (div_vmp_categoria_3_50 != null)
{
setAttrFor_div_vmp_categoria_3_50(div_vmp_categoria_3_50);
Widget vmp_categoria_3_60 = ((ContainerWidget)div_vmp_categoria_3_50).getComponent("vmp_categoria_3");
if (vmp_categoria_3_60 != null)
{
setAttrFor_vmp_categoria_3_60(vmp_categoria_3_60);
}
}
Widget div_vmp_categoria_4_50 = ((ContainerWidget)RepeatingArea1__40).getComponent("div_vmp_categoria_4");
if (div_vmp_categoria_4_50 != null)
{
setAttrFor_div_vmp_categoria_4_50(div_vmp_categoria_4_50);
Widget vmp_categoria_4_60 = ((ContainerWidget)div_vmp_categoria_4_50).getComponent("vmp_categoria_4");
if (vmp_categoria_4_60 != null)
{
setAttrFor_vmp_categoria_4_60(vmp_categoria_4_60);
}
}
Widget div_vmp_categoria_5_50 = ((ContainerWidget)RepeatingArea1__40).getComponent("div_vmp_categoria_5");
if (div_vmp_categoria_5_50 != null)
{
setAttrFor_div_vmp_categoria_5_50(div_vmp_categoria_5_50);
Widget vmp_categoria_5_60 = ((ContainerWidget)div_vmp_categoria_5_50).getComponent("vmp_categoria_5");
if (vmp_categoria_5_60 != null)
{
setAttrFor_vmp_categoria_5_60(vmp_categoria_5_60);
}
}
Widget div_vmp_categoria_6_50 = ((ContainerWidget)RepeatingArea1__40).getComponent("div_vmp_categoria_6");
if (div_vmp_categoria_6_50 != null)
{
setAttrFor_div_vmp_categoria_6_50(div_vmp_categoria_6_50);
Widget vmp_categoria_6_60 = ((ContainerWidget)div_vmp_categoria_6_50).getComponent("vmp_categoria_6");
if (vmp_categoria_6_60 != null)
{
setAttrFor_vmp_categoria_6_60(vmp_categoria_6_60);
}
}
Widget div_vmp_categoria_7_50 = ((ContainerWidget)RepeatingArea1__40).getComponent("div_vmp_categoria_7");
if (div_vmp_categoria_7_50 != null)
{
setAttrFor_div_vmp_categoria_7_50(div_vmp_categoria_7_50);
Widget vmp_categoria_7_60 = ((ContainerWidget)div_vmp_categoria_7_50).getComponent("vmp_categoria_7");
if (vmp_categoria_7_60 != null)
{
setAttrFor_vmp_categoria_7_60(vmp_categoria_7_60);
}
}
Widget div_vmp_categoria_8_50 = ((ContainerWidget)RepeatingArea1__40).getComponent("div_vmp_categoria_8");
if (div_vmp_categoria_8_50 != null)
{
setAttrFor_div_vmp_categoria_8_50(div_vmp_categoria_8_50);
Widget vmp_categoria_8_60 = ((ContainerWidget)div_vmp_categoria_8_50).getComponent("vmp_categoria_8");
if (vmp_categoria_8_60 != null)
{
setAttrFor_vmp_categoria_8_60(vmp_categoria_8_60);
}
}
Widget div_vmp_codigo_0_50 = ((ContainerWidget)RepeatingArea1__40).getComponent("div_vmp_codigo_0");
if (div_vmp_codigo_0_50 != null)
{
setAttrFor_div_vmp_codigo_0_50(div_vmp_codigo_0_50);
Widget vmp_codigo_0_60 = ((ContainerWidget)div_vmp_codigo_0_50).getComponent("vmp_codigo_0");
if (vmp_codigo_0_60 != null)
{
setAttrFor_vmp_codigo_0_60(vmp_codigo_0_60);
}
}
Widget div_vmp_codigo_1_50 = ((ContainerWidget)RepeatingArea1__40).getComponent("div_vmp_codigo_1");
if (div_vmp_codigo_1_50 != null)
{
setAttrFor_div_vmp_codigo_1_50(div_vmp_codigo_1_50);
Widget vmp_codigo_1_60 = ((ContainerWidget)div_vmp_codigo_1_50).getComponent("vmp_codigo_1");
if (vmp_codigo_1_60 != null)
{
setAttrFor_vmp_codigo_1_60(vmp_codigo_1_60);
}
}
Widget div_vmp_codigo_2_50 = ((ContainerWidget)RepeatingArea1__40).getComponent("div_vmp_codigo_2");
if (div_vmp_codigo_2_50 != null)
{
setAttrFor_div_vmp_codigo_2_50(div_vmp_codigo_2_50);
Widget vmp_codigo_2_60 = ((ContainerWidget)div_vmp_codigo_2_50).getComponent("vmp_codigo_2");
if (vmp_codigo_2_60 != null)
{
setAttrFor_vmp_codigo_2_60(vmp_codigo_2_60);
}
}
Widget div_vmp_codigo_3_50 = ((ContainerWidget)RepeatingArea1__40).getComponent("div_vmp_codigo_3");
if (div_vmp_codigo_3_50 != null)
{
setAttrFor_div_vmp_codigo_3_50(div_vmp_codigo_3_50);
Widget vmp_codigo_3_60 = ((ContainerWidget)div_vmp_codigo_3_50).getComponent("vmp_codigo_3");
if (vmp_codigo_3_60 != null)
{
setAttrFor_vmp_codigo_3_60(vmp_codigo_3_60);
}
}
Widget div_vmp_codigo_4_50 = ((ContainerWidget)RepeatingArea1__40).getComponent("div_vmp_codigo_4");
if (div_vmp_codigo_4_50 != null)
{
setAttrFor_div_vmp_codigo_4_50(div_vmp_codigo_4_50);
Widget vmp_codigo_4_60 = ((ContainerWidget)div_vmp_codigo_4_50).getComponent("vmp_codigo_4");
if (vmp_codigo_4_60 != null)
{
setAttrFor_vmp_codigo_4_60(vmp_codigo_4_60);
}
}
Widget div_vmp_codigo_5_50 = ((ContainerWidget)RepeatingArea1__40).getComponent("div_vmp_codigo_5");
if (div_vmp_codigo_5_50 != null)
{
setAttrFor_div_vmp_codigo_5_50(div_vmp_codigo_5_50);
Widget vmp_codigo_5_60 = ((ContainerWidget)div_vmp_codigo_5_50).getComponent("vmp_codigo_5");
if (vmp_codigo_5_60 != null)
{
setAttrFor_vmp_codigo_5_60(vmp_codigo_5_60);
}
}
Widget div_vmp_codigo_6_50 = ((ContainerWidget)RepeatingArea1__40).getComponent("div_vmp_codigo_6");
if (div_vmp_codigo_6_50 != null)
{
setAttrFor_div_vmp_codigo_6_50(div_vmp_codigo_6_50);
Widget vmp_codigo_6_60 = ((ContainerWidget)div_vmp_codigo_6_50).getComponent("vmp_codigo_6");
if (vmp_codigo_6_60 != null)
{
setAttrFor_vmp_codigo_6_60(vmp_codigo_6_60);
}
}
Widget div_vmp_codigo_7_50 = ((ContainerWidget)RepeatingArea1__40).getComponent("div_vmp_codigo_7");
if (div_vmp_codigo_7_50 != null)
{
setAttrFor_div_vmp_codigo_7_50(div_vmp_codigo_7_50);
Widget vmp_codigo_7_60 = ((ContainerWidget)div_vmp_codigo_7_50).getComponent("vmp_codigo_7");
if (vmp_codigo_7_60 != null)
{
setAttrFor_vmp_codigo_7_60(vmp_codigo_7_60);
}
}
Widget div_vmp_codigo_8_50 = ((ContainerWidget)RepeatingArea1__40).getComponent("div_vmp_codigo_8");
if (div_vmp_codigo_8_50 != null)
{
setAttrFor_div_vmp_codigo_8_50(div_vmp_codigo_8_50);
Widget vmp_codigo_8_60 = ((ContainerWidget)div_vmp_codigo_8_50).getComponent("vmp_codigo_8");
if (vmp_codigo_8_60 != null)
{
setAttrFor_vmp_codigo_8_60(vmp_codigo_8_60);
}
}
Widget div_vmp_descripcion_0_50 = ((ContainerWidget)RepeatingArea1__40).getComponent("div_vmp_descripcion_0");
if (div_vmp_descripcion_0_50 != null)
{
setAttrFor_div_vmp_descripcion_0_50(div_vmp_descripcion_0_50);
Widget vmp_descripcion_0_60 = ((ContainerWidget)div_vmp_descripcion_0_50).getComponent("vmp_descripcion_0");
if (vmp_descripcion_0_60 != null)
{
setAttrFor_vmp_descripcion_0_60(vmp_descripcion_0_60);
}
}
Widget div_vmp_descripcion_1_50 = ((ContainerWidget)RepeatingArea1__40).getComponent("div_vmp_descripcion_1");
if (div_vmp_descripcion_1_50 != null)
{
setAttrFor_div_vmp_descripcion_1_50(div_vmp_descripcion_1_50);
Widget vmp_descripcion_1_60 = ((ContainerWidget)div_vmp_descripcion_1_50).getComponent("vmp_descripcion_1");
if (vmp_descripcion_1_60 != null)
{
setAttrFor_vmp_descripcion_1_60(vmp_descripcion_1_60);
}
}
Widget div_vmp_descripcion_2_50 = ((ContainerWidget)RepeatingArea1__40).getComponent("div_vmp_descripcion_2");
if (div_vmp_descripcion_2_50 != null)
{
setAttrFor_div_vmp_descripcion_2_50(div_vmp_descripcion_2_50);
Widget vmp_descripcion_2_60 = ((ContainerWidget)div_vmp_descripcion_2_50).getComponent("vmp_descripcion_2");
if (vmp_descripcion_2_60 != null)
{
setAttrFor_vmp_descripcion_2_60(vmp_descripcion_2_60);
}
}
Widget div_vmp_descripcion_3_50 = ((ContainerWidget)RepeatingArea1__40).getComponent("div_vmp_descripcion_3");
if (div_vmp_descripcion_3_50 != null)
{
setAttrFor_div_vmp_descripcion_3_50(div_vmp_descripcion_3_50);
Widget vmp_descripcion_3_60 = ((ContainerWidget)div_vmp_descripcion_3_50).getComponent("vmp_descripcion_3");
if (vmp_descripcion_3_60 != null)
{
setAttrFor_vmp_descripcion_3_60(vmp_descripcion_3_60);
}
}
Widget div_vmp_descripcion_4_50 = ((ContainerWidget)RepeatingArea1__40).getComponent("div_vmp_descripcion_4");
if (div_vmp_descripcion_4_50 != null)
{
setAttrFor_div_vmp_descripcion_4_50(div_vmp_descripcion_4_50);
Widget vmp_descripcion_4_60 = ((ContainerWidget)div_vmp_descripcion_4_50).getComponent("vmp_descripcion_4");
if (vmp_descripcion_4_60 != null)
{
setAttrFor_vmp_descripcion_4_60(vmp_descripcion_4_60);
}
}
Widget div_vmp_descripcion_5_50 = ((ContainerWidget)RepeatingArea1__40).getComponent("div_vmp_descripcion_5");
if (div_vmp_descripcion_5_50 != null)
{
setAttrFor_div_vmp_descripcion_5_50(div_vmp_descripcion_5_50);
Widget vmp_descripcion_5_60 = ((ContainerWidget)div_vmp_descripcion_5_50).getComponent("vmp_descripcion_5");
if (vmp_descripcion_5_60 != null)
{
setAttrFor_vmp_descripcion_5_60(vmp_descripcion_5_60);
}
}
Widget div_vmp_descripcion_6_50 = ((ContainerWidget)RepeatingArea1__40).getComponent("div_vmp_descripcion_6");
if (div_vmp_descripcion_6_50 != null)
{
setAttrFor_div_vmp_descripcion_6_50(div_vmp_descripcion_6_50);
Widget vmp_descripcion_6_60 = ((ContainerWidget)div_vmp_descripcion_6_50).getComponent("vmp_descripcion_6");
if (vmp_descripcion_6_60 != null)
{
setAttrFor_vmp_descripcion_6_60(vmp_descripcion_6_60);
}
}
Widget div_vmp_descripcion_7_50 = ((ContainerWidget)RepeatingArea1__40).getComponent("div_vmp_descripcion_7");
if (div_vmp_descripcion_7_50 != null)
{
setAttrFor_div_vmp_descripcion_7_50(div_vmp_descripcion_7_50);
Widget vmp_descripcion_7_60 = ((ContainerWidget)div_vmp_descripcion_7_50).getComponent("vmp_descripcion_7");
if (vmp_descripcion_7_60 != null)
{
setAttrFor_vmp_descripcion_7_60(vmp_descripcion_7_60);
}
}
Widget div_vmp_descripcion_8_50 = ((ContainerWidget)RepeatingArea1__40).getComponent("div_vmp_descripcion_8");
if (div_vmp_descripcion_8_50 != null)
{
setAttrFor_div_vmp_descripcion_8_50(div_vmp_descripcion_8_50);
Widget vmp_descripcion_8_60 = ((ContainerWidget)div_vmp_descripcion_8_50).getComponent("vmp_descripcion_8");
if (vmp_descripcion_8_60 != null)
{
setAttrFor_vmp_descripcion_8_60(vmp_descripcion_8_60);
}
}
}
}
Widget div_box11__30 = ((ContainerWidget)view1__20).getComponent("div_box11_");
if (div_box11__30 != null)
{
setAttrFor_div_box11__30(div_box11__30);
Widget box11__40 = ((ContainerWidget)div_box11__30).getComponent("box11_");
if (box11__40 != null)
{
setAttrFor_box11__40(box11__40);
Widget div_image1__50 = ((ContainerWidget)box11__40).getComponent("div_image1_");
if (div_image1__50 != null)
{
setAttrFor_div_image1__50(div_image1__50);
Widget image1__60 = ((ContainerWidget)div_image1__50).getComponent("image1_");
if (image1__60 != null)
{
setAttrFor_image1__60(image1__60);
}
}
}
}
Widget div_box111__30 = ((ContainerWidget)view1__20).getComponent("div_box111_");
if (div_box111__30 != null)
{
setAttrFor_div_box111__30(div_box111__30);
Widget box111__40 = ((ContainerWidget)div_box111__30).getComponent("box111_");
if (box111__40 != null)
{
setAttrFor_box111__40(box111__40);
Widget div_label1__50 = ((ContainerWidget)box111__40).getComponent("div_label1_");
if (div_label1__50 != null)
{
setAttrFor_div_label1__50(div_label1__50);
Widget label1__60 = ((ContainerWidget)div_label1__50).getComponent("label1_");
if (label1__60 != null)
{
setAttrFor_label1__60(label1__60);
}
}
Widget div_label211__50 = ((ContainerWidget)box111__40).getComponent("div_label211_");
if (div_label211__50 != null)
{
setAttrFor_div_label211__50(div_label211__50);
Widget label211__60 = ((ContainerWidget)div_label211__50).getComponent("label211_");
if (label211__60 != null)
{
setAttrFor_label211__60(label211__60);
}
}
Widget div_textfield1__50 = ((ContainerWidget)box111__40).getComponent("div_textfield1_");
if (div_textfield1__50 != null)
{
setAttrFor_div_textfield1__50(div_textfield1__50);
Widget textfield1__60 = ((ContainerWidget)div_textfield1__50).getComponent("textfield1_");
if (textfield1__60 != null)
{
setAttrFor_textfield1__60(textfield1__60);
}
}
Widget div_textfield11__50 = ((ContainerWidget)box111__40).getComponent("div_textfield11_");
if (div_textfield11__50 != null)
{
setAttrFor_div_textfield11__50(div_textfield11__50);
Widget textfield11__60 = ((ContainerWidget)div_textfield11__50).getComponent("textfield11_");
if (textfield11__60 != null)
{
setAttrFor_textfield11__60(textfield11__60);
}
}
}
}
Widget div_label11__30 = ((ContainerWidget)view1__20).getComponent("div_label11_");
if (div_label11__30 != null)
{
setAttrFor_div_label11__30(div_label11__30);
Widget label11__40 = ((ContainerWidget)div_label11__30).getComponent("label11_");
if (label11__40 != null)
{
setAttrFor_label11__40(label11__40);
}
}
}
}
}
| [
"rokcrow@gmail.com"
] | rokcrow@gmail.com |
5468f58c4f0fa59b9793109183eb198467fe6e6a | 65e81a6007d28a628299d7bd59a3540f30ae893d | /src/offer/T41.java | cd8298e1cf3173e04c31d51ce5b6cd571a3b1f57 | [] | no_license | wiyee/coder | cd97d5b9b3869540fcb9e019b00685674675b043 | 5e196f80c6eae4551594706b50eb457a01cef646 | refs/heads/master | 2020-03-17T17:06:17.836145 | 2018-09-27T10:56:04 | 2018-09-27T10:56:04 | 133,775,197 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,029 | java | package offer;
import java.util.ArrayList;
/**
* Created by wiyee on 2018/3/16.
*/
public class T41 {
/**
* 和为s的连续整数序列
* 小明很喜欢数学,有一天他在做数学作业时,要求计算出9~16的和,他马上就写出了正确答案是100。但是他并不满足于此,
* 他在想究竟有多少种连续的正数序列的和为100(至少包括两个数)。没多久,他就得到另一组连续正数和为100的序列:18,19,20,21,22。
* 现在把问题交给你,你能不能也很快的找出所有和为S的连续正数序列? Good Luck!
*
* @param sum
* @return
*/
public ArrayList<ArrayList<Integer>> FindContinuousSequence(int sum) {
ArrayList<ArrayList<Integer>> lists = new ArrayList<>();
if (sum < 3)
return lists;
int left = 1;
int right = 2;
while (right - 1 <= sum / 2) {
if (sumList(left, right) == sum) {
ArrayList<Integer> list = new ArrayList<>();
for (int i = left; i <= right; i++) {
list.add(i);
}
lists.add(list);
left++;
right = left + 1;
} else if (sumList(left, right) < sum)
right++;
else
left++;
}
return lists;
}
private static int sumList(int left, int right) {
int sum = 0;
for (int i = left; i <= right; i++) {
sum += i;
}
return sum;
}
/*
* 和为S的两个数字
* 输入一个递增排序的数组和一个数字S,在数组中查找两个数,是的他们的和正好是S,如果有多对数字的和等于S,输出两个数的乘积最小的。
*/
public ArrayList<Integer> FindNumbersWithSum(int[] array, int sum) {
ArrayList<Integer> list = new ArrayList<>();
if (sum < 1 || array.length < 1)
return list;
int left = 0;
int right = array.length - 1;
int product = -1;
while (left < right) {
if (array[left] + array[right] == sum) {
if (array[left] * array[right] < product) {
list.remove(0);
list.remove(1);
list.add(array[left]);
list.add(array[right]);
product = array[left] * array[right];
} else if (product == -1) {
list.add(array[left]);
list.add(array[right]);
product = array[left] * array[right];
}
left++;
right--;
} else if (array[left] + array[right] < sum)
left++;
else right--;
}
return list;
}
public static void main(String[] args) {
T41 t41 = new T41();
int[] array = new int[]{1, 2, 4, 7, 11, 15};
System.out.println(t41.FindNumbersWithSum(array, 15));
}
}
| [
"woyiwuai@sina.com"
] | woyiwuai@sina.com |
225153d3027b5e02d41a6983ed0c87c3daab1373 | fe4bd1d7ae0a0301bc27f6d63476b1b1c4319283 | /src/main/java/com/taiji/dds/StringMsg.java | 05101c932630fb4c0818b180817049dd4192c4ca | [] | no_license | citizen007/ddsHelloWorld | 5aac1ec4804742a1fcfbe13c7297271c28a6967d | bc6d7f11db70aceae6801bf49952e404993930ed | refs/heads/master | 2020-05-29T11:56:43.919203 | 2016-03-22T02:56:17 | 2016-03-22T02:56:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 495 | java | package com.taiji.dds;
// CoreDX DDL Generated code. Do not modify - modifications may be overwritten.
public class StringMsg {
// instance variables
public String msg;
// constructors
public StringMsg() { }
public StringMsg( String __f1 ) {
msg = __f1;
}
public StringMsg init() {
msg = new String();
return this;
}
public void clear() {
msg = null;
}
public void copy( StringMsg from ) {
this.msg = from.msg;
}
}; // StringMsg
| [
"jasonxml@126.com"
] | jasonxml@126.com |
d77005bc877f05dc52866bbae9cc1b541fcc6b94 | db0f9e5d68a24ea48cfa69e454814b942be9ba0f | /ratis-test/src/test/java/org/apache/ratis/retry/TestExceptionDependentRetry.java | 769245bf614bf83754ea3612c297ebd2ed6a2ae6 | [
"Apache-2.0",
"CC0-1.0",
"BSD-2-Clause",
"BSD-3-Clause"
] | permissive | meijies/incubator-ratis | e5cd66267eae4b8abc4943aacea1439691b7a95e | cfd7c06079a7e14ae0684f8a0482bd74b9b3fb47 | refs/heads/master | 2021-03-20T14:53:52.994507 | 2020-04-03T17:06:55 | 2020-04-03T17:06:55 | 247,215,329 | 1 | 0 | Apache-2.0 | 2020-03-14T05:05:31 | 2020-03-14T05:05:31 | null | UTF-8 | Java | false | false | 5,800 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.ratis.retry;
import org.apache.ratis.client.ClientRetryEvent;
import org.apache.ratis.protocol.TimeoutIOException;
import org.apache.ratis.util.TimeDuration;
import org.junit.Assert;
import org.junit.Test;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import static org.junit.Assert.fail;
/**
* Class to test {@link ExceptionDependentRetry}.
*/
public class TestExceptionDependentRetry {
@Test
public void testExceptionDependentRetrySuccess() {
ExceptionDependentRetry.Builder builder =
ExceptionDependentRetry.newBuilder();
int ioExceptionRetries = 1;
int timeoutExceptionRetries = 2;
int defaultExceptionRetries = 5;
long ioExceptionSleepTime = 1;
long timeoutExceptionSleepTime = 4;
long defaultExceptionSleepTime = 10;
builder.setDefaultPolicy(RetryPolicies.retryUpToMaximumCountWithFixedSleep(defaultExceptionRetries,
TimeDuration.valueOf(defaultExceptionSleepTime, TimeUnit.SECONDS)));
builder.setExceptionToPolicy(IOException.class,
RetryPolicies.retryUpToMaximumCountWithFixedSleep(ioExceptionRetries,
TimeDuration.valueOf(ioExceptionSleepTime, TimeUnit.SECONDS)));
builder.setExceptionToPolicy(TimeoutIOException.class,
RetryPolicies.retryUpToMaximumCountWithFixedSleep(timeoutExceptionRetries,
TimeDuration.valueOf(timeoutExceptionSleepTime, TimeUnit.SECONDS)));
ExceptionDependentRetry exceptionDependentRetry = builder.build();
testException(ioExceptionRetries, ioExceptionSleepTime,
exceptionDependentRetry, new IOException());
testException(timeoutExceptionRetries, timeoutExceptionSleepTime,
exceptionDependentRetry, new TimeoutIOException("time out"));
// now try with an exception which is not there in the map.
testException(defaultExceptionRetries, defaultExceptionSleepTime,
exceptionDependentRetry, new TimeoutException());
}
@Test
public void testExceptionDependentRetryFailureWithExceptionDuplicate() {
try {
ExceptionDependentRetry.Builder builder =
ExceptionDependentRetry.newBuilder();
builder.setExceptionToPolicy(IOException.class,
RetryPolicies.retryUpToMaximumCountWithFixedSleep(1,
TimeDuration.valueOf(1, TimeUnit.SECONDS)));
builder.setExceptionToPolicy(IOException.class,
RetryPolicies.retryUpToMaximumCountWithFixedSleep(1,
TimeDuration.valueOf(1, TimeUnit.SECONDS)));
fail("testExceptionDependentRetryFailure failed");
} catch (Exception ex) {
Assert.assertEquals(IllegalStateException.class, ex.getClass());
}
}
@Test
public void testExceptionDependentRetryFailureWithExceptionMappedToNull() {
try {
ExceptionDependentRetry.Builder builder =
ExceptionDependentRetry.newBuilder();
builder.setExceptionToPolicy(IOException.class,
RetryPolicies.retryUpToMaximumCountWithFixedSleep(1,
TimeDuration.valueOf(1, TimeUnit.SECONDS)));
builder.setExceptionToPolicy(IOException.class, null);
fail("testExceptionDependentRetryFailure failed");
} catch (Exception ex) {
Assert.assertEquals(IllegalStateException.class, ex.getClass());
}
}
@Test
public void testExceptionDependentRetryFailureWithNoDefault() {
try {
ExceptionDependentRetry.Builder builder =
ExceptionDependentRetry.newBuilder();
builder.setExceptionToPolicy(IOException.class,
RetryPolicies.retryUpToMaximumCountWithFixedSleep(1,
TimeDuration.valueOf(1, TimeUnit.SECONDS)));
builder.build();
fail("testExceptionDependentRetryFailureWithNoDefault failed");
} catch (Exception ex) {
Assert.assertEquals(IllegalStateException.class, ex.getClass());
}
try {
ExceptionDependentRetry.Builder builder =
ExceptionDependentRetry.newBuilder();
builder.setExceptionToPolicy(IOException.class,
RetryPolicies.retryUpToMaximumCountWithFixedSleep(1,
TimeDuration.valueOf(1, TimeUnit.SECONDS)));
builder.setDefaultPolicy(null);
fail("testExceptionDependentRetryFailureWithNoDefault failed");
} catch (Exception ex) {
Assert.assertEquals(IllegalStateException.class, ex.getClass());
}
}
private void testException(int retries, long sleepTime,
ExceptionDependentRetry exceptionDependentRetry, Exception exception) {
for (int i = 0; i < retries + 1; i++) {
RetryPolicy.Action action =
exceptionDependentRetry.handleAttemptFailure(new ClientRetryEvent(i,
null, exception));
final boolean expected = i < retries;
Assert.assertEquals(expected, action.shouldRetry());
if (expected) {
Assert.assertEquals(sleepTime, action.getSleepTime().getDuration());
} else {
Assert.assertEquals(0L, action.getSleepTime().getDuration());
}
}
}
}
| [
"ljain@apache.org"
] | ljain@apache.org |
73733dfb0b7d71a3e67a4f7ed3090400ad701e74 | 9508868f54802408df2ca922453c6ba1af01c60e | /src/main/java/com/kepler/config/parser/ConfigParser4Date.java | 9e9f171e4f25d402496a58cbeec36bd341466c55 | [] | no_license | easonlong/Kepler-All | de94c8258e55a1443eb5ce27b4659a835830890d | 3633dde36fb85178b0288fc3f0eb4a25134ce8d1 | refs/heads/master | 2020-09-01T06:29:32.330733 | 2019-02-20T04:52:16 | 2019-02-20T04:52:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 844 | java | package com.kepler.config.parser;
import java.text.SimpleDateFormat;
import java.util.Date;
import com.kepler.KeplerLocalException;
import com.kepler.config.ConfigParser;
import com.kepler.config.PropertiesUtils;
/**
* String -> Date解析
*
* @author kim 2016年1月5日
*/
public class ConfigParser4Date implements ConfigParser {
/**
* 默认格式
*/
private static final String FORMAT = PropertiesUtils.get(ConfigParser4Date.class.getName().toLowerCase() + ".format", "yyyy-MM-dd hh:mm:ss");
@Override
public Object parse(Class<?> request, String config) {
try {
return new SimpleDateFormat(ConfigParser4Date.FORMAT).parse(config);
} catch (Throwable throwable) {
throw new KeplerLocalException(throwable);
}
}
@Override
public boolean support(Class<?> request) {
return Date.class.equals(request);
}
}
| [
"shenjiawei@didichuxing.com"
] | shenjiawei@didichuxing.com |
0fe4d65ae1f15bfe7ddadce43c2f7119cb50166f | 67e90d41db0cf1adfa3053014b43e78a24d35db1 | /src/main/java/am/inecobank/pages/flexibleDeposit/InecoBankFlexibleDepositPageXpaths.java | 1e8f5daa597ec3177e42438a604c294284edf9cd | [] | no_license | SandroDarbinyan/InecoBankTestCases | 228bcf841519a4a8c6865867e34b757cfd8d5aa5 | b19b4691afd313ea6f0427cb1a39db61649b4782 | refs/heads/master | 2023-05-10T14:31:12.270102 | 2022-04-04T21:01:15 | 2022-04-04T21:01:15 | 233,617,927 | 0 | 0 | null | 2023-05-09T18:43:00 | 2020-01-13T14:43:48 | Java | UTF-8 | Java | false | false | 223 | java | package am.inecobank.pages.flexibleDeposit;
public class InecoBankFlexibleDepositPageXpaths {
public static final String FLEXIBLE_DEPOSIT_TEXT = "//h1[@class='customDetailBanner__title' and text()='Flexible Deposit']";
}
| [
"sandro.darbinyan@gmail.com"
] | sandro.darbinyan@gmail.com |
e9ba02eb850c1b4e603e6032d05f030725762420 | 67094d5a3ff45aa834d06520ad5ded0d98301b8c | /firstapp/src/main/java/edu/scranton/cs/firstapp/GreetingController.java | 55a0b3f0f91e6a1a0384cf2e060a8a80bbcf19d8 | [] | no_license | Ceverine/DevOpProject | 8367cfd184f3c488c294603d6fc37700e7c60a78 | da54d8a46aa7979fa83281ee2278533171222b18 | refs/heads/master | 2022-07-02T14:50:01.038303 | 2020-05-12T19:10:30 | 2020-05-12T19:10:30 | 261,917,358 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 706 | java | package edu.scranton.cs.firstapp;
import java.util.concurrent.atomic.AtomicLong;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class GreetingController {
private static final String template = "Hello, %s!";
private final AtomicLong counter = new AtomicLong();
@RequestMapping("/greeting")
public Greeting greeting(@RequestParam(value="name", defaultValue="World") String name) {
return new Greeting(counter.incrementAndGet(),
String.format(template, name)); }
}
| [
"sabrina.alvarez@scranton.edu"
] | sabrina.alvarez@scranton.edu |
929d449d5a54b9d1a4b824156bff78ece985abf4 | b646fcfedf8c8efa05923b353065a203c38a5455 | /dw-lucene-application/src/main/java/com/alexsmaliy/dl4s/index/IndexUtils.java | 58bccbe75cc57b7d902ee4e82b9f2dec6f98f7f5 | [] | no_license | alexsmaliy/dl-dw-lucene | a7158453312b9ec50d071fe39db0a0a985835779 | ad17e376399463721f7a9309ddfac0141365ce50 | refs/heads/master | 2020-07-23T21:37:45.828459 | 2019-09-12T01:11:00 | 2019-09-12T01:11:00 | 207,712,395 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 445 | java | package com.alexsmaliy.dl4s.index;
import java.util.Base64;
public class IndexUtils {
private IndexUtils() { /* utils class */ }
public static String encodeIndexName(String indexName) {
return new String(Base64.getUrlEncoder().encode(indexName.getBytes()));
}
public static String decodeIndexName(String base64IndexName) {
return new String(Base64.getUrlDecoder().decode(base64IndexName.getBytes()));
}
}
| [
"alex.smaliy@gmail.com"
] | alex.smaliy@gmail.com |
05bb504e5d57c5ef74abd31b32473357f906b0fc | 095417cdcaade33c314ec34c0b80ccc2e1b0f18a | /Menu/Menu-ejb/src/main/java/com/projet/model/Categorie.java | 3894dd6c69f8fa2b94d6325b952aada745c65158 | [] | no_license | benlama/Menu | df27541e5556be5f852e4f71441e639aaa17591e | 2b4d5f3939dfb774b28272cfb31b118d3474cfdf | refs/heads/master | 2021-01-22T20:25:51.169679 | 2015-04-26T15:51:35 | 2015-04-26T15:51:35 | 34,670,952 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,971 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.projet.model;
import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
/**
*
* @author DNS
*/
@Entity
@Table(name = "categorie")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "Categorie.findAll", query = "SELECT c FROM Categorie c"),
@NamedQuery(name = "Categorie.findById", query = "SELECT c FROM Categorie c WHERE c.id = :id"),
@NamedQuery(name = "Categorie.findByDescription", query = "SELECT c FROM Categorie c WHERE c.description = :description"),
@NamedQuery(name = "Categorie.findByImage", query = "SELECT c FROM Categorie c WHERE c.image = :image"),
@NamedQuery(name = "Categorie.findByLibelle", query = "SELECT c FROM Categorie c WHERE c.libelle = :libelle"),
@NamedQuery(name = "Categorie.findByStatus", query = "SELECT c FROM Categorie c WHERE c.status = :status")})
public class Categorie implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Size(max = 255)
@Column(name = "description")
private String description;
@Size(max = 255)
@Column(name = "image")
private String image;
@Size(max = 255)
@Column(name = "libelle")
private String libelle;
@Size(max = 255)
@Column(name = "status")
private String status;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "categorie")
private List<PlatCategorie> platCategorieList;
public Categorie() {
}
public Categorie(Integer id) {
this.id = id;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
public String getLibelle() {
return libelle;
}
public void setLibelle(String libelle) {
this.libelle = libelle;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
@XmlTransient
public List<PlatCategorie> getPlatCategorieList() {
return platCategorieList;
}
public void setPlatCategorieList(List<PlatCategorie> platCategorieList) {
this.platCategorieList = platCategorieList;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.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 Categorie)) {
return false;
}
Categorie other = (Categorie) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "matier.Categorie[ id=" + id + " ]";
}
}
| [
"amine.benlama@gmail.com"
] | amine.benlama@gmail.com |
a121df8781f5e14c33878c03afced949a5012edb | 9c77721c9b2c361ee426b02f2f04073fb9133228 | /dogpro/Common-IMServer/src/main/java/com/imserver/mqtttool/MQTTRedisReadThread.java | df2be9cbd317cc9904ac8d1130b90d9ef3f36896 | [] | no_license | Chuchilok/GitHubRepository | 1a393fe5204a7d3ed702b8b2a24c43ea472f3e85 | 195a8befb6c61f3f7ed30c36d3a08a135edb96a9 | refs/heads/master | 2020-03-24T21:14:05.816292 | 2018-07-31T14:32:12 | 2018-07-31T14:32:12 | 143,020,321 | 0 | 0 | null | 2018-07-31T14:39:05 | 2018-07-31T13:47:40 | Java | UTF-8 | Java | false | false | 16,391 | java | package com.imserver.mqtttool;
import java.io.UnsupportedEncodingException;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicLong;
import redis.clients.jedis.Jedis;
import com.alibaba.druid.util.Base64;
import com.alibaba.fastjson.JSONObject;
import com.dogpro.common.domain.IMmessage;
import com.dogpro.common.domain.IMsend;
import com.dogpro.common.domain.PushMessage;
import com.dogpro.common.domain.SingletonObject;
import com.dogpro.common.tool.ObjectUtil;
import com.dogpro.common.tool.SpringInit;
import com.dogpro.service.dbservice.WalkingDogdbService;
import com.ibm.micro.client.mqttv3.MqttException;
import com.imserver.mqtttool.IBM.MQTTService;
import com.imserver.service.dbservice.IMRedisdbService;
public class MQTTRedisReadThread implements Runnable {
private Jedis jedis = null;
String key = "";
// private final static int poolsize = 1000;
// private static ExecutorService MQTTThreadPool = Executors
// .newFixedThreadPool(poolsize);
private MQTTService MQTTServiceList = null;
AtomicLong counter = null;
private IMRedisdbService imRedisdbService;
// 这里引用了WalkingDogdbService 类的东西
private WalkingDogdbService walkingDogdbService;
public MQTTRedisReadThread(Jedis jedis, String key, int id,
AtomicLong counter) {
this.counter = counter;
this.jedis = jedis;
this.key = key;
String ss = "FFF" + id;
try {
this.MQTTServiceList = new MQTTService(ss);
} catch (MqttException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
imRedisdbService = (IMRedisdbService) SpringInit
.getApplicationContext().getBean("IMRedisdbService");
walkingDogdbService = (WalkingDogdbService) SpringInit
.getApplicationContext().getBean("WalkingDogdbService");
}
public void run() {
while (true) {
try {
// final byte[] str = jedis.rpop(key.getBytes());
// // counter.incrementAndGet();
// if (null != str) {
// IMsend iMsend = (IMsend) ObjectUtil.bytes2Object(str);
// distributeMsg(iMsend);
// }
//使用brpop
final List<byte[]> result = jedis.brpop(10, key.getBytes());
if(result!=null){
IMsend iMsend = (IMsend) ObjectUtil.bytes2Object(result.get(1));
distributeMsg(iMsend);
}
} catch (Exception e) {
// 连接失败
if (!jedis.isConnected()) {
// 返回连接池里面
jedis.close();
// 重新获取连接
jedis = MQTTjedisManager.instance().getJedis();
}
}
}
}
public void distributeMsg(IMsend iMsend) {
// 根据接受者id对应 token 判断是否离线 是否ios用户
try {
// IOS推送显示文字
String iosPushContent = "";
String jsonString = new String(Base64.base64ToByteArray(iMsend
.getContent()), "utf-8");
JSONObject jsonObject = JSONObject.parseObject(jsonString);
IMmessage iMmessage = JSONObject.toJavaObject(jsonObject,
IMmessage.class);
// 接收者userId 集合
Set<String> revUidSet = new HashSet<String>();
// 判断消息类型
int type = iMmessage.getType();
// 是否群发标志
boolean groupflag = false;
JSONObject contentJson = null;
Map<String, Object> map = null;
String nickname = "";
{
switch (type) {
case 1:
// 好友请求1
revUidSet.add(iMmessage.getRevUid() + "");
contentJson = JSONObject
.parseObject(iMmessage.getContent());
map = contentJson;
nickname = map.get("nickname").toString();
iosPushContent = nickname + " 向你发送请求好友添加";
break;
case 2:
// 好友请求回复2
revUidSet.add(iMmessage.getRevUid() + "");
contentJson = JSONObject
.parseObject(iMmessage.getContent());
map = contentJson;
nickname = map.get("nickname").toString();
iosPushContent = nickname + " 同意你的好友验证";
break;
case 3:
// 好友文本消息3
revUidSet.add(iMmessage.getRevUid() + "");
contentJson = JSONObject
.parseObject(iMmessage.getContent());
map = contentJson;
nickname = imRedisdbService.getUserNickname(iMmessage
.getSendUid());
String content = map.get("content").toString();
content = content.length() > 20 ? content.substring(0, 20)
+ "……" : content;
iosPushContent = nickname + ":" + content;
break;
case 4:
// 好友图片信息4
revUidSet.add(iMmessage.getRevUid() + "");
nickname = imRedisdbService.getUserNickname(iMmessage
.getSendUid());
iosPushContent = nickname + ":" + "[图片]";
break;
case 5:
// 好友视频信息5
revUidSet.add(iMmessage.getRevUid() + "");
nickname = imRedisdbService.getUserNickname(iMmessage
.getSendUid());
iosPushContent = nickname + ":" + "[视频信息]";
break;
case 6:
// 好友定位信息6
revUidSet.add(iMmessage.getRevUid() + "");
nickname = imRedisdbService.getUserNickname(iMmessage
.getSendUid());
iosPushContent = nickname + ":" + "[定位信息]";
break;
case 7:
// 好友语音7
revUidSet.add(iMmessage.getRevUid() + "");
nickname = imRedisdbService.getUserNickname(iMmessage
.getSendUid());
iosPushContent = nickname + ":" + "[语音]";
break;
case 8:
// 群信息8
revUidSet.addAll(imRedisdbService.groupSMEMBERS(iMmessage
.getRevUid()));
groupflag = true;
contentJson = JSONObject
.parseObject(iMmessage.getContent());
map = contentJson;
String groupcontent = map.get("content").toString();
nickname = imRedisdbService.getUserNickname(iMmessage
.getSendUid());
groupcontent = groupcontent.length() > 20 ? groupcontent
.substring(0, 20) + "……" : groupcontent;
iosPushContent = nickname + ":" + groupcontent;
break;
case 9:
// 群视频信息 9
revUidSet.addAll(imRedisdbService.groupSMEMBERS(iMmessage
.getRevUid()));
groupflag = true;
nickname = imRedisdbService.getUserNickname(iMmessage
.getSendUid());
iosPushContent = nickname + ":" + "[视频信息]";
break;
case 10:
// 群图片信息 10
revUidSet.addAll(imRedisdbService.groupSMEMBERS(iMmessage
.getRevUid()));
groupflag = true;
nickname = imRedisdbService.getUserNickname(iMmessage
.getSendUid());
iosPushContent = nickname + ":" + "[图片]";
break;
case 11:
// 群语音 11
revUidSet.addAll(imRedisdbService.groupSMEMBERS(iMmessage
.getRevUid()));
groupflag = true;
nickname = imRedisdbService.getUserNickname(iMmessage
.getSendUid());
iosPushContent = nickname + ":" + "[语音]";
break;
case 12:
// 群定位信息 12
revUidSet.addAll(imRedisdbService.groupSMEMBERS(iMmessage
.getRevUid()));
groupflag = true;
nickname = imRedisdbService.getUserNickname(iMmessage
.getSendUid());
iosPushContent = nickname + ":" + "[定位信息]";
break;
case 13:
// 系统 个人信息
revUidSet.add(iMmessage.getRevUid() + "");
contentJson = JSONObject
.parseObject(iMmessage.getContent());
map = contentJson;
int code13 = Integer.valueOf(map.get("code").toString());
switch (code13) {
case 1:
// 退出群组
revUidSet.remove(iMmessage.getSendUid().toString());
iosPushContent = map.get("msg").toString();
break;
default:
break;
}
break;
case 14:
// 系统群组信息
revUidSet.addAll(imRedisdbService.groupSMEMBERS(iMmessage
.getRevUid()));
// 判断 code类型
contentJson = JSONObject
.parseObject(iMmessage.getContent());
map = contentJson;
int code14 = Integer.valueOf(map.get("code").toString());
switch (code14) {
case 1:
// 新人 加入 群聊 踢出发送者本人
revUidSet.remove(iMmessage.getSendUid().toString());
iosPushContent = map.get("msg").toString();
break;
case 2:
// 群组成员 退出群组
iosPushContent = map.get("msg").toString();
break;
default:
break;
}
groupflag = true;
break;
default:
break;
}
}
// 在线用户集合
Set<String> onlineSet = imRedisdbService.SMEMBERSonlineuser();
// ios处理集合
Set<String> iosSet = new HashSet<String>();
// AND处理集合
Set<String> andSet = new HashSet<String>();
// 接收者userId 是否在线 是否在ios
// 若 非 群发
if (!groupflag) {
for (String revuid : revUidSet) {
String pushtoken = imRedisdbService.getUserPush(revuid);
// 判断是否在线
if (onlineSet.contains(revuid)) {
MQTTServiceList.sendMsg(iMsend.getToken(),
iMsend.getContent());
} else {
if (pushtoken != null && pushtoken.startsWith("I")) {
// ios 离线 推送
iosSet.add(revuid);
} else if (pushtoken != null
&& pushtoken.startsWith("A")) {
// and 离线推送
andSet.add(revuid);
}
}
}
}
// 若群发
else {
for (String revuid : revUidSet) {
String pushtoken = imRedisdbService.getUserPush(revuid);
if (!onlineSet.contains(revuid)) {
// IM离线
if (pushtoken != null && pushtoken.startsWith("I")) {
// IOS用户
// redis 判断是否开启消息免打扰
int isDisturb = imRedisdbService
.getUserGroupDisturb(Long.valueOf(revuid));
if (isDisturb == 0) {
// 防止自己发的信息 自己收到推送
if (!(iMmessage.getType() < 13 && iMmessage
.getSendUid().toString().equals(revuid))) {
iosSet.add(revuid);
}
}
} else if (pushtoken != null
&& pushtoken.startsWith("A")) {
// and用户
// redis 判断是否开启消息免打扰
int isDisturb = imRedisdbService
.getUserGroupDisturb(Long.valueOf(revuid));
if (isDisturb == 0) {
// 防止自己发的信息 自己收到推送
if (!(iMmessage.getType() < 13 && iMmessage
.getSendUid().toString().equals(revuid))) {
andSet.add(revuid);
}
}
}
}
}
MQTTServiceList.sendMsg(iMsend.getToken(), iMsend.getContent());
}
// 这里把iosSet 和 iMmessage 传入队列
for (String revUid : iosSet) {
// 推送类型 1朋友圈 2印象 3群组 4私聊 5新的好友
int IMTYPE = 0;
PushMessage pushMessage = new PushMessage();
pushMessage.setSenduid(iMmessage.getSendUid());// 把id推进去
String pushtoken = "";
if (groupflag) {// 若为群发
// 推送类型 1朋友圈 2印象 3群组 4私聊 5好友请求 6好友验证回复
IMTYPE = 3;
// 群id RevUid;
Long userId = Long.parseLong(revUid);
pushtoken = imRedisdbService.getUserPush(userId + "");
pushMessage.setRevuid(userId);
pushMessage.setTargetid(iMmessage.getRevUid());
switch (type) {
case 8:
// 群信息8
pushMessage.setContent(iosPushContent);
break;
case 9:
// 群视频信息 9
pushMessage.setContent(iosPushContent);
break;
case 10:
// 群图片信息 10
pushMessage.setContent(iosPushContent);
break;
case 11:
// 群语音 11
pushMessage.setContent(iosPushContent);
break;
case 12:
// 群定位信息 12
pushMessage.setContent(iosPushContent);
break;
case 14:
// 群系统信息 14
pushMessage.setContent(iosPushContent);
IMTYPE = 7;
break;
default:
pushMessage.setContent("信息…………");
IMTYPE = 7;
break;
}
} else {// 好友消息
// 推送类型 1朋友圈 2印象 3群组 4私聊 5好友请求 6好友验证回复 7系统
IMTYPE = 4;
pushtoken = imRedisdbService.getUserPush(revUid);// 好友Token
Long userId = Long.parseLong(revUid);
pushMessage.setRevuid(userId);
pushMessage.setTargetid(iMmessage.getSendUid());
// System.out.println("666666:>>测试好友消息显示的token:" +
// pushtoken);
switch (type) {
case 1:// 好友请求
pushMessage.setContent(iosPushContent);
IMTYPE = 5;
break;
case 2:// 好友请求回复
pushMessage.setContent(iosPushContent);
IMTYPE = 6;
break;
case 3:
// 好友文本消息3
pushMessage.setContent(iosPushContent);
break;
case 4:
// 好友图片信息4
pushMessage.setContent(iosPushContent);
break;
case 5:
// 好友视频信息5
pushMessage.setContent(iosPushContent);
break;
case 6:
// 好友定位信息6
pushMessage.setContent(iosPushContent);
break;
case 7:
// 好友语音7
pushMessage.setContent(iosPushContent);
break;
case 13:
IMTYPE = 7;
// 个人系统信息 13
pushMessage.setContent(iosPushContent);
break;
default:
pushMessage.setContent("信息…………");
break;
}
}
pushMessage.setType(IMTYPE);
String content = JSONObject.toJSONString(pushMessage);
iMsend.setToken(pushtoken);// IOS_xxxxxxxxxxxxxxxxxxxxxxx
iMsend.setContent(content);
imRedisdbService.pushIOSPushMessage(iMsend);
}
// 这里把andSet 推送 入Redis队列
for (String revUid : andSet) {
// 推送类型 1朋友圈 2印象 3群组 4私聊 5新的好友
int IMTYPE = 0;
PushMessage pushMessage = new PushMessage();
pushMessage.setSenduid(iMmessage.getSendUid());// 把id推进去
String pushtoken = "";
if (groupflag) {// 若为群发
// 推送类型 1朋友圈 2印象 3群组 4私聊 5好友请求 6好友验证回复
IMTYPE = 3;
// 群id RevUid;
Long userId = Long.parseLong(revUid);
pushtoken = imRedisdbService.getUserPush(userId + "");
pushMessage.setRevuid(userId);
pushMessage.setTargetid(iMmessage.getRevUid());
switch (type) {
case 8:
// 群信息8
pushMessage.setContent(iosPushContent);
break;
case 9:
// 群视频信息 9
pushMessage.setContent(iosPushContent);
break;
case 10:
// 群图片信息 10
pushMessage.setContent(iosPushContent);
break;
case 11:
// 群语音 11
pushMessage.setContent(iosPushContent);
break;
case 12:
// 群定位信息 12
pushMessage.setContent(iosPushContent);
break;
case 14:
// 群系统信息 14
pushMessage.setContent(iosPushContent);
IMTYPE = 7;
break;
default:
pushMessage.setContent("信息…………");
IMTYPE = 7;
break;
}
} else {// 好友消息
// 推送类型 1朋友圈 2印象 3群组 4私聊 5好友请求 6好友验证回复 7系统
IMTYPE = 4;
pushtoken = imRedisdbService.getUserPush(revUid);// 好友Token
Long userId = Long.parseLong(revUid);
pushMessage.setRevuid(userId);
pushMessage.setTargetid(iMmessage.getSendUid());
switch (type) {
case 1:// 好友请求
pushMessage.setContent(iosPushContent);
IMTYPE = 5;
break;
case 2:// 好友请求回复
pushMessage.setContent(iosPushContent);
IMTYPE = 6;
break;
case 3:
// 好友文本消息3
pushMessage.setContent(iosPushContent);
break;
case 4:
// 好友图片信息4
pushMessage.setContent(iosPushContent);
break;
case 5:
// 好友视频信息5
pushMessage.setContent(iosPushContent);
break;
case 6:
// 好友定位信息6
pushMessage.setContent(iosPushContent);
break;
case 7:
// 好友语音7
pushMessage.setContent(iosPushContent);
break;
case 13:
IMTYPE = 7;
// 个人系统信息 13
pushMessage.setContent(iosPushContent);
break;
default:
pushMessage.setContent("信息…………");
break;
}
}
pushMessage.setType(IMTYPE);
String content = JSONObject.toJSONString(pushMessage);
iMsend.setToken(pushtoken.substring(4));// AND_xxxxxxxxxxxxxxxxxxxxxxx
iMsend.setContent(content);
imRedisdbService.pushANDPushMessage(iMsend);
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
}
| [
"41958395+Chuchilok@users.noreply.github.com"
] | 41958395+Chuchilok@users.noreply.github.com |
d6fd13c7634114fee942aeae192bf6f3e3891225 | e42d7da6d3e181dca864ba9fb3092961bc071cdb | /samples/token/src/main/java/SaleWithTokenExample.java | dca60063d1d6085619100ef308a4f69f0e147f39 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | cdollar393/litle-sdk-for-java | 4d8e622d328328189196d4a071c4c7a9b0a62f8b | 3ea6f7752f4a9096779eb0cd64ff73cd9ceb0cea | refs/heads/master | 2021-01-01T16:33:26.152250 | 2016-08-19T13:59:44 | 2016-08-19T13:59:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,035 | java | package com.litle.sdk.samples;
import com.litle.sdk.*;
import com.litle.sdk.generate.*;
public class SaleWithTokenExample {
public static void main(String[] args) {
Sale sale = new Sale();
sale.setOrderId("1");
sale.setAmount(10010L);
sale.setOrderSource(OrderSourceType.ECOMMERCE);
CardTokenType token = new CardTokenType();
token.setCardValidationNum("349");
token.setExpDate("1214");
token.setLitleToken("1111222233334000");
token.setType(MethodOfPaymentTypeEnum.VI);
sale.setToken(token);
SaleResponse response = new LitleOnline().sale(sale);
//Display Results
System.out.println("Response: " + response.getResponse());
System.out.println("Message: " + response.getMessage());
System.out.println("Litle Transaction ID: " + response.getLitleTxnId());
if(!response.getMessage().equals("Approved"))
throw new RuntimeException(" The SaleWithTokenExample does not give the right response");
}
}
| [
"twang@twang-vm1.dwi.litle.com"
] | twang@twang-vm1.dwi.litle.com |
6a97a2925ec5380e5bc0318ee23b718c8d59bd8a | 2712e31319b0c733bcab285415e55a427288406e | /eclipse/src/main/java/org/eclipse/jdt/internal/compiler/ast/NameReference.java | cdb715dd903ec78ece45851c2e5b6275ea200bd0 | [
"WTFPL"
] | permissive | mo79571830/eide | 8ba031a432cab62e1045b8ff61961d21cfc94f7d | 5d6470f82def645c17b5cebe03184ddc1ff67e62 | refs/heads/master | 2022-03-22T23:46:56.299439 | 2019-05-08T20:20:08 | 2019-05-08T20:20:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,298 | java | /*******************************************************************************
* Copyright (c) 2000, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* This is an implementation of an early-draft specification developed under the Java
* Community Process (JCP) and is made available for testing and evaluation purposes
* only. The code is not compatible with any specification of the JCP.
*
* Contributors:
* IBM Corporation - initial API and implementation
* Stephan Herrmann - Contribution for
* bug 331649 - [compiler][null] consider null annotations for fields
* Bug 400874 - [1.8][compiler] Inference infrastructure should evolve to meet JLS8 18.x (Part G of JSR335 spec)
* Bug 426996 - [1.8][inference] try to avoid method Expression.unresolve()?
* Jesper S Moller - Contributions for
* bug 382721 - [1.8][compiler] Effectively final variables needs special treatment
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.ast;
import org.eclipse.jdt.internal.compiler.lookup.*;
import org.eclipse.jdt.internal.compiler.problem.AbortMethod;
public abstract class NameReference extends Reference implements InvocationSite {
public Binding binding; //may be aTypeBinding-aFieldBinding-aLocalVariableBinding
public TypeBinding actualReceiverType; // modified receiver type - actual one according to namelookup
//the error printing
//some name reference are build as name reference but
//only used as type reference. When it happens, instead of
//creating a new object (aTypeReference) we just flag a boolean
//This concesion is valuable while there are cases when the NameReference
//will be a TypeReference (static message sends.....) and there is
//no changeClass in java.
public NameReference() {
this.bits |= Binding.TYPE | Binding.VARIABLE; // restrictiveFlag
}
/**
* Use this method only when sure that the current reference is <strong>not</strong>
* a chain of several fields (QualifiedNameReference with more than one field).
* Otherwise use {@link #lastFieldBinding()}.
*/
public FieldBinding fieldBinding() {
//this method should be sent ONLY after a check against isFieldReference()
//check its use doing senders.........
return (FieldBinding) this.binding ;
}
public FieldBinding lastFieldBinding() {
if ((this.bits & ASTNode.RestrictiveFlagMASK) == Binding.FIELD)
return fieldBinding(); // most subclasses only refer to one field anyway
return null;
}
public InferenceContext18 freshInferenceContext(Scope scope) {
return null;
}
public boolean isSuperAccess() {
return false;
}
public boolean isTypeAccess() {
// null is acceptable when we are resolving the first part of a reference
return this.binding == null || this.binding instanceof ReferenceBinding;
}
public boolean isTypeReference() {
return this.binding instanceof ReferenceBinding;
}
public void setActualReceiverType(ReferenceBinding receiverType) {
if (receiverType == null) return; // error scenario only
this.actualReceiverType = receiverType;
}
public void setDepth(int depth) {
this.bits &= ~DepthMASK; // flush previous depth if any
if (depth > 0) {
this.bits |= (depth & 0xFF) << DepthSHIFT; // encoded on 8 bits
}
}
public void setFieldIndex(int index){
// ignored
}
public abstract String unboundReferenceErrorName();
public abstract char[][] getName();
/* Called during code generation to ensure that outer locals's effectively finality is guaranteed.
Aborts if constraints are violated. Due to various complexities, this check is not conveniently
implementable in resolve/analyze phases.
*/
protected void checkEffectiveFinality(LocalVariableBinding localBinding, Scope scope) {
if ((this.bits & ASTNode.IsCapturedOuterLocal) != 0) {
if (!localBinding.isFinal() && !localBinding.isEffectivelyFinal()) {
scope.problemReporter().cannotReferToNonEffectivelyFinalOuterLocal(localBinding, this);
throw new AbortMethod(scope.referenceCompilationUnit().compilationResult, null);
}
}
}
}
| [
"202983447@qq.com"
] | 202983447@qq.com |
dd94873c30401c4d145ec5413e844370973f7558 | 36e593943be060ca5ea74a3d45923aba422ad2c9 | /ProficientIn4xSpring/chapter18/src/test/java/com/smart/test/dataset/excel/MultiSchemaXlsDataSetFactory.java | 62f6857a58b87d0f58c90559ba9c4cbce49241c0 | [] | no_license | xjr7670/book_practice | a73f79437262bb5e3b299933b7b1f7f662a157b5 | 5a562d76830faf78feec81bc11190b71eae3a799 | refs/heads/master | 2023-08-28T19:08:52.329127 | 2023-08-24T09:06:00 | 2023-08-24T09:06:00 | 101,477,574 | 3 | 1 | null | 2021-06-10T18:38:54 | 2017-08-26T09:56:02 | Python | UTF-8 | Java | false | false | 1,002 | java | package com.smart.test.dataset.excel;
import org.unitils.core.UnitilsException;
import org.unitils.dbunit.datasetfactory.DataSetFactory;
import org.unitils.dbunit.util.MultiSchemaDataSet;
import java.io.File;
import java.util.Arrays;
import java.util.Properties;
public class MultiSchemaXlsDataSetFactory implements DataSetFactory {
protected String defaultSchemaName;
//初始化
public void init(Properties configuration, String defaultSchemaName) {
this.defaultSchemaName = defaultSchemaName;
}
//创建数据集
public MultiSchemaDataSet createDataSet(File... dataSetFiles) {
try {
MultiSchemaXlsDataSetReader xlsDataSetReader = new MultiSchemaXlsDataSetReader(
defaultSchemaName);
return xlsDataSetReader.readDataSetXls(dataSetFiles);
} catch (Exception e) {
throw new UnitilsException("创建数据集失败: "
+ Arrays.toString(dataSetFiles), e);
}
}
// 获取数据集文件的扩展名
public String getDataSetFileExtension() {
return "xls";
}
}
| [
"xjr30226@126.com"
] | xjr30226@126.com |
85f2766dd75d66f38d69eb5dbdfc6b7fc803c2dc | f8bf37ee28bee1cf8a7221a19f5f29b9021e9871 | /backend/src/main/java/hu/uni/eszterhazy/afp/App.java | 8c6ed3eaa9521eef882464305f9899748a116f73 | [] | no_license | ZsoltToth/afp2020spring | c7af2d314d8b75f0de9d8b3d3fa7fe33b6ccf49f | 48b26e375b7982faa9d936bff8c59ac69e334966 | refs/heads/master | 2022-09-30T07:01:42.359796 | 2020-04-08T15:27:09 | 2020-04-08T15:27:09 | 250,025,416 | 0 | 0 | null | 2022-03-31T19:05:20 | 2020-03-25T16:03:33 | JavaScript | UTF-8 | Java | false | false | 330 | java | package hu.uni.eszterhazy.afp;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* Hello world!
*
*/
@SpringBootApplication
public class App
{
public static void main( String[] args )
{
SpringApplication.run(App.class, args);
}
}
| [
"tothzs87@gmail.com"
] | tothzs87@gmail.com |
b65bfca63336411adb74e309834e888d0ab7af4b | cc27308f925c6bf3449b531655122b8b9917c4eb | /src/main/java/it/bz/tis/alpenstaedte/UserController.java | 23097a9670a2d88e8aca8351421a0ba8aac98d61 | [] | no_license | noi-techpark/pip | 6296467dccd1183cfd0c49111752a696d9d3388c | 04ab0f17f3226e8a664de1907012b9dbc48883a5 | refs/heads/master | 2021-08-31T05:57:40.702993 | 2017-12-20T13:26:51 | 2017-12-20T13:26:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,636 | java | package it.bz.tis.alpenstaedte;
import it.bz.tis.alpenstaedte.dto.OrganisazionDto;
import it.bz.tis.alpenstaedte.dto.ResponseObject;
import it.bz.tis.alpenstaedte.dto.UserDto;
import it.bz.tis.alpenstaedte.util.DALCastUtil;
import it.bz.tis.alpenstaedte.util.DtoCastUtil;
import it.bz.tis.alpenstaedte.util.MailingUtil;
import java.io.File;
import java.io.IOException;
import java.security.Principal;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import javax.servlet.http.HttpSession;
import org.apache.commons.lang3.RandomStringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.FileSystemResource;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.annotation.Secured;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
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.ResponseBody;
import org.springframework.web.context.support.ServletContextResource;
import org.springframework.web.multipart.MultipartFile;
@RequestMapping("/user/**")
@Controller
public class UserController {
@Autowired
private FileSystemResource documentFolder;
@Autowired
private MailingUtil mailingUtil;
@Autowired
private PasswordEncoder encoder;
@Secured(value={"ROLE_ADMIN","ROLE_MANAGER", "ROLE_MANAGER"})
@RequestMapping(method = RequestMethod.GET,value="list")
public @ResponseBody ResponseEntity<List<UserDto>> getUsers(Principal principal) {
PipUser prince = PipUser.findPipUsersByEmailEquals(principal.getName()).getSingleResult();
List<UserDto> list = new ArrayList<UserDto>();
List<PipUser> users;
if (PipRole.ADMIN.getName().equals(prince.getRole()))
users = PipUser.findAllPipUsers("name","asc");
else{
users = PipUser.findPipUserByOrganisazionAndRole(prince.getOrganisazions().get(0),PipRole.USER.getName());
}
list = DtoCastUtil.castUser(users);
return new ResponseEntity<List<UserDto>>(list,HttpStatus.OK);
}
@Secured(value={"ROLE_ADMIN","ROLE_USER", "ROLE_MANAGER"})
@RequestMapping(method = RequestMethod.GET)
public @ResponseBody ResponseEntity<UserDto> getUser(Principal principal,@RequestParam(value="uuid",required=false)String uuid) {
PipUser user;
if(uuid!=null)
user = PipUser.findPipUsersByUuidEquals(uuid).getSingleResult();
else
user = PipUser.findPipUsersByEmailEquals(principal.getName()).getSingleResult();
UserDto dto = DtoCastUtil.cast(user);
return new ResponseEntity<UserDto>(dto,HttpStatus.OK);
}
@Secured(value={"ROLE_ADMIN","ROLE_USER", "ROLE_MANAGER"})
@RequestMapping(method = RequestMethod.PUT)
public @ResponseBody ResponseEntity<UserDto> updateUser(@RequestBody UserDto dto, Principal principal,@RequestParam(value="user-id",required=false)String uuid) {
PipUser user = PipUser.findPipUsersByUuidEquals(uuid).getSingleResult();
PipUser principalUser = PipUser.findPipUsersByEmailEquals(
principal.getName()).getSingleResult();
if (user.getEmail().equals(principal.getName()) || PipRole.ADMIN.getName().equals(principalUser.getRole())) {
user.setName(dto.getName());
user.setSurname(dto.getSurname());
user.setPreferredTopics(DALCastUtil.cast(dto.getTopics()));
user.setPhone(dto.getPhone());
user.setLanguageSkills(dto.getLanguageSkills());
user.merge();
return new ResponseEntity<UserDto>(HttpStatus.OK);
} else
return new ResponseEntity<UserDto>(HttpStatus.FORBIDDEN);
}
@Secured(value={"ROLE_ADMIN","ROLE_MANAGER"})
@RequestMapping(method = RequestMethod.DELETE)
public @ResponseBody ResponseEntity<Object> deleteUser(@RequestParam("email")String email,Principal principal) {
PipUser user = PipUser.findPipUsersByEmailEquals(email).getSingleResult();
PipUser currentUser = PipUser.findPipUsersByEmailEquals(principal.getName()).getSingleResult();
if (PipRole.MANAGER.equals(currentUser.getRole()) && !currentUser.organisationMatches(user))
return new ResponseEntity<Object>(HttpStatus.FORBIDDEN);
if (!PipRole.ADMIN.getName().equals(user.getRole()))
user.remove();
return new ResponseEntity<Object>(HttpStatus.OK);
}
@Secured(value={"ROLE_ADMIN","ROLE_MANAGER"})
@RequestMapping(method = RequestMethod.GET,value="deactivate")
public @ResponseBody ResponseEntity<Object> deactivateUser(@RequestParam("email")String email,Principal principal) {
PipUser user = PipUser.findPipUsersByEmailEquals(email).getSingleResult();
PipUser currentUser = PipUser.findPipUsersByEmailEquals(principal.getName()).getSingleResult();
if (PipRole.MANAGER.equals(currentUser.getRole()) && !currentUser.organisationMatches(user))
return new ResponseEntity<Object>(HttpStatus.FORBIDDEN);
if (!PipRole.ADMIN.getName().equals(user.getRole())){
user.setActive(false);
user.merge();
}
return new ResponseEntity<Object>(HttpStatus.OK);
}
@Secured(value={"ROLE_ADMIN","ROLE_MANAGER"})
@RequestMapping(method = RequestMethod.GET,value="activate")
public @ResponseBody ResponseEntity<Object> activateUser(@RequestParam("email")String email,Principal principal) {
PipUser user = PipUser.findPipUsersByEmailEquals(email).getSingleResult();
PipUser currentUser = PipUser.findPipUsersByEmailEquals(principal.getName()).getSingleResult();
if (PipRole.MANAGER.equals(currentUser.getRole()) && !currentUser.organisationMatches(user))
return new ResponseEntity<Object>(HttpStatus.FORBIDDEN);
if (!PipRole.ADMIN.getName().equals(user.getRole())){
user.setActive(true);
user.merge();
}
return new ResponseEntity<Object>(HttpStatus.OK);
}
@Secured(value={"ROLE_ADMIN","ROLE_MANAGER"})
@RequestMapping(method = RequestMethod.POST)
public @ResponseBody void createUser(@RequestBody UserDto dto,Principal principal) {
PipUser user = new PipUser();
user.setEmail(dto.getEmail());
Set<OrganisazionDto> organizations = dto.getOrganizations();
if (organizations.isEmpty()){
PipUser currentUser = PipUser.findPipUsersByEmailEquals(principal.getName()).getSingleResult();
List<Organisazion> organisazions = currentUser.getOrganisazions();
if (!organisazions.isEmpty()){
user.getOrganisazions().add(organisazions.get(0));
}
}else{
Organisazion organisazion = Organisazion.findOrganisazionsByName(new ArrayList<OrganisazionDto>(organizations).get(0).getName()).getSingleResult();
user.getOrganisazions().add(organisazion);
}
String randomPassword = RandomStringUtils.randomAlphanumeric(6);
user.setPassword(encoder.encode(randomPassword));
user.setRole(PipRole.USER.getName());
user.persist();
mailingUtil.sendCreationMail(user,randomPassword);
}
@Secured(value={"ROLE_USER", "ROLE_ADMIN", "ROLE_MANAGER"})
@RequestMapping(method = RequestMethod.GET, value = "profile-pic")
public @ResponseBody FileSystemResource getFile(@RequestParam(required=false,value="user") String userid, Principal principal,HttpSession session) throws IOException{
if(documentFolder.exists()){
String uuid;
if (userid != null)
uuid = userid;
else{
PipUser user = PipUser.findPipUsersByEmailEquals(principal.getName()).getSingleResult();
uuid = user.getUuid();
}
File folder = new File(documentFolder.getFile(),"user-data/"+uuid);
File file;
if (!uuid.isEmpty() && folder.exists() && folder.listFiles().length > 0)
file = folder.listFiles()[0];
else{
file = new ServletContextResource(session.getServletContext(),"/images/profile.jpg").getFile();
}
return new FileSystemResource(file);
}
return null;
}
@Secured(value={"ROLE_USER", "ROLE_ADMIN", "ROLE_MANAGER"})
@RequestMapping(method = RequestMethod.POST, value = "upload-profile-pic")
public @ResponseBody ResponseEntity<ResponseObject> uploadProfilePic(@RequestParam("file")List<MultipartFile> files,Principal principal,@RequestParam(value = "userid",required=false) String userid) {
if (documentFolder.exists()){
PipUser user;
PipUser principalUser = PipUser.findPipUsersByEmailEquals(principal.getName()).getSingleResult();
if (userid != null){
user = PipUser.findPipUsersByUuidEquals(userid).getSingleResult();
if ( !PipRole.ADMIN.getName().equals(principalUser.getRole()) && !principalUser.equals(user))
return new ResponseEntity<ResponseObject>(HttpStatus.FORBIDDEN);
}
else
user = principalUser;
File directory = new File(documentFolder.getPath()+"/user-data/"+user.getUuid());
directory.mkdirs();
for (File file : directory.listFiles()){
file.delete();
}
for (MultipartFile multiPartfile : files){
File file = new File(directory,multiPartfile.getOriginalFilename());
try {
multiPartfile.transferTo(file);
} catch (IllegalStateException e) {
e.printStackTrace();
return new ResponseEntity<ResponseObject>(HttpStatus.INTERNAL_SERVER_ERROR);
} catch (IOException e) {
e.printStackTrace();
return new ResponseEntity<ResponseObject>(HttpStatus.INTERNAL_SERVER_ERROR);
}
}
return new ResponseEntity<ResponseObject>(HttpStatus.OK);
}
return new ResponseEntity<ResponseObject>(HttpStatus.INTERNAL_SERVER_ERROR);
}
@Secured(value={"ROLE_ADMIN"})
@RequestMapping(method = RequestMethod.PUT, value = "user/promote")
public @ResponseBody void promote(@RequestBody String email) throws IOException{
PipUser user = PipUser.findPipUsersByEmailEquals(email).getSingleResult();
user.setRole(PipRole.MANAGER.getName());
user.merge();
}
@Secured(value={"ROLE_ADMIN"})
@RequestMapping(method = RequestMethod.PUT, value = "user/demote")
public @ResponseBody void demote(@RequestBody String email) throws IOException{
PipUser user = PipUser.findPipUsersByEmailEquals(email).getSingleResult();
if (user.getRole()!=PipRole.ADMIN.getName()){
user.setRole(PipRole.USER.getName());
user.merge();
}
}
@Secured(value={"ROLE_ADMIN","ROLE_MANAGER","ROLE_USER"})
@RequestMapping(method = RequestMethod.GET,value="organizations")
public @ResponseBody ResponseEntity<Set<OrganisazionDto>> getOrganisations() {
List<Organisazion> organisazions = Organisazion.findAllOrganisazions("name","ASC");
Set<OrganisazionDto> dtos = DtoCastUtil.castOrgs(organisazions);
return new ResponseEntity<Set<OrganisazionDto>>(dtos,HttpStatus.OK);
}
@Secured(value={"ROLE_ADMIN"})
@RequestMapping(method = RequestMethod.PUT,value="organization")
public @ResponseBody void updateOrganisation(@RequestBody UserDto userDto) {
PipUser user = PipUser.findPipUsersByEmailEquals(userDto.getEmail()).getSingleResult();
OrganisazionDto dto = new ArrayList<OrganisazionDto>(userDto.getOrganizations()).get(0);
Organisazion organisazion = Organisazion.findOrganisazionsByName(dto.getName()).getSingleResult();
user.getOrganisazions().clear();
user.getOrganisazions().add(organisazion);
user.merge();
}
@Secured(value={"ROLE_ADMIN","ROLE_MANAGER","ROLE_USER"})
@RequestMapping(method = RequestMethod.GET,value="user-by-topics")
public @ResponseBody ResponseEntity<List<UserDto>> getUserByTopics() {
List<PipUser> user = PipUser.findAllPipUsers();
List<UserDto> userDtos = DtoCastUtil.castUser(user);
return new ResponseEntity<List<UserDto>>(userDtos,HttpStatus.OK);
}
@Secured(value={"ROLE_ADMIN","ROLE_MANAGER","ROLE_USER"})
@RequestMapping(method = RequestMethod.GET,value="reset-password")
public @ResponseBody ResponseEntity<Object> resetPassword(Principal principal,@RequestParam("oldpw")String oldPassword,@RequestParam("newpw")String newPassword) {
PipUser user = PipUser.findPipUsersByEmailEquals(principal.getName()).getSingleResult();
if (!encoder.matches(oldPassword, user.getPassword()))
return new ResponseEntity<Object>(HttpStatus.FORBIDDEN);
user.setPassword(encoder.encode(newPassword));
user.merge();
return new ResponseEntity<Object>(HttpStatus.OK);
}
@RequestMapping(method = RequestMethod.GET,value="request-new-pw")
public String requestPassword(@RequestParam("email") String email, ModelMap model) {
List<PipUser> resultList = PipUser.findPipUsersByEmailEquals(email).getResultList();
boolean userExists = !resultList.isEmpty();
if (!userExists)
model.addAttribute("error", "User already exists");
else{
PipUser user = resultList.get(0);
String randomPassword = RandomStringUtils.randomAlphanumeric(6);
user.setPassword(encoder.encode(randomPassword));
user.merge();
mailingUtil.sendCreationMail(user, randomPassword);
}
return "redirect:/";
}
@Secured(value={"ROLE_ADMIN","ROLE_MANAGER","ROLE_USER"})
@RequestMapping(method = RequestMethod.GET,value="like")
public @ResponseBody void toggleLike(Principal principal, @RequestParam("comment") String uuid){
Comment comment = Comment.findCommentsByUuid(uuid).getSingleResult();
PipUser user = PipUser.findPipUsersByEmailEquals(principal.getName()).getSingleResult();
if (comment.getLiker().contains(user))
comment.getLiker().remove(user);
else
comment.getLiker().add(user);
comment.merge();
}
}
| [
"patrick.bertolla@tis.bz.it"
] | patrick.bertolla@tis.bz.it |
2984e8403b809a48b419f91559523fb60ca60ded | a6ad842539106440e3e475af3bdb99f3b4f5b142 | /BashSoft/src/main/bg/softuni/io/commands/DropDatabaseCommand.java | 6bdf6a9627001f31a90949d962973e900eb20807 | [] | no_license | thunderstorm773/BashSoft-OOP-Advanced | bc62c681450a9cf1501144aa0ee98ade44fc60ee | 85f6af28b2e0ce1e4077b6a4abfe3a45ceb24d63 | refs/heads/master | 2021-01-22T18:33:37.577580 | 2017-04-01T15:50:04 | 2017-04-01T15:50:04 | 85,090,507 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 876 | java | package main.bg.softuni.io.commands;
import main.bg.softuni.annotations.Alias;
import main.bg.softuni.annotations.Inject;
import main.bg.softuni.contracts.repository.Database;
import main.bg.softuni.io.OutputWriter;
@Alias(value = "dropdb")
public class DropDatabaseCommand extends Command{
@Inject
private Database repository;
public DropDatabaseCommand(String input, String[] data) {
super(input, data);
}
@Override
public void execute() throws Exception {
if (this.getData().length != 1) {
DisplayInvalidCommandMessage invalidCommandMessage =
new DisplayInvalidCommandMessage(this.getInput(), this.getData());
invalidCommandMessage.execute();
return;
}
this.repository.unloadData();
OutputWriter.writeMessageOnNewLine("Database dropped!");
}
}
| [
"luko193@gmail.com"
] | luko193@gmail.com |
c40b7bef8de78027fbf370b0b335a76cce4c3307 | 566a9252119593c099ac8bb572b291322eb17c47 | /hasting-webui/src/test/java/com/lindzh/hasting/webui/AbstractTestCase.java | 9428a3fe9f3c9f9a8d492f6e7400d6ea62b564e7 | [
"MIT"
] | permissive | BiYiTuan/hasting | 7743ecf709d7eb85e376c927ad355e679e4aa917 | efed0dabcc5181b9f81bb54514048b38adfd7177 | refs/heads/master | 2020-04-16T13:28:11.481592 | 2018-04-15T03:52:09 | 2018-04-15T03:52:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 424 | java | package com.lindzh.hasting.webui;
/**
* Created by lin on 2016/12/17.
*/
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"classpath:mybatis-config.xml","classpath:spring-admin.xml"})
public abstract class AbstractTestCase {
}
| [
"linsony0@163.com"
] | linsony0@163.com |
8b715084aebb00d1cd474a90737817a1a1ece2e6 | 95947ccb5c2a51cff7b4558394e93b8346fdd6ef | /src/syncdataaccess/Writer.java | dc6e0c69e3086686ce6201e73b35c578564e2a98 | [] | no_license | sunxiaohang/weliinternship | 83fc5c89abdd987be041ba505d3d9d0510e446b7 | 6939cb098f6b1f1d1754fb0a9523d494d6945650 | refs/heads/master | 2020-06-22T21:23:43.297490 | 2019-08-09T06:40:38 | 2019-08-09T06:40:38 | 198,402,866 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,247 | java | package syncdataaccess;
import java.util.Date;
/**
* @author sunhang
* @email sunhang@weli.cn
*/
public class Writer implements Runnable{
private PricesInfo pricesInfo;
public Writer(PricesInfo pricesInfo) {
this.pricesInfo = pricesInfo;
}
@Override
public void run() {
System.out.println("Writer: Attempt to modify the prices "+new Date());
pricesInfo.setPrices(Math.random()*10,Math.random()*10);
System.out.println("Writer: prices has been modified "+new Date());
try {
Thread.sleep(2);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
PricesInfo pricesInfo = new PricesInfo();
Reader[] readers = new Reader[5];
Thread[] threadReaders = new Thread[5];
for (int i = 0; i < readers.length; i++) {
readers[i] = new Reader(pricesInfo);
threadReaders[i] = new Thread(readers[i]);
}
Writer writer = new Writer(pricesInfo);
Thread threadWriter = new Thread(writer);
for (int i = 0; i < readers.length; i++) {
threadReaders[i].start();
}
threadWriter.start();
}
}
| [
"sunhang@weli.cn"
] | sunhang@weli.cn |
220b52ddffc65b4752bf361d3926e7ac84bba664 | 37c163d1901934b03a7cb5703036eb94b838ceec | /src/main/java/after/legacycode/decouple/extractinterface10/TransactionRecorder.java | 98c813ba30dfc7cf102df7120afa77e48caa7300 | [] | no_license | garrickyang/worklegacycode | 3d5ee2540f3ac08fb0babec4312ed39de8075f8b | 762970ea2465402e0114e1b1bef38c08b4e3ad23 | refs/heads/master | 2021-07-08T04:32:42.141698 | 2019-08-04T13:22:04 | 2019-08-04T13:22:04 | 200,495,327 | 0 | 0 | null | 2020-10-13T15:05:35 | 2019-08-04T13:20:21 | Java | UTF-8 | Java | false | false | 147 | java | package after.legacycode.decouple.extractinterface10;
public interface TransactionRecorder {
void saveTransaction(Transaction transaction);
}
| [
"331945732@qq.com"
] | 331945732@qq.com |
d596af116a92182d01080f7fbbde24ab3b30ded9 | 932e0ef73004187f959cb2a976ce9aa7cace84f7 | /src/main/java/com/stancu/customerrestapi/exception/ErrorHandler.java | bc2a8684a8fb4edb42b90be576f84aa1e581128b | [] | no_license | stancumihai/CustomerManagerRestApiSpring | 13aede7ad2b23b9b6a31033af3beba8194580dbc | 5a4efd89b5745959a6515580f8706b312eff535f | refs/heads/master | 2023-07-02T15:44:08.487083 | 2021-08-06T14:45:27 | 2021-08-06T14:45:27 | 393,353,660 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 648 | java | package com.stancu.customerrestapi.exception;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
@ControllerAdvice
public class ErrorHandler {
@ExceptionHandler
public ResponseEntity<CustomErrorResponse> handleException(Exception ex) {
CustomErrorResponse error = new CustomErrorResponse(HttpStatus.BAD_REQUEST.value(),
ex.getMessage(), System.currentTimeMillis());
return new ResponseEntity<>(error, HttpStatus.BAD_REQUEST);
}
}
| [
"stancumihai2000@yahoo.com"
] | stancumihai2000@yahoo.com |
d7a6615a2cd7f2b794e4adaabb35e1c8e50edfaa | dffc6d66fb10683f38d46055492b1e77f6d7912f | /ERP_WS/src/main/java/com/bap/erp/servicios/rh/RhEmpleadoService.java | 9370a98ceb16d67da09c3dbe1e507cf7bf0eb002 | [] | no_license | gpalabral/ErpBackEnd | bd3a4f8d8f0d23275e7d8b0a5670b7faf8037411 | 4dd908ca24625c8271d3dd1bdd9e1df714f6e921 | refs/heads/master | 2021-03-27T20:02:43.606225 | 2016-05-17T22:42:37 | 2016-05-17T22:42:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,729 | java | package com.bap.erp.servicios.rh;
import com.bap.erp.modelo.rh.RhEmpleado;
import java.io.InputStream;
import java.util.Date;
import java.util.List;
public interface RhEmpleadoService {
RhEmpleado persistRhEmpleado(RhEmpleado rhEmpleado) throws Exception;
RhEmpleado mergeRhEmpleado(RhEmpleado rhEmpleado) throws Exception;
void removeRhEmpleado(Long idEmpleado) throws Exception;
List<RhEmpleado> listaRhEmpleado() throws Exception;
String codigoEmpleado()throws Exception;
RhEmpleado persistModificacionRhEmpleado(RhEmpleado rhEmpleado)throws Exception;
RhEmpleado getRhEmpleadoById(Long idEmpleado) throws Exception;
RhEmpleado obtieneEmpleadoPorCodigo(String codigo)throws Exception;
RhEmpleado obtieneEmpleadoPorIdEmpleadoCargo(Long idEmpleadoCargo)throws Exception;
int obtieneDiasVacacion(Date fechaInicial, Date fechaFinal) throws Exception;
List<RhEmpleado> listaRhEmpleadoConCargoAsignado() throws Exception;
List<RhEmpleado> listaRhEmpleadosNuevosSinVariaciones(Long idPeriodoGestion) throws Exception;
List<RhEmpleado> listaRhEmpleadosNuevosSinRcIva(Long idPeriodoGestion) throws Exception;
List<RhEmpleado> listaRhEmpleadosNuevosSinDescuentos(Long idPeriodoGestion) throws Exception;
List<RhEmpleado> listaRhEmpleadosNuevosSinCriteriosIngreso(Long idPeriodoGestion) throws Exception;
List<RhEmpleado> listaRhEmpleadosNuevosSinPrima(Long idPeriodoGestion) throws Exception;
List<RhEmpleado> listaRhEmpleadoPorPeriodo(Long idPeriodoGestion) throws Exception;
void importaEmpleadosExcel(InputStream fileInputStream) throws Exception;
} | [
"gustavo.palabral@gmail.com"
] | gustavo.palabral@gmail.com |
30e04bca53333c66adaf9a014f098db26b833256 | b27bfe9db8f0c7e5ca9377397b23ef2ef27d4ddc | /morozov/terms/signals/TermIsNotAWorld.java | 41381a1bd658c6e41322c54be5f7abf4dc21fe24 | [] | no_license | Morozov2012/actor-prolog-java-library | 85fe97eb6a37709d742f4ab06b29d0718c7269c3 | 5a7e2011ac2152278b8ebae3dfb2da4d925619a3 | refs/heads/master | 2021-01-20T15:39:14.173431 | 2019-12-13T13:09:01 | 2019-12-13T13:09:01 | 7,780,078 | 5 | 3 | null | null | null | null | UTF-8 | Java | false | false | 272 | java | // (c) 2008 IRE RAS Alexei A. Morozov
package morozov.terms.signals;
import morozov.run.*;
public final class TermIsNotAWorld extends LightweightException {
//
public static final TermIsNotAWorld instance= new TermIsNotAWorld();
//
private TermIsNotAWorld() {
}
}
| [
"AlexeiMorozov2006@rambler.ru"
] | AlexeiMorozov2006@rambler.ru |
2c5c1ca1fb7f633adc5b7b9c2f0ba42bbf41fcd2 | 6f2f1b52d145513182255d38dd7f3aa856f6e679 | /cs336group27/src/com/cs336group27/pkg/LogoutServlet.java | 1927e1e0c338876fe2a375653e2eddf8ed68e17f | [] | no_license | eolanday/cs336group27 | cf113542119952d887e0bc1e841a6068a1ad082c | 125984cf388ddfcda18fd28a7cd8fe30582f2ac2 | refs/heads/master | 2023-01-31T11:47:15.592958 | 2020-12-18T01:49:52 | 2020-12-18T01:49:52 | 317,214,408 | 1 | 1 | null | 2020-12-18T01:50:46 | 2020-11-30T12:19:01 | Java | UTF-8 | Java | false | false | 1,521 | java | package com.cs336group27.pkg;
import java.io.IOException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.*;
/**
* Servlet implementation class LogoutServlet
*/
@WebServlet("/LogoutServlet")
public class LogoutServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public LogoutServlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
response.getWriter().append("Served at: ").append(request.getContextPath());
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
HttpSession session = request.getSession(false);
if (session != null) {
session.removeAttribute("cust");
session.removeAttribute("COUNT");
RequestDispatcher rd = request.getRequestDispatcher("index.jsp");
rd.forward(request, response);
}
}
}
| [
"eolanday@gmail.com"
] | eolanday@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.