blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 4 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 689M ⌀ | 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 131 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 32 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 313 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
332cd11d05fc7c6d78969aa3b7e1ac8c8c45dcac | 0cd5a86d0f398e6297afcb5ab259e7812cc609f9 | /src/com/zkr/xexgdd/activity/NavigationActivity.java | 558947a2abffec40ab3643127aa96735ed058c8a | [] | no_license | Win0818/XingGuangDaDao | c5f900ffd2569e69b41af272539f2e8cc477b0e3 | 63704c920e4f7230e7b9e49d8f13b9c9b72c6fde | refs/heads/master | 2020-09-11T05:06:46.108016 | 2016-08-26T11:42:41 | 2016-08-26T11:42:41 | 66,083,160 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,839 | java | package com.zkr.xexgdd.activity;
import java.util.ArrayList;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;
import android.widget.LinearLayout;
import com.zkr.xexgdd.R;
import com.zkr.xexgdd.adapter.MyViewPageAdapter;
import com.zkr.xexgdd.common.Constant;
import com.zkr.xexgdd.utils.MySharePreData;
public class NavigationActivity extends Activity implements
OnPageChangeListener, OnClickListener{
//定义ViewPager对象
private ViewPager viewPager;
//定义ViewPager适配�?
private MyViewPageAdapter vpAdapter;
//定义�?个ArrayList来存放View
private ArrayList<View> views;
private ImageView mIvEnter;
//引导图片资源
private int[] pics = new int[]{R.drawable.app_start, R.drawable.app_start,
R.drawable.app_start, R.drawable.app_start};
//底部小点的图�?
private ImageView[] points;
//记录当前选中的位�?
private int currentIndex;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_navigation);
initView();
initData();
}
/**
* 初始化组�?
*/
private void initView() {
//实例化ArrayList对象
views = new ArrayList<View>();
//实例化ViewPager
viewPager = (ViewPager) findViewById(R.id.viewpager);
mIvEnter = (ImageView) findViewById(R.id.iv_navigation_enter);
mIvEnter.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
//进入主界�?
enterMainActivity();
}
});
//实例化Viewpager的adapter
vpAdapter = new MyViewPageAdapter(views);
}
/**
* initial data
*/
@SuppressWarnings("deprecation")
private void initData() {
//定义�?个布�?并设置参�?
LinearLayout.LayoutParams mParams = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT);
//初始化引导图片界�?
for (int i = 0; i < pics.length; i++) {
ImageView iv = new ImageView(this);
iv.setLayoutParams(mParams);
//防止图片不能填满屏幕
iv.setScaleType(ScaleType.FIT_XY);
//加载图片资源
iv.setImageResource(pics[i]);
views.add(iv);
}
//设置数据
viewPager.setAdapter(vpAdapter);
viewPager.setOnPageChangeListener(this);
//初始化底部小�?
initPoint();
}
/**
* 初始化底部小�?
*/
private void initPoint() {
LinearLayout linearLayout = (LinearLayout) findViewById(R.id.ll);
points = new ImageView[pics.length];
//循环取得小点图片
for (int i = 0; i < pics.length; i++) {
//得到�?个LinearLayout下面的每�?个子元素
points[i] = (ImageView) linearLayout.getChildAt(i);
//默认都设为灰�?
points[i].setEnabled(true);
points[i].setOnClickListener(this);
//设置位置tag,方便圈与当前位置对�?
points[i].setTag(i);
}
//设置当前默认位置
currentIndex = 0;
//设置为白色,即�?�中状�??
points[currentIndex].setEnabled(false);
}
private void enterMainActivity() {
MySharePreData.SetBooleanData(this, Constant.NAVIGATION_SP_NAME,
"is_first", false);
//finish();
new Thread(new Runnable() {
@Override
public void run() {
// 进入主页�?
startActivity(new Intent(NavigationActivity.this,
MainActivity.class));
finish();
}
}).start();
}
@Override
public void onClick(View v) {
int position = (Integer) v.getTag();
setCurView(position);
setCurDot(position);
}
/**
* 当前页面状�?�改变时调用
*/
@Override
public void onPageScrollStateChanged(int arg0) {
// TODO Auto-generated method stub
}
/**
* 当前页面滑动时调�?
*/
@Override
public void onPageScrolled(int arg0, float arg1, int arg2) {
// TODO Auto-generated method stub
}
@Override
public void onPageSelected(int position) {
//设置底部小点选中状�??
setCurDot(position);
if (position == 3) {
mIvEnter.setVisibility(View.VISIBLE);
} else {
mIvEnter.setVisibility(View.INVISIBLE);
}
}
/**
* 设置当前的小点的位置
*/
private void setCurDot(int position) {
if ((position < 0) || (position > pics.length - 1) ||
(currentIndex == position)) {
return;
}
points[position].setEnabled(false);
points[currentIndex].setEnabled(true);
currentIndex = position;
}
/**
* 设置当前页面的位�?
*/
private void setCurView(int position) {
if ((position < 0) || (position > pics.length)) {
return;
}
viewPager.setCurrentItem(position);
}
}
| [
"756745281@qq.com"
] | 756745281@qq.com |
13d6bed4e9a5cff73efa569e5919bcf802504837 | 42723cec32501c57a6246d5db5c00479df4c02f8 | /src/test/java/es/udc/reunions/web/rest/CargoResourceIntTest.java | 975679de76e3bf5c9da1b240b91de15f5a34943a | [] | no_license | palomapiot/reunions | bae1de16d108b458d077d6b28c61c9fb971ce953 | f6c730186070f81cd7471d87288e4c93518238eb | refs/heads/master | 2021-08-31T12:42:11.524669 | 2017-12-21T09:55:10 | 2017-12-21T09:55:10 | 114,529,985 | 0 | 0 | null | 2017-12-17T11:12:51 | 2017-12-17T11:12:51 | null | UTF-8 | Java | false | false | 8,592 | java | package es.udc.reunions.web.rest;
import es.udc.reunions.ReunionsApp;
import es.udc.reunions.domain.Cargo;
import es.udc.reunions.repository.CargoRepository;
import es.udc.reunions.repository.search.CargoSearchRepository;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.hamcrest.Matchers.hasItem;
import org.mockito.MockitoAnnotations;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.MediaType;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.data.web.PageableHandlerMethodArgumentResolver;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.util.ReflectionTestUtils;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import javax.persistence.EntityManager;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
/**
* Test class for the CargoResource REST controller.
*
* @see CargoResource
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = ReunionsApp.class)
public class CargoResourceIntTest {
private static final String DEFAULT_NOMBRE = "AAAAA";
private static final String UPDATED_NOMBRE = "BBBBB";
@Inject
private CargoRepository cargoRepository;
@Inject
private CargoSearchRepository cargoSearchRepository;
@Inject
private MappingJackson2HttpMessageConverter jacksonMessageConverter;
@Inject
private PageableHandlerMethodArgumentResolver pageableArgumentResolver;
@Inject
private EntityManager em;
private MockMvc restCargoMockMvc;
private Cargo cargo;
@PostConstruct
public void setup() {
MockitoAnnotations.initMocks(this);
CargoResource cargoResource = new CargoResource();
ReflectionTestUtils.setField(cargoResource, "cargoSearchRepository", cargoSearchRepository);
ReflectionTestUtils.setField(cargoResource, "cargoRepository", cargoRepository);
this.restCargoMockMvc = MockMvcBuilders.standaloneSetup(cargoResource)
.setCustomArgumentResolvers(pageableArgumentResolver)
.setMessageConverters(jacksonMessageConverter).build();
}
/**
* Create an entity for this test.
*
* This is a static method, as tests for other entities might also need it,
* if they test an entity which requires the current entity.
*/
public static Cargo createEntity(EntityManager em) {
Cargo cargo = new Cargo()
.nombre(DEFAULT_NOMBRE);
return cargo;
}
@Before
public void initTest() {
cargoSearchRepository.deleteAll();
cargo = createEntity(em);
}
@Test
@Transactional
public void createCargo() throws Exception {
int databaseSizeBeforeCreate = cargoRepository.findAll().size();
// Create the Cargo
restCargoMockMvc.perform(post("/api/cargos")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(cargo)))
.andExpect(status().isCreated());
// Validate the Cargo in the database
List<Cargo> cargos = cargoRepository.findAll();
assertThat(cargos).hasSize(databaseSizeBeforeCreate + 1);
Cargo testCargo = cargos.get(cargos.size() - 1);
assertThat(testCargo.getNombre()).isEqualTo(DEFAULT_NOMBRE);
// Validate the Cargo in ElasticSearch
Cargo cargoEs = cargoSearchRepository.findOne(testCargo.getId());
assertThat(cargoEs).isEqualToComparingFieldByField(testCargo);
}
@Test
@Transactional
public void checkNombreIsRequired() throws Exception {
int databaseSizeBeforeTest = cargoRepository.findAll().size();
// set the field null
cargo.setNombre(null);
// Create the Cargo, which fails.
restCargoMockMvc.perform(post("/api/cargos")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(cargo)))
.andExpect(status().isBadRequest());
List<Cargo> cargos = cargoRepository.findAll();
assertThat(cargos).hasSize(databaseSizeBeforeTest);
}
@Test
@Transactional
public void getAllCargos() throws Exception {
// Initialize the database
cargoRepository.saveAndFlush(cargo);
// Get all the cargos
restCargoMockMvc.perform(get("/api/cargos?sort=id,desc"))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.[*].id").value(hasItem(cargo.getId().intValue())))
.andExpect(jsonPath("$.[*].nombre").value(hasItem(DEFAULT_NOMBRE.toString())));
}
@Test
@Transactional
public void getCargo() throws Exception {
// Initialize the database
cargoRepository.saveAndFlush(cargo);
// Get the cargo
restCargoMockMvc.perform(get("/api/cargos/{id}", cargo.getId()))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.id").value(cargo.getId().intValue()))
.andExpect(jsonPath("$.nombre").value(DEFAULT_NOMBRE.toString()));
}
@Test
@Transactional
public void getNonExistingCargo() throws Exception {
// Get the cargo
restCargoMockMvc.perform(get("/api/cargos/{id}", Long.MAX_VALUE))
.andExpect(status().isNotFound());
}
@Test
@Transactional
public void updateCargo() throws Exception {
// Initialize the database
cargoRepository.saveAndFlush(cargo);
cargoSearchRepository.save(cargo);
int databaseSizeBeforeUpdate = cargoRepository.findAll().size();
// Update the cargo
Cargo updatedCargo = cargoRepository.findOne(cargo.getId());
updatedCargo
.nombre(UPDATED_NOMBRE);
restCargoMockMvc.perform(put("/api/cargos")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(updatedCargo)))
.andExpect(status().isOk());
// Validate the Cargo in the database
List<Cargo> cargos = cargoRepository.findAll();
assertThat(cargos).hasSize(databaseSizeBeforeUpdate);
Cargo testCargo = cargos.get(cargos.size() - 1);
assertThat(testCargo.getNombre()).isEqualTo(UPDATED_NOMBRE);
// Validate the Cargo in ElasticSearch
Cargo cargoEs = cargoSearchRepository.findOne(testCargo.getId());
assertThat(cargoEs).isEqualToComparingFieldByField(testCargo);
}
@Test
@Transactional
public void deleteCargo() throws Exception {
// Initialize the database
cargoRepository.saveAndFlush(cargo);
cargoSearchRepository.save(cargo);
int databaseSizeBeforeDelete = cargoRepository.findAll().size();
// Get the cargo
restCargoMockMvc.perform(delete("/api/cargos/{id}", cargo.getId())
.accept(TestUtil.APPLICATION_JSON_UTF8))
.andExpect(status().isOk());
// Validate ElasticSearch is empty
boolean cargoExistsInEs = cargoSearchRepository.exists(cargo.getId());
assertThat(cargoExistsInEs).isFalse();
// Validate the database is empty
List<Cargo> cargos = cargoRepository.findAll();
assertThat(cargos).hasSize(databaseSizeBeforeDelete - 1);
}
@Test
@Transactional
public void searchCargo() throws Exception {
// Initialize the database
cargoRepository.saveAndFlush(cargo);
cargoSearchRepository.save(cargo);
// Search the cargo
restCargoMockMvc.perform(get("/api/_search/cargos?query=id:" + cargo.getId()))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.[*].id").value(hasItem(cargo.getId().intValue())))
.andExpect(jsonPath("$.[*].nombre").value(hasItem(DEFAULT_NOMBRE.toString())));
}
}
| [
"d.lamas@udc.es"
] | d.lamas@udc.es |
100afb92150c1d05139a472e7a70f9b08c16f1eb | b5b2dac6bfae5c427c99118136134a8651e904f0 | /target/java/src/org/tair/db/locusdetail/sql/QueryGeneModelsByLocusDetail.java | e356ee18ccf4506ccdfe5cc917be503191f8daee | [
"BSD-3-Clause"
] | permissive | tair/dw | b9799bb302ad8054024ec5391a2fdb32927a0704 | 6a9770640b2423eab20c5d1438fd3d95ecfda8b7 | refs/heads/master | 2021-01-21T12:07:18.718417 | 2015-10-21T00:08:39 | 2015-10-21T00:08:39 | 11,266,113 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 790 | java | /**
* Copyright 2012 Carnegie Institution for Science. All rights reserved.
*/
// Template: QueryAssociatedOneToManyObjects.vsl
package org.tair.db.locusdetail.sql;
/**
* <p>
* A query of a collection of LocusGeneModel objects using the primary key of
* an associated LocusDetail object. This class is the concrete
* subclass of the generated abstract class AbstractQueryGeneModelsBy${query.foriegnTypeName}.
*</p>
* <p>
* Make any changes to query behavior by overriding methods here rather than
* changing the abstract superclass; AndroMDA will overwrite that class when you
* run it but will never overwrite this concrete subclass.
* </p>
*
* @author Poesys/DB Cartridge
*/
public class QueryGeneModelsByLocusDetail extends AbstractQueryGeneModelsByLocusDetail {
} | [
"bmuller@stanford.edu"
] | bmuller@stanford.edu |
b240822ebb6f6a833924c088aee586d40617fe5c | 5eac59969db8aeced9505d57aa47947ffb32ba67 | /app/src/main/java/com/iwit/rodney/imp/IRecordImpl.java | 41a2bf196656400a82613b3a2486f396a1701dea | [] | no_license | Kenway090704/Rodney1 | c33f58223c7b1ae2e6a518445f14c394682f2112 | cd2a58406c5685fb65137f9dee84d28cb9d0deb7 | refs/heads/master | 2021-01-22T10:40:54.186221 | 2017-02-15T09:07:01 | 2017-02-15T09:07:01 | 82,027,605 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,378 | java | package com.iwit.rodney.imp;
import java.io.File;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import android.os.Environment;
import com.iwit.rodney.bussess.MusicDas;
import com.iwit.rodney.bussess.RecordDas;
import com.iwit.rodney.comm.CommConst;
import com.iwit.rodney.comm.tools.FileUtils;
import com.iwit.rodney.entity.Music;
import com.iwit.rodney.entity.Record;
import com.iwit.rodney.event.EventRecord;
import com.iwit.rodney.interfaces.IRecord;
import de.greenrobot.event.EventBus;
public class IRecordImpl implements IRecord {
private Map<String, Music> mid2Music = new HashMap<String, Music>();
@Override
public List<Record> getRecords() {
return RecordDas.getRecords();
}
@Override
public Music getCachedMusic(String mid) {
synchronized (this) {
Music m = mid2Music.get(mid);
if (m != null)
return m;
m = getFromDB(mid);
if (m != null)
mid2Music.put(mid, m);
return m;
}
}
private Music getFromDB(String mid) {
return MusicDas.getMusic(mid);
}
@Override
public boolean delete(Record record) {
// delete file and db data
if (RecordDas.delete(record) <= 0) {
return false;
}
File file = new File(Environment.getExternalStorageDirectory()
.getAbsolutePath()
+ CommConst.MUSIC_FILE_PATH
+ record.getName());
if (file.exists()) {
file.delete();
}
notifyRecrodDataChanged();
return true;
}
@Override
public boolean save(String tempFilePath, Record record) {
File file = new File(tempFilePath);
boolean result = RecordDas.save(record);
if (!result) {
return false;
}
result = file.renameTo(new File(Environment
.getExternalStorageDirectory().getAbsoluteFile()
+ CommConst.MUSIC_FILE_PATH + record.getName() + ".amr"));
if (!result) {
RecordDas.delete(record);
}
if (result) {
notifyRecrodDataChanged();
}
return result;
}
@Override
public boolean rename(Record record, String name) {
// 重命名本地文件,修改数据库
boolean result = false;
try {
result = RecordDas.update(record.getName(), name) > 0;
} catch (Exception ignore) {
}
if (!result) {
return false;
}
String basePath = Environment.getExternalStorageDirectory()
.getAbsolutePath() + CommConst.MUSIC_FILE_PATH;
File dest = new File(basePath + name + ".amr");
if (dest.exists()) {
dest.delete();
}
File src = new File(basePath + record.getName() + ".amr");
if (!src.exists()) {
throw new RuntimeException();
}
result = src.renameTo(dest);
if (!result) {
RecordDas.update(name, record.getName());
return false;
}
notifyRecrodDataChanged();
return true;
}
private void notifyRecrodDataChanged() {
EventBus.getDefault().post(new EventRecord());
}
@Override
public String saveLrc(String lrcName, String lrcContent) {
String basePath = Environment.getExternalStorageDirectory()
.getAbsolutePath() + CommConst.MUSIC_FILE_PATH;
File lrc = new File(basePath + lrcName + ".lrc");
int count = 0;
while (lrc.exists()) {
if (count++ > 10) {
return null;
}
lrcName += "_";
lrc = new File(basePath + lrcName + ".lrc");
}
if (FileUtils.saveFile(lrc, lrcContent))
return lrcName;
else
return null;
}
}
| [
"254903810@qq.com"
] | 254903810@qq.com |
0c4da3fadfc07b0a0bbfc3044836df88cd141fad | 449c28da15d21e6029b36f16521440755d15a618 | /src/main/java/br/com/sarp/controller/converters/EstadosConverter.java | a7148da8660177446f88f518e7e7519c0312451e | [] | no_license | UzumakiFerrel/sarp | 7168f731d2186964bc78fec08b9ba73280cda8ed | cd2f2bd8a7888f9a635ce24a9f462da69384a6b6 | refs/heads/master | 2021-01-02T08:46:41.288815 | 2015-02-28T14:06:14 | 2015-02-28T14:06:14 | 31,464,036 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,110 | java | package br.com.sarp.controller.converters;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.inject.Inject;
import javax.inject.Named;
import br.com.sarp.model.entidades.Estados;
import br.com.sarp.model.service.EstadosService;
@Named
public class EstadosConverter implements Converter {
@Inject
EstadosService estadosService;
public Object getAsObject(FacesContext context, UIComponent component,
String id) {
try {
Integer l = Integer.parseInt(id);
Estados estados = estadosService.buscarId(l);
System.out.println("Converteu " + estados.getNome());
return estados;
} catch (NumberFormatException e) {
e.printStackTrace();
System.out.println("Erro de conversao " + e.getMessage());
return null;
}
}
public String getAsString(FacesContext context, UIComponent component,
Object estado) {
try{
Estados e = (Estados) estado;
if(e.getCd_uf()==null) return null;
return e.getCd_uf().toString();
} catch(Exception e){
e.printStackTrace();
return null;
}
}
}
| [
"cnfoal@hotmail.com"
] | cnfoal@hotmail.com |
28f376f008a386fa9a28a716d2b3d16c7273e125 | 285181d4c8248a741fba87bb4e3cd77a8f0e3b03 | /app/src/main/java/org/cba/checkbible/db/Backup.java | 5be8d6064c4f82ab6b577db2bf7a78ca022732b9 | [] | no_license | truelightn/checkbible | 2836719489d7d6a33e2b180c1cb2ef1525b6a1c0 | e0cc6306d855aa6a2d5be675412c98820d86fe8d | refs/heads/master | 2021-05-04T05:53:53.058220 | 2019-01-04T08:57:30 | 2019-01-04T08:57:30 | 71,086,436 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,308 | java | package org.cba.checkbible.db;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Environment;
import android.support.v4.app.FragmentActivity;
import android.support.v7.app.AlertDialog;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;
import org.cba.checkbible.CheckBibleApp;
import org.cba.checkbible.R;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.channels.FileChannel;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* Created by jinhwan.na on 2017-05-23.
*/
public class Backup {
private static final String TAG = Backup.class.getSimpleName();
static final String DB_NAME = "checkbible";
private final String mBackUpDirectory = Environment.getExternalStorageDirectory() + "/CheckBible";
private Context mContext;
public Backup(Context context) {
mContext = context;
}
private void createFolder() {
File sd = new File(mBackUpDirectory);
if (!sd.exists()) {
sd.mkdir();
}
}
public void exportDB() {
try {
createFolder();
File sd = new File(mBackUpDirectory);
if (sd.canWrite()) {
SimpleDateFormat formatTime = new SimpleDateFormat("yyyy_MM_dd_HH_mm_ss");
String backupDBPath = DB_NAME + "_" + formatTime.format(new Date());
String currentDBPath = "//data//" + CheckBibleApp.getContext().getPackageName()
+ "//databases//" + DB_NAME;
File currentDB = new File(Environment.getDataDirectory(), currentDBPath);
File backupDB = new File(sd, backupDBPath);
FileChannel src = new FileInputStream(currentDB).getChannel();
FileChannel dst = new FileOutputStream(backupDB).getChannel();
dst.transferFrom(src, 0, src.size());
src.close();
dst.close();
Toast.makeText(CheckBibleApp.getContext(), "Backup Successful to Internal storage/CheckBible/"+ backupDBPath,
Toast.LENGTH_SHORT).show();
}
} catch (Exception e) {
Toast.makeText(CheckBibleApp.getContext(), "Backup Failed!", Toast.LENGTH_SHORT)
.show();
}
}
public void showDialLog() {
final AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
builder.setTitle(R.string.backup_data).setIcon(R.mipmap.ic_launcher)
.setMessage(R.string.backup_before_import);
builder.setPositiveButton(R.string.no, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
builder.setNegativeButton(R.string.yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
showDialogListFile();
// exportToSD();
}
});
builder.show();
}
public void showDialogListFile() {
createFolder();
File forder = new File(mBackUpDirectory);
File[] listFile = forder.listFiles();
final String[] listFileName = new String[listFile.length];
for (int i = 0, j = listFile.length - 1; i < listFile.length; i++, j--) {
listFileName[j] = listFile[i].getName();
}
if (listFileName.length > 0) {
// get layout for list
LayoutInflater inflater = ((FragmentActivity) mContext).getLayoutInflater();
View convertView = inflater.inflate(R.layout.list_backup_file, null);
final AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
// set view for dialog
builder.setView(convertView);
builder.setTitle(R.string.select_file).setIcon(R.mipmap.ic_launcher);
final AlertDialog alert = builder.create();
ListView lv = (ListView) convertView.findViewById(R.id.lv_backup);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(mContext,
android.R.layout.simple_list_item_1, listFileName);
lv.setAdapter(adapter);
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
alert.dismiss();
importDB(listFileName[position]);
}
});
alert.show();
} else {
final AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
builder.setTitle(R.string.delete).setIcon(R.mipmap.ic_launcher)
.setMessage(R.string.backup_empty);
builder.show();
}
}
public void importDB(String fileNameOnSD) {
File sd = new File(mBackUpDirectory);
if (sd.canWrite()) {
String currentDBPath = "//data//" + CheckBibleApp.getContext().getPackageName()
+ "//databases//" + DB_NAME;
File currentDB = new File(Environment.getDataDirectory(), currentDBPath);
File backupDB = new File(sd, fileNameOnSD);
try {
FileChannel src = new FileInputStream(backupDB).getChannel();
FileChannel dst = new FileOutputStream(currentDB)
.getChannel();
dst.transferFrom(src, 0, src.size());
src.close();
dst.close();
onBackupListener.onFinishImport();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
}
}
}
private OnBackupListener onBackupListener;
public void setOnBackupListener(OnBackupListener onBackupListener) {
this.onBackupListener = onBackupListener;
}
public interface OnBackupListener {
void onFinishImport();
}
}
| [
"jinhwan.na@lge.com"
] | jinhwan.na@lge.com |
c0959658aa78f3ba1f2f131d3af9e8b9048df79a | 735b6766a5d4898e14fdacfc99552579ad03067b | /VirtuaalinenLintukirja/src/test/java/viliki/virtuaalinenlintukirja/AppTest.java | d3a3c21ef0abc688a5907f917cded851a83ff49f | [] | no_license | Eeki/Viliki | bd7ee6c6f42aa9678f6ed06ca34e23037bf6a346 | 030e24a58bcf28047928db2ef51ba6cfeeb23634 | refs/heads/master | 2021-01-19T18:10:41.891432 | 2014-06-23T20:31:31 | 2014-06-23T20:31:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 657 | java | package viliki.virtuaalinenlintukirja;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit test for simple App.
*/
public class AppTest
extends TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName )
{
super( testName );
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
}
/**
* Rigourous Test :-)
*/
public void testApp()
{
assertTrue( true );
}
}
| [
"kalle.niukkanen@gmail.com"
] | kalle.niukkanen@gmail.com |
789051d68f7da1688482f545e82d29732087cdf8 | e81277c679bd3d77e7c276765d83ab65832532fe | /src/main/java/riptide/queue/ConveyorBelt.java | 40c2b651b3de2f223ae6123740cd169df7f6cf70 | [] | no_license | CyberFlameGO/Riptide | 09aab980c57d04c8709ec4977e170505902b6190 | 74317d48b4f1e61da0b88efac15372040451da2b | refs/heads/master | 2022-03-28T17:03:52.123037 | 2019-06-06T00:59:21 | 2019-06-06T00:59:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 525 | java | package riptide.queue;
import java.util.List;
/**
* Represents a queue like conveyor belt where data is constantly filled up and
* emptied by a consumer or when it hits it's occupancy limit
*
* @author cyberpwn
*
* @param <T>
* the type of data
*/
public interface ConveyorBelt<T>
{
public void push(T t);
public T pull();
public boolean canPull();
public int getOccupancy();
public int getSize();
public void setSize(int size);
public ConveyorBelt<T> clone();
public List<T> getData();
}
| [
"danielmillst@gmail.com"
] | danielmillst@gmail.com |
b25618d6044ddda0ddf9066e4348cf15d9a040dc | bec4e7456f8b6a109f128b6d466c3375298b13ec | /src/main/java/com/spring/ehcache/eventlogger/CustomCacheEventLogger.java | c472615331aa94a1c77e6224810c9b50d59cd8d2 | [] | no_license | Chaminda202/Spring-boot-caching | 928833a5a9afa18477c3a2dc87b66463530ad9c2 | 61bf4a0bcde54cc75e737008681a796a73e98300 | refs/heads/master | 2022-12-25T02:54:18.399407 | 2020-02-10T00:05:42 | 2020-02-10T00:05:42 | 200,636,797 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 656 | java | package com.spring.ehcache.eventlogger;
import org.ehcache.event.CacheEvent;
import org.ehcache.event.CacheEventListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class CustomCacheEventLogger implements CacheEventListener<Object, Object> {
private static final Logger LOG = LoggerFactory.getLogger(CustomCacheEventLogger.class);
@SuppressWarnings("rawtypes")
@Override
public void onEvent(CacheEvent cacheEvent) {
LOG.info("Cache event = {}, Key = {}, Old value = {}, New value = {}", cacheEvent.getType(),
cacheEvent.getKey(), cacheEvent.getOldValue(), cacheEvent.getNewValue());
}
} | [
"chaminda.sampath@inovaitsys.com"
] | chaminda.sampath@inovaitsys.com |
650b015037441481a61e5d9feca6895de9ef20c3 | af4a407866a9399c6e26107f7eda011979becfd4 | /MultiThread/src/ConCurrency/net/jcip/examples/CellularAutomata.java | 171164470bb662a5c306b8409809bb2d9d529df0 | [] | no_license | chptiger/MultiThread | 4dd87c364f8b7a4bf94ff2f37f453397f1a393bb | dba864328563a79f8fedfdcdec52e06de17304ff | refs/heads/master | 2021-01-10T13:41:09.792816 | 2018-09-05T02:13:30 | 2018-09-05T02:13:30 | 54,494,602 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,153 | java | package ConCurrency.net.jcip.examples;
import java.util.concurrent.*;
/**
* CellularAutomata
*
* Coordinating computation in a cellular automaton with CyclicBarrier
*
* @author Brian Goetz and Tim Peierls
*/
public class CellularAutomata {
private final Board mainBoard;
private final CyclicBarrier barrier;
private final Worker[] workers;
public CellularAutomata(Board board) {
this.mainBoard = board;
int count = Runtime.getRuntime().availableProcessors();
this.barrier = new CyclicBarrier(count,
new Runnable() {
public void run() {
mainBoard.commitNewValues();
}});
this.workers = new Worker[count];
for (int i = 0; i < count; i++)
workers[i] = new Worker(mainBoard.getSubBoard(count, i));
}
private class Worker implements Runnable {
private final Board board;
public Worker(Board board) { this.board = board; }
public void run() {
while (!board.hasConverged()) {
for (int x = 0; x < board.getMaxX(); x++)
for (int y = 0; y < board.getMaxY(); y++)
board.setNewValue(x, y, computeValue(x, y));
try {
barrier.await();
} catch (InterruptedException ex) {
return;
} catch (BrokenBarrierException ex) {
return;
}
}
}
private int computeValue(int x, int y) {
// Compute the new value that goes in (x,y)
return 0;
}
}
public void start() {
for (int i = 0; i < workers.length; i++)
new Thread(workers[i]).start();
mainBoard.waitForConvergence();
}
interface Board {
int getMaxX();
int getMaxY();
int getValue(int x, int y);
int setNewValue(int x, int y, int value);
void commitNewValues();
boolean hasConverged();
void waitForConvergence();
Board getSubBoard(int numPartitions, int index);
}
}
| [
"thomas.java863@gmail.com"
] | thomas.java863@gmail.com |
a5bfa3a98c18dcac6a63aca63f105ee45f455121 | 2a459da8a0835f22f1ccf425d60152e82e19160b | /app/src/main/java/com/juhezi/coderslife/SingleFragmentActivity.java | 797f63633b241f3d07a6b53b9141bd1730d9c540 | [] | no_license | qiaoyunrui/CoderLife | 946e1bc1b357df1011dd6d55ed34e58e8cb42892 | a9df06d34e1e5ad5b16106fc828b34fe151f33b4 | refs/heads/master | 2021-01-12T01:49:13.353059 | 2017-03-03T13:43:54 | 2017-03-03T13:43:54 | 78,435,687 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,230 | java | package com.juhezi.coderslife;
import android.databinding.DataBindingUtil;
import android.databinding.ViewDataBinding;
import android.os.Bundle;
import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.app.AppCompatActivity;
/**
* Created by qiao1 on 2017/1/11.
*/
public abstract class SingleFragmentActivity<T extends ViewDataBinding> extends AppCompatActivity {
private static String TAG = "SingleFragmentActivity";
protected void init(T binding) {
}
protected abstract Fragment getFragment();
@LayoutRes
protected abstract int getActLayoutRes();
protected abstract int getFragContainerId();
protected Fragment fragment = null;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
T binding = DataBindingUtil.setContentView(this, getActLayoutRes());
fragment = getSupportFragmentManager().findFragmentById(getFragContainerId());
if (fragment == null) {
fragment = getFragment();
getSupportFragmentManager().beginTransaction()
.add(getFragContainerId(), fragment)
.commit();
}
init(binding);
}
/**
* ii. ;9ABH,
* SA391, .r9GG35&G
* &#ii13Gh; i3X31i;:,rB1
* iMs,:,i5895, .5G91:,:;:s1:8A
* 33::::,,;5G5, ,58Si,,:::,sHX;iH1
* Sr.,:;rs13BBX35hh11511h5Shhh5S3GAXS:.,,::,,1AG3i,GG
* .G51S511sr;;iiiishS8G89Shsrrsh59S;.,,,,,..5A85Si,h8
* :SB9s:,............................,,,.,,,SASh53h,1G.
* .r18S;..,,,,,,,,,,,,,,,,,,,,,,,,,,,,,....,,.1H315199,rX,
* ;S89s,..,,,,,,,,,,,,,,,,,,,,,,,....,,.......,,,;r1ShS8,;Xi
* i55s:.........,,,,,,,,,,,,,,,,.,,,......,.....,,....r9&5.:X1
* 59;.....,. .,,,,,,,,,,,... .............,..:1;.:&s
* s8,..;53S5S3s. .,,,,,,,.,.. i15S5h1:.........,,,..,,:99
* 93.:39s:rSGB@A; ..,,,,..... .SG3hhh9G&BGi..,,,,,,,,,,,,.,83
* G5.G8 9#@@@@@X. .,,,,,,..... iA9,.S&B###@@Mr...,,,,,,,,..,.;Xh
* Gs.X8 S@@@@@@@B:..,,,,,,,,,,. rA1 ,A@@@@@@@@@H:........,,,,,,.iX:
* ;9. ,8A#@@@@@@#5,.,,,,,,,,,... 9A. 8@@@@@@@@@@M; ....,,,,,,,,S8
* X3 iS8XAHH8s.,,,,,,,,,,...,..58hH@@@@@@@@@Hs ...,,,,,,,:Gs
* r8, ,,,...,,,,,,,,,,..... ,h8XABMMHX3r. .,,,,,,,.rX:
* :9, . .:,..,:;;;::,.,,,,,.. .,,. ..,,,,,,.59
* .Si ,:.i8HBMMMMMB&5,.... . .,,,,,.sMr
* SS :: h@@@@@@@@@@#; . ... . ..,,,,iM5
* 91 . ;:.,1&@@@@@@MXs. . .,,:,:&S
* hS .... .:;,,,i3MMS1;..,..... . . ... ..,:,.99
* ,8; ..... .,:,..,8Ms:;,,,... .,::.83
* s&: .... .sS553B@@HX3s;,. .,;13h. .:::&1
* SXr . ...;s3G99XA&X88Shss11155hi. ,;:h&,
* iH8: . .. ,;iiii;,::,,,,,. .;irHA
* ,8X5; . ....... ,;iihS8Gi
* 1831, .,;irrrrrs&@
* ;5A8r. .:;iiiiirrss1H
* :X@H3s....... .,:;iii;iiiiirsrh
* r#h:;,...,,.. .,,:;;;;;:::,... .:;;;;;;iiiirrss1
* ,M8 ..,....,.....,,::::::,,... . .,;;;iiiiiirss11h
* 8B;.,,,,,,,.,..... . .. .:;;;;iirrsss111h
* i@5,:::,,,,,,,,.... . . .:::;;;;;irrrss111111
* 9Bi,:,,,,...... ..r91;;;;;iirrsss1ss1111
*/
}
| [
"juhezix@163.com"
] | juhezix@163.com |
46a6e88922397631bfb39743052934990ad9395e | 7222b8b61e9a1bb52fc333bd81e7be71b1ff25bf | /src/main/java/com/example/algamoney/resource/CategoriaResource.java | 4c772e84ca42c293d4cf97a45f503e15eb615de7 | [] | no_license | dettone/FullStackExample | 54008dcbe983d3c5e7ba9c595fba9f4f3ba2f36e | 7f5279d876f77102f0789e836ad755ae21df3fc6 | refs/heads/master | 2020-12-02T13:27:42.726087 | 2020-01-13T02:37:41 | 2020-01-13T02:37:41 | 231,021,332 | 0 | 0 | null | 2020-01-03T22:20:01 | 2019-12-31T03:46:36 | Java | UTF-8 | Java | false | false | 3,815 | java | package com.example.algamoney.resource;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
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.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import com.example.algamoney.event.RecursoCriadoEvent;
import com.example.algamoney.model.Categoria;
import com.example.algamoney.repository.CategoriaRepository;
import com.example.algamoney.service.CategoriaService;
//Cross Origin tira o bloqueio para outras portas http
//spring.io/guides/gs/rest-service-cors <- Serve para habilitar o cors em toda a aplicacao
//@CrossOrigin(maxAge = 10)
@RestController
@RequestMapping("/categorias")
public class CategoriaResource {
@Autowired
private CategoriaRepository categoriaRepository;
@GetMapping
@PreAuthorize("hasAuthority('ROLE_PESQUISAR_CATEGORIA')")
public List<Categoria> listar() {
return categoriaRepository.findAll();
}
// cria um Location e cria um local onde e criado e recuperar ele
@Autowired
private ApplicationEventPublisher publisher;
@Autowired
private CategoriaService categoriaService;
@PostMapping
@ResponseStatus(HttpStatus.CREATED)
@PreAuthorize("hasAuthority('ROLE_CADASTRAR_CATEGORIA') and #oauth2.hasScope('read')")
public ResponseEntity<Categoria> criar(@Valid @RequestBody Categoria categorias, HttpServletResponse response) {
Categoria categoriaSalva = categoriaRepository.save(categorias);
/*
* URI uri =
* ServletUriComponentsBuilder.fromCurrentRequestUri().path("/{codigo}")
* .buildAndExpand(categoriaSalva.getCodigo()).toUri();
* response.setHeader("Location", uri.toASCIIString());
*/
// obj que gerou o event o proprio objeto
publisher.publishEvent(new RecursoCriadoEvent(this, response, categoriaSalva.getCodigo()));
/*
* URI uri =
* ServletUriComponentsBuilder.fromCurrentRequestUri().path("/{codigo}")
* .buildAndExpand(pessoaSalva.getCodigo()).toUri();
* response.setHeader("Location", uri.toASCIIString());
*/
// return ResponseEntity.created().body(pessoaSalva);
return ResponseEntity.status(HttpStatus.CREATED).body(categoriaSalva);
// return ResponseEntity.created(uri).body(categoriaSalva);
}
@SuppressWarnings("rawtypes")
@GetMapping("/{codigo}")
@PreAuthorize("hasAuthority('ROLE_PESQUISAR_CATEGORIA') and #oauth2.hasScope('write')")
public ResponseEntity buscarPeloCodigo(@PathVariable Long codigo) {
return this.categoriaRepository.findById(codigo).map(categoria -> ResponseEntity.ok(categoria))
.orElse(ResponseEntity.notFound().build());
}
@DeleteMapping("/{codigo}")
@ResponseStatus(HttpStatus.NO_CONTENT)
@PreAuthorize("hasAuthority('ROLE_REMOVER_CATEGORIA') and #oauth2.hasScope('read')")
public void remover(@PathVariable Long codigo) {
this.categoriaRepository.deleteById(codigo);
}
@PutMapping("/{codigo}")
public ResponseEntity<Categoria> editar(@PathVariable Long codigo, @Valid @RequestBody Categoria categoria) {
Categoria categoriaSalva = categoriaService.editar(codigo, categoria);
return ResponseEntity.ok(categoriaSalva);
}
}
| [
"dettonex25@gmail.com"
] | dettonex25@gmail.com |
f89182cd4588eda7d74ee7ac7aec4111fadde299 | b1febd7d40e683abce83d2875a4dd00ace169efc | /basic/myapplication/src/main/java/com/di5cheng/myapplication/MyApplication.java | d8509556592b577d4b42d10473a3caed5c8eb57b | [] | no_license | zhoulesin/learnandroid | b89c1ecf0c5137cfb82d90d9d5f49a0385a0ec86 | b73f2bfb543ecd38384fc61b4a5e39ba1c9b1b28 | refs/heads/master | 2020-03-28T05:13:34.654104 | 2018-12-26T10:01:07 | 2018-12-26T10:01:07 | 147,763,694 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,123 | java | package com.di5cheng.myapplication;
import android.app.Application;
import android.content.Context;
import android.content.res.Configuration;
import android.util.Log;
/**
* Created by zhoul on 2018/11/9.
*/
public class MyApplication extends Application{
public static final String TAG = MyApplication.class.getSimpleName();
@Override
public void onCreate() {
super.onCreate();
//程序创建
Log.d(TAG, "onCreate: ");
}
@Override
public void onTerminate() {
super.onTerminate();
//程序终止
Log.d(TAG, "onTerminate: ");
}
@Override
public void onLowMemory() {
super.onLowMemory();
//低内存
Log.d(TAG, "onLowMemory: ");
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
}
@Override
public void onTrimMemory(int level) {
super.onTrimMemory(level);
//内存清理
//home键退出应用,长按menu键打开recent task都会执行
Log.d(TAG, "onTrimMemory: ");
}
}
| [
"zhoulesin@163.com"
] | zhoulesin@163.com |
e2ddee6b2a4f03b8b508e4b6d1bf2c34a5f2cb67 | b5ff7225024c19e3297346e52544b8e45d988c14 | /src/main/java/com/hk/security/core/validate/code/impl/AbstractValidateCodeProcessor.java | 5235acdaecd83b54630913a4957a070d03f929e8 | [] | no_license | upzzq/spring-security | 0296985e5eb60003eff8063b5c5205dc9f78e709 | 6874af54b987feeedbb2976bb9a8617f8a346f43 | refs/heads/master | 2020-03-31T13:01:11.351412 | 2018-10-09T11:24:50 | 2018-10-09T11:24:50 | 152,238,603 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,182 | java | package com.hk.security.core.validate.code.impl;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.social.connect.web.HttpSessionSessionStrategy;
import org.springframework.social.connect.web.SessionStrategy;
import org.springframework.web.context.request.ServletWebRequest;
import com.hk.security.core.validate.code.ValidateCode;
import com.hk.security.core.validate.code.ValidateCodeGenerator;
import com.hk.security.core.validate.code.ValidateCodeProcessor;
public abstract class AbstractValidateCodeProcessor<C extends ValidateCode> implements ValidateCodeProcessor {
/**
* 操作session工具类
*/
private SessionStrategy sessionStrategy = new HttpSessionSessionStrategy();
/**
* 搜集系统中所有的 {@link ValidateCodeGenerator} 接口的实现
*/
@Autowired
private Map<String, ValidateCodeGenerator> validateCodeGenerators;
@Override
public void create(ServletWebRequest request) throws Exception {
C validateCode = generate(request);
save(request, validateCode);
send(request, validateCode);
}
public C generate(ServletWebRequest request) {
String type = getProcessorType(request);
ValidateCodeGenerator validateCodeGenerator = validateCodeGenerators.get(type + "CodeGenerator");
return (C) validateCodeGenerator.generate(request);
}
/**
* 根据请求的url获取验证码类型
* @param request
* @return
*/
private String getProcessorType(ServletWebRequest request) {
return StringUtils.substringAfter(request.getRequest().getRequestURI(), "/code/");
}
/**
* 保存校验码
* @param request
* @param validateCode
*/
private void save(ServletWebRequest request, C validateCode) {
sessionStrategy.setAttribute(request, SESSION_KEY_PREFIX + getProcessorType(request).toUpperCase(), validateCode);
}
/**
* 发送验证码,由子类实现
* @param request
* @param validateCode
* @throws Exception
*/
protected abstract void send(ServletWebRequest request, C validateCode) throws Exception;
}
| [
"zhouziqi@gmail.com"
] | zhouziqi@gmail.com |
c573b09f28871e5cf45f917a4678770b355d6a64 | 024ad1b78d3f60c10eaff009979a542569312f89 | /app/src/main/java/com/example/uteq/revistasplaceholder/model/Articulo.java | 417e090f394926443eb0b89d22fc90806d399e5f | [] | no_license | josegerar/UTEQ_Revistas_Placeholder | d8939ba397232d61cc2d4bc329b65b2824482a6a | d7cc8cc61d0b6d7338b0373a28df41a1256e1e33 | refs/heads/master | 2023-03-22T17:57:39.049264 | 2021-03-12T04:58:54 | 2021-03-12T04:58:54 | 346,843,025 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,132 | java | package com.example.uteq.revistasplaceholder.model;
import java.util.ArrayList;
public class Articulo {
private String title;
private ArrayList<Autor> autors;
private ArrayList<Galery> galeries;
public Articulo() {
}
public Articulo(String title, ArrayList<Autor> autors, ArrayList<Galery> galeries) {
this.title = title;
this.autors = autors;
this.galeries = galeries;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public ArrayList<Autor> getAutors() {
return autors;
}
public void setAutors(ArrayList<Autor> autors) {
this.autors = autors;
}
public ArrayList<Galery> getGaleries() {
return galeries;
}
public void setGaleries(ArrayList<Galery> galeries) {
this.galeries = galeries;
}
@Override
public String toString() {
return "Articulo{" +
"title='" + title + '\'' +
", autors=" + autors +
", galeries=" + galeries +
'}';
}
}
| [
"jgarcia24121996@gmail.com"
] | jgarcia24121996@gmail.com |
2a5e0018864d63ac8c11f34bd6555b8e8a5de885 | 097b066c82bd2907206bd29de8b4dad129bb859e | /src/main/java/Application/jedi/JediOrder.java | bf427a9b8beb8b169456e6b3a11649da048aee03 | [] | no_license | dcoleman90/Spring-Boot-with-Jedi | fa332d3524b5219b2e5787436582ef43ab767229 | 541d3e1bc8180c692d85896c41074d534ede0dec | refs/heads/master | 2020-04-13T16:34:16.547583 | 2019-01-03T20:25:21 | 2019-01-03T20:25:21 | 163,324,719 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,919 | java | package Application.jedi;
import java.util.ArrayList;
public class JediOrder {
private ArrayList<Jedi> oldRepublic;
public JediOrder() {
this.oldRepublic = new ArrayList<Jedi>();
this.addMembersToTheOldRepublic();
}
private void addMembersToTheOldRepublic() {
Jedi obi = new Jedi("Obi-Won", "Human", 30, "Green", "Jedi Master");
Jedi anakin = new Jedi("Anakin Skywalker", "Human", 18, "Blue",
"Had a seat on the council but not given the rank of master");
Jedi yoda = new Jedi("Yoda", "Unknown", 900, "Green", "Grand Master");
Jedi plo = new Jedi("Plo Koon", "Kel Dor", 100, "Blue", "Master");
Jedi ahsoka = new Jedi("Ahsoka Tano", "Togruta", 16, "Blue and Green", "She is No Jedi");
this.oldRepublic.add(obi);
this.oldRepublic.add(anakin);
this.oldRepublic.add(yoda);
this.oldRepublic.add(plo);
this.oldRepublic.add(ahsoka);
}
public void addJedi(Jedi addedJedi) {
this.oldRepublic.add(addedJedi);
}
public ArrayList<Jedi> getRepublic() {
return this.oldRepublic;
}
public Jedi getJedi(String name) {
return this.oldRepublic.stream().filter(t -> t.getName().equals(name)).findFirst().get();
}
public ArrayList<Jedi> findRace(String race) {
ArrayList<Jedi> listOfJediRaces = new ArrayList<Jedi>();
for (int count = 0; count < this.oldRepublic.size(); count++) {
if (this.oldRepublic.get(count).getRace().equals(race)) {
listOfJediRaces.add(this.oldRepublic.get(count));
}
}
return listOfJediRaces;
}
public void updateJedi(Jedi addedJedi, String name) {
for (int count = 0; count < this.oldRepublic.size(); count++) {
Jedi jedi = this.oldRepublic.get(count);
if (jedi.getName().equals(name)) {
this.oldRepublic.set(count, addedJedi);
break;
}
}
}
public void deleteJedi(String name) {
this.oldRepublic.removeIf(jedi -> jedi.getName().equals(name));
}
}
| [
"dcolem12@my.westga.edu"
] | dcolem12@my.westga.edu |
1559601ac8029e7d650713ecb0356ecacc6fbd2d | 26bf72fab7cede7edc81cda8c39c96d5af09f3cf | /Nanashi/AdvancedTools/ItemUQPlanetGuardian.java | 03b53c42fab2903b74011a61cc29c101336f5aa2 | [] | no_license | softpj98/EnchantChanger147 | b0a80c078466aa0abe140499a0582d008dcba0bb | 0f324cb7ac516ff61ddd6e9668e0bafadafae43f | refs/heads/master | 2021-01-21T09:29:20.080426 | 2013-12-18T12:44:43 | 2013-12-18T12:44:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,199 | java | package Nanashi.AdvancedTools;
import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemUQPlanetGuardian extends ItemUniqueArms
{
protected ItemUQPlanetGuardian(int var1, EnumToolMaterial var2)
{
super(var1, var2);
}
protected ItemUQPlanetGuardian(int var1, EnumToolMaterial var2, int var3)
{
super(var1, var2);
this.weaponStrength = var3;
}
public void onUpdate(ItemStack var1, World var2, Entity var3, int var4, boolean var5)
{
super.onUpdate(var1, var2, var3, var4, var5);
}
public void onPlayerStoppedUsing(ItemStack var1, World var2, EntityPlayer var3, int var4)
{
int var5 = var3.getFoodStats().getFoodLevel();
if (var5 > 6)
{
int var6 = this.getMaxItemUseDuration(var1) - var4;
float var7 = (float)var6 / 20.0F;
var7 = (var7 * var7 + var7 * 2.0F) / 3.0F;
if ((double)var7 < 0.1D)
{
return;
}
if (var7 > 1.0F)
{
var7 = 1.0F;
}
Entity_PGPowerBomb var8 = new Entity_PGPowerBomb(var2, var3, var7);
if (!var2.isRemote)
{
var2.spawnEntityInWorld(var8);
}
if (!var3.capabilities.isCreativeMode)
{
var3.getFoodStats().addStats(-1, 1.0f);
}
var1.damageItem(1, var3);
var3.swingItem();
var2.playSoundAtEntity(var3, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F));
}
}
public EnumAction getItemUseAction(ItemStack var1)
{
return EnumAction.bow;
}
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("Ability : Ground Banish");
}
public ItemStack onItemRightClick(ItemStack var1, World var2, EntityPlayer var3)
{
int var4 = var3.getFoodStats().getFoodLevel();
if (var4 > 6)
{
var3.setItemInUse(var1, this.getMaxItemUseDuration(var1));
}
return var1;
}
}
| [
"akira.mew@gmail.com"
] | akira.mew@gmail.com |
0289afabf8ec0dc370b9c8a98c5058709e518411 | 95e435fa70669d7b0ba27712a378167a1f41787b | /src/pikater/ontology/messages/SetSItem.java | 2d484bc20d34dad252a0a536ae0577fa1c4265ae | [] | no_license | peskk3am/pikater4 | d4e850dbeca77520f7bdc06a2bbd780ac86f95ca | 090fec2bec42709d68eca8640c648223761a9402 | refs/heads/master | 2016-09-06T02:39:31.161371 | 2014-04-16T14:37:08 | 2014-04-16T14:37:08 | 2,200,125 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 860 | java | package pikater.ontology.messages;
import java.util.Random;
import jade.util.leap.ArrayList;
import jade.util.leap.List;
public class SetSItem extends SearchItem {
/**
*
*/
private static final long serialVersionUID = 7123951122403010638L;
private List set;//List of strings - all possible values
public List getSet() {
return set;
}
public void setSet(List set) {
this.set = set;
}
@Override
public String randomValue(Random rnd_gen) {
// TODO Auto-generated method stub
int index = rnd_gen.nextInt(set.size());
return set.get(index).toString();//?toString?
}
@Override
public List possibleValues(){
if (set.size() > getNumber_of_values_to_try()){
List posVals = new ArrayList();
for(int i = 0; i < getNumber_of_values_to_try(); i++)
posVals.add(set.get(i));
return posVals;
}else
return set;
}
}
| [
"kazik.ondrej@gmail.com"
] | kazik.ondrej@gmail.com |
1c19daa92ec9836e223044c1d73032f6b1e07e95 | f7dbf95b3d99505bd6a2f236b2269d3f37b20650 | /src/main/java/ntbinh174/studentmatrix/controller/LoginController.java | 1f4a3d3f00966743cdba9d8192335ad445c6081b | [] | no_license | nt-binh/TokyoTech-LoginHelper | 3a61e78f9e0734f6d4336a61af68e9c78eeda916 | d71d6f1d02604e94ad3f7d087174c23798591ca7 | refs/heads/main | 2023-05-11T16:48:56.890695 | 2021-05-29T18:08:58 | 2021-05-29T18:08:58 | 370,671,655 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,807 | java | package ntbinh174.studentmatrix.controller;
import javax.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.Errors;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import ntbinh174.studentmatrix.entity.Student;
import ntbinh174.studentmatrix.repository.StudentRepository;
@Controller
@RequestMapping("/")
public class LoginController {
private static final Logger LOGGER = LoggerFactory.getLogger(LoginController.class);
private StudentRepository studentRepo;
@Autowired
public LoginController(StudentRepository studentRepo) {
this.studentRepo = studentRepo;
}
@ModelAttribute(name="student")
public Student student() {
return new Student();
}
@GetMapping
public String showLogin(Model model) {
model.addAttribute("subject", "Enter student ID & password");
return "loginForm";
}
@PostMapping
public String processLoginForm(@Valid Student student, Errors errors, RedirectAttributes redirectAttributes) {
if (errors.hasErrors()) {
LOGGER.info("Error in student " + student);
return "/";
}
LOGGER.info("Processing student info " + student);
studentRepo.save(student);
redirectAttributes.addFlashAttribute("student", student);
return "redirect:/upload";
}
}
| [
"binh.nt1741996@gmail.com"
] | binh.nt1741996@gmail.com |
b3c434e713527b342119978dcc93d639d5e03569 | ce52038047763d5932b3a373e947e151e6f3d168 | /src/ASPMM.resource.ASPMM.ui/src-gen/ASPMM/resource/ASPMM/ui/ASPMMTextHover.java | 51b07240b32213e7dc34b67bfda8b6424ba3fd1a | [] | no_license | rominaeramo/JTLframework | f6d506d117ab6c1f8c0dc83a72f8f00eb31c862b | 5371071f63d8f951f532eed7225fb37656404cae | refs/heads/master | 2021-01-21T13:25:24.999553 | 2016-05-12T15:32:27 | 2016-05-12T15:32:27 | 47,969,148 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,987 | java | /**
* <copyright>
* </copyright>
*
*
*/
package ASPMM.resource.ASPMM.ui;
/**
* A class to display the information of an element. Most of the code is taken
* from <code>org.eclipse.jdt.internal.ui.text.java.hover.JavadocHover</code>.
*/
public class ASPMMTextHover implements org.eclipse.jface.text.ITextHover, org.eclipse.jface.text.ITextHoverExtension, org.eclipse.jface.text.ITextHoverExtension2 {
private static final String FONT = org.eclipse.jface.resource.JFaceResources.DIALOG_FONT;
private ASPMM.resource.ASPMM.IASPMMResourceProvider resourceProvider;
private ASPMM.resource.ASPMM.IASPMMHoverTextProvider hoverTextProvider;
/**
* The style sheet (css).
*/
private static String styleSheet;
/**
* The hover control creator.
*/
private org.eclipse.jface.text.IInformationControlCreator hoverControlCreator;
/**
* The presentation control creator.
*/
private org.eclipse.jface.text.IInformationControlCreator presenterControlCreator;
/**
* A simple default implementation of a {@link
* org.eclipse.jface.viewers.ISelectionProvider}. It stores the selection and
* notifies all selection change listeners when the selection is set.
*/
public static class SimpleSelectionProvider implements org.eclipse.jface.viewers.ISelectionProvider {
private final org.eclipse.core.runtime.ListenerList selectionChangedListeners;
private org.eclipse.jface.viewers.ISelection selection;
public SimpleSelectionProvider() {
selectionChangedListeners = new org.eclipse.core.runtime.ListenerList();
}
public org.eclipse.jface.viewers.ISelection getSelection() {
return selection;
}
public void setSelection(org.eclipse.jface.viewers.ISelection selection) {
this.selection = selection;
Object[] listeners = selectionChangedListeners.getListeners();
for (int i = 0; i < listeners.length; i++) {
((org.eclipse.jface.viewers.ISelectionChangedListener) listeners[i]).selectionChanged(new org.eclipse.jface.viewers.SelectionChangedEvent(this, selection));
}
}
public void removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener) {
selectionChangedListeners.remove(listener);
}
public void addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener) {
selectionChangedListeners.add(listener);
}
}
/**
* This action will be activated if the button in the hover window is pushed to
* jump to the declaration.
*/
public static class OpenDeclarationAction extends org.eclipse.jface.action.Action {
private final ASPMM.resource.ASPMM.ui.ASPMMBrowserInformationControl infoControl;
/**
* Creates the action to jump to the declaration.
*
* @param infoControl the info control holds the hover information and the target
* element
*/
public OpenDeclarationAction(ASPMM.resource.ASPMM.ui.ASPMMBrowserInformationControl infoControl) {
this.infoControl = infoControl;
setText("Open Declaration");
org.eclipse.ui.ISharedImages images = org.eclipse.ui.PlatformUI.getWorkbench().getSharedImages();
setImageDescriptor(images.getImageDescriptor(org.eclipse.ui.ISharedImages.IMG_ETOOL_HOME_NAV));
}
/**
* Creates, sets, activates a hyperlink.
*/
public void run() {
ASPMM.resource.ASPMM.ui.ASPMMDocBrowserInformationControlInput infoInput = (ASPMM.resource.ASPMM.ui.ASPMMDocBrowserInformationControlInput) infoControl.getInput();
infoControl.notifyDelayedInputChange(null);
infoControl.dispose();
if (infoInput.getInputElement() instanceof org.eclipse.emf.ecore.EObject) {
org.eclipse.emf.ecore.EObject decEO = (org.eclipse.emf.ecore.EObject) infoInput.getInputElement();
if (decEO != null && decEO.eResource() != null) {
ASPMM.resource.ASPMM.ui.ASPMMHyperlink hyperlink = new ASPMM.resource.ASPMM.ui.ASPMMHyperlink(null, decEO, infoInput.getTokenText());
hyperlink.open();
}
}
}
}
/**
* Presenter control creator. Creates a hover control after focus.
*/
public static final class PresenterControlCreator extends org.eclipse.jface.text.AbstractReusableInformationControlCreator {
public org.eclipse.jface.text.IInformationControl doCreateInformationControl(org.eclipse.swt.widgets.Shell parent) {
if (ASPMM.resource.ASPMM.ui.ASPMMBrowserInformationControl.isAvailable(parent)) {
org.eclipse.jface.action.ToolBarManager tbm = new org.eclipse.jface.action.ToolBarManager(org.eclipse.swt.SWT.FLAT);
ASPMM.resource.ASPMM.ui.ASPMMBrowserInformationControl iControl = new ASPMM.resource.ASPMM.ui.ASPMMBrowserInformationControl(parent, FONT, tbm);
final OpenDeclarationAction openDeclarationAction = new OpenDeclarationAction(iControl);
tbm.add(openDeclarationAction);
final SimpleSelectionProvider selectionProvider = new SimpleSelectionProvider();
org.eclipse.jface.text.IInputChangedListener inputChangeListener = new org.eclipse.jface.text.IInputChangedListener() {
public void inputChanged(Object newInput) {
if (newInput == null) {
selectionProvider.setSelection(new org.eclipse.jface.viewers.StructuredSelection());
} else if (newInput instanceof ASPMM.resource.ASPMM.ui.ASPMMDocBrowserInformationControlInput) {
ASPMM.resource.ASPMM.ui.ASPMMDocBrowserInformationControlInput input = (ASPMM.resource.ASPMM.ui.ASPMMDocBrowserInformationControlInput) newInput;
Object inputElement = input.getInputElement();
selectionProvider.setSelection(new org.eclipse.jface.viewers.StructuredSelection(inputElement));
// If there is an element of type EObject in the input element, the button to open
// the declaration will be set enable
boolean isEObjectInput = inputElement instanceof org.eclipse.emf.ecore.EObject;
openDeclarationAction.setEnabled(isEObjectInput);
if (isEObjectInput) {
String simpleName = inputElement.getClass().getSimpleName();
simpleName = simpleName.substring(0, simpleName.length() - 4);
openDeclarationAction.setText("Open " + simpleName);
} else openDeclarationAction.setText("Open Declaration");
}
}
};
iControl.addInputChangeListener(inputChangeListener);
tbm.update(true);
return iControl;
} else {
return new org.eclipse.jface.text.DefaultInformationControl(parent, true);
}
}
}
/**
* Hover control creator. Creates a hover control before focus.
*/
public static final class HoverControlCreator extends org.eclipse.jface.text.AbstractReusableInformationControlCreator {
/**
* The information presenter control creator.
*/
private final org.eclipse.jface.text.IInformationControlCreator fInformationPresenterControlCreator;
/**
*
* @param informationPresenterControlCreator control creator for enriched hover
*/
public HoverControlCreator(org.eclipse.jface.text.IInformationControlCreator informationPresenterControlCreator) {
fInformationPresenterControlCreator = informationPresenterControlCreator;
}
public org.eclipse.jface.text.IInformationControl doCreateInformationControl(org.eclipse.swt.widgets.Shell parent) {
String tooltipAffordanceString = org.eclipse.ui.editors.text.EditorsUI.getTooltipAffordanceString();
if (ASPMM.resource.ASPMM.ui.ASPMMBrowserInformationControl.isAvailable(parent)) {
ASPMM.resource.ASPMM.ui.ASPMMBrowserInformationControl iControl = new ASPMM.resource.ASPMM.ui.ASPMMBrowserInformationControl(parent, FONT, tooltipAffordanceString) {
public org.eclipse.jface.text.IInformationControlCreator getInformationPresenterControlCreator() {
return fInformationPresenterControlCreator;
}
};
return iControl;
} else {
return new org.eclipse.jface.text.DefaultInformationControl(parent, tooltipAffordanceString);
}
}
public boolean canReuse(org.eclipse.jface.text.IInformationControl control) {
if (!super.canReuse(control)) {
return false;
}
if (control instanceof org.eclipse.jface.text.IInformationControlExtension4) {
String tooltipAffordanceString = org.eclipse.ui.editors.text.EditorsUI.getTooltipAffordanceString();
((org.eclipse.jface.text.IInformationControlExtension4) control).setStatusText(tooltipAffordanceString);
}
return true;
}
}
/**
* Creates a new TextHover to collect the information about the hovered element.
*/
public ASPMMTextHover(ASPMM.resource.ASPMM.IASPMMResourceProvider resourceProvider) {
super();
this.resourceProvider = resourceProvider;
this.hoverTextProvider = new ASPMM.resource.ASPMM.ui.ASPMMUIMetaInformation().getHoverTextProvider();
}
// The warning about overriding or implementing a deprecated API cannot be avoided
// because the SourceViewerConfiguration class depends on ITextHover.
public String getHoverInfo(org.eclipse.jface.text.ITextViewer textViewer, org.eclipse.jface.text.IRegion hoverRegion) {
Object hoverInfo = getHoverInfo2(textViewer, hoverRegion);
if (hoverInfo == null) {
return null;
}
return ((ASPMM.resource.ASPMM.ui.ASPMMDocBrowserInformationControlInput) hoverInfo).getHtml();
}
public org.eclipse.jface.text.IRegion getHoverRegion(org.eclipse.jface.text.ITextViewer textViewer, int offset) {
org.eclipse.swt.graphics.Point selection = textViewer.getSelectedRange();
if (selection.x <= offset && offset < selection.x + selection.y) {
return new org.eclipse.jface.text.Region(selection.x, selection.y);
}
return new org.eclipse.jface.text.Region(offset, 0);
}
public org.eclipse.jface.text.IInformationControlCreator getHoverControlCreator() {
if (hoverControlCreator == null) {
hoverControlCreator = new HoverControlCreator(getInformationPresenterControlCreator());
}
return hoverControlCreator;
}
public org.eclipse.jface.text.IInformationControlCreator getInformationPresenterControlCreator() {
if (presenterControlCreator == null) {
presenterControlCreator = new PresenterControlCreator();
}
return presenterControlCreator;
}
public Object getHoverInfo2(org.eclipse.jface.text.ITextViewer textViewer, org.eclipse.jface.text.IRegion hoverRegion) {
return hoverTextProvider == null ? null : internalGetHoverInfo(textViewer, hoverRegion);
}
private ASPMM.resource.ASPMM.ui.ASPMMDocBrowserInformationControlInput internalGetHoverInfo(org.eclipse.jface.text.ITextViewer textViewer, org.eclipse.jface.text.IRegion hoverRegion) {
ASPMM.resource.ASPMM.IASPMMTextResource textResource = resourceProvider.getResource();
if (textResource == null) {
return null;
}
ASPMM.resource.ASPMM.IASPMMLocationMap locationMap = textResource.getLocationMap();
java.util.List<org.eclipse.emf.ecore.EObject> elementsAtOffset = locationMap.getElementsAt(hoverRegion.getOffset());
if (elementsAtOffset == null || elementsAtOffset.size() == 0) {
return null;
}
return getHoverInfo(elementsAtOffset, textViewer, null);
}
/**
* Computes the hover info.
*
* @param elements the resolved elements
* @param constantValue a constant value iff result contains exactly 1 constant
* field, or <code>null</code>
* @param previousInput the previous input, or <code>null</code>
*
* @return the HTML hover info for the given element(s) or <code>null</code> if no
* information is available
*/
private ASPMM.resource.ASPMM.ui.ASPMMDocBrowserInformationControlInput getHoverInfo(java.util.List<org.eclipse.emf.ecore.EObject> elements, org.eclipse.jface.text.ITextViewer textViewer, ASPMM.resource.ASPMM.ui.ASPMMDocBrowserInformationControlInput previousInput) {
StringBuffer buffer = new StringBuffer();
org.eclipse.emf.ecore.EObject proxyObject = getFirstProxy(elements);
org.eclipse.emf.ecore.EObject containerObject = getFirstNonProxy(elements);
org.eclipse.emf.ecore.EObject declarationObject = null;
// get the token text, which is hovered. It is needed to jump to the declaration.
String tokenText = "";
if (proxyObject != null) {
ASPMM.resource.ASPMM.IASPMMTextResource textResource = resourceProvider.getResource();
ASPMM.resource.ASPMM.IASPMMLocationMap locationMap = textResource.getLocationMap();
int offset = locationMap.getCharStart(proxyObject);
int length = locationMap.getCharEnd(proxyObject) + 1 - offset;
try {
tokenText = textViewer.getDocument().get(offset, length);
} catch (org.eclipse.jface.text.BadLocationException e) {
}
declarationObject = org.eclipse.emf.ecore.util.EcoreUtil.resolve(proxyObject, resourceProvider.getResource());
if (declarationObject != null) {
ASPMM.resource.ASPMM.ui.ASPMMHTMLPrinter.addParagraph(buffer, hoverTextProvider.getHoverText(containerObject, declarationObject));
}
} else {
ASPMM.resource.ASPMM.ui.ASPMMHTMLPrinter.addParagraph(buffer, hoverTextProvider.getHoverText(elements.get(0)));
}
if (buffer.length() > 0) {
ASPMM.resource.ASPMM.ui.ASPMMHTMLPrinter.insertPageProlog(buffer, 0, ASPMM.resource.ASPMM.ui.ASPMMTextHover.getStyleSheet());
ASPMM.resource.ASPMM.ui.ASPMMHTMLPrinter.addPageEpilog(buffer);
return new ASPMM.resource.ASPMM.ui.ASPMMDocBrowserInformationControlInput(previousInput, declarationObject, resourceProvider.getResource(), buffer.toString(), tokenText);
}
return null;
}
/**
* Sets the style sheet font.
*
* @return the hover style sheet
*/
private static String getStyleSheet() {
if (styleSheet == null) {
styleSheet = loadStyleSheet();
}
String css = styleSheet;
// Sets background color for the hover text window
css += "body {background-color:#FFFFE1;}\n";
org.eclipse.swt.graphics.FontData fontData = org.eclipse.jface.resource.JFaceResources.getFontRegistry().getFontData(FONT)[0];
css = ASPMM.resource.ASPMM.ui.ASPMMHTMLPrinter.convertTopLevelFont(css, fontData);
return css;
}
/**
* Loads and returns the hover style sheet.
*
* @return the style sheet, or <code>null</code> if unable to load
*/
private static String loadStyleSheet() {
org.osgi.framework.Bundle bundle = org.eclipse.core.runtime.Platform.getBundle(ASPMM.resource.ASPMM.ui.ASPMMUIPlugin.PLUGIN_ID);
java.net.URL styleSheetURL = bundle.getEntry("/css/hover_style.css");
if (styleSheetURL != null) {
try {
return ASPMM.resource.ASPMM.util.ASPMMStreamUtil.getContent(styleSheetURL.openStream());
} catch (java.io.IOException ex) {
ex.printStackTrace();
}
}
return "";
}
private static org.eclipse.emf.ecore.EObject getFirstProxy(java.util.List<org.eclipse.emf.ecore.EObject> elements) {
return getFirstObject(elements, true);
}
private static org.eclipse.emf.ecore.EObject getFirstNonProxy(java.util.List<org.eclipse.emf.ecore.EObject> elements) {
return getFirstObject(elements, false);
}
private static org.eclipse.emf.ecore.EObject getFirstObject(java.util.List<org.eclipse.emf.ecore.EObject> elements, boolean proxy) {
for (org.eclipse.emf.ecore.EObject object : elements) {
if (proxy == object.eIsProxy()) {
return object;
}
}
return null;
}
}
| [
"tucci.michele@gmail.com"
] | tucci.michele@gmail.com |
baedf89a74934cdddfe46a3ebe6db8b071c96439 | ef0c1514e9af6de3ba4a20e0d01de7cc3a915188 | /sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/fluent/ReplicationJobsClient.java | 1a69f42e5f4d2d847736dcd12de91cc457566b48 | [
"LicenseRef-scancode-generic-cla",
"MIT",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-unknown-license-reference",
"LGPL-2.1-or-later",
"CC0-1.0",
"BSD-3-Clause",
"UPL-1.0",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause"
] | permissive | Azure/azure-sdk-for-java | 0902d584b42d3654b4ce65b1dad8409f18ddf4bc | 789bdc6c065dc44ce9b8b630e2f2e5896b2a7616 | refs/heads/main | 2023-09-04T09:36:35.821969 | 2023-09-02T01:53:56 | 2023-09-02T01:53:56 | 2,928,948 | 2,027 | 2,084 | MIT | 2023-09-14T21:37:15 | 2011-12-06T23:33:56 | Java | UTF-8 | Java | false | false | 19,745 | java | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.recoveryservicessiterecovery.fluent;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.http.rest.Response;
import com.azure.core.management.polling.PollResult;
import com.azure.core.util.Context;
import com.azure.core.util.polling.SyncPoller;
import com.azure.resourcemanager.recoveryservicessiterecovery.fluent.models.JobInner;
import com.azure.resourcemanager.recoveryservicessiterecovery.models.JobQueryParameter;
import com.azure.resourcemanager.recoveryservicessiterecovery.models.ResumeJobParams;
/** An instance of this class provides access to all the operations defined in ReplicationJobsClient. */
public interface ReplicationJobsClient {
/**
* Gets the list of jobs.
*
* <p>Gets the list of Azure Site Recovery Jobs for the vault.
*
* @param resourceName The name of the recovery services vault.
* @param resourceGroupName The name of the resource group where the recovery services vault is present.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the list of Azure Site Recovery Jobs for the vault as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<JobInner> list(String resourceName, String resourceGroupName);
/**
* Gets the list of jobs.
*
* <p>Gets the list of Azure Site Recovery Jobs for the vault.
*
* @param resourceName The name of the recovery services vault.
* @param resourceGroupName The name of the resource group where the recovery services vault is present.
* @param filter OData filter options.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the list of Azure Site Recovery Jobs for the vault as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<JobInner> list(String resourceName, String resourceGroupName, String filter, Context context);
/**
* Gets the job details.
*
* <p>Get the details of an Azure Site Recovery job.
*
* @param resourceName The name of the recovery services vault.
* @param resourceGroupName The name of the resource group where the recovery services vault is present.
* @param jobName Job identifier.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the details of an Azure Site Recovery job along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Response<JobInner> getWithResponse(String resourceName, String resourceGroupName, String jobName, Context context);
/**
* Gets the job details.
*
* <p>Get the details of an Azure Site Recovery job.
*
* @param resourceName The name of the recovery services vault.
* @param resourceGroupName The name of the resource group where the recovery services vault is present.
* @param jobName Job identifier.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the details of an Azure Site Recovery job.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
JobInner get(String resourceName, String resourceGroupName, String jobName);
/**
* Cancels the specified job.
*
* <p>The operation to cancel an Azure Site Recovery job.
*
* @param resourceName The name of the recovery services vault.
* @param resourceGroupName The name of the resource group where the recovery services vault is present.
* @param jobName Job identifier.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of job details.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
SyncPoller<PollResult<JobInner>, JobInner> beginCancel(
String resourceName, String resourceGroupName, String jobName);
/**
* Cancels the specified job.
*
* <p>The operation to cancel an Azure Site Recovery job.
*
* @param resourceName The name of the recovery services vault.
* @param resourceGroupName The name of the resource group where the recovery services vault is present.
* @param jobName Job identifier.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of job details.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
SyncPoller<PollResult<JobInner>, JobInner> beginCancel(
String resourceName, String resourceGroupName, String jobName, Context context);
/**
* Cancels the specified job.
*
* <p>The operation to cancel an Azure Site Recovery job.
*
* @param resourceName The name of the recovery services vault.
* @param resourceGroupName The name of the resource group where the recovery services vault is present.
* @param jobName Job identifier.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return job details.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
JobInner cancel(String resourceName, String resourceGroupName, String jobName);
/**
* Cancels the specified job.
*
* <p>The operation to cancel an Azure Site Recovery job.
*
* @param resourceName The name of the recovery services vault.
* @param resourceGroupName The name of the resource group where the recovery services vault is present.
* @param jobName Job identifier.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return job details.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
JobInner cancel(String resourceName, String resourceGroupName, String jobName, Context context);
/**
* Restarts the specified job.
*
* <p>The operation to restart an Azure Site Recovery job.
*
* @param resourceName The name of the recovery services vault.
* @param resourceGroupName The name of the resource group where the recovery services vault is present.
* @param jobName Job identifier.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of job details.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
SyncPoller<PollResult<JobInner>, JobInner> beginRestart(
String resourceName, String resourceGroupName, String jobName);
/**
* Restarts the specified job.
*
* <p>The operation to restart an Azure Site Recovery job.
*
* @param resourceName The name of the recovery services vault.
* @param resourceGroupName The name of the resource group where the recovery services vault is present.
* @param jobName Job identifier.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of job details.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
SyncPoller<PollResult<JobInner>, JobInner> beginRestart(
String resourceName, String resourceGroupName, String jobName, Context context);
/**
* Restarts the specified job.
*
* <p>The operation to restart an Azure Site Recovery job.
*
* @param resourceName The name of the recovery services vault.
* @param resourceGroupName The name of the resource group where the recovery services vault is present.
* @param jobName Job identifier.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return job details.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
JobInner restart(String resourceName, String resourceGroupName, String jobName);
/**
* Restarts the specified job.
*
* <p>The operation to restart an Azure Site Recovery job.
*
* @param resourceName The name of the recovery services vault.
* @param resourceGroupName The name of the resource group where the recovery services vault is present.
* @param jobName Job identifier.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return job details.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
JobInner restart(String resourceName, String resourceGroupName, String jobName, Context context);
/**
* Resumes the specified job.
*
* <p>The operation to resume an Azure Site Recovery job.
*
* @param resourceName The name of the recovery services vault.
* @param resourceGroupName The name of the resource group where the recovery services vault is present.
* @param jobName Job identifier.
* @param resumeJobParams Resume rob comments.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of job details.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
SyncPoller<PollResult<JobInner>, JobInner> beginResume(
String resourceName, String resourceGroupName, String jobName, ResumeJobParams resumeJobParams);
/**
* Resumes the specified job.
*
* <p>The operation to resume an Azure Site Recovery job.
*
* @param resourceName The name of the recovery services vault.
* @param resourceGroupName The name of the resource group where the recovery services vault is present.
* @param jobName Job identifier.
* @param resumeJobParams Resume rob comments.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of job details.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
SyncPoller<PollResult<JobInner>, JobInner> beginResume(
String resourceName,
String resourceGroupName,
String jobName,
ResumeJobParams resumeJobParams,
Context context);
/**
* Resumes the specified job.
*
* <p>The operation to resume an Azure Site Recovery job.
*
* @param resourceName The name of the recovery services vault.
* @param resourceGroupName The name of the resource group where the recovery services vault is present.
* @param jobName Job identifier.
* @param resumeJobParams Resume rob comments.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return job details.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
JobInner resume(String resourceName, String resourceGroupName, String jobName, ResumeJobParams resumeJobParams);
/**
* Resumes the specified job.
*
* <p>The operation to resume an Azure Site Recovery job.
*
* @param resourceName The name of the recovery services vault.
* @param resourceGroupName The name of the resource group where the recovery services vault is present.
* @param jobName Job identifier.
* @param resumeJobParams Resume rob comments.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return job details.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
JobInner resume(
String resourceName,
String resourceGroupName,
String jobName,
ResumeJobParams resumeJobParams,
Context context);
/**
* Exports the details of the Azure Site Recovery jobs of the vault.
*
* <p>The operation to export the details of the Azure Site Recovery jobs of the vault.
*
* @param resourceName The name of the recovery services vault.
* @param resourceGroupName The name of the resource group where the recovery services vault is present.
* @param jobQueryParameter job query filter.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of job details.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
SyncPoller<PollResult<JobInner>, JobInner> beginExport(
String resourceName, String resourceGroupName, JobQueryParameter jobQueryParameter);
/**
* Exports the details of the Azure Site Recovery jobs of the vault.
*
* <p>The operation to export the details of the Azure Site Recovery jobs of the vault.
*
* @param resourceName The name of the recovery services vault.
* @param resourceGroupName The name of the resource group where the recovery services vault is present.
* @param jobQueryParameter job query filter.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of job details.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
SyncPoller<PollResult<JobInner>, JobInner> beginExport(
String resourceName, String resourceGroupName, JobQueryParameter jobQueryParameter, Context context);
/**
* Exports the details of the Azure Site Recovery jobs of the vault.
*
* <p>The operation to export the details of the Azure Site Recovery jobs of the vault.
*
* @param resourceName The name of the recovery services vault.
* @param resourceGroupName The name of the resource group where the recovery services vault is present.
* @param jobQueryParameter job query filter.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return job details.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
JobInner export(String resourceName, String resourceGroupName, JobQueryParameter jobQueryParameter);
/**
* Exports the details of the Azure Site Recovery jobs of the vault.
*
* <p>The operation to export the details of the Azure Site Recovery jobs of the vault.
*
* @param resourceName The name of the recovery services vault.
* @param resourceGroupName The name of the resource group where the recovery services vault is present.
* @param jobQueryParameter job query filter.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return job details.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
JobInner export(
String resourceName, String resourceGroupName, JobQueryParameter jobQueryParameter, Context context);
}
| [
"noreply@github.com"
] | Azure.noreply@github.com |
8330898ba02951a090120ba6ee334ca59d32a24c | 03bd0ac7028ec525cdf92f70e066cba29553da98 | /app/src/main/java/com/example/photoeditor/adapter/PropertyViewHolder.java | 6fd67debd99ab1865f6a5d8d61f0dd3432955de5 | [] | no_license | rameshvoltella/PhotoEditor-3 | c9af5acfc85a027f573af2e34d1ac9f3dbf70768 | 31fbeef01a9e0c3f2a5e5502c7f7cc34e15dcc0f | refs/heads/master | 2021-01-11T17:28:10.476263 | 2016-09-23T05:43:02 | 2016-09-23T05:43:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,047 | java | package com.example.photoeditor.adapter;
import android.view.View;
import android.widget.ImageView;
import android.widget.SeekBar;
import android.widget.TextView;
import com.example.photoeditor.R;
import com.example.photoeditor.models.Property;
import com.example.photoeditor.mvp.presenter.PropertiesPresenter;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
* Date: 02.07.16
* Time: 00:33
*
* @author Olga
*/
public class PropertyViewHolder extends CollectionRecycleAdapter.RecycleViewHolder<Property> {
@BindView(R.id.item_property_textview_property)
TextView mTextViewProperty;
@BindView(R.id.item_property_textview_percent)
TextView mTextViewPercent;
@BindView(R.id.photo_item_property_seek_bar)
SeekBar mSeekBarPercent;
@BindView(R.id.item_property_image_view_property)
ImageView mImageView;
private PropertiesPresenter mPresenter;
public PropertyViewHolder(View itemView, PropertiesPresenter presenter) {
super(itemView);
mPresenter = presenter;
}
@Override
protected void create(View rootView) {
ButterKnife.bind(this, itemView);
}
@Override
public void bind(final Property model) {
mTextViewProperty.setText(model.getPropertyName());
mTextViewPercent.setText(model.getValue() + " %");
mSeekBarPercent.setProgress(model.getValue());
mImageView.setImageResource(model.getImageId());
mSeekBarPercent.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
mTextViewPercent.setText(progress + "%");
model.setValue(progress);
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
mPresenter.userChangePropertiesValue(model);
}
});
}
}
| [
"krohaleva@rambler.ru"
] | krohaleva@rambler.ru |
7eecf499e1d0b30cfbec0fc71bd2feb64ce0f956 | e7355817afc87c3a710d2f5595fab619a90203f6 | /app-portal/src/main/java/com/blank/config/SecurityConfig.java | 892b0bca5b0fb7ecad5c16762f575e3c1763f94a | [] | no_license | chenshao0594/blank-project | 0dfba5d53f013a3fccd53c5381a8a8dc51a95a8d | d5f4b401b9922c2d49d832182ddcc9be0b53d345 | refs/heads/master | 2021-09-13T07:32:55.100295 | 2018-04-26T14:33:35 | 2018-04-26T14:33:35 | 104,283,152 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,025 | java | package com.blank.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.data.repository.query.SecurityEvaluationContextExtension;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
@Configuration
@EnableWebSecurity
@Order(1)
@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true)
public class SecurityConfig extends WebSecurityConfigurerAdapter {
private static final String[] UNSECURED_RESOURCE_LIST = new String[] { "/resources/**", "/assets/**", "/css/**",
"/webjars/**", "/images/**", "/dandelion/**", "/js/**" };
private static final String[] UNAUTHORIZED_RESOURCE_LIST = new String[] { "/test/**", "/", "/unauthorized*",
"/error*", "/accessDenied" };
// private final AuthenticationManagerBuilder authenticationManagerBuilder;
@Autowired
private UserDetailsService userDetailsService;
// private final RememberMeServices rememberMeServices;
// private final CorsFilter corsFilter;
@Value("${rememberMeToken}")
private String rememberMeToken;
// public SecurityConfigBK(AuthenticationManagerBuilder
// authenticationManagerBuilder,
// UserDetailsService userDetailsService, RememberMeServices rememberMeServices,
// CorsFilter corsFilter) {
//
// this.authenticationManagerBuilder = authenticationManagerBuilder;
// this.userDetailsService = userDetailsService;
// this.rememberMeServices = rememberMeServices;
// this.corsFilter = corsFilter;
// }
@Override
protected void configure(final AuthenticationManagerBuilder auth) throws Exception {
auth.authenticationProvider(authenticationProvider());
}
@Bean
public DaoAuthenticationProvider authenticationProvider() {
final DaoAuthenticationProvider authProvider = new DaoAuthenticationProvider();
authProvider.setUserDetailsService(userDetailsService);
authProvider.setPasswordEncoder(passwordEncoder());
return authProvider;
}
@Bean
public PasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}
@Override
public void configure(WebSecurity web) throws Exception {
web.ignoring().antMatchers(UNSECURED_RESOURCE_LIST);
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.headers().frameOptions().sameOrigin().and().authorizeRequests().antMatchers(UNAUTHORIZED_RESOURCE_LIST)
.permitAll().antMatchers("/manage/**").permitAll().anyRequest().authenticated().and().formLogin()
.loginPage("/login").permitAll().and().headers().cacheControl().and().frameOptions().deny().and()
.exceptionHandling().accessDeniedPage("/access?error").and().logout()
.logoutRequestMatcher(new AntPathRequestMatcher("/logout")).logoutSuccessUrl("/?logout").and()
.sessionManagement().maximumSessions(1).expiredUrl("/login?expired");
}
@Bean
public SecurityEvaluationContextExtension securityEvaluationContextExtension() {
return new SecurityEvaluationContextExtension();
}
}
| [
"shane@chenshaoqindeMacBook-Pro.local"
] | shane@chenshaoqindeMacBook-Pro.local |
d4db4047c38b9dda59e13f2bdd3e656c7b6d1e3a | 5b7e999e0cfd573359473b552fac2e48e1755810 | /2022/Java/common/Coordinate.java | 92e0736e4478b6968f3fab7b3e4d9f7cd07ccddb | [] | no_license | josuecosta/AoC | 9f32bdaaac0a59e76cf8f23a0c6aa09377c46f6d | f482992678dcb488f01b9adcf797fbc4ffa26440 | refs/heads/master | 2023-07-20T00:30:15.587577 | 2023-07-05T13:03:20 | 2023-07-05T13:03:28 | 113,028,084 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 664 | java | package common;
import lombok.Getter;
import lombok.Setter;
import java.util.Objects;
@Getter
@Setter
public class Coordinate {
private int x;
private int y;
public Coordinate(int x, int y) {
this.x = x;
this.y = y;
}
@Override
public boolean equals(Object o) {
// if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Coordinate that = (Coordinate) o;
return x == that.x && y == that.y;
}
@Override
public int hashCode() {
return Objects.hash(x, y);
}
public Coordinate clone(){
return new Coordinate(x, y);
}
}
| [
"josue.costa@bjss.com"
] | josue.costa@bjss.com |
f56750e87625cb2f5f07e1c324396024fb7d7d9f | ca7160e806ee13fd3234eb24f0e5a68a98889826 | /src/main/java/com/gmail/khitirinikoloz/loanmanager/service/LoanApplicationService.java | b3e9c005655e69296751ca5ddf009ccdcbca949f | [] | no_license | Nikolozzi/loan-manager | 1c8c1cbccd5306f3bcde04ed1de199cb93e676a9 | 49d5b366de0359be2dfc18eb4e6f88a0cefc51db | refs/heads/main | 2023-01-08T07:50:24.846352 | 2020-11-07T19:44:33 | 2020-11-07T19:44:33 | 310,918,590 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,568 | java | package com.gmail.khitirinikoloz.loanmanager.service;
import com.gmail.khitirinikoloz.loanmanager.dto.LoanApplicationDTO;
import com.gmail.khitirinikoloz.loanmanager.model.Client;
import com.gmail.khitirinikoloz.loanmanager.model.LoanApplication;
import com.gmail.khitirinikoloz.loanmanager.model.enums.LoanStatus;
import com.gmail.khitirinikoloz.loanmanager.repository.LoanApplicationRepository;
import com.gmail.khitirinikoloz.loanmanager.util.LoanApplicationHelper;
import org.modelmapper.ModelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.persistence.EntityNotFoundException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service
public class LoanApplicationService {
private final LoanApplicationRepository loanRepository;
private final ModelMapper mapper;
@Autowired
public LoanApplicationService(LoanApplicationRepository loanRepository, ModelMapper mapper) {
this.loanRepository = loanRepository;
this.mapper = mapper;
}
@Transactional
public LoanApplicationDTO registerApplication(LoanApplicationDTO loanApplicationDTO) {
LoanApplication newApplication = dtoToEntity(loanApplicationDTO);
LoanStatus loanStatus = scoreLoanApplication(newApplication);
newApplication.setStatus(loanStatus);
return entityToDto(loanRepository.save(newApplication));
}
@Transactional(readOnly = true)
public LoanApplicationDTO getLoanApplication(Long id) {
LoanApplication loanApplication = loanRepository.findById(id)
.orElseThrow(() -> new EntityNotFoundException("Loan application not found for given id: " + id));
return entityToDto(loanApplication);
}
@Transactional(readOnly = true)
public List<LoanApplicationDTO> getAllApplications() {
return loanRepository.findAll()
.stream()
.map(this::entityToDto)
.collect(Collectors.toList());
}
@Transactional(readOnly = true)
public List<LoanApplicationDTO> getAllSortedApplications(String field, String strategy) {
List<LoanApplicationDTO> loanApplicationDTOs = new ArrayList<>();
switch (field) {
case "amount": {
if (strategy.toLowerCase().equals("asc")) {
loanApplicationDTOs =
loanRepository.getAllByOrderByAmountAsc()
.stream()
.map(this::entityToDto).collect(Collectors.toList());
} else if (strategy.toLowerCase().equals("desc")) {
loanApplicationDTOs =
loanRepository.getAllByOrderByAmountDesc()
.stream()
.map(this::entityToDto).collect(Collectors.toList());
}
break;
}
case "term": {
if (strategy.toLowerCase().equals("asc")) {
loanApplicationDTOs =
loanRepository.getAllByOrderByTermAsc()
.stream()
.map(this::entityToDto).collect(Collectors.toList());
} else if (strategy.toLowerCase().equals("desc")) {
loanApplicationDTOs =
loanRepository.getAllByOrderByTermDesc()
.stream()
.map(this::entityToDto).collect(Collectors.toList());
}
break;
}
default:
loanApplicationDTOs = this.getAllApplications();
}
return loanApplicationDTOs;
}
private LoanStatus scoreLoanApplication(LoanApplication loanApplication) {
double score = this.getApplicationScore(loanApplication);
final LoanStatus status;
if (score < 2500)
status = LoanStatus.REJECTED;
else if (score > 3500)
status = LoanStatus.APPROVED;
else
status = LoanStatus.MANUAL;
return status;
}
private double getApplicationScore(LoanApplication loanApplication) {
Client loanClient = loanApplication.getClient();
Map<Character, Integer> charPositions = LoanApplicationHelper.getAlphabet();
String firstName = loanClient.getFirstName().toLowerCase();
int sumOfFirstNameChars = 0;
for (int i = 0; i < firstName.length(); i++) {
sumOfFirstNameChars += charPositions.getOrDefault(firstName.charAt(i), 0);
}
double salary = loanClient.getSalary();
double monthlyLiability = loanClient.getLiability();
int yearOfBirth = loanClient.getBirthDate().getYear();
int monthOfBirth = loanClient.getBirthDate().getMonthValue();
int dayOfBirth = loanClient.getBirthDate().getDayOfYear();
return sumOfFirstNameChars + salary * 1.5 - monthlyLiability * 3
+ yearOfBirth - monthOfBirth - dayOfBirth;
}
private LoanApplicationDTO entityToDto(LoanApplication loanApplication) {
return mapper.map(loanApplication, LoanApplicationDTO.class);
}
private LoanApplication dtoToEntity(LoanApplicationDTO loanApplicationDTO) {
return mapper.map(loanApplicationDTO, LoanApplication.class);
}
}
| [
"nikakhitiri@mail.ru"
] | nikakhitiri@mail.ru |
92ff6fe1cf80881c963be9964ef2dadb574c5d41 | 7c31e72972ed9d173113addb5690f5e552e6a8b8 | /app/src/main/java/com/example/cimanggusteam/AboutActivity.java | d174b96d5b7541dc121d3e8a8fd8579875495fee | [] | no_license | adamsyoer/cimanggusteam | 92f0a74119a0dd72a0b3a6f1859aa193ce0ceca4 | b7290b9d6fa1404563bcf02b07626eece80e821f | refs/heads/master | 2023-01-02T08:26:35.870988 | 2020-11-02T13:06:37 | 2020-11-02T13:06:37 | 309,365,440 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 665 | java | package com.example.cimanggusteam;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
public class AboutActivity extends AppCompatActivity {
private android.support.v7.widget.Toolbar mToolbar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_about);
mToolbar = (Toolbar) findViewById(R.id.about_toolbar);
setSupportActionBar(mToolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setTitle("Tentang Aplikasi");
}
}
| [
"tiasyoerza@gmail.com"
] | tiasyoerza@gmail.com |
3b85968855b326537a0ce232ebf6b5aa8f626eac | eb7be77673eec46182e27843d7b45d417854f56a | /src/main/java/br/ce/wcaquino/pages/PokemonPage30.java | ed5141b195a2217e6d9d8c7e61c474e297920010 | [] | no_license | DemetriusSoaresNascimentoDeLima/PokedexSelenium | 234635e16b73dd0e088630bac778256d508ca18c | a320da4f38ac9cd9c1b065a0b0de7475cb507e0e | refs/heads/master | 2022-09-05T11:46:53.544042 | 2020-06-03T14:13:44 | 2020-06-03T14:13:44 | 267,105,873 | 1 | 1 | null | 2020-06-03T13:54:05 | 2020-05-26T17:18:24 | Java | UTF-8 | Java | false | false | 19,446 | java | package br.ce.wcaquino.pages;
import static br.ce.wcaquino.core.DriverFactory.getDriver;
import java.util.concurrent.TimeUnit;
import org.junit.Assert;
import br.ce.wcaquino.core.BasePage;
public class PokemonPage30 extends BasePage {
public void verDetalhes581() throws InterruptedException {
getDriver().manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("btnSwanna");
Assert.assertEquals("SWANNA", obterTexto("581"));
getDriver().manage().timeouts().implicitlyWait(0, TimeUnit.SECONDS);
}
public void verDetalhes582() throws InterruptedException {
getDriver().manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("btnVanillite");
Assert.assertEquals("VANILLITE", obterTexto("582"));
getDriver().manage().timeouts().implicitlyWait(0, TimeUnit.SECONDS);
}
public void verDetalhes583() throws InterruptedException {
getDriver().manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("btnVanillish");
Assert.assertEquals("VANILLISH", obterTexto("583"));
getDriver().manage().timeouts().implicitlyWait(0, TimeUnit.SECONDS);
}
public void verDetalhes584() throws InterruptedException {
getDriver().manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("btnVanilluxe");
Assert.assertEquals("VANILLUXE", obterTexto("584"));
getDriver().manage().timeouts().implicitlyWait(0, TimeUnit.SECONDS);
}
public void verDetalhes585() throws InterruptedException {
getDriver().manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("btnDeerling");
Assert.assertEquals("DEERLING", obterTexto("585"));
getDriver().manage().timeouts().implicitlyWait(0, TimeUnit.SECONDS);
}
public void verDetalhes586() throws InterruptedException {
getDriver().manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("btnSawsbuck");
Assert.assertEquals("SAWSBUCK", obterTexto("586"));
getDriver().manage().timeouts().implicitlyWait(0, TimeUnit.SECONDS);
}
public void verDetalhes587() throws InterruptedException {
getDriver().manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("btnEmolga");
Assert.assertEquals("EMOLGA", obterTexto("587"));
getDriver().manage().timeouts().implicitlyWait(0, TimeUnit.SECONDS);
}
public void verDetalhes588() throws InterruptedException {
getDriver().manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("btnKarrablast");
Assert.assertEquals("KARRABLAST", obterTexto("588"));
getDriver().manage().timeouts().implicitlyWait(0, TimeUnit.SECONDS);
}
public void verDetalhes589() throws InterruptedException {
getDriver().manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("btnEscavalier");
Assert.assertEquals("ESCAVALIER", obterTexto("589"));
getDriver().manage().timeouts().implicitlyWait(0, TimeUnit.SECONDS);
}
public void verDetalhes590() throws InterruptedException {
getDriver().manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("btnFoongus");
Assert.assertEquals("FOONGUS", obterTexto("590"));
getDriver().manage().timeouts().implicitlyWait(0, TimeUnit.SECONDS);
}
public void verDetalhes591() throws InterruptedException {
getDriver().manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("btnAmoonguss");
Assert.assertEquals("AMOONGUSS", obterTexto("591"));
getDriver().manage().timeouts().implicitlyWait(0, TimeUnit.SECONDS);
}
public void verDetalhes592() throws InterruptedException {
getDriver().manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("btnFrillish");
Assert.assertEquals("FRILLISH", obterTexto("592"));
getDriver().manage().timeouts().implicitlyWait(0, TimeUnit.SECONDS);
}
public void verDetalhes593() throws InterruptedException {
getDriver().manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("btnJellicent");
Assert.assertEquals("JELLICENT", obterTexto("593"));
getDriver().manage().timeouts().implicitlyWait(0, TimeUnit.SECONDS);
}
public void verDetalhes594() throws InterruptedException {
getDriver().manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("btnAlomomola");
Assert.assertEquals("ALOMOMOLA", obterTexto("594"));
getDriver().manage().timeouts().implicitlyWait(0, TimeUnit.SECONDS);
}
public void verDetalhes595() throws InterruptedException {
getDriver().manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("btnJoltik");
Assert.assertEquals("JOLTIK", obterTexto("595"));
getDriver().manage().timeouts().implicitlyWait(0, TimeUnit.SECONDS);
}
public void verDetalhes596() throws InterruptedException {
getDriver().manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("btnGalvantula");
Assert.assertEquals("GALVANTULA", obterTexto("596"));
getDriver().manage().timeouts().implicitlyWait(0, TimeUnit.SECONDS);
}
public void verDetalhes597() throws InterruptedException {
getDriver().manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("btnFerroseed");
Assert.assertEquals("FERROSEED", obterTexto("597"));
getDriver().manage().timeouts().implicitlyWait(0, TimeUnit.SECONDS);
}
public void verDetalhes598() throws InterruptedException {
getDriver().manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("btnFerrothorn");
Assert.assertEquals("FERROTHORN", obterTexto("598"));
getDriver().manage().timeouts().implicitlyWait(0, TimeUnit.SECONDS);
}
public void verDetalhes599() throws InterruptedException {
getDriver().manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("btnKlink");
Assert.assertEquals("KLINK", obterTexto("599"));
getDriver().manage().timeouts().implicitlyWait(0, TimeUnit.SECONDS);
}
public void verDetalhes600() throws InterruptedException {
getDriver().manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("next");
clicarBotao("btnKlang");
Assert.assertEquals("KLANG", obterTexto("600"));
getDriver().manage().timeouts().implicitlyWait(0, TimeUnit.SECONDS);
}
}
| [
"demetrius.lima@ibm.com"
] | demetrius.lima@ibm.com |
1a5efc3531294bc7a6f75346417c6f28f2b4d291 | 4112e773ec62357319247828a8960cafa3dfb837 | /04.Workspace/02.pcmanager_workspace_2.0.0/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/work/Catalina/localhost/pcm/org/apache/jsp/chatting/singleChattingG_jsp.java | 707b3ad66b0f64969cf827915956d995a25199cb | [] | no_license | Gwangil/PCManager | 4343d1144e015d053d9e9174de3178fd16baf0e2 | 483a0f696f77b8873cccd4c951b764aeacb66aa1 | refs/heads/master | 2021-01-01T06:12:26.589618 | 2018-01-10T11:19:23 | 2018-01-10T11:19:23 | 97,378,179 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,643 | java | /*
* Generated by the Jasper component of Apache Tomcat
* Version: Apache Tomcat/8.5.16
* Generated at: 2017-07-21 03:17:30 UTC
* Note: The last modified time of this file was set to
* the last modified time of the source file after
* generation to assist with modification tracking.
*/
package org.apache.jsp.chatting;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
public final class singleChattingG_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent,
org.apache.jasper.runtime.JspSourceImports {
private static final javax.servlet.jsp.JspFactory _jspxFactory =
javax.servlet.jsp.JspFactory.getDefaultFactory();
private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants;
private static final java.util.Set<java.lang.String> _jspx_imports_packages;
private static final java.util.Set<java.lang.String> _jspx_imports_classes;
static {
_jspx_imports_packages = new java.util.HashSet<>();
_jspx_imports_packages.add("javax.servlet");
_jspx_imports_packages.add("javax.servlet.http");
_jspx_imports_packages.add("javax.servlet.jsp");
_jspx_imports_classes = null;
}
private volatile javax.el.ExpressionFactory _el_expressionfactory;
private volatile org.apache.tomcat.InstanceManager _jsp_instancemanager;
public java.util.Map<java.lang.String,java.lang.Long> getDependants() {
return _jspx_dependants;
}
public java.util.Set<java.lang.String> getPackageImports() {
return _jspx_imports_packages;
}
public java.util.Set<java.lang.String> getClassImports() {
return _jspx_imports_classes;
}
public javax.el.ExpressionFactory _jsp_getExpressionFactory() {
if (_el_expressionfactory == null) {
synchronized (this) {
if (_el_expressionfactory == null) {
_el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
}
}
}
return _el_expressionfactory;
}
public org.apache.tomcat.InstanceManager _jsp_getInstanceManager() {
if (_jsp_instancemanager == null) {
synchronized (this) {
if (_jsp_instancemanager == null) {
_jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig());
}
}
}
return _jsp_instancemanager;
}
public void _jspInit() {
}
public void _jspDestroy() {
}
public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response)
throws java.io.IOException, javax.servlet.ServletException {
final java.lang.String _jspx_method = request.getMethod();
if (!"GET".equals(_jspx_method) && !"POST".equals(_jspx_method) && !"HEAD".equals(_jspx_method) && !javax.servlet.DispatcherType.ERROR.equals(request.getDispatcherType())) {
response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, "JSPs only permit GET POST or HEAD");
return;
}
final javax.servlet.jsp.PageContext pageContext;
javax.servlet.http.HttpSession session = null;
final javax.servlet.ServletContext application;
final javax.servlet.ServletConfig config;
javax.servlet.jsp.JspWriter out = null;
final java.lang.Object page = this;
javax.servlet.jsp.JspWriter _jspx_out = null;
javax.servlet.jsp.PageContext _jspx_page_context = null;
try {
response.setContentType("text/html; charset=EUC-KR");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\r\n");
out.write("<html>\r\n");
out.write("<head>\r\n");
out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=EUC-KR\">\r\n");
out.write("\r\n");
out.write("<title>채팅페이지</title>\r\n");
out.write("<link rel=\"stylesheet\" href=\"/pcm/Resources/css/bootstrap.css\">\r\n");
out.write("<style>\r\n");
out.write("body {\r\n");
out.write("\t\tbackground-image: url('/pcm/img/kakao2.jpg'); background-size: cover;\r\n");
out.write("\t\tbackground-repeat : no-repeat;\r\n");
out.write("\t}\r\n");
out.write("button {\r\n");
out.write("\t background-color: #fcb259;\r\n");
out.write("\t color: white;\r\n");
out.write("\t padding: 14px 20px;\r\n");
out.write("\t margin: 8px 0;\r\n");
out.write("\t border: none;\r\n");
out.write("\t cursor: pointer;\r\n");
out.write("\t width: 100%;\r\n");
out.write("\t}\r\n");
out.write("input[type=text], input[type=tel], input[type=password] {\r\n");
out.write("\tcolor: black;\r\n");
out.write(" width: 300px;\r\n");
out.write(" padding: 12px 20px;\r\n");
out.write(" margin: 8px 0;\r\n");
out.write(" display: inline-block;\r\n");
out.write(" border: 1px solid #ccc;\r\n");
out.write(" box-sizing: border-box;\r\n");
out.write("</style>\r\n");
out.write("</head>\r\n");
out.write("<body> \r\n");
out.write("<input id=\"inputMessage\" type=\"text\"\r\n");
out.write("\t\tonkeydown=\"if(event.keyCode==13){send();}\" />\r\n");
out.write("<input type=\"submit\" class=\"btn btn-danger btn-lg\" value=\"전송\" onclick=\"send();\"/>\r\n");
out.write("<div id=\"messageWindow2\" style=\"padding:10px 0; height: 20em; overflow: auto;\"></div>\r\n");
out.write("</body>\r\n");
out.write("\r\n");
String id = "";
if (session.getAttribute("id") != null) {
id = (String) session.getAttribute("id");
}
String nick = (String)session.getAttribute("memberId");
String grade = (String)session.getAttribute("grade");
if (session.getAttribute("nick") != null) {
nick = (String) session.getAttribute("nick");
} else {
nick = (String)session.getAttribute("memberId");
}
out.write("\r\n");
out.write("\t<script type=\"text/javascript\">\r\n");
out.write("\t\tvar webSocket = new WebSocket('ws://localhost:8070/pcm/singleBroadcasting');\r\n");
out.write("\t\tvar inputMessage = document.getElementById('inputMessage');\r\n");
out.write("\t\tvar re_send = \"\";\r\n");
out.write("\t\tvar cnt = 0;\r\n");
out.write("\t\twebSocket.onerror = function(event) {\r\n");
out.write("\t\t\tonError(event)\r\n");
out.write("\t\t};\r\n");
out.write("\t\twebSocket.onopen = function(event) {\r\n");
out.write("\t\t\tonOpen(event)\r\n");
out.write("\t\t};\r\n");
out.write("\t\twebSocket.onmessage = function(event) {\r\n");
out.write("\t\t\tonMessage(event)\r\n");
out.write("\t\t};\r\n");
out.write("\t\t\r\n");
out.write("\t\tfunction onMessage(event) {\r\n");
out.write("\t\t\t\r\n");
out.write("\t\t\tvar message = event.data.split(\"|\");\r\n");
out.write("\t\t\t\tif(message[0] != re_send) {\r\n");
out.write("\t\t\t\t\tvar who = document.createElement('div');\r\n");
out.write("\t\t\t\t\t\r\n");
out.write("\t\t\t\t\twho.style[\"padding\"]=\"10px\";\r\n");
out.write("\t\t\t\t\twho.style[\"margin-left\"]=\"10px\";\r\n");
out.write("\t\t\t\t\t\r\n");
out.write("\t\t\t\t\twho.innerHTML = message[0];\r\n");
out.write("\t\t\t\t\tif(message[1] == \"A\") {\r\n");
out.write("\t\t\t\t\t\tdocument.getElementById('messageWindow2').appendChild(who);\r\n");
out.write("\t\t\t\t\t}\r\n");
out.write("\t\t\t\t\t\r\n");
out.write("\t\t\t\t\tre_send = message[0];\r\n");
out.write("\t\t\t\t}\r\n");
out.write("\t\t\t\t\r\n");
out.write("\t\t\t\tvar div=document.createElement('div');\r\n");
out.write("\t\t\t\t\r\n");
out.write("\t\t\t\tdiv.style[\"width\"]=\"auto\";\r\n");
out.write("\t\t\t\tdiv.style[\"word-wrap\"]=\"break-word\";\r\n");
out.write("\t\t\t\tdiv.style[\"display\"]=\"inline-block\";\r\n");
out.write("\t\t\t\tdiv.style[\"background-color\"]=\"#fcfcfc\";\r\n");
out.write("\t\t\t\tdiv.style[\"border-radius\"]=\"10px\";\r\n");
out.write("\t\t\t\tdiv.style[\"padding\"]=\"10px\";\r\n");
out.write("\t\t\t\tdiv.style[\"margin-left\"]=\"10px\";\r\n");
out.write("\t\t\t\t\r\n");
out.write("\t\t\t\tdiv.innerHTML = message[2];\r\n");
out.write("\t\t\t\tif(message[1] == \"A\") {\r\n");
out.write("\t\t\t\t\tdocument.getElementById('messageWindow2').appendChild(div);\r\n");
out.write("\t\t\t\t}\r\n");
out.write("\t\t\t\t\r\n");
out.write("\t\t\t\t\r\n");
out.write("\t\t\tvar clear=document.createElement('div');\r\n");
out.write("\t\t\tclear.style[\"clear\"]=\"both\";\r\n");
out.write("\t\t\tdocument.getElementById('messageWindow2').appendChild(clear);\r\n");
out.write("\t\t\t\r\n");
out.write("\t\t\tmessageWindow2.scrollTop = messageWindow2.scrollHeight;\r\n");
out.write("\t\t}\r\n");
out.write("\t\t\r\n");
out.write("\t\tfunction onClose(event) {\r\n");
out.write("\t\t\tvar div=document.createElement('div');\r\n");
out.write("\t\t\t\r\n");
out.write("\t\t\twebSocket.send(\"");
out.print(nick);
out.write(" is DisConnected\\n\");\r\n");
out.write("\t\t}\r\n");
out.write("\t\t\r\n");
out.write("\t\tfunction onOpen(event) {\r\n");
out.write("\t\t\tvar div=document.createElement('div');\r\n");
out.write("\t\t\t\r\n");
out.write("\t\t\tdiv.style[\"text-align\"]=\"center\";\r\n");
out.write("\t\t\t\r\n");
out.write("\t\t\tdiv.innerHTML = \"무엇을 도와드릴까요?? 회원님 1:1전용\";\r\n");
out.write("\t\t\tdocument.getElementById('messageWindow2').appendChild(div);\r\n");
out.write("\t\t\t\r\n");
out.write("\t\t\tvar clear=document.createElement('div');\r\n");
out.write("\t\t\tclear.style[\"clear\"]=\"both\";\r\n");
out.write("\t\t\tdocument.getElementById('messageWindow2').appendChild(clear);\r\n");
out.write("\t\t\t\r\n");
out.write("\t\t\twebSocket.send(\"");
out.print(nick +"|"+grade);
out.write("|안녕하세요^^\");\r\n");
out.write("\t\t}\r\n");
out.write("\t\t\r\n");
out.write("\t\tfunction onError(event) {\r\n");
out.write("\t\t\talert(\"chat_server connecting error \" + event.data);\r\n");
out.write("\t\t}\r\n");
out.write("\t\t\r\n");
out.write("\t\tfunction send() {\r\n");
out.write("\t\t\t\r\n");
out.write("\t\t\tif(inputMessage.value!=\"\"){\r\n");
out.write("\t\t\t\twebSocket.send(\"");
out.print(nick+"|"+grade);
out.write("|\"+ inputMessage.value);\r\n");
out.write("\t\t\t\t\r\n");
out.write("\t\t\t\tvar div=document.createElement('div');\r\n");
out.write("\t\t\t\t\r\n");
out.write("\t\t\t\tdiv.style[\"width\"]=\"auto\";\r\n");
out.write("\t\t\t\tdiv.style[\"word-wrap\"]=\"break-word\";\r\n");
out.write("\t\t\t\tdiv.style[\"float\"]=\"right\";\r\n");
out.write("\t\t\t\tdiv.style[\"display\"]=\"inline-block\";\r\n");
out.write("\t\t\t\tdiv.style[\"background-color\"]=\"#ffea00\";\r\n");
out.write("\t\t\t\tdiv.style[\"padding\"]=\"10px\";\r\n");
out.write("\t\t\t\tdiv.style[\"border-radius\"]=\"10px\";\r\n");
out.write("\t\t\t\tdiv.style[\"margin-right\"]=\"10px\";\r\n");
out.write("\t\t\t\t\r\n");
out.write("\t\t\t\tdiv.innerHTML = inputMessage.value;\r\n");
out.write("\t\t\t\tdocument.getElementById('messageWindow2').appendChild(div);\r\n");
out.write("\t\t\t\t\r\n");
out.write("\t\t\t\tvar clear = document.createElement('div');\r\n");
out.write("\t\t\t\tclear.style[\"clear\"] = \"both\";\r\n");
out.write("\t\t\t\tdocument.getElementById('messageWindow2').appendChild(clear);\r\n");
out.write("\t\t\t\t\r\n");
out.write("\t\t\t\tinputMessage.value = '';\r\n");
out.write("\t\t\t\t\r\n");
out.write("\t\t\t\tmessageWindow2.scrollTop = messageWindow2.scrollHeight;\r\n");
out.write("\t\t\t\t\r\n");
out.write("\t\t\t\tre_send = \"");
out.print(nick);
out.write("\";\r\n");
out.write("\t\t\t}\r\n");
out.write("\t\t}\r\n");
out.write("\t\t\r\n");
out.write("\t</script>\r\n");
out.write("<script src=\"http://ajax.googleapis.com/ajax/libs/jqery/1.12.4/jquery.min.js\"></script>\r\n");
out.write("<script type=\"text/javascript\" src=\"js/bootstrap.js\"></script>\r\n");
out.write("</html>");
} catch (java.lang.Throwable t) {
if (!(t instanceof javax.servlet.jsp.SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
try {
if (response.isCommitted()) {
out.flush();
} else {
out.clearBuffer();
}
} catch (java.io.IOException e) {}
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
else throw new ServletException(t);
}
} finally {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
}
| [
"tjtjsksk123@naver.com"
] | tjtjsksk123@naver.com |
e9bc44147452727c1c4e4d66e27c52373571a86a | f6f78b493299e8f6c41ce192833bf21e0ff67d1f | /.svn/pristine/e9/e9bc44147452727c1c4e4d66e27c52373571a86a.svn-base | 6937f3dc85a6780aaac55670281ea560a08a3f46 | [] | no_license | githubzxy/rserver | 5578d02fb24c35a0f1ed652e9c010365642b49b4 | a910442d3ff9473fa81e6d3267a6287341cfb934 | refs/heads/master | 2020-12-01T17:57:24.645658 | 2019-12-30T03:23:16 | 2019-12-30T03:23:16 | 230,716,205 | 0 | 0 | null | 2019-12-30T03:25:37 | 2019-12-29T07:10:13 | JavaScript | UTF-8 | Java | false | false | 2,015 | package com.enovell.yunwei.km_micor_service.service.constructionManage.pointInnerMaintainPlan;
import java.util.List;
import org.bson.Document;
public interface SkylightMaintenanceSkillAuditService {
/**
* 申请
* @param doc 数据对象
* @param collectionName 表名
* @return 新增的数据对象
*/
Document addDocument(Document doc,String collectionName);
/**
* 分页查询数量
* @param collectionName 表名
* @param startUploadDate 起始上传时间
* @param endUploadDate 结束上传时间
* @return 条数
*/
long findAllDocumentCount(String collectionName, String userId, String orgId, String currentDay,String project, String type, String startUploadDate,String endUploadDateString , String flowState,String orgSelectName);
/**
* 分页查询当前表中的数据
* @param collectionName 表名
* @param startUploadDate 起始上传时间
* @param endUploadDate 结束上传时间
* @param start 起始数据
* @param limit 展示条数
* @return 数据对象列表
*/
List<Document> findAllDocument(String collectionName, String userId, String orgId, String currentDay,String project, String type, String startUploadDate,String endUploadDate, String flowState,String orgSelectName, int start, int limit);
/**
* 根据id查询单条数据
* @param id 数据id
* @param collectionName 表名
* @return 单条数据对象
*/
Document findDocumentById(String id,String collectionName);
/**
* 更新数据对象
* @param doc 数据对象
* @param collectionName 表名
* @return 数据对象
*/
Document updateDocument(Document doc,String collectionName);
/**
* 删除数据对象
* @param ids 数据对象Id
* @param collectionName 表名
*/
void removeDocument(List<String> ids,String collectionName);
}
| [
"Administrator@USER-20190223OL"
] | Administrator@USER-20190223OL | |
6e56ee1936e30e12b5ef5c9e6e75aa2c200b5f84 | 0730a8654c995f02b61fac6c91f5e7fa0648bc9f | /restau/src/sample/Constants.java | 0364085c1f44b7a7f3cc6c647825bcdc0d2a0d99 | [] | no_license | ahnaf005/Restaurent-Management-System | ecd473399808f573366c4ec2f194aaac33e667b0 | 8b91e0be3c340afc9d1d7be8d3e9fb3cea63f2c1 | refs/heads/main | 2023-01-24T05:22:09.704708 | 2020-12-12T14:35:08 | 2020-12-12T14:35:08 | 320,850,321 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 284 | java | package sample;
public class Constants {
public static String ID;
public static String userType;
public static void setID(String ID) {
Constants.ID = ID;
}
public static void setUserType(String userType) {
Constants.userType = userType;
}
}
| [
"ahnaffaisalalavi@gmail,com"
] | ahnaffaisalalavi@gmail,com |
94eabbd86a909a21a1a0919d8db718d390f0f36e | 4ae76a95f168e61b3ae49d7e8838ede4db9daa40 | /Linear/Lt01_Ex36.java | 74d9214b2b57a11fd0762d5b8ab85b6d0a849ff2 | [] | no_license | andreluis-git/LoteAlgoritmos_JAVA | 7d672ba6032747312382909c08f91b8a089317fb | 4f23e9797b37c22fc5773368d64fd7a3e9f916a1 | refs/heads/master | 2023-02-10T10:47:39.141330 | 2021-01-05T22:28:07 | 2021-01-05T22:28:07 | 327,127,879 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 600 | java | package Lote.Linear;
import javax.swing.JOptionPane;
/*
Objetivo:Receba um número N. Calcule e mostre a série 1 + 1/1! + 1/2! + ... + 1/N!
Nome: André Luis
Data: 2020-02-17
*/
public class Lt01_Ex36 {
public static void main(String[] args) {
float number, serie, fat;
serie = 1;
number = Float.parseFloat(JOptionPane.showInputDialog("Digite um número:"));
for (float i = 1; i < number+1; i++) {
fat = 1;
// Calcula o valor fatorial a ser dividido
for (float j = 1; j < i+1; j++) {
fat *= j;
}
serie += (1/fat);
}
JOptionPane.showMessageDialog(null, serie);
}
}
| [
"almr.andre@gmail.com"
] | almr.andre@gmail.com |
a88fdab847f0eb7e27e86d1457b0e8dd4349436e | b0a67bc30d21bc038cef22212ae2076461b17ee1 | /src/main/java/com/att/biq/day26/net/socket/basic/clientserver/Server.java | 55aa346fe56ca63e57c18cbb4d22e7e41490207b | [] | no_license | gb824v/Biq | 0ec5da42d108c1210f3b0efb7a2845caa6474783 | 88b84d06c93b42db53da1a28a75a1f2c51102a98 | refs/heads/master | 2020-03-10T23:14:50.937044 | 2018-06-15T07:20:56 | 2018-06-15T07:20:56 | 129,637,306 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 997 | java | package com.att.biq.day26.net.socket.basic.clientserver;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.net.ServerSocket;
import java.net.Socket;
public class Server
{
public static void main(String[] args) throws IOException
{
Socket socket = null;
String line = "";
try (ServerSocket serverSoket = new ServerSocket(7000))
{
// Waiting to client to connect
socket = serverSoket.accept();
try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(socket.getInputStream())))
{
try (PrintStream outputStream = new PrintStream(socket.getOutputStream()))
{
while (!line.equals("!"))
{
line = bufferedReader.readLine();
System.out.println("Getting from Client: -> " + line);
outputStream.println("Sending to Client: -> " + line);
}
socket.close();
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
} | [
"gb824v@intl.att.com"
] | gb824v@intl.att.com |
6e56a12615b481cabb53c512d98c63101186a34d | be6b1710487cdaf8b94903fc0d6c167a94ee1a7f | /cruddemo/src/main/java/com/paudyal/springboot/cruddemo/rest/EmployeeRestController.java | 0963be3046e943eb4de200883179c27321821301 | [] | no_license | npaudyal/Spring-REST | a29f978744c785c38c06658e1fec32ff87fc00e6 | e80156ea42b79083345cee540b5d2ec05a4fbf40 | refs/heads/master | 2022-12-26T06:44:25.553483 | 2020-09-20T16:55:36 | 2020-09-20T16:55:36 | 296,900,345 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,202 | java | package com.paudyal.springboot.cruddemo.rest;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
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.paudyal.springboot.cruddemo.entity.Employee;
import com.paudyal.springboot.cruddemo.service.EmployeeService;
@RestController
@RequestMapping("/api")
public class EmployeeRestController {
private EmployeeService employeeService;
// Quick and dirty: inject employee dao
@Autowired
public EmployeeRestController(EmployeeService theEmployeeService) {
employeeService = theEmployeeService;
}
// expose "/employees endpoint"
@GetMapping("/employees")
public List<Employee> findAll(){
return employeeService.findAll();
}
@GetMapping("/employees/{employeeId}")
public Employee getEmployee(@PathVariable int employeeId){
Employee theEmployee = employeeService.findById(employeeId);
if(theEmployee == null) {
throw new RuntimeException("Employee id not found- "+ employeeId);
}
return theEmployee;
}
@PostMapping("/employees")
public Employee addEmployee(@RequestBody Employee theEmployee) {
theEmployee.setId(0);
employeeService.save(theEmployee);
return theEmployee;
}
@PutMapping("/employees")
public Employee updateEmployee(@RequestBody Employee theEmployee) {
employeeService.save(theEmployee);
return theEmployee;
}
@DeleteMapping("/employees/{employeeId}")
public String deleteEmployee(@PathVariable int employeeId) {
Employee tempEmployee = employeeService.findById(employeeId);
if(tempEmployee == null) {
throw new RuntimeException("Employee id not found: " + employeeId);
}
employeeService.deleteById(employeeId);
return "Deleted employee of id: "+ employeeId;
}
}
| [
"noreply@github.com"
] | npaudyal.noreply@github.com |
e85cc1012d7ad4c1340c640ad676d8bf0b9c415b | d5515553d071bdca27d5d095776c0e58beeb4a9a | /src/net/sourceforge/plantuml/oregon/PSystemOregonFactory.java | 99699038a2d3ca2ac023ba3a5824b3b786eb6c5c | [] | 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 | 1,800 | 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.oregon;
import net.sourceforge.plantuml.command.PSystemBasicFactory;
public class PSystemOregonFactory extends PSystemBasicFactory<PSystemOregon> {
// public PSystemOregon getSystem() {
// final Keyboard keyboard;
// if (inputs == null) {
// keyboard = new KeyboardList("");
// } else {
// keyboard = new KeyboardList(inputs);
// }
// system = new PSystemOregon(keyboard);
// return system;
// }
@Override
public PSystemOregon executeLine(PSystemOregon system, String line) {
if (system == null && line.equalsIgnoreCase("run oregon trail")) {
return new PSystemOregon();
}
if (system == null) {
return null;
}
system.add(line);
return system;
}
}
| [
"plantuml@gmail.com"
] | plantuml@gmail.com |
1122329147709f0f421516a244006acbe878252d | 04d9f479e6c726ebc54bc5035138efa58fc9ea4b | /src/com/xload/searchmaster/model/AltTextExtractor.java | 5927e6fff87cacc99417bf3707b0c26b2582d11e | [] | no_license | migueldiab/searchmaster | 5a3dcecc26dc2e05fb0b54d1325557b79b92ef0f | 464f581318af3d04298a666173d9bd3e0d73de4e | refs/heads/master | 2016-09-05T18:09:53.032310 | 2010-09-23T14:22:06 | 2010-09-23T14:22:06 | 32,398,314 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 664 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.xload.searchmaster.model;
import net.htmlparser.jericho.HTMLElementName;
import net.htmlparser.jericho.Segment;
import net.htmlparser.jericho.StartTag;
import net.htmlparser.jericho.TextExtractor;
/**
*
* @author madrax
*/
public class AltTextExtractor extends TextExtractor {
public AltTextExtractor(final Segment segment) {
super(segment);
}
@Override
public boolean excludeElement(StartTag startTag) {
return startTag.getName().equals(HTMLElementName.P) || "control".equalsIgnoreCase(startTag.getAttributeValue("class"));
}
}
| [
"migueldiab@43f39e98-2ee1-11df-a735-6ff41f51f3aa"
] | migueldiab@43f39e98-2ee1-11df-a735-6ff41f51f3aa |
1e2b9031c97f2c38768dd18828c4f95c2d1da6b6 | c325c7663c31e965ff2a62c8b81c143a3f5451fe | /src/main/java/com/app/view/tables/SkatersTable.java | fa350515b329252eff9d819e80eca85416a489d5 | [] | no_license | PetroRulov/Rink | 1d047d8f882ffebb5141d291dcd8426bcf980385 | 906fcd08a76244abd91253933ed2745079f12f0f | refs/heads/master | 2020-08-08T22:41:36.247243 | 2019-10-09T14:16:40 | 2019-10-09T14:16:40 | 213,936,756 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,664 | java | package com.app.view.tables;
import com.app.model.Administrator;
import com.app.model.Skater;
import javax.swing.*;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableColumn;
import java.awt.*;
/**
* Created by prulov on 26.11.2016.
*/
public class SkatersTable extends DefaultTableModel {
private Administrator admin;
private JTable table;
private final int columns;
public SkatersTable(Administrator admin){
this.admin = admin;
columns = 2;
table = createTable();
table.setFillsViewportHeight(true);
}
public JTable createTable() {
Object[] colNames = fillColumns();
Object[][] data = fillData();
JTable tSkaters = new JTable(data, colNames);
tSkaters.setAutoCreateRowSorter(true);
TableColumn column = null;
for(int i = 0; i < columns; i++){
column = tSkaters.getColumnModel().getColumn(i);
if(i == 0) {
column.setCellRenderer(new DefaultTableCellRenderer() {
public JComponent getTableCellRendererComponent(JTable table, Object value,
boolean isSelected, boolean hasFocus, int row, int col) {
JLabel label =
(JLabel) super.getTableCellRendererComponent(table, value,
isSelected, hasFocus, row, col);
label.setSize(10, 10);
label.setHorizontalAlignment(JLabel.CENTER);
label.setBackground(new Color(200, 150, 100));
label.setForeground(new Color(0, 0, 0));
label.setFont(new Font("Garamond", Font.BOLD, 20));
return label;
}
});
column.setMaxWidth(30);
} else {
column.setCellRenderer(new DefaultTableCellRenderer() {
public JComponent getTableCellRendererComponent(JTable table, Object value,
boolean isSelected, boolean hasFocus, int row, int col) {
JLabel label =
(JLabel) super.getTableCellRendererComponent(table, value,
isSelected, hasFocus, row, col);
//label.setPreferredSize(new Dimension(150,10));
label.setSize(150,10);
label.setHorizontalAlignment(JLabel.CENTER);
label.setBackground(new Color(170, 150, 150));
label.setForeground(new Color(255, 0, 0));
label.setFont(new Font("Garamond", Font.BOLD, 20));
return label;
}
});
}
}
return tSkaters;
}
private Object[] fillColumns(){
String[] heads = new String[]{"#", "ID number"};
Object[] colNames = new Object[heads.length];
for(int i = 0; i < columns; i++){
colNames[i] = heads[i];
}
return colNames;
}
private Object[][] fillData(){
Object[][] data = new Object[admin.getRink().getSkaters().size()][columns];
int j = 1, i = 0;
for (Skater skater : admin.getRink().getSkaters()) {
data[i] = new Object[] {
j++,
skater.toString()
};
i++;
}
return data;
}
}
| [
"prulov.pr@gmail.com"
] | prulov.pr@gmail.com |
101826f3f81ddff32ac9131d98beade36f0f85c2 | a32c6329b0a0497589c92579cd69797afed91bc5 | /src/main/java/com/amazonaws/mws/products/samples/GetMyPriceForSKUSample.java | b6b91df25fb56783d884f4f44585a45e96ec0de2 | [] | no_license | neelimakapoor1/seller_api | 9ae23e32e25bfc3d95b97ece148d8ebd0cd7fdbe | 2a5f7b8437ec50c3cddc9a5d51637a851dbee8de | refs/heads/master | 2021-06-10T19:58:51.548263 | 2019-07-01T09:03:03 | 2019-07-01T09:03:03 | 194,632,214 | 1 | 0 | null | 2021-06-04T02:02:55 | 2019-07-01T08:29:50 | Java | UTF-8 | Java | false | false | 3,725 | java | /*******************************************************************************
* Copyright 2009-2017 Amazon Services. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
*
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at: http://aws.amazon.com/apache2.0
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*******************************************************************************
* Marketplace Web Service Products
* API Version: 2011-10-01
* Library Version: 2017-03-22
* Generated: Wed Mar 22 23:24:32 UTC 2017
*/
package com.amazonaws.mws.products.samples;
import java.util.*;
import javax.xml.datatype.XMLGregorianCalendar;
import java.math.BigDecimal;
import com.amazonaws.mws.client.*;
import com.amazonaws.mws.products.*;
import com.amazonaws.mws.products.model.*;
/** Sample call for GetMyPriceForSKU. */
public class GetMyPriceForSKUSample {
/**
* Call the service, log response and exceptions.
*
* @param client
* @param request
*
* @return The response.
*/
public static GetMyPriceForSKUResponse invokeGetMyPriceForSKU(
MarketplaceWebServiceProducts client,
GetMyPriceForSKURequest request) {
try {
// Call the service.
GetMyPriceForSKUResponse response = client.getMyPriceForSKU(request);
ResponseHeaderMetadata rhmd = response.getResponseHeaderMetadata();
// We recommend logging every the request id and timestamp of every call.
System.out.println("Response:");
System.out.println("RequestId: "+rhmd.getRequestId());
System.out.println("Timestamp: "+rhmd.getTimestamp());
String responseXml = response.toXML();
System.out.println(responseXml);
return response;
} catch (MarketplaceWebServiceProductsException ex) {
// Exception properties are important for diagnostics.
System.out.println("Service Exception:");
ResponseHeaderMetadata rhmd = ex.getResponseHeaderMetadata();
if(rhmd != null) {
System.out.println("RequestId: "+rhmd.getRequestId());
System.out.println("Timestamp: "+rhmd.getTimestamp());
}
System.out.println("Message: "+ex.getMessage());
System.out.println("StatusCode: "+ex.getStatusCode());
System.out.println("ErrorCode: "+ex.getErrorCode());
System.out.println("ErrorType: "+ex.getErrorType());
throw ex;
}
}
/**
* Command line entry point.
*/
public static void main(String[] args) {
// Get a client connection.
// Make sure you've set the variables in MarketplaceWebServiceProductsSampleConfig.
MarketplaceWebServiceProductsClient client = MarketplaceWebServiceProductsSampleConfig.getClient();
// Create a request.
GetMyPriceForSKURequest request = new GetMyPriceForSKURequest();
String sellerId = "example";
request.setSellerId(sellerId);
String mwsAuthToken = "example";
request.setMWSAuthToken(mwsAuthToken);
String marketplaceId = "example";
request.setMarketplaceId(marketplaceId);
SellerSKUListType sellerSKUList = new SellerSKUListType();
request.setSellerSKUList(sellerSKUList);
// Make the call.
GetMyPriceForSKUSample.invokeGetMyPriceForSKU(client, request);
}
}
| [
"neelima.kapoor@gmail.com"
] | neelima.kapoor@gmail.com |
8b0b13fc62c9a6c87c3d469f193c1aeae208d8a1 | e6a202e7489bb5e7298531b1bdee9aa1b728e9d4 | /MyApplication/app/src/main/java/com/example/myapplication/newsActivity.java | bfc0619e789b5fc062ddaede378038b18ce6a0de | [] | no_license | huyangya/learngit | 80510af8e80d8f44f70f4a16c20cf9b8957fcfce | 7f7023c7cb4acabc7e53b83ab8394c3cbabdf4b8 | refs/heads/master | 2020-04-01T14:21:28.010503 | 2019-01-02T07:19:20 | 2019-01-02T07:19:20 | 153,290,961 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,482 | java | package com.example.myapplication;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import java.util.ArrayList;
import java.util.List;
public class newsActivity extends AppCompatActivity
{
private List<News> newsList = new ArrayList<>();
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_news);
initnews();
ListView listView = (ListView) findViewById(R.id.listview);
NewsAdapter adapter = new NewsAdapter(newsActivity.this, R.layout.newsui, newsList);
listView.setAdapter(adapter);
}
public void initnews()
{
News news1 = new News("震惊!!!外国男子因突然健身差点丧命!",R.drawable.new1);
newsList.add(news1);
News news2 = new News("3个月20多家健身房关门,传统健身房“倒闭潮”来了?",R.drawable.new2);
newsList.add(news2);
News new3 = new News("过度健身也是病!会对身体造成的5大伤害",R.drawable.new3);
newsList.add(new3);
News new4 = new News("男子花1.5万健身减肥差点送命!",R.drawable.new4);
newsList.add(new4);
News new5 = new News("健身猝死事件频发,我们还要健身吗?",R.drawable.new5);
newsList.add(new5);
}
}
| [
"2890967527@qq.com"
] | 2890967527@qq.com |
a9d61d055861b6972399e6cdf3141b81e67dd35c | 774d5613ecc6df50d485bc10a72a5039f69bd6ab | /phase1/test/ConferenceTest.java | c28f1dcf47df8cc05a32ddcca1b17ad4c6a96ab8 | [] | no_license | aq1e/CSC207-Final-Project | 18e5d422c182f343ed9a2797a63be2f595ca643a | 446b2600857ef18330fece5d4616a8061cc9065d | refs/heads/master | 2023-04-12T09:17:25.964339 | 2021-04-06T01:12:17 | 2021-04-06T01:12:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 36,832 | java | import contact.ContactManager;
import convention.ConferenceController;
import convention.EventController;
import convention.RoomController;
import convention.calendar.TimeRange;
import convention.conference.ConferenceManager;
import convention.exception.*;
import messaging.ConversationController;
import messaging.ConversationManager;
import org.junit.Before;
import org.junit.Test;
import user.UserManager;
import java.time.LocalDateTime;
import java.time.Month;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import static org.junit.Assert.*;
public class ConferenceTest {
/* Setup tests */
UUID myUser = UUID.randomUUID();
UUID randomUser = UUID.randomUUID();
UUID someOrganizer = UUID.randomUUID();
UUID someAttendee = UUID.randomUUID();
UUID someAttendeeB = UUID.randomUUID();
UUID someAttendeeC = UUID.randomUUID();
UUID someSpeaker = UUID.randomUUID();
UUID someSpeakerB = UUID.randomUUID();
UUID someSpeakerC = UUID.randomUUID();
UUID randomConference = UUID.randomUUID();
UUID randomEvent = UUID.randomUUID();
String emptyString = "";
String conferenceNameA = "Conference A";
String conferenceNameB = "Conference B";
String eventNameA = "Event A";
String eventNameB = "Event B";
String roomA = "Room A";
LocalDateTime dateA = LocalDateTime.of(2015,
Month.JULY, 29, 19, 30, 40);
LocalDateTime dateB = LocalDateTime.of(2018,
Month.JULY, 29, 19, 30, 40);
TimeRange timeRangeA = new TimeRange(dateA, dateB);
LocalDateTime dateC = LocalDateTime.of(2020,
Month.APRIL, 2, 1, 3, 20);
LocalDateTime dateD = LocalDateTime.of(2029,
Month.AUGUST, 29, 19, 30, 40);
TimeRange timeRangeB = new TimeRange(dateC, dateD);
LocalDateTime dateE = LocalDateTime.of(2030,
Month.APRIL, 2, 1, 3, 20);
LocalDateTime dateF = LocalDateTime.of(2049,
Month.AUGUST, 29, 19, 30, 40);
TimeRange timeRangeC = new TimeRange(dateE, dateF);
RoomController roomController;
EventController eventController;
ConferenceController conferenceController;
ConversationController conversationController;
@Before
public void init() {
UserManager userManager = new UserManager();
ConversationManager conversationManager = new ConversationManager();
ConferenceManager conferenceManager = new ConferenceManager();
ContactManager contactManager = new ContactManager();
// Convention controllers
conversationController = new ConversationController(contactManager, conversationManager);
roomController = new RoomController(conferenceManager);
eventController = new EventController(conferenceManager, conversationManager);
conferenceController = new ConferenceController(conversationManager, eventController, conferenceManager, userManager);
}
// Test with and without permission
// Admin tasks
// Create conf X
// Edit conf
// Add organizer X
// Remove organizer X
// Remove attendee
// Edit date X
// Edit name X
// Delete conf X
// Create event
// Assign a speaker
// Edit event
// Delete event
// Revoke speaker access if they don't have any more events
// Create room
// Edit room
// Delete room
// User tasks
// Join convention
// - Invite? Search?
// Register in event
// List events
// - Test the different ways to sort
// Speaker tasks
// List events they're running
// Create convo for an event
/* Conference creation */
/**
* The convention should exist after it is created... duh
*/
@Test(timeout = 100)
public void testCreateConference() {
UUID conferenceUUID = conferenceController.createConference(conferenceNameA, timeRangeA, myUser);
assertTrue(conferenceController.conferenceExists(conferenceUUID));
assertEquals(conferenceController.getConferenceName(conferenceUUID), conferenceNameA);
assertEquals(conferenceController.getConferenceTimeRange(conferenceUUID), timeRangeA);
assertTrue(conferenceController.getOrganizers(conferenceUUID, myUser).contains(myUser));
}
/**
* You need a name...
*/
@Test(timeout = 100, expected = InvalidNameException.class)
public void testCreateConferenceInvalidName() {
conferenceController.createConference(emptyString, timeRangeA, myUser);
}
/* Editing a convention */
@Test(timeout = 100)
public void testEditConferenceName() {
UUID conferenceUUID = conferenceController.createConference(conferenceNameA, timeRangeA, myUser);
conferenceController.setConferenceName(conferenceUUID, myUser, conferenceNameB);
assertEquals(conferenceController.getConferenceName(conferenceUUID), conferenceNameB);
}
/**
* You need a name...
*/
@Test(timeout = 100, expected = InvalidNameException.class)
public void testEditConferenceNameInvalidName() {
UUID conferenceUUID = conferenceController.createConference(conferenceNameA, timeRangeA, myUser);
conferenceController.setConferenceName(conferenceUUID, myUser, emptyString);
}
/**
* You must be an organizer
*/
@Test(timeout = 100, expected = PermissionException.class)
public void testEditConferenceNameInsufficientPermission() {
UUID conferenceUUID = conferenceController.createConference(conferenceNameA, timeRangeA, myUser);
conferenceController.setConferenceName(conferenceUUID, randomUser, conferenceNameB);
}
@Test(timeout = 100)
public void testEditConferenceDates() {
UUID conferenceUUID = conferenceController.createConference(conferenceNameA, timeRangeA, myUser);
conferenceController.setConferenceTimeRange(conferenceUUID, myUser, timeRangeB);
assertEquals(conferenceController.getConferenceTimeRange(conferenceUUID), timeRangeB);
}
/**
* You must be an organizer
*/
@Test(timeout = 100, expected = PermissionException.class)
public void testEditConferenceDatesInsufficientPermission() {
UUID conferenceUUID = conferenceController.createConference(conferenceNameA, timeRangeA, myUser);
conferenceController.setConferenceTimeRange(conferenceUUID, randomUser, timeRangeB);
}
/* Deleting a convention */
@Test(timeout = 100)
public void testDeleteConference() {
UUID conferenceUUID = conferenceController.createConference(conferenceNameA, timeRangeA, myUser);
conferenceController.deleteConference(conferenceUUID, myUser);
assertFalse(conferenceController.conferenceExists(conferenceUUID));
}
/**
* You can't delete a convention that doesn't exist
*/
@Test(timeout = 100, expected = NullConferenceException.class)
public void testDeleteInvalidConference() {
conferenceController.deleteConference(randomConference, myUser);
}
/**
* Only organizers can do this
*/
@Test(timeout = 100, expected = PermissionException.class)
public void testDeleteConferenceInsufficientPermission() {
UUID conferenceUUID = conferenceController.createConference(conferenceNameA, timeRangeA, myUser);
conferenceController.deleteConference(conferenceUUID, randomUser);
}
/* Time range */
@Test(timeout = 100)
public void testTimeRange() {
new TimeRange(dateA, dateB);
}
@Test(timeout = 100, expected = InvalidTimeRangeException.class)
public void testInvalidTimeRange() {
new TimeRange(dateB, dateA);
}
/* Managing organizers */
@Test(timeout = 100)
public void testAddOrganizer() {
UUID conferenceUUID = conferenceController.createConference(conferenceNameA, timeRangeA, myUser);
// Test that there is only the initial user
Set<UUID> organizers = conferenceController.getOrganizers(conferenceUUID, myUser);
assertTrue(organizers.size() == 1 && organizers.contains(myUser));
// Add the new organizer
conferenceController.addOrganizer(conferenceUUID, myUser, someOrganizer);
// Update pointer
organizers = conferenceController.getOrganizers(conferenceUUID, myUser);
// Ensure new organizer has been added successfully
assertTrue(organizers.size() == 2 && organizers.contains(myUser) && organizers.contains(someOrganizer));
}
/**
* Only organizers can do this
*/
@Test(timeout = 100, expected = PermissionException.class)
public void testAddOrganizerInsufficientPermission() {
UUID conferenceUUID = conferenceController.createConference(conferenceNameA, timeRangeA, myUser);
conferenceController.addOrganizer(conferenceUUID, randomUser, someOrganizer);
}
@Test(timeout = 100)
public void testRemoveOrganizer() {
UUID conferenceUUID = conferenceController.createConference(conferenceNameA, timeRangeA, myUser);
// Add the new organizer
conferenceController.addOrganizer(conferenceUUID, myUser, someOrganizer);
// Test that both users have been added
Set<UUID> organizers = conferenceController.getOrganizers(conferenceUUID, myUser);
assertTrue(organizers.size() == 2 && organizers.contains(myUser) && organizers.contains(someOrganizer));
// Remove the organizer
conferenceController.removeOrganizer(conferenceUUID, myUser, someOrganizer);
// Update pointer
organizers = conferenceController.getOrganizers(conferenceUUID, myUser);
// Test that the organizer has indeed been removed
assertEquals(organizers.size(), 1);
assertTrue(organizers.contains(myUser));
assertFalse(organizers.contains(someOrganizer));
}
/**
* You can't remove yourself if you're the last organizer
*/
@Test(timeout = 100, expected = LoneOrganizerException.class)
public void testRemoveLastOrganizer() {
UUID conferenceUUID = conferenceController.createConference(conferenceNameA, timeRangeA, myUser);
// Remove the organizer
conferenceController.removeOrganizer(conferenceUUID, myUser, myUser);
}
/**
* Only organizers can do this
*/
@Test(timeout = 100, expected = PermissionException.class)
public void testRemoveOrganizerInsufficientPermission() {
UUID conferenceUUID = conferenceController.createConference(conferenceNameA, timeRangeA, myUser);
conferenceController.removeOrganizer(conferenceUUID, randomUser, someOrganizer);
}
/**
* You can't demote someone who wasn't an organizer to begin with...
*/
@Test(timeout = 100, expected = NullUserException.class)
public void testRemoveInvalidOrganizer() {
UUID conferenceUUID = conferenceController.createConference(conferenceNameA, timeRangeA, myUser);
conferenceController.removeOrganizer(conferenceUUID, myUser, randomUser);
}
@Test(timeout = 100)
public void testGetSpeakers() {
UUID conferenceUUID = conferenceController.createConference(conferenceNameA, timeRangeA, myUser);
UUID roomUUID = roomController.createRoom(conferenceUUID, myUser, roomA, 2);
UUID eventUUID = eventController.createEvent(conferenceUUID, myUser, eventNameA, timeRangeA, roomUUID, new HashSet<>() {
{
add(someSpeaker);
}
});
assertTrue(eventController.getEventSpeakers(conferenceUUID, myUser, eventUUID).contains(someSpeaker));
assertEquals(eventController.getEventSpeakers(conferenceUUID, myUser, eventUUID).size(), 1);
}
@Test(timeout = 100)
public void testIsSpeaker() {
UUID conferenceUUID = conferenceController.createConference(conferenceNameA, timeRangeA, myUser);
UUID roomUUID = roomController.createRoom(conferenceUUID, myUser, roomA, 2);
assertFalse(conferenceController.isSpeaker(conferenceUUID, myUser, someSpeaker));
UUID eventUUID = eventController.createEvent(conferenceUUID, myUser, eventNameA, timeRangeA, roomUUID, new HashSet<>() {
{
add(someSpeaker);
}
});
assertTrue(conferenceController.isSpeaker(conferenceUUID, myUser, someSpeaker));
assertFalse(conferenceController.isSpeaker(conferenceUUID, myUser, randomUser));
}
@Test(timeout = 100)
public void testGetOrganizers() {
UUID conferenceUUID = conferenceController.createConference(conferenceNameA, timeRangeA, myUser);
assertTrue(conferenceController.getOrganizers(conferenceUUID, myUser).contains(myUser));
assertEquals(conferenceController.getOrganizers(conferenceUUID, myUser).size(), 1);
}
@Test(timeout = 100)
public void testIsOrganizer() {
UUID conferenceUUID = conferenceController.createConference(conferenceNameA, timeRangeA, myUser);
assertFalse(conferenceController.isOrganizer(conferenceUUID, myUser, someOrganizer));
conferenceController.addOrganizer(conferenceUUID, myUser, someOrganizer);
assertTrue(conferenceController.isOrganizer(conferenceUUID, myUser, someOrganizer));
assertFalse(conferenceController.isOrganizer(conferenceUUID, myUser, randomUser));
}
@Test(timeout = 100)
public void testGetAttendees() {
UUID conferenceUUID = conferenceController.createConference(conferenceNameA, timeRangeA, myUser);
assertEquals(conferenceController.getAttendees(conferenceUUID, myUser).size(), 0);
conferenceController.addAttendee(conferenceUUID, randomUser);
assertTrue(conferenceController.getAttendees(conferenceUUID, myUser).contains(randomUser));
assertEquals(conferenceController.getAttendees(conferenceUUID, myUser).size(), 1);
}
@Test(timeout = 100)
public void testIsAttendee() {
UUID conferenceUUID = conferenceController.createConference(conferenceNameA, timeRangeA, myUser);
assertFalse(conferenceController.isAttendee(conferenceUUID, myUser, someAttendee));
conferenceController.addAttendee(conferenceUUID, someAttendee);
assertTrue(conferenceController.isAttendee(conferenceUUID, myUser, someAttendee));
assertFalse(conferenceController.isAttendee(conferenceUUID, myUser, randomUser));
}
@Test(timeout = 100)
public void testCreateEvent() {
UUID conferenceUUID = conferenceController.createConference(conferenceNameA, timeRangeA, myUser);
UUID roomUUID = roomController.createRoom(conferenceUUID, myUser, roomA, 2);
assertEquals(eventController.getEvents(conferenceUUID, myUser).size(), 0);
UUID eventUUID = eventController.createEvent(conferenceUUID, myUser, eventNameA, timeRangeA, roomUUID, new HashSet<>() {
{
add(someSpeaker);
}
});
assertEquals(eventController.getEvents(conferenceUUID, myUser).size(), 1);
assertTrue(eventController.getEvents(conferenceUUID, myUser).contains(eventUUID));
}
@Test(timeout = 100, expected = InvalidNameException.class)
public void testCreateEventInvalidName() {
UUID conferenceUUID = conferenceController.createConference(conferenceNameA, timeRangeA, myUser);
UUID roomUUID = roomController.createRoom(conferenceUUID, myUser, roomA, 2);
UUID eventUUID = eventController.createEvent(conferenceUUID, myUser, emptyString, timeRangeA, roomUUID, new HashSet<>() {
{
add(someSpeaker);
}
});
}
@Test(timeout = 100, expected = PermissionException.class)
public void testCreateEventInsufficientPermission() {
UUID conferenceUUID = conferenceController.createConference(conferenceNameA, timeRangeA, myUser);
UUID roomUUID = roomController.createRoom(conferenceUUID, myUser, roomA, 2);
UUID eventUUID = eventController.createEvent(conferenceUUID, randomUser, eventNameA, timeRangeA, roomUUID, new HashSet<>() {
{
add(someSpeaker);
}
});
}
/**
* TODO: Room test cases
*/
/* Test attendee operations */
@Test(timeout = 100)
public void testJoinConference() {
UUID conferenceUUID = conferenceController.createConference(conferenceNameA, timeRangeA, myUser);
UUID roomUUID = roomController.createRoom(conferenceUUID, myUser, roomA, 2);
UUID eventUUID = eventController.createEvent(conferenceUUID, myUser, eventNameA, timeRangeA, roomUUID, new HashSet<>() {
{
add(someSpeaker);
}
});
conferenceController.addAttendee(conferenceUUID, randomUser);
assertEquals(eventController.getEventAttendees(conferenceUUID, myUser, eventUUID).size(), 0);
eventController.registerForEvent(conferenceUUID, randomUser, randomUser, eventUUID);
assertEquals(eventController.getEventAttendees(conferenceUUID, myUser, eventUUID).size(), 1);
assertTrue(eventController.getEventAttendees(conferenceUUID, myUser, eventUUID).contains(randomUser));
}
@Test(timeout = 100, expected = FullEventException.class)
public void testJoinConferenceFullRoom() {
UUID conferenceUUID = conferenceController.createConference(conferenceNameA, timeRangeA, myUser);
UUID roomUUID = roomController.createRoom(conferenceUUID, myUser, roomA, 1);
UUID eventUUID = eventController.createEvent(conferenceUUID, myUser, eventNameA, timeRangeA, roomUUID, new HashSet<>() {
{
add(someSpeaker);
}
});
conferenceController.addAttendee(conferenceUUID, randomUser);
conferenceController.addAttendee(conferenceUUID, someAttendee);
assertEquals(eventController.getEventAttendees(conferenceUUID, myUser, eventUUID).size(), 0);
eventController.registerForEvent(conferenceUUID, randomUser, randomUser, eventUUID);
assertEquals(eventController.getEventAttendees(conferenceUUID, myUser, eventUUID).size(), 1);
assertTrue(eventController.getEventAttendees(conferenceUUID, myUser, eventUUID).contains(randomUser));
eventController.registerForEvent(conferenceUUID, someAttendee, someAttendee, eventUUID);
}
@Test(timeout = 100, expected = PermissionException.class)
public void testJoinConferenceRandomUser() {
UUID conferenceUUID = conferenceController.createConference(conferenceNameA, timeRangeA, myUser);
UUID roomUUID = roomController.createRoom(conferenceUUID, myUser, roomA, 2);
UUID eventUUID = eventController.createEvent(conferenceUUID, myUser, eventNameA, timeRangeA, roomUUID, new HashSet<>() {
{
add(someSpeaker);
}
});
eventController.registerForEvent(conferenceUUID, randomUser, randomUser, eventUUID);
}
@Test(timeout = 100)
public void testLeaveConferenceAttendee() {
UUID conferenceUUID = conferenceController.createConference(conferenceNameA, timeRangeA, myUser);
conferenceController.addAttendee(conferenceUUID, someAttendee);
assertTrue(conferenceController.getAttendees(conferenceUUID, myUser).contains(someAttendee));
conferenceController.leaveConference(conferenceUUID, someAttendee, someAttendee);
assertFalse(conferenceController.getAttendees(conferenceUUID, myUser).contains(someAttendee));
}
@Test(timeout = 100)
public void testLeaveConferenceSpeaker() {
UUID conferenceUUID = conferenceController.createConference(conferenceNameA, timeRangeA, myUser);
UUID roomUUID = roomController.createRoom(conferenceUUID, myUser, roomA, 2);
UUID eventUUID = eventController.createEvent(conferenceUUID, myUser, eventNameA, timeRangeA, roomUUID, new HashSet<>() {
{
add(someSpeaker);
}
});
assertTrue(conferenceController.getSpeakers(conferenceUUID, myUser).contains(someSpeaker));
assertTrue(eventController.getEventSpeakers(conferenceUUID, myUser, eventUUID).contains(someSpeaker));
conferenceController.leaveConference(conferenceUUID, someSpeaker, someSpeaker);
assertFalse(conferenceController.getSpeakers(conferenceUUID, myUser).contains(someSpeaker));
assertFalse(eventController.getEventSpeakers(conferenceUUID, myUser, eventUUID).contains(someSpeaker));
}
@Test(timeout = 100, expected = NullConferenceException.class)
public void testLeaveConferenceInvalidConference() {
conferenceController.leaveConference(randomConference, randomUser, randomUser);
}
@Test(timeout = 100, expected = PermissionException.class)
public void testLeaveConferenceInvalidUser() {
UUID conferenceUUID = conferenceController.createConference(conferenceNameA, timeRangeA, myUser);
conferenceController.leaveConference(conferenceUUID, randomUser, randomUser);
}
@Test(timeout = 100, expected = LoneOrganizerException.class)
public void testLeaveConferenceLastOrganizer() {
UUID conferenceUUID = conferenceController.createConference(conferenceNameA, timeRangeA, myUser);
conferenceController.leaveConference(conferenceUUID, myUser, myUser);
}
@Test(timeout = 100)
public void testRegisterForEvent() {
UUID conferenceUUID = conferenceController.createConference(conferenceNameA, timeRangeA, myUser);
UUID roomUUID = roomController.createRoom(conferenceUUID, myUser, roomA, 2);
UUID eventUUID = eventController.createEvent(conferenceUUID, myUser, eventNameA, timeRangeA, roomUUID, new HashSet<>() {
{
add(someSpeaker);
}
});
assertTrue(eventController.getAttendeeEvents(conferenceUUID, myUser).size() == 0);
eventController.registerForEvent(conferenceUUID, myUser, myUser, eventUUID);
assertTrue(eventController.getAttendeeEvents(conferenceUUID, myUser).contains(eventUUID));
assertEquals(eventController.getAttendeeEvents(conferenceUUID, myUser).size(), 1);
}
@Test(timeout = 100, expected = NullEventException.class)
public void testRegisterForEventInvalidEvent() {
UUID conferenceUUID = conferenceController.createConference(conferenceNameA, timeRangeA, myUser);
eventController.registerForEvent(conferenceUUID, myUser, myUser, randomEvent);
}
@Test(timeout = 100, expected = PermissionException.class)
public void testRegisterForEventInsufficientPermission() {
UUID conferenceUUID = conferenceController.createConference(conferenceNameA, timeRangeA, myUser);
UUID roomUUID = roomController.createRoom(conferenceUUID, myUser, roomA, 2);
UUID eventUUID = eventController.createEvent(conferenceUUID, myUser, eventNameA, timeRangeA, roomUUID, new HashSet<>() {
{
add(someSpeaker);
}
});
eventController.registerForEvent(conferenceUUID, randomUser, randomUser, eventUUID);
}
@Test(timeout = 100)
public void testUnRegisterForEvent() {
UUID conferenceUUID = conferenceController.createConference(conferenceNameA, timeRangeA, myUser);
UUID roomUUID = roomController.createRoom(conferenceUUID, myUser, roomA, 2);
UUID eventUUID = eventController.createEvent(conferenceUUID, myUser, eventNameA, timeRangeA, roomUUID, new HashSet<>() {
{
add(someSpeaker);
}
});
eventController.registerForEvent(conferenceUUID, myUser, myUser, eventUUID);
assertTrue(eventController.getAttendeeEvents(conferenceUUID, myUser).contains(eventUUID));
assertEquals(eventController.getAttendeeEvents(conferenceUUID, myUser).size(), 1);
eventController.unregisterForEvent(conferenceUUID, myUser, myUser, eventUUID);
assertFalse(eventController.getAttendeeEvents(conferenceUUID, myUser).contains(eventUUID));
assertEquals(eventController.getAttendeeEvents(conferenceUUID, myUser).size(), 0);
}
@Test(timeout = 100, expected = PermissionException.class)
public void testUnregisterForEventInsufficientPermission() {
UUID conferenceUUID = conferenceController.createConference(conferenceNameA, timeRangeA, myUser);
UUID roomUUID = roomController.createRoom(conferenceUUID, myUser, roomA, 2);
UUID eventUUID = eventController.createEvent(conferenceUUID, myUser, eventNameA, timeRangeA, roomUUID, new HashSet<>() {
{
add(someSpeaker);
}
});
eventController.registerForEvent(conferenceUUID, myUser, myUser, eventUUID);
eventController.registerForEvent(conferenceUUID, someAttendee, someAttendee, eventUUID);
eventController.unregisterForEvent(conferenceUUID, someAttendee, myUser, eventUUID);
}
@Test(timeout = 100, expected = PermissionException.class)
public void testUnregisterAttendeeForEventAsOrganizer() {
UUID conferenceUUID = conferenceController.createConference(conferenceNameA, timeRangeA, myUser);
UUID roomUUID = roomController.createRoom(conferenceUUID, myUser, roomA, 2);
UUID eventUUID = eventController.createEvent(conferenceUUID, myUser, eventNameA, timeRangeA, roomUUID, new HashSet<>() {
{
add(someSpeaker);
}
});
eventController.registerForEvent(conferenceUUID, myUser, myUser, eventUUID);
eventController.registerForEvent(conferenceUUID, someAttendee, someAttendee, eventUUID);
assertEquals(eventController.getEventAttendees(conferenceUUID, myUser, eventUUID).size(), 2);
eventController.unregisterForEvent(conferenceUUID, myUser, someAttendee, eventUUID);
assertFalse(eventController.getEventAttendees(conferenceUUID, myUser, eventUUID).contains(someSpeaker));
assertEquals(eventController.getEventAttendees(conferenceUUID, myUser, eventUUID).size(), 1);
}
@Test(timeout = 100)
public void testGetEvents() {
UUID conferenceUUID = conferenceController.createConference(conferenceNameA, timeRangeA, myUser);
UUID roomUUID = roomController.createRoom(conferenceUUID, myUser, roomA, 2);
assertEquals(eventController.getEvents(conferenceUUID, myUser).size(), 0);
UUID eventUUID = eventController.createEvent(conferenceUUID, myUser, eventNameA, timeRangeA, roomUUID, new HashSet<>() {
{
add(someSpeaker);
}
});
assertEquals(eventController.getEvents(conferenceUUID, myUser).size(), 1);
UUID room2UUID = roomController.createRoom(conferenceUUID, myUser, roomA, 2);
UUID event2UUID = eventController.createEvent(conferenceUUID, myUser, eventNameA, timeRangeA, room2UUID, new HashSet<>() {
{
add(someSpeakerB);
}
});
assertEquals(eventController.getEvents(conferenceUUID, myUser).size(), 2);
}
@Test(timeout = 100)
public void testGetAttendeeEvents() {
UUID conferenceUUID = conferenceController.createConference(conferenceNameA, timeRangeA, myUser);
conferenceController.addAttendee(conferenceUUID, someAttendee);
assertEquals(eventController.getAttendeeEvents(conferenceUUID, myUser).size(), 0);
UUID roomUUID = roomController.createRoom(conferenceUUID, myUser, roomA, 2);
UUID eventUUID = eventController.createEvent(conferenceUUID, myUser, eventNameA, timeRangeA, roomUUID, new HashSet<>() {
{
add(someSpeaker);
}
});
eventController.registerForEvent(conferenceUUID, someAttendee, someAttendee, eventUUID);
assertEquals(eventController.getAttendeeEvents(conferenceUUID, someAttendee).size(), 1);
UUID room2UUID = roomController.createRoom(conferenceUUID, myUser, roomA, 2);
UUID event2UUID = eventController.createEvent(conferenceUUID, myUser, eventNameB, timeRangeA, room2UUID, new HashSet<>() {
{
add(someSpeakerB);
}
});
eventController.registerForEvent(conferenceUUID, someAttendee, someAttendee, event2UUID);
assertEquals(eventController.getAttendeeEvents(conferenceUUID, someAttendee).size(), 2);
UUID room3UUID = roomController.createRoom(conferenceUUID, myUser, roomA, 2);
UUID event3UUID = eventController.createEvent(conferenceUUID, myUser, eventNameB, timeRangeA, room3UUID, new HashSet<>() {
{
add(someSpeakerC);
}
});
assertEquals(eventController.getAttendeeEvents(conferenceUUID, someAttendee).size(), 2);
}
@Test(timeout = 100, expected = CalendarDoubleBookingException.class)
public void testDoubleBookRoom() {
UUID conferenceUUID = conferenceController.createConference(conferenceNameA, timeRangeA, myUser);
conferenceController.addAttendee(conferenceUUID, someAttendee);
assertEquals(eventController.getAttendeeEvents(conferenceUUID, myUser).size(), 0);
UUID roomUUID = roomController.createRoom(conferenceUUID, myUser, roomA, 2);
UUID eventUUID = eventController.createEvent(conferenceUUID, myUser, eventNameA, timeRangeA, roomUUID, new HashSet<>() {
{
add(someSpeaker);
}
});
UUID event2UUID = eventController.createEvent(conferenceUUID, myUser, eventNameB, timeRangeA, roomUUID, new HashSet<>() {
{
add(someSpeakerB);
}
});
}
@Test(timeout = 100, expected = SpeakerDoubleBookingException.class)
public void testDoubleBookSpeaker() {
UUID conferenceUUID = conferenceController.createConference(conferenceNameA, timeRangeA, myUser);
conferenceController.addAttendee(conferenceUUID, someAttendee);
assertEquals(eventController.getAttendeeEvents(conferenceUUID, myUser).size(), 0);
UUID roomUUID = roomController.createRoom(conferenceUUID, myUser, roomA, 2);
UUID eventUUID = eventController.createEvent(conferenceUUID, myUser, eventNameA, timeRangeA, roomUUID, new HashSet<>() {
{
add(someSpeaker);
}
});
UUID room2UUID = roomController.createRoom(conferenceUUID, myUser, roomA, 2);
UUID event2UUID = eventController.createEvent(conferenceUUID, myUser, eventNameB, timeRangeA, room2UUID, new HashSet<>() {
{
add(someSpeaker);
}
});
}
@Test(timeout = 100)
public void testGetSpeakerEvents() {
UUID conferenceUUID = conferenceController.createConference(conferenceNameA, timeRangeA, myUser);
UUID roomUUID = roomController.createRoom(conferenceUUID, myUser, roomA, 2);
assertEquals(eventController.getSpeakerEvents(conferenceUUID, myUser).size(), 0);
UUID eventUUID = eventController.createEvent(conferenceUUID, myUser, eventNameA, timeRangeA, roomUUID, new HashSet<>() {
{
add(someSpeaker);
}
});
assertEquals(eventController.getSpeakerEvents(conferenceUUID, someSpeaker).size(), 1);
UUID room2UUID = roomController.createRoom(conferenceUUID, myUser, roomA, 2);
UUID event2UUID = eventController.createEvent(conferenceUUID, myUser, eventNameB, timeRangeB, room2UUID, new HashSet<>() {
{
add(someSpeaker);
}
});
assertEquals(eventController.getSpeakerEvents(conferenceUUID, someSpeaker).size(), 2);
UUID room3UUID = roomController.createRoom(conferenceUUID, myUser, roomA, 2);
UUID event3UUID = eventController.createEvent(conferenceUUID, myUser, eventNameB, timeRangeC, room3UUID, new HashSet<>() {
{
add(someSpeakerB);
}
});
assertEquals(eventController.getSpeakerEvents(conferenceUUID, someSpeaker).size(), 2);
}
// Test conflicts
@Test(timeout = 100, expected = PermissionException.class)
public void testGetEventsInsufficientPermission() {
UUID conferenceUUID = conferenceController.createConference(conferenceNameA, timeRangeA, myUser);
eventController.getEvents(conferenceUUID, randomUser);
}
/* Test speaker operations */
@Test(timeout = 100)
public void testListAttendees() {
UUID conferenceUUID = conferenceController.createConference(conferenceNameA, timeRangeA, myUser);
conferenceController.addAttendee(conferenceUUID, someAttendee);
conferenceController.addAttendee(conferenceUUID, someAttendeeB);
UUID roomUUID = roomController.createRoom(conferenceUUID, myUser, roomA, 2);
UUID eventUUID = eventController.createEvent(conferenceUUID, myUser, eventNameA, timeRangeA, roomUUID, new HashSet<>() {
{
add(someSpeaker);
}
});
assertEquals(eventController.getEventAttendees(conferenceUUID, someSpeaker, eventUUID).size(), 0);
eventController.registerForEvent(conferenceUUID, someAttendee, someAttendee, eventUUID);
assertEquals(eventController.getEventAttendees(conferenceUUID, someSpeaker, eventUUID).size(), 1);
assertTrue(eventController.getEventAttendees(conferenceUUID, someSpeaker, eventUUID).contains(someAttendee));
eventController.registerForEvent(conferenceUUID, someAttendeeB, someAttendeeB, eventUUID);
assertEquals(eventController.getEventAttendees(conferenceUUID, someSpeaker, eventUUID).size(), 2);
assertTrue(eventController.getEventAttendees(conferenceUUID, someSpeaker, eventUUID).contains(someAttendee));
assertTrue(eventController.getEventAttendees(conferenceUUID, someSpeaker, eventUUID).contains(someAttendeeB));
}
@Test(timeout = 100, expected = NullEventException.class)
public void testListAttendeesInvalidEvent() {
UUID conferenceUUID = conferenceController.createConference(conferenceNameA, timeRangeA, myUser);
eventController.getEventAttendees(conferenceUUID, myUser, randomEvent);
}
@Test(timeout = 100, expected = PermissionException.class)
public void testListAttendeesInsufficientPermission() {
UUID conferenceUUID = conferenceController.createConference(conferenceNameA, timeRangeA, myUser);
conferenceController.addAttendee(conferenceUUID, someAttendee);
eventController.getEventAttendees(conferenceUUID, someAttendee, randomEvent);
}
@Test(timeout = 100)
public void testCreateEventConversation() {
UUID conferenceUUID = conferenceController.createConference(conferenceNameA, timeRangeA, myUser);
UUID roomUUID = roomController.createRoom(conferenceUUID, myUser, roomA, 2);
conferenceController.addAttendee(conferenceUUID, someAttendee);
conferenceController.addAttendee(conferenceUUID, someAttendeeB);
UUID eventUUID = eventController.createEvent(conferenceUUID, myUser, eventNameA, timeRangeA, roomUUID, new HashSet<>() {
{
add(someSpeaker);
}
});
eventController.registerForEvent(conferenceUUID, someAttendee, someAttendee, eventUUID);
assertEquals(conversationController.getConversationlist(someAttendee).size(), 0);
UUID eventConversationUUID = eventController.createEventConversation(conferenceUUID, someSpeaker, eventUUID);
assertEquals(conversationController.getConversationlist(someAttendee).size(), 1);
eventController.registerForEvent(conferenceUUID, someAttendeeB, someAttendeeB, eventUUID);
assertEquals(conversationController.getConversationlist(someAttendee).size(), 1);
System.out.println(conversationController.getMessages(someAttendee, eventConversationUUID));
assertEquals(conversationController.getMessages(someAttendee, eventConversationUUID).size(), 1);
}
@Test(timeout = 100, expected = PermissionException.class)
public void testListEventConversationInsufficientPermission() {
UUID conferenceUUID = conferenceController.createConference(conferenceNameA, timeRangeA, myUser);
UUID roomUUID = roomController.createRoom(conferenceUUID, myUser, roomA, 2);
conferenceController.addAttendee(conferenceUUID, someAttendee);
conferenceController.addAttendee(conferenceUUID, someAttendeeB);
UUID eventUUID = eventController.createEvent(conferenceUUID, myUser, eventNameA, timeRangeA, roomUUID, new HashSet<>() {
{
add(someSpeaker);
}
});
UUID eventConversationUUID = eventController.createEventConversation(conferenceUUID, randomUser, eventUUID);
}
}
| [
"henry@henrytu.me"
] | henry@henrytu.me |
94bc648627b600abd82d51a7c94a7ebd0cbce89a | a7b871d7deefa03e26297b3557298d8b69ca446f | /AirUCAB/src/Interfaz/DetalleClientes.java | 2e8298e2ab9e1f89ff78990e944a51b0d0339a40 | [] | no_license | alexdgn213/Proyecto_Bases_1_Garcia_Hevia_Lozano | b39e454f1d96d10ef124583f068e09cd463ecc7e | 9855c7d0db39885531dff5bd5b0ddf7c94198251 | refs/heads/master | 2021-09-03T21:10:17.765006 | 2018-01-12T01:16:23 | 2018-01-12T01:16:23 | 112,267,784 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 44,051 | 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 Interfaz;
import Adaptadores.AdaptadorSQLUI;
import Adaptadores.Comprobador;
import Adaptadores.ConectorDB;
import Adaptadores.MensajeUI;
import Dominio.Cliente;
import Dominio.Informacion_contacto;
import Dominio.Lugar;
import Dominio.Proveedor;
import java.awt.Color;
import java.sql.Date;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JPanel;
/**
*
* @author alexd
*/
public class DetalleClientes extends javax.swing.JPanel {
ConectorDB conector;
JPanel contenedor;
Cliente c;
JPanel panelMensaje;
ArrayList<String> permisos;
/**
* Creates new form PrincipalClientes
*/
public DetalleClientes(ConectorDB conector,JPanel contenedor,int id,JPanel panelMensaje,ArrayList<String> permisos) {
this.conector = conector;
this.contenedor = contenedor;
this.panelMensaje = panelMensaje;
this.permisos= permisos;
initComponents();
botonEliminar.setEnabled(permisos.contains("dcliente"));
botonGuardar.setEnabled(permisos.contains("ucliente"));
bAddInf.setEnabled(permisos.contains("ucliente"));
bDeInf.setEnabled(permisos.contains("ucliente"));
jlErrorFecha.setVisible(false);
jlErrorMonto.setVisible(false);
jlErrorNombre.setVisible(false);
jlErrorRif.setVisible(false);
jlErrorUbicacion.setVisible(false);
jlErrorInformacionTipo.setVisible(false);
jlErrorInformacionValor.setVisible(false);
jScrollPane2.getViewport().setBackground(AdaptadorSQLUI.fondoScrolls);
jScrollPane3.getViewport().setBackground(AdaptadorSQLUI.fondoTablas);
this.setSize(870, 610);
c = Cliente.buscarPorCodigo(conector, id);
if (c==null){
Lugar.llenarComboPaises(conector, jcbPais);
Lugar.llenarComboEstados(conector, jcbEstado,"");
Lugar.llenarComboMunicipios(conector, jcbMunicipio, "");
Lugar.llenarComboParroquias(conector, jcbParroquia, "","");
jcbMunicipio.setEnabled(false);
jcbEstado.setEnabled(false);
jcbParroquia.setEnabled(false);
panelInformacion.setVisible(false);
}
else{
llenarDatosCliente();
}
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jScrollPane2 = new javax.swing.JScrollPane();
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jtfRif = new javax.swing.JTextField();
jtfNombre = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
jtfMontoAcreditado = new javax.swing.JTextField();
jLabel4 = new javax.swing.JLabel();
jtfFechaInicio = new javax.swing.JTextField();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
jcbPais = new javax.swing.JComboBox<>();
jcbEstado = new javax.swing.JComboBox<>();
jLabel18 = new javax.swing.JLabel();
jcbMunicipio = new javax.swing.JComboBox<>();
jLabel19 = new javax.swing.JLabel();
jcbParroquia = new javax.swing.JComboBox<>();
jLabel20 = new javax.swing.JLabel();
jlErrorRif = new javax.swing.JLabel();
jlErrorNombre = new javax.swing.JLabel();
jlErrorMonto = new javax.swing.JLabel();
jlErrorFecha = new javax.swing.JLabel();
jlErrorUbicacion = new javax.swing.JLabel();
botonEliminar = new javax.swing.JButton();
botonGuardar = new javax.swing.JButton();
botonCancelar = new javax.swing.JButton();
panelInformacion = new javax.swing.JPanel();
jtfValor = new javax.swing.JTextField();
jlErrorInformacionTipo = new javax.swing.JLabel();
jtfTipo = new javax.swing.JTextField();
jLabel8 = new javax.swing.JLabel();
jLabel22 = new javax.swing.JLabel();
jScrollPane3 = new javax.swing.JScrollPane();
jTable2 = new javax.swing.JTable();
jLabel23 = new javax.swing.JLabel();
bAddInf = new javax.swing.JButton();
bDeInf = new javax.swing.JButton();
jLabel21 = new javax.swing.JLabel();
jlErrorInformacionValor = new javax.swing.JLabel();
setMinimumSize(new java.awt.Dimension(870, 610));
setOpaque(false);
setPreferredSize(new java.awt.Dimension(870, 610));
jScrollPane2.setMaximumSize(new java.awt.Dimension(1870, 1610));
jScrollPane2.setMinimumSize(new java.awt.Dimension(870, 610));
jScrollPane2.setPreferredSize(new java.awt.Dimension(850, 810));
jPanel1.setMaximumSize(new java.awt.Dimension(850, 32767));
jPanel1.setMinimumSize(new java.awt.Dimension(850, 810));
jPanel1.setOpaque(false);
jPanel1.setPreferredSize(new java.awt.Dimension(850, 810));
jLabel1.setFont(new java.awt.Font("Roboto", 1, 24)); // NOI18N
jLabel1.setForeground(new java.awt.Color(66, 66, 66));
jLabel1.setText("Cliente:");
jLabel1.setToolTipText("");
jLabel2.setFont(new java.awt.Font("Roboto", 0, 18)); // NOI18N
jLabel2.setText("RIF:");
jLabel2.setToolTipText("");
jLabel3.setFont(new java.awt.Font("Roboto", 0, 18)); // NOI18N
jLabel3.setText("Nombre:");
jLabel3.setToolTipText("");
jLabel4.setFont(new java.awt.Font("Roboto", 0, 18)); // NOI18N
jLabel4.setText("Monto Acreditado:");
jLabel4.setToolTipText("");
jtfFechaInicio.setToolTipText("");
jLabel5.setFont(new java.awt.Font("Roboto", 0, 18)); // NOI18N
jLabel5.setText("Fecha Inicio Operaciones:");
jLabel5.setToolTipText("");
jLabel6.setFont(new java.awt.Font("Roboto", 0, 14)); // NOI18N
jLabel6.setText("Pais:");
jLabel6.setToolTipText("");
jLabel7.setFont(new java.awt.Font("Roboto", 0, 18)); // NOI18N
jLabel7.setText("Ubicación:");
jLabel7.setToolTipText("");
jcbPais.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
jcbPais.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent evt) {
jcbPaisItemStateChanged(evt);
}
});
jcbPais.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jcbPaisActionPerformed(evt);
}
});
jcbEstado.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
jcbEstado.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jcbEstadoActionPerformed(evt);
}
});
jLabel18.setFont(new java.awt.Font("Roboto", 0, 14)); // NOI18N
jLabel18.setText("Estado:");
jLabel18.setToolTipText("");
jcbMunicipio.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
jcbMunicipio.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jcbMunicipioActionPerformed(evt);
}
});
jLabel19.setFont(new java.awt.Font("Roboto", 0, 14)); // NOI18N
jLabel19.setText("Municipio:");
jLabel19.setToolTipText("");
jcbParroquia.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
jcbParroquia.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jcbParroquiaActionPerformed(evt);
}
});
jLabel20.setFont(new java.awt.Font("Roboto", 0, 14)); // NOI18N
jLabel20.setText("Parroquia:");
jLabel20.setToolTipText("");
jlErrorRif.setFont(new java.awt.Font("Roboto", 0, 12)); // NOI18N
jlErrorRif.setForeground(new java.awt.Color(255, 0, 0));
jlErrorRif.setText("Error en el rif");
jlErrorRif.setToolTipText("");
jlErrorNombre.setFont(new java.awt.Font("Roboto", 0, 12)); // NOI18N
jlErrorNombre.setForeground(new java.awt.Color(255, 0, 0));
jlErrorNombre.setText("Error en el rif");
jlErrorNombre.setToolTipText("");
jlErrorMonto.setFont(new java.awt.Font("Roboto", 0, 12)); // NOI18N
jlErrorMonto.setForeground(new java.awt.Color(255, 0, 0));
jlErrorMonto.setText("Error en el rif");
jlErrorMonto.setToolTipText("");
jlErrorFecha.setFont(new java.awt.Font("Roboto", 0, 12)); // NOI18N
jlErrorFecha.setForeground(new java.awt.Color(255, 0, 0));
jlErrorFecha.setText("Error en el rif");
jlErrorFecha.setToolTipText("");
jlErrorUbicacion.setFont(new java.awt.Font("Roboto", 0, 12)); // NOI18N
jlErrorUbicacion.setForeground(new java.awt.Color(255, 0, 0));
jlErrorUbicacion.setText("Error en el rif");
jlErrorUbicacion.setToolTipText("");
botonEliminar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Interfaz/Imagenes/ic_delete_black_48dp_1x.png"))); // NOI18N
botonEliminar.setContentAreaFilled(false);
botonEliminar.setMaximumSize(new java.awt.Dimension(69, 48));
botonEliminar.setMinimumSize(new java.awt.Dimension(69, 48));
botonEliminar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
botonEliminarActionPerformed(evt);
}
});
botonGuardar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Interfaz/Imagenes/ic_check_black_48dp_1x.png"))); // NOI18N
botonGuardar.setContentAreaFilled(false);
botonGuardar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
botonGuardarActionPerformed(evt);
}
});
botonCancelar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Interfaz/Imagenes/ic_close_black_48dp_1x.png"))); // NOI18N
botonCancelar.setToolTipText("");
botonCancelar.setContentAreaFilled(false);
botonCancelar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
botonCancelarActionPerformed(evt);
}
});
panelInformacion.setOpaque(false);
jtfValor.setToolTipText("");
jlErrorInformacionTipo.setFont(new java.awt.Font("Roboto", 0, 12)); // NOI18N
jlErrorInformacionTipo.setForeground(new java.awt.Color(255, 0, 0));
jlErrorInformacionTipo.setText("Error en el rif");
jlErrorInformacionTipo.setToolTipText("");
jLabel8.setFont(new java.awt.Font("Roboto", 0, 18)); // NOI18N
jLabel8.setText("Informacion de contacto:");
jLabel8.setToolTipText("");
jLabel22.setFont(new java.awt.Font("Roboto", 0, 14)); // NOI18N
jLabel22.setText("Nueva:");
jLabel22.setToolTipText("");
jTable2.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
jTable2.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jTable2MouseClicked(evt);
}
});
jScrollPane3.setViewportView(jTable2);
jLabel23.setFont(new java.awt.Font("Roboto", 0, 14)); // NOI18N
jLabel23.setText("Tipo:");
jLabel23.setToolTipText("");
bAddInf.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Interfaz/Imagenes/ic_arrow_upward_black_24dp_1x.png"))); // NOI18N
bAddInf.setContentAreaFilled(false);
bAddInf.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bAddInfActionPerformed(evt);
}
});
bDeInf.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Interfaz/Imagenes/ic_delete_black_24dp_1x.png"))); // NOI18N
bDeInf.setContentAreaFilled(false);
bDeInf.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bDeInfActionPerformed(evt);
}
});
jLabel21.setFont(new java.awt.Font("Roboto", 0, 14)); // NOI18N
jLabel21.setText("Valor:");
jLabel21.setToolTipText("");
jlErrorInformacionValor.setFont(new java.awt.Font("Roboto", 0, 12)); // NOI18N
jlErrorInformacionValor.setForeground(new java.awt.Color(255, 0, 0));
jlErrorInformacionValor.setText("Error en el rif");
jlErrorInformacionValor.setToolTipText("");
javax.swing.GroupLayout panelInformacionLayout = new javax.swing.GroupLayout(panelInformacion);
panelInformacion.setLayout(panelInformacionLayout);
panelInformacionLayout.setHorizontalGroup(
panelInformacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 574, Short.MAX_VALUE)
.addGroup(panelInformacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelInformacionLayout.createSequentialGroup()
.addContainerGap()
.addGroup(panelInformacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 210, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(panelInformacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, panelInformacionLayout.createSequentialGroup()
.addComponent(jLabel22, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(bAddInf, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, panelInformacionLayout.createSequentialGroup()
.addGap(36, 36, 36)
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 294, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(bDeInf, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(panelInformacionLayout.createSequentialGroup()
.addGap(51, 51, 51)
.addGroup(panelInformacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(panelInformacionLayout.createSequentialGroup()
.addComponent(jLabel21, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jtfValor))
.addGroup(panelInformacionLayout.createSequentialGroup()
.addComponent(jLabel23, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jtfTipo, javax.swing.GroupLayout.PREFERRED_SIZE, 117, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(18, 18, 18)
.addGroup(panelInformacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jlErrorInformacionTipo, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jlErrorInformacionValor, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
);
panelInformacionLayout.setVerticalGroup(
panelInformacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 293, Short.MAX_VALUE)
.addGroup(panelInformacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelInformacionLayout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(panelInformacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(bDeInf, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(28, 28, 28)
.addGroup(panelInformacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel22, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(bAddInf, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelInformacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel23, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jtfTipo, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jlErrorInformacionTipo))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelInformacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel21, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jtfValor, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jlErrorInformacionValor))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
);
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1)
.addGap(118, 118, 118)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(panelInformacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 210, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jlErrorUbicacion, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 210, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jtfFechaInicio, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jlErrorFecha, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 210, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jtfMontoAcreditado, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jlErrorMonto, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 210, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jtfNombre, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 210, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jtfRif, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jlErrorRif, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jlErrorNombre, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(36, 36, 36)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel18, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel19, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel20, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(42, 42, 42)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(jcbMunicipio, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jcbEstado, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jcbPais, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jcbParroquia, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 6, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(botonGuardar, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(botonCancelar, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(botonEliminar, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addContainerGap())
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(70, 70, 70)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jtfRif, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jlErrorRif)))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jtfNombre, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jlErrorNombre)))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jtfMontoAcreditado, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jlErrorMonto))))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(botonGuardar, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(botonCancelar, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(botonEliminar, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jtfFechaInicio, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jlErrorFecha)))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jlErrorUbicacion))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jcbPais, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel18, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jcbEstado, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel19, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jcbMunicipio, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel20, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jcbParroquia, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(panelInformacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(28, 28, 28))
);
jScrollPane2.setViewportView(jPanel1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 826, Short.MAX_VALUE)
);
}// </editor-fold>//GEN-END:initComponents
private void jcbPaisItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jcbPaisItemStateChanged
}//GEN-LAST:event_jcbPaisItemStateChanged
private void jcbPaisActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcbPaisActionPerformed
Lugar.llenarComboEstados(conector, jcbEstado,(String)jcbPais.getSelectedItem());
Lugar.llenarComboMunicipios(conector, jcbMunicipio, "");
Lugar.llenarComboParroquias(conector, jcbParroquia, "","");
if(jcbPais.getSelectedIndex()>0){
jcbEstado.setEnabled(true);
jcbMunicipio.setEnabled(false);
jcbParroquia.setEnabled(false);
}
else{
jcbEstado.setEnabled(false);
jcbMunicipio.setEnabled(false);
jcbParroquia.setEnabled(false);
}
}//GEN-LAST:event_jcbPaisActionPerformed
private void jcbEstadoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcbEstadoActionPerformed
Lugar.llenarComboMunicipios(conector, jcbMunicipio, (String) jcbEstado.getSelectedItem());
Lugar.llenarComboParroquias(conector, jcbParroquia, "","");
if(jcbPais.getSelectedIndex()>0){
jcbMunicipio.setEnabled(true);
jcbParroquia.setEnabled(false);
}
else{
jcbMunicipio.setEnabled(false);
jcbParroquia.setEnabled(false);
}
}//GEN-LAST:event_jcbEstadoActionPerformed
private void jcbMunicipioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcbMunicipioActionPerformed
Lugar.llenarComboParroquias(conector, jcbParroquia,(String) jcbMunicipio.getSelectedItem() ,(String)jcbEstado.getSelectedItem());
if(jcbPais.getSelectedIndex()>0){
jcbParroquia.setEnabled(true);
}
else{
jcbParroquia.setEnabled(false);
}
}//GEN-LAST:event_jcbMunicipioActionPerformed
private void jcbParroquiaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcbParroquiaActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jcbParroquiaActionPerformed
private void botonCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonCancelarActionPerformed
PrincipalClientes nuevoPanel = new PrincipalClientes(conector,contenedor,panelMensaje,permisos);
contenedor.removeAll();
contenedor.add(nuevoPanel);
contenedor.updateUI();
}//GEN-LAST:event_botonCancelarActionPerformed
private void botonGuardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonGuardarActionPerformed
jlErrorRif.setVisible(false);
jlErrorNombre.setVisible(false);
jlErrorMonto.setVisible(false);
jlErrorFecha.setVisible(false);
boolean A = Comprobador.ComprobarInt(jtfRif, jlErrorRif);
boolean B = Comprobador.ComprobarString(jtfNombre, jlErrorNombre);
boolean C = Comprobador.ComprobarInt(jtfMontoAcreditado, jlErrorMonto);
boolean D = Comprobador.ComprobarDate(jtfFechaInicio, jlErrorFecha);
int fk_lugar = Lugar.fkDireccion(conector,jcbPais.getSelectedItem().toString(),jcbEstado.getSelectedItem().toString() , jcbMunicipio.getSelectedItem().toString(), jcbParroquia.getSelectedItem().toString());
if( A && B && C && D){
if (c==null){
Cliente c = new Cliente(Integer.parseInt(jtfRif.getText()),jtfNombre.getText(),Integer.parseInt(jtfMontoAcreditado.getText()),Date.valueOf(jtfFechaInicio.getText()),fk_lugar);
c.agregarADB(conector);
new Thread(new MensajeUI(panelMensaje,"Cliente agregado exitosamente",1)).start();
}
else{
c.setCli_rif(Integer.parseInt(jtfRif.getText()));
c.setCli_nombre(jtfNombre.getText());
c.setCli_monto_acreditado(Integer.parseInt(jtfMontoAcreditado.getText()));
c.setCli_fecha_inicio(Date.valueOf(jtfFechaInicio.getText()));
c.setFk_lug_codigo(fk_lugar);
c.modificarEnDB(conector);
new Thread(new MensajeUI(panelMensaje,"Cliente modificado exitosamente",1)).start();
}
PrincipalClientes nuevoPanel = new PrincipalClientes(conector,contenedor,panelMensaje,permisos);
contenedor.removeAll();
contenedor.add(nuevoPanel);
contenedor.updateUI();
}else{
new Thread(new MensajeUI(panelMensaje,"Los datos ingresados no son correctos",0)).start();
}
}//GEN-LAST:event_botonGuardarActionPerformed
private void botonEliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonEliminarActionPerformed
if (c==null){
}
else{
c.eliminarDeDB(conector);
new Thread(new MensajeUI(panelMensaje,"Cliente eliminado exitosamente",1)).start();
}
PrincipalClientes nuevoPanel = new PrincipalClientes(conector,contenedor,panelMensaje,permisos);
contenedor.removeAll();
contenedor.add(nuevoPanel);
contenedor.updateUI();
}//GEN-LAST:event_botonEliminarActionPerformed
private void bAddInfActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bAddInfActionPerformed
Informacion_contacto i = new Informacion_contacto(jtfValor.getText(),jtfTipo.getText(),c.getCli_rif(),3);
i.agregarADB(conector);
Informacion_contacto.llenarTablaInformacionCliente(conector, jTable2, c.getCli_rif());
}//GEN-LAST:event_bAddInfActionPerformed
private void bDeInfActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bDeInfActionPerformed
int fila = jTable2.getSelectedRow();
if (fila>=0){
int id = (Integer) jTable2.getValueAt(fila, 0);
Informacion_contacto i = Informacion_contacto.buscarPorCodigo(conector, id);
i.eliminarDeDB(conector);
Informacion_contacto.llenarTablaInformacionCliente(conector, jTable2, c.getCli_rif());
}
}//GEN-LAST:event_bDeInfActionPerformed
private void jTable2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTable2MouseClicked
int fila = jTable2.getSelectedRow();
if (fila>=0){
int id = (Integer) jTable2.getValueAt(fila, 0);
Informacion_contacto i = Informacion_contacto.buscarPorCodigo(conector, id);
jtfValor.setText(i.getInf_valor());
jtfTipo.setText(i.getInf_tipo());
}
}//GEN-LAST:event_jTable2MouseClicked
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton bAddInf;
private javax.swing.JButton bDeInf;
private javax.swing.JButton botonCancelar;
private javax.swing.JButton botonEliminar;
private javax.swing.JButton botonGuardar;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel18;
private javax.swing.JLabel jLabel19;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel20;
private javax.swing.JLabel jLabel21;
private javax.swing.JLabel jLabel22;
private javax.swing.JLabel jLabel23;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JTable jTable2;
private javax.swing.JComboBox<String> jcbEstado;
private javax.swing.JComboBox<String> jcbMunicipio;
private javax.swing.JComboBox<String> jcbPais;
private javax.swing.JComboBox<String> jcbParroquia;
private javax.swing.JLabel jlErrorFecha;
private javax.swing.JLabel jlErrorInformacionTipo;
private javax.swing.JLabel jlErrorInformacionValor;
private javax.swing.JLabel jlErrorMonto;
private javax.swing.JLabel jlErrorNombre;
private javax.swing.JLabel jlErrorRif;
private javax.swing.JLabel jlErrorUbicacion;
private javax.swing.JTextField jtfFechaInicio;
private javax.swing.JTextField jtfMontoAcreditado;
private javax.swing.JTextField jtfNombre;
private javax.swing.JTextField jtfRif;
private javax.swing.JTextField jtfTipo;
private javax.swing.JTextField jtfValor;
private javax.swing.JPanel panelInformacion;
// End of variables declaration//GEN-END:variables
private void llenarDatosCliente() {
jtfRif.setText(String.valueOf(c.getCli_rif()));
jtfRif.setEnabled(false);
jtfNombre.setText(c.getCli_nombre());
jtfMontoAcreditado.setText(String.valueOf(c.getCli_monto_acreditado()));
jtfFechaInicio.setText(c.getCli_fecha_inicio().toString());
Informacion_contacto.llenarTablaInformacionCliente(conector, jTable2, c.getCli_rif());
cargarDireccion();
}
private void cargarDireccion(){
List<Lugar> direccion = Lugar.obtenerDireccion(conector, c.getFk_lug_codigo());
for(Lugar l : direccion){
if (l.getLug_tipo().equals("Pais")){
jcbPais.removeAllItems();
jcbPais.addItem("Seleccione una opción...");
jcbPais.addItem(l.getLug_nombre());
jcbPais.setSelectedIndex(1);
}
else if (l.getLug_tipo().equals("Estado")){
jcbEstado.removeAllItems();
jcbEstado.addItem(l.getLug_nombre());
jcbEstado.setSelectedItem(0);
jcbEstado.setEnabled(false);
}
else if (l.getLug_tipo().equals("Municipio")){
jcbMunicipio.removeAllItems();
jcbMunicipio.addItem(l.getLug_nombre());
jcbMunicipio.setSelectedItem(0);
jcbMunicipio.setEnabled(false);
}
else if (l.getLug_tipo().equals("Parroquia")){
jcbParroquia.removeAllItems();
jcbParroquia.addItem(l.getLug_nombre());
jcbParroquia.setSelectedItem(0);
jcbParroquia.setEnabled(false);
}
}
}
}
| [
"alexdgn213@gmail.com"
] | alexdgn213@gmail.com |
4b173d70d78abb6cfcf7cba670f82dd500a35561 | d2eee6e9a3ad0b3fd2899c3d1cf94778615b10cb | /PROMISE/archives/xalan/2.7/org/apache/xalan/xsltc/dom/ForwardPositionIterator.java | e9f10261550b2765e81de92d2fb997d7edaca8f0 | [] | no_license | hvdthong/DEFECT_PREDICTION | 78b8e98c0be3db86ffaed432722b0b8c61523ab2 | 76a61c69be0e2082faa3f19efd76a99f56a32858 | refs/heads/master | 2021-01-20T05:19:00.927723 | 2018-07-10T03:38:14 | 2018-07-10T03:38:14 | 89,766,606 | 5 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,594 | java | package org.apache.xalan.xsltc.dom;
import org.apache.xalan.xsltc.runtime.BasisLibrary;
import org.apache.xml.dtm.DTMAxisIterator;
import org.apache.xml.dtm.ref.DTMAxisIteratorBase;
/**
* This iterator is a wrapper that always returns the position of
* a node in document order. It is needed for the case where
* a call to position() occurs in the context of an XSLT element
* such as xsl:for-each, xsl:apply-templates, etc.
*
* The getPosition() methods in DTMAxisIterators defined
* in DTMDefaultBaseIterators always return the position
* in document order, which is backwards for XPath in the
* case of the ancestor, ancestor-or-self, previous and
* previous-sibling.
*
* XSLTC implements position() with the
* BasisLibrary.positionF() method, and uses the
* DTMAxisIterator.isReverse() method to determine
* whether the result of getPosition() should be
* interpreted as being equal to position().
* But when the expression appears in apply-templates of
* for-each, the position() function operates in document
* order.
*
* The only effect of the ForwardPositionIterator is to force
* the result of isReverse() to false, so that
* BasisLibrary.positionF() calculates position() in a way
* that's consistent with the context in which the
* iterator is being used."
*
* (Apparently the correction of isReverse() occurs
* implicitly, by inheritance. This class also appears
* to maintain its own position counter, which seems
* redundant.)
*
* @deprecated This class exists only for backwards compatibility with old
* translets. New code should not reference it.
*/
public final class ForwardPositionIterator extends DTMAxisIteratorBase {
private DTMAxisIterator _source;
public ForwardPositionIterator(DTMAxisIterator source) {
_source = source;
}
public DTMAxisIterator cloneIterator() {
try {
final ForwardPositionIterator clone =
(ForwardPositionIterator) super.clone();
clone._source = _source.cloneIterator();
clone._isRestartable = false;
return clone.reset();
}
catch (CloneNotSupportedException e) {
BasisLibrary.runTimeError(BasisLibrary.ITERATOR_CLONE_ERR,
e.toString());
return null;
}
}
public int next() {
return returnNode(_source.next());
}
public DTMAxisIterator setStartNode(int node) {
_source.setStartNode(node);
return this;
}
public DTMAxisIterator reset() {
_source.reset();
return resetPosition();
}
public void setMark() {
_source.setMark();
}
public void gotoMark() {
_source.gotoMark();
}
}
| [
"hvdthong@github.com"
] | hvdthong@github.com |
08dac130539834fde59ab3c5bc39cacdabb183b2 | 89e1811c3293545c83966995cb000c88fc95fa79 | /MCHH-boss/src/main/java/com/threefiveninetong/mchh/core/aop/AopException.java | 92852aaedb53ec061546643ea16b25e804066e0b | [] | no_license | wxddong/MCHH-parent | 9cafcff20d2f36b5d528fd8dd608fa9547327486 | 2898fdf4e778afc01b850d003899f25005b8e415 | refs/heads/master | 2021-01-01T17:25:29.109072 | 2017-07-23T02:28:59 | 2017-07-23T02:28:59 | 96,751,862 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,382 | java | package com.threefiveninetong.mchh.core.aop;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.HandlerExceptionResolver;
import org.springframework.web.servlet.ModelAndView;
import com.threefiveninetong.mchh.core.base.BaseVO;
import com.threefiveninetong.mchh.util.ExceptionUrl;
import com.threefiveninetong.mchh.util.SystemException;
//拦截异常
public class AopException implements HandlerExceptionResolver {
private static final Logger logger = LoggerFactory.getLogger(AopException.class);
private ReloadableResourceBundleMessageSource messageSource;
public void setMessageSource(
ReloadableResourceBundleMessageSource messageSource) {
this.messageSource = messageSource;
}
@Override
public ModelAndView resolveException(HttpServletRequest request,
HttpServletResponse response, Object handler, Exception ex) {
String messageFial;
HandlerMethod handlerMethod = (HandlerMethod) handler;
Class<?> cla = handlerMethod.getMethod().getReturnType();
Annotation[] methodAnnotations = handlerMethod.getMethod()
.getAnnotations();
Object obj = null;
String key = null;
Map<String, Object> model = new HashMap<String, Object>();
if (ex instanceof SystemException) {
SystemException sysex = (SystemException) ex;
if (sysex.getValues() != null
&& sysex.getKey() != null && !"".equals(sysex.getKey())) {
key = sysex.getKey();
messageFial = messageSource.getMessage(sysex.getKey(), sysex
.getValues(), null);
} else if (sysex.getMessage() != null
&& !"".equals(sysex.getMessage())) {
messageFial = sysex.getMessage();
} else if (sysex.getKey() != null && !"".equals(sysex.getKey())) {
key = sysex.getKey();
messageFial = messageSource.getMessage(sysex.getKey(), sysex
.getValues(), null);
} else {
messageFial = "系统异常";
}
} else {
messageFial = "系统异常";
}
logger.error(ex.getMessage(),ex);
ex.printStackTrace();
if (validateJson(methodAnnotations)) {
try {
if (cla.newInstance() instanceof ModelAndView) {
BaseVO vo=new BaseVO();
vo.setMessage(messageFial);
vo.setStatusCode(key);
model.put("data", vo);
}else{
obj = cla.newInstance();
setter(obj, "Message", messageFial, String.class);
setter(obj, "StatusCode", key, String.class);// 所有验证异常错误码为-200
model.put("data", obj);
}
} catch (Exception e) {
e.printStackTrace();
}
} else {
/*
* model.put("data", messageFial); String
* url=this.validateArg(methodAnnotations); return new
* ModelAndView(url,model);
*/
try {
if (cla.newInstance() instanceof ModelAndView) {
BaseVO vo=new BaseVO();
vo.setMessage(messageFial);
vo.setStatusCode(key);
model.put("data", vo);
}else{
obj = cla.newInstance();
setter(obj, "Message", messageFial, String.class);
setter(obj, "StatusCode", key, String.class);// 所有验证异常错误码为-200
model.put("data", obj);
}
} catch (Exception e) {
e.printStackTrace();
}
}
return new ModelAndView("jsonView", model);
}
public static void setter(Object obj, String att, Object value,
Class<?> type) {
try {
Method method = obj.getClass().getMethod("set" + att, type);
method.invoke(obj, value);
} catch (Exception e) {
e.printStackTrace();
}
}
private boolean validateJson(Annotation[] methodAnnotations) {
if (null != methodAnnotations) {
for (Annotation anotation : methodAnnotations) {
if (ResponseBody.class.isInstance(anotation)) {
return true;
}
}
}
return false;
}
private String validateArg(Annotation[] methodAnnotations) {
if (null != methodAnnotations) {
for (Annotation anotation : methodAnnotations) {
if (ExceptionUrl.class.isInstance(anotation)) {
ExceptionUrl url = (ExceptionUrl) anotation;
return url.url();
}
}
}
return null;
}
}
| [
"wxd_1024@163.com"
] | wxd_1024@163.com |
59127a87f2e4c48e0de27940e3548ec68c7a89f4 | e7164e4e7aaed8382306c03881e2d39a6444f530 | /backend-app/src/main/java/com/example/reactproject/exception/CustomResponseEntityExceptionHandler.java | 1637a937b7c200e7b5c27f80025f8d74cde4a5e1 | [] | no_license | Yasin2034/SpringBoot-React-Project-Management | b65719f9698fddfd4f0bb34a5100f14eb4b74370 | 7a43fea6babe58605965666bb7e34a2a1a6514fa | refs/heads/master | 2022-12-15T15:19:50.573701 | 2020-04-24T21:27:20 | 2020-04-24T21:27:20 | 257,353,794 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,223 | java | package com.example.reactproject.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;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.request.WebRequest;
import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;
@ControllerAdvice
@RestController
public class CustomResponseEntityExceptionHandler extends ResponseEntityExceptionHandler {
@ExceptionHandler
public final ResponseEntity<Object> handlerProjectIdException(ProjectIdException ex,WebRequest req){
ProjectIdExceptionResponse exceptionResponse = new ProjectIdExceptionResponse(ex.getMessage());
return new ResponseEntity(exceptionResponse,HttpStatus.BAD_REQUEST);
}
@ExceptionHandler
public final ResponseEntity<Object> handlerProjectNotFoundException(ProjectNotFoundException ex,WebRequest req){
ProjectNotFoundExceptionResponse exceptionResponse = new ProjectNotFoundExceptionResponse(ex.getMessage());
return new ResponseEntity(exceptionResponse,HttpStatus.BAD_REQUEST);
}
}
| [
"yasinhesap05@gmail.com"
] | yasinhesap05@gmail.com |
ee532af747de78a60a9143daf4cdb5b8c0d4848c | 8450380a5e698cb7079084dcc0a4d8248c71f734 | /app/src/main/java/com/example/piggybank/ui/report/ReportFragment.java | dc4ba1e0fff0a9be47a3763f89d724b3539935fb | [] | no_license | hemonJuice/PiggyBank | 5ba1665bcd2a7a7f236bd586744d1a64c7cda17e | 41ccd716738ada71bdba2a83b4f01e20e394ebd5 | refs/heads/master | 2023-04-23T16:57:55.546907 | 2021-05-05T02:59:19 | 2021-05-05T02:59:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,169 | java | package com.example.piggybank.ui.report;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider;
import com.example.piggybank.R;
public class ReportFragment extends Fragment {
private ReportViewModel reportViewModel;
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
reportViewModel =
new ViewModelProvider(this).get(ReportViewModel.class);
View root = inflater.inflate(R.layout.fragment_report, container, false);
final TextView textView = root.findViewById(R.id.text_report);
reportViewModel.getText().observe(getViewLifecycleOwner(), new Observer<String>() {
@Override
public void onChanged(@Nullable String s) {
textView.setText(s);
}
});
return root;
}
} | [
"wilsonhuang0326@gmail.com"
] | wilsonhuang0326@gmail.com |
980e26e57884ba09d480b4f92fa1fe9331bac53c | 93e2fdf0a4a691e00630a4938195ed273f8b4dc4 | /e3-manager-web/src/main/java/org/e3/controller/ItemController.java | 62b957248784153e00f00d0af6fbd99e301eb160 | [] | no_license | suixinghero/e3 | 4633fe73968b0446ef1e1397594ae3fd2313fc38 | 9ef7f048282840c2279e58e1c5f09d54673ef5a6 | refs/heads/master | 2022-12-25T16:19:38.030285 | 2019-10-14T09:47:53 | 2019-10-14T09:47:53 | 212,588,303 | 0 | 1 | null | 2022-12-16T07:15:34 | 2019-10-03T13:33:35 | JavaScript | UTF-8 | Java | false | false | 1,381 | java | package org.e3.controller;
import org.e3.common.util.E3Result;
import org.e3.pojo.TbItem;
import org.e3.service.ItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.Map;
/**
* @author xujin
* @package-name org.e3.controller
* @createtime 2019-10-02 22:41
*/
@Controller
@RequestMapping("/item")
public class ItemController {
@Autowired
private ItemService itemService;
@RequestMapping("/{itemId}")
@ResponseBody
public TbItem getItemById(@PathVariable(value = "itemId")Long itemId){
TbItem tbItem= itemService.getItemlById(itemId);
return tbItem;
}
@RequestMapping("/list")
@ResponseBody
public Map<String,Object> getItemList(Integer page,Integer rows){
Map<String,Object> map=itemService.getItemList(page,rows);
return map;
}
@RequestMapping(value = "/save",method = RequestMethod.POST)
@ResponseBody
public E3Result addItem(TbItem tbItem,String desc){
E3Result e3Result=itemService.addItem(tbItem,desc);
return e3Result;
}
}
| [
"2623062011@qq.com"
] | 2623062011@qq.com |
d594a9e542443299e19a629abb0a6d18f7e8c5d9 | cdd011950f944a7c7c91feede249a4424f027bf5 | /bmc-core/src/main/java/com/oracle/bmc/core/responses/CreateRemotePeeringConnectionResponse.java | ee129ac75b2d014c8f08354bf9f56caf7e23246c | [
"UPL-1.0",
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | kpanwar/oci-java-sdk | 1f769ddb34c37f5c939b8dad43c42e249b0551d4 | b60d045abad0e68e20b50139516a879751dc33a2 | refs/heads/master | 2020-04-13T03:52:19.405231 | 2018-12-13T17:55:00 | 2018-12-13T17:55:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,263 | java | /**
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
*/
package com.oracle.bmc.core.responses;
import com.oracle.bmc.core.model.*;
@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20160918")
@lombok.Builder(builderClassName = "Builder")
@lombok.Getter
public class CreateRemotePeeringConnectionResponse {
/**
* For optimistic concurrency control. See `if-match`.
*/
private String etag;
/**
* Unique Oracle-assigned identifier for the request. If you need to contact Oracle about
* a particular request, please provide the request ID.
*
*/
private String opcRequestId;
/**
* The returned RemotePeeringConnection instance.
*/
private RemotePeeringConnection remotePeeringConnection;
public static class Builder {
/**
* Copy method to populate the builder with values from the given instance.
* @return this builder instance
*/
public Builder copy(CreateRemotePeeringConnectionResponse o) {
etag(o.getEtag());
opcRequestId(o.getOpcRequestId());
remotePeeringConnection(o.getRemotePeeringConnection());
return this;
}
}
}
| [
"juan.alvarado@oracle.com"
] | juan.alvarado@oracle.com |
a7b783d33c1b8655da25c5e2c1f3a4ac2301c0bf | 7630087033c1e1e1e13bcef80e3c3b20317a10db | /GerenciamentoPessoas/src/main/java/br/mp/mpt/gerentepessoas/util/jpa/Transactional.java | c69345bf94af1ddc5681c3722b295e874331a95f | [] | no_license | th3g3ntl3m4n84/GerenciamentoPessoas | 689a3b9eea7ec10aa10fc6e89bc3b1cdde48e537 | 44d9e507007ec35c3e11141c61ef0b42a0756e97 | refs/heads/master | 2021-06-05T17:09:40.121227 | 2016-08-15T18:10:48 | 2016-08-15T18:10:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 435 | java | /**
*
*/
package br.mp.mpt.gerentepessoas.util.jpa;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import javax.interceptor.InterceptorBinding;
/**
* @author joao
*
*/
@InterceptorBinding
@Retention(RetentionPolicy.RUNTIME)
@Target( {ElementType.TYPE, ElementType.METHOD} )
public @interface Transactional {
}
| [
"jpfguedes@gmail.com"
] | jpfguedes@gmail.com |
fc29910afb247995ed64f77bb8d1165a2096fe28 | 139960e2d7d55e71c15e6a63acb6609e142a2ace | /mobile_app1/module241/src/main/java/module241packageJava0/Foo320.java | e54c1a5af5e57f82ba8ec9ecc59113191d2c61ea | [
"Apache-2.0"
] | permissive | uber-common/android-build-eval | 448bfe141b6911ad8a99268378c75217d431766f | 7723bfd0b9b1056892cef1fef02314b435b086f2 | refs/heads/master | 2023-02-18T22:25:15.121902 | 2023-02-06T19:35:34 | 2023-02-06T19:35:34 | 294,831,672 | 83 | 7 | Apache-2.0 | 2021-09-24T08:55:30 | 2020-09-11T23:27:37 | Java | UTF-8 | Java | false | false | 374 | java | package module241packageJava0;
import java.lang.Integer;
public class Foo320 {
Integer int0;
public void foo0() {
new module241packageJava0.Foo319().foo5();
}
public void foo1() {
foo0();
}
public void foo2() {
foo1();
}
public void foo3() {
foo2();
}
public void foo4() {
foo3();
}
public void foo5() {
foo4();
}
}
| [
"oliviern@uber.com"
] | oliviern@uber.com |
e8a30ded4fb06749aea3611053cbd520a13c13c3 | 7fb10d87ef9eda8a2b0b39f5ec876f02d08cd621 | /java-source-example/jdk8u40-source/resource/com/sun/corba/se/spi/activation/LocatorPackage/ServerLocationHolder.java | d81599236f5415989b061d8bd609893ed84011e7 | [] | no_license | SexCastException/java | 77873efe81a8f2495356a5c33b97996993e121c4 | 7997885a3e2c62423d886978016a1ce02d39e44b | refs/heads/master | 2022-05-09T13:42:12.379628 | 2022-04-14T06:29:32 | 2022-04-14T06:29:32 | 190,780,380 | 0 | 0 | null | 2022-04-14T06:29:33 | 2019-06-07T17:02:54 | Java | UTF-8 | Java | false | false | 1,206 | java | package com.sun.corba.se.spi.activation.LocatorPackage;
/**
* com/sun/corba/se/spi/activation/LocatorPackage/ServerLocationHolder.java .
* Generated by the IDL-to-Java compiler (portable), version "3.2"
* from c:/re/workspace/8-2-build-owindows-i586-cygwin/jdk8u40/2855/corba/src/share/classes/com/sun/corba/se/spi/activation/activation.idl
* Tuesday, February 10, 2015 10:07:59 PM PST
*/
public final class ServerLocationHolder implements org.omg.CORBA.portable.Streamable
{
public com.sun.corba.se.spi.activation.LocatorPackage.ServerLocation value = null;
public ServerLocationHolder ()
{
}
public ServerLocationHolder (com.sun.corba.se.spi.activation.LocatorPackage.ServerLocation initialValue)
{
value = initialValue;
}
public void _read (org.omg.CORBA.portable.InputStream i)
{
value = com.sun.corba.se.spi.activation.LocatorPackage.ServerLocationHelper.read (i);
}
public void _write (org.omg.CORBA.portable.OutputStream o)
{
com.sun.corba.se.spi.activation.LocatorPackage.ServerLocationHelper.write (o, value);
}
public org.omg.CORBA.TypeCode _type ()
{
return com.sun.corba.se.spi.activation.LocatorPackage.ServerLocationHelper.type ();
}
}
| [
"pyh@qq.com"
] | pyh@qq.com |
33e4552bd8fbd46b04b349c7c095ec3670582c27 | 0fd64559b9bb49ff7399726cb2ae18cbb8e85eb9 | /PricingStrategyFactory.java | 82561fcc4ae6b835af3770f184d23f544dcf5d59 | [] | no_license | test1855/java- | 54ce7b2d1286d44f19e5868a478d573a12374be0 | 2a8e14a756781ab5ad567766dd7f14df0e5b3ad5 | refs/heads/master | 2021-06-29T21:07:49.514966 | 2017-09-14T22:58:26 | 2017-09-14T22:58:26 | 103,589,824 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 519 | java | package CartSystem;
import java.util.Enumeration;
public class PricingStrategyFactory {
private PricingStrategyFactory instance;
public PricingStrategyFactory getInstance()
{
return instance;
}
public IPricingStrategy getPricingStrategy(int bookType)
{
Enumeration<IPricingStrategy> s=Global.strategycatalog.strategies.elements();
while(s.hasMoreElements()){
IPricingStrategy temp=s.nextElement();
if(temp.getFitType()==bookType)
return temp;
}
return null;
}
}
| [
"noreply@github.com"
] | test1855.noreply@github.com |
5d7456b174dc3769bdf7df770d5c203e4b555ddf | 48acea5bcdbf5fa52f1baf57421f37c9d19a6cc4 | /Click2Wish/app/src/androidTest/java/com/example/pavilion/click2wish/ExampleInstrumentedTest.java | df70f1926b4fa47ae7bb5e71990c8aadb8455e54 | [] | no_license | ashish1110/click2wish | d64a5139d2806f7cf61f3686531a56d780019f76 | f25cacf0e44b63a235d71c1fa4c447a4ebf7ab2c | refs/heads/master | 2020-03-09T02:51:00.909390 | 2018-04-07T17:21:47 | 2018-04-07T17:21:47 | 128,550,285 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 766 | java | package com.example.pavilion.click2wish;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.pavilion.click2wish", appContext.getPackageName());
}
}
| [
"ashishg501@gmail.com"
] | ashishg501@gmail.com |
e864a6973e0a3cd699f3032aad4abc0c2dd85722 | 5724e8e305084406178823344dfdeefc3e7a4ee5 | /src/Position.java | 0c54152a2a99f4277b16c37f75fdd457bc13908f | [] | no_license | laithithanhtrang/btvn-buoi12 | 321ce15290f9e71994fda5266afdf3bd7f2e2f0c | 4f07edf8662ed70620190c976924dacdb4fd9ae1 | refs/heads/master | 2023-03-25T01:09:19.437507 | 2021-03-19T03:12:39 | 2021-03-19T03:12:39 | 349,285,175 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 44 | java |
public enum Position {
GK, DF, MF, FW
} | [
"trangltt@edmicro.vn"
] | trangltt@edmicro.vn |
754aef5455339760ca3a39f67ccea9ec627bed5d | 70aa289a7350d0d3cc87d11758e2e37f1386a59d | /app/src/main/java/com/mingchu/positiondetaidemo/NewQuestionBean.java | f5fb00e57caf68622ed60a052c93ca047dab6151 | [] | no_license | wuyinlei/PositionDetaiDemo | 72237ee4d847cd0f984320c82c155c6c932e3e62 | 31e8d5f38609c9703d76d1cedb06993fec4df5d6 | refs/heads/master | 2021-01-22T21:03:27.932607 | 2017-03-18T08:52:48 | 2017-03-18T08:52:48 | 85,387,960 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,077 | java | package com.mingchu.positiondetaidemo;
import java.io.Serializable;
/**
* Created by wuyinlei on 2017/3/10.
*/
public class NewQuestionBean implements Serializable {
String content;
String username;
String answercount;
String attentioncount;
String type;
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getAnswercount() {
return answercount;
}
public void setAnswercount(String answercount) {
this.answercount = answercount;
}
public String getAttentioncount() {
return attentioncount;
}
public void setAttentioncount(String attentioncount) {
this.attentioncount = attentioncount;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}
| [
"power1118wu@gmail.com"
] | power1118wu@gmail.com |
dda6e2ae9e9c1220e89224bdbfa1cb7f0352dd63 | caadafcdfd9bfd61592af1642bcdf0da1a24da56 | /Documents/NetBeansProjects/project_Hakeko/src/main/java/com/mycompany/project_hakeko/service/UniversiteFacade.java | 2a325d3184c2c49a90b923b8a66941ea4f34b445 | [] | no_license | sanata1/project_Hakeko | eba81b26b90c69ef94a2c4d12529a77d2e175204 | b27f9224d746cb57f2cde75e2865470daea0cc33 | refs/heads/master | 2020-03-23T00:17:56.909054 | 2018-07-13T14:55:40 | 2018-07-13T14:55:40 | 140,855,185 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 822 | 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.mycompany.project_hakeko.service;
import com.mycompany.project_hakeko.bean.Universite;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
/**
*
* @author Owner
*/
@Stateless
public class UniversiteFacade extends AbstractFacade<Universite> {
@PersistenceContext(unitName = "com.mycompany_project_Hakeko_war_1.0-SNAPSHOTPU")
private EntityManager em;
@Override
protected EntityManager getEntityManager() {
return em;
}
public UniversiteFacade() {
super(Universite.class);
}
}
| [
"sanogosanata15@gmail.com"
] | sanogosanata15@gmail.com |
c9371284a760ccb5860e75eac22fcfab49497013 | 88f2925e7d658393258e62629c40cea1eded51b6 | /core/src/main/java/com/bamboo/core/base/exception/ServiceException.java | acf9d40a97b30bcb73fee6a02b4f37eda068f5a6 | [] | no_license | yongkunlin/parent | d9ce8c70b87bcc1ab862122554f99290f7e32b39 | dacad8a6e64abfb6a17f583ebb8a3f4b625cfba3 | refs/heads/master | 2020-03-23T09:30:24.269480 | 2018-07-27T02:02:48 | 2018-07-27T02:02:48 | 141,391,797 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,321 | java | package com.bamboo.core.base.exception;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* 服务异常封装
* Created by yklin on 2018/5/28.
*/
public class ServiceException extends BaseException {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
public ServiceException() {
super();
}
public ServiceException(String message, String methodName) {
super(message);
logger.error(methodName + ":{}", message);
}
public ServiceException(String message, String methodName, Throwable cause) {
super(message, cause);
logger.error(methodName + ":{}", processTrace(cause));
}
private String processTrace(Throwable e) {
if (null != e && e.getStackTrace() != null) {
StackTraceElement stackTraceElement = e.getStackTrace()[0];
StringBuffer sb = new StringBuffer();
sb.append("--error messag detail:").append(e.toString()).append(",").append("file=")
.append(stackTraceElement.getFileName()).append(",").append("line=")
.append(stackTraceElement.getLineNumber()).append(",").append("method=")
.append(stackTraceElement.getMethodName());
return sb.toString();
}
return null;
}
}
| [
"1843515130@qq.com"
] | 1843515130@qq.com |
80b26939f9fd93deacf1d5e7033109077700ff16 | 53348a9737260d3ef4c3ccd48cc0c18687ce97b6 | /src/main/java/com/ships/repositories/ShipRepository.java | 0e8421c86b53b4d9fe9723cddc6e44fd309a1316 | [] | no_license | CathalRyan96/Server-Side-RAD-Project | b76e28299f8b0e1ce212677dd7ff5832c651805b | fd164fd6a83fd35cd5dac1b5f8488266c432d47b | refs/heads/master | 2020-03-11T03:29:29.845074 | 2018-04-27T09:25:35 | 2018-04-27T09:25:35 | 129,748,993 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 259 | java | package com.ships.repositories;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import com.ships.model.Ship;
@Repository
public interface ShipRepository
extends CrudRepository<Ship, Long> {
}
| [
"cathalryan48@gmail.com"
] | cathalryan48@gmail.com |
6cc675478cd6e3953a42f774236239619d6c4a3a | 2dcc440fa85d07e225104f074bcf9f061fe7a7ae | /gameserver/src/main/java/org/mmocore/gameserver/skills/effects/Effect_i_sp.java | bc28aa1d01177a85712e1aa634e57d3ed6e23aa1 | [] | no_license | VitaliiBashta/L2Jts | a113bc719f2d97e06db3e0b028b2adb62f6e077a | ffb95b5f6e3da313c5298731abc4fcf4aea53fd5 | refs/heads/master | 2020-04-03T15:48:57.786720 | 2018-10-30T17:34:29 | 2018-10-30T17:35:04 | 155,378,710 | 0 | 3 | null | null | null | null | UTF-8 | Java | false | false | 810 | java | package org.mmocore.gameserver.skills.effects;
import org.mmocore.gameserver.model.Effect;
import org.mmocore.gameserver.object.Creature;
import org.mmocore.gameserver.object.Player;
import org.mmocore.gameserver.skills.SkillEntry;
/**
* @author : Mangol
*/
public class Effect_i_sp extends Effect {
private final int _power;
public Effect_i_sp(final Creature creature, final Creature target, final SkillEntry skill, final EffectTemplate template) {
super(creature, target, skill, template);
_power = template.getParam().getInteger("argument", 0);
}
@Override
public void onStart() {
Player player = (Player) getEffector();
player.addExpAndSp(0, (long) _power);
}
@Override
protected boolean onActionTime() {
return false;
}
}
| [
"Vitalii.Bashta@accenture.com"
] | Vitalii.Bashta@accenture.com |
012a69d9e62e8caa085010adf59380ecb6a79614 | 485b13c4ef82a7fb5c55596d008ed6873552cbb0 | /decorator_test/src/main/java/org/firewater/decorator/decoratorv2/NoodlesDecorator.java | db451dc33272d135eed5ab347bf09fc243b82a1c | [] | no_license | xubo001/designPattern | aa357387e0b1a6d249aed42e59ffa1ebe3cc0ca2 | 3bbf9b8d7c63b00517bf82cdf86c1f31fbd9e76f | refs/heads/master | 2022-12-11T03:51:07.033260 | 2020-09-03T02:35:37 | 2020-09-03T02:35:37 | 289,821,317 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 406 | java | package org.firewater.decorator.decoratorv2;
public abstract class NoodlesDecorator extends NoodlesBase{
private Noodles noodles;
public NoodlesDecorator(Noodles noodles) {
this.noodles = noodles;
}
protected NoodlesDecorator() {
}
public String getMsg(){
return noodles.getMsg();
}
public int getPrice(){
return noodles.getPrice();
}
}
| [
"xb3dcs1021@aliyun.com"
] | xb3dcs1021@aliyun.com |
2d28bda43c16b1261fc3801bfe76e67cd71661b8 | e48d0ec33dc90a213feefc588007675f693fa935 | /src/test/java/com/tinkoff/edu/AppTest.java | 799d67c50abb689c129d9ad7aa46ae96e1dde35c | [] | no_license | NatalyaVinogradova/qa-automation-java | 73fe69dbe8e739e5093235d829375a8649b7e753 | a16dd0dbbff06a32c18510a432ba9e9c0ad318e7 | refs/heads/main | 2023-08-06T14:33:16.618160 | 2021-09-17T08:25:10 | 2021-09-17T08:25:10 | 392,309,735 | 0 | 0 | null | 2021-09-15T15:44:21 | 2021-08-03T12:27:04 | Java | UTF-8 | Java | false | false | 6,941 | java | package com.tinkoff.edu;
import com.tinkoff.edu.app.controllers.LoanCalcController;
import com.tinkoff.edu.app.models.LoanBusinessException;
import com.tinkoff.edu.app.models.LoanRequest;
import com.tinkoff.edu.app.repositories.ArrayLoanCalcRepository;
import com.tinkoff.edu.app.services.ConcreteLoanCalcService;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static com.tinkoff.edu.app.enums.LoanType.*;
import static com.tinkoff.edu.app.enums.ResponseType.APPROVED;
import static com.tinkoff.edu.app.enums.ResponseType.DENIED;
import static org.junit.jupiter.api.Assertions.*;
/**
* Created on 11.08.2021
*
* @author Natalya Vinogradova
*/
public class AppTest {
private LoanRequest request;
private LoanCalcController controller;
@BeforeEach
public void init() {
request = new LoanRequest(PERSON, 10000, 12, "Иван Блинов");
controller = new LoanCalcController(new ConcreteLoanCalcService(new ArrayLoanCalcRepository()));
}
// @Test
// public void shouldGet1WhenFirstRequest() {
// LoanResponse response = controller.createRequest(request);
// assertEquals(1, response.getRequestId());
// }
// @Test
// public void shouldGetIncrementedIdWhenAnyCall() {
// controller = new LoanCalcController(new ConcreteLoanCalcService(new VariableLoanCalcRepository(2)));
// assertEquals(3, controller.createRequest(request).getRequestId());
// assertEquals(4, controller.createRequest(request).getRequestId());
// }
@Test
public void shouldGetErrorWhenApplyNullRequest() {
assertThrows(LoanBusinessException.class, () -> {
controller.createRequest(null);
});
}
@Test
public void shouldGetErrorWhenApplyZeroOrNegativeAmountRequest() {
request = new LoanRequest(PERSON, 0, 10, "Антон Семенов");
assertThrows(LoanBusinessException.class, () -> {
controller.createRequest(request);
});
request = new LoanRequest(PERSON, -10, 10, "Антон Семенов");
assertThrows(LoanBusinessException.class, () -> {
controller.createRequest(request);
});
}
@Test
public void shouldGetErrorWhenApplyZeroOrNegativeMonthsRequest() {
request = new LoanRequest(PERSON, 1000, 0, "Анна Петрова");
assertThrows(LoanBusinessException.class, () -> {
controller.createRequest(request);
});
request = new LoanRequest(PERSON, 1000, -10, "Анна Петрова");
assertThrows(LoanBusinessException.class, () -> {
controller.createRequest(request);
});
}
@Test
public void shouldGetApprovedWhenPersonLess10000Less12() {
request = new LoanRequest(PERSON, 9000, 11, "Анна Петрова");
assertEquals(APPROVED, controller.createRequest(request).getType());
}
@Test
public void shouldGetApprovedWhenPersonEquals10000Equals12() {
request = new LoanRequest(PERSON, 10000, 12, "Анна Петрова");
assertEquals(APPROVED, controller.createRequest(request).getType());
}
@Test
public void shouldGetApprovedWhenPersonLess10000Equals12() {
request = new LoanRequest(PERSON, 9000, 12, "Иван Блинов");
assertEquals(APPROVED, controller.createRequest(request).getType());
}
@Test
public void shouldGetApprovedWhenPersonEquals10000Less12() {
request = new LoanRequest(PERSON, 10000, 9, "Иван Блинов");
assertEquals(APPROVED, controller.createRequest(request).getType());
}
@Test
public void shouldGetDeniedWhenPersonMore10000Amount() {
request = new LoanRequest(PERSON, 11000, 11, "Иван Блинов");
assertEquals(DENIED, controller.createRequest(request).getType());
}
@Test
public void shouldGetDeniedWhenPersonMore12Months() {
request = new LoanRequest(PERSON, 9000, 13, "Антон Семенов");
assertEquals(DENIED, controller.createRequest(request).getType());
}
@Test
public void shouldGetApprovedWhenOooMore10000Less12() {
request = new LoanRequest(OOO, 15000, 11, "ООО Армада");
assertEquals(APPROVED, controller.createRequest(request).getType());
}
@Test
public void shouldGetDeniedWhenOooLess10000More12() {
request = new LoanRequest(OOO, 5000, 15, "ООО Армада");
assertEquals(DENIED, controller.createRequest(request).getType());
}
@Test
public void shouldGetDeniedWhenOooLess10000Less12() {
request = new LoanRequest(OOO, 5000, 6, "ООО Армада");
assertEquals(DENIED, controller.createRequest(request).getType());
}
@Test
public void shouldGetDeniedWhenOooEquals10000More12() {
request = new LoanRequest(OOO, 10000, 15, "ООО Котики");
assertEquals(DENIED, controller.createRequest(request).getType());
}
@Test
public void shouldGetDeniedWhenOooEquals10000Less12() {
request = new LoanRequest(OOO, 10000, 1, "ООО Пёсики");
assertEquals(DENIED, controller.createRequest(request).getType());
}
@Test
public void shouldGetDeniedWhenOooLess10000Equals12() {
request = new LoanRequest(OOO, 9000, 12, "ООО Котики");
assertEquals(DENIED, controller.createRequest(request).getType());
}
@Test
public void shouldGetDeniedWhenOooMore10000More12() {
request = new LoanRequest(OOO, 15000, 15, "ООО Пёсики");
assertEquals(DENIED, controller.createRequest(request).getType());
}
@Test
public void shouldGetDeniedWhenOooMore10000Equals12() {
request = new LoanRequest(OOO, 15000, 12, "ООО Котики");
assertEquals(DENIED, controller.createRequest(request).getType());
}
@Test
public void shouldGetDeniedWhenOooEquals10000Equals12() {
request = new LoanRequest(OOO, 10000, 12, "ООО Пёсики");
assertEquals(DENIED, controller.createRequest(request).getType());
}
@Test
public void shouldGetDeniedWhenIp() {
request = new LoanRequest(IP, 10000, 12, "ИП Редиска");
assertEquals(DENIED, controller.createRequest(request).getType());
request = new LoanRequest(IP, 15000, 13, "ИП Редиска");
assertEquals(DENIED, controller.createRequest(request).getType());
request = new LoanRequest(IP, 2000, 5, "ИП Редиска");
assertEquals(DENIED, controller.createRequest(request).getType());
request = new LoanRequest(IP, 2000, 13, "ИП Редиска");
assertEquals(DENIED, controller.createRequest(request).getType());
request = new LoanRequest(IP, 15000, 5, "ИП Редиска");
assertEquals(DENIED, controller.createRequest(request).getType());
}
}
| [
"n.vinogradova@tinkoff.ru"
] | n.vinogradova@tinkoff.ru |
e4c40404a978892dfa20933a0056641b59ee0dab | cb24265f4c31ec1410809e312c65675c1839b345 | /src/main/java/com/savemebeta/SOSsm.java | cd06b7fc4c147a18b0cb253d4a0c14d9322b69df | [] | no_license | TaintBench/save_me | 16ac18ecf3753e82d103c620b7f4f07b2a6236d6 | cb27d0e5e90ef7fc5666e08037a22c91b4e67357 | refs/heads/master | 2021-07-21T05:33:16.315128 | 2021-07-16T11:39:41 | 2021-07-16T11:39:41 | 234,355,355 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,669 | java | package com.savemebeta;
import android.app.Activity;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
public class SOSsm extends Activity {
public String name;
public String phone;
public String sms;
public String var;
public String var2;
public class sendsmsdata2 extends AsyncTask<Void, Void, Void> {
/* access modifiers changed from: protected|varargs */
public Void doInBackground(Void... params) {
HttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost("http://topemarketing.com/android/googlefinal/sossms.php");
List<NameValuePair> nameValuePairs = new ArrayList();
nameValuePairs.add(new BasicNameValuePair("name", SOSsm.this.name));
nameValuePairs.add(new BasicNameValuePair("phone", SOSsm.this.phone));
nameValuePairs.add(new BasicNameValuePair("sms", SOSsm.this.sms));
try {
httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs, "UTF-8"));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
try {
httpClient.execute(httpPost);
} catch (ClientProtocolException e2) {
e2.printStackTrace();
} catch (IOException e3) {
e3.printStackTrace();
}
return null;
}
}
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(1);
getWindow().setFlags(1024, 1024);
setContentView(R.layout.sos);
Intent intent = getIntent();
this.var2 = intent.getStringExtra("var2");
this.var = intent.getExtras().getString("var");
final EditText editText = (EditText) findViewById(R.id.editTextsos);
((Button) findViewById(R.id.buttonsos)).setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
SOSsm.this.name = SOSsm.this.var2;
SOSsm.this.phone = SOSsm.this.var;
SOSsm.this.sms = editText.getText().toString();
new sendsmsdata2().execute(new Void[0]);
Toast.makeText(SOSsm.this, "SOS SMS SAVED SUCCESSFUL", 1).show();
Toast.makeText(SOSsm.this, "Go To our website to send your sos sms", 1).show();
new Timer().schedule(new TimerTask() {
public void run() {
Intent intent = new Intent(SOSsm.this.getBaseContext(), Scan.class);
intent.putExtra("var2", SOSsm.this.var2);
Bundle extras = new Bundle();
extras.putString("var", SOSsm.this.var);
intent.putExtras(extras);
SOSsm.this.startActivity(intent);
}
}, 5000);
}
});
}
}
| [
"malwareanalyst1@gmail.com"
] | malwareanalyst1@gmail.com |
c671301569ca968f143c76ac825750e51fb696ba | 544033d5d517913f1f5aa5e1119b69f74a952cc9 | /DeliverySpring/src/main/java/br/com/unopar/delivery/service/impl/PedidoServiceImpl.java | 51315336423552a4ae5b49b146453638ed1456a6 | [] | no_license | virginiafarias/delivery | d65d43859e8031eeb3b59144aad14a9ed936d19c | 3cbd3357fc6f3590f83bb9f728462c801038a95f | refs/heads/master | 2021-01-10T22:07:46.606070 | 2014-06-25T00:35:00 | 2014-06-25T00:35:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,133 | java | package br.com.unopar.delivery.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import br.com.unopar.delivery.model.Pedido;
import br.com.unopar.delivery.model.PedidoProduto;
import br.com.unopar.delivery.repository.PedidoProdutoRepository;
import br.com.unopar.delivery.repository.PedidoRepository;
import br.com.unopar.delivery.service.PedidoService;
@Service
public class PedidoServiceImpl implements PedidoService {
@Autowired
private PedidoRepository pedidoRepository;
@Autowired
private PedidoProdutoRepository pedidoProdutoRepository;
@Override
public List<Pedido> listar() {
return pedidoRepository.listar();
}
@Override
public Pedido cadastrar(Pedido pedido) {
return pedidoRepository.adicionarOuAtualizar(pedido);
}
@Override
public Pedido getById(Integer id) {
return pedidoRepository.getById(id);
}
@Override
public PedidoProduto cadastrar(PedidoProduto pedidoProduto) {
return pedidoProdutoRepository.adicionarOuAtualizar(pedidoProduto);
}
}
| [
"virginia.farias7@gmail.com"
] | virginia.farias7@gmail.com |
ab712ec5585b00bfcf48d7d4cf065b66b0b301c5 | c68ccb91228d19d872ac4e9b439d233bf9b1e2fb | /app/src/main/java/com/example/android/popularmoviesstage1p2/DetailsActivity.java | d9a4af1b8435f4ad5fe7c76844b65c68fcbce2ce | [] | no_license | ebteesaam/PopularMoviesStage1P2 | f71678171cf3f63eb1f23989296d486689850dd1 | 3c3454f16d618ea5edbb00cf6930421d0be1a257 | refs/heads/master | 2020-04-07T17:29:05.025001 | 2019-11-01T21:33:23 | 2019-11-01T21:33:23 | 158,571,332 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,608 | java | package com.example.android.popularmoviesstage1p2;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.telecom.Call;
import android.util.Log;
import android.widget.ImageView;
import android.widget.TextView;
import com.squareup.picasso.Picasso;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
* Created by ebtesam on 28/11/2018 AD.
*/
public class DetailsActivity extends AppCompatActivity {
ImageView img;
TextView vote;
TextView title;
TextView date;
TextView overview;
private List<Movie> movies;
Movie movie;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.details_activity);
ButterKnife.bind(this);
title=findViewById(R.id.title);
img=findViewById(R.id.detail_img);
vote=findViewById(R.id.vote);
date=findViewById(R.id.date);
overview=findViewById(R.id.overview);
movies=new ArrayList<>();
movie=getIntent().getParcelableExtra("index");
Log.e(DetailsActivity.this.toString(),"#"+movie.getDate());
title.setText(movie.getTitle());
vote.setText(movie.getVote_average()+" ");
date.setText(movie.getDate());
overview.setText(movie.getPlot_synopsis());
Picasso.with(DetailsActivity.this)
.load(movie.getImg())
.into(img);
}
}
| [
"1ebteesaam@gmail.com"
] | 1ebteesaam@gmail.com |
85306fa1b8bc5cc2e882b13593a767eae90f7f8c | c9925af46eba3437852cf74db5b0858959d8e6fa | /app/src/main/java/com/jixuan/wavedemo/PorterDuffXfermodeView1.java | ed0676a02d0d2ab92eac74d4749445b69d19ca41 | [] | no_license | wangxuyang518/WaterWidget | 75370af90e9a6b73a45cf3a1d73caf32e61075fd | 2aa927668f2455de3a431363cc94fb13a1a9f809 | refs/heads/master | 2022-04-04T03:17:00.023267 | 2020-02-21T01:29:19 | 2020-02-21T01:29:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,903 | java | package com.jixuan.wavedemo;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Xfermode;
import android.util.AttributeSet;
import android.view.View;
import androidx.annotation.Nullable;
public class PorterDuffXfermodeView1 extends View {
private Paint mWavePaint;
private Bitmap dstBmp, srcBmp;
private RectF dstRect, srcRect;
public int bitmapWitdh;
public int bitmapHeight;
private Xfermode mXfermode;
private PorterDuff.Mode mPorterDuffMode = PorterDuff.Mode.MULTIPLY;
public PorterDuffXfermodeView1(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
mWavePaint = new Paint();
dstBmp = BitmapFactory.decodeResource(getResources(), R.mipmap.icon_bg);
srcBmp = BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher);
mXfermode = new PorterDuffXfermode(mPorterDuffMode);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
int saveCount = canvas.saveLayer(srcRect, mWavePaint, Canvas.ALL_SAVE_FLAG);
mWavePaint.setColor(Color.parseColor("#ff7474"));
mWavePaint.setStyle(Paint.Style.FILL_AND_STROKE);
canvas.drawRect(new Rect(0, 0, 200, 200), mWavePaint);//dest试图
//canvas.drawBitmap(dstBmp,0,0,mWavePaint);
mWavePaint.setColor(Color.parseColor("#1976D2"));
mWavePaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_OVER));
canvas.drawCircle(180, 180, 50, mWavePaint);
// canvas.drawBitmap(srcBmp,0,0,mWavePaint);
canvas.restoreToCount(saveCount);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
bitmapWitdh = dstBmp.getWidth();
bitmapHeight = dstBmp.getHeight();
widthMeasureSpec = MeasureSpec.makeMeasureSpec(400, MeasureSpec.EXACTLY);
heightMeasureSpec = MeasureSpec.makeMeasureSpec(400, MeasureSpec.EXACTLY);
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
int width = w <= h ? w : h;
int centerX = w / 2;
int centerY = h / 2;
int quarterWidth = width / 4;
srcRect = new RectF(centerX - quarterWidth, centerY - quarterWidth, centerX + quarterWidth, centerY + quarterWidth);
dstRect = new RectF(centerX - quarterWidth, centerY - quarterWidth, centerX + quarterWidth, centerY + quarterWidth);
}
}
| [
"wangxuy@seirobotics.net"
] | wangxuy@seirobotics.net |
c07e095e2c03344d2e8e0f30ef034bb6cb6347c1 | 9769fdbe8ab853c5ec2458c8222ee5f74326d54f | /Seminar5/src/ro/ase/csie/cts/lab5/dp/singleton/registry/DbConnection.java | 6c40f9b67690c7f6d1e2648ece4d11dada359b42 | [] | no_license | nickavr/CTS-laboratory | 95350dd378e6780dae6411b7d4cd822af0c88179 | 85d6d3ea9c099127bcdf30c5bfeac7eca461775c | refs/heads/main | 2023-05-04T18:11:59.841406 | 2021-05-25T08:27:48 | 2021-05-25T08:27:48 | 341,493,632 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 812 | java | package ro.ase.csie.cts.lab5.dp.singleton.registry;
//this handles multiple connections to different databases (still singleton, only one conn per db)
import java.util.HashMap;
public class DbConnection {
String socket;
String schema;
private static HashMap<String, DbConnection> connections = new HashMap<>();
private DbConnection(String socket, String schema) {
this.socket = socket;
this.schema = schema;
}
public static DbConnection getConnection(String socket, String schema){
//we use the socket as the key
DbConnection connection = connections.get(socket);
if(connection == null){
connection = new DbConnection(socket, schema);
connections.put(socket, connection);
}
return connection;
}
}
| [
"nicuavram11@gmail.com"
] | nicuavram11@gmail.com |
62143b7f2ecb02608cf0e897931a118e152529aa | d4662f4836a8fb98f11ed29d5177fa84c472542b | /src/main/java/com/nikolidakis/requests/GetUserByIdRequest.java | a25c04b701edd15f7b7916ee7e6ee2530db47df2 | [] | no_license | NikolidakisDimitris/AuctionProject | b0e74df9dcbf945a4e62d7579cc3c827f8124f6a | b09de4313e9578ebdc63115bdb95b6a905a40f76 | refs/heads/master | 2022-02-26T07:20:00.649276 | 2019-09-25T15:31:25 | 2019-09-25T15:31:25 | 183,818,764 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 226 | java | package com.nikolidakis.requests;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class GetUserByIdRequest {
private Long id;
}
| [
"dnikolidakis@omilia.com"
] | dnikolidakis@omilia.com |
22d039c2e0896bac557329c410895a088c66122b | 91782e76bf8abf31a5312f8580c296efd0d2ca5f | /src/main/java/controller/request/ProductCategoryRequest.java | 49117616dc529a67790e2aeda7264d2cc628afb1 | [] | no_license | WhiteWalker72/Webshop | 76f384bbc1f1848fae46f918b7668a80924c487e | 098059990061f8704be8f3dbae4b71d65c069807 | refs/heads/development | 2021-03-27T14:49:26.134772 | 2018-03-21T06:28:21 | 2018-03-21T06:28:21 | 124,216,170 | 0 | 0 | null | 2018-03-20T23:03:18 | 2018-03-07T10:02:08 | Java | UTF-8 | Java | false | false | 586 | java | package controller.request;
public class ProductCategoryRequest {
private int productId;
private int categoryId;
private String action;
public ProductCategoryRequest() {
}
public ProductCategoryRequest(int productId, int categoryId, String action) {
this.productId = productId;
this.categoryId = categoryId;
this.action = action;
}
public int getProductId() {
return productId;
}
public int getCategoryId() {
return categoryId;
}
public String getAction() {
return action;
}
}
| [
"sivar.werrie@student.hu.nl"
] | sivar.werrie@student.hu.nl |
f61c866481726b04f4875120114d8180e0789fe4 | 2696932021992a49476b7a0bafdd8abd534a08fd | /src/main/java/com/sandbox/phonebook/repository/package-info.java | 32ed635d23a465c22b59a384dcfc03e3384817d3 | [] | no_license | BulkSecurityGeneratorProject/phonebook | ec2c52aadb4be3072e956ba0ba851b63b5312104 | 53f766196363283ef8c567ff91cc601b145b1c2c | refs/heads/master | 2022-12-11T20:26:10.847575 | 2017-01-23T10:45:14 | 2018-01-04T17:03:22 | 296,586,180 | 0 | 0 | null | 2020-09-18T10:14:04 | 2020-09-18T10:14:03 | null | UTF-8 | Java | false | false | 83 | java | /**
* Spring Data JPA repositories.
*/
package com.sandbox.phonebook.repository;
| [
"sofia.craciun@ysura.com"
] | sofia.craciun@ysura.com |
9374619584df6fcaf346dc0f139b7519c1f269a4 | adb44408812fc40a7a610ec5b0317155579d4ab8 | /src/main/java/kr/or/ddit/member/service/IMemberService.java | 7272f752f4b04275f0e430bdff2c7c069ed18a64 | [] | no_license | SoyeonJO/SpringToddler | 5b915fd13ca4654abc0bbeb2136b57c430e640d0 | 74cde2ca4f16d2f8b14d6328b4b51607e660605e | refs/heads/master | 2022-12-21T15:54:33.746457 | 2020-01-19T14:17:22 | 2020-01-19T14:17:22 | 226,016,952 | 1 | 0 | null | 2022-12-16T02:45:30 | 2019-12-05T04:36:22 | JavaScript | UTF-8 | Java | false | false | 588 | java | package kr.or.ddit.member.service;
import java.util.List;
import java.util.Map;
import kr.or.ddit.vo.MemberVO;
public interface IMemberService{
//특정 학생의 정보를 넣어 값을 받아올 메서드.
public MemberVO memberInfo(Map<String, String> params);
//모든 학생의 정보를 받아올 메서드
public List<MemberVO> memberList();
//퍼시스턴스 레이어에 입력할 메서드들 생성
public void insertMemberInfo(MemberVO memberInfo);
public void updateMemberInfo(MemberVO memberInfo);
public void deleteMemberInfo(Map<String, String> params);
}
| [
"csy815kr@naver.com"
] | csy815kr@naver.com |
d71f69c804ca428e4172699d8e76b964bf07cdb1 | ad1b0ae5eed3fe4c96e5dd230b929b78933964d3 | /crawler/src/generated-sources/java/com/oneops/crawler/jooq/crawler/Keys.java | 8e78ac876e18229caf2c5b535ed890e8161d8bf5 | [
"Apache-2.0"
] | permissive | AyushyaChitransh/oneops | 102898a8a5285a9e47788fe1d34423ad15dab56c | c1ef8c51091fdc70866bd6187f0da3cf50d1591a | refs/heads/master | 2020-06-06T11:11:34.047911 | 2019-06-19T12:05:40 | 2019-06-20T09:38:16 | 192,724,030 | 0 | 0 | Apache-2.0 | 2019-06-19T12:02:35 | 2019-06-19T12:02:35 | null | UTF-8 | Java | false | true | 1,853 | java | /*
* This file is generated by jOOQ.
*/
package com.oneops.crawler.jooq.crawler;
import com.oneops.crawler.jooq.crawler.tables.CrawlEntities;
import com.oneops.crawler.jooq.crawler.tables.records.CrawlEntitiesRecord;
import javax.annotation.Generated;
import org.jooq.UniqueKey;
import org.jooq.impl.AbstractKeys;
/**
* A class modelling foreign key relationships and constraints of tables of
* the <code>crawler</code> schema.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.10.0"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class Keys {
// -------------------------------------------------------------------------
// IDENTITY definitions
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
// UNIQUE and PRIMARY KEY definitions
// -------------------------------------------------------------------------
public static final UniqueKey<CrawlEntitiesRecord> CRAWL_ENTITIES_PKEY = UniqueKeys0.CRAWL_ENTITIES_PKEY;
// -------------------------------------------------------------------------
// FOREIGN KEY definitions
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
// [#1459] distribute members to avoid static initialisers > 64kb
// -------------------------------------------------------------------------
private static class UniqueKeys0 extends AbstractKeys {
public static final UniqueKey<CrawlEntitiesRecord> CRAWL_ENTITIES_PKEY = createUniqueKey(CrawlEntities.CRAWL_ENTITIES, "crawl_entities_pkey", CrawlEntities.CRAWL_ENTITIES.OO_ID);
}
}
| [
"sureshg@users.noreply.github.com"
] | sureshg@users.noreply.github.com |
6bd22c83169f3b68f4c5298323fed372173dcc76 | 9e6ae41bd912742f42d88a0a9410ed1d345d316a | /src/main/java/org/registrator/community/dto/ResourceAreaDTO.java | a3dbb67d9ff45473d898661ae4c48fdb8e897c8b | [] | no_license | Social-Projects/Resource-Registration-System | da58a294d4788471cadea722126a9871eefaaa5c | 48ca9a4283d75b1220c91791468809690d3a25ca | refs/heads/development | 2020-12-29T02:21:27.372886 | 2017-04-11T20:39:44 | 2017-04-11T20:39:44 | 51,432,413 | 6 | 3 | null | 2018-03-10T08:49:18 | 2016-02-10T09:46:45 | Java | UTF-8 | Java | false | false | 469 | java | package org.registrator.community.dto;
import java.util.List;
import org.springframework.util.AutoPopulatingList;
public class ResourceAreaDTO {
private List<PoligonAreaDTO> poligons = new AutoPopulatingList<PoligonAreaDTO>(PoligonAreaDTO.class);
public ResourceAreaDTO() {
}
public List<PoligonAreaDTO> getPoligons() {
return poligons;
}
public void setPoligons(List<PoligonAreaDTO> poligons) {
this.poligons = poligons;
}
}
| [
"vitaliihorban93@gmail.com"
] | vitaliihorban93@gmail.com |
2eb0bb83558dbacb52df04c914302fff31307e2a | 504c341f553da891e1d1b73a2bdf9ff223ca56d9 | /src/main/java/space/pxls/util/RateLimitingHandler.java | 1345fe1a6744d388d236f85e941f2e4fc29c99ae | [
"MIT"
] | permissive | Giszmo/Pxls-1 | b5d1784af126df4446786a10bbd97d75170347f9 | 880bc5f3d9902b8d200ba38a9f00393ae4784726 | refs/heads/master | 2020-03-08T01:50:32.611104 | 2018-04-03T02:46:57 | 2018-04-03T02:46:57 | 127,842,101 | 0 | 0 | null | 2018-04-03T02:54:48 | 2018-04-03T02:54:47 | null | UTF-8 | Java | false | false | 1,787 | java | package space.pxls.util;
import io.undertow.server.HttpHandler;
import io.undertow.server.HttpServerExchange;
import io.undertow.util.StatusCodes;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class RateLimitingHandler implements HttpHandler {
private HttpHandler next;
private Map<String, RequestBucket> buckets = new ConcurrentHashMap<>();
private int time;
private int count;
public RateLimitingHandler(HttpHandler next, int time, int count) {
this.next = next;
this.time = time;
this.count = count;
}
@Override
public void handleRequest(HttpServerExchange exchange) throws Exception {
String ip = exchange.getAttachment(IPReader.IP);
RequestBucket bucket = buckets.<String, RequestBucket>compute(ip, (key, old) -> {
if (old == null) return new RequestBucket(System.currentTimeMillis(), 0);
if (old.startTime + time * 1000 < System.currentTimeMillis())
return new RequestBucket(System.currentTimeMillis(), 0);
return old;
});
bucket.count++;
if (bucket.count > count)
{
int timeSeconds = (int) ((bucket.startTime + time * 1000) - System.currentTimeMillis()) / 1000;
exchange.setStatusCode(StatusCodes.TOO_MANY_REQUESTS);
exchange.getResponseSender().send("You are doing that too much, try again in " + timeSeconds / 60 + " minutes");
} else {
next.handleRequest(exchange);
}
}
public static class RequestBucket {
public long startTime;
public int count;
public RequestBucket(long startTime, int count) {
this.startTime = startTime;
this.count = count;
}
}
}
| [
"voltasalt@gmail.com"
] | voltasalt@gmail.com |
b90ed97e41b5beb27e19226448431cf2fadb0e89 | 54f7c6e7d11a5a5d39986994256cc348c151ba78 | /src/com/d3/d3xmpp/d3View/MoreFooter.java | 1d7c7a1247c054f77c6f3e6d81218372df318583 | [] | no_license | maclala/D3Xmpp_v2 | fbf6898cdc9e0d146dc81f2ccd6a4bba0f55c1f7 | 0380712995d96e1aa30c06b65abe00aa1368d96d | refs/heads/master | 2021-01-23T12:16:45.824623 | 2015-08-06T08:27:53 | 2015-08-06T08:27:53 | 40,288,231 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,480 | java | /**
*
*/
package com.d3.d3xmpp.d3View;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.d3.d3xmpp.R;
/**
* @author MZH
*
*/
public class MoreFooter extends LinearLayout{
private TextView moreData;
private RelativeLayout loadingMore;
/**
* @param context
*/
public MoreFooter(Context context) {
super(context);
init(context);
}
public void init(Context context){
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
inflater.inflate(R.layout.morefooter, this);
moreData = (TextView) findViewById(R.id.moredata);
loadingMore = (RelativeLayout)findViewById(R.id.moreloadlayout);
}
public void setBackgroundColor(String color){
moreData.setBackgroundColor(android.graphics.Color.parseColor(color));
loadingMore.setBackgroundColor(android.graphics.Color.parseColor(color));
}
public void setOnClickListener(OnClickListener onClickListener){
moreData.setOnClickListener(onClickListener);
}
public void setNormal(){
setClickable(true);
moreData.setVisibility(View.VISIBLE);
loadingMore.setVisibility(View.GONE);
}
public void setDisable(){
setClickable(false);
moreData.setVisibility(View.GONE);
loadingMore.setVisibility(View.VISIBLE);
}
}
| [
"high@HighdeMacBook-Pro.local"
] | high@HighdeMacBook-Pro.local |
8051a26e147840deda0c2e56d4960323089d53fc | d2cb1f4f186238ed3075c2748552e9325763a1cb | /methods_all/nonstatic_methods/javax_swing_JEditorPane_location.java | aedf7d24fe7f7193a0bfede4587f8ae46c7baebf | [] | no_license | Adabot1/data | 9e5c64021261bf181b51b4141aab2e2877b9054a | 352b77eaebd8efdb4d343b642c71cdbfec35054e | refs/heads/master | 2020-05-16T14:22:19.491115 | 2019-05-25T04:35:00 | 2019-05-25T04:35:00 | 183,001,929 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 148 | java | class javax_swing_JEditorPane_location{ public static void function() {javax.swing.JEditorPane obj = new javax.swing.JEditorPane();obj.location();}} | [
"peter2008.ok@163.com"
] | peter2008.ok@163.com |
147c9d028f90c17d9127caec89de8b65f0a74102 | c77c8b5c23f46adf0b7cd5e4e19153cc015a82df | /payment-app/src/main/java/com/payment/app/web/rest/errors/FieldErrorVM.java | 82ad988bcf88353d0c7e25f843b8e702e4932efc | [] | no_license | eveline-nuta/microservice-sales-app | 15623810f884916192e744e013fe08ac75af6ee4 | fd9b7e9582903234eba280448740d2f2b19143ff | refs/heads/master | 2022-09-02T10:48:33.633974 | 2019-02-09T00:29:18 | 2019-02-09T00:29:18 | 164,356,169 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 647 | java | package com.payment.app.web.rest.errors;
import java.io.Serializable;
public class FieldErrorVM implements Serializable {
private static final long serialVersionUID = 1L;
private final String objectName;
private final String field;
private final String message;
public FieldErrorVM(String dto, String field, String message) {
this.objectName = dto;
this.field = field;
this.message = message;
}
public String getObjectName() {
return objectName;
}
public String getField() {
return field;
}
public String getMessage() {
return message;
}
}
| [
"debbie.evelyn@gmail.com"
] | debbie.evelyn@gmail.com |
ae90ed2309dac6d72727f6fd477276af3a2fe866 | 7198a239eb7a6c3cf3e5593a1940589ec3bf7d4b | /src/main/java/rmiForAutoPackage/ServerIP.java | c5a6f79edbb138eedbaf6de6849d90cbfc30b837 | [] | no_license | charlesYangM/RMIServer | 0de6d82262bfe612f07911b98dc712db326bbdc7 | f17e87ca0dbd0c0e9f1d8d89f162bb6d6e95fe62 | refs/heads/master | 2020-03-19T20:59:54.762414 | 2018-06-11T12:40:51 | 2018-06-11T12:40:51 | 136,925,305 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 162 | java | package rmiForAutoPackage;
/**
* Created by HP on 2017/6/21.
*/
public enum ServerIP {
IP820,
IP821,
IP822,
IP823,
IP3240,
Notkafka;
}
| [
"qazwer1314123@gmail.com"
] | qazwer1314123@gmail.com |
e8621db132ee9bafe75d564cf177c4e726f64a08 | 8ee85f2b9c17c20c2dcc33f8d8b8c2cebb5fbf13 | /eureka-technology/src/main/java/com/cloud/facade/UserFacade.java | 20887ec40bb71fd1e314d54fdd4abe3af3650cc5 | [] | no_license | fengzuo626/eureka-technology | 831fd99e83849b5c622ab6522578fa2948c5da9c | f95746e2941fb6a60798060b30e5d7355e5ee610 | refs/heads/master | 2020-03-25T14:00:11.940953 | 2018-08-07T10:22:12 | 2018-08-07T10:22:12 | 143,851,389 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 372 | java | package com.cloud.facade;
import java.util.List;
import java.util.Map;
import com.cloud.dao.user.entity.SaasUser;
public interface UserFacade {
public boolean insertUser(SaasUser user);
public boolean deleteById(Integer id);
public boolean updateUser(SaasUser user);
public Map<String, Object> findByid(Integer id);
public List<SaasUser> findUsers();
}
| [
"i.yu@qq.com"
] | i.yu@qq.com |
b1bc3ff5b55a10b7d6f68eb809aaa158611837ed | 8af1164bac943cef64e41bae312223c3c0e38114 | /results-java/apache--zeppelin/82de508d727761a9d95ce506a23e39b372f82a93/before/Job.java | 4495b21f6fcbec8720c4bfe97a4d25b886b907d4 | [
"Apache-2.0"
] | permissive | fracz/refactor-extractor | 3ae45c97cc63f26d5cb8b92003b12f74cc9973a9 | dd5e82bfcc376e74a99e18c2bf54c95676914272 | refs/heads/master | 2021-01-19T06:50:08.211003 | 2018-11-30T13:00:57 | 2018-11-30T13:00:57 | 87,353,478 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,310 | 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.zeppelin.scheduler;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Skeletal implementation of the Job concept.
* - designed for inheritance
* - should be run on a separate thread
* - maintains internal state: it's status
* - supports listeners who are updated on status change
*
* Job class is serialized/deserialized and used server<->client communication
* and saving/loading jobs from disk.
* Changing/adding/deleting non transitive field name need consideration of that.
*
* @author Leemoonsoo
*/
public abstract class Job {
/**
* Job status.
*
* READY - Job is not running, ready to run.
* PENDING - Job is submitted to scheduler. but not running yet
* RUNNING - Job is running.
* FINISHED - Job finished run. with success
* ERROR - Job finished run. with error
* ABORT - Job finished by abort
*
*/
public static enum Status {
READY,
PENDING,
RUNNING,
FINISHED,
ERROR,
ABORT;
boolean isReady() {
return this == READY;
}
boolean isRunning() {
return this == RUNNING;
}
boolean isPending() {
return this == PENDING;
}
}
private String jobName;
String id;
Object result;
Date dateCreated;
Date dateStarted;
Date dateFinished;
Status status;
transient boolean aborted = false;
String errorMessage;
private transient Throwable exception;
private transient JobListener listener;
private long progressUpdateIntervalMs;
public Job(String jobName, JobListener listener, long progressUpdateIntervalMs) {
this.jobName = jobName;
this.listener = listener;
this.progressUpdateIntervalMs = progressUpdateIntervalMs;
dateCreated = new Date();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
id = dateFormat.format(dateCreated) + "_" + super.hashCode();
setStatus(Status.READY);
}
public Job(String jobName, JobListener listener) {
this(jobName, listener, JobProgressPoller.DEFAULT_INTERVAL_MSEC);
}
public Job(String jobId, String jobName, JobListener listener, long progressUpdateIntervalMs) {
this.jobName = jobName;
this.listener = listener;
this.progressUpdateIntervalMs = progressUpdateIntervalMs;
id = jobId;
setStatus(Status.READY);
}
public String getId() {
return id;
}
@Override
public int hashCode() {
return id.hashCode();
}
@Override
public boolean equals(Object o) {
return ((Job) o).hashCode() == hashCode();
}
public Status getStatus() {
return status;
}
public void setStatus(Status status) {
if (this.status == status) {
return;
}
Status before = this.status;
Status after = status;
if (listener != null) {
listener.beforeStatusChange(this, before, after);
}
this.status = status;
if (listener != null) {
listener.afterStatusChange(this, before, after);
}
}
public void setListener(JobListener listener) {
this.listener = listener;
}
public JobListener getListener() {
return listener;
}
public boolean isTerminated() {
return !this.status.isReady() && !this.status.isRunning() && !this.status.isPending();
}
public boolean isRunning() {
return this.status.isRunning();
}
public void run() {
JobProgressPoller progressUpdator = null;
try {
progressUpdator = new JobProgressPoller(this, progressUpdateIntervalMs);
progressUpdator.start();
dateStarted = new Date();
result = jobRun();
this.exception = null;
errorMessage = null;
dateFinished = new Date();
progressUpdator.terminate();
} catch (NullPointerException e) {
logger().error("Job failed", e);
progressUpdator.terminate();
this.exception = e;
result = e.getMessage();
errorMessage = getStack(e);
dateFinished = new Date();
} catch (Throwable e) {
logger().error("Job failed", e);
progressUpdator.terminate();
this.exception = e;
result = e.getMessage();
errorMessage = getStack(e);
dateFinished = new Date();
} finally {
//aborted = false;
}
}
public static String getStack(Throwable e) {
if (e == null) {
return "";
}
Throwable cause = ExceptionUtils.getRootCause(e);
return ExceptionUtils.getFullStackTrace(cause);
}
public Throwable getException() {
return exception;
}
protected void setException(Throwable t) {
exception = t;
errorMessage = getStack(t);
}
public Object getReturn() {
return result;
}
public String getJobName() {
return jobName;
}
public void setJobName(String jobName) {
this.jobName = jobName;
}
public abstract int progress();
public abstract Map<String, Object> info();
protected abstract Object jobRun() throws Throwable;
protected abstract boolean jobAbort();
public void abort() {
aborted = jobAbort();
}
public boolean isAborted() {
return aborted;
}
public Date getDateCreated() {
return dateCreated;
}
public Date getDateStarted() {
return dateStarted;
}
public Date getDateFinished() {
return dateFinished;
}
private Logger logger() {
return LoggerFactory.getLogger(Job.class);
}
protected void setResult(Object result) {
this.result = result;
}
} | [
"fraczwojciech@gmail.com"
] | fraczwojciech@gmail.com |
ad1cab6c43d9704f5205fa99be71216b2e72fe3d | 0e260b850c4e606a91161505f8ee9e80b792f036 | /app/src/main/java/com/example/duanwu/project3/model/BackendM.java | 3165bfe8500f5b8ebe9f233c972f3fa1f8f185a7 | [] | no_license | gt2454/Project3 | 6f2658c7ddf473c8b6025bacc0312a45f5e53e49 | 9f81605fd5bdfa997b04452d53320469514a095b | refs/heads/master | 2020-05-15T21:28:08.767960 | 2019-04-21T12:08:33 | 2019-04-21T12:08:33 | 182,499,297 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,443 | java | package com.example.duanwu.project3.model;
import com.example.duanwu.project3.base.BaseModel;
import com.example.duanwu.project3.bean.GankBean.FuLiBean;
import com.example.duanwu.project3.net.BaseObserver;
import com.example.duanwu.project3.net.GankService;
import com.example.duanwu.project3.net.HttpUtils;
import com.example.duanwu.project3.net.ResultCallBack;
import com.example.duanwu.project3.net.RxUtils;
import io.reactivex.Observable;
import io.reactivex.disposables.Disposable;
public class BackendM extends BaseModel {
public void getHot(final ResultCallBack<FuLiBean> resultCallBack) {
GankService apiserver = HttpUtils.getInstance().getApiserver(GankService.url2, GankService.class);
Observable<FuLiBean> dailyNews = apiserver.getImages();
dailyNews.compose(RxUtils.<FuLiBean>rxObserableSchedulerHelper())
.subscribe(new BaseObserver<FuLiBean>() {
@Override
public void onSubscribe(Disposable d) {
mCompositeDisposable.add(d);
}
@Override
public void onNext(FuLiBean dailyNewsBean) {
if(dailyNewsBean.getResults().size()>0){
resultCallBack.onSuccess(dailyNewsBean);
}
// callBack.onSuccess(dailyNewsBean);
}
});
}
}
| [
"2454027056@qq.com"
] | 2454027056@qq.com |
1e060e32de548d12801f580009edf78ab3b947d7 | 16212d742fc44742105d5bfa08ce025c0955df1c | /fix-trading-technologies/src/main/java/quickfix/tt/field/LeavesQty.java | 14d936b0424e360b015fab5e7826db5bc960844f | [
"Apache-2.0"
] | permissive | WojciechZankowski/fix-dictionaries | 83c7ea194f28edbaba2124418fa2ab05ad256114 | 94b299972ade7597c4b581d752858b873102796e | refs/heads/master | 2021-01-19T13:26:18.927116 | 2017-04-14T22:09:15 | 2017-04-14T22:09:16 | 88,088,490 | 10 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,128 | java | /* Generated Java Source File */
/*******************************************************************************
* Copyright (c) quickfixengine.org All rights reserved.
*
* This file is part of the QuickFIX FIX Engine
*
* This file may be distributed under the terms of the quickfixengine.org
* license as defined by quickfixengine.org and appearing in the file
* LICENSE included in the packaging of this file.
*
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING
* THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* See http://www.quickfixengine.org/LICENSE for licensing information.
*
* Contact ask@quickfixengine.org if any conditions of this licensing
* are not clear to you.
******************************************************************************/
package quickfix.tt.field;
import quickfix.DoubleField;
public class LeavesQty extends DoubleField {
static final long serialVersionUID = 20050617;
public static final int FIELD = 151;
public LeavesQty() {
super(151);
}
public LeavesQty(double data) {
super(151, data);
}
}
| [
"info@zankowski.pl"
] | info@zankowski.pl |
7468948504b7cbce0796b7eafa5411950762d709 | d5eb1ba4bc19cb89858ca6a936112a36f9cffb53 | /src/main/java/org/latin/verb_conjugation/provider/Conjugation03a.java | 1258808dbd99048b1dfcbcd7002dc13bb04028c2 | [] | no_license | djoricpetar/_latin | cf97ff1034ad5b686895ddea260620cff874727f | c742cda73d0aa8d49850cc8ab4dd740a241a35ce | refs/heads/master | 2020-04-05T13:38:25.232894 | 2017-07-22T10:49:17 | 2017-07-22T10:49:17 | 94,931,434 | 0 | 0 | null | 2017-07-14T14:17:16 | 2017-06-20T20:18:04 | Java | UTF-8 | Java | false | false | 3,237 | java | package org.latin.verb_conjugation.provider;
import java.util.Map;
import org.latin.common.WordTransformation;
import org.latin.verb.BasicVerb;
import org.latin.verb.ConjugationPretty;
import org.latin.verb.FirstPersonSingularPresentEndsWithRule;
import org.latin.verb.PerfectStartsWithBasisPresentRule;
import org.latin.verb.Position;
import org.latin.verb.VerbSatisfier;
import org.logic_with_oop.AndRule;
import org.logic_with_oop.NotRule;
import org.logic_with_oop.Rule;
public class Conjugation03a extends VerbSatisfier {
@Override
protected String provideBasisPresent() {
return WordTransformation.stripLastNCharacters(basicVerb.getInfinitive(), 3);
}
@Override
protected String provideBasisPerfect() {
return WordTransformation.stripLastNCharacters(basicVerb.getFirstPersonSingularPerfect(), 1);
}
@Override
public Rule isSatisfiableBy(BasicVerb basicVerb) {
return
new AndRule(
new NotRule(
new PerfectStartsWithBasisPresentRule(basicVerb)
),
new NotRule(
new FirstPersonSingularPresentEndsWithRule(basicVerb, "io")
)
);
}
@Override
public ConjugationPretty pretty() {
return ConjugationPretty.III;
}
@Override
protected Map<Position, String> provideSuffixesForPresent() {
return defualtPresentMapCreation(new String[] {
"o", "imus",
"is", "itis",
"it", "unt"
});
}
@Override
protected Map<Position, String> provideSuffixesForImperative() {
return defualtImperativeMapCreation(new String[] {
"e", "ite"
});
}
@Override
protected Map<Position, String> provideSuffixesForImperfect() {
return defualtImperfectMapCreation(new String[] {
"ebam", "ebamus",
"ebas", "ebatis",
"ebat", "ebant"
});
}
@Override
protected Map<Position, String> provideSuffixesForFuturI() {
return defualtFuturIMapCreation(new String[] {
"am", "emus",
"es", "etis",
"et", "ent"
});
}
@Override
protected Map<Position, String> provideSuffixesForPerfect() {
return defualtPerfectMapCreation(new String[] {
"i", "imus",
"isti", "istis",
"it", "erunt"
});
}
@Override
protected Map<Position, String> provideSuffixesForPlusQuamPerfect() {
return defualtPlusQuamPerfecttMapCreation(new String[] {
"eram", "eramus",
"eras", "eratis",
"erat", "erant"
});
}
@Override
protected Map<Position, String> provideSuffixesForFuturII() {
return defualtFuturIIMapCreation(new String[] {
"ero", "erimus",
"eris", "eritis",
"erit", "erint"
});
}
@Override
protected Map<Position, String> provideSuffixesForPassivePresent() {
return defualtPassivePresentMapCreation(new String[] {
"or", "imur",
"eris", "imini",
"itur", "untur"
});
}
@Override
protected Map<Position, String> provideSuffixesForPassiveImperfect() {
return defualtPassiveImperfectMapCreation(new String[] {
"ebar", "ebamur",
"ebaris", "ebamini",
"ebatur", "ebantur"
});
}
@Override
protected Map<Position, String> provideSuffixesForPassiveFuturI() {
return defualtPassiveFuturIMapCreation(new String[] {
"ar", "emur",
"eris", "emini",
"etur", "entur"
});
}
@Override
protected void registerIrregularPositions() {}
}
| [
"petar.djoric@codedevelopment.com"
] | petar.djoric@codedevelopment.com |
7ef0d89f01f035f2fa7405537919c4a810b1453e | ac1e2ef7ab9cfb412c103e87a25917b4a9da47a7 | /src/main/java/org/elasticsearch/client/transport/action/admin/indices/status/ClientTransportIndicesStatusAction.java | e0e350c16b8255f59848586010a1eda829416bfc | [] | no_license | 877867559/elasticsearch06 | 05a9917a559134bad75619f7b1aa7af94df461d9 | 749779c3582f8bf6061e080973072264adac3c1f | refs/heads/master | 2020-04-29T23:33:11.860335 | 2019-03-21T10:35:15 | 2019-03-21T10:35:15 | 176,479,780 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,764 | java | /*
* Licensed to Elastic Search and Shay Banon under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. Elastic Search 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.elasticsearch.client.transport.action.admin.indices.status;
import com.google.inject.Inject;
import org.elasticsearch.action.TransportActions;
import org.elasticsearch.action.admin.indices.status.IndicesStatusRequest;
import org.elasticsearch.action.admin.indices.status.IndicesStatusResponse;
import org.elasticsearch.client.transport.action.support.BaseClientTransportAction;
import org.elasticsearch.transport.TransportService;
import org.elasticsearch.util.settings.Settings;
/**
* @author kimchy (Shay Banon)
*/
public class ClientTransportIndicesStatusAction extends BaseClientTransportAction<IndicesStatusRequest, IndicesStatusResponse> {
@Inject public ClientTransportIndicesStatusAction(Settings settings, TransportService transportService) {
super(settings, transportService, IndicesStatusResponse.class);
}
@Override protected String action() {
return TransportActions.Admin.Indices.STATUS;
}
} | [
"liushuaishuai@xforceplus.com"
] | liushuaishuai@xforceplus.com |
8d9af59ca4f4969e30b6cf6a826e02cc53974f5b | a11ba1b53c0e1e978b5f4f55a38b4ff5b13d5e36 | /ui/src/main/java/org/apache/hop/ui/hopui/wizards/RipDatabaseWizard.java | 795f72cb0f66fbe5a48e7cd2e61239d4280b371f | [
"Apache-2.0"
] | permissive | lipengyu/hop | 157747f4da6d909a935b4510e01644935333fef9 | 8afe35f0705f44d78b5c33c1ba3699f657f8b9dc | refs/heads/master | 2020-09-12T06:31:58.176011 | 2019-11-11T21:17:59 | 2019-11-11T21:17:59 | 222,341,727 | 1 | 0 | Apache-2.0 | 2019-11-18T01:50:19 | 2019-11-18T01:50:18 | null | UTF-8 | Java | false | false | 4,466 | java | /*! ******************************************************************************
*
* Pentaho Data Integration
*
* Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com
*
*******************************************************************************
*
* 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.hop.ui.hopui.wizards;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.IWizardContainer;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Composite;
import org.apache.hop.core.logging.LoggingObjectInterface;
import org.apache.hop.core.logging.LoggingObjectType;
import org.apache.hop.core.logging.SimpleLoggingObject;
/**
* This wizard helps you extract information from tables in one database and pump it into another.
*
* @since 17-apr-04
* @author Matt
*
*/
public class RipDatabaseWizard implements IWizard {
public static final LoggingObjectInterface loggingObject = new SimpleLoggingObject(
"Rid database wizard", LoggingObjectType.SPOON, null );
public RipDatabaseWizard() {
super();
}
// Adds any last-minute pages to this wizard.
public void addPages() {
}
// Returns whether this wizard could be finished without further user interaction.
public boolean canFinish() {
return false;
}
// Creates this wizard's controls in the given parent control.
public void createPageControls( Composite pageContainer ) {
}
// Disposes of this wizard and frees all SWT resources.
public void dispose() {
}
// Returns the container of this wizard.
public IWizardContainer getContainer() {
return null;
}
// Returns the default page image for this wizard.
public Image getDefaultPageImage() {
return null;
}
// Returns the dialog settings for this wizard.
public IDialogSettings getDialogSettings() {
return null;
}
// Returns the successor of the given page.
public IWizardPage getNextPage( IWizardPage page ) {
return null;
}
// Returns the wizard page with the given name belonging to this wizard.
public IWizardPage getPage( String pageName ) {
return null;
}
// Returns the number of pages in this wizard.
public int getPageCount() {
return 3;
}
// Returns all the pages in this wizard.
public IWizardPage[] getPages() {
return null;
}
// Returns the predecessor of the given page.
public IWizardPage getPreviousPage( IWizardPage page ) {
return null;
}
// Returns the first page to be shown in this wizard.
public IWizardPage getStartingPage() {
return null;
}
// Returns the title bar color for this wizard.
public RGB getTitleBarColor() {
return null;
}
// Returns the window title string for this wizard.
public String getWindowTitle() {
return "Rip database wizard";
}
// Returns whether help is available for this wizard.
public boolean isHelpAvailable() {
return false;
}
// Returns whether this wizard needs Previous and Next buttons.
public boolean needsPreviousAndNextButtons() {
return true;
}
// Returns whether this wizard needs a progress monitor.
public boolean needsProgressMonitor() {
return false;
}
// Performs any actions appropriate in response to the user having pressed the Cancel button, or refuse if canceling
// now is not permitted.
public boolean performCancel() {
return false;
}
// Performs any actions appropriate in response to the user having pressed the Finish button, or refuse if finishing
// now is not permitted.
public boolean performFinish() {
return false;
}
// Sets or clears the container of this wizard.
public void setContainer( IWizardContainer wizardContainer ) {
}
}
| [
"mattcasters@gmail.com"
] | mattcasters@gmail.com |
616e3086eba743725c15888924691631a694936e | 45a68ae9184cfdc58a66dd94f7b407a3c2458260 | /doze/src/com/cyanogenmod/settings/device/MotoDozeService.java | 5f77b9e6f2a021f2df314fc3385bddb725aa48ec | [] | no_license | LineageOS/android_device_motorola_condor | 3cdd06323c04fb1ec4b7a95082202566863f0de6 | 64bdbfa2877ae7600d79269fbeee293e1738e971 | refs/heads/cm-14.1 | 2020-06-11T17:08:30.241190 | 2017-07-21T16:02:05 | 2017-08-16T03:00:48 | 75,635,094 | 11 | 30 | null | 2022-10-02T20:04:45 | 2016-12-05T14:56:16 | Java | UTF-8 | Java | false | false | 7,245 | java | /*
* Copyright (c) 2015 The CyanogenMod Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.cyanogenmod.settings.device;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.os.IBinder;
import android.os.PowerManager;
import android.preference.PreferenceManager;
import android.provider.Settings;
import android.util.Log;
import java.util.ArrayList;
import java.util.List;
public class MotoDozeService extends Service {
private static final String TAG = "MotoDozeService";
private static final boolean DEBUG = false;
private static final String GESTURE_HAND_WAVE_KEY = "gesture_hand_wave";
private static final String GESTURE_POCKET_KEY = "gesture_pocket";
private static final int POCKET_DELTA_NS = 1000 * 1000 * 1000;
private Context mContext;
private MotoProximitySensor mSensor;
private PowerManager mPowerManager;
private PowerManager.WakeLock mWakeLock;
private boolean mHandwaveGestureEnabled = false;
private boolean mPocketGestureEnabled = false;
class MotoProximitySensor implements SensorEventListener {
private SensorManager mSensorManager;
private Sensor mSensor;
private boolean mSawNear = false;
private long mInPocketTime = 0;
public MotoProximitySensor(Context context) {
mSensorManager = (SensorManager)context.getSystemService(Context.SENSOR_SERVICE);
mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY);
}
@Override
public void onSensorChanged(SensorEvent event) {
boolean isNear = event.values[0] < mSensor.getMaximumRange();
if (mSawNear && !isNear) {
if (shouldPulse(event.timestamp)) {
launchDozePulse();
}
} else {
mInPocketTime = event.timestamp;
}
mSawNear = isNear;
}
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {
/* Empty */
}
private boolean shouldPulse(long timestamp) {
long delta = timestamp - mInPocketTime;
if (mHandwaveGestureEnabled && mPocketGestureEnabled) {
return true;
} else if (mHandwaveGestureEnabled && !mPocketGestureEnabled) {
return delta < POCKET_DELTA_NS;
} else if (!mHandwaveGestureEnabled && mPocketGestureEnabled) {
return delta >= POCKET_DELTA_NS;
}
return false;
}
public void enable() {
if (mHandwaveGestureEnabled || mPocketGestureEnabled) {
mSensorManager.registerListener(this, mSensor, SensorManager.SENSOR_DELAY_NORMAL);
}
}
public void disable() {
mSensorManager.unregisterListener(this, mSensor);
}
}
@Override
public void onCreate() {
if (DEBUG) Log.d(TAG, "MotoDozeService Started");
mContext = this;
mPowerManager = (PowerManager)getSystemService(Context.POWER_SERVICE);
mSensor = new MotoProximitySensor(mContext);
mWakeLock = mPowerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "MotoDozeWakeLock");
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(mContext);
loadPreferences(sharedPrefs);
sharedPrefs.registerOnSharedPreferenceChangeListener(mPrefListener);
if (!isInteractive() && isDozeEnabled()) {
mSensor.enable();
}
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
if (DEBUG) Log.d(TAG, "Starting service");
IntentFilter screenStateFilter = new IntentFilter(Intent.ACTION_SCREEN_ON);
screenStateFilter.addAction(Intent.ACTION_SCREEN_OFF);
mContext.registerReceiver(mScreenStateReceiver, screenStateFilter);
return START_STICKY;
}
@Override
public IBinder onBind(Intent intent) {
return null;
}
private void launchDozePulse() {
mContext.sendBroadcast(new Intent("com.android.systemui.doze.pulse"));
}
private boolean isInteractive() {
return mPowerManager.isInteractive();
}
private boolean isDozeEnabled() {
return Settings.Secure.getInt(mContext.getContentResolver(),
Settings.Secure.DOZE_ENABLED, 1) != 0;
}
private void onDisplayOn() {
if (DEBUG) Log.d(TAG, "Display on");
mSensor.disable();
if (isDozeEnabled() && !mWakeLock.isHeld()) {
if (DEBUG) Log.d(TAG, "Acquiring wakelock");
mWakeLock.acquire();
}
}
private void onDisplayOff() {
if (DEBUG) Log.d(TAG, "Display off");
if (isDozeEnabled()) {
mSensor.enable();
}
if (mWakeLock.isHeld()) {
if (DEBUG) Log.d(TAG, "Releasing wakelock");
mWakeLock.release();
}
}
private void loadPreferences(SharedPreferences sharedPreferences) {
mHandwaveGestureEnabled = sharedPreferences.getBoolean(GESTURE_HAND_WAVE_KEY, false);
mPocketGestureEnabled = sharedPreferences.getBoolean(GESTURE_POCKET_KEY, false);
}
private BroadcastReceiver mScreenStateReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) {
onDisplayOff();
} else if (intent.getAction().equals(Intent.ACTION_SCREEN_ON)) {
onDisplayOn();
}
}
};
private SharedPreferences.OnSharedPreferenceChangeListener mPrefListener =
new SharedPreferences.OnSharedPreferenceChangeListener() {
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
if (GESTURE_HAND_WAVE_KEY.equals(key)) {
mHandwaveGestureEnabled = sharedPreferences.getBoolean(GESTURE_HAND_WAVE_KEY, false);
} else if (GESTURE_POCKET_KEY.equals(key)) {
mPocketGestureEnabled = sharedPreferences.getBoolean(GESTURE_POCKET_KEY, false);
}
if (isDozeEnabled() && !mWakeLock.isHeld()) {
if (DEBUG) Log.d(TAG, "Acquiring wakelock");
mWakeLock.acquire();
}
}
};
}
| [
"sultanqasim@gmail.com"
] | sultanqasim@gmail.com |
018c9aff54df6adfff6f088de05911d8a5134aa6 | 73f0134ecd7ab7d4c4643c817ed92875eeda62c5 | /app/src/main/java/quotes/Quotes.java | bb11bbed7f9c37500c3a537369d6ab70e8a62030 | [
"MIT"
] | permissive | mohammadkabbara/quotes | 2a897d499d613d3409518d15203b113fb6a08da1 | 27e227a808b5854f9d50a110667a63a09ef9a12c | refs/heads/main | 2023-08-12T11:10:42.838718 | 2021-10-05T16:23:41 | 2021-10-05T16:23:41 | 413,821,174 | 0 | 0 | MIT | 2021-10-05T16:23:42 | 2021-10-05T13:04:52 | null | UTF-8 | Java | false | false | 922 | java | package quotes;
import java.util.ArrayList;
public class Quotes {
private ArrayList<String> tags;
private String author;
// private String likes;
private String text;
public ArrayList<String> getTags() {
return tags;
}
public void setTags(ArrayList<String> tags) {
this.tags = tags;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
// public String getLikes() {
// return likes;
// }
//
// public void setLikes(String likes) {
// this.likes = likes;
// }
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
@Override
public String toString() {
return "{author: " + author + ", text: " + text + "}";
}
} | [
"mohammadkabbara40@gmail.com"
] | mohammadkabbara40@gmail.com |
d158023850425b5c01ff02ff4c0e326d6d6991b9 | b97b4686da48ba7a42ae345964bf2707f225ecd3 | /app/src/main/java/od/chat/ui/fragment/CommentFragment.java | a026fc205a4080d72106210e8af5a01d07c9b64c | [] | no_license | DanilaGri/ChatMVP | 8210bb6152eb75864be0444adfdd9da80f137587 | 389d4bd900078addb6f36077c804fb514327fe5f | refs/heads/master | 2021-01-22T13:03:25.528143 | 2017-05-28T20:30:03 | 2017-05-28T20:30:03 | 68,498,774 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,716 | java | package od.chat.ui.fragment;
import android.os.Bundle;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import org.greenrobot.eventbus.EventBus;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;
import od.chat.R;
import od.chat.event.UpdateEvent;
import od.chat.listener.OnCommentAdapterListener;
import od.chat.model.Comment;
import od.chat.presenter.CommentPresenter;
import od.chat.ui.adapter.CommentAdapter;
import od.chat.ui.view.CommentView;
import od.chat.utils.AndroidUtils;
/**
* A simple {@link BaseFragment} subclass.
* Use the {@link CommentFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class CommentFragment extends BaseFragment implements CommentView, OnCommentAdapterListener {
private static final String ARGUMENT_ID = "ARGUMENT_ID";
public static final String TAG = CommentFragment.class.getSimpleName();
private boolean isLoading = false;
public static final int PAGE_SIZE = 2;
@Bind(R.id.rv_chat)
RecyclerView rvChat;
@Bind(R.id.swipe_chat)
SwipeRefreshLayout swipeChat;
@Bind(R.id.et_add_comment)
EditText etAddComment;
@Bind(R.id.iv_send)
ImageView ivSend;
@Bind(R.id.ll_progress_bar)
LinearLayout llProgressBar;
@Bind(R.id.tv_no_comments)
TextView tvNoComments;
private String id;
private LinearLayoutManager mLayoutManager;
private CommentAdapter commentAdapter;
@Inject
CommentPresenter presenter;
@Inject
AndroidUtils androidUtils;
public CommentFragment() {
// Required empty public constructor
}
public static CommentFragment newInstance(String id) {
CommentFragment fragment = new CommentFragment();
Bundle args = new Bundle();
args.putString(ARGUMENT_ID, id);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
id = getArguments().getString(ARGUMENT_ID);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_comment, container, false);
ButterKnife.bind(this, view);
getComponent().inject(this);
presenter.attachView(this);
swipeChat.post(() -> {
swipeChat.setRefreshing(true);
presenter.loadComments(id, 0);
});
commentAdapter =
new CommentAdapter(getActivity(), new ArrayList<>(), this, presenter.getUserId());
rvChat.setAdapter(commentAdapter);
mLayoutManager = new LinearLayoutManager(getActivity());
rvChat.setLayoutManager(mLayoutManager);
swipeChat.setOnRefreshListener(() -> {
presenter.loadComments(id,0);
});
rvChat.addOnScrollListener(onScrollListener);
setupTitle(getString(R.string.title_comments));
return view;
}
@Override
public void onDestroyView() {
super.onDestroyView();
ButterKnife.unbind(this);
}
@Override
public void showComments(List<Comment> commentList) {
if (commentList == null) {
commentList = new ArrayList<>();
}
isLoading = !(commentList.size() <= 20);
commentAdapter.setCommentList(commentList);
swipeChat.setRefreshing(false);
if(commentList.isEmpty()){
tvNoComments.setVisibility(View.VISIBLE);
} else {
tvNoComments.setVisibility(View.GONE);
}
swipeChat.setRefreshing(false);
llProgressBar.setVisibility(View.GONE);
androidUtils.hideKeyboard(getView());
etAddComment.setText("");
etAddComment.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
if (etAddComment.length() > 0) {
ivSend.setEnabled(true);
} else {
ivSend.setEnabled(false);
}
}
});
}
@Override
public void showLoad() {
llProgressBar.setVisibility(View.VISIBLE);
}
@Override
public void update() {
EventBus.getDefault().postSticky(new UpdateEvent());
}
@Override
public void showError() {
swipeChat.setRefreshing(false);
llProgressBar.setVisibility(View.GONE);
androidUtils.hideKeyboard(getView());
}
@OnClick({R.id.et_add_comment, R.id.iv_send})
public void onClick(View view) {
switch (view.getId()) {
case R.id.iv_send:
presenter.sendComment(etAddComment.getText().toString());
break;
}
}
@Override
public void deleteComment(String id) {
presenter.deleteComment(id);
}
@Override
public void editComment(String id, String text) {
presenter.editComment(id, text);
}
final RecyclerView.OnScrollListener onScrollListener = new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
int visibleItemCount = mLayoutManager.getChildCount();
int totalItemCount = mLayoutManager.getItemCount();
int firstVisibleItemPosition = mLayoutManager.findFirstVisibleItemPosition();
if (!isLoading ) {
if ((visibleItemCount + firstVisibleItemPosition) >= totalItemCount
&& firstVisibleItemPosition >= 0
&& totalItemCount >= PAGE_SIZE) {
commentAdapter.loadMore();
presenter.loadComments(id, totalItemCount);
isLoading = true;
}
}
}
};
}
| [
"danilamastergrigorenko@gmail.com"
] | danilamastergrigorenko@gmail.com |
25b92215ed0974bf6e25287a6f642677a9e4c985 | d90873f31c2d8e36abf99bc37c21e72954eda54a | /src/main/java/com/openbravo/data/gui/JImageViewerProduct.java | 9031613dd4fb01408eba9c3ada7286767062930a | [] | no_license | tudorilisoi/mobilecenta | 378ef15f69006008cbdd2ece384fcc19740bf349 | 61ee26cdf706899456a89c849ef99df4e6da5d6f | refs/heads/master | 2023-04-27T13:57:42.735864 | 2023-03-12T05:18:03 | 2023-03-12T05:18:03 | 129,228,961 | 3 | 1 | null | 2023-04-17T17:36:45 | 2018-04-12T09:43:48 | Java | UTF-8 | Java | false | false | 13,653 | java | // uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS 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.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.openbravo.data.gui;
import com.openbravo.data.loader.LocalRes;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import javax.imageio.ImageIO;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.filechooser.FileFilter;
/**
*
* @author JG uniCenta
*/
public class JImageViewerProduct extends javax.swing.JPanel {
private Dimension m_maxsize;
private final ZoomIcon m_icon;
private BufferedImage m_Img = null;
private static File m_fCurrentDirectory = null;
private static final NumberFormat m_percentformat = new DecimalFormat("#,##0.##%");
public JImageViewerProduct() {
initComponents();
m_Img = null;
m_maxsize = null;
m_icon = new ZoomIcon();
m_jImage.setIcon(m_icon);
m_jPercent.setText(m_percentformat.format(m_icon.getZoom()));
privateSetEnabled(isEnabled());
}
/**
*
* @param size
*/
public void setMaxDimensions(Dimension size) {
m_maxsize = size;
}
/**
*
* @return
*/
public Dimension getMaxDimensions() {
return m_maxsize;
}
@Override
public void setEnabled(boolean value) {
privateSetEnabled(value);
super.setEnabled(value);
}
private void privateSetEnabled(boolean value) {
m_jbtnzoomin.setEnabled(value && (m_Img != null));
m_jbtnzoomout.setEnabled(value && (m_Img != null));
m_jPercent.setEnabled(value && (m_Img != null));
m_jScr.setEnabled(value && (m_Img != null));
}
/**
*
* @param img
*/
public void setImage(BufferedImage img) {
BufferedImage oldimg = m_Img;
m_Img = img;
m_icon.setIcon(m_Img == null ? null : new ImageIcon(m_Img));
m_jPercent.setText(m_percentformat.format(m_icon.getZoom()));
m_jImage.revalidate();
m_jScr.revalidate();
m_jScr.repaint();
privateSetEnabled(isEnabled());
firePropertyChange("image", oldimg, m_Img);
}
/**
*
* @return
*/
public BufferedImage getImage() {
return m_Img;
}
/**
*
* @return
*/
public double getZoom() {
return m_icon.getZoom();
}
/**
*
* @param zoom
*/
public void setZoom(double zoom) {
double oldzoom = m_icon.getZoom();
m_icon.setZoom(zoom);
m_jPercent.setText(m_percentformat.format(m_icon.getZoom()));
m_jImage.revalidate();
m_jScr.revalidate();
m_jScr.repaint();
firePropertyChange("zoom", oldzoom, zoom);
}
/**
*
*/
public void incZoom() {
double zoom = m_icon.getZoom();
setZoom(zoom > 4.0 ? 8.0 : zoom * 2.0);
}
/**
*
*/
public void decZoom() {
double zoom = m_icon.getZoom();
setZoom(zoom < 0.5 ? 0.25 : zoom / 2.0);
}
/**
*
*/
public void doLoad() {
JFileChooser fc = new JFileChooser(m_fCurrentDirectory);
fc.addChoosableFileFilter(new ExtensionsFilter(
LocalRes.getIntString("label.imagefiles"), "png", "gif", "jpg", "jpeg", "bmp"));
if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
try {
BufferedImage img = ImageIO.read(fc.getSelectedFile());
if (img != null) {
// compruebo que no exceda el tamano maximo.
if (m_maxsize != null && (img.getHeight() > m_maxsize.height || img.getWidth() > m_maxsize.width)) {
if (JOptionPane.showConfirmDialog(this,
LocalRes.getIntString("message.resizeimage"),
LocalRes.getIntString("title.editor"),
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION) {
// Redimensionamos la imagen para que se ajuste
img = resizeImage(img);
}
}
setImage(img);
m_fCurrentDirectory = fc.getCurrentDirectory();
}
} catch (IOException eIO) {
}
}
}
private BufferedImage resizeImage(BufferedImage img) {
int myheight = img.getHeight();
int mywidth = img.getWidth();
if (myheight > m_maxsize.height) {
mywidth = (int) (mywidth * m_maxsize.height / myheight);
myheight = m_maxsize.height;
}
if (mywidth > m_maxsize.width) {
myheight = (int) (myheight * m_maxsize.width / mywidth);
mywidth = m_maxsize.width;
}
BufferedImage thumb = new BufferedImage(mywidth, myheight, BufferedImage.TYPE_4BYTE_ABGR);
double scalex = (double) mywidth / (double) img.getWidth(null);
double scaley = (double) myheight / (double) img.getHeight(null);
Graphics2D g2d = thumb.createGraphics();
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
g2d.setColor(new Color(0, 0, 0, 0));
g2d.fillRect(0, 0, mywidth, myheight);
if (scalex < scaley) {
g2d.drawImage(img, 0,(int) ((myheight - img.getHeight(null) * scalex) / 2.0)
, mywidth, (int) (img.getHeight(null) * scalex), null);
} else {
g2d.drawImage(img, (int) ((mywidth - img.getWidth(null) * scaley) / 2.0), 0
, (int) (img.getWidth(null) * scaley), myheight, null);
}
g2d.dispose();
return thumb;
}
private static class ZoomIcon implements Icon {
private Icon ico;
private double zoom;
public ZoomIcon() {
this.ico = null;
this.zoom = 1.0;
}
@Override
public int getIconHeight() {
return ico == null ? 0 : (int) (zoom * ico.getIconHeight());
}
@Override
public int getIconWidth() {
return ico == null ? 0 : (int) (zoom * ico.getIconWidth());
}
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
if (ico != null) {
Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
AffineTransform oldt = g2d.getTransform();
g2d.transform(AffineTransform.getScaleInstance(zoom, zoom));
ico.paintIcon(c, g2d, (int) (x / zoom), (int) (y / zoom));
g2d.setTransform(oldt);
}
}
public void setIcon(Icon ico) {
this.ico = ico;
this.zoom = 1.0;
}
public void setZoom(double zoom) {
this.zoom = zoom;
}
public double getZoom() {
return zoom;
}
}
private static class ExtensionsFilter extends FileFilter {
private final String message;
private final String[] extensions;
public ExtensionsFilter(String message, String... extensions) {
this.message = message;
this.extensions = extensions;
}
@Override
public boolean accept(java.io.File f) {
if (f.isDirectory()) {
return true;
} else {
String sFileName = f.getName();
int ipos = sFileName.lastIndexOf('.');
if (ipos >= 0) {
String sExt = sFileName.substring(ipos + 1);
for(String s : extensions) {
if (s.equalsIgnoreCase(sExt)) {
return true;
}
}
}
return false;
}
}
@Override
public String getDescription() {
return message;
}
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
m_jScr = new javax.swing.JScrollPane();
m_jImage = new javax.swing.JLabel();
jPanel1 = new javax.swing.JPanel();
jPanel2 = new javax.swing.JPanel();
m_jbtnzoomin = new javax.swing.JButton();
m_jPercent = new javax.swing.JLabel();
m_jbtnzoomout = new javax.swing.JButton();
setLayout(new java.awt.BorderLayout());
m_jImage.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
m_jImage.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/no_photo.png"))); // NOI18N
m_jImage.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
m_jScr.setViewportView(m_jImage);
add(m_jScr, java.awt.BorderLayout.CENTER);
jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jPanel2.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 5, 0, 5));
jPanel2.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
jPanel2.setLayout(new java.awt.GridLayout(0, 1, 0, 2));
m_jbtnzoomin.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/viewmag+.png"))); // NOI18N
m_jbtnzoomin.setToolTipText("Zoom In");
m_jbtnzoomin.setPreferredSize(new java.awt.Dimension(50, 45));
m_jbtnzoomin.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
m_jbtnzoominActionPerformed(evt);
}
});
jPanel2.add(m_jbtnzoomin);
m_jPercent.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
m_jPercent.setBorder(javax.swing.BorderFactory.createCompoundBorder(javax.swing.BorderFactory.createLineBorder(javax.swing.UIManager.getDefaults().getColor("Button.darkShadow")), javax.swing.BorderFactory.createEmptyBorder(1, 4, 1, 4)));
m_jPercent.setOpaque(true);
m_jPercent.setPreferredSize(new java.awt.Dimension(10, 30));
jPanel2.add(m_jPercent);
m_jbtnzoomout.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/viewmag-.png"))); // NOI18N
m_jbtnzoomout.setToolTipText("Zoom Out");
m_jbtnzoomout.setPreferredSize(new java.awt.Dimension(50, 45));
m_jbtnzoomout.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
m_jbtnzoomoutActionPerformed(evt);
}
});
jPanel2.add(m_jbtnzoomout);
jPanel1.add(jPanel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
add(jPanel1, java.awt.BorderLayout.LINE_END);
}// </editor-fold>//GEN-END:initComponents
private void m_jbtnzoomoutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jbtnzoomoutActionPerformed
decZoom();
}//GEN-LAST:event_m_jbtnzoomoutActionPerformed
private void m_jbtnzoominActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jbtnzoominActionPerformed
incZoom();
}//GEN-LAST:event_m_jbtnzoominActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JLabel m_jImage;
private javax.swing.JLabel m_jPercent;
private javax.swing.JScrollPane m_jScr;
private javax.swing.JButton m_jbtnzoomin;
private javax.swing.JButton m_jbtnzoomout;
// End of variables declaration//GEN-END:variables
}
| [
"tudorilisoi@yahoo.com"
] | tudorilisoi@yahoo.com |
875aca039710efc5d5ac2d33bb93b87e3eef229f | 9738a78468c1bc7c546ffc2351a78d0ded8a3404 | /web/src/main/java/command/MealCommand/EditMealSaveCommand.java | a17126104b769a1944e506599ab6f7ab0da13f1e | [] | no_license | sensesnet/rest_hibernate | e22899852d3f51a32b6ec6514a9d9b051e2b6918 | 208b1a6db5ba1ccf4b06b780ca126abae2e02974 | refs/heads/master | 2021-06-26T19:54:20.728062 | 2017-04-03T20:59:27 | 2017-04-03T20:59:27 | 58,499,906 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,491 | java | package command.MealCommand;
import by.restaurantHibernate.DaoExceptions.DaoException;
import by.restaurantHibernate.Services.MealService;
import command.iCommand.iCommand;
import by.restaurantHibernate.pojos.Meal;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.SQLException;
public class EditMealSaveCommand implements iCommand {
@Override
public void execute(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, SQLException, DaoException {
MealService mealService = new MealService();
try {
int mId = Integer.valueOf(request.getParameter("mealId"));
Meal meal = mealService.getById(mId);
//meal.setId(mId);
String mealName = request.getParameter("mealName");
meal.setMealName(mealName);
meal.setMealPrice(Integer.valueOf(request.getParameter("mealPrice")));
meal.setMealTime(Integer.valueOf(request.getParameter("mealTime")));
meal.setMealConsist(request.getParameter("mealConsist"));
mealService.edit(meal);
response.sendRedirect("Controller");
} catch (SQLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (DaoException e) {
e.printStackTrace();
}
}
}
| [
"sensesnet@gmail.com"
] | sensesnet@gmail.com |
7f81ce53b5e786dcc3ff7c0e13f7f913450830a9 | f64bddc9e7fd94780222b549a958cff375c38c65 | /src/test/java/com/koehler/springbootwebflux/fluxandmono/FluxAndMonoFilterTest.java | 59739ce245dff49504852a44b6264e5576ca64c3 | [] | no_license | fabiokoehler/spring-boot-webflux-poc | 3ba514aa1612a88d483ca9578c98eaa40e4966c5 | 220f3538096db963032de23b12d22dcacedc4b8e | refs/heads/master | 2022-12-18T21:54:32.913660 | 2020-10-06T01:00:36 | 2020-10-06T01:00:36 | 298,444,366 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 647 | java | package com.koehler.springbootwebflux.fluxandmono;
import org.junit.jupiter.api.Test;
import reactor.core.publisher.Flux;
import reactor.test.StepVerifier;
import java.util.Arrays;
import java.util.List;
public class FluxAndMonoFilterTest {
List<String> names = Arrays.asList("adam", "anna", "jack", "jenny");
@Test
public void flux() {
Flux<String> stringFlux = Flux
.fromIterable(names)
.filter(s -> s.startsWith("a"))
.log();
StepVerifier
.create(stringFlux)
.expectNext("adam", "anna")
.verifyComplete();
}
}
| [
"fabiokoehler@gmail.com"
] | fabiokoehler@gmail.com |
c27c6923f2b4fea3ab1db4aa61f2e4264a6aa8e7 | 89f3af52f5634bce05aaecc742b1e4bb0a009ff2 | /trunk/fmps-web/src/main/java/cn/com/fubon/pay/controller/OfflineWechatPayController.java | 4d79f8b82d842dea9e6f013928a25d63ba000820 | [] | no_license | cash2one/fmps | d331391b7d6cb5b50645e823e1606c6ea236b8a2 | b57c463943fec0da800e5374f306176914a39079 | refs/heads/master | 2021-01-21T06:42:45.275421 | 2016-06-21T12:47:46 | 2016-06-21T12:47:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 19,723 | java | package cn.com.fubon.pay.controller;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import jodd.util.StringUtil;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.jeecgframework.core.common.model.json.AjaxJson;
import org.jeecgframework.core.constant.Globals;
import org.jeecgframework.core.util.IdcardUtils;
import org.jeecgframework.core.util.IpUtil;
import org.jeecgframework.core.util.UUIDGenerator;
import org.jeecgframework.web.system.service.SystemService;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import weixin.guanjia.account.entity.WeixinAccountEntity;
import weixin.guanjia.account.service.WeixinAccountServiceI;
import weixin.guanjia.core.util.WeixinUtil;
import cn.com.fubon.pay.entity.PaymentConstants;
import cn.com.fubon.pay.entity.WeiXinOfflineOrderDetail;
import cn.com.fubon.pay.entity.WeiXinOfflineOrderInfo;
import cn.com.fubon.pay.service.IPayService;
import cn.com.fubon.pay.service.OfflineWechatPayService;
import cn.com.fubon.pay.service.TelesaleWebService;
import cn.com.fubon.pay.service.WechatPayService;
import cn.com.fubon.util.CachedUtils;
import cn.com.fubon.util.Constants;
import cn.com.fubon.util.MD5Utils;
import cn.com.fubon.webservice.externl.telesalesystem.TelesaleWSConstants;
/**
* 线下微信支付类
*
* @author patrick.z
*/
@Scope("prototype")
@Controller
@RequestMapping("/pay/offlinePay")
public class OfflineWechatPayController {
@Resource
private OfflineWechatPayService offlineWechatPayService;
@Resource
private WechatPayService wechatPayServiceImpl;
@Resource(name = "telesaleWebService")
private TelesaleWebService telesaleWebService;
@Resource
private WeixinAccountServiceI weixinAccountService;
@Resource
private SystemService systemService;
@Resource()
private IPayService payServiceImpl;
private static final Logger logger = Logger
.getLogger(OfflineWechatPayController.class);
public OfflineWechatPayController() {
}
/**
* 进入保费支付画面
*
* @param request
* @return
*/
@RequestMapping(params = "payIndex")
public String payIndex(HttpServletRequest request) {
String code = request.getParameter("code");
logger.info("code=>" + code);
String openid = (String) request.getAttribute("openid");
if (StringUtil.isEmpty(openid)) {
openid = request.getParameter("openid");
}
logger.info("openid=>" + openid);
if (StringUtil.isEmpty(openid)) {
List<WeixinAccountEntity> weixinAccountEntityList = weixinAccountService
.findValidWeixinAccounts();
WeixinAccountEntity weixinAccountEntity = weixinAccountEntityList
.get(0);
openid = WeixinUtil.getOpenId(
weixinAccountEntity.getAccountappid(),
weixinAccountEntity.getAccountappsecret(), code);
logger.info("根据code获取 openid,获取到的openid=>" + openid);
}
request.setAttribute("openid", openid);
int versionNum = WeixinUtil.getWechatVersion(request);
if (versionNum >= 5) {
return "fo/offlinepay/payCode";
} else {
request.setAttribute("message", "您的微信版本过低,请升级版本为5.0以上!");
return "/fo/common/message";
}
}
/**
* 检测验证码和支付码状态
*
* @param request
* @return
* @throws Exception
*/
@RequestMapping(params = "checkValidateCode")
@ResponseBody
public AjaxJson checkValidateCode(HttpServletRequest request)
throws Exception {
AjaxJson jsonString = new AjaxJson();
// 检查验证码/支付码状态
String randCode = request.getParameter("randCode");
String payCode = request.getParameter("payCode");
String randCodeInSession = getSessionRandCode(request);
logger.info("offlineWechatPay,from client, randCode=>" + randCode);
boolean isValidateCodeValid = true;
if (StringUtils.isEmpty(randCode) || StringUtils.isEmpty(payCode)) {
isValidateCodeValid = false;
jsonString.setMsg("请输入验证码和支付码!");
jsonString.setSuccess(false);
} else if (!randCode.equalsIgnoreCase(randCodeInSession)) {
isValidateCodeValid = false;
jsonString.setMsg("验证码错误!");
jsonString.setSuccess(false);
} else if (payCode.length() != 6) {
isValidateCodeValid = false;
jsonString.setMsg("支付码只能长度为6位!");
jsonString.setSuccess(false);
}
if (isValidateCodeValid) {// 验证码通过
// 调用核心接口检测支付码
boolean checkRes = getCoreChkResByPayCode(payCode);
String message = getCoreMessageByPayCode(payCode);
if (!checkRes) {// 支付码不可用
logger.info("offlineWechatPay,The paycode from browser do not use==>"
+ payCode);
jsonString.setMsg(message);
jsonString.setSuccess(false);
}
}
return jsonString;
}
/**
* 检测支付码状态(调用核心接口)
*
* @param request
* @return
* @throws Exception
*/
@RequestMapping(params = "checkPayCode")
@ResponseBody
public AjaxJson checkPayCode(HttpServletRequest request) throws Exception {
AjaxJson jsonString = new AjaxJson();
boolean isPayCodeValid = true;
String payCode = request.getParameter("payCode");
String openid = request.getParameter("openid");
String totalpremium = request.getParameter("totalpremium"); //获取各险种保费之和
if (StringUtils.isEmpty(payCode)) {
isPayCodeValid = false;
jsonString.setMsg("请输入支付码!");
jsonString.setSuccess(false);
} else if (payCode.length() != 6) {
isPayCodeValid = false;
jsonString.setMsg("支付码只能长度为6位!");
jsonString.setSuccess(false);
}
if (isPayCodeValid) {
// 调用核心接口检测支付码
boolean checkRes = getCoreChkResByPayCode(payCode);
String message = getCoreMessageByPayCode(payCode);
if (!checkRes) {// 支付码不可用
logger.info("offlineWechatPay,The paycode from browser do not use.");
jsonString.setMsg(message);
jsonString.setSuccess(false);
} else {
// 微信下单并返回JOSN对象
String body = "";// 险种名称
String json = " ";
String kindName = "";
String outTradeNo = "";// 支付码
String totalFee = "";// 总保费
String attach = "";// 订单号+被保险人名称+核心订单号
String orderId = "";// 订单号
String spbillCreateIp = IpUtil.getPayIpAddr(request);
WeiXinOfflineOrderInfo weiXinOfflineOrderInfo = offlineWechatPayService
.getOrderInfoByPayCode(payCode);
// 总费用处理 取分
totalFee = String.valueOf(BigDecimal.valueOf(weiXinOfflineOrderInfo.getSumPremium()).multiply(BigDecimal.valueOf(100)).intValue());
DecimalFormat df = new DecimalFormat("#.00");
double sumP =weiXinOfflineOrderInfo.getSumPremium();
double totalF = Double.parseDouble(totalpremium);
if(Math.abs(sumP-totalF) > 0.1){//验证是否与核心的总金额相等
logger.info("offlineWechatPay,totalFeeTemp no eq sumPremium.");
jsonString.setMsg("总保费["+df.format(sumP)+"]与分项保费合计["+df.format(totalF)+"]不符,不允许进行支付。");
jsonString.setSuccess(false);
}else{
attach = "CorePay"+","+weiXinOfflineOrderInfo.getPayCode()+","+weiXinOfflineOrderInfo.getInsuredName();
outTradeNo = weiXinOfflineOrderInfo.getPayCode() + "_"
+ UUIDGenerator.generate().substring(15);
for (WeiXinOfflineOrderDetail weiXinOfflineOrderDetail : weiXinOfflineOrderInfo
.getWeiXinOfflineOrderDetails()) {
kindName = weiXinOfflineOrderDetail.getKindName();
body += kindName + ",";
}
if (body.length() > 0) {
body = body.substring(0, body.length() - 1);
}
logger.info("openid=body=outTradeNo=totalFee=spbillCreateIp=attach===>"
+ openid
+ ":"
+ body
+ ":"
+ outTradeNo
+ ":"
+ totalFee + ":" + spbillCreateIp + ":" + attach);
// 调用支付接口返回支付jason
String activedProfile = request.getSession()
.getServletContext()
.getInitParameter("spring.profiles.active");
if (activedProfile.equals("prod")) {// 生产环境
json = wechatPayServiceImpl.getPayJsRequestJson(openid,
body, outTradeNo, totalFee, spbillCreateIp, attach);
} else {// 其他环境
json = wechatPayServiceImpl.getPayJsRequestJson(openid,
body, outTradeNo, "1", spbillCreateIp, attach);
}
jsonString.setObj(json);
logger.info("getPayJosn=openid+json====>" + openid + ":" + json);
// 记录系统日志
message = "OfflineWechatPay,payCode:[" + payCode + "]发起支付!";
systemService.addLog(message, Globals.Log_Type_INSERT,
Globals.Log_Leavel_INFO);
}
}
}
return jsonString;
}
/**
* 保费支付
*
* @param request
* @return
* @throws Exception
*/
@RequestMapping(params = "payOrder")
public String payOrder(HttpServletRequest request) throws Exception {
// 检查验证码状态
String randCode = request.getParameter("randCode");
String randCodeInSession = getSessionRandCode(request);
if (!randCode.equalsIgnoreCase(randCodeInSession)) {
logger.info("The randcode from browser not equal in httpsession.");
request.setAttribute("message", "验证码错误!");
return "/fo/offlinepay/payFail";
}
String payCode = request.getParameter("paycode");
String openid = (String) request.getAttribute("openid");
if (StringUtil.isEmpty(openid)) {
openid = request.getParameter("openid");
}
String orderId = "";// 订单号
String kindType = "0";// 0车险 1 非车险
Map<String, Object> detailList = null;
WeiXinOfflineOrderInfo weiXinOfflineOrderInfo = offlineWechatPayService
.getOrderInfoByPayCode(payCode);
detailList = offlineWechatPayService.getOrderInfoByDetail(weiXinOfflineOrderInfo.getId());
//保存返回的总金额
String totalpremium = "";
Double total = 0.0;
DecimalFormat df = new DecimalFormat("#.00");
for (WeiXinOfflineOrderDetail weiXinOfflineOrderDetail : weiXinOfflineOrderInfo
.getWeiXinOfflineOrderDetails()) {
total+= Double.parseDouble(weiXinOfflineOrderDetail.getPremium());
}
totalpremium = df.format(total);
// 参照起保日期来判断当前日期是否过期
int isEqDate = -1;
boolean isGtDate = false;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
// 系统当前日期
String dateSysString = sdf.format(new java.util.Date());
Date dateSysTemp = sdf.parse(dateSysString);
if (null != weiXinOfflineOrderInfo.getId()) {
isGtDate = dateSysTemp.after(weiXinOfflineOrderInfo
.getPolicyStartDate());
isEqDate = (dateSysTemp.compareTo(weiXinOfflineOrderInfo
.getPolicyStartDate()));
}
// 订单信息
if (null == weiXinOfflineOrderInfo.getId()) {
request.setAttribute("message", "微信支付订单信息为空,下单失败!");
return "/fo/offlinepay/payFail";
} else if (weiXinOfflineOrderInfo.getPayStatus() == TelesaleWSConstants.PAYSTATUS_SUCCESS) {
request.setAttribute("message", "微信支付订单状态为支付成功,下单失败!");
return "/fo/offlinepay/payFail";
} else if (weiXinOfflineOrderInfo.getPayStatus() == TelesaleWSConstants.PAYSTATUS_FAIL) {
request.setAttribute("message", "微信支付订单状态为支付失败,下单失败!");
return "/fo/offlinepay/payFail";
} else if (isGtDate || isEqDate == 0) {// 判断 起保日期 >当前日期
request.setAttribute(
"message",
"微信支付订单起保日期已过期,有效期为"
+ sdf.format(weiXinOfflineOrderInfo
.getPolicyStartDate()) + ",下单失败!");
return "/fo/offlinepay/payFail";
} else if (!getChkResByPayCodeStatus(weiXinOfflineOrderInfo
.getPayCodeStatus())) {// 支付码状态检测
String message = getMessageByPayCodeStatus(weiXinOfflineOrderInfo
.getPayCodeStatus());
request.setAttribute("message", message);
return "/fo/offlinepay/payFail";
} else if (null != weiXinOfflineOrderInfo.getId()
& weiXinOfflineOrderInfo.getPayStatus() == TelesaleWSConstants.PAYSTATUS_NOTPAY) {
orderId = weiXinOfflineOrderInfo.getId();
// 非车/车险判断
String classType = weiXinOfflineOrderInfo.getClassCode();
if (classType.toUpperCase()
.equals(TelesaleWSConstants.CLASSCODE_CX)) {// 车险
kindType = "0";
}
if (classType.toUpperCase()
.equals(TelesaleWSConstants.CLASSCODE_FC)) {// 非车
kindType = "1";
}
// 身份证加密
String identifyNumber = weiXinOfflineOrderInfo.getIdentifyNumber();
identifyNumber = IdcardUtils
.getEncryptionIdentifyNum(identifyNumber);
weiXinOfflineOrderInfo.setIdentifyNumber(identifyNumber);
}
request.setAttribute("payCode", weiXinOfflineOrderInfo.getPayCode());
request.setAttribute("kindType", kindType);
request.setAttribute("orderId", orderId);
request.setAttribute("openid", openid);
// changed by laiyaobin 201512041749
request.setAttribute("detailList", detailList);
request.setAttribute("weiXinOfflineOrderInfo", weiXinOfflineOrderInfo);
request.setAttribute("totalpremium", totalpremium);
// changed by qingqu.huang 201509221746
request.setAttribute("paytype", "wxpay");
return "fo/offlinepay/policyInfo";
}
/**
* 保费支付结果
*
* @param request
* @return
*/
@RequestMapping(params = "showPayResult")
public String showPayResult(HttpServletRequest request) {
String resultType = request.getParameter("result");
String orderId = request.getParameter("orderId");
String payCode = request.getParameter("payCode");
String msg = request.getParameter("msg");
String openid = (String) request.getAttribute("openid");
if (StringUtil.isEmpty(openid)) {
openid = request.getParameter("openid");
}
logger.info("showPayResult,orderId=>" + orderId + "\bresultType=>"
+ resultType + "\bmsg=>" + msg);
/* 微信支付日志处理 */
offlineWechatPayService.saveOrderInfoLog(orderId, resultType, msg);
if (resultType.equals("success")) {
// 记录系统日志
String message = "OfflineWechatPay,payCode:[" + payCode + "]支付成功!";
systemService.addLog(message, Globals.Log_Type_INSERT,
Globals.Log_Leavel_INFO);
WeiXinOfflineOrderInfo weiXinOfflineOrderInfo = payServiceImpl
.getEntity(WeiXinOfflineOrderInfo.class, orderId);
if (weiXinOfflineOrderInfo.getPayStatus() != 1) {
offlineWechatPayService.updOrderInfoByOrderIdAndStatus(orderId,
3);
}
try {
telesaleWebService.ReceivePayCodeStatus(weiXinOfflineOrderInfo.getPaycodemd5(), PaymentConstants.PAYCODESTATUS_006);
} catch (Exception e) {
logger.error("支付完成调用通知公共服务接口错误。。。", e);
}
request.setAttribute("openid", openid);
return "/fo/offlinepay/payResult";
} else {
offlineWechatPayService.updOrderInfoByOrderIdAndStatus(orderId, 2);
request.setAttribute("message", "保费支付失败!" + msg);
return "/fo/offlinepay/payFail";
}
}
/**
* 根据支付码调用核心接口返回文字信息(对外调用)
*
* @param payCodeStatus
* @return String
* @throws Exception
*/
private String getCoreMessageByPayCode(String payCode) throws Exception {
String message = (String) checkCorePayCode(payCode).get("coreMessage");
return message;
}
/**
* 根据支付码调用核心接口检测支付码是否可用(对外调用)
*
* @param payCodeStatus
* @return boolean
* @throws Exception
*/
private boolean getCoreChkResByPayCode(String payCode) throws Exception {
boolean checkRes = Boolean.parseBoolean(checkCorePayCode(payCode).get(
"coreChkReturn")
+ "");
return checkRes;
}
/**
* 根据支付码状态返回文字信息(对外调用)
*
* @param payCodeStatus
* @return String
*/
private String getMessageByPayCodeStatus(String payCodeStatus) {
String message = (String) getPayCodeStatus(payCodeStatus)
.get("message");
return message;
}
/**
* 根据支付码状态检测支付码是否可用(对外调用)
*
* @param payCodeStatus
* @return boolean
*/
private boolean getChkResByPayCodeStatus(String payCodeStatus) {
boolean checkRes = Boolean.parseBoolean(""
+ getPayCodeStatus(payCodeStatus).get("chkReturn"));
return checkRes;
}
/**
* 支付码状态文字信息 key:message,chkReturn 如果状态是005(支付成功),checkReturn则返回true,message
* 为支付码没通过的错误信息
*
* @param payCodeState
* @return orderPayCodeStatusMap
*/
private Map<String, Object> getPayCodeStatus(String payCodeStatus) {
String message = "支付码不存在!";
boolean res = false;
if (payCodeStatus.equals(TelesaleWSConstants.PAYCODESTATUS_1))
message = "您输入的支付码不存在,请重新输入!";
if (payCodeStatus.equals(TelesaleWSConstants.PAYCODESTATUS_2))
message = "您输入的支付码已过期,请与工作人员联系,获取新的支付码!";
if (payCodeStatus.equals(TelesaleWSConstants.PAYCODESTATUS_3))
message = "您输入的支付码已失效,请与工作人员联系,获取新的支付码!";
if (payCodeStatus.equals(TelesaleWSConstants.PAYCODESTATUS_4))
message = "您输入的支付码已完成支付,请重新输入!";
if (payCodeStatus.equals(TelesaleWSConstants.PAYCODESTATUS_5))
res = true;
Map<String, Object> orderPayCodeStatusMap = new HashMap<String, Object>();
orderPayCodeStatusMap.put("message", message);
orderPayCodeStatusMap.put("chkReturn", res);// 测试 true
return orderPayCodeStatusMap;
}
/**
* 从session获取验证码
*
* @param request
* @return String
*/
private String getSessionRandCode(HttpServletRequest request) {
HttpSession session = request.getSession();
String openid = request.getParameter("openid");
String randCodeInSession = (String) session
.getAttribute(Constants.SESSION_KEY_RAND_CODE);
logger.info("offlineWechatPay,from server session, randCode=>"
+ randCodeInSession + ",sessionid=>" + session.getId());
// 若session为空则从membercahced中取值
if (StringUtils.isEmpty(randCodeInSession)) {
randCodeInSession = (String) CachedUtils.get("randCode" + openid);
logger.info("offlineWechatPay,from server membercahced, randCode=>"
+ randCodeInSession);
}
return randCodeInSession;
}
/**
* 调用核心接口检测支付码
*
* @param payCode
* @return orderPayCodeMap
* @throws Exception
*/
private Map<String, Object> checkCorePayCode(String payCode)
throws Exception {
// changed by qingqu.huang 201509221746
if (StringUtil.isNotEmpty(payCode)) {
payCode = MD5Utils.MD5(payCode);
}
String payCodeStatus = "";
WeiXinOfflineOrderInfo weiXinOfflineOrderInfo = telesaleWebService
.checkPayCode(payCode);
if (null != weiXinOfflineOrderInfo
&& null != weiXinOfflineOrderInfo.getPayCodeStatus()) {
payCodeStatus = weiXinOfflineOrderInfo.getPayCodeStatus();
}
logger.info("offlineWechatPay,from client, payCode=>" + payCode);
logger.info("offlineWechatPay,from server, payCodeStatus=>"
+ payCodeStatus);
boolean checkRes = getChkResByPayCodeStatus(payCodeStatus);
String message = getMessageByPayCodeStatus(payCodeStatus);
Map<String, Object> orderPayCodeMap = new HashMap<String, Object>();
orderPayCodeMap.put("coreMessage", message);
orderPayCodeMap.put("coreChkReturn", checkRes);
return orderPayCodeMap;
}
} | [
"fangfang.guo@fubon.com.cn"
] | fangfang.guo@fubon.com.cn |
13b3f75066a5bde621955fde4c712f0e7403d972 | c7c721e9d840e5a53d00ab2b0e586bd1865feb3c | /app/src/main/java/com/wokun/tysl/model/bean/UploadFileSingle.java | 249a944163ad66023eb387304f36608bb1bbe7c1 | [] | no_license | lenka123123/MyProgram | 6f4a81cfa0a467039d97426610ce29ac9d342a31 | 1b76f278538a7e093c92df1339da5e06ad5a57e7 | refs/heads/master | 2020-03-28T00:47:32.345765 | 2019-04-15T01:51:39 | 2019-04-15T01:52:34 | 147,449,901 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 600 | java | package com.wokun.tysl.model.bean;
public class UploadFileSingle {
private String headImgUrl;
private String url;
private String filename;
public String getHeadImgUrl() {
return headImgUrl;
}
public void setHeadImgUrl(String headImgUrl) {
this.headImgUrl = headImgUrl;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getFilename() {
return filename;
}
public void setFilename(String filename) {
this.filename = filename;
}
}
| [
"2177768307@qq.com"
] | 2177768307@qq.com |
32cf602694d97a2f0535f108712df6007374021b | c502aaffec24ec0d6bfd7ed97e4e1724b7120d51 | /src/main/java/com/lm/sales/processor/AbstractSaleProcessor.java | 4f1f5a51c4544f6bf3457e3640416905bdb2cee4 | [] | no_license | gfiorini/salesTaxes | a8578123471b4030eaad805af66b4a28fbf60adc | 99e789394bd5a20c2cb90cac7cfb3fbdfbbd9b77 | refs/heads/master | 2021-07-11T07:15:35.714976 | 2019-10-05T14:27:29 | 2019-10-05T14:28:52 | 209,991,178 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 323 | java | package com.lm.sales.processor;
import com.lm.sales.helper.ITaxRounder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public abstract class AbstractSaleProcessor implements ISaleProcessor {
@Autowired
protected ITaxRounder rounder;
}
| [
"gianluca.fiorini@gmail.com"
] | gianluca.fiorini@gmail.com |
c0d1ba8bc877982dcfdb63f8ae936c82cb2d8947 | 81c7067c8170e3e61530522835577fd5e58527c1 | /app/src/main/java/com/zjzy/morebit/utils/Banner.java | a82c1fb1501f71a31b8d3386294391652159027a | [
"Apache-2.0"
] | permissive | Lchenghui/morebit-android-app | 7806295750770f8fb55483797f621bc88054d259 | c889f6c3efdc3b96fbff48a23b0d01a65d6b8aa5 | refs/heads/master | 2023-02-26T18:31:51.575690 | 2020-09-14T09:35:00 | 2020-09-14T09:35:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 27,082 | java | package com.zjzy.morebit.utils;
import android.content.Context;
import android.content.res.TypedArray;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.youth.banner.BannerConfig;
import com.youth.banner.BannerScroller;
import com.youth.banner.WeakHandler;
import com.youth.banner.listener.OnBannerClickListener;
import com.youth.banner.listener.OnBannerListener;
import com.youth.banner.loader.ImageLoaderInterface;
import com.youth.banner.view.BannerViewPager;
import com.zjzy.morebit.R;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;
public class Banner extends FrameLayout implements ViewPager.OnPageChangeListener {
public String tag = "banner";
private int mIndicatorMargin = BannerConfig.PADDING_SIZE;
private int mIndicatorWidth;
private int mIndicatorHeight;
private int indicatorSize;
private int bannerBackgroundImage;
private int bannerStyle = BannerConfig.CIRCLE_INDICATOR;
//目前仅仅支持 BannerConfig.RECTANGLE_INDICATOR 类型,设置 未选中的指示器宽度
private int indicatorUnselectedWidth=-1;
private int delayTime = BannerConfig.TIME;
private int scrollTime = BannerConfig.DURATION;
private boolean isAutoPlay = BannerConfig.IS_AUTO_PLAY;
private boolean isScroll = BannerConfig.IS_SCROLL;
private int mIndicatorSelectedResId = R.drawable.gray_radius;
private int mIndicatorUnselectedResId = R.drawable.white_radius;
private int mLayoutResId = R.layout.banner;
private int titleHeight;
private int titleBackground;
private int titleTextColor;
private int titleTextSize;
private int count = 0;
private int currentItem;
private int gravity = -1;
private int lastPosition = 1;
private int scaleType = 1;
private List<String> titles;
private List imageUrls;
private List<View> imageViews;
private List<ImageView> indicatorImages;
private Context context;
private BannerViewPager viewPager;
private TextView bannerTitle, numIndicatorInside, numIndicator;
private LinearLayout indicator, indicatorInside, titleView;
private ImageView bannerDefaultImage;
private ImageLoaderInterface imageLoader;
private BannerPagerAdapter adapter;
private ViewPager.OnPageChangeListener mOnPageChangeListener;
private BannerScroller mScroller;
private OnBannerClickListener bannerListener;
private OnBannerListener listener;
private DisplayMetrics dm;
private float mPercentage = 1;//每页占比
private WeakHandler handler = new WeakHandler();
public Banner(Context context) {
this(context, null);
}
public Banner(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public Banner(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
this.context = context;
titles = new ArrayList<>();
imageUrls = new ArrayList<>();
imageViews = new ArrayList<>();
indicatorImages = new ArrayList<>();
dm = context.getResources().getDisplayMetrics();
indicatorSize = dm.widthPixels / 80;
initView(context, attrs);
}
private void initView(Context context, AttributeSet attrs) {
imageViews.clear();
handleTypedArray(context, attrs);
View view = LayoutInflater.from(context).inflate(mLayoutResId, this, true);
bannerDefaultImage = (ImageView) view.findViewById(R.id.bannerDefaultImage);
viewPager = (BannerViewPager) view.findViewById(R.id.bannerViewPager);
titleView = (LinearLayout) view.findViewById(R.id.titleView);
indicator = (LinearLayout) view.findViewById(R.id.circleIndicator);
indicatorInside = (LinearLayout) view.findViewById(R.id.indicatorInside);
bannerTitle = (TextView) view.findViewById(R.id.bannerTitle);
numIndicator = (TextView) view.findViewById(R.id.numIndicator);
numIndicatorInside = (TextView) view.findViewById(R.id.numIndicatorInside);
bannerDefaultImage.setImageResource(bannerBackgroundImage);
initViewPagerScroll();
}
private void handleTypedArray(Context context, AttributeSet attrs) {
if (attrs == null) {
return;
}
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.Banner);
mIndicatorWidth = typedArray.getDimensionPixelSize(R.styleable.Banner_indicator_width, indicatorSize);
// indicatorUnselectedWidth = typedArray.getDimensionPixelSize(R.styleable.Banner_indicator_unselectd_width, indicatorSize);
mIndicatorHeight = typedArray.getDimensionPixelSize(R.styleable.Banner_indicator_height, indicatorSize);
mIndicatorMargin = typedArray.getDimensionPixelSize(R.styleable.Banner_indicator_margin, BannerConfig.PADDING_SIZE);
mIndicatorSelectedResId = typedArray.getResourceId(R.styleable.Banner_indicator_drawable_selected, R.drawable.gray_radius);
mIndicatorUnselectedResId = typedArray.getResourceId(R.styleable.Banner_indicator_drawable_unselected, R.drawable.white_radius);
scaleType = typedArray.getInt(R.styleable.Banner_image_scale_type, scaleType);
delayTime = typedArray.getInt(R.styleable.Banner_delay_time, BannerConfig.TIME);
scrollTime = typedArray.getInt(R.styleable.Banner_scroll_time, BannerConfig.DURATION);
isAutoPlay = typedArray.getBoolean(R.styleable.Banner_is_auto_play, BannerConfig.IS_AUTO_PLAY);
titleBackground = typedArray.getColor(R.styleable.Banner_title_background, BannerConfig.TITLE_BACKGROUND);
titleHeight = typedArray.getDimensionPixelSize(R.styleable.Banner_title_height, BannerConfig.TITLE_HEIGHT);
titleTextColor = typedArray.getColor(R.styleable.Banner_title_textcolor, BannerConfig.TITLE_TEXT_COLOR);
titleTextSize = typedArray.getDimensionPixelSize(R.styleable.Banner_title_textsize, BannerConfig.TITLE_TEXT_SIZE);
mLayoutResId = typedArray.getResourceId(R.styleable.Banner_banner_layout, mLayoutResId);
bannerBackgroundImage = typedArray.getResourceId(R.styleable.Banner_banner_default_image, R.drawable.no_banner);
typedArray.recycle();
}
private void initViewPagerScroll() {
try {
Field mField = ViewPager.class.getDeclaredField("mScroller");
mField.setAccessible(true);
mScroller = new BannerScroller(viewPager.getContext());
mScroller.setDuration(scrollTime);
mField.set(viewPager, mScroller);
} catch (Exception e) {
Log.e(tag, e.getMessage());
}
}
/**
* 页面宽度所占ViewPager测量宽度的权重比例,默认为1.0F
*
* @param percentage 每页占比 0.0~1.0
* @return
*/
public Banner setPageWith(float percentage) {
this.mPercentage = percentage;
return this;
}
/**
* 设置banner 图片页面间距
*
* @param marginPixels
* @return
*/
public Banner setPageMargin(int marginPixels) {
viewPager.setPageMargin(marginPixels);
return this;
}
public List<View> getImageViews() {
return imageViews;
}
public ViewPager getViewPager() {
return viewPager;
}
/**
* 设置viewpager的margin
*
* @param left
* @param top
* @param right
* @param bottom
* @return
*/
public Banner setViewPageMargin(int left, int top, int right, int bottom) {
ViewGroup.LayoutParams lp = viewPager.getLayoutParams();
if (lp instanceof RelativeLayout.LayoutParams) {
RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) viewPager.getLayoutParams();
layoutParams.setMargins(left, top, right, bottom);
} else if (lp instanceof LinearLayout.LayoutParams) {
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) viewPager.getLayoutParams();
layoutParams.setMargins(left, top, right, bottom);
} else if (lp instanceof FrameLayout.LayoutParams) {
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) viewPager.getLayoutParams();
layoutParams.setMargins(left, top, right, bottom);
}
return this;
}
public Banner isAutoPlay(boolean isAutoPlay) {
this.isAutoPlay = isAutoPlay;
return this;
}
public Banner setImageLoader(ImageLoaderInterface imageLoader) {
this.imageLoader = imageLoader;
return this;
}
public Banner setDelayTime(int delayTime) {
this.delayTime = delayTime;
return this;
}
public Banner setIndicatorGravity(int type) {
switch (type) {
case BannerConfig.LEFT:
this.gravity = Gravity.LEFT | Gravity.CENTER_VERTICAL;
break;
case BannerConfig.CENTER:
this.gravity = Gravity.CENTER;
break;
case BannerConfig.RIGHT:
this.gravity = Gravity.RIGHT | Gravity.CENTER_VERTICAL;
break;
}
return this;
}
public Banner setBannerAnimation(Class<? extends ViewPager.PageTransformer> transformer) {
try {
setPageTransformer(true, transformer.newInstance());
} catch (Exception e) {
Log.e(tag, "Please set the PageTransformer class");
}
return this;
}
/**
* Set the number of pages that should be retained to either side of the
* current page in the view hierarchy in an idle state. Pages beyond this
* limit will be recreated from the adapter when needed.
*
* @param limit How many pages will be kept offscreen in an idle state.
* @return Banner
*/
public Banner setOffscreenPageLimit(int limit) {
if (viewPager != null) {
viewPager.setOffscreenPageLimit(limit);
}
return this;
}
/**
* Set a {@} that will be called for each attached page whenever
* the scroll position is changed. This allows the application to apply custom property
* transformations to each page, overriding the default sliding look and feel.
*
* @param reverseDrawingOrder true if the supplied PageTransformer requires page views
* to be drawn from last to first instead of first to last.
* @param transformer PageTransformer that will modify each page's animation properties
* @return Banner
*/
public Banner setPageTransformer(boolean reverseDrawingOrder, ViewPager.PageTransformer transformer) {
viewPager.setPageTransformer(reverseDrawingOrder, transformer);
return this;
}
public Banner setBannerTitles(List<String> titles) {
this.titles = titles;
return this;
}
public Banner setBannerStyle(int bannerStyle) {
this.bannerStyle = bannerStyle;
return this;
}
/**
* 目前 仅仅支持 BannerConfig.RECTANGLE_INDICATOR 类型,设置 未选中的指示器宽度
* @param unSelectWidth
* @return
*/
public Banner setRectIndicationUnselectWidth(int unSelectWidth){
this.indicatorUnselectedWidth=unSelectWidth;
return this;
}
public Banner setViewPagerIsScroll(boolean isScroll) {
this.isScroll = isScroll;
return this;
}
public Banner setImages(List<?> imageUrls) {
this.imageUrls = imageUrls;
this.count = imageUrls.size();
return this;
}
public void update(List<?> imageUrls, List<String> titles) {
this.titles.clear();
this.titles.addAll(titles);
update(imageUrls);
}
public void update(List<?> imageUrls) {
this.imageUrls.clear();
this.imageViews.clear();
this.indicatorImages.clear();
this.imageUrls.addAll(imageUrls);
this.count = this.imageUrls.size();
start();
}
public void updateBannerStyle(int bannerStyle) {
indicator.setVisibility(GONE);
numIndicator.setVisibility(GONE);
numIndicatorInside.setVisibility(GONE);
indicatorInside.setVisibility(GONE);
bannerTitle.setVisibility(View.GONE);
titleView.setVisibility(View.GONE);
this.bannerStyle = bannerStyle;
start();
}
public Banner start() {
setBannerStyleUI();
setImageList(imageUrls);
setData();
return this;
}
private void setTitleStyleUI() {
if (titles.size() != imageUrls.size()) {
throw new RuntimeException("[Banner] --> The number of titles and images is different");
}
if (titleBackground != -1) {
titleView.setBackgroundColor(titleBackground);
}
if (titleHeight != -1) {
titleView.setLayoutParams(new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, titleHeight));
}
if (titleTextColor != -1) {
bannerTitle.setTextColor(titleTextColor);
}
if (titleTextSize != -1) {
bannerTitle.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleTextSize);
}
if (titles != null && titles.size() > 0) {
bannerTitle.setText(titles.get(0));
bannerTitle.setVisibility(View.VISIBLE);
titleView.setVisibility(View.VISIBLE);
}
}
private void setBannerStyleUI() {
int visibility = count > 1 ? View.VISIBLE : View.GONE;
switch (bannerStyle) {
case BannerConfig.CIRCLE_INDICATOR:
indicator.setVisibility(visibility);
break;
case BannerConfig.NUM_INDICATOR:
numIndicator.setVisibility(visibility);
break;
case BannerConfig.NUM_INDICATOR_TITLE:
numIndicatorInside.setVisibility(visibility);
setTitleStyleUI();
break;
case BannerConfig.CIRCLE_INDICATOR_TITLE:
indicator.setVisibility(visibility);
setTitleStyleUI();
break;
case BannerConfig.CIRCLE_INDICATOR_TITLE_INSIDE:
indicatorInside.setVisibility(visibility);
setTitleStyleUI();
break;
}
}
private void initImages() {
imageViews.clear();
if (bannerStyle == BannerConfig.CIRCLE_INDICATOR ||
bannerStyle == BannerConfig.CIRCLE_INDICATOR_TITLE ||
bannerStyle == BannerConfig.CIRCLE_INDICATOR_TITLE_INSIDE) {
createIndicator();
} else if (bannerStyle == BannerConfig.NUM_INDICATOR_TITLE) {
numIndicatorInside.setText("1/" + count);
} else if (bannerStyle == BannerConfig.NUM_INDICATOR) {
numIndicator.setText("1/" + count);
}
}
private void setImageList(List<?> imagesUrl) {
if (imagesUrl == null || imagesUrl.size() <= 0) {
bannerDefaultImage.setVisibility(VISIBLE);
Log.e(tag, "The image data set is empty.");
return;
}
bannerDefaultImage.setVisibility(GONE);
initImages();
for (int i = 0; i <= count + 1; i++) {
View imageView = null;
if (imageLoader != null) {
imageView = imageLoader.createImageView(context);
}
if (imageView == null) {
imageView = new ImageView(context);
}
setScaleType(imageView);
Object url = null;
if (i == 0) {
url = imagesUrl.get(count - 1);
} else if (i == count + 1) {
url = imagesUrl.get(0);
} else {
url = imagesUrl.get(i - 1);
}
imageViews.add(imageView);
if (imageLoader != null)
imageLoader.displayImage(context, url, imageView);
else
Log.e(tag, "Please set images loader.");
}
}
private void setScaleType(View imageView) {
if (imageView instanceof ImageView) {
ImageView view = ((ImageView) imageView);
switch (scaleType) {
case 0:
view.setScaleType(ImageView.ScaleType.CENTER);
break;
case 1:
view.setScaleType(ImageView.ScaleType.CENTER_CROP);
break;
case 2:
view.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
break;
case 3:
view.setScaleType(ImageView.ScaleType.FIT_CENTER);
break;
case 4:
view.setScaleType(ImageView.ScaleType.FIT_END);
break;
case 5:
view.setScaleType(ImageView.ScaleType.FIT_START);
break;
case 6:
view.setScaleType(ImageView.ScaleType.FIT_XY);
break;
case 7:
view.setScaleType(ImageView.ScaleType.MATRIX);
break;
}
}
}
private void createIndicator() {
indicatorImages.clear();
indicator.removeAllViews();
indicatorInside.removeAllViews();
for (int i = 0; i < count; i++) {
ImageView imageView = new ImageView(context);
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(bannerStyle == 0 ?
indicatorUnselectedWidth:mIndicatorWidth, mIndicatorHeight);
params.leftMargin = mIndicatorMargin;
params.rightMargin = mIndicatorMargin;
if (i == 0) {
imageView.setImageResource(mIndicatorSelectedResId);
} else {
imageView.setImageResource(mIndicatorUnselectedResId);
}
indicatorImages.add(imageView);
if (bannerStyle == BannerConfig.CIRCLE_INDICATOR ||
bannerStyle == BannerConfig.CIRCLE_INDICATOR_TITLE)
indicator.addView(imageView, params);
else if (bannerStyle == BannerConfig.CIRCLE_INDICATOR_TITLE_INSIDE)
indicatorInside.addView(imageView, params);
}
}
private void setData() {
currentItem = 1;
if (adapter == null) {
adapter = new BannerPagerAdapter();
viewPager.addOnPageChangeListener(this);
}
viewPager.setAdapter(adapter);
viewPager.setFocusable(true);
viewPager.setCurrentItem(1);
if (gravity != -1)
indicator.setGravity(gravity);
if (isScroll && count > 1) {
viewPager.setScrollable(true);
} else {
viewPager.setScrollable(false);
}
if (isAutoPlay)
startAutoPlay();
}
public void startAutoPlay() {
handler.removeCallbacks(task);
handler.postDelayed(task, delayTime);
}
public void stopAutoPlay() {
handler.removeCallbacks(task);
}
private final Runnable task = new Runnable() {
@Override
public void run() {
if (count > 1 && isAutoPlay) {
currentItem = currentItem % (count + 1) + 1;
// Log.i(tag, "curr:" + currentItem + " count:" + count);
if (currentItem == 1) {
viewPager.setCurrentItem(currentItem, false);
handler.post(task);
} else {
viewPager.setCurrentItem(currentItem);
handler.postDelayed(task, delayTime);
}
}
}
};
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
// Log.i(tag, ev.getAction() + "--" + isAutoPlay);
if (isAutoPlay) {
int action = ev.getAction();
if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL
|| action == MotionEvent.ACTION_OUTSIDE) {
startAutoPlay();
} else if (action == MotionEvent.ACTION_DOWN) {
stopAutoPlay();
}
}
return super.dispatchTouchEvent(ev);
}
/**
* 返回真实的位置
*
* @param position
* @return 下标从0开始
*/
public int toRealPosition(int position) {
int realPosition = (position - 1) % count;
if (realPosition < 0)
realPosition += count;
return realPosition;
}
class BannerPagerAdapter extends PagerAdapter {
@Override
public int getCount() {
return imageViews.size();
}
@Override
public float getPageWidth(int position) {
return mPercentage;
}
@Override
public boolean isViewFromObject(View view, Object object) {
return view == object;
}
@Override
public Object instantiateItem(ViewGroup container, final int position) {
container.addView(imageViews.get(position));
View view = imageViews.get(position);
if (bannerListener != null) {
view.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Log.e(tag, "你正在使用旧版点击事件接口,下标是从1开始," +
"为了体验请更换为setOnBannerListener,下标从0开始计算");
bannerListener.OnBannerClick(position);
}
});
}
if (listener != null) {
view.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
listener.OnBannerClick(toRealPosition(position));
}
});
}
return view;
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
container.removeView((View) object);
}
}
@Override
public void onPageScrollStateChanged(int state) {
if (mOnPageChangeListener != null) {
mOnPageChangeListener.onPageScrollStateChanged(state);
}
// Log.i(tag,"currentItem: "+currentItem);
switch (state) {
case 0://No operation
if (currentItem == 0) {
viewPager.setCurrentItem(count, false);
} else if (currentItem == count + 1) {
viewPager.setCurrentItem(1, false);
}
break;
case 1://start Sliding
if (currentItem == count + 1) {
viewPager.setCurrentItem(1, false);
} else if (currentItem == 0) {
viewPager.setCurrentItem(count, false);
}
break;
case 2://end Sliding
break;
}
}
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
if (mOnPageChangeListener != null) {
mOnPageChangeListener.onPageScrolled(toRealPosition(position), positionOffset, positionOffsetPixels);
}
}
@Override
public void onPageSelected(int position) {
currentItem = position;
if (mOnPageChangeListener != null) {
mOnPageChangeListener.onPageSelected(toRealPosition(position));
}
if (bannerStyle == BannerConfig.CIRCLE_INDICATOR ||
bannerStyle == BannerConfig.CIRCLE_INDICATOR_TITLE ||
bannerStyle == BannerConfig.CIRCLE_INDICATOR_TITLE_INSIDE) {
ImageView unImageView = indicatorImages.get((lastPosition - 1 + count) % count);
ImageView imageView = indicatorImages.get((position - 1 + count) % count);
unImageView.setImageResource(mIndicatorSelectedResId);
imageView.setImageResource(mIndicatorUnselectedResId);
lastPosition = position;
}
if (position == 0) position = count;
if (position > count) position = 1;
switch (bannerStyle) {
case BannerConfig.CIRCLE_INDICATOR:
break;
case BannerConfig.NUM_INDICATOR:
numIndicator.setText(position + "/" + count);
break;
case BannerConfig.NUM_INDICATOR_TITLE:
numIndicatorInside.setText(position + "/" + count);
bannerTitle.setText(titles.get(position - 1));
break;
case BannerConfig.CIRCLE_INDICATOR_TITLE:
bannerTitle.setText(titles.get(position - 1));
break;
case BannerConfig.CIRCLE_INDICATOR_TITLE_INSIDE:
bannerTitle.setText(titles.get(position - 1));
break;
}
}
@Deprecated
public Banner setOnBannerClickListener(OnBannerClickListener listener) {
this.bannerListener = listener;
return this;
}
/**
* 废弃了旧版接口,新版的接口下标是从1开始,同时解决下标越界问题
*
* @param listener
* @return
*/
public Banner setOnBannerListener(OnBannerListener listener) {
this.listener = listener;
return this;
}
public Banner setOnPageChangeListener(ViewPager.OnPageChangeListener onPageChangeListener) {
mOnPageChangeListener = onPageChangeListener;
return this;
}
public void releaseBanner() {
handler.removeCallbacksAndMessages(null);
}
}
| [
"1658865887@qq.com"
] | 1658865887@qq.com |
df58aee5621945105b5c26a4ab03b5ab1edd8267 | 03cabc3fab410601b8bac60416d6a81c1e28793e | /PhoneStore_Demo/src/main/java/com/rikkei/service/JWTTokenService.java | 7305f81650fd3c53d34e4bc31adbd6bd6ea0b522 | [] | no_license | phamminhtuan197/rikkei | d0ad2c808ce88c58bed8603f6cea31ef18149605 | 0b5cf9a31a32d90eda46c27287aaa407f5aff8ae | refs/heads/master | 2023-07-02T02:17:20.247360 | 2021-08-16T08:09:11 | 2021-08-16T08:09:11 | 387,969,566 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,707 | java | package com.rikkei.service;
import javax.servlet.http.HttpServletResponse;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import javax.servlet.http.HttpServletRequest;
import java.util.Collections;
import java.util.Date;
public class JWTTokenService {
private static final long EXPIRATION_TIME = 864000000; // 10 days
private static final String SECRET = "123456";
private static final String PREFIX_TOKEN = "Bearer";
private static final String AUTHORIZATION = "Authorization";
public static void addJWTTokenToHeader(HttpServletResponse response, String username) {
String JWT = Jwts.builder()
.setSubject(username)
.setExpiration(new Date(System.currentTimeMillis() + EXPIRATION_TIME))
.signWith(SignatureAlgorithm.HS512, SECRET)
.compact();
response.addHeader(AUTHORIZATION, PREFIX_TOKEN + " " + JWT);
}
public static Authentication parseTokenToUserInformation(HttpServletRequest request) {
String token = request.getHeader(AUTHORIZATION);
if (token == null) {
return null;
}
// parse the token
String username = Jwts.parser()
.setSigningKey(SECRET)
.parseClaimsJws(token.replace(PREFIX_TOKEN, ""))
.getBody()
.getSubject();
return username != null ?
new UsernamePasswordAuthenticationToken(username, null, Collections.emptyList()) :
null;
}
} | [
"phamminhtuan197@gmail.com"
] | phamminhtuan197@gmail.com |
2c09ba7d63f256a551171c040582004fe2397ce6 | bcd2705164ecd4d4585ccd06aa11eafc4d3c3ee2 | /MOAPDBPostgres/src/arida/ufc/br/moap/db/postgres/imp/PostgresqlProvider.java | 708e7ac1e75024e9cf9a497ae53f325ddd18b6ff | [] | no_license | jmacedoj/moap | ed844979a5e3142901874af80630277c1558a8df | 75230152ba866acdcab0bc8a57bd7d71d6e0a871 | refs/heads/master | 2021-01-20T23:38:04.280530 | 2012-11-13T00:23:48 | 2012-11-13T00:23:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,312 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package arida.ufc.br.moap.db.postgres.imp;
import arida.ufc.br.moap.core.database.spi.AbstractDatabase;
import java.io.Serializable;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
/**
*
* @author igobrilhante
*/
//@ServiceProvider(service=Database.class)
public class PostgresqlProvider extends AbstractDatabase implements Serializable {
// private static final int SRID = Integer.parseInt(PostgisProperties.getInstance().getType("srid"));
private static final long serialVersionUID = -85997221180839532L;
// private ConnectionProperty cm;
// private Connection connection;
// private static PostgresqlBuilder instance;
public final int COMMIT_LIMIT = 100;
private final Logger logger = Logger.getLogger(PostgresqlProvider.class);
public PostgresqlProvider(){ System.out.println("a");}
// private PostgresqlBuilder(){
// instance = new PostgresqlBuilder();
// }
// public static PostgresqlBuilder getInstance(){
// if(instance==null){
// return new PostgresqlBuilder();
// }
// return (PostgresqlBuilder) instance;
// }
// public Connection getConnection() {
// return this.connection;
// }
// public ConnectionProperty getConnectionDBManager(){
// return this.cm;
// }
public void close() throws SQLException{
this.connection.close();
}
public synchronized void createTable(String table_name, String attributes) throws Exception,SQLException {
logger.info("Creating table " + table_name);
Statement state = connection.createStatement();
String query = "SELECT COUNT(*) count FROM pg_stat_user_tables WHERE schemaname='public' and relname = '" + table_name + "'";
ResultSet result = state.executeQuery(query);
int update;
//System.out.println(query);
result.next();
if (result.getInt(1) > 0) {
//System.out.println("Drop table result: "+update);
}
query = "DROP TABLE if exists " + table_name;
update = state.executeUpdate(query);
query = "CREATE TABLE " + table_name + " (" + attributes + ")";
update = state.executeUpdate(query);
//System.out.println("Create table result: "+update);
state.close();
// connection.commit();
}
public synchronized void createTable(String table_name, String attributes, boolean replace) {
}
public synchronized boolean tableExists(String table) throws SQLException{
Statement state = connection.createStatement();
String q = "SELECT COUNT(*) count FROM pg_stat_user_tables WHERE schemaname='public' and relname = '" + table + "'";
ResultSet result = state.executeQuery(q);
int update;
//System.out.println(query);
result.next();
int r = result.getInt(1);
result.close();
state.close();
if ( r == 0)
return false;
return true;
}
public synchronized void createTableAsQuery(String table_name, String query) throws Exception,SQLException {
logger.info("Creating table " + table_name);
Statement state = connection.createStatement();
String q = "SELECT COUNT(*) count FROM pg_stat_user_tables WHERE schemaname='public' and relname = '" + table_name + "'";
ResultSet result = state.executeQuery(q);
int update;
//System.out.println(query);
result.next();
if (result.getInt(1) > 0) {
q = "DROP TABLE " + table_name;
update = state.executeUpdate(q);
//System.out.println("Drop table result: "+update);
}
q = "DROP TABLE IF EXISTS " + table_name+"; CREATE TABLE " + table_name + " as " +query;
update = state.executeUpdate(q);
//System.out.println("Create table result: "+update);
state.close();
// connection.commit();
}
public synchronized void createSpatialIndex(String table, String index, String attribute){
try {
logger.info("Create Index");
// CREATE INDEX [indexname] ON [tablename] USING GIST ( [geometrycolumn] );
String q = "CREATE INDEX "+index+" ON "+table+ " USING GIST ("+ attribute+") ";
if(tableExists(table)){
Statement stat = connection.createStatement();
stat.executeUpdate(q);
}
} catch (SQLException ex) {
ex.printStackTrace();
}
}
public synchronized void createTableAsQuery(String table_name, String query,String index) throws Exception,SQLException {
logger.info("Creating table " + table_name);
Statement state = connection.createStatement();
String q = "SELECT COUNT(*) count FROM pg_stat_user_tables WHERE schemaname='public' and relname = '" + table_name + "'";
ResultSet result = state.executeQuery(q);
int update;
//System.out.println(query);
result.next();
if (result.getInt(1) > 0) {
q = "DROP TABLE " + table_name;
update = state.executeUpdate(q);
//System.out.println("Drop table result: "+update);
}
q = "CREATE TABLE " + table_name + " as " +query;
update = state.executeUpdate(q);
//System.out.println("Create table result: "+update);
if(!index.equals(""))
state.execute("ALTER TABLE "+table_name+" ADD PRIMARY KEY ("+index+")");
// connection.commit();
state.close();
}
public synchronized void addColumn(String table_name, String attribute, String type) throws Exception {
Statement state = connection.createStatement();
String query = "SELECT count(*) FROM information_schema.columns WHERE table_name = '"+table_name+"' and column_name='"+attribute+"'";
ResultSet rs = state.executeQuery(query);
int count = 0;
while(rs.next()){
count = rs.getInt(1);
}
if(count>0){
query = "ALTER TABLE " + table_name + " DROP COLUMN " + attribute;
state.executeUpdate(query);
}
query = "ALTER TABLE " + table_name + " ADD COLUMN " + attribute + " " + type;
System.out.println(query);
state.executeUpdate(query);
state.close();
// connection.commit();
}
public synchronized String prepareStatement(int atts, String table) {
if (atts > 0) {
String statement = "INSERT INTO " + table + " VALUES (";
for (int i = 0; i < atts; i++) {
if (i == atts - 1) {
statement += "?";
}
else {
statement += "?,";
}
}
statement += ")";
return statement;
}
throw new RuntimeException("Number of attributes is invalid");
}
private void storeAttributes() {
}
// public synchronized String getType(AttributeType type) {
// switch (type) {
// case STRING:
// return "text";
// case INT:
// return "integer";
// case DOUBLE:
// return "numeric";
// case FLOAT:
// return "numeric";
// case LONG:
// return "bigint";
// default:
// return null;
// }
// }
//
// public synchronized AttributeType getAttributeType(String type) {
// if (type.equalsIgnoreCase("text")) {
// return AttributeType.STRING;
// }
// if (type.equalsIgnoreCase("integer")) {
// return AttributeType.LONG;
// }
// if (type.equalsIgnoreCase("int4")) {
// return AttributeType.LONG;
// }
// if (type.equalsIgnoreCase("numeric")) {
// return AttributeType.FLOAT;
// }
// throw new RuntimeException("Type " + type + " has not been found");
// }
//
// public int getNumberOfColumns(AttributeTable table) {
// int count = 0;
// for (AttributeColumn c : table.getColumns()) {
// if (!c.getOrigin().equals(AttributeOrigin.PROPERTY)) {
// count++;
// }
// }
// System.out.println(count);
// return count;
// }
//
// public synchronized AttributeTableImpl getTableColumns(ResultSet res, String name) throws SQLException {
// AbstractAttributeModel model = (AbstractAttributeModel) Lookup.getDefault().lookup(AttributeController.class).getModel();
//
// AttributeTableImpl table = new AttributeTableImpl(model, name);
//
// ResultSetMetaData metadata = res.getMetaData();
// for (int i = 0; i < metadata.getColumnCount(); i++) {
// AttributeType type = getAttributeType(metadata.getColumnTypeName(i+1));
//
// table.addColumn(metadata.getColumnName(i+1), type);
// }
//
// return table;
// }
public synchronized Object[] getColumnNames(ResultSet res) throws SQLException{
ResultSetMetaData metadata = res.getMetaData();
Object[] columnNames = new Object[metadata.getColumnCount()];
for (int i = 0; i < metadata.getColumnCount(); i++) {
columnNames[i] = metadata.getColumnLabel(i+1);
}
return columnNames;
}
public synchronized String mergeStrings(List<String> strings){
String output = "";
for(int i=0;i<strings.size();i++){
if(i==0)
output += "'"+strings.get(i) +"'";
else
output += ",'"+strings.get(i) +"'";
}
return output;
}
public synchronized String mergeIntegers(List<Integer> integers){
String output = "";
for(int i=0;i<integers.size();i++){
if(i==0)
output += integers.get(i);
else
output += ","+integers.get(i);
}
return output;
}
public synchronized List<String> getTables() throws SQLException{
ArrayList<String> list = new ArrayList<String>();
Statement s = connection.createStatement();
ResultSet rs = s.executeQuery("SELECT relname FROM pg_stat_user_tables WHERE schemaname='public'");
while(rs.next()){
list.add(rs.getString("relname"));
}
rs.close();
s.close();
return list;
}
public synchronized void dropTable(String table) throws SQLException{
Statement s = connection.createStatement();
s.executeUpdate("DROP TABLE IF EXISTS "+table);
s.close();
}
// Retrieve object/table from the database
@Override
public Object getObject(String name) {
// TODO Auto-generated method stub
return null;
}
// @Override
// public void setObject(String name,Object object) {
// // TODO Auto-generated method stub
// Class c;
//
// if(object instanceof Collection){
// Collection collection = (Collection)object;
// Object o = collection.iterator().next().getClass();
//
// if( o instanceof LatLonPoint){
// if(o instanceof TimeStampedPoint){
// Postgis.toPGPoint((TimeStampedPoint)o, SRID);
// }
// // create postgis point
// else{
// Postgis.toPGPoint((LatLonPoint)o,SRID);
// }
//
//
// }
// else{
// if( o instanceof Linestring){
// Postgis.toPGLineString((Linestring)o,SRID);
// }
// }
//
// }
// else{
//
// }
// }
@Override
public String getName() {
// TODO Auto-generated method stub
return "Postgresql";
}
@Override
public String getDriverClass() {
// TODO Auto-generated method stub
return "org.postgresql.Driver";
}
@Override
public Object getObject(Class c, String query) {
// TODO Auto-generated method stub
return null;
}
@Override
public void setObject(Class c, String query) {
// TODO Auto-generated method stub
}
private static synchronized String createAttributes(Map<String, String> attributes){
StringBuilder builder = new StringBuilder();
for(String att : attributes.keySet()){
String type = attributes.get(att);
builder.append(att+" ");
builder.append(type);
builder.append(",");
}
return builder.substring(0, builder.length()-1);
}
@Override
public void setObject(String name, Object object) {
// TODO Auto-generated method stub
}
public ResultSet getResultSet(String query){
try {
Statement stat = connection.createStatement();
ResultSet res = stat.executeQuery(query);
return res;
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
public void commit(){
try {
this.getConnection().commit();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
| [
"franzejr@gmail.com"
] | franzejr@gmail.com |
4c0db1cc9902ea354c7f424363f7a32954c60e14 | 0ea214ea0efbc35b225992a2ef52fbe80552c4a7 | /src/main/java/es/smt/appfrigo/bean/UserTracking.java | 75191c2c4bd9200b5a4cc6843bade83c6016b0fb | [] | no_license | Zurine/appfrigo | 3b51ed982bf1d07cd8a92512b628b47ba8aaf081 | dc703346d354f8f9a2fdaf3bb4e5c83d51b95cc6 | refs/heads/master | 2020-12-03T03:38:09.426889 | 2017-06-29T08:22:18 | 2017-06-29T08:22:18 | 95,752,785 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,385 | java | package es.smt.appfrigo.bean;
import java.io.Serializable;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import es.smt.appfrigo.validation.CustomJsonDateDeserializer;
@JsonInclude(Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class UserTracking implements Serializable{
private static final long serialVersionUID = 1L;
private UserMicro user;
private BusinessNano business;
private int boxState;
private double totalUser;
private double totalSystem;
@JsonDeserialize(using = CustomJsonDateDeserializer.class)
private String date;
private List<TrackingDay> tracking;
public UserTracking() {
super();
}
public UserTracking(UserMicro user, BusinessNano business, int boxState, double totalUser, double totalSystem,
List<TrackingDay> tracking) {
super();
this.user = user;
this.business = business;
this.boxState = boxState;
this.totalUser = totalUser;
this.totalSystem = totalSystem;
this.tracking = tracking;
}
public UserMicro getUser() {
return user;
}
public void setUser(UserMicro user) {
this.user = user;
}
public BusinessNano getBusiness() {
return business;
}
public void setBusiness(BusinessNano business) {
this.business = business;
}
public int getBoxState() {
return boxState;
}
public void setBoxState(int boxState) {
this.boxState = boxState;
}
public double getTotalUser() {
return totalUser;
}
public void setTotalUser(double totalUser) {
this.totalUser = totalUser;
}
public double getTotalSystem() {
return totalSystem;
}
public void setTotalSystem(double totalSystem) {
this.totalSystem = totalSystem;
}
public List<TrackingDay> getTracking() {
return tracking;
}
public void setTracking(List<TrackingDay> tracking) {
this.tracking = tracking;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
@Override
public String toString() {
return "UserTracking [user=" + user + ", business=" + business + ", boxState=" + boxState + ", totalUser="
+ totalUser + ", totalSystem=" + totalSystem + ", tracking=" + tracking + "]";
}
}
| [
"zurine@socialmediatechnologies.es"
] | zurine@socialmediatechnologies.es |
d7101d7e160c807ae843b3176e952a6dd37e7059 | 66b630094446e0456033f2a06348f21ea17bd3e1 | /src/main/java/tch/impl/ReviewResultServiceImpl.java | 703f9b472cd76b17880abe11187017f50b9c226a | [] | no_license | FiseTch/anaylse | ccaa0d73135a18ba33517f96178d46a8a742cde4 | 40e92ab766a8a1dd83e58e51ffbf7d06ff613fea | refs/heads/master | 2022-12-21T22:32:53.526537 | 2018-06-07T04:29:12 | 2018-06-07T04:29:12 | 124,012,351 | 2 | 0 | null | 2022-12-16T08:39:17 | 2018-03-06T03:04:02 | Java | UTF-8 | Java | false | false | 2,953 | java | package tch.impl;
import java.util.List;
import javax.annotation.Resource;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
import tch.dao.ReviewResultMapper;
import tch.model.ReviewResult;
import tch.service.IReviewResultService;
/**
*
*
* Copyright:tch
*
* @class: tch.impl
* @Description:
*
* @version: v1.0.0
* @author: tongch
* @date: 2018-04-05
* Modification History:
* date Author Version Description
*------------------------------------------------------------
* 2018-04-05 tongch v1.1.0
*/
@Service("reviewResultService")
@Scope("prototype")
public class ReviewResultServiceImpl implements IReviewResultService {
private Log log = LogFactory.getLog(UserServiceImpl.class);
@Resource
private ReviewResultMapper reviewResultMapper;
/**
* 通过主键id删除记录
*/
public int deleteById(String id) {
log.info("执行"+Thread.currentThread().getStackTrace()[1].getMethodName());
return reviewResultMapper.deleteByPrimaryKey(id);
}
/**
* 插入记录(属性不允许为空)
*/
public int insertReviewResult(ReviewResult reviewResult) {
log.info("执行"+Thread.currentThread().getStackTrace()[1].getMethodName());
return reviewResultMapper.insert(reviewResult);
}
/**
* 插入记录(除主键外,其余的属性允许为空)
*/
public int insertReviewResultSelective(ReviewResult reviewResult) {
log.info("执行"+Thread.currentThread().getStackTrace()[1].getMethodName());
return reviewResultMapper.insertSelective(reviewResult);
}
/**
* 通过id查询记录
*/
public ReviewResult getRevById(String id) {
log.info("执行"+Thread.currentThread().getStackTrace()[1].getMethodName());
return reviewResultMapper.getRevByPrimaryKey(id);
}
/**
* 根据主键id更新记录(其余属性允许为空)
*/
public int updateByIdSelective(ReviewResult reviewResult) {
log.info("执行"+Thread.currentThread().getStackTrace()[1].getMethodName());
return reviewResultMapper.updateByPrimaryKeySelective(reviewResult);
}
/**
* 根据主键id更新记录(属性不允许为空)
*/
public int updateById(ReviewResult reviewResult) {
log.info("执行"+Thread.currentThread().getStackTrace()[1].getMethodName());
return reviewResultMapper.updateByPrimaryKey(reviewResult);
}
/**
* 根据属性值查记录
*/
public List<ReviewResult> getRevByAttr(ReviewResult reviewResult) {
log.info("执行"+Thread.currentThread().getStackTrace()[1].getMethodName());
return reviewResultMapper.getRevByAttr(reviewResult);
}
@Override
public List<ReviewResult> getGeneralRevByAttr(ReviewResult reviewResult) {
log.info("执行"+Thread.currentThread().getStackTrace()[1].getMethodName());
return reviewResultMapper.getGeneralRevByAttr(reviewResult);
}
}
| [
"2289717264@qq.com"
] | 2289717264@qq.com |
907e09241875f2f99403da697612997e9d668504 | bf0947db26907bd7ee0115b1c8571fa1b6a3dda9 | /app/src/main/java/comg/example/ismail_el_makassary/webservicejson/MainActivity.java | d419e47e0cd592fcf044ea8818accc81aa5cb638 | [] | no_license | ismailelmakassary/Ismail-UAS-android-2109 | 7720244f44aefc945d17d91601a762e5a33c4213 | 84c7ccf8e3c05915d090770a2e2dc842ff4690bc | refs/heads/master | 2020-05-26T07:51:33.746367 | 2019-05-23T03:40:07 | 2019-05-23T03:40:07 | 188,156,499 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 360 | java | package comg.example.ismail_el_makassary.webservicejson;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
| [
"ismailelmakassary@gmail.com"
] | ismailelmakassary@gmail.com |
e740d44bff4e42be5905dee2bc04fb9bf83238f4 | 2a6280c8ace50a1276db77a888878df387519af7 | /leetCode/src/main/java/linkedlist/HasCycle_0141.java | 30e8e91d08da81e9b69f9691bab7729da186411c | [] | no_license | MrTallon/algorithm | 6e7eb0ad95f14a2ac2514235334736a553d86d87 | 39f0f951f7b708f9c318573ccce78a8f6c770d7e | refs/heads/master | 2021-07-12T02:01:15.360736 | 2020-12-07T10:13:09 | 2020-12-07T10:13:09 | 226,653,971 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,019 | java | package linkedlist;
import java.util.HashSet;
import java.util.Set;
/**
* 链表中的环
* https://leetcode-cn.com/problems/linked-list-cycle/
*
* @author tallon
* @version v1.0.0
* @date 2020-10-09 10:58
*/
public class HasCycle_0141 {
/**
* 快慢指针
*/
public boolean hasCycle(ListNode head) {
if (head == null || head.next == null) {
return false;
}
ListNode slow = head;
ListNode fast = head.next;
while (slow != fast) {
if (fast == null || fast.next == null) {
return false;
}
slow = slow.next;
fast = fast.next.next;
}
return true;
}
/**
* 遍历,哈希
*/
public boolean hashSet(ListNode head) {
Set<ListNode> seen = new HashSet<>();
while (head != null) {
if (!seen.add(head)) {
return true;
}
head = head.next;
}
return false;
}
}
| [
"352420160@qq.com"
] | 352420160@qq.com |
fad53d34f7b0b771864a675a18a9c206595e6748 | a6f69ea42a0c8c0433590887e5571f511123cb8c | /src/main/java/com/alibaba/csp/sentinel/dashboard/rule/nacos/gateway/GatewayApiRuleNacosPublisher.java | ef872d733764e448bc7139974c297f4cc6f42a43 | [] | no_license | VINO42/alibaba-sentinel-dashboard-nacos | 7e09c3820b5bb5177b4145d43a6bb70121dffc7e | c2e94ab22451f6c26b6e52038137782f63bc297f | refs/heads/master | 2022-03-28T06:11:59.164601 | 2020-01-03T01:10:47 | 2020-01-03T01:10:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,857 | java | /*
* Copyright 1999-2018 Alibaba Group Holding Ltd.
*
* 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.alibaba.csp.sentinel.dashboard.rule.nacos.gateway;
import com.alibaba.csp.sentinel.dashboard.datasource.entity.gateway.ApiDefinitionEntity;
import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.FlowRuleEntity;
import com.alibaba.csp.sentinel.dashboard.rule.DynamicRulePublisher;
import com.alibaba.csp.sentinel.dashboard.rule.nacos.NacosConfigUtil;
import com.alibaba.nacos.api.config.ConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @author Eric Zhao
* @since 1.4.0
* add by tam
*/
@Component("gatewayApiRuleNacosPublisher")
public class GatewayApiRuleNacosPublisher implements DynamicRulePublisher<List<ApiDefinitionEntity>> {
@Autowired
private ConfigService configService;
@Autowired
private NacosConfigUtil nacosConfigUtil;
@Override
public void publish(String app, List<ApiDefinitionEntity> rules) throws Exception {
nacosConfigUtil.setRuleStringToNacos(
this.configService,
app,
NacosConfigUtil.GATEWAY_API_DATA_ID_POSTFIX,
rules
);
}
} | [
"tanjianchengcc@gmail.com"
] | tanjianchengcc@gmail.com |
ee6950c3461ec5b678c1715ddd4d39e36fd6e941 | c2672d3c822b3680e7ecf67ff70aeb52d06f2f07 | /Emotional_Trashcan/Emotional_Trashcan/app/src/main/java/com/Jungeun/wjdwjd95/emotional_trashcan/OnSwipeTouchListener.java | b9d571a77f32656cc00775a17beacfd5dbb11e44 | [] | no_license | JungeunKwon/Emotional_Trashcan | 108ca745ae167ca2167979789f303519df8e25f6 | 638ddbd646982ac76cb93f28435189377223cf18 | refs/heads/develop | 2020-12-05T14:10:08.407424 | 2020-04-07T16:05:54 | 2020-04-07T16:05:54 | 232,134,660 | 0 | 0 | null | 2020-04-07T16:11:10 | 2020-01-06T15:55:41 | Java | UTF-8 | Java | false | false | 2,230 | java | package com.Jungeun.wjdwjd95.emotional_trashcan;
import android.content.Context;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.View;
public class OnSwipeTouchListener implements View.OnTouchListener {
private final GestureDetector gestureDetector;
public OnSwipeTouchListener(Context ctx) {
gestureDetector = new GestureDetector(ctx, new GestureListener());
}
@Override
public boolean onTouch(View v, MotionEvent event) {
return gestureDetector.onTouchEvent(event);
}
private final class GestureListener extends GestureDetector.SimpleOnGestureListener {
private static final int SWIPE_THRESHOLD = 100;
private static final int SWIPE_VELOCITY_THRESHOLD = 100;
@Override
public boolean onDown(MotionEvent e) {
return true;
}
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
boolean result = false;
try {
float diffY = e2.getY() - e1.getY();
float diffX = e2.getX() - e1.getX();
if (Math.abs(diffX) > Math.abs(diffY)) {
if (Math.abs(diffX) > SWIPE_THRESHOLD && Math.abs(velocityX) > SWIPE_VELOCITY_THRESHOLD) {
if (diffX > 0) {
onSwipeRight();
} else {
onSwipeLeft();
}
}
result = true;
} else if (Math.abs(diffY) > SWIPE_THRESHOLD && Math.abs(velocityY) > SWIPE_VELOCITY_THRESHOLD) {
if (diffY > 0) {
onSwipeBottom();
} else {
onSwipeTop();
}
}
result = true;
} catch (Exception exception) {
exception.printStackTrace();
}
return result;
}
}
public void onSwipeRight() {
}
public void onSwipeLeft() {
}
public void onSwipeTop() {
}
public void onSwipeBottom() {
}
} | [
"wow_v_v@naver.com"
] | wow_v_v@naver.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.