blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2
values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557
values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82
values | src_encoding stringclasses 28
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 7 5.41M | extension stringclasses 11
values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
a007bd046c4a30a3f8809f37d2d3891239087a54 | e46c84db0568eeccc8c011ad99f7c12625dece75 | /app/src/main/java/com/actionbar/venkat/thor/Lightindustry.java | 6c5755634838bf615df22263c00664cf88bb843e | [] | no_license | Venkatprasadkalet1/English-Essay-For-Students | f4b4001a4446189240e13444b13523777a3c2ee3 | f2a1adf3ce180efb0276b16779741739b1e54ae5 | refs/heads/master | 2022-11-23T16:03:50.529793 | 2022-10-30T06:09:26 | 2022-10-30T06:09:26 | 211,070,549 | 4 | 13 | null | 2022-10-30T06:09:27 | 2019-09-26T11:14:06 | Java | UTF-8 | Java | false | false | 1,009 | java | package com.actionbar.venkat.thor;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
public class Lightindustry extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_lightindustry);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
}
}
| [
"venkatprasadkalet@gmail.com"
] | venkatprasadkalet@gmail.com |
d2d5f8e722279dc20a67b509854e6187b83bad39 | c1aeadcea3758b9e477d2d1915936c4a0219018e | /app/src/main/java/krunal/com/example/cameraapp/AppExecutor.java | 32bd2ce04bab6415b5ee475bfb7e4414948afa0c | [] | no_license | Ponprabhakar-pg/mad-ex-12 | 3329949a88b0924be40d4a6b848691b7be3bb3a1 | 01d957de5f79a120f443417818eb937a7f76e0ba | refs/heads/main | 2023-04-25T17:14:17.668402 | 2021-05-21T08:28:22 | 2021-05-21T08:28:22 | 369,466,929 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,227 | java | package krunal.com.example.cameraapp;
import android.os.Handler;
import android.os.Looper;
import android.support.annotation.NonNull;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
/**
* Handle All Threads.
*/
public class AppExecutor {
private final Executor diskIO;
private final Executor networkIO;
private final Executor mainThread;
private AppExecutor(Executor diskIO, Executor networkIO, Executor mainThread) {
this.diskIO = diskIO;
this.networkIO = networkIO;
this.mainThread = mainThread;
}
public AppExecutor() {
this(Executors.newSingleThreadExecutor(), Executors.newFixedThreadPool(3),
new MainThreadExecutor());
}
public Executor diskIO() {
return diskIO;
}
public Executor networkIO() {
return networkIO;
}
public Executor mainThread() {
return mainThread;
}
private static class MainThreadExecutor implements Executor {
private Handler mainThreadHandler = new Handler(Looper.getMainLooper());
@Override
public void execute(@NonNull Runnable command) {
mainThreadHandler.post(command);
}
}
}
| [
"TOSHIBA@Prabhakar.rJ"
] | TOSHIBA@Prabhakar.rJ |
898ee02f7f5047ae1c9a701e2a709b7c4129235a | df7fd66ec14e601b3de252194027936ed42d9fc3 | /leet/src/main/java/easy/E914_Card_Group.java | e2f8e3a137fcd4afb66e0981ff2a35b73b26edc6 | [] | no_license | gaiqun4726/leetecode-study | a61b6aa7b9f7b510b9d5d06d7c576933d4f5cf3e | 2806047c70baad0e541d4e58c4c59ebefbb0bd1c | refs/heads/master | 2021-06-17T09:01:47.801414 | 2021-02-02T09:07:31 | 2021-02-02T09:07:31 | 154,359,015 | 1 | 0 | null | 2020-10-13T20:38:03 | 2018-10-23T16:11:06 | Java | UTF-8 | Java | false | false | 1,884 | java | package easy;
import java.util.HashMap;
import java.util.Map;
public class E914_Card_Group {
/**
* 暴力法,尝试所有可能整除元素个数的数字。
* @param deck
* @return
*/
public boolean hasGroupsSizeX(int[] deck) {
if (deck == null || deck.length == 0)
return false;
Map<Integer, Integer> map = new HashMap<Integer, Integer>();
for (int i = 0; i < deck.length; i++) {
int key = deck[i];
if (map.containsKey(key)) {
int count = map.get(key);
map.put(key, ++count);
} else {
map.put(key, 1);
}
}
Object[] keys = map.keySet().toArray();
boolean res = false;
for (int key = 2; key <= deck.length; key++) {
int count = 0;
for (int j = 0; j < keys.length; j++) {
if (map.get((Integer) keys[j]) % key == 0)
count++;
}
if (count == keys.length) {
res = true;
break;
}
}
return res;
}
/**
* 其实就是求各个卡牌个数的最大公约数是不是大于等于2.
* @param deck
* @return
*/
public boolean hasGroupsSizeX2(int[] deck) {
if(deck==null||deck.length==0) {
return false;
}
Map<Integer,Integer> map = new HashMap<>();
for(int i: deck) {
if(map.containsKey(i)) {
map.put(i, map.get(i)+1);
} else {
map.put(i, 1);
}
}
int val = map.get(deck[0]);
for(int j: map.values()) {
val = gcd(j, val);
}
return val>=2;
}
int gcd(int a, int b) {
if(b==0) {
return a;
}
return gcd(b, a%b);
}
}
| [
"gaiqun4726@126.com"
] | gaiqun4726@126.com |
9481e1de1de8ff880780cb72796dfaa280e48f01 | 97c8f17f7cb6dd25cea81669869f80c3a58e3bcc | /src/main/java/jhs/math/common/Item.java | 87273f18d2e47217d7ff8da13723897df1e38ede | [
"Apache-2.0"
] | permissive | trippsapientae/sim-transit-lc | 070620f46ae4779994282a174447dcadf7e07ef4 | b4b333117c608a792432072d335cf092bd6dec53 | refs/heads/master | 2020-08-29T06:02:18.237139 | 2019-03-18T02:14:06 | 2019-03-18T02:14:06 | 217,949,553 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 52 | java | package jhs.math.common;
public interface Item {
}
| [
"jsolorzano@logmein.com"
] | jsolorzano@logmein.com |
a7f33bdc161cdc94503e21a15b10bccd83e1214c | 8e6581b2a961aee88c728cf1c40fd7b3e59b36d9 | /ContactRecView/app/src/main/java/com/example/contactrecview/data/DataBaseHandler.java | 297b6510a20ea355dad8be3a67e77ef14ecabe39 | [] | no_license | kamal218/Android-projects | 60a391c34cd261661454a877fb4299c68dae2025 | 44d6aab0b07d0c29664824b738d071ff2f81c2c5 | refs/heads/master | 2023-05-01T16:28:19.616149 | 2021-05-22T03:17:38 | 2021-05-22T03:17:38 | 302,254,562 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,558 | java | package com.example.contactrecview.data;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import com.example.contactrecview.contract.Contract;
import com.example.contactrecview.model.Contact;
import java.util.ArrayList;
import java.util.List;
public class DataBaseHandler extends SQLiteOpenHelper {
public DataBaseHandler( Context context) {
super(context, "db", null, 1);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL("CREATE TABLE " + Contract.TABLE_NAME + "("
+ Contract.KEY_ID + " INTEGER PRIMARY KEY," + Contract.KEY_NAME + " TEXT,"
+ Contract.KEY_NUMBER + " TEXT" + ");");
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
String DROP = "DROP TABLE IF EXISTS ";
db.execSQL(DROP+Contract.TABLE_NAME);
onCreate(db);
}
// CRUD
public void addContact(Contact contact){
SQLiteDatabase db=getWritableDatabase();
ContentValues cv=new ContentValues();
cv.put(Contract.KEY_NAME,contact.getName());
cv.put(Contract.KEY_NUMBER,contact.getNumer());
db.insert(Contract.TABLE_NAME,null,cv);
db.close();
}
public Contact getContact(int ID){
Contact contact=new Contact();
SQLiteDatabase db=getReadableDatabase();
Cursor cursor=db.query(Contract.TABLE_NAME,new String[]{Contract.KEY_ID,Contract.KEY_NAME,Contract.KEY_NUMBER},Contract.KEY_ID+"=?",new String[]{String.valueOf(ID)},null,null,null);
if(cursor!=null)
cursor.moveToFirst();
contact.setID(Integer.parseInt(cursor.getString(0)));
contact.setName(cursor.getString(1));
contact.setNumer(cursor.getString(2));
return contact;
}
public void deleteContact(Contact contact){
SQLiteDatabase db=this.getWritableDatabase();
db.delete(Contract.TABLE_NAME,Contract.KEY_ID+"=?",new String[]{String.valueOf(contact.getID())});
db.close();
}
public void updateContact(Contact contact){
SQLiteDatabase db=this.getWritableDatabase();
ContentValues cv=new ContentValues();
cv.put(Contract.KEY_NAME,contact.getName());
cv.put(Contract.KEY_NUMBER,contact.getNumer());
db.update(Contract.TABLE_NAME,cv,Contract.KEY_ID+"=?",new String[]{String.valueOf(contact.getID())});
}
public int getNumberOfContacts(){
SQLiteDatabase db=getReadableDatabase();
Cursor cursor=db.rawQuery("SELECT * FROM "+Contract.TABLE_NAME,null);
return cursor.getCount();
}
public List<Contact> getAllContacts(){
SQLiteDatabase db=getReadableDatabase();
List<Contact> ans=new ArrayList();
Cursor cursor=db.rawQuery("SELECT * FROM "+Contract.TABLE_NAME,null);
if(cursor.moveToFirst()){
do{
Contact contact=new Contact();
contact.setID(Integer.parseInt(cursor.getString(0)));
contact.setName(cursor.getString(1));
contact.setNumer(cursor.getString(2));
ans.add(contact);
}while(cursor.moveToNext());
}
return ans;
}
public void deleteTable(){
SQLiteDatabase db=getWritableDatabase();
String DROP = "DROP TABLE IF EXISTS ";
db.execSQL(DROP+Contract.TABLE_NAME);
onCreate(db);
}
}
| [
"kamal@example.com"
] | kamal@example.com |
0a3b8e3f5969c7c8c2f961214ba722bb14719e2f | 2fe5d37c0ad3c76238543394c8c475caab1545ab | /src/main/java/Task_6.java | 9800af680f495722f0c331bd8a6465163e163bc7 | [] | no_license | tzotzo77/PyshnenkoDA_Java2.0 | ef01b8c2ee188d5777ddd663fd897e1ee0b2390e | d0ab60ccba1e658b5396369c3c2de9c3b6615a29 | refs/heads/master | 2022-12-26T12:48:36.817098 | 2020-06-04T09:11:46 | 2020-06-04T09:11:46 | 266,503,633 | 0 | 0 | null | 2020-10-13T22:32:28 | 2020-05-24T08:53:06 | Java | UTF-8 | Java | false | false | 2,080 | java | import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.*;
public class Task_6 {
public static void main(String[] args) {
String str;
List<String> myArrayList = new ArrayList<String>();
try (BufferedReader br = new BufferedReader(new FileReader
("D:\\GIT_repository\\Java_PyshnenkoDA\\Task_File.txt"))) {
while ((str = br.readLine()) != null) {
for (String word : str.split("\\s+|,\\s*|\\.\\s*|\\t+|\\n+")) {
myArrayList.add(word);
}
}
} catch (IOException ex) {
System.out.println("Ошибка ввода-вывода : " + ex);
}
myArrayList.removeIf(item -> item.equals(""));
Collections.sort(myArrayList);
System.out.println("Отсортированный по алфавиту список слов из файла :");
System.out.println(myArrayList);
String s = " ";
myArrayList.add(0, s);
int max = 0;
HashMap<String, Integer> myHashMap = new HashMap<>();
for (int i = 1; i < myArrayList.size(); i++) {
int counter = 0;
for (int j = 0; j < myArrayList.size(); j++) {
if (myArrayList.get(j).equals(myArrayList.get(i))) {
counter++;
}
}
if (counter >= max) {
max = counter;
}
if (!myArrayList.get(i).equals(myArrayList.get(i - 1))) {
System.out.println("Число повтороений слова \"" + myArrayList.get(i) + "\" = " + counter);
myHashMap.put(myArrayList.get(i), counter);
}
}
System.out.println("Слова с наибольшим числом повторений (" + max + ") :");
for (Map.Entry<String, Integer> pair : myHashMap.entrySet()) {
if (pair.getValue() == max) {
System.out.print(pair.getKey() + " ");
}
}
}
}
| [
"dpisnenco@mail.ru"
] | dpisnenco@mail.ru |
fb211bebbc2318e978c17b2101443cfc16a5944d | 0cb6f9b171ea6c93518aeb17c2488eac48658ea6 | /sentry-spring/src/main/java/io/sentry/spring/tracing/SentryTransactionAdvice.java | 421bf27139c80d3c1679850367a138e9cca6d336 | [
"MIT"
] | permissive | bobinx/sentry-java | 6dd3886df72078b1a850b66fc64e39bd2c66b398 | bb19d62bda9b161e366dd792d1dd1122c28f87cd | refs/heads/main | 2023-03-23T07:23:34.920010 | 2021-03-10T15:31:48 | 2021-03-10T15:31:48 | 346,911,901 | 0 | 0 | MIT | 2021-03-12T02:40:12 | 2021-03-12T02:40:12 | null | UTF-8 | Java | false | false | 2,782 | java | package io.sentry.spring.tracing;
import com.jakewharton.nopen.annotation.Open;
import io.sentry.IHub;
import io.sentry.ITransaction;
import io.sentry.util.Objects;
import java.lang.reflect.Method;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.springframework.aop.support.AopUtils;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.util.StringUtils;
/**
* Reports execution of every bean method annotated with {@link SentryTransaction} or a execution of
* a bean method within a class annotated with {@link SentryTransaction}.
*/
@ApiStatus.Internal
@Open
public class SentryTransactionAdvice implements MethodInterceptor {
private final @NotNull IHub hub;
public SentryTransactionAdvice(final @NotNull IHub hub) {
this.hub = Objects.requireNonNull(hub, "hub is required");
}
@Override
public Object invoke(final @NotNull MethodInvocation invocation) throws Throwable {
final Method mostSpecificMethod =
AopUtils.getMostSpecificMethod(invocation.getMethod(), invocation.getThis().getClass());
@Nullable
SentryTransaction sentryTransaction =
AnnotationUtils.findAnnotation(mostSpecificMethod, SentryTransaction.class);
if (sentryTransaction == null) {
sentryTransaction =
AnnotationUtils.findAnnotation(
mostSpecificMethod.getDeclaringClass(), SentryTransaction.class);
}
final String name = resolveTransactionName(invocation, sentryTransaction);
final boolean isTransactionActive = isTransactionActive();
if (isTransactionActive) {
// transaction is already active, we do not start new transaction
return invocation.proceed();
} else {
String operation;
if (sentryTransaction != null && !StringUtils.isEmpty(sentryTransaction.operation())) {
operation = sentryTransaction.operation();
} else {
operation = "bean";
}
final ITransaction transaction = hub.startTransaction(name, operation);
try {
return invocation.proceed();
} finally {
transaction.finish();
}
}
}
private @NotNull String resolveTransactionName(
MethodInvocation invocation, @Nullable SentryTransaction sentryTransaction) {
return sentryTransaction == null || StringUtils.isEmpty(sentryTransaction.value())
? invocation.getMethod().getDeclaringClass().getSimpleName()
+ "."
+ invocation.getMethod().getName()
: sentryTransaction.value();
}
private boolean isTransactionActive() {
return hub.getSpan() != null;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
a0baae94e1f17ab4fa8393aa7b2a3d7371206652 | f44ea6f635bf4a6c3e4a2de4920f34938d09c3cc | /mall-mbg/src/main/java/com/coding/cloud/mall/model/PmsProductVertifyRecordExample.java | de008ce77b15ad03bba8476cada980f3cb296d40 | [] | no_license | lwz525/mall-swarm | 1a0ac087b83a7e4d4b23332717be2aac2187570e | 77f9a35704e3ec8060634c324c9299d0ff260492 | refs/heads/master | 2023-06-02T10:21:42.053453 | 2021-06-27T13:20:55 | 2021-06-27T13:20:55 | 379,658,624 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,935 | java | package com.coding.cloud.mall.model;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class PmsProductVertifyRecordExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public PmsProductVertifyRecordExample() {
oredCriteria = new ArrayList<>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andProductIdIsNull() {
addCriterion("product_id is null");
return (Criteria) this;
}
public Criteria andProductIdIsNotNull() {
addCriterion("product_id is not null");
return (Criteria) this;
}
public Criteria andProductIdEqualTo(Long value) {
addCriterion("product_id =", value, "productId");
return (Criteria) this;
}
public Criteria andProductIdNotEqualTo(Long value) {
addCriterion("product_id <>", value, "productId");
return (Criteria) this;
}
public Criteria andProductIdGreaterThan(Long value) {
addCriterion("product_id >", value, "productId");
return (Criteria) this;
}
public Criteria andProductIdGreaterThanOrEqualTo(Long value) {
addCriterion("product_id >=", value, "productId");
return (Criteria) this;
}
public Criteria andProductIdLessThan(Long value) {
addCriterion("product_id <", value, "productId");
return (Criteria) this;
}
public Criteria andProductIdLessThanOrEqualTo(Long value) {
addCriterion("product_id <=", value, "productId");
return (Criteria) this;
}
public Criteria andProductIdIn(List<Long> values) {
addCriterion("product_id in", values, "productId");
return (Criteria) this;
}
public Criteria andProductIdNotIn(List<Long> values) {
addCriterion("product_id not in", values, "productId");
return (Criteria) this;
}
public Criteria andProductIdBetween(Long value1, Long value2) {
addCriterion("product_id between", value1, value2, "productId");
return (Criteria) this;
}
public Criteria andProductIdNotBetween(Long value1, Long value2) {
addCriterion("product_id not between", value1, value2, "productId");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Date value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Date value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Date value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Date value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Date> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Date> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Date value1, Date value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andVertifyManIsNull() {
addCriterion("vertify_man is null");
return (Criteria) this;
}
public Criteria andVertifyManIsNotNull() {
addCriterion("vertify_man is not null");
return (Criteria) this;
}
public Criteria andVertifyManEqualTo(String value) {
addCriterion("vertify_man =", value, "vertifyMan");
return (Criteria) this;
}
public Criteria andVertifyManNotEqualTo(String value) {
addCriterion("vertify_man <>", value, "vertifyMan");
return (Criteria) this;
}
public Criteria andVertifyManGreaterThan(String value) {
addCriterion("vertify_man >", value, "vertifyMan");
return (Criteria) this;
}
public Criteria andVertifyManGreaterThanOrEqualTo(String value) {
addCriterion("vertify_man >=", value, "vertifyMan");
return (Criteria) this;
}
public Criteria andVertifyManLessThan(String value) {
addCriterion("vertify_man <", value, "vertifyMan");
return (Criteria) this;
}
public Criteria andVertifyManLessThanOrEqualTo(String value) {
addCriterion("vertify_man <=", value, "vertifyMan");
return (Criteria) this;
}
public Criteria andVertifyManLike(String value) {
addCriterion("vertify_man like", value, "vertifyMan");
return (Criteria) this;
}
public Criteria andVertifyManNotLike(String value) {
addCriterion("vertify_man not like", value, "vertifyMan");
return (Criteria) this;
}
public Criteria andVertifyManIn(List<String> values) {
addCriterion("vertify_man in", values, "vertifyMan");
return (Criteria) this;
}
public Criteria andVertifyManNotIn(List<String> values) {
addCriterion("vertify_man not in", values, "vertifyMan");
return (Criteria) this;
}
public Criteria andVertifyManBetween(String value1, String value2) {
addCriterion("vertify_man between", value1, value2, "vertifyMan");
return (Criteria) this;
}
public Criteria andVertifyManNotBetween(String value1, String value2) {
addCriterion("vertify_man not between", value1, value2, "vertifyMan");
return (Criteria) this;
}
public Criteria andStatusIsNull() {
addCriterion("status is null");
return (Criteria) this;
}
public Criteria andStatusIsNotNull() {
addCriterion("status is not null");
return (Criteria) this;
}
public Criteria andStatusEqualTo(Integer value) {
addCriterion("status =", value, "status");
return (Criteria) this;
}
public Criteria andStatusNotEqualTo(Integer value) {
addCriterion("status <>", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThan(Integer value) {
addCriterion("status >", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThanOrEqualTo(Integer value) {
addCriterion("status >=", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThan(Integer value) {
addCriterion("status <", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThanOrEqualTo(Integer value) {
addCriterion("status <=", value, "status");
return (Criteria) this;
}
public Criteria andStatusIn(List<Integer> values) {
addCriterion("status in", values, "status");
return (Criteria) this;
}
public Criteria andStatusNotIn(List<Integer> values) {
addCriterion("status not in", values, "status");
return (Criteria) this;
}
public Criteria andStatusBetween(Integer value1, Integer value2) {
addCriterion("status between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andStatusNotBetween(Integer value1, Integer value2) {
addCriterion("status not between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andDetailIsNull() {
addCriterion("detail is null");
return (Criteria) this;
}
public Criteria andDetailIsNotNull() {
addCriterion("detail is not null");
return (Criteria) this;
}
public Criteria andDetailEqualTo(String value) {
addCriterion("detail =", value, "detail");
return (Criteria) this;
}
public Criteria andDetailNotEqualTo(String value) {
addCriterion("detail <>", value, "detail");
return (Criteria) this;
}
public Criteria andDetailGreaterThan(String value) {
addCriterion("detail >", value, "detail");
return (Criteria) this;
}
public Criteria andDetailGreaterThanOrEqualTo(String value) {
addCriterion("detail >=", value, "detail");
return (Criteria) this;
}
public Criteria andDetailLessThan(String value) {
addCriterion("detail <", value, "detail");
return (Criteria) this;
}
public Criteria andDetailLessThanOrEqualTo(String value) {
addCriterion("detail <=", value, "detail");
return (Criteria) this;
}
public Criteria andDetailLike(String value) {
addCriterion("detail like", value, "detail");
return (Criteria) this;
}
public Criteria andDetailNotLike(String value) {
addCriterion("detail not like", value, "detail");
return (Criteria) this;
}
public Criteria andDetailIn(List<String> values) {
addCriterion("detail in", values, "detail");
return (Criteria) this;
}
public Criteria andDetailNotIn(List<String> values) {
addCriterion("detail not in", values, "detail");
return (Criteria) this;
}
public Criteria andDetailBetween(String value1, String value2) {
addCriterion("detail between", value1, value2, "detail");
return (Criteria) this;
}
public Criteria andDetailNotBetween(String value1, String value2) {
addCriterion("detail not between", value1, value2, "detail");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
} | [
"lwz525@126.com"
] | lwz525@126.com |
146971551117f00627802ce4335e3cedf2548ef8 | b599bcd517956b14426bd7cb85faaaff7eeded7b | /java/com/avantplus/fintracker/data/management/DBSessionFactory.java | 588b2fcdb3f1a4e393ac695ee6cdecfa852c84e5 | [] | no_license | jorgesosahedz/fintracker | 900d497580873374f9a14516d610bfb2f97ac664 | 45b8b4aee33ef38750f3bcf4e3d9eb067103c11c | refs/heads/master | 2021-09-08T23:12:35.696112 | 2018-03-12T20:21:28 | 2018-03-12T20:21:28 | 110,310,565 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 859 | java | package com.avantplus.fintracker.data.management;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import com.avantplus.fintracker.data.entity.*;
public class DBSessionFactory {
private static SessionFactory factory;
public static SessionFactory getFactory() {
if (factory==null) {
Configuration configuration = new Configuration().configure("hibernate.cfg.xml");
configuration.addAnnotatedClass(PaymentType.class);
configuration.addAnnotatedClass(UserTransactionBase.class);
configuration.addAnnotatedClass(User.class);
configuration.addAnnotatedClass(Category.class);
configuration.addAnnotatedClass(Subcategory.class);
configuration.addAnnotatedClass(PaymentType.class);
factory = configuration.buildSessionFactory();
}
return factory;
}
}
| [
"jorge_sosa_hdz@yahoo.com"
] | jorge_sosa_hdz@yahoo.com |
5ef0f2ccdbb8d8bac95e54793bb4cabd3fdb102f | 292c1d7850a91821b339522b4381516a081761c7 | /src/test/java/br/com/kohen/eventmanager/clarion/ws/utils/CodeHandlerUtilsTest.java | c32cbfd8177fa1309d167b24a92cadae7f46f1dc | [] | no_license | mmaico/Clarion-WS | 92e43ab3a45e3ae53e7f70938aa939f7dcb4b0b0 | 7826872e7502e59dac09a6aafc9c9cf4f179d715 | refs/heads/master | 2020-04-05T23:41:25.484722 | 2015-01-14T09:59:28 | 2015-01-14T09:59:28 | 4,120,485 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 959 | java | package br.com.kohen.eventmanager.clarion.ws.utils;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.*;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.runners.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public class CodeHandlerUtilsTest {
@InjectMocks
private CodeHandlerUtils utils;
/**
* : $Pedido já incluso : Empresa / Origem / Protheus / Externo - 01 / 2 / 065008 / 232
*/
@Test
public void shouldExtractValueWhenExternalSystemaResponse() {
String returnExternalSystem = ": $Pedido já incluso : Empresa / Origem / Protheus / Externo - 01 / 2 / 065008 / 232";
String codeExpected = "065008";
String codeTreat = utils.extractValueFromResponde(returnExternalSystem);
assertThat(codeTreat, is(codeExpected));
}
}
| [
"mmaico@gmail.com"
] | mmaico@gmail.com |
fa316addb2245fca574d4ce454a4cdf9965c2f90 | 48ef74d5471574d6e6502ffe37b2f99999fb42f6 | /Employee Management System/src/test/java/testing/TestCalculation.java | 660bb3fda1015b0ada49321774822cdd77f55098 | [] | no_license | kailashdjniraula9/Employee-Management-System | 87dacebd4a76e269c252890e3747400ef07bca3c | 7cdc5cc68798a8839e07c5119bdbfc9c92816021 | refs/heads/master | 2022-12-22T04:27:23.932166 | 2020-03-14T15:16:43 | 2020-03-14T15:16:43 | 246,236,014 | 0 | 0 | null | 2022-12-16T03:47:50 | 2020-03-10T07:34:45 | JavaScript | UTF-8 | Java | false | false | 952 | java | package testing;
import static org.junit.Assert.*;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import com.bway.springproject.testing.Calculation;
public class TestCalculation {
static Calculation c = null;
@BeforeClass
public static void init(){
c = new Calculation();
System.out.println("before class method");
}
@Test
public void testSquare() {
int result = c.getSquare(10);
assertEquals(100, result);
}
@Test
public void testAddition(){
int value = c.addition(5, 5);
assertEquals(10, value);
}
@AfterClass
public static void classEnd(){
System.out.println("after class");
}
@Before
public void initMethod(){
System.out.println("init method ");
}
@After
public void afterMethod(){
System.out.println("after method ");
c = null;
}
}
| [
"Kailash Niraula@KailashDj"
] | Kailash Niraula@KailashDj |
e38303ed49e07da0a0a4f0fffe8cb80bdb2914bc | a028d7e1c59e1f6320108e5b01ce28ec960af818 | /apple-cloud-center-zipkin/src/main/java/com/cachexic/cloud/ZipkinApplication.java | fa98a7361f605800d9a2102972bd89552b477b83 | [] | no_license | tangmin721/apple-cloud | ef9304284d15df80a9189118be943abe5ddfab43 | 3876f8b5129bffb1c531acc67e7d9e689a00c422 | refs/heads/master | 2021-01-23T02:40:30.319373 | 2017-12-01T16:31:30 | 2017-12-01T16:31:30 | 102,441,157 | 4 | 6 | null | null | null | null | UTF-8 | Java | false | false | 467 | java | package com.cachexic.cloud;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import zipkin.server.EnableZipkinServer;
/**
* @author tangmin
* @Description: zipkin追踪服务
* @date 2017-04-12 23:22:05
*/
@SpringBootApplication
@EnableZipkinServer
public class ZipkinApplication {
public static void main(String[] args) {
SpringApplication.run(ZipkinApplication.class, args);
}
}
| [
"191102902@qq.com"
] | 191102902@qq.com |
2b56c0be9f1d60667a9649b7c92f79663ee4f9d8 | 04b3d97459e8a73e2f34072ca8dbf447c837ef09 | /SilverVitality/app/src/main/java/sg/edu/nyp/silvervitality/Appointment/OnBootReceiver.java | 9c93dc7c95bf87b05458383a7172586969ba5548 | [] | no_license | nyp-sit/Geriatric | 4ff3d6f3d79953e4f4419ef66a72278a1c807d44 | bb4202945e12dbc68c01e95bd2ae60f2c33cf4ea | refs/heads/master | 2021-03-30T17:26:48.335335 | 2014-11-28T05:25:13 | 2014-11-28T05:25:13 | 24,364,982 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,045 | java | package sg.edu.nyp.silvervitality.Appointment;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ComponentInfo;
import android.database.Cursor;
import android.util.Log;
/**
* Created by Student on 11/24/2014.
*/
public class OnBootReceiver extends BroadcastReceiver {
private static final String TAG = ComponentInfo.class.getCanonicalName();
@Override
public void onReceive(Context context, Intent intent) {
ReminderManager reminderMgr = new ReminderManager(context);
RemindersDbAdapter dbHelper = new RemindersDbAdapter(context);
dbHelper.open();
Cursor cursor = dbHelper.fetchAllReminders();
if(cursor != null) {
cursor.moveToFirst();
int rowIdColumnIndex = cursor.getColumnIndex(RemindersDbAdapter.KEY_ROWID);
int dateTimeColumnIndex = cursor.getColumnIndex(RemindersDbAdapter.KEY_DATE_TIME);
while(cursor.isAfterLast() == false) {
Log.d(TAG, "Adding alarm from boot.");
Log.d(TAG, "Row Id Column Index - " + rowIdColumnIndex);
Log.d(TAG, "Date Time Column Index - " + dateTimeColumnIndex);
Long rowId = cursor.getLong(rowIdColumnIndex);
String dateTime = cursor.getString(dateTimeColumnIndex);
Calendar cal = Calendar.getInstance();
SimpleDateFormat format = new SimpleDateFormat(ReminderEditActivity.DATE_TIME_FORMAT);
try {
java.util.Date date = format.parse(dateTime);
cal.setTime(date);
reminderMgr.setReminder(rowId, cal);
} catch (java.text.ParseException e) {
Log.e("OnBootReceiver", e.getMessage(), e);
}
cursor.moveToNext();
}
cursor.close() ;
}
dbHelper.close();
}
}
| [
"donutsandnuts@gmail.com"
] | donutsandnuts@gmail.com |
649aba697a770e8dbbb9281f29f9a4d0dcccf577 | b8041953e5587386de5134359ff8623e32437aee | /src/com/coffee/web/service/GenericDo.java | 6b43dd39b248a946be78d564dafee76f6e9b2c52 | [] | no_license | coffeeliuwei/Finalpackage | 14741517ea0e86289523d1803ffb314eedbe0662 | 13c281f6299f05507940a7b0ed8e5c0effb69ba2 | refs/heads/master | 2021-05-16T18:33:23.309748 | 2020-03-27T02:18:50 | 2020-03-27T02:18:50 | 250,420,293 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 751 | java | package com.coffee.web.service;
import java.util.HashMap;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.coffee.web.FormData;
public abstract class GenericDo
{
// httpReq : 请求对象
protected HttpServletRequest httpReq;
// httpResp : 应答对象
protected HttpServletResponse httpResp;
// queryParams : URL 末属附加的参数
// protected FormData queryParams; // deprecated: 由子类自己提取
// charset: 字符编码
protected String charset ;
// 子类应重写这个方法 , strReq 是请求数据 (可能为null), 应返回一段数据, 可以为null
public abstract String execute(String strReq) throws Exception;
}
| [
"394776565@qq.com"
] | 394776565@qq.com |
bfc9030c9b2e760f98a18ec7877f2ed1958685c9 | 93249ac332c0f24bf7642caa21f27058ba99189b | /core/plugins/org.csstudio.simplepv.pvmanager.test/src/org/csstudio/simplepv/pvmanager/PVManagerReadUnitTest.java | 1035da5f5b6604fb048e1e3cdef3ad234c50f270 | [] | no_license | crispd/cs-studio | 0678abd0db40f024fbae4420eeda87983f109382 | 32dd49d1eb744329dc1083b4ba30b65155000ffd | refs/heads/master | 2021-01-17T23:59:55.878433 | 2014-06-20T17:55:02 | 2014-06-20T17:55:02 | 21,135,201 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,902 | java | /*******************************************************************************
* Copyright (c) 2013 Oak Ridge National Laboratory.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
******************************************************************************/
package org.csstudio.simplepv.pvmanager;
import static org.csstudio.utility.test.HamcrestMatchers.greaterThanOrEqualTo;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import org.csstudio.simplepv.AbstractPVFactory;
import org.csstudio.simplepv.IPV;
import org.csstudio.simplepv.IPVListener;
import org.csstudio.simplepv.SimplePVLayer;
import org.epics.vtype.VType;
import org.junit.Test;
/** JUnit test for reading with PVManagerPVFactory
*
* <p>Directly accesses PVManagerPVFactory to run as plain JUnit test.
* CSS code should use {@link SimplePVLayer}
* @author Kay Kasemir
*/
public class PVManagerReadUnitTest extends TestHelper
{
final private AtomicInteger connections = new AtomicInteger();
final private AtomicInteger changes = new AtomicInteger();
private volatile Exception error = null;
/** Read 'latest' value */
@Test
public void testBasicReading() throws Exception
{
final boolean readonly = true;
final boolean buffer = false;
final IPV pv = factory.createPV("sim://ramp", readonly, 10, buffer,
AbstractPVFactory.getDefaultPVNotificationThread(), null);
pv.addListener(new IPVListener()
{
@Override
public void connectionChanged(final IPV pv)
{
System.out.println(pv.getName() + (pv.isConnected() ? " connected" : " disconnected"));
connections.incrementAndGet();
}
@Override
public void exceptionOccurred(final IPV pv, final Exception exception)
{
error = exception;
error.printStackTrace();
}
@Override
public void valueChanged(final IPV pv)
{
final VType value = pv.getValue();
System.out.println(pv.getName() + " = " + value);
if (value != null)
changes.incrementAndGet();
}
@Override
public void writeFinished(final IPV pv, final boolean isWriteSucceeded)
{
error = new Exception("Received write 'finish'");
}
@Override
public void writePermissionChanged(final IPV pv)
{
error = new Exception("Received write permission change");
}
});
assertThat(pv.isStarted(), equalTo(false));
pv.start();
assertThat(pv.isStarted(), equalTo(true));
// Expect about 1 update per second
for (int count=0; count < 10; ++count)
{
if (changes.get() > 5)
break;
else
TimeUnit.SECONDS.sleep(1);
}
assertThat(pv.isConnected(), equalTo(true));
assertThat(changes.get(), greaterThanOrEqualTo(5));
pv.stop();
assertThat(pv.isStarted(), equalTo(false));
// Wait for disconnect
for (int count=0; count < 10; ++count)
{
if (pv.isConnected())
TimeUnit.MILLISECONDS.sleep(10);
else
{
System.out.println("Disconnect takes " + count*10 + " ms");
break;
}
}
assertThat(pv.isConnected(), equalTo(false));
// Should not see error from sim:// channel
assertThat(error, is(nullValue()));
}
/** Read 'all' value */
@Test
public void testBufferedReading() throws Exception
{
final boolean readonly = true;
final boolean buffer = true;
final IPV pv = factory.createPV("sim://ramp", readonly, (int)TimeUnit.SECONDS.toMillis(2),
buffer, AbstractPVFactory.getDefaultPVNotificationThread(), null);
final AtomicBoolean got_multiples = new AtomicBoolean();
final List<VType> values = new ArrayList<>();
pv.addListener(new IPVListener()
{
@Override
public void connectionChanged(final IPV pv)
{
System.out.println(pv.getName() + (pv.isConnected() ? " connected" : " disconnected"));
connections.incrementAndGet();
}
@Override
public void exceptionOccurred(final IPV pv, final Exception exception)
{
error = exception;
error.printStackTrace();
}
@Override
public void valueChanged(final IPV pv)
{
final List<VType> new_values = pv.getAllBufferedValues();
System.out.println(pv.getName() + " = " + new_values);
if (new_values != null)
{
if (new_values.size() > 1)
got_multiples.set(true);
synchronized (new_values)
{
values.addAll(new_values);
}
}
}
@Override
public void writeFinished(final IPV pv, final boolean isWriteSucceeded)
{
error = new Exception("Received write 'finish'");
}
@Override
public void writePermissionChanged(final IPV pv)
{
error = new Exception("Received write permission change");
}
});
pv.start();
// Expect about 1 update per second, so wait for ~5 values
TimeUnit.SECONDS.sleep(5);
// Should have connected and received a bunch of values...
assertThat(pv.isConnected(), equalTo(true));
synchronized (values)
{
System.out.println(values);
assertThat(values.size(), greaterThanOrEqualTo(1));
}
// ..AND they should have arrived with at least some multiples
// (PV updates at 1Hz, we use a 2 sec update period)
assertThat(got_multiples.get(), equalTo(true));
pv.stop();
// Should not see error from sim:// channel
assertThat(error, is(nullValue()));
}
}
| [
"ztyaner11@gmail.com"
] | ztyaner11@gmail.com |
2c7ec5aebf097bbfd3757243d72dfe23ee365035 | fc2fb98ae057ebf8a2a3c4138b268666dad4fdf0 | /app/src/main/java/com/bt_121shoppe/motorbike/loan/model/commune_Item.java | c1b766c522847c6112bf9a9ed652a7800f8a8c43 | [] | no_license | Thou168/Lucky_App | 2057d238e06d45a9fbfb8df370f11cb19dd1dce7 | 1f159e1c3e4cfe71c2be66912bd104b192e0da69 | refs/heads/master | 2021-07-13T05:03:12.824363 | 2020-08-14T10:36:10 | 2020-08-14T10:36:10 | 194,384,016 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 987 | java | package com.bt_121shoppe.motorbike.loan.model;
import com.bt_121shoppe.motorbike.Api.api.model.Item_loan;
import com.google.gson.annotations.SerializedName;
public class commune_Item extends Item_loan {
@SerializedName("commune")
private String commune;
@SerializedName("commune_kh")
private String commune_kh;
@SerializedName("district")
private int districtId;
public commune_Item(int loan_status, int loan_record_status) {
super(loan_status, loan_record_status);
}
public int getDistrictId(){
return districtId;
}
public void setDistrictId(int districtId) {
this.districtId = districtId;
}
public String getCommune() {
return commune;
}
public void setCommune(String commune) {
this.commune = commune;
}
public String getCommune_kh() {
return commune_kh;
}
public void setCommune_kh(String commune_kh) {
this.commune_kh = commune_kh;
}
}
| [
"mwg.sengraksmey@gmail.com"
] | mwg.sengraksmey@gmail.com |
7655d31338ccfd874459917ae8db92f27d9d4791 | aafe547b69bc14728f428586dbe942f00976060a | /watch/src/main/java/com/formalizationunit/amaz/informatory/watch/Widget.java | 05ce297c54f80d7207a8355e66099b1fa45ac541 | [] | no_license | rain-bipper/AmazInformatory | 06b010df654b0ba56396de9d9dd56d2bf2e46762 | 5f29cdb0c067f18540bacb7fb95d102f2cfa40f5 | refs/heads/master | 2020-09-26T00:45:44.805151 | 2019-12-11T12:08:58 | 2019-12-15T12:16:08 | 226,125,902 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 226 | java | package com.formalizationunit.amaz.informatory.watch;
import android.content.Context;
import android.view.View;
public interface Widget {
void onActive();
void onInactive();
View getView(Context paramContext);
}
| [
"ripp@yandex-team.ru"
] | ripp@yandex-team.ru |
93e04fa05e8d871a149e5ade7605100c01eb957c | 2dad21c1d0804a4cfd83b65071ca64d48bbdaf58 | /LectureController.java | fa668cceffce6fc996c2773e5933339f193b071c | [] | no_license | JasonDongHoon/assignment | f48453e1d0720f0c9e2a8a211fc70c45ea8429bb | 91902a4f75b7b340ebf3fb57a2c62a9c5f661a88 | refs/heads/master | 2021-01-12T12:31:30.702016 | 2016-11-20T03:37:35 | 2016-11-20T03:37:35 | 72,531,281 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,069 | java | package bitcamp.java89.ems;
import java.util.Scanner;
public class LectureController {
private Lecture[] lectures = new Lecture[100];
private int length = 0;
private Scanner keyScan;
public LectureController(Scanner keyScan) {
this.keyScan = keyScan;
}
public void service() {
loop: while (true) {
System.out.print("강좌관리> ");
String command = keyScan.nextLine().toLowerCase();
switch (command) {
case "add": this.doAdd(); break;
case "list": this.doList(); break;
case "view": this.doView(); break;
case "delete": this.doDelete(); break;
case "update": this.doUpdate(); break;
case "main": break loop;
default: System.out.println("지원하지 않는 명령어 입니다.");
}
}
}
private void doAdd() {
while (length < this.lectures.length) {
Lecture lecture = new Lecture();
System.out.print("강좌명(Java & DB 양성과정)");
lecture.course = this.keyScan.nextLine();
System.out.print("시작일(2016.10.10)");
lecture.period = this.keyScan.nextLine();
System.out.print("시간(09~18)");
lecture.time = this.keyScan.nextLine();
System.out.print("장소(서초구 서초동)");
lecture.place = this.keyScan.nextLine();
System.out.print("비용(2,000,000)");
lecture.cost = Integer.parseInt(this.keyScan.nextLine());
System.out.print("결제방법(Cash or Card)");
lecture.method = this.keyScan.nextLine();
this.lectures[length++] = lecture;
System.out.print("계속 입력할래요?(y/n)?");
if (!this.keyScan.nextLine().equals("y"))
break;
}
}
private void doList() {
for (int i = 0; i < this.length; i++) {
Lecture lecture = this.lectures[i];
System.out.printf("%s,%s,%s,%s,%d,%s\n", lecture.course, lecture.period,
lecture.time, lecture.place, lecture.cost, lecture.method);
}
}
private void doView() {
System.out.print("조회할 사용자는??");
String course = this.keyScan.nextLine().toLowerCase();
for (int i = 0; i < this.length; i++) {
if (this.lectures[i].course.toLowerCase().equals(course)) {
System.out.printf("강좌명: %s\n", this.lectures[i].course);
System.out.printf("암호: (****)\n");
System.out.printf("시작일: %s\n", this.lectures[i].period);
System.out.printf("시간: %s\n", this.lectures[i].time);
System.out.printf("장소: %s\n", this.lectures[i].place);
System.out.printf("비용: %d\n", this.lectures[i].cost);
System.out.printf("결제방법: %s\n", this.lectures[i].method);
break;
}
}
}
private void doDelete() {
System.out.print("삭제할 사용자는??");
String course = this.keyScan.nextLine().toLowerCase();
for (int i = 0; i < this.length; i++) {
if (this.lectures[i].course.toLowerCase().equals(course)) {
for (int x = i + 1; x < length; x++, i++) {
this.lectures[i] = this.lectures[x];
}
this.lectures[--length] = null;
System.out.printf("%s 학생 정보를 삭제하였습니다.\n", this.lectures[i].course);
return;
}
System.out.printf("%s 학생이 없습니다.\n", course);
}
}
private void doUpdate() {
while (length < this.lectures.length) {
Lecture lecture = new Lecture();
System.out.print("변경할 사용자는??");
String course = this.keyScan.nextLine().toLowerCase();
System.out.print("시작일(2016.10.10)");
lecture.period = this.keyScan.nextLine();
System.out.print("시간(09~18)");
lecture.time = this.keyScan.nextLine();
System.out.print("장소(서초구 서초동)");
lecture.place = this.keyScan.nextLine();
System.out.print("비용(2,000,000)");
lecture.cost = Integer.parseInt(this.keyScan.nextLine());
System.out.print("결제방법(Cash or Card)");
lecture.method = this.keyScan.nextLine();
this.lectures[length++] = lecture;
System.out.print("저장하시겠습니까(y/n)?");
if (!this.keyScan.nextLine().equals("y")) {
System.out.print("저장하였습니다.\n");
break;
} else {
System.out.print("변경을 취소하였습니다.\n");
break;
}
}
}
}
| [
"hjmlove7@gmail.com"
] | hjmlove7@gmail.com |
e61a3db791acff2596aba83f079c37e46093eef8 | 59a63b91c76c11e94da9805ccbb83bc107aacc54 | /src/Controller/Controller.java | 6e4a0fc4abd55fc8297b971741233417946f82b7 | [] | no_license | Amadeo234/Minesweeper | 683abd6aee9ab89771c75180ed36167edf3291ef | c2366314eebac8bdf27f3524c91fe889e8dcef8f | refs/heads/master | 2021-06-29T23:32:12.912242 | 2020-10-18T19:18:40 | 2020-10-18T19:19:00 | 175,483,204 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,639 | java | package Controller;
import Model.Board;
import Model.BoardGeneratorFactory;
import Model.BoardGeneratorType;
import Model.IBoardGenerator;
import Solver.Communicator;
import Solver.Solver;
import View.BoardView;
import View.MessageWindow;
import javafx.application.Platform;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.TextField;
import javafx.stage.Stage;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.File;
import java.io.FileNotFoundException;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Scanner;
public class Controller {
@FXML
private TextField minesField;
@FXML
private TextField heightField;
@FXML
private TextField widthField;
@FXML
private Button newGameButton;
@FXML
private Button customGameButton;
@FXML
private ChoiceBox<String> customGameMap;
private Stage fileNotFound = new MessageWindow("File not found!");
private Stage wrongFileEncoding = new MessageWindow("Wrong file encoding!");
private BoardView boardView;
private Board board;
private int width;
private int height;
private int mines;
private Button exitButton = new Button("Exit");
private Button replayButton = new Button("Replay");
private BoardGeneratorType boardGeneratorType;
private File mapFile = null;
private Button solveButton = new Button("Solve");
private Communicator botTalker;
private Deque<Integer> revealedInfo;
@FXML
private void newGame() {
((Stage) newGameButton.getScene().getWindow()).close();
getParams();
boardGeneratorType = BoardGeneratorType.Simple;
generateGame(BoardGeneratorFactory.MakeBoardGenerator(BoardGeneratorType.Simple)).show();
}
@FXML
private void customGame() {
mapFile = openMapFile(customGameMap.getValue());
if (mapFile == null) {
fileNotFound.show();
return;
}
boardGeneratorType = BoardGeneratorType.File;
((Stage) customGameButton.getScene().getWindow()).close();
prepareScanner();
generateGame(BoardGeneratorFactory.MakeBoardGenerator(BoardGeneratorType.File)).show();
}
@Nullable
private File openMapFile(@Nullable String fileName) {
try {
URL fileURL = Thread.currentThread().getContextClassLoader().getResource("./Maps/" + fileName);
if (fileURL != null) {
return new File(fileURL.toURI());
}
} catch (URISyntaxException ignored) {
}
return null;
}
private void prepareScanner() {
try {
Scanner sc = new Scanner(mapFile);
getParams(sc);
BoardGeneratorFactory.mapScanner = sc;
} catch (FileNotFoundException ignored) {
}
}
private void autoSolve(@NotNull Node[] buttons) {
solveButton.setDisable(true);
Deque<Integer> feedback = new ArrayDeque<>();
botTalker = new Communicator(feedback);
new Solver(width, height, buttons, feedback, botTalker).start();
}
private void resetGame() {
if (boardGeneratorType == BoardGeneratorType.File)
prepareScanner();
setBoard(new Board(width, height, mines, BoardGeneratorFactory.MakeBoardGenerator(boardGeneratorType)));
boardView.disableBoard(false);
solveButton.setDisable(false);
}
private BoardView generateGame(@NotNull IBoardGenerator boardGenerator) {
exitButton.setOnAction(event -> exit());
replayButton.setOnAction(event -> resetGame());
boardView = new BoardView(exitButton, replayButton, solveButton, width, height);
setBoard(new Board(width, height, mines, boardGenerator));
return boardView;
}
private void getParams() {
try {
mines = Integer.parseInt(minesField.getText());
width = Integer.parseInt(widthField.getText());
height = Integer.parseInt(heightField.getText());
} catch (NumberFormatException ignore) {
//TODO handle the exception
}
}
private void getParams(@NotNull Scanner sc) {
try {
mines = sc.nextInt();
width = sc.nextInt();
height = sc.nextInt();
} catch (RuntimeException e) {
wrongFileEncoding.show();
}
}
private void show(int pos) {
revealedInfo = boardView.reveal(pos);
int numOfRevealed = revealedInfo.pop();
if (board.checkFail(pos))
finish(false);
else if (board.checkSuccess(numOfRevealed))
finish(true);
if (botTalker != null)
botTalker.send(revealedInfo);
}
private void finish(boolean victory) {
boardView.addResult(victory);
boardView.disableBoard(true);
boardView.showBombs();
revealedInfo.clear();
revealedInfo.add(-1);
}
@FXML
private void exit() {
Platform.exit();
}
private void setBoard(@NotNull Board boardModel) {
board = boardModel;
Node[] buttons = new Node[height * width];
for (int pos = 0; pos < height * width; ++pos) {
Node tmp = new Node(pos);
tmp.setOnAction((event) -> show(tmp.getPos()));
buttons[pos] = tmp;
}
boardView.setBoard(buttons, board.getValues());
solveButton.setOnAction(event -> autoSolve(buttons));
}
}
| [
"Krzysiek23497@gmail.com"
] | Krzysiek23497@gmail.com |
b58bf702ff48701d8d37a92d6efbfcfde69e03b4 | bcfcf9133999a84a4d6ca34398471c5e3207b777 | /crontab4j-scheduler/src/main/java/org/keyboardplaying/cron/expression/rule/package-info.java | 5048f6985cab8e5b6af7ff25c4e54f8e1f89d901 | [
"BSD-3-Clause"
] | permissive | cyChop/crontab4j | df66a554dddfee39796d27dadf2f0275985ac7a3 | 1c168ab1ec1734536c15cd26a0c1741314088c50 | refs/heads/master | 2021-07-06T06:39:20.185889 | 2017-01-05T07:37:34 | 2017-01-05T07:37:34 | 30,843,507 | 1 | 1 | null | 2017-01-04T22:39:11 | 2015-02-15T21:48:35 | Java | UTF-8 | Java | false | false | 90 | java | /**
* The possible kinds of rules.
*/
package org.keyboardplaying.cron.expression.rule;
| [
"cyrille.chopelet@mines-nancy.org"
] | cyrille.chopelet@mines-nancy.org |
58b98d4064675c342fdd1c91ed33e0947d5f774d | ae85abeb5b0b655da6c35c14bfab83aa8b937bac | /src/main/java/com/study/jta/atomikos/config/DataSourceFirstConfig.java | dc6720c1ff7bd896ab9e8bf08a3e3b9cddb3fd97 | [] | no_license | 92376/jta-atomikos | b79ffd861169a2466b33cda5dda70b746c4c43cb | eca26683b44f0557c71338b7990c5a6f5a4ff293 | refs/heads/master | 2020-05-30T19:37:06.750201 | 2019-06-03T03:31:14 | 2019-06-03T03:31:14 | 189,928,858 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,060 | java | package com.study.jta.atomikos.config;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.SqlSessionTemplate;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jta.atomikos.AtomikosDataSourceBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import javax.sql.DataSource;
/**
* 读数据源配置
*
* @author wujing
* @date: 2019/03/27 14:26
*/
@Configuration
@MapperScan(basePackages = "com.study.jta.atomikos.dao.first", sqlSessionTemplateRef = "firstSqlSessionTemplate")
public class DataSourceFirstConfig {
@Primary
@Bean(name = "firstDataSource")
@ConfigurationProperties(prefix = "app.datasource.first")
public DataSource dataSource() {
return new AtomikosDataSourceBean();
}
@Primary
@Bean(name = "firstSqlSessionFactory")
public SqlSessionFactory sqlSessionFactory(@Qualifier("firstDataSource") DataSource dataSource)
throws Exception {
SqlSessionFactoryBean bean = new SqlSessionFactoryBean();
bean.setDataSource(dataSource);
bean.setConfiguration(MybatisConfig.getConfiguration());
return bean.getObject();
}
@Primary
@Bean(name = "firstTransactionManager")
public DataSourceTransactionManager transactionManager(@Qualifier("firstDataSource") DataSource dataSource) {
return new DataSourceTransactionManager(dataSource);
}
@Primary
@Bean(name = "firstSqlSessionTemplate")
public SqlSessionTemplate sqlSessionTemplate(
@Qualifier("firstSqlSessionFactory") SqlSessionFactory sqlSessionFactory) {
return new SqlSessionTemplate(sqlSessionFactory);
}
} | [
"923765001@qq.com"
] | 923765001@qq.com |
a12e0a0e6e276ea6f3ea472ab30d155b0142244b | afab90e214f8cb12360443e0877ab817183fa627 | /bitcamp-java/src/main/java/com/eomcs/oop/ex11/c/step7/Category.java | 5abf52c719767d066280e8de99297abad01eb820 | [] | no_license | oreoTaste/bitcamp-study | 40a96ef548bce1f80b4daab0eb650513637b46f3 | 8f0af7cd3c5920841888c5e04f30603cbeb420a5 | refs/heads/master | 2020-09-23T14:47:32.489490 | 2020-05-26T09:05:40 | 2020-05-26T09:05:40 | 225,523,347 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,646 | java | package com.eomcs.oop.ex11.c.step7;
public class Category {
// static nested class 를 사용하여
// 여러 상수를 그룹 별로 묶어 관리한다.
//
// 그러면 차라리 각각의 클래스를 멤버 클래스로 별도의 파일로 분리하는 것이 낫지 않을까?
// => 다음 클래스를 보면 상수를 묶어서 관리하는 용도로 만들었다.
// => 클래스의 크기도 작다.
// => 이런 클래스를 별도의 파일로 분리하면 여러 개의 파일이 생겨서 오히려 관리하기 번거롭다.
// 즉 자잘한 클래스들이 여러 파일에 분산되기 때문에 관리하기 번거로워진다.
// => 차라리 이렇게 중첩 클래스로 만들면 사용할 때 다음과 같이 계층적으로 작성하기 때문에
// 이해하기가 쉬워진다.
// int value = Category.computer.CPU;
// => 바깥 클래스를 패키지처럼 생각할 수 있어 이해하고 관리하기 편하다.
public static class computer {
public static final int CPU = 1;
public static final int VGA = 2;
public static final int RAM = 3;
public static final int MOUSE = 4;
public static final int KEYBOARD = 5;
}
public static class appliance {
public static final int TV = 10;
public static final int AUDIO = 11;
public static final int DVD = 12;
public static final int VACUUMCLEANER = 13;
}
public static class book {
public static final int POET = 100;
public static final int NOVEL = 101;
public static final int ESSAY = 102;
public static final int IT = 103;
public static final int LANG = 104;
}
}
| [
"youngkuk.sohn@gmail.com"
] | youngkuk.sohn@gmail.com |
3931d7b3fc7763dd46be7b69ee4669df2aabfb5f | a9c0f63b0158e75b36fd34bb95c0c9182bdbce2c | /src/repl_it_Assignments/P226_Carpet/Carpet.java | 6325cf402274dd3495a1be98e56630c8557c1142 | [] | no_license | arafatadiham/MyFirstProject | 54d11fd265b70fb252fcd01941ec913e79c39ebd | f2b0c21b00c4c2d175b388a0662020dfc121efcc | refs/heads/master | 2021-01-14T04:30:17.514735 | 2020-05-01T23:37:29 | 2020-05-01T23:37:29 | 242,599,065 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 709 | java | package repl_it_Assignments.P226_Carpet;
public class Carpet {
public double width;
public double length;
public double unitPrice;
public double totalPrice;
public boolean isPersian;
public Carpet() {
length = 300;
width = 300;
totalPrice = 200;
isPersian = false;
unitPrice = 0;
}
public Carpet(double width, double length, double unitPrice, boolean isPersian) {
this.width = width;
this.length = length;
this.unitPrice = unitPrice;
this.isPersian = isPersian;
totalPrice = (width + length) * unitPrice;
if (isPersian == true) {
this.totalPrice += 200;
}
}
} | [
"arafat.adiham@gmail.com"
] | arafat.adiham@gmail.com |
41fd6f7f2177f0836c124961804921d06ed8941f | a35c090e652e32f585075dfd0fcc13bfcda05009 | /dd/mat/FragmentMap/gen/com/example/fragmentmap/BuildConfig.java | 67d4718201ea72fb323fac1dd55c70b9b154edfc | [] | no_license | andandjava/doc | af93f7e9c382c48638c6788c1e24010dc85b24b0 | 16f74c8e751547fc349d4187e0d89d07fb3193db | refs/heads/master | 2021-01-01T04:55:48.381107 | 2016-04-28T07:15:35 | 2016-04-28T07:15:35 | 57,279,380 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 165 | java | /** Automatically generated file. DO NOT MODIFY */
package com.example.fragmentmap;
public final class BuildConfig {
public final static boolean DEBUG = true;
} | [
"ajaybabu.p@etg72.etggs.net"
] | ajaybabu.p@etg72.etggs.net |
a0903c06d4cf66907b1f9a3c3b6c7fd01ccfdc15 | 9d354db86883438c209c22717ac9f1043c459321 | /lingwan_pp/YytxBiData/src/org/tp/zb/server/handler/HttpDemoServerHandler.java | 050a718f6ae50e5f80985057ed8b719e2e77fcd0 | [] | no_license | royzhang78/PP | 23f773574c46743f84b57f9739076c9afe418f50 | e8dba1de81629fd5d947178ce90b9d94ee662e9b | refs/heads/master | 2020-12-03T07:46:24.814705 | 2016-08-22T07:03:02 | 2016-08-22T07:03:02 | 66,249,469 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,742 | java | /*
* Copyright 2013 The Netty Project
*
* The Netty Project 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.tp.zb.server.handler;
import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandlerAdapter;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.http.DefaultFullHttpResponse;
import io.netty.handler.codec.http.FullHttpResponse;
import io.netty.handler.codec.http.HttpHeaderUtil;
import io.netty.handler.codec.http.HttpHeaderValues;
import io.netty.handler.codec.http.HttpRequest;
import static io.netty.handler.codec.http.HttpHeaderNames.*;
import static io.netty.handler.codec.http.HttpResponseStatus.*;
import static io.netty.handler.codec.http.HttpVersion.*;
public class HttpDemoServerHandler extends ChannelHandlerAdapter {
private static final byte[] CONTENT = { '1', '1', '1', '1', 'o', ' ', 'W', 'o', 'r', 'l', 'd' };
@Override
public void channelReadComplete(ChannelHandlerContext ctx) {
ctx.flush();
}
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) {
if (msg instanceof HttpRequest) {
// new jodd.madvoc.MadvocServletFilter().doFilter(arg0, arg1, arg2);
HttpRequest req = (HttpRequest) msg;
if (HttpHeaderUtil.is100ContinueExpected(req)) {
ctx.write(new DefaultFullHttpResponse(HTTP_1_1, CONTINUE));
}
boolean keepAlive = HttpHeaderUtil.isKeepAlive(req);
FullHttpResponse response = new DefaultFullHttpResponse(HTTP_1_1, OK, Unpooled.wrappedBuffer(CONTENT));
response.headers().set(CONTENT_TYPE, "text/plain");
response.headers().setInt(CONTENT_LENGTH, response.content().readableBytes());
if (!keepAlive) {
ctx.write(response).addListener(ChannelFutureListener.CLOSE);
} else {
response.headers().set(CONNECTION, HttpHeaderValues.KEEP_ALIVE);
ctx.write(response);
}
}
}
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
cause.printStackTrace();
ctx.close();
}
}
| [
"roy.zhang@fireflygames.com"
] | roy.zhang@fireflygames.com |
6d04c2f58a00d324f61eae61d82c3d444fba6c5d | dea92fc41db6a97d8cb32b266c399edd3a61989f | /source/org.strategoxt.imp.editors.stratego/editor/java/trans/basic_desugar_top_0_0.java | c0d1c0f9e34625a71fab460114f63f71038130d6 | [] | no_license | adilakhter/spoofaxlang | 19170765e690477a79069e05fd473f521d1d1ddc | 27515280879cc108a3cf2108df00760b6d39e15e | refs/heads/master | 2020-03-17T01:15:18.833754 | 2015-01-22T07:12:05 | 2015-01-22T07:12:05 | 133,145,594 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,160 | java | package trans;
import org.strategoxt.stratego_lib.*;
import org.strategoxt.stratego_lib.*;
import org.strategoxt.stratego_sglr.*;
import org.strategoxt.stratego_gpp.*;
import org.strategoxt.stratego_xtc.*;
import org.strategoxt.stratego_aterm.*;
import org.strategoxt.strc.*;
import org.strategoxt.java_front.*;
import org.strategoxt.imp.editors.stratego.strategies.*;
import org.strategoxt.lang.*;
import org.spoofax.interpreter.terms.*;
import static org.strategoxt.lang.Term.*;
import org.spoofax.interpreter.library.AbstractPrimitive;
import java.util.ArrayList;
import java.lang.ref.WeakReference;
@SuppressWarnings("all") public class basic_desugar_top_0_0 extends Strategy
{
public static basic_desugar_top_0_0 instance = new basic_desugar_top_0_0();
@Override public IStrategoTerm invoke(Context context, IStrategoTerm term)
{
context.push("basic_desugar_top_0_0");
Fail21495:
{
term = topdown_1_0.instance.invoke(context, term, lifted6554.instance);
if(term == null)
break Fail21495;
context.popOnSuccess();
if(true)
return term;
}
context.popOnFailure();
return null;
}
} | [
"md.adilakhter@gmail.com"
] | md.adilakhter@gmail.com |
3a316cb4504ab2edcf3097ee4ec8ee95739f1ec6 | f17a8f4dd140532ee10730639f86b62683985c58 | /src/main/java/com/cisco/axl/api/_8/AddRecordingProfileReq.java | 14f614b17d9a0151fae061cfd9966b81214eef06 | [
"Apache-2.0"
] | permissive | alexpekurovsky/cucm-http-api | 16f1b2f54cff4dcdc57cf6407c2a40ac8302a82a | a1eabf49cc9a05c8293ba07ae97f2fe724a6e24d | refs/heads/master | 2021-01-15T14:19:10.994351 | 2013-04-04T15:32:08 | 2013-04-04T15:32:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,614 | java |
package com.cisco.axl.api._8;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for AddRecordingProfileReq complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="AddRecordingProfileReq">
* <complexContent>
* <extension base="{http://www.cisco.com/AXL/API/8.0}APIRequest">
* <sequence>
* <element name="recordingProfile" type="{http://www.cisco.com/AXL/API/8.0}XRecordingProfile"/>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "AddRecordingProfileReq", propOrder = {
"recordingProfile"
})
public class AddRecordingProfileReq
extends APIRequest
{
@XmlElement(required = true)
protected XRecordingProfile recordingProfile;
/**
* Gets the value of the recordingProfile property.
*
* @return
* possible object is
* {@link XRecordingProfile }
*
*/
public XRecordingProfile getRecordingProfile() {
return recordingProfile;
}
/**
* Sets the value of the recordingProfile property.
*
* @param value
* allowed object is
* {@link XRecordingProfile }
*
*/
public void setRecordingProfile(XRecordingProfile value) {
this.recordingProfile = value;
}
}
| [
"martin@filliau.com"
] | martin@filliau.com |
4195bbdd4d8824d4dc60fe0df2ece6beec8f8d4f | 0ab73dfcc1b0a21f2a4a6852d8c82b5ad119e277 | /FightPub2/src/main/java/view/menu/JukkaElement1.java | 2e319a0c237a65918f447e9deb9024993f66da5a | [] | no_license | patrikheinonen/fightPub2 | c0ac764887e189e87b86728022ae9d73346b23e9 | de9f21f9e09e0b1c8272175be96c4ff2715dc006 | refs/heads/master | 2022-02-26T16:59:15.826662 | 2019-12-09T21:11:06 | 2019-12-09T21:11:06 | 243,501,224 | 0 | 0 | null | 2022-02-10T01:21:57 | 2020-02-27T11:17:44 | HTML | UTF-8 | Java | false | false | 304 | java |
package view.menu;
/**
* Use "Jukka" as player 1 character.
* @author Joonas
*/
public class JukkaElement1 extends MenuElement {
public JukkaElement1() {
super.label = texts.getString("CHAR2");
}
public void action() {
MenuIF menu = new Character2Menu("Jukka");
}
}
| [
"joonas.taivalmaa@metropolia.fi"
] | joonas.taivalmaa@metropolia.fi |
e1eb5fc4a006b59fa5f2751685ce803303790d13 | bbfe1c1fda49630e43989fbede475b3efdb80e7f | /espresso/libtests/src/main/java/com/google/android/apps/common/testing/ui/espresso/base/AsyncTaskPoolMonitorTest.java | 83a62b4526f00c0297df74a76860dfc0de010754 | [] | no_license | dkauf/espresso_clone | 87cc57f09ab3dcb15de3f7a6e54756c85571eed7 | 799a545b00332c84450c6c777e454b732549322f | refs/heads/master | 2021-01-22T11:03:38.696010 | 2013-10-21T14:28:59 | 2013-10-22T20:09:10 | 13,791,301 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,843 | java | package com.google.android.apps.common.testing.ui.espresso.base;
import junit.framework.TestCase;
import java.util.concurrent.Callable;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.FutureTask;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
/**
* Unit test for {@link AsyncTaskPoolMonitor}
*/
public class AsyncTaskPoolMonitorTest extends TestCase {
private final ThreadPoolExecutor testThreadPool = new ThreadPoolExecutor(
4, 4, 1, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());
private AsyncTaskPoolMonitor monitor = new AsyncTaskPoolMonitor(testThreadPool);
@Override
public void tearDown() throws Exception {
testThreadPool.shutdownNow();
super.tearDown();
}
public void testIsIdle_onEmptyPool() throws Exception {
assertTrue(monitor.isIdleNow());
final AtomicBoolean isIdle = new AtomicBoolean(false);
// since we're already idle, this should be ran immedately on our thread.
monitor.notifyWhenIdle(new Runnable() {
@Override
public void run() {
isIdle.set(true);
}
});
assertTrue(isIdle.get());
}
public void testIsIdle_withRunningTask() throws Exception {
final CountDownLatch runLatch = new CountDownLatch(1);
testThreadPool.submit(new Runnable() {
@Override
public void run() {
runLatch.countDown();
try {
Thread.sleep(50000);
} catch (InterruptedException ie) {
throw new RuntimeException(ie);
}
}
});
assertTrue(runLatch.await(1, TimeUnit.SECONDS));
assertFalse(monitor.isIdleNow());
final AtomicBoolean isIdle = new AtomicBoolean(false);
monitor.notifyWhenIdle(new Runnable() {
@Override
public void run() {
isIdle.set(true);
}
});
// runnable shouldn't be run ever..
assertFalse(isIdle.get());
}
public void testIdleNotificationAndRestart() throws Exception {
FutureTask<Thread> workerThreadFetchTask = new FutureTask<Thread>(new Callable<Thread>() {
@Override
public Thread call() {
return Thread.currentThread();
}
});
testThreadPool.submit(workerThreadFetchTask);
Thread workerThread = workerThreadFetchTask.get();
final CountDownLatch runLatch = new CountDownLatch(1);
final CountDownLatch exitLatch = new CountDownLatch(1);
testThreadPool.submit(new Runnable() {
@Override
public void run() {
runLatch.countDown();
try {
exitLatch.await();
} catch (InterruptedException ie) {
throw new RuntimeException(ie);
}
}
});
assertTrue(runLatch.await(1, TimeUnit.SECONDS));
final CountDownLatch notificationLatch = new CountDownLatch(1);
monitor.notifyWhenIdle(new Runnable() {
@Override
public void run() {
notificationLatch.countDown();
}
});
// give some time for the idle detection threads to spin up.
Thread.sleep(2000);
// interrupt one of them
workerThread.interrupt();
Thread.sleep(1000);
// unblock the dummy work item.
exitLatch.countDown();
assertTrue(notificationLatch.await(1, TimeUnit.SECONDS));
assertTrue(monitor.isIdleNow());
}
public void testIdleNotification_extraWork() throws Exception {
final CountDownLatch firstRunLatch = new CountDownLatch(1);
final CountDownLatch firstExitLatch = new CountDownLatch(1);
testThreadPool.submit(new Runnable() {
@Override
public void run() {
firstRunLatch.countDown();
try {
firstExitLatch.await();
} catch (InterruptedException ie) {
throw new RuntimeException(ie);
}
}
});
assertTrue(firstRunLatch.await(1, TimeUnit.SECONDS));
final CountDownLatch notificationLatch = new CountDownLatch(1);
monitor.notifyWhenIdle(new Runnable() {
@Override
public void run() {
notificationLatch.countDown();
}
});
final CountDownLatch secondRunLatch = new CountDownLatch(1);
final CountDownLatch secondExitLatch = new CountDownLatch(1);
testThreadPool.submit(new Runnable() {
@Override
public void run() {
secondRunLatch.countDown();
try {
secondExitLatch.await();
} catch (InterruptedException ie) {
throw new RuntimeException(ie);
}
}
});
assertFalse(notificationLatch.await(10, TimeUnit.MILLISECONDS));
firstExitLatch.countDown();
assertFalse(notificationLatch.await(500, TimeUnit.MILLISECONDS));
secondExitLatch.countDown();
assertTrue(notificationLatch.await(1, TimeUnit.SECONDS));
assertTrue(monitor.isIdleNow());
}
}
| [
"thomaswk@google.com"
] | thomaswk@google.com |
533d20e6784345a11f53f5cfd25b002058fbccda | 146a270f140553bd607876eb8c489c47eb8efd3e | /smart_router/src/test/java/com/bbq/smart_router/ExampleUnitTest.java | f5c71f494fb6709afef7873d8e7e4c86ee5a6222 | [] | no_license | iwome/smartRouter | 635dee86f7ac90c4d226b0c2c7c36c9d14144c8c | 5717fddc60b725ac900635eaa2c91fa586700eef | refs/heads/master | 2020-09-05T03:15:52.128037 | 2019-11-11T08:01:39 | 2019-11-11T08:01:39 | 219,964,211 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 381 | java | package com.bbq.smart_router;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"431066566@qq.com"
] | 431066566@qq.com |
34017d2ea680809d064fe017c41b7cf3b77373ab | 3d1bc9934ca6aceea49d4f63dd59432eef82c8eb | /oa/src/main/java/com/hotent/makshi/dao/waterprotectpark/RiverExperimentDao.java | 70ac78ec176a54fac81e81e69b61a3f514955d2f | [] | no_license | sdzx3783/project2018 | 570c5d878cc0afb5bda93003b5dc66d78e42fb79 | 52e0cae652fbd83b5712636e15a2e14401a5a50a | refs/heads/master | 2020-03-12T04:28:04.856156 | 2018-04-21T06:58:25 | 2018-04-21T06:58:25 | 130,445,510 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 426 | java |
package com.hotent.makshi.dao.waterprotectpark;
import java.util.List;
import org.springframework.stereotype.Repository;
import com.hotent.core.db.BaseDao;
import com.hotent.core.db.BaseDao;
import com.hotent.makshi.model.waterprotectpark.RiverExperiment;
@Repository
public class RiverExperimentDao extends BaseDao<RiverExperiment>
{
@Override
public Class<?> getEntityClass()
{
return RiverExperiment.class;
}
} | [
"378377084@qq.com"
] | 378377084@qq.com |
95e55571d8504677ee10e3d2c761bce4973260af | 325d8fa5fc3fbc1031145c9576d2dd8b99d435c4 | /src/java/servlet/UpdateCartServlet.java | 11d575a9045b279d42ea89c2bbff92ee3b709b6c | [] | no_license | tintran2401/HotelBooking | fe15f6df6bccfdbfd8eea1c7badf70b6a2266b9f | 4531c07754cda034ac37fdba3adfc63bbc284bf4 | refs/heads/master | 2023-03-16T17:12:58.063412 | 2021-03-01T12:30:46 | 2021-03-01T12:30:46 | 343,408,723 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,043 | 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 servlet;
import entities.TblBooking;
import entities.TblBookingDetails;
import java.io.IOException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import service.CartService;
/**
*
* @author TiTi
*/
@WebServlet(name = "UpdateCartServlet", urlPatterns = {"/UpdateCartServlet"})
public class UpdateCartServlet extends HttpServlet {
private final String viewCartPage = "viewCart.jsp";
private final String errorPage = "error.jsp";
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
* methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
String url = viewCartPage;
String btAction = request.getParameter("btAction");
String amountStr = request.getParameter("amount");
String detailPositionStr = request.getParameter("detailPosition");
try {
int amount = amountStr == null ? 1 : Integer.parseInt(amountStr);
int detailPosition = amountStr == null ? 1 : Integer.parseInt(detailPositionStr);
CartService cartService = new CartService(request.getSession());
TblBooking cart = cartService.getCart();
List<TblBookingDetails> details = (List<TblBookingDetails>) cart.getTblBookingDetailsCollection();
if ("Update".equals(btAction)) {
details.get(detailPosition).setAmount(amount);
} else if ("Delete".equals(btAction)) {
details.remove(detailPosition);
}
cart.setTblBookingDetailsCollection(details);
cartService.setCart(cart);
} catch (NumberFormatException ex) {
url = errorPage;
Logger.getLogger(UpdateCartServlet.class.getName()).log(Level.SEVERE, null, ex);
} finally {
RequestDispatcher rd = request.getRequestDispatcher(url);
rd.forward(request, response);
}
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
| [
"tintran1197@gmail.com"
] | tintran1197@gmail.com |
42ddaaa5207f9309fb019744d64147fd5e3c980b | 9da996d44a2621a269a2bd8430c6c892f87c3fb2 | /src/co/edu/uptc/persistencia/DAOPedidoFabrica.java | 040374670a1e49de908ff225f6bd1a42eae90017 | [] | no_license | SilvanaGC/ProyectoProgramacion | 1948e9b7af28639b798287ee330c104889a4e985 | 3a42a2cbb631d35ec022e92a914c315069a4a66f | refs/heads/main | 2023-07-30T17:19:04.665666 | 2021-10-07T14:09:58 | 2021-10-07T14:09:58 | 412,652,523 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,498 | java | package co.edu.uptc.persistencia;
import java.util.ArrayList;
import co.edu.uptc.logica.modelo.Fabrica;
import co.edu.uptc.logica.modelo.Producto;
import co.edu.uptc.logica.modelo.SistemaFacturacion;
import co.edu.uptc.utilidades.Archivo;
public class DAOPedidoFabrica {
private String RUTA = "Recursos/PedidosFabricacion.txt";
// Set
public void guardarProductoPedidoFab(Producto p, Fabrica f) {
new Archivo().AgregarContenido(RUTA, p.getCodigo() + "," + f.getCantidad() + "," + f.getComentarios() );
}
public ArrayList<Fabrica> mostrarDatosPedidoFab() {
// Obtener contenido de mi archivo plano
ArrayList<String> datos = new Archivo().ContenidoArchivo(RUTA);
ArrayList<Fabrica> listadoPedidosFabricar = new ArrayList<Fabrica>();
for (int i = 0; i < datos.size(); i++) {
Fabrica f = new Fabrica();
String Linea[] = datos.get(i).split(",");
f.setProducto(buscarProducto(Linea[0]));
//f.setCantidad(Integer.parseInt(Linea[1]));
f.setComentarios(Linea[2]);
listadoPedidosFabricar.add(f);
}
return listadoPedidosFabricar;
}
public Producto buscarProducto(String codP) {
SistemaFacturacion s = new SistemaFacturacion();
ArrayList<Producto> productos = s.getListadoProductos();
Producto p = new Producto();
for (int i = 0; i < productos.size(); i++) {
if (productos.get(i).getCodigo().equals(codP)) {
p = productos.get(i);
return p;
}
}
return null;
}
}
| [
"gutierrezchaparrosilvana@gmail.com"
] | gutierrezchaparrosilvana@gmail.com |
5971320a4164c97408da2c800b83e39e2c0d8ee2 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/9/9_6d99eef55f1fbcdc48f43fe0c7fb8a60cf218253/SetOperationsTask/9_6d99eef55f1fbcdc48f43fe0c7fb8a60cf218253_SetOperationsTask_t.java | fd419a8aacbec1b3643183ba63f8340890c9a282 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 1,919 | java | package edu.ucsf.rbvi.setsApp.internal.tasks;
import java.util.ArrayList;
import java.util.List;
import org.cytoscape.work.AbstractTask;
import org.cytoscape.work.TaskMonitor;
import org.cytoscape.work.Tunable;
import org.cytoscape.work.util.ListSingleSelection;
import edu.ucsf.rbvi.setsApp.internal.CyIdType;
import edu.ucsf.rbvi.setsApp.internal.SetOperations;
public class SetOperationsTask extends AbstractTask {
@Tunable(description="Enter a name for the new set:")
public String setName;
@Tunable(description="Select name of second set:")
public ListSingleSelection<String> seT2;
@Tunable(description="Select name of first set:")
public ListSingleSelection<String> seT1;
private SetsManager sm;
private SetOperations operation;
public SetOperationsTask(SetsManager setsManager, CyIdType type, SetOperations s) {
sm = setsManager;
List<String> attr = getSelectedSets(type);
seT1 = new ListSingleSelection<String>(attr);
seT2 = new ListSingleSelection<String>(attr);
operation = s;
}
private List<String> getSelectedSets(CyIdType type) {
ArrayList<String> selectSet = new ArrayList<String>();
List<String> mySetNames = sm.getSetNames();
if (type == CyIdType.NODE) {
for (String s: mySetNames)
if (sm.getType(s) == CyIdType.NODE)
selectSet.add(s);
}
if (type == CyIdType.EDGE) {
for (String s: mySetNames)
if (sm.getType(s) == CyIdType.EDGE)
selectSet.add(s);
}
return selectSet;
}
@Override
public void run(TaskMonitor arg0) throws Exception {
String set1 = seT1.getSelectedValue();
String set2 = seT2.getSelectedValue();
switch (operation) {
case INTERSECT:
sm.intersection(setName, set1, set2);
break;
case DIFFERENCE:
sm.difference(setName, set1, set2);
break;
case UNION:
sm.union(setName, set1, set2);
break;
default:
break;
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
9009252915bf29058f933844d5f9ae771e65eb3e | 29aadc987d4b7ce5770206798987e939248f4ba4 | /src/GUI/ModifyUser.java | 264fc52e4e3cd5ec043a4a93509cfeb14eebb788 | [] | no_license | 2snufkin/Swing | e804ba802f15b35648dbfabf69a2df0a2615e4dd | 3340ff4f3b2b9ca9999d5211dba0cc11a7f4dfed | refs/heads/master | 2023-08-25T07:45:12.543401 | 2021-11-08T10:43:01 | 2021-11-08T10:43:01 | 332,562,741 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,659 | 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 GUI;
import dAO.UserDAO;
import entities.Users;
import javax.swing.*;
/**
*
* @author Home
*/
public class ModifyUser extends javax.swing.JFrame {
/**
* Creates new form UserListGUI
*/
public ModifyUser() {
initComponents();
}
/**
* 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">
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jUserField = new javax.swing.JTextField();
jUserpass = new javax.swing.JTextField();
jComboBox1 = new javax.swing.JComboBox<>();
jButton2 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jPanel1.setBackground(new java.awt.Color(255, 255, 255));
jLabel1.setText("User Name");
jLabel2.setText("Password");
jLabel3.setText("Role");
jUserField.setText(" ");
jUserpass.setText(" ");
jUserpass.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jUserpassActionPerformed(evt);
}
});
jComboBox1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "User", "Admin"}));
jButton2.setBackground(new java.awt.Color(255, 255, 255));
jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/Save-icon.gif"))); // NOI18N
jButton2.setText("Save");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
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()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2)
.addComponent(jLabel3)
.addComponent(jLabel1))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 41, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jUserpass, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jUserField, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(51, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton2)
.addContainerGap())
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(0, 27, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jUserField, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jUserpass, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel3))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton2)
.addContainerGap())
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
);
pack();
}// </editor-fold>
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
Users userobg = new Users();
UserDAO user = new UserDAO();
String name = jUserField.getText().trim();
String pass = jUserpass.getText().trim();
if(name.isEmpty() ||pass.isEmpty() ) JOptionPane.showMessageDialog(jUserField,"Please enter something");
String role = String.valueOf(jComboBox1.getSelectedIndex());
Users userT = new Users(name, pass,role );
userM.addUser(userT);
UserListGUI.model.setRowCount(0);
UserListGUI.displayUsers();
}
private void jUserpassActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(ModifyUser.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(ModifyUser.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(ModifyUser.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(ModifyUser.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new ModifyUser().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton jButton2;
public javax.swing.JComboBox<String> jComboBox1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JPanel jPanel1;
public javax.swing.JTextField jUserField;
public javax.swing.JTextField jUserpass;
public UserDAO userM = new UserDAO();
// End of variables declaration
}
| [
"75860271+2snufkin@users.noreply.github.com"
] | 75860271+2snufkin@users.noreply.github.com |
7e07343d8570dee698080515f253c6aabc79899b | 8ce7ec699baf0668db0119b25b1319a4a2d2e029 | /ecsite/ecsite/src/main/java/jp/co/internous/ecsite/model/entity/Goods.java | 0fcb62b8e42f8ba3a158fbe2cd1025f74ff9027d | [] | no_license | akari819/ecsite | 92d6de47dc23d228df64a147c539ccf557db1614 | 44d49d05d75edf14c4fc571e7ba41fccabcbaf13 | refs/heads/master | 2023-01-30T05:17:22.432428 | 2020-12-14T06:48:50 | 2020-12-14T06:48:50 | 299,774,904 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,138 | java | package jp.co.internous.ecsite.model.entity;
import java.sql.Timestamp;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name="goods")
public class Goods {
@Id
@Column(name="id")
@GeneratedValue(strategy=GenerationType.IDENTITY)
private long id;
@Column(name="goods_name")
private String goodsName;
@Column(name="price")
private long price;
@Column(name="update_at")
private Timestamp updatedAt;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getGoodsName() {
return goodsName;
}
public void setGoodsName(String goodsName) {
this.goodsName = goodsName;
}
public long getPrice() {
return price;
}
public void setPrice(long price) {
this.price = price;
}
public Timestamp getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(Timestamp updatedAt) {
this.updatedAt = updatedAt;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
dcb7d22314f937630a612960acd116d54aac2e62 | c732b3a347389ca8075cedf907ba5d99854fceb4 | /src/lab5/Ch3/Main.java | c6b9dcc4876af6ea44c155e85843598935dd8b60 | [] | no_license | IoanaDiac/AtelierulDigitalJava2020 | 04e407cbed2a3cf696d00eebe8cb0df85a33a485 | 0e3a8fac135a8ba610dcb295114ea284118c096c | refs/heads/master | 2023-03-12T19:48:31.380814 | 2021-03-05T22:07:18 | 2021-03-05T22:07:18 | 313,394,796 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 358 | java | package lab5.Ch3;
public class Main {
public static void main(String[] args) {
String rootValue = "a";
GenericList<String> list = new GenericList<>(rootValue);
for (int i = 1; i < 10; i++) {
list.insert(String.valueOf(Character.valueOf((char) (rootValue.charAt(0) + i))));
}
list.println();
}
}
| [
"69198000+IoanaDiac@users.noreply.github.com"
] | 69198000+IoanaDiac@users.noreply.github.com |
a9f741371d1ea6459828daadde4c3d2a6ad43c33 | b3122263c829f70819e067ae4ca8e9ced5a5712c | /app/src/test/java/com/example/immigreat/ExampleUnitTest.java | aabaff3ecb7d53577f4c8c653da8433047f93d2c | [] | no_license | neilkale/ImmiGreat | 3cbf8b03b9729ae7cdb0c7a64e7e368a2efc3176 | f56703dbb51af20d731be2c72f49d6707005e9bc | refs/heads/master | 2022-11-30T06:09:22.067438 | 2020-07-30T15:28:52 | 2020-07-30T15:28:52 | 251,392,277 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 382 | java | package com.example.immigreat;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"neil.kale@gmail.com"
] | neil.kale@gmail.com |
c42ffdec9a6b4a9fe74912b71b56c42bd691a6e9 | 0c93d77b1ad74f4ff818f4351fa2e68b94658f07 | /src/Main_1107.java | 2f2c9622f12a8ecc554b6fcf14fdc2fc97d164f6 | [] | no_license | fkrfkrdk/JHS_NT1 | a00a5d29d3672232a24c2cb41461a9af2c4d3423 | 673a265a09ebcfb187142421f08e526c028bee51 | refs/heads/master | 2021-04-04T09:56:24.009732 | 2018-03-11T06:37:46 | 2018-03-11T06:37:46 | 124,725,505 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,401 | java | import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main_1107 {
private static final int INIT_CH = 100;
private static int N, M;
private static int smallest, largest, secondSmallest = -1;
private static boolean[] broken;
public static void main(String args[]) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
N = Integer.parseInt(br.readLine());
M = Integer.parseInt(br.readLine());
String[] input_s = new String[0];
if(M!=0) {
input_s = br.readLine().split(" ");
}
broken = new boolean[10];
for(int i=0;i<M;i++) {
broken[Integer.parseInt(input_s[i])] = true;
}
boolean second = false;
for(int i=0;i<10;i++) {
if(!broken[i]) {
if(!second) {
smallest = i;
second = true;
} else {
secondSmallest = i;
break;
}
}
}
for(int i=9;i>=0;i--) {
if(!broken[i]) {
largest = i;
break;
}
}
if(N == INIT_CH) {
System.out.println(0);
System.exit(0);
}
int diff = Math.abs(N-INIT_CH);
if(M==10) {
System.out.println(diff);
System.exit(0);
}
if(M==9 && smallest==0) {
int toZero = Math.abs(N-0)+1;
System.out.println(Math.min(toZero, diff));
System.exit(0);
}
if(checkConsistAll(N)) {
int digit = checkDigit(N);
System.out.println(Math.min(digit, diff));
System.exit(0);
}
int afterN = afterN(N);
int beforeN = beforeN(N);
int countAfter = Math.abs(afterN-N) + checkDigit(afterN);
int countBefore = Math.abs(beforeN-N) + checkDigit(beforeN);
int countDiff = Math.abs(N-INIT_CH);
//System.out.println("A:" + afterN + " / "+countAfter);
//System.out.println("B:" + beforeN +" / "+countBefore);
int result = 0;
if(beforeN == 0 && broken[0]) {
result = Math.min(countDiff,countAfter);
} else {
result = Math.min(countDiff, Math.min(countAfter, countBefore));
}
System.out.println(result);
br.close();
}
private static int checkDigit(int num) {
if(num == 0) return 1;
int digit = 0;
int n_temp = num;
while(n_temp != 0) {
n_temp = n_temp/10;
digit++;
}
return digit;
}
private static boolean checkConsistAll(int num) {
if(num == 0) {
if(broken[0]) return false;
else return true;
}
int n_temp = num;
while(n_temp != 0) {
if(broken[n_temp%10]) return false;
else n_temp = n_temp/10;
}
return true;
}
private static int afterN(int num) {
if(num/10 == 0) {
int larger = findBiggerNum(num);
if(larger != -1) return larger;
else {
if(smallest == 0) return secondSmallest*10+smallest;
else return smallest*10+smallest;
}
} else {
if(checkConsistAll(num/10)) {
int larger = findBiggerNum(num%10);
if(larger != -1) return (num/10)*10+larger;
}
return afterN(num/10)*10+smallest;
}
}
private static int beforeN(int num) {
if(num/10 == 0) {
int smaller = findSmallerNum(num);
if(smaller != -1) return smaller;
else return 0;
} else {
if(checkConsistAll(num/10)) {
int smaller = findSmallerNum(num%10);
if(smaller != -1) return (num/10)*10+smaller;
}
return beforeN(num/10)*10+largest;
}
}
private static int findBiggerNum(int num) {
for(int i=num+1;i<10;i++) {
if(!broken[i]) return i;
}
return -1;
}
private static int findSmallerNum(int num) {
for(int i=num-1;i>=0;i--) {
if(!broken[i]) return i;
}
return -1;
}
}
| [
"dkfkrfkr@naver.com"
] | dkfkrfkr@naver.com |
5d524434b1cb154252b04f87a9172c96942dca17 | eacfc7cf6b777649e8e017bf2805f6099cb9385d | /APK Source/src/com/immersion/hapticmediasdk/MediaTaskManager.java | 73f0588e87164e4786a47ce27596f49ca1ce3d1e | [] | no_license | maartenpeels/WordonHD | 8b171cfd085e1f23150162ea26ed6967945005e2 | 4d316eb33bc1286c4b8813c4afd478820040bf05 | refs/heads/master | 2021-03-27T16:51:40.569392 | 2017-06-12T13:32:51 | 2017-06-12T13:32:51 | 44,254,944 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 24,270 | java | // Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: braces fieldsfirst space lnc
package com.immersion.hapticmediasdk;
import android.content.Context;
import android.os.Handler;
import android.os.SystemClock;
import com.immersion.hapticmediasdk.controllers.HapticPlaybackThread;
import com.immersion.hapticmediasdk.controllers.MediaController;
import com.immersion.hapticmediasdk.utils.Log;
import com.immersion.hapticmediasdk.utils.RuntimeInfo;
import rrrrrr.crccrr;
public class MediaTaskManager
implements Runnable
{
/* member class not found */
class crccrr {}
private static final String a = "MediaTaskManager";
public static int b041504150415041504150415 = 2;
public static int b041504150415041504150415 = 0;
public static int b041504150415041504150415 = 1;
public static int b042104210421042104210421 = 37;
private final Object b;
private final Object c;
private long d;
private long e;
private Handler f;
private volatile HapticContentSDK.SDKStatus g;
private MediaController h;
private String i;
private boolean j;
private Context k;
private RuntimeInfo l;
public MediaTaskManager(Handler handler, Context context, RuntimeInfo runtimeinfo)
{
if (((b042104210421042104210421 + b041504150415041504150415) * b042104210421042104210421) % b041504150415041504150415 != b041504150415041504150415())
{
b042104210421042104210421 = 47;
b041504150415041504150415 = b041504150415041504150415();
}
HapticContentSDK.SDKStatus sdkstatus;
try
{
super();
b = new Object();
}
// Misplaced declaration of an exception variable
catch (Handler handler)
{
throw handler;
}
try
{
c = new Object();
sdkstatus = HapticContentSDK.SDKStatus.NOT_INITIALIZED;
}
// Misplaced declaration of an exception variable
catch (Handler handler)
{
throw handler;
}
g = sdkstatus;
f = handler;
k = context;
l = runtimeinfo;
return;
}
private int a()
{
int i1;
try
{
f.removeCallbacks(this);
if (h != null && d() != 0)
{
Log.e("MediaTaskManager", "Could not dispose haptics, reset anyway.");
}
}
catch (Exception exception)
{
throw exception;
}
try
{
i = null;
d = 0L;
g = HapticContentSDK.SDKStatus.NOT_INITIALIZED;
}
catch (Exception exception1)
{
throw exception1;
}
i1 = b042104210421042104210421;
switch ((i1 * (b041504150415041504150415() + i1)) % b041504150415041504150415)
{
default:
b042104210421042104210421 = b041504150415041504150415();
b041504150415041504150415 = 55;
// fall through
case 0: // '\0'
return 0;
}
}
private int a(HapticContentSDK.SDKStatus sdkstatus)
{
int i1 = b042104210421042104210421;
switch ((i1 * (b041504150415041504150415 + i1)) % b041504150415041504150415)
{
default:
b042104210421042104210421 = 19;
b041504150415041504150415 = b041504150415041504150415();
break;
case 0: // '\0'
break;
}
Object obj;
String s;
try
{
obj = f;
}
// Misplaced declaration of an exception variable
catch (HapticContentSDK.SDKStatus sdkstatus)
{
throw sdkstatus;
}
try
{
((Handler) (obj)).removeCallbacks(this);
g = sdkstatus;
if (i == null)
{
break MISSING_BLOCK_LABEL_135;
}
h = new MediaController(f.getLooper(), this);
sdkstatus = h.getControlHandler();
obj = k;
s = i;
}
// Misplaced declaration of an exception variable
catch (HapticContentSDK.SDKStatus sdkstatus)
{
throw sdkstatus;
}
sdkstatus = new HapticPlaybackThread(((Context) (obj)), s, sdkstatus, j, l);
h.initHapticPlayback(sdkstatus);
return 0;
return -4;
}
private int b()
{
f.removeCallbacks(this);
int i1 = h.onPrepared();
if (i1 == 0)
{
g = HapticContentSDK.SDKStatus.PLAYING;
Handler handler;
int j1;
while ((4 * 5) % 2 != 0 && (3 + 9) % 2 + 1 != 1) ;
handler = f;
j1 = b042104210421042104210421;
switch ((j1 * (b041504150415041504150415 + j1)) % b041504150415041504150415)
{
default:
b042104210421042104210421 = b041504150415041504150415();
b041504150415041504150415 = 68;
// fall through
case 0: // '\0'
handler.postDelayed(this, 1500L);
break;
}
}
return i1;
}
public static int b041504150415041504150415()
{
return 1;
}
public static int b041504150415041504150415()
{
return 0;
}
public static int b041504150415041504150415()
{
return 54;
}
private int c()
{
int i1;
try
{
f.removeCallbacks(this);
d = 0L;
}
catch (Exception exception)
{
throw exception;
}
if (((b042104210421042104210421 + b041504150415041504150415) * b042104210421042104210421) % b041504150415041504150415 != b041504150415041504150415)
{
b042104210421042104210421 = b041504150415041504150415();
b041504150415041504150415 = b041504150415041504150415();
}
try
{
i1 = h.stopHapticPlayback();
}
catch (Exception exception1)
{
throw exception1;
}
if (i1 != 0)
{
break MISSING_BLOCK_LABEL_65;
}
g = HapticContentSDK.SDKStatus.STOPPED;
return i1;
}
private int d()
{
int i1 = c();
if (i1 == 0)
{
label0:
do
{
switch ((4 * 5) % 2)
{
default:
while (true)
{
switch ((3 + 9) % 2 + 1)
{
default:
break;
case 0: // '\0'
continue label0;
case 1: // '\001'
break label0;
}
}
break;
case 0: // '\0'
break label0;
case 1: // '\001'
break;
}
} while (true);
h.onDestroy(f);
if (((b042104210421042104210421 + b041504150415041504150415) * b042104210421042104210421) % b041504150415041504150415 != b041504150415041504150415)
{
b042104210421042104210421 = 80;
b041504150415041504150415 = 44;
}
h = null;
}
return i1;
}
private int e()
{
int i1 = 2;
int j1;
try
{
f.removeCallbacks(this);
}
catch (Exception exception1)
{
throw exception1;
}
try
{
j1 = h.onPause();
}
catch (Exception exception2)
{
throw exception2;
}
if (j1 != 0)
{
break MISSING_BLOCK_LABEL_43;
}
try
{
do
{
i1 /= 0;
} while (true);
}
catch (Exception exception)
{
b042104210421042104210421 = b041504150415041504150415();
}
g = HapticContentSDK.SDKStatus.PAUSED;
return j1;
}
private int f()
{
f.removeCallbacks(this);
if (f.postDelayed(this, 1500L))
{
label0:
do
{
switch ((4 * 5) % 2)
{
default:
while (true)
{
switch ((3 + 9) % 2 + 1)
{
default:
break;
case 0: // '\0'
continue label0;
case 1: // '\001'
break label0;
}
}
break;
case 0: // '\0'
break label0;
case 1: // '\001'
break;
}
} while (true);
if (((b041504150415041504150415() + b041504150415041504150415) * b041504150415041504150415()) % b041504150415041504150415 != b041504150415041504150415)
{
b042104210421042104210421 = 70;
b041504150415041504150415 = 50;
}
return 0;
} else
{
return -1;
}
}
private int g()
{
int i1;
try
{
i1 = h.onPause();
}
catch (Exception exception)
{
throw exception;
}
if (i1 != 0)
{
break MISSING_BLOCK_LABEL_50;
}
if (((b042104210421042104210421 + b041504150415041504150415) * b042104210421042104210421) % b041504150415041504150415 != b041504150415041504150415())
{
b042104210421042104210421 = 64;
b041504150415041504150415 = 32;
}
g = HapticContentSDK.SDKStatus.PAUSED_DUE_TO_TIMEOUT;
return i1;
}
private int h()
{
int i1;
try
{
i1 = h.onPause();
}
catch (Exception exception)
{
throw exception;
}
if (i1 != 0)
{
break MISSING_BLOCK_LABEL_19;
}
g = HapticContentSDK.SDKStatus.PAUSED_DUE_TO_BUFFERING;
if (((b042104210421042104210421 + b041504150415041504150415) * b042104210421042104210421) % b041504150415041504150415 != b041504150415041504150415)
{
b042104210421042104210421 = 29;
b041504150415041504150415 = b041504150415041504150415();
}
return i1;
}
private int i()
{
if (((b042104210421042104210421 + b041504150415041504150415) * b042104210421042104210421) % b041504150415041504150415 != b041504150415041504150415)
{
b042104210421042104210421 = 78;
b041504150415041504150415 = 14;
}
int j1 = b();
int i1 = j1;
if (j1 == 0)
{
i1 = f();
}
label0:
do
{
switch ((4 * 5) % 2)
{
default:
while (true)
{
switch ((3 + 9) % 2 + 1)
{
default:
break;
case 0: // '\0'
continue label0;
case 1: // '\001'
break label0;
}
}
break;
case 0: // '\0'
break label0;
case 1: // '\001'
break;
}
} while (true);
return i1;
}
public int SeekTo(int i1)
{
int j1 = b041504150415041504150415();
switch ((j1 * (b041504150415041504150415() + j1)) % b041504150415041504150415)
{
default:
b042104210421042104210421 = 10;
b041504150415041504150415 = 6;
// fall through
case 0: // '\0'
setMediaTimestamp(i1);
break;
}
h.seekTo(i1);
if (getSDKStatus() == HapticContentSDK.SDKStatus.PLAYING)
{
label0:
do
{
switch ((3 + 9) % 2 + 1)
{
default:
while (true)
{
switch ((3 + 9) % 2 + 1)
{
default:
break;
case 0: // '\0'
continue label0;
case 1: // '\001'
break label0;
}
}
break;
case 0: // '\0'
break;
case 1: // '\001'
break label0;
}
} while (true);
return h.prepareHapticPlayback();
} else
{
return 0;
}
}
public long getMediaReferenceTime()
{
long l1;
synchronized (c)
{
l1 = e;
}
return l1;
exception;
obj;
JVM INSTR monitorexit ;
label0:
do
{
switch ((4 * 5) % 2)
{
default:
while (true)
{
switch ((3 + 9) % 2 + 1)
{
default:
break;
case 0: // '\0'
continue label0;
case 1: // '\001'
break label0;
}
}
break;
case 0: // '\0'
break label0;
case 1: // '\001'
break;
}
} while (true);
throw exception;
}
public long getMediaTimestamp()
{
long l1;
synchronized (c)
{
l1 = d;
}
return l1;
exception;
_L2:
(3 + 9) % 2 + 1;
JVM INSTR tableswitch 0 1: default 48
// 0 17
// 1 79;
goto _L1 _L2 _L3
_L1:
(4 * 5) % 2;
JVM INSTR tableswitch 0 1: default 76
// 0 79
// 1 17;
goto _L1 _L3 _L2
_L3:
obj;
JVM INSTR monitorexit ;
throw exception;
}
public HapticContentSDK.SDKStatus getSDKStatus()
{
obj;
JVM INSTR monitorenter ;
sdkstatus = g;
obj;
JVM INSTR monitorexit ;
return sdkstatus;
exception;
obj;
JVM INSTR monitorexit ;
throw exception;
Object obj = b;
HapticContentSDK.SDKStatus sdkstatus;
Exception exception;
while ((3 + 9) % 2 + 1 != 1 && (4 * 5) % 2 != 0) ;
break MISSING_BLOCK_LABEL_17;
}
public void run()
{
System.currentTimeMillis();
if (((b042104210421042104210421 + b041504150415041504150415) * b042104210421042104210421) % b041504150415041504150415 != b041504150415041504150415)
{
b042104210421042104210421 = 91;
b041504150415041504150415 = 30;
}
label0:
do
{
switch ((3 + 9) % 2 + 1)
{
default:
while (true)
{
switch ((3 + 9) % 2 + 1)
{
default:
break;
case 0: // '\0'
continue label0;
case 1: // '\001'
break label0;
}
}
break;
case 0: // '\0'
break;
case 1: // '\001'
break label0;
}
} while (true);
transitToState(HapticContentSDK.SDKStatus.PAUSED_DUE_TO_TIMEOUT);
}
public void setHapticsUrl(String s, boolean flag)
{
synchronized (b)
{
i = s;
j = flag;
}
return;
s;
_L3:
(4 * 5) % 2;
JVM INSTR tableswitch 0 1: default 48
// 0 79
// 1 21;
goto _L1 _L2 _L3
_L1:
(4 * 5) % 2;
JVM INSTR tableswitch 0 1: default 76
// 0 79
// 1 21;
goto _L1 _L2 _L3
_L2:
obj;
JVM INSTR monitorexit ;
throw s;
}
public void setMediaReferenceTime()
{
Object obj = c;
obj;
JVM INSTR monitorenter ;
HapticContentSDK.SDKStatus sdkstatus = g;
_L2:
(3 + 9) % 2 + 1;
JVM INSTR tableswitch 0 1: default 44
// 0 12
// 1 75;
goto _L1 _L2 _L3
_L1:
(4 * 5) % 2;
JVM INSTR tableswitch 0 1: default 72
// 0 75
// 1 12;
goto _L1 _L3 _L2
_L3:
if (sdkstatus == HapticContentSDK.SDKStatus.STOPPED)
{
h.waitHapticStopped();
}
e = SystemClock.uptimeMillis();
obj;
JVM INSTR monitorexit ;
return;
Exception exception;
exception;
obj;
JVM INSTR monitorexit ;
throw exception;
}
public void setMediaTimestamp(long l1)
{
Object obj = c;
obj;
JVM INSTR monitorenter ;
if (g == HapticContentSDK.SDKStatus.STOPPED)
{
h.waitHapticStopped();
}
e = SystemClock.uptimeMillis();
_L2:
(3 + 9) % 2 + 1;
JVM INSTR tableswitch 0 1: default 60
// 0 31
// 1 95;
goto _L1 _L2 _L3
_L1:
(3 + 9) % 2 + 1;
JVM INSTR tableswitch 0 1: default 92
// 0 31
// 1 95;
goto _L1 _L2 _L3
_L3:
d = l1;
obj;
JVM INSTR monitorexit ;
return;
Exception exception;
exception;
obj;
JVM INSTR monitorexit ;
throw exception;
}
public int transitToState(HapticContentSDK.SDKStatus sdkstatus)
{
int i1;
label0:
{
i1 = -1;
synchronized (b)
{
if (sdkstatus != HapticContentSDK.SDKStatus.NOT_INITIALIZED)
{
break label0;
}
i1 = a();
}
return i1;
}
crccrr.b042504250425042504250425[g.ordinal()];
JVM INSTR tableswitch 1 7: default 652
// 1 90
// 2 107
// 3 213
// 4 330
// 5 449
// 6 485
// 7 554;
goto _L1 _L2 _L3 _L4 _L5 _L6 _L7 _L8
_L1:
obj;
JVM INSTR monitorexit ;
return i1;
sdkstatus;
obj;
JVM INSTR monitorexit ;
throw sdkstatus;
_L2:
if (sdkstatus != HapticContentSDK.SDKStatus.INITIALIZED) goto _L1; else goto _L9
_L9:
i1 = a(sdkstatus);
goto _L1
_L3:
if (sdkstatus != HapticContentSDK.SDKStatus.PLAYING) goto _L11; else goto _L10
_L10:
i1 = i();
goto _L1
_L31:
if (sdkstatus != HapticContentSDK.SDKStatus.STOPPED_DUE_TO_ERROR) goto _L1; else goto _L12
_L12:
i1 = c();
g = HapticContentSDK.SDKStatus.STOPPED_DUE_TO_ERROR;
goto _L1
_L36:
if (sdkstatus != HapticContentSDK.SDKStatus.PLAYING) goto _L14; else goto _L13
_L13:
h.setRequestBufferPosition((int)d);
i1 = i();
goto _L1
_L11:
if (sdkstatus != HapticContentSDK.SDKStatus.STOPPED) goto _L16; else goto _L15
_L15:
i1 = c();
goto _L1
_L16:
if (sdkstatus != HapticContentSDK.SDKStatus.STOPPED_DUE_TO_ERROR) goto _L1; else goto _L17
_L17:
i1 = c();
g = HapticContentSDK.SDKStatus.STOPPED_DUE_TO_ERROR;
goto _L1
_L4:
(3 + 9) % 2 + 1;
JVM INSTR tableswitch 0 1: default 244
// 0 213
// 1 275;
goto _L18 _L4 _L19
_L18:
(4 * 5) % 2;
JVM INSTR tableswitch 0 1: default 272
// 0 275
// 1 213;
goto _L18 _L19 _L4
_L19:
if (sdkstatus != HapticContentSDK.SDKStatus.PLAYING) goto _L21; else goto _L20
_L20:
i1 = f();
goto _L1
_L21:
if (sdkstatus != HapticContentSDK.SDKStatus.PAUSED) goto _L23; else goto _L22
_L22:
i1 = e();
goto _L1
_L23:
if (sdkstatus != HapticContentSDK.SDKStatus.PAUSED_DUE_TO_TIMEOUT) goto _L25; else goto _L24
_L24:
Log.w("MediaTaskManager", "Haptic playback is paused due to update time-out. Call update() to resume playback");
i1 = g();
goto _L1
_L5:
if (sdkstatus != HapticContentSDK.SDKStatus.PLAYING) goto _L27; else goto _L26
_L26:
h.setRequestBufferPosition((int)d);
i1 = i();
goto _L1
_L27:
if (sdkstatus != HapticContentSDK.SDKStatus.PAUSED) goto _L29; else goto _L28
_L28:
i1 = 0;
goto _L1
_L25:
if (sdkstatus != HapticContentSDK.SDKStatus.PAUSED_DUE_TO_BUFFERING)
{
continue; /* Loop/switch isn't completed */
}
i1 = h();
Log.w("MediaTaskManager", "Haptic playback is paused due to slow data buffering...");
goto _L1
if (sdkstatus != HapticContentSDK.SDKStatus.STOPPED) goto _L31; else goto _L30
_L30:
i1 = c();
goto _L1
_L29:
if (sdkstatus != HapticContentSDK.SDKStatus.STOPPED) goto _L33; else goto _L32
_L32:
i1 = c();
goto _L1
_L33:
if (sdkstatus != HapticContentSDK.SDKStatus.STOPPED_DUE_TO_ERROR) goto _L1; else goto _L34
_L34:
i1 = c();
g = HapticContentSDK.SDKStatus.STOPPED_DUE_TO_ERROR;
goto _L1
_L6:
if (sdkstatus != HapticContentSDK.SDKStatus.PAUSED_DUE_TO_TIMEOUT) goto _L36; else goto _L35
_L35:
i1 = 0;
goto _L1
_L41:
if (sdkstatus != HapticContentSDK.SDKStatus.STOPPED_DUE_TO_ERROR) goto _L1; else goto _L37
_L37:
i1 = c();
g = HapticContentSDK.SDKStatus.STOPPED_DUE_TO_ERROR;
goto _L1
_L7:
if (sdkstatus != HapticContentSDK.SDKStatus.PAUSED_DUE_TO_BUFFERING) goto _L39; else goto _L38
_L38:
i1 = 0;
goto _L1
_L14:
if (sdkstatus != HapticContentSDK.SDKStatus.PAUSED)
{
continue; /* Loop/switch isn't completed */
}
g = HapticContentSDK.SDKStatus.PAUSED;
i1 = 0;
goto _L1
if (sdkstatus != HapticContentSDK.SDKStatus.STOPPED) goto _L41; else goto _L40
_L40:
i1 = c();
goto _L1
_L47:
if (sdkstatus != HapticContentSDK.SDKStatus.PAUSED) goto _L43; else goto _L42
_L42:
g = HapticContentSDK.SDKStatus.PAUSED;
i1 = 0;
goto _L1
_L8:
if (sdkstatus != HapticContentSDK.SDKStatus.PLAYING) goto _L45; else goto _L44
_L44:
i1 = i();
goto _L1
_L39:
if (sdkstatus != HapticContentSDK.SDKStatus.PLAYING) goto _L47; else goto _L46
_L46:
h.setRequestBufferPosition((int)d);
i1 = i();
goto _L1
_L43:
if (sdkstatus != HapticContentSDK.SDKStatus.STOPPED) goto _L49; else goto _L48
_L48:
i1 = c();
goto _L1
_L49:
if (sdkstatus != HapticContentSDK.SDKStatus.STOPPED_DUE_TO_ERROR) goto _L1; else goto _L50
_L50:
i1 = c();
g = HapticContentSDK.SDKStatus.STOPPED_DUE_TO_ERROR;
goto _L1
_L45:
HapticContentSDK.SDKStatus sdkstatus1 = HapticContentSDK.SDKStatus.STOPPED;
if (sdkstatus == sdkstatus1)
{
i1 = 0;
}
goto _L1
}
}
| [
"maartenpeels1012@hotmail.com"
] | maartenpeels1012@hotmail.com |
836d6ce89da2c896c1f627df4c871977a6e4a473 | d7c66b5533096f4e44b8bb86b6f5c90bab820ca6 | /app/src/main/java/ru/scorpio92/vkmd2/presentation/presenter/MusicPresenter.java | f897c2bbc9e96fe5f1864835fae13dff0638c249 | [] | no_license | VN0/vkmd2 | fc6c5e861719de0e1471a393d0f75d2a1817800a | 237269a8cdb386bc38892dad62325516c464f318 | refs/heads/master | 2020-06-21T22:29:27.908547 | 2018-06-01T05:49:43 | 2018-06-01T05:49:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,465 | java | package ru.scorpio92.vkmd2.presentation.presenter;
import java.util.List;
import ru.scorpio92.vkmd2.data.entity.Track;
import ru.scorpio92.vkmd2.domain.usecase.CheckUpdateUsecase;
import ru.scorpio92.vkmd2.domain.usecase.GetOnlineTracksUsecase;
import ru.scorpio92.vkmd2.domain.usecase.GetSavedTrackListUsecase;
import ru.scorpio92.vkmd2.domain.usecase.GetTrackListFromDBUsecase;
import ru.scorpio92.vkmd2.domain.usecase.SaveDownloadListUsecase;
import ru.scorpio92.vkmd2.domain.usecase.SaveOfflineSearchUsecase;
import ru.scorpio92.vkmd2.domain.usecase.base.CompletableObserver;
import ru.scorpio92.vkmd2.domain.usecase.base.ErrorObserver;
import ru.scorpio92.vkmd2.domain.usecase.base.SingleObserver;
import ru.scorpio92.vkmd2.presentation.presenter.base.AbstractPresenter;
import ru.scorpio92.vkmd2.presentation.presenter.base.IMusicPresenter;
import ru.scorpio92.vkmd2.presentation.view.activity.base.IMusicActivity;
import ru.scorpio92.vkmd2.tools.LocalStorage;
import ru.scorpio92.vkmd2.tools.Logger;
public class MusicPresenter extends AbstractPresenter<IMusicActivity> implements IMusicPresenter {
private GetOnlineTracksUsecase getOnlineTracksUsecase;
private GetTrackListFromDBUsecase getTrackListFromDBUsecase;
private GetSavedTrackListUsecase getSavedTrackListUsecase;
private SaveOfflineSearchUsecase saveOfflineSearchUsecase;
private SaveDownloadListUsecase saveDownloadListUsecase;
private CheckUpdateUsecase checkUpdateUsecase;
public MusicPresenter(IMusicActivity view) {
super(view);
getTrackListFromDBUsecase = new GetTrackListFromDBUsecase();
getSavedTrackListUsecase = new GetSavedTrackListUsecase();
checkUpdateUsecase = new CheckUpdateUsecase();
}
@Override
public void onDestroy() {
super.onDestroy();
cancelUsecases();
}
@Override
public void checkForUpdate() {
checkUpdateUsecase.execute(new SingleObserver<String>() {
@Override
public void onNext(String path) {
if(path.isEmpty()) {
Logger.log("CheckUpdate: no update");
} else {
Logger.log("CheckUpdate: " + path);
getView().showUpdateDialog(path);
}
}
@Override
public void onError(Throwable e) {
Logger.error((Exception) e);
}
});
}
@Override
public void getTrackList() {
getView().showOnlineSearchProgress(false);
if(getOnlineTracksUsecase != null)
getOnlineTracksUsecase.cancel();
getTrackListFromDBUsecase.execute(new SingleObserver<List<Track>>() {
@Override
protected void onStart() {
getView().showProgress(true);
}
@Override
public void onNext(List<Track> tracks) {
if (checkViewState()) {
getView().showProgress(false);
getView().showTrackList(tracks);
}
}
@Override
public void onError(Throwable e) {
Logger.error((Exception) e);
if (checkViewState()) {
getView().showProgress(false);
getView().showToast("Что-то пошло не так...");
}
}
});
}
@Override
public void getSavedTrackList() {
getView().showOnlineSearchProgress(false);
if(getOnlineTracksUsecase != null)
getOnlineTracksUsecase.cancel();
getSavedTrackListUsecase.execute(new SingleObserver<List<Track>>() {
@Override
protected void onStart() {
getView().showProgress(true);
}
@Override
public void onNext(List<Track> tracks) {
if (checkViewState()) {
getView().showProgress(false);
getView().showTrackList(tracks);
}
}
@Override
public void onError(Throwable e) {
Logger.error((Exception) e);
if (checkViewState()) {
getView().showProgress(false);
getView().showToast("Что-то пошло не так...");
}
}
});
}
@Override
public void getOnlineTracks(CharSequence searchQuery) {
String searchString = searchQuery.toString().trim();
if (searchString.length() >= 3) {
try {
cancelUsecases();
String uid = LocalStorage.getDataFromFile(getView().getViewContext(), LocalStorage.USER_ID_STORAGE);
String cookie = LocalStorage.getDataFromFile(getView().getViewContext(), LocalStorage.COOKIE_STORAGE);
getOnlineTracksUsecase = new GetOnlineTracksUsecase(uid, cookie, searchString);
getOnlineTracksUsecase.execute(new SingleObserver<List<Track>>() {
@Override
protected void onStart() {
getView().showOnlineSearchProgress(true);
}
@Override
public void onNext(List<Track> tracks) {
if (checkViewState()) {
getView().showTrackList(tracks);
getView().showOnlineSearchProgress(false);
}
}
@Override
public void onError(Throwable e) {
if (checkViewState()) {
getView().showToast("Что-то пошло не так...");
getView().showOnlineSearchProgress(false);
}
}
});
} catch (Exception e) {
Logger.error(e);
getView().showOnlineSearchProgress(false);
}
}
}
@Override
public void saveOfflineSearch(List<String> trackIdList) {
cancelUsecases();
saveOfflineSearchUsecase = new SaveOfflineSearchUsecase(trackIdList);
saveOfflineSearchUsecase.execute(new ErrorObserver() {
@Override
public void onError(Throwable e) {
Logger.error((Exception) e);
}
});
}
@Override
public void sendTracksForDownload(List<String> trackIdList) {
getView().showPrepareForDownload();
saveDownloadListUsecase = new SaveDownloadListUsecase(trackIdList);
saveDownloadListUsecase.execute(new CompletableObserver() {
@Override
public void onError(Throwable e) {
Logger.error((Exception) e);
}
@Override
public void onComplete() {
if (getView() != null)
getView().startDownloadService();
}
});
}
private void cancelUsecases() {
checkUpdateUsecase.cancel();
getSavedTrackListUsecase.cancel();
getTrackListFromDBUsecase.cancel();
if (getOnlineTracksUsecase != null)
getOnlineTracksUsecase.cancel();
if (saveOfflineSearchUsecase != null)
saveOfflineSearchUsecase.cancel();
if (saveDownloadListUsecase != null)
saveDownloadListUsecase.cancel();
}
}
| [
"scorpio92@mail.ru"
] | scorpio92@mail.ru |
1b02004b9118f36cdb9a57c1761db3f28705b019 | 685c907e0bf4721ff2b0db3ad652b51ab432afd0 | /src/main/resources/config/WebSecurityConfig.java | 1d86592c11cfcf657078ae0a756f81418cec817a | [] | no_license | haksup/bss | ca725618e70ee2656e01f13cfef2c3254594db9b | cd92ac3d5b10714fca482df1ac3cf44f29051fdd | refs/heads/master | 2020-12-10T09:10:07.272555 | 2016-09-29T09:29:20 | 2016-09-29T09:29:20 | 52,266,752 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 380 | java | package config;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
}
| [
"myborn@adwitt.com"
] | myborn@adwitt.com |
ee7beb4a6ee3f3bf121de1c1b8297dce82008776 | 2e03403116ab93d634129bd85fcd136869136813 | /src/tr/org/linux/kamp2016/helloworld/EmailValidation.java | d8f3b95d7ea23f8ff562d519996d575c867e86b2 | [] | no_license | deryabalik/Lyk2016-todo | 3fda7737888452d6ee610524b21d0221343934ff | 70aef9b6392bba9d608bdf3510d5197c50e6c264 | refs/heads/master | 2021-01-20T20:14:22.843349 | 2016-08-16T08:50:09 | 2016-08-16T08:50:09 | 65,803,643 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,149 | java | package tr.org.linux.kamp2016.helloworld;
import java.util.Scanner;
public class EmailValidation {
/**
* @param args
*/
static String email;
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("This program takes an email adress");
Scanner input = new Scanner(System.in);
String mail = "mail";
while(!mail.isEmpty()){
System.out.println("Enter an mail addres");
mail = input.nextLine();
if(!mail.isEmpty()){
if(isValid(mail)){
System.out.println("This mail adress is valid");
}
else{
System.out.println("This mail adres is not valid");
}
}System.out.println("Done");
}
}
private static boolean isValid(String email){
if(email.contains(" ")){
return false;
}
if(!email.contains("@")){
return false;
}
if(!email.contains(".")){
return false;
}
if(email.startsWith("@")|| email.startsWith(".")){
return false;
}
//mail@.
if(!(email.indexOf('@') + 1 < email.lastIndexOf("."))){
return false;
}
if(!(email.lastIndexOf(".") +2 < email.length())){
return false;
}return true;
}
}
| [
"dryblkc@gmail.com"
] | dryblkc@gmail.com |
773805bb31cd8aaa36b267af03da8792cd3de554 | a596e6bfedccf3adea175e6777705e2096ad97d1 | /esearch-stat/esearch-stat-event/src/main/java/com/globalegrow/esearch/stat/event/bean/UserInfoBean.java | b3ea346544078bd9313cfaff504c6d5c12079a82 | [] | no_license | waywtd/esearch | d2096c8335517e6b660f1c094e62add3a8a79315 | 0299ca772d82cf96e6ff73fd37afb09c2cf3cfd8 | refs/heads/master | 2020-04-29T02:14:03.910007 | 2019-03-15T06:07:44 | 2019-03-15T06:07:44 | 175,758,936 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,624 | java | package com.globalegrow.esearch.stat.event.bean;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import org.apache.hadoop.io.Writable;
import com.globalegrow.esearch.constant.Constant;
/**
* <pre>
*
* File: UserInfoBean.java
*
* Copyright (c) 2017, globalegrow.com All Rights Reserved.
*
* Description:
* TODO
*
* Revision History
* Date, Who, What;
* 2017年8月11日 lizhaohui Initial.
*
* </pre>
*/
public class UserInfoBean implements Writable
{
private String userId;
private String cookieId;
public UserInfoBean()
{
}
public UserInfoBean(String userId, String cookieId)
{
super();
this.userId = userId;
this.cookieId = cookieId;
}
@Override
public void write(DataOutput out) throws IOException
{
out.writeUTF(userId);
out.writeUTF(cookieId);
}
@Override
public void readFields(DataInput in) throws IOException
{
this.userId=in.readUTF();
this.cookieId=in.readUTF();
}
public String getUserId()
{
return userId;
}
public void setUserId(String userId)
{
this.userId = userId;
}
public String getCookieId()
{
return cookieId;
}
public void setCookieId(String cookieId)
{
this.cookieId = cookieId;
}
@Override
public String toString()
{
StringBuffer buffer=new StringBuffer();
buffer.append(userId).append(Constant.HIVE_SEPERATE).append(cookieId);
return buffer.toString();
}
}
| [
"chenc@jiguang.cn"
] | chenc@jiguang.cn |
e152f17e2f6c967e6d4464b39dd3db2c57366412 | 9001332d47ade446c5b649bfac94b1bb1b216ef6 | /11_Schepers_Tastenhoye_Vandewyngaert_KassaApp_2019/src/domain/DrempelKorting.java | 914112d38bb0e14b42182254968101b9b2da06ed | [] | no_license | KeanuTastenhoye/OOO_KassaApp | c179958e967479da083cd0b86965a30577a6bbdf | c96540ca5cfda892c423136457f454679fa93fae | refs/heads/master | 2023-01-12T09:31:22.645838 | 2020-11-14T11:15:16 | 2020-11-14T11:15:16 | 223,220,200 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 351 | java | package domain;
/**
* //@author Eline
*/
public class DrempelKorting implements KortingStrategy {
private int kortingEUR,drempel;
public DrempelKorting(int kortingEUR,int drempel)
{
this.kortingEUR=kortingEUR;
this.drempel=drempel;
}
@Override
public int getKorting() {
return kortingEUR;
}
}
| [
"elineschepers1999@gmail.com"
] | elineschepers1999@gmail.com |
3d6f9265485c76f7d348f09939c7673a481ee209 | fdf5110607059d08ea6a94fb3a4583c20ae24e21 | /Section 07 - Initilization and Cleanup/Exercise 01/src/com/samdide/thinkinginjava/Main.java | 7e73041e72e1fe036973e273b83302aa5b888c12 | [] | no_license | HenrikSamuelsson/ThinkingInJava | fe20c8f0d78855df82d70425c2837b6a72831a68 | d0fa25b74ff6b2f946f96d1869336fa5fbfbe8d5 | refs/heads/master | 2021-01-19T20:23:08.429348 | 2014-06-02T20:57:23 | 2014-06-02T20:57:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 417 | java | package com.samdide.thinkinginjava;
/**
* Exercise that demonstrates that an uninitialized String reference is set to
* null.
*
* @author Henrik Samuelsson
*/
public class Main {
/**
* Entry point to application.
*
* @param args
* array of string arguments
*/
public static void main(String[] args) {
StringHolder sh = new StringHolder();
System.out.println("sh.i = " + sh.s);
}
}
| [
"henrik.samuelsson@gmail.com"
] | henrik.samuelsson@gmail.com |
38088af42ab01b564705256406344ece642ec81b | 647ec12ce50f06e7380fdbfb5b71e9e2d1ac03b4 | /com.tencent.mm/classes.jar/com/tencent/mm/protocal/protobuf/fjy.java | 7cc57ad2763a174359fcdfc39771dce44b894e5c | [] | no_license | tsuzcx/qq_apk | 0d5e792c3c7351ab781957bac465c55c505caf61 | afe46ef5640d0ba6850cdefd3c11badbd725a3f6 | refs/heads/main | 2022-07-02T10:32:11.651957 | 2022-02-01T12:41:38 | 2022-02-01T12:41:38 | 453,860,108 | 36 | 9 | null | 2022-01-31T09:46:26 | 2022-01-31T02:43:22 | Java | UTF-8 | Java | false | false | 6,399 | java | package com.tencent.mm.protocal.protobuf;
import com.tencent.matrix.trace.core.AppMethodBeat;
import java.util.LinkedList;
public final class fjy
extends erp
{
public glh aaCt;
public gli aaCu;
public glj aaCv;
public gnn abKt;
public String oOI;
public final int op(int paramInt, Object... paramVarArgs)
{
AppMethodBeat.i(50115);
if (paramInt == 0)
{
paramVarArgs = (i.a.a.c.a)paramVarArgs[0];
if (this.BaseRequest != null)
{
paramVarArgs.qD(1, this.BaseRequest.computeSize());
this.BaseRequest.writeFields(paramVarArgs);
}
if (this.oOI != null) {
paramVarArgs.g(2, this.oOI);
}
if (this.aaCt != null)
{
paramVarArgs.qD(3, this.aaCt.computeSize());
this.aaCt.writeFields(paramVarArgs);
}
if (this.aaCu != null)
{
paramVarArgs.qD(6, this.aaCu.computeSize());
this.aaCu.writeFields(paramVarArgs);
}
if (this.aaCv != null)
{
paramVarArgs.qD(7, this.aaCv.computeSize());
this.aaCv.writeFields(paramVarArgs);
}
if (this.abKt != null)
{
paramVarArgs.qD(8, this.abKt.computeSize());
this.abKt.writeFields(paramVarArgs);
}
AppMethodBeat.o(50115);
return 0;
}
if (paramInt == 1) {
if (this.BaseRequest == null) {
break label888;
}
}
label888:
for (int i = i.a.a.a.qC(1, this.BaseRequest.computeSize()) + 0;; i = 0)
{
paramInt = i;
if (this.oOI != null) {
paramInt = i + i.a.a.b.b.a.h(2, this.oOI);
}
i = paramInt;
if (this.aaCt != null) {
i = paramInt + i.a.a.a.qC(3, this.aaCt.computeSize());
}
paramInt = i;
if (this.aaCu != null) {
paramInt = i + i.a.a.a.qC(6, this.aaCu.computeSize());
}
i = paramInt;
if (this.aaCv != null) {
i = paramInt + i.a.a.a.qC(7, this.aaCv.computeSize());
}
paramInt = i;
if (this.abKt != null) {
paramInt = i + i.a.a.a.qC(8, this.abKt.computeSize());
}
AppMethodBeat.o(50115);
return paramInt;
if (paramInt == 2)
{
paramVarArgs = new i.a.a.a.a((byte[])paramVarArgs[0], unknownTagHandler);
for (paramInt = erp.getNextFieldNumber(paramVarArgs); paramInt > 0; paramInt = erp.getNextFieldNumber(paramVarArgs)) {
if (!super.populateBuilderWithField(paramVarArgs, this, paramInt)) {
paramVarArgs.kFT();
}
}
AppMethodBeat.o(50115);
return 0;
}
if (paramInt == 3)
{
Object localObject1 = (i.a.a.a.a)paramVarArgs[0];
fjy localfjy = (fjy)paramVarArgs[1];
paramInt = ((Integer)paramVarArgs[2]).intValue();
Object localObject2;
switch (paramInt)
{
case 4:
case 5:
default:
AppMethodBeat.o(50115);
return -1;
case 1:
paramVarArgs = ((i.a.a.a.a)localObject1).aMP(paramInt);
i = paramVarArgs.size();
paramInt = 0;
while (paramInt < i)
{
localObject1 = (byte[])paramVarArgs.get(paramInt);
localObject2 = new kc();
if ((localObject1 != null) && (localObject1.length > 0)) {
((kc)localObject2).parseFrom((byte[])localObject1);
}
localfjy.BaseRequest = ((kc)localObject2);
paramInt += 1;
}
AppMethodBeat.o(50115);
return 0;
case 2:
localfjy.oOI = ((i.a.a.a.a)localObject1).ajGk.readString();
AppMethodBeat.o(50115);
return 0;
case 3:
paramVarArgs = ((i.a.a.a.a)localObject1).aMP(paramInt);
i = paramVarArgs.size();
paramInt = 0;
while (paramInt < i)
{
localObject1 = (byte[])paramVarArgs.get(paramInt);
localObject2 = new glh();
if ((localObject1 != null) && (localObject1.length > 0)) {
((glh)localObject2).parseFrom((byte[])localObject1);
}
localfjy.aaCt = ((glh)localObject2);
paramInt += 1;
}
AppMethodBeat.o(50115);
return 0;
case 6:
paramVarArgs = ((i.a.a.a.a)localObject1).aMP(paramInt);
i = paramVarArgs.size();
paramInt = 0;
while (paramInt < i)
{
localObject1 = (byte[])paramVarArgs.get(paramInt);
localObject2 = new gli();
if ((localObject1 != null) && (localObject1.length > 0)) {
((gli)localObject2).parseFrom((byte[])localObject1);
}
localfjy.aaCu = ((gli)localObject2);
paramInt += 1;
}
AppMethodBeat.o(50115);
return 0;
case 7:
paramVarArgs = ((i.a.a.a.a)localObject1).aMP(paramInt);
i = paramVarArgs.size();
paramInt = 0;
while (paramInt < i)
{
localObject1 = (byte[])paramVarArgs.get(paramInt);
localObject2 = new glj();
if ((localObject1 != null) && (localObject1.length > 0)) {
((glj)localObject2).parseFrom((byte[])localObject1);
}
localfjy.aaCv = ((glj)localObject2);
paramInt += 1;
}
AppMethodBeat.o(50115);
return 0;
}
paramVarArgs = ((i.a.a.a.a)localObject1).aMP(paramInt);
i = paramVarArgs.size();
paramInt = 0;
while (paramInt < i)
{
localObject1 = (byte[])paramVarArgs.get(paramInt);
localObject2 = new gnn();
if ((localObject1 != null) && (localObject1.length > 0)) {
((gnn)localObject2).parseFrom((byte[])localObject1);
}
localfjy.abKt = ((gnn)localObject2);
paramInt += 1;
}
AppMethodBeat.o(50115);
return 0;
}
AppMethodBeat.o(50115);
return -1;
}
}
}
/* Location: L:\local\mybackup\temp\qq_apk\com.tencent.mm\classes8.jar
* Qualified Name: com.tencent.mm.protocal.protobuf.fjy
* JD-Core Version: 0.7.0.1
*/ | [
"98632993+tsuzcx@users.noreply.github.com"
] | 98632993+tsuzcx@users.noreply.github.com |
2b2ae121cf32ad8107b7ad307f02a8ae6ff4455b | 49ce1a640f315fe04b52bd0f3b583e7aa563a788 | /src/p05/textbook/exercise/Exercise09.java | 7e9db9389805cb411538f88f24cbef0524b9ebba | [] | no_license | lim950914/java20210325 | 3decd232b3c2228f4c5e6c7fd1bd955939d0a986 | 47bb0555410f9b178d6d92ec40b7236fca4613e0 | refs/heads/master | 2023-07-10T09:10:28.691318 | 2021-08-06T00:05:46 | 2021-08-06T00:05:46 | 351,269,331 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,557 | java | package p05.textbook.exercise;
import java.util.Scanner;
public class Exercise09 {
public static void main(String[] args) {
boolean run = true;
int studentNum = 0;
int[] scores = null;
Scanner scanner = new Scanner(System.in);
while (run) {
System.out.println("-----------------------------------------------");
System.out.println("1.학생수|2.점수입력|3.점수리스트|4.분석|5.종료");
System.out.println("-----------------------------------------------");
System.out.print("선택>");
int selectNo = scanner.nextInt();
switch (selectNo) {
case 1:
// 학생수
System.out.print("학생수>");
studentNum = scanner.nextInt();
scores = new int[studentNum];
break;
case 2:
// 점수입력
for (int i = 0; i < scores.length; i++) {
System.out.print("scores[" + i + "]>");
scores[i] = scanner.nextInt();
}
break;
case 3:
// 점수리스트
for (int i = 0; i < scores.length; i++) {
System.out.println("scores[" + i + "]: " + scores[i]);
}
break;
case 4:
// 분석
int max = Integer.MIN_VALUE;
double sum = 0;
double avg = 0;
for (int score : scores) {
sum += score;
if (score > max) {
max = score;
}
}
avg = sum / scores.length;
System.out.println("최고 점수: " + max);
System.out.println("평균 점수: " + avg);
break;
case 5:
// 종료
run = false;
break;
}
}
scanner.close();
System.out.println("프로그램 종료");
}
}
| [
"dlackswn2222@naver.com"
] | dlackswn2222@naver.com |
51f216c5a073135cfb90dc0e534d1e3e848f3dca | 0e72b89280e75f9bd21f8fbbf03030cc9677d781 | /src/main/java/com/design/structuralPatterns/proxyPattern/singer/SingerProxyDemo.java | 0fb94f814ee9793fc24bf10167344d56d8244ebf | [] | no_license | Yommmm/DesignPatterns | 27f8dedb2d5ddf7aab2b44304f57054af1473390 | a0353a3f8925aa3847163bea2f3421aafd13628f | refs/heads/master | 2021-04-27T11:41:10.956837 | 2019-03-06T07:26:37 | 2019-03-06T07:26:37 | 122,567,179 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 287 | java | package com.design.structuralPatterns.proxyPattern.singer;
public class SingerProxyDemo {
public static void main(String[] args) {
Sing zhang = new Agent("love song");
zhang.sing();
System.out.println("=================================");
zhang.sing();
}
}
| [
"yangzhiwen@chalco-steering.com"
] | yangzhiwen@chalco-steering.com |
0a825b1842b6281e99e4a80d25f03d3cfa6740ef | ad9c328aeb5ea617a1c056df45ae9acc3e5c1aad | /projects/projects-spring/projects-spring2.5.6/src/main/java/org/springframework/web/servlet/handler/SimpleMappingExceptionResolver.java | 1b42941e50f10d18c52561d1a386286ee220ffd7 | [] | no_license | tangjiquan/collect | 3fa4b3fd5fecc7e0d8d7a6bf89151464bd4e98bb | d059d89ae9899bd43b2f5b7d46b7ba88d5f066d4 | refs/heads/master | 2022-12-22T19:26:37.599708 | 2019-08-05T15:00:32 | 2019-08-05T15:00:48 | 126,582,519 | 1 | 0 | null | 2022-12-16T08:04:19 | 2018-03-24T09:03:08 | Java | UTF-8 | Java | false | false | 17,605 | java | /*
* Copyright 2002-2008 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.web.servlet.handler;
import java.util.Enumeration;
import java.util.Properties;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.core.Ordered;
import org.springframework.web.servlet.HandlerExceptionResolver;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.util.WebUtils;
/**
* {@link org.springframework.web.servlet.HandlerExceptionResolver} implementation
* that allows for mapping exception class names to view names, either for a
* set of given handlers or for all handlers in the DispatcherServlet.
*
* <p>Error views are analogous to error page JSPs, but can be used with any
* kind of exception including any checked one, with fine-granular mappings for
* specific handlers.
*
* @author Juergen Hoeller
* @since 22.11.2003
* @see org.springframework.web.servlet.DispatcherServlet
*/
public class SimpleMappingExceptionResolver implements HandlerExceptionResolver, Ordered {
/**
* The default name of the exception attribute: "exception".
*/
public static final String DEFAULT_EXCEPTION_ATTRIBUTE = "exception";
/** Logger available to subclasses */
protected final Log logger = LogFactory.getLog(getClass());
private int order = Integer.MAX_VALUE; // default: same as non-Ordered
private Set mappedHandlers;
private Class[] mappedHandlerClasses;
private Log warnLogger;
private Properties exceptionMappings;
private String defaultErrorView;
private Integer defaultStatusCode;
private String exceptionAttribute = DEFAULT_EXCEPTION_ATTRIBUTE;
public void setOrder(int order) {
this.order = order;
}
public int getOrder() {
return this.order;
}
/**
* Specify the set of handlers that this exception resolver should apply to.
* The exception mappings and the default error view will only apply
* to the specified handlers.
* <p>If no handlers and handler classes are set, the exception mappings
* and the default error view will apply to all handlers. This means that
* a specified default error view will be used as fallback for all exceptions;
* any further HandlerExceptionResolvers in the chain will be ignored in
* this case.
*/
public void setMappedHandlers(Set mappedHandlers) {
this.mappedHandlers = mappedHandlers;
}
/**
* Specify the set of classes that this exception resolver should apply to.
* The exception mappings and the default error view will only apply
* to handlers of the specified type; the specified types may be interfaces
* and superclasses of handlers as well.
* <p>If no handlers and handler classes are set, the exception mappings
* and the default error view will apply to all handlers. This means that
* a specified default error view will be used as fallback for all exceptions;
* any further HandlerExceptionResolvers in the chain will be ignored in
* this case.
*/
public void setMappedHandlerClasses(Class[] mappedHandlerClasses) {
this.mappedHandlerClasses = mappedHandlerClasses;
}
/**
* Set the log category for warn logging. The name will be passed to the
* underlying logger implementation through Commons Logging, getting
* interpreted as log category according to the logger's configuration.
* <p>Default is no warn logging. Specify this setting to activate
* warn logging into a specific category. Alternatively, override
* the {@link #logException} method for custom logging.
* @see org.apache.commons.logging.LogFactory#getLog(String)
* @see org.apache.log4j.Logger#getLogger(String)
* @see java.util.logging.Logger#getLogger(String)
*/
public void setWarnLogCategory(String loggerName) {
this.warnLogger = LogFactory.getLog(loggerName);
}
/**
* Set the mappings between exception class names and error view names.
* The exception class name can be a substring, with no wildcard support
* at present. A value of "ServletException" would match
* <code>javax.servlet.ServletException</code> and subclasses, for example.
* <p><b>NB:</b> Consider carefully how specific the pattern is, and whether
* to include package information (which isn't mandatory). For example,
* "Exception" will match nearly anything, and will probably hide other rules.
* "java.lang.Exception" would be correct if "Exception" was meant to define
* a rule for all checked exceptions. With more unusual exception names such
* as "BaseBusinessException" there's no need to use a FQN.
* <p>Follows the same matching algorithm as RuleBasedTransactionAttribute
* and RollbackRuleAttribute.
* @param mappings exception patterns (can also be fully qualified class names)
* as keys, and error view names as values
* @see org.springframework.transaction.interceptor.RuleBasedTransactionAttribute
* @see org.springframework.transaction.interceptor.RollbackRuleAttribute
*/
public void setExceptionMappings(Properties mappings) {
this.exceptionMappings = mappings;
}
/**
* Set the name of the default error view.
* This view will be returned if no specific mapping was found.
* <p>Default is none.
*/
public void setDefaultErrorView(String defaultErrorView) {
this.defaultErrorView = defaultErrorView;
}
/**
* Set the default HTTP status code that this exception resolver will apply
* if it resolves an error view.
* <p>Note that this error code will only get applied in case of a top-level
* request. It will not be set for an include request, since the HTTP status
* cannot be modified from within an include.
* <p>If not specified, no status code will be applied, either leaving this to
* the controller or view, or keeping the servlet engine's default of 200 (OK).
* @param defaultStatusCode HTTP status code value, for example
* 500 (SC_INTERNAL_SERVER_ERROR) or 404 (SC_NOT_FOUND)
* @see javax.servlet.http.HttpServletResponse#SC_INTERNAL_SERVER_ERROR
* @see javax.servlet.http.HttpServletResponse#SC_NOT_FOUND
*/
public void setDefaultStatusCode(int defaultStatusCode) {
this.defaultStatusCode = new Integer(defaultStatusCode);
}
/**
* Set the name of the model attribute as which the exception should
* be exposed. Default is "exception".
* <p>This can be either set to a different attribute name or to
* <code>null</code> for not exposing an exception attribute at all.
* @see #DEFAULT_EXCEPTION_ATTRIBUTE
*/
public void setExceptionAttribute(String exceptionAttribute) {
this.exceptionAttribute = exceptionAttribute;
}
/**
* Checks whether this resolver is supposed to apply (i.e. the handler
* matches in case of "mappedHandlers" having been specified), then
* delegates to the {@link #doResolveException} template method.
*/
public ModelAndView resolveException(
HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {
if (shouldApplyTo(request, handler)) {
return doResolveException(request, response, handler, ex);
}
else {
return null;
}
}
/**
* Check whether this resolver is supposed to apply to the given handler.
* <p>The default implementation checks against the specified mapped handlers
* and handler classes, if any.
* @param request current HTTP request
* @param handler the executed handler, or <code>null</code> if none chosen at the
* time of the exception (for example, if multipart resolution failed)
* @return whether this resolved should proceed with resolving the exception
* for the given request and handler
* @see #setMappedHandlers
* @see #setMappedHandlerClasses
*/
protected boolean shouldApplyTo(HttpServletRequest request, Object handler) {
if (handler != null) {
if (this.mappedHandlers != null && this.mappedHandlers.contains(handler)) {
return true;
}
if (this.mappedHandlerClasses != null) {
for (int i = 0; i < this.mappedHandlerClasses.length; i++) {
if (this.mappedHandlerClasses[i].isInstance(handler)) {
return true;
}
}
}
}
// Else only apply if there are no explicit handler mappings.
return (this.mappedHandlers == null && this.mappedHandlerClasses == null);
}
/**
* Actually resolve the given exception that got thrown during on handler execution,
* returning a ModelAndView that represents a specific error page if appropriate.
* <p>May be overridden in subclasses, in order to apply specific exception checks.
* Note that this template method will be invoked <i>after</i> checking whether
* this resolved applies ("mappedHandlers" etc), so an implementation may simply
* proceed with its actual exception handling.
* @param request current HTTP request
* @param response current HTTP response
* @param handler the executed handler, or <code>null</code> if none chosen at the
* time of the exception (for example, if multipart resolution failed)
* @param ex the exception that got thrown during handler execution
* @return a corresponding ModelAndView to forward to, or <code>null</code> for default processing
*/
protected ModelAndView doResolveException(
HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {
// Log exception, both at debug log level and at warn level, if desired.
if (logger.isDebugEnabled()) {
logger.debug("Resolving exception from handler [" + handler + "]: " + ex);
}
logException(ex, request);
// Expose ModelAndView for chosen error view.
String viewName = determineViewName(ex, request);
if (viewName != null) {
// Apply HTTP status code for error views, if specified.
// Only apply it if we're processing a top-level request.
Integer statusCode = determineStatusCode(request, viewName);
if (statusCode != null) {
applyStatusCodeIfPossible(request, response, statusCode.intValue());
}
return getModelAndView(viewName, ex, request);
}
else {
return null;
}
}
/**
* Log the given exception at warn level, provided that warn logging has been
* activated through the {@link #setWarnLogCategory "warnLogCategory"} property.
* <p>Calls {@link #buildLogMessage} in order to determine the concrete message
* to log. Always passes the full exception to the logger.
* @param ex the exception that got thrown during handler execution
* @param request current HTTP request (useful for obtaining metadata)
* @see #setWarnLogCategory
* @see #buildLogMessage
* @see org.apache.commons.logging.Log#warn(Object, Throwable)
*/
protected void logException(Exception ex, HttpServletRequest request) {
if (this.warnLogger != null && this.warnLogger.isWarnEnabled()) {
this.warnLogger.warn(buildLogMessage(ex, request), ex);
}
}
/**
* Build a log message for the given exception, occured during processing
* the given request.
* @param ex the exception that got thrown during handler execution
* @param request current HTTP request (useful for obtaining metadata)
* @return the log message to use
*/
protected String buildLogMessage(Exception ex, HttpServletRequest request) {
return "Handler execution resulted in exception";
}
/**
* Determine the view name for the given exception, searching the
* {@link #setExceptionMappings "exceptionMappings"}, using the
* {@link #setDefaultErrorView "defaultErrorView"} as fallback.
* @param ex the exception that got thrown during handler execution
* @param request current HTTP request (useful for obtaining metadata)
* @return the resolved view name, or <code>null</code> if none found
*/
protected String determineViewName(Exception ex, HttpServletRequest request) {
String viewName = null;
// Check for specific exception mappings.
if (this.exceptionMappings != null) {
viewName = findMatchingViewName(this.exceptionMappings, ex);
}
// Return default error view else, if defined.
if (viewName == null && this.defaultErrorView != null) {
if (logger.isDebugEnabled()) {
logger.debug("Resolving to default view '" + this.defaultErrorView +
"' for exception of type [" + ex.getClass().getName() + "]");
}
viewName = this.defaultErrorView;
}
return viewName;
}
/**
* Find a matching view name in the given exception mappings.
* @param exceptionMappings mappings between exception class names and error view names
* @param ex the exception that got thrown during handler execution
* @return the view name, or <code>null</code> if none found
* @see #setExceptionMappings
*/
protected String findMatchingViewName(Properties exceptionMappings, Exception ex) {
String viewName = null;
String dominantMapping = null;
int deepest = Integer.MAX_VALUE;
for (Enumeration names = exceptionMappings.propertyNames(); names.hasMoreElements();) {
String exceptionMapping = (String) names.nextElement();
int depth = getDepth(exceptionMapping, ex);
if (depth >= 0 && depth < deepest) {
deepest = depth;
dominantMapping = exceptionMapping;
viewName = exceptionMappings.getProperty(exceptionMapping);
}
}
if (viewName != null && logger.isDebugEnabled()) {
logger.debug("Resolving to view '" + viewName + "' for exception of type [" + ex.getClass().getName() +
"], based on exception mapping [" + dominantMapping + "]");
}
return viewName;
}
/**
* Return the depth to the superclass matching.
* <p>0 means ex matches exactly. Returns -1 if there's no match.
* Otherwise, returns depth. Lowest depth wins.
* <p>Follows the same algorithm as
* {@link org.springframework.transaction.interceptor.RollbackRuleAttribute}.
*/
protected int getDepth(String exceptionMapping, Exception ex) {
return getDepth(exceptionMapping, ex.getClass(), 0);
}
private int getDepth(String exceptionMapping, Class exceptionClass, int depth) {
if (exceptionClass.getName().indexOf(exceptionMapping) != -1) {
// Found it!
return depth;
}
// If we've gone as far as we can go and haven't found it...
if (exceptionClass.equals(Throwable.class)) {
return -1;
}
return getDepth(exceptionMapping, exceptionClass.getSuperclass(), depth + 1);
}
/**
* Determine the HTTP status code to apply for the given error view.
* <p>The default implementation always returns the specified
* {@link #setDefaultStatusCode "defaultStatusCode"}, as a common
* status code for all error views. Override this in a custom subclass
* to determine a specific status code for the given view.
* @param request current HTTP request
* @param viewName the name of the error view
* @return the HTTP status code to use, or <code>null</code> for the
* servlet container's default (200 in case of a standard error view)
* @see #setDefaultStatusCode
* @see #applyStatusCodeIfPossible
*/
protected Integer determineStatusCode(HttpServletRequest request, String viewName) {
return this.defaultStatusCode;
}
/**
* Apply the specified HTTP status code to the given response, if possible
* (that is, if not executing within an include request).
* @param request current HTTP request
* @param response current HTTP response
* @param statusCode the status code to apply
* @see #determineStatusCode
* @see #setDefaultStatusCode
* @see javax.servlet.http.HttpServletResponse#setStatus
*/
protected void applyStatusCodeIfPossible(HttpServletRequest request, HttpServletResponse response, int statusCode) {
if (!WebUtils.isIncludeRequest(request)) {
if (logger.isDebugEnabled()) {
logger.debug("Applying HTTP status code " + statusCode);
}
response.setStatus(statusCode);
request.setAttribute(WebUtils.ERROR_STATUS_CODE_ATTRIBUTE, new Integer(statusCode));
}
}
/**
* Return a ModelAndView for the given request, view name and exception.
* <p>The default implementation delegates to {@link #getModelAndView(String, Exception)}.
* @param viewName the name of the error view
* @param ex the exception that got thrown during handler execution
* @param request current HTTP request (useful for obtaining metadata)
* @return the ModelAndView instance
*/
protected ModelAndView getModelAndView(String viewName, Exception ex, HttpServletRequest request) {
return getModelAndView(viewName, ex);
}
/**
* Return a ModelAndView for the given view name and exception.
* <p>The default implementation adds the specified exception attribute.
* Can be overridden in subclasses.
* @param viewName the name of the error view
* @param ex the exception that got thrown during handler execution
* @return the ModelAndView instance
* @see #setExceptionAttribute
*/
protected ModelAndView getModelAndView(String viewName, Exception ex) {
ModelAndView mv = new ModelAndView(viewName);
if (this.exceptionAttribute != null) {
if (logger.isDebugEnabled()) {
logger.debug("Exposing Exception as model attribute '" + this.exceptionAttribute + "'");
}
mv.addObject(this.exceptionAttribute, ex);
}
return mv;
}
}
| [
"2495527426@qq.com"
] | 2495527426@qq.com |
225434fd1704cb58aa2d09aef01fb02fb463147e | fea95331f43acfd65d3a02e303cb022ba2e8c41e | /App/app/src/main/java/com/example/prateek/bottom_navigation/stories/StoriesViewHolder.java | 02ea816e0ba8b8f6121c1924bfddd43ab1b60933 | [] | no_license | pratzmewara/Hackgrid_Vision | 44e91570f79bfa0d29ac8feac4fcdf9835873c47 | 8404bf1225c047b1b44a5955fa4a032c09937e47 | refs/heads/master | 2020-04-28T01:52:23.092549 | 2019-03-10T20:24:50 | 2019-03-10T20:24:50 | 174,876,178 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,940 | java | package com.example.prateek.bottom_navigation.stories;
import android.content.Intent;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.example.kartikbhardwaj.bottom_navigation.R;
import com.facebook.drawee.view.SimpleDraweeView;
import androidx.recyclerview.widget.RecyclerView;
public class StoriesViewHolder extends RecyclerView.ViewHolder {
private TextView nameTv;
private LinearLayout storiesLL;
private SimpleDraweeView image;
private String name, description, imageURL;
Intent intent= new Intent(itemView.getContext(),StoryPageActivity.class);
public StoriesViewHolder(View itemView)
{
super(itemView);
storiesLL=itemView.findViewById(R.id.storiesll);
nameTv=itemView.findViewById(R.id.stories_name);
image=itemView.findViewById(R.id.stories_image_view);
}
public void populate(StoriesModel stories)
{
name=stories.getStoryName();
description=stories.getStoryDescription();
imageURL=stories.getStoryImageURL();
nameTv.setText(name);
image.setImageURI(imageURL);
intent.putExtra("storyname",name);
intent.putExtra("storyurl",imageURL);
intent.putExtra("storydesc",description);
image.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
itemView.getContext().startActivity(intent);
}
});
nameTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
itemView.getContext().startActivity(intent);
}
});
storiesLL.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
itemView.getContext().startActivity(intent);
}
});
}
}
| [
"prateek.mewara@vitstudent.ac.in"
] | prateek.mewara@vitstudent.ac.in |
3801231afd80d4b9c3b5e2eaf3aa0e948edcdd87 | 9fa1a589355dfe9160c7547b481d3b527d99a2d1 | /src/main/java/com/mkyong/rest/client/ApacheHttpClientPost.java | 03b090537282551f6354d243554ee088208403f2 | [] | no_license | ghoshatlht/teamcitytestProjectforCI-CD | a557fce068c7770a8c115a864c5d487efd40b044 | ffb72d370a6f92cf6b1d9d211976eae33f66acfb | refs/heads/master | 2021-07-03T11:50:54.574521 | 2017-09-25T13:21:56 | 2017-09-25T13:21:56 | 104,752,608 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,562 | java | package com.mkyong.rest.client;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient;
public class ApacheHttpClientPost {
// http://localhost:8080/RESTfulExample/json/product/post
public static void main(String[] args) {
try {
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpPost postRequest = new HttpPost(
"http://localhost:8080/RESTfulExample/json/product/post");
StringEntity input = new StringEntity(
"{\"qty\":100,\"name\":\"iPad 4\"}");
input.setContentType("application/json");
postRequest.setEntity(input);
HttpResponse response = httpClient.execute(postRequest);
if (response.getStatusLine().getStatusCode() != 201) {
throw new RuntimeException("Failed : HTTP error code : "
+ response.getStatusLine().getStatusCode());
}
BufferedReader br = new BufferedReader(new InputStreamReader(
(response.getEntity().getContent())));
String output;
System.out.println("Output from Server .... \n");
while ((output = br.readLine()) != null) {
System.out.println(output);
}
httpClient.getConnectionManager().shutdown();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
} | [
"SG05477@denb0271.de.corp.danet.com"
] | SG05477@denb0271.de.corp.danet.com |
6d9a81c2287f6b5a937cc1018107b697f4c14649 | 39c5b83a0cf38e0ca29468f8a6df570f3ae91058 | /card-service/src/main/java/com/card/service/impl/CreditCardCostServiceImpl.java | 0d3061f2a49b65b2381ef11fe117b0653dcef27a | [] | no_license | huihuxidetong/kami | 2284d4d67e2c4929aa67926747d7e0cbe4731b1e | 206140ad05aa8b4348f2cdf07286bad0d2f98b0f | refs/heads/master | 2022-12-24T02:17:59.582666 | 2019-08-02T06:15:38 | 2019-08-02T06:15:38 | 196,506,394 | 0 | 1 | null | 2022-12-16T09:12:21 | 2019-07-12T04:04:02 | JavaScript | UTF-8 | Java | false | false | 865 | java | package com.card.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.card.inteface.entity.CreditCardCost;
import com.card.inteface.dao.CreditCardCostDao;
import com.card.inteface.service.CreditCardCostService;
import java.util.List;
/**
* @notes:信用卡费用Service实现类
*
* @author zzh
*
* 2018-09-26 13:05:40 Email:azhangzhihengi@163.com
*/
@Service
public class CreditCardCostServiceImpl implements CreditCardCostService {
@Autowired
private CreditCardCostDao creditCardCostDao;
/**
* @notes 通过信用卡id查询费用信息
* @param creditCardId
* @return
*/
public List<CreditCardCost> findCreditCardCostByCreditCardId(Integer creditCardId) throws Exception {
return creditCardCostDao.findCreditCardCostByCreditCardId(creditCardId);
}
}
| [
"382949860@qq.com"
] | 382949860@qq.com |
d82dbc5d024d0b1f33f5d1456d921e020410f706 | f371e511b689c813f86c721f957a285d35a0b14f | /Google/BFS & DFS/52. N-Queens II.java | c8957599467fc8fd2a139744567a01c3883cf13f | [] | no_license | Waynexia888/leetcode-java | 3c10f3b16e44325bbb05383cda8bc27e2a1d9fbd | 366666fa5196918bfe3a703e82dc9fa29076b802 | refs/heads/master | 2022-03-24T20:02:59.563267 | 2021-09-21T19:29:51 | 2021-09-21T19:29:51 | 252,570,861 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,156 | java | Leetcode 52. N-Queens II
class Solution {
private int count = 0;
public int totalNQueens(int n) {
if (n == 0) {
return 0;
}
List<Integer> temp = new ArrayList<>();
dfs(n, temp);
return count;
}
private void dfs(int n, List<Integer> temp) {
if (temp.size() == n) {
count++;
return;
}
// temp.get(i)表示第i行,第temp.get(i)列
for (int i = 0; i < n; i++) {
if (!isValid(temp, i)) {
continue;
}
temp.add(i);
dfs(n, temp);
temp.remove(temp.size() - 1);
}
}
private boolean isValid(List<Integer> temp, int col) {
int row = temp.size();
for (int i = 0; i < temp.size(); i++) {
if (temp.get(i) == col) {
return false;
}
if (row + col == i + temp.get(i)) {
return false;
}
if (row - col == i - temp.get(i)) {
return false;
}
}
return true;
}
} | [
"qiwuwaynexia@gmail.com"
] | qiwuwaynexia@gmail.com |
ca52d3e6154b35356e0bf411d06fb22d55d0b52b | 58dc7837d5afacc86c4f23cb0740ed3078e7658c | /Contacts.java | ebd05f9a53ca4e66c03b916de24e6e1fea8547fe | [] | no_license | JeongHyeLee/SoftwareEngineering | ba11ee8d0f1cbc9ec81c72b9715971906bad7077 | 9eb4d0fdafb56fee95e69ae0be082b83a9d4ed5a | refs/heads/master | 2020-04-05T02:13:42.691031 | 2019-03-12T07:27:35 | 2019-03-12T07:27:35 | 156,468,787 | 4 | 3 | null | 2018-11-22T10:19:01 | 2018-11-07T00:45:59 | null | UHC | Java | false | false | 2,752 | java | import java.util.ArrayList;
import java.util.Scanner;
public class Contacts{
String name;
String phonenum;
String email;
public Contacts(String name, String phonenum, String email) {
this.name = name;
this.phonenum = phonenum;
this.email = email;
}
public void AddressBook() {
Scanner scan = new Scanner(System.in);
int pick;
Boolean flag;
Contact contact = new Contact();
while(true) {
System.out.print("1. create 2. view 3. update 4. delete 5. exit\n원하는 작업을 선택하세요:");
pick = scan.nextInt();
if(pick == 1) {
System.out.print("name: ");
String name = scan.next();
System.out.print("phone number: ");
String phonenum = scan.next();
System.out.print("email: ");
String email = scan.next();
contact.CreateContact(name, phonenum, email);
System.out.print("추가 완료!\n\n");
}
else if(pick == 2) {
contact.ViewContact();
System.out.print('\n');
}
else if(pick == 3) {
System.out.print("contact of name to update: ");
String name = scan.next();
flag = contact.UpdateContact(name);
if(flag) {
System.out.print("name: ");
String newname = scan.next();
System.out.print("phone number: ");
String phonenum = scan.next();
System.out.print("email: ");
String email = scan.next();
contact.CreateContact(newname, phonenum, email);
System.out.print("수정 완료!\n\n");
}
}
else if(pick == 4) {
System.out.print("contact of name to delete: ");
String name = scan.next();
contact.DeleteContact(name);
System.out.print("삭제 완료!\n\n");
}
else
break;
}
}
}
class Contact {
ArrayList<Contacts> contacts;
public Contact() {
contacts = new ArrayList<Contacts>();
}
public Boolean CreateContact(String name, String phonenum, String email) {
Contacts c = new Contacts(name, phonenum, email);
if(contacts.add(c))
return(true);
else
return(false);
}
public Boolean UpdateContact(String name) {
for(int i=0;i<contacts.size(); i++) {
Contacts c = (Contacts)contacts.get(i);
if(name.equals(c.name)) {
contacts.remove(c);
return(true);
}
}
return (false);
}
public Boolean DeleteContact(String name) {
for(int i=0;i<contacts.size(); i++) {
Contacts c = (Contacts)contacts.get(i);
if(name.equals(c.name)) {
contacts.remove(c);
return (true);
}
}
return(false);
}
public void ViewContact() {
for(int i=0;i<contacts.size(); i++) {
Contacts c = (Contacts)contacts.get(i);
System.out.print(c.name+"\t"+c.phonenum+"\t"+c.email+"\n");
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
e1451961df1dcbe31ed9a33f32aa1126e5de2915 | 1e58b966196de01bff6c597d47117fd100504f89 | /core/src/com/badlogic/bus/DestBusStop.java | 6c3a21915659f297e8b1504480c6a48dc911cf44 | [] | no_license | Jonwalk30/Bus | db1bbce1ca13e087a0edaf91dd245975f0c74378 | a6f5ae783abdb339a4d025f1667a55c6cca882f7 | refs/heads/master | 2020-04-08T03:34:43.752171 | 2019-01-02T15:44:41 | 2019-01-02T15:44:41 | 158,981,536 | 0 | 0 | null | 2018-11-27T18:03:38 | 2018-11-24T23:18:11 | Java | UTF-8 | Java | false | false | 269 | java | package com.badlogic.bus;
import com.badlogic.gdx.graphics.Texture;
public class DestBusStop extends BusStop {
public DestBusStop(String name, double popularity, double roadPosition, Texture image) {
super(name, popularity, roadPosition, image);
}
}
| [
""
] | |
eec47defe9651eb4701faad4da033597e7e052fc | b4cf8b91f7bde2b170bc10c9290ec752e8ecec80 | /chmlibrary/src/main/java/com/chm006/library/widget/SwipeProgressBar.java | 7112e3935822b33eee54bced222885973f2321db | [] | no_license | chm006/SunflowerBible | deeed321878fe50e0c24e0f4c10f5a7d67dfab99 | 0a16743dc96812ca14c7bdeceb2b439e7571ef3d | refs/heads/master | 2020-12-24T10:10:24.374656 | 2017-11-07T10:14:26 | 2017-11-07T10:14:26 | 73,247,810 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,160 | java | package com.chm006.library.widget;
/*
* Copyright (C) 2013 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.RectF;
import android.support.v4.view.ViewCompat;
import android.view.View;
import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;
/**
* Custom progress bar that shows a cycle of colors as widening circles that
* overdraw each other. When finished, the bar is cleared from the inside out as
* the main cycle continues. Before running, this can also indicate how close
* the user is to triggering something (e.g. how far they need to pull down to
* trigger a refresh).
* <p>
* SwipeRefreshLayout 上拉加载、下拉刷新ProgressBar
* Created by chenmin on 2016/9/27.
*/
final class SwipeProgressBar {
// Default progress animation colors are grays.
private final static int COLOR1 = 0xB3000000;
private final static int COLOR2 = 0x80000000;
private final static int COLOR3 = 0x4d000000;
private final static int COLOR4 = 0x1a000000;
// The duration of the animation cycle.
private static final int ANIMATION_DURATION_MS = 2000;
// The duration of the animation to clear the bar.
private static final int FINISH_ANIMATION_DURATION_MS = 1000;
// Interpolator for varying the speed of the animation.
private static final Interpolator INTERPOLATOR = BakedBezierInterpolator.getInstance();
private final Paint mPaint = new Paint();
private final RectF mClipRect = new RectF();
private float mTriggerPercentage;
private long mStartTime;
private long mFinishTime;
private boolean mRunning;
// Colors used when rendering the animation,
private int mColor1;
private int mColor2;
private int mColor3;
private int mColor4;
private View mParent;
private Rect mBounds = new Rect();
public SwipeProgressBar(View parent) {
mParent = parent;
mColor1 = COLOR1;
mColor2 = COLOR2;
mColor3 = COLOR3;
mColor4 = COLOR4;
}
/**
* Set the four colors used in the progress animation. The first color will
* also be the color of the bar that grows in response to a user swipe
* gesture.
*
* @param color1 Integer representation of a color.
* @param color2 Integer representation of a color.
* @param color3 Integer representation of a color.
* @param color4 Integer representation of a color.
*/
void setColorScheme(int color1, int color2, int color3, int color4) {
mColor1 = color1;
mColor2 = color2;
mColor3 = color3;
mColor4 = color4;
}
/**
* Update the progress the user has made toward triggering the swipe
* gesture. and use this value to update the percentage of the trigger that
* is shown.
*/
void setTriggerPercentage(float triggerPercentage) {
mTriggerPercentage = triggerPercentage;
mStartTime = 0;
ViewCompat.postInvalidateOnAnimation(mParent);
}
/**
* Start showing the progress animation.
*/
void start() {
if (!mRunning) {
mTriggerPercentage = 0;
mStartTime = AnimationUtils.currentAnimationTimeMillis();
mRunning = true;
mParent.postInvalidate();
}
}
/**
* Stop showing the progress animation.
*/
void stop() {
if (mRunning) {
mTriggerPercentage = 0;
mFinishTime = AnimationUtils.currentAnimationTimeMillis();
mRunning = false;
mParent.postInvalidate();
}
}
/**
* @return Return whether the progress animation is currently running.
*/
boolean isRunning() {
return mRunning || mFinishTime > 0;
}
void draw(Canvas canvas) {
final int width = mBounds.width();
final int height = mBounds.height();
final int cx = width / 2;
// final int cy = height / 2;
final int cy = mBounds.bottom - height / 2;
boolean drawTriggerWhileFinishing = false;
int restoreCount = canvas.save();
canvas.clipRect(mBounds);
if (mRunning || (mFinishTime > 0)) {
long now = AnimationUtils.currentAnimationTimeMillis();
long elapsed = (now - mStartTime) % ANIMATION_DURATION_MS;
long iterations = (now - mStartTime) / ANIMATION_DURATION_MS;
float rawProgress = (elapsed / (ANIMATION_DURATION_MS / 100f));
// If we're not running anymore, that means we're running through
// the finish animation.
if (!mRunning) {
// If the finish animation is done, don't draw anything, and
// don't repost.
if ((now - mFinishTime) >= FINISH_ANIMATION_DURATION_MS) {
mFinishTime = 0;
return;
}
// Otherwise, use a 0 opacity alpha layer to clear the animation
// from the inside out. This layer will prevent the circles from
// drawing within its bounds.
long finishElapsed = (now - mFinishTime) % FINISH_ANIMATION_DURATION_MS;
float finishProgress = (finishElapsed / (FINISH_ANIMATION_DURATION_MS / 100f));
float pct = (finishProgress / 100f);
// Radius of the circle is half of the screen.
float clearRadius = width / 2 * INTERPOLATOR.getInterpolation(pct);
mClipRect.set(cx - clearRadius, 0, cx + clearRadius, height);
canvas.saveLayerAlpha(mClipRect, 0, 0);
// Only draw the trigger if there is a space in the center of
// this refreshing view that needs to be filled in by the
// trigger. If the progress view is just still animating, let it
// continue animating.
drawTriggerWhileFinishing = true;
}
// First fill in with the last color that would have finished drawing.
if (iterations == 0) {
canvas.drawColor(mColor1);
} else {
if (rawProgress >= 0 && rawProgress < 25) {
canvas.drawColor(mColor4);
} else if (rawProgress >= 25 && rawProgress < 50) {
canvas.drawColor(mColor1);
} else if (rawProgress >= 50 && rawProgress < 75) {
canvas.drawColor(mColor2);
} else {
canvas.drawColor(mColor3);
}
}
// Then draw up to 4 overlapping concentric circles of varying radii, based on how far
// along we are in the cycle.
// progress 0-50 draw mColor2
// progress 25-75 draw mColor3
// progress 50-100 draw mColor4
// progress 75 (wrap to 25) draw mColor1
if ((rawProgress >= 0 && rawProgress <= 25)) {
float pct = (((rawProgress + 25) * 2) / 100f);
drawCircle(canvas, cx, cy, mColor1, pct);
}
if (rawProgress >= 0 && rawProgress <= 50) {
float pct = ((rawProgress * 2) / 100f);
drawCircle(canvas, cx, cy, mColor2, pct);
}
if (rawProgress >= 25 && rawProgress <= 75) {
float pct = (((rawProgress - 25) * 2) / 100f);
drawCircle(canvas, cx, cy, mColor3, pct);
}
if (rawProgress >= 50 && rawProgress <= 100) {
float pct = (((rawProgress - 50) * 2) / 100f);
drawCircle(canvas, cx, cy, mColor4, pct);
}
if ((rawProgress >= 75 && rawProgress <= 100)) {
float pct = (((rawProgress - 75) * 2) / 100f);
drawCircle(canvas, cx, cy, mColor1, pct);
}
if (mTriggerPercentage > 0 && drawTriggerWhileFinishing) {
// There is some portion of trigger to draw. Restore the canvas,
// then draw the trigger. Otherwise, the trigger does not appear
// until after the bar has finished animating and appears to
// just jump in at a larger width than expected.
canvas.restoreToCount(restoreCount);
restoreCount = canvas.save();
canvas.clipRect(mBounds);
drawTrigger(canvas, cx, cy);
}
// Keep running until we finish out the last cycle.
ViewCompat.postInvalidateOnAnimation(mParent);
} else {
// Otherwise if we're in the middle of a trigger, draw that.
if (mTriggerPercentage > 0 && mTriggerPercentage <= 1.0) {
drawTrigger(canvas, cx, cy);
}
}
canvas.restoreToCount(restoreCount);
}
private void drawTrigger(Canvas canvas, int cx, int cy) {
mPaint.setColor(mColor1);
canvas.drawCircle(cx, cy, cx * mTriggerPercentage, mPaint);
}
/**
* Draws a circle centered in the view.
*
* @param canvas the canvas to draw on
* @param cx the center x coordinate
* @param cy the center y coordinate
* @param color the color to draw
* @param pct the percentage of the view that the circle should cover
*/
private void drawCircle(Canvas canvas, float cx, float cy, int color, float pct) {
mPaint.setColor(color);
canvas.save();
canvas.translate(cx, cy);
float radiusScale = INTERPOLATOR.getInterpolation(pct);
canvas.scale(radiusScale, radiusScale);
canvas.drawCircle(0, 0, cx, mPaint);
canvas.restore();
}
/**
* Set the drawing bounds of this SwipeProgressBar.
*/
void setBounds(int left, int top, int right, int bottom) {
mBounds.left = left;
mBounds.top = top;
mBounds.right = right;
mBounds.bottom = bottom;
}
static final class BakedBezierInterpolator implements Interpolator {
private static final BakedBezierInterpolator INSTANCE = new BakedBezierInterpolator();
public final static BakedBezierInterpolator getInstance() {
return INSTANCE;
}
/**
* Use getInstance instead of instantiating.
*/
private BakedBezierInterpolator() {
super();
}
/**
* Lookup table values.
* Generated using a Bezier curve from (0,0) to (1,1) with control points:
* P0 (0,0)
* P1 (0.4, 0)
* P2 (0.2, 1.0)
* P3 (1.0, 1.0)
* <p>
* Values sampled with x at regular intervals between 0 and 1.
*/
private static final float[] VALUES = new float[]{
0.0f, 0.0002f, 0.0009f, 0.0019f, 0.0036f, 0.0059f, 0.0086f, 0.0119f, 0.0157f, 0.0209f,
0.0257f, 0.0321f, 0.0392f, 0.0469f, 0.0566f, 0.0656f, 0.0768f, 0.0887f, 0.1033f, 0.1186f,
0.1349f, 0.1519f, 0.1696f, 0.1928f, 0.2121f, 0.237f, 0.2627f, 0.2892f, 0.3109f, 0.3386f,
0.3667f, 0.3952f, 0.4241f, 0.4474f, 0.4766f, 0.5f, 0.5234f, 0.5468f, 0.5701f, 0.5933f,
0.6134f, 0.6333f, 0.6531f, 0.6698f, 0.6891f, 0.7054f, 0.7214f, 0.7346f, 0.7502f, 0.763f,
0.7756f, 0.7879f, 0.8f, 0.8107f, 0.8212f, 0.8326f, 0.8415f, 0.8503f, 0.8588f, 0.8672f,
0.8754f, 0.8833f, 0.8911f, 0.8977f, 0.9041f, 0.9113f, 0.9165f, 0.9232f, 0.9281f, 0.9328f,
0.9382f, 0.9434f, 0.9476f, 0.9518f, 0.9557f, 0.9596f, 0.9632f, 0.9662f, 0.9695f, 0.9722f,
0.9753f, 0.9777f, 0.9805f, 0.9826f, 0.9847f, 0.9866f, 0.9884f, 0.9901f, 0.9917f, 0.9931f,
0.9944f, 0.9955f, 0.9964f, 0.9973f, 0.9981f, 0.9986f, 0.9992f, 0.9995f, 0.9998f, 1.0f, 1.0f
};
private static final float STEP_SIZE = 1.0f / (VALUES.length - 1);
@Override
public float getInterpolation(float input) {
if (input >= 1.0f) {
return 1.0f;
}
if (input <= 0f) {
return 0f;
}
int position = Math.min(
(int) (input * (VALUES.length - 1)),
VALUES.length - 2);
float quantized = position * STEP_SIZE;
float difference = input - quantized;
float weight = difference / STEP_SIZE;
return VALUES[position] + weight * (VALUES[position + 1] - VALUES[position]);
}
}
} | [
"472677037@qq.com"
] | 472677037@qq.com |
8180846e54edce3e12ea613057cd3ffda1711590 | 6baa09045c69b0231c35c22b06cdf69a8ce227d6 | /modules/dfp_appengine/src/main/java/com/google/api/ads/dfp/jaxws/v201602/UserServiceInterfacegetUsersByStatementResponse.java | 8057b7786bb8d22c6e1f9f9b2f6990ac97f4a2e0 | [
"Apache-2.0"
] | permissive | remotejob/googleads-java-lib | f603b47117522104f7df2a72d2c96ae8c1ea011d | a330df0799de8d8de0dcdddf4c317d6b0cd2fe10 | refs/heads/master | 2020-12-11T01:36:29.506854 | 2016-07-28T22:13:24 | 2016-07-28T22:13:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,573 | java |
package com.google.api.ads.dfp.jaxws.v201602;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for getUsersByStatementResponse element declaration.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <element name="getUsersByStatementResponse">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="rval" type="{https://www.google.com/apis/ads/publisher/v201602}UserPage" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"rval"
})
@XmlRootElement(name = "getUsersByStatementResponse")
public class UserServiceInterfacegetUsersByStatementResponse {
protected UserPage rval;
/**
* Gets the value of the rval property.
*
* @return
* possible object is
* {@link UserPage }
*
*/
public UserPage getRval() {
return rval;
}
/**
* Sets the value of the rval property.
*
* @param value
* allowed object is
* {@link UserPage }
*
*/
public void setRval(UserPage value) {
this.rval = value;
}
}
| [
"api.cseeley@gmail.com"
] | api.cseeley@gmail.com |
6002dc066731654466452903af01c1c7951a6531 | 0af8b92686a58eb0b64e319b22411432aca7a8f3 | /large-multiproject/project22/src/main/java/org/gradle/test/performance22_4/Production22_357.java | 70b53a6cb78c3b7c6a741855e27aaf57acfc40c7 | [] | no_license | gradle/performance-comparisons | b0d38db37c326e0ce271abebdb3c91769b860799 | e53dc7182fafcf9fedf07920cbbea8b40ee4eef4 | refs/heads/master | 2023-08-14T19:24:39.164276 | 2022-11-24T05:18:33 | 2022-11-24T05:18:33 | 80,121,268 | 17 | 15 | null | 2022-09-30T08:04:35 | 2017-01-26T14:25:33 | null | UTF-8 | Java | false | false | 305 | java | package org.gradle.test.performance22_4;
public class Production22_357 extends org.gradle.test.performance10_4.Production10_357 {
private final String property;
public Production22_357() {
this.property = "foo";
}
public String getProperty() {
return property;
}
}
| [
"cedric.champeau@gmail.com"
] | cedric.champeau@gmail.com |
8a975dc5810248f22f5d5e776285a5d58c9b51f7 | 0bfedca967bf059471eb434725b1fb2074e88f83 | /java/tf2/plugin/jei/category/RecipeCategoryGunCraft.java | 900388291587ea77538441abc4a04460c455bb47 | [] | no_license | Sweetheart8888/TacticalFrame2 | 00cb176b0c7e8032207acfd90fffbcb39395e4d5 | 7f9ec0539c109c96a54342f763934dc56fdc701d | refs/heads/master | 2020-09-07T03:03:19.936745 | 2019-11-12T13:43:11 | 2019-11-12T13:43:11 | 188,586,083 | 3 | 4 | null | 2019-08-16T11:47:26 | 2019-05-25T16:01:11 | Java | UTF-8 | Java | false | false | 4,600 | java | package tf2.plugin.jei.category;
import java.util.List;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.ICraftingGridHelper;
import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.ingredients.VanillaTypes;
import mezz.jei.api.recipe.IRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper;
import mezz.jei.api.recipe.wrapper.ICraftingRecipeWrapper;
import mezz.jei.api.recipe.wrapper.ICustomCraftingRecipeWrapper;
import mezz.jei.api.recipe.wrapper.IShapedCraftingRecipeWrapper;
import mezz.jei.config.Constants;
import mezz.jei.startup.ForgeModIdHelper;
import mezz.jei.util.Translator;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.resources.I18n;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.TextFormatting;
import tf2.plugin.jei.PluginJEI;
import tf2.util.Reference;
public class RecipeCategoryGunCraft implements IRecipeCategory<IRecipeWrapper> {
protected static final int outputSlot = 0;
protected static final int inputSlot = 1;
protected final ResourceLocation backgroundLocation = Constants.RECIPE_GUI_VANILLA;
protected final IDrawable background;
protected final String localizedName;
protected final ICraftingGridHelper craftingGridHelper;
public RecipeCategoryGunCraft(IGuiHelper guiHelper) {
this.background = guiHelper.createDrawable(this.backgroundLocation, 0, 60, 116, 54);
this.localizedName = I18n.format("gui.guncraft", new Object[0]);
this.craftingGridHelper = guiHelper.createCraftingGridHelper(inputSlot, outputSlot);
}
@Override
public String getUid() {
return PluginJEI.UID_GunCraft;
}
@Override
public String getTitle() {
return this.localizedName;
}
@Override
public String getModName() {
return Reference.NAME;
}
@Override
public IDrawable getBackground() {
return this.background;
}
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients) {
IGuiItemStackGroup guiItemStackGroup = recipeLayout.getItemStacks();
guiItemStackGroup.init(outputSlot, false, 94, 18);
for(int i = 0; i < 3; i++) {
for(int j = 0; j < 3; j++) {
guiItemStackGroup.init(inputSlot + j + i * 3, true, j * 18, i * 18);
}
}
if(recipeWrapper instanceof ICustomCraftingRecipeWrapper) {
ICustomCraftingRecipeWrapper customCraftingRecipeWrapper = (ICustomCraftingRecipeWrapper)recipeWrapper;
customCraftingRecipeWrapper.setRecipe(recipeLayout, ingredients);
return;
}
List<List<ItemStack>> inputs = ingredients.getInputs(VanillaTypes.ITEM);
List<List<ItemStack>> outputs = ingredients.getOutputs(VanillaTypes.ITEM);
if(recipeWrapper instanceof IShapedCraftingRecipeWrapper) {
IShapedCraftingRecipeWrapper shapedCraftingRecipeWrapper = (IShapedCraftingRecipeWrapper)recipeWrapper;
craftingGridHelper.setInputs(guiItemStackGroup, inputs, shapedCraftingRecipeWrapper.getWidth(), shapedCraftingRecipeWrapper.getHeight());
}
else {
craftingGridHelper.setInputs(guiItemStackGroup, inputs);
recipeLayout.setShapeless();
}
guiItemStackGroup.set(outputSlot, outputs.get(0));
if(recipeWrapper instanceof ICraftingRecipeWrapper) {
ICraftingRecipeWrapper craftingRecipeWrapper = (ICraftingRecipeWrapper)recipeWrapper;
ResourceLocation registryName = craftingRecipeWrapper.getRegistryName();
if(registryName != null) {
guiItemStackGroup.addTooltipCallback((slotIndex, input, ingredient, tooltip) -> {
if(slotIndex == outputSlot) {
String recipeModId = registryName.getResourceDomain();
boolean modIdDifferent = false;
ResourceLocation itemRegistryName = ingredient.getItem().getRegistryName();
if(itemRegistryName != null) {
String itemModId = itemRegistryName.getResourceDomain();
modIdDifferent = !recipeModId.equals(itemModId);
}
if(modIdDifferent) {
String modName = ForgeModIdHelper.getInstance().getFormattedModNameForModId(recipeModId);
tooltip.add(TextFormatting.GRAY + Translator.translateToLocalFormatted("jei.tooltip.recipe.by", modName));
}
boolean showAdvanced = Minecraft.getMinecraft().gameSettings.advancedItemTooltips || GuiScreen.isShiftKeyDown();
if(showAdvanced) {
tooltip.add(TextFormatting.DARK_GRAY + Translator.translateToLocalFormatted("jei.tooltip.recipe.id", registryName.toString()));
}
}
});
}
}
}
}
| [
"livecoal157@yahoo.co.jp"
] | livecoal157@yahoo.co.jp |
a5644ed20e7df532d7e2a28ea0ba585bdf434da4 | c9577160d51cdcf5f5e591ead9facad9ce9cdb61 | /AirportCapacityManagement/src/it/polito/tdp/ariannavaraldo/model/PersonDeparture.java | 82dae1838599bcf6c2041d87890a5c51cbdfec5b | [
"Apache-2.0"
] | permissive | TdP-prove-finali/VaraldoArianna | c272eecf7efb757d9eed32fb730efe27610b6e66 | 243952bf960e03911e5ce095078c8faccd8a2565 | refs/heads/master | 2021-01-23T00:34:56.513932 | 2017-06-30T11:59:41 | 2017-06-30T11:59:41 | 92,820,872 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,731 | java | package it.polito.tdp.ariannavaraldo.model;
import java.sql.Time;
import java.util.HashMap;
import java.util.Random;
public class PersonDeparture {
private int number;
private HashMap<Integer, PersonArea> areas = new HashMap<Integer, PersonArea>();
private Flight flight;
private int checkInNumber;
private int securityCheckNumber;
//Tempo di anticipo/ritardo rispetto all'orario giusto (1 ora per nazionali, 2 ore per internazionali)
private int timeAdvance;
//Tempo impiegato nell'area di arrivo per accedere al banco di checkIn o avviarsi verso la security area
private int timeInArrivalArea;;
//Tempo impiegato per fare il checkIn
private int timeForCheckIn;
//Tempo impiegato per accedere all'area security
private int timeToSecurityArea;;
//Tempo impiegato per fare il securityCheck
private int timeForSecurityCheck;
//Tempo impiegato nell'area di imbarco
private int timeInEmbarc;
// Tempo consigliato di anticipo rispetto all'orario del volo
private long estimatedArrivalInAirport;
private boolean late = false;
public PersonDeparture(int number, Flight flight, ConfigDeparture config) {
Random r = new Random();
this.number = number;
this.flight = flight;
timeAdvance = (r.nextInt(config.getMaxAdvanceArrival()-config.getMinAdvanceArrival())+config.getMinAdvanceArrival())*Commons.MINUTE;
timeInArrivalArea = (r.nextInt(config.getMaxTimeInArrivalArea()-config.getMinTimeInArrivalArea())+config.getMinTimeInArrivalArea())*Commons.MINUTE;
timeForCheckIn = (r.nextInt(config.getMaxTimeForCheckIn()-config.getMinTimeForCheckIn())+config.getMinTimeForCheckIn())*Commons.MINUTE;
timeToSecurityArea = (r.nextInt(config.getMaxTimeToSecurityArea()-config.getMinTimeToSecurityArea())+config.getMinTimeToSecurityArea())*Commons.MINUTE;
timeForSecurityCheck = (r.nextInt(config.getMaxTimeForSecurityCheck()-config.getMinTimeForSecurityCheck())+config.getMinTimeForSecurityCheck())*Commons.SECOND;
timeInEmbarc = (r.nextInt(config.getMaxTimeInEmbarc()-config.getMinTimeInEmbarc())+config.getMinTimeInEmbarc())*Commons.MINUTE;
//Per i voli nazionali devo arrivare un'ora prima mentre per gli internazionali 2 ore prima
int multiplier=1;
if(!flight.isNazionale())
multiplier=2;
estimatedArrivalInAirport = Commons.HOUR*multiplier;
}
public HashMap<Integer, PersonArea> getAreas() {
return areas;
}
public PersonArea getArea(int areaId) {
return areas.get(areaId);
}
public Flight getFlight() {
return flight;
}
public void setFlight(Flight flight) {
this.flight = flight;
}
public int getNumber() {
return number;
}
public void setNumber(int number) {
this.number = number;
}
public int getMillisInArrivalArea() {
return timeInArrivalArea;
}
public Time getActualArrivalInAirport() {
return new Time(flight.getDepartureTime().getTime()-estimatedArrivalInAirport-timeAdvance);
}
public int getTimeForCheckIn() {
return timeForCheckIn;
}
public int getCheckInNumber() {
return checkInNumber;
}
public void setCheckInNumber(int checkInNumber) {
this.checkInNumber = checkInNumber;
}
public int getTimeToSecurityArea() {
return timeToSecurityArea;
}
public int getTimeForSecurityCheck() {
return timeForSecurityCheck;
}
public void setSecurityCheckNumber(int number) {
this.securityCheckNumber = number;
}
public int getSecurityCheckNumber() {
return securityCheckNumber;
}
public int getTimeInEmbarc() {
return timeInEmbarc;
}
public boolean isLate() {
return late;
}
public void setLate(boolean late) {
this.late = late;
}
}
| [
"s203574@studenti.polito.it"
] | s203574@studenti.polito.it |
0de03d78d4d5facbca11e58dce63642448242ff6 | c8e4405b1c16506bc1402ae4cbaacb40087a87ca | /lab5/src/androidTest/java/android/lab5/ExampleInstrumentedTest.java | 02101c02f4a1178eeacd03a646c1b6821b135005 | [] | no_license | LipatovNikita/AndroidLabs | 603a5628c8816a31e28949023290b2c1990ec950 | 23614ef151f5541ec414ab5d6fc4ac76f552e239 | refs/heads/master | 2021-08-24T12:10:25.674937 | 2017-12-09T18:13:37 | 2017-12-09T18:13:37 | 112,505,275 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 728 | java | package android.lab5;
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("android.lab5", appContext.getPackageName());
}
}
| [
"No9S6yya"
] | No9S6yya |
45e18cf8339d86a7ff4c0e8cfd0212886f35c8c6 | ccce86d60fb049b9bd5cac1bf98108357c0f4cef | /xiaojihua-spring-boot-autoconfigration/src/main/java/com/xiaojihu/xiaojihuaspringbootautoconfigration/service/properties/HelloProperties.java | 86ee0b9068df68983918f3c39442eb9a8d0adb26 | [] | no_license | githubxiaojihua/xiaojihuastart | efad35cf4d2f1bdceb7bbde0e43f03e4d4577c8e | 7325e0abeb4fdfd3c403e3ff880365305201ff8e | refs/heads/master | 2022-11-01T23:36:42.924867 | 2020-06-16T05:53:08 | 2020-06-16T05:53:08 | 272,620,558 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 579 | java | package com.xiaojihu.xiaojihuaspringbootautoconfigration.service.properties;
import org.springframework.boot.context.properties.ConfigurationProperties;
@ConfigurationProperties(prefix = "xiaojihua.hello")
public class HelloProperties {
private String prefix;
private String suffix;
public String getPrefix() {
return prefix;
}
public void setPrefix(String prefix) {
this.prefix = prefix;
}
public String getSuffix() {
return suffix;
}
public void setSuffix(String suffix) {
this.suffix = suffix;
}
}
| [
"2542213767@qq.com"
] | 2542213767@qq.com |
7d02413326ae89c450f993205566e128e0a0782b | 70bf849f613498afaaf60dd0bb1eb1b3a7ccb973 | /nvwa-commons/nvwa-common/src/main/java/cn/home/jeffrey/common/aspect/FacadeServiceLogAspect.java | 61d8857e4aae7c8702468f5ae48fe3ec3809cd30 | [] | no_license | jijunhui/nvwa | e723d07d30aad571a53c29fa55c798c23fea96a4 | 52f38aa0c5aaa1cb13df36c8e67e902090baf974 | refs/heads/master | 2022-06-23T00:23:03.580367 | 2020-04-19T13:03:25 | 2020-04-19T13:03:25 | 251,640,894 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,111 | java | package cn.home.jeffrey.common.aspect;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.Signature;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.stereotype.Component;
import java.time.format.DateTimeFormatter;
/**
* @author jijunhui
* @version 1.0.0
* @date 2020/3/26 0:03
* @description facade接口请求日志
*/
@Aspect
@Component
@Slf4j
public class FacadeServiceLogAspect {
/**
* jdk1.8 线程安全的时间format
*/
private final static DateTimeFormatter DATETIMEFORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
private final static ThreadLocal<StringBuffer> LOGSTRINGBUFFER = new ThreadLocal<>();
/**
* 指定切点 所有facade接口的请求日志
*/
@Pointcut("execution(public * cn.home.jeffrey..*.service.facade.impl.*.*(..))")
public void log() {
}
/**
* 环绕通知,环绕增强,相当于MethodInterceptor
*
* @param pjp
* @return
*/
@Around("log()")
public Object doAround(ProceedingJoinPoint pjp) {
long start = System.currentTimeMillis();
StringBuffer logBuffer = new StringBuffer("facade服务_统一拦截_开始:{}.{}");
Signature signature = pjp.getSignature();
// 获取目标方法的参数信息
String[] params = ((MethodSignature) signature).getParameterNames();
String method = ((MethodSignature) signature).getMethod().getName();
Object[] values = pjp.getArgs();
if (null != params && params.length > 0 && null != values && values.length > 0 && params.length == values.length) {
logBuffer.append("(");
for (int i = 0; i < params.length; i++) {
logBuffer.append(params[i]).append("(").append(values[i]).append(")");
if (i != params.length - 1) {
logBuffer.append(",");
}
}
logBuffer.append(")");
} else {
logBuffer.append("()");
}
log.info(logBuffer.toString(), signature.getDeclaringType().getSimpleName(), ((MethodSignature) signature).getMethod().getName());
logBuffer.setLength(0);
Object o = null;
try {
o = pjp.proceed();
logBuffer.append("facade服务_统一拦截_结束:{}.{}_返回结果:{},耗时:{}ms");
log.info(logBuffer.toString(), signature.getDeclaringType().getSimpleName(), ((MethodSignature) signature).getMethod().getName(), o, (System.currentTimeMillis() - start));
} catch (Throwable throwable) {
logBuffer.append("facade服务_统一拦截_结束:{}.{}_异常:{},耗时:{}ms");
log.error(logBuffer.toString(), signature.getDeclaringType().getSimpleName(), ((MethodSignature) signature).getMethod().getName(), throwable.getMessage(), throwable, (System.currentTimeMillis() - start));
}
return o;
}
}
| [
"jeffreyji@aliyun.com"
] | jeffreyji@aliyun.com |
a5db9905bfe14ed3e2e0230f40f4453ce8f0306d | 4fd412416e992ef545217bcd12ba8468daab20bf | /nullFreeCode-example/src/main/java/com/karakun/philip/demo/nullFreeCode/example/Gender.java | 007adb1c1b138154ede8c90bba7d60f822809dbc | [] | no_license | phbenisc/nullFreeCode | 23a52ecc28644aa1a3fe2865cb5e38211ff59e7c | dd02c418f64a2ae89498008a4bcdc5b547f76ecb | refs/heads/master | 2020-08-07T18:08:44.395695 | 2019-10-08T05:41:52 | 2019-10-08T05:41:52 | 213,546,220 | 0 | 0 | null | 2019-11-13T12:25:10 | 2019-10-08T04:05:15 | Java | UTF-8 | Java | false | false | 104 | java | package com.karakun.philip.demo.nullFreeCode.example;
public enum Gender {
MALE, FEMALE, UNKNOWN
}
| [
"philip.benischke@gmail.com"
] | philip.benischke@gmail.com |
643f757f08a095dbb61edca12751ceda160fe537 | 329ba790483278e561be7d090bad8710774a8f8a | /src/main/java/com/atfarm/challenge/repository/package-info.java | 2fbc650abc04ab8b979f09e911f22a0132df5e49 | [] | no_license | BulkSecurityGeneratorProject/Atfarm- | 802e31fd487cbfb618337dac08a6c2af3cb97453 | c269b3c8849fb3fada754abaaef1e0e42fc30f9f | refs/heads/master | 2022-12-23T21:55:40.764197 | 2019-07-12T18:22:21 | 2019-07-12T18:22:21 | 296,564,963 | 0 | 0 | null | 2020-09-18T08:43:57 | 2020-09-18T08:43:56 | null | UTF-8 | Java | false | false | 82 | java | /**
* Spring Data JPA repositories.
*/
package com.atfarm.challenge.repository;
| [
"imo@crossworkers.com"
] | imo@crossworkers.com |
cbbe62376a1fcf3689f2f71fa8966ca6e18fd9d8 | 0a8e6cd964b53d19c36cc70afcf139474656c4c3 | /app/src/main/java/technician/ifb/com/ifptecnician/stock/MystockModel.java | 29767646c800ed8b09a925029110da60484e9154 | [] | no_license | arunifb/serviceambassador | 2bb44c0723aeb4e75b88306db98db440238a6b1f | 3030103c353613bf0d53ac6d7c752548bc16402c | refs/heads/main | 2023-08-27T21:08:38.835258 | 2021-10-27T12:12:39 | 2021-10-27T12:12:39 | 421,447,094 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,604 | java | package technician.ifb.com.ifptecnician.stock;
public class MystockModel {
boolean Ischeck;
String TechPartnerId,SpareCode,SpareDes,Amount,Quantity,returnqty;
// "ItemId": "8903287028700",
// "ItemName": "CABLE HARNESS-C4 W/OUT TURBO- 32004652",
// "Quantity": 1,
// "Price": 0,
// "OrderId": null,
// "TechCode": null,
// "stock_type": "REQUEST",
// "Status": "Pending",
// "Remark": "Request is pending"
public String getTechPartnerId() {
return TechPartnerId;
}
public String getSpareCode() {
return SpareCode;
}
public String getSpareDes() {
return SpareDes;
}
public String getAmount() {
return Amount;
}
public String getQuantity() {
return Quantity;
}
public boolean isIscheck() {
return Ischeck;
}
public void setIscheck(boolean ischeck) {
Ischeck = ischeck;
}
public void setTechPartnerId(String techPartnerId) {
TechPartnerId = techPartnerId;
}
public void setSpareCode(String spareCode) {
SpareCode = spareCode;
}
public void setSpareDes(String spareDes) {
SpareDes = spareDes;
}
public void setAmount(String amount) {
Amount = amount;
}
public void setQuantity(String quantity) {
Quantity = quantity;
}
public String getReturnqty() {
return returnqty;
}
public void setReturnqty(String returnqty) {
this.returnqty = returnqty;
}
}
| [
"you@example.com"
] | you@example.com |
18f39edb3189ad7d99ce15e0180bef64233fd5d1 | 08af01b1b722fc1896b3c04b9d2fb3cb50be65ea | /app/src/main/java/br/apps/groupchatapp/ui/view/details/DetailsPresenter.java | ba4971599621e9346cf49d0eb392560be0054374 | [] | no_license | bhushanraut1811/GroupChatApp | 390d2449f260cb051a4e02ab785bf5e38301558a | 294b102da6b46b3973da5722a78877ca06af58a3 | refs/heads/master | 2021-01-22T06:11:46.140284 | 2017-02-12T18:33:14 | 2017-02-12T18:33:14 | 81,746,374 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 859 | java | package br.apps.groupchatapp.ui.view.details;
import android.support.v4.app.FragmentActivity;
import java.util.ArrayList;
import br.apps.groupchatapp.service.db.RealmDB;
import br.apps.groupchatapp.service.db.model.ChatDetails;
import io.realm.Realm;
import io.realm.RealmResults;
public class DetailsPresenter {
private IDetailsFragmentView mView;
private FragmentActivity mActivity;
public DetailsPresenter(IDetailsFragmentView view, FragmentActivity activity) {
this.mView = view;
this.mActivity = activity;
}
public void fetchDetailsFromDb(final ArrayList<ChatDetails> detailsList) {
Realm realm = RealmDB.newInstance(mActivity);
RealmResults<ChatDetails> realmResults = realm.where(ChatDetails.class).findAll();
detailsList.addAll(realmResults);
mView.setUpListNotify();
}
}
| [
"bhushanraut1811@gmail.com"
] | bhushanraut1811@gmail.com |
34854d4eab1a496a103aae63c1900877e2e1b84a | 0bd312d8d20158d8265defb724e78361cfb60574 | /app/src/main/java/com/tedyuen/customviewtest/view/CounterView.java | e6501541056a073b5092e438e6fdd1aa7b1b481c | [] | no_license | tedyuen/CustomViewTest | 53fbb1ee7c18fdab6484dbc9a617dd3f76218a8b | 68ab8a4728bb3ee21a7d1317545ac236d2851e0d | refs/heads/master | 2020-12-02T04:56:47.916014 | 2016-08-26T07:33:43 | 2016-08-26T07:33:43 | 66,531,510 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,348 | java | package com.tedyuen.customviewtest.view;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.View;
/**
* Created by tedyuen on 16-8-25.
*/
public class CounterView extends View implements View.OnClickListener {
private Paint mPaint;
private Rect mBounds;
private int mCount;
public CounterView(Context context, AttributeSet attrs) {
super(context, attrs);
mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mBounds = new Rect();
setOnClickListener(this);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
mPaint.setColor(Color.BLUE);
canvas.drawRect(0, 0, getWidth(), getHeight(), mPaint);
mPaint.setColor(Color.YELLOW);
mPaint.setTextSize(30);
String text = String.valueOf(mCount);
mPaint.getTextBounds(text, 0, text.length(), mBounds);
float textWidth = mBounds.width();
float textHeight = mBounds.height();
canvas.drawText(text, getWidth() / 2 - textWidth / 2, getHeight() / 2
+ textHeight / 2, mPaint);
}
@Override
public void onClick(View v) {
mCount++;
invalidate();
}
}
| [
"tedyuen.goo@gmail.com"
] | tedyuen.goo@gmail.com |
133243c7a8aaa47c8b0e0234669dffe032d51966 | 377c5a03c10257c28d99a0c7fb01dd08ea020190 | /design-patterns/src/main/java/com/exemplo/structural/facade/Memory.java | 99e37c0edf39d67793e3eab90d5a40fa333798ef | [] | no_license | romjunior/design-patterns-and-best-practices-in-java | 8c11f3c42789282e9a002d565d428b4fac33181b | 75a88eee8623a284907754674e703a8180100384 | refs/heads/master | 2023-03-06T19:35:33.332222 | 2021-02-19T02:39:36 | 2021-02-19T02:39:36 | 276,812,648 | 6 | 0 | null | null | null | null | UTF-8 | Java | false | false | 197 | java | package com.exemplo.structural.facade;
public class Memory {
public void load(final long position, byte[] data) {
System.out.println("Loading data to memory... " + position);
}
}
| [
"romualdo.jrr@gmail.com"
] | romualdo.jrr@gmail.com |
0d8826fe74f0b115b586fd09067c7d6d1531e334 | cc831a8549ce22bf0b70ac0a809dd6b1746cf802 | /ExtentReportPractice/src/test/java/testcases/testcase2.java | b19d495ff0168e5f0c9b38529285d03a08b35f1a | [] | no_license | Raghunath-NV/JenkinsPractice | b68ae4595785f3269f16e2236be37890af937db0 | 48ed846da7c10d5b263f7fbe6d518f873c4c86eb | refs/heads/master | 2021-06-25T02:22:11.043051 | 2020-04-01T00:34:32 | 2020-04-01T00:34:32 | 209,411,830 | 0 | 0 | null | 2021-04-26T20:06:59 | 2019-09-18T22:05:00 | HTML | UTF-8 | Java | false | false | 418 | java | package testcases;
import org.testng.annotations.Test;
import org.testng.AssertJUnit;
import org.testng.SkipException;
import org.testng.annotations.Test;
public class testcase2 {
@Test
public void loginPassTest() {
System.out.println("Pass Test");
}
@Test
public void loginFailTest() {
AssertJUnit.fail();
}
@Test
public void loginSkipTest() {
throw new SkipException("skipping test case");
}
}
| [
"raghunathnv2020@gmail.com"
] | raghunathnv2020@gmail.com |
d56ceed5d784ad01f6012831bca12b08ed9ea06f | 159653651b6fc3194d1f29fb69be817b7b18ea7d | /src/com/rootls/manage/dto/Res3FC021.java | df51163523caa5c4fa5b366e2e8f330c175d7812 | [] | no_license | luowei/ebank-demo | 70aafaacab8b31e40ad8cf83db7a20d576e15a80 | 0aa0b6777a070fc61aa0abd11e33711957fb58de | refs/heads/master | 2020-05-30T02:41:46.871598 | 2014-10-10T07:29:45 | 2014-10-10T07:29:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 677 | java | package com.rootls.manage.dto;
import java.io.Serializable;
/**
* Created by luowei on 2014/8/15.
*/
public class Res3FC021 implements Serializable {
String file_flg;
String mx_msg;
String file_name;
public String getFile_flg() {
return file_flg;
}
public void setFile_flg(String file_flg) {
this.file_flg = file_flg;
}
public String getMx_msg() {
return mx_msg;
}
public void setMx_msg(String mx_msg) {
this.mx_msg = mx_msg;
}
public String getFile_name() {
return file_name;
}
public void setFile_name(String file_name) {
this.file_name = file_name;
}
}
| [
"luowei505050@126.com"
] | luowei505050@126.com |
57b341ee7945c1946f095068e8c586acd3ea8686 | 0835dcc6f1ce71cd2801a6456335989454968d71 | /ZTotalPrj/ECE_MODEL/org/model/ExpContextInterface.java | 133cb227e76f7f83ada79ac3fbb53b9a827faaba | [] | no_license | stefano-bragaglia/Kinect-ECE-XText | addca7adb751acfd94a3bc7561b5b94a61526603 | 394c3e5c2c7240ca0a8e739558f17b4c9d17b676 | refs/heads/master | 2021-01-21T12:36:40.051435 | 2014-02-13T13:21:37 | 2014-02-13T13:21:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 569 | java | package org.model;
import org.model.ConditionInterface;
import org.model.TimeInterface;
import org.visitor.CreateDeclarationsVisitor;
import org.visitor.Visitable;
public interface ExpContextInterface extends Visitable{
public void setFinalCondition(ConditionInterface finalCondition);
public void setInitialCondition(ConditionInterface initialCondition);
public ConditionInterface getFinalCondition();
public ConditionInterface getInitialCondition();
public void setTime(TimeInterface time);
public void accept(CreateDeclarationsVisitor visitor);
}
| [
"cadupper@gmail.com"
] | cadupper@gmail.com |
c17f773c9be2ffdacc3df5a8aa39f7be02a5af43 | c464933d672364c37c201a1981ddaeac4bf6cfb5 | /vwt-web-controller/src/main/java/com/royasoft/vwt/controller/service/InternetAuthService.java | ab896fd41c0508125b8b887f6853be6fdebed254 | [] | no_license | lnsoftware/backup | d65aa34bb9ee5417c810fffc882e7bc28fa5c3af | 0be152b3fff3b5b4c1172c7a1302d7a39b317187 | refs/heads/master | 2020-05-18T05:25:58.021395 | 2019-03-30T03:37:51 | 2019-03-30T03:37:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 95,014 | java | /************************************************
* Copyright © 2002-2015 上海若雅软件系统有限公司 *
************************************************/
package com.royasoft.vwt.controller.service;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.royasoft.vwt.base.zk.ZkUtil;
import com.royasoft.vwt.common.security.MD5;
import com.royasoft.vwt.controller.constant.Constants;
import com.royasoft.vwt.controller.constant.FunctionIdConstant;
import com.royasoft.vwt.controller.constant.ResponseInfoConstant;
import com.royasoft.vwt.controller.packet.QueuePacket;
import com.royasoft.vwt.controller.queue.ServicesQueue;
import com.royasoft.vwt.controller.util.BaseConstant;
import com.royasoft.vwt.controller.util.PageUtils;
import com.royasoft.vwt.controller.util.ResponsePackUtil;
import com.royasoft.vwt.controller.util.RocketMqUtil;
import com.royasoft.vwt.controller.util.upload.FastDFSUtil;
import com.royasoft.vwt.soa.base.database.api.interfaces.DatabaseInterface;
import com.royasoft.vwt.soa.base.dictionary.api.interfaces.DictionaryInterface;
import com.royasoft.vwt.soa.base.dictionary.api.vo.DictionaryVo;
import com.royasoft.vwt.soa.base.redis.api.interfaces.RedisInterface;
import com.royasoft.vwt.soa.base.sms.api.interfaces.SendProvinceSmsInterface;
import com.royasoft.vwt.soa.business.hlwAuth.api.interfaces.HlwCorpAuthInterface;
import com.royasoft.vwt.soa.business.hlwAuth.api.interfaces.SmsSwitchInterface;
import com.royasoft.vwt.soa.business.hlwAuth.api.vo.HlwCorpAuthVO;
import com.royasoft.vwt.soa.business.hlwAuth.api.vo.SmsSwitchVO;
import com.royasoft.vwt.soa.business.industry.api.interfaces.IndustryManagerInterface;
import com.royasoft.vwt.soa.business.industry.api.vo.IndustryManagerVo;
import com.royasoft.vwt.soa.systemsettings.platform.api.interfaces.AccountManagerInterface;
import com.royasoft.vwt.soa.systemsettings.platform.api.vo.AccountManegerVo;
import com.royasoft.vwt.soa.uic.clientuser.api.interfaces.ClientUserInterface;
import com.royasoft.vwt.soa.uic.clientuser.api.vo.ClientUserVO;
import com.royasoft.vwt.soa.uic.corp.api.interfaces.CorpInterface;
import com.royasoft.vwt.soa.uic.corp.api.vo.CorpVO;
import com.royasoft.vwt.soa.uic.customer.api.interfaces.CustomerInterface;
import com.royasoft.vwt.soa.uic.customer.api.vo.CustomerVo;
import com.royasoft.vwt.soa.uic.depart.api.interfaces.DepartMentInterface;
import com.royasoft.vwt.soa.uic.depart.api.vo.DepartMentVO;
import com.royasoft.vwt.soa.uic.member.api.interfaces.HLWMemberInfoInterface;
import com.royasoft.vwt.soa.uic.member.api.interfaces.MemberInfoInterface;
import com.royasoft.vwt.soa.uic.member.api.vo.MemberInfoVO;
import io.netty.channel.Channel;
import io.netty.handler.codec.http.HttpRequest;
import jxl.Workbook;
import jxl.write.Label;
import jxl.write.WritableCellFormat;
import jxl.write.WritableFont;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
import jxl.write.WriteException;
import jxl.write.biff.RowsExceededException;
@Scope("prototype")
@Service
public class InternetAuthService implements Runnable {
@Autowired
private HlwCorpAuthInterface hlwCorpAuthInterface;
@Autowired
private RedisInterface redisInterface;
@Autowired
private DictionaryInterface dictionaryInterface;
@Autowired
private CustomerInterface customerInterface;
@Autowired
private MemberInfoInterface memberInfoInterface;
@Autowired
private CorpInterface corpInterface;
@Autowired
private ClientUserInterface clientUserInterface;
@Autowired
private DepartMentInterface departMentInterface;
@Autowired
private HLWMemberInfoInterface hLWMemberInfoInterface;
@Autowired
private DatabaseInterface databaseInterface;
@Autowired
private AccountManagerInterface accountManagerInterface;
@Autowired
private SendProvinceSmsInterface sendProvinceSmsInterface;
@Autowired
private SmsSwitchInterface smsSwitchInterface;
@Autowired
private ZkUtil zkUtil;
@Autowired
private IndustryManagerInterface industryManagerInterface;// 行业管理服务化
/** 包含链接信息与报文信息的packet **/
private QueuePacket queue_packet = null;
/** 包含请求以及头信息报文内容 **/
private Object msg = null;
/** 客户端链接 **/
private Channel channel = null;
private final Logger logger = LoggerFactory.getLogger(InternetAuthService.class);
@Override
public void run() {
while (true) {
try {
// 获取InternetAuth的队列处理数据
queue_packet = ServicesQueue.internetAuth_queue.take();
long t1 = System.currentTimeMillis();
logger.info("==============开始时间:{}", t1);
msg = queue_packet.getMsg();// 获取请求信息
channel = queue_packet.getChannel();// 获取连接
if (msg instanceof HttpRequest) {
HttpRequest request = (HttpRequest) msg;
String function_id = queue_packet.getFunction_id(); // 获取功能ID
String user_id = queue_packet.getUser_id(); // 获取用户ID
String request_body = queue_packet.getRequest_body();// 获取参数实体
logger.debug("互联网认证处理类(入口),function_id:{},user_id:{},request_body:{}", function_id, user_id, request_body);
/***************************** 业务逻辑处理 *********************************************/
String res = "";// 响应结果
if (function_id == null || function_id.length() <= 0) {
ResponsePackUtil.CalibrationParametersFailure(channel, "任务业务请求参数校验失败!");
} else {
res = sendTaskBusinessLayer(function_id, user_id, request_body, request);
}
ResponsePackUtil.responseStatusOK(channel, res); // 响应成功
// String responseStatus = ResponsePackUtil.getResCode(res);
// if (null != responseStatus && !"".equals(responseStatus))
}
ResponsePackUtil.cagHttpResponse(channel, ResponsePackUtil.buildPack(ResponseInfoConstant.FAIL1004, ""));
} catch (Exception e) {
logger.error("互联网认证业务逻辑处理异常", e);
// 响应客户端异常
ResponsePackUtil.cagHttpResponse(channel, ResponsePackUtil.buildPack(ResponseInfoConstant.FAIL1004, ""));
} finally {
// channel.close();
}
}
}
/**
* 任务分模块请求
*
* @param function_id
* @param user_id
* @param request_body
* @param msg
* @return
* @author liujm
*/
private String sendTaskBusinessLayer(String function_id, String user_id, String request_body, Object request) {
String res = "";
switch (function_id) {
case FunctionIdConstant.getInternetAuthList:// 创建任务
res = getInternetAuthList(request_body);
break;
case FunctionIdConstant.getInterAuthInfoFromCity:
res = getInterAuthInfoFromCity(request_body);
break;
case FunctionIdConstant.getInterAuthInfoFromArea:
res = getInterAuthInfoFromArea(request_body);
break;
case FunctionIdConstant.getInterAuthInfoOpen:
res = getInterAuthInfoOpen(request_body);
break;
case FunctionIdConstant.getInterAuthInfoFromCustome:
res = getInterAuthInfoFromCustome(request_body);
break;
case FunctionIdConstant.examineInterAuth:
res = examineInterAuth(request_body);
break;
case FunctionIdConstant.getIsSendMessage:
res = getIsSendMessage(request_body);
break;
case FunctionIdConstant.getInterCustomer:
res = getInterCustomer(request_body);
break;
case FunctionIdConstant.getIndustryMsg:
res = getIndustryMsg(request_body);
break;
case FunctionIdConstant.updateSendMessage:
res = updateSendMessage(request_body);
break;
case FunctionIdConstant.hlwAuthListExport:
res = hlwAuthListExport(request_body);
break;
default:
res = ResponsePackUtil.returnFaileInfo(); // 未知请求
}
return res;
}
/**
* 互联网认证列表查询
*
* @param request_body
* @param user_id
* @return
* @author liujm
*/
@SuppressWarnings("unchecked")
public String getInternetAuthList(String request_body) {
Map<String, Object> model = new HashMap<String, Object>();
Map<String, Boolean> sortMap = new HashMap<String, Boolean>();
logger.debug("获取互联网认证列表,requestBody:{},userId:{}", request_body);
JSONObject requestJson = JSONObject.parseObject(request_body);
String roleId = "";
int pageIndex = 1;
int pageSize = 10;
// 地市区域条件查询
Map<String, Object> condition = new HashMap<String, Object>();
try {
if (null != requestJson && !"".equals(requestJson)) {
String page = requestJson.getString("page");// 前台传递的页面位置请求
String limit = requestJson.getString("limit");// 前台传递的每页显示数
String startTime = requestJson.getString("startTime");// 开始时间
String endTime = requestJson.getString("endTime");// 结束时间
String telNum = requestJson.getString("linkTel");// 电话号码
String corpName = requestJson.getString("corpName");// 企业名称
// 缓存id
String sessionId = requestJson.getString("sessionid");
if (null != page && !"".equals(page)) {
pageIndex = Integer.parseInt(page);
}
if (null != limit && !"".equals(limit)) {
pageSize = Integer.parseInt(limit);
}
if (null != startTime && !"".equals(startTime)) {
condition.put("start_time_registDate", startTime.trim() + " 00:00:00");
}
if (null != endTime && !"".equals(endTime)) {
condition.put("end_time_registDate", endTime.trim() + " 00:00:00");
}
if (null != telNum && !"".equals(telNum)) {
condition.put("LIKE_linkTel", telNum.trim());
}
if (null != corpName && !"".equals(corpName)) {
condition.put("LIKE_corpName", corpName.trim());
}
// 从缓存里面获取SessionId
if (null != sessionId && !"".equals(sessionId)) {
String josonUserObject = redisInterface.getString(Constants.nameSpace + sessionId);
if (null != josonUserObject && !"".equals(josonUserObject)) {
JSONObject js = JSONObject.parseObject(josonUserObject);
roleId = js.getString("roleId");
// 地市管理员只能看到2未下发、3已下发
if (Constants.DISHIADMIN.equals(roleId)) {
condition.put("EQ_corpCity", js.getString("userCityArea"));
condition.put("GTE_dealFlag", "2");
condition.put("LTE_dealFlag", "3");
// 区县管理员只能看到3未分配,4已分配,5未开户,7已开户
} else if (Constants.QUXIANADMIN.equals(roleId)) {
condition.put("EQ_corpArea", js.getString("userCityArea"));
condition.put("GTE_dealFlag", "3");
condition.put("LTE_dealFlag", "7");
// String dealFlags = "3,4,5,6,7";
// condition.put("IN_dealFlag", dealFlags);
// 客户经理只能看到4已经分配下来,5通过,6不通过
} else if (Constants.CUSTOMADMIN.equals(roleId)) {
Map<String, Object> conditions = new HashMap<String, Object>();
conditions.put("EQ_telNum", js.getString("telNum"));
List<CustomerVo> customerList = customerInterface.findCustomerByCondition(conditions, null);
CustomerVo customerVo = null;
if (null != customerList && customerList.size() > 0) {
customerVo = customerList.get(0);
}
if (null != customerVo) {
condition.put("EQ_customerId", customerVo.getId());
}
condition.put("GTE_dealFlag", "4");
condition.put("LTE_dealFlag", "6");
} else {
return ResponsePackUtil.buildPack(ResponseInfoConstant.FAIL3004, "");
}
} else {
return ResponsePackUtil.buildPack(ResponseInfoConstant.FAIL3004, "");
}
} else {
return ResponsePackUtil.buildPack(ResponseInfoConstant.FAIL3004, "");
}
}
condition.put("EQ_deleteFlag", "0");
sortMap.put("registDate", false);
int total = 0;
List<HlwCorpAuthVO> list = null;
Map<String, Object> m = hlwCorpAuthInterface.findAllByPage(pageIndex, pageSize, condition, sortMap);
if (null != m) {
list = (List<HlwCorpAuthVO>) m.get("content");
total = PageUtils.getPageCount(Integer.parseInt(m.get("total").toString()), pageSize);
if (total > 0) {
// 封装后的数据
List<Map<String, Object>> list1 = this.transeferTotable(list, roleId);
// model.put("success", true);
model.put("items", list1);
model.put("pageNum", total);// 数据总数
model.put("page", pageIndex);
} else {
// 数据不存在时返回一条无对应数据提示
return ResponsePackUtil.buildPack(ResponseInfoConstant.SUCC, "");
}
} else {
// 数据查询异常返回异常提示
ResponsePackUtil.buildPack(ResponseInfoConstant.FAIL1006, "");
}
} catch (Exception e) {
logger.error("分页查询互联网认证信息异常", e);
}
return ResponsePackUtil.buildPack(ResponseInfoConstant.SUCC, model);
}
/**
* 互联网认证列表查询的数据封装
*
* @param list
* @return
*/
public List<Map<String, Object>> transeferTotable(List<HlwCorpAuthVO> list, String roleId) {
List<Map<String, Object>> tableList = new ArrayList<Map<String, Object>>();
try {
logger.debug("互联网认证数据封装List:{}", list);
for (HlwCorpAuthVO cv : list) {
Map<String, Object> corpMap = new HashMap<String, Object>();
// 数据封装
// id
corpMap.put("authId", cv.getAuthId());
// 企业名称
corpMap.put("corpName", cv.getCorpName());
// 联系人
corpMap.put("linkName", cv.getLinkName());
// 手机号码
corpMap.put("linkTel", cv.getLinkTel());
// 角色id
corpMap.put("roleId", roleId);
// 地市
DictionaryVo dictionaryVo1 = dictionaryInterface.findDictionaryByDictIdAndKey(Constants.DICTIONARYID, cv.getCorpCity());
if (dictionaryVo1 != null) {
corpMap.put("corpCityId", dictionaryVo1.getDictKey());
corpMap.put("corpCityName", dictionaryVo1.getDictKeyDesc());
}
// 申请时间
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String str = "";
if (null != cv.getRegistDate()) {
str = sdf.format(cv.getRegistDate());
}
corpMap.put("registDate", str);
// 审批状态
corpMap.put("dealFlag", cv.getDealFlag());
tableList.add(corpMap);
}
} catch (Exception e) {
logger.error("反馈问题数据封装异常", e);
}
return tableList;
}
/**
* 查询指定区域下的客户经理(分页)
*
* @param request_body
* @param user_id
* @return
* @author liujm
*/
@SuppressWarnings("unchecked")
public String getInterCustomer(String request_body) {
logger.debug("互联网认证获取当前区县的所有客户经理");
JSONObject requestJson = JSONObject.parseObject(request_body);
List<Map<String, Object>> tableList = new ArrayList<Map<String, Object>>();
Map<String, Object> model = new HashMap<String, Object>();
int pageIndex = 1;
int pageSize = 10;
if (null != requestJson) {
String corpArea = requestJson.getString("corpArea");
String customerName = requestJson.getString("customerName"); // 名字(支持模糊查询)
String customerTelnum = requestJson.getString("customerTelnum"); // 手机号码(支持模糊查询)
String page = requestJson.getString("page");// 前台传递的页面位置请求
String limit = requestJson.getString("limit");// 前台传递的每页显示数
Map<String, Object> conditions = new HashMap<String, Object>();
try {
logger.debug("查询指定区域下的客户经理(分页),areaCode:{},customerName:{},customerTelnum:{},page:{},limit:{},", corpArea, customerName, customerTelnum, page, limit);
if (null != page && !"".equals(page)) {
pageIndex = Integer.parseInt(page);
}
if (null != limit && !"".equals(limit)) {
pageSize = Integer.parseInt(limit);
}
if (customerName != null && !"".equals(customerName)) {
conditions.put("LIKE_name", customerName.trim());
}
if (customerTelnum != null && !"".equals(customerTelnum)) {
conditions.put("LIKE_telNum", customerTelnum.trim());
}
if (null != corpArea && !"".equals(corpArea)) {
conditions.put("EQ_area", corpArea);
Map<String, Object> map = customerInterface.findCustomerOfPage(pageIndex, pageSize, conditions, null);
if (map != null && !map.isEmpty()) {
List<CustomerVo> customerVoList = (List<CustomerVo>) map.get("content");
String total = map.get("total").toString();
int pagenum = PageUtils.getPageCount(Integer.parseInt(total), pageSize);
for (CustomerVo cv : customerVoList) {
Map<String, Object> corpCustomerMap = new HashMap<String, Object>();
corpCustomerMap.put("customerId", cv.getId());
corpCustomerMap.put("customeNamer", cv.getName());
corpCustomerMap.put("customerTel", cv.getTelNum());
tableList.add(corpCustomerMap);
}
model.put("items", tableList);
model.put("pageNum", pagenum);// 数据总数
model.put("page", pageIndex);
}
}
} catch (Exception e) {
logger.error("获取区县客户经理失败", e);
}
} else {
return ResponsePackUtil.buildPack(ResponseInfoConstant.FAIL1001, "");
}
return ResponsePackUtil.buildPack(ResponseInfoConstant.SUCC, model);
}
/**
* 地市查看查看互联网认证信息
*
* @param request_body
* @param user_id
* @return
* @author liujm
*/
public String getInterAuthInfoFromCity(String request_body) {
Map<String, Object> model = new HashMap<String, Object>();
JSONObject requestJson = JSONObject.parseObject(request_body);
HlwCorpAuthVO hlwCorpAuthVO = null;
if (null != requestJson) {
String id = requestJson.getString("id");
String sessionid = requestJson.getString("sessionid");
try {
if (null != id && !"".equals(id)) {
hlwCorpAuthVO = hlwCorpAuthInterface.findByAuthId(id);
if (hlwCorpAuthVO != null) {
// 主键id
model.put("authId", hlwCorpAuthVO.getAuthId());
// 企业名称
model.put("corpName", hlwCorpAuthVO.getCorpName());
// 联系人
model.put("linkName", hlwCorpAuthVO.getLinkName());
// 手机号码
model.put("linkTel", hlwCorpAuthVO.getLinkTel());
String fastDFSNode = Constants.fastDFSNode;
String trackerAddr = "";
try {
trackerAddr = zkUtil.findData(fastDFSNode);
logger.debug("获取图片fast地址fastDFSNode:{}", fastDFSNode);
} catch (Exception e) {
logger.error("获取图片fast地址失败", e);
}
// 企业认证函
model.put("official", trackerAddr + hlwCorpAuthVO.getOfficial());
// 企业地址
model.put("corpAddress", hlwCorpAuthVO.getCorpAddress());
model.put("corpAreaId", hlwCorpAuthVO.getCorpArea());
// 企业人数
DictionaryVo dictionaryVo3 = dictionaryInterface.findDictionaryByDictIdAndKey(Constants.DICTIONARYCORPCOUNT, hlwCorpAuthVO.getCorpMemberNumber());
if (null != dictionaryVo3) {
model.put("corpMemberNumber", dictionaryVo3.getDictValue());
}
if (null != sessionid && !"".equals(sessionid)) {
String josonUserObject = redisInterface.getString(Constants.nameSpace + sessionid);
if (null != josonUserObject && !"".equals(josonUserObject)) {
JSONObject js = JSONObject.parseObject(josonUserObject);
String roleId = js.getString("roleId");
// 角色
model.put("roleId", roleId);
// 地市编码
model.put("corpCityId", hlwCorpAuthVO.getCorpCity());
if (null != hlwCorpAuthVO.getCorpCity() && !"".equals(hlwCorpAuthVO.getCorpCity())) {
DictionaryVo dictionaryVo1 = dictionaryInterface.findDictionaryByDictIdAndKey(Constants.DICTIONARYID, hlwCorpAuthVO.getCorpCity());
if (null != dictionaryVo1) {
// 地市名称
model.put("corpCityName", dictionaryVo1.getDictKeyDesc());
}
}
}
}
}
} else {
return ResponsePackUtil.buildPack(ResponseInfoConstant.FAIL1001, "");
}
} catch (Exception e) {
logger.debug("预览互联网认证信息详情失败", e);
}
// 地市编码
String corpCity = hlwCorpAuthVO.getCorpCity();
List<Map<String, Object>> tableList = new ArrayList<Map<String, Object>>();
try {
if (null != corpCity && !"".equals(corpCity)) {
List<DictionaryVo> dictionaryVoList = dictionaryInterface.findDictionaryByDictIdAndDictValue(Constants.DICTIONARYID, corpCity);
for (DictionaryVo cv : dictionaryVoList) {
Map<String, Object> corpCityMap = new HashMap<String, Object>();
corpCityMap.put("areaId", cv.getDictKey());
corpCityMap.put("keyDesc", cv.getDictKeyDesc());
tableList.add(corpCityMap);
}
// 当前地市下所有区县
model.put("allArea", tableList);
} else {
ResponsePackUtil.buildPack(ResponseInfoConstant.FAIL3001, "");
}
} catch (Exception e) {
logger.error("获取地市下面的所有区县异常", e);
}
} else {
return ResponsePackUtil.buildPack(ResponseInfoConstant.FAIL1001, "");
}
return ResponsePackUtil.buildPack(ResponseInfoConstant.SUCC, model);
}
/**
* 区县管理员查看互联网认证信息
*
* @param request_body
* @param user_id
* @return
*/
public String getInterAuthInfoFromArea(String request_body) {
Map<String, Object> model = new HashMap<String, Object>();
JSONObject requestJson = JSONObject.parseObject(request_body);
HlwCorpAuthVO hlwCorpAuthVO = null;
if (null != requestJson) {
String id = requestJson.getString("id");
String sessionid = requestJson.getString("sessionid");
try {
if (null != id && !"".equals(id)) {
hlwCorpAuthVO = hlwCorpAuthInterface.findByAuthId(id);
if (hlwCorpAuthVO != null) {
// 主键id
model.put("authId", hlwCorpAuthVO.getAuthId());
// 企业名称
model.put("corpName", hlwCorpAuthVO.getCorpName());
// 联系人
model.put("linkName", hlwCorpAuthVO.getLinkName());
// 手机号码
model.put("linkTel", hlwCorpAuthVO.getLinkTel());
String fastDFSNode = Constants.fastDFSNode;
String trackerAddr = "";
try {
trackerAddr = zkUtil.findData(fastDFSNode);
logger.debug("获取图片fast地址fastDFSNode:{}", fastDFSNode);
} catch (Exception e) {
logger.error("获取图片fast地址失败", e);
}
// 企业认证函
model.put("official", trackerAddr + hlwCorpAuthVO.getOfficial());
// 企业地址
model.put("corpAddress", hlwCorpAuthVO.getCorpAddress());
// 企业人数
DictionaryVo dictionaryVo3 = dictionaryInterface.findDictionaryByDictIdAndKey(Constants.DICTIONARYCORPCOUNT, hlwCorpAuthVO.getCorpMemberNumber());
if (null != dictionaryVo3) {
model.put("corpMemberNumber", dictionaryVo3.getDictValue());
}
if (null != sessionid && !"".equals(sessionid)) {
String josonUserObject = redisInterface.getString(Constants.nameSpace + sessionid);
if (null != josonUserObject && !"".equals(josonUserObject)) {
JSONObject js = JSONObject.parseObject(josonUserObject);
String roleId = js.getString("roleId");
// 角色
model.put("roleId", roleId);
// 地市
model.put("corpCityId", hlwCorpAuthVO.getCorpCity());
if (null != hlwCorpAuthVO.getCorpCity() && !"".equals(hlwCorpAuthVO.getCorpCity())) {
DictionaryVo dictionaryVo1 = dictionaryInterface.findDictionaryByDictIdAndKey(Constants.DICTIONARYID, hlwCorpAuthVO.getCorpCity());
if (null != dictionaryVo1) {
// 地市名称
model.put("corpCityName", dictionaryVo1.getDictKeyDesc());
}
}
// 区县
model.put("corpAreaId", hlwCorpAuthVO.getCorpArea());
if (null != hlwCorpAuthVO.getCorpArea() && !"".equals(hlwCorpAuthVO.getCorpArea())) {
DictionaryVo dictionaryVo2 = dictionaryInterface.findDictionaryByDictIdAndKey(Constants.DICTIONARYID, hlwCorpAuthVO.getCorpArea());
if (null != dictionaryVo2) {
// 区县名称
model.put("corpAreaName", dictionaryVo2.getDictKeyDesc());
}
}
}
}
CustomerVo customerVo = customerInterface.findCustomerById(hlwCorpAuthVO.getCustomerId());
if (null != customerVo) {
model.put("customerTelnum", customerVo.getTelNum());
model.put("customerName", customerVo.getName());
}
}
} else {
return ResponsePackUtil.buildPack(ResponseInfoConstant.FAIL1001, "");
}
} catch (Exception e) {
logger.debug("预览互联网认证信息详情失败", e);
}
// String corpArea = hlwCorpAuthVO.getCorpArea();
// Map<String, Object> conditions = new HashMap<String, Object>();
// List<Map<String, Object>> tableList = new ArrayList<Map<String, Object>>();
// try {
// if (null != corpArea && !"".equals(corpArea)) {
// conditions.put("EQ_area", corpArea);
// List<CustomerVo> customerVoList = customerInterface.findCustomerByCondition(conditions, null);
// for (CustomerVo cv : customerVoList) {
// Map<String, Object> corpCustomerMap = new HashMap<String, Object>();
// corpCustomerMap.put("customeId", cv.getId());
// corpCustomerMap.put("customeName", cv.getName());
// tableList.add(corpCustomerMap);
// }
// model.put("allCustome", tableList);
// } else {
// ResponsePackUtil.buildPack(ResponseInfoConstant.FAIL3002, "");
// }
// } catch (Exception e) {
// logger.error("获取区县客户经理失败", e);
// }
} else {
return ResponsePackUtil.buildPack(ResponseInfoConstant.FAIL1001, "");
}
return ResponsePackUtil.buildPack(ResponseInfoConstant.SUCC, model);
}
/**
* 获取所有的行业信息
*
* @param request_body
* @param user_id
* @return
*/
public String getIndustryMsg(String request_body) {
Map<String, Object> model = new HashMap<String, Object>();
Map<String, Object> conditions = new HashMap<String, Object>();
try {
conditions.put("EQ_isVaild", 1);
conditions.put("NE_industryId", 10);
List<IndustryManagerVo> list = industryManagerInterface.findAllIndustryManager(conditions);
model.put("data", list);
return ResponsePackUtil.buildPack(ResponseInfoConstant.SUCC, model);
} catch (Exception e) {
logger.error("获取所有的行业信息异常", e);
return ResponsePackUtil.buildPack(ResponseInfoConstant.FAIL3003, "");
}
}
/**
* 客户经理查看互联网认证信息
*
* @param request_body
* @param user_id
* @return
* @author liujm
*/
public String getInterAuthInfoFromCustome(String request_body) {
Map<String, Object> model = new HashMap<String, Object>();
JSONObject requestJson = JSONObject.parseObject(request_body);
if (null != requestJson) {
String id = requestJson.getString("id");
String sessionid = requestJson.getString("sessionid");
try {
if (null != id && !"".equals(id)) {
HlwCorpAuthVO hlwCorpAuthVO = hlwCorpAuthInterface.findByAuthId(id);
if (hlwCorpAuthVO != null) {
// 主键id
model.put("authId", hlwCorpAuthVO.getAuthId());
// 企业名称
model.put("corpName", hlwCorpAuthVO.getCorpName());
// 联系人
model.put("linkName", hlwCorpAuthVO.getLinkName());
// 手机号码
model.put("linkTel", hlwCorpAuthVO.getLinkTel());
// 企业认证函
String fastDFSNode = Constants.fastDFSNode;
String trackerAddr = "";
try {
trackerAddr = zkUtil.findData(fastDFSNode);
logger.debug("获取图片fast地址fastDFSNode:{}", fastDFSNode);
} catch (Exception e) {
logger.error("获取图片fast地址失败", e);
}
model.put("official", trackerAddr + hlwCorpAuthVO.getOfficial());
// 企业地址
model.put("corpAddress", hlwCorpAuthVO.getCorpAddress());
// 企业人数
DictionaryVo dictionaryVo3 = dictionaryInterface.findDictionaryByDictIdAndKey(Constants.DICTIONARYCORPCOUNT, hlwCorpAuthVO.getCorpMemberNumber());
if (null != dictionaryVo3) {
model.put("corpMemberNumber", dictionaryVo3.getDictValue());
}
if (null != sessionid && !"".equals(sessionid)) {
String josonUserObject = redisInterface.getString(Constants.nameSpace + sessionid);
if (null != josonUserObject && !"".equals(josonUserObject)) {
JSONObject js = JSONObject.parseObject(josonUserObject);
String roleId = js.getString("roleId");
// 角色
model.put("roleId", roleId);
// 地市
model.put("corpCityId", hlwCorpAuthVO.getCorpCity());
if (null != hlwCorpAuthVO.getCorpCity() && !"".equals(hlwCorpAuthVO.getCorpCity())) {
DictionaryVo dictionaryVo1 = dictionaryInterface.findDictionaryByDictIdAndKey(Constants.DICTIONARYID, hlwCorpAuthVO.getCorpCity());
if (null != dictionaryVo1) {
// 地市名称
model.put("corpCityName", dictionaryVo1.getDictKeyDesc());
}
}
// 区县
model.put("corpAreaId", hlwCorpAuthVO.getCorpArea());
if (null != hlwCorpAuthVO.getCorpArea() && !"".equals(hlwCorpAuthVO.getCorpArea())) {
DictionaryVo dictionaryVo2 = dictionaryInterface.findDictionaryByDictIdAndKey(Constants.DICTIONARYID, hlwCorpAuthVO.getCorpArea());
if (null != dictionaryVo2) {
// 区县名称
model.put("corpAreaName", dictionaryVo2.getDictKeyDesc());
}
}
}
}
// 客户经理
if (null != hlwCorpAuthVO.getCustomerId() && !"".equals(hlwCorpAuthVO.getCustomerId())) {
CustomerVo customerVo = customerInterface.findCustomerById(hlwCorpAuthVO.getCustomerId());
if (null != customerVo) {
model.put("customerId", hlwCorpAuthVO.getCustomerId());
model.put("customerName", customerVo.getName());
}
}
model.put("dealFlag", hlwCorpAuthVO.getDealFlag());
model.put("authComment", hlwCorpAuthVO.getAuthComment());
}
} else {
return ResponsePackUtil.buildPack(ResponseInfoConstant.FAIL1001, "");
}
} catch (Exception e) {
logger.debug("预览互联网认证信息详情失败", e);
}
} else {
return ResponsePackUtil.buildPack(ResponseInfoConstant.FAIL1001, "");
}
return ResponsePackUtil.buildPack(ResponseInfoConstant.SUCC, model);
}
/**
* 区县管理员开户
*
* @param request_body
* @param user_id
* @return
* @author liujm
*/
public String getInterAuthInfoOpen(String request_body) {
Map<String, Object> model = new HashMap<String, Object>();
JSONObject requestJson = JSONObject.parseObject(request_body);
if (null != requestJson) {
String id = requestJson.getString("id");
String sessionid = requestJson.getString("sessionid");
try {
if (null != id && !"".equals(id)) {
HlwCorpAuthVO hlwCorpAuthVO = hlwCorpAuthInterface.findByAuthId(id);
if (hlwCorpAuthVO != null) {
// 主键id
model.put("authId", hlwCorpAuthVO.getAuthId());
// 企业名称
model.put("corpName", hlwCorpAuthVO.getCorpName());
// 联系人
model.put("linkName", hlwCorpAuthVO.getLinkName());
// 手机号码
model.put("linkTel", hlwCorpAuthVO.getLinkTel());
// 企业认证函
String fastDFSNode = Constants.fastDFSNode;
String trackerAddr = "";
try {
trackerAddr = zkUtil.findData(fastDFSNode);
logger.debug("获取图片fast地址fastDFSNode:{}", fastDFSNode);
} catch (Exception e) {
logger.error("获取图片fast地址失败", e);
}
model.put("official", trackerAddr + hlwCorpAuthVO.getOfficial());
// 企业地址
model.put("corpAddress", hlwCorpAuthVO.getCorpAddress());
// 企业人数
DictionaryVo dictionaryVo3 = dictionaryInterface.findDictionaryByDictIdAndKey(Constants.DICTIONARYCORPCOUNT, hlwCorpAuthVO.getCorpMemberNumber());
if (null != dictionaryVo3) {
model.put("corpMemberNumber", dictionaryVo3.getDictValue());
}
if (null != sessionid && !"".equals(sessionid)) {
String josonUserObject = redisInterface.getString(Constants.nameSpace + sessionid);
if (null != josonUserObject && !"".equals(josonUserObject)) {
JSONObject js = JSONObject.parseObject(josonUserObject);
String roleId = js.getString("roleId");
// 角色
model.put("roleId", roleId);
// 地市
model.put("corpCityId", hlwCorpAuthVO.getCorpCity());
if (null != hlwCorpAuthVO.getCorpCity() && !"".equals(hlwCorpAuthVO.getCorpCity())) {
DictionaryVo dictionaryVo1 = dictionaryInterface.findDictionaryByDictIdAndKey(Constants.DICTIONARYID, hlwCorpAuthVO.getCorpCity());
if (null != dictionaryVo1) {
// 地市名称
model.put("corpCityName", dictionaryVo1.getDictKeyDesc());
}
}
// 区县
model.put("corpAreaId", hlwCorpAuthVO.getCorpArea());
if (null != hlwCorpAuthVO.getCorpArea() && !"".equals(hlwCorpAuthVO.getCorpArea())) {
DictionaryVo dictionaryVo2 = dictionaryInterface.findDictionaryByDictIdAndKey(Constants.DICTIONARYID, hlwCorpAuthVO.getCorpArea());
if (null != dictionaryVo2) {
// 区县名称
model.put("corpAreaName", dictionaryVo2.getDictKeyDesc());
}
}
}
}
// 客户经理
if (null != hlwCorpAuthVO.getCustomerId() && !"".equals(hlwCorpAuthVO.getCustomerId())) {
CustomerVo customerVo = customerInterface.findCustomerById(hlwCorpAuthVO.getCustomerId());
if (null != customerVo) {
model.put("customerId", hlwCorpAuthVO.getCustomerId());
model.put("customerName", customerVo.getName());
}
}
model.put("dealFlag", hlwCorpAuthVO.getDealFlag());
model.put("authComment", hlwCorpAuthVO.getAuthComment());
AccountManegerVo accountManeger3 = accountManagerInterface.findByCorpid(hlwCorpAuthVO.getCorpId());
if (null != accountManeger3) {
model.put("loginName", accountManeger3.getAccountlogginname());
}
Map<String, Object> conditions = new HashMap<String, Object>();
conditions.put("EQ_corpId", hlwCorpAuthVO.getCorpId());
List<CorpVO> CorpVOL = corpInterface.findAllByConditions(conditions);
if (null != CorpVOL && CorpVOL.size() > 0) {
// if (null != CorpVOL.get(0).getCustomerId() && !"".equals(CorpVOL.get(0).getCustomerId())) {
// CustomerVo customerVo = customerInterface.findCustomerById(CorpVOL.get(0).getCustomerId());
// if (null != customerVo) {
// model.put("customerName", customerVo.getName());
// }
// }
if (null != CorpVOL.get(0).getCorpIndustry() && !"".equals(CorpVOL.get(0).getCorpIndustry())) {
IndustryManagerVo industryManagerVo = industryManagerInterface.findByIndustryId(Long.parseLong(CorpVOL.get(0).getCorpIndustry()));
if (null != industryManagerVo) {
model.put("industryName", industryManagerVo.getIndustryName());
}
}
}
}
} else {
return ResponsePackUtil.buildPack(ResponseInfoConstant.FAIL1001, "");
}
} catch (Exception e) {
logger.debug("预览互联网认证信息详情失败", e);
}
} else {
return ResponsePackUtil.buildPack(ResponseInfoConstant.FAIL1001, "");
}
return ResponsePackUtil.buildPack(ResponseInfoConstant.SUCC, model);
}
/**
* 互联网认证信息分配、审核和开户
*
* @param request
* @param response
* @return
*/
public String examineInterAuth(String request_body) {
HlwCorpAuthVO hlwCorpAuthVORul = null;
JSONObject requestJson = JSONObject.parseObject(request_body);
if (null != requestJson) {
String id = requestJson.getString("id");
String sessionid = requestJson.getString("sessionid");
String roleId = null;
try {
if (null != id && !"".equals(id)) {
HlwCorpAuthVO hlwCorpAuthVO = hlwCorpAuthInterface.findByAuthId(id);
if (null != hlwCorpAuthVO) {
if (null != sessionid && !"".equals(sessionid)) {
String josonUserObject = redisInterface.getString(Constants.nameSpace + sessionid);
if (null != josonUserObject && !"".equals(josonUserObject)) {
JSONObject js = JSONObject.parseObject(josonUserObject);
roleId = js.getString("roleId");
// 地市
if (Constants.DISHIADMIN.equals(roleId)) {
// 分配区县
hlwCorpAuthVO.setCorpArea(requestJson.getString("corpArea"));
hlwCorpAuthVO.setDealFlag("3");
String sendmail = requestJson.getString("sendmail");
if (null != sendmail && !"".equals(sendmail)) {
try {
List<SmsSwitchVO> smsSwitchVOList = smsSwitchInterface.findByAttr(requestJson.getString("corpArea"));
if ("1".equals(sendmail) && (null == smsSwitchVOList || smsSwitchVOList.size() == 0)) {
if (null != roleId && !"".equals(roleId)) {
try {
List<AccountManegerVo> accountManegerVoList = accountManagerInterface.findByRegionidAndRoleid(requestJson.getString("corpArea"),
Integer.parseInt(Constants.QUXIANADMIN));
if (null != accountManegerVoList && accountManegerVoList.size() > 0) {
for (int i = 0; i < accountManegerVoList.size(); i++) {
AccountManegerVo accountManegerVo = accountManegerVoList.get(i);
if (accountManegerVo != null) {
sendProvinceSmsInterface.sendCommonSms(accountManegerVo.getTelnum(), Constants.sendCityContent);
}
}
}
} catch (Exception e) {
logger.error("查询区县管理员电话失败", e);
}
}
}
} catch (Exception e) {
logger.error("地市分配区县短信发送短信失败", e);
}
}
}
// 区县
else if (Constants.QUXIANADMIN.equals(roleId)) {
if ("5".equals(hlwCorpAuthVO.getDealFlag())) {
try {
AccountManegerVo accountManeger = accountManagerInterface.findAccountManagerByLoginName(requestJson.getString("loginName"));
if (null != accountManeger) {
return ResponsePackUtil.buildPack(ResponseInfoConstant.FAIL3005, "");
} else {
// 区县开户
hlwCorpAuthVO.setDealFlag("7");
// Map<String, Object> conditions = new HashMap<String, Object>();
// conditions.put("EQ_", hlwCorpAuthVO.getCorpId());
// 企业
CorpVO corp = corpInterface.findById(hlwCorpAuthVO.getCorpId());
if (null != corp) {
try {
corp.setFromchannel(1L);
// 行业
corp.setCorpIndustry(requestJson.getString("industryid"));
// 区县
corp.setCorpArea(hlwCorpAuthVO.getCorpArea());
// 地市
corp.setCorpRegion(hlwCorpAuthVO.getCorpCity());
// 客户经理
corp.setCustomerId(requestJson.getString("customerId"));
// 地市名称
corp.setCorpName(hlwCorpAuthVO.getCorpName());
// 联系人
corp.setCorpPersonname(hlwCorpAuthVO.getLinkName());
// 联系人电话
corp.setCorpMobilephone(hlwCorpAuthVO.getLinkTel());
corpInterface.saveCorp(corp);
} catch (Exception e) {
logger.error("企业信息修改异常", e);
}
}
// 企业下所有用户
List<ClientUserVO> ClientUserVOList = clientUserInterface.findByCorpId(hlwCorpAuthVO.getCorpId());
if (null != ClientUserVOList && ClientUserVOList.size() > 0) {
try {
for (int i = 0; i < ClientUserVOList.size(); i++) {
ClientUserVOList.get(i).setFromChannel(1L);
clientUserInterface.saveUser(ClientUserVOList.get(i));
}
} catch (Exception e) {
logger.error("client_user企业下所有员工fromchannal修改异常", e);
}
}
// 企业下所有部门
List<DepartMentVO> DepartMentVOList = departMentInterface.findByCorpId(hlwCorpAuthVO.getCorpId());
String rootDeptId = null;
String departname = "";
if (null != DepartMentVOList && DepartMentVOList.size() > 0) {
try {
for (int i = 0; i < DepartMentVOList.size(); i++) {
if (DepartMentVOList.get(i).getParentDeptNum().equals("1")) {
rootDeptId = DepartMentVOList.get(i).getDeptId();
DepartMentVOList.get(i).setPartName(hlwCorpAuthVO.getCorpName());
} else {
if (null != DepartMentVOList.get(i).getPartFullName() && !"".equals(DepartMentVOList.get(i).getPartFullName())) {
String[] departNames = DepartMentVOList.get(i).getPartFullName().split("/");
departNames[0] = hlwCorpAuthVO.getCorpName();
for (int j = 0; j < departNames.length; j++) {
departname += departNames[j] + "/";
}
DepartMentVOList.get(i).setPartFullName(departname.substring(0, departname.length() - 1));
}
}
DepartMentVOList.get(i).setActTime(new Date());
DepartMentVOList.get(i).setFromChannel("1");
departMentInterface.save(DepartMentVOList.get(i));
//变量清空
departname="";
}
} catch (Exception e) {
logger.error("企业下所有所在部门员工fromchannal修改异常", e);
}
}
// 企业下所有员工迁移表
Map<String, Object> conditions = new HashMap<String, Object>();
conditions.put("EQ_corpId", hlwCorpAuthVO.getCorpId());
List<MemberInfoVO> MemberInfoVOList = hLWMemberInfoInterface.findHLWMemberInfoByCondition(conditions, null);
if (null != MemberInfoVOList && MemberInfoVOList.size() > 0) {
try {
for (int i = 0; i < MemberInfoVOList.size(); i++) {
if (rootDeptId.equals(MemberInfoVOList.get(i).getDeptId())) {
MemberInfoVOList.get(i).setPartName(hlwCorpAuthVO.getCorpName());
}
MemberInfoVOList.get(i).setFromChannel(1L);
MemberInfoVOList.get(i).setSort(i + 1L);
// 加入排序字段
MemberInfoVOList.get(i).setOperationTime(new Date());
memberInfoInterface.save(MemberInfoVOList.get(i));
}
hLWMemberInfoInterface.deleteByCorpId(hlwCorpAuthVO.getCorpId());
} catch (Exception e) {
logger.error("企业下所有员工迁移异常", e);
}
}
// 新建企业的东西
AccountManegerVo accountManegerVo = new AccountManegerVo();
accountManegerVo.setAccountid(Integer.valueOf(databaseInterface.generateId("sys_user", "user_id") + ""));
accountManegerVo.setAccountlogginname(requestJson.getString("loginName"));
accountManegerVo.setAccountusername(hlwCorpAuthVO.getLinkName());
accountManegerVo.setCorpid(hlwCorpAuthVO.getCorpId());
accountManegerVo.setIseffective("Y");
accountManegerVo.setPassword(MD5.encodeMD5(requestJson.getString("password")));
if (hlwCorpAuthVO.getCorpArea() != null && !"".equals(hlwCorpAuthVO.getCorpArea())) {
accountManegerVo.setRegionid(hlwCorpAuthVO.getCorpArea());
} else {
accountManegerVo.setRegionid(hlwCorpAuthVO.getCorpCity());
}
accountManegerVo.setRoleid(3);
accountManegerVo.setTelnum(hlwCorpAuthVO.getLinkTel());
logger.debug("新增企业管理员信息,accountManegerVo{}", JSON.toJSON(accountManegerVo));
accountManagerInterface.save(accountManegerVo);
// String sendmail = requestJson.getString("sendmail");
String sendCorpmail = requestJson.getString("sendCorpmail");
String sendcustomermail = requestJson.getString("sendcustomermail");
if (null != sendcustomermail && !"".equals(sendcustomermail)) {
try {
//开户给客户经理发送短信
List<SmsSwitchVO> smsSwitchVOList1 = smsSwitchInterface.findByAttr(requestJson.getString("customerId"));
if ("1".equals(sendcustomermail)&&(null == smsSwitchVOList1 || smsSwitchVOList1.size() == 0)) {
try {
CustomerVo customerVo = customerInterface.findCustomerById(requestJson.getString("customerId"));
if (null != customerVo) {
// 短信内容待定
sendProvinceSmsInterface.sendCommonSms(customerVo.getTelNum(), hlwCorpAuthVO.getCorpName() + "已开户");
}
} catch (Exception e) {
logger.error("区县开户发送客户经理短息异常", e);
}
}
} catch (Exception e) {
logger.error("区县开户发送客户经理短息异常", e);
}
}
if (null != sendCorpmail && !"".equals(sendCorpmail)) {
if("1".equals(sendCorpmail)){
try {
sendProvinceSmsInterface.sendCommonSms(hlwCorpAuthVO.getLinkTel(), Constants.sendOpenContent1 + requestJson.getString("loginName")
+ Constants.sendOpenContent2 + requestJson.getString("password") + Constants.sendOpenContent3);
} catch (Exception e) {
logger.error("区县开户发送企业管理员短息异常", e);
}
}
}
}
} catch (Exception e) {
logger.error("区县开户异常", e);
}
// 审核认证时间
// hlwCorpAuthVO.setAuthDate(new Date());
} else {
try {
hlwCorpAuthVO.setCustomerId(requestJson.getString("customerId"));
// requestJson.getString("customerTel")只给电话发短信
String sendmail = requestJson.getString("sendmail");
if (null != sendmail && !"".equals(sendmail)) {
try {
List<SmsSwitchVO> smsSwitchVOList = smsSwitchInterface.findByAttr(requestJson.getString("customerId"));
if ("1".equals(sendmail) && (null == smsSwitchVOList || smsSwitchVOList.size() == 0)) {
CustomerVo customerVo = customerInterface.findCustomerById(requestJson.getString("customerId"));
if (null != customerVo) {
sendProvinceSmsInterface.sendCommonSms(customerVo.getTelNum(), Constants.sendCityContent);
}
}
} catch (Exception e) {
logger.error("区县分配给客户经理发送短信失败", e);
}
}
hlwCorpAuthVO.setDealFlag("4");
} catch (Exception e) {
logger.error("区县分配给客户经理失败", e);
}
}
}
// 客户经理
else if (Constants.CUSTOMADMIN.equals(roleId)) {
hlwCorpAuthVO.setDealFlag(requestJson.getString("dealFlag"));
hlwCorpAuthVO.setAuthComment(requestJson.getString("authComment"));// 审核意见
hlwCorpAuthVO.getCorpArea();
String sendmail = requestJson.getString("sendmail");
if (null != sendmail && !"".equals(sendmail)) {
List<SmsSwitchVO> smsSwitchVOList = smsSwitchInterface.findByAttr(hlwCorpAuthVO.getCorpArea());
if ("1".equals(sendmail)) {
//不通过给申请人发
if ("6".equals(requestJson.getString("dealFlag"))) {
sendProvinceSmsInterface.sendCommonSms(hlwCorpAuthVO.getLinkTel(), Constants.sendNoPassContent);
} else {//给区县管理员发
if(null == smsSwitchVOList || smsSwitchVOList.size() == 0){
try {
List<AccountManegerVo> accountManegerVoList = accountManagerInterface.findByRegionidAndRoleid(hlwCorpAuthVO.getCorpArea(),
Integer.parseInt(Constants.QUXIANADMIN));
if (null != accountManegerVoList && accountManegerVoList.size() > 0) {
for (int i = 0; i < accountManegerVoList.size(); i++) {
AccountManegerVo accountManegerVo = accountManegerVoList.get(i);
if (null != accountManegerVo) {
sendProvinceSmsInterface.sendCommonSms(accountManegerVo.getTelnum(), Constants.sendCityContent);
}
}
} else {
logger.debug("区县管理员账户为空");
}
} catch (Exception e) {
logger.error("客户经理给区县发送短信异常", e);
}
}
}
}
}
// 审核认证时间
hlwCorpAuthVO.setAuthDate(new Date());
}
}
}
// 审核认证时间
// hlwCorpAuthVO.setAuthDate(new Date());
}
// 保存数据
hlwCorpAuthVORul = hlwCorpAuthInterface.save(hlwCorpAuthVO);
/** 推送企业开户提醒至该企业所有注册用户 */
sendNoticeToCorpManager(roleId, hlwCorpAuthVO);
} else {
return ResponsePackUtil.buildPack(ResponseInfoConstant.FAIL1001, "");
}
} catch (Exception e) {
logger.error("进行反馈问题时异常", e);
}
} else {
return ResponsePackUtil.buildPack(ResponseInfoConstant.FAIL1001, "");
}
if (null != hlwCorpAuthVORul) {
return ResponsePackUtil.buildPack(ResponseInfoConstant.SUCC, "");
} else {
return ResponsePackUtil.buildPack(ResponseInfoConstant.FAIL1001, "");
}
}
/**
* 推送企业开户提醒至该企业所有注册用户
*
* @param roleId
* @param hlwCorpAuthVO
*/
private void sendNoticeToCorpManager(String roleId, HlwCorpAuthVO hlwCorpAuthVO) {
logger.debug("推送企业开户提醒至该企业所有注册用户,roleId:{},hlwCorpAuthVO:{}", roleId, JSON.toJSONString(hlwCorpAuthVO));
if (!Constants.QUXIANADMIN.equals(roleId) || !"7".equals(hlwCorpAuthVO.getDealFlag()))
return;
List<ClientUserVO> clientUserVOs = clientUserInterface.findByCorpId(hlwCorpAuthVO.getCorpId());
logger.debug("推送企业开户提醒至该企业所有注册用户(获取所有注册用户),clientUserVOs:{}", null == clientUserVOs ? 0 : clientUserVOs.size());
if (null == clientUserVOs || clientUserVOs.isEmpty())
return;
for (ClientUserVO clientUserVO : clientUserVOs) {
if (null == clientUserVO || null == clientUserVO.getUserId() || "".equals(clientUserVO.getUserId()))
continue;
JSONObject imJson = new JSONObject();
imJson.put("content", "");
imJson.put("type", "3");
imJson.put("requestId", UUID.randomUUID().toString());
imJson.put("roleId", clientUserVO.getUserId());
imJson.put("needOffLine", false);
RocketMqUtil.send(RocketMqUtil.BuinessPushQueue, imJson.toJSONString());
}
}
/**
* 删除互联网认证信息
*
* @param request_body
* @param user_id
* @return
*/
// public String deleteInterAuthById(String request_body, String user_id) {
//
// boolean flag = false;
// JSONObject requestJson = JSONObject.parseObject(request_body);
// if (null != requestJson) {
// String id = requestJson.getString("id");
// try {
// flag = hlwCorpAuthInterface.deleteByAuthId(id);
// } catch (Exception e) {
// logger.error("删除互联网认证信息异常", e);
// }
// if (flag) {
// return ResponsePackUtil.buildPack(ResponseInfoConstant.SUCC, "");
// } else {
// return ResponsePackUtil.buildPack(ResponseInfoConstant.FAIL3003, "");
// }
// } else {
// return ResponsePackUtil.buildPack(ResponseInfoConstant.FAIL1001, "");
// }
// }
/**
* 获取是否发送短信
*
* @param request_body
* @param user_id
* @return
*/
public String getIsSendMessage(String request_body) {
Map<String, Object> model = new HashMap<String, Object>();
JSONObject requestJson = JSONObject.parseObject(request_body);
if (null != requestJson) {
String sessionid = requestJson.getString("sessionid");
if (null != sessionid && !"".equals(sessionid)) {
String josonUserObject = redisInterface.getString(Constants.nameSpace + sessionid);
if (null != josonUserObject && !"".equals(josonUserObject)) {
JSONObject js = JSONObject.parseObject(josonUserObject);
String roleId = js.getString("roleId");
String userCityArea = js.getString("userCityArea");
if (null != roleId && !"".equals(roleId)) {
if (Constants.CUSTOMADMIN.equals(roleId)) {
try {
Map<String, Object> conditions = new HashMap<String, Object>();
conditions.put("EQ_telNum", js.getString("telNum"));
List<CustomerVo> customerList = customerInterface.findCustomerByCondition(conditions, null);
CustomerVo customerVo = null;
if (null != customerList && customerList.size() > 0) {
customerVo = customerList.get(0);
}
if (null != customerVo) {
List<SmsSwitchVO> smsSwitchVOList = smsSwitchInterface.findByAttr(customerVo.getId());
if (null != smsSwitchVOList && smsSwitchVOList.size() > 0) {
// 库里面有值则不发短信
model.put("isSendMessage", "0");
} else {
model.put("isSendMessage", "1");
}
}
} catch (Exception e) {
logger.error("客户经理获取发不发送短信数据异常", e);
}
} else {
try {
List<SmsSwitchVO> smsSwitchVOList = smsSwitchInterface.findByAttr(userCityArea);
if (null != smsSwitchVOList && smsSwitchVOList.size() > 0) {
// 库里面有值则不发短信
model.put("isSendMessage", "0");
} else {
model.put("isSendMessage", "1");
}
} catch (Exception e) {
logger.error("地市区县获取发不发送短信数据异常", e);
}
}
}
return ResponsePackUtil.buildPack(ResponseInfoConstant.SUCC, model);
} else {
return ResponsePackUtil.buildPack(ResponseInfoConstant.FAIL1001, "");
}
} else {
return ResponsePackUtil.buildPack(ResponseInfoConstant.FAIL1001, "");
}
} else {
return ResponsePackUtil.buildPack(ResponseInfoConstant.FAIL1001, "");
}
}
/**
* 修改是否发送短信
*
* @param request_body
* @param user_id
* @return
*/
public String updateSendMessage(String request_body) {
JSONObject requestJson = JSONObject.parseObject(request_body);
boolean flag = false;
if (null != requestJson) {
String sessionid = requestJson.getString("sessionid");
String isSend = requestJson.getString("isSend");
if (null != sessionid && !"".equals(sessionid)) {
String josonUserObject = redisInterface.getString(Constants.nameSpace + sessionid);
if (null != josonUserObject && !"".equals(josonUserObject)) {
JSONObject js = JSONObject.parseObject(josonUserObject);
String roleId = js.getString("roleId");
if (null != roleId && !"".equals(roleId)) {
// 客户经理是否接受短信
if (Constants.CUSTOMADMIN.equals(roleId)) {
try {
Map<String, Object> conditions = new HashMap<String, Object>();
conditions.put("EQ_telNum", js.getString("telNum"));
List<CustomerVo> customerList = customerInterface.findCustomerByCondition(conditions, null);
CustomerVo customerVo = null;
if (null != customerList && customerList.size() > 0) {
customerVo = customerList.get(0);
}
if (null != customerVo) {
if ("0".equals(isSend)) {
SmsSwitchVO smsSwitchVO = new SmsSwitchVO();
smsSwitchVO.setId(UUID.randomUUID().toString());
smsSwitchVO.setAttr(customerVo.getId());
smsSwitchVO.setType("3");
smsSwitchVO.setInsertDate(new Date());
try {
smsSwitchInterface.save(smsSwitchVO);
flag = true;
} catch (Exception e) {
logger.error("保存是否发送短信失败", e);
}
} else if ("1".equals(isSend)) {
List<SmsSwitchVO> smsSwitchVOList = smsSwitchInterface.findByAttr(customerVo.getId());
if (null != smsSwitchVOList && smsSwitchVOList.size() > 0) {
try {
for (int i = 0; i < smsSwitchVOList.size(); i++) {
smsSwitchInterface.deleteById(smsSwitchVOList.get(i).getId());
}
} catch (Exception e) {
logger.error("删除是否发送短信失败", e);
}
}
flag = true;
}
}
} catch (Exception e) {
logger.error("客户经理是否接受短信修改异常", e);
}
} else {
try {
// 地市、区县是否接受短信
if ("0".equals(isSend)) {
SmsSwitchVO smsSwitchVO = new SmsSwitchVO();
smsSwitchVO.setId(UUID.randomUUID().toString());
smsSwitchVO.setAttr(js.getString("userCityArea"));
if(Constants.DISHIADMIN.equals(roleId)){
smsSwitchVO.setType("1");
}else{
smsSwitchVO.setType("2");
}
smsSwitchVO.setInsertDate(new Date());
try {
smsSwitchInterface.save(smsSwitchVO);
flag = true;
} catch (Exception e) {
logger.error("保存是否发送短信失败", e);
}
} else if ("1".equals(isSend)) {
List<SmsSwitchVO> smsSwitchVOList = smsSwitchInterface.findByAttr(js.getString("userCityArea"));
if (null != smsSwitchVOList && smsSwitchVOList.size() > 0) {
try {
for (int i = 0; i < smsSwitchVOList.size(); i++) {
smsSwitchInterface.deleteById(smsSwitchVOList.get(i).getId());
}
} catch (Exception e) {
logger.error("删除是否发送短信失败", e);
}
}
flag = true;
}
} catch (Exception e) {
logger.error("区县是否接受短信修改异常", e);
}
}
}
}
}
if (flag) {
return ResponsePackUtil.buildPack(ResponseInfoConstant.SUCC, "");
} else {
return ResponsePackUtil.buildPack(ResponseInfoConstant.FAIL1001, "");
}
} else {
return ResponsePackUtil.buildPack(ResponseInfoConstant.FAIL1001, "");
}
}
/**
* 互联网认证的导出读写方法
*
* @param list
* @param userId
* @param request
* @param response
*/
@SuppressWarnings("unchecked")
public String hlwAuthListExport(String request_body) {
Map<String, Boolean> sortMap = new HashMap<String, Boolean>();
logger.debug("获取互联网认证列表进行导出,requestBody:{},userId:{}", request_body);
JSONObject requestJson = JSONObject.parseObject(request_body);
String roleId = "";
// 地市区域条件查询
Map<String, Object> condition = new HashMap<String, Object>();
if (null != requestJson && !"".equals(requestJson)) {
String startTime = requestJson.getString("startTime");// 开始时间
String endTime = requestJson.getString("endTime");// 结束时间
String telNum = requestJson.getString("linkTel");// 电话号码
String corpName = requestJson.getString("corpName");// 企业名称
// 缓存id
String sessionId = requestJson.getString("sessionid");
if (null != startTime && !"".equals(startTime)) {
condition.put("start_time_registDate", startTime.trim() + " 00:00:00");
}
if (null != endTime && !"".equals(endTime)) {
condition.put("end_time_registDate", endTime.trim() + " 00:00:00");
}
if (null != telNum && !"".equals(telNum)) {
condition.put("LIKE_linkTel", telNum.trim());
}
if (null != corpName && !"".equals(corpName)) {
condition.put("LIKE_corpName", corpName.trim());
}
// 从缓存里面获取SessionId
if (null != sessionId && !"".equals(sessionId)) {
String josonUserObject = redisInterface.getString(Constants.nameSpace + sessionId);
if (null != josonUserObject && !"".equals(josonUserObject)) {
JSONObject js = JSONObject.parseObject(josonUserObject);
roleId = js.getString("roleId");
// 地市管理员只能看到2未下发、3已下发
if (Constants.DISHIADMIN.equals(roleId)) {
condition.put("EQ_corpCity", js.getString("userCityArea"));
condition.put("GTE_dealFlag", "2");
condition.put("LTE_dealFlag", "3");
// 区县管理员只能看到3未分配,4已分配,5未开户,7已开户
} else if (Constants.QUXIANADMIN.equals(roleId)) {
condition.put("EQ_corpArea", js.getString("userCityArea"));
condition.put("GTE_dealFlag", "3");
condition.put("LTE_dealFlag", "7");
// String dealFlags = "3,4,5,6,7";
// condition.put("IN_dealFlag", dealFlags);
// 客户经理只能看到4已经分配下来,5通过,6不通过
} else if (Constants.CUSTOMADMIN.equals(roleId)) {
Map<String, Object> conditions = new HashMap<String, Object>();
conditions.put("EQ_telNum", js.getString("telNum"));
List<CustomerVo> customerList = customerInterface.findCustomerByCondition(conditions, null);
CustomerVo customerVo = null;
if (null != customerList && customerList.size() > 0) {
customerVo = customerList.get(0);
}
if (null != customerVo) {
condition.put("EQ_customerId", customerVo.getId());
}
condition.put("GTE_dealFlag", "4");
condition.put("LTE_dealFlag", "6");
} else {
return ResponsePackUtil.buildPack(ResponseInfoConstant.FAIL3006, "");
}
} else {
return ResponsePackUtil.buildPack(ResponseInfoConstant.FAIL3006, "");
}
}
}
condition.put("EQ_deleteFlag", "0");
int pageIndex = 1;
int pageSize = 1000;
int total = 0;
List<HlwCorpAuthVO> list = null;
List<HlwCorpAuthVO> _list = new ArrayList<HlwCorpAuthVO>();
Map<String, Object> m = hlwCorpAuthInterface.findAllByPage(pageIndex, 1, condition, null);
if (null != m) {
if (null != m.get("total")) {
total = Integer.parseInt(m.get("total").toString());
}
sortMap.put("registDate", false);
int xx = total % pageSize == 0 ? (total / pageSize) : (total / pageSize + 1);
for (int i = 1; i <= xx; i++) { // 循环调用分页获取total / pageSize + 1次,一次pageSize条
Map<String, Object> mList = hlwCorpAuthInterface.findAllByPage(i, pageSize, condition, sortMap);
if (mList != null) {
list = (List<HlwCorpAuthVO>) mList.get("content");
_list.addAll(list);
}
}
if (null == _list || _list.isEmpty()) {
_list = new ArrayList<>();
}
byte[] b = null;
String url = "";
String fastDFSNode = BaseConstant.fastDFSNode;
String nginxAddr = "";
try {
nginxAddr = zkUtil.findData(fastDFSNode);
} catch (Exception e) {
logger.error("获取导出地址报错", e);
}
try {
b = writeExcel(_list, roleId);
url = FastDFSUtil.uploadFile(b, "xls");
} catch (Exception e) {
logger.error("导出excel报错", e);
return ResponsePackUtil.buildPack(ResponseInfoConstant.FAIL2018, "");
}
return ResponsePackUtil.buildPack("0000", nginxAddr + url);
} else {
return ResponsePackUtil.buildPack(ResponseInfoConstant.FAIL2018, "");
}
}
/**
* 导出excel
*
* @param list
* @return
* @throws IOException
* @throws RowsExceededException
* @throws WriteException
*/
public byte[] writeExcel(List<HlwCorpAuthVO> list, String roleId) throws IOException, RowsExceededException, WriteException {
ByteArrayOutputStream os = new ByteArrayOutputStream();
WritableWorkbook wwb = Workbook.createWorkbook(os);
WritableSheet sheet = wwb.createSheet("sheet1", 0);
sheet.mergeCells(0, 0, 8, 0);// 添加合并单元格,第一个参数是起始列,第二个参数是起始行,第三个参数是终止列,第四个参数是终止行
WritableFont bold = new WritableFont(WritableFont.ARIAL, 10, WritableFont.BOLD);// 设置字体种类和黑体显示,字体为Arial,字号大小为10,采用黑体显示
WritableCellFormat titleFormate = new WritableCellFormat(bold);// 生成一个单元格样式控制对象
titleFormate.setAlignment(jxl.format.Alignment.CENTRE);// 单元格中的内容水平方向居中
titleFormate.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 单元格的内容垂直方向居中
Label title = new Label(0, 0, "互联网认证信息", titleFormate);
sheet.setRowView(0, 600, false);// 设置第一行的高度
sheet.addCell(title);
sheet.addCell(new Label(0, 1, "序列号"));
sheet.addCell(new Label(1, 1, "认证编号"));
sheet.addCell(new Label(2, 1, "企业名称"));
sheet.addCell(new Label(3, 1, "联系人"));
sheet.addCell(new Label(4, 1, "手机号码"));
sheet.addCell(new Label(5, 1, "所属地市"));
sheet.addCell(new Label(6, 1, "所属区县"));
sheet.addCell(new Label(7, 1, "申请时间"));
sheet.addCell(new Label(8, 1, "审核状态"));
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
for (int i = 0; i < list.size(); i++) {
sheet.addCell(new Label(0, i + 2, i + 1 + ""));
sheet.addCell(new Label(1, i + 2, trim(list.get(i).getAuthId())));
sheet.addCell(new Label(2, i + 2, trim(list.get(i).getCorpName())));
sheet.addCell(new Label(3, i + 2, trim(list.get(i).getLinkName())));
sheet.addCell(new Label(4, i + 2, trim(list.get(i).getLinkTel())));
if (null != list.get(i).getCorpCity() && !"".equals(list.get(i).getCorpCity())) {
try {
DictionaryVo dictionaryVo = dictionaryInterface.findDictionaryByDictIdAndKey(Constants.DICTIONARYID, list.get(i).getCorpCity());
if (null != dictionaryVo) {
sheet.addCell(new Label(5, i + 2, trim(dictionaryVo.getDictKeyDesc())));
}
} catch (Exception e) {
logger.error("导出excel查询字典地市失败", e);
}
} else {
sheet.addCell(new Label(5, i + 2, ""));
}
if (null != list.get(i).getCorpArea() && !"".equals(list.get(i).getCorpArea())) {
try {
DictionaryVo dictionaryVo1 = dictionaryInterface.findDictionaryByDictIdAndKey(Constants.DICTIONARYID, list.get(i).getCorpArea());
if (null != dictionaryVo1) {
sheet.addCell(new Label(6, i + 2, trim(dictionaryVo1.getDictKeyDesc())));
}
} catch (Exception e) {
logger.error("导出excel查询字典区县失败", e);
}
} else {
sheet.addCell(new Label(6, i + 2, ""));
}
if (null != list.get(i).getRegistDate() && !"".equals(list.get(i).getRegistDate())) {
String str = sdf.format(list.get(i).getRegistDate());
sheet.addCell(new Label(7, i + 2, str));
} else {
sheet.addCell(new Label(7, i + 2, ""));
}
String dealFlag = "";
String getDealFlag = list.get(i).getDealFlag();
if (null != getDealFlag && !"".equals(getDealFlag)) {
if (Constants.DISHIADMIN.equals(roleId)) {
if ("2".equals(getDealFlag)) {
dealFlag = "未下发";
} else if ("3".equals(getDealFlag)) {
dealFlag = "已下发";
}
} else if (Constants.QUXIANADMIN.equals(roleId)) {
if ("3".equals(getDealFlag)) {
dealFlag = "待分配";
} else if ("4".equals(getDealFlag)) {
dealFlag = "待反馈";
} else if ("5".equals(getDealFlag)) {
dealFlag = "待开通";
} else if ("6".equals(getDealFlag)) {
dealFlag = "不开通";
} else if ("7".equals(getDealFlag)) {
dealFlag = "已开通";
}
} else if (Constants.CUSTOMADMIN.equals(roleId)) {
if ("4".equals(getDealFlag)) {
dealFlag = "待反馈";
} else if ("5".equals(getDealFlag)) {
dealFlag = "待开通";
} else if ("6".equals(getDealFlag)) {
dealFlag = "不开通";
}
}
}
sheet.addCell(new Label(8, i + 2, dealFlag));
}
wwb.write();
wwb.close();
byte[] b = os.toByteArray();
os.close();
return b;
}
/**
* trim
*
* @param obj
* @return
* @author liujm
*/
public static String trim(Object obj) {
return (obj == null) ? "" : obj.toString().trim();
}
}
| [
"2424693824@qq.com"
] | 2424693824@qq.com |
9d01ac91c65dd5a990c53ccc16b14c961544a8e5 | 24356ccf08e4023dca94f1593ab4498f914c6ef4 | /common-utils/src/main/java/com/soa/mfc/common/pojo/MfcResult.java | 132127a882550683cc887b506d28282ddc2ea180 | [] | no_license | menfengchao/integrat_project_mfc_SOA | c47ffce572c322a2db45fb578b5edcbf3cc562df | e8ea15a6ad696bb73e9eca74b296971a39f291fa | refs/heads/master | 2020-03-15T10:28:54.118114 | 2018-05-14T08:01:38 | 2018-05-14T08:01:38 | 132,095,120 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,666 | java | package com.soa.mfc.common.pojo;
import java.io.Serializable;
import java.util.List;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
/**
* 自定义响应结构
*/
public class MfcResult implements Serializable{
// 定义jackson对象
private static final ObjectMapper MAPPER = new ObjectMapper();
// 响应业务状态
private Integer status;
// 响应消息
private String msg;
// 响应中的数据
private Object data;
public MfcResult() {}
public MfcResult(Object data) {
this.status = 200;
this.msg = "OK";
this.data = data;
}
public MfcResult(Integer status, String msg, Object data) {
this.status = status;
this.msg = msg;
this.data = data;
}
public static MfcResult ok() {
return new MfcResult(null);
}
public static MfcResult ok(Object data) {
return new MfcResult(data);
}
public static MfcResult build(Integer status, String msg, Object data) {
return new MfcResult(status, msg, data);
}
public static MfcResult build(Integer status, String msg) {
return new MfcResult(status, msg, null);
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
/**
* 将json结果集转化为MfcResult对象
* @param jsonData json数据
* @param clazz MfcResult中的object类型
* @return
*/
public static MfcResult formatToPojo(String jsonData, Class<?> clazz) {
try {
if (clazz == null) {
return MAPPER.readValue(jsonData, MfcResult.class);
}
JsonNode jsonNode = MAPPER.readTree(jsonData);
JsonNode data = jsonNode.get("data");
Object obj = null;
if (clazz != null) {
if (data.isObject()) {
obj = MAPPER.readValue(data.traverse(), clazz);
} else if (data.isTextual()) {
obj = MAPPER.readValue(data.asText(), clazz);
}
}
return build(jsonNode.get("status").intValue(), jsonNode.get("msg").asText(), obj);
} catch (Exception e) {
return null;
}
}
/**
* 没有object对象的转化
* @param json
* @return
*/
public static MfcResult format(String json) {
try {
return MAPPER.readValue(json, MfcResult.class);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* Object是集合转化
*
* @param jsonData json数据
* @param clazz 集合中的类型
* @return
*/
public static MfcResult formatToList(String jsonData, Class<?> clazz) {
try {
JsonNode jsonNode = MAPPER.readTree(jsonData);
JsonNode data = jsonNode.get("data");
Object obj = null;
if (data.isArray() && data.size() > 0) {
obj = MAPPER.readValue(data.traverse(),
MAPPER.getTypeFactory().constructCollectionType(List.class, clazz));
}
return build(jsonNode.get("status").intValue(), jsonNode.get("msg").asText(), obj);
} catch (Exception e) {
return null;
}
}
}
| [
"549514557@qq.com"
] | 549514557@qq.com |
3325823d9546d96404bf17068a699e4aa1dc4d49 | 49d567a7c51da3ad6bdf45acfcfd14e8656bf621 | /src/main/java/MaxConsecutiveOnes.java | 7bd02f8b9f26abb90a4aafa426393cbe186d0586 | [] | no_license | nassimbg/Problems | 8528c05c3f47996f045eb8bf4d1a56271e04de45 | 6c0fb58ae46e66bce6537ea606b6677d2f1ba399 | refs/heads/master | 2021-06-06T09:04:51.633473 | 2021-03-10T10:01:36 | 2021-03-10T10:01:36 | 93,439,590 | 0 | 1 | null | 2020-11-15T11:37:57 | 2017-06-05T19:37:27 | Java | UTF-8 | Java | false | false | 399 | java | public class MaxConsecutiveOnes {
public static int findMaxConsecutiveOnes(int[] nums) {
int max = 0;
int current = 0;
for (int index = 0; index < nums.length; index++) {
if (nums[index] == 0) {
max = Math.max(max ,current);
current = 0;
} else {
current++;
}
}
return Math.max(max, current);
}
}
| [
"nassim.boughannam@murex.com"
] | nassim.boughannam@murex.com |
62be273e85c154e5c7a3c651a0eb45448c097022 | 6d6f988ac4ecd4a39b41a622c797924b5e8bf912 | /androidx-annotation/src/main/java/androidx/annotation/LayoutRes.java | d27142b0cb0d863b611389f172c7ff468d598b2b | [] | no_license | keeponZhang/JetPack | bbb9985abdc90330725aef8f472d51c51fa99786 | ef0726e643922206d79f7c322f3079fd1a41737d | refs/heads/master | 2021-02-05T13:55:01.712693 | 2020-03-05T07:53:46 | 2020-03-05T07:53:46 | 243,787,969 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,339 | java | /*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package androidx.annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.LOCAL_VARIABLE;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.RetentionPolicy.CLASS;
/**
* Denotes that an integer parameter, field or method return value is expected
* to be a layout resource reference (e.g. {@code android.R.layout.list_content}).
*/
@Documented
@Retention(CLASS)
@Target({METHOD, PARAMETER, FIELD, LOCAL_VARIABLE})
public @interface LayoutRes {
}
| [
"zhangwengao@yy.com"
] | zhangwengao@yy.com |
bc61783c6903482774aefb08359a5ecf7c7a4792 | 008faf00f6547ccd54dc7349ac52022ebc0d2416 | /EncuentraloFacil/EncuentraloFacil/src/java/cl/encuentraloFacil/aplicacion/Controlador/BeanRegistro.java | 9e38d636f7cbb85337d55420430c7ea7836fbe56 | [] | no_license | mariogoz/ENCUENTRALOFACIL | b2a1650b139b1a01d628946b1972e0f2f33f9ad8 | e8560603c6eb4b8719ad6849fe3254e6cdc19318 | refs/heads/master | 2021-01-10T07:14:02.584414 | 2015-12-07T04:23:33 | 2015-12-07T04:23:33 | 43,212,742 | 1 | 1 | null | 2015-11-04T17:47:00 | 2015-09-26T16:17:40 | Java | UTF-8 | Java | false | false | 4,407 | 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 cl.encuentraloFacil.aplicacion.Controlador;
import cl.encuentraloFacil.aplicacion.Business.AutoAdminBusiness;
import cl.encuentraloFacil.aplicacion.Business.UsuarioBusiness;
import cl.encuentraloFacil.aplicacion.TO.ClienteTO;
import cl.encuentraloFacil.aplicacion.util.Properties;
import cl.encuentraloFacil.aplicacion.util.ValidateRut;
import java.io.Serializable;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.context.FacesContext;
import org.apache.log4j.Logger;
/**
*
* @author Mario
*/
@ManagedBean
@RequestScoped
public class BeanRegistro implements Serializable {
final static Logger logger = Logger.getLogger(BeanRegistro.class);
private ClienteTO cliente = new ClienteTO();
private String dvView;
private FacesMessage msg;
private FacesContext context;
AutoAdminBusiness adminBusiness = new AutoAdminBusiness();
/**
* Creates a new instance of BeanRegistro
*/
public BeanRegistro() {
}
public void validarRut() {
context = FacesContext.getCurrentInstance();
if (getCliente() != null && getCliente().getDv() != ' ' && getCliente().getRut() != null) {
if (!ValidateRut.ValidarRut(getCliente().getRut(), getCliente().getDv())) {
msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Rut no valido", null);
context.addMessage(null, msg);
}
} else {
msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Rut no valido", null);
context.addMessage(null, msg);
}
}
public Boolean findExisteUsuario() {
UsuarioBusiness usuerBusiness = new UsuarioBusiness();
Boolean existe = usuerBusiness.getExisteUsuario(getCliente());
return existe;
}
public Integer findExisteRut() {
UsuarioBusiness usuerBusiness = new UsuarioBusiness();
Integer existe = usuerBusiness.getExisteRut(getCliente());
return existe;
}
public void registrarCliente() {
context = FacesContext.getCurrentInstance();
String replace = dvView.replaceAll("\\.", "");
String[] valores = replace.split("-");
Integer valorRut = Integer.parseInt(valores[0]);
char dv = valores[1].charAt(0);
getCliente().setRut(valorRut);
getCliente().setDv(dv);
Integer isRut = findExisteRut();
if (isRut.equals(1)) {
Boolean isExiste = findExisteUsuario();
if (isExiste) {
msg = new FacesMessage(FacesMessage.SEVERITY_WARN, Properties.getProperty("usuario.registro.usuario"), null);
context.addMessage(null, msg);
} else {
Boolean isRegistro = adminBusiness.insertClienteUsuario(getCliente());
if (isRegistro) {
logger.info("Registro Exitoso");
setCliente(null);
msg = new FacesMessage(FacesMessage.SEVERITY_INFO, Properties.getProperty("usuario.registro.exito"), null);
context.addMessage(null, msg);
} else {
msg = new FacesMessage(FacesMessage.SEVERITY_WARN, Properties.getProperty("beanlogin.autentificacion.error"), null);
context.addMessage(null, msg);
}
}
} else {
msg = new FacesMessage(FacesMessage.SEVERITY_WARN, Properties.getProperty("usuario.registro.rut"), null);
context.addMessage(null, msg);
}
}
public void limpiarRegistro() {
setCliente(null);
}
public String redireccionarRegistro() {
return "";
}
/**
* @return the cliente
*/
public ClienteTO getCliente() {
return cliente;
}
/**
* @param cliente the cliente to set
*/
public void setCliente(ClienteTO cliente) {
this.cliente = cliente;
}
/**
* @return the dvView
*/
public String getDvView() {
return dvView;
}
/**
* @param dvView the dvView to set
*/
public void setDvView(String dvView) {
this.dvView = dvView;
}
}
| [
"mariogoz@gmail.com"
] | mariogoz@gmail.com |
dc47d385c955a95982e4303f676b732963b484bb | 1dc54278cd6c0975ecef7edbd1fd157ef13725e9 | /src/main/java/LeetCode/MiddleOfTheLinkedList.java | b0e3610220f035a38d25d0c80cb8fee631b687b6 | [] | no_license | Sean-Xiao-Liu/JavaBasic | 13f49c89f2bec0d8449dfeadc5610781b556a8b8 | 2a28ef2481cd3d58d12cbbcd3110aeb9d27b96fd | refs/heads/master | 2023-03-19T04:56:21.787528 | 2023-03-06T23:04:06 | 2023-03-06T23:04:06 | 206,166,529 | 1 | 0 | null | 2022-09-08T01:03:57 | 2019-09-03T20:28:36 | Java | UTF-8 | Java | false | false | 1,331 | java | package LeetCode;
public class MiddleOfTheLinkedList {
//method 1 get count and iterate to the first
public static ListNode middleNode(ListNode head) {
if( head == null || head.next == null) return head;
ListNode fast = head;
ListNode slow = head;
int count = 0;
while (fast != null){
fast = fast.next;
count++;
}
int midpoint = count / 2;
for(int i = 0 ; i < midpoint; i++){
slow = slow.next;
}
return slow;
}
//method 2 fast and slew pointer at 1 pass
public static ListNode middleNode2(ListNode head){
if( head == null || head.next == null) return head;
ListNode fast = head;
ListNode slow = head;
while(fast.next != null){
fast = fast.next.next;
slow = slow.next;
if(fast == null) break;
}
return slow;
}
public static void main(String[] args) {
ListNode head = new ListNode(1);
head.next = new ListNode(2);
// head.next.next = new ListNode(3);
// head.next.next.next = new ListNode(4);
// head.next.next.next.next = new ListNode(5);
// head.next.next.next.next.next = new ListNode(6);
System.out.println(middleNode2(head).val);
}
}
| [
"glxiaoliu@gmail.com"
] | glxiaoliu@gmail.com |
52ccb5bd9947e8f5e8d194556a99ee28d6457bce | d3a7d2711f6f7675ab938a6d9cee713f74797393 | /javaExercise/part12/ex14/OnOffSwitch.java | a38be8562f476dc7195584003f329052d504c89f | [] | no_license | iMeiji/Exercise-of-Thinking-in-JAVA | a2b2ab2c1801a576fecacfb741c0a484f25c306b | b071ca613929488d31edc0a300e9b2a1c553ec58 | refs/heads/master | 2021-01-21T02:50:02.483136 | 2015-11-18T15:06:03 | 2015-11-18T15:06:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 778 | java | package part12.ex14;//: exceptions/OnOffSwitch.java
// Why use finally?
public class OnOffSwitch {
private static Switch sw = new Switch();
public static void f() throws OnOffException1, OnOffException2 {
throw new RuntimeException();
}
public static void main(String[] args) {
try {
sw.on();
// Code that can throw exceptions...
f();
sw.off();
} catch (OnOffException1 e) {
System.out.println("OnOffException1");
sw.off();
} catch (OnOffException2 e) {
System.out.println("OnOffException2");
sw.off();
} catch (RuntimeException e) {
System.err.println("sw not off");
}
}
} /* Output:
on
off
*///:~
| [
"1398738509@qq.com"
] | 1398738509@qq.com |
4db137dec2cebf3696f0f281c6599bff6670fd5b | a009c746766f78d91ca870b77b69b324c90df840 | /eshop-auth/src/main/java/com/iiit/action/springcloud/eshop/auth/config/druid/DruidConfiguration.java | 40dbc69ade2b14daf5c5b7afc998a99bf8be57b8 | [] | no_license | anglabace/iiit.action.springcloud.zuul.jwt.oauth2.mybatis.mysql.redis.druid | 912c60ecedae8b3879975a35e51245ff6f7b7b92 | 0b4cc04c9cf197a543cb2c5b2fc7d1abd3ab0c2c | refs/heads/master | 2020-08-09T20:18:47.080091 | 2019-04-26T07:50:49 | 2019-04-26T07:50:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,790 | java | package com.iiit.action.springcloud.eshop.auth.config.druid;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.support.http.StatViewServlet;
import com.alibaba.druid.support.http.WebStatFilter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import javax.sql.DataSource;
import java.sql.SQLException;
/**
* 〈druid连接池配置〉
*
* @author rengang
* @create 2018/12/13
* @since 1.0.0
*/
@Configuration
public class DruidConfiguration {
@Value("${spring.datasource.url}")
private String url;
@Value("${spring.datasource.username}")
private String username;
@Value("${spring.datasource.password}")
private String password;
@Value("${spring.datasource.driver-class-name}")
private String driverClassName;
@Value("${spring.druid.initialSize}")
private int initialSize;
@Value("${spring.druid.minIdle}")
private int minIdle;
@Value("${spring.druid.maxActive}")
private int maxActive;
@Value("${spring.druid.maxWait}")
private int maxWait;
@Value("${spring.druid.timeBetweenEvictionRunsMillis}")
private int timeBetweenEvictionRunsMillis;
@Value("${spring.druid.minEvictableIdleTimeMillis}")
private int minEvictableIdleTimeMillis;
@Value("${spring.druid.validationQuery}")
private String validationQuery;
@Value("${spring.druid.testWhileIdle}")
private boolean testWhileIdle;
@Value("${spring.druid.testOnBorrow}")
private boolean testOnBorrow;
@Value("${spring.druid.testOnReturn}")
private boolean testOnReturn;
@Value("${spring.druid.poolPreparedStatements}")
private boolean poolPreparedStatements;
@Value("${spring.druid.maxPoolPreparedStatementPerConnectionSize}")
private int maxPoolPreparedStatementPerConnectionSize;
@Value("${spring.druid.filters}")
private String filters;
@Value("{spring.druid.connectionProperties}")
private String connectionProperties;
@Bean
@Primary
public DataSource dataSource() {
DruidDataSource datasource = new DruidDataSource();
datasource.setUrl(url);
datasource.setUsername(username);
//这里可以做加密处理
datasource.setPassword(password);
datasource.setDriverClassName(driverClassName);
//configuration
datasource.setInitialSize(initialSize);
datasource.setMinIdle(minIdle);
datasource.setMaxActive(maxActive);
datasource.setMaxWait(maxWait);
datasource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
datasource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);
datasource.setValidationQuery(validationQuery);
datasource.setTestWhileIdle(testWhileIdle);
datasource.setTestOnBorrow(testOnBorrow);
datasource.setTestOnReturn(testOnReturn);
datasource.setPoolPreparedStatements(poolPreparedStatements);
datasource.setMaxPoolPreparedStatementPerConnectionSize(maxPoolPreparedStatementPerConnectionSize);
try {
datasource.setFilters(filters);
} catch (SQLException e) {
}
datasource.setConnectionProperties(connectionProperties);
return datasource;
}
@Bean
public ServletRegistrationBean statViewServlet() {
ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new StatViewServlet(), "/druid/*");
//设置ip白名单
servletRegistrationBean.addInitParameter("allow", "127.0.0.1");
//设置ip黑名单,优先级高于白名单
servletRegistrationBean.addInitParameter("deny", "192.168.0.19");
//设置控制台管理用户
servletRegistrationBean.addInitParameter("loginUsername", "root");
servletRegistrationBean.addInitParameter("loginPassword", "root");
//是否可以重置数据
servletRegistrationBean.addInitParameter("resetEnable", "false");
return servletRegistrationBean;
}
@Bean
public FilterRegistrationBean statFilter() {
//创建过滤器
FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean(new WebStatFilter());
//设置过滤器过滤路径
filterRegistrationBean.addUrlPatterns("/*");
//忽略过滤的形式
filterRegistrationBean.addInitParameter("exclusions", "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*");
return filterRegistrationBean;
}
}
| [
"rengang66@sina.com"
] | rengang66@sina.com |
72b5d76d70b87073e7571531a554aa71193bd1d7 | 605c28cc4d7ffd35583f6aba8cc58c7068f237e2 | /src/com/dxjr/portal/autoInvestConfig/vo/AutoInvestConfigRecordVo.java | 1e80d1dcde2cc281a88c4938903e12d64820ac60 | [] | no_license | Lwb6666/dxjr_portal | 7ffb56c79f0bd07a39ac94f30b2280f7cc98a2e4 | cceef6ee83d711988e9d1340f682e0782e392ba0 | refs/heads/master | 2023-04-21T07:38:25.528219 | 2021-05-10T02:47:22 | 2021-05-10T02:47:22 | 351,003,513 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,334 | java | package com.dxjr.portal.autoInvestConfig.vo;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import com.dxjr.utils.DateUtils;
public class AutoInvestConfigRecordVo implements Serializable {
private static final long serialVersionUID = -5816997501577003675L;
/**
* 主键Id
*/
private Integer id;
/**
* 自动投标规则Id
*/
private Integer auto_tender_id;
/**
* 用户Id
*/
private Integer user_id;
/**
* 是否启用 (0:不启用,1:启用)
*/
private int status;
/**
* 自动投标方式 (1:按金额投标,2:按比例投标, 3:按余额投标)
*/
private int tender_type;
/**
* 借款还款方式(0:没有限制, 1:按月分期还款,2:按月付息到期还本 , 3:到期还本付息,4:按天还款)
*/
private int borrow_type;
/**
* 借款期限无限定状态(0:未选中,1:已选中)
*/
private int timelimit_status;
/**
* 最短借款月数
*/
private int min_time_limit;
/**
* 最长借款月数
*/
private int max_time_limit;
/**
* 最短借款天数
*/
private int min_day_limit;
/**
* 最长借款天数
*/
private int max_day_limit;
/**
* 单笔最低投标金额
*/
private BigDecimal min_tender_account;
/**
* 自动投标金额
*/
private BigDecimal tender_account_auto;
/**
* 投标比例
*/
private double tender_scale;
/**
* 投标奖励比例,默认为0,表示不考虑是否有简历 (该字段作废)
*/
private BigDecimal award_flag;
/**
* 当余额不足的情况下如何处理 1、余额全部投 2、不参与本次投标
*/
private int balance_not_enough;
/**
* 时间,默认系统生成时间
*/
private String settime;
/**
* Ip地址、系统抓起
*/
private String setip;
/**
* 最小年化收益率
*/
private BigDecimal min_apr;
/**
* 最大年化收益率
*/
private BigDecimal max_apr;
/**
* 推荐标状态(0:无,1:选中)
*/
private int borrow_type1_status;
/**
* 抵押标状态(0:无,1:选中)
*/
private int borrow_type2_status;
/**
* 净值标状态(0:无,1:选中)
*/
private int borrow_type3_status;
/**
* 秒标状态(0:无,1:选中)
*/
private int borrow_type4_status;
/**
* 排队时间
*/
private String uptime;
/**
* 排队号
*/
private Integer rownum;
/**
* 添加时间
*/
private Date addtime;
/**
* 记录类型(0:新建,1:修改,2:投标成功,3:删除)
*/
private int record_type;
/**
* 备注
*/
private String remark;
/**
* 自动投标记录Id
*/
private Integer tender_record_id;
/**
* 投标金额
*/
private BigDecimal tender_record_accout;
/**
* 担保标状态(0:无,1:选中)
*/
private int borrow_type5_status;
/**
* 借款标id
*/
private Integer borrowId;
/**
* 借款标名称
*/
private String borrowName;
/**
* 自动类型(1:按抵押标、担保标投标,2:按净值标、信用标投标)
*/
private Integer autoType;
private Integer borrowType;
private String borrowTypeStr;
/**
* VIP会员等级【1:终身顶级会员会员,0:普通vip会员】
*/
private Integer vipLevel;
private String addtimeStamp;
/**
* 平台来源(1:网页 2:微信 3:安卓端 4: IOS端)
*/
private Integer platform;
/**
* 是否使用活期宝(0:未使用;1:使用;)
*/
private Integer isUseCur;
private Integer custodyFlag;
public Integer getCustodyFlag() {
return custodyFlag;
}
public void setCustodyFlag(Integer custodyFlag) {
this.custodyFlag = custodyFlag;
}
public Integer getIsUseCur() {
return isUseCur;
}
public void setIsUseCur(Integer isUseCur) {
this.isUseCur = isUseCur;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getAuto_tender_id() {
return auto_tender_id;
}
public void setAuto_tender_id(Integer auto_tender_id) {
this.auto_tender_id = auto_tender_id;
}
public Integer getUser_id() {
return user_id;
}
public void setUser_id(Integer user_id) {
this.user_id = user_id;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public int getTender_type() {
return tender_type;
}
public void setTender_type(int tender_type) {
this.tender_type = tender_type;
}
public int getBorrow_type() {
return borrow_type;
}
public void setBorrow_type(int borrow_type) {
this.borrow_type = borrow_type;
}
public int getTimelimit_status() {
return timelimit_status;
}
public void setTimelimit_status(int timelimit_status) {
this.timelimit_status = timelimit_status;
}
public int getMin_time_limit() {
return min_time_limit;
}
public void setMin_time_limit(int min_time_limit) {
this.min_time_limit = min_time_limit;
}
public int getMax_time_limit() {
return max_time_limit;
}
public void setMax_time_limit(int max_time_limit) {
this.max_time_limit = max_time_limit;
}
public int getMin_day_limit() {
return min_day_limit;
}
public void setMin_day_limit(int min_day_limit) {
this.min_day_limit = min_day_limit;
}
public int getMax_day_limit() {
return max_day_limit;
}
public void setMax_day_limit(int max_day_limit) {
this.max_day_limit = max_day_limit;
}
public BigDecimal getTender_account_auto() {
return tender_account_auto;
}
public void setTender_account_auto(BigDecimal tender_account_auto) {
this.tender_account_auto = tender_account_auto;
}
public BigDecimal getAward_flag() {
return award_flag;
}
public void setAward_flag(BigDecimal award_flag) {
this.award_flag = award_flag;
}
public int getBalance_not_enough() {
return balance_not_enough;
}
public void setBalance_not_enough(int balance_not_enough) {
this.balance_not_enough = balance_not_enough;
}
public String getSettime() {
return settime;
}
public void setSettime(String settime) {
this.settime = settime;
}
public String getSetip() {
return setip;
}
public void setSetip(String setip) {
this.setip = setip;
}
public BigDecimal getMin_apr() {
return min_apr;
}
public void setMin_apr(BigDecimal min_apr) {
this.min_apr = min_apr;
}
public BigDecimal getMax_apr() {
return max_apr;
}
public void setMax_apr(BigDecimal max_apr) {
this.max_apr = max_apr;
}
public int getBorrow_type1_status() {
return borrow_type1_status;
}
public void setBorrow_type1_status(int borrow_type1_status) {
this.borrow_type1_status = borrow_type1_status;
}
public int getBorrow_type2_status() {
return borrow_type2_status;
}
public void setBorrow_type2_status(int borrow_type2_status) {
this.borrow_type2_status = borrow_type2_status;
}
public int getBorrow_type3_status() {
return borrow_type3_status;
}
public void setBorrow_type3_status(int borrow_type3_status) {
this.borrow_type3_status = borrow_type3_status;
}
public int getBorrow_type4_status() {
return borrow_type4_status;
}
public void setBorrow_type4_status(int borrow_type4_status) {
this.borrow_type4_status = borrow_type4_status;
}
public String getUptime() {
return uptime;
}
public void setUptime(String uptime) {
this.uptime = uptime;
}
public Integer getRownum() {
return rownum;
}
public void setRownum(Integer rownum) {
this.rownum = rownum;
}
public BigDecimal getMin_tender_account() {
return min_tender_account;
}
public void setMin_tender_account(BigDecimal min_tender_account) {
this.min_tender_account = min_tender_account;
}
public double getTender_scale() {
return tender_scale;
}
public void setTender_scale(double tender_scale) {
this.tender_scale = tender_scale;
}
public Date getAddtime() {
return addtime;
}
public void setAddtime(Date addtime) {
this.addtime = addtime;
}
public int getRecord_type() {
return record_type;
}
public void setRecord_type(int record_type) {
this.record_type = record_type;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public Integer getTender_record_id() {
return tender_record_id;
}
public void setTender_record_id(Integer tender_record_id) {
this.tender_record_id = tender_record_id;
}
public BigDecimal getTender_record_accout() {
return tender_record_accout;
}
public void setTender_record_accout(BigDecimal tender_record_accout) {
this.tender_record_accout = tender_record_accout;
}
public int getBorrow_type5_status() {
return borrow_type5_status;
}
public void setBorrow_type5_status(int borrow_type5_status) {
this.borrow_type5_status = borrow_type5_status;
}
public Integer getBorrowId() {
return borrowId;
}
public void setBorrowId(Integer borrowId) {
this.borrowId = borrowId;
}
public String getBorrowName() {
return borrowName;
}
public void setBorrowName(String borrowName) {
this.borrowName = borrowName;
}
public Integer getBorrowType() {
return borrowType;
}
public void setBorrowType(Integer borrowType) {
this.borrowType = borrowType;
}
public String getBorrowTypeStr() {
if (null != borrowType) {
if (borrowType == 1) {
return "推荐标";
} else if (borrowType == 2) {
return "抵押标";
} else if (borrowType == 3) {
return "净值标";
} else if (borrowType == 4) {
return "秒标";
} else if (borrowType == 5) {
return "担保标";
}
}
return "";
}
public void setBorrowTypeStr(String borrowTypeStr) {
this.borrowTypeStr = borrowTypeStr;
}
public Integer getAutoType() {
return autoType;
}
public void setAutoType(Integer autoType) {
this.autoType = autoType;
}
public Integer getVipLevel() {
return vipLevel;
}
public void setVipLevel(Integer vipLevel) {
this.vipLevel = vipLevel;
}
public String getAddtimeStamp() {
if (addtime != null) {
return String.valueOf(DateUtils.dateTime2TimeStamp(DateUtils.format(addtime, DateUtils.YMD_HMS)));
}
return addtimeStamp;
}
public void setAddtimeStamp(String addtimeStamp) {
this.addtimeStamp = addtimeStamp;
}
public Integer getPlatform() {
return platform;
}
public void setPlatform(Integer platform) {
this.platform = platform;
}
}
| [
"1677406532@qq.com"
] | 1677406532@qq.com |
cd3a0f83c3ad0b66664e17b8a9fca7337cd270bc | ac0172e3bc37ce4bd7f5a8c1181b1ca8e9f02225 | /src/d200204/ForTest3.java | bdcda43d70be1e56b7ef082242e69132b237756b | [] | no_license | lsh829/java-2020-academy | 83db5c824e6079dfee7e518ced3d274b1afbb296 | f9fe6849b91ca38c5501479b86dd95a2c1204f58 | refs/heads/master | 2021-01-03T19:31:38.764369 | 2020-02-13T07:17:39 | 2020-02-13T07:25:07 | null | 0 | 0 | null | null | null | null | UHC | Java | false | false | 199 | java | package d200204;
public class ForTest3 {
public static void main(String[] args) {
//짝수만 출력하는 프로그램 작성
for(int i=2;i<=10;i+=2){
System.out.printf("%d\t",i);
}
}
}
| [
"inegg.apps@gmail.com"
] | inegg.apps@gmail.com |
18865ec3d53346c2fe3730cdb9360df28487ca2b | afc60cceedd877bf66da5b09b0deedb9f5386148 | /TTSCoach/app/src/main/java/com/example/ttscoach/GoFragment.java | 790065575e24e776d3418e702da8a83302482eb5 | [] | no_license | RossmacD/AndroidCollege | 988384175945f586b6a5066850590b7378762932 | 4304f6e995d8f7ff5dfe38494f7af6bd9f221c8e | refs/heads/master | 2020-09-10T15:14:29.153083 | 2020-05-05T20:01:03 | 2020-05-05T20:01:03 | 221,734,899 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,701 | java | package com.example.ttscoach;
import android.os.Build;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProviders;
import android.os.Handler;
import android.os.Looper;
import android.speech.tts.TextToSpeech;
import android.speech.tts.UtteranceProgressListener;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.example.ttscoach.database.Exercise;
import com.example.ttscoach.database.ExercisesViewModel;
import com.example.ttscoach.databinding.FragmentGoBinding;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
/**
* A simple {@link Fragment} subclass.
*/
public class GoFragment extends Fragment {
private List<Exercise> exercises;
private TextView goText,nameText,countText,setText;
private ProgressBar progressBar;
private Button stopButton;
private Boolean stopped, speaking;
TextToSpeech tts;
Handler handler;
public GoFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
speaking=false;
ExercisesViewModel viewModel = ViewModelProviders.of(this).get(ExercisesViewModel.class);
//Live Data is shown in the fragment
viewModel.getExercise().observe(getActivity(), this::setExercises);
//get handle to main loop
handler=new Handler(Looper.getMainLooper());
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_go, container, false);
}
@Override
public void onResume() {
super.onResume();
//Hide Toolbar
((AppCompatActivity)getActivity()).getSupportActionBar().hide();
}
@Override
public void onStop() {
super.onStop();
//Add Tool bar back in
((AppCompatActivity)getActivity()).getSupportActionBar().show();
//Kill Thread tasks
stopped=true;
}
public void setExercises(List<Exercise> exercises) {
this.exercises = exercises;
if(getActivity()!=null){
startSession();
}
}
public void startSession(){
//Get views
nameText=getActivity().findViewById(R.id.nameText);
countText=getActivity().findViewById(R.id.countText);
goText=getActivity().findViewById(R.id.goText);
setText=getActivity().findViewById(R.id.setText);
progressBar=getActivity().findViewById(R.id.progressBar);
stopButton=getActivity().findViewById(R.id.stopButton);
//Kill switch
stopButton.setOnClickListener((view) -> {
stopped=true;
}
);
prepareTTS();
speaking=true;
stopped=false;
new Thread(() -> {
while (speaking && !stopped){
//Do nothing - wait till talking has stopped
}
for(Exercise exercise : exercises){
ConvertTextToSpeech("Now starting"+exercise.getName());
while (speaking && !stopped){
//Do nothing - wait till talking has stopped
}
//Update UI thread
handler.post(() -> {
goText.setText("GO!");
countText.setBackgroundResource(R.drawable.circle);
});
for(int setCount=1;setCount<=exercise.getSets();setCount++) {
//Check if the loop should be killed
if(stopped){
break;
}
final int finalSetCount=setCount;
ConvertTextToSpeech("Set "+setCount+", GO!");
while (speaking && !stopped){
//Do nothing - wait till speaking has stopped
}
//Make changes in UI thread
handler.post(() -> {
goText.setText("GO!");
countText.setBackgroundResource(R.drawable.circle);
});
for (int repCount = 1; repCount <= exercise.getReps(); repCount++) {
//Stop task when button pressed
if(stopped){
break;
}
//Set vars for passing into ui thread
final int finalRepCount=repCount;
handler.post(() -> {
nameText.setText(""+exercise.getName());
countText.setText(""+finalRepCount);
//Set Progress value, animate if version allows it to
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
progressBar.setProgress( Math.round((finalRepCount*100)/exercise.getReps()),true);
}else{
progressBar.setProgress( Math.round((finalRepCount*100)/exercise.getReps()));
}
setText.setText("Set: "+finalSetCount+"/"+exercise.getSets());
ConvertTextToSpeech(""+finalRepCount);
});
//Wait
try {
Thread.sleep(exercise.getInterval()*1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
handler.post(() -> {
goText.setText("Break");
countText.setText(""+exercise.getSetBreak());
countText.setBackgroundResource(R.drawable.circle_red);
});
if(stopped){
break;
}
ConvertTextToSpeech("Set complete,Take a "+exercise.getSetBreak()+" seconds break!");
//Wait
try {
Thread.sleep(exercise.getSetBreak()*1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
ConvertTextToSpeech("Exercise complete, well done");
}).start();
}
/**
* Initialise TTS & add listener
*/
private void prepareTTS(){
tts=new TextToSpeech(getActivity(), status -> {
if(status == TextToSpeech.SUCCESS){
Log.e("RossTTs", "success");
//Listener to see if TTS is still speaking
tts.setOnUtteranceProgressListener(new UtteranceProgressListener() {
//If TTS is Done
@Override
public void onDone(String utteranceId) {
speaking=false;
Log.e("RossTTs", "Done");
}
//If TTS has an error
@Override
public void onError(String utteranceId) {
speaking=false;
}
//Runs when TTS is started
@Override
public void onStart(String utteranceId) {
speaking=true;
}
});
//Set the TTS language
int result=tts.setLanguage(Locale.US);
//If there is an error loading the language
if(result==TextToSpeech.LANG_MISSING_DATA ||
result==TextToSpeech.LANG_NOT_SUPPORTED){
Log.e("RossTTs", "This Language is not supported");
}
else{
//Run first TTS Command
ConvertTextToSpeech("Lets Begin");
}
}
else
//Error Catch
Log.e("RossTTs", "Initilization Failed!");
});
}
private void ConvertTextToSpeech(String s) {
speaking=true;
//The string is put into a hash map and queued - ID is irrelevent but needed for the listener
HashMap<String, String> map = new HashMap<String, String>();
map.put(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, "UniqueID");
tts.speak(s, TextToSpeech.QUEUE_FLUSH, map);
}
}
| [
"42966821+RossmacD@users.noreply.github.com"
] | 42966821+RossmacD@users.noreply.github.com |
064e26285cfe082c732a33c80a96b672b58a11a6 | 262fe922a5cdb5d026c09144b86174f6cda27970 | /app/src/main/java/unii/entertainment/teammaker/wizard/view/CategoryWizardFragment.java | f044ca6c241c256052a3b17649d9d585e2bf885d | [] | no_license | apachucy/Team-Maker | 534dddf2e8888858f3c10e53efc937b80e21ae3c | 4f3cd9220927d686f5ec1a5790ab8235a4bfdfdc | refs/heads/master | 2020-05-25T20:29:10.361336 | 2017-08-29T12:13:19 | 2017-08-29T12:13:19 | 95,134,018 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,466 | java | package unii.entertainment.teammaker.wizard.view;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.Switch;
import butterknife.BindView;
import butterknife.ButterKnife;
import unii.entertainment.teammaker.R;
import unii.entertainment.teammaker.base.BaseFragment;
import unii.entertainment.teammaker.dagger.ActivityComponent;
public class CategoryWizardFragment extends BaseFragment {
// private WizardViewModel wizardViewModel;
@BindView(R.id.team_number)
EditText teamNumberView;
@BindView(R.id.diverse_teams)
Switch diverseTeams;
@Override
public View onCreateView(LayoutInflater inflater,
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_wizard_category, container, false);
ButterKnife.bind(this, view);
injectDependencies();
initData(getActivityComponent());
initView();
return view;
}
@Override
protected void injectDependencies() {
getActivityComponent().inject(this);
}
@Override
protected void initView() {
}
@Override
protected void initData(ActivityComponent component) {
}
@Override
public void onPause() {
super.onPause();
// saveIsDiverseTeam();
// saveTeamNumber();
}
/*
@Override
public void onResume() {
super.onResume();
if (wizardViewModel.getNumberOfTeams() > 0) {
teamNumberView.setText(String.valueOf(wizardViewModel.getNumberOfTeams()));
}
diverseTeams.setChecked(wizardViewModel.isCreateMixedTeams());
}
private void saveIsDiverseTeam() {
wizardViewModel.setCreateMixedTeams(diverseTeams.isChecked());
}
private void saveTeamNumber() {
if (teamNumberView.getText() == null || teamNumberView.getText().toString().isEmpty()) {
return;
}
String teamNumberValue = teamNumberView.getText().toString();
try {
int teamNumber = Integer.parseInt(teamNumberValue);
if (teamNumber > 0) {
wizardViewModel.setNumberOfTeams(teamNumber);
}
} catch (NumberFormatException e) {
//display an error?
}
}*/
}
| [
"arkadiusz.pachucy@payu.com"
] | arkadiusz.pachucy@payu.com |
a77aed6d3029be24f5eaa46e4e584665b538d07b | fc510d65ff7a98e2f2b43b81904dd2a939d90d92 | /app/src/test/java/demo/android/newretrofitdemo/ExampleUnitTest.java | 61bd4557d8f49719d780535d882360f1ac983225 | [] | no_license | RakshitSorathiya/NewRetrofitDemo | 36a6e632241b0f02c8b9d3af9d340c058449612e | 44292b4e22b0cb0f3f1deef82916aca3c3f4cf53 | refs/heads/master | 2021-01-09T09:37:09.561030 | 2017-02-07T06:40:27 | 2017-02-07T06:40:27 | 81,175,275 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 406 | java | package demo.android.newretrofitdemo;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"rakshitsorathiya@gmail.com"
] | rakshitsorathiya@gmail.com |
acf4c6e3ece26330789c533d526dd212415b20f3 | f9857829aee2b58df98ef39da566b00c717d07f5 | /poc-team-cloud-operational/poc-team-cloud-script-jdk/src/main/java/org/poc/team/cloud/script/jdk/App.java | 600b838b909235eb9ffafaf8a2534b6de98c0966 | [] | no_license | Aetsmtl/poc-team-cloud | 0561f6ca17f44c6b4d434906ce2d16ee6de6790b | 7f99eb1047c54a168fd1350ee205b0a15bbe8200 | refs/heads/master | 2021-01-14T08:10:28.101224 | 2018-10-15T20:13:32 | 2018-10-15T20:13:32 | 81,929,316 | 0 | 1 | null | 2017-07-04T19:15:29 | 2017-02-14T09:37:25 | CSS | UTF-8 | Java | false | false | 192 | java | package org.poc.team.cloud.script.jdk;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}
| [
"arnold.fotsing.nde@esigetel.net"
] | arnold.fotsing.nde@esigetel.net |
f3add9a00c45bbab3036af169b9b02fbd3b4cc1f | 457327cb9bcc6426dd0c18f7ead4d8b93e554d01 | /testparallaxeffects/src/main/java/com/hxht/testparallaxeffects/customview/MyListView.java | 6025766129d68fa91a4230ba3fa0616e05947c7d | [] | no_license | FlyingSnow2211/QzoneEffect | 231d505b110eeb76f68dfd6ef846dbe0e06d1b03 | b892b1738e29b893937fae803af4c385dde9b7bb | refs/heads/master | 2021-01-19T10:24:06.255294 | 2015-07-27T08:27:30 | 2015-07-27T08:27:30 | 39,764,845 | 5 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,622 | java | package com.hxht.testparallaxeffects.customview;
import android.content.Context;
import android.support.v4.view.MotionEventCompat;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.ImageView;
import android.widget.ListView;
import com.hxht.testparallaxeffects.ui.ResetAnimation;
public class MyListView extends ListView {
private ImageView headerView ;
private int originHeight;
private int maxHeight;
public MyListView(Context context) {
super(context);
}
public MyListView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public MyListView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public void setParallaxImageView(ImageView headerView) {
this.headerView = headerView ;
originHeight = headerView.getHeight();
maxHeight = headerView.getDrawable().getIntrinsicHeight();
}
/**
* 重写overScrollBy,能获取ListView下拉的距离
*
* @param deltaX:横向的变化量
* @param deltaY:纵向的变化量
* @param scrollX:横向X的偏移量
* @param scrollY:纵向Y的偏移量
* @param scrollRangeX:横向X偏移范围
* @param scrollRangeY:纵向Y的偏移范围
* @param maxOverScrollX:横向X最大的偏移量
* @param maxOverScrollY:纵向Y最大的偏移量
* @param isTouchEvent:是否是触摸产生的滑动超出
* @return
*/
@Override
protected boolean overScrollBy(int deltaX, int deltaY, int scrollX, int scrollY, int scrollRangeX, int scrollRangeY, int maxOverScrollX, int maxOverScrollY, boolean isTouchEvent) {
if (isTouchEvent && deltaY < 0){
int newHeight = (int) (headerView.getHeight() + Math.abs(deltaY /3.0f));
//if (newHeight > maxHeight){
// newHeight = maxHeight ;
//}
newHeight = Math.min(newHeight,maxHeight);
headerView.getLayoutParams().height = newHeight ;
headerView.requestLayout();
}
return super.overScrollBy(deltaX, deltaY, scrollX, scrollY, scrollRangeX, scrollRangeY, maxOverScrollX, maxOverScrollY, isTouchEvent);
}
@Override
public boolean onTouchEvent(MotionEvent ev) {
if (MotionEventCompat.getActionMasked(ev) == MotionEvent.ACTION_UP){
ResetAnimation resetAnimation = new ResetAnimation(headerView, originHeight);
headerView.startAnimation(resetAnimation);
}
return super.onTouchEvent(ev);
}
}
| [
"hbzhangjiefei@163.com"
] | hbzhangjiefei@163.com |
e2f02cf3114d3ef03f5e5c92d470f529e6bf6cc4 | ae1535a952eacd2baa070c97ed0716ea2e6eaa20 | /nifi-nar-bundles/nifi-kafka-bundle/nifi-kafka-0-11-processors/src/main/java/org/apache/nifi/processors/kafka/pubsub/ConsumeKafka_0_11.java | a8d0457594b75542b39c951ef9de83291e2f9da4 | [
"Apache-2.0",
"LicenseRef-scancode-unknown",
"MIT",
"ISC"
] | permissive | ak-arun/nifi-1 | 80427f8a8c2fe73ab032401702a2b2d1a9218c2b | c1459825bb09a5d3ed527ac59c83cf3470b41e23 | refs/heads/master | 2020-03-07T01:56:28.126126 | 2018-03-23T19:11:38 | 2018-03-28T20:49:32 | 127,141,327 | 0 | 0 | Apache-2.0 | 2018-03-28T13:04:13 | 2018-03-28T13:04:13 | null | UTF-8 | Java | false | false | 21,621 | 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.nifi.processors.kafka.pubsub;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Pattern;
import java.util.concurrent.TimeUnit;
import org.apache.kafka.clients.consumer.ConsumerConfig;
import org.apache.kafka.common.KafkaException;
import org.apache.kafka.common.errors.WakeupException;
import org.apache.kafka.common.serialization.ByteArrayDeserializer;
import org.apache.nifi.annotation.behavior.DynamicProperty;
import org.apache.nifi.annotation.behavior.InputRequirement;
import org.apache.nifi.annotation.behavior.WritesAttribute;
import org.apache.nifi.annotation.behavior.WritesAttributes;
import org.apache.nifi.annotation.documentation.CapabilityDescription;
import org.apache.nifi.annotation.documentation.Tags;
import org.apache.nifi.annotation.lifecycle.OnStopped;
import org.apache.nifi.annotation.lifecycle.OnUnscheduled;
import org.apache.nifi.components.AllowableValue;
import org.apache.nifi.components.PropertyDescriptor;
import org.apache.nifi.components.ValidationContext;
import org.apache.nifi.components.ValidationResult;
import org.apache.nifi.logging.ComponentLog;
import org.apache.nifi.processor.AbstractProcessor;
import org.apache.nifi.processor.ProcessContext;
import org.apache.nifi.processor.ProcessSession;
import org.apache.nifi.processor.Relationship;
import org.apache.nifi.processor.exception.ProcessException;
import org.apache.nifi.processor.util.StandardValidators;
import static org.apache.nifi.processors.kafka.pubsub.KafkaProcessorUtils.HEX_ENCODING;
import static org.apache.nifi.processors.kafka.pubsub.KafkaProcessorUtils.UTF8_ENCODING;
@CapabilityDescription("Consumes messages from Apache Kafka specifically built against the Kafka 0.11.x Consumer API. "
+ "The complementary NiFi processor for sending messages is PublishKafka_0_11.")
@Tags({"Kafka", "Get", "Ingest", "Ingress", "Topic", "PubSub", "Consume", "0.11.x"})
@WritesAttributes({
@WritesAttribute(attribute = KafkaProcessorUtils.KAFKA_COUNT, description = "The number of messages written if more than one"),
@WritesAttribute(attribute = KafkaProcessorUtils.KAFKA_KEY, description = "The key of message if present and if single message. "
+ "How the key is encoded depends on the value of the 'Key Attribute Encoding' property."),
@WritesAttribute(attribute = KafkaProcessorUtils.KAFKA_OFFSET, description = "The offset of the message in the partition of the topic."),
@WritesAttribute(attribute = KafkaProcessorUtils.KAFKA_PARTITION, description = "The partition of the topic the message or message bundle is from"),
@WritesAttribute(attribute = KafkaProcessorUtils.KAFKA_TOPIC, description = "The topic the message or message bundle is from")
})
@InputRequirement(InputRequirement.Requirement.INPUT_FORBIDDEN)
@DynamicProperty(name = "The name of a Kafka configuration property.", value = "The value of a given Kafka configuration property.",
description = "These properties will be added on the Kafka configuration after loading any provided configuration properties."
+ " In the event a dynamic property represents a property that was already set, its value will be ignored and WARN message logged."
+ " For the list of available Kafka properties please refer to: http://kafka.apache.org/documentation.html#configuration. ")
public class ConsumeKafka_0_11 extends AbstractProcessor {
static final AllowableValue OFFSET_EARLIEST = new AllowableValue("earliest", "earliest", "Automatically reset the offset to the earliest offset");
static final AllowableValue OFFSET_LATEST = new AllowableValue("latest", "latest", "Automatically reset the offset to the latest offset");
static final AllowableValue OFFSET_NONE = new AllowableValue("none", "none", "Throw exception to the consumer if no previous offset is found for the consumer's group");
static final AllowableValue TOPIC_NAME = new AllowableValue("names", "names", "Topic is a full topic name or comma separated list of names");
static final AllowableValue TOPIC_PATTERN = new AllowableValue("pattern", "pattern", "Topic is a regex using the Java Pattern syntax");
static final PropertyDescriptor TOPICS = new PropertyDescriptor.Builder()
.name("topic")
.displayName("Topic Name(s)")
.description("The name of the Kafka Topic(s) to pull from. More than one can be supplied if comma separated.")
.required(true)
.addValidator(StandardValidators.NON_BLANK_VALIDATOR)
.expressionLanguageSupported(true)
.build();
static final PropertyDescriptor TOPIC_TYPE = new PropertyDescriptor.Builder()
.name("topic_type")
.displayName("Topic Name Format")
.description("Specifies whether the Topic(s) provided are a comma separated list of names or a single regular expression")
.required(true)
.allowableValues(TOPIC_NAME, TOPIC_PATTERN)
.defaultValue(TOPIC_NAME.getValue())
.build();
static final PropertyDescriptor GROUP_ID = new PropertyDescriptor.Builder()
.name(ConsumerConfig.GROUP_ID_CONFIG)
.displayName("Group ID")
.description("A Group ID is used to identify consumers that are within the same consumer group. Corresponds to Kafka's 'group.id' property.")
.required(true)
.addValidator(StandardValidators.NON_BLANK_VALIDATOR)
.expressionLanguageSupported(false)
.build();
static final PropertyDescriptor AUTO_OFFSET_RESET = new PropertyDescriptor.Builder()
.name(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG)
.displayName("Offset Reset")
.description("Allows you to manage the condition when there is no initial offset in Kafka or if the current offset does not exist any "
+ "more on the server (e.g. because that data has been deleted). Corresponds to Kafka's 'auto.offset.reset' property.")
.required(true)
.allowableValues(OFFSET_EARLIEST, OFFSET_LATEST, OFFSET_NONE)
.defaultValue(OFFSET_LATEST.getValue())
.build();
static final PropertyDescriptor KEY_ATTRIBUTE_ENCODING = new PropertyDescriptor.Builder()
.name("key-attribute-encoding")
.displayName("Key Attribute Encoding")
.description("FlowFiles that are emitted have an attribute named '" + KafkaProcessorUtils.KAFKA_KEY + "'. This property dictates how the value of the attribute should be encoded.")
.required(true)
.defaultValue(UTF8_ENCODING.getValue())
.allowableValues(UTF8_ENCODING, HEX_ENCODING)
.build();
static final PropertyDescriptor MESSAGE_DEMARCATOR = new PropertyDescriptor.Builder()
.name("message-demarcator")
.displayName("Message Demarcator")
.required(false)
.addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
.expressionLanguageSupported(true)
.description("Since KafkaConsumer receives messages in batches, you have an option to output FlowFiles which contains "
+ "all Kafka messages in a single batch for a given topic and partition and this property allows you to provide a string (interpreted as UTF-8) to use "
+ "for demarcating apart multiple Kafka messages. This is an optional property and if not provided each Kafka message received "
+ "will result in a single FlowFile which "
+ "time it is triggered. To enter special character such as 'new line' use CTRL+Enter or Shift+Enter depending on the OS")
.build();
static final PropertyDescriptor HEADER_NAME_REGEX = new PropertyDescriptor.Builder()
.name("header-name-regex")
.displayName("Headers to Add as Attributes (Regex)")
.description("A Regular Expression that is matched against all message headers. "
+ "Any message header whose name matches the regex will be added to the FlowFile as an Attribute. "
+ "If not specified, no Header values will be added as FlowFile attributes. If two messages have a different value for the same header and that header is selected by "
+ "the provided regex, then those two messages must be added to different FlowFiles. As a result, users should be cautious about using a regex like "
+ "\".*\" if messages are expected to have header values that are unique per message, such as an identifier or timestamp, because it will prevent NiFi from bundling "
+ "the messages together efficiently.")
.addValidator(StandardValidators.REGULAR_EXPRESSION_VALIDATOR)
.expressionLanguageSupported(false)
.required(false)
.build();
static final PropertyDescriptor MAX_POLL_RECORDS = new PropertyDescriptor.Builder()
.name("max.poll.records")
.displayName("Max Poll Records")
.description("Specifies the maximum number of records Kafka should return in a single poll.")
.required(false)
.defaultValue("10000")
.addValidator(StandardValidators.POSITIVE_INTEGER_VALIDATOR)
.build();
static final PropertyDescriptor MAX_UNCOMMITTED_TIME = new PropertyDescriptor.Builder()
.name("max-uncommit-offset-wait")
.displayName("Max Uncommitted Time")
.description("Specifies the maximum amount of time allowed to pass before offsets must be committed. "
+ "This value impacts how often offsets will be committed. Committing offsets less often increases "
+ "throughput but also increases the window of potential data duplication in the event of a rebalance "
+ "or JVM restart between commits. This value is also related to maximum poll records and the use "
+ "of a message demarcator. When using a message demarcator we can have far more uncommitted messages "
+ "than when we're not as there is much less for us to keep track of in memory.")
.required(false)
.defaultValue("1 secs")
.addValidator(StandardValidators.TIME_PERIOD_VALIDATOR)
.build();
static final PropertyDescriptor HONOR_TRANSACTIONS = new PropertyDescriptor.Builder()
.name("honor-transactions")
.displayName("Honor Transactions")
.description("Specifies whether or not NiFi should honor transactional guarantees when communicating with Kafka. If false, the Processor will use an \"isolation level\" of "
+ "read_uncomitted. This means that messages will be received as soon as they are written to Kafka but will be pulled, even if the producer cancels the transactions. If "
+ "this value is true, NiFi will not receive any messages for which the producer's transaction was canceled, but this can result in some latency since the consumer must wait "
+ "for the producer to finish its entire transaction instead of pulling as the messages become available.")
.expressionLanguageSupported(false)
.allowableValues("true", "false")
.defaultValue("true")
.required(true)
.build();
static final PropertyDescriptor MESSAGE_HEADER_ENCODING = new PropertyDescriptor.Builder()
.name("message-header-encoding")
.displayName("Message Header Encoding")
.description("Any message header that is found on a Kafka message will be added to the outbound FlowFile as an attribute. "
+ "This property indicates the Character Encoding to use for deserializing the headers.")
.addValidator(StandardValidators.CHARACTER_SET_VALIDATOR)
.defaultValue("UTF-8")
.required(false)
.build();
static final Relationship REL_SUCCESS = new Relationship.Builder()
.name("success")
.description("FlowFiles received from Kafka. Depending on demarcation strategy it is a flow file per message or a bundle of messages grouped by topic and partition.")
.build();
static final List<PropertyDescriptor> DESCRIPTORS;
static final Set<Relationship> RELATIONSHIPS;
private volatile ConsumerPool consumerPool = null;
private final Set<ConsumerLease> activeLeases = Collections.synchronizedSet(new HashSet<>());
static {
List<PropertyDescriptor> descriptors = new ArrayList<>();
descriptors.addAll(KafkaProcessorUtils.getCommonPropertyDescriptors());
descriptors.add(TOPICS);
descriptors.add(TOPIC_TYPE);
descriptors.add(HONOR_TRANSACTIONS);
descriptors.add(GROUP_ID);
descriptors.add(AUTO_OFFSET_RESET);
descriptors.add(KEY_ATTRIBUTE_ENCODING);
descriptors.add(MESSAGE_DEMARCATOR);
descriptors.add(MESSAGE_HEADER_ENCODING);
descriptors.add(HEADER_NAME_REGEX);
descriptors.add(MAX_POLL_RECORDS);
descriptors.add(MAX_UNCOMMITTED_TIME);
DESCRIPTORS = Collections.unmodifiableList(descriptors);
RELATIONSHIPS = Collections.singleton(REL_SUCCESS);
}
@Override
public Set<Relationship> getRelationships() {
return RELATIONSHIPS;
}
@Override
protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
return DESCRIPTORS;
}
@OnStopped
public void close() {
final ConsumerPool pool = consumerPool;
consumerPool = null;
if (pool != null) {
pool.close();
}
}
@Override
protected PropertyDescriptor getSupportedDynamicPropertyDescriptor(final String propertyDescriptorName) {
return new PropertyDescriptor.Builder()
.description("Specifies the value for '" + propertyDescriptorName + "' Kafka Configuration.")
.name(propertyDescriptorName).addValidator(new KafkaProcessorUtils.KafkaConfigValidator(ConsumerConfig.class)).dynamic(true)
.build();
}
@Override
protected Collection<ValidationResult> customValidate(final ValidationContext validationContext) {
return KafkaProcessorUtils.validateCommonProperties(validationContext);
}
private synchronized ConsumerPool getConsumerPool(final ProcessContext context) {
ConsumerPool pool = consumerPool;
if (pool != null) {
return pool;
}
return consumerPool = createConsumerPool(context, getLogger());
}
protected ConsumerPool createConsumerPool(final ProcessContext context, final ComponentLog log) {
final int maxLeases = context.getMaxConcurrentTasks();
final long maxUncommittedTime = context.getProperty(MAX_UNCOMMITTED_TIME).asTimePeriod(TimeUnit.MILLISECONDS);
final byte[] demarcator = context.getProperty(ConsumeKafka_0_11.MESSAGE_DEMARCATOR).isSet()
? context.getProperty(ConsumeKafka_0_11.MESSAGE_DEMARCATOR).evaluateAttributeExpressions().getValue().getBytes(StandardCharsets.UTF_8)
: null;
final Map<String, Object> props = new HashMap<>();
KafkaProcessorUtils.buildCommonKafkaProperties(context, ConsumerConfig.class, props);
props.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, "false");
props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, ByteArrayDeserializer.class.getName());
props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, ByteArrayDeserializer.class.getName());
final String topicListing = context.getProperty(ConsumeKafka_0_11.TOPICS).evaluateAttributeExpressions().getValue();
final String topicType = context.getProperty(ConsumeKafka_0_11.TOPIC_TYPE).evaluateAttributeExpressions().getValue();
final List<String> topics = new ArrayList<>();
final String keyEncoding = context.getProperty(KEY_ATTRIBUTE_ENCODING).getValue();
final String securityProtocol = context.getProperty(KafkaProcessorUtils.SECURITY_PROTOCOL).getValue();
final String bootstrapServers = context.getProperty(KafkaProcessorUtils.BOOTSTRAP_SERVERS).evaluateAttributeExpressions().getValue();
final boolean honorTransactions = context.getProperty(HONOR_TRANSACTIONS).asBoolean();
final String charsetName = context.getProperty(MESSAGE_HEADER_ENCODING).evaluateAttributeExpressions().getValue();
final Charset charset = Charset.forName(charsetName);
final String headerNameRegex = context.getProperty(HEADER_NAME_REGEX).getValue();
final Pattern headerNamePattern = headerNameRegex == null ? null : Pattern.compile(headerNameRegex);
if (topicType.equals(TOPIC_NAME.getValue())) {
for (final String topic : topicListing.split(",", 100)) {
final String trimmedName = topic.trim();
if (!trimmedName.isEmpty()) {
topics.add(trimmedName);
}
}
return new ConsumerPool(maxLeases, demarcator, props, topics, maxUncommittedTime, keyEncoding, securityProtocol,
bootstrapServers, log, honorTransactions, charset, headerNamePattern);
} else if (topicType.equals(TOPIC_PATTERN.getValue())) {
final Pattern topicPattern = Pattern.compile(topicListing.trim());
return new ConsumerPool(maxLeases, demarcator, props, topicPattern, maxUncommittedTime, keyEncoding, securityProtocol,
bootstrapServers, log, honorTransactions, charset, headerNamePattern);
} else {
getLogger().error("Subscription type has an unknown value {}", new Object[] {topicType});
return null;
}
}
@OnUnscheduled
public void interruptActiveThreads() {
// There are known issues with the Kafka client library that result in the client code hanging
// indefinitely when unable to communicate with the broker. In order to address this, we will wait
// up to 30 seconds for the Threads to finish and then will call Consumer.wakeup() to trigger the
// thread to wakeup when it is blocked, waiting on a response.
final long nanosToWait = TimeUnit.SECONDS.toNanos(5L);
final long start = System.nanoTime();
while (System.nanoTime() - start < nanosToWait && !activeLeases.isEmpty()) {
try {
Thread.sleep(100L);
} catch (final InterruptedException ie) {
Thread.currentThread().interrupt();
return;
}
}
if (!activeLeases.isEmpty()) {
int count = 0;
for (final ConsumerLease lease : activeLeases) {
getLogger().info("Consumer {} has not finished after waiting 30 seconds; will attempt to wake-up the lease", new Object[] {lease});
lease.wakeup();
count++;
}
getLogger().info("Woke up {} consumers", new Object[] {count});
}
activeLeases.clear();
}
@Override
public void onTrigger(ProcessContext context, ProcessSession session) throws ProcessException {
final ConsumerPool pool = getConsumerPool(context);
if (pool == null) {
context.yield();
return;
}
try (final ConsumerLease lease = pool.obtainConsumer(session, context)) {
if (lease == null) {
context.yield();
return;
}
activeLeases.add(lease);
try {
while (this.isScheduled() && lease.continuePolling()) {
lease.poll();
}
if (this.isScheduled() && !lease.commit()) {
context.yield();
}
} catch (final WakeupException we) {
getLogger().warn("Was interrupted while trying to communicate with Kafka with lease {}. "
+ "Will roll back session and discard any partially received data.", new Object[] {lease});
} catch (final KafkaException kex) {
getLogger().error("Exception while interacting with Kafka so will close the lease {} due to {}",
new Object[]{lease, kex}, kex);
} catch (final Throwable t) {
getLogger().error("Exception while processing data from kafka so will close the lease {} due to {}",
new Object[]{lease, t}, t);
} finally {
activeLeases.remove(lease);
}
}
}
}
| [
"joewitt@apache.org"
] | joewitt@apache.org |
9794119dcefbae7b81f9f930d0a4da8a381fb43d | 5965d1487b019d34ae6609d852d30316548d1612 | /src/Java_Assignment_1/Bidding.java | 3746381e759c552a929c03e695f4172cb4444f97 | [] | no_license | vijay-paul/Java_selenium | 8e31ce7d686fa44670e60b0010e954b9718eccc6 | 0a90fe4daa13a3993d3482cc7738800e80a0e316 | refs/heads/master | 2022-12-10T17:13:37.174731 | 2020-09-09T01:36:39 | 2020-09-09T01:36:39 | 293,969,295 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 821 | java | package Java_Assignment_1;
import java.util.Scanner;
public class Bidding {
public static void main(String[] args) {
System.out.println(" Michael enter your BID");
float bidder_A=userinput();
System.out.println(" Bruce enter your BID");
float bidder_B=userinput();
if(bidder_A<bidder_B) {
System.out.println("Michael won the BID ");
}
else {
System.out.println("Bruce won the BID ");
}
// TODO Auto-generated method stub
}
public static float userinput() {
float number = 0;
boolean result = false;
Scanner sc = new Scanner(System.in);
do {
if (sc.hasNextFloat()) {
number = sc.nextFloat();
result = true;
} else {
sc.nextLine();
System.out.println("Enter only number ");
}
} while (!result);
result = true;
return number;
}
}
| [
"clashedroyaled@gmail.com"
] | clashedroyaled@gmail.com |
4cc30e946a7c7ac35888d45e59eeec948b8e14c3 | f47ec3077c6946bf9dd4b2a484e66944a9363908 | /app/src/main/java/com/education/shengnongcollege/BaseTopActivity.java | 46916def3d9cbca05a59c6ec294ce6ee373017e3 | [] | no_license | aaroncao/ShengnongCollege | 0e071f513a772f33cff88ac34d0471b9103950c8 | 240b4ce08743b048d31a1db5a6d7fdf11949a9e8 | refs/heads/master | 2021-09-17T04:48:51.113822 | 2018-06-03T07:39:02 | 2018-06-03T07:39:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,539 | java | package com.education.shengnongcollege;
import android.Manifest;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import java.util.LinkedList;
import java.util.List;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.disposables.Disposable;
/**
* Created by wuweixiang on 16/8/24.
* 最顶层activity,放置所有activity的公用处理
*/
public abstract class BaseTopActivity extends AppCompatActivity {
protected Context context;
protected boolean isMIUI = true;
protected Context getContext() {
return context;
}
public static List<Activity> getsActivities() {
return sActivities;
}
public static List<Activity> sActivities = new LinkedList<Activity>();
@Override
protected void onStart() {
super.onStart();
}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
if (savedInstanceState != null) {
String FRAGMENTS_TAG = "android:support:fragments";
savedInstanceState.remove(FRAGMENTS_TAG);
}
super.onCreate(savedInstanceState);
context = getApplicationContext();
sActivities.add(this);
}
@Override
protected void onDestroy() {
sActivities.remove(this);
clearDispose();
super.onDestroy();
}
@Override
protected void onPause() {
super.onPause();
}
@Override
protected void onResume() {
super.onResume();
}
@Override
protected void onStop() {
// TODO Auto-generated method stub
super.onStop();
}
public static Activity getTopActivity() {
if (sActivities.size() > 0) {
return sActivities.get(sActivities.size() - 1);
} else {
return null;
}
}
public static void finishAll() {
for (int i = sActivities.size() - 1; i >= 0; i--) {
Activity a = sActivities.get(i);
if (a instanceof Activity && !a.isFinishing()) {
// sActivities.remove(i);
a.finish();
a.overridePendingTransition(0, 0);
}
}
}
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
//为了处理某些场景(比如长期放置)被回收的时候,重新启动app使用,暂时去掉
// try {
// startActivity(new Intent(this, Class.forName("com.jkyshealth.activity.other.NewHelloActivity")));
// } catch (ClassNotFoundException e) {
// e.printStackTrace();
// try {
// startActivity(new Intent(this, Class.forName("com.mintcode.area_patient.area_login.HelloActivity")));
// } catch (ClassNotFoundException e1) {
// e1.printStackTrace();
// }
// }
// finish();
}
protected CompositeDisposable compositeDisposable;
protected synchronized void addRequestDispose(Disposable disposable) {
if (compositeDisposable == null) {
compositeDisposable = new CompositeDisposable();
}
if (disposable != null) {
compositeDisposable.add(disposable);
}
}
protected synchronized void clearDispose() {
if (compositeDisposable != null) {
compositeDisposable.clear();
}
}
}
| [
"weixiangwu@91jkys.com"
] | weixiangwu@91jkys.com |
2d93e0ebd399074ec3e56eeb5a5e0c69ea59e7a5 | 1c47778084b0adeccdde0b8dd39fd27112b3384d | /src/java/control/SearchControl.java | fe8b00f0f6e548a229ff14fef777564237e5178c | [] | no_license | tungdang1602/THPTUDCSDL-Shoes | 02b519552ba731d67f1a4988cced3cf5708e981e | 575ab5eec4373e86bc9a14011041bd717ee8e610 | refs/heads/master | 2023-06-18T01:34:01.424807 | 2021-07-13T10:44:52 | 2021-07-13T10:44:52 | 383,203,349 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,477 | java | package control;
import model.Product;
import model.Category;
import model.Information;
import dao.ProductDAO;
import dao.InforDAO;
import dao.CategoryDAO;
import dao.UserDAO;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet(name = "SearchControl", urlPatterns = {"/search"})
public class SearchControl extends HttpServlet {
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
* methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
request.setCharacterEncoding("UTF-8");
String txtSearch = request.getParameter("txt");
if (txtSearch.equals("")) {
response.sendRedirect("home");
} else {
//Call to DAOs
ProductDAO ProductDAO = new ProductDAO();
InforDAO InforDAO = new InforDAO();
CategoryDAO CategoryDAO = new CategoryDAO();
UserDAO UserDAO = new UserDAO();
List<Category> listC = CategoryDAO.getAllCategory(); //Get List Category
Product first = ProductDAO.getHotProduct(); //Get First Product
Product last = ProductDAO.getFavoriteProduct(); //Get Last Product
Information infor = InforDAO.getInfor(); //Get Information
String CategoryID = request.getParameter("CategoryID");
if (CategoryID == null) {
CategoryID = "0";
}
request.setAttribute("CategoryID", CategoryID);
int CID = Integer.parseInt(CategoryID);
String indexPage = request.getParameter("index");
if (indexPage == null) {
indexPage = "1";
}
int index = Integer.parseInt(indexPage);
int count = ProductDAO.countProductByCategory(CID);
int endPage = count / 6;
if (count % 6 != 0) {
endPage++;
}
List<Product> listP = ProductDAO.searchProductByName(txtSearch);
//Set Data to JSP
request.setAttribute("allCategory", listC);
request.setAttribute("first", first);
request.setAttribute("last", last);
request.setAttribute("infor", infor);
request.setAttribute("listP", listP); //List Product
request.setAttribute("end", endPage);
request.setAttribute("tag", index); //Page number
request.setAttribute("count", count);
request.setAttribute("CateID", CID);
request.getRequestDispatcher("Home.jsp").forward(request, response);
}
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
| [
"Admin@TungDang"
] | Admin@TungDang |
0d5ceefdf20cc61277272c1d2bd8e241c148fabd | acb6caac637a8597c93ecf8be29b3912331a2265 | /lesson8/Question2a/PriceComparator.java | a8e64fbf38c5043cccf2b063068cc2080c77a6d4 | [] | no_license | gfasil/MPP | 7ae0b89df5f0f203f2698cf911b6e34084626d88 | d331df09d75cf01c2ad76162369d436b0f830943 | refs/heads/master | 2020-08-05T11:30:49.824886 | 2019-10-22T02:14:49 | 2019-10-22T02:14:49 | 212,484,971 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 305 | java | package Assignments.lesson8.Question2a;
import java.util.Comparator;
public class PriceComparator implements Comparator<Product> {
@Override
public int compare(Product o1, Product o2) {
// TODO Auto-generated method stub
return Double.compare(o1.getPrice(),o2.getPrice());
}
}
| [
"noreply@github.com"
] | noreply@github.com |
12578c1dac0970a9cda5dac7a33d6637349d695e | f53826b040138802bc8d7f5974ee6fd6d78d7d44 | /app/src/main/java/com/atguigu/tiankuo/appstore/base/BaseFragment.java | acddc0fa5e9b674ef05530e5394dd5a1e5f8a176 | [] | no_license | tiankuo-android/AppStore | 3b30ca220fe6ee9623ba9bbddffbbce0503cb3cb | 000850d478eb2544bbe03a97f20a64ef8bc97c07 | refs/heads/master | 2020-05-28T10:39:11.431201 | 2017-06-19T08:08:33 | 2017-06-19T08:08:33 | 94,008,598 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,039 | java | package com.atguigu.tiankuo.appstore.base;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
/**
* 作者:田阔
* 邮箱:1226147264@qq.com
* Created by Administrator on 2017/6/11 0011.
*/
public abstract class BaseFragment extends Fragment {
public Context mContext;
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mContext = getActivity();
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return initView();
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
initData();
}
public abstract View initView();
public void initData() {
}
}
| [
"1226147264@qq.com"
] | 1226147264@qq.com |
9bd8e0a334678b884e2fcd6ddd52d41552e6240a | 322af1fa7381e5c267a4e7f231a06e3843079a00 | /main/java/frc/robot/subsystems/Hook.java | d8e10ae772e87fab0069b0563fb48ca1027f51a6 | [] | no_license | BrunZo/FRC | 0385d5b30c0820d90e8cbd9303fa04e871937a73 | 61fd8bcb3b979476d28a7cd0ad3894d04410b5cf | refs/heads/main | 2023-03-10T05:18:28.735037 | 2021-02-19T15:00:10 | 2021-02-19T15:00:10 | 338,457,692 | 0 | 0 | null | 2021-02-19T15:00:10 | 2021-02-12T23:29:57 | Java | UTF-8 | Java | false | false | 1,142 | java | package frc.robot.subsystems;
import edu.wpi.first.wpilibj.PWMVictorSPX;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
public class Hook extends SubsystemBase {
public PWMVictorSPX motorController;
/**
* Constructor of a Hook object using the new keyword.
* @param pwmChannel the PWM channel in the roboRIO in which the motor is connected.
*/
public Hook(int pwmChannel) {
this.motorController = new PWMVictorSPX(pwmChannel);
}
/**
* A function that starts the motor and starts wrapping the rope around the motor axis.
*/
public void up() {
motorController.setSpeed(1);
SmartDashboard.putBoolean("UP", true);
}
/**
* Completely stops the motor.
*/
public void stopMotor() {
motorController.setSpeed(0);
SmartDashboard.putBoolean("UP", false);
SmartDashboard.putBoolean("DOWN", false);
}
/**
* A function that starts unwrapping the motor.
*/
public void down() {
motorController.setSpeed(-1);
SmartDashboard.putBoolean("DOWN", true);
}
@Override
public void periodic() {
}
} | [
"ziger.bruno@gmail.com"
] | ziger.bruno@gmail.com |
94130675172f0942f18913bba61e0ee641948550 | ef699639dfba41101aa6b125eacf932de7276020 | /src/net/finmath/time/daycount/DayCountConvention_ACT_365A.java | f307089805cc0a8d37be8ed6370d2a7b47849c98 | [] | no_license | AlessandroGnoatto/CBIMultiCurve | ebfb42e122e1baf3044436bfd3bafafc48f98883 | e529da17b8e4fa0d896fd3a4a9014e6f9063dbef | refs/heads/master | 2020-12-08T05:02:47.580111 | 2020-01-09T19:48:56 | 2020-01-09T19:48:56 | 232,891,813 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,155 | java | /*
* (c) Copyright Christian P. Fries, Germany. Contact: email@christian-fries.de.
*
* Created on 07.09.2013
*/
package net.finmath.time.daycount;
import java.time.LocalDate;
import java.time.Month;
import java.time.chrono.IsoChronology;
/**
* Implementation of ACT/365A.
*
* Calculates the day count by calculating the actual number of days between startDate and endDate.
*
* A fractional day is rounded to the approximately nearest day.
*
* The day count fraction is calculated using ACT/365A convention, that is, the
* day count is divided by 366 if February 29 lies in between startDate (excluding) and endDate (including),
* otherwise it the day count is divided by 365.
*
* @see DayCountConvention_ACT_365
* @see DayCountConvention_ACT_365L
*
* @author Christian Fries
*/
public class DayCountConvention_ACT_365A extends DayCountConvention_ACT {
/**
* Create an ACT/365 day count convention.
*/
public DayCountConvention_ACT_365A() {
}
/* (non-Javadoc)
* @see net.finmath.time.daycount.DayCountConventionInterface#getDaycountFraction(java.time.LocalDate, java.time.LocalDate)
*/
@Override
public double getDaycountFraction(LocalDate startDate, LocalDate endDate) {
if(startDate.isAfter(endDate)) {
return -getDaycountFraction(endDate,startDate);
}
double daysPerYear = 365.0;
// Check startDate for leap year
if (startDate.isLeapYear()) {
LocalDate leapDayStart = LocalDate.of(startDate.getYear(), Month.FEBRUARY, 29);
if(startDate.isBefore(leapDayStart) && !endDate.isBefore(leapDayStart)) {
daysPerYear = 366.0;
}
}
// Check endDate for leap year
if (endDate.isLeapYear()){
LocalDate leapDayEnd = LocalDate.of(endDate.getYear(), Month.FEBRUARY, 29);
if(startDate.isBefore(leapDayEnd) && !endDate.isBefore(leapDayEnd)) {
daysPerYear = 366.0;
}
}
// Check in-between years for leap year
for(int year = startDate.getYear()+1; year < endDate.getYear(); year++) {
if(IsoChronology.INSTANCE.isLeapYear(year)) {
daysPerYear = 366.0;
}
}
double daycountFraction = getDaycount(startDate, endDate) / daysPerYear;
return daycountFraction;
}
}
| [
"alessandrognoatto@macbookproalessandrounivr.homenet.telecomitalia.it"
] | alessandrognoatto@macbookproalessandrounivr.homenet.telecomitalia.it |
95dc2c9f53737890da4f700538bb51630bc3f905 | ec61d50fde6524f76e528933678e427394ed23be | /src/main/java/com/ncs/demo/commons/CommonConstants.java | 8f5b8860b22ecb01e36231d7104d9434dd42d9f1 | [] | no_license | 554768191/cms-demo | 4476a1898f5d8422633103cf70546c5bf323535f | 22f77c0039acb9dfbf30f697ab6a0be3c3f0e2d5 | refs/heads/master | 2020-03-29T21:49:23.768449 | 2018-04-26T10:33:21 | 2018-04-26T10:33:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,235 | java | package com.ncs.demo.commons;
/**
* Created by 84234261@qq.com
* User: Zhiwei Wu(Allen)
* Date: 2018/2/6
* Time: 10:16
* To change this template use File | Settings | File Templates.
*/
public class CommonConstants {
public static final String SUCCESS_CODE = "000000";
public static final String FAIL_CODE = "000001";
public static final String NOT_LOGIN_CODE = "000002";
public static final String SUCCESS_DESC = "操作成功";
public static final String FAIL_DESC = "操作失败";
public static final String REGISTER_SUCCESS_DESC = "注册成功";
public static final String LOGIN_FAIL_DESC = "登录失败";
public static final String NOT_LOGIN = "您还没登录,请先登录";
/**
* 发送邮件的用户名
*/
public static final String USER_NAME = "cmssystem@139.com";
/**
* 发送邮件的密码
*/
public static final String PASSWORD = "Allen19910628";
/**
* 邮件服务器地址
*/
public static final String SMTP_HOST = "smtp.139.com";
/**
* 收件人
*/
public static final String RECEIVER = "84234261@qq.com";
/**
* 邮件主题
*/
public static final String SUBJECT = "生日提醒";
}
| [
"84234261@qq.com"
] | 84234261@qq.com |
0f85adf3e2e343a8fd7017b90fa34db83e0e61fd | 4bfdb1959bdc6a75c425db17bfce508da70ac35a | /src/main/java/com/ems/projections/EmployeeWithManager.java | d5be815feaba91e1c84d4eafbbd1f18315a2b499 | [] | no_license | junaidameer93/ems | 172ed077ed1c2a90517fed5464ec3a4aa9f53170 | fa497b24d15aa52e4615aef708f92e6e59c44eb8 | refs/heads/master | 2020-03-28T18:34:16.278091 | 2018-09-19T02:01:53 | 2018-09-19T02:01:53 | 148,892,433 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 222 | java | package com.ems.projections;
public interface EmployeeWithManager {
String getFirstName();
String getLastName();
EManager getManager();
interface EManager {
String getFirstName();
String getLastName();
}
}
| [
"junaid.ameer93@gmail.com"
] | junaid.ameer93@gmail.com |
03354090c38bc4c76cb30b828698d4c43dcfe78c | e2f6808efac2bdfae8ddfd1be97ff1482d8c996c | /srcAD/org/openbravo/erpWindows/AreasofInterest/AreasofInterest.java | 889f170ce87e5fedc4a8e81a3a527948148644ed | [] | no_license | Omeru/ELREHA_ERP | 4741f6c88d6d76797e9e6386fe3d8162353e3eb7 | 0935d9598684dde1669cbddf85c82f49a080d85e | refs/heads/master | 2020-04-30T10:43:39.181327 | 2016-11-09T12:41:05 | 2016-11-09T12:41:05 | 64,836,671 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 42,947 | java |
package org.openbravo.erpWindows.AreasofInterest;
import org.openbravo.erpCommon.utility.*;
import org.openbravo.data.FieldProvider;
import org.openbravo.utils.FormatUtilities;
import org.openbravo.utils.Replace;
import org.openbravo.base.secureApp.HttpSecureAppServlet;
import org.openbravo.base.secureApp.VariablesSecureApp;
import org.openbravo.base.exception.OBException;
import org.openbravo.scheduling.ProcessBundle;
import org.openbravo.scheduling.ProcessRunner;
import org.openbravo.erpCommon.businessUtility.WindowTabs;
import org.openbravo.xmlEngine.XmlDocument;
import java.util.Vector;
import java.util.StringTokenizer;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
import java.sql.Connection;
import org.apache.log4j.Logger;
import org.apache.commons.fileupload.FileItem;
import org.openz.view.*;
import org.openz.model.*;
import org.openz.controller.callouts.CalloutStructure;
import org.openz.view.Formhelper;
import org.openz.view.Scripthelper;
import org.openz.view.templates.ConfigureButton;
import org.openz.view.templates.ConfigureInfobar;
import org.openz.view.templates.ConfigurePopup;
import org.openz.view.templates.ConfigureSelectBox;
import org.openz.view.templates.ConfigureFrameWindow;
import org.openz.util.LocalizationUtils;
import org.openz.util.UtilsData;
import org.openz.controller.businessprocess.DocActionWorkflowOptions;
import org.openbravo.data.Sqlc;
public class AreasofInterest extends HttpSecureAppServlet {
private static final long serialVersionUID = 1L;
private static Logger log4j = Logger.getLogger(AreasofInterest.class);
private static final String windowId = "245";
private static final String tabId = "438";
private static final String defaultTabView = "RELATION";
private static final int accesslevel = 7;
private static final double SUBTABS_COL_SIZE = 15;
public void doPost (HttpServletRequest request, HttpServletResponse response) throws IOException,ServletException {
TableSQLData tableSQL = null;
VariablesSecureApp vars = new VariablesSecureApp(request);
Boolean saveRequest = (Boolean) request.getAttribute("autosave");
this.setWindowId(windowId);
this.setTabId(tabId);
if(saveRequest != null && saveRequest){
String currentOrg = vars.getStringParameter("inpadOrgId");
String currentClient = vars.getStringParameter("inpadClientId");
boolean editableTab = (!org.openbravo.erpCommon.utility.WindowAccessData.hasReadOnlyAccess(this, vars.getRole(), tabId)
&& (currentOrg.equals("") || Utility.isElementInList(Utility.getContext(this, vars,"#User_Org", windowId, accesslevel), currentOrg))
&& (currentClient.equals("") || Utility.isElementInList(Utility.getContext(this, vars, "#User_Client", windowId, accesslevel),currentClient)));
OBError myError = new OBError();
String commandType = request.getParameter("inpCommandType");
String strrInterestareaId = request.getParameter("inprInterestareaId");
if (editableTab) {
int total = 0;
if(commandType.equalsIgnoreCase("EDIT") && !strrInterestareaId.equals(""))
total = saveRecord(vars, myError, 'U');
else
total = saveRecord(vars, myError, 'I');
if (!myError.isEmpty() && total == 0)
throw new OBException(myError.getMessage());
}
vars.setSessionValue(request.getParameter("mappingName") +"|hash", vars.getPostDataHash());
vars.setSessionValue(tabId + "|Header.view", "EDIT");
return;
}
try {
tableSQL = new TableSQLData(vars, this, tabId, Utility.getContext(this, vars, "#AccessibleOrgTree", windowId, accesslevel), Utility.getContext(this, vars, "#User_Client", windowId), Utility.getContext(this, vars, "ShowAudit", windowId).equals("Y"));
} catch (Exception ex) {
ex.printStackTrace();
}
String strOrderBy = vars.getSessionValue(tabId + "|orderby");
if (!strOrderBy.equals("")) {
vars.setSessionValue(tabId + "|newOrder", "1");
}
if (vars.commandIn("DEFAULT")) {
String strR_InterestArea_ID = vars.getGlobalVariable("inprInterestareaId", windowId + "|R_InterestArea_ID", "");
String strView = vars.getSessionValue(tabId + "|AreasofInterest.view");
if (strView.equals("")) {
strView = defaultTabView;
if (strView.equals("EDIT")) {
if (strR_InterestArea_ID.equals("")) strR_InterestArea_ID = firstElement(vars, tableSQL);
if (strR_InterestArea_ID.equals("")) strView = "RELATION";
}
}
if (strView.equals("EDIT"))
printPageEdit(response, request, vars, false, strR_InterestArea_ID, tableSQL);
else printPageDataSheet(response, vars, strR_InterestArea_ID, tableSQL);
} else if (vars.commandIn("DIRECT") || vars.commandIn("DIRECTRELATION")) {
String strR_InterestArea_ID = vars.getStringParameter("inpDirectKey");
if (strR_InterestArea_ID.equals("")) strR_InterestArea_ID = vars.getRequiredGlobalVariable("inprInterestareaId", windowId + "|R_InterestArea_ID");
else vars.setSessionValue(windowId + "|R_InterestArea_ID", strR_InterestArea_ID);
if (vars.commandIn("DIRECT")){
vars.setSessionValue(tabId + "|AreasofInterest.view", "EDIT");
printPageEdit(response, request, vars, false, strR_InterestArea_ID, tableSQL);
}
if (vars.commandIn("DIRECTRELATION")){
vars.setSessionValue(tabId + "|AreasofInterest.view", "RELATION");
printPageDataSheet(response, vars, strR_InterestArea_ID, tableSQL);
}
} else if (vars.commandIn("TAB")) {
String strView = vars.getSessionValue(tabId + "|AreasofInterest.view");
String strR_InterestArea_ID = "";
if (strView.equals("")) {
strView = defaultTabView;
if (strView.equals("EDIT")) {
strR_InterestArea_ID = firstElement(vars, tableSQL);
if (strR_InterestArea_ID.equals("")) strView = "RELATION";
}
}
if (strView.equals("EDIT")) {
if (strR_InterestArea_ID.equals("")) strR_InterestArea_ID = firstElement(vars, tableSQL);
printPageEdit(response, request, vars, false, strR_InterestArea_ID, tableSQL);
} else printPageDataSheet(response, vars, "", tableSQL);
} else if (vars.commandIn("SEARCH")) {
vars.getRequestGlobalVariable("inpParamName", tabId + "|paramName");
vars.removeSessionValue(windowId + "|R_InterestArea_ID");
String strR_InterestArea_ID="";
String strView = vars.getSessionValue(tabId + "|AreasofInterest.view");
if (strView.equals("")) strView=defaultTabView;
if (strView.equals("EDIT")) {
strR_InterestArea_ID = firstElement(vars, tableSQL);
if (strR_InterestArea_ID.equals("")) {
// filter returns empty set
strView = "RELATION";
// switch to grid permanently until the user changes the view again
vars.setSessionValue(tabId + "|AreasofInterest.view", strView);
}
}
if (strView.equals("EDIT"))
printPageEdit(response, request, vars, false, strR_InterestArea_ID, tableSQL);
else printPageDataSheet(response, vars, strR_InterestArea_ID, tableSQL);
} else if (vars.commandIn("RELATION")) {
String strR_InterestArea_ID = vars.getGlobalVariable("inprInterestareaId", windowId + "|R_InterestArea_ID", "");
vars.setSessionValue(tabId + "|AreasofInterest.view", "RELATION");
printPageDataSheet(response, vars, strR_InterestArea_ID, tableSQL);
} else if (vars.commandIn("NEW")) {
printPageEdit(response, request, vars, true, "", tableSQL);
} else if (vars.commandIn("EDIT")) {
@SuppressWarnings("unused") // In Expense Invoice tab this variable is not used, to be fixed
String strR_InterestArea_ID = vars.getGlobalVariable("inprInterestareaId", windowId + "|R_InterestArea_ID", "");
vars.setSessionValue(tabId + "|AreasofInterest.view", "EDIT");
setHistoryCommand(request, "EDIT");
printPageEdit(response, request, vars, false, strR_InterestArea_ID, tableSQL);
} else if (vars.commandIn("NEXT")) {
String strR_InterestArea_ID = vars.getRequiredStringParameter("inprInterestareaId");
String strNext = nextElement(vars, strR_InterestArea_ID, tableSQL);
printPageEdit(response, request, vars, false, strNext, tableSQL);
} else if (vars.commandIn("PREVIOUS")) {
String strR_InterestArea_ID = vars.getRequiredStringParameter("inprInterestareaId");
String strPrevious = previousElement(vars, strR_InterestArea_ID, tableSQL);
printPageEdit(response, request, vars, false, strPrevious, tableSQL);
} else if (vars.commandIn("FIRST_RELATION")) {
vars.setSessionValue(tabId + "|AreasofInterest.initRecordNumber", "0");
response.sendRedirect(strDireccion + request.getServletPath() + "?Command=RELATION");
} else if (vars.commandIn("PREVIOUS_RELATION")) {
String strInitRecord = vars.getSessionValue(tabId + "|AreasofInterest.initRecordNumber");
String strRecordRange = Utility.getContext(this, vars, "#RecordRange", windowId);
int intRecordRange = strRecordRange.equals("")?0:Integer.parseInt(strRecordRange);
if (strInitRecord.equals("") || strInitRecord.equals("0")) {
vars.setSessionValue(tabId + "|AreasofInterest.initRecordNumber", "0");
} else {
int initRecord = (strInitRecord.equals("")?0:Integer.parseInt(strInitRecord));
initRecord -= intRecordRange;
strInitRecord = ((initRecord<0)?"0":Integer.toString(initRecord));
vars.setSessionValue(tabId + "|AreasofInterest.initRecordNumber", strInitRecord);
}
vars.removeSessionValue(windowId + "|R_InterestArea_ID");
response.sendRedirect(strDireccion + request.getServletPath() + "?Command=RELATION");
} else if (vars.commandIn("NEXT_RELATION")) {
String strInitRecord = vars.getSessionValue(tabId + "|AreasofInterest.initRecordNumber");
String strRecordRange = Utility.getContext(this, vars, "#RecordRange", windowId);
int intRecordRange = strRecordRange.equals("")?0:Integer.parseInt(strRecordRange);
int initRecord = (strInitRecord.equals("")?0:Integer.parseInt(strInitRecord));
if (initRecord==0) initRecord=1;
initRecord += intRecordRange;
strInitRecord = ((initRecord<0)?"0":Integer.toString(initRecord));
vars.setSessionValue(tabId + "|AreasofInterest.initRecordNumber", strInitRecord);
vars.removeSessionValue(windowId + "|R_InterestArea_ID");
response.sendRedirect(strDireccion + request.getServletPath() + "?Command=RELATION");
} else if (vars.commandIn("FIRST")) {
String strFirst = firstElement(vars, tableSQL);
printPageEdit(response, request, vars, false, strFirst, tableSQL);
} else if (vars.commandIn("LAST_RELATION")) {
String strLast = lastElement(vars, tableSQL);
printPageDataSheet(response, vars, strLast, tableSQL);
} else if (vars.commandIn("LAST")) {
String strLast = lastElement(vars, tableSQL);
printPageEdit(response, request, vars, false, strLast, tableSQL);
} else if (vars.commandIn("SAVE_NEW_RELATION", "SAVE_NEW_NEW", "SAVE_NEW_EDIT")) {
OBError myError = new OBError();
int total = saveRecord(vars, myError, 'I');
if (!myError.isEmpty()) {
response.sendRedirect(strDireccion + request.getServletPath() + "?Command=NEW");
}
else {
if (myError.isEmpty()) {
myError = Utility.translateError(this, vars, vars.getLanguage(), "@CODE=RowsInserted");
myError.setMessage(total + " " + myError.getMessage());
vars.setMessage(tabId, myError);
}
if (vars.commandIn("SAVE_NEW_NEW")) response.sendRedirect(strDireccion + request.getServletPath() + "?Command=NEW");
else if (vars.commandIn("SAVE_NEW_EDIT")) response.sendRedirect(strDireccion + request.getServletPath() + "?Command=EDIT");
else response.sendRedirect(strDireccion + request.getServletPath() + "?Command=RELATION");
}
} else if (vars.commandIn("SAVE_EDIT_RELATION", "SAVE_EDIT_NEW", "SAVE_EDIT_EDIT", "SAVE_EDIT_NEXT")) {
String strR_InterestArea_ID = vars.getRequiredGlobalVariable("inprInterestareaId", windowId + "|R_InterestArea_ID");
OBError myError = new OBError();
int total = saveRecord(vars, myError, 'U');
if (!myError.isEmpty()) {
response.sendRedirect(strDireccion + request.getServletPath() + "?Command=EDIT");
}
else {
if (myError.isEmpty()) {
myError = Utility.translateError(this, vars, vars.getLanguage(), "@CODE=RowsUpdated");
myError.setMessage(total + " " + myError.getMessage());
vars.setMessage(tabId, myError);
}
if (vars.commandIn("SAVE_EDIT_NEW")) response.sendRedirect(strDireccion + request.getServletPath() + "?Command=NEW");
else if (vars.commandIn("SAVE_EDIT_EDIT")) response.sendRedirect(strDireccion + request.getServletPath() + "?Command=EDIT");
else if (vars.commandIn("SAVE_EDIT_NEXT")) {
String strNext = nextElement(vars, strR_InterestArea_ID, tableSQL);
vars.setSessionValue(windowId + "|R_InterestArea_ID", strNext);
response.sendRedirect(strDireccion + request.getServletPath() + "?Command=EDIT");
} else response.sendRedirect(strDireccion + request.getServletPath() + "?Command=RELATION");
}
/* } else if (vars.commandIn("DELETE_RELATION")) {
String strR_InterestArea_ID = vars.getRequiredInStringParameter("inprInterestareaId");
String message = deleteRelation(vars, strR_InterestArea_ID);
if (!message.equals("")) {
bdError(request, response, message, vars.getLanguage());
} else {
vars.removeSessionValue(windowId + "|rInterestareaId");
vars.setSessionValue(tabId + "|AreasofInterest.view", "RELATION");
response.sendRedirect(strDireccion + request.getServletPath());
}*/
} else if (vars.commandIn("DELETE")) {
String strR_InterestArea_ID = vars.getRequiredStringParameter("inprInterestareaId");
//AreasofInterestData data = getEditVariables(vars);
int total = 0;
OBError myError = null;
if (org.openbravo.erpCommon.utility.WindowAccessData.hasReadOnlyAccess(this, vars.getRole(), tabId)) {
myError = Utility.translateError(this, vars, vars.getLanguage(), Utility.messageBD(this, "NoWriteAccess", vars.getLanguage()));
vars.setMessage(tabId, myError);
} else {
try {
total = AreasofInterestData.delete(this, strR_InterestArea_ID, Utility.getContext(this, vars, "#User_Client", windowId, accesslevel), Utility.getContext(this, vars, "#User_Org", windowId, accesslevel));
} catch(ServletException ex) {
myError = Utility.translateError(this, vars, vars.getLanguage(), ex.getMessage());
if (!myError.isConnectionAvailable()) {
bdErrorConnection(response);
return;
} else vars.setMessage(tabId, myError);
}
if (myError==null && total==0) {
myError = Utility.translateError(this, vars, vars.getLanguage(), Utility.messageBD(this, "NoWriteAccess", vars.getLanguage()));
vars.setMessage(tabId, myError);
}
vars.removeSessionValue(windowId + "|rInterestareaId");
vars.setSessionValue(tabId + "|AreasofInterest.view", "RELATION");
}
if (myError==null) {
myError = Utility.translateError(this, vars, vars.getLanguage(), "@CODE=RowsDeleted");
myError.setMessage(total + " " + myError.getMessage());
vars.setMessage(tabId, myError);
}
response.sendRedirect(strDireccion + request.getServletPath());
} else if (vars.getCommand().toUpperCase().startsWith("BUTTON") || vars.getCommand().toUpperCase().startsWith("SAVE_BUTTON")) {
pageErrorPopUp(response);
} else pageError(response);
}
/*
String deleteRelation(VariablesSecureApp vars, String strR_InterestArea_ID) throws IOException, ServletException {
log4j.debug("Deleting records");
Connection conn = this.getTransactionConnection();
try {
if (strR_InterestArea_ID.startsWith("(")) strR_InterestArea_ID = strR_InterestArea_ID.substring(1, strR_InterestArea_ID.length()-1);
if (!strR_InterestArea_ID.equals("")) {
strR_InterestArea_ID = Replace.replace(strR_InterestArea_ID, "'", "");
StringTokenizer st = new StringTokenizer(strR_InterestArea_ID, ",", false);
while (st.hasMoreTokens()) {
String strKey = st.nextToken();
if (AreasofInterestData.deleteTransactional(conn, this, strKey)==0) {
releaseRollbackConnection(conn);
log4j.warn("deleteRelation - key :" + strKey + " - 0 records deleted");
}
}
}
releaseCommitConnection(conn);
} catch (ServletException e) {
releaseRollbackConnection(conn);
e.printStackTrace();
log4j.error("Rollback in transaction");
return "ProcessRunError";
}
return "";
}
*/
private AreasofInterestData getEditVariables(Connection con, VariablesSecureApp vars) throws IOException,ServletException {
AreasofInterestData data = new AreasofInterestData();
ServletException ex = null;
try {
data.rInterestareaId = vars.getRequestGlobalVariable("inprInterestareaId", windowId + "|R_InterestArea_ID"); data.adClientId = vars.getRequestGlobalVariable("inpadClientId", windowId + "|AD_Client_ID"); data.adClientIdr = vars.getStringParameter("inpadClientId_R"); data.adOrgId = vars.getRequestGlobalVariable("inpadOrgId", windowId + "|AD_Org_ID"); data.adOrgIdr = vars.getStringParameter("inpadOrgId_R"); data.name = vars.getStringParameter("inpname"); data.description = vars.getStringParameter("inpdescription"); data.isactive = vars.getStringParameter("inpisactive", "N");
data.createdby = vars.getUser();
data.updatedby = vars.getUser();
data.adUserClient = Utility.getContext(this, vars, "#User_Client", windowId, accesslevel);
data.adOrgClient = Utility.getContext(this, vars, "#AccessibleOrgTree", windowId, accesslevel);
data.updatedTimeStamp = vars.getStringParameter("updatedTimestamp");
}
catch(ServletException e) {
vars.setEditionData(tabId, data);
throw e;
}
// Behavior with exception for numeric fields is to catch last one if we have multiple ones
if(ex != null) {
vars.setEditionData(tabId, data);
throw ex;
}
return data;
}
private AreasofInterestData[] getRelationData(AreasofInterestData[] data) {
if (data!=null) {
for (int i=0;i<data.length;i++) { data[i].rInterestareaId = FormatUtilities.truncate(data[i].rInterestareaId, 10); data[i].adClientId = FormatUtilities.truncate(data[i].adClientId, 44); data[i].adOrgId = FormatUtilities.truncate(data[i].adOrgId, 44); data[i].name = FormatUtilities.truncate(data[i].name, 50); data[i].description = FormatUtilities.truncate(data[i].description, 50);}
}
return data;
}
private void refreshSessionEdit(VariablesSecureApp vars, FieldProvider[] data) {
if (data==null || data.length==0) return;
vars.setSessionValue(windowId + "|R_InterestArea_ID", data[0].getField("rInterestareaId")); vars.setSessionValue(windowId + "|AD_Client_ID", data[0].getField("adClientId")); vars.setSessionValue(windowId + "|AD_Org_ID", data[0].getField("adOrgId"));
}
private void refreshSessionNew(VariablesSecureApp vars) throws IOException,ServletException {
AreasofInterestData[] data = AreasofInterestData.selectEdit(this, vars.getSessionValue("#AD_SqlDateTimeFormat"), vars.getLanguage(), vars.getStringParameter("inprInterestareaId", ""), Utility.getContext(this, vars, "#User_Client", windowId), Utility.getContext(this, vars, "#AccessibleOrgTree", windowId, accesslevel));
if (data==null || data.length==0) return;
refreshSessionEdit(vars, data);
}
private String nextElement(VariablesSecureApp vars, String strSelected, TableSQLData tableSQL) throws IOException, ServletException {
if (strSelected == null || strSelected.equals("")) return firstElement(vars, tableSQL);
if (tableSQL!=null) {
String data = null;
try{
String strSQL = ModelSQLGeneration.generateSQLonlyId(this, vars, tableSQL, (tableSQL.getTableName() + "." + tableSQL.getKeyColumn() + " AS ID"), new Vector<String>(), new Vector<String>(), 0, 0);
ExecuteQuery execquery = new ExecuteQuery(this, strSQL, tableSQL.getParameterValuesOnlyId());
data = execquery.selectAndSearch(ExecuteQuery.SearchType.NEXT, strSelected, tableSQL.getKeyColumn());
} catch (Exception e) {
log4j.error("Error getting next element", e);
}
if (data!=null) {
if (data!=null) return data;
}
}
return strSelected;
}
private int getKeyPosition(VariablesSecureApp vars, String strSelected, TableSQLData tableSQL) throws IOException, ServletException {
if (log4j.isDebugEnabled()) log4j.debug("getKeyPosition: " + strSelected);
if (tableSQL!=null) {
String data = null;
try{
String strSQL = ModelSQLGeneration.generateSQLonlyId(this, vars, tableSQL, (tableSQL.getTableName() + "." + tableSQL.getKeyColumn() + " AS ID"), new Vector<String>(), new Vector<String>(),0,0);
ExecuteQuery execquery = new ExecuteQuery(this, strSQL, tableSQL.getParameterValuesOnlyId());
data = execquery.selectAndSearch(ExecuteQuery.SearchType.GETPOSITION, strSelected, tableSQL.getKeyColumn());
} catch (Exception e) {
log4j.error("Error getting key position", e);
}
if (data!=null) {
// split offset -> (page,relativeOffset)
int absoluteOffset = Integer.valueOf(data);
int page = absoluteOffset / TableSQLData.maxRowsPerGridPage;
int relativeOffset = absoluteOffset % TableSQLData.maxRowsPerGridPage;
log4j.debug("getKeyPosition: absOffset: " + absoluteOffset + "=> page: " + page + " relOffset: " + relativeOffset);
String currPageKey = tabId + "|" + "currentPage";
vars.setSessionValue(currPageKey, String.valueOf(page));
return relativeOffset;
}
}
return 0;
}
private String previousElement(VariablesSecureApp vars, String strSelected, TableSQLData tableSQL) throws IOException, ServletException {
if (strSelected == null || strSelected.equals("")) return firstElement(vars, tableSQL);
if (tableSQL!=null) {
String data = null;
try{
String strSQL = ModelSQLGeneration.generateSQLonlyId(this, vars, tableSQL, (tableSQL.getTableName() + "." + tableSQL.getKeyColumn() + " AS ID"), new Vector<String>(), new Vector<String>(),0,0);
ExecuteQuery execquery = new ExecuteQuery(this, strSQL, tableSQL.getParameterValuesOnlyId());
data = execquery.selectAndSearch(ExecuteQuery.SearchType.PREVIOUS, strSelected, tableSQL.getKeyColumn());
} catch (Exception e) {
log4j.error("Error getting previous element", e);
}
if (data!=null) {
return data;
}
}
return strSelected;
}
private String firstElement(VariablesSecureApp vars, TableSQLData tableSQL) throws IOException, ServletException {
if (tableSQL!=null) {
String data = null;
try{
String strSQL = ModelSQLGeneration.generateSQLonlyId(this, vars, tableSQL, (tableSQL.getTableName() + "." + tableSQL.getKeyColumn() + " AS ID"), new Vector<String>(), new Vector<String>(),0,1);
ExecuteQuery execquery = new ExecuteQuery(this, strSQL, tableSQL.getParameterValuesOnlyId());
data = execquery.selectAndSearch(ExecuteQuery.SearchType.FIRST, "", tableSQL.getKeyColumn());
} catch (Exception e) {
log4j.debug("Error getting first element", e);
}
if (data!=null) return data;
}
return "";
}
private String lastElement(VariablesSecureApp vars, TableSQLData tableSQL) throws IOException, ServletException {
if (tableSQL!=null) {
String data = null;
try{
String strSQL = ModelSQLGeneration.generateSQLonlyId(this, vars, tableSQL, (tableSQL.getTableName() + "." + tableSQL.getKeyColumn() + " AS ID"), new Vector<String>(), new Vector<String>(),0,0);
ExecuteQuery execquery = new ExecuteQuery(this, strSQL, tableSQL.getParameterValuesOnlyId());
data = execquery.selectAndSearch(ExecuteQuery.SearchType.LAST, "", tableSQL.getKeyColumn());
} catch (Exception e) {
log4j.error("Error getting last element", e);
}
if (data!=null) return data;
}
return "";
}
private void printPageDataSheet(HttpServletResponse response, VariablesSecureApp vars, String strR_InterestArea_ID, TableSQLData tableSQL)
throws IOException, ServletException {
if (log4j.isDebugEnabled()) log4j.debug("Output: dataSheet");
String strParamName = vars.getSessionValue(tabId + "|paramName");
boolean hasSearchCondition=false;
vars.removeEditionData(tabId);
if (!(strParamName.equals(""))) hasSearchCondition=true;
String strOffset = "0";
//vars.getSessionValue(tabId + "|offset");
String selectedRow = "0";
if (!strR_InterestArea_ID.equals("")) {
selectedRow = Integer.toString(getKeyPosition(vars, strR_InterestArea_ID, tableSQL));
}
String[] discard={"isNotFiltered","isNotTest"};
if (hasSearchCondition) discard[0] = new String("isFiltered");
if (vars.getSessionValue("#ShowTest", "N").equals("Y")) discard[1] = new String("isTest");
XmlDocument xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpWindows/AreasofInterest/AreasofInterest_Relation", discard).createXmlDocument();
ToolBar toolbar = new ToolBar(this, vars.getLanguage(), "AreasofInterest", false, "document.frmMain.inprInterestareaId", "grid", "..", "".equals("Y"), "AreasofInterest", strReplaceWith, false);
toolbar.prepareRelationTemplate("N".equals("Y"), hasSearchCondition, !vars.getSessionValue("#ShowTest", "N").equals("Y"), false, Utility.getContext(this, vars, "ShowAudit", windowId).equals("Y"));
xmlDocument.setParameter("toolbar", toolbar.toString());
StringBuffer orderByArray = new StringBuffer();
vars.setSessionValue(tabId + "|newOrder", "1");
String positions = vars.getSessionValue(tabId + "|orderbyPositions");
orderByArray.append("var orderByPositions = new Array(\n");
if (!positions.equals("")) {
StringTokenizer tokens=new StringTokenizer(positions, ",");
boolean firstOrder = true;
while(tokens.hasMoreTokens()){
if (!firstOrder) orderByArray.append(",\n");
orderByArray.append("\"").append(tokens.nextToken()).append("\"");
firstOrder = false;
}
}
orderByArray.append(");\n");
String directions = vars.getSessionValue(tabId + "|orderbyDirections");
orderByArray.append("var orderByDirections = new Array(\n");
if (!positions.equals("")) {
StringTokenizer tokens=new StringTokenizer(directions, ",");
boolean firstOrder = true;
while(tokens.hasMoreTokens()){
if (!firstOrder) orderByArray.append(",\n");
orderByArray.append("\"").append(tokens.nextToken()).append("\"");
firstOrder = false;
}
}
orderByArray.append(");\n");
// }
xmlDocument.setParameter("selectedColumn", "\nvar selectedRow = " + selectedRow + ";\n" + orderByArray.toString());
xmlDocument.setParameter("directory", "var baseDirectory = \"" + strReplaceWith + "/\";\n");
xmlDocument.setParameter("windowId", windowId);
xmlDocument.setParameter("KeyName", "rInterestareaId");
xmlDocument.setParameter("language", "defaultLang=\"" + vars.getLanguage() + "\";");
xmlDocument.setParameter("theme", vars.getTheme());
//xmlDocument.setParameter("buttonReference", Utility.messageBD(this, "Reference", vars.getLanguage()));
try {
WindowTabs tabs = new WindowTabs(this, vars, tabId, windowId, false);
xmlDocument.setParameter("parentTabContainer", tabs.parentTabs());
xmlDocument.setParameter("mainTabContainer", tabs.mainTabs());
xmlDocument.setParameter("childTabContainer", tabs.childTabs());
NavigationBar nav = new NavigationBar(this, vars.getLanguage(), "AreasofInterest_Relation.html", "AreasofInterest", "W", strReplaceWith, tabs.breadcrumb());
xmlDocument.setParameter("navigationBar", nav.toString());
LeftTabsBar lBar = new LeftTabsBar(this, vars.getLanguage(), "AreasofInterest_Relation.html", strReplaceWith);
xmlDocument.setParameter("leftTabs", lBar.relationTemplate());
} catch (Exception ex) {
throw new ServletException(ex);
}
{
OBError myMessage = vars.getMessage(tabId);
vars.removeMessage(tabId);
if (myMessage!=null) {
xmlDocument.setParameter("messageType", myMessage.getType());
xmlDocument.setParameter("messageTitle", myMessage.getTitle());
xmlDocument.setParameter("messageMessage", myMessage.getMessage());
}
}
xmlDocument.setParameter("grid", Utility.getContext(this, vars, "#RecordRange", windowId));
xmlDocument.setParameter("grid_Offset", strOffset);
xmlDocument.setParameter("grid_SortCols", positions);
xmlDocument.setParameter("grid_SortDirs", directions);
xmlDocument.setParameter("grid_Default", selectedRow);
response.setContentType("text/html; charset=UTF-8");
PrintWriter out = response.getWriter();
out.println(xmlDocument.print());
out.close();
}
private void printPageEdit(HttpServletResponse response, HttpServletRequest request, VariablesSecureApp vars,boolean boolNew, String strR_InterestArea_ID, TableSQLData tableSQL)
throws IOException, ServletException {
if (log4j.isDebugEnabled()) log4j.debug("Output: edit");
HashMap<String, String> usedButtonShortCuts;
usedButtonShortCuts = new HashMap<String, String>();
String strOrderByFilter = vars.getSessionValue(tabId + "|orderby");
String orderClause = " R_InterestArea.Name";
if (strOrderByFilter==null || strOrderByFilter.equals("")) strOrderByFilter = orderClause;
/*{
if (!strOrderByFilter.equals("") && !orderClause.equals("")) strOrderByFilter += ", ";
strOrderByFilter += orderClause;
}*/
String strCommand = null;
AreasofInterestData[] data=null;
XmlDocument xmlDocument=null;
FieldProvider dataField = vars.getEditionData(tabId);
vars.removeEditionData(tabId);
String strParamName = vars.getSessionValue(tabId + "|paramName");
boolean hasSearchCondition=false;
if (!(strParamName.equals(""))) hasSearchCondition=true;
String strParamSessionDate = vars.getGlobalVariable("inpParamSessionDate", Utility.getTransactionalDate(this, vars, windowId), "");
String buscador = "";
String[] discard = {"", "isNotTest"};
if (vars.getSessionValue("#ShowTest", "N").equals("Y")) discard[1] = new String("isTest");
if (dataField==null) {
if (!boolNew) {
discard[0] = new String("newDiscard");
data = AreasofInterestData.selectEdit(this, vars.getSessionValue("#AD_SqlDateTimeFormat"), vars.getLanguage(), strR_InterestArea_ID, Utility.getContext(this, vars, "#User_Client", windowId), Utility.getContext(this, vars, "#AccessibleOrgTree", windowId, accesslevel));
if (!strR_InterestArea_ID.equals("") && (data == null || data.length==0)) {
response.sendRedirect(strDireccion + request.getServletPath() + "?Command=RELATION");
return;
}
refreshSessionEdit(vars, data);
strCommand = "EDIT";
}
if (boolNew || data==null || data.length==0) {
discard[0] = new String ("editDiscard");
strCommand = "NEW";
data = new AreasofInterestData[0];
} else {
discard[0] = new String ("newDiscard");
}
} else {
if (dataField.getField("rInterestareaId") == null || dataField.getField("rInterestareaId").equals("")) {
discard[0] = new String ("editDiscard");
strCommand = "NEW";
boolNew = true;
} else {
discard[0] = new String ("newDiscard");
strCommand = "EDIT";
}
}
if (dataField==null) {
if (boolNew || data==null || data.length==0) {
refreshSessionNew(vars);
data = AreasofInterestData.set(Utility.getDefault(this, vars, "Name", "", "245", "438", "", dataField), Utility.getDefault(this, vars, "Description", "", "245", "438", "", dataField), Utility.getDefault(this, vars, "AD_Org_ID", "@AD_Org_ID@", "245", "438", "", dataField), Utility.getDefault(this, vars, "UpdatedBy", "", "245", "438", "", dataField), AreasofInterestData.selectDef7780_0(this, Utility.getDefault(this, vars, "UpdatedBy", "", "245", "438", "", dataField)), "", Utility.getDefault(this, vars, "AD_Client_ID", "@AD_CLIENT_ID@", "245", "438", "", dataField), "Y", Utility.getDefault(this, vars, "CreatedBy", "", "245", "438", "", dataField), AreasofInterestData.selectDef7786_1(this, Utility.getDefault(this, vars, "CreatedBy", "", "245", "438", "", dataField)));
}
} else {
data = new AreasofInterestData[1];
java.lang.Object ref1= dataField;
data[0]=(AreasofInterestData) ref1;
data[0].created="";
data[0].updated="";
}
String currentOrg = (boolNew?"":(dataField!=null?dataField.getField("adOrgId"):data[0].getField("adOrgId")));
if (!currentOrg.equals("") && !currentOrg.startsWith("'")) currentOrg = "'"+currentOrg+"'";
String currentClient = (boolNew?"":(dataField!=null?dataField.getField("adClientId"):data[0].getField("adClientId")));
if (!currentClient.equals("") && !currentClient.startsWith("'")) currentClient = "'"+currentClient+"'";
boolean editableTab = (!org.openbravo.erpCommon.utility.WindowAccessData.hasReadOnlyAccess(this, vars.getRole(), tabId) && (currentOrg.equals("") || Utility.isElementInList(Utility.getContext(this, vars, "#User_Org", windowId, accesslevel),currentOrg)) && (currentClient.equals("") || Utility.isElementInList(Utility.getContext(this, vars, "#User_Client", windowId, accesslevel), currentClient)));
if (Formhelper.isTabReadOnly(this, vars, tabId))
editableTab=false;
ToolBar toolbar = new ToolBar(this, editableTab, vars.getLanguage(), "AreasofInterest", (strCommand.equals("NEW") || boolNew || (dataField==null && (data==null || data.length==0))), "document.frmMain.inprInterestareaId", "", "..", "".equals("Y"), "AreasofInterest", strReplaceWith, true, false, false, Utility.hasTabAttachments(this, vars, tabId, strR_InterestArea_ID));
toolbar.prepareEditionTemplate("N".equals("Y"), hasSearchCondition, vars.getSessionValue("#ShowTest", "N").equals("Y"), "STD", Utility.getContext(this, vars, "ShowAudit", windowId).equals("Y"));
// set updated timestamp to manage locking mechanism
String updatedTimestamp="";
if (!boolNew) {
updatedTimestamp=(dataField != null ? dataField.getField("updatedTimeStamp") : data[0].getField("updatedTimeStamp"));
}
this.setUpdatedtimestamp(updatedTimestamp);
// this.setOrgparent(currentPOrg);
this.setCommandtype(strCommand);
try {
WindowTabs tabs = new WindowTabs(this, vars, tabId, windowId, true, (strCommand.equalsIgnoreCase("NEW")));
response.setContentType("text/html; charset=UTF-8");
PrintWriter output = response.getWriter();
Connection conn = null;
Scripthelper script = new Scripthelper();
if (boolNew)
script.addHiddenfieldWithID("newdatasetindicator", "NEW");
else
script.addHiddenfieldWithID("newdatasetindicator", "");
script.addHiddenfieldWithID("enabledautosave", "Y");
script.addMessage(this, vars, vars.getMessage(tabId));
Formhelper fh=new Formhelper();
String strLeftabsmode="EDIT";
String focus=fh.TabGetFirstFocusField(this,tabId);
String strSkeleton = ConfigureFrameWindow.doConfigureWindowMode(this,vars,Sqlc.TransformaNombreColumna(focus),tabs.breadcrumb(), "Form Window",null,strLeftabsmode,tabs,"_Relation",toolbar.toString());
String strTableStructure="";
if (editableTab||tabId.equalsIgnoreCase("800026"))
strTableStructure=fh.prepareTabFields(this, vars, script, tabId,data[0], Utility.getContext(this, vars, "ShowAudit", windowId).equals("Y"));
else
strTableStructure=fh.prepareTabFieldsRO(this, vars, script, tabId,data[0], Utility.getContext(this, vars, "ShowAudit", windowId).equals("Y"));
strSkeleton=Replace.replace(strSkeleton, "@CONTENT@", strTableStructure );
script.addOnload("setProcessingMode('window', false);");
strSkeleton = script.doScript(strSkeleton, "",this,vars);
output.println(strSkeleton);
vars.removeMessage(tabId);
output.close();
} catch (Exception ex) {
throw new ServletException(ex);
}
}
void printPageButtonFS(HttpServletResponse response, VariablesSecureApp vars, String strProcessId, String path) throws IOException, ServletException {
log4j.debug("Output: Frames action button");
response.setContentType("text/html; charset=UTF-8");
PrintWriter out = response.getWriter();
XmlDocument xmlDocument = xmlEngine.readXmlTemplate(
"org/openbravo/erpCommon/ad_actionButton/ActionButtonDefaultFrames").createXmlDocument();
xmlDocument.setParameter("processId", strProcessId);
xmlDocument.setParameter("trlFormType", "PROCESS");
xmlDocument.setParameter("language", "defaultLang = \"" + vars.getLanguage() + "\";\n");
xmlDocument.setParameter("type", strDireccion + path);
out.println(xmlDocument.print());
out.close();
}
private String getDisplayLogicContext(VariablesSecureApp vars, boolean isNew) throws IOException, ServletException {
log4j.debug("Output: Display logic context fields");
String result = "var strShowAudit=\"" +(isNew?"N":Utility.getContext(this, vars, "ShowAudit", windowId)) + "\";\n";
return result;
}
private String getReadOnlyLogicContext(VariablesSecureApp vars) throws IOException, ServletException {
log4j.debug("Output: Read Only logic context fields");
String result = "";
return result;
}
private String getShortcutScript( HashMap<String, String> usedButtonShortCuts){
StringBuffer shortcuts = new StringBuffer();
shortcuts.append(" function buttonListShorcuts() {\n");
Iterator<String> ik = usedButtonShortCuts.keySet().iterator();
Iterator<String> iv = usedButtonShortCuts.values().iterator();
while(ik.hasNext() && iv.hasNext()){
shortcuts.append(" keyArray[keyArray.length] = new keyArrayItem(\"").append(ik.next()).append("\", \"").append(iv.next()).append("\", null, \"altKey\", false, \"onkeydown\");\n");
}
shortcuts.append(" return true;\n}");
return shortcuts.toString();
}
private int saveRecord(VariablesSecureApp vars, OBError myError, char type) throws IOException, ServletException {
AreasofInterestData data = null;
int total = 0;
if (org.openbravo.erpCommon.utility.WindowAccessData.hasReadOnlyAccess(this, vars.getRole(), tabId)) {
OBError newError = Utility.translateError(this, vars, vars.getLanguage(), Utility.messageBD(this, "NoWriteAccess", vars.getLanguage()));
myError.setError(newError);
vars.setMessage(tabId, myError);
}
else {
Connection con = null;
try {
con = this.getTransactionConnection();
data = getEditVariables(con, vars);
data.dateTimeFormat = vars.getSessionValue("#AD_SqlDateTimeFormat");
String strSequence = "";
if(type == 'I') {
strSequence = SequenceIdData.getUUID();
if(log4j.isDebugEnabled()) log4j.debug("Sequence: " + strSequence);
data.rInterestareaId = strSequence;
}
if (Utility.isElementInList(Utility.getContext(this, vars, "#User_Client", windowId, accesslevel),data.adClientId) && Utility.isElementInList(Utility.getContext(this, vars, "#User_Org", windowId, accesslevel),data.adOrgId)){
if(type == 'I') {
total = data.insert(con, this);
} else {
//Check the version of the record we are saving is the one in DB
if (AreasofInterestData.getCurrentDBTimestamp(this, data.rInterestareaId).equals(
vars.getStringParameter("updatedTimestamp"))) {
total = data.update(con, this);
} else {
myError.setMessage(Replace.replace(Replace.replace(Utility.messageBD(this,
"SavingModifiedRecord", vars.getLanguage()), "\\n", "<br/>"), """, "\""));
myError.setType("Error");
vars.setSessionValue(tabId + "|concurrentSave", "true");
}
}
}
else {
OBError newError = Utility.translateError(this, vars, vars.getLanguage(), Utility.messageBD(this, "NoWriteAccess", vars.getLanguage()));
myError.setError(newError);
}
releaseCommitConnection(con);
CrudOperations.UpdateCustomFields(tabId, data.rInterestareaId, vars, this);
} catch(Exception ex) {
OBError newError = Utility.translateError(this, vars, vars.getLanguage(), ex.getMessage());
myError.setError(newError);
try {
releaseRollbackConnection(con);
} catch (final Exception e) { //do nothing
}
}
if (myError.isEmpty() && total == 0) {
OBError newError = Utility.translateError(this, vars, vars.getLanguage(), "@CODE=DBExecuteError");
myError.setError(newError);
}
vars.setMessage(tabId, myError);
if(!myError.isEmpty()){
if(data != null ) {
if(type == 'I') {
data.rInterestareaId = "";
}
else {
}
vars.setEditionData(tabId, data);
}
}
else {
vars.setSessionValue(windowId + "|R_InterestArea_ID", data.rInterestareaId);
}
}
return total;
}
public String getServletInfo() {
return "Servlet AreasofInterest. This Servlet was made by Wad constructor";
} // End of getServletInfo() method
}
| [
"neeko@gmx.de"
] | neeko@gmx.de |
abb23909cb00d8f3edd0a2b9d5f6d0e17f77f42c | 276f946d29ce93b060b4a96baed15f13c5674617 | /app/src/main/java/com/PrivateRouter/PrivateMail/dbase/ArrayIntegerConverter.java | 276a50b4cdb7896cb597262a37d5ac4f5623649c | [] | no_license | afterlogic/android-privaterouter | 9f4dc618c44ca91f978e3fd2171dd3e631c35b8f | 8f6898ba18b3393ad21e30fa0f8a575df87e23e1 | refs/heads/master | 2020-06-15T18:41:33.184088 | 2019-07-11T11:36:57 | 2019-07-11T11:36:57 | 195,366,750 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 675 | java | package com.PrivateRouter.PrivateMail.dbase;
import android.arch.persistence.room.TypeConverter;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.ArrayList;
public class ArrayIntegerConverter {
@TypeConverter
public static ArrayList<Integer> fromString(String value) {
Type listType = new TypeToken<ArrayList<Integer>>() {}.getType();
return new Gson().fromJson(value , listType);
}
@TypeConverter
public static String fromArrayList(ArrayList<Integer> list) {
Gson gson = new Gson();
String json = gson.toJson(list);
return json;
}
}
| [
"alexander.v.levitsky@gmail.com"
] | alexander.v.levitsky@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.