blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1b2738b9c1a786425ad25b380c8de06b2337df2b | d44271b16ef4a762e57273f276330c69bba09343 | /Microservice/src/main/java/com/rifu/entity/ZavaVerifyCode.java | 15c571b90de730dcdce44d03f03c2d251d1dbfed | [] | no_license | 13071679487/IdeaProjects | 55e91e97172b328297a6ae1ccef68a621bcc9407 | ca3dca208a9df41497524e3d19df47414b3be1ea | refs/heads/master | 2020-04-03T20:33:20.722181 | 2018-10-31T11:52:15 | 2018-10-31T11:52:15 | 155,548,812 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,104 | java | package com.rifu.entity;
import java.io.Serializable;
import java.util.Date;
public class ZavaVerifyCode implements Serializable {
private Integer id;
private String account;
private String verifyCode;
private Date createTime;
private Date updateTime;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account == null ? null : account.trim();
}
public String getVerifyCode() {
return verifyCode;
}
public void setVerifyCode(String verifyCode) {
this.verifyCode = verifyCode == null ? null : verifyCode.trim();
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
} | [
"[email protected]"
] | |
8672c09489eaa29065767a053c7956889fdb0a02 | 0753867c790281239b8f213ac547d5b6a8451a33 | /ex_lib/simple_rt/src/java/io/PrintStream.java | ee7d489a594866ba18dcd9fc1337371da409f1e1 | [
"LicenseRef-scancode-public-domain"
] | permissive | zhujiabin/miniJVM | 386325e8554a6cbaa2442096a16b91767d75d4a7 | 4ae1cd1a40c5e23cb8f4bec0ebe1a3b94c611d8c | refs/heads/master | 2020-04-28T05:57:09.444049 | 2019-03-07T08:17:27 | 2019-03-07T08:17:27 | 175,038,279 | 1 | 0 | null | 2019-03-11T16:14:52 | 2019-03-11T16:14:51 | null | UTF-8 | Java | false | false | 1,413 | 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 java.io;
import java.lang.Integer;
import java.lang.String;
/**
*
* @author gust
*/
public class PrintStream {
public PrintStream() {
}
public void print(String s) {
printImpl(s);
}
public void println(String s) {
printImpl(s + "\n");
}
public void print(int v) {
printImpl(Integer.toString(v));
}
public void println(int v) {
printImpl(Integer.toString(v) + "\n");
}
public void print(long v) {
printImpl(Long.toString(v));
}
public void println(long v) {
printImpl(Long.toString(v) + "\n");
}
public void print(float d) {
printImpl(Double.toString(d));
}
public void println(float d) {
printImpl(Double.toString(d) + "\n");
}
public void print(double d) {
printImpl(Double.toString(d));
}
public void println(double d) {
printImpl(Double.toString(d) + "\n");
}
public void println() {
printImpl(new String("\n"));
}
// void printImpl(String s){
// java.lang.System.out.println("");
// }
static native void printImpl(String s);
}
| [
"[email protected]"
] | |
ad2296cc7c9eca6460acf7f382d85520b8a0919b | bb1dc28e55e9d7115b91060731bf6d918ff9043a | /app/src/main/java/com/wxine/android/CDAdapter.java | 832f6c74e705b0668451865932e7863d415576be | [] | no_license | Bem-Leeeeee/wxine-online | 701d026c502687e99b7a84590c1828ca78322286 | d36800a02e2e49cdc324bf0ff6bbac197a5cafbb | refs/heads/master | 2021-06-01T13:20:03.701794 | 2016-07-05T02:12:26 | 2016-07-05T02:12:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,883 | java | package com.wxine.android;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.example.wxine_online.wxine_online.R;
import com.wxine.android.utils.CircleImageView;
public class CDAdapter extends BaseAdapter{
private String names[];
private int icons[];
private Context mContext;
private TextView name_tv;
private CircleImageView img;
private View deleteView;
private boolean isShowDelete;//根据这个变量来判断是否显示删除图标,true是显示,false是不显示
public CDAdapter(Context mContext, String names[], int icons[]) {
this.mContext = mContext;
this.names=names;
this.icons=icons;
}
public void setIsShowDelete(boolean isShowDelete){
this.isShowDelete=isShowDelete;
notifyDataSetChanged();
}
@Override
public int getCount() {
return icons.length;
}
@Override
public Object getItem(final int position) {
// TODO Auto-generated method stub
deleteView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
return icons[position];
}
@Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
convertView = LayoutInflater.from(mContext).inflate(
R.layout.grid_item, null);
img = (CircleImageView) convertView.findViewById(R.id.img);
name_tv = (TextView) convertView.findViewById(R.id.name_tv);
deleteView = convertView.findViewById(R.id.delete_markView);
deleteView.setVisibility(isShowDelete ? View.VISIBLE : View.GONE);//设置删除按钮是否显示
img.setImageResource(icons[position]);
name_tv.setText(names[position]);
return convertView;
}
}
| [
"[email protected]"
] | |
64ab97da00f58d51f2fda06ed011b8874d4e7570 | 1dbbafec723fbe16fdec250aab8d66fe298a72e5 | /app/src/androidTest/java/org/chzz/map/ApplicationTest.java | 343d99657f2dcb781b7fcf2fd852823916c779fd | [] | no_license | xiaoxinxing12/ChzzMap-Android | ba4f27e5af6cd76f02ee3688f25c528eb07f789d | cf119001cbae8a540a31da7375fe37413e5f7361 | refs/heads/master | 2021-01-16T20:38:31.071026 | 2016-08-05T10:13:00 | 2016-08-05T10:13:00 | 64,924,805 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 343 | java | package org.chzz.map;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
} | [
"[email protected]"
] | |
b3933b7241c12ff195e318fd5b74b39baf1fafbc | e42c98daf48cb6b70e3dbd5f5af3517d901a06ab | /modules/uctool-manager/src/main/java/com/cisco/axl/api/_10/ListProcessNodeReq.java | 0f27e654aaf8ff906b60b5d4f717f9845dc7a889 | [] | no_license | mgnext/UCTOOL | c238d8f295e689a8babcc1156eb0b487cba31da0 | 5e7aeb422a33b3cf33fca0231616ac0416d02f1a | refs/heads/master | 2020-06-03T04:07:57.650216 | 2015-08-07T10:44:04 | 2015-08-07T10:44:04 | 39,693,900 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 7,913 | java |
package com.cisco.axl.api._10;
import java.math.BigInteger;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for ListProcessNodeReq complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="ListProcessNodeReq">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="searchCriteria">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="processNodeRole" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* <element name="returnedTags" type="{http://www.cisco.com/AXL/API/10.5}LProcessNode"/>
* <element name="skip" type="{http://www.w3.org/2001/XMLSchema}unsignedLong" minOccurs="0"/>
* <element name="first" type="{http://www.w3.org/2001/XMLSchema}unsignedLong" minOccurs="0"/>
* </sequence>
* <attribute name="sequence" type="{http://www.w3.org/2001/XMLSchema}unsignedLong" />
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ListProcessNodeReq", propOrder = {
"searchCriteria",
"returnedTags",
"skip",
"first"
})
public class ListProcessNodeReq {
@XmlElement(required = true)
protected ListProcessNodeReq.SearchCriteria searchCriteria;
@XmlElement(required = true)
protected LProcessNode returnedTags;
@XmlSchemaType(name = "unsignedLong")
protected BigInteger skip;
@XmlSchemaType(name = "unsignedLong")
protected BigInteger first;
@XmlAttribute(name = "sequence")
@XmlSchemaType(name = "unsignedLong")
protected BigInteger sequence;
/**
* Gets the value of the searchCriteria property.
*
* @return
* possible object is
* {@link ListProcessNodeReq.SearchCriteria }
*
*/
public ListProcessNodeReq.SearchCriteria getSearchCriteria() {
return searchCriteria;
}
/**
* Sets the value of the searchCriteria property.
*
* @param value
* allowed object is
* {@link ListProcessNodeReq.SearchCriteria }
*
*/
public void setSearchCriteria(ListProcessNodeReq.SearchCriteria value) {
this.searchCriteria = value;
}
/**
* Gets the value of the returnedTags property.
*
* @return
* possible object is
* {@link LProcessNode }
*
*/
public LProcessNode getReturnedTags() {
return returnedTags;
}
/**
* Sets the value of the returnedTags property.
*
* @param value
* allowed object is
* {@link LProcessNode }
*
*/
public void setReturnedTags(LProcessNode value) {
this.returnedTags = value;
}
/**
* Gets the value of the skip property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getSkip() {
return skip;
}
/**
* Sets the value of the skip property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setSkip(BigInteger value) {
this.skip = value;
}
/**
* Gets the value of the first property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getFirst() {
return first;
}
/**
* Sets the value of the first property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setFirst(BigInteger value) {
this.first = value;
}
/**
* Gets the value of the sequence property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getSequence() {
return sequence;
}
/**
* Sets the value of the sequence property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setSequence(BigInteger value) {
this.sequence = value;
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="processNodeRole" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"name",
"description",
"processNodeRole"
})
public static class SearchCriteria {
protected String name;
protected String description;
protected String processNodeRole;
/**
* Gets the value of the name property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getName() {
return name;
}
/**
* Sets the value of the name property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setName(String value) {
this.name = value;
}
/**
* Gets the value of the description property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDescription() {
return description;
}
/**
* Sets the value of the description property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDescription(String value) {
this.description = value;
}
/**
* Gets the value of the processNodeRole property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getProcessNodeRole() {
return processNodeRole;
}
/**
* Sets the value of the processNodeRole property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setProcessNodeRole(String value) {
this.processNodeRole = value;
}
}
}
| [
"[email protected]"
] | |
4e64d31c44ac145ad5cb6092226beec98fe14769 | e969d1d1df39d5cb70f2ad2b36659d424693c4fc | /test/src/main/java/com/hxq/demo/service/impl/UserServiceImplV2.java | e1635b493f87b059bec5a28ba35be61d18651a5c | [] | no_license | daydayupxjp/hjt | 68e5293aac151f4fce8463bb13c92478ecb55931 | 3f5914af82c928fc52b9e949ef300bab034cddc8 | refs/heads/master | 2022-06-28T05:04:45.723432 | 2019-11-27T10:45:54 | 2019-11-27T10:45:54 | 183,212,889 | 0 | 0 | null | 2022-06-21T02:16:37 | 2019-04-24T11:14:52 | Java | UTF-8 | Java | false | false | 834 | java | package com.hxq.demo.service.impl;
import com.hxq.demo.dao.UserInfoMapper;
import com.hxq.demo.entity.Role;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
/**
* @ClassName UserServiceImplV2
* @Description TODO
* @Author hongxq
* @Date 2019/11/14 0014 10:14
* @Version 1.0
**/
@Service
public class UserServiceImplV2 {
@Autowired
UserInfoMapper userInfoMapper;
//B
@Transactional(rollbackFor = Exception.class,propagation = Propagation.REQUIRES_NEW)
public void initRoleInfo(){
Role role = new Role();
role.setRoleName("test");
userInfoMapper.saveRole(role);
int i = 1/0;
}
}
| [
"[email protected]"
] | |
33904d655fb9b8a90ebee58029626f21589f0b24 | ce10054a844302dea4cc23b2e97ee38764d6c4ed | /frontendapp/android/app/src/main/java/com/frontendapp/MainApplication.java | c17687f7461db25517da6a79f2364d9d02ed547c | [] | no_license | sgxcj777/PsychPal | 3af2a2659f426e97ea6596821f0189031a10f249 | 16ada9076977797adb5f85e226e5d3ec8b85268f | refs/heads/master | 2022-04-09T00:02:52.535061 | 2019-07-29T07:55:03 | 2019-07-29T07:55:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,325 | java | package com.frontendapp;
import android.app.Application;
import com.facebook.react.ReactApplication;
import com.learnium.RNDeviceInfo.RNDeviceInfo;
import com.oblador.vectoricons.VectorIconsPackage;
import com.swmansion.gesturehandler.react.RNGestureHandlerPackage;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;
import java.util.Arrays;
import java.util.List;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new RNDeviceInfo(),
new VectorIconsPackage(),
new RNGestureHandlerPackage()
);
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
}
}
| [
"[email protected]"
] | |
0f89246f6d8f6d5dccae1fdbd7de3fb90d41696c | d5fe966fe2189398ca1825d4f3decc38c7e0c75f | /app/src/main/java/com/example/myapplication/NewListContents.java | af08f32fc8911c44f1746dfc57444ac99f716c75 | [] | no_license | HarshShirke25/Women-Safety-App | 7c81d4b3e5edf284f93522c923c65c0417933343 | aae8d4f70b8960f447b275e1dff64b691a0f60e3 | refs/heads/main | 2023-05-28T14:44:51.288340 | 2021-06-14T18:24:13 | 2021-06-14T18:24:13 | 376,919,256 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,322 | java | package com.example.myapplication;
import android.annotation.SuppressLint;
import android.database.Cursor;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.Toast;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import java.util.ArrayList;
public class NewListContents extends AppCompatActivity {
DatabaseHandler myDB;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.viewcontents_layout);
@SuppressLint("WrongViewCast") ListView listView = (ListView) findViewById(R.id.views);
myDB = new DatabaseHandler(this);
ArrayList<String> theList = new ArrayList<>();
Cursor data = myDB.getListContents();
if (data.getCount() == 0) {
Toast.makeText(NewListContents.this, "There is no contact", Toast.LENGTH_SHORT).show();
} else {
while (data.moveToNext()) {
theList.add(data.getString(1));
ListAdapter listAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, theList);
listView.setAdapter(listAdapter);
}
}
}
}
| [
"[email protected]"
] | |
4b56bc5209d963a999819dff455a27390ab71e90 | 57d151f463cc0f0424de701cd287b4a538a0065e | /mega_repaso/src/pro_ev1/tanda3ej7.java | f5242458e5b4ce434d4cd9f58df0afcb7d93dcd2 | [] | no_license | svivancos/src_java | dfb0d88ace38963a80ff8f656e0abfb7533973e7 | 1e24a3797eb32c48d6b7debcfc69cea805e1cd5c | refs/heads/master | 2020-04-30T08:52:26.483113 | 2015-08-31T11:26:18 | 2015-08-31T11:26:18 | 41,671,821 | 0 | 0 | null | null | null | null | WINDOWS-1250 | Java | false | false | 945 | java | package pro_ev1;
public class tanda3ej7 {
public static void main(String[] args) {
int[] vec = {5,6,8,9,7,4,3,10,1};
System.out.print("Sin orden: ");
for(int i = 0; i < vec.length; i++){
System.out.print(vec[i]+" ");
}
System.out.println();
System.out.print("Ordenado: ");
int i, j, menor, pos, tmp;
// FASE 1, cogemos el primer valor lo damos como si fuera el menor y posteriormente probaremos el resto
for (i = 0; i < vec.length - 1; i++) {
menor = vec[i];
pos = i;
// FASE 2, con ese teórico menor lo cotejamos con los demás en busca de uno menor
for (j = i + 1; j < vec.length; j++){
if (vec[j] < menor) {
menor = vec[j];
pos = j;
}
}
// FASE 3, si hay uno menor se intercambian las posiciones
if (pos != i){
tmp = vec[i];
vec[i] = vec[pos];
vec[pos] = tmp;
}
}
for(int k = 0; k < vec.length; k++){
System.out.print(vec[k]+" ");
}
}
}
| [
"[email protected]"
] | |
e2d934383365baac8f6adc887009abce957d8b30 | a906b0b4ef153627329d7d8033c5395de9cee1cb | /src/test/java/leavehomesafely/handlers/FallbackIntentHandlerTest.java | 49b18fa6eff8ab8817b23949d6df2f321ad34807 | [
"LicenseRef-scancode-unknown-license-reference",
"CC-BY-4.0",
"LicenseRef-scancode-public-domain",
"Apache-2.0"
] | permissive | MUAS-DTLab-WiSe19-20-Alexa-Demenz/WiSe19-20-Alexa-Demenz-LeaveHomeSafely | 580aed3e2ed46dd47078c6aeae9fe9d8691f59cb | 67c38f4e9c049d265340de5cc7da238d4081ea7a | refs/heads/master | 2023-04-22T14:19:25.554335 | 2021-05-04T14:53:50 | 2021-05-04T14:53:50 | 274,386,650 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,018 | java | package leavehomesafely.handlers;
import com.amazon.ask.dispatcher.request.handler.HandlerInput;
import com.amazon.ask.model.Response;
import leavehomesafely.PhrasesAndConstants;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
import static org.junit.Assert.assertTrue;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.when;
public class FallbackIntentHandlerTest {
private FallbackIntentHandler handler;
@Before
public void setup() {
handler = new FallbackIntentHandler();
}
@Test
public void testCanHandle() {
final HandlerInput inputMock = Mockito.mock(HandlerInput.class);
when(inputMock.matches(any())).thenReturn(true);
assertTrue(handler.canHandle(inputMock));
}
/*
@Test
public void testHandle() {
final Response response = TestUtil.standardTestForHandle(handler);
assertTrue(response.getOutputSpeech().toString().contains(PhrasesAndConstants.FALLBACK));
}
*/
}
| [
"[email protected]"
] | |
ccde0387c692240d8bece67d1cfaa5e39bda2b94 | f845d8a05d86d93480cf7c6f634b2b36a645a8ea | /functional_programming/src/main/java/com/epam/functional_programming/PalindromeString.java | 33ddc598e8633024dff0c7e816ee086eee70065d | [] | no_license | IshaShylu/java-8-lambda-and-stream | cece5ebe4825243e82474ae0f276e7b1dbabc460 | bc838dae86dba855dcfabd7e8dfefb96da494dd5 | refs/heads/master | 2022-11-19T21:25:03.244291 | 2020-07-24T08:35:25 | 2020-07-24T08:35:25 | 282,165,025 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 598 | java | package com.epam.functional_programming;
import java.util.Arrays;
import java.util.List;
import java.util.function.Predicate;
import java.util.stream.Collectors;
public class PalindromeString {
public static void main(String args[])
{
List<String> ls=Arrays.asList("ababa","madam","banana","refer","kayak","sir","computer");
checkPalindrome(ls,Palindrome::isPalindrome).forEach(System.out::println);
}
private static List<String> checkPalindrome(List<String> ls, Predicate<String> myPredicate) {
return ls.stream().filter(st -> myPredicate.test(st)).collect(Collectors.toList());
}
}
| [
"[email protected]"
] | |
39a6db6dce611e3f6b6ddf6c47dae324610871e5 | 2e17e8dd21931b8603be7e65b611d5831a3dcf6b | /src/main/java/com/tharuke/lhi/repository/CustomerRepository.java | 0c7a77a05bdba3b0bc274cc0c27263edee29b675 | [] | no_license | TharukeJay/lhi-backend | 0c2b3c190a82eb756488b85fd3faffbabd3b7918 | f65d7071f16424f1d7015ed537f57a6e0b6dc773 | refs/heads/master | 2023-08-15T02:49:45.345020 | 2021-09-26T04:48:35 | 2021-09-26T04:48:35 | 400,353,704 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 797 | java | package com.tharuke.lhi.repository;
import com.tharuke.lhi.repository.model.Customer;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface CustomerRepository extends MongoRepository<Customer,String> {
List<Customer> findAll();
Customer findCustomerByCustomerId(String customerId);
boolean existsCustomerByCustomerName(String customerName);
boolean existsCustomerByCustomerId(String customerId);
@Query("{'$or':[ {'customerName':{'$regex':?0, $options: 'i'}}, {'town':{'$regex':?1, $options: 'i'}} ] }")
List<Customer> searchAllByCustomerNameAndTown(String customerName, String townText);
}
| [
"[email protected]"
] | |
9c76f10de8587ee32ebcf9dab760cb77ab5be885 | ef2302b9d1de4c2517a50208f6995fffbce71cf5 | /Lab 24.5/src/EmployeeSortedList.java | eaca2f68e2f4000cc379c4f8fbdf1fae83f066e7 | [
"Apache-2.0"
] | permissive | KatrinaGroves/Java | 0bb57790edf7b17807646b77a534f3d44d9be620 | 3cfa483251f826dcc665b9f800490fc7664f96a9 | refs/heads/master | 2022-06-17T18:35:43.488082 | 2020-05-16T18:03:29 | 2020-05-16T18:03:29 | 262,600,471 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 411 | java | import java.util.Comparator;
import java.util.List;
class EmployeeSortedList implements Comparator {
static List<Employee> sortEmployees(List<Employee> listOfEmployees) {
listOfEmployees.sort(
Comparator.comparing(Employee::getLastName).thenComparing(Comparator.comparing(Employee::getEmpID)));
return listOfEmployees;
}
@Override
public int compare(Object o1In, Object o2In) {
return 0;
}
}
| [
"[email protected]"
] | |
77bc61050b652b2b5bd72f5ffca80cbbe557eb38 | afe46e1cb5d6b2a6a7f05a3aaabacb204cfd249d | /src/model/data_structures/llaveC.java | 0ed87137ae9d5e90c93f05d0403964e82c992c3b | [] | no_license | lagonzalezd/Proyecto_2_202010_sec_3_team_1 | 2939cf8c3067ee221299859f33822370739c0583 | 11594d080ca75e1b217c560d0df18d39a6c53c04 | refs/heads/master | 2021-05-20T14:19:54.699306 | 2020-04-26T04:47:49 | 2020-04-26T04:47:49 | 252,329,950 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 327 | java | package model.data_structures;
public class llaveC implements Comparable<llaveC>{
private int id;
public llaveC(int pObjId){
id = pObjId;
}
public int darId(){
return id;
}
public int compareTo(llaveC arg0) {
if (id>arg0.darId())
return 1;
else if (id<arg0.darId())
return -1;
return 0;
}
} | [
"[email protected]"
] | |
65088e01af86172aef7ec367ad7d43b603b34d4c | faad8f8a6da1a8bd421fb7581df175253682cd4b | /src/main/java/org/javarosa/core/services/PrototypeManager.java | d4a8e26e0303c58380d0c68cc65d03d7763f508a | [
"Apache-2.0"
] | permissive | echisMOH/echisCommCareMOH-core | cff4011261098b18afeaa249b4ff35f5d97e5e8f | 30fde2c53a96315195c6d00ef693e63a2f99c6db | refs/heads/master | 2020-05-21T16:06:29.238477 | 2019-05-11T08:16:45 | 2019-05-11T08:16:45 | 186,106,173 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,307 | java | package org.javarosa.core.services;
import org.javarosa.core.util.externalizable.CannotCreateObjectException;
import org.javarosa.core.util.externalizable.PrototypeFactory;
import java.util.HashSet;
public class PrototypeManager {
private static final HashSet<String> prototypes = new HashSet<>();
private static PrototypeFactory staticDefault;
public static void registerPrototype(String className) {
prototypes.add(className);
try {
PrototypeFactory.getInstance(Class.forName(className));
} catch (ClassNotFoundException e) {
throw new CannotCreateObjectException(className + ": not found");
}
rebuild();
}
public static void registerPrototypes(String[] classNames) {
for (String className : classNames) {
registerPrototype(className);
}
}
public static PrototypeFactory getDefault() {
if (staticDefault == null) {
rebuild();
}
return staticDefault;
}
private static void rebuild() {
if (staticDefault == null) {
staticDefault = new PrototypeFactory(prototypes);
return;
}
synchronized (staticDefault) {
staticDefault = new PrototypeFactory(prototypes);
}
}
}
| [
"[email protected]"
] | |
2868f4b85e85299ca04ac7e77cd1cfc0796bb6b4 | 9d32980f5989cd4c55cea498af5d6a413e08b7a2 | /A72n_10_0_0/src/main/java/com/android/server/wm/ClientLifecycleManager.java | 5bce15ab3315bbaeca2fd383f6b3446233033b62 | [] | no_license | liuhaosource/OppoFramework | e7cc3bcd16958f809eec624b9921043cde30c831 | ebe39acabf5eae49f5f991c5ce677d62b683f1b6 | refs/heads/master | 2023-06-03T23:06:17.572407 | 2020-11-30T08:40:07 | 2020-11-30T08:40:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,412 | java | package com.android.server.wm;
import android.app.IApplicationThread;
import android.app.servertransaction.ActivityLifecycleItem;
import android.app.servertransaction.ClientTransaction;
import android.app.servertransaction.ClientTransactionItem;
import android.os.Binder;
import android.os.IBinder;
import android.os.RemoteException;
/* access modifiers changed from: package-private */
public class ClientLifecycleManager {
ClientLifecycleManager() {
}
/* access modifiers changed from: package-private */
public void scheduleTransaction(ClientTransaction transaction) throws RemoteException {
IApplicationThread client = transaction.getClient();
ClientLifecycleMonitor.getInstance().transactionStart(transaction);
transaction.schedule();
if (!(client instanceof Binder)) {
transaction.recycle();
}
}
/* access modifiers changed from: package-private */
public void scheduleTransaction(IApplicationThread client, IBinder activityToken, ActivityLifecycleItem stateRequest) throws RemoteException {
scheduleTransaction(transactionWithState(client, activityToken, stateRequest));
}
/* access modifiers changed from: package-private */
public void scheduleTransaction(IApplicationThread client, IBinder activityToken, ClientTransactionItem callback) throws RemoteException {
scheduleTransaction(transactionWithCallback(client, activityToken, callback));
}
/* access modifiers changed from: package-private */
public void scheduleTransaction(IApplicationThread client, ClientTransactionItem callback) throws RemoteException {
scheduleTransaction(transactionWithCallback(client, null, callback));
}
private static ClientTransaction transactionWithState(IApplicationThread client, IBinder activityToken, ActivityLifecycleItem stateRequest) {
ClientTransaction clientTransaction = ClientTransaction.obtain(client, activityToken);
clientTransaction.setLifecycleStateRequest(stateRequest);
return clientTransaction;
}
private static ClientTransaction transactionWithCallback(IApplicationThread client, IBinder activityToken, ClientTransactionItem callback) {
ClientTransaction clientTransaction = ClientTransaction.obtain(client, activityToken);
clientTransaction.addCallback(callback);
return clientTransaction;
}
}
| [
"[email protected]"
] | |
3e52f732eba4b76aba07b23e8e334494e6c68838 | 0ad728410205770a667806a87f3a2daeaeccec94 | /src/main/java/com/vtgarment/model/view/NormalView.java | e15d221d815fc06bbebba7c59686db9ec7a7073e | [] | no_license | NarongchaiPlaiyim/VTGarment | 55fafb9a58d08fb57379298c434366a7d56938f5 | e1da45d550f91e5e8fbe7df80066328ca4ac0107 | refs/heads/master | 2021-01-18T22:01:22.125128 | 2016-05-30T04:12:10 | 2016-05-30T04:12:10 | 54,274,192 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 386 | java | package com.vtgarment.model.view;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@Getter
@Setter
@ToString
public abstract class NormalView extends View {
public String country;
public String factory;
public String line;
public String sutureLine;
public String percentOfYesterday;
public String percentOfToday;
public String trends;
}
| [
"[email protected]"
] | |
f36c99c3d828088288961508503a33adf79b51ae | 1e745cd853bd5f3971ee53cfb6695264a25015ff | /app/src/main/java/hreday/sagar/allusaonlineshop/Electreonics/Craig.java | b79f8a7fc1278fe7894d5c6d8bc5c28471bed16e | [] | no_license | HredaySagarChakraborty/OnlineShopping | f1b692c4a6596ce5c7b9fbc85b490fcc583d3138 | fc0568c10a94831f1584465df21a7685f2b39b27 | refs/heads/master | 2021-03-16T14:29:35.334025 | 2020-03-12T19:35:28 | 2020-03-12T19:35:28 | 246,916,076 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,793 | java | package hreday.sagar.allusaonlineshop.Electreonics;
import androidx.appcompat.app.AppCompatActivity;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebResourceError;
import android.webkit.WebResourceRequest;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ProgressBar;
import hreday.sagar.allusaonlineshop.R;
public class Craig extends AppCompatActivity {
private WebView webView;
private ProgressBar progressBar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_craig);
getSupportActionBar().hide();
progressBar=findViewById(R.id.progress);
// mInterstitialAd = new InterstitialAd(this);
// mInterstitialAd.setAdUnitId("ca-app-pub-4248114886151875/2595314880");
// mInterstitialAd.loadAd(new AdRequest.Builder().build());
webView = findViewById(R.id.webviewId);
webView.loadUrl("https://sfbay.craigslist.org/");
WebSettings webSettings = webView.getSettings();
webView.setWebViewClient(new WebViewClient()
{
@Override public void onPageStarted(WebView view, String url, Bitmap favicon) {
super.onPageStarted(view, url, favicon);
progressBar.setVisibility(ProgressBar.VISIBLE);
webView.setVisibility(View.INVISIBLE);
}
@Override public void onPageCommitVisible(WebView view, String url) {
super.onPageCommitVisible(view, url);
progressBar.setVisibility(ProgressBar.GONE);
webView.setVisibility(View.VISIBLE);
}
@Override
public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
Craig.this.webView.loadUrl("file:///android_asset/errors.html");
super.onReceivedError(view, request, error);
}
});
webSettings.setJavaScriptEnabled(true);
}
@Override
public void onBackPressed() {
if (webView.canGoBack()) {
webView.goBack();
} else {
super.onBackPressed();
}
}
/*
@Override
public void onBackPressed() {
if (mInterstitialAd.isLoaded()) {
mInterstitialAd.show();
mInterstitialAd.setAdListener(new AdListener() {
@Override
public void onAdClosed() {
super.onAdClosed();
finish();
}
});
} else {
super.onBackPressed();
}
}
*/
}
| [
"[email protected]"
] | |
1043c23804733b9a4bc6d38c11dfc94a1b54b2f6 | 506cbb3a7e991221063095c1861ade0d6afea15d | /src/main/java/com/codetaylor/mc/dropt/modules/dropt/rule/parse/ParserRuleMatchBlocks.java | 78e8aa1e517e5140ed5914bf4b3073642c7e357d | [
"Apache-2.0"
] | permissive | WolfieWaffle/dropt | 93fe18157700e233a0c70b6d08e5239c9fef84d1 | d0388b9e5d8c1db1fee4ae4bed3b8c208ce77a8e | refs/heads/master | 2020-06-14T08:43:08.032853 | 2019-06-30T18:18:49 | 2019-06-30T18:18:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,087 | java | package com.codetaylor.mc.dropt.modules.dropt.rule.parse;
import com.codetaylor.mc.athenaeum.parser.recipe.item.MalformedRecipeItemException;
import com.codetaylor.mc.athenaeum.parser.recipe.item.ParseResult;
import com.codetaylor.mc.athenaeum.parser.recipe.item.RecipeItemParser;
import com.codetaylor.mc.dropt.modules.dropt.rule.data.Rule;
import com.codetaylor.mc.dropt.modules.dropt.rule.data.RuleList;
import com.codetaylor.mc.dropt.modules.dropt.rule.log.ILogger;
import com.codetaylor.mc.dropt.modules.dropt.rule.log.DebugFileWrapper;
import com.codetaylor.mc.dropt.modules.dropt.rule.match.BlockMatchEntry;
import net.minecraft.block.Block;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
import net.minecraftforge.oredict.OreDictionary;
public class ParserRuleMatchBlocks
implements IRuleListParser {
@Override
public void parse(
RecipeItemParser parser, RuleList ruleList, Rule rule, ILogger logger, DebugFileWrapper debugFileWrapper
) {
if (rule.match == null) {
if (rule.debug) {
debugFileWrapper.debug("[PARSE] Match object not defined, skipped parsing block match");
}
return;
}
if (rule.match.blocks == null || rule.match.blocks.blocks.length == 0) {
if (rule.debug) {
debugFileWrapper.debug("[PARSE] No block matches defined, skipped parsing block match");
}
return;
}
for (String string : rule.match.blocks.blocks) {
String[] split = string.split(",");
ParseResult parse;
try {
parse = parser.parse(split[0]);
} catch (MalformedRecipeItemException e) {
logger.error("[PARSE] Unable to parse block <" + split[0] + "> in file: " + ruleList._filename, e);
continue;
}
if (rule.debug) {
debugFileWrapper.debug("[PARSE] Parsed block match: " + parse);
}
Block block = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(parse.getDomain(), parse.getPath()));
if (block == null) {
logger.error("[PARSE] Unable to find registered block: " + parse.toString());
continue;
}
if (rule.debug) {
debugFileWrapper.debug("[PARSE] Found registered block: " + block);
}
int meta = parse.getMeta();
int[] metas = new int[Math.max(split.length - 1, 0)];
for (int i = 1; i < split.length; i++) {
if ("*".equals(split[i].trim())) {
meta = OreDictionary.WILDCARD_VALUE;
metas = new int[0];
break;
}
try {
metas[i - 1] = Integer.valueOf(split[i].trim());
} catch (Exception e) {
logger.error("[PARSE] Unable to parse extra meta for <" + string + "> in file: " + ruleList._filename, e);
}
}
BlockMatchEntry blockMatchEntry = new BlockMatchEntry(parse.getDomain(), parse.getPath(), meta, metas);
rule.match.blocks._blocks.add(blockMatchEntry);
if (rule.debug) {
debugFileWrapper.debug("[PARSE] Added block matcher: " + blockMatchEntry);
}
}
}
}
| [
"[email protected]"
] | |
d6ea9d890724b6fc5e41c2d1423ea39f89d6deac | f0a63413261469627354a246836a46035382fb46 | /Android/mud/src/Teacher.java | e2f8ccd698923d2f37c6719b09916282ef4c67bb | [] | no_license | oskarlindh/Java | 1b4ece6ca15357ebfbfa57f08d08d9b5883b9919 | 0488369e7c85a10b5f6537b0c7b560106d4f6773 | refs/heads/master | 2020-06-28T20:35:26.868845 | 2019-01-19T10:16:31 | 2019-01-19T10:16:31 | 74,474,201 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,037 | java | import java.io.File;
import java.util.List;
import java.util.ArrayList;
import java.util.Iterator;
import java.lang.StringBuilder;
/**
* Teacher is subclass to Creature and handles the avatar courses interaction
*/
public class Teacher extends Creature
{
private Course course;
private List<String> validInteractions;
/**
*Default constructor for the Teacher object
* @param name the name of the Teacher
*/
public Teacher(String name)
{
super(name);
validInteractions = new ArrayList<String>();
validInteractions.add("talk");
}
/**
* Prints the Teachers name and it's course
*/
public void talk()
{
String talk = "Hi my name is " +super.name+"\n";
talk += "The subject i am teaching is " + course;
System.out.println(talk);
}
/**
* Prints the Teachers question
*/
public void askQuestion()
{
StringBuilder question = new StringBuilder();
question.append("Teacher "+super.name+" asks you a question\n\n");
question.append(course.questionToString());
System.out.println(question.toString());
}
/**
* Checks if an interaction is valid
* @param action the action to test for validity
* @return true if the interaction is a valid one
*/
public boolean validInteraction(String action)
{
for (int i = 0;i < validInteractions.size();i++ ) {
if(action.equals(validInteractions.get(i)))
return true;
}
return false;
}
public List<String> getValidInteractions()
{
return validInteractions;
}
/**
* Prints the Teachers questions with one less alternativ
*/
public void askQuestionAlternativeRemoved()
{ if(course == null)
System.out.println("I have no question to ask you");
System.out.println(course.questionRemoveAnswer());
}
/**
* Checks if the answer to the question is correct
* @param answer the alternative for the teachers quesion wished to test
* for corectness
* @return true if the answer i correct
*/
public boolean checkAnswer(int answer)
{
return course.checkAnswer(answer);
}
/**
* Set the object course
* @param course the course to set for the teacher.
*/
public void setCourse(Course course)
{ if(this.course == null){
this.course = course;
validInteractions.add("enroll");
}
}
/**
* Returns the Book for the objects course
* @return the book corresponding to the teachers course
*/
public Book getCourseBook()
{
return course.getBook();
}
/**
* @return a string containing "Teacher"
*/
public String getCreatureType()
{
return "Teacher";
}
/**
* @return the objects course object
*/
public Course getCourse()
{
return course;
}
}
| [
"[email protected]"
] | |
8eecdd28300aec0070017830e0a0a9a297afb39b | 65074aecb1ec800748d0e5a6a1c12b1396ce9582 | /hc-meta-app/app/src/main/java/com/cloudminds/meta/service/navigation/LocationMonitor.java | 65f057764e4654afa82ae0521a3b5f778ece661c | [] | no_license | wqlljj/note | fe4011547899b469a5c179a813970af326f5c65f | 792821980fb6087719012b943cc4e8dda69d3626 | refs/heads/master | 2021-06-27T16:28:49.376137 | 2019-06-11T03:39:52 | 2019-06-11T03:39:52 | 135,403,941 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,997 | java | package com.cloudminds.meta.service.navigation;
import android.Manifest;
import android.content.Context;
import android.content.pm.PackageManager;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.support.v4.app.ActivityCompat;
import android.util.Log;
import com.amap.api.location.AMapLocation;
import com.amap.api.location.AMapLocationClient;
import com.amap.api.location.AMapLocationClientOption;
import com.amap.api.location.AMapLocationListener;
import com.amap.api.navi.model.NaviLatLng;
import com.cloudminds.hc.hariservice.HariServiceClient;
import com.cloudminds.hc.hariservice.utils.PreferenceUtils;
import com.cloudminds.meta.util.DeviceUtils;
import com.squareup.okhttp.Call;
import com.squareup.okhttp.Callback;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.Response;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
/**
* Created by zoey on 17/5/15.
*/
public class LocationMonitor implements AMapLocationListener {
private final String TAG = "NAVI/LocationMonitor";
private static LocationMonitor locationMonitor;
private Context mContext;
private AMapLocationClient mLocationClient;
//声明mLocationOption对象
private AMapLocationClientOption mLocationOption;
public static String cityCode = "";
public static double curLatitude = 0.0; //当前位置纬度
public static double curLongitude = 0.0; //当前位置经度
private LocationObserver locationObserver;
private boolean enableReportLocation = false; //上传位置到hari 后台
//英文环境使用framwork提供的api
private LocationManager locationManager = null;
public static LocationMonitor instance(Context context){
if (null == locationMonitor){
locationMonitor = new LocationMonitor();
locationMonitor.init(context);
}
return locationMonitor;
}
public static LocationMonitor getInstance(){
return locationMonitor;
}
public void setEnableReportLocation(boolean enable){
enableReportLocation = enable;
}
public void init(Context context){
mContext = context;
if ("EN".equalsIgnoreCase(DeviceUtils.getSysLanguage())){
//initEn();
} else {
initCH();
}
}
private void initEn(){
if (ActivityCompat.checkSelfPermission(mContext, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(mContext, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
return;
}
String serviceString = Context.LOCATION_SERVICE;
locationManager = (LocationManager) mContext.getSystemService(serviceString);
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 6000, 0, locationListener);
}
private void initCH(){
mLocationClient = new AMapLocationClient(mContext);
//初始化定位参数
mLocationOption = new AMapLocationClientOption();
//设置定位监听
mLocationClient.setLocationListener(this);
//设置定位模式为高精度模式,Battery_Saving为低功耗模式,Device_Sensors是仅设备模式
mLocationOption.setLocationMode(AMapLocationClientOption.AMapLocationMode.Hight_Accuracy);
//设置定位间隔,单位毫秒,默认为2000ms
mLocationOption.setInterval(2000);
//启用手机传感器 用来获取方向角
mLocationOption.setSensorEnable(true);
//设置定位参数
mLocationClient.setLocationOption(mLocationOption);
// 此方法为每隔固定时间会发起一次定位请求,为了减少电量消耗或网络流量消耗,
// 注意设置合适的定位时间的间隔(最小间隔支持为1000ms),并且在合适时间调用stopLocation()方法来取消定位请求
// 在定位结束后,在合适的生命周期调用onDestroy()方法
}
public NaviLatLng getCurPoint(){
NaviLatLng latLng = new NaviLatLng();
latLng.setLatitude(curLatitude);
latLng.setLongitude(curLongitude);
return latLng;
}
public void setLocationObserver(LocationObserver observer){
locationObserver = observer;
}
public void startLocation(LocationObserver observer){
if ("EN".equalsIgnoreCase(DeviceUtils.getSysLanguage())){
initEn();
} else {
boolean gpsEnable = PreferenceUtils.getPrefBoolean("GPSEnable",true);
if (gpsEnable){
locationObserver = observer;
mLocationClient.startLocation();
}
}
}
public void stopLocation(){
if (null != locationManager){
locationManager.removeUpdates(locationListener);
}
if (null != mLocationClient){
mLocationClient.stopLocation();
}
}
@Override
public void onLocationChanged(AMapLocation aMapLocation) {
if (aMapLocation != null) {
if (aMapLocation.getErrorCode() == 0) {
//定位成功回调信息,设置相关消息
curLatitude = aMapLocation.getLatitude();//获取纬度
curLongitude = aMapLocation.getLongitude();//获取经度
Log.d(TAG,"定位精度 : "+aMapLocation.getAccuracy());
if (cityCode.isEmpty()){
cityCode = aMapLocation.getCityCode();//城市编码
}
if (enableReportLocation){
reportLocation();
enableReportLocation = false;
}
} else {
//显示错误信息ErrCode是错误码,errInfo是错误信息,详见错误码表。
Log.d(TAG,"location Error, ErrCode:"
+ aMapLocation.getErrorCode() + ", errInfo:"
+ aMapLocation.getErrorInfo());
}
}
if (locationObserver != null){
locationObserver.onLocationChanged(aMapLocation);
}
}
public interface LocationObserver{
public void onLocationChanged(AMapLocation aMapLocation);
}
//英文环境下 位置更新回调
private final LocationListener locationListener = new LocationListener() {
@Override
public void onLocationChanged(Location location) {
curLongitude = location.getLongitude();
curLatitude = location.getLatitude();
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
}
@Override
public void onProviderEnabled(String provider) {
}
@Override
public void onProviderDisabled(String provider) {
}
};
public boolean isGpsEnabled(){
boolean enable = true;
LocationManager locationManager = (LocationManager) mContext.getSystemService(Context.LOCATION_SERVICE);
// 判断GPS模块是否开启,如果没有则开启
if (!locationManager.isProviderEnabled(android.location.LocationManager.GPS_PROVIDER)){
enable = false;
}
return enable;
}
private void reportLocation(){
Log.d(TAG, "reportRobotLocation"+"latitude:"+ curLatitude + " longitude:" + curLongitude);
JSONObject object = new JSONObject();
try {
object.put("type","reportLocation");
JSONObject locationInfo = new JSONObject();
locationInfo.put("lng",curLongitude);
locationInfo.put("lat",curLatitude);
object.put("data",locationInfo);
}catch (JSONException e){
e.printStackTrace();
}
HariServiceClient.getCommandEngine().sendData(object);
}
}
| [
"[email protected]"
] | |
14d39d7d058a22a8b60f1ac221331cb32ece5a83 | c83ae1e7ef232938166f7b54e69f087949745e0d | /sources/com/google/firebase/iid/zzav.java | 5dd066f369d772b10c865d2da5c2aa251f85f4a1 | [] | no_license | FL0RlAN/android-tchap-1.0.35 | 7a149a08a88eaed31b0f0bfa133af704b61a7187 | e405f61db55b3bfef25cf16103ba08fc2190fa34 | refs/heads/master | 2022-05-09T04:35:13.527984 | 2020-04-26T14:41:37 | 2020-04-26T14:41:37 | 259,030,577 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 8,587 | java | package com.google.firebase.iid;
import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.content.pm.ServiceInfo;
import android.util.Log;
import androidx.collection.SimpleArrayMap;
import androidx.legacy.content.WakefulBroadcastReceiver;
import java.util.ArrayDeque;
import java.util.Queue;
import org.matrix.olm.OlmException;
public final class zzav {
private static zzav zzcy;
private final SimpleArrayMap<String, String> zzcz = new SimpleArrayMap<>();
private Boolean zzda = null;
private Boolean zzdb = null;
final Queue<Intent> zzdc = new ArrayDeque();
private final Queue<Intent> zzdd = new ArrayDeque();
public static synchronized zzav zzai() {
zzav zzav;
synchronized (zzav.class) {
if (zzcy == null) {
zzcy = new zzav();
}
zzav = zzcy;
}
return zzav;
}
private zzav() {
}
public static PendingIntent zza(Context context, int i, Intent intent, int i2) {
return PendingIntent.getBroadcast(context, i, zza(context, "com.google.firebase.MESSAGING_EVENT", intent), 1073741824);
}
public static void zzb(Context context, Intent intent) {
context.sendBroadcast(zza(context, "com.google.firebase.INSTANCE_ID_EVENT", intent));
}
public static void zzc(Context context, Intent intent) {
context.sendBroadcast(zza(context, "com.google.firebase.MESSAGING_EVENT", intent));
}
private static Intent zza(Context context, String str, Intent intent) {
Intent intent2 = new Intent(context, FirebaseInstanceIdReceiver.class);
intent2.setAction(str);
intent2.putExtra("wrapped_intent", intent);
return intent2;
}
public final Intent zzaj() {
return (Intent) this.zzdd.poll();
}
public final int zzb(Context context, String str, Intent intent) {
String str2 = "FirebaseInstanceId";
if (Log.isLoggable(str2, 3)) {
String str3 = "Starting service: ";
String valueOf = String.valueOf(str);
Log.d(str2, valueOf.length() != 0 ? str3.concat(valueOf) : new String(str3));
}
char c = 65535;
int hashCode = str.hashCode();
if (hashCode != -842411455) {
if (hashCode == 41532704 && str.equals("com.google.firebase.MESSAGING_EVENT")) {
c = 1;
}
} else if (str.equals("com.google.firebase.INSTANCE_ID_EVENT")) {
c = 0;
}
if (c == 0) {
this.zzdc.offer(intent);
} else if (c != 1) {
String str4 = "Unknown service action: ";
String valueOf2 = String.valueOf(str);
Log.w(str2, valueOf2.length() != 0 ? str4.concat(valueOf2) : new String(str4));
return 500;
} else {
this.zzdd.offer(intent);
}
Intent intent2 = new Intent(str);
intent2.setPackage(context.getPackageName());
return zzd(context, intent2);
}
/* JADX WARNING: Removed duplicated region for block: B:42:0x00de A[Catch:{ SecurityException -> 0x0124, IllegalStateException -> 0x00fc }] */
/* JADX WARNING: Removed duplicated region for block: B:43:0x00e3 A[Catch:{ SecurityException -> 0x0124, IllegalStateException -> 0x00fc }] */
/* JADX WARNING: Removed duplicated region for block: B:45:0x00f0 A[Catch:{ SecurityException -> 0x0124, IllegalStateException -> 0x00fc }] */
/* JADX WARNING: Removed duplicated region for block: B:48:0x00fa */
private final int zzd(Context context, Intent intent) {
String str;
ComponentName componentName;
synchronized (this.zzcz) {
str = (String) this.zzcz.get(intent.getAction());
}
if (str == null) {
ResolveInfo resolveService = context.getPackageManager().resolveService(intent, 0);
if (resolveService == null || resolveService.serviceInfo == null) {
Log.e("FirebaseInstanceId", "Failed to resolve target intent service, skipping classname enforcement");
if (zzd(context)) {
componentName = WakefulBroadcastReceiver.startWakefulService(context, intent);
} else {
componentName = context.startService(intent);
Log.d("FirebaseInstanceId", "Missing wake lock permission, service start may be delayed");
}
if (componentName != null) {
return -1;
}
Log.e("FirebaseInstanceId", "Error while delivering the message: ServiceIntent not found.");
return 404;
}
ServiceInfo serviceInfo = resolveService.serviceInfo;
if (!context.getPackageName().equals(serviceInfo.packageName) || serviceInfo.name == null) {
String str2 = serviceInfo.packageName;
String str3 = serviceInfo.name;
StringBuilder sb = new StringBuilder(String.valueOf(str2).length() + 94 + String.valueOf(str3).length());
sb.append("Error resolving target intent service, skipping classname enforcement. Resolved service was: ");
sb.append(str2);
sb.append("/");
sb.append(str3);
Log.e("FirebaseInstanceId", sb.toString());
if (zzd(context)) {
}
if (componentName != null) {
}
} else {
String str4 = serviceInfo.name;
if (str4.startsWith(".")) {
String valueOf = String.valueOf(context.getPackageName());
String valueOf2 = String.valueOf(str4);
str4 = valueOf2.length() != 0 ? valueOf.concat(valueOf2) : new String(valueOf);
}
str = str4;
synchronized (this.zzcz) {
this.zzcz.put(intent.getAction(), str);
}
}
}
if (Log.isLoggable("FirebaseInstanceId", 3)) {
String str5 = "Restricting intent to a specific service: ";
String valueOf3 = String.valueOf(str);
Log.d("FirebaseInstanceId", valueOf3.length() != 0 ? str5.concat(valueOf3) : new String(str5));
}
intent.setClassName(context.getPackageName(), str);
try {
if (zzd(context)) {
}
if (componentName != null) {
}
} catch (SecurityException e) {
Log.e("FirebaseInstanceId", "Error while delivering the message to the serviceIntent", e);
return OlmException.EXCEPTION_CODE_SESSION_INIT_OUTBOUND_SESSION;
} catch (IllegalStateException e2) {
String valueOf4 = String.valueOf(e2);
StringBuilder sb2 = new StringBuilder(String.valueOf(valueOf4).length() + 45);
sb2.append("Failed to start service while in background: ");
sb2.append(valueOf4);
Log.e("FirebaseInstanceId", sb2.toString());
return OlmException.EXCEPTION_CODE_SESSION_INIT_INBOUND_SESSION;
}
}
/* access modifiers changed from: 0000 */
public final boolean zzd(Context context) {
if (this.zzda == null) {
this.zzda = Boolean.valueOf(context.checkCallingOrSelfPermission("android.permission.WAKE_LOCK") == 0);
}
if (!this.zzda.booleanValue()) {
String str = "FirebaseInstanceId";
if (Log.isLoggable(str, 3)) {
Log.d(str, "Missing Permission: android.permission.WAKE_LOCK this should normally be included by the manifest merger, but may needed to be manually added to your manifest");
}
}
return this.zzda.booleanValue();
}
/* access modifiers changed from: 0000 */
public final boolean zze(Context context) {
if (this.zzdb == null) {
this.zzdb = Boolean.valueOf(context.checkCallingOrSelfPermission("android.permission.ACCESS_NETWORK_STATE") == 0);
}
if (!this.zzda.booleanValue()) {
String str = "FirebaseInstanceId";
if (Log.isLoggable(str, 3)) {
Log.d(str, "Missing Permission: android.permission.ACCESS_NETWORK_STATE this should normally be included by the manifest merger, but may needed to be manually added to your manifest");
}
}
return this.zzdb.booleanValue();
}
}
| [
"[email protected]"
] | |
e3182baf7a965f71c4aa64d409105d6c8f2050c0 | d353ed1faafd36520b67970b2e8a0f812d110311 | /src/main/java/com/zl/llyy/mr/topkurl/TopkURLRunner.java | d679c5b62a06e5717e9b2aa766f39c72f48665b1 | [] | no_license | jackyZL/hadoop-test | d125e15cf19100a47c1920e5a877b420b3ad775d | 184ae13df4b866cb2211897bdaa406c5633c7902 | refs/heads/master | 2021-01-24T09:37:09.246503 | 2016-11-04T11:09:34 | 2016-11-04T11:09:34 | 69,306,919 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,348 | java | package com.zl.llyy.mr.topkurl;
import com.zl.llyy.mr.bean.FlowBean;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.conf.Configured;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;
public class TopkURLRunner extends Configured implements Tool{
@Override
public int run(String[] args) throws Exception {
Configuration conf = new Configuration();
Job job = Job.getInstance(conf);
job.setJarByClass(TopkURLRunner.class);
job.setMapperClass(TopkURLMapper.class);
job.setReducerClass(TopkURLReducer.class);
job.setMapOutputKeyClass(Text.class);
job.setMapOutputValueClass(FlowBean.class);
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(LongWritable.class);
FileInputFormat.setInputPaths(job, new Path(args[0]));
FileOutputFormat.setOutputPath(job, new Path(args[1]));
return job.waitForCompletion(true)?0:1;
}
public static void main(String[] args) throws Exception {
int res = ToolRunner.run(new Configuration(), new TopkURLRunner(), args);
System.exit(res);
}
}
| [
"[email protected]"
] | |
42b27b29ccf824e08e922f0dc3b37b67d4caab27 | 6afd4b0e9f53b316eb619b31d0929906d044cdc0 | /src/com/challengeearth/cedroid/caching/CECacheRequest.java | df4f6b428733fbd813c0c208726447b5c5dc089c | [] | no_license | stestaub/ChallengeEarthAndroid | b47efeba9f823a72b521a381fd45fc80ce35eaad | cae13c8abe1632ca6b8c6da5d4aecd5dca943720 | refs/heads/master | 2016-09-05T10:00:48.353318 | 2012-03-23T15:32:51 | 2012-03-23T15:32:51 | 3,145,898 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 415 | java | package com.challengeearth.cedroid.caching;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.CacheRequest;
public class CECacheRequest extends CacheRequest {
final ByteArrayOutputStream body = new ByteArrayOutputStream();
@Override
public void abort() {
}
@Override
public OutputStream getBody() throws IOException {
return body;
}
}
| [
"[email protected]"
] | |
b702abdf9724cfb768184722626f00ddfb2c8836 | b31ef82368fcb1b4496eaa2c2d07e64fe6fea93b | /src/main/java/com/winetto/SearchServlet.java | 018c36029d201c3b5590c796e74c43320ac77d54 | [] | no_license | artureus/winetto | be61c625ea98f5af3bc80010c1fb06ebda1349e8 | 14443f2f64844650fcf7210b0457dd7bd85f0e11 | refs/heads/master | 2020-04-22T09:07:46.887831 | 2013-04-02T10:33:06 | 2013-04-02T10:33:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,743 | java | package main.java.com.winetto;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Type;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.google.gson.FieldNamingPolicy;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
public class SearchServlet extends HttpServlet {
/**
*
*/
private static final long serialVersionUID = 1L;
// Checking for connection to the internet
public static boolean isInternetReachable()
{
try {
// Choose an URL of a known source
URL url = new URL("http://www.google.com");
// Open a connection to that source
HttpURLConnection urlConnect = (HttpURLConnection)url.openConnection();
// Trying to retrieve data of the source
urlConnect.getContent();
} catch (UnknownHostException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return false;
}
catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return false;
}
return true;
}
/**
* Read a URL returning an object and transform it into a String.
*
* @param urlString
* @return String with the external object
* @throws Exception
*/
private static String readUrl(String urlString) throws Exception {
BufferedReader reader = null;
try {
URL url = new URL(urlString);
reader = new BufferedReader(new InputStreamReader(url.openStream()));
StringBuffer buffer = new StringBuffer();
int read;
char[] chars = new char[1024];
while ((read = reader.read(chars)) != -1)
buffer.append(chars, 0, read);
return buffer.toString();
} finally {
if (reader != null)
reader.close();
}
}
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
try {
if (isInternetReachable()) {
// Defining API url parameters
String urlHTTPinit = "http://api.wine-searcher.com/wine-select-api.lml?";
String urlHTTParamSeparator = "&";
String urlHTTParamAssignation = "=";
String paramKey = "Xkey";
String paramVersion = "Xversion";
String paramWinename = "Xwinename";
String paramWidesearch = "Xwidesearch";
String paramKeyword_mode = "Xkeyword_mode";
String paramCurrencycode = "Xcurrencycode";
String paramVintage = "Xvintage";
String paramLocation = "Xlocation";
String paramAutoexpand = "Xautoexpand";
String paramFormat = "Xformat";
String key = "artrxx481761";
String version = "5";
String winename = req.getParameter("search_wine");
String widesearch = "Y";
String keyword_mode = "A"; // X
String currencycode = "EUR";
String vintage = req.getParameter("search_vintage");
String location = "spain";
String autoexpand = "Y";
String format = "J";
// Composing dynamic URL to make the API call
String apiURL = urlHTTPinit;
apiURL += paramKey + urlHTTParamAssignation + key;
apiURL += urlHTTParamSeparator + paramVersion + urlHTTParamAssignation + version;
if (req.getParameterMap().containsKey("search_wine"))
apiURL += urlHTTParamSeparator + paramWinename + urlHTTParamAssignation + winename;
apiURL += urlHTTParamSeparator + paramWidesearch + urlHTTParamAssignation + widesearch;
apiURL += urlHTTParamSeparator + paramKeyword_mode + urlHTTParamAssignation + keyword_mode;
apiURL += urlHTTParamSeparator + paramCurrencycode + urlHTTParamAssignation + currencycode;
if (req.getParameterMap().containsKey("search_vintage"))
apiURL += urlHTTParamSeparator + paramVintage + urlHTTParamAssignation + vintage;
apiURL += urlHTTParamSeparator + paramLocation + urlHTTParamAssignation + location;
apiURL += urlHTTParamSeparator + paramAutoexpand + urlHTTParamAssignation + autoexpand;
apiURL += urlHTTParamSeparator + paramFormat + urlHTTParamAssignation + format;
apiURL = apiURL.replace(' ', '+');
// DEVTime: Printing results
//System.out.println(apiURL);
// Translating Json Object from API URL to String
String jsonString = "";
try {
jsonString = readUrl(apiURL);
// DEVTime: Printing results
//System.out.println(jsonString);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// Translating Json Object (String) to Json Object (GSON lib)
GsonBuilder gsonBuilder = new GsonBuilder();
gsonBuilder.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_DASHES);
Gson gson = gsonBuilder.disableHtmlEscaping().create();
Type preWineListType = new TypeToken<PreWineList>(){}.getType();
PreWineList preWineList = gson.fromJson(jsonString, preWineListType);
// Another way could be:
//PreWineList preWineList = gson.fromJson(jsonString, PreWineList.class);
// DEVTime: Printing results
//System.out.println("json test String: " + new Gson().toJson(preWineList));
// Get Return Code for analyze response state
String returnCode = preWineList.getWineSearcher().getReturnCode();
req.setAttribute("returnCode", returnCode);
if (returnCode.equals("0")) {
// Print List Wine
List<PreWine> listPreWine = preWineList.getWineSearcher().getWines();
List<Wine> listWine = new ArrayList<Wine>();
if (listPreWine != null) {
for (int i = 0; i < listPreWine.size(); i++) {
listWine.add(listPreWine.get(i).getWine());
}
} else {
// If Wine List is empty, we force an error to fill every input
req.setAttribute("returnCode", "6");
}
req.setAttribute("data", listWine);
req.setAttribute("saved", listWine);
}
} else {
// If internet is no reachable, a message is returned to the view
req.setAttribute("returnCode", "7");
}
} catch (Exception e) {
req.setAttribute("returnCode", "99");
// TODO Auto-generated catch block
e.printStackTrace();
}
// Return control to View
req.getRequestDispatcher("/index.jsp").forward(req, resp);
}
}
| [
"[email protected]"
] | |
55608810938ebabdf744ef14f96577a3a85fc146 | 329b2cb3c91a0c953458efd253c4fcdce6f539c4 | /graphsdk/src/main/java/com/microsoft/graph/generated/IBaseWorkbookTableConvertToRangeRequestBuilder.java | 3577b6dfa4807c78d308306af81dad1096d94f5c | [
"MIT"
] | permissive | sbolotovms/msgraph-sdk-android | 255eeddf19c1b15f04ee3b1549f0cae70d561fdd | 1320795ba1c0b5eb36ef8252b73799d15fc46ba1 | refs/heads/master | 2021-01-20T05:09:00.148739 | 2017-04-28T23:20:23 | 2017-04-28T23:20:23 | 89,751,501 | 1 | 0 | null | 2017-04-28T23:20:37 | 2017-04-28T23:20:37 | null | UTF-8 | Java | false | false | 1,485 | java | // ------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
// ------------------------------------------------------------------------------
package com.microsoft.graph.generated;
import com.microsoft.graph.concurrency.*;
import com.microsoft.graph.core.*;
import com.microsoft.graph.extensions.*;
import com.microsoft.graph.http.*;
import com.microsoft.graph.generated.*;
import com.microsoft.graph.options.*;
import com.microsoft.graph.serializer.*;
import java.util.Arrays;
import java.util.List;
// **NOTE** This file was generated by a tool and any changes will be overwritten.
/**
* The interface for the Base Workbook Table Convert To Range Request Builder.
*/
public interface IBaseWorkbookTableConvertToRangeRequestBuilder extends IRequestBuilder {
/**
* Creates the IWorkbookTableConvertToRangeRequest
*
* @return The IWorkbookTableConvertToRangeRequest instance
*/
IWorkbookTableConvertToRangeRequest buildRequest();
/**
* Creates the IWorkbookTableConvertToRangeRequest with specific options instead of the existing options
*
* @param requestOptions the options for the request
* @return The IWorkbookTableConvertToRangeRequest instance
*/
IWorkbookTableConvertToRangeRequest buildRequest(final List<Option> requestOptions);
}
| [
"[email protected]"
] | |
07c92a3c1a2d6369e3d26dc1ba3efbcd0bfa8bbf | a5957981f24989424a8e627af5089fb63cb6ce60 | /src/com/bergerkiller/bukkit/tc/signactions/SignActionStation.java | c1dbc06e53d637aaa1a7f0fe276b2f40914651b1 | [] | no_license | Thulinma/TrainCarts | fc928f03ee61416c79785c2bc137c8a8ac4a367f | 999d2694debe100b887d6a9a8703c32010080237 | refs/heads/master | 2021-01-18T08:55:27.299989 | 2012-01-11T16:49:56 | 2012-01-11T16:49:56 | 2,627,618 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,837 | java | package com.bergerkiller.bukkit.tc.signactions;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.event.block.SignChangeEvent;
import org.bukkit.material.Rails;
import com.bergerkiller.bukkit.tc.MinecartGroup;
import com.bergerkiller.bukkit.tc.MinecartMember;
import com.bergerkiller.bukkit.tc.StationMode;
import com.bergerkiller.bukkit.tc.TrainCarts;
import com.bergerkiller.bukkit.tc.API.SignActionEvent;
import com.bergerkiller.bukkit.tc.actions.BlockActionSetLevers;
import com.bergerkiller.bukkit.tc.permissions.Permission;
import com.bergerkiller.bukkit.tc.utils.BlockUtil;
import com.bergerkiller.bukkit.tc.utils.FaceUtil;
public class SignActionStation extends SignAction {
@Override
public void execute(SignActionEvent info) {
if (info.isAction(SignActionType.REDSTONE_CHANGE, SignActionType.GROUP_ENTER, SignActionType.GROUP_LEAVE)) {
if (info.isTrainSign() || info.isCartSign()) {
if (info.isType("station")) {
if (info.hasRails()) {
MinecartGroup group = info.getGroup();
if (group != null) {
if (info.isAction(SignActionType.GROUP_LEAVE)) {
} else if (!info.isPowered()) {
group.clearActions();
} else {
//Check if not already targeting
if (group != null && info.hasRails()) {
//Get station length
double length = 0;
try {
length = Double.parseDouble(info.getLine(1).substring(7).trim());
} catch (Exception ex) {};
long delayMS = 0;
try {
delayMS = (long) (Double.parseDouble(info.getLine(2)) * 1000);
} catch (Exception ex) {};
//Get the mode used
StationMode mode = StationMode.fromString(info.getLine(3));
//Get the middle minecart
MinecartMember midd = group.middle();
//First, get the direction of the tracks above
BlockFace dir = info.getRailDirection();
//Get the length of the track to center in
if (length == 0) {
//manually calculate the length
//use the amount of straight blocks
for (BlockFace face : FaceUtil.getFaces(dir)) {
int tlength = 0;
//get the type of rail required
BlockFace checkface = face;
if (checkface == BlockFace.NORTH)
checkface = BlockFace.SOUTH;
if (checkface == BlockFace.EAST)
checkface = BlockFace.WEST;
Block b = info.getRails();
int maxlength = 20;
while (true) {
//Next until invalid
b = b.getRelative(face);
Rails rr = BlockUtil.getRails(b);
if (rr == null || rr.getDirection() != checkface)
break;
tlength++;
//prevent inf. loop or long processing
maxlength--;
if (maxlength <= 0) break;
}
//Update the length
if (length == 0 || tlength < length) length = tlength;
}
}
boolean west = info.isPowered(BlockFace.WEST);
boolean east = info.isPowered(BlockFace.EAST);
boolean north = info.isPowered(BlockFace.NORTH);
boolean south = info.isPowered(BlockFace.SOUTH);
//which directions to move, or brake?
BlockFace instruction = BlockFace.UP; //SELF is brake
if (dir == BlockFace.WEST) {
if (west && !east) {
instruction = BlockFace.WEST;
} else if (east && !west) {
instruction = BlockFace.EAST;
} else {
instruction = BlockFace.SELF;
}
} else if (dir == BlockFace.SOUTH) {
if (north && !south) {
instruction = BlockFace.NORTH;
} else if (south && !north) {
instruction = BlockFace.SOUTH;
} else {
instruction = BlockFace.SELF;
}
}
if (instruction == BlockFace.UP) return;
//What do we do?
if (instruction == BlockFace.SELF) {
if (north || east || south || west) {
//Redstone change and moving?
if (!info.isAction(SignActionType.REDSTONE_CHANGE) || !info.getMember().isMoving()) {
//Brake
//TODO: ADD CHECK?!
group.clearActions();
midd.addActionLaunch(info.getRailLocation(), 0);
BlockFace trainDirection = null;
if (mode == StationMode.CONTINUE) {
trainDirection = midd.getDirection();
} else if (mode == StationMode.REVERSE) {
trainDirection = midd.getDirection().getOppositeFace();
} else if (mode == StationMode.LEFT || mode == StationMode.RIGHT) {
trainDirection = info.getFacing();
//Convert
if (mode == StationMode.LEFT) {
trainDirection = FaceUtil.rotate(trainDirection, 2);
} else {
trainDirection = FaceUtil.rotate(trainDirection, -2);
}
}
if (trainDirection != null) {
//Actual launching here
if (delayMS > 0) {
if (TrainCarts.playSoundAtStation) group.addActionSizzle();
info.getGroup().addAction(new BlockActionSetLevers(info.getAttachedBlock(), true));
}
group.addActionWait(delayMS);
midd.addActionLaunch(trainDirection, length, TrainCarts.launchForce);
} else {
group.addActionWaitForever();
if (TrainCarts.playSoundAtStation) group.addActionSizzle();
info.getGroup().addAction(new BlockActionSetLevers(info.getAttachedBlock(), true));
}
}
}
} else {
//Launch
group.clearActions();
MinecartMember head = group.head();
if (delayMS > 0 || (head.isMoving() && head.getDirection() != instruction)) {
//Reversing or has delay, need to center it in the middle first
midd.addActionLaunch(info.getRailLocation(), 0);
}
if (delayMS > 0) {
if (TrainCarts.playSoundAtStation) group.addActionSizzle();
info.getGroup().addAction(new BlockActionSetLevers(info.getAttachedBlock(), true));
}
group.addActionWait(delayMS);
midd.addActionLaunch(instruction, length, TrainCarts.launchForce);
}
}
}
}
if (info.isAction(SignActionType.GROUP_LEAVE)) {
info.setLevers(false);
}
}
}
}
}
}
@Override
public void build(SignChangeEvent event, String type, SignActionMode mode) {
if (mode != SignActionMode.NONE) {
if (type.startsWith("station")) {
handleBuild(event, Permission.BUILD_STATION, "station", "stop, wait and launch trains");
}
}
}
}
| [
"[email protected]"
] | |
8ed376c0b3d9c29a086444855cb04e7e5c10ac3b | a2f8374ffdad04ee3d0c72f63119ba8d36200f35 | /discovery/src/main/java/com/jinhyy/EurekaServer.java | 5b76799291f14d34234ee78e36baa4be9735d9f3 | [] | no_license | Jinhyy/cloud-native-app-sample | 4b16b841094b3102e90c1abd848ee9d1ecdf8df8 | 9350e89ad29d13658f3b3fef3f00e2d27d5f4997 | refs/heads/master | 2022-11-22T15:33:58.020455 | 2020-07-15T17:25:55 | 2020-07-15T17:25:55 | 170,606,991 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,891 | java | package com.jinhyy;
import com.netflix.config.ConfigurationManager;
import io.micrometer.core.instrument.MeterRegistry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.actuate.autoconfigure.metrics.MeterRegistryCustomizer;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
@EnableEurekaServer
@SpringBootApplication
public class EurekaServer {
private static final Logger logger = LoggerFactory.getLogger(EurekaServer.class);
@Configuration
public static class SecurityPermitAllConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests().anyRequest().permitAll()
.and().csrf().disable();
}
}
//
// @Bean
// MeterRegistryCustomizer<MeterRegistry> configurer(
// @Value("${spring.application.name}") String applicationName) {
// return (registry) -> registry.config().commonTags("application", applicationName);
// }
public static void main(String[] args) {
SpringApplication.run(EurekaServer.class, args);
// String dataCenter = ConfigurationManager.getConfigInstance().getString("archaius.deployment.datacenter");
// logger.info("★ dataCenter: {}", dataCenter);
// System.out.println("☆ dataCenter: " + dataCenter);
}
}
| [
"[email protected]"
] | |
555683b7f80ed18daad54b1f5d6ffb9fec4be7a0 | 3067190d61555f813e9332f3982ea446f842b64f | /backend/src/main/java/com/arek314/pda/db/dao/InformationsDAO.java | 71b77d1ae537262dc382874f048aa0e43b874ced | [] | no_license | ArekArek/PDA | dba83c4e258fa85e66b72a45e4f573e4bc9ec0da | 6ede19a0c0762e3bf702d1bf1421c512aec99a7a | refs/heads/master | 2021-01-20T13:22:27.682339 | 2017-05-06T17:40:46 | 2017-05-06T17:40:46 | 90,480,205 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,313 | java | package com.arek314.pda.db.dao;
import com.arek314.pda.db.mapper.InformationMapper;
import com.arek314.pda.db.model.Information;
import org.skife.jdbi.v2.sqlobject.BindBean;
import org.skife.jdbi.v2.sqlobject.SqlQuery;
import org.skife.jdbi.v2.sqlobject.SqlUpdate;
import org.skife.jdbi.v2.sqlobject.customizers.RegisterMapper;
import java.util.Collection;
@RegisterMapper(InformationMapper.class)
public abstract class InformationsDAO {
@SqlQuery("select id, \"mapURL\" from informations")
public abstract Collection<Information> getAllInformations();
@SqlUpdate("insert into informations (\"mapURL\") values (:mapURL)")
public abstract void createInformation(@BindBean Information information);
@SqlUpdate("update informations set \"mapURL\" = :mapURL where id in (select id from informations order by id " + "desc limit 1)")
public abstract void updateInformation(@BindBean Information information);
@SqlQuery("select id, \"mapURL\" from informations order by id desc limit 1")
public abstract Information getInformation();
@SqlUpdate("delete from informations")
abstract void removeAll();
@SqlUpdate("alter table informations alter column id restart with 1")
abstract void resetIdCounter();
public void deleteAll() {
removeAll();
}
}
| [
"[email protected]"
] | |
ed431cb79111f1c0a24d25daf670f6bc2eb8be36 | 7d01b90c542d321e513009e134a59a756a08097c | /babasport/src/main/java/com/cjk/core/bean/product/Brand.java | a2de6459960dc1956d52f70b5b19e0ac8580d009 | [] | no_license | Killwithout/AyogaStore | 544708cae9e3168ac05b32ee871b55ccf213fbdb | ad99f6fba33d036b7c7c78463c660148ec069eb8 | refs/heads/master | 2020-03-12T13:10:33.692096 | 2018-04-23T03:43:38 | 2018-04-23T03:43:38 | 130,635,484 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,925 | java | package com.cjk.core.bean.product;
import com.cjk.core.web.Constants;
/**
* 品牌
* @author cjk
*
*/
public class Brand {
private Integer id;
private String name;
private String description;
private String imgUrl;
private Integer sort;
private Integer isDisplay;
//获取全路径
public String getAllUrl(){
return Constants.IMAGE_URL + imgUrl;
}
//页号
private Integer pageNo = 1;
//开始行
private Integer startRow;
//每页数
private Integer pageSize = 10;
public Integer getStartRow() {
return startRow;
}
public void setStartRow(Integer startRow) {
this.startRow = startRow;
}
public Integer getPageSize() {
return pageSize;
}
public void setPageSize(Integer pageSize) {
//计算一次开始行
this.startRow = (pageNo - 1)*pageSize;
this.pageSize = pageSize;
}
public Integer getPageNo() {
return pageNo;
}
public void setPageNo(Integer pageNo) {
//计算一次开始行
this.startRow = (pageNo - 1)*pageSize;
this.pageNo = pageNo;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getImgUrl() {
return imgUrl;
}
public void setImgUrl(String imgUrl) {
this.imgUrl = imgUrl;
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
public Integer getIsDisplay() {
return isDisplay;
}
public void setIsDisplay(Integer isDisplay) {
this.isDisplay = isDisplay;
}
@Override
public String toString() {
return "Brand [id=" + id + ", name=" + name + ", description="
+ description + ", imgUrl=" + imgUrl + ", sort=" + sort
+ ", isDisplay=" + isDisplay + "]";
}
}
| [
"[email protected]"
] | |
b29878de319359d38b4f8f1691dd78a880119065 | c7d915893ddad2da392a96f6da21d273c4d5f2e6 | /src/结构型/过滤器模式/CriteriaFemale.java | 09988bd09b97b4bf90e42b78c8b31126e95feec1 | [] | no_license | xuqm/DesignPattern | 2fc7f489fc03b76379d42faddbc63af592de40f4 | ce9ef3a2b82349a49b273191074ebab4209814b4 | refs/heads/master | 2021-03-17T14:18:08.673062 | 2020-05-20T08:56:34 | 2020-05-20T08:56:34 | 246,997,019 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 485 | java | package 结构型.过滤器模式;
import java.util.ArrayList;
import java.util.List;
public class CriteriaFemale implements Criteria {
@Override
public List<Person> meetCriteria(List<Person> persons) {
List<Person> femalePersons = new ArrayList<Person>();
for (Person person : persons) {
if (person.getGender().equalsIgnoreCase("FEMALE")) {
femalePersons.add(person);
}
}
return femalePersons;
}
} | [
"[email protected]"
] | |
95533794e13c176a6ada4a4b935e75fc36c04ef3 | 34c3b0887f71165a6d4a533bc06ffa2624c2dc10 | /summer-alipay-core/src/main/java/com/alipay/api/domain/Material.java | b8f9592b4b5b6efd3143e6d403334a9c4961f87b | [] | no_license | songhaoran/summer-alipay | 91a7a7fdddf67265241785cd6bb2b784c0f0f1c4 | d02e33d9ab679dfc56160af4abd759c0abb113a4 | refs/heads/master | 2021-05-04T16:39:11.272890 | 2018-01-17T09:52:32 | 2018-01-17T09:52:32 | 120,255,759 | 1 | 0 | null | 2018-02-05T04:42:15 | 2018-02-05T04:42:15 | null | UTF-8 | Java | false | false | 1,271 | java | package com.alipay.api.domain;
import java.util.List;
import com.alipay.api.AlipayObject;
import com.alipay.api.internal.mapping.ApiField;
import com.alipay.api.internal.mapping.ApiListField;
/**
* 发送消息内容
*
* @author auto create
* @since 1.0, 2016-12-02 15:56:25
*/
public class Material extends AlipayObject {
private static final long serialVersionUID = 8853395383182559114L;
/**
* 图文消息子消息项集合,单条消息最多6个子项,否则会发送失败
*/
@ApiListField("articles")
@ApiField("article")
private List<Article> articles;
/**
* 消息类型,text:文本类型,image-text:图文类型。当消息类型为text时,text参数必传,当消息类型为image-text时,articles参数必传
*/
@ApiField("msg_type")
private String msgType;
/**
* 文本消息内容
*/
@ApiField("text")
private Text text;
public List<Article> getArticles() {
return this.articles;
}
public void setArticles(List<Article> articles) {
this.articles = articles;
}
public String getMsgType() {
return this.msgType;
}
public void setMsgType(String msgType) {
this.msgType = msgType;
}
public Text getText() {
return this.text;
}
public void setText(Text text) {
this.text = text;
}
}
| [
"[email protected]"
] | |
8e2be79e2a9013cb73fdaa912f87aeac80e03016 | d5f3b2856dcd60a1cd50c27ec7f95de0825cea7d | /src/main/java/com/helencoder/shield/util/DFA.java | 85ee1c52631098307946201a0f2df3756144c016 | [
"MIT"
] | permissive | helencoder/Shield | bf0bfb51051d6a862d05e01a8eebfc0d792832dc | 06b2960c0866f84ce6a70c416854dfcee90224ac | refs/heads/master | 2021-09-06T22:57:02.595216 | 2018-02-13T01:46:19 | 2018-02-13T01:46:19 | 104,615,084 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,030 | java | package com.helencoder.shield.util;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
/**
* DFA(Deterministic Finite Automaton)算法
*
* Created by helencoder on 2018/1/5.
*/
public class DFA {
private String dictPath;
private Set sensitiveWordsSet;
private Map sensitiveWordsMap;
public DFA(String dictPath) {
this.dictPath = dictPath;
this.sensitiveWordsSet = new HashSet<String>();
try {
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(dictPath)));
for (String str = br.readLine(); str != null; str = br.readLine()) {
this.sensitiveWordsSet.add(str.trim());
}
} catch (IOException ex) {
ex.printStackTrace();
}
}
/**
* 敏感词map构建
*/
public void init() {
this.sensitiveWordsMap = new HashMap<String, String>(this.sensitiveWordsSet.size());
Set<String> sensitiveWordsSet = this.sensitiveWordsSet;
for (String word : sensitiveWordsSet) {
Map nowMap = this.sensitiveWordsMap;
for (int i = 0; i < word.length(); i++) {
// 转换成char型
char keyChar = word.charAt(i);
// 获取
Object tempMap = nowMap.get(keyChar);
if (tempMap != null) { // 如果存在该key,直接赋值
nowMap = (Map) tempMap;
} else { // 不存在则,则构建一个map,同时将isEnd设置为0,因为他不是最后一个
// 设置标志位
Map<String, String> newMap = new HashMap<String, String>();
newMap.put("isEnd", "0");
// 添加到集合
nowMap.put(keyChar, newMap);
nowMap = newMap;
}
// 最后一个
if (i == word.length() - 1) {
nowMap.put("isEnd", "1");
}
}
}
}
/**
* 敏感词检测
*/
public boolean check(String str) {
boolean flag = false; //敏感词结束标识位:用于敏感词只有1位的情况
char word = 0;
Map nowMap = this.sensitiveWordsMap;
for(int i = 0; i < str.length() ; i++){
word = str.charAt(i);
nowMap = (Map) nowMap.get(word); //获取指定key
if(nowMap != null){ //存在,则判断是否为最后一个
if("1".equals(nowMap.get("isEnd"))){ //如果为最后一个匹配规则,结束循环,返回匹配标识数
flag = true; //结束标志位为true
}
} else{ //不存在,直接返回
break;
}
}
return flag;
}
}
| [
"[email protected]"
] | |
5e576d9f5d0b914cc427875cc4a42ce429c50f08 | 9eaa7d5600d84e7e326386b2e4aa8404bb2dec8a | /app/src/main/java/com/application/pradyotprakash/newattendanceappfaculty/FirebaseMessagingService.java | 50b3b2240ba855c16b06f6895bd1f44513f0e526 | [] | no_license | pradyotprksh/NewAttendanceAppFaculty | 89ee6b2ec02ecf8f8b96ea52aa7cef0b2d6850ca | a19da05a2155a98a73dba04f85c2c820b701d2c3 | refs/heads/master | 2021-04-06T04:34:28.771214 | 2018-05-17T19:05:10 | 2018-05-17T19:05:10 | 124,767,084 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,094 | java | package com.application.pradyotprakash.newattendanceappfaculty;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Intent;
import android.support.v4.app.NotificationCompat;
import com.google.firebase.messaging.RemoteMessage;
/**
* Created by pradyotprakash on 03/03/18.
*/
public class FirebaseMessagingService extends com.google.firebase.messaging.FirebaseMessagingService {
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
super.onMessageReceived(remoteMessage);
String message_title = remoteMessage.getNotification().getTitle();
String message_body = remoteMessage.getNotification().getBody();
String click_action = remoteMessage.getNotification().getClickAction();
String dataMessage = remoteMessage.getData().get("message");
String dataFrom = remoteMessage.getData().get("from_user_id");
String dataFromDesignation = remoteMessage.getData().get("from_designation");
String dataFromOn = remoteMessage.getData().get("message_on");
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(this, getString(R.string.default_notification_channel_id))
.setSmallIcon(R.mipmap.ic_launcher)
.setContentTitle(message_title)
.setContentText(message_body);
Intent intent = new Intent(click_action);
intent.putExtra("message", dataMessage);
intent.putExtra("from_user_id", dataFrom);
intent.putExtra("from_designation", dataFromDesignation);
intent.putExtra("message_on", dataFromOn);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
mBuilder.setContentIntent(pendingIntent);
int mNotificationId = (int) System.currentTimeMillis();
NotificationManager mNotifyMgr =
(NotificationManager) getSystemService(NOTIFICATION_SERVICE);
mNotifyMgr.notify(mNotificationId, mBuilder.build());
}
}
| [
"[email protected]"
] | |
222eab299876dc5c1003a24c3a3381b584bfd062 | a57d68dcd6f2b261dd1037c08a83ddcc7e0a05c7 | /views/JTBMain.java | d5743c8529ae8e5de3f049f442a82465555be234 | [] | no_license | CesarDuvanCabraCoy/SepararArchivos-TreeN | 8eb438165b62eada7f8b0a91e328ca679b0b144d | b3579b164160de6c51b2ddbcae60d5dbc2cfac31 | refs/heads/master | 2020-03-09T21:06:38.691888 | 2018-04-12T16:20:13 | 2018-04-12T16:20:13 | 129,001,250 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,044 | java | package views;
import java.awt.Color;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JToolBar;
import controllers.JBActions;
import controllers.MainController;
public class JTBMain extends JToolBar{
private static final long serialVersionUID = 1L;
private MainController mainController;
private JButton jbAddVideo;
public JTBMain(MainController mainController) {
this.mainController = mainController;
this.setBackground(Color.decode("#2D2E30"));
this.setFloatable(false);
this.setRollover(true);
init();
}
private void init() {
addButton(jbAddVideo, ConstantsGUI.URL_CHOOSE_FOLDER_MAIN, JBActions.SHOW_JFC_FOLDER, ConstantsGUI.TT_JFC_FOLDER, true);
}
private void addButton(JButton jb, String urlImage, JBActions command, String toolTip, boolean enabled) {
jb = new JButton(new ImageIcon(getClass().getResource(urlImage)));
jb.setEnabled(enabled);
jb.addActionListener(mainController);
jb.setActionCommand(command.toString());
jb.setToolTipText(toolTip);
this.add(jb);
}
} | [
"[email protected]"
] | |
98db75bbd79608791b6e4856338962c6ea0d8805 | 29b6a856a81a47ebab7bfdba7fe8a7b845123c9e | /dingtalk/java/src/main/java/com/aliyun/dingtalkimpaas_1_0/models/GetConversationIdRequest.java | 54aa673e0d5bee2c6cff2f2794b5ab5b131c10c7 | [
"Apache-2.0"
] | permissive | aliyun/dingtalk-sdk | f2362b6963c4dbacd82a83eeebc223c21f143beb | 586874df48466d968adf0441b3086a2841892935 | refs/heads/master | 2023-08-31T08:21:14.042410 | 2023-08-30T08:18:22 | 2023-08-30T08:18:22 | 290,671,707 | 22 | 9 | null | 2021-08-12T09:55:44 | 2020-08-27T04:05:39 | PHP | UTF-8 | Java | false | false | 884 | java | // This file is auto-generated, don't edit it. Thanks.
package com.aliyun.dingtalkimpaas_1_0.models;
import com.aliyun.tea.*;
public class GetConversationIdRequest extends TeaModel {
@NameInMap("appUid")
public String appUid;
@NameInMap("userId")
public String userId;
public static GetConversationIdRequest build(java.util.Map<String, ?> map) throws Exception {
GetConversationIdRequest self = new GetConversationIdRequest();
return TeaModel.build(map, self);
}
public GetConversationIdRequest setAppUid(String appUid) {
this.appUid = appUid;
return this;
}
public String getAppUid() {
return this.appUid;
}
public GetConversationIdRequest setUserId(String userId) {
this.userId = userId;
return this;
}
public String getUserId() {
return this.userId;
}
}
| [
"[email protected]"
] | |
1c95554b9f2400caaf33dbb2ff0e60064e398c43 | 49b026906e9949218c49b62fbe1118965a450ad3 | /src/test/java/ua/repair_agency/services/validation/FormValidatorTest.java | ac8ef87831a7914b339d5bba8c15888d26610e1f | [] | no_license | flame19/RepairAgency | 4921ca796f5b6c15ca3f8d2ea859285b33cad693 | 6fe393edd22f6922ce41982215a2ee8a28d44aa8 | refs/heads/master | 2022-12-25T17:28:14.425846 | 2020-10-11T15:47:47 | 2020-10-11T15:47:47 | 303,154,935 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,013 | java | package ua.repair_agency.services.validation;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
import org.junit.jupiter.params.provider.ValueSource;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import ua.repair_agency.constants.Attributes;
import ua.repair_agency.constants.Parameters;
import ua.repair_agency.models.forms.*;
import ua.repair_agency.models.user.User;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.HashSet;
import java.util.Set;
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
class FormValidatorTest {
@Mock
private HttpServletRequest req;
private Set<String> inconsistencies = new HashSet<>();
@BeforeEach
void init() {
MockitoAnnotations.initMocks(this);
inconsistencies.clear();
}
@ParameterizedTest
@CsvSource({"[email protected], User1234", "[email protected], User1234"})
void validation_loginFormWithValidData_noInconsistencies(String email, String pass) {
when(req.getParameter("email")).thenReturn(email);
when(req.getParameter("pass")).thenReturn(pass);
LoginForm form = new LoginForm(req);
inconsistencies = FormValidator.validateForm(form);
assertTrue(inconsistencies.isEmpty());
}
@ParameterizedTest
@CsvSource({"user@mailcom, User1234", "usermail.com, User1234", "[email protected], User1234"})
void validation_loginFormWithInvalidEmail_oneEmailInconsistency(String email, String pass) {
when(req.getParameter("email")).thenReturn(email);
when(req.getParameter("pass")).thenReturn(pass);
LoginForm form = new LoginForm(req);
inconsistencies = FormValidator.validateForm(form);
assertAll(
() -> assertEquals(1, inconsistencies.size()),
() -> assertTrue(inconsistencies.contains("email")));
}
@ParameterizedTest
@CsvSource({"[email protected], User123", "[email protected], user1234", "[email protected], ?ser1234"})
void validation_loginFormWithInvalidPass_onePassInconsistency(String email, String pass) {
when(req.getParameter("email")).thenReturn(email);
when(req.getParameter("pass")).thenReturn(pass);
LoginForm form = new LoginForm(req);
inconsistencies = FormValidator.validateForm(form);
assertAll(
() -> assertEquals(1, inconsistencies.size()),
() -> assertTrue(inconsistencies.contains("password")));
}
@ParameterizedTest
@CsvSource({"user@mailcom, User123", "usermail.com, user1234", "[email protected], ?ser1234", ","})
void validation_loginFormWithInvalidEmailPass_twoEmailPassInconsistencies(String email, String pass) {
when(req.getParameter("email")).thenReturn(email);
when(req.getParameter("pass")).thenReturn(pass);
LoginForm form = new LoginForm(req);
inconsistencies = FormValidator.validateForm(form);
assertAll(
() -> assertEquals(2, inconsistencies.size()),
() -> assertTrue(inconsistencies.contains("email")),
() -> assertTrue(inconsistencies.contains("password")));
}
@ParameterizedTest
@CsvSource({"Firstname, Lastname, [email protected], User1234, User1234, en, CUSTOMER",
"Ім'я, Прізвище, [email protected], User1234, User1234, uk, CUSTOMER"})
void validation_registrationFormWithValidData_noInconsistencies(
String fName, String lName, String email, String pass, String passConf, String lang, String role) {
HttpSession session = mock(HttpSession.class);
User user = mock(User.class);
when(req.getParameter(Parameters.F_NAME)).thenReturn(fName);
when(req.getParameter(Parameters.L_NAME)).thenReturn(lName);
when(req.getParameter(Parameters.EMAIL)).thenReturn(email);
when(req.getParameter(Parameters.PASS)).thenReturn(pass);
when(req.getParameter(Parameters.PASS_CONF)).thenReturn(passConf);
when(req.getParameter(Parameters.LANG)).thenReturn(lang);
when(req.getParameter(Parameters.ROLE)).thenReturn(role);
when(user.getLanguage()).thenReturn(lang);
when(session.getAttribute(Attributes.USER)).thenReturn(user);
when(req.getSession()).thenReturn(session);
RegistrationForm form = new RegistrationForm(req);
inconsistencies = FormValidator.validateForm(form);
assertTrue(inconsistencies.isEmpty());
}
@ParameterizedTest
@CsvSource({"Firstname+, Lastnaem1, usermail.com, user1234, USer12345, ,",
"Ім'я%, Прізвище/, [email protected], user123, USer12345, ,"})
void validation_registrationFormWithInvalidData_sevenInconsistencies(
String fName, String lName, String email, String pass, String passConf, String lang, String role) {
HttpSession session = mock(HttpSession.class);
User user = mock(User.class);
when(req.getParameter(Parameters.F_NAME)).thenReturn(fName);
when(req.getParameter(Parameters.L_NAME)).thenReturn(lName);
when(req.getParameter(Parameters.EMAIL)).thenReturn(email);
when(req.getParameter(Parameters.PASS)).thenReturn(pass);
when(req.getParameter(Parameters.PASS_CONF)).thenReturn(passConf);
when(req.getParameter(Parameters.LANG)).thenReturn(lang);
when(req.getParameter(Parameters.ROLE)).thenReturn(role);
when(user.getLanguage()).thenReturn(lang);
when(session.getAttribute(Attributes.USER)).thenReturn(user);
when(req.getSession()).thenReturn(session);
RegistrationForm form = new RegistrationForm(req);
inconsistencies = FormValidator.validateForm(form);
assertAll(
() -> assertEquals(7, inconsistencies.size()),
() -> assertTrue(inconsistencies.contains("firstName")),
() -> assertTrue(inconsistencies.contains("lastName")),
() -> assertTrue(inconsistencies.contains("email")),
() -> assertTrue(inconsistencies.contains("password")),
() -> assertTrue(inconsistencies.contains("passwordConfirmation")),
() -> assertTrue(inconsistencies.contains("language")),
() -> assertTrue(inconsistencies.contains("role")));
}
@ParameterizedTest
@CsvSource({
"Firstname, Lastname, [email protected], MANAGER",
"Ім'я, Прізвище, [email protected], MASTER"})
void validation_userEditingFormWithValidData_noInconsistencies(String fName, String lName, String email, String role) {
when(req.getParameter(Parameters.F_NAME)).thenReturn(fName);
when(req.getParameter(Parameters.L_NAME)).thenReturn(lName);
when(req.getParameter(Parameters.EMAIL)).thenReturn(email);
when(req.getParameter(Parameters.ROLE)).thenReturn(role);
UserEditingForm form = new UserEditingForm(req);
inconsistencies = FormValidator.validateForm(form);
assertTrue(inconsistencies.isEmpty());
}
@ParameterizedTest
@CsvSource({
"Firstname8, Lastname/, usermail.com, ",
"Ім'я., Прізвище2, second-user@mailcom, "})
void validation_userEditingFormWithInvalidData_fourInconsistencies(String fName, String lName, String email, String role) {
when(req.getParameter(Parameters.F_NAME)).thenReturn(fName);
when(req.getParameter(Parameters.L_NAME)).thenReturn(lName);
when(req.getParameter(Parameters.EMAIL)).thenReturn(email);
when(req.getParameter(Parameters.ROLE)).thenReturn(role);
UserEditingForm form = new UserEditingForm(req);
inconsistencies = FormValidator.validateForm(form);
assertAll(
() -> assertEquals(4, inconsistencies.size()),
() -> assertTrue(inconsistencies.contains("firstName")),
() -> assertTrue(inconsistencies.contains("lastName")),
() -> assertTrue(inconsistencies.contains("email")),
() -> assertTrue(inconsistencies.contains("role")));
}
@ParameterizedTest
@CsvSource(
{"Brand-100, 100-model, 2005, ENGINE_REPAIR, Repair description",
"Бренд-100, 100-модель, 1995, CHASSIS_REPAIR, Опис ремонту"})
void validation_orderFormWithValidData_noInconsistencies(
String brand, String model, String year, String repairType, String repairDescription) {
HttpSession session = mock(HttpSession.class);
when(req.getParameter(Parameters.CAR_BRAND)).thenReturn(brand);
when(req.getParameter(Parameters.CAR_MODEL)).thenReturn(model);
when(req.getParameter(Parameters.CAR_YEAR)).thenReturn(year);
when(req.getParameter(Parameters.REPAIR_TYPE)).thenReturn(repairType);
when(req.getParameter(Parameters.REPAIR_DESCRIPTION)).thenReturn(repairDescription);
when(session.getAttribute(Attributes.USER)).thenReturn(new User.UserBuilder().build());
when(req.getSession()).thenReturn(session);
OrderForm form = new OrderForm(req);
inconsistencies = FormValidator.validateForm(form);
assertTrue(inconsistencies.isEmpty());
}
@ParameterizedTest
@CsvSource({
"Brand%, , 2100, Repair type, ",
", Модель?, 1899, , "})
void validation_orderFormWithInvalidData_fiveInconsistencies(
String brand, String model, String year, String repairType, String repairDescription) {
HttpSession session = mock(HttpSession.class);
when(req.getParameter(Parameters.CAR_BRAND)).thenReturn(brand);
when(req.getParameter(Parameters.CAR_MODEL)).thenReturn(model);
when(req.getParameter(Parameters.CAR_YEAR)).thenReturn(year);
when(req.getParameter(Parameters.REPAIR_TYPE)).thenReturn(repairType);
when(req.getParameter(Parameters.REPAIR_DESCRIPTION)).thenReturn(repairDescription);
when(session.getAttribute(Attributes.USER)).thenReturn(new User.UserBuilder().build());
when(req.getSession()).thenReturn(session);
OrderForm form = new OrderForm(req);
inconsistencies = FormValidator.validateForm(form);
assertAll(
() -> assertEquals(5, inconsistencies.size()),
() -> assertTrue(inconsistencies.contains("carBrand")),
() -> assertTrue(inconsistencies.contains("carModel")),
() -> assertTrue(inconsistencies.contains("carYear")),
() -> assertTrue(inconsistencies.contains("repairType")),
() -> assertTrue(inconsistencies.contains("repairDescription")));
}
@ParameterizedTest
@CsvSource({"131.25, Some manager comment", "15, Якийсь коментар менеджера"})
void validation_orderEditingFormWithValidData_noInconsistencies(String price, String managerComment) {
when(req.getParameter(Parameters.PRICE)).thenReturn(price);
when(req.getParameter(Parameters.MANAGER_COMMENT)).thenReturn(managerComment);
OrderEditingForm form = new OrderEditingForm(req);
inconsistencies = FormValidator.validateForm(form);
assertTrue(inconsistencies.isEmpty());
}
@ParameterizedTest
@CsvSource({".25, ", "10.1.3, "})
void validation_orderEditingFormWithInvalidData_twoInconsistencies(String price, String managerComment) {
when(req.getParameter(Parameters.PRICE)).thenReturn(price);
when(req.getParameter(Parameters.MANAGER_COMMENT)).thenReturn(managerComment);
OrderEditingForm form = new OrderEditingForm(req);
Set<String> inconsistencies = FormValidator.validateForm(form);
assertAll(
() -> assertEquals(2, inconsistencies.size()),
() -> assertTrue(inconsistencies.contains("price")),
() -> assertTrue(inconsistencies.contains("managerComment")));
}
@ParameterizedTest
@CsvSource({"Some review", "Якийсь відгук"})
void validation_reviewFormWithValidData_noInconsistencies(String review) {
when(req.getParameter(Parameters.REVIEW_CONTENT)).thenReturn(review);
ReviewForm form = new ReviewForm(req);
inconsistencies = FormValidator.validateForm(form);
assertTrue(inconsistencies.isEmpty());
}
@ParameterizedTest
@ValueSource(strings = {""})
void validation_reviewFormWithInvalidData_inconsistency(String review) {
when(req.getParameter(Parameters.REVIEW_CONTENT)).thenReturn(review);
ReviewForm form = new ReviewForm(req);
inconsistencies = FormValidator.validateForm(form);
assertAll(
() -> assertEquals(1, inconsistencies.size()),
() -> assertTrue(inconsistencies.contains("reviewContent")));
}
}
| [
"[email protected]"
] | |
3b17693ce107e3237a041c13ccdd85c99ed9c01c | 0fb8ed67d7181f6ede69451329c740f983c5e40c | /Java-Applet/applet_b3.java | ecb01080894ebac6ddf5c40eb4057393ed4fb96d | [] | no_license | ttyn/java | 61e6f184f10e59050ad51ffdd0994cd81420aeff | 33759e749f297b643b1bef1e16fe822622ce05d6 | refs/heads/master | 2020-03-22T05:53:37.749968 | 2018-07-03T14:46:22 | 2018-07-03T14:46:22 | 139,597,684 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 997 | java | import java.awt.Graphics;
import javax.swing.JApplet;
import javax.swing.JOptionPane;
public class applet_b3 extends JApplet {
int num;
String[] kq= {"","","",""};
/**
* Create the applet.
*/
public applet_b3() {
}
public void init(){
String n1=JOptionPane.showInputDialog("Nhập số thứ nhất", null);
String n2=JOptionPane.showInputDialog("Nhập số thứ 2", null);
try {
double num1=Integer.parseInt(n1);
double num2=Integer.parseInt(n2);
kq[0]=n1+"+"+n2+"="+String.valueOf(num1+num2);
kq[1]=n1+"-"+n2+"="+String.valueOf(num1-num2);
kq[2]=n1+"*"+n2+"="+String.valueOf(num1*num2);
kq[3]=n1+"/"+n2+"="+String.valueOf(num1/num2);
}
catch(NumberFormatException e) {
JOptionPane.showMessageDialog(null,"Vui lòng nhập lại 2 số thực");
init();
}
}
public void paint(Graphics g) {
int y = 20;
for(int i=0;i<4;i++) {
y+=15;
g.drawString(kq[i], 20, y);
}
}
}
| [
"[email protected]"
] | |
8ec02b2a956d579b705bac2b821ad30c2d00879d | f28dce60491e33aefb5c2187871c1df784ccdb3a | /src/main/java/rx/internal/operators/OperatorZipIterable.java | 67b59f1147616416687a8b3613c9a45d69eac3bc | [
"Apache-2.0"
] | permissive | JackChan1999/boohee_v5.6 | 861a5cad79f2bfbd96d528d6a2aff84a39127c83 | 221f7ea237f491e2153039a42941a515493ba52c | refs/heads/master | 2021-06-11T23:32:55.977231 | 2017-02-14T18:07:04 | 2017-02-14T18:07:04 | 81,962,585 | 8 | 6 | null | null | null | null | UTF-8 | Java | false | false | 2,304 | java | package rx.internal.operators;
import java.util.Iterator;
import rx.Observable$Operator;
import rx.Subscriber;
import rx.exceptions.Exceptions;
import rx.functions.Func2;
import rx.observers.Subscribers;
public final class OperatorZipIterable<T1, T2, R> implements Observable$Operator<R, T1> {
final Iterable<? extends T2> iterable;
final Func2<? super T1, ? super T2, ? extends R> zipFunction;
public OperatorZipIterable(Iterable<? extends T2> iterable, Func2<? super T1, ? super T2, ? extends R> zipFunction) {
this.iterable = iterable;
this.zipFunction = zipFunction;
}
public Subscriber<? super T1> call(final Subscriber<? super R> subscriber) {
final Iterator<? extends T2> iterator = this.iterable.iterator();
try {
if (iterator.hasNext()) {
return new Subscriber<T1>(subscriber) {
boolean done;
public void onCompleted() {
if (!this.done) {
this.done = true;
subscriber.onCompleted();
}
}
public void onError(Throwable e) {
if (this.done) {
Exceptions.throwIfFatal(e);
return;
}
this.done = true;
subscriber.onError(e);
}
public void onNext(T1 t) {
if (!this.done) {
try {
subscriber.onNext(OperatorZipIterable.this.zipFunction.call(t, iterator.next()));
if (!iterator.hasNext()) {
onCompleted();
}
} catch (Throwable e) {
Exceptions.throwOrReport(e, this);
}
}
}
};
}
subscriber.onCompleted();
return Subscribers.empty();
} catch (Throwable e) {
Exceptions.throwOrReport(e, subscriber);
return Subscribers.empty();
}
}
}
| [
"[email protected]"
] | |
9a01d3767ca6a919df7347ae3a703e0dc48b1038 | 115ea1b0b3adbaf984b92d57df1c4a659f03880d | /app/src/main/java/com/zjc/drivingSchoolT/db/model/OrderItem.java | cd86332d569337491527741fdba6405d5ed4972a | [] | no_license | caocf/DrivingSchoolT | c125bfed726ae710b3a1221dd1e9c14eca43b169 | f7799e10f2c08fd0cc6ec30df832049f3a28ac5f | refs/heads/master | 2020-06-11T21:46:29.964063 | 2016-09-03T15:17:04 | 2016-09-03T15:17:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,083 | java | package com.zjc.drivingSchoolT.db.model;
/**
* 订单列表Item
*
* @author LJ
* @date 2016年7月21日
*/
public class OrderItem extends AppResponse {
/**
* contactsname : 张俊陈
* contactsphone : 13797039695
* orderid : SJ160827592280000005
* orid : 678de123f41046028591cb6e36508104
* starttime : 2016-08-29 20:35:00
* state : 1
* title : 科目三培训学车订单
* total : 200.0
* uid : 42164b4381024eb1b6d6b9c0836aaa59
*/
private String contactsname;
private String contactsphone;
private String orderid;
private String orid;
private String starttime;
private String state;
private String title;
private double total;
private String uid;
public String getContactsname() {
return contactsname;
}
public void setContactsname(String contactsname) {
this.contactsname = contactsname;
}
public String getContactsphone() {
return contactsphone;
}
public void setContactsphone(String contactsphone) {
this.contactsphone = contactsphone;
}
public String getOrderid() {
return orderid;
}
public void setOrderid(String orderid) {
this.orderid = orderid;
}
public String getOrid() {
return orid;
}
public void setOrid(String orid) {
this.orid = orid;
}
public String getStarttime() {
return starttime;
}
public void setStarttime(String starttime) {
this.starttime = starttime;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public double getTotal() {
return total;
}
public void setTotal(double total) {
this.total = total;
}
public String getUid() {
return uid;
}
public void setUid(String uid) {
this.uid = uid;
}
}
| [
"zjcx740811016"
] | zjcx740811016 |
bdb0487ab300db1cebac18334c409812c76d87e2 | f55e0f08bbbbde3bbf06b83c822a93d54819b1e8 | /app/src/main/java/com/jqsoft/nursing/rx/RxBusBaseMessage.java | 4fedbb9fe8acca6e8456b3ed80026d77d8c47974 | [] | no_license | moshangqianye/nursing | 27e58e30a51424502f1b636ae47b60b81a3b2ca0 | 20cd5aace59555ef9d708df0fb03639b2fc843d0 | refs/heads/master | 2020-09-08T13:39:55.939252 | 2020-03-20T09:55:34 | 2020-03-20T09:55:34 | 221,147,807 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 428 | java | package com.jqsoft.nursing.rx;
/**
* Created by quantan.liu on 2017/3/10.
*/
public class RxBusBaseMessage {
private int code;
private Object object;
private RxBusBaseMessage(){}
public RxBusBaseMessage(int code, Object object){
this.code=code;
this.object=object;
}
public int getCode() {
return code;
}
public Object getObject() {
return object;
}
}
| [
"123456"
] | 123456 |
b1620b1a2d5163c629ba7b868f0c432897d6e40a | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/15/15_24cde041f237747c2fc6d61a1ee0ec56a904293b/PublicOpenIDResource/15_24cde041f237747c2fc6d61a1ee0ec56a904293b_PublicOpenIDResource_s.java | 5b607db3c42691be88f7f09372f0106231c404d1 | [] | 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 | 10,176 | java | package uk.co.froot.demo.openid.resources;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.google.common.collect.Sets;
import com.yammer.dropwizard.views.View;
import org.openid4java.OpenIDException;
import org.openid4java.consumer.ConsumerException;
import org.openid4java.consumer.ConsumerManager;
import org.openid4java.consumer.VerificationResult;
import org.openid4java.discovery.DiscoveryException;
import org.openid4java.discovery.DiscoveryInformation;
import org.openid4java.discovery.Identifier;
import org.openid4java.message.AuthRequest;
import org.openid4java.message.AuthSuccess;
import org.openid4java.message.MessageException;
import org.openid4java.message.ParameterList;
import org.openid4java.message.ax.AxMessage;
import org.openid4java.message.ax.FetchRequest;
import org.openid4java.message.ax.FetchResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import uk.co.froot.demo.openid.auth.InMemoryUserCache;
import uk.co.froot.demo.openid.model.Authority;
import uk.co.froot.demo.openid.model.BaseModel;
import uk.co.froot.demo.openid.model.User;
import uk.co.froot.demo.openid.views.PublicFreemarkerView;
import javax.servlet.http.HttpSession;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.net.URI;
import java.util.List;
import java.util.Set;
/**
* <p>Resource to provide the following to application:</p>
* <ul>
* <li>Provision of configuration for public home page</li>
* </ul>
*
* @since 0.0.1
*/
@Path("/openid")
@Produces(MediaType.TEXT_HTML)
public class PublicOpenIDResource extends BaseResource {
private static final Logger log = LoggerFactory.getLogger(PublicOpenIDResource.class);
private static final String OPENID_DISCOVERY_KEY = "openid-discovery-key";
private final static String YAHOO_ENDPOINT = "https://me.yahoo.com";
private final static String GOOGLE_ENDPOINT = "https://www.google.com/accounts/o8/id";
public final ConsumerManager manager;
public PublicOpenIDResource() {
// Proxy configuration must come before ConsumerManager construction
// ProxyProperties proxyProps = new ProxyProperties();
// proxyProps.setProxyHostName("some-proxy");
// proxyProps.setProxyPort(8080);
// HttpClientFactory.setProxyProperties(proxyProps);
this.manager = new ConsumerManager();
}
/**
* @return A login view
*/
@GET
public View login() {
BaseModel model = new BaseModel();
return new PublicFreemarkerView<BaseModel>("openid/login.ftl", model);
}
/**
* Handles the authentication request from the user after they select their OpenId server
*
* @param identifier The identifier for the OpenId server
* @return A redirection or a form view containing user-specific permissions
*/
@POST
public Response authenticationRequest(
@FormParam("identifier")
String identifier
) {
Preconditions.checkNotNull(identifier, "No OpenID identifier submitted");
try {
// The OpenId server will use this endpoint to provide authentication
// Parts of this may be shown to the user
String returnToUrl = String.format(
"http://%s:%d/openid/verify",
request.getServerName(),
request.getServerPort());
// Perform discovery on the user-supplied identifier
List discoveries = manager.discover(identifier);
// Attempt to associate with the OpenID provider
// and retrieve one service endpoint for authentication
DiscoveryInformation discovered = manager.associate(discoveries);
// Store the discovery information in the user's session (creating a new one if required)
HttpSession session = request.getSession();
session.setAttribute(OPENID_DISCOVERY_KEY, discovered);
// Build the AuthRequest message to be sent to the OpenID provider
AuthRequest authReq = manager.authenticate(discovered, returnToUrl);
// Build the FetchRequest containing the information to be copied
// from the OpenID provider
FetchRequest fetch = FetchRequest.createFetchRequest();
if (identifier.startsWith(GOOGLE_ENDPOINT)) {
fetch.addAttribute("email",
"http://axschema.org/contact/email", true);
fetch.addAttribute("firstName",
"http://axschema.org/namePerson/first", true);
fetch.addAttribute("lastName",
"http://axschema.org/namePerson/last", true);
} else if (identifier.startsWith(YAHOO_ENDPOINT)) {
fetch.addAttribute("email",
"http://axschema.org/contact/email", true);
fetch.addAttribute("fullname",
"http://axschema.org/namePerson", true);
} else { // works for myOpenID
fetch.addAttribute("fullname",
"http://schema.openid.net/namePerson", true);
fetch.addAttribute("email",
"http://schema.openid.net/contact/email", true);
}
// Attach the extension to the authentication request
authReq.addExtension(fetch);
// Redirect the user to their OpenId server authentication process
return Response.seeOther(URI.create(authReq.getDestinationUrl(true))).build();
} catch (MessageException e1) {
e1.printStackTrace();
} catch (DiscoveryException e1) {
e1.printStackTrace();
} catch (ConsumerException e1) {
e1.printStackTrace();
}
return Response.ok().build();
}
/**
* Handles the OpenId server response to the earlier AuthRequest
*
* @return The OpenId identifier for this user if verification was successful
*/
@GET
@Path("/verify")
public View verifyOpenIdServerResponse() {
BaseModel model = new BaseModel();
try {
// Retrieve the previously stored discovery information
DiscoveryInformation discovered = (DiscoveryInformation) request
.getSession(false)
.getAttribute(OPENID_DISCOVERY_KEY);
// Fail fast
if (discovered == null) {
throw new WebApplicationException(Response.Status.UNAUTHORIZED);
}
// Extract the receiving URL from the HTTP request
StringBuffer receivingURL = request.getRequestURL();
String queryString = request.getQueryString();
if (queryString != null && queryString.length() > 0) {
receivingURL.append("?").append(request.getQueryString());
}
// Extract the parameters from the authentication response
// (which comes in as a HTTP request from the OpenID provider)
ParameterList parameterList = new ParameterList(request.getParameterMap());
// Verify the response
// ConsumerManager needs to be the same (static) instance used
// to place the authentication request
// This could be tricky if this service is load-balanced
VerificationResult verification = manager.verify(
receivingURL.toString(), parameterList, discovered);
// Examine the verification result and extract the verified identifier
Optional<Identifier> verified = Optional.fromNullable(verification.getVerifiedId());
if (verified.isPresent()) {
// Verified
AuthSuccess authSuccess = (AuthSuccess) verification.getAuthResponse();
// Put the result into the user cache
User user = new User();
user.setOpenIDIdentifier(verified.get().getIdentifier());
// Extract additional information
if (authSuccess.hasExtension(AxMessage.OPENID_NS_AX)) {
user.setEmailAddress(extractEmailAddress(authSuccess));
user.setFirstName(extractFirstName(authSuccess));
user.setLastName(extractLastName(authSuccess));
}
log.info("Extracted a {}",user);
// Bind the authorities to the user
Set<Authority> authorities = Sets.newHashSet();
// Promote to admin if they have a specific email address
// (not a good way, but this is only a demo)
if ("[email protected]".equals(user.getEmailAddress())) {
authorities.add(Authority.ROLE_ADMIN);
log.info("Granted admin rights");
}
authorities.add(Authority.ROLE_PUBLIC);
user.setAuthorities(authorities);
// This user may be returning through a verified cookie on a new session
HttpSession session = request.getSession();
// Use a central store for Users (keeps the session light)
InMemoryUserCache.INSTANCE.put(session.getId(), user);
return new PublicFreemarkerView<BaseModel>("common/home.ftl", model);
}
} catch (OpenIDException e) {
// present error to the user
e.printStackTrace();
}
// Must have failed to be here
throw new WebApplicationException(Response.Status.UNAUTHORIZED);
}
private String extractEmailAddress(AuthSuccess authSuccess) throws MessageException {
FetchResponse fetchResp = (FetchResponse) authSuccess.getExtension(AxMessage.OPENID_NS_AX);
return getAttributeValue(
fetchResp,
"email",
"",
String.class);
}
private String extractFirstName(AuthSuccess authSuccess) throws MessageException {
FetchResponse fetchResp = (FetchResponse) authSuccess.getExtension(AxMessage.OPENID_NS_AX);
return getAttributeValue(
fetchResp,
"firstname",
"",
String.class);
}
private String extractLastName(AuthSuccess authSuccess) throws MessageException {
FetchResponse fetchResp = (FetchResponse) authSuccess.getExtension(AxMessage.OPENID_NS_AX);
return getAttributeValue(
fetchResp,
"lastname",
"",
String.class);
}
@SuppressWarnings("unchecked")
private <T> T getAttributeValue(FetchResponse fetchResponse, String attribute, T defaultValue, Class<T> clazz) {
List list = fetchResponse.getAttributeValues(attribute);
if (list != null && !list.isEmpty()) {
return (T) list.get(0);
}
return defaultValue;
}
}
| [
"[email protected]"
] | |
b34b70dbd23caeab8e810e21780c96e3aa8af2cc | 6a2dcdc4ef2c0f7a27740696c978d7d3d01ac09e | /src/main/java/com/example/FinalExam/loanController.java | 40174c4aa3b5d886e6fa0e716d947b2b1f2ea429 | [] | no_license | amansidhu29/Amandeep_300324334FinalExam | ea2507a69e7e89013553cc9bbd76a3f8f396756c | b4ace04b702f77b5d20e08e2b0d1489a21935376 | refs/heads/master | 2023-07-15T10:09:48.687401 | 2021-08-19T19:10:30 | 2021-08-19T19:10:30 | 398,088,295 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,545 | java | package com.example.FinalExam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.SessionAttributes;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
@RequestMapping
@Controller
public class loanController {
DataBaseImplementation service;
@Autowired
Connection connect;
//a mapping when someone enters file
@RequestMapping(value = "/", method = RequestMethod.GET)
public String showloanPage2(ModelMap model) throws ClassNotFoundException, SQLException {
service = new DataBaseImplementation(connect.connect());
model.addAttribute("todos", service.display());
List<Loan> filteredTodos = new ArrayList<Loan>();
filteredTodos = (List) model.get("todos");
model.put("no", filteredTodos.get(0).getClientno());
model.put("clientname", filteredTodos.get(0).getClientname());
model.put("loanamount", filteredTodos.get(0).getLoanamount());
model.put("years", filteredTodos.get(0).getYears());
model.put("loantype", filteredTodos.get(0).getLoantype());
return "loantable";
}
@RequestMapping(value = "/loantable", method = RequestMethod.GET)
public String showLoanpage(ModelMap model,@RequestParam(defaultValue = "") String id) throws ClassNotFoundException, SQLException {
service = new DataBaseImplementation(connect.connect());
model.addAttribute("todos", service.display());
List<Loan> filteredTodos = new ArrayList<Loan>();
filteredTodos = (List) model.get("todos");
model.put("id", filteredTodos.get(0).getClientno());
model.put("clientname", filteredTodos.get(0).getClientname());
model.put("loanamount", filteredTodos.get(0).getLoanamount());
model.put("years", filteredTodos.get(0).getYears());
model.put("loantype", filteredTodos.get(0).getLoantype());
return"loantable";
}
@RequestMapping(value ="/delete-todo", method = RequestMethod.GET)
public String delete(ModelMap model, @RequestParam String id) throws SQLException, ClassNotFoundException {
service.delete(id);
model.clear();
return "redirect:/";
}
@RequestMapping(value = "/update-todo", method = RequestMethod.GET)
public String showUpdateTodoPage(ModelMap model, @RequestParam(defaultValue = "") String id) throws SQLException, ClassNotFoundException {
model.put("id", id);
Loan aa = service.search(id);
model.put("id", aa.getClientno());
model.put("clientname",aa.getClientname());
model.put("loanamount", aa.getLoanamount());
model.put("years", aa.getYears());
model.put("loantype", aa.getLoantype());
return "loanedit";
}
@RequestMapping(value = "/update-todo", method = RequestMethod.POST)
public String showUpdate(ModelMap model, @RequestParam String clientno, @RequestParam String clientname,@RequestParam double loanamount,@RequestParam int years,@RequestParam String loantype) throws SQLException, ClassNotFoundException {
String iid = (String) model.get("id");
Loan aa = new Loan(clientno,clientname,loanamount,years,loantype);
service.update(aa,iid);
return "redirect:/";
}
@RequestMapping(value = "/add-todo", method = RequestMethod.GET)
public String showpage()
{
return "loanadd";
}
@RequestMapping(value = "/add-todo", method = RequestMethod.POST)
public String add(ModelMap model, @RequestParam String clientno, @RequestParam String clientname,@RequestParam double loanamount,@RequestParam int years,@RequestParam String loantype) throws SQLException, ClassNotFoundException {
if (!((service.search(clientno)) == null)) {
model.put("errorMessage", "The Record you are trying to add is already existing.Choose a different customer number ");
return "redirect/loantable";
}
Loan aa = new Loan(clientno,clientname,loanamount,years,loantype);
service.add(aa);
model.clear();
return "redirect:/loantable";
}
}
| [
"[email protected]"
] | |
be140011c0e29a79bf51bf9627940abfa3e34058 | f88d3a6b54aa55ee1529d052dc4c8f71dfb38bc2 | /compilation1/Compiler_vrai/src/com/esisa/compiler/scanner/dfa/Blank.java | a934c57913b2fca432bf22ccdc008a40b46d78ce | [] | no_license | mhidoart/compilation-esisa | 8085c85591f004151857239c75b5e294d9e9137c | 5c76edd2ef88c789eacb172eb3dddafa26b4579d | refs/heads/master | 2023-02-23T04:29:15.411940 | 2021-01-28T15:06:09 | 2021-01-28T15:06:09 | 333,791,470 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 259 | java | package com.esisa.compiler.scanner.dfa;
import com.esisa.compiler.scanner.DFA;
public class Blank extends DFA{
public Blank() {
this("blank");
}
public Blank(String name) {
super(name , 2, 1);
add(0, 1, " \t\n\r");
add(1, 1, " \t\n\r");
}
}
| [
"[email protected]"
] | |
f4638098e64c008a8d7693296ca22da6445cf24a | 42e55f37181715d4eb12833c71083fa2196f14bc | /sismtema-legado-empresa-1/src/main/java/com/emrpesa/sistema/legado/SismtemaLegadoEmpresa1Application.java | d66445723b2cce5b40eb78d2f20c4aa7e07a20a3 | [] | no_license | AngelCeebra/sistema-empresa | 17f0265c1164ef587d13ef8d6f81efe99899cd24 | 7008bc059908d135c1ce9345a06e4f2e0c59027d | refs/heads/master | 2022-12-09T18:24:19.282215 | 2020-09-01T02:41:31 | 2020-09-01T02:41:31 | 291,366,776 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 351 | java | package com.emrpesa.sistema.legado;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SismtemaLegadoEmpresa1Application {
public static void main(String[] args) {
SpringApplication.run(SismtemaLegadoEmpresa1Application.class, args);
}
}
| [
"[email protected]"
] | |
bb523b5b94788a4a8210b253a5a56d92b15ec124 | a4e02b49771d16dd2a677c6702109aa848716831 | /src/com/cwa/server/logic/dataFunction/MatchDataFunction.java | 1702d7de443d0d14ceae8c842f806b095f6f87e2 | [] | no_license | mmgame/cwa2_2003logic_server | 29c1f774431bf458e98a648f76eea2c25ddf7133 | e40cb9ff2ea9b297124ce69acae4d114d1e3cfeb | refs/heads/master | 2021-03-12T22:08:58.968452 | 2015-08-06T03:10:02 | 2015-08-06T03:10:02 | 40,281,601 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,868 | java | package com.cwa.server.logic.dataFunction;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.cwa.component.data.IDBSession;
import com.cwa.component.data.function.IDataFunction;
import com.cwa.component.prototype.IPrototypeClientService;
import com.cwa.data.entity.IMatchEntityDao;
import com.cwa.data.entity.domain.MatchEntity;
import com.cwa.data.entity.domain.UserinfoEntity;
import com.cwa.message.MatchMessage.FormationInfoBean;
import com.cwa.prototype.FunctionPrototype;
import com.cwa.prototype.GameInitPrototype;
import com.cwa.prototype.gameEnum.CDTypeEnum;
import com.cwa.prototype.gameEnum.FunctionTypeEnum;
import com.cwa.prototype.gameEnum.IdsTypeEnum;
import com.cwa.prototype.gameEnum.MatchTypeEnum;
import com.cwa.server.logic.context.ILogicContext;
import com.cwa.server.logic.module.cd.IGameCdHandler;
import com.cwa.server.logic.module.match.cache.MatchCache;
import com.cwa.server.logic.player.IPlayer;
import com.cwa.util.TimeUtil;
/**
* 副本数据封装
*
* @author mausmars
*
*/
public class MatchDataFunction implements IDataFunction {
// {副本类型:MatchEntity}
private Map<Integer, MatchEntity> entityMap = new HashMap<Integer, MatchEntity>();
private MatchCache matchCache;
private IMatchEntityDao dao;
private IPlayer player;
private boolean isInited;
public MatchDataFunction(IPlayer player) {
this.player = player;
IDBSession dbSession = player.getDataFunctionManager().getDbSession();
dao = (IMatchEntityDao) dbSession.getEntityDao(MatchEntity.class);
}
@Override
public boolean initData(boolean newRegister) {
if (isInited) {
return false;
}
isInited = true;
List<MatchEntity> entitys = dao.selectEntityByUserId(player.getUserId(), createParams());
for (MatchEntity e : entitys) {
entityMap.put(e.matchType, e);
}
if (newRegister) {
IPrototypeClientService prototypeService = player.getLogicContext().getprototypeManager();
List<GameInitPrototype> gameInitPrototypeList = prototypeService.getAllPrototype(GameInitPrototype.class);
for (GameInitPrototype gameInitPrototype : gameInitPrototypeList) {
if (gameInitPrototype.getInitType() == IdsTypeEnum.Ids_Match.value()) {
newCreateEntity(gameInitPrototype.getInitSubType(), gameInitPrototype.getInitParamList().get(0));
}
}
}
return false;
}
@Override
public boolean isInited() {
return isInited;
}
public void newCreateEntity(int matchType, int passcardId) {
MatchEntity entity = new MatchEntity();
entity.userId = player.getUserId();
entity.matchType = matchType;
entity.matchKeyId = passcardId;
entity.resetTime = TimeUtil.currentSystemTime();
entity.setBattleKeyIdsMap(new HashMap<String, Integer>());
entity.setResetKeyIdsMap(new HashMap<String, Integer>());
entityMap.put(matchType, entity);
// 插入实体
insertEntity(entity);
}
public MatchEntity getEntity(int matchType) {
return entityMap.get(matchType);
}
public MatchCache getMatchCache() {
return matchCache;
}
// 创建副本战斗缓存
public void createMatchCache(int matchType, int passcardId) {
matchCache = new MatchCache();
matchCache.setMatchType(matchType);
matchCache.setMatchKeyId(passcardId);
matchCache.setStartTime(TimeUtil.currentSystemTime());
matchCache.setCheck(true);
matchCache.setSession(player.getSession());
}
// 移除緩存
public void cleanCache() {
matchCache = null;
}
public Collection<MatchEntity> getAllEntity() {
return entityMap.values();
}
/**
* 赢得比赛
*
* @param matchType
* @param passcardId
* @param next
*/
public void winMatch(int matchType, int passcardId, int next) {
MatchEntity matchEntity = entityMap.get(matchType);
if (matchEntity.matchKeyId == passcardId) {
// 设置下一关
matchEntity.matchKeyId = next;
}
modifyBattleCount(matchType, passcardId, 1);
updateEntity(matchEntity);
}
public void modifyBattleCount(int matchType, int passcardId, int count) {
// 精英副本比赛次数加
if (matchType == MatchTypeEnum.Match_Elite.value()) {
MatchEntity matchEntity = entityMap.get(matchType);
Map<String, Integer> battleKeyIdMap = matchEntity.getBattleKeyIdsMap();
if (!battleKeyIdMap.containsKey(String.valueOf(passcardId))) {
battleKeyIdMap.put(String.valueOf(passcardId), 0);
}
battleKeyIdMap.put(String.valueOf(passcardId), battleKeyIdMap.get(battleKeyIdMap) + count);
updateEntity(matchEntity);
}
}
// 精英副本次数重置
public void refreshBattleCount(int passcardId) {
MatchEntity matchEntity = entityMap.get(MatchTypeEnum.Match_Elite.value());
Map<String, Integer> battleKeyIdMap = matchEntity.getBattleKeyIdsMap();
if (battleKeyIdMap.containsKey(String.valueOf(passcardId))) {
battleKeyIdMap.put(String.valueOf(passcardId), 0);
updateEntity(matchEntity);
}
}
// 获取刷新次数
public int getRefreshCount(int passcardId) {
MatchEntity matchEntity = entityMap.get(MatchTypeEnum.Match_Elite.value());
Map<String, Integer> battleKeyIdMap = matchEntity.getBattleKeyIdsMap();
if (battleKeyIdMap.containsKey(String.valueOf(passcardId))) {
return battleKeyIdMap.get(String.valueOf(passcardId));
}
return 0;
}
/**
* 副本次数和重置次数cd检测
*/
public void cdBattleReset() {
ILogicContext logicContext = player.getLogicContext();
IGameCdHandler cdHandler = logicContext.getCdManager().getGameCd(CDTypeEnum.CD_BATTLE, player.getLogicContext());
for (MatchEntity matchEntity : entityMap.values()) {
boolean isFinishedCD = cdHandler.isFinishedCd(player, CDTypeEnum.CD_BATTLE.value(), matchEntity.resetTime);
if (isFinishedCD) {
matchEntity.getBattleKeyIdsMap().clear();
matchEntity.getResetKeyIdsMap().clear();
// 重置
if (logicContext.getCdManager().isSaveDb(CDTypeEnum.CD_BATTLE, logicContext)) {
matchEntity.resetTime = TimeUtil.currentSystemTime();
}
updateEntity(matchEntity);
}
}
}
public boolean checkMatchFormationInfo(List<FormationInfoBean> beans) {
Set<Integer> heroIds = new HashSet<Integer>();
boolean isRetinue = false;
Iterator<FormationInfoBean> beanIt = beans.iterator();
for (; beanIt.hasNext();) {
FormationInfoBean bean = beanIt.next();
int heroId = bean.getHeroId();
if (heroId > 0) {
if (heroIds.contains(heroId)) {
return false;
}
heroIds.add(heroId);
}
int retinueId = bean.getRetinueId();
if (retinueId > 0) {
if (heroIds.contains(retinueId)) {
return false;
}
heroIds.add(retinueId);
isRetinue = true;
}
}
if (isRetinue) {
UserinfoDataFunction fdFunction = (UserinfoDataFunction) player.getDataFunctionManager().getDataFunction(UserinfoEntity.class);
FunctionPrototype functionPrototype = player.getLogicContext().getprototypeManager()
.getPrototype(FunctionPrototype.class, FunctionTypeEnum.Function_Retinue.value());
int userLevel = fdFunction.getLevel();
if (userLevel < functionPrototype.getLevelMin()) {
// 等级不足开启侍从
return false;
}
}
return true;
}
private void updateEntity(MatchEntity entity) {
dao.updateEntity(entity, player.getDataFunctionManager().getDbSession().getParams(player.getRid()));
}
private void insertEntity(MatchEntity entity) {
dao.insertEntity(entity, player.getDataFunctionManager().getDbSession().getParams(player.getRid()));
}
private Map<String, Object> createParams() {
return player.getDataFunctionManager().getDbSession().getParams(player.getRid());
}
}
| [
"[email protected]"
] | |
bdd6f4479f70e943d9656b55a2b022aef2cc7aba | 6f09a418d925d82659ade9c55ccf312339da13c0 | /app/src/main/java/com/atendimentossolutions/filafastonline/ItemMeusAtendimentos.java | b98306d29f0607740f945d521c75d1befb0375c8 | [] | no_license | jonathandias02/FilaFastOnlineMobile | bc9c1b5e1ea14f2976dfcf6cad24d39afc6df352 | 6afceff8d568710da36f99f08021d577911766b2 | refs/heads/master | 2020-03-27T06:32:23.047364 | 2018-11-09T22:30:17 | 2018-11-09T22:30:17 | 146,113,255 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 874 | java | package com.atendimentossolutions.filafastonline;
import java.util.Date;
public class ItemMeusAtendimentos {
private String senha;
private String dataAtendimento;
private String servico;
private String atendente;
public String getSenha() {
return senha;
}
public void setSenha(String senha) {
this.senha = senha;
}
public String getDataAtendimento() {
return dataAtendimento;
}
public void setDataAtendimento(String dataAtendimento) {
this.dataAtendimento = dataAtendimento;
}
public String getServico() {
return servico;
}
public void setServico(String servico) {
this.servico = servico;
}
public String getAtendente() {
return atendente;
}
public void setAtendente(String atendente) {
this.atendente = atendente;
}
}
| [
"[email protected]"
] | |
60770ebdebfac673ac0dc2b29d59a695c5beb540 | a90259f75e3c9185211252596c6635b1c752144d | /src/com/shixi/domain/Customer.java | 580ca02af3d9bcca2654dfca101875b8550eca65 | [] | no_license | anshe80/purchase_sell_stock | 8d5e37d45c770de3a55814d0c68db5d1528359ec | aad7b257e8f5297a0ffc24290807df6798b60bd8 | refs/heads/master | 2020-12-29T01:31:16.319988 | 2014-11-27T01:38:36 | 2014-11-27T01:38:36 | null | 0 | 0 | null | null | null | null | WINDOWS-1252 | Java | false | false | 1,895 | java | /**
* @author whl
* @date£º2013-7-20 ÏÂÎç3:49:25
*/
package com.shixi.domain;
public class Customer {
private Integer id;
private String name;
private String phone;
private String address;
private String postcode;
private String cmail;
private String company;
public String getPostcode() {
return postcode;
}
public void setPostcode(String postcode) {
this.postcode = postcode;
}
public String getCmail() {
return cmail;
}
public void setCmail(String cmail) {
this.cmail = cmail;
}
public String getCompany() {
return company;
}
public void setCompany(String company) {
this.company = company;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public Customer() {}
public Customer(String name, String phone, String address, String postcode, String cmail, String company) {
this.name = name;
this.phone = phone;
this.address = address;
this.postcode = postcode;
this.cmail = cmail;
this.company = company;
}
public void setName(String name) {
this.name = name;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public Customer(Integer id, String name, String phone, String address,
String postcode, String cmail, String company) {
super();
this.id = id;
this.name = name;
this.phone = phone;
this.address = address;
this.postcode = postcode;
this.cmail = cmail;
this.company = company;
}
@Override
public String toString() {
return "Customer [id=" + id + ", name=" + name + ", phone=" + phone
+ ", address=" + address + ", postcode=" + postcode
+ ", cmail=" + cmail + ", company=" + company + "]";
}
}
| [
"[email protected]"
] | |
09163fae641cf781a92223d2852f1389e2a726ae | 5f6e35b80fceea7f8b105cd69b1dc600463e1897 | /array/src/array/Removingconstvedplcte.java | 7f4165aabbbab011fe2d2d18d50fdcb040bcbad5 | [] | no_license | SurajChandramauli/MyJAVALearningCodes | e75aa35222720131d9f5e9f4ff08b0d8746e1747 | 092c68195ee71a2f5124480de8570d5bb8e47890 | refs/heads/main | 2023-05-13T18:40:30.672347 | 2021-05-26T12:39:43 | 2021-05-26T12:39:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 747 | java | package array;
import java.util.Scanner;
public class Removingconstvedplcte
{
public static int[] takeinput()
{
Scanner s = new Scanner(System.in);
int size=s.nextInt();
int[] arr = new int[size];
for(int i=0;i<size;i++)
{
arr[i]=s.nextInt();
}
s.close();
return arr;
}
/*public static void print(int[] arr)
{
for(int i=0;i<arr.length;i++)
{
System.out.print(arr[i]);
}
}
*/
public static void main(String[] args)
{
// TODO Auto-generated method stub
int[] Arr = takeinput();
for(int i=0;i<Arr.length-1;i++)
{
if(Arr[i]!=Arr[i+1])
{
System.out.print(Arr[i]);
}
}
System.out.print(Arr[Arr.length-1]);
}
}
| [
"[email protected]"
] | |
43fb7d5b7f7d85342d440bfe4c46faede47464e6 | 1078a08def1c6edef7303fe9c1b5e8d91710d48d | /dashboard/dashboard-core/src/main/java/com/dmma/dashboard/core/services/BankOfficeService.java | 2c044e4f488f0b4a3b8c352ea8b61ff9b2699fc7 | [] | no_license | vtitkova/Dashboard | d18258076834b680997bdcb0adc3ecaedafe1ca8 | c7d0af2f01b8d4c9b781977968ecae5e58eff500 | refs/heads/master | 2020-12-02T08:44:32.755105 | 2011-08-23T21:24:45 | 2011-08-23T21:24:45 | 2,247,581 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,326 | java | package com.dmma.dashboard.core.services;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.dmma.base.app.services.base.BaseService;
import com.dmma.dashboard.core.daos.BankOfficeDao;
import com.dmma.dashboard.core.entities.BankOffice;
public class BankOfficeService implements BaseService<BankOffice, Integer>{
private static final Logger log = LoggerFactory.getLogger(BankOfficeService.class);
private BankOfficeDao bankOfficeDao;
public void setBankOfficeDao(BankOfficeDao bankOfficeDao) {
this.bankOfficeDao = bankOfficeDao;
}
@Override
public BankOffice findById(Integer id) {
log.debug("findById");
return bankOfficeDao.findById(id);
}
@Override
public void saveOrUpdate(BankOffice entity) {
log.debug("saveOrUpdate");
bankOfficeDao.saveOrUpdate(entity);
}
@Override
public void delete(BankOffice entity) {
log.debug("delete");
bankOfficeDao.delete(entity);
}
@Override
public List<BankOffice> findAll() {
log.debug("findAll");
return bankOfficeDao.findAll();
}
@Override
public List<Integer> findAllIDs() {
log.debug("findAllIDs");
return bankOfficeDao.findAllIDs();
}
public BankOffice findByExternalId(Long externalId) {
log.debug("findByExternalId "+externalId);
return bankOfficeDao.findByExternalId(externalId);
}
}
| [
"[email protected]"
] | |
a93227ea21e218267d270a64eeda56e83e202603 | 54d15f21c10b003b41e147dd147be7ea2287f08d | /EjemplosHilos/ejemplo_hilos_bodega/src/Programa.java | 21966c8e53aa2606602916199136294f72cef81d | [] | no_license | NicholleVerdugo/ejemplo_hilos_bodega | ef59af14c9ba910d73a105de563d010c54a7be40 | 163f75928dce580bad5561ddb7285c64d932deae | refs/heads/master | 2016-08-12T16:03:45.215742 | 2016-03-14T13:38:51 | 2016-03-14T13:38:51 | 53,327,644 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 485 | 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.
*/
public class Programa {
public static void main(String main[]){
Bodega bode = new Bodega();
Descargador procesoDescarga = new Descargador(bode);
Empacador procesoCarga=new Empacador(bode);
procesoDescarga.start();
procesoCarga.start();
}
}
| [
"[email protected]"
] | |
29d00bcff2e53e6f8a72dd026cdad8ba989bb39b | 16640ec15e2dd0916cfe1a6b4ca70fc852b09a64 | /adp/src/main/java/com/hongguaninfo/hgdf/adp/service/sys/SysUserUgroupJoinService.java | 55c0bff5f2a97f2638c02e80483757825b7dee6e | [] | no_license | hhp676/LaiWuWater | 5d569fc205037f1883a5e65565a7ee57d8830cb8 | a57f1f20b008070ee160156afaf229376bfe551c | refs/heads/master | 2020-04-01T09:27:17.223874 | 2018-10-24T07:45:57 | 2018-10-24T07:45:57 | 153,070,956 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,648 | java | package com.hongguaninfo.hgdf.adp.service.sys;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hongguaninfo.hgdf.adp.core.exception.BizException;
import com.hongguaninfo.hgdf.adp.core.utils.SessionUtils;
import com.hongguaninfo.hgdf.adp.dao.sys.SysUserUgroupJoinDao;
import com.hongguaninfo.hgdf.adp.entity.sys.SysUserUgroupJoin;
/**
* 系统用户用户组关联表:SYS_USER_UGROUP_JOIN biz 层
*
* @author:yuyanlin
*/
@Service("sysUserUgroupJoinService")
public class SysUserUgroupJoinService {
@Autowired
private SysUserUgroupJoinDao sysUserUgroupJoinDao;
// 通过用户id获取列表
public List<SysUserUgroupJoin> getListByUserId(int userId)
throws BizException {
SysUserUgroupJoin queryVo = new SysUserUgroupJoin();
queryVo.setUserId(new BigDecimal(userId));
return sysUserUgroupJoinDao.getList(queryVo);
}
// 通过用户id获取用户组id字符串
public String getGroupIdsByUserId(int userId) throws BizException {
List<String> groupIdList = new ArrayList<String>();
List<SysUserUgroupJoin> list = getListByUserId(userId);
for (SysUserUgroupJoin bo : list) {
groupIdList.add(bo.getGroupId() + "");
}
return StringUtils.join(groupIdList, ",");
}
// 通过用户id获取用户组名称字符串
public String getGroupNamesByUserId(int userId) throws BizException {
List<String> groupNameList = new ArrayList<String>();
List<SysUserUgroupJoin> list = getListByUserId(userId);
for (SysUserUgroupJoin bo : list) {
groupNameList.add(bo.getGroupName());
}
return StringUtils.join(groupNameList, ",");
}
// 新增
public void insertSysUserUgroupJoin(int userId, int groupId)
throws BizException {
SysUserUgroupJoin sysUserUgroupJoin = new SysUserUgroupJoin();
sysUserUgroupJoin.setGroupId(new BigDecimal(groupId));
sysUserUgroupJoin.setUserId(new BigDecimal(userId));
sysUserUgroupJoin.setIsFinal(0);
sysUserUgroupJoin.setCrtUserid(new BigDecimal(SessionUtils.getUserId()));
sysUserUgroupJoin.setCrtTime(new Date());
sysUserUgroupJoinDao.save(sysUserUgroupJoin);
}
// 批量新增
public void insertBatchSysUserUgroupJoin(String groupIds, int userId)
throws BizException {
if (!StringUtils.isEmpty(groupIds)) {
List<SysUserUgroupJoin> list = new ArrayList<SysUserUgroupJoin>();
String[] groupIdAry = groupIds.split(",");
for (String groupId : groupIdAry) {
SysUserUgroupJoin sysUserUgroupJoin = new SysUserUgroupJoin();
sysUserUgroupJoin.setGroupId(new BigDecimal(groupId));
sysUserUgroupJoin.setUserId(new BigDecimal(userId));
sysUserUgroupJoin.setIsFinal(0);
sysUserUgroupJoin.setCrtUserid(new BigDecimal(SessionUtils
.getUserId()));
sysUserUgroupJoin.setCrtTime(new Date());
list.add(sysUserUgroupJoin);
}
sysUserUgroupJoinDao.saveBatch(list);
}
}
// 通过用户id删除
public void deleteByUserId(int userId) throws BizException {
sysUserUgroupJoinDao.delete(userId);
}
/**
* 通过用户组删除
* @param id
*/
public void deleteByGroupId(int groupId) {
sysUserUgroupJoinDao.deleteByGroupId(groupId);
}
} | [
"[email protected]"
] | |
61113f4d51afe604d3d06e2e65b49e74aa0dc10c | 4c4ad34d0a1d2d941b8502c7c2eae608bb64d703 | /Laba3/Lab3_a/Product.java | 2ddeff1ddc3c42e4a47967e2ad89f69c46e7c7b8 | [] | no_license | ZhukDI/java_repository | f51272ec1f4f3ce8022d80d1176e727dc5559956 | f671ef9d832d2c11cc0e7890ab7fb93974770daf | refs/heads/master | 2020-04-05T08:53:23.325299 | 2017-08-05T21:49:47 | 2017-08-05T21:49:47 | 81,748,185 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,443 | java | package product;
/**
* Created by Админ on 28.02.2017.
*
*
*/
public class Product {
private int id;
private String name;
private String UPC;
private String maker;
private double price;
private int shelfLife;
private int count;
Product(int id, String name, String UPC, String maker, double price, int shelfLife, int count) {
this.id = id;
this.name = name;
this.UPC = UPC;
this.maker = maker;
this.price = price;
this.shelfLife = shelfLife;
this.count = count;
}
public int getId() {
return id;
}
public String getName() {
return name;
}
public int getShelfLife() {
return shelfLife;
}
public double getPrice() {
return price;
}
public String getUPC() {
return UPC;
}
public String getMaker() {
return maker;
}
public int getCount() {
return count;
}
public void Show(){
System.out.println("Id: "+ id);
System.out.println("Наименование: " + name);
System.out.println("UPC: " + UPC);
System.out.println("Производитель: " + maker);
System.out.println("Цена: " + price + " рублей");
System.out.println("Срок хранения: " + shelfLife + " месяцев");
System.out.println("Количество " + count);
}
}
| [
"[email protected]"
] | |
a52538190278f7fde06448f2c78ba34278ae72b4 | d74ae31c66c8493260e4dbf8b3cc87581337174c | /src/main/java/hello/repo/Customer146Repository.java | 6cf4a31d0e18e62dcec316a48a294ffbd6e13422 | [] | no_license | scratches/spring-data-gazillions | 72e36c78a327f263f0de46fcee991473aa9fb92c | 858183c99841c869d688cdbc4f2aa0f431953925 | refs/heads/main | 2021-06-07T13:20:08.279099 | 2018-08-16T12:13:37 | 2018-08-16T12:13:37 | 144,152,360 | 0 | 0 | null | 2021-04-26T17:19:34 | 2018-08-09T12:53:18 | Java | UTF-8 | Java | false | false | 279 | java | package hello.repo;
import hello.model.Customer146;
import java.util.List;
import org.springframework.data.repository.CrudRepository;
public interface Customer146Repository extends CrudRepository<Customer146, Long> {
List<Customer146> findByLastName(String lastName);
}
| [
"[email protected]"
] | |
3a672820261432c24b8760cf300ffccf4b5748f6 | 342f92c326ab23ae70512356bb5568722aa81a7c | /ClavaWeaver/test/pt/up/fe/specs/cxxweaver/tests/CxxBenchTest.java | ba47a4fd2d46d0891ff2a6e9a32306fc321eb56b | [
"Apache-2.0"
] | permissive | fabiodrg/clava | 56082f69cf43ec3054c8b181cde3d0cda32562d5 | c85df83eaf4fd2037e0b628d933ae2de4a372a35 | refs/heads/master | 2023-06-30T04:46:03.315347 | 2021-08-11T18:46:12 | 2021-08-11T18:46:12 | 369,831,920 | 0 | 0 | Apache-2.0 | 2021-05-22T14:43:23 | 2021-05-22T14:43:22 | null | UTF-8 | Java | false | false | 1,885 | java | /**
* Copyright 2016 SPeCS.
*
* 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. under the License.
*/
package pt.up.fe.specs.cxxweaver.tests;
import org.junit.After;
import org.junit.BeforeClass;
import org.junit.Test;
import pt.up.fe.specs.clava.language.Standard;
import pt.up.fe.specs.cxxweaver.ClavaWeaverTester;
import pt.up.fe.specs.util.SpecsSystem;
public class CxxBenchTest {
@BeforeClass
public static void setupOnce() {
SpecsSystem.programStandardInit();
ClavaWeaverTester.clean();
}
@After
public void tearDown() {
ClavaWeaverTester.clean();
}
private static ClavaWeaverTester newTester() {
return new ClavaWeaverTester("clava/test/bench/", Standard.CXX11)
.setResultPackage("cpp/results")
.setSrcPackage("cpp/src");
}
@Test
public void testLoicEx1() {
newTester().test("LoicEx1.lara", "loic_ex1.cpp");
}
@Test
public void testLoicEx2() {
newTester().setCheckWovenCodeSyntax(false).test("LoicEx2.lara", "loic_ex2.cpp");
}
@Test
public void testLoicEx3() {
// newTester().setCheckWovenCodeSyntax(false).test("LoicEx3.lara", "loic_ex3.cpp");
newTester().test("LoicEx3.lara", "loic_ex3.cpp");
}
@Test
public void testLSIssue2() {
newTester().test("LSIssue2.lara", "ls_issue2.cpp");
}
}
| [
"[email protected]"
] | |
45fa6a1f9eb597246a58bf99a1d16cdfc1294055 | 6e87c7ddfb90037dfa4254546991221058dfa8b1 | /conexao_fornecedor.java | 4c7709b59cdd8b9a6f45cb62321c62906e0a6343 | [] | no_license | neyranms/controle_de_estoque_java_javascript | be310117c11543aef2331cbb369318451b82da78 | de5232f5ed61635fd3653ebb974d8623e24d01cd | refs/heads/main | 2023-01-23T15:57:08.883023 | 2020-11-24T18:27:40 | 2020-11-24T18:27:40 | 315,718,664 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,249 | java | package conexao_fornecedor;
import java.sql.*;
public class Conexao_fornecedor {
public Connection con;
public Statement stm;
public ResultSet res = null;
private int for_codigo = 0
private String for_nome = 0;
private String for_endereco = 0;
private String for_numero = 0;
private String for_bairro = 0;
private String for_cidade = 0;
private char for_uf = 0;
private String for_cnpjcpf = 0;
private String for_rgie = 0;
private String for_telefone = 0;
private String for_fax = 0;
private String for_celular = 0;
public Conexao_fornecedor() {
try {
Class.forName("org.gjt.mm.mysql.Driver");
con = DriverManager.getConnection("jdbc:mysql://localhost:3306/sistema_estoque2020","root","vertrigo");
stm = con.createStatement();
} catch (Exception e) {
System.out.println("não foi possível conectar ao banco" + e.getMessage());
}
public void setFor_codigo(int for_codigo){
this.for_codigo = for_codigo;
}
public void setFor_codigo(String for_nome){
this.for_nome = for_nome;
}
public void setFor_endereco(String for_endereco){
this.for_endereco = for_endereco;
}
public void setFor_numero(String for_numero){
this.for_numero = for_numero;
}
public void setFor_bairro(String for_bairro){
this.for_bairro = for_bairro;
}
public void setFor_cidade(String for_cidade){
this.for_cidade = for_cidade;
}
public void setFor_uf(char for_uf){
this.for_uf = for_uf;
}
public void setFor_cnpjcpf(String for_cnpjcpf){
this.for_cnpjcpf = for_cnpjcpf;
}
public void setFor_rgie(String for_rgie){
this.for_rgie = for_rgie;
}
public void setFor_telefone(String for_telefone){
this.for_telefone = for_telefone;
}
public void setFor_fax(String for_fax){
this.for_fax = for_fax;
}
public void setFor_celular(String for_celular){
this.for_celular = for_celular;
}
public void setFor_email(String for_email){
this.for_email = for_email;
}
public int getFor_codigo(){
return for_codigo;
}
public float getFor_nome(){
return for_nome;
}
public String getFor_endereco(){
return for_endereco;
}
public String getFor_numero(){
return for_numero;
}
public String getFor_bairro(){
return for_bairro;
}
public String getFor_cidade(){
return for_cidade;
}
public String getFor_uf(){
return for_uf;
}
public String getFor_cnpjcpf(){
return for_cnpjcpf;
}
public String getFor_rgie(){
return for_rgie;
}
public String getFor_telefone(){
return for_telefone;
}
public String getFor_fax(){
return for_fax;
}
public String getFor_celular(){
return for_celular;
}
public String getFor_email(){
return for_email;
}
public void inserirDados(){
try {
String query = "insert into fornecedor(for_codigo,for_nome,for_endereco,for_numero,for_bairro,for_codigo,for_uf,for_cnpjcpf,for_rgie,for_telefone,for_fax,for_celular,for_email) "
+ "values("+for_codigo+","+for_nome+","+for_endereco+","+for_numero+","+for_bairro+","+for_codigo+","+for_uf+","+for_cnpjcpf+","+for_rgie+","+for_telefone+","+for_fax+","+for_celular+","+for_email+")";
stm.executeUpdate(query);
}catch (SQLException e){System.out.println("Erro na inserção:" + e.getMessage());}
}
public boolean alterarDados(){
boolean testa = false;
try {
String query = "update fornecedor "+
"for_codigo = "+ for_codigo+" " +
"for_nome = "+ for_nome+" " +
"for_endereco = "+ for_endereco+ " " +
"for_numero = "+ for_numero + " " +
"for_bairro = "+ for_bairro + " " +
"for_codigo = "+ for_codigo + " " +
"for_uf = "+ for_uf +" " +
"for_cnpjcpf = "+ for_cnpjcpf+" " +
"for_rgie = "+ for_rgie+ " " +
"for_telefone = "+ for_telefone + " " +
"for_fax = "+ for_fax + " " +
"for_celular = "+ for_celular + " " +
"for_email = "+ for_email + " " +
"where for_codigo = "+ for_codigo + " ";
int linhas = stm.executeUpdate(query);
if (linhas >0 )
testa = true;
else
testa = false;
}catch (SQLException e){System.out.println("Erro na inserção:" + e.getMessage());}
return testa;
}
public boolean excluirDados(){
boolean testa = false;
try {
String query = "delete from fornecedor where for_codigo='" +for_codigo+"'";
int linhas = stm.executeUpdate(query);
if (linhas > 0)
testa = true;
else
testa = false;
}catch (SQLException e){System.out.println("Erro na exclusão:" + e.getMessage());}
return testa;
}
public boolean consultarDados(){
boolean testa = false;
try {
String query = "select * from fornecedor where for_codigo='" + for_codigo+"'";
res = stm.executeQuery(query);
if (res.next()){testa = true;}
else{testa = false;}
}catch (SQLException e){System.out.println("Erro na inserção:" + e.getMessage());}
return testa;
}
public void setConsulta() {
try {
res = stm.executeQuery("select * from fornecedor");
}
catch (SQLException e){
e.printStackTrace();
}
}
public ResultSet getResultado() {
return res;
}
} | [
"[email protected]"
] | |
6240985708828ae1bc85195b76ee9027a6baa26c | 0363f2e3baffe71dd218680974caf7cbe6b62804 | /app/src/main/java/com/example/soilagricultureiot/GasActivity.java | f479c0bd3032d76fe0197bd3da85d8c4fee06195 | [] | no_license | manhoosbilli1/SOIL-AGRICULTURE-APP | 922dced945d4ac4bb32ecbe5d76a51b2cb871f55 | eff24c5e57f14bb9a08139934d73e92918863f14 | refs/heads/master | 2022-11-20T22:43:17.027194 | 2020-07-28T21:03:25 | 2020-07-28T21:03:25 | 277,396,668 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,732 | java | package com.example.soilagricultureiot;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.graphics.Color;
import android.media.tv.TvView;
import android.os.Bundle;
import android.os.DeadObjectException;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import com.github.mikephil.charting.charts.LineChart;
import com.github.mikephil.charting.components.YAxis;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.data.LineData;
import com.github.mikephil.charting.data.LineDataSet;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.GenericTypeIndicator;
import com.google.firebase.database.ValueEventListener;
import java.lang.reflect.Array;
import java.security.Guard;
import java.sql.Time;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import de.nitri.gauge.Gauge;
import lecho.lib.hellocharts.model.Axis;
import lecho.lib.hellocharts.model.Line;
import lecho.lib.hellocharts.view.LineChartView;
import java.util.Calendar;
public class GasActivity extends AppCompatActivity {
private static final String TAG = "values";
ArrayList<Object> objectArrayList;
private static final int limit = 84600;
public static boolean remakeList = false;
private ValueEventListener mListener;
FirebaseDatabase mRoot;
DatabaseReference mRootRef;
LineDataSet lineDataSet = new LineDataSet(null,null);
LineData lineData;
LineChart chart;
Gauge gauge;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_gas);
Date currenTime =Calendar.getInstance().getTime();
Log.v(TAG, currenTime.toString());
Button btnBack = findViewById(R.id.btnBack);
chart = (LineChart) findViewById(R.id.chart);
gauge = (Gauge) findViewById(R.id.gauge);
mRoot = FirebaseDatabase.getInstance();
mRootRef = mRoot.getReference();
//chart settings
chart.setNoDataText("No data to show, Failed to load from database.");
chart.setBackgroundColor(Color.WHITE);
chart.setDrawBorders(true);
chart.setBorderColor(Color.BLACK);
//below event listener is for updating the gauges only
mListener = new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
Map<String, Float> dataMap = (Map)snapshot.getValue();
assert dataMap != null;
Number gasN = (Number) dataMap.get("gas");
assert gasN != null;
float gas = gasN.floatValue();
String gasS = gasN.toString();
gauge.moveToValue(gas);
gauge.setLowerText(gasS);
}
@Override
public void onCancelled(@NonNull DatabaseError error) {
Toast.makeText(GasActivity.this,"Failed to load data from database",
Toast.LENGTH_SHORT).show();
}
};
mRootRef.child("firebaseIOT").addValueEventListener(mListener);
//adding another event listener for updating the graphs node: /soil-agriculture-iot/History/sensor;
//this is reading the history and transferring it to an array
mRootRef.child("History/gas").orderByKey().addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
List<Entry> entries = new ArrayList<>();
float counter=0f;
float counterData = 0f;
for(DataSnapshot mySnapShot : snapshot.getChildren()){
Float yValue = mySnapShot.getValue(Float.class);
counter += 1.0f;
entries.add(new Entry(counter, yValue));
counterData = counter++;
}
if(snapshot.getChildrenCount() >= limit){
mRootRef.child(("History/gas")).removeValue(); //cleans the data when its reached its limit
}
lineDataSet.setValues(entries);
lineDataSet.setLabel("Gas Values ");
lineDataSet.setColor(Color.WHITE);
lineData = new LineData(lineDataSet);
chart.clear();
chart.setData((lineData));
chart.invalidate();
}
@Override
public void onCancelled(@NonNull DatabaseError error) {
Toast.makeText(GasActivity.this,"Failed to load data from database",
Toast.LENGTH_SHORT).show();
}
});
//show the retrieved array on a graph
btnBack.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(GasActivity.this, AdvancedActivity.class);
startActivity(i);
Toast.makeText(GasActivity.this, "Going back to menu", Toast.LENGTH_SHORT).show();
}
});
}
@Override
protected void onDestroy() {
super.onDestroy();
mRootRef.child("firebaseIOT").removeEventListener(mListener);
}
} | [
"[email protected]"
] | |
620abadcbae120f1c246c6e639d71dbf9344da01 | 2d752386a1c0f064b30d9044c20a2116fa60581d | /comment/api/src/main/java/com/singerdream/comment/api/CommentInterface.java | 0d31a4cd7e695c4652e58c62da50409b1c160a05 | [] | no_license | Peng-Da/dubbo-usage | 25391f3b96de04d5d17a76a57bfcd4d1d9bff1fa | 5a09bc9d900b39090d899a1245fee24983bf5348 | refs/heads/main | 2023-04-12T23:31:56.535267 | 2021-04-28T13:28:57 | 2021-04-28T13:28:57 | 362,468,228 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 394 | java | package com.singerdream.comment.api;
import com.singerdream.comment.api.modle.CommentModel;
import java.util.List;
public interface CommentInterface {
CommentModel add(CommentModel comment);
void delete(long commentId);
void update(CommentModel commentModel);
List<CommentModel> queryActiveByTargetId(long targetId);
List<CommentModel> queryActiveByPid(long pid);
}
| [
"[email protected]"
] | |
c0bec6f7a0200159ee4abeb5dd56f8a993fdcdb6 | f800e918fcd19d75ebaeb9c1db24dae62c35a907 | /app/src/main/java/com/bw/zweidu/activity/LoginActivity.java | 8a9e8b636325e687988b0d77961b3cbf5c77f30a | [] | no_license | zwais/zweidu | 5587df38c29f2d7229c3a15e7a18b4e78e1b3726 | 74000f274be66d30bd70eadcdff5149e54b06745 | refs/heads/master | 2020-04-27T12:46:24.831654 | 2019-03-07T12:55:29 | 2019-03-07T12:55:29 | 174,343,869 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,090 | java | package com.bw.zweidu.activity;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Parcelable;
import android.text.method.HideReturnsTransformationMethod;
import android.text.method.PasswordTransformationMethod;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.bw.zweidu.MainActivity;
import com.bw.zweidu.R;
import com.bw.zweidu.base.BaseActivity;
import com.bw.zweidu.bean.LoginBean;
import com.bw.zweidu.presenter.IpresenterImpl;
import com.bw.zweidu.util.Apis;
import com.bw.zweidu.util.RegularUtil;
import com.bw.zweidu.view.IView;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
public class LoginActivity extends BaseActivity implements IView {
private EditText edit_phone;
private EditText edit_pass;
private CheckBox box_remember;
private TextView text_reg;
private Button button_reg;
private SharedPreferences mSharedPreferences;
private IpresenterImpl mIpresenterImpl;
private SharedPreferences.Editor edit;
private ImageView image_eye;
@Override
protected int getLayoutResId() {
return R.layout.activity_login;
}
@SuppressLint("CommitPrefEdits")
@Override
protected void initView(Bundle savedInstanceState) {
//获取资源ID
edit_phone = findViewById(R.id.login_edit_phone);
edit_pass = findViewById(R.id.login_edit_pass);
box_remember = findViewById(R.id.login_box_remember);
text_reg = findViewById(R.id.login_text_reg);
button_reg= findViewById(R.id.login_button_login);
image_eye = findViewById(R.id.login_image_pass_eye);
mSharedPreferences=getSharedPreferences("User",MODE_PRIVATE);
edit = mSharedPreferences.edit();
//互绑
initPresenter();
}
@Override
protected void initData() {
//记住密码
getEdit();
//登录
clickMain();
//跳转到注册界面
touchRegister();
//触摸显示密码
touchEye();
}
@SuppressLint("ClickableViewAccessibility")
private void touchEye() {
image_eye.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
//判断事件的动作,按下,抬起
if (event.getAction()==MotionEvent.ACTION_DOWN){
//从密码不可见模式变为密码可见模式
edit_pass.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
}else if (event.getAction()==MotionEvent.ACTION_UP) {
//从密码可见模式变为密码不可见模式
edit_pass.setTransformationMethod(PasswordTransformationMethod.getInstance());
}
return true;
}
});
}
private void getEdit() {
//获取记住密码的状态值
boolean box_ischeck = mSharedPreferences.getBoolean("box_ischeck", false);
if (box_ischeck){
String phone = mSharedPreferences.getString("phone", null);
String pass = mSharedPreferences.getString("pass", null);
edit_phone.setText(phone);
edit_pass.setText(pass);
box_remember.setChecked(true);
}
}
@SuppressLint("ClickableViewAccessibility")
private void touchRegister() {
text_reg.setOnTouchListener(new View.OnTouchListener() {
private float x;
private float y;
@Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction()==MotionEvent.ACTION_DOWN){
text_reg.setTextColor(Color.parseColor("#ff6699"));
x = event.getX();
y = event.getY();
}else if(event.getAction()==MotionEvent.ACTION_UP) {
text_reg.setTextColor(Color.parseColor("#ffffff"));
if (event.getX() == x || event.getY() == y) {
Intent intent = new Intent(LoginActivity.this, RegisterActivity.class);
startActivity(intent);
finish();
}
}
return true;
}
});
}
private void clickMain() {
button_reg.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//获取手机号和密码
String mphone = edit_phone.getText().toString();
String mpass = edit_pass.getText().toString();
//进行判断
if (RegularUtil.isNull(mphone)){
Toast.makeText(LoginActivity.this, "手机号不能为空", Toast.LENGTH_SHORT).show();
return ;
}
if (RegularUtil.isNull(mphone)){
Toast.makeText(LoginActivity.this, "密码不能为空", Toast.LENGTH_SHORT).show();
return ;
}
if (!(RegularUtil.isPhone(mphone))){
Toast.makeText(LoginActivity.this, "手机格式错误", Toast.LENGTH_SHORT).show();
return ;
}
if (RegularUtil.isPass(mpass)){
Toast.makeText(LoginActivity.this, "密码不能少于6位", Toast.LENGTH_SHORT).show();
return;
}
//判断复选框是否选中
if (box_remember.isChecked()){
//记住密码的状态
edit.putString("phone",mphone);
edit.putString("pass",mpass);
edit.putBoolean("box_ischeck",true);
edit.commit();
}else{
//清除所有的状态
edit.clear();
edit.commit();
}
//发送网络请求
getUrl(mphone,mpass);
}
});
}
private void getUrl(String mphone, String mpass) {
Map<String,String> params = new HashMap<>();
params.put("phone",mphone);
params.put("pwd",mpass);
mIpresenterImpl.postRequestIpresenter(Apis.LOGIN_URL,params,LoginBean.class);
}
private void initPresenter() {
mIpresenterImpl=new IpresenterImpl(this);
}
@Override
protected void onDestroy() {
super.onDestroy();
//解绑
mIpresenterImpl.deatch();
}
@Override
public void success(Object object) {
if (object instanceof LoginBean){
LoginBean loginBean= (LoginBean) object;
if(loginBean.getStatus().equals("0000")) {
LoginBean.ResultBean result = loginBean.getResult();
Log.i("TAG_ID",result.getUserId()+" "+result.getSessionId());
edit.putString("sessionId", result.getSessionId());
edit.putString("userId", result.getUserId()+"");
edit.commit();
//跳转到主界面进行商品展示
Intent intent = new Intent(LoginActivity.this, MainActivity.class);
intent.putExtra("result", (Serializable) result);
startActivity(intent);
Toast.makeText(this, "登录成功", Toast.LENGTH_SHORT).show();
finish();
}else{
Toast.makeText(this, loginBean.getMessage(), Toast.LENGTH_SHORT).show();
}
}
}
@Override
public void failure(String error) {
Toast.makeText(this, error, Toast.LENGTH_SHORT).show();
}
}
| [
"[email protected]"
] | |
5bd375fd4382f0ae284815048144ba6a448f3dee | 76cebfcf868ea75889d7a127f82f6a94985efa00 | /hmf-common/src/main/java/com/hartwig/hmftools/common/purple/region/FittedRegionFactory.java | 13523eca0b68d46ee6b324536268927c0d732f1a | [
"MIT"
] | permissive | j-hudecek/hmftools | 2a45f2a13c2bd8c0364d2bd073c32c0d374d22a3 | f619e02cdb166594e7dd4d7d1dd7fe8592267f2d | refs/heads/master | 2020-03-31T08:20:54.511532 | 2018-10-08T09:39:29 | 2018-10-08T09:39:29 | 152,054,013 | 0 | 0 | MIT | 2018-10-08T09:34:13 | 2018-10-08T09:34:12 | null | UTF-8 | Java | false | false | 489 | java | package com.hartwig.hmftools.common.purple.region;
import java.util.Collection;
import java.util.List;
import org.jetbrains.annotations.NotNull;
public interface FittedRegionFactory {
@NotNull
List<FittedRegion> fitRegion(final double purity, final double normFactor,
@NotNull final Collection<ObservedRegion> observedRegions);
@NotNull
FittedRegion fitRegion(final double purity, final double normFactor, final @NotNull ObservedRegion observedRegion);
}
| [
"[email protected]"
] | |
f51be376a57bfdf964763be928ee6ff78e245901 | a9a71a16ac9ed1d1515e77b4ff823e9d98bc9ec0 | /src/br/edu/ifcvideira/DAOs/UsuarioDao.java | 4d5d78e3969c4f9841c7b3062c8b3126ffed8158 | [] | no_license | WelliRigo/gerenciador-de-cantina | 7a31eb0f5e8f43d98824a634e782cd31f34c4ab8 | 21bb75524753a2aa6454e7cea318c5676040fb9b | refs/heads/master | 2022-11-19T16:09:45.350063 | 2020-07-17T18:19:48 | 2020-07-17T18:19:48 | 257,076,308 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,370 | java | package br.edu.ifcvideira.DAOs;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JOptionPane;
import br.edu.ifcvideira.beans.Usuario;
import br.edu.ifcvideira.utils.Conexao;
public class UsuarioDao {
public void CadastrarUsuario(Usuario us) throws SQLException, Exception{
try{
String sql = "INSERT INTO usuarios (nome_usuario, cpf_usuario, rg_usuario, telefone_usuario, celular_usuario, login_usuario, senha_usuario, data_cadastro_usuario) VALUES (?,?,?,?,?,?,?,?)";
java.sql.PreparedStatement sqlPrep = Conexao.conectar().prepareStatement(sql);
int contador = 1;
sqlPrep.setString(contador++, us.getNome());
sqlPrep.setString(contador++, us.getCpf());
sqlPrep.setString(contador++, us.getRgUs());
sqlPrep.setString(contador++, us.getTelefone());
sqlPrep.setString(contador++, us.getCelular());
sqlPrep.setString(contador++, us.getLoginUs());
sqlPrep.setString(contador++, us.getSenhaUs());
sqlPrep.setTimestamp(contador++, us.getDataCadastro());
sqlPrep.execute();
} catch(SQLException e) {
JOptionPane.showMessageDialog(null,e.getMessage());
} catch(Exception e) {
JOptionPane.showMessageDialog(null,e.getMessage());
}
}
public void AlterarUsuarioComSenha(Usuario us) throws Exception {
try{
String sql = "UPDATE usuarios SET nome_usuario=?, cpf_usuario=?, rg_usuario=?, telefone_usuario=?, celular_usuario=?, login_usuario=?, senha_usuario=? WHERE id_usuario=?";
PreparedStatement sqlPrep = Conexao.conectar().prepareStatement(sql);
int contador = 1;
sqlPrep.setString(contador++, us.getNome());
sqlPrep.setString(contador++, us.getCpf());
sqlPrep.setString(contador++, us.getRgUs());
sqlPrep.setString(contador++, us.getTelefone());
sqlPrep.setString(contador++, us.getCelular());
sqlPrep.setString(contador++, us.getLoginUs());
sqlPrep.setString(contador++, us.getSenhaUs());
sqlPrep.setInt(contador++, us.getIdUs());
sqlPrep.execute();
}catch(Exception e) {
JOptionPane.showMessageDialog(null, e.getMessage());
}
}
public void AlterarUsuarioSemSenha(Usuario us) throws Exception {
try{
String sql = "UPDATE usuarios SET nome_usuario=?, cpf_usuario=?, rg_usuario=?, telefone_usuario=?, celular_usuario=?, login_usuario=? WHERE id_usuario=?";
PreparedStatement sqlPrep = Conexao.conectar().prepareStatement(sql);
int contador = 1;
sqlPrep.setString(contador++, us.getNome());
sqlPrep.setString(contador++, us.getCpf());
sqlPrep.setString(contador++, us.getRgUs());
sqlPrep.setString(contador++, us.getTelefone());
sqlPrep.setString(contador++, us.getCelular());
sqlPrep.setString(contador++, us.getLoginUs());
sqlPrep.setInt(contador++, us.getIdUs());
sqlPrep.execute();
}catch(Exception e) {
JOptionPane.showMessageDialog(null, e.getMessage());
}
}
public void deletarUsuario(Usuario us) throws Exception{
try{
String sql = "DELETE FROM usuarios WHERE id_usuario=? ";
PreparedStatement sqlPrep = (PreparedStatement) Conexao.conectar().prepareStatement(sql);
sqlPrep.setInt(1, us.getIdUs());
sqlPrep.execute();
} catch (SQLException e){
JOptionPane.showMessageDialog(null, e.getMessage());
}
}
public List<Object> buscarTodos() throws SQLException, Exception{
List<Object> usuario = new ArrayList<Object>();
try {
String sql = "SELECT * FROM usuarios";
java.sql.Statement state = Conexao.conectar().createStatement();
ResultSet rs = state.executeQuery(sql);
while (rs.next())
{
Object[] linha = {rs.getString(1), rs.getString(2), rs.getString(3), rs.getString(4), rs.getString(5), rs.getString(6), rs.getString(7), rs.getString(9)};
usuario.add(linha);
}
state.close();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e.getMessage());
}
return usuario;
}
public int RetornarProximoCodigoUsuario() throws Exception {
try{
String sql ="SELECT MAX(id_usuario)+1 AS id_usuario FROM usuarios ";
PreparedStatement sqlPrep = Conexao.conectar().prepareStatement(sql);
ResultSet rs = sqlPrep.executeQuery();
if (rs.next()){
return rs.getInt("id_usuario");
}else{
return 1;
}
} catch(Exception e) {
JOptionPane.showMessageDialog(null, e.getMessage());
return 1;
}
}
} | [
"[email protected]"
] | |
bcf566c5852e488b2e0ac805460666d16bd9fd6e | a0e17004cd01da298b0213aa8fd2ee3e7433f402 | /src/hospital/management/system/loginForm.java | e7739ee2a0520cde04fc624673f34cb86b5cdb64 | [] | no_license | mlkrSumanta/Hospital-Management-System | 3fdbc94ff19bc933e0c3a755b304f3f2e7b6e21f | 30c51a0b9c1164498abe6fe7e8d19f184f6b095f | refs/heads/master | 2021-06-20T08:26:40.421885 | 2017-06-23T17:09:52 | 2017-06-23T17:09:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,516 | 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 hospital.management.system;
import hospital.management.system.Doctor.DoctorMenu;
import hospital.management.system.Employee.EmployeeMenu;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import javax.swing.JOptionPane;
import java.util.Calendar;
import java.util.GregorianCalendar;
/**
*
* @author Sumanta
*/
public class loginForm extends javax.swing.JFrame {
Connection conn = null;
ResultSet rs = null;
PreparedStatement pst = null;
/**
* Creates new form loginForm
*/
public loginForm() {
initComponents();
Toolkit toolkit = getToolkit();
Dimension size = toolkit.getScreenSize();
setLocation(size.width/2 - getWidth()/2, size.height/2 - getHeight()/2);
conn = Database.java_db();
currentDate();
}
public void currentDate(){
Calendar cal = new GregorianCalendar();
int month = cal.get(Calendar.MONTH);
int year = cal.get(Calendar.YEAR);
int day = cal.get(Calendar.DAY_OF_MONTH);
lbl_date.setText(day + "/" + (month + 1) + "/" + year);
int second = cal.get(Calendar.SECOND);
int minute = cal.get(Calendar.MINUTE);
int hour = cal.get(Calendar.HOUR);
lbl_time.setText(hour + ":" + minute + ":" + second);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel3 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();
txt_Combo = new javax.swing.JComboBox<>();
txt_Username = new javax.swing.JTextField();
txt_Password = new javax.swing.JPasswordField();
jButton2 = new javax.swing.JButton();
jLabel6 = new javax.swing.JLabel();
jMenuBar1 = new javax.swing.JMenuBar();
jMenu1 = new javax.swing.JMenu();
lbl_date = new javax.swing.JMenu();
lbl_time = new javax.swing.JMenu();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setPreferredSize(new java.awt.Dimension(800, 600));
setResizable(false);
jPanel3.setLayout(null);
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel1.setForeground(new java.awt.Color(255, 255, 255));
jLabel1.setText("Please Enter Your Username and Password");
jPanel3.add(jLabel1);
jLabel1.setBounds(20, 350, 260, 15);
jLabel2.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel2.setForeground(new java.awt.Color(255, 255, 255));
jLabel2.setText("Login Id");
jPanel3.add(jLabel2);
jLabel2.setBounds(20, 380, 51, 15);
jLabel3.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel3.setForeground(new java.awt.Color(255, 255, 255));
jLabel3.setText("Password");
jPanel3.add(jLabel3);
jLabel3.setBounds(20, 410, 59, 15);
jLabel4.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel4.setForeground(new java.awt.Color(255, 255, 255));
jLabel4.setText("Select Division");
jPanel3.add(jLabel4);
jLabel4.setBounds(20, 440, 88, 15);
jButton1.setText("Login");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jPanel3.add(jButton1);
jButton1.setBounds(247, 463, 90, 30);
txt_Combo.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Doctor", "Employee" }));
jPanel3.add(txt_Combo);
txt_Combo.setBounds(149, 430, 190, 30);
jPanel3.add(txt_Username);
txt_Username.setBounds(150, 370, 190, 30);
jPanel3.add(txt_Password);
txt_Password.setBounds(150, 400, 190, 30);
jButton2.setText("Back");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jPanel3.add(jButton2);
jButton2.setBounds(630, 500, 103, 43);
jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/hospital/management/system/images/327908-abstract-wallpapers.jpg"))); // NOI18N
jLabel6.setText("jLabel6");
jPanel3.add(jLabel6);
jLabel6.setBounds(0, 0, 900, 600);
jMenu1.setText("File");
jMenuBar1.add(jMenu1);
lbl_date.setText("Date");
jMenuBar1.add(lbl_date);
lbl_time.setText("Time");
jMenuBar1.add(lbl_time);
setJMenuBar(jMenuBar1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, 800, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, 600, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
if (txt_Combo.getSelectedItem().toString().equals("Doctor")) {
loginAttempt("Doctor");
}
else if (txt_Combo.getSelectedItem().toString().equals("Employee")) {
loginAttempt("Employee");
}
}//GEN-LAST:event_jButton1ActionPerformed
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
// TODO add your handling code here:
HomeMenu hm = new HomeMenu();
hm.setVisible(true);
this.dispose();
}//GEN-LAST:event_jButton2ActionPerformed
private void loginAttempt(String tableName) {
String sql = "Select name, loginId, password from " + tableName
+ " Where (loginId = ? and password = ?)";
try{
int count = 0;
pst = conn.prepareStatement(sql);
pst.setString(1, txt_Username.getText());
pst.setString(2, txt_Password.getText());
rs = pst.executeQuery();
while (rs.next()){
String id = rs.getString(2);
String name = rs.getString(1);
userDetails.loginId = id;
userDetails.userName = name;
count++;
}
String access = txt_Combo.getSelectedItem().toString();
if (access == "Doctor"){
if (count == 1){
DoctorMenu aMenu = new DoctorMenu();
aMenu.setVisible(true);
this.dispose();
}
else {
JOptionPane.showMessageDialog(null, "LoginId or Password is incorrect");
}
}
else if (access == "Employee") {
if (count == 1){
EmployeeMenu eMenu = new EmployeeMenu();
eMenu.setVisible(true);
this.dispose();
}
else {
JOptionPane.showMessageDialog(null, "LoginId or Password is incorrect");
}
}
}
catch (Exception e){
JOptionPane.showMessageDialog(null, e);
}
finally {
try {
rs.close();
pst.close();
}
catch (Exception e) {
}
}
}
/**
* @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(loginForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(loginForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(loginForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(loginForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new loginForm().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel6;
private javax.swing.JMenu jMenu1;
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JPanel jPanel3;
private javax.swing.JMenu lbl_date;
private javax.swing.JMenu lbl_time;
private javax.swing.JComboBox<String> txt_Combo;
private javax.swing.JPasswordField txt_Password;
private javax.swing.JTextField txt_Username;
// End of variables declaration//GEN-END:variables
}
| [
"[email protected]"
] | |
a5b2a7e8ccec44440c36f96d3579b60ab6630673 | a0e5b1e4ce5a20dfdba7477072012712d1175d09 | /src/Table/TableView.java | b59d7be242a69f50fdeb80aee42e17c541dcd904 | [] | no_license | TakmingMark/Taisin | 93004244fb84555273c6538a3dd92291929cf086 | 7789294502a41e1463ad87ab02356f7b19881032 | refs/heads/master | 2021-09-02T11:58:38.467436 | 2018-01-02T11:08:57 | 2018-01-02T11:08:57 | 113,396,747 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,110 | java | package Table;
import java.awt.Dimension;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import Component.MultiLineTableCellRenderer;
public class TableView extends JPanel{
JTable table;
MultiLineTableCellRenderer multiLineTableCellRenderer;
private TableView() {
initView();
}
public static TableView getViewObject() {
return new TableView();
}
private void initView() {
table=new JTable();
multiLineTableCellRenderer=new MultiLineTableCellRenderer();
table.setDefaultRenderer(String.class, multiLineTableCellRenderer);
table.setRowHeight(table.getRowHeight() * 3);
this.add(new JScrollPane(table));
autoScrolltableToBottom();
}
public void autoScrolltableToBottom()
{
table.addComponentListener(new ComponentAdapter() {
public void componentResized(ComponentEvent e) {
int lastIndex =table.getRowCount()-1;
table.changeSelection(lastIndex, 0,false,false);
}
});
}
public void setTableModel(TableModel model) {
table.setModel(model);
table.setPreferredScrollableViewportSize(new Dimension(790, 370));
table.getColumnModel().getColumn(0).setPreferredWidth(80);
table.getColumnModel().getColumn(1).setPreferredWidth(80);
table.getColumnModel().getColumn(2).setPreferredWidth(120);
table.getColumnModel().getColumn(3).setPreferredWidth(150);
table.getColumnModel().getColumn(4).setPreferredWidth(300);
table.getColumnModel().getColumn(5).setPreferredWidth(400);
table.getColumnModel().getColumn(6).setPreferredWidth(150);
table.getColumnModel().getColumn(7).setPreferredWidth(80);
table.getColumnModel().getColumn(8).setPreferredWidth(80);
table.getColumnModel().getColumn(9).setPreferredWidth(80);
table.getColumnModel().getColumn(10).setPreferredWidth(80);
table.setFillsViewportHeight(true);
table.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
}
public JTable getTable() {
return table;
}
}
| [
"[email protected]"
] | |
0b044183d276ed2f080270b30b382207217ddd62 | 94fa6e486a630f664057dc39b6934fa54e9f87ab | /hafta3Odev2/src/hafta3Odev2/InstructorManager.java | 6707d8dd3a0efd59f989db855b2dc7021ed4246d | [] | no_license | muzafferovun/react | b7e9dd846006648964356c82d55370aa431e0696 | 5d9636b5880393cfa08ddfba81b4d0d43945c72c | refs/heads/main | 2023-04-18T05:41:03.584848 | 2021-05-04T18:51:27 | 2021-05-04T18:51:27 | 361,265,461 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 63 | java | package hafta3Odev2;
public class InstructorManager {
}
| [
"[email protected]"
] | |
fdcc0e1c8aee07d4d4cfa289a79fa8285828c4f0 | b2fa66ec49f50b4bb92fee6494479238c8b46876 | /src/main/java/fi/riista/feature/permit/application/mammal/amount/MammalPermitApplicationSpeciesAmountFeature.java | 1f26121cba41bc43ccb1fb4625c0e864778facb8 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | suomenriistakeskus/oma-riista-web | f007a9dc663317956ae672ece96581f1704f0e85 | f3550bce98706dfe636232fb2765a44fa33f78ca | refs/heads/master | 2023-04-27T12:07:50.433720 | 2023-04-25T11:31:05 | 2023-04-25T11:31:05 | 77,215,968 | 16 | 4 | MIT | 2023-04-25T11:31:06 | 2016-12-23T09:49:44 | Java | UTF-8 | Java | false | false | 4,873 | java | package fi.riista.feature.permit.application.mammal.amount;
import fi.riista.feature.gamediary.GameSpecies;
import fi.riista.feature.gamediary.GameSpeciesService;
import fi.riista.feature.permit.application.HarvestPermitApplication;
import fi.riista.feature.permit.application.HarvestPermitApplicationAuthorizationService;
import fi.riista.feature.permit.application.HarvestPermitApplicationSpeciesAmount;
import fi.riista.feature.permit.application.HarvestPermitApplicationSpeciesAmountRepository;
import fi.riista.feature.permit.application.HarvestPermitApplicationSpeciesAmountUpdater;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Nonnull;
import javax.annotation.Resource;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
@Component
public class MammalPermitApplicationSpeciesAmountFeature {
@Resource
private GameSpeciesService gameSpeciesService;
@Resource
private HarvestPermitApplicationAuthorizationService harvestPermitApplicationAuthorizationService;
@Resource
private HarvestPermitApplicationSpeciesAmountRepository harvestPermitApplicationSpeciesAmountRepository;
@Transactional(readOnly = true)
public List<MammalPermitApplicationSpeciesAmountDTO> getSpeciesAmounts(final long applicationId) {
final HarvestPermitApplication application =
harvestPermitApplicationAuthorizationService.readApplication(applicationId);
return application.getSpeciesAmounts().stream()
.sorted(Comparator.comparing(HarvestPermitApplicationSpeciesAmount::getId))
.map(MammalPermitApplicationSpeciesAmountDTO::new)
.collect(Collectors.toList());
}
@Transactional
public void saveSpeciesAmounts(final long applicationId,
final List<MammalPermitApplicationSpeciesAmountDTO> dtoList) {
final HarvestPermitApplication application =
harvestPermitApplicationAuthorizationService.updateApplication(applicationId);
final List<HarvestPermitApplicationSpeciesAmount> existingSpecies =
harvestPermitApplicationSpeciesAmountRepository.findByHarvestPermitApplication(application);
validateSpecies(dtoList);
final Updater speciesUpdater = new Updater(existingSpecies, createCallback(application));
speciesUpdater.processAll(dtoList);
harvestPermitApplicationSpeciesAmountRepository.saveAll(speciesUpdater.getResultList());
harvestPermitApplicationSpeciesAmountRepository.deleteAll(speciesUpdater.getMissing());
}
private static void validateSpecies(final List<MammalPermitApplicationSpeciesAmountDTO> dtoList) {
if (dtoList.size() > 1) {
dtoList.stream()
.map(MammalPermitApplicationSpeciesAmountDTO::getGameSpeciesCode)
.filter(code -> GameSpecies.isLargeCarnivore(code) || code == GameSpecies.OFFICIAL_CODE_OTTER)
.findAny()
.ifPresent(code -> {
throw new IllegalArgumentException("Contains species which need to be applied " +
"separately:" + code);
}
);
}
}
@Nonnull
private UpdaterCallback createCallback(final HarvestPermitApplication application) {
return new UpdaterCallback() {
@Override
public HarvestPermitApplicationSpeciesAmount create(final MammalPermitApplicationSpeciesAmountDTO dto) {
final GameSpecies gameSpecies = gameSpeciesService.requireByOfficialCode(dto.getGameSpeciesCode());
return HarvestPermitApplicationSpeciesAmount.createForHarvest(application, gameSpecies, dto.getAmount());
}
@Override
public void update(final HarvestPermitApplicationSpeciesAmount entity,
final MammalPermitApplicationSpeciesAmountDTO dto) {
entity.setSpecimenAmount(dto.getAmount());
}
@Override
public int getSpeciesCode(final MammalPermitApplicationSpeciesAmountDTO dto) {
return dto.getGameSpeciesCode();
}
};
}
private static class Updater
extends HarvestPermitApplicationSpeciesAmountUpdater<MammalPermitApplicationSpeciesAmountDTO> {
Updater(final List<HarvestPermitApplicationSpeciesAmount> existingList,
final UpdaterCallback callback) {
super(existingList, callback);
}
}
private abstract static class UpdaterCallback
implements HarvestPermitApplicationSpeciesAmountUpdater.Callback<MammalPermitApplicationSpeciesAmountDTO> {
}
}
| [
"[email protected]"
] | |
320712447ee8cb1a26442b768b202869ba18aff0 | 57fa27775cb4adb66264e426bf88e7abbd557630 | /CV/ParagraphWithList.java | 7952616d7ace2a655b6039ac94c98f150c0fe3b5 | [] | no_license | koalabzium/Learning-java | 2a54513c03df1f6f37075d58c124c75eefd1e1d2 | 1167c5a13d04d667ede223f196b02b3cf1b67323 | refs/heads/master | 2021-10-08T15:03:33.465113 | 2018-12-13T21:28:51 | 2018-12-13T21:28:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 853 | java | import javax.xml.bind.annotation.XmlElement;
import java.io.PrintStream;
public class ParagraphWithList extends Paragraph{
//String title;
@XmlElement(name = "list")
UnorderedList items = new UnorderedList();
ParagraphWithList(String newtext) {
super(newtext);
}
public ParagraphWithList() {
super("");
}
ParagraphWithList setContent(String newtext)
{
this.text=newtext;
return this;
}
ParagraphWithList addListItem(String itemName)
{
ListItem i = new ListItem(itemName);
this.items.additem(itemName);
return this;
}
ParagraphWithList addListItem(ListItem i)
{
this.items.additem(i);
return this;
}
void writeHTML(PrintStream out)
{
super.writeHTML(out);
items.writeHTML(out);
}
}
| [
"[email protected]"
] | |
4289cdefb40c02e0cb4e0a7a249c5de2431d8450 | 9ebd81eb315eff1b7f7072c25b515205a50b808a | /src/test/java/entity/TrainDriverTest.java | 669a5b2a18584e32a0b079146b35a3dbf12f0bb9 | [] | no_license | yarrou/homework_3 | 39f8cd5e5f7518c011ef7b80f3e2a233ddc83bfb | abdc576b28db832adcec720dddd588095569f51e | refs/heads/main | 2023-04-27T10:51:54.146645 | 2021-04-26T15:14:44 | 2021-04-26T15:14:44 | 357,970,698 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 408 | java | package entity;
import data.UserTestSamples;
import entity.people.TrainDriver;
import entity.people.User;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
class TrainDriverTest {
@Test
void createInvalidDriver() {
User user = UserTestSamples.getValidChildren();
assertThrows(IllegalArgumentException.class, () -> new TrainDriver(user));
}
} | [
"[email protected]"
] | |
fc5622538c19e62fa9d5ee57ef1756c5b849586c | d3ca0ca21ace3acc5d4a0a68f275b4fb4578c059 | /src/main/java/com/qr/blog/service/interfaces/TagService.java | a66c3ccd98423b04542a9f08d3b3f2492c53d92a | [] | no_license | QRGE/qr-box | 63299e794cf4c8519371d1ba20a9721f6c51bae0 | bd5e042017306c7ccd3482b61f2f73beef6f544f | refs/heads/master | 2023-07-05T03:33:52.063942 | 2021-08-22T15:01:24 | 2021-08-22T15:01:24 | 398,827,369 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 629 | java | package com.qr.blog.service.interfaces;
import com.qr.blog.pojo.Tag;
import com.qr.blog.pojo.vo.HotTagVo;
import java.util.List;
/**
* @Author: QR
* @Date: 2021/8/4-13:48
*/
public interface TagService {
/**
* 根据名称搜索分类
* @param name 搜索的分类名称
* @return 搜索结果集
*/
List<Tag> getByName(String name);
/**
* 根据 blogId 查询 tags
* @param blogId blogId
* @return 查询的 tags
*/
List<Tag> getByBlogId(Long blogId);
/**
* 获取热门标签
* @return 热门标签集合
*/
List<HotTagVo> getHotTags();
}
| [
"[email protected]"
] | |
931fe5dd043dcc3e7a996b682580b70ec11a2c26 | e15245c68ba4d24527d03d1d3b74847d5e984b4a | /src/com/company/CheckStringEndValues.java | 2a6349762b453ac6ecad3bcd28ed523ba7d22cda | [] | no_license | NabeelHaris/String-end-with | e76af6d62d3dfd2fdefa90010378cbe59eae6759 | 86d7eb017c9ccf12db45c97a5f307beee506b4da | refs/heads/master | 2020-05-15T04:22:00.673458 | 2019-04-18T13:10:28 | 2019-04-18T13:10:28 | 182,085,216 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 280 | java | package com.company;
public class CheckStringEndValues {
public boolean checkStringEndWithSecondString(String inputString, String endString){
if (inputString.endsWith(endString)){
return true;
}else {
return false;
}
}
}
| [
"[email protected]"
] | |
604afcc7b08d778d5c6053898c6326ed8652f787 | 8c9a308be789c7b925282fb5fccb84735a875c33 | /src/test/java/com/ing/controller/StatementControllerTest.java | 23dba51d4fee424d894a2cb2411494c7c30abf6e | [] | no_license | awsasif8/Mortgage | dd8cef92a9daca8e7866c241eb08bde557c70a0a | 992e7d8d02a35c1a340ab0b46601767d71a7e8a6 | refs/heads/master | 2020-07-17T18:54:32.376671 | 2019-09-03T15:19:34 | 2019-09-03T15:19:34 | 206,076,861 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 964 | java | package com.ing.controller;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import com.ing.dto.StatementResponseDto;
import com.ing.service.StatementService;
@RunWith(MockitoJUnitRunner.class)
public class StatementControllerTest {
@Mock
StatementService statementService;
@InjectMocks
StatementController statementController;
@Test
public void getStatementsTest()
{StatementResponseDto dto=new StatementResponseDto();
dto.setStatusCode(200);
Mockito.when(statementService.getStatements("12345")).thenReturn(dto);
ResponseEntity response=statementController.getStatements("12345");
response.getBody();
assertEquals(dto.getStatusCode(),response.getStatusCodeValue());
}
}
| [
"[email protected]"
] | |
22aa756026c7d39514c12fee60398a780603e99e | 059d28049ab6a850e94e84785827d6863ee4fb95 | /src/main/java/CartManager.java | 68c6ccc11f77e2816c266599b514e8e1327e14c9 | [] | no_license | bord81/Online-shop-on-JSF | 51ada4871c332c248b281491671637bd0d309640 | 41d88515cb80eb45ff81a0d4533d9146740fa099 | refs/heads/master | 2021-01-20T16:50:56.463780 | 2017-05-22T09:58:14 | 2017-05-22T09:58:14 | 90,853,477 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,004 | java |
import com.google.gson.Gson;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.RequestScoped;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.persistence.EntityManager;
import javax.persistence.Query;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.security.SecureRandom;
import java.util.*;
@ManagedBean(name = "cManager")
@RequestScoped
public class CartManager {
@ManagedProperty(value = "#{currentUserStatus}")
private UserStatus userStatus;
private List<UserJsf> userList = new ArrayList<>();
private Map<String, String> mapParams;
private Map<String, Object> cookieMap;
private static final Logger logger = LogManager.getLogger(CartManager.class);
public Map<String, Object> getCookieMap() {
return cookieMap;
}
public void setUserStatus(UserStatus userStatus) {
this.userStatus = userStatus;
}
@PostConstruct
public void loadCart() {
mapParams = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
cookieMap = FacesContext.getCurrentInstance().getExternalContext().getRequestCookieMap();
logger.info("loadCart: init done");
}
public void addItem() {
if (userStatus.getCurrentUser() != null) {
UserJsf currentUser = userStatus.getCurrentUser();
CartList cartList = new Gson().fromJson(currentUser.getBasket(), CartList.class);
cartList.items.add(Integer.valueOf(mapParams.get("add")));
currentUser.setBasket(new Gson().toJson(cartList));
updateUsersDb(currentUser);
logger.info("addItem: current user was updated");
} else {
if (cookieMap.get("c0ntAct") != null) {
EntityManager entityManager = ODBUtil.getEntityManagerFactory().createEntityManager();
Query query = entityManager.createQuery("select u from UserJsf u", UserJsf.class);
userList = (List<UserJsf>) query.getResultList();
entityManager.close();
Cookie cookie = (Cookie) cookieMap.get("c0ntAct");
String userCookie = cookie.getValue();
UserJsf currentUser = new UserJsf();
boolean isPresent = false;
for (UserJsf user : userList) {
if (user.getCookie().equals(userCookie)) {
currentUser = new UserJsf(user.getId(), user.getCookie(), user.getBasket());
isPresent = true;
break;
}
}
if (!isPresent) {
logger.info("addItem: new user was updated");
addNewUser();
} else {
CartList cartList = new Gson().fromJson(currentUser.getBasket(), CartList.class);
cartList.items.add(Integer.valueOf(mapParams.get("add")));
currentUser.setBasket(new Gson().toJson(cartList));
userStatus.setCurrentUser(currentUser);
updateUsersDb(currentUser);
logger.info("addItem: current user was updated first time based on cookie");
}
} else {
addNewUser();
logger.info("addItem: new user was updated");
}
}
}
public void removeItem() {
if (userStatus.getCurrentUser() != null) {
UserJsf currentUser = userStatus.getCurrentUser();
CartList cartList = new Gson().fromJson(currentUser.getBasket(), CartList.class);
cartList.items.remove(Integer.valueOf(mapParams.get("id")));
currentUser.setBasket(new Gson().toJson(cartList));
updateUsersDb(currentUser);
logger.info("removeItem: current user was updated");
} else {
if (cookieMap.get("c0ntAct") != null) {
EntityManager entityManager = ODBUtil.getEntityManagerFactory().createEntityManager();
Query query = entityManager.createQuery("select u from UserJsf u", UserJsf.class);
userList = (List<UserJsf>) query.getResultList();
entityManager.close();
Cookie cookie = (Cookie) cookieMap.get("c0ntAct");
String userCookie = cookie.getValue();
UserJsf currentUser = new UserJsf();
for (UserJsf user : userList) {
if (user.getCookie().equals(userCookie)) {
currentUser = new UserJsf(user.getId(), user.getCookie(), user.getBasket());
break;
}
}
CartList cartList = new Gson().fromJson(currentUser.getBasket(), CartList.class);
cartList.items.remove(Integer.valueOf(mapParams.get("id")));
currentUser.setBasket(new Gson().toJson(cartList));
userStatus.setCurrentUser(currentUser);
updateUsersDb(currentUser);
logger.info("removeItem: current user was updated first time based on cookie");
}
}
ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext();
try {
ec.redirect(((HttpServletRequest) ec.getRequest()).getRequestURI());
} catch (IOException e) {
logger.error("IO Exception" + e);
}
}
public void removeAll() {
if (userStatus.getCurrentUser() != null) {
UserJsf currentUser = userStatus.getCurrentUser();
CartList cartList = new Gson().fromJson(currentUser.getBasket(), CartList.class);
cartList.items.clear();
currentUser.setBasket(new Gson().toJson(cartList));
updateUsersDb(currentUser);
logger.info("removeAll: current user was updated");
} else {
if (cookieMap.get("c0ntAct") != null) {
EntityManager entityManager = ODBUtil.getEntityManagerFactory().createEntityManager();
Query query = entityManager.createQuery("select u from UserJsf u", UserJsf.class);
userList = (List<UserJsf>) query.getResultList();
entityManager.close();
Cookie cookie = (Cookie) cookieMap.get("c0ntAct");
String userCookie = cookie.getValue();
UserJsf currentUser = new UserJsf();
for (UserJsf user : userList) {
if (user.getCookie().equals(userCookie)) {
currentUser = new UserJsf(user.getId(), user.getCookie(), user.getBasket());
break;
}
}
CartList cartList = new Gson().fromJson(currentUser.getBasket(), CartList.class);
cartList.items.clear();
currentUser.setBasket(new Gson().toJson(cartList));
userStatus.setCurrentUser(currentUser);
updateUsersDb(currentUser);
logger.info("removeItem: current user was updated first time based on cookie");
}
}
ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext();
try {
ec.redirect(((HttpServletRequest) ec.getRequest()).getRequestURI());
} catch (IOException e) {
logger.error("IO Exception" + e);
}
}
private void addNewUser() {
UUID uuid = UUID.randomUUID();
String cookie = uuid.toString();
Map<String, Object> properties = new HashMap<>();
properties.put("maxAge", 31536000);
try {
FacesContext.getCurrentInstance().getExternalContext().addResponseCookie("c0ntAct", URLEncoder.encode(cookie, "UTF-8"), properties);
} catch (UnsupportedEncodingException e) {
logger.error("UnsupportedEncodingException" + e);
}
CartList cartList = new CartList();
cartList.items.add(Integer.valueOf(mapParams.get("add")));
String cart = new Gson().toJson(cartList);
SecureRandom secureRandom = new SecureRandom();
int id = secureRandom.nextInt();
UserJsf newUser = new UserJsf(id, cookie, cart);
userStatus.setCurrentUser(newUser);
updateUsersDb(newUser);
}
private void updateUsersDb(UserJsf u) {
jpaCall(u);
}
private void jpaCall(UserJsf u) {
EntityManager entityManager = ODBUtil.getEntityManagerFactory().createEntityManager();
entityManager.getTransaction().begin();
entityManager.merge(u);
entityManager.getTransaction().commit();
entityManager.close();
}
}
| [
"[email protected]"
] | |
d554f9fb5196fe53e609e1c6a3b8a5a48b39e762 | 4afb654c6667f5ed9c25ebcd7071993f7382269d | /src/main/java/com/website/eap/crawler/storage/HBaseHelper.java | d7e92ab07633328bbb296583b065c22f2f9b85b3 | [] | no_license | ddviplinux/eap | c164f39f2e8bab8e75fb3d4d604e19ed35512d23 | 4a5c75772cd862104f8a783a68ef4e5152bef7c6 | refs/heads/master | 2021-01-10T11:55:20.571452 | 2016-02-27T05:35:07 | 2016-02-27T05:35:07 | 52,651,338 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,341 | java | package com.website.eap.crawler.storage;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.*;
import org.apache.hadoop.hbase.client.*;
import org.apache.hadoop.hbase.util.Bytes;
import java.io.Closeable;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
/**
* Used by the book examples to generate tables and fill them with test data.
*/
public class HBaseHelper implements Closeable {
private Configuration configuration = null;
private Connection connection = null;
private Admin admin = null;
protected HBaseHelper(Configuration configuration) throws IOException {
this.configuration = configuration;
this.connection = ConnectionFactory.createConnection(configuration);
this.admin = connection.getAdmin();
}
public static HBaseHelper getHelper(Configuration configuration) throws IOException {
return new HBaseHelper(configuration);
}
@Override
public void close() throws IOException {
connection.close();
}
public Connection getConnection() {
return connection;
}
public Configuration getConfiguration() {
return configuration;
}
public void createNamespace(String namespace) {
try {
NamespaceDescriptor nd = NamespaceDescriptor.create(namespace).build();
admin.createNamespace(nd);
} catch (Exception e) {
System.err.println("Error: " + e.getMessage());
}
}
public void dropNamespace(String namespace, boolean force) {
try {
if (force) {
TableName[] tableNames = admin.listTableNamesByNamespace(namespace);
for (TableName name : tableNames) {
admin.disableTable(name);
admin.deleteTable(name);
}
}
} catch (Exception e) {
// ignore
}
try {
admin.deleteNamespace(namespace);
} catch (IOException e) {
System.err.println("Error: " + e.getMessage());
}
}
public boolean existsTable(String table)
throws IOException {
return existsTable(TableName.valueOf(table));
}
public boolean existsTable(TableName table)
throws IOException {
return admin.tableExists(table);
}
public void createTable(String table, String... colfams)
throws IOException {
createTable(TableName.valueOf(table), 1, null, colfams);
}
public void createTable(TableName table, String... colfams)
throws IOException {
createTable(table, 1, null, colfams);
}
public void createTable(String table, int maxVersions, String... colfams)
throws IOException {
createTable(TableName.valueOf(table), maxVersions, null, colfams);
}
public void createTable(TableName table, int maxVersions, String... colfams)
throws IOException {
createTable(table, maxVersions, null, colfams);
}
public void createTable(String table, byte[][] splitKeys, String... colfams)
throws IOException {
createTable(TableName.valueOf(table), 1, splitKeys, colfams);
}
public void createTable(TableName table, int maxVersions, byte[][] splitKeys,
String... colfams)
throws IOException {
HTableDescriptor desc = new HTableDescriptor(table);
for (String cf : colfams) {
HColumnDescriptor coldef = new HColumnDescriptor(cf);
coldef.setMaxVersions(maxVersions);
desc.addFamily(coldef);
}
if (splitKeys != null) {
admin.createTable(desc, splitKeys);
} else {
admin.createTable(desc);
}
}
public void disableTable(String table) throws IOException {
disableTable(TableName.valueOf(table));
}
public void disableTable(TableName table) throws IOException {
admin.disableTable(table);
}
public void dropTable(String table) throws IOException {
dropTable(TableName.valueOf(table));
}
public void dropTable(TableName table) throws IOException {
if (existsTable(table)) {
if (admin.isTableEnabled(table)) disableTable(table);
admin.deleteTable(table);
}
}
public void fillTable(String table, int startRow, int endRow, int numCols,
String... colfams)
throws IOException {
fillTable(TableName.valueOf(table), startRow,endRow, numCols, colfams);
}
public void fillTable(TableName table, int startRow, int endRow, int numCols,
String... colfams)
throws IOException {
fillTable(table, startRow, endRow, numCols, -1, false, colfams);
}
public void fillTable(String table, int startRow, int endRow, int numCols,
boolean setTimestamp, String... colfams)
throws IOException {
fillTable(TableName.valueOf(table), startRow, endRow, numCols, -1,
setTimestamp, colfams);
}
public void fillTable(TableName table, int startRow, int endRow, int numCols,
boolean setTimestamp, String... colfams)
throws IOException {
fillTable(table, startRow, endRow, numCols, -1, setTimestamp, colfams);
}
public void fillTable(String table, int startRow, int endRow, int numCols,
int pad, boolean setTimestamp, String... colfams)
throws IOException {
fillTable(TableName.valueOf(table), startRow, endRow, numCols, pad,
setTimestamp, false, colfams);
}
public void fillTable(TableName table, int startRow, int endRow, int numCols,
int pad, boolean setTimestamp, String... colfams)
throws IOException {
fillTable(table, startRow, endRow, numCols, pad, setTimestamp, false,
colfams);
}
public void fillTable(String table, int startRow, int endRow, int numCols,
int pad, boolean setTimestamp, boolean random,
String... colfams)
throws IOException {
fillTable(TableName.valueOf(table), startRow, endRow, numCols, pad,
setTimestamp, random, colfams);
}
public void fillTable(TableName table, int startRow, int endRow, int numCols,
int pad, boolean setTimestamp, boolean random,
String... colfams)
throws IOException {
Table tbl = connection.getTable(table);
Random rnd = new Random();
for (int row = startRow; row <= endRow; row++) {
for (int col = 1; col <= numCols; col++) {
Put put = new Put(Bytes.toBytes("row-" + padNum(row, pad)));
for (String cf : colfams) {
String colName = "col-" + padNum(col, pad);
String val = "val-" + (random ?
Integer.toString(rnd.nextInt(numCols)) :
padNum(row, pad) + "." + padNum(col, pad));
if (setTimestamp) {
put.addColumn(Bytes.toBytes(cf), Bytes.toBytes(colName), col,
Bytes.toBytes(val));
} else {
put.addColumn(Bytes.toBytes(cf), Bytes.toBytes(colName),
Bytes.toBytes(val));
}
}
tbl.put(put);
}
}
tbl.close();
}
public void fillTableRandom(String table,
int minRow, int maxRow, int padRow,
int minCol, int maxCol, int padCol,
int minVal, int maxVal, int padVal,
boolean setTimestamp, String... colfams)
throws IOException {
fillTableRandom(TableName.valueOf(table), minRow, maxRow, padRow, minCol,
maxCol, padCol, minVal, maxVal, padVal, setTimestamp, colfams);
}
public void fillTableRandom(TableName table,
int minRow, int maxRow, int padRow,
int minCol, int maxCol, int padCol,
int minVal, int maxVal, int padVal,
boolean setTimestamp, String... colfams)
throws IOException {
Table tbl = connection.getTable(table);
Random rnd = new Random();
int maxRows = minRow + rnd.nextInt(maxRow - minRow);
for (int row = 0; row < maxRows; row++) {
int maxCols = minCol + rnd.nextInt(maxCol - minCol);
for (int col = 0; col < maxCols; col++) {
int rowNum = rnd.nextInt(maxRow - minRow + 1);
Put put = new Put(Bytes.toBytes("row-" + padNum(rowNum, padRow)));
for (String cf : colfams) {
int colNum = rnd.nextInt(maxCol - minCol + 1);
String colName = "col-" + padNum(colNum, padCol);
int valNum = rnd.nextInt(maxVal - minVal + 1);
String val = "val-" + padNum(valNum, padCol);
if (setTimestamp) {
put.addColumn(Bytes.toBytes(cf), Bytes.toBytes(colName), col,
Bytes.toBytes(val));
} else {
put.addColumn(Bytes.toBytes(cf), Bytes.toBytes(colName),
Bytes.toBytes(val));
}
}
tbl.put(put);
}
}
tbl.close();
}
public String padNum(int num, int pad) {
String res = Integer.toString(num);
if (pad > 0) {
while (res.length() < pad) {
res = "0" + res;
}
}
return res;
}
public void put(String table, String row, String fam, String qual,
String val) throws IOException {
put(TableName.valueOf(table), row, fam, qual, val);
}
public void put(TableName table, String row, String fam, String qual,
String val) throws IOException {
Table tbl = connection.getTable(table);
Put put = new Put(Bytes.toBytes(row));
put.addColumn(Bytes.toBytes(fam), Bytes.toBytes(qual), Bytes.toBytes(val));
tbl.put(put);
tbl.close();
}
public void put(String table, String row, String fam, String qual, long ts,
String val) throws IOException {
put(TableName.valueOf(table), row, fam, qual, ts, val);
}
public void put(TableName table, String row, String fam, String qual, long ts,
String val) throws IOException {
Table tbl = connection.getTable(table);
Put put = new Put(Bytes.toBytes(row));
put.addColumn(Bytes.toBytes(fam), Bytes.toBytes(qual), ts,
Bytes.toBytes(val));
tbl.put(put);
tbl.close();
}
public void put(String table, String[] rows, String[] fams, String[] quals,
long[] ts, String[] vals) throws IOException {
put(TableName.valueOf(table), rows, fams, quals, ts, vals);
}
public void put(TableName table, String[] rows, String[] fams, String[] quals,
long[] ts, String[] vals) throws IOException {
Table tbl = connection.getTable(table);
for (String row : rows) {
Put put = new Put(Bytes.toBytes(row));
for (String fam : fams) {
int v = 0;
for (String qual : quals) {
String val = vals[v < vals.length ? v : vals.length - 1];
long t = ts[v < ts.length ? v : ts.length - 1];
System.out.println("Adding: " + row + " " + fam + " " + qual +
" " + t + " " + val);
put.addColumn(Bytes.toBytes(fam), Bytes.toBytes(qual), t,
Bytes.toBytes(val));
v++;
}
}
tbl.put(put);
}
tbl.close();
}
public void dump(String table, String[] rows, String[] fams, String[] quals)
throws IOException {
dump(TableName.valueOf(table), rows, fams, quals);
}
public void dump(TableName table, String[] rows, String[] fams, String[] quals)
throws IOException {
Table tbl = connection.getTable(table);
List<Get> gets = new ArrayList<Get>();
for (String row : rows) {
Get get = new Get(Bytes.toBytes(row));
get.setMaxVersions();
if (fams != null) {
for (String fam : fams) {
for (String qual : quals) {
get.addColumn(Bytes.toBytes(fam), Bytes.toBytes(qual));
}
}
}
gets.add(get);
}
Result[] results = tbl.get(gets);
for (Result result : results) {
for (Cell cell : result.rawCells()) {
System.out.println("Cell: " + cell +
", Value: " + Bytes.toString(cell.getValueArray(),
cell.getValueOffset(), cell.getValueLength()));
}
}
tbl.close();
}
public void dump(String table) throws IOException {
dump(TableName.valueOf(table));
}
public void dump(TableName table) throws IOException {
try (
Table t = connection.getTable(table);
ResultScanner scanner = t.getScanner(new Scan())
) {
for (Result result : scanner) {
dumpResult(result);
}
}
}
public void dumpResult(Result result) {
for (Cell cell : result.rawCells()) {
System.out.println("Cell: " + cell +
", Value: " + Bytes.toString(cell.getValueArray(),
cell.getValueOffset(), cell.getValueLength()));
}
}
}
| [
"[email protected]"
] | |
2d8bc36e8ad6a7d76b013cea78d763bee9474a5a | 349728f8777d48b4414dc47eed3057e22e3bcf0b | /sym/main/src/main/java/com/selectyour/gwtclient/component/master/stage/SelectHandler.java | 9f58881ea6792a40634469b37c744b0f80217868 | [] | no_license | gadgetfan/examples | 91584294f3144b0204b9f6d930a0f8b1fe84e009 | 7c2a5d6a8749d2e7c12fb63b3e661f5503a75c82 | refs/heads/master | 2016-09-05T09:13:07.185380 | 2014-11-09T11:24:38 | 2014-11-09T11:24:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 209 | java | package com.selectyour.gwtclient.component.master.stage;
/**
* event, that occurs, after client chooses some variant on this stage
*/
public interface SelectHandler {
void onSelect(Long[] selectIds);
}
| [
"[email protected]"
] | |
99f468bfdfe80f949e12c53b08b5a2550f9947cd | 7b451e69f5e3e5a3bc1247f71a6b4866950ce7f6 | /app/src/main/java/com/example/management/net/okhttp/callback/StringCallback.java | e458355d923495c888029a15879db4324f22b32d | [] | no_license | wangminjianjy/Management | b8602c1913c9729d80ec1186beafef7e72fcd463 | 77b65a1c949dea84924d0d57c831ef5396fcceb1 | refs/heads/master | 2023-06-15T06:53:53.703433 | 2021-07-12T09:41:36 | 2021-07-12T09:41:36 | 383,725,919 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 488 | java | package com.example.management.net.okhttp.callback;
import java.io.IOException;
import okhttp3.Call;
import okhttp3.Request;
import okhttp3.Response;
/**
* Created by dzl on 2017/3/29.
*/
public interface StringCallback extends BaseCallBack {
void onStart(Request request);
void onResponse(Call call, Response response, String text);
void onResponseError(Call call, Response response, IOException e);
void onFailure(Call call, Request request, IOException e);
}
| [
"wangminjianjy"
] | wangminjianjy |
eeed57f1d2d5610d72e33b21f49ce01f69cee94c | 488b7d4454c2034ec79490dd71abdf7277f015ab | /sample/src/main/java/com/danikula/videocache/sample/MultipleVideosActivity.java | 46d7f5b42609a73f157948dcd94dccbb703eac6c | [
"Apache-2.0"
] | permissive | metalurgus/AndroidVideoCache | ee292e5161660ad7c1738be5ff7353f6ce66f2c7 | 945fa4d08034136145fef0e088a6cacec36a83fe | refs/heads/master | 2021-01-21T07:54:12.738247 | 2016-07-22T08:03:56 | 2016-07-22T08:03:56 | 63,934,433 | 4 | 0 | null | 2016-07-22T07:47:52 | 2016-07-22T07:47:51 | null | UTF-8 | Java | false | false | 937 | java | package com.danikula.videocache.sample;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import org.androidannotations.annotations.EActivity;
@EActivity(R.layout.activity_multiple_videos)
public class MultipleVideosActivity extends FragmentActivity {
@Override
protected void onCreate(Bundle state) {
super.onCreate(state);
if (state == null) {
addVideoFragment(Video.ORANGE_1, R.id.videoContainer0);
addVideoFragment(Video.ORANGE_2, R.id.videoContainer1);
addVideoFragment(Video.ORANGE_3, R.id.videoContainer2);
addVideoFragment(Video.ORANGE_4, R.id.videoContainer3);
}
}
private void addVideoFragment(Video video, int containerViewId) {
getSupportFragmentManager()
.beginTransaction()
.add(containerViewId, VideoFragment.build(this, video))
.commit();
}
}
| [
"[email protected]"
] | |
30ede45e3a31c56abd557ab2cf79629dd0b5087c | e5cffb6d7da3e21be1e0e7d6172a3394ab62f98c | /joker-generator/src/main/java/com/eccard/joker/Joker.java | 2572d4cb20dfd9583945bf9f7434f80059d6e085 | [] | no_license | eccard/gradle-final-project | 703e353936642c84fc8dae95c4afbaefda4dd2e5 | a9095b3bc84fdc51e09d3cb347fb9047c761b131 | refs/heads/master | 2020-04-15T11:15:55.285883 | 2019-01-12T19:35:17 | 2019-01-12T19:49:38 | 164,622,748 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 149 | java | package com.eccard.joker;
public class Joker {
public String getJoker(){
return "What gets wetter the more it dries? A towel.";
}
}
| [
"[email protected]"
] | |
44b261466da1a346cc83301228d900abddc43935 | 739b94e7c686fd1db46b0cd1de72ae67aadbb729 | /BinaryTree/Node.java | 5ecdcf92ba3b14a18dad0cb9635998dd554929a6 | [] | no_license | ardianhilmip35/E41202334_ARDIAN-HILMI-PRAMULINTANG | 3839bb60ddaa6e300d71b60ab5ebc84606ae8b2a | 3098f7e32c89e80f544fcd43bbc9ee2544a81083 | refs/heads/main | 2023-04-01T22:12:54.019833 | 2021-04-16T16:22:20 | 2021-04-16T16:22:20 | 348,030,953 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 539 | 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 BinaryTree;
/**
*
* @author USER
*/
public class Node {
public int id;
public String data;
public Node leftChild;
public Node rightChild;
public void displayNode() {
// TODO code application logic here
System.out.print("(" + id + ", " + data + " ) ");
}
}
| [
"[email protected]"
] | |
41bca3fdae613c658708c1b6baebb00092580fe7 | 44308a812aadf60910509d94de39e8a511d6e91e | /app/src/main/java/android/renderscript/ScriptIntrinsicResize.java | 83185e48c72c419bf30de04f89a1350586af5544 | [] | no_license | longyinzaitian/Android27Source | 31e01e83bc891e3602484b91b7eab325a22747ce | 9b982c844adbfd54f92facb7e4caf46ee40e2692 | refs/heads/master | 2020-03-08T15:54:54.433791 | 2018-04-10T09:44:25 | 2018-04-10T09:44:25 | 128,224,765 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,654 | 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 android.renderscript;
/**
* Intrinsic for performing a resize of a 2D allocation.
*/
public final class ScriptIntrinsicResize extends ScriptIntrinsic {
private Allocation mInput;
private ScriptIntrinsicResize(long id, RenderScript rs) {
super(id, rs);
}
/**
* Supported elements types are {@link Element#U8}, {@link
* Element#U8_2}, {@link Element#U8_3}, {@link Element#U8_4}
* {@link Element#F32}, {@link Element#F32_2}, {@link
* Element#F32_3}, {@link Element#F32_4}
*
* @param rs The RenderScript context
*
* @return ScriptIntrinsicResize
*/
public static ScriptIntrinsicResize create(RenderScript rs) {
long id = rs.nScriptIntrinsicCreate(12, 0);
ScriptIntrinsicResize si = new ScriptIntrinsicResize(id, rs);
return si;
}
/**
* Set the input of the resize.
* Must match the element type supplied during create.
*
* @param ain The input allocation.
*/
public void setInput(Allocation ain) {
Element e = ain.getElement();
if (!e.isCompatible(Element.U8(mRS)) &&
!e.isCompatible(Element.U8_2(mRS)) &&
!e.isCompatible(Element.U8_3(mRS)) &&
!e.isCompatible(Element.U8_4(mRS)) &&
!e.isCompatible(Element.F32(mRS)) &&
!e.isCompatible(Element.F32_2(mRS)) &&
!e.isCompatible(Element.F32_3(mRS)) &&
!e.isCompatible(Element.F32_4(mRS))) {
throw new RSIllegalArgumentException("Unsupported element type.");
}
mInput = ain;
setVar(0, ain);
}
/**
* Get a FieldID for the input field of this intrinsic.
*
* @return Script.FieldID The FieldID object.
*/
public FieldID getFieldID_Input() {
return createFieldID(0, null);
}
/**
* Resize copy the input allocation to the output specified. The
* Allocation is rescaled if necessary using bi-cubic
* interpolation.
*
* @param aout Output allocation. Element type must match
* current input. Must not be same as input.
*/
public void forEach_bicubic(Allocation aout) {
if (aout == mInput) {
throw new RSIllegalArgumentException("Output cannot be same as Input.");
}
forEach_bicubic(aout, null);
}
/**
* Resize copy the input allocation to the output specified. The
* Allocation is rescaled if necessary using bi-cubic
* interpolation.
*
* @param aout Output allocation. Element type must match
* current input.
* @param opt LaunchOptions for clipping
*/
public void forEach_bicubic(Allocation aout, LaunchOptions opt) {
forEach(0, (Allocation) null, aout, null, opt);
}
/**
* Get a KernelID for this intrinsic kernel.
*
* @return Script.KernelID The KernelID object.
*/
public KernelID getKernelID_bicubic() {
return createKernelID(0, 2, null, null);
}
}
| [
"[email protected]"
] | |
87db2d05b912c2ede9eea1c4e26d99e64987fbd4 | 421f0a75a6b62c5af62f89595be61f406328113b | /generated_tests/no_seeding/88_jopenchart-de.progra.charting.render.InterpolationChartRenderer-1.0-2/de/progra/charting/render/InterpolationChartRenderer_ESTest_scaffolding.java | 7529ab8f9c5927303a51d9603066a5542527b268 | [] | no_license | tigerqiu712/evosuite-model-seeding-empirical-evaluation | c78c4b775e5c074aaa5e6ca56bc394ec03c2c7c6 | 11a920b8213d9855082d3946233731c843baf7bc | refs/heads/master | 2020-12-23T21:04:12.152289 | 2019-10-30T08:02:29 | 2019-10-30T08:02:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 558 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Mon Oct 28 15:05:31 GMT 2019
*/
package de.progra.charting.render;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
import org.evosuite.runtime.sandbox.Sandbox;
import org.evosuite.runtime.sandbox.Sandbox.SandboxMode;
@EvoSuiteClassExclude
public class InterpolationChartRenderer_ESTest_scaffolding {
// Empty scaffolding for empty test suite
}
| [
"[email protected]"
] | |
ff2b506f141d46da04daf9e05481c2e1b2a8ccc0 | fcc71599a3b7a8c55d7888fee1a8f9f48b0d8aac | /src/modelos/Persona.java | 53661bf1c55ea41bcd8d19472cd70b2e8fcc320f | [] | no_license | GuilleVe09/Taller-Refactoring | a387dc805a6546a7eaba05bbb53bebf7ecaaacc8 | 048e49d040d36f6f2595c290fd020befb667907d | refs/heads/main | 2023-05-28T23:15:23.226137 | 2021-01-08T06:03:06 | 2021-01-08T06:03:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,187 | java | package modelos;
import java.util.List;
public class Persona {
protected String nombre;
protected String apellido;
protected int edad;
protected Direccion direccion;
protected Telefono telefono;
protected List<Paralelo> paralelos;
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public String getApellido() {
return apellido;
}
public void setApellido(String apellido) {
this.apellido = apellido;
}
public int getEdad() {
return edad;
}
public void setEdad(int edad) {
this.edad = edad;
}
public Direccion getDireccion() {
return direccion;
}
public void setDireccion(Direccion direccion) {
this.direccion = direccion;
}
public Telefono getTelefono() {
return telefono;
}
public void setTelefono(Telefono telefono) {
this.telefono = telefono;
}
public List<Paralelo> getParalelos() {
return paralelos;
}
public void setParalelos(List<Paralelo> paralelos) {
this.paralelos = paralelos;
}
}
| [
"[email protected]"
] | |
3c22e29edf8adf11742cea6f3fb9768f0ce2d8f4 | a2e06e57dcdfacd52b74547ebf68e985e0036fe0 | /platform/com.subgraph.vega.ui.tags/src/com/subgraph/vega/ui/tags/taggableeditor/TaggableEditorDialog.java | 72fdeb2a1625762f92cee6a7ed7f71e686f5fbff | [] | no_license | subgraph/Vega | 2804f5b3ccccdab4ab4edda551f3c643a24c4b2e | c732de3d3fe5be83a27ee1838d9aeb8132b1f9e2 | refs/heads/develop | 2023-08-07T09:17:31.887919 | 2016-06-29T21:12:23 | 2016-06-29T21:12:23 | 941,687 | 321 | 109 | null | 2021-02-23T18:00:14 | 2010-09-27T04:17:48 | Java | UTF-8 | Java | false | false | 15,775 | java | /*******************************************************************************
* Copyright (c) 2011 Subgraph.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Subgraph - initial API and implementation
******************************************************************************/
package com.subgraph.vega.ui.tags.taggableeditor;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.TitleAreaDialog;
import org.eclipse.jface.preference.ColorSelector;
import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.FontMetrics;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import com.subgraph.vega.api.events.IEvent;
import com.subgraph.vega.api.events.IEventHandler;
import com.subgraph.vega.api.model.IWorkspace;
import com.subgraph.vega.api.model.WorkspaceCloseEvent;
import com.subgraph.vega.api.model.WorkspaceOpenEvent;
import com.subgraph.vega.api.model.WorkspaceResetEvent;
import com.subgraph.vega.api.model.tags.ITag;
import com.subgraph.vega.api.model.tags.ITagModel;
import com.subgraph.vega.api.model.tags.ITaggable;
import com.subgraph.vega.internal.ui.tags.taggableeditor.TagModifier;
import com.subgraph.vega.internal.ui.tags.taggableeditor.TagTableCheckStateManager;
import com.subgraph.vega.internal.ui.tags.taggableeditor.TagTableContentProvider;
import com.subgraph.vega.internal.ui.tags.taggableeditor.TagTableLabelProvider;
import com.subgraph.vega.internal.ui.tags.taggableeditor.TagTableSearchFilter;
import com.subgraph.vega.ui.tags.Activator;
import com.subgraph.vega.ui.tags.tageditor.TagEditorDialog;
import com.subgraph.vega.ui.tagsl.taggablepopup.ITagModifierValidator;
public class TaggableEditorDialog extends TitleAreaDialog implements ITagModifierValidator {
protected static final String IStructuredSelection = null;
private final ITaggable taggable;
private ITagModel tagModel;
private IEventHandler workspaceListener;
private ArrayList<TagModifier> tagList = new ArrayList<TagModifier>();
private TagModifier tagSelected;
private Composite parentComposite;
private Text tagFilterText;
private CheckboxTableViewer tagTableViewer;
private TagTableCheckStateManager checkStateManager;
private TagTableSearchFilter tagTableSearchFilter;
private Button createButton;
private Button editButton;
private Text tagNameText;
private Text tagDescText;
private ColorSelector nameColorSelector;
private ColorSelector rowColorSelector;
static public TaggableEditorDialog createDialog(Shell parentShell, ITaggable taggable) {
final TaggableEditorDialog dialog = new TaggableEditorDialog(parentShell, taggable);
dialog.initialize();
dialog.create();
dialog.getShell().addListener(SWT.Traverse, new Listener() {
public void handleEvent(Event e) {
if (e.detail == SWT.TRAVERSE_ESCAPE) {
e.doit = false;
}
}
});
return dialog;
}
private TaggableEditorDialog(Shell parentShell, ITaggable taggable) {
super(parentShell);
this.taggable = taggable;
workspaceListener = new IEventHandler() {
@Override
public void handleEvent(IEvent event) {
if (event instanceof WorkspaceOpenEvent) {
handleWorkspaceOpen((WorkspaceOpenEvent) event);
} else if (event instanceof WorkspaceCloseEvent) {
handleWorkspaceClose((WorkspaceCloseEvent) event);
} else if (event instanceof WorkspaceResetEvent) {
handleWorkspaceReset((WorkspaceResetEvent) event);
}
}
};
checkStateManager = new TagTableCheckStateManager();
tagTableSearchFilter = new TagTableSearchFilter();
}
private void initialize() {
IWorkspace currentWorkspace = Activator.getDefault().getModel().addWorkspaceListener(workspaceListener);
tagModel = currentWorkspace.getTagModel();
}
private void handleWorkspaceOpen(WorkspaceOpenEvent event) {
tagModel = event.getWorkspace().getTagModel();
}
private void handleWorkspaceClose(WorkspaceCloseEvent event) {
// REVISIT this is really bad. pop up a warning and exit?
tagModel = null;
}
private void handleWorkspaceReset(WorkspaceResetEvent event) {
tagModel = event.getWorkspace().getTagModel();
}
@Override
public void create() {
super.create();
setTitle("Select Tags");
setMessage("Tags can be used to signify a result as noteworthy and to simplify searching for it. Select " +
"which tags apply to this result.");
}
@Override
protected Control createDialogArea(Composite parent) {
final Composite dialogArea = (Composite) super.createDialogArea(parent);
parentComposite = new Composite(dialogArea, SWT.NULL);
parentComposite.setLayout(new GridLayout(1, false));
parentComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
createTagsArea(parentComposite).setLayoutData(new GridData(GridData.FILL_BOTH));
createTagInfoArea(parentComposite).setLayoutData(new GridData(GridData.FILL_BOTH));
for (ITag tag: tagModel.getAllTags()) {
TagModifier tagModifier = new TagModifier(tag);
tagList.add(tagModifier);
for (ITag tagged: taggable.getAllTags()) {
if (tagModifier.getTagOrig() == tagged) {
checkStateManager.addChecked(tagModifier);
break;
}
}
}
tagTableViewer.setInput(tagList);
setTagSelected(null);
return dialogArea;
}
@Override
protected void okPressed() {
for (TagModifier tagModifier: tagList) {
if (tagModifier.isModified()) {
tagModifier.store(tagModel);
}
}
List<TagModifier> checked = checkStateManager.getCheckedList();
ArrayList<ITag> checkedList = new ArrayList<ITag>(checked.size());
for (Object tagModifier: checked) {
checkedList.add(((TagModifier) tagModifier).getTagOrig());
}
taggable.setTags(checkedList);
super.okPressed();
}
@Override
protected void cancelPressed() {
int tagModifiedCnt = 0;
for (TagModifier tagModifier: tagList) {
if (tagModifier.isModified()) {
tagModifiedCnt++;
}
}
if (tagModifiedCnt != 0) {
if (confirmLoseTagModifications(tagModifiedCnt) == false) {
return;
}
}
super.cancelPressed();
}
@Override
public boolean close() {
if (workspaceListener != null) {
Activator.getDefault().getModel().removeWorkspaceListener(workspaceListener);
workspaceListener = null;
}
return super.close();
}
private GridLayout createGaplessGridLayout(int numColumns, boolean makeColumnsEqualWidth) {
final GridLayout layout = new GridLayout(numColumns, makeColumnsEqualWidth);
layout.marginWidth = 0;
layout.marginHeight = 0;
layout.marginLeft = 0;
layout.marginTop = 0;
layout.marginRight = 0;
layout.marginBottom = 0;
return layout;
}
private Control createTagsArea(Composite parent) {
final Group rootControl = new Group(parent, SWT.NONE);
rootControl.setLayout(new GridLayout(1, false));
rootControl.setText("Available Tags");
tagFilterText = new Text(rootControl, SWT.SEARCH);
tagFilterText.setLayoutData(new GridData(GridData.FILL_BOTH));
tagFilterText.setMessage("type filter text");
tagFilterText.addModifyListener(createTagFilterModifyListener());
GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
final Control tagTableControl = createTagTable(rootControl, gd, 7);
tagTableControl.setLayoutData(gd);
createTagAreaButtonsControl(rootControl).setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, false, false, 1, 1));
return rootControl;
}
private ModifyListener createTagFilterModifyListener() {
return new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
final String matchFilter = tagFilterText.getText();
if (!matchFilter.isEmpty()) {
tagTableSearchFilter.setMatchFilter(matchFilter);
} else {
tagTableSearchFilter.setMatchFilter(null);
}
tagTableViewer.refresh();
}
};
}
private Control createTagTable(Composite parent, GridData gd, int heightInRows) {
tagTableViewer = CheckboxTableViewer.newCheckList(parent, SWT.BORDER);
tagTableViewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
tagTableViewer.setLabelProvider(new TagTableLabelProvider());
tagTableViewer.setContentProvider(new TagTableContentProvider());
tagTableViewer.addSelectionChangedListener(createSelectionChangedListener());
tagTableViewer.setCheckStateProvider(checkStateManager);
tagTableViewer.addCheckStateListener(checkStateManager);
tagTableViewer.addFilter(tagTableSearchFilter);
gd.heightHint = tagTableViewer.getTable().getItemHeight() * heightInRows;
return tagTableViewer.getTable();
}
private ISelectionChangedListener createSelectionChangedListener() {
return new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
boolean isEmpty = event.getSelection().isEmpty();
editButton.setEnabled(!isEmpty);
if (isEmpty == false) {
final TagModifier tagModifier = (TagModifier)((IStructuredSelection) event.getSelection()).getFirstElement();
setTagSelected(tagModifier);
}
}
};
}
private Composite createTagAreaButtonsControl(Composite parent) {
final Composite rootControl = new Composite(parent, SWT.NONE);
rootControl.setLayout(new GridLayout(2, false));
createButton = new Button(rootControl, SWT.PUSH);
createButton.setText("Create");
createButton.addSelectionListener(createSelectionListenerCreateButton());
editButton = new Button(rootControl, SWT.PUSH);
editButton.setText("Edit");
editButton.addSelectionListener(createSelectionListenerEditButton());
editButton.setEnabled(false);
return rootControl;
}
private SelectionListener createSelectionListenerCreateButton() {
return new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
TagModifier tag = new TagModifier(tagModel.createTag());
TagEditorDialog dialog = TagEditorDialog.createDialog(getShell(), tag, TaggableEditorDialog.this);
if (dialog.open() == IDialogConstants.OK_ID) {
tagList.add(tag);
tagTableViewer.refresh();
tagTableViewer.setSelection(new StructuredSelection(tag));
setTagSelected(tag);
}
}
};
}
private SelectionListener createSelectionListenerEditButton() {
return new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
final TagModifier tag = (TagModifier)((IStructuredSelection) tagTableViewer.getSelection()).getFirstElement();
if (tag != null) {
TagEditorDialog dialog = TagEditorDialog.createDialog(getShell(), tag, TaggableEditorDialog.this);
if (dialog.open() == IDialogConstants.OK_ID) {
tagTableViewer.refresh();
setTagSelected(tag);
}
}
}
};
}
private Group createTagInfoArea(Composite parent) {
final Group rootControl = new Group(parent, SWT.NONE);
rootControl.setLayout(new GridLayout(1, false));
rootControl.setText("Tag Information");
createTagInfoNameControl(rootControl).setLayoutData(new GridData(GridData.FILL_BOTH));
createTagInfoDescControl(rootControl).setLayoutData(new GridData(GridData.FILL_BOTH));
createTagInfoColorControl(rootControl).setLayoutData(new GridData(GridData.FILL_BOTH));
return rootControl;
}
private Composite createTagInfoNameControl(Composite parent) {
final Composite rootControl = new Composite(parent, SWT.NONE);
rootControl.setLayout(createGaplessGridLayout(2, false));
final Label label = new Label(rootControl, SWT.NONE);
label.setText("Name:");
label.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
tagNameText = new Text(rootControl, SWT.BORDER | SWT.SINGLE);
tagNameText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
tagNameText.setEnabled(false);
return rootControl;
}
private Composite createTagInfoDescControl(Composite parent) {
final Composite rootControl = new Composite(parent, SWT.NONE);
rootControl.setLayout(createGaplessGridLayout(1, false));
final Label label = new Label(rootControl, SWT.NONE);
label.setText("Description:");
tagDescText = new Text(rootControl, SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.V_SCROLL);
final FontMetrics tagDescTextFm = new GC(tagDescText).getFontMetrics();
GridData tagDescTextGd = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1);
tagDescTextGd.heightHint = tagDescTextFm.getHeight() * 5;
tagDescText.setLayoutData(tagDescTextGd);
tagDescText.setEditable(false);
return rootControl;
}
private Composite createTagInfoColorControl(Composite parent) {
final Composite rootControl = new Composite(parent, SWT.NONE);
rootControl.setLayout(createGaplessGridLayout(2, false));
Label label = new Label(rootControl, SWT.NONE);
label.setText("Name color:");
nameColorSelector = new ColorSelector(rootControl);
nameColorSelector.setColorValue(new RGB(0, 0, 0));
nameColorSelector.setEnabled(false);
label = new Label(rootControl, SWT.NONE);
label.setText("Row background color:");
rowColorSelector = new ColorSelector(rootControl);
rowColorSelector.setColorValue(new RGB(255, 255, 255));
rowColorSelector.setEnabled(false);
return rootControl;
}
private RGB tagColorToRgb(int color) {
return new RGB((color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff);
}
private void setTagSelected(TagModifier tag) {
this.tagSelected = tag;
if (tag != null) {
tagNameText.setText(tag.getName());
if (tag.getDescription() != null) {
tagDescText.setText(tag.getDescription());
} else {
tagDescText.setText("");
}
nameColorSelector.setColorValue(tagColorToRgb(tag.getNameColor()));
rowColorSelector.setColorValue(tagColorToRgb(tag.getRowColor()));
} else {
tagNameText.setText("");
tagDescText.setText("");
nameColorSelector.setColorValue(new RGB(0, 0, 0));
rowColorSelector.setColorValue(new RGB(255, 255, 255));
}
}
private boolean confirmLoseTagModifications(int cnt) {
MessageBox messageDialog = new MessageBox(getShell(), SWT.ICON_WARNING | SWT.OK | SWT.CANCEL);
messageDialog.setText("Warning");
messageDialog.setMessage(cnt + " tags were modified. Proceed without saving?");
if (messageDialog.open() == SWT.CANCEL) {
return false;
} else {
return true;
}
}
@Override
public String validate(TagModifier modifier) {
final String name = modifier.getName();
if (name.isEmpty()) {
return "Tag name cannot be empty";
}
for (TagModifier tagModifier: tagList) {
if (tagModifier != modifier && tagModifier.getName().equalsIgnoreCase(name)) {
return "A tag of that name already exists";
}
}
return null;
}
}
| [
"[email protected]"
] | |
632ce42911b488350c80812e75839d27adf87b1d | a04e7fa78a8087987c09816968793b97d4f788da | /hw16-0036493852-2/src/main/java/hr/fer/zemris/java/hw16/jvdraw/colors/JColorArea.java | 500a44fecbd92f226d5bdee031090467f041388b | [] | no_license | frankocar/OPJJ-FER | cb348888ac2aef33e7e136f342c543f5cdbd6374 | 5ee357a0bd543f94715d07b33aa4e72bab30f419 | refs/heads/master | 2021-05-07T07:21:42.962121 | 2017-11-01T10:53:12 | 2017-11-01T10:53:12 | 109,117,554 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,669 | java | package hr.fer.zemris.java.hw16.jvdraw.colors;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.LinkedList;
import java.util.List;
import javax.swing.JColorChooser;
import javax.swing.JComponent;
/**
* A component that shows a {@link JColorChooser} on a click and shows a currently
* selected color as its representation. Also is an implementation of {@link IColorProvider}
* interface.
*
* @author Franko Car
*
*/
public class JColorArea extends JComponent implements IColorProvider {
/** */
private static final long serialVersionUID = 1L;
/**
* Currently selected colors
*/
private Color selectedColor;
/**
* List of listeners
*/
private List<ColorChangeListener> listeners;
/**
* A constructor
*
* @param selectedColor initial color
*/
public JColorArea(Color selectedColor) {
this.selectedColor = selectedColor;
setBackground(selectedColor);
setOpaque(true);
setPreferredSize(new Dimension(15, 15));
setMaximumSize(new Dimension(15, 15));
setMinimumSize(new Dimension(15, 15));
setBackground(selectedColor);
addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
Color userColor = JColorChooser.showDialog(JColorArea.this.getParent(), "Choose a color", selectedColor);
if (userColor != null) {
setColor(userColor);
}
}
});
repaint();
}
/**
* Set a new color
*
* @param newColor new color
*/
public void setColor(Color newColor) {
if (newColor == null) {
throw new IllegalArgumentException("Color can't be null");
}
Color oldColor = selectedColor;
this.selectedColor = newColor;
setBackground(selectedColor);
repaint();
if (listeners != null && !listeners.isEmpty()) {
List<ColorChangeListener> iterable = new LinkedList<>(listeners);
for (ColorChangeListener listener : iterable) {
listener.newColorSelected(this, oldColor, selectedColor);
}
}
}
@Override
public Dimension getPreferredSize() {
return new Dimension(15, 15);
}
@Override
public Color getCurrentColor() {
return selectedColor;
}
@Override
public void addColorChangeListener(ColorChangeListener l) {
if (listeners == null) {
listeners = new LinkedList<>();
}
listeners.add(l);
}
@Override
public void removeColorChangeListener(ColorChangeListener l) {
if (listeners == null) {
return;
}
listeners.remove(l);
}
@Override
protected void paintComponent(Graphics g) {
g.setColor(selectedColor);
g.fillRect(0, 0, getWidth(), getHeight());
}
}
| [
"[email protected]"
] | |
cbbfbb78800b9c0654264b2881e71da9102ae80c | 1ea83c6b176ad0b5c8d6f43bb9e942a90b0729bb | /app/src/main/java/com/howell/action/PlatformAction.java | 116834f6e839dc10226be8c0ff3a47cce3377d7a | [] | no_license | Bjelijah/EcamH265AS | bd2e61567f274b58d01d3ce2a3dbe715e006f4b7 | 85fff49782554d611ff575c062afd3f1f7600156 | refs/heads/master | 2021-01-12T14:45:57.533948 | 2017-08-21T06:29:56 | 2017-08-21T06:29:56 | 72,078,807 | 6 | 3 | null | null | null | null | UTF-8 | Java | false | false | 4,623 | java | package com.howell.action;
import android.os.AsyncTask;
import android.os.Handler;
import android.util.Log;
import com.howell.entityclass.Device;
import com.howell.entityclass.NodeDetails;
import com.howell.protocol.GetNATServerReq;
import com.howell.protocol.GetNATServerRes;
import com.howell.protocol.LoginRequest;
import com.howell.protocol.LoginResponse;
import com.howell.protocol.SoapManager;
import com.howell.utils.DecodeUtils;
import com.howell.utils.IConst;
import java.util.List;
public class PlatformAction implements IConst{
private static PlatformAction mInstance = null;
private PlatformAction() { }
public static PlatformAction getInstance(){
if(mInstance == null){
mInstance = new PlatformAction();
}
return mInstance;
}
SoapManager mSoapManager = SoapManager.getInstance();
private String turnServerIp = null;
private int turnServerPort = -1;
private String device_id = null;
private String deviceID = null;
private String account = null;
private String password= null;
private boolean isTest = false;//是用100868账号登入试用e看
private NodeDetails curSelNode= null;
List<Device> deviceList = null;
public boolean isTest(){
return isTest;
}
public void setIsTest(boolean isTest){
this.isTest = isTest;
}
public void setCurSelNode(NodeDetails node){
this.curSelNode = node;
}
public NodeDetails getCurSelNode(){
return curSelNode;
}
public void setDeviceID(String deviceID){
Log.e("123","~~~~~~~~ PlatformAction set dev id="+deviceID);
this.deviceID = deviceID;
}
public String getDeviceID(){
return this.deviceID;
}
public List<Device> getDeviceList() {
return deviceList;
}
public void setDeviceList(List<Device> deviceList) {
this.deviceList = deviceList;
}
public String getDevice_id() {
return device_id;
}
public String getDevice_id(int index){
if(deviceList==null)return null;
if(index>deviceList.size())return null;
return deviceList.get(index).getDeviceID();
}
public void setDevice_id(String device_id) {
this.device_id = device_id;
}
public void setDevice_id(int index){
if(deviceList==null)return;
if(index>deviceList.size())return;
this.device_id = deviceList.get(index).getDeviceID();
}
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getDeviceId(){
// return device_id;
return this.deviceID;
}
public String getCurSelDeviceId(){
return getDeviceId();
}
public void setCurSelDeviceId(String deviceId){
setDevice_id(deviceId);
}
public void setTurnServerIP(String turnServerIp){
// Log.i("123","~~~~~~turnServerIP="+turnServerIp);
this.turnServerIp = turnServerIp;
}
public String getTurnServerIP(){
return this.turnServerIp;
}
public void setTurnServerPort(int turnServerPort){
// Log.i("123","~~~~~turnServerPort="+turnServerPort);
this.turnServerPort = turnServerPort;
}
public int getTurnServerPort(){
return turnServerPort;
}
Handler handler;
public void setHandler(Handler handler){
this.handler = handler;
}
/**
* @Deprecated H265 Turn SSL never used
*
*
*/
@Deprecated
public void loginPlatform(){
new AsyncTask<Void, Void, Boolean>() {
@Override
protected Boolean doInBackground(Void... params) {
String encodedPassword = DecodeUtils.getEncodedPassword(TEST_PASSWORD);
// String imei = PhoneConfig.getPhoneDeveceID(PlatformAction.this);
LoginRequest loginReq = new LoginRequest(TEST_ACCOUNT, "Common",encodedPassword, "1.0.0.1",null);
LoginResponse loginRes = mSoapManager.getUserLoginRes(loginReq);
if(loginRes.getResult().equals("OK")){
List<Device> list = loginRes.getNodeList();
if(!list.isEmpty()){
device_id = list.get(0).getDeviceID();
}else{
device_id = null;
}
GetNATServerRes res = mSoapManager.getGetNATServerRes(new GetNATServerReq(TEST_ACCOUNT, loginRes.getLoginSession()));
Log.i("123", res.toString());
if(res.getResult().equals("OK")){
turnServerIp = res.getTURNServerAddress();
turnServerPort = res.getTURNServerPort();
}else{
turnServerIp = null;
turnServerPort = -1;
}
return true;
}else{
return false;
}
}
protected void onPostExecute(Boolean result) {
if(result){
handler.sendEmptyMessage(MSG_LOGIN_OK);
}else{
handler.sendEmptyMessage(MSG_LOGIN_FAIL);
}
};
}.execute();
}
}
| [
"[email protected]"
] | |
824a14ff3ec5e78db0c2bc6688714422ce3fbe56 | d1502cfbd5becf7a1ad441f5990ebc80ac207055 | /src/test/java/listners/TestNGListners.java | 06c8bf484f4834af345a56c78161895256e36d80 | [] | no_license | nitink007/CucumberTestNGFramework | ec13605cc8795937b8ec7806729be11fb1e619a1 | 24bbc66f2cf58d31a171fc63b56b502a8bd774e0 | refs/heads/master | 2023-07-18T22:27:12.023782 | 2020-08-30T09:05:43 | 2020-08-30T09:06:22 | 269,528,926 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 959 | java | package listners;
import org.testng.IResultMap;
import org.testng.ITestContext;
import org.testng.ITestListener;
import org.testng.ITestResult;
public class TestNGListners implements ITestListener {
public void onTestStart(ITestResult result) {
System.out.println("onTestStart");
}
public void onTestSuccess(ITestResult result) {
System.out.println("onTestSuccess");
}
public void onTestFailure(ITestResult result) {
System.out.println("onTestFailure");
}
public void onTestSkipped(ITestResult result) {
System.out.println("onTestSkipped");
}
public void onTestFailedButWithinSuccessPercentage(ITestResult result) {
System.out.println("onTestFailedButWithinSuccessPercentage");
}
public void onStart(ITestContext context) {
System.out.println("onStart");
}
public void onFinish(ITestContext context) {
System.out.println("onFinish");
}
}
| [
"[email protected]"
] | |
0f2906490d3cea8a377f2ffef74bdab3dd114872 | c3dd131751d5d94a60a3026120624638566c9dcb | /app/src/main/java/com/example/miwok/WordAdapter.java | 845c01ad8bf58e2c497bb45174b67968448444d2 | [] | no_license | systemry420/android-lang-app | 6a538e5014a7d768c3f9f7c4fa841b8a77b5ff70 | cb6024b2caf356149f760e42465d65bf42fba94b | refs/heads/master | 2023-04-04T00:29:24.394579 | 2021-04-11T18:56:45 | 2021-04-11T18:56:45 | 354,821,721 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,103 | java | package com.example.miwok;
import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import java.util.ArrayList;
public class WordAdapter extends ArrayAdapter<Word> {
public WordAdapter(Activity context, ArrayList<Word> words) {
super(context, 0, words);
}
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
View listItemView = convertView;
if(listItemView == null) {
listItemView = LayoutInflater.from(getContext()).inflate(
R.layout.listitem, parent, false);
}
// Get the {@link AndroidFlavor} object located at this position in the list
Word currentWord = getItem(position);
// Find the TextView in the list_item.xml layout with the ID version_name
TextView miwokTextView = listItemView.findViewById(R.id.miwok_text_view);
// Get the version name from the current AndroidFlavor object and
// set this text on the name TextView
miwokTextView.setText(currentWord.getmMiwokWord());
// Find the TextView in the list_item.xml layout with the ID version_number
TextView englishTextView = listItemView.findViewById(R.id.english_text_view);
// Get the version number from the current AndroidFlavor object and
// set this text on the number TextView
englishTextView.setText(currentWord.getDefaultWord());
ImageView image = listItemView.findViewById(R.id.image);
if(currentWord.hasImage()) {
image.setImageResource(currentWord.getnImageResID());
} else {
image.setVisibility(View.GONE);
}
// Return the whole list item layout (containing 2 TextViews and an ImageView)
// so that it can be shown in the ListView
return listItemView;
}
}
| [
"[email protected]"
] | |
6cce1217c677e2640d7f323f3760af23178d3759 | 9f276752a939569143bdeb30abf0f6fb5f069b1e | /src/main/java/com/joy/demo/mapper/TestMapper.java | 2bee6d47c0db66ed855ed6784930212cd3e1cccf | [] | no_license | 15122741165/spring.demo | e80600bfe245324206f4177fd0f120d1a41ca518 | d3586d8f161cf78561e7e35031120bed9da384f2 | refs/heads/master | 2023-04-17T11:58:37.751428 | 2021-05-05T13:48:12 | 2021-05-05T13:48:12 | 364,584,069 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 279 | java | package com.joy.demo.mapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;
import java.util.Map;
@Mapper
public interface TestMapper {
@Select("select * from user")
List<Map<String,Object>> test();
}
| [
"[email protected]"
] | |
b63ea279f0ca1f9d51c50488f337fef742a96a68 | 41b772dd5d14f69136380234fa5a1af776ab81f8 | /vaadin-modules-dm-sample/vaadin-modules-dm-module2/src/main/java/org/ws13/vaadin/osgi/dm/module2/Module2.java | c7118504805147711fd13500b9e265ab0091692b | [] | no_license | ctranxuan/o-vaadin | 4eb6b3d25c9b91d6e3edb67255191e1e22099ae1 | 4547c38b8af6b20d3c6d94c88d7a72a9d33321df | refs/heads/master | 2020-04-22T09:33:17.145332 | 2011-12-10T19:10:36 | 2011-12-10T19:10:36 | 2,813,018 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,739 | java | /*******************************************************************************
* Copyright 2011 ctranxuan
*
* 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.ws13.vaadin.osgi.dm.module2;
import org.ws13.vaadin.osgi.dm.services.Module;
import com.vaadin.ui.Component;
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.Label;
public class Module2 implements Module {
public static class ModuleComponent extends CustomComponent {
private static final long serialVersionUID = 2619946166525399922L;
public ModuleComponent() {
setCompositionRoot(new Label("Hello, this is Module 2"));
}
}
public String getName() {
return "Module 2";
}
public Component createComponent() {
return new ModuleComponent();
}
// public void setModuleService(ModuleService service) {
// System.out.println("Module2: registering with ModuleService");
// service.registerModule(this);
// }
//
// public void unsetModuleService(ModuleService service) {
// System.out.println("Module2: unregistering with ModuleService");
// service.unregisterModule(this);
// }
}
| [
"[email protected]"
] | |
1fd0c9145faafbecdc06e8c3f3511d3f694a46b0 | d6b21db31c312ecb0da1b52b955eac1c93c373a9 | /JavaSpring_Projects/TicketAdvantage/CommonPackage/src/main/java/com/ticketadvantage/services/model/User.java | 275028514e836b9f6d0b36d3c48934e538a5947f | [] | no_license | teja0009/Projects | 84b366a0d0cb17245422c6e2aad5e65a5f7403ac | 70a437a164cef33e42b65162f8b8c3cfaeda008b | refs/heads/master | 2023-03-16T10:10:10.529062 | 2020-03-08T06:22:43 | 2020-03-08T06:22:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,917 | java | /**
*
*/
package com.ticketadvantage.services.model;
import java.io.Serializable;
import java.util.Date;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.PrePersist;
import javax.persistence.PreUpdate;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
/**
* @author jmiller
*
*/
@Entity
@Table(name = "usersta")
@XmlRootElement(name = "user")
@XmlAccessorType(XmlAccessType.NONE)
public class User implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "usersta_generator")
@SequenceGenerator(name="usersta_generator", sequenceName = "usersta_seq", initialValue=1, allocationSize=50)
@Column(name = "id", unique = true, nullable = false)
@XmlElement
private Long id;
@Column(name = "username", unique = true, nullable = false, length = 50)
@XmlElement
private String username;
@Column(name = "password", unique = false, nullable = true, length = 50)
@XmlElement(nillable=true)
private String password;
@Column(name = "email", unique = false, nullable = true, length = 100)
@XmlElement(nillable=true)
private String email;
@Column(name = "mobilenumber", unique = false, nullable = true, length = 16)
@XmlElement(nillable=true)
private String mobilenumber;
@Column(name = "isactive")
@XmlElement
private Boolean isactive;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "datecreated", unique = false, nullable = true)
@XmlElement
private Date datecreated;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "datemodified", unique = false, nullable = true)
@XmlElement
private Date datemodified;
@OneToMany(fetch = FetchType.EAGER, cascade=CascadeType.ALL)
@OrderBy("name ASC")
@JoinTable(name="usersaccounts", joinColumns={@JoinColumn(name="usersid", referencedColumnName="id")}
, inverseJoinColumns={@JoinColumn(name="accountsid", referencedColumnName="id")})
@XmlElement(nillable=true)
private Set<Accounts> accounts;
@OneToMany(fetch = FetchType.EAGER, cascade=CascadeType.ALL)
@OrderBy("name ASC")
@JoinTable(name="usersemailaccounts", joinColumns={@JoinColumn(name="usersid", referencedColumnName="id")}
, inverseJoinColumns={@JoinColumn(name="emailaccountsid", referencedColumnName="id")})
@XmlElement(nillable=true)
private Set<EmailAccounts> emailaccounts;
@OneToMany(fetch = FetchType.EAGER, cascade=CascadeType.ALL)
@OrderBy("name ASC")
@JoinTable(name="userstwitteraccounts", joinColumns={@JoinColumn(name="usersid", referencedColumnName="id")}
, inverseJoinColumns={@JoinColumn(name="twitteraccountsid", referencedColumnName="id")})
@XmlElement(nillable=true)
private Set<TwitterAccounts> twitteraccounts;
@OneToMany(fetch = FetchType.EAGER, cascade=CascadeType.ALL)
@OrderBy("name ASC")
@JoinTable(name="usersgroups", joinColumns={@JoinColumn(name="usersid", referencedColumnName="id")}
, inverseJoinColumns={@JoinColumn(name="groupsid", referencedColumnName="id")})
@XmlElement(nillable=true)
private Set<Groups> groups;
/*
@OneToMany(mappedBy="user", fetch = FetchType.EAGER, cascade=CascadeType.ALL)
@OrderBy("weekstartdate DESC")
@XmlElement(nillable=true)
private List<UserBilling> userBillings;
*/
/**
*
*/
public User() {
super();
// log.debug("Entering User()");
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
}
/**
* @return the id
*/
public Long getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Long id) {
this.id = id;
}
/**
* @return the username
*/
public String getUsername() {
return username;
}
/**
* @param username the username to set
*/
public void setUsername(String username) {
this.username = username;
}
/**
* @return the password
*/
public String getPassword() {
return password;
}
/**
* @param password the password to set
*/
public void setPassword(String password) {
this.password = password;
}
/**
* @return the email
*/
public String getEmail() {
return email;
}
/**
* @param email the email to set
*/
public void setEmail(String email) {
this.email = email;
}
/**
* @return the mobilenumber
*/
public String getMobilenumber() {
return mobilenumber;
}
/**
* @param mobilenumber the mobilenumber to set
*/
public void setMobilenumber(String mobilenumber) {
this.mobilenumber = mobilenumber;
}
/**
* @return the isactive
*/
public Boolean getIsactive() {
return isactive;
}
/**
* @param isactive the isactive to set
*/
public void setIsactive(Boolean isactive) {
this.isactive = isactive;
}
/**
* @return the datecreated
*/
public Date getDatecreated() {
return datecreated;
}
/**
* @param datecreated the datecreated to set
*/
public void setDatecreated(Date datecreated) {
this.datecreated = datecreated;
}
/**
* @return the datemodified
*/
public Date getDatemodified() {
return datemodified;
}
/**
* @param datemodified the datemodified to set
*/
public void setDatemodified(Date datemodified) {
this.datemodified = datemodified;
}
/**
* @return the accounts
*/
public Set<Accounts> getAccounts() {
return accounts;
}
/**
* @param accounts the accounts to set
*/
public void setAccounts(Set<Accounts> accounts) {
this.accounts = accounts;
}
/**
* @return the user billings
*/
// public List<UserBilling> getUserBillings() {
// return userBillings;
// }
/**
* @param user billings the user billings to set
*/
// public void setUserBillings(List<UserBilling> userBillings) {
// this.userBillings = userBillings;
// }
/**
* @return the emailaccounts
*/
public Set<EmailAccounts> getEmailaccounts() {
return emailaccounts;
}
/**
* @param emailaccounts the emailaccounts to set
*/
public void setEmailaccounts(Set<EmailAccounts> emailaccounts) {
this.emailaccounts = emailaccounts;
}
/**
* @return the twitteraccounts
*/
public Set<TwitterAccounts> getTwitteraccounts() {
return twitteraccounts;
}
/**
* @param twitteraccounts the twitteraccounts to set
*/
public void setTwitteraccounts(Set<TwitterAccounts> twitteraccounts) {
this.twitteraccounts = twitteraccounts;
}
/**
* @return the groups
*/
public Set<Groups> getGroups() {
return groups;
}
/**
* @param groups the groups to set
*/
public void setGroups(Set<Groups> groups) {
this.groups = groups;
}
/**
*
*/
@PrePersist
protected void onCreate() {
datecreated = datemodified = new Date();
}
/**
*
*/
@PreUpdate
protected void onUpdate() {
datecreated = datemodified = new Date();
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "User [id=" + id + ", username=" + username + ", password=" + password + ", email=" + email
+ ", mobilenumber=" + mobilenumber + ", isactive=" + isactive + ", datecreated=" + datecreated
+ ", datemodified=" + datemodified + ", accounts=" + accounts + ", emailaccounts=" + emailaccounts
+ ", twitteraccounts=" + twitteraccounts + ", groups=" + groups + "]";
}
} | [
"[email protected]"
] | |
da9834aad15101580c1da96050babfa2d0022284 | 57369a8543ae72cef80eccea397006bfc6e7018e | /src/main/java/com/selab/livinglab/Controller/IndexController.java | 649665a761a72b485734070bade3a7ed2da5b955 | [] | no_license | ubbig/testgrafana | 7aff8f673efd895d0e3edd11109ad6c1e4d876c2 | 4f3f762e2092c1277670914bc60de17027f592d7 | refs/heads/main | 2023-07-14T13:38:59.978451 | 2021-08-30T09:20:36 | 2021-08-30T09:20:36 | 397,087,271 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 673 | java | package com.selab.livinglab.Controller;
import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.ui.Model;
import javax.servlet.http.HttpServletRequest;
@Controller
public class IndexController {
static Logger logger = LoggerFactory.getLogger(IndexController.class);
public IndexController() {
}
@RequestMapping("/")
public String index(final Model model, final HttpServletResponse respose, final HttpServletRequest request){
return "living/geojson";
}
}
| [
"[email protected]"
] | |
6b0d49c2d35dc6076a71c81521d9d73f549fdf8e | 79a33795eed2bbf921e426fdaaf285ed4a38a68f | /前30/xianjinxia/app/src/main/java/com/example/apple/xianjinxia/dao/Bills.java | 37100e84ae82172f05ba92fdb1b141c037be3d39 | [] | no_license | bluelzx/miaobaitiao | d809c6cf778852998513f0ae73624567d0798ca1 | b8be0d5256cb029fef8784069dae7704bb16ad85 | refs/heads/master | 2021-01-20T01:51:21.518301 | 2017-04-20T02:53:42 | 2017-04-20T02:53:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,041 | java | package com.example.apple.xianjinxia.dao;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. Enable "keep" sections if you want to edit.
/**
* Entity mapped to table e_bills.
*/
public class Bills {
private Long b_id;
private Long b_pid;
private String b_add_date;
private String b_name;
private String b_type;
private String b_num;
private String b_all;
private String b_describ;
public Bills() {
}
public Bills(Long b_id) {
this.b_id = b_id;
}
public Bills(Long b_id, Long b_pid, String b_add_date, String b_name, String b_type, String b_num, String b_all, String b_describ) {
this.b_id = b_id;
this.b_pid = b_pid;
this.b_add_date = b_add_date;
this.b_name = b_name;
this.b_type = b_type;
this.b_num = b_num;
this.b_all = b_all;
this.b_describ = b_describ;
}
public Long getB_id() {
return b_id;
}
public void setB_id(Long b_id) {
this.b_id = b_id;
}
public Long getB_pid() {
return b_pid;
}
public void setB_pid(Long b_pid) {
this.b_pid = b_pid;
}
public String getB_add_date() {
return b_add_date;
}
public void setB_add_date(String b_add_date) {
this.b_add_date = b_add_date;
}
public String getB_name() {
return b_name;
}
public void setB_name(String b_name) {
this.b_name = b_name;
}
public String getB_type() {
return b_type;
}
public void setB_type(String b_type) {
this.b_type = b_type;
}
public String getB_num() {
return b_num;
}
public void setB_num(String b_num) {
this.b_num = b_num;
}
public String getB_all() {
return b_all;
}
public void setB_all(String b_all) {
this.b_all = b_all;
}
public String getB_describ() {
return b_describ;
}
public void setB_describ(String b_describ) {
this.b_describ = b_describ;
}
}
| [
"[email protected]"
] | |
75a85223fcb58a5766468226d82e54e174a40441 | 511164dd56017b7738417d4d2403404fa4428e12 | /com.learnMaven.com/src/test/java/stepDefination/stepDefinationDemo.java | b1a71a4de0a37a2ccfb9268a27d714f575fa6fe3 | [] | no_license | ajaykbiswal/seleniumtest4 | 979c39d936e9f028d528ae0515f304aaa0613958 | c03043ad8fbca25ef746ab0b0103649c42b4b2cc | refs/heads/master | 2022-12-25T21:50:12.497332 | 2019-07-21T09:26:10 | 2019-07-21T09:26:10 | 198,035,122 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,132 | java | package stepDefination;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;
public class stepDefinationDemo {
WebDriver driver;
@Given("^Open Chrome and start application$")
public void open_Chrome_and_start_application() throws Throwable {
System.setProperty("webdriver.chrome.driver", "");
driver=new ChromeDriver();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.get("");
}
@When("^Enter valid username and valid password$")
public void enter_valid_username_and_valid_password() throws Throwable {
driver.findElement(By.xpath("")).sendKeys("");
driver.findElement(By.xpath("")).sendKeys("");
}
@Then("^user should be able to login into application sucessfully$")
public void user_should_be_able_to_login_into_application_sucessfully() throws Throwable {
driver.findElement(By.id("")).click();
}
}
| [
"[email protected]"
] | |
905e923c3581297bf92e96c152c3a62f65311446 | 0ba3fd20406df94852a2a68d674d64f2532b76d4 | /build/generated/src/org/apache/jsp/candidate_jsp.java | 63be82a69120b1871ee2cfbad1106c760967e769 | [] | no_license | RISHABHDHIMAN1140/project1 | 953d83c1b69fb1f2326d98fd5b2469c8a2e005e0 | f084cd24781723964909a9e01429d07e43ee0e66 | refs/heads/master | 2020-04-09T05:33:10.564270 | 2018-12-02T16:59:22 | 2018-12-02T16:59:22 | 160,069,105 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,370 | java | package org.apache.jsp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
public final class candidate_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory();
private static java.util.List<String> _jspx_dependants;
private org.glassfish.jsp.api.ResourceInjector _jspx_resourceInjector;
public java.util.List<String> getDependants() {
return _jspx_dependants;
}
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
JspWriter _jspx_out = null;
PageContext _jspx_page_context = null;
try {
response.setContentType("text/html");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
_jspx_resourceInjector = (org.glassfish.jsp.api.ResourceInjector) application.getAttribute("com.sun.appserv.jsp.resource.injector");
out.write("<html>\n");
out.write(" <head>\n");
out.write(" <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n");
out.write(" <style>\n");
out.write(".container {\n");
out.write(" position: relative;\n");
out.write(" width: 50%;\n");
out.write("}\n");
out.write("\n");
out.write(".image {\n");
out.write(" opacity: 1;\n");
out.write(" display: block;\n");
out.write(" width: 70%;\n");
out.write(" height: auto;\n");
out.write(" transition: .5s ease;\n");
out.write(" backface-visibility: hidden;\n");
out.write("}\n");
out.write("\n");
out.write(".middle {\n");
out.write(" transition: .5s ease;\n");
out.write(" opacity: 0;\n");
out.write(" position: absolute;\n");
out.write(" top: 50%;\n");
out.write(" left: 50%;\n");
out.write(" transform: translate(-50%, -50%);\n");
out.write(" -ms-transform: translate(-50%, -50%);\n");
out.write(" text-align: center;\n");
out.write("}\n");
out.write("\n");
out.write(".container:hover .image {\n");
out.write(" opacity: 0.3;\n");
out.write("}\n");
out.write("\n");
out.write(".container:hover .middle {\n");
out.write(" opacity: 1;\n");
out.write("}\n");
out.write("\n");
out.write(".text {\n");
out.write(" background-color: #4CAF50;\n");
out.write(" color: white;\n");
out.write(" font-size: 16px;\n");
out.write(" padding: 16px 32px;\n");
out.write("}\n");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("\n");
out.write(".papu {\n");
out.write(" position: relative;\n");
out.write(" width: 50%;\n");
out.write("}\n");
out.write("\n");
out.write(".image {\n");
out.write(" opacity: 1;\n");
out.write(" display: block;\n");
out.write(" width: 70%;\n");
out.write(" height: auto;\n");
out.write(" transition: .5s ease;\n");
out.write(" backface-visibility: hidden;\n");
out.write("}\n");
out.write("\n");
out.write(".middle {\n");
out.write(" transition: .5s ease;\n");
out.write(" opacity: 0;\n");
out.write(" position: absolute;\n");
out.write(" top: 50%;\n");
out.write(" left: 50%;\n");
out.write(" transform: translate(-50%, -50%);\n");
out.write(" -ms-transform: translate(-50%, -50%);\n");
out.write(" text-align: center;\n");
out.write("}\n");
out.write("\n");
out.write(".papu:hover .image {\n");
out.write(" opacity: 0.3;\n");
out.write("}\n");
out.write("\n");
out.write(".papu:hover .middle {\n");
out.write(" opacity: 1;\n");
out.write("}\n");
out.write("\n");
out.write(".text {\n");
out.write(" background-color: #4CAF50;\n");
out.write(" color: white;\n");
out.write(" font-size: 16px;\n");
out.write(" padding: 16px 32px;\n");
out.write("}\n");
out.write("\n");
out.write("\n");
out.write("\n");
out.write(".akki {\n");
out.write(" position: relative;\n");
out.write(" width: 50%;\n");
out.write("}\n");
out.write("\n");
out.write(".image {\n");
out.write(" opacity: 1;\n");
out.write(" display: block;\n");
out.write(" width: 70%;\n");
out.write(" height: auto;\n");
out.write(" transition: .5s ease;\n");
out.write(" backface-visibility: hidden;\n");
out.write("}\n");
out.write("\n");
out.write(".middle {\n");
out.write(" transition: .5s ease;\n");
out.write(" opacity: 0;\n");
out.write(" position: absolute;\n");
out.write(" top: 50%;\n");
out.write(" left: 50%;\n");
out.write(" transform: translate(-50%, -50%);\n");
out.write(" -ms-transform: translate(-50%, -50%);\n");
out.write(" text-align: center;\n");
out.write("}\n");
out.write("\n");
out.write(".akki:hover .image {\n");
out.write(" opacity: 0.3;\n");
out.write("}\n");
out.write("\n");
out.write(".akki:hover .middle {\n");
out.write(" opacity: 1;\n");
out.write("}\n");
out.write("\n");
out.write(".text {\n");
out.write(" background-color: #4CAF50;\n");
out.write(" color: white;\n");
out.write(" font-size: 16px;\n");
out.write(" padding: 16px 32px;\n");
out.write("}\n");
out.write("\n");
out.write("</style>\n");
out.write("</head>\n");
out.write("<body>\n");
out.write("\n");
out.write("<div class=\"container\">\n");
out.write(" <img src=\"F:\\voting photos\\Download-Indian-Prime-Minister-Sri-Narendra-Modi-HD-Wallpaper-for-Desktop-Free-1.jpg\" alt=\"Avatar\" class=\"image\" style=\"width:70%\">\n");
out.write(" <div class=\"middle\">\n");
out.write(" <div class=\"text\">\n");
out.write(" <h1>BJP</h1>\n");
out.write(" <pre>\n");
out.write("Name:Narendra Damodardas Modi\n");
out.write("Born: 17 September 1950 (age 68 years), Vadnagar\n");
out.write("Spouse: Jashodaben Narendrabhai Modi (m. 1968)\n");
out.write("Office: Prime Minister of India since 2014\n");
out.write("Education: Gujarat University (1983), University of Delhi (1978), School of Open Learning\n");
out.write("Previous offices: Member of the Gujarat Legislative Assembly (2002?2014), Chief Minister of Gujarat (2001?2014)</div>\n");
out.write(" </pre></div>\n");
out.write("</div>\n");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("<div class=\"papu\">\n");
out.write(" <img src=\"F:\\voting photos\\papu.jpg\" alt=\"Avatar\" class=\"image\" style=\"width:70%\">\n");
out.write(" <div class=\"middle\">\n");
out.write(" <div class=\"text\">\n");
out.write(" <h1>INDIAN NATIONAL CONGRESS</h1>\n");
out.write(" <pre>\n");
out.write("Name:Rahul Gandhi\n");
out.write("Born: 48 years\n");
out.write("Education: M.Phil from Trinity College, Cambridge in 1995.\n");
out.write(" </pre></div>\n");
out.write("</div>\n");
out.write(" \n");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("<div class=\"akki\">\n");
out.write(" <img src=\"F:\\voting photos\\akki.jpg\" alt=\"Avatar\" class=\"image\" style=\"width:140%\">\n");
out.write(" <div class=\"middle\">\n");
out.write(" <div class=\"text\">\n");
out.write(" <h1>AAM AADMI PARTY</h1>\n");
out.write(" <pre>\n");
out.write("Born: 16 August 1968 (age 50 years), Siwani\n");
out.write("Spouse: Sunita Kejriwal (m. 1994)\n");
out.write("Office: List of Chief Ministers of Delhi until 14 Feb 2019\n");
out.write("Previous office: List of Chief Ministers of Delhi (2013?2014)\n");
out.write("Education: Indian Institute of Technology Kharagpur (1985?1989), Campus School, CCS HAU, Dayanand college\n");
out.write(" </pre></div>\n");
out.write("</div>\n");
out.write("\n");
out.write("</body>\n");
out.write("\n");
out.write("</html>\n");
} catch (Throwable t) {
if (!(t instanceof SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
else throw new ServletException(t);
}
} finally {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
}
| [
"[email protected]"
] | |
a0d3b857249ac4d657b7dc5fc7f1376f5f68447f | 7bea7fb60b5f60f89f546a12b43ca239e39255b5 | /src/javax/management/remote/MBeanServerForwarder.java | f9d9dd1cdd6c43de94e36a48f4134fdfc3965d99 | [] | no_license | sorakeet/fitcorejdk | 67623ab26f1defb072ab473f195795262a8ddcdd | f946930a826ddcd688b2ddbb5bc907d2fc4174c3 | refs/heads/master | 2021-01-01T05:52:19.696053 | 2017-07-15T01:33:41 | 2017-07-15T01:33:41 | 97,292,673 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 381 | java | /**
* Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
package javax.management.remote;
import javax.management.MBeanServer;
public interface MBeanServerForwarder extends MBeanServer{
public MBeanServer getMBeanServer();
public void setMBeanServer(MBeanServer mbs);
}
| [
"panxiaoping@9af151c5-2e68-9a40-a710-8967c58c11f7"
] | panxiaoping@9af151c5-2e68-9a40-a710-8967c58c11f7 |
a90835b3063b0a29ce772e8bdc513974957ccfdc | fcc6a1eca7246cd4465e9d7b7e3f4e1c4c741373 | /common/rebelkeithy/mods/aquaculture/items/AquaItemPickaxe.java | 21ac18e0269a80c4cd72fc5abc77a6d9acbd8f7f | [] | no_license | RebelKeithy/Aquaculture | 600617ec4996d166d04f55d970880574f8bb752f | 6fe8bd24cedfd6e129ade4354af53e2826678ea5 | refs/heads/master | 2023-07-08T14:10:50.533384 | 2013-07-16T18:54:41 | 2013-07-16T18:54:41 | 10,957,344 | 4 | 2 | null | 2020-07-21T14:44:24 | 2013-06-26T03:33:34 | Java | UTF-8 | Java | false | false | 778 | java | package rebelkeithy.mods.aquaculture.items;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemPickaxe;
public class AquaItemPickaxe extends ItemPickaxe
{
public AquaItemPickaxe(int par1, EnumToolMaterial par2EnumToolMaterial)
{
super(par1, par2EnumToolMaterial);
}
/**
* Sets the unlocalized name of this item to the string passed as the parameter, prefixed by "item."
*/
public Item setUnlocalizedName(String par1Str)
{
super.setUnlocalizedName(par1Str);
this.setTextureName("aquaculture:" + par1Str.replaceAll("\\s",""));
return this;
}
public Item setTextureName(String par1Str)
{
super.func_111206_d(par1Str);
return this;
}
}
| [
"[email protected]"
] | |
7bf46a2d76ec6eb53da7dce399c8372e9832b1b1 | 267e6e7f525e3e22639cb88551bde6cd95597290 | /src/main/java/com/cs/travels/service/UserService.java | 61db0a2b7d7bd2ca12cbef7fe20ba8a7fee5f0ca | [] | no_license | zycloud68/travels | 8d4815698a4713dcec0bd60e3fc755ffb0ae8932 | 7b310c2b8461d69888ef999dedde4e60ababeed1 | refs/heads/master | 2023-06-05T12:59:28.316364 | 2021-06-23T03:57:04 | 2021-06-23T03:57:04 | 287,181,429 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 160 | java | package com.cs.travels.service;
import com.cs.travels.entity.User;
public interface UserService {
void register(User user);
User login(User user);
}
| [
"[email protected]"
] | |
8b9fbce00270906a0b0e52f9f27686ac186be3ce | f42d7da85f9633cfb84371ae67f6d3469f80fdcb | /com4j-20120426-2/samples/word/build/src/word/SeriesCollection.java | ea5c98829a52884da387903798fc70402361a1ee | [
"BSD-2-Clause"
] | permissive | LoongYou/Wanda | ca89ac03cc179cf761f1286172d36ead41f036b5 | 2c2c4d1d14e95e98c0a3af365495ec53775cc36b | refs/heads/master | 2023-03-14T13:14:38.476457 | 2021-03-06T10:20:37 | 2021-03-06T10:20:37 | 231,610,760 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,817 | java | package word ;
import com4j.*;
@IID("{8FEB78F7-35C6-4871-918C-193C3CDD886D}")
public interface SeriesCollection extends Com4jObject,Iterable<Com4jObject> {
// Methods:
/**
* <p>
* Getter method for the COM property "Parent"
* </p>
* @return Returns a value of type com4j.Com4jObject
*/
@DISPID(150) //= 0x96. The runtime will prefer the VTID if present
@VTID(7)
@ReturnValue(type=NativeType.Dispatch)
com4j.Com4jObject parent();
/**
* @param source Mandatory java.lang.Object parameter.
* @param rowcol Optional parameter. Default value is 2
* @param seriesLabels Optional parameter. Default value is com4j.Variant.getMissing()
* @param categoryLabels Optional parameter. Default value is com4j.Variant.getMissing()
* @param replace Optional parameter. Default value is com4j.Variant.getMissing()
* @return Returns a value of type word.Series
*/
@DISPID(181) //= 0xb5. The runtime will prefer the VTID if present
@VTID(8)
word.Series add(
@MarshalAs(NativeType.VARIANT) java.lang.Object source,
@Optional @DefaultValue("2") word.XlRowCol rowcol,
@Optional @MarshalAs(NativeType.VARIANT) java.lang.Object seriesLabels,
@Optional @MarshalAs(NativeType.VARIANT) java.lang.Object categoryLabels,
@Optional @MarshalAs(NativeType.VARIANT) java.lang.Object replace);
/**
* <p>
* Getter method for the COM property "Count"
* </p>
* @return Returns a value of type int
*/
@DISPID(118) //= 0x76. The runtime will prefer the VTID if present
@VTID(9)
int count();
/**
* @param source Mandatory java.lang.Object parameter.
* @param rowcol Optional parameter. Default value is com4j.Variant.getMissing()
* @param categoryLabels Optional parameter. Default value is com4j.Variant.getMissing()
* @return Returns a value of type java.lang.Object
*/
@DISPID(227) //= 0xe3. The runtime will prefer the VTID if present
@VTID(10)
@ReturnValue(type=NativeType.VARIANT)
java.lang.Object extend(
@MarshalAs(NativeType.VARIANT) java.lang.Object source,
@Optional @MarshalAs(NativeType.VARIANT) java.lang.Object rowcol,
@Optional @MarshalAs(NativeType.VARIANT) java.lang.Object categoryLabels);
/**
* @param index Mandatory java.lang.Object parameter.
* @return Returns a value of type word.Series
*/
@DISPID(0) //= 0x0. The runtime will prefer the VTID if present
@VTID(11)
@DefaultMethod
word.Series item(
@MarshalAs(NativeType.VARIANT) java.lang.Object index);
/**
*/
@DISPID(-4) //= 0xfffffffc. The runtime will prefer the VTID if present
@VTID(12)
java.util.Iterator<Com4jObject> iterator();
/**
* @return Returns a value of type word.Series
*/
@DISPID(1117) //= 0x45d. The runtime will prefer the VTID if present
@VTID(13)
word.Series newSeries();
/**
* <p>
* Getter method for the COM property "Application"
* </p>
* @return Returns a value of type com4j.Com4jObject
*/
@DISPID(148) //= 0x94. The runtime will prefer the VTID if present
@VTID(14)
@ReturnValue(type=NativeType.Dispatch)
com4j.Com4jObject application();
/**
* <p>
* Getter method for the COM property "Creator"
* </p>
* @return Returns a value of type int
*/
@DISPID(149) //= 0x95. The runtime will prefer the VTID if present
@VTID(15)
int creator();
/**
* @param index Mandatory java.lang.Object parameter.
* @return Returns a value of type word.Series
*/
@DISPID(1610743818) //= 0x6002000a. The runtime will prefer the VTID if present
@VTID(16)
word.Series _Default(
@MarshalAs(NativeType.VARIANT) java.lang.Object index);
// Properties:
}
| [
"[email protected]"
] | |
82197054d689f013539fafee5b4ae85411b1c0e0 | 740c2625445063d975991f2bc35f7e8375b307eb | /android/app/src/main/java/com/taba/MainActivity.java | d96ae65a9d249167b11bc8b5d40129c80d9a1410 | [] | no_license | masteine/taba | ba617f346ab532e9cd0978e9a5d2cf02b7073682 | 52e78d31d15bbb2824e799257bdcfdaa867cc7f4 | refs/heads/master | 2023-04-12T11:27:13.904032 | 2021-04-14T14:52:06 | 2021-04-14T14:52:06 | 355,816,995 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 335 | java | package com.taba;
import com.facebook.react.ReactActivity;
public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript. This is used to schedule
* rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "taba";
}
}
| [
"[email protected]"
] | |
dd7a322ab51699d67288b744bc8021e57cb19595 | f643eb2bffea8995b057f01347ccf9ff63e85344 | /7.1_code/apps-edoc/com/seeyon/v3x/edoc/domain/EdocRegister.java | 7bdd17b011f2edef5b0337bb9b77c59218350637 | [] | no_license | AirSkye/A-8-code | 13598ff31d554ec68f1e677c2f9284931594d0c9 | 008c6d21dd8c9b406c16fc86b899534b712121c4 | refs/heads/master | 2023-07-18T10:54:24.056687 | 2021-03-16T03:02:41 | 2021-03-16T03:02:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 26,986 | java | package com.seeyon.v3x.edoc.domain;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import com.seeyon.ctp.common.po.filemanager.Attachment;
import com.seeyon.ctp.util.Datetimes;
import com.seeyon.ctp.util.Strings;
import com.seeyon.v3x.common.domain.BaseModel;
import com.seeyon.v3x.edoc.constants.EdocNavigationEnum;
import com.seeyon.ctp.util.IdentifierUtil;
/**
* 公文登记对象
* @author 唐桂林 2011.09.27
*/
public class EdocRegister extends BaseModel implements Serializable {
/**
*
*/
private static final long serialVersionUID = 2987994269664372485L;
public static final int AUTO_REGISTER = 1;
/**
*
*/
public static final int REGISTER_TYPE_BY_PAPER_REC_EDOC = 100; //新建纸质收文时,登记表中也插入数据并设置该状态,不在登记表中显示
/**
* 标志位, 共100位,采用枚举的自然顺序
*/
protected static enum INENTIFIER_INDEX{
HAS_ATTACHMENTS, // 是否有附件
};
/** 标志位 */
private String identifier;
/** 签收单ID */
private Long recieveId = 0L;
/** 来文公文ID */
private Long edocId = 0L;
/** 登记单类型 0发文登记 1收文登记 */
private Integer edocType = 0;
/** 登记方式 1电子公文登记 2纸质公文登记 3二维码公文登记 */
private Integer registerType = 0;
/** 创建人Id */
private Long createUserId = 0L;
/** 创建人名字 */
private String createUserName;
/** 创建时间 */
private java.sql.Timestamp createTime;
/** 修改时间 */
private java.sql.Timestamp updateTime;
/** 来文单位 */
private String sendUnit;
/** 来文单位id */
private Long sendUnitId = 0L;
/** 来文类型 1内部单位 2外部单位 */
private Integer sendUnitType = 0;
/** 成文单位 */
private String edocUnit;
/** 成文单位id */
private String edocUnitId;
/** 成文日期 发文最后一个签发节点的处理日期,如果没有签发节点,用封发日期 */
private java.sql.Date edocDate;
/** 登记人id */
private Long registerUserId = 0L;
/** 登记人 */
private String registerUserName;
/** 登记日期 */
private java.sql.Date registerDate;
/** 签发人id */
private Long issuerId = 0L;
/** 签发人 */
private String issuer;
/** 签发日期 */
private java.sql.Date issueDate;
/** 会签人 */
private String signer;
/** 分发人id */
private Long distributerId = -1L;
/** 是否代理 */
private boolean proxy;
private Long proxyId;
/** 代理人 */
private String proxyName;
private String proxyLabel;
/** 代理人 Id*/
private Long proxyUserId;
/** 分发人 */
private String distributer;
/** 分发时间 */
private java.sql.Date distributeDate;
/** 分发状态 0草稿箱 1待分发 2已分发 */
private Integer distributeState = 0;
/** 分发关联公文id */
private Long distributeEdocId = 0L;
/** 标题 */
private String subject;
/** 公文类型-来自系统枚举值 */
private String docType;
/** 行文类型- 来自系统枚举值 */
private String sendType;
/** 来文字号 */
private String docMark;
/** 收文编号 */
private String serialNo;
/** 文件密级 */
private String secretLevel;
/** 紧急程度 */
private String urgentLevel;
/** 保密期限 */
private String keepPeriod;
/** 主送单位 */
private String sendTo;
/** 主送单位id */
private String sendToId;
/** 抄送单位 */
private String copyTo;
/** 主送单位id */
private String copyToId;
/** 主题词 */
private String keywords;
/** 印发份数 */
private Integer copies;
/** 附注 */
private String noteAppend;
/** 附件说明 */
private String attNote;
/** 登记状态 0草稿箱 1待登记 2已登记 3退回给签收 4被退回 5删除 */
private Integer state = 0;
/** 登记单位 */
private Long orgAccountId = 0L;
/** 签收时间 */
private java.sql.Timestamp recTime;
/** 交换机关类型 0部门 1单位(非数据库字段) */
private int exchangeType;
/** 交换机关id (非数据库字段) */
private long exchangeOrgId;
/** 是否有附件 */
private boolean hasAttachments;
/** 公文级别 */
private String unitLevel;
/** 送文日期 */
private java.sql.Timestamp exchangeSendTime;
/** 交换方式:区分往外发送的方式(内部公文交换又叫致远交换、书生公文交换) */
private Integer exchangeMode =0;
/** 附件 */
private List<Attachment> attachmentList = new ArrayList<Attachment>();
/** 正文 */
private RegisterBody registerBody = null;
private Integer isRetreat = 0;//是否被退回
private Integer autoRegister;//是否自动登记(V5-G6版本使用,但A8中也有这个字段)
private Long recieveUserId; //签收人id
private String recieveUserName; //签收人名称
public Long getRecieveUserId() {
return recieveUserId;
}
public void setRecieveUserId(Long recieveUserId) {
this.recieveUserId = recieveUserId;
}
public String getRecieveUserName() {
return recieveUserName;
}
public void setRecieveUserName(String recieveUserName) {
this.recieveUserName = recieveUserName;
}
public Integer getAutoRegister() {
return autoRegister;
}
public void setAutoRegister(Integer autoRegister) {
this.autoRegister = autoRegister;
}
public String getProxyLabel() {
return proxyLabel;
}
public void setProxyLabel(String proxyLabel) {
this.proxyLabel = proxyLabel;
}
public Integer getIsRetreat() {
return isRetreat;
}
public void setIsRetreat(Integer isRetreat) {
this.isRetreat = isRetreat;
}
public Long getProxyId() {
return proxyId;
}
public void setProxyId(Long proxyId) {
this.proxyId = proxyId;
}
//解析Long值
private Long parseLongVal(HttpServletRequest request, String code, Long defualtValue){
Long ret = defualtValue;
String rValue = request.getParameter(code);
if(Strings.isNotBlank(rValue)){
ret = Long.parseLong(rValue);
}
return ret;
}
//解析Integer值
private Integer parseIntegerVal(HttpServletRequest request, String code, Integer defualtValue){
Integer ret = defualtValue;
String rValue = request.getParameter(code);
if(Strings.isNotBlank(rValue)){
ret = Integer.parseInt(rValue);
}
return ret;
}
//解析String 类型
private String parseStringVal(HttpServletRequest request, String code, String defualtValue){
String ret = defualtValue;
String rValue = request.getParameter(code);
if(Strings.isNotBlank(rValue)){
ret = rValue;
}
return ret;
}
public void bind(HttpServletRequest request) {
this.setId(parseLongVal(request, "id", -1L));
this.setIdentifier(parseStringVal(request, "identifier", "00000000000000000000"));
this.setEdocId(parseLongVal(request, "edocId", -1L));
this.setEdocType(parseIntegerVal(request, "edocType", 1));
this.setRecieveId(parseLongVal(request, "recieveId", -1L));
this.setRegisterType(parseIntegerVal(request, "registerType", EdocNavigationEnum.RegisterType.ByAutomatic.ordinal()));
this.setCreateUserId(parseLongVal(request, "createUserId", -1L));
this.setCreateUserName(parseStringVal(request, "createUserName", ""));
this.setCreateTime(request.getParameter("createTime") == null ? new java.sql.Timestamp(new java.util.Date().getTime()) : Timestamp.valueOf(request.getParameter("createTime")));
this.setUpdateTime(request.getParameter("updateTime") == null ? null : Timestamp.valueOf(request.getParameter("updateTime")));
this.setSendUnit(parseStringVal(request, "sendUnit", ""));
this.setSendUnitId(parseLongVal(request, "sendUnitId", -1L));
this.setSendUnitType(parseIntegerVal(request, "sendUnitType", this.getSendUnitType()));
this.setEdocUnit(parseStringVal(request, "edocUnit", ""));
this.setEdocUnitId(parseStringVal(request, "edocUnitId", ""));
this.setRegisterUserId(parseLongVal(request, "registerUserId", -1L));
this.setRegisterUserName(parseStringVal(request, "registerUserName", ""));
this.setIssuerId(parseLongVal(request, "issuerId", -1L));
this.setIssuer(parseStringVal(request, "issuer", ""));
java.sql.Date date = null;
if(Strings.isNotBlank(request.getParameter("edocDate"))) {
date = new java.sql.Date(Datetimes.parseDatetime(request.getParameter("edocDate")+" 00:00:00").getTime());
}
this.setEdocDate(date);
date = null;
if(Strings.isNotBlank(request.getParameter("registerDate"))) {
date = new java.sql.Date(Datetimes.parseDatetime(request.getParameter("registerDate")+" 00:00:00").getTime());
}
this.setRegisterDate(date);
date = null;
if(Strings.isNotBlank(request.getParameter("issueDate"))) {
date = new java.sql.Date(Datetimes.parseDatetime(request.getParameter("issueDate")+" 00:00:00").getTime());
}
this.setIssueDate(date);
date = null;
if(Strings.isNotBlank(request.getParameter("distributeDate"))) {
date = new java.sql.Date(Datetimes.parseDatetime(request.getParameter("distributeDate")+" 00:00:00").getTime());
}
this.setDistributeDate(date);
this.setRecTime(Strings.isBlank(request.getParameter("recTime")) ? null : Timestamp.valueOf(request.getParameter("recTime")));
this.setSigner(parseStringVal(request, "signer", ""));
this.setDistributerId(parseLongVal(request, "distributerId", -1L));
this.setDistributer(parseStringVal(request, "distributer", ""));
this.setDistributeState(parseIntegerVal(request, "distributeState", 0));
this.setDistributeEdocId(parseLongVal(request, "distributeEdocId", -1L));
this.setSubject(parseStringVal(request, "subject", ""));
this.setDocType(parseStringVal(request, "docType", this.getDocType()));
this.setSendType(parseStringVal(request, "sendType", this.getSendType()));
this.setDocMark(parseStringVal(request, "docMark", ""));
this.setSerialNo(parseStringVal(request, "serialNo", ""));
this.setSecretLevel(parseStringVal(request, "secretLevel", this.getSecretLevel()));
this.setUrgentLevel(parseStringVal(request, "urgentLevel", this.getUrgentLevel()));
this.setKeepPeriod(parseStringVal(request, "keepPeriod", this.getKeepPeriod()));
this.setUnitLevel(parseStringVal(request, "unitLevel", null));
this.setSendTo(parseStringVal(request, "sendTo", ""));
this.setSendToId(parseStringVal(request, "sendToId", ""));
this.setCopyTo(parseStringVal(request, "copyTo", ""));
this.setCopyToId(parseStringVal(request, "copyToId", ""));
this.setKeywords(parseStringVal(request, "keywords", ""));
this.setCopies(parseIntegerVal(request, "registerCopies", null));
this.setNoteAppend(parseStringVal(request, "noteAppend", ""));
this.setAttNote(parseStringVal(request, "attNote", ""));
this.setState(parseIntegerVal(request, "state", 1));
this.setOrgAccountId(parseLongVal(request, "orgAccountId", -1L));
}
/**
* @return distributeEdocId
*/
public Long getDistributeEdocId() {
return distributeEdocId;
}
/**
* @param distributeEdocId
*/
public void setDistributeEdocId(Long distributeEdocId) {
this.distributeEdocId = distributeEdocId;
}
/**
* @return the recTime
*/
public java.sql.Timestamp getRecTime() {
return recTime;
}
/**
* @param recTime the recTime to set
*/
public void setRecTime(java.sql.Timestamp recTime) {
this.recTime = recTime;
}
/**
* @return the exchangeType
*/
public int getExchangeType() {
return exchangeType;
}
/**
* @param exchangeType the exchangeType to set
*/
public void setExchangeType(int exchangeType) {
this.exchangeType = exchangeType;
}
/**
* @return the exchangeOrgId
*/
public long getExchangeOrgId() {
return exchangeOrgId;
}
public Long getProxyUserId() {
return proxyUserId;
}
public void setProxyUserId(Long proxyUserId) {
this.proxyUserId = proxyUserId;
}
/**
* @param exchangeOrgId the exchangeOrgId to set
*/
public void setExchangeOrgId(long exchangeOrgId) {
this.exchangeOrgId = exchangeOrgId;
}
/**
* @param id the id to set
*/
public void setId(long id) {
this.id = id;
}
/**
* @return the id
*/
public Long getId() {
return id;
}
/**
* @return the identifier
*/
public String getIdentifier() {
return identifier;
}
/**
* @param identifier the identifier to set
*/
public void setIdentifier(String identifier) {
this.identifier = identifier;
}
/**
* @return the recieveId
*/
public Long getRecieveId() {
return recieveId;
}
/**
* @param recieveId the recieveId to set
*/
public void setRecieveId(Long recieveId) {
this.recieveId = recieveId;
}
/**
* @return the edocId
*/
public Long getEdocId() {
return edocId;
}
/**
* @param edocId the edocId to set
*/
public void setEdocId(Long edocId) {
this.edocId = edocId;
}
/**
* @return the edocType
*/
public Integer getEdocType() {
return edocType;
}
/**
* @param edocType the edocType to set
*/
public void setEdocType(Integer edocType) {
this.edocType = edocType;
}
/**
* @return the registerType
*/
public Integer getRegisterType() {
return registerType;
}
/**
* @param registerType the registerType to set
*/
public void setRegisterType(Integer registerType) {
this.registerType = registerType;
}
/**
* @return the createUserId
*/
public Long getCreateUserId() {
return createUserId;
}
/**
* @param createUserId the createUserId to set
*/
public void setCreateUserId(Long createUserId) {
this.createUserId = createUserId;
}
/**
* @return the createUserName
*/
public String getCreateUserName() {
return createUserName;
}
/**
* @param createUserName the createUserName to set
*/
public void setCreateUserName(String createUserName) {
this.createUserName = createUserName;
}
/**
* @return the createTime
*/
public java.sql.Timestamp getCreateTime() {
return createTime;
}
/**
* @param createTime the createTime to set
*/
public void setCreateTime(java.sql.Timestamp createTime) {
this.createTime = createTime;
}
/**
* @return the updateTime
*/
public java.sql.Timestamp getUpdateTime() {
return updateTime;
}
/**
* @param updateTime the updateTime to set
*/
public void setUpdateTime(java.sql.Timestamp updateTime) {
this.updateTime = updateTime;
}
/**
* @return the sendUnit
*/
public String getSendUnit() {
return sendUnit;
}
/**
* @param sendUnit the sendUnit to set
*/
public void setSendUnit(String sendUnit) {
this.sendUnit = sendUnit;
}
/**
* @return the sendUnitId
*/
public Long getSendUnitId() {
return sendUnitId;
}
/**
* @param sendUnitId the sendUnitId to set
*/
public void setSendUnitId(Long sendUnitId) {
this.sendUnitId = sendUnitId;
}
/**
* @return the sendUnitType
*/
public Integer getSendUnitType() {
return sendUnitType;
}
/**
* @param sendUnitType the sendUnitType to set
*/
public void setSendUnitType(Integer sendUnitType) {
this.sendUnitType = sendUnitType;
}
/**
* @return the edocUnit
*/
public String getEdocUnit() {
return edocUnit;
}
/**
* @param edocUnit the edocUnit to set
*/
public void setEdocUnit(String edocUnit) {
this.edocUnit = edocUnit;
}
/**
* @return the edocUnitId
*/
public String getEdocUnitId() {
return edocUnitId;
}
/**
* @param edocUnitId the edocUnitId to set
*/
public void setEdocUnitId(String edocUnitId) {
this.edocUnitId = edocUnitId;
}
/**
* @return the edocDate
*/
public java.sql.Date getEdocDate() {
return edocDate;
}
/**
* @param edocDate the edocDate to set
*/
public void setEdocDate(java.sql.Date edocDate) {
this.edocDate = edocDate;
}
/**
* @return the registerUserId
*/
public Long getRegisterUserId() {
return registerUserId;
}
/**
* @param registerUserId the registerUserId to set
*/
public void setRegisterUserId(Long registerUserId) {
this.registerUserId = registerUserId;
}
/**
* @return the registerUserName
*/
public String getRegisterUserName() {
return registerUserName;
}
/**
* @param registerUserName the registerUserName to set
*/
public void setRegisterUserName(String registerUserName) {
this.registerUserName = registerUserName;
}
/**
* @return the registerDate
*/
public java.sql.Date getRegisterDate() {
return registerDate;
}
/**
* @param registerDate the registerDate to set
*/
public void setRegisterDate(java.sql.Date registerDate) {
this.registerDate = registerDate;
}
/**
* @return the signer
*/
public String getSigner() {
return signer;
}
/**
* @param signer the signer to set
*/
public void setSigner(String signer) {
this.signer = signer;
}
/**
* @return the issuer
*/
public String getIssuer() {
return issuer;
}
/**
* @param issuer the issuer to set
*/
public void setIssuer(String issuer) {
this.issuer = issuer;
}
/**
* @return the distributerId
*/
public Long getDistributerId() {
return distributerId;
}
/**
* @param distributerId the distributerId to set
*/
public void setDistributerId(Long distributerId) {
this.distributerId = distributerId;
}
/**
* @return the distributer
*/
public String getDistributer() {
return distributer;
}
/**
* @param distributer the distributer to set
*/
public void setDistributer(String distributer) {
this.distributer = distributer;
}
/**
* @return the subject
*/
public String getSubject() {
return subject;
}
/**
* @param subject the subject to set
*/
public void setSubject(String subject) {
this.subject = subject;
}
/**
* @return the docType
*/
public String getDocType() {
return docType;
}
/**
* @param docType the docType to set
*/
public void setDocType(String docType) {
this.docType = docType;
}
/**
* @return the sendType
*/
public String getSendType() {
return sendType;
}
/**
* @param sendType the sendType to set
*/
public void setSendType(String sendType) {
this.sendType = sendType;
}
/**
* @return the docMark
*/
public String getDocMark() {
return docMark;
}
/**
* @param docMark the docMark to set
*/
public void setDocMark(String docMark) {
this.docMark = docMark;
}
/**
* @return the serialNo
*/
public String getSerialNo() {
return serialNo;
}
/**
* @param serialNo the serialNo to set
*/
public void setSerialNo(String serialNo) {
this.serialNo = serialNo;
}
/**
* @return the secretLevel
*/
public String getSecretLevel() {
return secretLevel;
}
/**
* @param secretLevel the secretLevel to set
*/
public void setSecretLevel(String secretLevel) {
this.secretLevel = secretLevel;
}
/**
* @return the urgentLevel
*/
public String getUrgentLevel() {
return urgentLevel;
}
/**
* @param urgentLevel the urgentLevel to set
*/
public void setUrgentLevel(String urgentLevel) {
this.urgentLevel = urgentLevel;
}
/**
* @return the keepPeriod
*/
public String getKeepPeriod() {
return keepPeriod;
}
/**
* @param keepPeriod the keepPeriod to set
*/
public void setKeepPeriod(String keepPeriod) {
this.keepPeriod = keepPeriod;
}
/**
* @return the sendTo
*/
public String getSendTo() {
return sendTo;
}
/**
* @param sendTo the sendTo to set
*/
public void setSendTo(String sendTo) {
this.sendTo = sendTo;
}
/**
* @return the sendToId
*/
public String getSendToId() {
return sendToId;
}
/**
* @param sendToId the sendToId to set
*/
public void setSendToId(String sendToId) {
this.sendToId = sendToId;
}
/**
* @return the copyTo
*/
public String getCopyTo() {
return copyTo;
}
/**
* @param copyTo the copyTo to set
*/
public void setCopyTo(String copyTo) {
this.copyTo = copyTo;
}
/**
* @return the copyToId
*/
public String getCopyToId() {
return copyToId;
}
/**
* @param copyToId the copyToId to set
*/
public void setCopyToId(String copyToId) {
this.copyToId = copyToId;
}
/**
* @return the keywords
*/
public String getKeywords() {
return keywords;
}
/**
* @param keywords the keywords to set
*/
public void setKeywords(String keywords) {
this.keywords = keywords;
}
/**
* @return the noteAppend
*/
public String getNoteAppend() {
return noteAppend;
}
/**
* @param noteAppend the noteAppend to set
*/
public void setNoteAppend(String noteAppend) {
this.noteAppend = noteAppend;
}
/**
* @return the attNote
*/
public String getAttNote() {
return attNote;
}
/**
* @param attNote the attNote to set
*/
public void setAttNote(String attNote) {
this.attNote = attNote;
}
/**
* @return the state
*/
public Integer getState() {
return state;
}
/**
* @param state the state to set
*/
public void setState(Integer state) {
this.state = state;
}
/**
* @return the orgAccountId
*/
public Long getOrgAccountId() {
return orgAccountId;
}
/**
* @return the issuerId
*/
public Long getIssuerId() {
return issuerId;
}
/**
* @param issuerId the issuerId to set
*/
public void setIssuerId(Long issuerId) {
this.issuerId = issuerId;
}
/**
* @return the issueDate
*/
public java.sql.Date getIssueDate() {
return issueDate;
}
/**
* @param issueDate the issueDate to set
*/
public void setIssueDate(java.sql.Date issueDate) {
this.issueDate = issueDate;
}
public boolean isProxy() {
return proxy;
}
public void setProxy(boolean proxy) {
this.proxy = proxy;
}
public String getProxyName() {
return proxyName;
}
public void setProxyName(String proxyName) {
this.proxyName = proxyName;
}
/**
* @param orgAccountId the orgAccountId to set
*/
public void setOrgAccountId(Long orgAccountId) {
this.orgAccountId = orgAccountId;
}
/**
* @return the distributeDate
*/
public java.sql.Date getDistributeDate() {
return distributeDate;
}
/**
* @param distributeDate the distributeDate to set
*/
public void setDistributeDate(java.sql.Date distributeDate) {
this.distributeDate = distributeDate;
}
/**
* @return the distributeState
*/
public Integer getDistributeState() {
return distributeState;
}
/**
* @param distributeState the distributeState to set
*/
public void setDistributeState(Integer distributeState) {
this.distributeState = distributeState;
}
/**
* @return the attachmentList
*/
public List<Attachment> getAttachmentList() {
return attachmentList;
}
/**
* @param attachmentList the attachmentList to set
*/
public void setAttachmentList(List<Attachment> attachmentList) {
this.attachmentList = attachmentList;
}
/**
* @return the edocBodyList
*/
public RegisterBody getRegisterBody() {
return registerBody;
}
/**
* @param edocBody the edocBody to set
*/
public void setRegisterBody(RegisterBody registerBody) {
this.registerBody = registerBody;
}
public boolean getHasAttachments() {
return IdentifierUtil.lookupInner(identifier, EdocSummary.INENTIFIER_INDEX.HAS_ATTACHMENTS.ordinal(), '1');
}
public void setHasAttachments(boolean hasAttachments) {
this.hasAttachments = hasAttachments;
this.identifier = IdentifierUtil.update(this.getIdentifier(), EdocSummary.INENTIFIER_INDEX.HAS_ATTACHMENTS.ordinal(), hasAttachments ? '1' : '0');
}
public String getUnitLevel() {
return unitLevel;
}
public void setUnitLevel(String unitLevel) {
this.unitLevel = unitLevel;
}
public Integer getCopies() {
return copies;
}
public void setCopies(Integer copies) {
this.copies = copies;
}
public java.sql.Timestamp getExchangeSendTime() {
return exchangeSendTime;
}
public void setExchangeSendTime(java.sql.Timestamp exchangeSendTime) {
this.exchangeSendTime = exchangeSendTime;
}
public Integer getExchangeMode() {
return exchangeMode;
}
public void setExchangeMode(Integer exchangeMode) {
this.exchangeMode = exchangeMode;
}
}
| [
"[email protected]"
] | |
8d9306c98cc192619f7598065a9b04ce77a03ced | bbde3a6b002eac0381e71a4a33086ffc291e7e11 | /src/main/java/ESClient.java | 7425dda717e8677caa86a9a8cf59fb8981cce8e1 | [] | no_license | AlexanderNikolovAlexn/ElasticSearchExample | bd4af15c1e2fa2e2e2b286fb3d7130d255da07e6 | 231fe576b9fe508a00549c89b3a8b3fcb9c92bc5 | refs/heads/master | 2021-01-13T00:49:20.686916 | 2016-01-26T10:10:48 | 2016-01-26T10:10:48 | 50,112,455 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,792 | java | import com.google.gson.Gson;
import org.elasticsearch.action.admin.indices.create.CreateIndexRequest;
import org.elasticsearch.action.admin.indices.create.CreateIndexResponse;
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse;
import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsRequest;
import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsResponse;
import org.elasticsearch.action.bulk.BulkRequestBuilder;
import org.elasticsearch.action.bulk.BulkResponse;
import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.action.index.IndexResponse;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.action.search.SearchType;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.InetSocketTransportAddress;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.SearchHit;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
public class ESClient {
static final int BULKRECORDS = 1000;
private Client client;
private IndicesAdminClient adminClient;
public ESClient() {
this.client = null;
adminClient = null;
}
public ESClient(String hostName, int portNumber, String clusterName) {
try {
Settings settings = Settings.settingsBuilder()
.put("cluster.name", clusterName).build();
this.client = TransportClient.builder().settings(settings).build()
.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(hostName), portNumber));
adminClient = this.client.admin().indices();
}
catch (UnknownHostException e) {
e.printStackTrace();
}
}
public boolean indexExists(String indexName) {
IndicesExistsRequest request = new IndicesExistsRequest(indexName);
IndicesExistsResponse response = adminClient.prepareExists(indexName).execute().actionGet();
if (response.isExists()) {
return true;
}
return false;
}
public boolean deleteIndex(String indexName)
{
DeleteIndexRequest request = new DeleteIndexRequest(indexName);
try {
DeleteIndexResponse response = adminClient.delete(request).actionGet();
if (!response.isAcknowledged()) {
return false;
}
return true;
}
catch (org.elasticsearch.index.IndexNotFoundException e) {
return false;
}
}
public boolean createIndex(String indexName)
{
CreateIndexRequest request = new CreateIndexRequest(indexName);
CreateIndexResponse response = this.adminClient.create(request).actionGet();
if (!response.isAcknowledged()) {
return false;
}
return true;
}
public boolean addJSON(String indexName, String indexType, String docId, JsonInterface json) {
IndexRequest indexRequest = new IndexRequest(indexName, indexType, docId);
indexRequest.source(json.toJson());
IndexResponse response = client.index(indexRequest).actionGet();
return response.isCreated();
}
public long bulkInsert(String indexName, String indexType, List<JsonInterface> jsons) {
BulkRequestBuilder bulkBuilder = client.prepareBulk();
long insertedRecords = 0;
long failedRecords = 0;
long bulkRecords = 0;
String id = "";
for (int i = 0; i < jsons.size(); i++) {
JsonInterface json = jsons.get(i);
String s = json.toJson();
bulkBuilder.add(client.prepareIndex(indexName, indexType, String.valueOf(i)).setSource(s));
bulkRecords++;
if(bulkRecords == BULKRECORDS || i == jsons.size() - 1) {
BulkResponse bulkResponse = bulkBuilder.execute().actionGet();
if(bulkResponse.hasFailures()) {
failedRecords += bulkResponse.getItems().length;
}
insertedRecords += bulkRecords;
bulkRecords = 0;
bulkBuilder = client.prepareBulk();
}
}
return insertedRecords;
}
public List<JsonInterface> getJsonFilter(String indexName, String indexType, Map<String, String> filter) {
BoolQueryBuilder boolQuery = new BoolQueryBuilder();
for (Map.Entry<String, String> entry : filter.entrySet()){
boolQuery.must(QueryBuilders.matchPhrasePrefixQuery(entry.getKey(), entry.getValue().toLowerCase()));
}
SearchResponse response = client.prepareSearch(indexName)
.setTypes(indexType)
.setSearchType(SearchType.QUERY_AND_FETCH)
.setQuery(boolQuery)
.setFrom(0).setSize(60).setExplain(true)
.execute()
.actionGet();
List<JsonInterface> myFiles = new ArrayList<JsonInterface>();
SearchHit[] results = response.getHits().getHits();
for (SearchHit hit : results) {
System.out.println("------------------------------");
Map<String,Object> result = hit.getSource();
Gson gson = new Gson();
myFiles.add(gson.fromJson(hit.getSourceAsString(), MyFile.class));
}
return myFiles;
}
public List<JsonInterface> getJsonMatchAll(String indexName, String type) {
SearchResponse response = client.prepareSearch(indexName)
.setTypes(type)
.setSearchType(SearchType.QUERY_AND_FETCH)
.setQuery(matchAllQuery())
.setFrom(0).setSize(60).setExplain(true)
.execute()
.actionGet();
List<JsonInterface> myFiles = new ArrayList<JsonInterface>();
SearchHit[] results = response.getHits().getHits();
for (SearchHit hit : results) {
System.out.println("------------------------------");
Map<String,Object> result = hit.getSource();
System.out.println(result);
Gson gson = new Gson();
myFiles.add(gson.fromJson(hit.getSourceAsString(), MyFile.class));
}
return myFiles;
}
public Client getClient(){
return this.client;
}
}
| [
"[email protected]"
] | |
c19838e7018e22c3f1b74ef6f724fc02bc50b446 | 7f15c327d450f165dc7210fd224e58584175e611 | /src/main/java/clinic/programming/training/Application.java | dd38abc36bdefff8d14b6306a6eb6f1e02433824 | [
"Apache-2.0"
] | permissive | dkim-dev/maven | d35f26069af9a0e3e93f0c49339dbc8bd8bf0794 | e923f7ad63a2e535b8d4ae667e88d928c57da845 | refs/heads/master | 2022-11-15T13:42:23.192708 | 2020-07-19T03:47:30 | 2020-07-19T03:47:30 | 280,722,049 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 985 | java | package clinic.programming.training;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
public class Application {
public int countWords(String words) {
String[] separateWords = StringUtils.split(words, ' ');
return (separateWords == null) ? 0 : separateWords.length;
}
public void greet() {
List<String> greetings = new ArrayList<>();
greetings.add ("Hello");
for (String greeting : greetings) {
System.out.println("Greeting: " + greeting);
}
}
public Application() {
System.out.println ("Inside Application");
}
// method main(): ALWAYS the APPLICATION entry point
public static void main (String[] args) {
System.out.println ("Starting Application");
Application app = new Application();
app.greet();
int count = app.countWords("I have four words");
System.out.println("Word Count: " + count);
}
}
| [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.