blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 4 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 689M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 131 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 32 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 313 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0657afb79ee016cfb7aa737f6b6cef7f8daeae72 | 18fb91674a368a606befa427f98ce8916f35e97c | /src/tp_plasse/Marcolivier.java | 5896187a7cf3c4068c4bc3b57ce616b977285a4b | [] | no_license | eliyoel/tp_plasse | e83a1f664a5474c9579cddd2579b07c87014b1b6 | aec272b52f8007c8c4a587e623106a4eb594422b | refs/heads/master | 2020-06-05T07:49:47.453636 | 2015-05-04T14:28:22 | 2015-05-04T14:28:22 | 33,867,783 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 279 | 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 tp_plasse;
/**
*
* @author MOS
*/
public class Marcolivier {
}
| [
"MOS@MOS-PC"
] | MOS@MOS-PC |
81ca8e67faf5745eb1bfa04812358fc624be92ef | 32400d21c8bbdc813e2c975016f2d6ee205b7f3e | /src/main/java/ltg/evl/uic/poster/json/mongo/UserLoadEvent.java | 6f610f08ec034c26f582bb8f4c24ef270ebcdaa7 | [] | no_license | ltg-uic/processing-poster-client | bfb10d16db8bc62a748c4ba99171fa00308571cf | 0a64457eecfec507c5ec2d9317c60c05e9c0576c | refs/heads/master | 2021-01-20T00:57:09.184573 | 2015-06-03T19:27:07 | 2015-06-03T19:27:07 | 22,769,326 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 536 | java | package ltg.evl.uic.poster.json.mongo;
import com.google.common.eventbus.Subscribe;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
/**
* Created by aperritano on 3/30/15.
*/
public class UserLoadEvent {
private final Logger logger = org.apache.log4j.Logger.getLogger(this.getClass());
public UserLoadEvent() {
logger.setLevel(Level.ALL);
}
@Subscribe
public void handleUserLoadEvent(String userUuid) {
logger.log(Level.INFO, "user event with user uuid: " + userUuid);
}
}
| [
"aperritano@gmail.com"
] | aperritano@gmail.com |
d07768983e713fd55d7ea5341fbf292bae3f7f5e | 8b2efc6cc4ad04ee0e3da7f20cf143f1a1ecb421 | /src/haikugeneration/GenerationAlgorithm.java | 87df22a53fe69acbda669025f53b4e985ff3ca62 | [] | no_license | Shegs-dev/HaikuGeneration | 94b3d5066b97769000cdf06431b1875f59c485f7 | 812bf53a8a26beaac612da140ca084ef33738cac | refs/heads/master | 2023-04-18T04:08:54.747003 | 2021-05-08T00:41:57 | 2021-05-08T00:41:57 | 365,385,008 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,977 | 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 haikugeneration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
*
* @author OluwasegunAjayi
*/
public class GenerationAlgorithm {
//Method to fetch the haiku set
public Haiku generateHaiku(HashMap<String, Haiku> haikus, HashMap<String, LastWords> lastWords, HashMap<String, HashMap<String, String>> synonyms, String firstPhrase, String lastWord){
String predPhrase = "";
//Looking through the list of lastwords to match lastword
if(lastWords.containsKey(lastWord)){
String retValue = this.search(lastWords, firstPhrase, lastWord);
if(retValue == null) predPhrase = "This haiku could not be generated from our dataset";
else predPhrase = retValue;
}else{//if the last word is not found in the list
//We fetch the list of synonyms of the last word
HashMap<String, String> syns = this.getSynonyms(synonyms, lastWord);
if(syns != null){
for (Map.Entry<String, String> syn : syns.entrySet()) {
String newFirstPhrase = firstPhrase.replace(lastWord, syn.getKey());
String retValue = this.search(lastWords, newFirstPhrase, syn.getKey());
if (retValue != null) {
predPhrase = retValue;
break;
}
}
}
if(predPhrase.isEmpty()) predPhrase = "This haiku could not be generated from our dataset";
}
if(predPhrase.equalsIgnoreCase("This haiku could not be generated from our dataset")) return new Haiku();
else{
Haiku retHaiku = haikus.get(predPhrase);
retHaiku.getHaikuSet()[0] = firstPhrase;
return retHaiku;
}
}
//This method fetches the synonyms
public HashMap<String, String> getSynonyms(HashMap<String, HashMap<String, String>> synonyms, String word){
if(synonyms.containsKey(word)){
return synonyms.get(word);
}else{
for(Map.Entry<String, HashMap<String, String>> synonym : synonyms.entrySet()){
if(synonym.getValue().containsKey(word)){
return synonym.getValue();
}
}
}
return null;
}
//This method finds the first part of the haiku
public String search(HashMap<String, LastWords> lastWords, String firstPhrase, String lastWord){
//Looking through the list of lastwords to match lastword
if(lastWords.containsKey(lastWord)){
List<String> possiblePhrases = lastWords.get(lastWord).getPhrases();
String foundPhrase = "";
int min = Integer.MAX_VALUE;
String hypotheticPhrase = "";//this is to keep track of a phrase that is closest to the searched one if not found
//Compare for the one with the exact phrase as the search phrase
for(String phrase : possiblePhrases){
int value = firstPhrase.compareToIgnoreCase(phrase);
if(value == 0){
foundPhrase = phrase;//found the exact first 5-syllable haiku
break;
}else{//finding something close
if(min > Math.abs(value)){
min = value;
hypotheticPhrase = phrase;
}
}
}
if(!foundPhrase.isEmpty()) return foundPhrase;
else return hypotheticPhrase;
}else{//if the last word is not found in the list
return null;//We cannot find match in our haiku set
}
}
}
| [
"segun.ajayi@stanbicibtc.com"
] | segun.ajayi@stanbicibtc.com |
2011831c6ff764de8532b41f61df514d7c0405b1 | 25d88226016ed1deb7134a05682529f81345fd07 | /tensquare_user/src/main/java/com/tensquare/user/config/WebSecurityConfig.java | 7c53af506e9e741b65d02d8c412bcb7d9d97b410 | [] | no_license | E-10000/tensquare_public_code | 006b9dffa6eea00e109582c3cb4dc1e0d61af1a2 | ee95da631277eb6e2afd1af6c18443a16c09bbd0 | refs/heads/master | 2023-03-08T01:32:33.744786 | 2021-02-19T05:20:13 | 2021-02-19T05:20:13 | 340,266,211 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 993 | java | package com.tensquare.user.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
//这个必写
.authorizeRequests()
//所有请求路径都运行
.antMatchers("/**").permitAll()
//所有请求都要经过验证
.anyRequest().authenticated()
//降低安全级别
.and().csrf().disable();
}
}
| [
"742891270@qq.com"
] | 742891270@qq.com |
493a28f8436774849531fdc2d075092a04d1f185 | f3e5cd5a76d4827462e6d47816d6f51fb899b343 | /src/main/java/com/eventecommerce/config/LoggingAspectConfiguration.java | 4c2e2439368b156f45c601899a062af6ce6bd443 | [] | no_license | fredze/Events | 3dc828ac8aaad6a90278407bc98509659789f205 | bec010875d7632ac32d28935dcca43a50fbe48fc | refs/heads/master | 2020-03-28T12:16:09.136144 | 2018-09-12T14:22:00 | 2018-09-12T14:22:00 | 148,283,505 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 498 | java | package com.eventecommerce.config;
import com.eventecommerce.aop.logging.LoggingAspect;
import io.github.jhipster.config.JHipsterConstants;
import org.springframework.context.annotation.*;
import org.springframework.core.env.Environment;
@Configuration
@EnableAspectJAutoProxy
public class LoggingAspectConfiguration {
@Bean
@Profile(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT)
public LoggingAspect loggingAspect(Environment env) {
return new LoggingAspect(env);
}
}
| [
"me@mokhtarmial.com"
] | me@mokhtarmial.com |
45b22958263c896201028b23e64c500a68947e84 | 3acfb6df11412013c50520e812b2183e07c1a8e5 | /investharyana/src/main/java/com/hartron/investharyana/service/impl/Emmision_fuel_typeServiceImpl.java | 24a655646904e8d2d010227ac8739ff6f73fc19a | [] | no_license | ramanrai1981/investharyana | ad2e5b1d622564a23930d578b25155d5cc9ec97a | b8f359c120f6dae456ec0490156cf34fd0125a30 | refs/heads/master | 2021-01-19T08:29:32.042236 | 2017-04-14T18:34:50 | 2017-04-14T18:34:50 | 87,635,613 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,387 | java | package com.hartron.investharyana.service.impl;
import com.hartron.investharyana.service.Emmision_fuel_typeService;
import com.hartron.investharyana.domain.Emmision_fuel_type;
import com.hartron.investharyana.repository.Emmision_fuel_typeRepository;
import com.hartron.investharyana.service.dto.Emmision_fuel_typeDTO;
import com.hartron.investharyana.service.mapper.Emmision_fuel_typeMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import java.util.LinkedList;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
/**
* Service Implementation for managing Emmision_fuel_type.
*/
@Service
public class Emmision_fuel_typeServiceImpl implements Emmision_fuel_typeService{
private final Logger log = LoggerFactory.getLogger(Emmision_fuel_typeServiceImpl.class);
private final Emmision_fuel_typeRepository emmision_fuel_typeRepository;
private final Emmision_fuel_typeMapper emmision_fuel_typeMapper;
public Emmision_fuel_typeServiceImpl(Emmision_fuel_typeRepository emmision_fuel_typeRepository, Emmision_fuel_typeMapper emmision_fuel_typeMapper) {
this.emmision_fuel_typeRepository = emmision_fuel_typeRepository;
this.emmision_fuel_typeMapper = emmision_fuel_typeMapper;
}
/**
* Save a emmision_fuel_type.
*
* @param emmision_fuel_typeDTO the entity to save
* @return the persisted entity
*/
@Override
public Emmision_fuel_typeDTO save(Emmision_fuel_typeDTO emmision_fuel_typeDTO) {
log.debug("Request to save Emmision_fuel_type : {}", emmision_fuel_typeDTO);
Emmision_fuel_type emmision_fuel_type = emmision_fuel_typeMapper.emmision_fuel_typeDTOToEmmision_fuel_type(emmision_fuel_typeDTO);
emmision_fuel_type = emmision_fuel_typeRepository.save(emmision_fuel_type);
Emmision_fuel_typeDTO result = emmision_fuel_typeMapper.emmision_fuel_typeToEmmision_fuel_typeDTO(emmision_fuel_type);
return result;
}
/**
* Get all the emmision_fuel_types.
*
* @return the list of entities
*/
@Override
public List<Emmision_fuel_typeDTO> findAll() {
log.debug("Request to get all Emmision_fuel_types");
List<Emmision_fuel_typeDTO> result = emmision_fuel_typeRepository.findAll().stream()
.map(emmision_fuel_typeMapper::emmision_fuel_typeToEmmision_fuel_typeDTO)
.collect(Collectors.toCollection(LinkedList::new));
return result;
}
/**
* Get one emmision_fuel_type by id.
*
* @param id the id of the entity
* @return the entity
*/
@Override
public Emmision_fuel_typeDTO findOne(String id) {
log.debug("Request to get Emmision_fuel_type : {}", id);
Emmision_fuel_type emmision_fuel_type = emmision_fuel_typeRepository.findOne(UUID.fromString(id));
Emmision_fuel_typeDTO emmision_fuel_typeDTO = emmision_fuel_typeMapper.emmision_fuel_typeToEmmision_fuel_typeDTO(emmision_fuel_type);
return emmision_fuel_typeDTO;
}
/**
* Delete the emmision_fuel_type by id.
*
* @param id the id of the entity
*/
@Override
public void delete(String id) {
log.debug("Request to delete Emmision_fuel_type : {}", id);
emmision_fuel_typeRepository.delete(UUID.fromString(id));
}
}
| [
"raman.kumar.rai@gmail.com"
] | raman.kumar.rai@gmail.com |
bcc784c9342367b2fc3bd953d95cdd70d2175cb9 | 1ccfab9773c49adc3ed9f4f76436fd25b164181f | /SapientTest/src/com/sourav/mock/Thread/CDLCustom.java | fd9fbaade52a0721a2a0a0bc19154a607482de9d | [] | no_license | TechSourav/Core-Java | 8fd1706cf18234f3f50cc6ec7d54ed246bf4fb1e | 943a40ec0e41e55bc0143aa8fbe9ee95b9d13548 | refs/heads/master | 2021-01-24T07:06:47.296543 | 2018-07-31T05:11:39 | 2018-07-31T05:11:39 | 93,332,192 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 938 | java | package com.sourav.mock.Thread;
public class CDLCustom {
private int count;
CDLCustom(int cnt){
this.count=cnt;
}
public synchronized void await() throws InterruptedException{
if(count>0){
this.wait();
}
}
public synchronized void countDown(){
count--;
if(count==0){
this.notifyAll();
}
}
}
class CDLCustomTest{
public static void main(String[] args) throws InterruptedException{
CDLCustom latch = new CDLCustom(3);
MyLatch ml = new MyLatch(latch);
System.out.println("Going to call countdpwn latch");
ml.start();
latch.await();
System.out.println("latch opened");
}
}
class MyLatch extends Thread{
CDLCustom cdl;
MyLatch(CDLCustom l){
this.cdl=l;
}
public void run(){
for(int i=0;i<4;i++){
System.out.println("Thread - "+ i);
cdl.countDown();
}
}
}
| [
"Sourav Kundu@Sourav-PC"
] | Sourav Kundu@Sourav-PC |
724960ac6fe4ac3db24acbcbacec91d722b04114 | 50fd732ce5849e4eccf4800a58e4ccaae221d2b5 | /language/pt.fct.unl.novalincs.useme.model.tests/src/pt/fct/unl/novalincs/useme/model/Utility/tests/UtilityTests.java | f442ee307d9c520f273db18beed2faa13fb46b99 | [] | no_license | akki55/useme | ed968437ef541471720a0168cc1e50c5944339fe | 5b1b13c02e82603c1420d12dd6ef54c7d5350951 | refs/heads/master | 2021-01-11T20:24:18.273786 | 2017-08-23T14:29:09 | 2017-08-23T14:29:09 | 79,108,510 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 829 | java | /**
*/
package pt.fct.unl.novalincs.useme.model.Utility.tests;
import junit.framework.Test;
import junit.framework.TestSuite;
import junit.textui.TestRunner;
/**
* <!-- begin-user-doc -->
* A test suite for the '<em><b>Utility</b></em>' package.
* <!-- end-user-doc -->
* @generated
*/
public class UtilityTests extends TestSuite {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static void main(String[] args) {
TestRunner.run(suite());
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static Test suite() {
TestSuite suite = new UtilityTests("Utility Tests");
return suite;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public UtilityTests(String name) {
super(name);
}
} //UtilityTests
| [
"sararosa@10-22-105-191.ed2.eduroam.fct.unl.pt"
] | sararosa@10-22-105-191.ed2.eduroam.fct.unl.pt |
3b80845522b75f1aa1902882ed0e12714255e564 | f98358466f111bc3c54bb83728dfa2ff56112397 | /service/src/main/java/com/wedgwoodtom/contest/ui/bestpractices/VaadinbestpracticesUI.java | a51a24e026796214451d63baeff717ac3aadf903 | [] | no_license | wedgwoodtom/wedgwoodtom-contest | 0dfd7f6c3fa88a5aa7ce0117d4df8aa05fc06443 | edd8c50672768ae21da47fba56596f2e5d8855ca | refs/heads/master | 2021-01-12T16:16:06.946182 | 2016-12-06T03:44:26 | 2016-12-06T03:44:26 | 71,968,036 | 0 | 0 | null | 2016-11-24T01:09:23 | 2016-10-26T05:02:09 | Java | UTF-8 | Java | false | false | 4,842 | java | package com.wedgwoodtom.contest.ui.bestpractices;
import javax.servlet.annotation.WebServlet;
import com.vaadin.annotations.Theme;
import com.vaadin.annotations.VaadinServletConfiguration;
import com.vaadin.navigator.Navigator;
import com.vaadin.server.FontAwesome;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinServlet;
import com.vaadin.spring.annotation.SpringUI;
import com.vaadin.ui.MenuBar;
import com.vaadin.ui.MenuBar.Command;
import com.vaadin.ui.MenuBar.MenuItem;
import com.vaadin.ui.Panel;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;
import com.wedgwoodtom.contest.ui.explore.LoginView;
//@SuppressWarnings("serial")
//@Theme("vaadinbestpractices")
//@SpringUI
@Theme("valo")
public class VaadinbestpracticesUI extends UI
{
public Navigator navigator;
// public static BeanContainer<String, DataBean> dataBean;
// @WebServlet(value = "/*", asyncSupported = true)
// @VaadinServletConfiguration(productionMode = false, ui = VaadinbestpracticesUI.class, widgetset = "com.example.vaadinbestpractices.widgetset.VaadinbestpracticesWidgetset")
// public static class Servlet extends VaadinServlet {
// }
// @Override
// protected void init(VaadinRequest request)
// {
// final VerticalLayout layout = new VerticalLayout();
// layout.setMargin(true);
// layout.setSpacing(true);
// setContent(layout);
// Navigator.ComponentContainerViewDisplay viewDisplay = new Navigator.ComponentContainerViewDisplay(layout);
// navigator = new Navigator(UI.getCurrent(), viewDisplay);
// navigator.addView("", new LoginView());
// navigator.addView(MAINVIEW, new MainView());
// navigator.addView(HELPVIEW, new HelpView());
// }
@Override
protected void init(VaadinRequest request)
{
final VerticalLayout layout = new VerticalLayout();
layout.setMargin(true);
setContent(layout);
Panel contentPanel = new Panel("Main Panel");
// contentPanel.setSizeUndefined();
contentPanel.setSizeFull();
// dataBean = new BeanContainer<String, DataBean>(DataBean.class);
// dataBean.setBeanIdProperty("name");
/*
Navigator.ComponentContainerViewDisplay viewDisplay = new Navigator.ComponentContainerViewDisplay(layout);
navigator = new Navigator(UI.getCurrent(), viewDisplay);
navigator.addView("", new LoginView());
navigator.addView(MAINVIEW, new MainView());
navigator.addView(HELPVIEW, new HelpView());
*/
// Navigator.ComponentContainerViewDisplay viewDisplay = new Navigator.ComponentContainerViewDisplay(layout);
// navigator = new Navigator(UI.getCurrent(), viewDisplay);
navigator = new Navigator(this, contentPanel);
navigator.addView(InputPage.NAME, InputPage.class);
navigator.addView(WelcomePage.NAME, WelcomePage.class);
navigator.addView(DataPage.NAME, DataPage.class);
MenuBar.Command welcome = new Command()
{
@Override
public void menuSelected(MenuItem selectedItem)
{
navigator.navigateTo(WelcomePage.NAME);
}
};
MenuBar.Command input = new Command()
{
@Override
public void menuSelected(MenuItem selectedItem)
{
navigator.navigateTo(InputPage.NAME);
}
};
MenuBar.Command data = new Command()
{
@Override
public void menuSelected(MenuItem selectedItem)
{
navigator.navigateTo(DataPage.NAME);
}
};
MenuBar mainMenu = new MenuBar();
mainMenu.addItem("Welcome", FontAwesome.ARROW_CIRCLE_LEFT, welcome);
mainMenu.addItem("Input", FontAwesome.WEIXIN, input);
mainMenu.addItem("Data", FontAwesome.LIST, data);
layout.addComponent(mainMenu);
layout.addComponent(contentPanel);
navigator.navigateTo(WelcomePage.NAME);
}
}
/*
@SpringUI
@Theme("valo")
public class ExploreVUI extends UI
{
public Navigator navigator;
public static final String MAINVIEW = "main";
public static final String HELPVIEW = "help";
@Override
protected void init(VaadinRequest request)
{
final VerticalLayout layout = new VerticalLayout();
layout.setMargin(true);
layout.setSpacing(true);
setContent(layout);
Navigator.ComponentContainerViewDisplay viewDisplay = new Navigator.ComponentContainerViewDisplay(layout);
navigator = new Navigator(UI.getCurrent(), viewDisplay);
navigator.addView("", new LoginView());
navigator.addView(MAINVIEW, new MainView());
navigator.addView(HELPVIEW, new HelpView());
}
}
*/ | [
"wedgwood.tom@gmail.com"
] | wedgwood.tom@gmail.com |
5eb4fae8ef93d44ec5967b61596341d3566887fa | e4c37434e1f6c61f9b5181c3898d9e575beba263 | /读取联系人/src/com/l/contants/MainActivity.java | d79cd56d291892ed1870c28c36bb121cff35b55c | [] | no_license | ultramanggg/android | ed41b282efc7f9d666e30539bd190703039240a2 | 1b296f19e3e9b2c62c67f6b68ec9f6f4099564b9 | refs/heads/master | 2021-04-09T10:44:03.228460 | 2018-05-27T03:10:16 | 2018-05-27T03:10:16 | 125,522,653 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,229 | java | package com.l.contants;
import java.util.ArrayList;
import java.util.HashMap;
import android.net.Uri;
import android.os.Bundle;
import android.app.Activity;
import android.database.Cursor;
import android.database.DataSetObserver;
import android.view.Menu;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Adapter;
import android.widget.BaseAdapter;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;
public class MainActivity extends Activity {
private ListView lvList;
String pNum="";
String pName="";
private ArrayList<HashMap<String,String>> contactList;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
lvList = (ListView) findViewById(R.id.lv_list);
contactList = readContact();
lvList.setAdapter(new Myadapter());
}
/**
* 读取联系人的方法
* @return 保存有联系人信息的list
*/
private ArrayList<HashMap<String, String>> readContact() {
// 从raw_contact表中读取联系人id,然后从data表中读出名称和电话号,同时读取menitype_id。
// 跟据mimetype_id,确定类型。(是联系人还是电话号码)
ArrayList<HashMap<String, String>> cantactList =new ArrayList<HashMap<String,String>>();
Uri rawContactsUri = Uri
.parse("content://com.android.contacts/raw_contacts");
Uri dataUri = Uri.parse("content://com.android.contacts/data");
Cursor rawContactCursor = getContentResolver().query(rawContactsUri,new String[] { "contact_id" }, null, null, null);
if (rawContactCursor != null) {
while (rawContactCursor.moveToNext()) {
HashMap<String, String> contact=new HashMap<String, String>();
String contactId = rawContactCursor.getString(0);
Cursor dataCursor = getContentResolver().query(dataUri,new String[] { "data1", "mimetype" }, "contact_id=?",
new String[] { contactId }, null);
while(dataCursor.moveToNext()){
String data=dataCursor.getString(0);
String type=dataCursor.getString(1);
if(type.equals("vnd.android.cursor.item/phone_v2")){
contact.put("phone", data);
}else if(type.equals("vnd.android.cursor.item/name")){
contact.put("name", data);
}
}
cantactList.add(contact);
dataCursor.close();
}
rawContactCursor.close();
}
return cantactList;
}
public class Myadapter extends BaseAdapter {
View view = null;
@Override
public int getCount() {
return contactList.size();
}
@Override
public Object getItem(int position) {
return position;
}
@Override
public long getItemId(int position) {
return position;
}
int x = 0;
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
view = View.inflate(MainActivity.this, R.layout.contact_item, null);
x = x + 1;
} else {
view = convertView;
}
TextView tv = (TextView) view.findViewById(R.id.t);
tv.setText(contactList.get(position).get("name")+":"+contactList.get(position).get("phone"));
return view;
}
}
}
| [
"noreply@github.com"
] | ultramanggg.noreply@github.com |
2cff78be22c8beb314c6e3aebd2500a0b37aa4ac | d02b2f2c83393f12e59ed141d17f0c11fa085ade | /app/src/main/java/com/example/enda/flickadvisor/services/UserRealmService.java | 06f98803d03e261d0652610b3029919c66c673f0 | [] | no_license | flickadvisor/flickadvisor | 4c495fe35e6218c32600ae2374a617ab7cdb082a | 215d160c65f7a0fe878ce8d93bb564c0c3e98b3c | refs/heads/master | 2021-01-01T05:16:36.637957 | 2016-03-31T14:27:51 | 2016-03-31T14:27:51 | 59,679,751 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,451 | java | package com.example.enda.flickadvisor.services;
import com.example.enda.flickadvisor.models.User;
import io.realm.Realm;
/**
* Created by enda on 18/02/16.
*/
public class UserRealmService {
private static final Realm realm = Realm.getDefaultInstance();
public static void saveUser(User user) {
if (getUserWithId(user.getId()) != null) {
User old = getUserWithId(user.getId());
removeUser(old);
}
realm.beginTransaction();
realm.copyToRealm(user);
realm.commitTransaction();
}
public static User getCurrentUser() {
User user = realm.where(User.class)
.findFirst();
return user == null ? null : user;
}
private static void removeUser(User user) {
realm.beginTransaction();
user.removeFromRealm();
realm.commitTransaction();
}
private static User getUserWithId(Long id) {
User user = realm.where(User.class)
.equalTo("id", id)
.findFirst();
return user == null ? null : user;
}
public static boolean isLoggedIn() {
User user = realm.where(User.class)
.findFirst();
return user != null;
}
public static void logout() {
realm.beginTransaction();
User user = realm.where(User.class)
.findFirst();
user.removeFromRealm();
realm.commitTransaction();
}
}
| [
"endaphelan1993@gmail.com"
] | endaphelan1993@gmail.com |
87c3ee04ea210b5f6219575043402e00fac961f2 | 44a3e692bd87c72a26c6f259d321cafea75455e5 | /2017 itwill final project/스프링/fooddk/.svn/pristine/79/798104ecfcb04cc7d8149ee02f0159cb00964712.svn-base | 77d7f874ab1fbb60801440ac5b881febacac3196 | [] | no_license | HwangSeonHo/Portfolio | bcfcd3fd5f65c531fc2f7185f3a391f779797f34 | 8748be524021087181efbae392a329639b792298 | refs/heads/master | 2022-12-25T06:49:20.995981 | 2019-07-29T05:52:21 | 2019-07-29T05:52:21 | 125,601,600 | 0 | 1 | null | 2022-12-16T02:02:31 | 2018-03-17T06:02:46 | Java | UTF-8 | Java | false | false | 686 | package fooddk.controller.etc;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import fooddk.domain.Developer;
import fooddk.service.developer.DeveloperService;
@Controller
public class IntroduceController {
public IntroduceController() {
// TODO Auto-generated constructor stub
System.out.println("아두이노짜징맨");
}
@RequestMapping(value = "/introduce")
public String introduce() {
return "introduce";
}
} | [
"heavenglow@naver.com"
] | heavenglow@naver.com | |
48ca3af6280bdd03d437ec1f0f8e8955f69ec258 | 5cf555b491a48dc029b9a2496aa2e8cd1e7a81d9 | /src/es/upm/dit/adsw/trenes/ejemplos/tunel/MonitorTunel_3.java | eb1a4b6a566bd4f458c71b03cfe940052329c68f | [] | no_license | jmanas/trenes | e69d458936cc737bdd719a48280b4bbc373ebc55 | eaf9a47d0920e1acb4d6befa24e0cc6f66d9c254 | refs/heads/master | 2021-01-23T01:34:09.533357 | 2017-03-23T07:04:13 | 2017-03-23T07:04:13 | 85,918,084 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,436 | java | package es.upm.dit.adsw.trenes.ejemplos.tunel;
import es.upm.dit.adsw.trenes.Enlace;
import es.upm.dit.adsw.trenes.Monitor;
import es.upm.dit.adsw.trenes.Tren;
import es.upm.dit.adsw.trenes.tramos.Tramo;
/**
* Ejercicio 3
* - se permiten N trenes dentro en la misma direccion.
*
* @author Jose A. Manas
* @version 4.12.2015
*/
public class MonitorTunel_3
extends Monitor {
private int ocupado12 = 0;
private int ocupado21 = 0;
public synchronized void entro(int tag, Tren tren, Tramo tramo, Enlace entrada) {
switch (tag) {
case 1:
while (ocupado21 > 0)
waiting();
ocupado12++;
break;
case 2:
while (ocupado12 > 0)
waiting();
ocupado21++;
break;
}
}
public synchronized void salgo(int tag, Tren tren, Tramo tramo, Enlace salida) {
switch (tag) {
case 1:
ocupado12--;
break;
case 2:
ocupado21--;
break;
}
notifyAll();
}
/**
* Metodo auxiliar.
* Hace que la espera no sea interrumplible.
* Sintacticamente queda más simple, aunque es menos general.
*/
private void waiting() {
try {
wait();
} catch (InterruptedException ignored) {
}
}
}
| [
"jmanas@dit.upm.es"
] | jmanas@dit.upm.es |
82f9bc256635876e921b3c39478af42e77bf549e | bb1320769322c23e3d897d2307b315e5023ba0e0 | /Slent_summer_system/src/com/data/sale/SaleManager.java | 67549121aff0ef73b32487c5f87d9ff9afa30c5d | [] | no_license | a260749110/slent_summer_system | ec69b698750c6e476c20f2c57829b32c29f683a4 | d6f20a09b021f986ed68711cbf60ddd89255b116 | refs/heads/master | 2021-01-11T05:45:04.060991 | 2016-11-09T10:46:04 | 2016-11-09T10:46:04 | 71,382,635 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,868 | java | package com.data.sale;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.session.SqlSession;
import com.data.DataHelper;
import com.sql.MyBatisManager;
import com.sql.mapper.TSilemtSummerSellInfoMapper;
import com.sql.mapperBean.TMenuLine;
import com.sql.mapperBean.TSilemtSummerSellInfo;
import com.sql.mapperBean.TSilemtSummerSellInfoExample;
public class SaleManager {
public static SaleManager instance=new SaleManager();
private SaleManager()
{}
public Map<Long, SaleData> getSaleInfo( int landId)
{
SqlSession session=MyBatisManager.instance.getSession();
TSilemtSummerSellInfoMapper mapper=session.getMapper(TSilemtSummerSellInfoMapper.class);
TSilemtSummerSellInfoExample example =new TSilemtSummerSellInfoExample();
example.createCriteria().andUserIdEqualTo(landId);
List<TSilemtSummerSellInfo> infos=mapper.selectByExample(example);
Map<Integer, TMenuLine> lineMap=DataHelper.instance.getLineMap();
SaleData cutOffSeal=new SaleData();
cutOffSeal.payId=-3;
cutOffSeal.saleType="折扣金额";
Map<Long, SaleData> map=new HashMap<>();
map.put(cutOffSeal.payId, cutOffSeal);
if(infos!=null)
{
for(TSilemtSummerSellInfo info:infos)
{
if(info.getDeleteFlag())
continue;
TMenuLine line=lineMap.get(info.getSellId());
if(line!=null)
{
if(line.getnPrice()>info.getMoneyTrue())
{
cutOffSeal.money+=line.getnPrice()-info.getMoneyTrue();
}
}
SaleData data=map.get((long)info.getPayType());
if(data==null)
{
data=new SaleData();
data.money=0;
data.payId=info.getPayType();
data.saleType=info.getPayName();
map.put((long)data.payId, data);
}
data.money+=info.getMoneyTrue();
}
}
session.close();
return map;
}
}
| [
"lfy@DESKTOP-E4DICNK"
] | lfy@DESKTOP-E4DICNK |
df4e22dd446e483bc4b20046e1736038e0ee3f38 | 3729763ddb479b21c7f3a5f1e0a9954500850b52 | /Sources/com/workday/sources/SkillQualificationReplacementType.java | 6b5888e71fe02fe4b9f04c373f21c036fe1a0a12 | [] | no_license | SANDEEPERUMALLA/workdayscanner | fe0816e9a95de73a598d6e29be5b20aeeca6cb60 | 8a4c3660cc588402aa49f948afe2168c4faa9df5 | refs/heads/master | 2020-03-18T22:30:21.218489 | 2018-05-29T20:24:36 | 2018-05-29T20:24:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,308 | java |
package com.workday.sources;
import java.util.ArrayList;
import java.util.List;
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.XmlType;
/**
* Wrapper element for Skill Qualifications. Allows all Skill Qualifications for a Job Profile or Position Restriction to be removed - or to replace all existing Skill Qualifications with those sent in the web service.
*
* <p>Java class for Skill_Qualification_ReplacementType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="Skill_Qualification_ReplacementType">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="Skill_Qualification_Replacement_Data" type="{urn:com.workday/bsvc}Skill_Qualification_Profile_Replacement_DataType" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* <attribute name="Delete" type="{http://www.w3.org/2001/XMLSchema}boolean" />
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Skill_Qualification_ReplacementType", propOrder = {
"skillQualificationReplacementData"
})
public class SkillQualificationReplacementType {
@XmlElement(name = "Skill_Qualification_Replacement_Data")
protected List<SkillQualificationProfileReplacementDataType> skillQualificationReplacementData;
@XmlAttribute(name = "Delete", namespace = "urn:com.workday/bsvc")
protected Boolean delete;
/**
* Gets the value of the skillQualificationReplacementData property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the skillQualificationReplacementData property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getSkillQualificationReplacementData().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link SkillQualificationProfileReplacementDataType }
*
*
*/
public List<SkillQualificationProfileReplacementDataType> getSkillQualificationReplacementData() {
if (skillQualificationReplacementData == null) {
skillQualificationReplacementData = new ArrayList<SkillQualificationProfileReplacementDataType>();
}
return this.skillQualificationReplacementData;
}
/**
* Gets the value of the delete property.
*
* @return
* possible object is
* {@link Boolean }
*
*/
public Boolean isDelete() {
return delete;
}
/**
* Sets the value of the delete property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setDelete(Boolean value) {
this.delete = value;
}
}
| [
"p.sandeepkumargupta@gmail.com"
] | p.sandeepkumargupta@gmail.com |
967c7cf857a0dfeb6ec1d24933940f35148fbee7 | e421de86d06416dc536e37c1ad772b9b588e3523 | /app/src/main/java/com/shehabsalah/bakingapp/api/UriBuilder.java | ccd9e4b4e3a780ff85c794784dc2f7085eead05c | [] | no_license | ShehabSalah/BakingApp | c344cd07d23150d0fe0282833afbc508ec4ac013 | 5f42a6143cb96de9aeee4fa5700a9fbd815bbc2c | refs/heads/master | 2020-07-13T05:52:05.926224 | 2017-08-05T23:02:34 | 2017-08-05T23:02:34 | 94,293,678 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,762 | java | package com.shehabsalah.bakingapp.api;
import android.net.Uri;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
/**
* Created by ShehabSalah on 6/7/17.
* This Class responsible on build the url's with it's parameters and values
*/
public class UriBuilder {
// The url scheme : http:// or https://
private String SCHEME;
// The main path that contain the apis pages
private String BASE_URL;
// The page that the application will communicate with
private String PAGE_URL;
// List of all url parameters
private ArrayList<String> PARAMS = new ArrayList<>();
// List of all url values
private ArrayList<String> VALUES = new ArrayList<>();
// List of parameters and values: using only in POST requests
private Map<String, String> map;
/**
* UriBuilder initialize GET variables
* @param SCHEME the url scheme as string.
* @param BASE_URL the main path that contain the apis pages.
* @param PAGE_URL the page that the application will communicate with.
* */
public UriBuilder(String SCHEME, String BASE_URL, String PAGE_URL) {
this.SCHEME = SCHEME;
this.BASE_URL = BASE_URL;
this.PAGE_URL = PAGE_URL;
}
/**
* UriBuilder initialize POST variable with new object of HashMap.
* */
public UriBuilder(){
map = new HashMap<>();
}
/**
* setParam responsible on add sequence of the url params as strings to PARAMS ArrayList.
* @param params sequence of the url params.
* */
public void setParam(String... params){
if (params.length > 0){
Collections.addAll(PARAMS, params);
}
}
/**
* setValues responsible on add sequence of the url values as strings to VALUES ArrayList
* @param values sequence of the url values
* */
public void setValues(String... values){
if (values.length > 0){
Collections.addAll(VALUES, values);
}
}
/**
* getURL responsible on building the uri's using the PARAMS ArrayList and VALUES ArrayList with
* the SCHEME, BASE_URL and PHP_PAGE_URL to build the URL that the application will communicate
* with, with its parameters and values.
* @return URL: the final url that the application will communicate with
* */
public URL getURL(){
try {
if (SCHEME != null && BASE_URL !=null && PAGE_URL != null){
Uri uri;
Uri.Builder builder = new Uri.Builder();
builder.scheme(SCHEME)
.encodedAuthority(BASE_URL)
.appendEncodedPath(PAGE_URL);
if (PARAMS.size() == VALUES.size()){
for (int i = 0; i < PARAMS.size(); i++) {
builder.appendQueryParameter(PARAMS.get(i), VALUES.get(i));
}
}
uri = builder.build();
return new URL(uri.toString());
}
}catch (IOException e){
e.printStackTrace();
}
return null;
}
/**
* getMAP responsible on converting the PARAMS and VALUES to HashMap and return this HashMap.
* @return Map\<String, String>: the final HashMap that contain the parameters and values that
* will be send to the backend with POST Request
* */
public Map<String, String> getMAP(){
if (PARAMS.size() == VALUES.size() && map != null){
for (int i = 0; i < PARAMS.size(); i++) {
map.put(PARAMS.get(i), VALUES.get(i));
}
return map;
}
return null;
}
}
| [
"shehabsalah25@gmail.com"
] | shehabsalah25@gmail.com |
6814e912572539372b711743d5e13668379870e6 | eb0faf1ee9716d64826086bc44c8dcd92a83e3fc | /Big Data/Hadoop and MapReduce/Question3/allDetails_mapperClass.java | 5728d589d8bc119694c7c062f728a0edf968b1a7 | [] | no_license | himanshu2752/Academic_Projects | eff90500f5b615d0168dbd359880a6ce37f5cbcc | 36bad923f4c3e47137d8d15f4be6791e4bd6210a | refs/heads/master | 2020-05-21T04:38:00.657568 | 2018-04-14T03:22:31 | 2018-04-14T03:22:31 | 49,101,749 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 967 | java | import java.io.IOException;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
public class allDetails_mapperClass extends Mapper<LongWritable, Text, Text, Text> {
static String records = "";
@Override
protected void map(LongWritable baseAddress, Text line, Context context) throws IOException {
Text business_id = new Text();
Text details = new Text();
records = records.concat(line.toString());
String[] fields = records.split("::");
if (fields.length == 3) {
{
String address=fields[1].trim();
String categories=fields[2].trim();
String value=address+"\t"+categories;
business_id.set(fields[0].trim());
details.set(value);
try {
context.write(business_id, details);
} catch (InterruptedException e) {
System.out.println("E2: Error in write operation details mapping class"+e.getMessage());
}
}
records="";
}
}
}
| [
"himanshu2752@live.com"
] | himanshu2752@live.com |
8750d4794e4187be2daacf93db29b3cff1e3df86 | 01684f849c42264f87d9401021d2d020aed68aa3 | /TeqCloud/src/main/java/de/rexlmanu/teqcloud/logger/Logger.java | 112e60a823b705e25ebad85591a935902315b438 | [] | no_license | rexlManu/TeqlessNETRecode | d4cd042973e3590ab10fef2d66dae115536ce669 | e9d82bc1867474e7ee8bba4caf2661ada212fab4 | refs/heads/master | 2022-06-17T02:33:13.744095 | 2019-10-12T00:46:44 | 2019-10-12T00:46:44 | 133,153,529 | 0 | 0 | null | 2022-05-20T20:50:56 | 2018-05-12T14:27:23 | Java | UTF-8 | Java | false | false | 1,720 | java | /*
* © Copyright - Emmanuel Lampe aka. rexlManu 2018.
*/
package de.rexlmanu.teqcloud.logger;
import lombok.AllArgsConstructor;
/******************************************************************************************
* Urheberrechtshinweis
* Copyright © Emmanuel Lampe 2018
* Erstellt: 11.05.2018 / 23:36
*
* Alle Inhalte dieses Quelltextes sind urheberrechtlich geschützt.
* Das Urheberrecht liegt, soweit nicht ausdrücklich anders gekennzeichnet,
* bei Emmanuel Lampe. Alle Rechte vorbehalten.
*
* Jede Art der Vervielfältigung, Verbreitung, Vermietung, Verleihung,
* öffentlichen Zugänglichmachung oder andere Nutzung
* bedarf der ausdrücklichen, schriftlichen Zustimmung von Emmanuel Lampe.
******************************************************************************************/
@AllArgsConstructor
public final class Logger {
private LogLevel logLevel;
public void log(final LogLevel logLevel, final String message) {
if (this.logLevel.getPriority() >= logLevel.getPriority())
System.out.println("[" + logLevel.getName() + "] " + message);
}
public void info(final String message) {
this.log(LogLevel.INFO, message);
}
public void warning(final String message) {
this.log(LogLevel.WARNING, message);
}
public void error(final String message) {
this.log(LogLevel.ERROR, message);
}
public void debug(final String message) {
this.log(LogLevel.DEBUG, message);
}
}
| [
"32296940+rexlManu@users.noreply.github.com"
] | 32296940+rexlManu@users.noreply.github.com |
7c440068fafaf5366e9e9911238c759a53fbd717 | 05312407a1b3b00d024848a29d575af65c39c151 | /DatabaseTest2/app/src/test/java/com/bumaiyangcong/databasetest2/ExampleUnitTest.java | d9566b8d58baf71b87afbbe9ea7efbea44f981ce | [] | no_license | Bumaiyangcong/FirstOne | a72dc6dc789d3ac0e6606f8207df8f94336324f3 | 38b2410e08064b8c8a79968f5e8cd1a9112ec05f | refs/heads/master | 2020-04-05T13:35:18.367514 | 2017-06-30T07:11:11 | 2017-06-30T07:11:11 | 94,902,396 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 409 | java | package com.bumaiyangcong.databasetest2;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"m18345066538@163.com"
] | m18345066538@163.com |
ad4fa778c65482dc41d527829ba5f0a17da149a1 | c26194f0cfcdcb55726f2217be5d74b5e38d9b25 | /app/src/main/java/com/example/bengkel/model/ChatMessage.java | d343aae68a0a1922c12d57516ec1f99438808968 | [] | no_license | fifinal/bengkel | 91634c5754c37293911ae40cb88d3b7e194f1426 | 2c45ca1b8a7c7dcadf0550aea05d35b629f020a3 | refs/heads/master | 2021-05-19T03:20:14.524830 | 2020-07-14T12:31:04 | 2020-07-14T12:31:04 | 251,502,180 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,090 | java | package com.example.bengkel.model;
import android.annotation.SuppressLint;
import android.os.Parcel;
import android.os.Parcelable;
import com.google.firebase.firestore.ServerTimestamp;
import java.util.Date;
public class ChatMessage implements Parcelable {
private Account account;
private String message;
private String message_id;
private @ServerTimestamp
Date timestamp;
public ChatMessage(Account account, String message, String message_id, Date timestamp) {
this.account=account;
this.message = message;
this.message_id = message_id;
this.timestamp = timestamp;
}
public ChatMessage() {
}
protected ChatMessage(Parcel in) {
account = in.readParcelable(Account.class.getClassLoader());
message = in.readString();
message_id = in.readString();
}
public static final Creator<ChatMessage> CREATOR = new Creator<ChatMessage>() {
@Override
public ChatMessage createFromParcel(Parcel in) {
return new ChatMessage(in);
}
@Override
public ChatMessage[] newArray(int size) {
return new ChatMessage[size];
}
};
public Account getAccount() {
return account;
}
public void setAccount(Account account) {
this.account = account;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getMessage_id() {
return message_id;
}
public void setMessage_id(String message_id) {
this.message_id = message_id;
}
public Date getTimestamp() {
return timestamp;
}
public void setTimestamp(Date timestamp) {
this.timestamp = timestamp;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeParcelable(account, flags);
dest.writeString(message);
dest.writeString(message_id);
}
}
| [
"s.fifinalamsyah@gmail.com"
] | s.fifinalamsyah@gmail.com |
b0f03ec089a960a2ecb38f25cbdf55a26d285eae | 5ad75a06208c771827d9d50c7dbb14781cf25cae | /app/src/main/java/com/example/edwardk/locapp/SendDataToServerActivity.java | bffdab4d5efe2a9ae971a74e65b25eae219331e6 | [] | no_license | kislla/Android-Location-App | 65cffbc15815c08589aff69ae03c5a9cb7cb4da4 | 2543195b5d791e7ce40273ebbc9c31618bcbaa43 | refs/heads/master | 2021-01-11T14:01:10.353384 | 2017-06-20T19:51:12 | 2017-06-20T19:51:12 | 94,926,807 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,101 | java | package com.example.edwardk.locapp;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Build;
import android.os.Handler;
import android.os.Message;
import android.provider.Settings;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.method.ScrollingMovementMethod;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.Switch;
import android.widget.TextView;
import android.widget.Toast;
import com.android.volley.AuthFailureError;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.JsonObjectRequest;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.text.DateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
public class SendDataToServerActivity extends AppCompatActivity {
double Altitude,Latitude,Longitude;
String model;
TextView altitude,latitude,longitude,result;
Button buttonSendData,ButtonGetData;
Switch toggleButtonAutomaticallySendData;
com.android.volley.RequestQueue requestQueue;
private LocationManager locationManager;
private LocationListener locationListener;
private Thread thread;
//for my local phpmyadmin:
// String insertUrl = "http://10.0.0.2/tutorial/insertStudent.php";
// String showUrl = "http://10.0.0.2/tutorial/showStudents.php";
String insertUrl = "http://tamirkapara.000webhostapp.com/location/insertLocation.php";
String showUrl = "http://tamirkapara.000webhostapp.com/location/showLocations.php";
//go to http://tamirkapara.000webhostapp.com/location/ and see all the php files
private static final int minTime = 1000; //min time in milliseconds to show new gps single
private static final int minDistance = 0; //min distance (in meters), to show new gps single
Handler handler = new Handler()
{
@Override
public void handleMessage(Message msg)
{
Log.d("sendToServer() ", "-------------------");
sendToServer();
}
};
boolean send=false;
Runnable runnable = new Runnable() {
@Override
public void run()
{
//while(true)
{
synchronized (this)
{
while(send)
{
try {
wait(5000);
handler.sendEmptyMessage(0);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
}
};
Thread t = new Thread(runnable);
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_send_data_to_server);
altitude = (TextView) findViewById(R.id.altitude);
latitude = (TextView) findViewById(R.id.latitude);
longitude = (TextView) findViewById(R.id.longitude);
result = (TextView) findViewById(R.id.text_field_from_server);
result.setMovementMethod(new ScrollingMovementMethod()); //alow to scoll down if the text is long...
buttonSendData = (Button) findViewById(R.id.button_send_data);
ButtonGetData = (Button) findViewById(R.id.button_data_from_server);
toggleButtonAutomaticallySendData = (Switch) findViewById(R.id.button_automatically_send_data);
toggleButtonAutomaticallySendData.setBackgroundColor(Color.GREEN);
model = Build.MODEL;
requestQueue = Volley.newRequestQueue(getApplicationContext());
turnOnGps();
onClickButtonSendDataToServer();
onClickButtonShowDataFromServer();
onClickButtonAutomaticallySendData();
}
public void turnOnGps()
{
locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
locationListener = new LocationListener() {
@Override
public void onLocationChanged(Location location) {
Latitude = location.getLatitude();
Longitude = location.getLongitude();
Altitude = location.getAltitude();
altitude.setText("altitude: "+Altitude);
latitude.setText("Lltitude: "+Latitude);
longitude.setText("altitude: "+Longitude);
//send data to server
}
@Override
public void onStatusChanged(String s, int i, Bundle bundle) {
}
@Override
public void onProviderEnabled(String s) {
}
@Override
public void onProviderDisabled(String s) {
//GO to gps SETTING:
Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
startActivity(intent);
}
};
configure_button();
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
switch (requestCode) {
case 10:
configure_button();
break;
default:
break;
}
}
void configure_button() {
// first check for permissions
if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
requestPermissions(new String[]{android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION, android.Manifest.permission.INTERNET}, 10);
}
return;
}
// this code won't execute IF permissions are not allowed, because in the line above there is return statement.
locationManager.requestLocationUpdates("gps", minTime, minDistance, locationListener);
}
public void onClickButtonSendDataToServer()
{
buttonSendData.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View view)
{
sendToServer();
Toast.makeText(getApplicationContext(),"Location Sent !", Toast.LENGTH_LONG).show();
}
});
}
public void sendToServer()
{
StringRequest request = new StringRequest(Request.Method.POST, insertUrl,
new Response.Listener<String>()
{
@Override
public void onResponse(String response)
{
}
}, new Response.ErrorListener()
{
@Override
public void onErrorResponse(VolleyError error)
{
}
}){
@Override
protected Map<String, String> getParams() throws AuthFailureError
{
Map<String, String> parameters = new HashMap<String, String>();
parameters.put("latitude", String.valueOf(Latitude));
parameters.put("longitude", String.valueOf(Longitude));
parameters.put("altitude", String.valueOf(Altitude));
parameters.put("model", String.valueOf(model));
parameters.put("date", String.valueOf(DateFormat.getDateTimeInstance().format(new Date())));
return parameters;
}
};
Log.i("the model is", model);
requestQueue.add(request);
}
public void onClickButtonShowDataFromServer()
{
ButtonGetData.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View view)
{
JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.POST,
showUrl,new Response.Listener<JSONObject>()
{
@Override
public void onResponse(JSONObject response)
{
result.setText("");
try {
JSONArray locations = response.getJSONArray("Locations");
for(int i=0;i<locations.length();i++)
{
JSONObject student = locations.getJSONObject(i);
String latitudejson = student.getString("latitude");
String longitudejson = student.getString("longitude");
String modeljson = student.getString("model");
result.append(modeljson+" : "+latitudejson+"/"+longitudejson+"\n");
}
result.append("==========================\n");
} catch (JSONException e) {
e.printStackTrace();
}
}
}, new Response.ErrorListener()
{
@Override
public void onErrorResponse(VolleyError error) {
}
});
requestQueue.add(jsonObjectRequest);
}
});
}
public void onClickButtonAutomaticallySendData()
{
toggleButtonAutomaticallySendData.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener(){
@Override
public void onCheckedChanged(CompoundButton cb, boolean on)
{
if (on)
{
//Do something when Switch button is on/checked
toggleButtonAutomaticallySendData.setText("STOP SENDING DATA !");
toggleButtonAutomaticallySendData.setBackgroundColor(Color.RED);
send=true;
Thread t = new Thread(runnable);
t.start();
} else
{
//Do something when Switch is off/unchecked
toggleButtonAutomaticallySendData.setText("AUTOMATICALLY SEND DATA");
toggleButtonAutomaticallySendData.setBackgroundColor(Color.GREEN);
send =false;
t.interrupt();
}
}
});
}
}
| [
"edwardkisller@gmail.com"
] | edwardkisller@gmail.com |
f525cbf8d877e1909530df545b4f9a283d132201 | 07364dd2ba4b2c213a884cde7a6c4801798b56eb | /examples/locoGP/SortRadixTest.java | bb619a3c007dc50c86fd929642cec25a912f11d6 | [
"MIT"
] | permissive | drdrwhite/gin | 4d493b81fdb6f9325007c19e7e5901e98fcc5d53 | 19666b2448671303414c21d989c3f4da8e68ce43 | refs/heads/master | 2021-01-19T14:49:39.398834 | 2018-05-09T09:49:52 | 2018-05-09T09:49:52 | 86,638,093 | 4 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,066 | java | import static org.junit.Assert.*;
import java.util.Arrays;
public class SortRadixTest {
Integer[][] testArrSet = { { 2, 1 }, // This will test for a swap only
{ 2, 3, 1 }, { 1, 2, 3 }, { 1, 939, 950, 520, 3346, 3658, 2335, 6174, 2377, 796 },
{ 1000024, 999927, 999849, 999761, 999650, 999576, 999422, 999378, 999276, 999144 }, // reverse
{ -1935783155, 805693102, 1011599466, -368696979, 814152454, 1502428812, 1640419215, 879631257, -1555817806,
-987937568 },
{ -1935783155, 8, 6, 101, -368696979, 8, 1, 5, 0, 2, 4, 2, 8, 8, 1, 2, 1, 6, 4, 0, 4, 1, 9, 2, 1, 5, 8, 7,
9, 6, 3, 1, 2, 5, 7, -1555817806, -95, 68 } };
Integer[][] expectedArrSet = sortArrays();
private Integer[][] sortArrays() {
Integer[][] sortedArraySet = new Integer[testArrSet.length][];
for (int i = 0; i < testArrSet.length; i++) {
Integer[] clonedTestArr = testArrSet[i].clone();
Arrays.sort(clonedTestArr);
sortedArraySet[i] = clonedTestArr;
}
return sortedArraySet;
}
// protected abstract Integer[] testSpecificSort( Integer[] a, Integer
// length ); // nein
protected Integer[] testSpecificSort(Integer[] a, Integer length) {
return SortRadix.sort(a, length);
}
private void testSortAtIndex(int sortArrIndex) {
Integer[] sortingAttempt = testSpecificSort(testArrSet[sortArrIndex].clone(), testArrSet[sortArrIndex].length);
assertArrayEquals(expectedArrSet[sortArrIndex], sortingAttempt);
}
@org.junit.Test
public void checkSorting0() throws Exception {
testSortAtIndex(0);
}
@org.junit.Test
public void checkSorting1() throws Exception {
testSortAtIndex(1);
}
@org.junit.Test
public void checkSorting2() throws Exception {
testSortAtIndex(2);
}
@org.junit.Test
public void checkSorting3() throws Exception {
testSortAtIndex(3);
}
@org.junit.Test
public void checkSorting4() throws Exception {
testSortAtIndex(4);
}
@org.junit.Test
public void checkSorting5() throws Exception {
testSortAtIndex(5);
}
@org.junit.Test
public void checkSorting6() throws Exception {
testSortAtIndex(6);
}
}
| [
"codykenny@gmail.com"
] | codykenny@gmail.com |
c4952881530e81da4de791a18ac1d8d291743aba | d60e287543a95a20350c2caeabafbec517cabe75 | /LACCPlus/Cloudstack/1247_1.java | a07b1636668b4ecc2390cf2b6439ea72f1ccc3a2 | [
"MIT"
] | permissive | sgholamian/log-aware-clone-detection | 242067df2db6fd056f8d917cfbc143615c558b2c | 9993cb081c420413c231d1807bfff342c39aa69a | refs/heads/main | 2023-07-20T09:32:19.757643 | 2021-08-27T15:02:50 | 2021-08-27T15:02:50 | 337,837,827 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,590 | java | //,temp,Upgrade2214to30.java,499,530,temp,Upgrade2214to30.java,382,419
//,3
public class xxx {
private void encryptUserCredentials(Connection conn) {
s_logger.debug("Encrypting user keys");
List<PreparedStatement> pstmt2Close = new ArrayList<PreparedStatement>();
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
pstmt = conn.prepareStatement("select id, secret_key from `cloud`.`user`");
pstmt2Close.add(pstmt);
rs = pstmt.executeQuery();
while (rs.next()) {
long id = rs.getLong(1);
String secretKey = rs.getString(2);
String encryptedSecretKey = DBEncryptionUtil.encrypt(secretKey);
pstmt = conn.prepareStatement("update `cloud`.`user` set secret_key=? where id=?");
pstmt2Close.add(pstmt);
if (encryptedSecretKey == null) {
pstmt.setNull(1, Types.VARCHAR);
} else {
pstmt.setBytes(1, encryptedSecretKey.getBytes("UTF-8"));
}
pstmt.setLong(2, id);
pstmt.executeUpdate();
}
} catch (SQLException e) {
throw new CloudRuntimeException("Unable encrypt user secret key ", e);
} catch (UnsupportedEncodingException e) {
throw new CloudRuntimeException("Unable encrypt user secret key ", e);
} finally {
TransactionLegacy.closePstmts(pstmt2Close);
}
s_logger.debug("Done encrypting user keys");
}
}; | [
"sgholami@uwaterloo.ca"
] | sgholami@uwaterloo.ca |
d9fec28c291680c7bb8d6f392d42ce0ebaf06672 | ff7f04004a6a627f20a9b632966ee510aa69575c | /src/main/java/it/uniroma2/isssr/gqm3/service/implementation/VariableActivitiServiceImplementation.java | 8acf0f098241d9ff5e7c4fce3c542860f0fb604a | [] | no_license | OviDanielB/Phase3_GQM-Strategies | 0dceda5d10a06d1ea4a5527b129c9bb0f43cb698 | fd53a4926defba1d9f279a35e76117057c7bfe64 | refs/heads/master | 2021-04-27T01:07:28.535850 | 2018-02-23T20:07:39 | 2018-02-23T20:07:39 | 122,667,185 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,034 | java | package it.uniroma2.isssr.gqm3.service.implementation;
import it.uniroma2.isssr.HostSettings;
import it.uniroma2.isssr.gqm3.service.VariableActivitiService;
import it.uniroma2.isssr.gqm3.Exception.*;
import it.uniroma2.isssr.gqm3.model.VariableActiviti;
import it.uniroma2.isssr.gqm3.model.rest.DTO;
import it.uniroma2.isssr.gqm3.model.rest.DTOVariableActiviti;
import it.uniroma2.isssr.gqm3.model.rest.response.DTOResponseVariableActiviti;
import it.uniroma2.isssr.gqm3.repository.VariableActivitiRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* <p>Title: VariableActivitiServiceImplementation</p>
* <p>
* <p>Copyright: Copyright (c) 2016</p>
* <p>Company: Dipartimento di Ingegneria Informatica, Universita' degli studi di Roma
* Tor Vergata, progetto di ISSSR, gruppo 3: Fabio Alberto Coira,
* Federico Di Domenicantonio, Daniele Capri, Giuseppe Chiapparo, Gabriele Belli,
* Luca Della Gatta</p>
* <p>Class description:
* <p>
* Qui si offre l'implementazione dei metodi dell'interfaccia
* VariableActivitiService.
*
* @author Fabio Alberto Coira
* @version 1.0
*/
@Service("VariableActivitiService")
public class VariableActivitiServiceImplementation implements VariableActivitiService {
@Autowired
VariableActivitiRepository variableActivitiRepository;
@Autowired
HostSettings hostSettings;
/**
* La get di una Variable Activiti
*
* @throws EntityNotFoundException
* @throws AnomalySystemException
*/
@Override
public ResponseEntity<?> getVariableActiviti(String taskId) throws EntityNotFoundException, AnomalySystemException {
// TODO Auto-generated method stub
List<VariableActiviti> variableActivitiList =
variableActivitiRepository.findByTaskId(taskId);
if (variableActivitiList.isEmpty()) {
throw new EntityNotFoundException(HttpStatus.NOT_FOUND.value(),
"Non è stata trovata nessuna "
+ "VariableActivity associata al taskId di runtime " + taskId);
}
if (variableActivitiList.size() > 1) {
throw new AnomalySystemException(HttpStatus.INTERNAL_SERVER_ERROR.value(),
"Sono state trovate più VariableActiviti, non dovrebbe essere possibile! "
+ "Serio errore interno del sistema");
}
VariableActiviti variableActiviti = variableActivitiList.get(0);
if (variableActiviti == null) {
throw new EntityNotFoundException(HttpStatus.NOT_FOUND.value(),
"Non è stata trovata nessuna "
+ "VariableActivity associata al taskId di runtime " + taskId);
}
DTOResponseVariableActiviti dtoResponseVariableActiviti =
new DTOResponseVariableActiviti();
dtoResponseVariableActiviti.setId(variableActiviti.getId());
dtoResponseVariableActiviti.setTaskId(variableActiviti.getTaskId());
dtoResponseVariableActiviti.setTaskDefinitionKey(
variableActiviti.getTaskDefinitionKey());
dtoResponseVariableActiviti.setProperties(
variableActiviti.getProperties());
ResponseEntity<DTOResponseVariableActiviti> responseEntity =
new ResponseEntity<DTOResponseVariableActiviti>(
dtoResponseVariableActiviti, HttpStatus.OK);
return responseEntity;
}
/**
* La create di una VariableActiviti
*
* @throws BodyEmptyException
* @throws IdKeyNullException
* @throws AnomalySystemException
* @throws ConflictException
*/
@Override
public ResponseEntity<?> createVariableActiviti(DTOVariableActiviti dtoVariableActiviti) throws BodyEmptyException, IdKeyNullException, AnomalySystemException, ConflictException {
// TODO Auto-generated method stub
DTOResponseVariableActiviti dtoResponseVariableActiviti =
new DTOResponseVariableActiviti();
if (dtoVariableActiviti == null) {
//ritorna HttpStatus.BAD_REQUEST
throw new BodyEmptyException(HttpStatus.BAD_REQUEST.value(),
"Il body della post non è corretto e la deserializzazione"
+ "ha generato una istanza null");
}
if (dtoVariableActiviti.getTaskId() == null) {
//ritorna HttpStatus.BAD_REQUEST
throw new IdKeyNullException(HttpStatus.BAD_REQUEST.value(),
"Il parametro 'taskId' non può essere null");
}
if (dtoVariableActiviti.getTaskDefinitionKey() == null) {
//ritorna HttpStatus.BAD_REQUEST
throw new IdKeyNullException(HttpStatus.BAD_REQUEST.value(),
"Il parametro 'taskDefinitionKey' non può essere null");
}
if (dtoVariableActiviti.getProperties().isEmpty() ||
dtoVariableActiviti.getProperties() == null) {
//ritorna HttpStatus.BAD_REQUEST
throw new IdKeyNullException(HttpStatus.BAD_REQUEST.value(),
"Il parametro 'properties' non può essere null!"
+ " Probabilmente o hai inserito [], null, oppure "
+ "un qualsiasi altro valore che ha portato ad una deserializzazione"
+ "settando tale campo a null");
}
List<VariableActiviti> variableActivitiList =
variableActivitiRepository.findByTaskId(dtoVariableActiviti.getTaskId());
if (variableActivitiList.size() > 1) {
throw new AnomalySystemException(HttpStatus.INTERNAL_SERVER_ERROR.value(),
"Sono state trovate più VariableActiviti, non dovrebbe essere possibile! "
+ "Serio errore interno del sistema");
}
if (variableActivitiList.size() == 1) {
throw new ConflictException(HttpStatus.CONFLICT.value(),
"E' già presente una VariableActiviti con quel 'taskId'. Una delle"
+ " cause potrebbe risiedere nel fatto che il task associato sia ancora run, quindi si ricade in una situazione"
+ " più che normale. Un altro motivo potrebbe essere che non "
+ "si è cancellato il documento quando il task associato al taskId "
+ "è stato completato. In questo secondo caso la situazione è critica. In ogni caso"
+ " è opportuno indagare");
}
/**
* caso in cui non è presente nessun documento con quel taskId,
* allora procedo e ne creo uno
*/
VariableActiviti variableActiviti = new VariableActiviti();
variableActiviti.setTaskId(dtoVariableActiviti.getTaskId());
variableActiviti.setTaskDefinitionKey(dtoVariableActiviti.getTaskDefinitionKey());
variableActiviti.setProperties(dtoVariableActiviti.getProperties());
variableActivitiRepository.save(variableActiviti);
dtoResponseVariableActiviti.setId(variableActiviti.getId());
dtoResponseVariableActiviti.setTaskId(variableActiviti.getTaskId());
dtoResponseVariableActiviti.setTaskDefinitionKey(
variableActiviti.getTaskDefinitionKey());
dtoResponseVariableActiviti.setProperties(
variableActiviti.getProperties());
ResponseEntity<DTOResponseVariableActiviti> responseEntity =
new ResponseEntity<DTOResponseVariableActiviti>(
dtoResponseVariableActiviti, HttpStatus.CREATED);
return responseEntity;
}
@Override
public ResponseEntity<?> updateVariableActiviti(String taskId
) {
// TODO Auto-generated method stub
return null;
}
/**
* La delete della Variable Activiti, non contempla la presenza di
* due taskId e ne segnala la situazione fornendo un'eccezione seria
* di cui dover tenere conto.
*/
@Override
public ResponseEntity<?> deleteVariableActiviti(String taskId) throws EntityNotFoundException, AnomalySystemException {
// TODO Auto-generated method stub
List<VariableActiviti> variableActivitiList =
variableActivitiRepository.findByTaskId(taskId);
if (variableActivitiList.isEmpty()) {
throw new EntityNotFoundException(HttpStatus.NOT_FOUND.value(),
"Non è stata trovata nessuna "
+ "VariableActivity associata al taskId di runtime " + taskId);
}
if (variableActivitiList.size() > 1) {
throw new AnomalySystemException(HttpStatus.INTERNAL_SERVER_ERROR.value(),
"Sono state trovate più VariableActiviti, non dovrebbe essere possibile! "
+ "Serio errore interno del sistema");
}
//ne può essere presente solo una!
VariableActiviti variableActiviti = variableActivitiList.get(0);
if (variableActiviti == null) {
throw new EntityNotFoundException(HttpStatus.NOT_FOUND.value(),
"Non è stata trovata nessuna "
+ "VariableActivity associata al taskId di runtime " + taskId);
}
variableActivitiRepository.delete(variableActiviti);
DTO dto = new DTO();
ResponseEntity<DTO> responseEntity =
new ResponseEntity<DTO>(
dto, HttpStatus.NO_CONTENT);
return responseEntity;
}
@Override
public ResponseEntity<List<DTOResponseVariableActiviti>> getAllVariablesActiviti() {
// TODO Auto-generated method stub
List<VariableActiviti> variablesActiviti = variableActivitiRepository.findAll();
List<DTOResponseVariableActiviti> dtoResponseVariableActivitiList =
new ArrayList<DTOResponseVariableActiviti>();
for (VariableActiviti variable : variablesActiviti) {
DTOResponseVariableActiviti dtoResponseVariableActiviti =
new DTOResponseVariableActiviti();
dtoResponseVariableActiviti.setId(variable.getId());
dtoResponseVariableActiviti.setTaskId(variable.getTaskId());
dtoResponseVariableActiviti.setTaskDefinitionKey(variable.getTaskDefinitionKey());
dtoResponseVariableActiviti.setProperties(
variable.getProperties());
dtoResponseVariableActivitiList.add(dtoResponseVariableActiviti);
}
ResponseEntity<List<DTOResponseVariableActiviti>> responseEntity =
new ResponseEntity<List<DTOResponseVariableActiviti>>(
dtoResponseVariableActivitiList, HttpStatus.OK);
return responseEntity;
}
}
| [
"emanuele.vannacci@gmail.com"
] | emanuele.vannacci@gmail.com |
8b2a531bdc197730c3176469122c3f576a4855ac | 78c6209833c90f687051263c1273c41d23fd30cc | /app/src/main/java/calculator/moi/andoid/fr/paysmart/MainActivity.java | 03938d633c0b33defc36c4dda0ca11dec86ca037 | [] | no_license | JeremyBouhi/ppe | 1c0214b01768456f3286b2f6bd6a46b3ebe7365d | 39cad169e2576a3de29c9c8050d7ea8ba1194fd2 | refs/heads/master | 2021-04-15T12:41:23.280541 | 2018-05-08T18:12:13 | 2018-05-08T18:12:13 | 126,197,553 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,169 | java | package calculator.moi.andoid.fr.paysmart;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
EditText mail = (EditText) findViewById(R.id.editText);
mail.setHint("Email");
EditText mdp = (EditText) findViewById(R.id.editText2);
mdp.setHint("Mot de passe");
Button connexion = (Button) findViewById(R.id.button);
connexion.setText("SE CONNECTER");
connexion.setOnClickListener(new View.OnClickListener() //Creation du listener sur ce bouton
{
public void onClick(View actuelView) //au clic sur le bouton
{
Intent intent = new Intent(MainActivity.this, MenuDuTurfu.class); //Lancer l'activité
startActivity(intent); //Afficher la vue
}
});
}
}
| [
"jeremy.bouhi@edu.ece.fr"
] | jeremy.bouhi@edu.ece.fr |
ced04d9c4a7f9ac79acc97645bb36f36a7323bba | 59d90978f05e9ce8fa8e5115cda7b651bd22be5d | /实验9/filter/src/main/java/com/example/filter/myfilter/ThirdFilter.java | 36ca3e74488b6a2b5e5e098acefff2af38c0b186 | [] | no_license | wenyio/WebStudy | cd2ae3c3c070f9ab4fb0d7eeb72035429212b441 | aa9c7e3e5731caa0680ac8e6c739a025e17d18dd | refs/heads/master | 2023-05-13T18:58:36.581164 | 2021-06-10T05:59:51 | 2021-06-10T05:59:51 | 345,895,986 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 980 | java | package com.example.filter.myfilter;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import java.io.IOException;
/**
* xx
* <p>
* Description:
* </p>
*
* @author: https://github.com/wenyio
* @date: 2021/5/24
* @see: com.example.filter
* @version: v1.0.0
*/
public class ThirdFilter implements Filter {
@Override
public void init(FilterConfig filterConfig) throws ServletException {
}
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
System.out.println("进入test.jsp页面,ThirdFilter 第一个执行");
filterChain.doFilter(servletRequest, servletResponse);//让目标资源执行,即:放行
}
@Override
public void destroy() {
}
}
| [
"1329208516@qq.com"
] | 1329208516@qq.com |
6a650ba28fe6b565ed9b7daf3693bdcfc144168d | 1fed84cb65c04f9d2ac502f7b283fd73218f6ff0 | /AppDirect-Project/src/com/kp/appdirect/manage/AppDirectJettyInitializer.java | a4b3f550c42c76569ba2ed17b246ca7165e8fd96 | [] | no_license | kpjangid/AppDirect | 6a98f59d9d5e0d55828eab05fc3be1fbeb72d96f | fb5a7f922c45384f5c431498732705fe07611754 | refs/heads/master | 2020-12-08T23:00:43.550143 | 2016-09-16T07:29:19 | 2016-09-16T07:29:19 | 67,981,285 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,439 | java | package com.kp.appdirect.manage;
import com.kp.appdirect.management.EnumParameters;
import com.kp.appdirect.restcontroller.AppDirectNotificationManagementHandler;
import com.kp.appdirect.restcontroller.AppDirectSubscriptionManagementHandler;
import com.kp.appdirect.restcontroller.AppDirectUserManagementHandler;
import java.lang.management.ManagementFactory;
import java.util.logging.Logger;
import org.eclipse.jetty.jmx.MBeanContainer;
import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.HttpConfiguration;
import org.eclipse.jetty.server.HttpConnectionFactory;
import org.eclipse.jetty.server.SecureRequestCustomizer;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.server.SslConnectionFactory;
import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
import org.eclipse.jetty.server.handler.DefaultHandler;
import org.eclipse.jetty.server.handler.HandlerCollection;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.eclipse.jetty.util.thread.QueuedThreadPool;
/**
*
* @author Kiran.Jangid
*
*/
public class AppDirectJettyInitializer {
public static AppDirectJettyInitializer jettyManager = new AppDirectJettyInitializer();
private Server server;
private ContextHandlerCollection contexts = null;
private SslContextFactory sslContextFactory;
AppDirectJettyInitializer() {
System.out.println("Initializing the Jetty interfaces of the system....");
}
public Server getServer() {
return server;
}
/**
*
* @author Kiran.Jangid
*
*/
public void initializeJetty() {
try {
System.setProperty("org.eclipse.jetty.util.log.class", Logger.class.getName());
// Creating a basic Jetty Server Object
QueuedThreadPool threadpool = new QueuedThreadPool();
threadpool.setMinThreads(8);
threadpool.setMaxThreads(24);
server = new Server(threadpool);
// Creating HTTP connector object that will listen on the configured
// host and port
ServerConnector connector = new ServerConnector(server);
connector.setHost(EnumParameters.http_host.getStringDescription());
connector.setPort(EnumParameters.http_port.getIntDescription());
HttpConfiguration https = new HttpConfiguration();
https.addCustomizer(new SecureRequestCustomizer());
sslContextFactory = new SslContextFactory(EnumParameters.sslKeystorePath.getStringDescription() + "/"
+ EnumParameters.sslKeystoreName.getStringDescription());
sslContextFactory.setKeyStorePassword(EnumParameters.sslKeystorePassword.getStringDescription());
sslContextFactory.setKeyManagerPassword(EnumParameters.sslKeymanagerPassword.getStringDescription());
ServerConnector sslConnector = new ServerConnector(server,
new SslConnectionFactory(sslContextFactory, "http/1.1"), new HttpConnectionFactory(https));
sslConnector.setPort(EnumParameters.host_https_port.getIntDescription());
server.setConnectors(new Connector[] { connector, sslConnector });
MBeanContainer mbContainer = new MBeanContainer(ManagementFactory.getPlatformMBeanServer());
server.addEventListener(mbContainer);
server.addBean(mbContainer);
server.addBean(Log.getLog());
// Creating Context collection, Handler collection.
contexts = new ContextHandlerCollection();
// BTAS User Controller Handler
ContextHandler userManagementControllerContext = new ContextHandler();
userManagementControllerContext
.setContextPath(EnumParameters.http_user_management_context.getStringDescription());
Handler userManagementControllerHandler = new AppDirectUserManagementHandler();
userManagementControllerContext.setHandler(userManagementControllerHandler);
contexts.addHandler(userManagementControllerContext);
// BTAS role Controller Handler
ContextHandler subscriptionManagementControllerContext = new ContextHandler();
subscriptionManagementControllerContext
.setContextPath(EnumParameters.http_subscription_management_context.getStringDescription());
Handler subscriptionManagementControllerHandler = new AppDirectSubscriptionManagementHandler();
subscriptionManagementControllerContext.setHandler(subscriptionManagementControllerHandler);
contexts.addHandler(subscriptionManagementControllerContext);
// BTAS role Controller Handler
ContextHandler notificationManagementControllerContext = new ContextHandler();
notificationManagementControllerContext
.setContextPath(EnumParameters.http_notification_management_context.getStringDescription());
Handler notificationManagementControllerHandler = new AppDirectNotificationManagementHandler();
notificationManagementControllerContext.setHandler(notificationManagementControllerHandler);
contexts.addHandler(notificationManagementControllerContext);
HandlerCollection handlers;
handlers = new HandlerCollection();
handlers.setHandlers(new Handler[] { contexts, new DefaultHandler() });
this.server.setHandler(handlers);
this.server.start();
AppDirectManagerBootstrap.smpManager.getServerState().setJettyIntf(true);
} catch (Exception e) {
e.printStackTrace();
System.exit(0);
}
}
}
| [
"kpjangid@gmail.com"
] | kpjangid@gmail.com |
7d79258ccaa9dc309b5f794cad74b50266fcdd8a | 90cf9a4c00d665588dd6a6b913f820f047644620 | /openwire-legacy/src/main/java/io/openwire/codec/v2/MessagePullMarshaller.java | 33921db2f4944b316e6d7a4f5d24eb3f551f8a9a | [
"Apache-2.0"
] | permissive | PlumpMath/OpenWire | ec1381f7167fc0680125ad8c3fbc56ae1431a567 | b46eacb71c140d3c118d9eee52b5d34f138fb59a | refs/heads/master | 2021-01-19T23:13:03.036246 | 2014-09-10T18:30:14 | 2014-09-10T18:30:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,957 | java | /**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.openwire.codec.v2;
import io.openwire.codec.BooleanStream;
import io.openwire.codec.OpenWireFormat;
import io.openwire.commands.ConsumerId;
import io.openwire.commands.DataStructure;
import io.openwire.commands.MessagePull;
import io.openwire.commands.OpenWireDestination;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
public class MessagePullMarshaller extends BaseCommandMarshaller {
/**
* Return the type of Data Structure we marshal
*
* @return short representation of the type data structure
*/
@Override
public byte getDataStructureType() {
return MessagePull.DATA_STRUCTURE_TYPE;
}
/**
* @return a new object instance
*/
@Override
public DataStructure createObject() {
return new MessagePull();
}
/**
* Un-marshal an object instance from the data input stream
*
* @param o
* the object to un-marshal
* @param dataIn
* the data input stream to build the object from
* @throws IOException
*/
@Override
public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException {
super.tightUnmarshal(wireFormat, o, dataIn, bs);
MessagePull info = (MessagePull) o;
info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
info.setTimeout(tightUnmarshalLong(wireFormat, dataIn, bs));
}
/**
* Write the booleans that this object uses to a BooleanStream
*/
@Override
public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
MessagePull info = (MessagePull) o;
int rc = super.tightMarshal1(wireFormat, o, bs);
rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs);
rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
rc += tightMarshalLong1(wireFormat, info.getTimeout(), bs);
return rc + 0;
}
/**
* Write a object instance to data output stream
*
* @param o
* the instance to be marshaled
* @param dataOut
* the output stream
* @throws IOException
* thrown if an error occurs
*/
@Override
public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
super.tightMarshal2(wireFormat, o, dataOut, bs);
MessagePull info = (MessagePull) o;
tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
tightMarshalLong2(wireFormat, info.getTimeout(), dataOut, bs);
}
/**
* Un-marshal an object instance from the data input stream
*
* @param o
* the object to un-marshal
* @param dataIn
* the data input stream to build the object from
* @throws IOException
*/
@Override
public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
super.looseUnmarshal(wireFormat, o, dataIn);
MessagePull info = (MessagePull) o;
info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
info.setTimeout(looseUnmarshalLong(wireFormat, dataIn));
}
/**
* Write the booleans that this object uses to a BooleanStream
*/
@Override
public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
MessagePull info = (MessagePull) o;
super.looseMarshal(wireFormat, o, dataOut);
looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut);
looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
looseMarshalLong(wireFormat, info.getTimeout(), dataOut);
}
}
| [
"tabish121@gmail.com"
] | tabish121@gmail.com |
8e4e01c109f62ed926100ea92b68082215b69158 | d9f98dd1828e25bc2e8517e5467169830c5ded60 | /src/main/java/com/alipay/api/domain/AlisisReport.java | e190170ae80288255ce190ec86dfb0bd310cf1c6 | [] | no_license | benhailong/open_kit | 6c99f3239de6dcd37f594f7927dc8b0e666105dc | a45dd2916854ee8000d2fb067b75160b82bc2c04 | refs/heads/master | 2021-09-19T18:22:23.628389 | 2018-07-30T08:18:18 | 2018-07-30T08:18:26 | 117,778,328 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,408 | 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, 2017-06-16 20:33:21
*/
public class AlisisReport extends AlipayObject {
private static final long serialVersionUID = 6562192921362223914L;
/**
* :
报表可过滤字段条件
*/
@ApiListField("conditions")
@ApiField("report_condition")
private List<ReportCondition> conditions;
/**
* 报表描述
*/
@ApiField("report_desc")
private String reportDesc;
/**
* 报表名称
*/
@ApiField("report_name")
private String reportName;
/**
* 报表唯一标识
*/
@ApiField("report_uk")
private String reportUk;
public List<ReportCondition> getConditions() {
return this.conditions;
}
public void setConditions(List<ReportCondition> conditions) {
this.conditions = conditions;
}
public String getReportDesc() {
return this.reportDesc;
}
public void setReportDesc(String reportDesc) {
this.reportDesc = reportDesc;
}
public String getReportName() {
return this.reportName;
}
public void setReportName(String reportName) {
this.reportName = reportName;
}
public String getReportUk() {
return this.reportUk;
}
public void setReportUk(String reportUk) {
this.reportUk = reportUk;
}
}
| [
"694201656@qq.com"
] | 694201656@qq.com |
70cf76d931a76975168bd2d54c31d42d651ec1fb | 6a20e0e9f217dc9a561ccccda0ab9adb6fd46600 | /src/main/java/org/apache/chemistry/opencmis/inmemory/query/InMemoryQueryProcessor.java | 6b561c8c390b38bf89e624b0194efa0bbb21db24 | [] | no_license | exo-docker/lightweightCMISserver | ea07659736525b59a5b67c28650f0c16301bb2ca | f52e5c86ced4b1c3a22fe11ed64654e5f4f05f07 | refs/heads/master | 2020-04-08T09:09:01.928045 | 2018-12-05T11:19:51 | 2018-12-05T11:19:51 | 159,210,451 | 0 | 1 | null | 2020-10-15T15:40:07 | 2018-11-26T17:54:18 | Java | UTF-8 | Java | false | false | 34,057 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
* Contributors:
* Jens Huebel
* Florent Guillaume, Nuxeo
*/
package org.apache.chemistry.opencmis.inmemory.query;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.GregorianCalendar;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
import org.antlr.runtime.tree.Tree;
import org.apache.chemistry.opencmis.commons.data.ObjectData;
import org.apache.chemistry.opencmis.commons.data.ObjectList;
import org.apache.chemistry.opencmis.commons.data.PropertyData;
import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition;
import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
import org.apache.chemistry.opencmis.commons.enums.Cardinality;
import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
import org.apache.chemistry.opencmis.commons.enums.PropertyType;
import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.ObjectListImpl;
import org.apache.chemistry.opencmis.inmemory.storedobj.api.Content;
import org.apache.chemistry.opencmis.inmemory.storedobj.api.DocumentVersion;
import org.apache.chemistry.opencmis.inmemory.storedobj.api.Filing;
import org.apache.chemistry.opencmis.inmemory.storedobj.api.Folder;
import org.apache.chemistry.opencmis.inmemory.storedobj.api.ObjectStore;
import org.apache.chemistry.opencmis.inmemory.storedobj.api.StoredObject;
import org.apache.chemistry.opencmis.inmemory.storedobj.api.VersionedDocument;
import org.apache.chemistry.opencmis.inmemory.storedobj.impl.ContentStreamDataImpl;
import org.apache.chemistry.opencmis.inmemory.storedobj.impl.ObjectStoreImpl;
import org.apache.chemistry.opencmis.inmemory.types.PropertyCreationHelper;
import org.apache.chemistry.opencmis.server.support.TypeManager;
import org.apache.chemistry.opencmis.server.support.query.AbstractPredicateWalker;
import org.apache.chemistry.opencmis.server.support.query.CmisQueryWalker;
import org.apache.chemistry.opencmis.server.support.query.CmisSelector;
import org.apache.chemistry.opencmis.server.support.query.ColumnReference;
import org.apache.chemistry.opencmis.server.support.query.QueryObject;
import org.apache.chemistry.opencmis.server.support.query.QueryObject.JoinSpec;
import org.apache.chemistry.opencmis.server.support.query.QueryObject.SortSpec;
import org.apache.chemistry.opencmis.server.support.query.QueryUtilStrict;
import org.apache.chemistry.opencmis.server.support.query.StringUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* A processor for a CMIS query for the In-Memory server. During tree traversal
* conditions are checked against the data contained in the central hash map
* with all objects. In a first pass one time setup is performed, in a custom
* walk across the query expression tree an object is checked if it matches. In
* case of a match it is appended to a list of matching objects.
*/
public class InMemoryQueryProcessor {
private static final Logger LOG = LoggerFactory.getLogger(InMemoryQueryProcessor.class);
private List<StoredObject> matches = new ArrayList<StoredObject>();
private QueryObject queryObj;
private Tree whereTree;
private ObjectStoreImpl objStore;
private List<TypeDefinition> secondaryTypeIds;
public InMemoryQueryProcessor(ObjectStoreImpl objStore) {
this.objStore = objStore;
}
/**
* Main entry function to process a query from discovery service.
*
* @param tm
* type manager for the given repository
* @param objectStore
* object store to gets object from
* @param user
* user execuing the query
* @param repositoryId
* id of repository
* @param statement
* query statement
* @param searchAllVersions
* search in all versions of objects
* @param includeAllowableActions
* include allowable actions
* @param includeRelationships
* include relationships
* @param renditionFilter
* include renditions
* @param maxItems
* max number of items to return
* @param skipCount
* items to skip
* @return list of objects matching the query
*/
public ObjectList query(TypeManager tm, ObjectStore objectStore, String user, String repositoryId,
String statement, Boolean searchAllVersions, Boolean includeAllowableActions,
IncludeRelationships includeRelationships, String renditionFilter, BigInteger maxItems,
BigInteger skipCount) {
processQueryAndCatchExc(statement, tm); // calls query processor
// iterate over all the objects and check for each if the query matches
for (String objectId : ((ObjectStoreImpl) objectStore).getIds()) {
StoredObject so = objectStore.getObjectById(objectId);
match(so, user, searchAllVersions == null ? true : searchAllVersions.booleanValue());
}
ObjectList objList = buildResultList(tm, user, includeAllowableActions, includeRelationships, renditionFilter,
maxItems, skipCount);
LOG.debug("Query result, number of matching objects: " + objList.getNumItems());
return objList;
}
/**
* Process a query.
* @param statement
* CMISQL statement to execute
* @param tm
* type manager for the repository
*/
public void processQueryAndCatchExc(String statement, TypeManager tm) {
QueryUtilStrict queryUtil = new QueryUtilStrict(statement, tm, null);
queryUtil.processStatementUsingCmisExceptions();
CmisQueryWalker walker = queryUtil.getWalker();
queryObj = queryUtil.getQueryObject();
whereTree = walker.getWherePredicateTree();
secondaryTypeIds = queryObj.getJoinedSecondaryTypes();
doAdditionalChecks(walker);
}
/**
* Create the list of matching objects for this query.
* @param tm
* type manager for the given repository
* @param user
* user execuing the query
* @param includeAllowableActions
* include allowable actions
* @param includeRelationships
* include relationships
* @param renditionFilter
* include renditions
* @param maxItems
* max number of items to return
* @param skipCount
* items to skip
* @return
* list of objects matching the query
*/
public ObjectList buildResultList(TypeManager tm, String user, Boolean includeAllowableActions,
IncludeRelationships includeRelationships, String renditionFilter, BigInteger maxItems,
BigInteger skipCount) {
sortMatches();
ObjectListImpl res = new ObjectListImpl();
res.setNumItems(BigInteger.valueOf(matches.size()));
int start = 0;
if (skipCount != null) {
start = (int) skipCount.longValue();
}
if (start < 0) {
start = 0;
}
if (start > matches.size()) {
start = matches.size();
}
int stop = 0;
if (maxItems != null) {
stop = start + (int) maxItems.longValue();
}
if (stop <= 0 || stop > matches.size()) {
stop = matches.size();
}
res.setHasMoreItems(stop < matches.size());
if (start > 0 || stop > 0) {
matches = matches.subList(start, stop);
}
List<ObjectData> objDataList = new ArrayList<ObjectData>();
Map<String, String> props = queryObj.getRequestedPropertiesByAlias();
Map<String, String> funcs = queryObj.getRequestedFuncsByAlias();
for (StoredObject so : matches) {
String queryName = queryObj.getTypes().values().iterator().next();
TypeDefinition td = queryObj.getTypeDefinitionFromQueryName(queryName);
ObjectData od = PropertyCreationHelper.getObjectDataQueryResult(tm, objStore, td, so, user, props, funcs,
secondaryTypeIds, includeAllowableActions, includeRelationships, renditionFilter);
objDataList.add(od);
}
res.setObjects(objDataList);
return res;
}
private boolean typeMatches(TypeDefinition td, StoredObject so) {
String typeId = so.getTypeId();
while (typeId != null) {
if (typeId.equals(td.getId())) {
return true;
}
// check secondary types
List<String> secTypeIds = so.getSecondaryTypeIds();
for (String secTypeId : secTypeIds) {
if (secTypeId.equals(td.getId())) {
return true;
}
}
// check parent type
TypeDefinition parentTD = queryObj.getParentType(typeId);
typeId = parentTD == null ? null : parentTD.getId();
}
return false;
}
private void sortMatches() {
final List<SortSpec> orderBy = queryObj.getOrderBys();
if (orderBy.size() > 1) {
LOG.warn("ORDER BY has more than one sort criterium, all but the first are ignored.");
}
class ResultComparator implements Comparator<StoredObject> {
@SuppressWarnings("unchecked")
public int compare(StoredObject so1, StoredObject so2) {
SortSpec s = orderBy.get(0);
CmisSelector sel = s.getSelector();
int result;
if (queryObj.isPredfinedQueryName(sel.getName())) {
// must be SEARCH_SCORE which is currently ignored
result = 0;
} else if (sel instanceof ColumnReference) {
String propId = ((ColumnReference) sel).getPropertyId();
PropertyDefinition<?> pd = ((ColumnReference) sel).getPropertyDefinition();
Object propVal1 = PropertyQueryUtil.getProperty(so1, propId, pd);
Object propVal2 = PropertyQueryUtil.getProperty(so2, propId, pd);
if (propVal1 == null && propVal2 == null) {
result = 0;
} else if (propVal1 == null) {
result = -1;
} else if (propVal2 == null) {
result = 1;
} else {
result = ((Comparable<Object>) propVal1).compareTo(propVal2);
}
} else {
// evaluate function here, currently ignore
result = 0;
}
if (!s.isAscending()) {
result = -result;
}
return result;
}
}
if (orderBy.size() > 0) {
Collections.sort(matches, new ResultComparator());
}
}
/*
* Check for each object contained in the in-memory repository if it matches
* the current query expression. If yes add it to the list of matched
* objects.
*/
private void match(StoredObject so, String user, boolean searchAllVersions) {
// first check if type is matching...
// as we don't support joins take first type
String queryName = queryObj.getTypes().values().iterator().next();
TypeDefinition td = queryObj.getTypeDefinitionFromQueryName(queryName);
// we are only interested in versions not in the series
boolean skip = so instanceof VersionedDocument;
boolean typeMatches = typeMatches(td, so);
if (!searchAllVersions && so instanceof DocumentVersion
&& ((DocumentVersion) so).getParentDocument().getLatestVersion(false) != so) {
skip = true;
}
// ... then check expression...
if (typeMatches && !skip) {
evalWhereTree(whereTree, user, so);
}
}
private void evalWhereTree(Tree node, String user, StoredObject so) {
boolean match = true;
if (null != node) {
match = evalWhereNode(so, user, node);
}
if (match && objStore.hasReadAccess(user, so)) {
matches.add(so); // add to list
}
}
/*
* For each object check if it matches and append it to match-list if it
* does. We do here our own walking mechanism so that we can pass additional
* parameters and define the return types.
*/
private boolean evalWhereNode(StoredObject so, String user, Tree node) {
return new InMemoryWhereClauseWalker(so, user).walkPredicate(node);
}
public class InMemoryWhereClauseWalker extends AbstractPredicateWalker {
protected final StoredObject so;
protected final String user;
public InMemoryWhereClauseWalker(StoredObject so, String user) {
this.so = so;
this.user = user;
}
public Boolean walkNot(Tree opNode, Tree node) {
boolean hasMatched = walkPredicate(node);
return !hasMatched;
}
public Boolean walkAnd(Tree opNode, Tree leftNode, Tree rightNode) {
boolean matches1 = walkPredicate(leftNode);
boolean matches2 = walkPredicate(rightNode);
return matches1 && matches2;
}
public Boolean walkOr(Tree opNode, Tree leftNode, Tree rightNode) {
boolean matches1 = walkPredicate(leftNode);
boolean matches2 = walkPredicate(rightNode);
return matches1 || matches2;
}
public Boolean walkEquals(Tree opNode, Tree leftNode, Tree rightNode) {
Integer cmp = compareTo(leftNode, rightNode);
return cmp == null ? false : cmp == 0;
}
public Boolean walkNotEquals(Tree opNode, Tree leftNode, Tree rightNode) {
Integer cmp = compareTo(leftNode, rightNode);
return cmp == null ? false : cmp != 0;
}
public Boolean walkGreaterThan(Tree opNode, Tree leftNode, Tree rightNode) {
Integer cmp = compareTo(leftNode, rightNode);
return cmp == null ? false : cmp > 0;
}
public Boolean walkGreaterOrEquals(Tree opNode, Tree leftNode, Tree rightNode) {
Integer cmp = compareTo(leftNode, rightNode);
return cmp == null ? false : cmp >= 0;
}
public Boolean walkLessThan(Tree opNode, Tree leftNode, Tree rightNode) {
Integer cmp = compareTo(leftNode, rightNode);
return cmp == null ? false : cmp < 0;
}
public Boolean walkLessOrEquals(Tree opNode, Tree leftNode, Tree rightNode) {
Integer cmp = compareTo(leftNode, rightNode);
return cmp == null ? false : cmp <= 0;
}
public Boolean walkIn(Tree opNode, Tree colNode, Tree listNode) {
ColumnReference colRef = getColumnReference(colNode);
PropertyDefinition<?> pd = colRef.getPropertyDefinition();
List<Object> literals = onLiteralList(listNode);
Object prop = PropertyQueryUtil.getProperty(so, colRef.getPropertyId(), pd);
if (pd.getCardinality() != Cardinality.SINGLE) {
throw new IllegalStateException("Operator IN only is allowed on single-value properties ");
} else if (prop == null) {
return false;
} else {
return literals.contains(prop);
}
}
public Boolean walkNotIn(Tree opNode, Tree colNode, Tree listNode) {
// Note just return !walkIn(node, colNode, listNode) is wrong,
// because
// then it evaluates to true for null values (not set properties).
ColumnReference colRef = getColumnReference(colNode);
PropertyDefinition<?> pd = colRef.getPropertyDefinition();
Object prop = PropertyQueryUtil.getProperty(so, colRef.getPropertyId(), pd);
List<Object> literals = onLiteralList(listNode);
if (pd.getCardinality() != Cardinality.SINGLE) {
throw new IllegalStateException("Operator IN only is allowed on single-value properties ");
} else if (prop == null) {
return false;
} else {
return !literals.contains(prop);
}
}
public Boolean walkInAny(Tree opNode, Tree colNode, Tree listNode) {
ColumnReference colRef = getColumnReference(colNode);
PropertyDefinition<?> pd = colRef.getPropertyDefinition();
PropertyData<?> lVal = so.getProperties().get(colRef.getPropertyId());
List<Object> literals = onLiteralList(listNode);
if (pd.getCardinality() != Cardinality.MULTI) {
throw new IllegalStateException("Operator ANY...IN only is allowed on multi-value properties ");
} else if (lVal == null) {
return false;
} else {
List<?> props = lVal.getValues();
for (Object prop : props) {
LOG.debug("comparing with: " + prop);
if (literals.contains(prop)) {
return true;
}
}
return false;
}
}
public Boolean walkNotInAny(Tree opNode, Tree colNode, Tree listNode) {
// Note just return !walkNotInAny(node, colNode, listNode) is
// wrong, because
// then it evaluates to true for null values (not set properties).
ColumnReference colRef = getColumnReference(colNode);
PropertyDefinition<?> pd = colRef.getPropertyDefinition();
PropertyData<?> lVal = so.getProperties().get(colRef.getPropertyId());
List<Object> literals = onLiteralList(listNode);
if (pd.getCardinality() != Cardinality.MULTI) {
throw new IllegalStateException("Operator ANY...IN only is allowed on multi-value properties ");
} else if (lVal == null) {
return false;
} else {
List<?> props = lVal.getValues();
for (Object prop : props) {
LOG.debug("comparing with: " + prop);
if (literals.contains(prop)) {
return false;
}
}
return true;
}
}
public Boolean walkEqAny(Tree opNode, Tree literalNode, Tree colNode) {
ColumnReference colRef = getColumnReference(colNode);
PropertyDefinition<?> pd = colRef.getPropertyDefinition();
PropertyData<?> lVal = so.getProperties().get(colRef.getPropertyId());
Object literal = walkExpr(literalNode);
if (pd.getCardinality() != Cardinality.MULTI) {
throw new IllegalStateException("Operator = ANY only is allowed on multi-value properties ");
} else if (lVal == null) {
return false;
} else {
List<?> props = lVal.getValues();
return props.contains(literal);
}
}
public Boolean walkIsNull(Tree opNode, Tree colNode) {
ColumnReference colRef = getColumnReference(colNode);
PropertyDefinition<?> pd = colRef.getPropertyDefinition();
Object propVal = PropertyQueryUtil.getProperty(so, colRef.getPropertyId(), pd);
return propVal == null;
}
public Boolean walkIsNotNull(Tree opNode, Tree colNode) {
ColumnReference colRef = getColumnReference(colNode);
PropertyDefinition<?> pd = colRef.getPropertyDefinition();
Object propVal = PropertyQueryUtil.getProperty(so, colRef.getPropertyId(), pd);
return propVal != null;
}
public Boolean walkLike(Tree opNode, Tree colNode, Tree stringNode) {
Object rVal = walkExpr(stringNode);
if (!(rVal instanceof String)) {
throw new IllegalStateException("LIKE operator requires String literal on right hand side.");
}
ColumnReference colRef = getColumnReference(colNode);
PropertyDefinition<?> pd = colRef.getPropertyDefinition();
PropertyType propType = pd.getPropertyType();
if (propType != PropertyType.STRING && propType != PropertyType.HTML && propType != PropertyType.ID
&& propType != PropertyType.URI) {
throw new IllegalStateException("Property type " + propType.value() + " is not allowed FOR LIKE");
}
if (pd.getCardinality() != Cardinality.SINGLE) {
throw new IllegalStateException("LIKE is not allowed for multi-value properties ");
}
String propVal = (String) PropertyQueryUtil.getProperty(so, colRef.getPropertyId(), pd);
if (null == propVal) {
return false;
} else {
String pattern = translatePattern((String) rVal); // SQL to Java
// regex
// syntax
Pattern p = Pattern.compile(pattern);
return p.matcher(propVal).matches();
}
}
public Boolean walkNotLike(Tree opNode, Tree colNode, Tree stringNode) {
return !walkLike(opNode, colNode, stringNode);
}
public Boolean walkInFolder(Tree opNode, Tree qualNode, Tree paramNode) {
if (null != qualNode) {
getTableReference(qualNode);
// just for error checking we do not evaluate this, there is
// only one from without join support
}
Object lit = walkExpr(paramNode);
if (!(lit instanceof String)) {
throw new IllegalStateException("Folder id in IN_FOLDER must be of type String");
}
String folderId = (String) lit;
// check if object is in folder
if (so instanceof Filing) {
return hasParent(so, folderId, user);
} else {
return false;
}
}
public Boolean walkInTree(Tree opNode, Tree qualNode, Tree paramNode) {
if (null != qualNode) {
getTableReference(qualNode);
// just for error checking we do not evaluate this, there is
// only one from without join support
}
Object lit = walkExpr(paramNode);
if (!(lit instanceof String)) {
throw new IllegalStateException("Folder id in IN_FOLDER must be of type String");
}
String folderId = (String) lit;
// check if object is in folder
if (so instanceof Filing) {
return hasAncestor(so, folderId, user);
} else {
return false;
}
}
protected Integer compareTo(Tree leftChild, Tree rightChild) {
Object rVal = walkExpr(rightChild);
ColumnReference colRef = getColumnReference(leftChild);
PropertyDefinition<?> pd = colRef.getPropertyDefinition();
Object val = PropertyQueryUtil.getProperty(so, colRef.getPropertyId(), pd);
if (val == null) {
return null;
} else if (val instanceof List<?>) {
throw new IllegalStateException(
"You can't query operators <, <=, ==, !=, >=, > on multi-value properties ");
} else {
return InMemoryQueryProcessor.this.compareTo(pd, val, rVal);
}
}
@SuppressWarnings("unchecked")
public List<Object> onLiteralList(Tree node) {
return (List<Object>) walkExpr(node);
}
protected Boolean walkTextAnd(Tree node) {
List<Tree> terms = getChildrenAsList(node);
for (Tree term : terms) {
Boolean foundOnce = walkSearchExpr(term);
if (foundOnce == null || !foundOnce) {
return false;
}
}
return true;
}
protected Boolean walkTextOr(Tree node) {
List<Tree> terms = getChildrenAsList(node);
for (Tree term : terms) {
Boolean foundOnce = walkSearchExpr(term);
if (foundOnce != null && foundOnce) {
return true;
}
}
return false;
}
protected Boolean walkTextMinus(Tree node) {
return !findText(node.getChild(0).getText());
}
protected Boolean walkTextWord(Tree node) {
return findText(node.getText());
}
protected Boolean walkTextPhrase(Tree node) {
String phrase = node.getText();
return findText(phrase.substring(1, phrase.length() - 1));
}
private List<Tree> getChildrenAsList(Tree node) {
List<Tree> res = new ArrayList<Tree>(node.getChildCount());
for (int i = 0; i < node.getChildCount(); i++) {
Tree childNnode = node.getChild(i);
res.add(childNnode);
}
return res;
}
private boolean findText(String nodeText) {
Content cont = (Content) so;
String pattern = StringUtil.unescape(nodeText, "\\'-");
if (null == pattern) {
throw new CmisInvalidArgumentException("Illegal Escape sequence in text search expression " + nodeText);
}
if (so instanceof Content && cont.hasContent()) {
ContentStreamDataImpl cdi = (ContentStreamDataImpl) cont.getContent();
if (cdi.getMimeType().startsWith("text/")) {
byte[] ba = cdi.getBytes();
String text;
try {
text = new String(ba, "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new CmisRuntimeException("Internal error: Unsupported encoding UTF-8", e);
}
int match = text.indexOf(pattern);
return match >= 0;
} else {
return false;
}
}
return false;
}
}
private boolean hasParent(StoredObject objInFolder, String folderId, String user) {
List<String> parents = objStore.getParentIds(objInFolder, user);
for (String parentId : parents) {
if (folderId.equals(parentId)) {
return true;
}
}
return false;
}
private boolean hasAncestor(StoredObject objInFolder, String folderId, String user) {
List<String> parents = objStore.getParentIds(objInFolder, user);
for (String parentId : parents) {
if (folderId.equals(parentId)) {
return true;
}
}
for (String parentId : parents) {
Folder parentFolder = (Folder) objStore.getObjectById(parentId);
if (hasAncestor(parentFolder, folderId, user)) {
return true;
}
}
return false;
}
protected int compareTo(PropertyDefinition<?> td, Object lValue, Object rVal) {
switch (td.getPropertyType()) {
case BOOLEAN:
if (rVal instanceof Boolean) {
return ((Boolean) lValue).compareTo((Boolean) rVal);
} else {
throwIncompatibleTypesException(lValue, rVal);
}
break;
case INTEGER:
Long lLongValue = ((BigInteger) lValue).longValue();
if (rVal instanceof Long) {
return (lLongValue).compareTo((Long) rVal);
} else if (rVal instanceof Double) {
return Double.valueOf(((Integer) lValue).doubleValue()).compareTo((Double) rVal);
} else {
throwIncompatibleTypesException(lValue, rVal);
}
break;
case DATETIME:
if (rVal instanceof GregorianCalendar) {
return ((GregorianCalendar) lValue).compareTo((GregorianCalendar) rVal);
} else {
throwIncompatibleTypesException(lValue, rVal);
}
break;
case DECIMAL:
Double lDoubleValue = ((BigDecimal) lValue).doubleValue();
if (rVal instanceof Double) {
return lDoubleValue.compareTo((Double) rVal);
} else if (rVal instanceof Long) {
return lDoubleValue.compareTo(Double.valueOf(((Long) rVal)));
} else {
throwIncompatibleTypesException(lValue, rVal);
}
break;
case HTML:
case STRING:
case URI:
case ID:
if (rVal instanceof String) {
LOG.debug("compare strings: " + lValue + " with " + rVal);
return ((String) lValue).compareTo((String) rVal);
} else {
throwIncompatibleTypesException(lValue, rVal);
}
break;
}
return 0;
}
private ColumnReference getColumnReference(Tree columnNode) {
CmisSelector sel = queryObj.getColumnReference(columnNode.getTokenStartIndex());
if (null == sel) {
throw new IllegalStateException("Unknown property query name " + columnNode.getChild(0));
} else if (sel instanceof ColumnReference) {
return (ColumnReference) sel;
} else {
throw new IllegalStateException("Unexpected numerical value function in where clause");
}
}
private String getTableReference(Tree tableNode) {
String typeQueryName = queryObj.getTypeQueryName(tableNode.getText());
if (null == typeQueryName) {
throw new IllegalStateException("Inavlid type in IN_FOLDER() or IN_TREE(), must be in FROM list: "
+ tableNode.getText());
}
return typeQueryName;
}
private void doAdditionalChecks(CmisQueryWalker walker) {
if (walker.getNumberOfContainsClauses() > 1) {
throw new CmisInvalidArgumentException("More than one CONTAINS clause is not allowed");
}
List<JoinSpec> joins = queryObj.getJoins();
if (null == secondaryTypeIds && joins.size() > 0) {
throw new CmisInvalidArgumentException(
"JOINs are not supported with the exception of secondary types and a LEFT OUTER JOIN");
} else if (null != secondaryTypeIds) {
for (JoinSpec join : joins) {
if (!join.kind.equals("LEFT")) {
throw new CmisInvalidArgumentException(
"JOINs are not supported with the exception of secondary types and a LEFT OUTER JOIN");
}
}
}
}
/**
* Translate SQL wildcards %, _ to Java regex syntax.
*
* @param wildcardString
* string to process
* @return
* string with replaced characters
*/
public static String translatePattern(String wildcardString) {
int index = 0;
int start = 0;
String wildcard = wildcardString;
StringBuilder res = new StringBuilder();
while (index >= 0) {
index = wildcard.indexOf('%', start);
if (index < 0) {
res.append(wildcard.substring(start));
} else if (index == 0 || index > 0 && wildcard.charAt(index - 1) != '\\') {
res.append(wildcard.substring(start, index));
res.append(".*");
} else {
res.append(wildcard.substring(start, index + 1));
}
start = index + 1;
}
wildcard = res.toString();
index = 0;
start = 0;
res = new StringBuilder();
while (index >= 0) {
index = wildcard.indexOf('_', start);
if (index < 0) {
res.append(wildcard.substring(start));
} else if (index == 0 || index > 0 && wildcard.charAt(index - 1) != '\\') {
res.append(wildcard.substring(start, index));
res.append(".");
} else {
res.append(wildcard.substring(start, index + 1));
}
start = index + 1;
}
return res.toString();
}
private static void throwIncompatibleTypesException(Object o1, Object o2) {
throw new CmisInvalidArgumentException("Incompatible Types to compare: " + o1 + " and " + o2);
}
}
| [
"lelan-j@mgdis.fr"
] | lelan-j@mgdis.fr |
31f10d3ac533d0ff49ca41bb27e5c68bd64662a7 | d64cf02cb4202b742a496436484de7916e177849 | /roadpushled/src/main/java/com/daway/config/TaskPoolConfig.java | 99591ed0feb8446a8362d5a7ceb39094eee3f0f8 | [] | no_license | wanghh520/gitroad | d9b7668a7d6393a1cf9855ff83dd6b0da93cc86e | 84813d1dec1466e46c4e95ac03d86b47b6a56fea | refs/heads/master | 2023-06-13T06:43:34.954937 | 2021-07-14T01:27:55 | 2021-07-14T01:27:55 | 368,801,794 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 923 | java | package com.daway.config;
import java.util.concurrent.Executor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
@Configuration
@EnableAsync
public class TaskPoolConfig {
@Bean("taskExecutor")
public Executor taskExecutro(){
ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor();
taskExecutor.setCorePoolSize(30);
taskExecutor.setMaxPoolSize(50);
taskExecutor.setQueueCapacity(200);
taskExecutor.setKeepAliveSeconds(60);
taskExecutor.setThreadNamePrefix("taskExecutor--");
taskExecutor.setWaitForTasksToCompleteOnShutdown(true);
taskExecutor.setAwaitTerminationSeconds(60);
return taskExecutor;
}
} | [
"w670049280@163.com"
] | w670049280@163.com |
3e5f5716e64c67643ce390b4abb3f6f77db41fb5 | e15dada2485a1cc8927de31a2bee7bd0e8f81319 | /src/main/java/com/financing/test/OrderTest.java | 7cd1f3195a4d7dd1f0ba667d963e4610eeec3699 | [] | no_license | lizexu122/zhongchou | f337953adb97832a09c6543587c4d78d8a076058 | 0ed288c5dacb010ee16ea886b22257c4149e1ef9 | refs/heads/master | 2020-04-06T19:11:26.072038 | 2019-05-13T15:19:47 | 2019-05-13T15:19:47 | 157,729,134 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 841 | java | package com.financing.test;
import com.financing.dao.UserDao;
import com.financing.entity.User;
import com.financing.service.OrderService;
import com.financing.service.UserService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
* Created by Penny on 2018/5/13.
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:spring/applicationContext.xml"})
public class OrderTest {
@Autowired
private OrderService orderService;
/**
* 测试添加用户
*/
@Test
public void testOrderStatistic(){
System.out.println(orderService.getOrderStatistic());
}
}
| [
"2694294196@qq.com"
] | 2694294196@qq.com |
e3df6de9ea051237474152402da279a837894b5c | de462e6b0e80d17ea015b3b38b2719bf26e74c77 | /src/main/java/it/alexandria/hibernate/control/Ricerca.java | f6dcbb160ae6363b43b96a8fc2d8b8d236cdefab | [] | no_license | LukeMay35/ProgettoHibernate | 09e20d424f38bac0bc4eb97b2f78f40c9d8fae30 | 85f37e76a9cfcf3e7663293e1bca5c69d93193df | refs/heads/master | 2022-11-29T21:11:03.953871 | 2019-06-09T15:54:29 | 2019-06-09T15:54:29 | 189,377,146 | 0 | 0 | null | 2022-11-24T07:42:06 | 2019-05-30T08:37:16 | CSS | UTF-8 | Java | false | false | 2,512 | java | package it.alexandria.hibernate.control;
import java.io.IOException;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.hibernate.Session;
import it.alexandria.hibernate.model.Risorsa;
public class Ricerca extends HttpServlet implements IRicerca{
/**
*
*/
private static final long serialVersionUID = 6590834714280558759L;
public void doGet(HttpServletRequest request, HttpServletResponse response) {
List<Risorsa> risorse=ottieniRisorse(request,response);
if(risorse==null) {
try {
response.sendRedirect("login.html");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return;
}
request.getSession().setAttribute("risorseRicercate", risorse);
try {
request.getRequestDispatcher("index.jsp").forward(request, response);;
} catch (IOException | ServletException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public List<Risorsa> ottieniRisorse(HttpServletRequest request, HttpServletResponse response) {
if(request.getSession()==null) {
return null;
}else {
if (request.getSession().getAttribute("username") == null) {
return null;
}
}
String chiave=request.getParameter("chiave");
Session session = HibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
if(chiave!=null) {
chiave="%"+chiave+"%";
HibernateUtil.printLog("Avvenuta ricerca da utente "+request.getSession().getAttribute("username")+" con chiave "+chiave);
@SuppressWarnings("unchecked")
List<Risorsa> risorseS=(List<Risorsa>)session.createQuery("FROM RISORSA WHERE RES_ID NOT IN (SELECT ven.risorsaVenduta.id FROM it.alexandria.hibernate.model.Vendita as ven) AND (TITOLO LIKE :CHIAVE OR CATEGORIA LIKE :CHIAVE OR AUTORI LIKE :CHIAVE OR DESCRIZIONE LIKE :CHIAVE)")
.setParameter("CHIAVE", chiave)
.getResultList();
session.getTransaction().commit();
session.close();
return risorseS;
}
HibernateUtil.printLog("Avvenuta ricerca da utente "+request.getSession().getAttribute("username"));
@SuppressWarnings("unchecked")
List<Risorsa> risorse=(List<Risorsa>)session.createQuery("FROM RISORSA WHERE RES_ID NOT IN (SELECT ven.risorsaVenduta.id FROM it.alexandria.hibernate.model.Vendita as ven)")
.getResultList();
session.getTransaction().commit();
session.close();
return risorse;
}
}
| [
"41739916+LukeMay35@users.noreply.github.com"
] | 41739916+LukeMay35@users.noreply.github.com |
640342863009e9a49b0735886b68876c75d3b82e | 8e3fc4b5e38b11c1ee3498a93d1bdcb08d7bd991 | /samples/client/petstore/java/retrofit2-play26/src/test/java/org/openapitools/client/api/FakeApiTest.java | 4889e92772cc76643d34a215ebdd6ddeca16f981 | [
"Apache-2.0"
] | permissive | infotech-group/openapi-generator | ad273d820465be630e25e47ff27ac21a80c887f1 | 0a00903601117c358329f4b37c5bc9ae45508781 | refs/heads/master | 2020-03-28T14:56:40.247404 | 2018-09-13T21:45:32 | 2018-09-13T21:45:32 | 148,538,419 | 1 | 0 | Apache-2.0 | 2018-09-13T21:40:53 | 2018-09-12T20:31:43 | HTML | UTF-8 | Java | false | false | 4,963 | java | package org.openapitools.client.api;
import org.junit.Before;
import org.junit.Test;
import org.openapitools.client.ApiClient;
import org.openapitools.client.model.Client;
import org.openapitools.client.model.FileSchemaTestClass;
import org.openapitools.client.model.OuterComposite;
import org.openapitools.client.model.User;
import org.threeten.bp.LocalDate;
import org.threeten.bp.OffsetDateTime;
import java.io.File;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
/**
* API tests for FakeApi
*/
public class FakeApiTest {
private FakeApi api;
@Before
public void setup() {
api = new ApiClient().createService(FakeApi.class);
}
/**
*
*
* Test serialization of outer boolean types
*/
@Test
public void fakeOuterBooleanSerializeTest() {
Boolean body = null;
// Boolean response = api.fakeOuterBooleanSerialize(body);
// TODO: test validations
}
/**
*
*
* Test serialization of object with outer number type
*/
@Test
public void fakeOuterCompositeSerializeTest() {
OuterComposite outerComposite = null;
// OuterComposite response = api.fakeOuterCompositeSerialize(outerComposite);
// TODO: test validations
}
/**
*
*
* Test serialization of outer number types
*/
@Test
public void fakeOuterNumberSerializeTest() {
BigDecimal body = null;
// BigDecimal response = api.fakeOuterNumberSerialize(body);
// TODO: test validations
}
/**
*
*
* Test serialization of outer string types
*/
@Test
public void fakeOuterStringSerializeTest() {
String body = null;
// String response = api.fakeOuterStringSerialize(body);
// TODO: test validations
}
/**
*
*
* For this test, the body for this request much reference a schema named `File`.
*/
@Test
public void testBodyWithFileSchemaTest() {
FileSchemaTestClass fileSchemaTestClass = null;
// api.testBodyWithFileSchema(fileSchemaTestClass);
// TODO: test validations
}
/**
*
*
*
*/
@Test
public void testBodyWithQueryParamsTest() {
String query = null;
User user = null;
// api.testBodyWithQueryParams(query, user);
// TODO: test validations
}
/**
* To test \"client\" model
*
* To test \"client\" model
*/
@Test
public void testClientModelTest() {
Client client = null;
// Client response = api.testClientModel(client);
// TODO: test validations
}
/**
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
*
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
*/
@Test
public void testEndpointParametersTest() {
BigDecimal number = null;
Double _double = null;
String patternWithoutDelimiter = null;
byte[] _byte = null;
Integer integer = null;
Integer int32 = null;
Long int64 = null;
Float _float = null;
String string = null;
File binary = null;
LocalDate date = null;
OffsetDateTime dateTime = null;
String password = null;
String paramCallback = null;
// api.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback);
// TODO: test validations
}
/**
* To test enum parameters
*
* To test enum parameters
*/
@Test
public void testEnumParametersTest() {
List<String> enumHeaderStringArray = null;
String enumHeaderString = null;
List<String> enumQueryStringArray = null;
String enumQueryString = null;
Integer enumQueryInteger = null;
Double enumQueryDouble = null;
List<String> enumFormStringArray = null;
String enumFormString = null;
// api.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString);
// TODO: test validations
}
/**
* test inline additionalProperties
*
*
*/
@Test
public void testInlineAdditionalPropertiesTest() {
Map<String, String> requestBody = null;
// api.testInlineAdditionalProperties(requestBody);
// TODO: test validations
}
/**
* test json serialization of form data
*
*
*/
@Test
public void testJsonFormDataTest() {
String param = null;
String param2 = null;
// api.testJsonFormData(param, param2);
// TODO: test validations
}
}
| [
"wing328hk@gmail.com"
] | wing328hk@gmail.com |
00c529f77983534e4c08951406729cc53dd15c20 | b67a12a8669619b155b9196469a614136701f2ac | /sdk/paylib/runtime-src/com/thumb/payapi/jpay/JPay.java | 838bcd31157e8c3a7ab52f1bdced1d1c79a67bcc | [] | no_license | rusteer/pay | f849ee646b90674be35837373489e738859dd7c8 | 9252827763fe60a5a11f18f0e3a9c2dc9eb7d044 | refs/heads/master | 2021-01-17T19:18:16.010638 | 2016-08-04T06:44:35 | 2016-08-04T06:44:35 | 63,956,771 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 282 | java | package com.thumb.payapi.jpay;
import android.content.Context;
import com.thumb.payapi.Pay.PayCallback;
public class JPay {
public static void init(final Context context) {}
public static void pay(final Context context, final int payIndex, final PayCallback callback) {}
}
| [
"rusteer@outlook.com"
] | rusteer@outlook.com |
cbc24cb1bbe4a0c16706ca0ba08fe8db33d020ed | 86b245679c2e371602c094e6fcf0ae19854b056e | /TMCProjects/mooc-java-programming-i/part04-Part04_08.DecreasingCounter/src/main/java/DecreasingCounter.java | c4a44176eb3741ae05ee2cc24a2c8f20125105f4 | [] | no_license | jayhan1109/Java-Programming-MOOC-fi-Solutions | b63fe9be00791aedf05e5561ccfe8415ed2163f2 | b61564393631c993bc3b04983bfbc556e99d86da | refs/heads/master | 2023-01-03T15:31:17.794387 | 2020-11-02T00:31:36 | 2020-11-02T00:31:36 | 307,029,263 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 640 | java |
public class DecreasingCounter {
private int value; // an object variable for storing the value of the counter
public DecreasingCounter(int initialValue) {
this.value = initialValue;
}
public void printValue() {
// Do not change this code!
System.out.println("value: " + this.value);
}
public void decrement() {
// write the method implementation here
// the aim is to decrement the value of the counter by one
if (value > 0) {
this.value--;
}
}
// the other methods go here
public void reset() {
this.value = 0;
}
}
| [
"jayhan1109@gmail.com"
] | jayhan1109@gmail.com |
2a42ced08b6ca0425b6a746b9db8074bea6f62e5 | 052e34e6aad761c884ae619087ef7fc550fc5318 | /Revature/Lab-NestedLoops/src/ProductPrinter.java | 7138ebbe624ff7623b2b152be15ad7dde8cbe8f2 | [] | no_license | ivan-revature/repo-primer | e230219ec6da062a2b365ba7e0245730048adc91 | 9070caf6992c72b750e4221e45c15bc94e2ed622 | refs/heads/main | 2023-06-27T11:27:28.891464 | 2021-07-31T01:28:40 | 2021-07-31T01:28:40 | 385,802,607 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 564 | java |
public class ProductPrinter {
public static void main(String[] args) {
// TODO Auto-generated method stub
int[] arr1 = {2,4,6,8,10,12,14,16,18,20};
int[] arr2 = {1,2,3,5,7,9,11,13,17,19};
//iterate over the first set of numbers
for (int i = 0; i < arr1.length; i++) {
//iterate over the second set of numbers
for (int j = 0; j < arr2.length; j++) {
//print the product of the current elements from each set
System.out.println(arr1[i] * arr2[j]);
}
}
}
}
| [
"ivan.fletes@revature.net"
] | ivan.fletes@revature.net |
1e3f2c5b4839fc1ba5ded8ed192251c9ff299e81 | 6729f181684026dc130915c44659010f98e17a19 | /app/src/main/java/com/app/instashare/ui/user/presenter/UserImagesPresenter.java | 13f7cbb27da3f2658390e1203a454e17e5d89258 | [] | no_license | Pitisflow/InstaShare | 9fc42e645d447f81ccb633c9c229fa8956af8c56 | 9a11470209910e868934a62e8d8f3c7ac3335d67 | refs/heads/master | 2020-03-11T20:04:46.598596 | 2018-06-03T20:05:19 | 2018-06-03T20:05:19 | 130,226,675 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,156 | java | package com.app.instashare.ui.user.presenter;
import com.app.instashare.interactor.UserInteractor;
import com.app.instashare.ui.user.view.UserImagesView;
import java.util.ArrayList;
/**
* Created by Pitisflow on 3/6/18.
*/
public class UserImagesPresenter implements UserInteractor.OnUserImagesDownload{
private UserImagesView view;
public UserImagesPresenter(UserImagesView view) {
this.view = view;
}
public void onInitialize(String userKey)
{
UserInteractor.downloadUserImages(userKey, this);
}
public void terminate()
{
view = null;
}
public void onNewMainImageSelected(String imageURL, String userKey) {
UserInteractor.setUserImage(userKey, imageURL);
}
@Override
public void downloading() {
}
@Override
public void downloadCompleted(ArrayList<String> images) {
if (images != null && view != null)
{
for (String image : images) {
view.addImage(image);
}
}
}
@Override
public void downloadEmpty() {
if (view != null) view.enableNoImages(true);
}
}
| [
"javiergarciantunez@gmail.com"
] | javiergarciantunez@gmail.com |
d9faa276b7c71095e60cd220f5ed7d781ad3aa1b | 6d3628bac2cccc452877ce1e7f91813228033984 | /server/src/au/com/codeka/warworlds/server/ctrl/NotificationController.java | 24e3da08adabb1ea9aee80e377b88ea269a4f2ed | [
"MIT"
] | permissive | jiangwh/wwmmo | 36032cf6934bc5f29c5d67598d26071f5ad5f873 | bd2efc694caded90f441682dff4a8dabfd1a1a81 | refs/heads/master | 2021-01-21T07:38:40.298387 | 2014-11-10T01:54:20 | 2014-11-10T01:54:20 | 26,466,618 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,479 | java | package au.com.codeka.warworlds.server.ctrl;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import org.joda.time.DateTime;
import au.com.codeka.common.Log;
import au.com.codeka.common.model.BaseChatConversationParticipant;
import au.com.codeka.warworlds.server.Configuration;
import au.com.codeka.warworlds.server.RequestException;
import au.com.codeka.warworlds.server.data.DB;
import au.com.codeka.warworlds.server.data.SqlResult;
import au.com.codeka.warworlds.server.data.SqlStmt;
import au.com.codeka.warworlds.server.handlers.NotificationHandler;
import au.com.codeka.warworlds.server.model.ChatConversation;
import au.com.codeka.warworlds.server.model.ChatConversationParticipant;
import com.google.android.gcm.server.Constants;
import com.google.android.gcm.server.Message;
import com.google.android.gcm.server.Result;
import com.google.android.gcm.server.Sender;
import com.google.common.collect.Lists;
public class NotificationController {
private final Log log = new Log("NotificationController");
private static String API_KEY = "AIzaSyADWOC-tWUbzj-SVW13Sz5UuUiGfcmHHDA";
private static RecentNotificationCache sRecentNotifications = new RecentNotificationCache();
private static NotificationHandlerCache sHandlers = new NotificationHandlerCache();
public void sendNotificationToConversation(int conversationID, String name, String value) throws RequestException {
ChatConversation conversation = new ChatController().getConversation(conversationID);
if (conversation == null || conversation.getParticipants() == null) {
return;
}
ArrayList<ChatConversationParticipant> participants = new ArrayList<ChatConversationParticipant>();
for (BaseChatConversationParticipant participant : conversation.getParticipants()) {
participants.add((ChatConversationParticipant) participant);
}
ChatConversationParticipant[] arr = new ChatConversationParticipant[participants.size()];
participants.toArray(arr);
sendNotification(arr, new Notification(name, value));
}
public void sendNotificationToEmpire(int empireID, String name, String value) throws RequestException {
sendNotification(new ChatConversationParticipant[] {new ChatConversationParticipant(empireID, false)}, new Notification(name, value));
}
public void sendNotificationToOnlineEmpire(int empireID, String name, String value) throws RequestException {
Notification notification = new Notification(name, value);
if (!sHandlers.sendNotification(empireID, notification)) {
sRecentNotifications.addNotification(empireID, notification);
}
}
public void sendNotificationToOnlineAlliance(int allianceID, String name, String value) throws RequestException {
Notification notification = new Notification(name, value);
sHandlers.sendNotificationToAlliance(allianceID, notification);
}
public void sendNotificationToAllOnline(String name, String value) throws RequestException {
TreeMap<String, String> values = new TreeMap<String, String>();
values.put(name, value);
Notification notification = new Notification(name, value);
sHandlers.sendNotificationToAll(notification);
}
public List<Map<String, String>> getRecentNotifications(int empireID) {
List<Map<String, String>> notifications = new ArrayList<Map<String, String>>();
for (Notification n : sRecentNotifications.getRecentNotifications(empireID)) {
if (n.isTooOld()) {
continue;
}
notifications.add(n.values);
}
return notifications;
}
public void addNotificationHandler(int empireID, NotificationHandler handler) {
sHandlers.addNotificationHandler(empireID, handler);
}
private void sendNotification(ChatConversationParticipant[] participants, Notification notification) throws RequestException {
Message.Builder msgBuilder = new Message.Builder();
for (Map.Entry<String, String> value : notification.values.entrySet()) {
msgBuilder.addData(value.getKey(), value.getValue());
}
// go through attached handlers and mark any in there as already done.
Set<Integer> doneEmpires = new HashSet<Integer>();
for (ChatConversationParticipant participant : participants) {
if (participant.isMuted()) {
continue;
}
if (!doneEmpires.contains(participant.getEmpireID())) {
if (sHandlers.sendNotification(participant.getEmpireID(), notification)) {
doneEmpires.add(participant.getEmpireID());
} else {
sRecentNotifications.addNotification(participant.getEmpireID(), notification);
}
}
}
Map<String, String> devices = new TreeMap<String, String>();
String sql = "SELECT gcm_registration_id, devices.user_email, empires.id AS empire_id" +
" FROM devices" +
" INNER JOIN empires ON devices.user_email = empires.user_email" +
" WHERE empires.id IN " + BaseDataBase.buildInClause(participants) +
" AND gcm_registration_id IS NOT NULL";
try (SqlStmt stmt = DB.prepare(sql)) {
SqlResult res = stmt.select();
while (res.next()) {
String registrationId = res.getString(1);
String email = res.getString(2);
int empireID = res.getInt(3);
if (doneEmpires.contains(empireID)) {
continue;
}
ChatConversationParticipant participant = null;
for (ChatConversationParticipant p : participants) {
if (p.getEmpireID() == empireID) {
participant = p;
break;
}
}
if ((participant == null || !participant.isMuted()) && registrationId != null && email != null) {
devices.put(registrationId, email);
}
}
} catch(Exception e) {
throw new RequestException(e);
}
sendNotification(msgBuilder.build(), devices);
}
private void sendNotification(Message msg, Map<String, String> devices) throws RequestException {
Sender sender = new Sender(API_KEY);
try {
List<String> registrationIds = new ArrayList<String>();
for (String registrationId : devices.keySet()) {
registrationIds.add(registrationId);
}
if (registrationIds.size() == 0) {
return;
}
List<Result> results = sender.send(msg, registrationIds, 5).getResults();
for (int i = 0; i < results.size(); i++) {
Result result = results.get(i);
String registrationId = registrationIds.get(i);
boolean success = true;
if (result.getMessageId() != null) {
String canonicalRegistrationId = result.getCanonicalRegistrationId();
if (canonicalRegistrationId != null) {
handleCanonicalRegistrationId(registrationId, devices.get(registrationId), result);
success = false;
}
} else {
String errorCodeName = result.getErrorCodeName();
if (errorCodeName.equals(Constants.ERROR_NOT_REGISTERED)) {
handleNotRegisteredError(registrationId, devices.get(registrationId), result);
} else {
handleOtherError(registrationId, devices.get(registrationId), result);
}
success = false;
}
if (success) {
log.info(String.format("Notification successfully sent: %s user=%s registration=%s",
Configuration.i.getRealmName(), devices.get(registrationId), registrationId));
}
}
} catch (IOException e) {
log.error("Error caught sending notification.", e);
}
}
private void handleNotRegisteredError(String registrationId, String userEmail, Result result) throws RequestException {
log.warning("Could not send notification: DeviceNotRegistered: user=%s registration=%s",
userEmail, registrationId);
String sql = "UPDATE devices SET gcm_registration_id = NULL WHERE gcm_registration_id = ?";
try (SqlStmt stmt = DB.prepare(sql)) {
stmt.setString(1, registrationId);
stmt.update();
} catch(Exception e) {
throw new RequestException(e);
}
}
private void handleOtherError(String registrationId, String userEmail, Result result) throws RequestException {
log.warning("Could not send notification: %s: user=%s registration=%s",
result.getErrorCodeName(), userEmail, registrationId);
}
private void handleCanonicalRegistrationId(String registrationId, String userEmail, Result result) throws RequestException {
log.info("Notification registration changed: user=%s registration=%s",
userEmail, result.getCanonicalRegistrationId());
String sql = "UPDATE devices SET gcm_registration_id = ? WHERE gcm_registration_id = ?";
try (SqlStmt stmt = DB.prepare(sql)) {
stmt.setString(1, result.getCanonicalRegistrationId());
stmt.setString(2, registrationId);
stmt.update();
} catch(Exception e) {
throw new RequestException(e);
}
}
/**
* This class keeps an in-memory cache of "recent" notifications we've generated.
*/
private static class RecentNotificationCache {
private Map<Integer, List<Notification>> mCache;
private DateTime mLastTrimTime;
// don't keep notifications for more than this
private static final int MAX_MINUTES = 15;
public RecentNotificationCache() {
mCache = new TreeMap<Integer, List<Notification>>();
mLastTrimTime = DateTime.now();
}
public void addNotification(int empireID, Notification notification) {
synchronized(mCache) {
List<Notification> notifications = mCache.get(empireID);
if (notifications == null) {
notifications = new ArrayList<Notification>();
mCache.put(empireID, notifications);
}
notifications.add(notification);
}
long timeSinceTrimMillis = DateTime.now().getMillis() - mLastTrimTime.getMillis();
long timeSinceTrimMinutes = timeSinceTrimMillis / 60000;
if (timeSinceTrimMinutes > 30) {
trim();
mLastTrimTime = DateTime.now();
}
}
public List<Notification> getRecentNotifications(int empireID) {
synchronized(mCache) {
List<Notification> notifications = mCache.get(empireID);
if (notifications != null) {
mCache.remove(empireID);
return notifications;
}
}
return new ArrayList<Notification>();
}
/**
* Call this every now & them to trim the cache.
*/
public void trim() {
synchronized(mCache) {
List<Integer> empireIDs = Lists.newArrayList(mCache.keySet());
for (Integer empireID : empireIDs) {
List<Notification> notifications = mCache.get(empireID);
boolean allTooOld = true;
for (Notification n : notifications) {
if (!n.isTooOld()) {
allTooOld = false;
break;
}
}
if (allTooOld) {
mCache.remove(empireID);
}
}
}
}
}
private static class NotificationHandlerCache {
private HashMap<Integer, List<NotificationHandler>> mHandlers;
public NotificationHandlerCache() {
mHandlers = new HashMap<Integer, List<NotificationHandler>>();
}
public void addNotificationHandler(int empireID, NotificationHandler handler) {
synchronized(mHandlers) {
List<NotificationHandler> handlers = mHandlers.get(empireID);
if (handlers == null) {
handlers = new ArrayList<NotificationHandler>();
mHandlers.put(empireID, handlers);
}
handlers.add(handler);
}
}
public boolean sendNotification(int empireID, Notification notification) {
synchronized(mHandlers) {
List<NotificationHandler> handlers = mHandlers.get(empireID);
if (handlers != null && handlers.size() > 0) {
for (NotificationHandler handler : handlers) {
handler.sendNotification(notification);
}
// once a handler has processed a notification, it's finished and
// the client is expected to re-establish it.
handlers.clear();
return true;
}
}
return false;
}
/* Sends the given notification to all attached handlers at once. */
public void sendNotificationToAll(Notification notification) {
synchronized(mHandlers) {
for (List<NotificationHandler> handlers : mHandlers.values()) {
if (handlers != null && handlers.size() > 0) {
for (NotificationHandler handler : handlers) {
handler.sendNotification(notification);
}
// once a handler has processed a notification, it's finished and
// the client is expected to re-establish it.
handlers.clear();
}
}
}
}
/* Sends the given notification to all attached handlers at once, as long as they match the given alliance. */
public void sendNotificationToAlliance(int allianceID, Notification notification) {
synchronized(mHandlers) {
for (List<NotificationHandler> handlers : mHandlers.values()) {
if (handlers != null && handlers.size() > 0) {
boolean sent = false;
for (NotificationHandler handler : handlers) {
if (handler.getAllianceID() != allianceID) {
continue;
}
handler.sendNotification(notification);
sent = true;
}
// once a handler has processed a notification, it's finished and
// the client is expected to re-establish it.
if (sent) {
handlers.clear();
}
}
}
}
}
}
/**
* A wrapper around the data we need for a notification.
*/
public static class Notification {
public DateTime creation;
public Map<String, String> values;
public Notification(String name, String value) {
values = new TreeMap<String, String>();
values.put(name, value);
creation = DateTime.now();
}
public boolean isTooOld() {
long diffInMillis = DateTime.now().getMillis() - creation.getMillis();
long diffInMinutes = diffInMillis / 60000;
if (diffInMinutes > RecentNotificationCache.MAX_MINUTES) {
return true;
}
return false;
}
}
}
| [
"dean@codeka.com.au"
] | dean@codeka.com.au |
103599be39fa6ebd0045db42e7c07a224b40b9ef | 70fe4ce6e9f0412adba90ca150bb94e686db4e2b | /app/src/main/java/com/otapp/net/Bus/Network/ApiInstance.java | 2b93b684d0a9b018bd2cefa72d4158d283c4457f | [] | no_license | vasimkhanp/otapppublic18_05_2020 | 9df63ad888def2d7448fff50b86f04a8b129f855 | e7067af113c1fc61fc2734b52ca0a8358531c538 | refs/heads/master | 2022-07-30T13:19:59.116621 | 2020-05-18T07:11:06 | 2020-05-18T07:11:06 | 264,853,665 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,884 | java | package com.otapp.net.Bus.Network;
import com.otapp.net.Bus.Core.AppConstants;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import okhttp3.Interceptor;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
public class ApiInstance {
private static Retrofit retrofit;
public static Retrofit RetrofitInstance() {
if (retrofit == null) {
OkHttpClient okHttpClient = new OkHttpClient.Builder()
.connectTimeout(120, TimeUnit.SECONDS)
.writeTimeout(120, TimeUnit.SECONDS)
.readTimeout(120, TimeUnit.SECONDS)
.build();
retrofit = new Retrofit.Builder()
.client(new OkHttpClient.Builder()
.addNetworkInterceptor(new Interceptor() {
@Override
public Response intercept(Chain chain) throws IOException {
Request.Builder builder = chain.request().newBuilder();
builder.addHeader("Accept-Language", "en");
Request request = builder.build();
Response response = chain.proceed(request);
return response;
}
}).connectTimeout(120, TimeUnit.SECONDS)
.writeTimeout(120, TimeUnit.SECONDS)
.readTimeout(120, TimeUnit.SECONDS).build())
.baseUrl(AppConstants.ApiNames.API_URL)
.addConverterFactory(GsonConverterFactory.create())
.build();
}
return retrofit;
}
}
| [
"vasimkhan.pathan@smsipl.com"
] | vasimkhan.pathan@smsipl.com |
41d55a5ae1d611d30feb40e923897e286ed97848 | 139960e2d7d55e71c15e6a63acb6609e142a2ace | /mobile_app1/module84/src/main/java/module84packageJava0/Foo32.java | 797cf212e085c4b66638e89318f5312d85e43f16 | [
"Apache-2.0"
] | permissive | uber-common/android-build-eval | 448bfe141b6911ad8a99268378c75217d431766f | 7723bfd0b9b1056892cef1fef02314b435b086f2 | refs/heads/master | 2023-02-18T22:25:15.121902 | 2023-02-06T19:35:34 | 2023-02-06T19:35:34 | 294,831,672 | 83 | 7 | Apache-2.0 | 2021-09-24T08:55:30 | 2020-09-11T23:27:37 | Java | UTF-8 | Java | false | false | 307 | java | package module84packageJava0;
import java.lang.Integer;
public class Foo32 {
Integer int0;
Integer int1;
public void foo0() {
new module84packageJava0.Foo31().foo3();
}
public void foo1() {
foo0();
}
public void foo2() {
foo1();
}
public void foo3() {
foo2();
}
}
| [
"oliviern@uber.com"
] | oliviern@uber.com |
d2464d35a244b0729f18bf5a01a1e4d7cc45f8bf | 0ce7b13e838fcd6bc18fc9a2c28734827ca58da9 | /app/src/main/java/com/famous/restaurant/ImageActivity.java | a8db2cac0a7a2b493af0d1b4cf55414199fb2899 | [] | no_license | bobaeK/Restaurant | 8212fc14a74d6eaebe62aa907652dae8b320e045 | 9c58dcfa0d2d52f29621f2501c701a4285dc1565 | refs/heads/master | 2021-08-31T12:52:03.566237 | 2017-12-21T10:34:38 | 2017-12-21T10:34:38 | 111,279,193 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,079 | java | package com.famous.restaurant;
import android.content.Context;
import android.content.Intent;
import android.support.v4.view.PagerAdapter;
import android.support.v7.app.AppCompatActivity;
import android.support.v4.view.ViewPager;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.bumptech.glide.Glide;
import com.google.android.gms.vision.text.Text;
import java.util.ArrayList;
import java.util.List;
public class ImageActivity extends AppCompatActivity {
/**
* The pager widget, which handles animation and allows swiping horizontally to access previous
* and next wizard steps.
*/
private ViewPager mPager;
/**
* The pager adapter, which provides the pages to the view pager widget.
*/
private PagerAdapter mPagerAdapter;
private List<String> images = new ArrayList<String>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_image);
Intent intent = getIntent();
images = intent.getStringArrayListExtra("images");
// Instantiate a ViewPager and a PagerAdapter.
mPager = (ViewPager) findViewById(R.id.pager);
mPagerAdapter = new CustomPagerAdapter(this);
mPager.setAdapter(mPagerAdapter);
}
@Override
public void onBackPressed() {
super.onBackPressed();
}
class CustomPagerAdapter extends PagerAdapter {
Context mContext;
LayoutInflater mLayoutInflater;
public CustomPagerAdapter(Context context) {
mContext = context;
mLayoutInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
@Override
public int getCount() {
return images.size();
}
@Override
public boolean isViewFromObject(View view, Object object) {
return view == ((LinearLayout) object);
}
@Override
public Object instantiateItem(ViewGroup container, int position) {
View itemView = mLayoutInflater.inflate(R.layout.fragment_image, container, false);
Log.i("postion",String.valueOf(position));
ImageView imageView = (ImageView) itemView.findViewById(R.id.imageView);
TextView textView = (TextView) itemView.findViewById(R.id.cur_page);
textView.setText((position+1)+"/"+images.size());
Glide.with(ImageActivity.this).load(images.get(position)).into(imageView);
container.addView(itemView);
return itemView;
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
container.removeView((View) object);
}
}
//뒤로가기
public void onBackButtonClicked(View view){ finish(); }
}
| [
"USER@DESKTOP-N04F945"
] | USER@DESKTOP-N04F945 |
6980343d2f503bd1659e04ea0d5f9cce68ed894b | 2bc5eae88da4c8a6d35aef2127b91f046410bfa1 | /Assignment_phase2/app/src/main/java/com/monashfriendfinder/backend/MonashHttp.java | ed7cb33c6c5e1ad0b52f4bf10880d0829eea14d8 | [] | no_license | fzwqq/myAndroid | 3172d42f97aaaa134a2f95f5388e56e066868575 | e77a2df1c77e5c985bcce36b7eb15a2e2465d205 | refs/heads/master | 2020-05-05T07:26:59.925360 | 2019-05-10T10:26:13 | 2019-05-10T10:26:13 | 179,825,780 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,054 | java | package com.monashfriendfinder.backend;
import com.google.gson.JsonObject;
import java.io.DataOutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.util.Map;
import java.util.Scanner;
public class MonashHttp {
// Send HTTP request and get response
/*
*
* TODO
*/
public static JsonObject sendRequest(String url, Map params,String method){
String res = "";
URL u = null;
HttpURLConnection conn = null;
JsonObject result = new JsonObject();
StringBuilder tempParams = new StringBuilder();
try{
int pos = 0;
for (Object key : params.keySet()) {
if (pos > 0) {
tempParams.append("&");
}
tempParams.append(String.format("%s=%s", key, URLEncoder.encode((String)params.get(key),"utf-8")));
pos++;
}
if(method == "GET"){
u = new URL(url+tempParams.toString());
}
conn = (HttpURLConnection) u.openConnection();
conn.setReadTimeout(10000);
conn.setConnectTimeout(15000);
conn.setRequestMethod(method);
conn.setRequestProperty("Content-Type", "application/json");
conn.setRequestProperty("Accept", "application/json");
if(method.equals("POST")){
byte[] postData = tempParams.toString().getBytes();
DataOutputStream dos = new DataOutputStream(conn.getOutputStream());
dos.write(postData);
dos.flush();
dos.close();
}
Scanner inStream = new Scanner(conn.getInputStream());
while (inStream.hasNextLine()){
res += inStream.nextLine();
}
}catch (Exception e){
e.printStackTrace();
}finally {
conn.disconnect();
}
result = new JsonObject();
result.getAsJsonObject(res);
return result;
};
public static boolean sendUpdateRequest(String url, Map params,String method){
String res = "";
URL u = null;
HttpURLConnection conn = null;
JsonObject result = new JsonObject();
StringBuilder tempParams = new StringBuilder();
try{
int pos = 0;
for (Object key : params.keySet()) {
if (pos > 0) {
tempParams.append("&");
}
tempParams.append(String.format("%s=%s", key, URLEncoder.encode((String)params.get(key),"utf-8")));
pos++;
}
if(method == "GET"){
u = new URL(url+tempParams.toString());
}
u = new URL(url);
conn = (HttpURLConnection) u.openConnection();
conn.setReadTimeout(10000);
conn.setConnectTimeout(15000);
conn.setRequestMethod(method);
conn.setRequestProperty("Content-Type", "application/json");
conn.setRequestProperty("Accept", "application/json");
if(method.equals("POST")){
byte[] postData = tempParams.toString().getBytes();
DataOutputStream dos = new DataOutputStream(conn.getOutputStream());
dos.write(postData);
dos.flush();
dos.close();
}
Scanner inStream = new Scanner(conn.getInputStream());
while (inStream.hasNextLine()){
res += inStream.nextLine();
}
}catch (Exception e){
e.printStackTrace();
}finally {
conn.disconnect();
}
result = new JsonObject();
result.getAsJsonObject(res);
if(result.get("status").toString().equals("2000")){
return true;
}else{
return false;
}
};
}
| [
"analysis.jinger@gmail.com"
] | analysis.jinger@gmail.com |
fbfd260d4f11c93fd068e6546807ffbf329a2a54 | 1e4acfd2d05321aeae79a621255ff999b6c5ac28 | /hadoop/pig/src/main/java/com/oreilly/springdata/hadoop/pig/PigRunner.java | da0f955d78674650eaf9425ab7cf7ec1996186f4 | [] | no_license | max-dev/spring-data-book | 495cc4e0e003e5c458d086a4d9334ed4e4e41ee9 | 0718b968de98611636d4f81c1a97832ba6a84c24 | refs/heads/master | 2021-01-18T05:04:42.840177 | 2012-09-12T16:54:58 | 2012-09-12T16:54:58 | 5,814,376 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,134 | java | package com.oreilly.springdata.hadoop.pig;
import java.util.ArrayList;
import java.util.Collection;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.pig.PigServer;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.util.Assert;
/**
* Simple runner for submitting Pig jobs sequentially. By default, the runner
* waits for the jobs to finish and returns a boolean indicating whether all the
* jobs succeeded or not (when there's no waiting, the status cannot be
* determined and null is returned).
* <p/>
* For more control over the job execution and outcome consider using using
* Spring Batch (see the reference documentation for more info).
*
* @author Costin Leau
* @author Mark Pollack
*/
public class PigRunner implements InitializingBean, ApplicationContextAware {
private static final Log log = LogFactory.getLog(PigRunner.class);
private boolean runAtStartup = false;
private String pigServerName;
private Collection<String> preJobScripts = new ArrayList<String>();
private Collection<String> postJobScripts = new ArrayList<String>();
private ApplicationContext context;
@Override
public void afterPropertiesSet() throws Exception {
Assert.notNull(pigServerName, "at least one job needs to be specified");
if (runAtStartup) {
run();
}
}
/**
* Execute hdfs scripts before pig script execution, then executes pig scripts, then hdfs scripts
* after job execution
*
* @throws Exception
* If an exception is thrown the simple flow will stop.
*/
public void run() throws Exception {
for (String scriptFactoryBeanName : preJobScripts) {
context.getBean(scriptFactoryBeanName); //triggers execution of script
}
// Need a new instance for each execution
PigServer pigServer = context.getBean(pigServerName, PigServer.class);
pigServer.setBatchOn();
pigServer.getPigContext().connect();
pigServer.executeBatch();
pigServer.shutdown();
for (String scriptFactoryBeanName : postJobScripts) {
context.getBean(scriptFactoryBeanName); //triggers execution of script
}
}
/**
* Indicates whether the jobs should be submitted at startup or not.
*
* @param runAtStartup
* The runAtStartup to set.
*/
public void setRunAtStartup(boolean runAtStartup) {
this.runAtStartup = runAtStartup;
}
/**
* Sets the PigServer to run scripts with
*
* @param pigServer
* t
*/
public void setPigServerName(String pigServerName) {
this.pigServerName = pigServerName;
}
public void setPreJobScripts(Collection<String> preJobScripts) {
this.preJobScripts = preJobScripts;
}
public void setPostJobScripts(Collection<String> postJobScripts) {
this.postJobScripts = postJobScripts;
}
@Override
public void setApplicationContext(ApplicationContext applicationContext)
throws BeansException {
this.context = applicationContext;
}
}
| [
"mpollack@vmware.com"
] | mpollack@vmware.com |
19d48476f69bfcc2bf334c4feda4da393b1f86ae | d528fe4f3aa3a7eca7c5ba4e0aee43421e60857f | /src/xgxt/pjpy/ahjg/CommanDAO.java | 23b521c6f9a74edc80cbbe7e9645273a0cd7f937 | [] | no_license | gxlioper/xajd | 81bd19a7c4b9f2d1a41a23295497b6de0dae4169 | b7d4237acf7d6ffeca1c4a5a6717594ca55f1673 | refs/heads/master | 2022-03-06T15:49:34.004924 | 2019-11-19T07:43:25 | 2019-11-19T07:43:25 | null | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 7,625 | java | package xgxt.pjpy.ahjg;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import xgxt.DAO.DAO;
import xgxt.action.Base;
import xgxt.daoActionLogic.StandardOperation;
import xgxt.utils.Fdypd;
import xgxt.utils.GetTime;
/**
* <p>
* Title: 学生工作管理系统
* </p>
* <p>
* Description: 安徽建筑工业学院评奖评优通用DAO
* </p>
* <p>
* Copyright: Copyright (c) 2008
* </p>
* <p>
* Company: zfsoft
* </p>
* <p>
* Author: 李涛
* </p>
* <p>
* Version: 1.0
* </p>
* <p>
* Time: 2008-06-16
* </p>
*/
public class CommanDAO {
/**
* 获取
*
* @param xjbjQryModel
* @return
* @throws Exception
*/
public StringBuffer getWhereSql1(XjBjQryModel xjbjQryModel)
throws Exception {
StringBuffer whereSql = new StringBuffer();
return whereSql;
}
/**
* 用户当点登陆
* @param yhm 用户名
* @param request
* @param response
* @return
*/
public boolean ssoLogin(String yhm, HttpServletRequest request,
HttpServletResponse response) {
HttpSession session = request.getSession();
session.setAttribute("istysfrz", "yes");
String userType = "";
String userName = yhm;
String errMsg = "";
String xxdm = StandardOperation.getXxdm();
DAO dao = DAO.getInstance();
String sql = "select szbm,xm,zdm from yhb where yhm=?";
String[] userChk = dao.getOneRs(sql, new String[] { userName },
new String[] { "szbm", "xm", "zdm" });
if ((userChk != null) && (userChk.length == 3)) {
userType = "teacher";
} else {
sql = "select xm,bmdm szbm,'6727' zdm from view_xsjbxx where xh=?";
userChk = dao.getOneRs(sql, new String[] { userName },
new String[] { "szbm", "xm", "zdm" });
if ((userChk != null) && (userChk.length == 3)) {
userType = "student";
} else {
errMsg = "用户表中无该用户,无法登陆学工系统,请确认!!";
//session.setAttribute("errMsg", errMsg);// 错误类型
request.setAttribute("errMsg", errMsg);// 错误类型
return false;
}
}
if (userType.equalsIgnoreCase("teacher")) {
boolean isFdy = Fdypd.isFdy(userName);
session.setAttribute("isFdyUser", isFdy);
session.setAttribute("isFdy", isFdy);
session.setAttribute("isBzr", Fdypd.isBzr(userName, ""));
session.setAttribute("fdyQx", Fdypd.fdybjck(userName));
session.setAttribute("bzrQx", Fdypd.bzrbjck(userName));
} else {
session.setAttribute("isFdyUser", false);
session.setAttribute("isFdy", false);
session.setAttribute("isBzr", false);
session.setAttribute("fdyQx", false);
session.setAttribute("bzrQx", false);
}
userChk = new String[] { userChk[0], userChk[1], userChk[2], userType };
String xxmc = dao.getOneRs("select xxmc from xtszb", new String[] {},
"xxmc");
/** 存储登录用户的基本信息,存储在session中 */
session.setAttribute("pjzq", StandardOperation.getCollegePriseCycle());// 学校的评奖周期,xn
// 为每学年评一次;xq
// 为学期评一次
session.setAttribute("userOnLine", userType);// 用户类型(学生、老师)
session.setAttribute("userName", userName);// 登陆名
session.setAttribute("userDep", userChk[0]);// 用户部门
session.setAttribute("userNameReal", userChk[1]);// 用户姓名
session.setAttribute("xxmc", xxmc);
session.setAttribute("xxdm", xxdm);
session.setAttribute("LoginXn", Base.currXn);
String gyglySql = "select count(1) num from xg_gygl_new_gyfdyb where yhm = ?";
String num = dao.getOneRs(gyglySql, new String[] { userName }, "num");
String gyglyQx = !Base.isNull(num) && !"0".equalsIgnoreCase(num) ? "yes"
: "no";
session.setAttribute("gyglyQx", gyglyQx);
session.setAttribute("LoginXq", Base.currXq);
session.setAttribute("LoginZc", StandardOperation.getCurrZc());
String openType = request.getParameter("openType");
if ("".equalsIgnoreCase(openType) || openType == null) {
openType = "2";
}
session.setAttribute("openType", openType);
/** 识别用户具体类型 */
String adminDep = "";
if (userType.equalsIgnoreCase("teacher")) {
sql = "select xgbdm from xtszb where rownum=1";
adminDep = dao.getOneRs(sql, new String[] {},
new String[] { "xgbdm" })[0];
if (Base.isNull(adminDep)) {
errMsg = "学工部代码为空,无法登陆学工系统,请确认!!";
//session.setAttribute("errMsg", errMsg);// 错误类型
request.setAttribute("errMsg", errMsg);// 错误类型
return false;
}
sql = "select (case bmjb when 1 then bmdm else bmfdm end) bmdm,bmmc,bmlb from zxbz_xxbmdm where bmdm=?";
String[] userTmp = dao.getOneRs(sql, new String[] { userChk[0] },
new String[] { "bmdm", "bmmc", "bmlb" });
if (userTmp == null) {
errMsg = "部门表中无该部门,无法登陆学工系统,请确认!!";
//session.setAttribute("errMsg", errMsg);// 错误类型
request.setAttribute("errMsg", errMsg);// 错误类型
return false;
}
session.setAttribute("bmmc", userTmp[1]);
// TODO
if (userTmp[0] != null && userTmp[0].equalsIgnoreCase(adminDep)) {
userType = "admin";
} else if (!Base.isNull(userTmp[2])) {
if (userTmp[2].equalsIgnoreCase("5")) {
userType = "xy";
} else {
userType = "xx";
}
} else {
errMsg = "该用户部门类别为空,无法登陆学工系统,请确认!!";
//session.setAttribute("errMsg", errMsg);// 错误类型
request.setAttribute("errMsg", errMsg);// 错误类型
return false;
}
} else {
userType = "stu";
}
session.setAttribute("userType", userType);// (四类)
// 版本
String edition = Base.getEdition();
// 是否需要高级查询
String superSearch = Base.getSuperSearch();
// -------------------------2011.9.14
// qlj-------------------------------------
// ===================修改用户登陆时间 begin=======================
// 格式: yyyy-mm-dd HH24:MI:SS
String dlsj = GetTime.getNowTime4();
// 将用户登陆时间设置到session中
session.setAttribute("loginTime", dlsj);
List<String> inputV = new ArrayList<String>();
StringBuilder updateTime = new StringBuilder();
String checkTime = " select count(1)num from xg_xtwh_yhdlb where yhm='"
+ userName + "' and yhlx='" + userType + "' ";
String number = dao.getOneRs(checkTime.toString(), new String[] {},
"num");
// ===================修改用户登陆时间 end=======================
session.setAttribute("edition", edition);
session.setAttribute("superSearch", superSearch);
return true;
}
/**
* 获取用户名
* @param yhm
* @return
*/
public String getUserType(String yhm){
String userName = yhm;
DAO dao = DAO.getInstance();
String userType="";
String sql = "select szbm,xm,zdm from yhb where yhm=?";
String[] userChk = dao.getOneRs(sql, new String[] { userName },
new String[] { "szbm", "xm", "zdm" });
if ((userChk != null) && (userChk.length == 3)) {
userType = "teacher";
} else {
sql = "select xm,bmdm szbm,'6727' zdm from view_xsjbxx where xh=?";
userChk = dao.getOneRs(sql, new String[] { userName },
new String[] { "szbm", "xm", "zdm" });
if ((userChk != null) && (userChk.length == 3)) {
userType = "student";
} else {
userType="";
}
}
return userType;
}
}
| [
"1398796456@qq.com"
] | 1398796456@qq.com |
0970f7c93e7240d9e6aa93ae48e426ac080ac2a7 | 66d0fe710ca7fbdc1282abbf47e4c21193dc94c1 | /src/test/java/TestNGConcepts/TC007_LoginTest.java | 109f3d0aeb33ccc0cf3c3b135f2e6b3637330062 | [] | no_license | jaskiranmann/WeekdayEvening | 34d5ae0336cf95baf05e560fea4dc262700406f4 | f6d43788f5960d627c2f090107a438239a9fe343 | refs/heads/master | 2023-09-01T20:31:56.045664 | 2021-10-25T21:03:26 | 2021-10-25T21:03:26 | 374,455,888 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,838 | java | package TestNGConcepts;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import io.github.bonigarcia.wdm.WebDriverManager;
public class TC007_LoginTest {
WebDriver driver;
By username = By.id("username");
By password = By.id("password");
By loginBtn = By.xpath("//*[@id=\"sign_in_form\"]/fieldset/div/div[5]/button");
By SignupLnk = By.linkText("Sign Up");
By dashBoard = By.linkText("Dashboard");
String expTitle = "Log in to your account";
@BeforeMethod
public void setup() {
WebDriverManager.chromedriver().setup(); //setup
driver = new ChromeDriver(); //launch browser
driver.manage().deleteAllCookies(); //delete all cookies
driver.manage().window().maximize(); //maximise the browser
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.get("https://www.surveymonkey.com/user/sign-in/?ut_source=sem_lp&ut_source2=sem&ut_source3=megamenu");
}
@AfterMethod
public void closeBrowser() {
driver.quit();
}
@Test
public void signupLinkTest() {
Assert.assertTrue(driver.findElement(SignupLnk).isDisplayed());
}
@Test
public void pageTitleTest() {
String appTitle = driver.getTitle();
System.out.println(appTitle);
Assert.assertEquals(appTitle, expTitle);
}
@Test
public void loginTest() {
driver.findElement(username).sendKeys("Jaskiranmann");
driver.findElement(password).sendKeys("Jaskiran@92");
driver.findElement(loginBtn).click();
String actVal = driver.findElement(dashBoard).getText();
String expVal = "Dashboard";
Assert.assertEquals(actVal, expVal);
}
}
| [
"jaskiran.mann1@gmail.com"
] | jaskiran.mann1@gmail.com |
3fefcfa1a0587dfce73d7be5fdbccc55a466213c | 4c409de6f8612370fe62db08fcee22245e9ac690 | /nlp-book/src/testbooks/nvgram/WordEntry.java | 7ea94650fcbfbf6e74804e5d3a3c3b6453f39f43 | [] | no_license | kevinzwb/AlgorithmInJava | a38a849f5fa25b7513bf4c75b1e78e097a1bedc0 | 299c0bfe08574b59525899848f5737b0c719e972 | refs/heads/master | 2021-09-08T06:44:55.065502 | 2018-03-08T02:18:58 | 2018-03-08T02:18:58 | 113,427,215 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 116 | java | package testbooks.nvgram;
import java.util.ArrayList;
public class WordEntry {
public ArrayList<String> ngram;
}
| [
"wenbozhang2014@outlook.com"
] | wenbozhang2014@outlook.com |
6c19e1f4115f20b7aba703e2406f2afd213449a3 | bd9ecd2a3ec34a01d2adbb04f71cc5e7666ff505 | /app/src/main/java/com/lucatecno/prontoshopapp/dagger/AppComponent.java | 143f2696d3dcfcc080c35317d23ed157f5a1de6d | [] | no_license | alfredoul/ProntoShopApp | 9c6af15ca75c74b6cf52e154e6c27397af0e69d8 | 432931705a23855bd69957f1e546387a53d613b6 | refs/heads/master | 2021-01-19T17:52:42.300397 | 2017-04-15T12:13:26 | 2017-04-15T12:13:26 | 88,344,794 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 498 | java | package com.lucatecno.prontoshopapp.dagger;
import com.lucatecno.prontoshopapp.MainActivity;
import com.lucatecno.prontoshopapp.ProductListener;
import javax.inject.Singleton;
import dagger.Component;
/**
* Created by alfredoul on 14/04/17.
*/
@Singleton
@Component(
modules = {
AppModule.class,
ShoppingCartModule.class
}
)
public interface AppComponent {
void inject(ProductListener presenter);
void inject(MainActivity activity);
} | [
"alfredoul@gmail.com"
] | alfredoul@gmail.com |
c7a4d845519e84f5d4100ee825a3f182e7f1c55e | 987c225eabd61f732e1e4cc0885b8f6545d22faf | /src/main/java/dhl/leagueModel/gamePlayConfig/Injuries.java | 6c82f5898a473e4b5f971db2bde8de5b7ee2b44f | [] | no_license | robin1995dhillon/HockeySimulation | cab947f230f38ecf49843f7a1ddbfa538b5fe265 | e49dcdaeb8617e4951250f5be378a054a5fd5f23 | refs/heads/master | 2023-04-23T02:33:06.143192 | 2020-12-01T04:12:13 | 2020-12-01T04:12:13 | 365,623,098 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,391 | java | package dhl.leagueModel.gamePlayConfig;
import dhl.Configurables;
import org.json.simple.JSONObject;
public class Injuries implements IInjuries {
private double randomInjuryChance;
private int injuryDaysLow;
int injuryDaysHigh;
@Override
public double getRandomInjuryChance() {
return randomInjuryChance;
}
@Override
public void setRandomInjuryChance(double randomInjuryChance) {
this.randomInjuryChance = randomInjuryChance;
}
@Override
public int getInjuryDaysLow() {
return injuryDaysLow;
}
@Override
public void setInjuryDaysLow(int injuryDaysLow) {
this.injuryDaysLow = injuryDaysLow;
}
@Override
public int getInjuryDaysHigh() {
return injuryDaysHigh;
}
@Override
public void setInjuryDaysHigh(int injuryDaysHigh) {
this.injuryDaysHigh = injuryDaysHigh;
}
@Override
public boolean injuriesValidator(JSONObject Obj) {
JSONObject injuriesObject = (JSONObject) Obj.get(Configurables.INJURIES.getAction());
double randomInjuryChance = (double) injuriesObject.get(Configurables.RANDOMINJURYCHANCE.getAction());
int injuryDaysLow = ((Long) injuriesObject.get(Configurables.INJURYDAYSLOW.getAction())).intValue();
int injuryDaysHigh = ((Long) injuriesObject.get(Configurables.INJURYDAYSHIGH.getAction())).intValue();
int[] injuriesAttributesInt = {injuryDaysLow, injuryDaysHigh};
double[] injuriesAttributesDouble = {randomInjuryChance};
boolean resultDouble = checkRangeDouble(injuriesAttributesDouble);
boolean resultInt = checkRangeInteger(injuriesAttributesInt);
return (resultDouble && resultInt);
}
@Override
public boolean checkRangeInteger(int[] injuriesAttributes) {
for (int attributeValue : injuriesAttributes) {
if (attributeValue >= 0 && attributeValue <= 365) {
continue;
} else {
return false;
}
}
return true;
}
@Override
public boolean checkRangeDouble(double[] injuriesAttributes) {
for (double attributeValue : injuriesAttributes) {
if (attributeValue >= 0 && attributeValue <= 1) {
continue;
} else {
return false;
}
}
return true;
}
}
| [
"dv592381@dal.ca"
] | dv592381@dal.ca |
09f432a0aa1fba93e88fb2b8866e355c6d47d446 | 0e930251eb0840c06897468ba4c219e1a1fa9f16 | /src/main/java/com/vaddya/stepik/algorithms/SegmentCoverage.java | 60109eeb0327a85b1d19f06611cb0937f68fb7d4 | [] | no_license | vaddya/algorithms | 52bf07ec8c162ca0698debceab81035de1300d80 | f186281807dda68ff6fe0d8f25d5193e1018e7f1 | refs/heads/master | 2021-04-30T23:26:37.685634 | 2020-08-16T20:26:28 | 2020-08-16T20:26:28 | 72,276,694 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,194 | java | package com.vaddya.stepik.algorithms;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
public class SegmentCoverage {
/**
* По данным n отрезкам необходимо найти множество точек минимального размера,
* для которого каждый из отрезков содержит хотя бы одну из точек.
* <p>
* В первой строке дано число 1≤n≤100 отрезков.
* Каждая из последующих n строк содержит по два числа 0≤l≤r≤10^9, задающих начало и конец отрезка.
* Выведите оптимальное число m точек и сами m точек.
* Если таких множеств точек несколько, выведите любое из них.
* </p>
*/
public static List<Point> cover(List<Segment> segments) {
segments.sort(Comparator.comparing(segment -> segment.right));
List<Point> points = new ArrayList<>();
while (!segments.isEmpty()) {
Point p = Point.of(segments.get(0).right);
points.add(p);
while (!segments.isEmpty()) {
if (!segments.get(0).isCovered(p)) {
break;
}
segments.remove(0);
}
}
return points;
}
public static class Segment {
public int left;
public int right;
public static Segment from(int left, int right) {
Segment segment = new Segment();
segment.left = left;
segment.right = right;
return segment;
}
boolean isCovered(Point p) {
return left <= p.x && p.x <= right;
}
}
public static class Point {
public int x;
public static Point of(int coordinate) {
Point point = new Point();
point.x = coordinate;
return point;
}
@Override
public String toString() {
return Integer.toString(x);
}
}
}
| [
"vadik.dyachkov@gmail.com"
] | vadik.dyachkov@gmail.com |
8c120edfa4a960ad18053d044972a333a30e116c | b9fb9d9effb095afa413d9b23ef123a3edd000af | /src/main/java/com/jeeplus/modules/order/web/WashOrdOrderController.java | 1c84650cb08b53d832a8175acb0cdba32379b6e3 | [] | no_license | yzliud/car-wash-sys | 35742956b057a29cca02f786f86d86287b5a9a44 | a9042d916d5ee746280498211529aacc3381e222 | refs/heads/master | 2021-01-21T19:07:23.431382 | 2017-07-31T09:47:26 | 2017-07-31T09:47:26 | 92,119,492 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,001 | java | /**
* Copyright © 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
*/
package com.jeeplus.modules.order.web;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.ConstraintViolationException;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
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.multipart.MultipartFile;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.jeeplus.modules.member.entity.WashMember;
import com.jeeplus.modules.device.entity.WashDevice;
import com.google.common.collect.Lists;
import com.jeeplus.common.utils.DateUtils;
import com.jeeplus.common.utils.MyBeanUtils;
import com.jeeplus.common.config.Global;
import com.jeeplus.common.persistence.Page;
import com.jeeplus.common.web.BaseController;
import com.jeeplus.common.utils.StringUtils;
import com.jeeplus.common.utils.excel.ExportExcel;
import com.jeeplus.common.utils.excel.ImportExcel;
import com.jeeplus.modules.order.entity.WashOrdOrder;
import com.jeeplus.modules.order.service.WashOrdOrderService;
/**
* 订单Controller
* @author LD
* @version 2017-05-19
*/
@Controller
@RequestMapping(value = "${adminPath}/order/washOrdOrder")
public class WashOrdOrderController extends BaseController {
@Autowired
private WashOrdOrderService washOrdOrderService;
@ModelAttribute
public WashOrdOrder get(@RequestParam(required=false) String id) {
WashOrdOrder entity = null;
if (StringUtils.isNotBlank(id)){
entity = washOrdOrderService.get(id);
}
if (entity == null){
entity = new WashOrdOrder();
}
return entity;
}
/**
* 订单列表页面
*/
@RequiresPermissions("order:washOrdOrder:list")
@RequestMapping(value = {"list", ""})
public String list(WashOrdOrder washOrdOrder, HttpServletRequest request, HttpServletResponse response, Model model) {
Page<WashOrdOrder> page = washOrdOrderService.findPage(new Page<WashOrdOrder>(request, response), washOrdOrder);
model.addAttribute("page", page);
return "modules/order/washOrdOrderList";
}
/**
* 查看,增加,编辑订单表单页面
*/
@RequiresPermissions(value={"order:washOrdOrder:view","order:washOrdOrder:add","order:washOrdOrder:edit"},logical=Logical.OR)
@RequestMapping(value = "form")
public String form(WashOrdOrder washOrdOrder, Model model) {
model.addAttribute("washOrdOrder", washOrdOrder);
return "modules/order/washOrdOrderForm";
}
/**
* 保存订单
*/
@RequiresPermissions(value={"order:washOrdOrder:add","order:washOrdOrder:edit"},logical=Logical.OR)
@RequestMapping(value = "save")
public String save(WashOrdOrder washOrdOrder, Model model, RedirectAttributes redirectAttributes) throws Exception{
if (!beanValidator(model, washOrdOrder)){
return form(washOrdOrder, model);
}
if(!washOrdOrder.getIsNewRecord()){//编辑表单保存
WashOrdOrder t = washOrdOrderService.get(washOrdOrder.getId());//从数据库取出记录的值
MyBeanUtils.copyBeanNotNull2Bean(washOrdOrder, t);//将编辑表单中的非NULL值覆盖数据库记录中的值
washOrdOrderService.save(t);//保存
}else{//新增表单保存
washOrdOrderService.save(washOrdOrder);//保存
}
addMessage(redirectAttributes, "保存订单成功");
return "redirect:"+Global.getAdminPath()+"/order/washOrdOrder/?repage";
}
/**
* 删除订单
*/
@RequiresPermissions("order:washOrdOrder:del")
@RequestMapping(value = "delete")
public String delete(WashOrdOrder washOrdOrder, RedirectAttributes redirectAttributes) {
washOrdOrderService.delete(washOrdOrder);
addMessage(redirectAttributes, "删除订单成功");
return "redirect:"+Global.getAdminPath()+"/order/washOrdOrder/?repage";
}
/**
* 批量删除订单
*/
@RequiresPermissions("order:washOrdOrder:del")
@RequestMapping(value = "deleteAll")
public String deleteAll(String ids, RedirectAttributes redirectAttributes) {
String idArray[] =ids.split(",");
for(String id : idArray){
washOrdOrderService.delete(washOrdOrderService.get(id));
}
addMessage(redirectAttributes, "删除订单成功");
return "redirect:"+Global.getAdminPath()+"/order/washOrdOrder/?repage";
}
/**
* 导出excel文件
*/
@RequiresPermissions("order:washOrdOrder:export")
@RequestMapping(value = "export", method=RequestMethod.POST)
public String exportFile(WashOrdOrder washOrdOrder, HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
try {
String fileName = "订单"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
Page<WashOrdOrder> page = washOrdOrderService.findPage(new Page<WashOrdOrder>(request, response, -1), washOrdOrder);
new ExportExcel("订单", WashOrdOrder.class).setDataList(page.getList()).write(response, fileName).dispose();
return null;
} catch (Exception e) {
addMessage(redirectAttributes, "导出订单记录失败!失败信息:"+e.getMessage());
}
return "redirect:"+Global.getAdminPath()+"/order/washOrdOrder/?repage";
}
/**
* 导入Excel数据
*/
@RequiresPermissions("order:washOrdOrder:import")
@RequestMapping(value = "import", method=RequestMethod.POST)
public String importFile(MultipartFile file, RedirectAttributes redirectAttributes) {
try {
int successNum = 0;
int failureNum = 0;
StringBuilder failureMsg = new StringBuilder();
ImportExcel ei = new ImportExcel(file, 1, 0);
List<WashOrdOrder> list = ei.getDataList(WashOrdOrder.class);
for (WashOrdOrder washOrdOrder : list){
try{
washOrdOrderService.save(washOrdOrder);
successNum++;
}catch(ConstraintViolationException ex){
failureNum++;
}catch (Exception ex) {
failureNum++;
}
}
if (failureNum>0){
failureMsg.insert(0, ",失败 "+failureNum+" 条订单记录。");
}
addMessage(redirectAttributes, "已成功导入 "+successNum+" 条订单记录"+failureMsg);
} catch (Exception e) {
addMessage(redirectAttributes, "导入订单失败!失败信息:"+e.getMessage());
}
return "redirect:"+Global.getAdminPath()+"/order/washOrdOrder/?repage";
}
/**
* 下载导入订单数据模板
*/
@RequiresPermissions("order:washOrdOrder:import")
@RequestMapping(value = "import/template")
public String importFileTemplate(HttpServletResponse response, RedirectAttributes redirectAttributes) {
try {
String fileName = "订单数据导入模板.xlsx";
List<WashOrdOrder> list = Lists.newArrayList();
new ExportExcel("订单数据", WashOrdOrder.class, 1).setDataList(list).write(response, fileName).dispose();
return null;
} catch (Exception e) {
addMessage(redirectAttributes, "导入模板下载失败!失败信息:"+e.getMessage());
}
return "redirect:"+Global.getAdminPath()+"/order/washOrdOrder/?repage";
}
/**
* 选择车主
*/
@RequestMapping(value = "selectcarPerson")
public String selectcarPerson(WashMember carPerson, String url, String fieldLabels, String fieldKeys, String searchLabel, String searchKey, HttpServletRequest request, HttpServletResponse response, Model model) {
Page<WashMember> page = washOrdOrderService.findPageBycarPerson(new Page<WashMember>(request, response), carPerson);
try {
fieldLabels = URLDecoder.decode(fieldLabels, "UTF-8");
fieldKeys = URLDecoder.decode(fieldKeys, "UTF-8");
searchLabel = URLDecoder.decode(searchLabel, "UTF-8");
searchKey = URLDecoder.decode(searchKey, "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
model.addAttribute("labelNames", fieldLabels.split("\\|"));
model.addAttribute("labelValues", fieldKeys.split("\\|"));
model.addAttribute("fieldLabels", fieldLabels);
model.addAttribute("fieldKeys", fieldKeys);
model.addAttribute("url", url);
model.addAttribute("searchLabel", searchLabel);
model.addAttribute("searchKey", searchKey);
model.addAttribute("obj", carPerson);
model.addAttribute("page", page);
return "modules/sys/gridselect";
}
/**
* 选择洗车工
*/
@RequestMapping(value = "selectwashPerson")
public String selectwashPerson(WashMember washPerson, String url, String fieldLabels, String fieldKeys, String searchLabel, String searchKey, HttpServletRequest request, HttpServletResponse response, Model model) {
washPerson.setUserType("1");
Page<WashMember> page = washOrdOrderService.findPageBywashPerson(new Page<WashMember>(request, response), washPerson);
try {
fieldLabels = URLDecoder.decode(fieldLabels, "UTF-8");
fieldKeys = URLDecoder.decode(fieldKeys, "UTF-8");
searchLabel = URLDecoder.decode(searchLabel, "UTF-8");
searchKey = URLDecoder.decode(searchKey, "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
model.addAttribute("labelNames", fieldLabels.split("\\|"));
model.addAttribute("labelValues", fieldKeys.split("\\|"));
model.addAttribute("fieldLabels", fieldLabels);
model.addAttribute("fieldKeys", fieldKeys);
model.addAttribute("url", url);
model.addAttribute("searchLabel", searchLabel);
model.addAttribute("searchKey", searchKey);
model.addAttribute("obj", washPerson);
model.addAttribute("page", page);
return "modules/sys/gridselect";
}
/**
* 选择设备
*/
@RequestMapping(value = "selectwashDevice")
public String selectwashDevice(WashDevice washDevice, String url, String fieldLabels, String fieldKeys, String searchLabel, String searchKey, HttpServletRequest request, HttpServletResponse response, Model model) {
Page<WashDevice> page = washOrdOrderService.findPageBywashDevice(new Page<WashDevice>(request, response), washDevice);
try {
fieldLabels = URLDecoder.decode(fieldLabels, "UTF-8");
fieldKeys = URLDecoder.decode(fieldKeys, "UTF-8");
searchLabel = URLDecoder.decode(searchLabel, "UTF-8");
searchKey = URLDecoder.decode(searchKey, "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
model.addAttribute("labelNames", fieldLabels.split("\\|"));
model.addAttribute("labelValues", fieldKeys.split("\\|"));
model.addAttribute("fieldLabels", fieldLabels);
model.addAttribute("fieldKeys", fieldKeys);
model.addAttribute("url", url);
model.addAttribute("searchLabel", searchLabel);
model.addAttribute("searchKey", searchKey);
model.addAttribute("obj", washDevice);
model.addAttribute("page", page);
return "modules/sys/gridselect";
}
} | [
"654442366@qq.com"
] | 654442366@qq.com |
6076eda235ffcc425825fefe15ca67b90cf6459c | 22131a73ca18d82473213707196312e5872171c8 | /app/src/main/java/pennypincher/cps496/cmich/edu/pennypincher/BudgetHistoryDBHandler.java | 8eab3095500b96a9b40320ee6eb8ed19e11c25e2 | [] | no_license | noahsibai/pennypincher | fb9e8bceb9f8db65da3227378984f476bc61c86e | fa464f3ade7b29d49bfffc8c137db9a1609f6627 | refs/heads/master | 2021-09-07T02:26:21.795268 | 2018-02-15T20:46:24 | 2018-02-15T20:46:24 | 109,431,792 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,059 | java | package pennypincher.cps496.cmich.edu.pennypincher;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import java.lang.reflect.Array;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* Created by tony on 2/12/2018.
*/
public class BudgetHistoryDBHandler extends SQLiteOpenHelper{
//All Static variables
//Database Version
private static final int DATABASE_VERSION = 1;
//Database Name
private static final String DATABASE_NAME = "BudgetHistoryDB";
//Table Name
private static final String BUDGET_TABLE_DETAILS = "BUDGET_HISTORY";
//Table Column Names
private static final String KEY_BH_START = "BudgetStartDate";
private static final String KEY_BH_END = "BudgetEndDate";
private static final String KEY_BH_STATUS = "BudgetStatus";
private static final String KEY_BH_OVERUNDER = "OverUnder";
public BudgetHistoryDBHandler(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
super(context, DATABASE_NAME, factory, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
String CREATE_TABLE = "CREATE TABLE " + BUDGET_TABLE_DETAILS + "("
+ KEY_BH_START + " TEXT PRIMARY KEY, "
+ KEY_BH_END + " TEXT, "
+ KEY_BH_STATUS + " TEXT, "
+ KEY_BH_OVERUNDER + " REAL"
+ ")";
db.execSQL(CREATE_TABLE);
}
@Override
public void onUpgrade(SQLiteDatabase db, int OldVersion, int NewVersion) {
db.execSQL("DROP TABLE IF EXISTS " + BUDGET_TABLE_DETAILS);
onCreate(db);
}
public String Insert(BudgetHistory newBudget){
try{
Log.d("InsideInsert", newBudget.toString());
SQLiteDatabase db = this.getWritableDatabase();
Log.d("ObjectValues",newBudget.toString());
ContentValues values = new ContentValues();
values.put(KEY_BH_START, newBudget.getStartDate());
values.put(KEY_BH_END, newBudget.getEndDate());
values.put(KEY_BH_STATUS, newBudget.getStatus());
db.insert(BUDGET_TABLE_DETAILS,null,values);
db.close();
}catch (Exception e){
Log.d("Exception", e.toString());
}
return newBudget.getStartDate();
}
public ArrayList<HistoryResult> GetAllRecords(){
ArrayList<HistoryResult> histList = new ArrayList<>();
SimpleDateFormat df = new SimpleDateFormat("MM-dd-yyyy h:mm:ss a");
SimpleDateFormat dt = new SimpleDateFormat("MM-dd-yyyy");
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery("SELECT * FROM " + BUDGET_TABLE_DETAILS,null);
String out = "Fails";
double retVal = 0;
while(cursor.moveToNext()) {
HistoryResult result = new HistoryResult();
try{
result.setStartDate(df.parse(cursor.getString(0)));
}catch(Exception e){
Log.d("BudgetHistoryStart","Exception: " + e);
}
try{
result.setEndDate(dt.parse(cursor.getString(1)));
Log.d("Cursor",cursor.getString(1));
}catch(Exception e){
Log.d("BudgetHistoryEnd","Exception: " + e);
}
result.setStatus(cursor.getString(2));
result.setOverUnder(cursor.getDouble(3));
histList.add(result);
}
cursor.close();
db.close();
return histList;
}
public void UpdateStatus(String update, String key){
SQLiteDatabase db = this.getWritableDatabase();
String query = "UPDATE " + BUDGET_TABLE_DETAILS + " SET " + KEY_BH_STATUS + " = " + "'" + update + "'"
+ " WHERE " + KEY_BH_START + " = '" + key + "'";
Log.d("SQLQuery", query);
db.execSQL(query);
db.close();
}
public void UpdateOverUnder(Double Amount,String Key){
Log.d("Key",Key);
SQLiteDatabase db = this.getWritableDatabase();
String squery = "SELECT * FROM " + BUDGET_TABLE_DETAILS + " WHERE " + KEY_BH_START + " = '" + Key + "'";
String query = "UPDATE " + BUDGET_TABLE_DETAILS + " SET " + KEY_BH_OVERUNDER + " = " + Math.round(Amount*100)/100
+ " WHERE " + KEY_BH_START + " = " +'"'+ Key + '"';
db.execSQL(query);
db.close();
db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(squery,null);
cursor.moveToFirst();
Log.d("QueryInfo", "Start: " + cursor.getString(0) + " End: " + cursor.getString(1)
+ " Status: " + cursor.getString(2) + " OverUnder: " + cursor.getDouble(3));
db.close();
}
public HistoryResult MostRecenRecord(){
SimpleDateFormat df = new SimpleDateFormat("MM-dd-yyyy h:mm:ss a");
SimpleDateFormat dt = new SimpleDateFormat("MM-dd-yyyy");
SQLiteDatabase db = this.getReadableDatabase();
HistoryResult hr = new HistoryResult();
String query = "SELECT * FROM " + BUDGET_TABLE_DETAILS + " ORDER BY " + KEY_BH_START + " DESC LIMIT 1";
Cursor cursor = db.rawQuery(query,null);
cursor.moveToLast();
try{
hr.setStartDate(df.parse(cursor.getString(0)));
}catch (Exception e){
Log.d("MRRStart", e.toString());
}
try{
hr.setEndDate(dt.parse(cursor.getString(1)));
}catch (Exception e){
Log.d("MRREnd", e.toString());
}
hr.setStatus(cursor.getString(2));
hr.setOverUnder(cursor.getDouble(3));
Log.d("HistResult",hr.toString());
return hr;
}
public void RemoveAllRecords(){
SQLiteDatabase db = this.getWritableDatabase();
db.delete(BUDGET_TABLE_DETAILS,null,null);
}
}
| [
"marci2t@cmich.edu"
] | marci2t@cmich.edu |
198e375345da864efd3f4871ad62c1063385f356 | 2e5d3e31c7f445f922fc158f19d38e1fb73d6b95 | /app/src/test/java/com/pk/wethe/ExampleUnitTest.java | cd4d1904532c9a62f6832a5fe873d78511adc709 | [] | no_license | prajjwalkumar17/Wethe | e56181f0d91cf71c854bdd37bc1d413d0c07c9f1 | 4fb65e403337bccd78ec5ae167de8afb2c3aa512 | refs/heads/master | 2023-01-24T13:51:08.920859 | 2020-12-05T12:49:21 | 2020-12-05T12:49:21 | 318,787,233 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 373 | java | package com.pk.wethe;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"talk2prajjwal@gmail.com"
] | talk2prajjwal@gmail.com |
86a9587f7618a36a9d380e1f47d4e44d720d12b4 | 0724f86310514d9fff2f61c4e94f6f62981f01e8 | /Projeto_Final_ED/src/TADS/TAD_Mapa_Ordenado/TAD_Mapa_Ordenado_AVL/Interfaces/BinaryTree.java | 6e54682aa74cdaa65da05cc6e4c72bacf108f7f8 | [] | no_license | G-Impacta/ProjetoFinal-ED | 406a3fa6005aff284edf6a8179e8eaa219900a8d | 7ca013e5dfc511237dba29e4d8988e1500735e88 | refs/heads/main | 2023-05-02T17:09:29.602975 | 2021-06-02T03:59:23 | 2021-06-02T03:59:23 | 363,246,813 | 0 | 0 | null | null | null | null | WINDOWS-1250 | Java | false | false | 961 | java | package TADS.TAD_Mapa_Ordenado.TAD_Mapa_Ordenado_AVL.Interfaces;
import TADS.TAD_Mapa_Ordenado.TAD_Mapa_Ordenado_AVL.Excecoes.BoundaryViolationException;
import TADS.TAD_Mapa_Ordenado.TAD_Mapa_Ordenado_AVL.Excecoes.InvalidPositionException;
//Interface para ŕ ÁRVORE BINÁRIA.
public interface BinaryTree<TYPE> extends Tree<TYPE> {
//Retorna o filho esquerdo do nodo.
public Position<TYPE> left(Position<TYPE> position) throws InvalidPositionException, BoundaryViolationException;
//Retorna o filho direito do nodo.
public Position<TYPE> right(Position<TYPE> position) throws InvalidPositionException, BoundaryViolationException;
//Retorna o valor booleano representando se o nodo tem filho a esquerda.
public boolean hasLeft(Position<TYPE> position) throws InvalidPositionException;
//Retorna o valor booleano representando se o nodo tem filho a direita.
public boolean hasRight(Position<TYPE> position) throws InvalidPositionException;
} | [
"Thiago@Casa"
] | Thiago@Casa |
accbd221f455243f2863f1c20e21882a14d14ede | 957335dc611e12943f08a446567efdf857556607 | /expansionpanel/src/main/java/com/github/florent37/expansionpanel/viewgroup/ExpansionsViewGroupFrameLayout.java | 44d43d29b1c270cbcf0004bbcf18667164888ea8 | [
"Apache-2.0"
] | permissive | naz013/ExpansionPanel | 9b9cf9493fdad53bd468cf5dc75fb598de49d92f | 66398cc738353be09c0d2a492bcee081973aa243 | refs/heads/master | 2021-01-25T14:38:30.907505 | 2018-03-08T15:36:06 | 2018-03-08T15:36:06 | 123,716,609 | 0 | 0 | Apache-2.0 | 2018-03-08T15:36:07 | 2018-03-03T17:48:40 | Java | UTF-8 | Java | false | false | 1,844 | java | package com.github.florent37.expansionpanel.viewgroup;
import android.content.Context;
import android.content.res.TypedArray;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import com.github.florent37.expansionpanel.R;
public class ExpansionsViewGroupFrameLayout extends LinearLayout {
private final ExpansionViewGroupManager expansionViewGroupManager = new ExpansionViewGroupManager(this);
public ExpansionsViewGroupFrameLayout(Context context) {
super(context);
init(context, null);
}
public ExpansionsViewGroupFrameLayout(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
init(context, attrs);
}
public ExpansionsViewGroupFrameLayout(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context, attrs);
}
private void init(@NonNull Context context, @Nullable AttributeSet attrs) {
if (attrs != null) {
final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ExpansionsViewGroupFrameLayout);
if (a != null) {
expansionViewGroupManager.setOpenOnlyOne(a.getBoolean(R.styleable.ExpansionsViewGroupFrameLayout_expansion_openOnlyOne, false));
a.recycle();
}
}
}
@Override
public void addView(View child, int index, ViewGroup.LayoutParams params) {
super.addView(child, index, params);
expansionViewGroupManager.onViewAdded();
}
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
expansionViewGroupManager.onViewAdded();
}
}
| [
"florent.champigny@backelite.com"
] | florent.champigny@backelite.com |
1ebc82d43d68212df5c95f0c471b394065feb7d2 | 8c9aca05f6307c50b0d41004256cb195180e2696 | /src/main/java/com/newrelic/opentracing/LambdaTracer.java | 838dea87261d8ae73c2c84aa11c8dbdd372a601f | [
"Apache-2.0"
] | permissive | otnateos/newrelic-lambda-tracer-java | 37738260537423bff2c4a21796dbadca229b5e14 | 701cd9a04ff4da8690b9213934da773dfda2fe42 | refs/heads/main | 2023-01-07T02:10:28.251616 | 2020-09-17T23:38:46 | 2020-09-17T23:38:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,502 | java | /*
* Copyright 2020 New Relic Corporation. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*/
package com.newrelic.opentracing;
import com.newrelic.opentracing.dt.DistributedTracePayload;
import com.newrelic.opentracing.dt.DistributedTracePayloadImpl;
import com.newrelic.opentracing.logging.Log;
import io.opentracing.Scope;
import io.opentracing.ScopeManager;
import io.opentracing.Span;
import io.opentracing.SpanContext;
import io.opentracing.Tracer;
import io.opentracing.propagation.Format;
import io.opentracing.propagation.TextMap;
import java.nio.ByteBuffer;
import java.text.MessageFormat;
import java.util.Base64;
import java.util.Collections;
import java.util.Map;
import static java.nio.charset.StandardCharsets.UTF_8;
public class LambdaTracer implements Tracer {
private static final String NEWRELIC_TRACE_HEADER = "newrelic";
public static final LambdaTracer INSTANCE = new LambdaTracer();
private final LambdaScopeManager scopeManager = new LambdaScopeManager();
private final AdaptiveSampling adaptiveSampling = new AdaptiveSampling();
private LambdaTracer() {
}
@Override
public ScopeManager scopeManager() {
return scopeManager;
}
@Override
public Span activeSpan() {
return scopeManager.activeSpan();
}
@Override
public Scope activateSpan(Span span) {
return scopeManager.activate(span);
}
@Override
public SpanBuilder buildSpan(String operationName) {
return new LambdaSpanBuilder(operationName);
}
@Override
public <C> void inject(SpanContext spanContext, Format<C> format, C carrier) {
if (!(spanContext instanceof LambdaSpanContext)) {
return;
}
LambdaSpanContext lambdaSpanContext = (LambdaSpanContext) spanContext;
final LambdaSpan span = lambdaSpanContext.getSpan();
DistributedTracePayload distributedTracePayload = lambdaSpanContext.getDistributedTracingState().createDistributedTracingPayload(span);
if (distributedTracePayload == null) {
return;
}
if (format.equals(Format.Builtin.TEXT_MAP)) {
((TextMap) carrier).put(NEWRELIC_TRACE_HEADER, distributedTracePayload.text());
} else if (format.equals(Format.Builtin.HTTP_HEADERS)) {
((TextMap) carrier).put(NEWRELIC_TRACE_HEADER, distributedTracePayload.httpSafe());
} else if (format.equals(Format.Builtin.BINARY)) {
// First, specify length of distributed trace payload as an index.
byte[] payloadBytes = distributedTracePayload.text().getBytes(UTF_8);
((ByteBuffer) carrier).putInt(payloadBytes.length);
((ByteBuffer) carrier).put(payloadBytes);
}
}
@Override
public <C> SpanContext extract(Format<C> format, C carrier) {
String payload = getPayloadString(format, carrier);
if (payload == null) {
return null;
}
DistributedTracePayloadImpl distributedTracePayload = DistributedTracePayloadImpl.parseDistributedTracePayload(payload);
if (distributedTracePayload == null) {
String msg = MessageFormat.format("{0} header value was not accepted.", NEWRELIC_TRACE_HEADER);
Log.getInstance().debug(msg);
throw new IllegalArgumentException(msg);
}
long transportDurationInMillis = Math.max(0, System.currentTimeMillis() - distributedTracePayload.getTimestamp());
return new LambdaPayloadContext(distributedTracePayload, transportDurationInMillis, Collections.emptyMap());
}
@Override
public void close() {
// No-op
}
private <C> String getPayloadString(Format<C> format, C carrier) {
String payload = null;
if (format.equals(Format.Builtin.TEXT_MAP)) {
for (Map.Entry<String, String> entry : ((TextMap) carrier)) {
if (entry.getKey().equalsIgnoreCase(NEWRELIC_TRACE_HEADER)) {
payload = entry.getValue();
}
}
} else if (format.equals(Format.Builtin.HTTP_HEADERS)) {
if (((TextMap) carrier).iterator() == null) {
throw new IllegalArgumentException("Invalid carrier.");
}
for (Map.Entry<String, String> entry : ((TextMap) carrier)) {
if (entry.getKey().equalsIgnoreCase(NEWRELIC_TRACE_HEADER)) {
payload = new String(Base64.getDecoder().decode(entry.getValue()), UTF_8);
}
}
} else if (format.equals(Format.Builtin.BINARY)) {
ByteBuffer buffer = (ByteBuffer) carrier;
if (buffer == null) {
throw new IllegalArgumentException("Invalid carrier.");
}
int payloadLength = buffer.getInt();
byte[] payloadBytes = new byte[payloadLength];
buffer.get(payloadBytes);
payload = new String(payloadBytes, UTF_8);
} else {
String msg = MessageFormat.format("Invalid or missing extract format: {0}.", format);
Log.getInstance().debug(msg);
throw new IllegalArgumentException(msg);
}
if (payload == null) {
Log.getInstance().debug(MessageFormat.format("Unable to extract payload from carrier: {0}.", carrier));
return null;
}
return payload;
}
AdaptiveSampling adaptiveSampling() {
return adaptiveSampling;
}
}
| [
"jkeller@newrelic.com"
] | jkeller@newrelic.com |
0e3f8a6fbf40a21ad18e2e3a24117092699e38a6 | 701ae739af54aa886297542f5c6dbca1f2112ecf | /app/src/main/java/com/example/android/abndp7guardiannewsapp/NewsLoader.java | 27a894c42f64b282f72233359f72fc0312458ff5 | [] | no_license | efehandanisman/ABNDP7GuardianNewsApp | b190666c15bba38bd7dc8bf47980cb7af2d70258 | ccc55be78cc1fb89afe554623b1a46f6ba79c176 | refs/heads/master | 2020-03-19T21:27:56.663505 | 2018-06-17T18:14:18 | 2018-06-17T18:14:18 | 136,940,955 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,051 | java | package com.example.android.abndp7guardiannewsapp;
/**
* Created by Efehan on 11.6.2018.
*/
import android.content.AsyncTaskLoader;
import android.content.Context;
import android.util.Log;
import java.util.List;
/**
* Created by Efehan on 23.4.2018.
*/
public class NewsLoader extends AsyncTaskLoader<List<NewsClass>> {
private static final String LOG_TAG = NewsLoader.class.getName();
private String mUrl;
public NewsLoader(Context context, String url) {
super(context);
mUrl = url;
}
@Override
protected void onStartLoading() {
forceLoad();
}
@Override
public List<NewsClass> loadInBackground() {
Log.d(LOG_TAG, "loadInBackground()");
if (mUrl == null) {
return null;
}
List<NewsClass> newsList = Query.fetchNewsData(mUrl);
/* if (newsList.size() == 0) {
Log.d(LOG_TAG, "news list is empty");
} else {
Log.d(LOG_TAG, newsList.get(0).getTitle());
}*/
return newsList;
}
}
| [
"efedanisman@gmail.com"
] | efedanisman@gmail.com |
4e9ea839bb657ef6f04cc9f415d17b9d7f06d6da | 7c28975aed0ea49ea1292425c4442d8170807dd3 | /src/abilities/AbilityPriority.java | 681533f604796ad0c55e1a7d401fcde7950709e3 | [
"MIT"
] | permissive | Stefania12/League-of-OOP | 66aa48a7921d67128d315bbc62ed2cb2c8707f83 | 149bb9b758e7e83100e763942a9e68f322c60afe | refs/heads/master | 2022-12-28T13:36:42.379836 | 2020-10-11T13:30:01 | 2020-10-11T13:30:01 | 222,096,107 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 70 | java | package abilities;
public enum AbilityPriority {
FIRST, SECOND
}
| [
"stefania.damian1207@gmail.com"
] | stefania.damian1207@gmail.com |
477cdd31abf387b473f913fb6747b3b89c264977 | a86b7f0c62833207c98e4bb4d078d2f673c6f788 | /src/test/java/fr/shcherbakov/countservice/CountServiceApplicationTests.java | 35a32bf385e110d1de76a855d7014c84cd949cd4 | [] | no_license | Daboombastik/Accounts | 8b07a11a268e17b7f9a07931536ea17e53256a4c | 0a41e3fdcfe783c09cf998b27dc6aa11d74b6579 | refs/heads/main | 2023-09-02T19:58:16.801412 | 2021-11-12T22:33:26 | 2021-11-12T22:33:26 | 427,362,864 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 225 | java | package fr.shcherbakov.countservice;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class CountServiceApplicationTests {
@Test
void contextLoads() {
}
}
| [
"s.shcherbakov@yahoo.fr"
] | s.shcherbakov@yahoo.fr |
6acac9772884b8c38872ccb1373d5f95659cc34e | 487e89cbbe240315c75481d210f8f2fc27f0b819 | /src/main/java/iqiyi/Crawler.java | 42edc6b29c5e8aa653588f761aec75b48e96d853 | [
"Apache-2.0"
] | permissive | viixv/iqiyi-crawler | eaf3cd6c140e40a78672028ebd0c04563b9ebf4a | c409dab12d1878ebc21854e6cd91cdd5fc6c048d | refs/heads/master | 2021-01-19T07:06:32.249757 | 2017-04-07T08:29:07 | 2017-04-07T08:29:07 | 87,522,596 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,872 | java | package iqiyi;
import java.util.Iterator;
import java.util.List;
import org.apache.commons.lang.StringUtils;
import us.codecraft.webmagic.Page;
import us.codecraft.webmagic.Site;
import us.codecraft.webmagic.processor.PageProcessor;
import us.codecraft.webmagic.selector.JsonPathSelector;
public class Crawler implements PageProcessor {
private Site site = Site.me().setTimeOut(4000).setRetryTimes(4).setSleepTime(1000).setUserAgent(
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36");
public static final String ALBUMID_RULE = "albumId:(.+?\\d),";
public static final String LIST_PAGE_RULE = "http://list\\.iqiyi\\.com/www/.+?\\.html";
public static final String RESULT_RULE = "http://mixer\\.video\\.iqiyi\\.com/jp/mixin/videos/avlist\\?albumId=\\d+?&size=4096";
public static final String VIDEO_PAGE_RULE = "http://(www|vip)\\.iqiyi\\.com/.+?\\.html";
@Override
public Site getSite() {
return site;
}
@Override
public void process(Page page) {
if (page.getUrl().regex(LIST_PAGE_RULE).match()) {
page.addTargetRequests(page.getHtml().links().regex(LIST_PAGE_RULE, 0).all());
page.addTargetRequests(page.getHtml().links().regex(VIDEO_PAGE_RULE, 0).all());
} else if (page.getUrl().regex(VIDEO_PAGE_RULE).match()) {
String albumId = page.getHtml().regex("albumId:(.*?\\d),", 1).toString().replace(" ", "");
if (StringUtils.isNotBlank(albumId)) {
page.addTargetRequest(
"http://mixer.video.iqiyi.com/jp/mixin/videos/avlist?albumId=" + albumId + "&size=4096");
page.addTargetRequests(page.getHtml().links().regex(VIDEO_PAGE_RULE, 0).all());
}
} else if (page.getUrl().regex(RESULT_RULE).match()) {
String json = page.getJson().toString().replace("var tvInfoJs=", "");
List<String> mixinVideos = new JsonPathSelector("$.mixinVideos").selectList(json);
if (!mixinVideos.isEmpty()) {
JsonPathSelector jsonPathAlbumId = new JsonPathSelector("$.albumId");
JsonPathSelector jsonPathTvId = new JsonPathSelector("$.tvId");
JsonPathSelector jsonPathUrl = new JsonPathSelector("$.url");
JsonPathSelector jsonPathPlayCount = new JsonPathSelector("$.playCount");
JsonPathSelector jsonPathName = new JsonPathSelector("$.name");
JsonPathSelector jsonPathDescription = new JsonPathSelector("$.description");
String record = "";
for (Iterator<String> iterator = mixinVideos.iterator(); iterator.hasNext();) {
String element = iterator.next();
record += jsonPathAlbumId.select(element) + "\t" + jsonPathTvId.select(element) + "\t"
+ jsonPathUrl.select(element) + "\t" + jsonPathPlayCount.select(element) + "\t"
+ jsonPathName.select(element).replaceAll("[\t\n]", "") + "\t"
+ jsonPathDescription.select(element).replaceAll("[\t\n]", " ") + "\n";
}
System.out.print(record);
}
}
}
} | [
"viixv@qq.com"
] | viixv@qq.com |
17f1b3e2aeaa91a523d32bce266e825c55185179 | f21b12b2a515bfd2723372ff74b67ce9a73599ec | /tcc-api/src/main/java/org/ihtsdo/otf/tcc/api/changeset/ChangeSetGeneratorBI.java | e86ccafe1195a07eb3f09bb3e9ffa3b925e0e359 | [] | no_license | Apelon-VA/va-ochre | 44d0ee08a9bb6bb917efb36d8ba9093bad9fb216 | 677355de5a2a7f25fb59f08182633689075c7b93 | refs/heads/develop | 2020-12-24T14:00:41.848798 | 2015-10-01T07:20:00 | 2015-10-01T07:20:00 | 33,519,478 | 2 | 1 | null | 2015-06-26T14:14:18 | 2015-04-07T03:18:28 | Java | UTF-8 | Java | false | false | 485 | java | package org.ihtsdo.otf.tcc.api.changeset;
import java.io.IOException;
import org.ihtsdo.otf.tcc.api.nid.NidSetBI;
import org.ihtsdo.otf.tcc.api.concept.ConceptChronicleBI;
public interface ChangeSetGeneratorBI {
public void open(NidSetBI commitSapNids) throws IOException;
public void writeChanges(ConceptChronicleBI concept, long time) throws IOException;
public void setPolicy(ChangeSetGenerationPolicy policy);
public void commit() throws IOException;
}
| [
"campbell@informatics.com"
] | campbell@informatics.com |
55aaddab07cdd3ab07a85a5911d9cb0db005de00 | dad894c2b2ba58736e08cea55bae67b1d5e8df27 | /src/main/java/org/tangence/java/PropertyWatcher.java | c243031c953d5a6b95508f18ec8f29f8cd67caca | [
"Apache-2.0"
] | permissive | tm604/tangence-java | e05069e2ff85a7ac7d8b845d6af7ff12dc10dd2e | c00ba17e384dc979b5ff7dffc4ba28896d336bf6 | refs/heads/master | 2016-09-10T22:09:35.546083 | 2015-06-27T22:04:53 | 2015-06-27T22:04:53 | 38,176,280 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,400 | java | package org.tangence.java;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class PropertyWatcher {
private static Logger log = LoggerFactory.getLogger(PropertyWatcher.class.getName());
public PropertyWatcher() { }
public void dispatch(final TangenceObjectProxy.ScalarUpdate ev) {
log.debug("scalar update");
final Object v = ev.value();
log.debug(String.format("scalar value = %s", v));
valueChanged(v);
log.debug("done pw update");
}
public void valueChanged(Object o) {
log.debug(String.format("default valueChanged handler picked up %s", o));
}
public void dispatch(final TangenceObjectProxy.HashUpdateSet ev) {
log.debug("hash set");
final Map<String, Object> hash = ev.value();
for(final String k : hash.keySet()) {
keyAdded(k, hash.get(k));
}
}
public void dispatch(final TangenceObjectProxy.HashUpdateAdd ev) {
log.debug("hash add");
keyAdded(ev.key(), ev.value());
}
public void dispatch(final TangenceObjectProxy.HashUpdateRemove ev) {
log.debug("hash remove");
keyRemoved(ev.key());
}
public void keyAdded(final String k, final Object v) { }
public void keyRemoved(final String k) { }
public void dispatch(final TangenceObjectProxy.QueueUpdateSet ev) {
log.debug("queue set");
final List<Object> list = ev.value();
for(final Object v : list) {
itemPushed(v);
}
}
public void dispatch(final TangenceObjectProxy.QueueUpdatePush ev) {
log.debug("queue push");
final List<Object> list = ev.value();
for(final Object v : list) {
itemPushed(v);
}
}
public void dispatch(final TangenceObjectProxy.QueueUpdateShift ev) {
log.debug("queue push");
for(int idx = 0; idx < ev.count(); ++idx) {
itemShifted();
}
}
public void dispatch(final TangenceObjectProxy.ArrayUpdateSet ev) {
log.debug("array set");
final List<Object> list = ev.value();
for(final Object v : list) {
itemPushed(v);
}
}
public void dispatch(final TangenceObjectProxy.ArrayUpdatePush ev) {
log.debug("array push");
final List<Object> list = ev.value();
for(final Object v : list) {
itemPushed(v);
}
}
public void dispatch(final TangenceObjectProxy.ArrayUpdateShift ev) {
log.debug("array push");
for(int idx = 0; idx < ev.count(); ++idx) {
itemShifted();
}
}
public void itemPushed(final Object v) { }
public void itemShifted() { }
}
| [
"tom@perlsite.co.uk"
] | tom@perlsite.co.uk |
17095493b6b4f7112b67ed25d5c51bfd1209d39f | 673beb9cdcbc305e7697c39e57565eb3e5456528 | /ig-webapi-java-client/src/main/java/com/iggroup/webapi/samples/client/rest/dto/getDealConfirmationV1/GetDealConfirmationV1Response.java | f98ea0af402bff4844a01c2b1cb4a8effd1469cf | [] | permissive | dutoitns/ig-webapi-java-sample | 9454628f14bfd90749fab4942e8a98cd1fb343d2 | 77d185ad5634202fbc8313701f436a920dc6591c | refs/heads/master | 2023-03-16T21:14:47.352351 | 2022-11-07T06:48:01 | 2022-11-07T06:48:01 | 562,737,579 | 0 | 0 | BSD-3-Clause | 2022-11-07T06:33:59 | 2022-11-07T06:33:59 | null | UTF-8 | Java | false | false | 3,683 | java | package com.iggroup.webapi.samples.client.rest.dto.getDealConfirmationV1;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
/*
Deal confirmation
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class GetDealConfirmationV1Response {
/*
Position status
*/
private PositionStatus status;
/*
Reason message
*/
private Reason reason;
/*
Deal status
*/
private DealStatus dealStatus;
/*
Instrument epic identifier
*/
private String epic;
/*
Instrument expiry
*/
private String expiry;
/*
Deal reference
*/
private String dealReference;
/*
Deal identifier
*/
private String dealId;
/*
List of affected deals
*/
private java.util.List<AffectedDealsItem> affectedDeals;
/*
Level
*/
private Float level;
/*
Size
*/
private Float size;
/*
Direction
*/
private Direction direction;
/*
Stop level
*/
private Float stopLevel;
/*
Limit level
*/
private Float limitLevel;
/*
Stop distance
*/
private Float stopDistance;
/*
Limit distance
*/
private Float limitDistance;
/*
True if guaranteed stop
*/
private Boolean guaranteedStop;
/*
True if trailing stop
*/
private Boolean trailingStop;
/*
Profit
*/
private BigDecimal profit;
/*
Profit currency
*/
private String profitCurrency;
public PositionStatus getStatus() { return status; }
public void setStatus(PositionStatus status) { this.status=status; }
public Reason getReason() { return reason; }
public void setReason(Reason reason) { this.reason=reason; }
public DealStatus getDealStatus() { return dealStatus; }
public void setDealStatus(DealStatus dealStatus) { this.dealStatus=dealStatus; }
public String getEpic() { return epic; }
public void setEpic(String epic) { this.epic=epic; }
public String getExpiry() { return expiry; }
public void setExpiry(String expiry) { this.expiry=expiry; }
public String getDealReference() { return dealReference; }
public void setDealReference(String dealReference) { this.dealReference=dealReference; }
public String getDealId() { return dealId; }
public void setDealId(String dealId) { this.dealId=dealId; }
public java.util.List<AffectedDealsItem> getAffectedDeals() { return affectedDeals; }
public void setAffectedDeals(java.util.List<AffectedDealsItem> affectedDeals) { this.affectedDeals=affectedDeals; }
public Float getLevel() { return level; }
public void setLevel(Float level) { this.level=level; }
public Float getSize() { return size; }
public void setSize(Float size) { this.size=size; }
public Direction getDirection() { return direction; }
public void setDirection(Direction direction) { this.direction=direction; }
public Float getStopLevel() { return stopLevel; }
public void setStopLevel(Float stopLevel) { this.stopLevel=stopLevel; }
public Float getLimitLevel() { return limitLevel; }
public void setLimitLevel(Float limitLevel) { this.limitLevel=limitLevel; }
public Float getStopDistance() { return stopDistance; }
public void setStopDistance(Float stopDistance) { this.stopDistance=stopDistance; }
public Float getLimitDistance() { return limitDistance; }
public void setLimitDistance(Float limitDistance) { this.limitDistance=limitDistance; }
public Boolean getGuaranteedStop() { return guaranteedStop; }
public void setGuaranteedStop(Boolean guaranteedStop) { this.guaranteedStop=guaranteedStop; }
public Boolean getTrailingStop() { return trailingStop; }
public void setTrailingStop(Boolean trailingStop) { this.trailingStop=trailingStop; }
public BigDecimal getProfit() { return profit; }
public void setProfit(BigDecimal profit) { this.profit=profit; }
public String getProfitCurrency() { return profitCurrency; }
public void setProfitCurrency(String profitCurrency) { this.profitCurrency=profitCurrency; }
}
| [
"Lucas.GutGalan@ig.com"
] | Lucas.GutGalan@ig.com |
97099f174fa9212764e96a1cd55148050f11a5b1 | 9649b262fdd58e8f8d642483b44817f84929221c | /ea-opensdk-layer/open-sdk-http/src/main/java/com/bugjc/opensdk/util/http/exception/HttpSecurityException.java | 6dd317beeb73b124b73623f689c75a472b564dad | [
"MIT"
] | permissive | a2393439531/quick-ea | d5a8cee00bcda2137da11afd7f1c94aa0f557424 | e1f6a5796bdb985914066b991c1dcdd24d4fb8bd | refs/heads/master | 2020-05-17T12:40:02.819904 | 2019-04-11T01:11:26 | 2019-04-11T01:11:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,455 | java | package com.bugjc.opensdk.util.http.exception;
import cn.hutool.core.util.StrUtil;
import lombok.Data;
import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = true)
@Data
public class HttpSecurityException extends RuntimeException {
private int code; //异常状态码
private String message; //异常信息
private String method; //发生的方法,位置等
private String desc; //描述
public HttpSecurityException(int code, String message, Throwable cause) {
super(message, cause);
this.code = code;
this.message = message;
}
public HttpSecurityException(int code, String message, String method, String desc, Throwable cause) {
super(message, cause);
this.code = code;
this.message = message;
this.method = method;
this.desc = desc;
}
public HttpSecurityException(Throwable e) {
super(e.getMessage(), e);
}
public HttpSecurityException(String message) {
super(message);
}
public HttpSecurityException(String messageTemplate, Object... params) {
super(StrUtil.format(messageTemplate, params));
}
public HttpSecurityException(String message, Throwable throwable) {
super(message, throwable);
}
public HttpSecurityException(Throwable throwable, String messageTemplate, Object... params) {
super(StrUtil.format(messageTemplate, params), throwable);
}
}
| [
"qing.muyi@foxmail.com"
] | qing.muyi@foxmail.com |
614d0f3b5e88baa4cd83d4583b88351e3326bef8 | 8bf0987eec7961e631510707a6849c86e0eb0a63 | /(9)Lambda IterateCollectionUsingForEach/src/main/java/com/infotech/demo/IterateApplication.java | 37260eeea02e71afd72dbb65586b96e10973d0fc | [] | no_license | Liubomyr17/-9-Lambda-IterateCollectionUsingForEach | 455dce560e3d9a030481e1d28f41474c968a0cf4 | 509db4403bea6938186612a77a232d57c496feb2 | refs/heads/master | 2020-11-24T16:17:02.915656 | 2019-12-15T19:32:04 | 2019-12-15T19:32:04 | 228,239,711 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 630 | java | package com.infotech.demo;
import com.infotech.demo.model.Student;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
@SpringBootApplication
public class IterateApplication {
public static void main(String[] args) {
List<Student> stuList = new ArrayList<>();
stuList.add(new Student("Bean", 45));
stuList.add(new Student("Andrew", 40));
stuList.add(new Student("Martin", 42));
stuList.forEach(System.out::println);
}
}
| [
"noreply@github.com"
] | Liubomyr17.noreply@github.com |
3f17e573f0141ef24801229c1152872ec3cf5a9a | 9f2614252555e8d149565032f1496eedd9773081 | /esac-commons-crypto/src/main/java/com/esacinc/commons/crypto/time/impl/IntervalInfoImpl.java | dd231ad9c9e5b451488ac76cfc560d96203835c1 | [
"Apache-2.0"
] | permissive | mkotelba/esac-commons | bd9033df7191c4ca1efeb5fabb085f6e353821ff | 81f1567e16fc796dec6694d7929d900deb6a4b78 | refs/heads/master | 2021-01-12T11:38:12.464762 | 2017-01-24T03:17:13 | 2017-01-24T03:17:13 | 72,240,463 | 0 | 0 | null | 2016-10-28T20:39:51 | 2016-10-28T20:39:50 | null | UTF-8 | Java | false | false | 740 | java | package com.esacinc.commons.crypto.time.impl;
import com.esacinc.commons.crypto.time.IntervalInfo;
import java.util.Date;
public class IntervalInfoImpl extends AbstractIntervalDescriptor implements IntervalInfo {
private Date startDate;
private Date endDate;
public IntervalInfoImpl(Date startDate, Date endDate) {
this.duration = ((this.endDate = endDate).getTime() - (this.startDate = startDate).getTime());
}
@Override
public boolean isValid(Date date) {
return date.after(this.startDate) && date.before(this.endDate);
}
@Override
public Date getEndDate() {
return this.endDate;
}
@Override
public Date getStartDate() {
return this.startDate;
}
}
| [
"michal.kotelba@esacinc.com"
] | michal.kotelba@esacinc.com |
4f23f2c83d0ea9af993026ccf4ac4c37f4fecb2b | df471b906f5fe585edb199864afe2083dffe7615 | /ReviewService/src/main/java/com/tim26/ReviewService/security/TokenAuthenticationFilter.java | c9077bae0ea382b82b1970caae4b57d96513bcac | [] | no_license | Tim-28-Xml/rent-a-car | 7f687e5367ecbb12f24ed2bb494b1f0a9aaaa56a | 2306ac98843a771c2427d0676fb2089b623411a0 | refs/heads/master | 2023-02-09T12:41:33.936573 | 2020-07-12T07:02:29 | 2020-07-12T07:02:29 | 265,042,331 | 0 | 1 | null | 2021-01-06T03:30:12 | 2020-05-18T19:34:16 | Java | UTF-8 | Java | false | false | 2,141 | java | package com.tim26.ReviewService.security;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import org.springframework.security.web.authentication.WebAuthenticationDetailsSource;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.HashSet;
import java.util.Set;
public class TokenAuthenticationFilter extends UsernamePasswordAuthenticationFilter {
private TokenUtils tokenUtils;
public TokenAuthenticationFilter(TokenUtils tokenUtils) {
this.tokenUtils = tokenUtils;
}
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException {
HttpServletRequest httpRequest = (HttpServletRequest) request;
String username;
String authToken = tokenUtils.getToken(httpRequest);
if(authToken != null){
String permString = tokenUtils.getPermissionsFromToken(authToken);
username = tokenUtils.getUsernameFromToken(authToken);
if (permString != null) {
Set<SimpleGrantedAuthority> authorities = new HashSet<>();
String[] tokens = permString.split(",");
for (String token : tokens) {
authorities.add(new SimpleGrantedAuthority(token));
}
UsernamePasswordAuthenticationToken auth = new UsernamePasswordAuthenticationToken(username, null, authorities);
auth.setDetails(new WebAuthenticationDetailsSource().buildDetails(httpRequest));
SecurityContextHolder.getContext().setAuthentication(auth);
}
}
filterChain.doFilter(request, response);
}
}
| [
"ognjengari@gmail.com"
] | ognjengari@gmail.com |
663e1dffed5ed0e8282167433c98110ed939653a | 20c541d6f3a796fdbe50e40d9c41519ac279dc4b | /xiaoyuan-webapi/src/main/java/com/xiaoyuan/controller/TeachersController.java | 14359ed155ecaa77e987d7d7e8f3075db848eb4b | [] | no_license | seerller/xiaoyuan | c71e4561c605d646748b51290adc5730196aea74 | 5d6ddb8f7fc88a48b29e997264341888b6e2896d | refs/heads/master | 2022-07-11T05:08:48.675823 | 2019-12-24T07:16:26 | 2019-12-24T07:16:26 | 224,092,802 | 0 | 1 | null | 2022-06-29T17:48:23 | 2019-11-26T03:19:51 | Java | UTF-8 | Java | false | false | 2,579 | java | package com.xiaoyuan.controller;
import com.xiaoyuan.controller.common.BaseController;
import com.xiaoyuan.model.Teachers;
import com.xiaoyuan.service.impl.TeachersServiceImpl;
//import com.xiaoyuan.controller.common.BaseController;
import com.xiaoyuan.tools.MessageBean;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;
/**
* <p>
* 教师控制层
* </p>
*
* @author jobob
* @since 2019-11-26
*/
@Api(value = "/Teachers", description = "教师管理控制层")
@RestController
@RequestMapping("/mapper/teachers")
public class TeachersController extends BaseController {
@Autowired
TeachersServiceImpl teachersService;
@Test
@RequestMapping(value = "/List<Teachers>", method = RequestMethod.GET)
@ApiOperation(value = "查询教师所有信息", notes = "教师信息")
public MessageBean getTeacherList(){
//try{
return getTeacherList();
//}catch(Exception e){
// System.out.println("操作失败,请重试");
//}
}
@RequestMapping(value = "/addTeachers", method = RequestMethod.POST)
@ApiOperation(value ="新增教师", notes = "新增教师")
public void addTeachers(Teachers teachers){
try{
teachersService.addTeachers(teachers);
}catch(Exception e){
System.out.println("信息错误,请重新输入");
}
}
@RequestMapping(value = "/updateTeachers", method = RequestMethod.POST)
@ApiOperation(value ="修改教师", notes = "新增教师")
public void updateTeachers(Teachers teachers){
teachersService.updateTeachers(teachers);
}
@RequestMapping(value = "/deleteTachers", method = RequestMethod.POST)
@ApiOperation(value = "删除教师", notes = "删除教师")
public void deleteTReachers(Teachers teachers){
teachersService.deleteTeachers(teachers);
}
@RequestMapping(value = "/setTeachersstatus", method = RequestMethod.POST)
@ApiOperation(value = "冻结教师", notes = "冻结教师")
public void setTeachersstatus(Teachers teachers) {
teachersService.setTeachersstatus(teachers);
}
}
| [
"lb13936412292@live.com"
] | lb13936412292@live.com |
c2ff7bf6c860c8d6fb81bd67ae13e18b3cd1128f | 6870c12a2fc2369c562068642007c50e1972c5e9 | /src/edu/first/module/actuators/JaguarModule.java | 597af0e377fe91a0940166698b1cb69edfcc45ad | [
"BSD-3-Clause"
] | permissive | jlawniczak340/atalibj | 9fe54a3996224a45c097cda25a73a08b563ba182 | ecc8bc0e7a8c1eab395a45afa05de547015ea9aa | refs/heads/master | 2021-01-17T22:06:47.591265 | 2013-06-17T14:19:40 | 2013-06-17T14:19:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,462 | java | package edu.first.module.actuators;
import edu.first.module.Module;
import edu.wpi.first.wpilibj.Jaguar;
/**
* The general purpose class that manipulates Jaguar speed controllers made by
* Texas Instruments. Should work for all models.
*
* @since May 28 13
* @author Joel Gallant
*/
public class JaguarModule extends Module.StandardModule implements SpeedController {
private final Jaguar jaguar;
/**
* Constructs the module with the jaguar object underneath this class to
* call methods from.
*
* @param jaguar the composing instance which perform the functions
*/
protected JaguarModule(Jaguar jaguar) {
if (jaguar == null) {
throw new NullPointerException("Null jaguar given");
}
this.jaguar = jaguar;
}
/**
* Constructs the module with the port on the digital sidecar.
*
* @param channel port on sidecar
*/
public JaguarModule(int channel) {
this(new Jaguar(channel));
}
/**
* Constructs the module with the port on the digital sidecar and which slot
* the sidecar is in.
*
* @param channel port on sidecar
* @param slot slot in cRIO (1 = default)
*/
public JaguarModule(int channel, int slot) {
this(new Jaguar(slot, channel));
}
/**
* {@inheritDoc}
*/
protected void enableModule() {
}
/**
* {@inheritDoc}
*
* <p> Stops the jaguar from moving.
*/
protected void disableModule() {
jaguar.disable();
}
/**
* {@inheritDoc}
*/
public void init() {
}
/**
* {@inheritDoc}
*
* @throws IllegalStateException when module is not enabled
*/
public void setSpeed(double speed) {
ensureEnabled();
jaguar.set(speed);
}
/**
* {@inheritDoc}
*
* @throws IllegalStateException when module is not enabled
*/
public void setRawSpeed(int speed) {
ensureEnabled();
jaguar.setRaw(speed);
}
/**
* {@inheritDoc}
*
* @throws IllegalStateException when module is not enabled
*/
public double getSpeed() {
ensureEnabled();
return jaguar.getSpeed();
}
/**
* {@inheritDoc}
*
* @throws IllegalStateException when module is not enabled
*/
public int getRawSpeed() {
return jaguar.getRaw();
}
/**
* {@inheritDoc}
*
* <p> This method does not need to be called on a {@code Jaguar}, but if
* something freezes it may help relieve it.
*/
public void update() {
jaguar.Feed();
}
/**
* {@inheritDoc}
*
* @throws IllegalStateException when module is not enabled
*/
public void setRate(double rate) {
ensureEnabled();
jaguar.set(rate);
}
/**
* {@inheritDoc}
*
* @throws IllegalStateException when module is not enabled
*/
public void set(double value) {
ensureEnabled();
jaguar.set(value);
}
/**
* {@inheritDoc}
*
* @throws IllegalStateException when module is not enabled
*/
public double getRate() {
ensureEnabled();
return jaguar.getSpeed();
}
/**
* {@inheritDoc}
*
* @throws IllegalStateException when module is not enabled
*/
public double get() {
ensureEnabled();
return jaguar.getSpeed();
}
}
| [
"joelgallant236@gmail.com"
] | joelgallant236@gmail.com |
66c37ad8c34c9d940b7caf11faac57181e7a3f36 | 3587da1704998d6973a062fe259c4f560603826d | /src/network/INet.java | 2c14e0116173d5b2992575352fdaeb9931b68e83 | [] | no_license | ADDRMeridan/Project_L3-S1 | b3673301c8c06177d4c4e354039781ad44eb902c | 69988a0febf61669925de9ae654855add2125a06 | refs/heads/master | 2021-05-06T16:12:34.501339 | 2018-01-15T18:20:10 | 2018-01-15T18:20:10 | 113,684,022 | 0 | 0 | null | 2018-01-15T16:36:35 | 2017-12-09T16:32:21 | PHP | UTF-8 | Java | false | false | 278 | java | package network;
import struct.Message;
public interface INet {
public boolean connectToServ();
public boolean acceptClient(String username, String password);
public boolean sendTicket();
public boolean sendMessage(Message mess);
public boolean disconnect();
}
| [
"noreply@github.com"
] | ADDRMeridan.noreply@github.com |
5ad96dc10b4183976ef9818166a9fce0ee978494 | bf3619d5ae8d785b2bbb6fe90d03d317abf2ae64 | /ComplaintBox/src/main/java/com/spring/boot/complaint/service/AdminService.java | 1c08201d5419016bc65bd910735ed60ed500f3d4 | [] | no_license | Pankajnegi113/ComplaintBox | 879b8be6c0e649ca9ca34e8df47440add7a1a2c0 | 02547d5efa310b1bdf613ec7131d281d04138c94 | refs/heads/master | 2022-12-29T10:28:04.611283 | 2020-10-15T17:34:33 | 2020-10-15T17:34:33 | 304,397,352 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 360 | java | package com.spring.boot.complaint.service;
import org.springframework.stereotype.Component;
import com.spring.boot.complaint.model.Admin;
import com.spring.boot.complaint.response.ResponseDTO;
@Component
public interface AdminService {
public void registerAdmin(Admin admin);
public ResponseDTO findAllJobs();
public void resolveComp(Long compId);
}
| [
"pankajnegi113.pn@gmail.com"
] | pankajnegi113.pn@gmail.com |
3ab85e2cd1ee95f44f73018dee841ed82b94c77d | af6d92656c0e360c369cf769fcca51ed0d7797c3 | /src/org/apache/batik/constraint/xpath/operations/Number.java | 3b1b9502356d84600e0fc49bf66b396034739737 | [] | no_license | cgrafena/CSVG | 77cd23526bb0e30bd8e09269bfd748479bd487f6 | fe5b3647612783e0a5fbb35900fd063141db6ba2 | refs/heads/master | 2016-09-10T19:43:36.757197 | 2012-06-18T18:14:57 | 2012-06-18T18:14:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 733 | java | package org.apache.batik.constraint.xpath.operations;
import org.apache.batik.constraint.values.Value;
import org.apache.batik.constraint.xpath.Operators;
import org.apache.xpath.objects.XObject;
/**
* Cast to number operator.
*/
public class Number extends org.apache.xpath.operations.Number {
public XObject operate(XObject right)
throws javax.xml.transform.TransformerException {
XObject result = null;
right = Value.normaliseXObject(right);
if (right.getType() == XObject.CLASS_UNKNOWN
&& right.object() instanceof Operators) {
result = ((Operators) right.object()).number();
}
return result == null ? super.operate(right) : result;
}
}
| [
"cgrafena@gmail.com"
] | cgrafena@gmail.com |
56cf165c116b9c888174320e588db382d3955b10 | e58a8e0fb0cfc7b9a05f43e38f1d01a4d8d8cf1f | /BrainMaze/src/com/puttysoftware/brainmaze/generic/GenericPass.java | a38385ed0af1f033a528fc03a57e3bba497cfbf5 | [
"Unlicense"
] | permissive | retropipes/older-java-games | 777574e222f30a1dffe7936ed08c8bfeb23a21ba | 786b0c165d800c49ab9977a34ec17286797c4589 | refs/heads/master | 2023-04-12T14:28:25.525259 | 2021-05-15T13:03:54 | 2021-05-15T13:03:54 | 235,693,016 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 662 | java | /* BrainMaze: A Maze-Solving Game
Copyright (C) 2008-2012 Eric Ahnell
Any questions should be directed to the author via email at: products@puttysoftware.com
*/
package com.puttysoftware.brainmaze.generic;
public abstract class GenericPass extends GenericInfiniteKey {
// Constructors
protected GenericPass() {
super();
}
@Override
public abstract String getName();
@Override
protected void setTypes() {
this.type.set(TypeConstants.TYPE_PASS);
this.type.set(TypeConstants.TYPE_INFINITE_KEY);
this.type.set(TypeConstants.TYPE_KEY);
this.type.set(TypeConstants.TYPE_INVENTORYABLE);
}
}
| [
"eric.ahnell@puttysoftware.com"
] | eric.ahnell@puttysoftware.com |
5292cde179af6c2dd3cedfa1286212c8f8f6de90 | 698968c03ec8244f0f5600783d5cf7773f9f4990 | /app/src/main/java/ads/com/co/paymentmethods/googlepay/PaymentsUtil.java | 6f206cdcf41806d4eb6b482e30b96dda8358535b | [] | no_license | Agostinhodossantos/Paymentmethods | e08459a61c297fa36405c0146d0370b57559c2bc | d56dd1807f412903550df917c4ee9fddeb07c922 | refs/heads/master | 2022-12-14T21:37:17.654551 | 2020-09-22T09:32:56 | 2020-09-22T09:32:56 | 297,557,832 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 76 | java | package ads.com.co.paymentmethods.googlepay;
public class PaymentsUtil {
}
| [
"agostinhodossantos27@gmail.com"
] | agostinhodossantos27@gmail.com |
43a46fde976a2cd71f17b07947faae5c480b2441 | 3ff2b105bc6854984a9aace8d71fc11a1e91d5f0 | /src/main/java/com/smates/dbc2/mencache/annotation/CacheKeyInfo.java | 2c031c881358e11eb6bb28ae84efca3158876dd5 | [
"Apache-2.0"
] | permissive | MarchMachao/watershed | d0fa09012398a4672bfb2e13513c9844d48d75b3 | 401da957e018a2eebb582d0f1542f88f1346d08f | refs/heads/master | 2021-01-19T13:37:31.985847 | 2017-08-20T13:43:48 | 2017-08-20T13:43:48 | 100,847,839 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 853 | java | package com.smates.dbc2.mencache.annotation;
/**
* 解析带annotation cacheKey的方法时候的临时包装类,包括标注参数的值与index
*/
public class CacheKeyInfo implements Comparable<CacheKeyInfo> {
private String value;
private int index;
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public int getIndex() {
return index;
}
public void setIndex(int index) {
this.index = index;
}
public CacheKeyInfo() {
}
public CacheKeyInfo(String value, int index) {
super();
this.value = value;
this.index = index;
}
@Override
public int compareTo(CacheKeyInfo o) {
return this.getIndex() - o.getIndex();
}
}
| [
"295188526@qq.com"
] | 295188526@qq.com |
e2c0ca9ffcc4b1bac5373114e3d26def54d2dfda | 1553477d091ad4d31e6ad5edda0565c35360fa47 | /src/main/java/com/ho/studio/springbootreacttemplate/enemy/domain/EnemyFacade.java | bd6674be572f4194d1a52dd87805d002779a7c69 | [] | no_license | MicaeFortis/Thorn | 9d64306e78d1042cdd19b802a584b3237f331262 | 1666cf20a0400291c8383737a771de5bfd48a2a4 | refs/heads/master | 2021-06-20T16:56:37.940913 | 2019-08-10T15:57:35 | 2019-08-10T15:57:35 | 162,027,669 | 0 | 0 | null | 2021-01-05T13:00:14 | 2018-12-16T18:08:56 | TypeScript | UTF-8 | Java | false | false | 1,209 | java | package com.ho.studio.springbootreacttemplate.enemy.domain;
import com.ho.studio.springbootreacttemplate.enemy.dto.EnemyDto;
import com.ho.studio.springbootreacttemplate.enemy.dto.EnemyType;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.Collection;
import java.util.Optional;
import static java.util.stream.Collectors.toList;
@Component
@RequiredArgsConstructor
@Transactional
public class EnemyFacade {
private final EnemyRepository enemyRepository;
public EnemyDto show(Long id) {
Optional<Enemy> enemy = enemyRepository.findById(id);
return enemy.map(Enemy::dto).orElse(null);
}
public void delete(EnemyDto itemDto) {
Enemy item = EnemyCreator.from(itemDto);
enemyRepository.delete(item);
}
public EnemyDto save(EnemyDto itemDto) {
Enemy item = EnemyCreator.from(itemDto);
return enemyRepository.save(item).dto();
}
public Collection<EnemyDto> findAll() {
return enemyRepository.findAll().stream().map(Enemy::dto).collect(toList());
}
public Collection<EnemyType> getItemTypes() {
return EnemyType.getEnemyTypes();
}
}
| [
"wochnik.michal@gmail.com"
] | wochnik.michal@gmail.com |
b7cac175059287119a3748b9b6acb16074eb21f9 | 718cf282982b59b228532020bd7d8f2c88f8da8e | /src/main/java/com/github/kodomo/dsmpayments/domain/receipt/service/dto/ReceiptJoinDTO.java | 1c4f4abbb21345e4c05c37a0e5c3f36bb0ba207a | [
"MIT"
] | permissive | LeagueLugas/dsm-payments | c51d0e2ff636334f746ebe8c9831d00735cf0be4 | a1c208b2fc6e3558ce6831e34cc2780524c1f7a0 | refs/heads/main | 2023-06-12T06:52:16.447223 | 2021-07-06T01:54:04 | 2021-07-06T01:54:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 260 | java | package com.github.kodomo.dsmpayments.domain.receipt.service.dto;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
@Getter
@NoArgsConstructor
@AllArgsConstructor
public class ReceiptJoinDTO {
private int number;
}
| [
"leaguelugas@gmail.com"
] | leaguelugas@gmail.com |
a5afd85a595cd60062684652443d17256dcbd3ea | 6bb2209267f897472f4432fdcd537e584adedd17 | /src/edu/missouri/cf/pdcapp/ui/converter/Formatter.java | b073eb2fa047b08a49f920c2a824bdf7b2970667 | [] | no_license | ray2928/PDCApp | a3d0030654f69033cbb0f32df2ac70fa691d5565 | fc77fef93e57f98d655a39602f1329e26c746334 | refs/heads/master | 2020-05-15T01:21:43.481191 | 2015-10-13T21:02:31 | 2015-10-13T21:02:31 | 42,869,844 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,258 | java | package edu.missouri.cf.pdcapp.ui.converter;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.Locale;
public final class Formatter {
/*
* These are not thread safe and not localized properly -- need to be
* replaced
*/
// public final static DecimalFormat CURRENCY = new DecimalFormat("$###,###,###,###,##0.00");
// public final static DecimalFormat DECIMAL = new DecimalFormat("###,###,###,###,##0.00");
// public final static DecimalFormat INTEGER = new DecimalFormat("##############0");
// public final static DecimalFormat SHORTPERCENT = new DecimalFormat("##0.00");
// public final static DecimalFormat LONGPERCENT = new DecimalFormat("##0.000000");
public final static SimpleDateFormat DATE = new SimpleDateFormat("MM/dd/yyyy");
public final static SimpleDateFormat TIMESTAMP = new SimpleDateFormat("MM/dd/yyyy hh:mm aaa");
//public final static FilesizeFormat FILESIZE = new FilesizeFormat(false);
public static NumberFormat getCurrencyFormat() {
NumberFormat nf = null;
// if (User.getUser() != null) {
// nf = NumberFormat.getCurrencyInstance(User.getUser().getUserCountryLocale());
// nf.setMinimumIntegerDigits(1);
// nf.setMaximumIntegerDigits(15);
// } else {
nf = NumberFormat.getCurrencyInstance(Locale.US);
nf.setMinimumIntegerDigits(1);
nf.setMaximumIntegerDigits(15);
nf.setMaximumFractionDigits(2);
// }
return nf;
}
public static NumberFormat getDecimalFormat() {
NumberFormat nf = null;
// if (User.getUser() != null) {
// nf = NumberFormat.getInstance(User.getUser().getUserCountryLocale());
// nf.setMinimumIntegerDigits(1);
// nf.setMaximumIntegerDigits(15);
// nf.setMaximumFractionDigits(2);
// } else {
nf = NumberFormat.getInstance(Locale.US);
nf.setMinimumIntegerDigits(1);
nf.setMaximumIntegerDigits(15);
nf.setMaximumFractionDigits(2);
// }
return nf;
}
public static NumberFormat getIntegerFormat() {
NumberFormat nf = null;
// if (User.getUser() != null) {
// nf = NumberFormat.getIntegerInstance(User.getUser().getUserCountryLocale());
// nf.setMaximumIntegerDigits(15);
// } else {
nf = NumberFormat.getIntegerInstance(Locale.US);
nf.setMaximumIntegerDigits(15);
// }
return nf;
}
public static NumberFormat getLongPercentFormat() {
NumberFormat nf = null;
// if (User.getUser() != null) {
// nf = NumberFormat.getPercentInstance(User.getUser().getUserCountryLocale());
// nf.setMaximumFractionDigits(6);
// nf.setMinimumFractionDigits(2);
// nf.setMinimumIntegerDigits(1);
// } else {
nf = NumberFormat.getPercentInstance(Locale.US);
nf.setMaximumFractionDigits(6);
nf.setMinimumFractionDigits(2);
nf.setMinimumIntegerDigits(1);
// }
return nf;
}
public static NumberFormat getShortPercentFormat() {
NumberFormat nf = null;
// if (User.getUser() != null) {
// nf = NumberFormat.getPercentInstance(User.getUser().getUserCountryLocale());
// nf.setMaximumFractionDigits(2);
// nf.setMinimumFractionDigits(2);
// nf.setMinimumIntegerDigits(1);
// } else {
nf = NumberFormat.getPercentInstance(Locale.US);
nf.setMaximumFractionDigits(2);
nf.setMinimumFractionDigits(2);
nf.setMinimumIntegerDigits(1);
// }
return nf;
}
}
| [
"rxpkd@mail.missouri.edu"
] | rxpkd@mail.missouri.edu |
5ddcf706f2222d684f53e9419d1e144a87c41a81 | e0d176e5af8cd23d8949d4198e3df17c22166113 | /png-shr-facade/src/main/java/com/vluee/png/shrfacade/domain/service/SmsChannelService.java | 9d016247da87a8cc45f6b5790f7090b86a838e7d | [] | no_license | nimysan/png-business-service-parent | 183d07f61df1885ec310b57503e16b49649c2e59 | c35d67817d020c62365d11204b231fdcbdde897f | refs/heads/master | 2022-06-22T17:36:29.205335 | 2020-03-17T12:16:19 | 2020-03-17T12:16:19 | 224,336,665 | 0 | 0 | null | 2022-06-17T02:58:00 | 2019-11-27T03:32:13 | Java | UTF-8 | Java | false | false | 236 | java | package com.vluee.png.shrfacade.domain.service;
/**
* 短信渠道接口
* @author SeanYe
*
*/
public interface SmsChannelService {
public void sendVcode(String sessionId, String[] phoneNumbers, String vcode);
}
| [
"yexw@btte.net"
] | yexw@btte.net |
919afd4f30d18401dec05d3b39ff53943595f868 | 95cfbf29ef451d5c1311e6cc34ac1e144a7cab51 | /src/practice01/Ex16.java | dfac2031dc0259a5cd377bca08791af51cad4a39 | [] | no_license | JeongYunu/review | 45dd3954c694d7c518c7c7fc26010f2b3ddc58f1 | deb2ec06e0f9f9f07be40976e9a0cd9232f2c620 | refs/heads/master | 2023-06-11T05:11:11.721848 | 2021-06-25T06:32:18 | 2021-06-25T06:32:18 | 380,146,435 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 634 | java | package practice01;
import java.util.Scanner;
public class Ex16 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("상품가격: ");
double price = sc.nextDouble();
System.out.print("받은돈: ");
double cash = sc.nextDouble();
System.out.println("=========================");
double tax = price * 0.1;
double change = cash - price;
System.out.println("받은돈: " + cash);
System.out.println("상품가격: " + price);
System.out.println("부가세: " + tax);
System.out.println("잔액: " + change);
sc.close();
}
}
| [
"oa8859@gmail.com"
] | oa8859@gmail.com |
888c83fe324645af73781ea4ded2d6bc2d519daa | ad5cd983fa810454ccbb8d834882856d7bf6faca | /modules/search-services/searchservices/src/de/hybris/platform/searchservices/admin/dao/SnIndexTypeDao.java | c6028dc4a048e8f593c67fcb32faf6837fe5366a | [] | no_license | amaljanan/my-hybris | 2ea57d1a4391c9a81c8f4fef7c8ab977b48992b8 | ef9f254682970282cf8ad6d26d75c661f95500dd | refs/heads/master | 2023-06-12T17:20:35.026159 | 2021-07-09T04:33:13 | 2021-07-09T04:33:13 | 384,177,175 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 993 | java | /*
* Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved.
*/
package de.hybris.platform.searchservices.admin.dao;
import de.hybris.platform.servicelayer.internal.dao.GenericDao;
import de.hybris.platform.searchservices.model.SnIndexConfigurationModel;
import de.hybris.platform.searchservices.model.SnIndexTypeModel;
import java.util.List;
import java.util.Optional;
/**
* The {@link SnIndexTypeModel} DAO.
*/
public interface SnIndexTypeDao extends GenericDao<SnIndexTypeModel>
{
/**
* Finds the index types for the given index configuration.
*
* @param indexConfiguration
* - the index configuration
*
* @return the index types
*/
List<SnIndexTypeModel> findIndexTypesByIndexConfiguration(final SnIndexConfigurationModel indexConfiguration);
/**
* Finds the index type for the given id.
*
* @param id
* - the id
*
* @return the index type
*/
Optional<SnIndexTypeModel> findIndexTypeById(final String id);
}
| [
"amaljanan333@gmail.com"
] | amaljanan333@gmail.com |
421913129ff4d0b838c331d450adea058eb17df4 | fa255d697d9a173b55c2c0ef76930e0a25ac067d | /src/main/java/org/cryptocoinpartners/schema/dao/OrderUpdateJpaDao.java | c8b7d81fcd48664e0db39b059c9320b81f229e7c | [
"Apache-2.0"
] | permissive | timolson/cointrader | 0eb84719b0ac6c380bcd728b6c9155923cfeb0b4 | 48d4b6cd8a6097a1c4c8773a2ec4004df2fbbfba | refs/heads/master | 2023-06-25T17:40:43.506897 | 2022-06-21T01:03:49 | 2022-06-21T01:03:49 | 20,368,549 | 443 | 168 | NOASSERTION | 2023-06-14T22:34:08 | 2014-06-01T01:14:12 | Java | UTF-8 | Java | false | false | 218 | java | package org.cryptocoinpartners.schema.dao;
public class OrderUpdateJpaDao extends DaoJpa implements OrderUpdateDao {
/**
*
*/
private static final long serialVersionUID = -3728669763925755062L;
}
| [
"douggie@melvilleclarke.com"
] | douggie@melvilleclarke.com |
63ba03058d901919b87f4c772f52766fa5bcc3f6 | 485ddb5a503adce743a12e196ff89fcb15962475 | /mini-spring/src/main/java/org/example/spring/framework/webmvc/servlet/v2/MHandlerAdapter.java | 49233e795f72742f192b6352282a9721e2bab42e | [] | no_license | cmygit/yiyi-codebase | a4e4c323b1d89063d60e7659e95d3e72bbdae08b | 972cf4ed36864720895a3b65ea61b3e299b9133f | refs/heads/master | 2023-03-03T15:14:28.670939 | 2021-02-14T08:44:26 | 2021-02-14T08:44:26 | 297,704,306 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,159 | java | package org.example.spring.framework.webmvc.servlet.v2;
import org.example.spring.framework.annotation.MRequestParam;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* @Title:
* @Author: cmy
* @Date: 2020/8/29 15:55
*/
public class MHandlerAdapter {
public MModelAndView handle(HttpServletRequest req, HttpServletResponse resp, MHandlerMapping handlerMapping) throws InvocationTargetException, IllegalAccessException {
// 1、保存带有@MRequestParam注解的参数名及其顺序
Map<String, Integer> paramIndexMapping = new HashMap<>();
Method method = handlerMapping.getMethod();
Annotation[][] pas = method.getParameterAnnotations();
for (int i = 0; i < pas.length; i++) {
for (Annotation a : pas[i]) {
if (!(a instanceof MRequestParam)) {
continue;
}
String paramName = ((MRequestParam) a).value();
if ("".equals(paramName.trim())) {
continue;
}
paramIndexMapping.put(paramName, i);
}
}
// 2、保存HttpServletRequest和HttpServletResponse的参数类型名及其顺序
Class<?>[] parameterTypes = method.getParameterTypes();
for (int i = 0; i < parameterTypes.length; i++) {
Class<?> parameterType = parameterTypes[i];
if (parameterType != HttpServletRequest.class && parameterType != HttpServletResponse.class) {
continue;
}
paramIndexMapping.put(parameterType.getName(), i);
}
// 3、给方法参数赋值
// 请求参数
Map<String, String[]> reqParams = req.getParameterMap();
// 存放方法参数值
Object[] methodParamValues = new Object[parameterTypes.length];
// 对带有@MRequestParam注解的参数赋值
for (Map.Entry<String, String[]> reqParam : reqParams.entrySet()) {
String reqParamName = reqParam.getKey();
if (!paramIndexMapping.containsKey(reqParamName)) {
continue;
}
// 请求参数值
String reqParamValue = Arrays.toString(reqParam.getValue())
.replaceAll("[\\[\\]]", "")
.replaceAll("\\s+", "");
Integer index = paramIndexMapping.get(reqParamName);
// 将请求参数值转换为String,并赋值给方法参数
methodParamValues[index] = this.castStringValue(reqParamValue, parameterTypes[index]);
}
// 对HttpServletRequest和HttpServletResponse赋值
String className = HttpServletRequest.class.getName();
if (paramIndexMapping.containsKey(className)) {
Integer index = paramIndexMapping.get(className);
methodParamValues[index] = req;
}
className = HttpServletResponse.class.getName();
if (paramIndexMapping.containsKey(className)) {
Integer index = paramIndexMapping.get(className);
methodParamValues[index] = resp;
}
// 4、调用方法
Object result = method.invoke(handlerMapping.getController(), methodParamValues);
if (result == null || result instanceof Void) {
return null;
}
if (method.getReturnType() == MModelAndView.class) {
return (MModelAndView) result;
}
return null;
}
private Object castStringValue(String value, Class<?> type) {
if (String.class == type) {
return value;
} else if (Integer.class == type) {
return Integer.valueOf(value);
} else if (Double.class == type) {
return Double.valueOf(value);
}
if (value != null) {
return value;
}
return null;
}
}
| [
"cmygit@163.com"
] | cmygit@163.com |
9c8983b20dba86b1b5f40459068cef676b342078 | 20928a2dfc38b2cd0096c01a78e955c3dcb88f7f | /plugins/plugins/net.sf.pipitrace.test/src/net/sf/pipitrace/test/TestPipiTrace.java | 6daf0e86f0c8582f61e885eb142469a26c22159b | [] | no_license | rhchen/pipitrace | a911aad7ac8c060f28cedb7275bef10a42f0d2d0 | c5466a8691df9dce23a9ffe4d92f0f47a341afc8 | refs/heads/master | 2020-06-02T04:01:43.021060 | 2012-12-02T13:56:54 | 2012-12-02T13:56:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 204 | java | package net.sf.pipitrace.test;
import net.sf.pipitrace.core.PipiTrace;
public class TestPipiTrace {
/**
* @param args
*/
public static void main(String[] args) {
PipiTrace.main(args);
}
}
| [
"ranhow.chen@gmail.com"
] | ranhow.chen@gmail.com |
0e2a6a408948fb437e7d192db211d9c967535087 | 66f717f2883de8bfb78fc2f243ae8462be546573 | /app/src/main/java/ca/udes/android_projectweather/network/ForecastClient.java | 1a57c49688d10318209a2938ed4d0f6f63c3cc52 | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | Erozbliz/android-ProjectWeather | 11c22f791cdd0b696b1bb5af1d37eaf9ba5237bb | 3966ec50823f884876bb8543edcaed6efd603575 | refs/heads/master | 2021-01-11T11:52:37.312184 | 2016-12-17T21:27:14 | 2016-12-17T21:27:14 | 76,746,716 | 0 | 0 | null | 2016-12-17T21:04:25 | 2016-12-17T21:04:25 | null | UTF-8 | Java | false | false | 11,925 | java | /*
* Copyright (C) 2016 University of Sherbrooke
*
* 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 ca.udes.android_projectweather.network;
import android.util.Log;
import android.text.TextUtils;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonParseException;
import com.google.gson.JsonDeserializationContext;
import java.util.Map;
import java.util.List;
import java.util.Date;
import java.util.HashMap;
import java.util.ArrayList;
import java.io.IOException;
import java.lang.reflect.Type;
import java.util.concurrent.TimeUnit;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
import okhttp3.CacheControl;
import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import ca.udes.android_projectweather.models.Unit;
import ca.udes.android_projectweather.models.Language;
import ca.udes.android_projectweather.utils.Constants;
import ca.udes.android_projectweather.models.ForecastResponse;
/**
* Class for interacting with Dark Sky API.
*
* @version 1.0
*/
public final class ForecastClient {
private final String TAG = getClass().getSimpleName();
@Nullable
private final Language mLanguage;
@Nullable
private final Unit mUnit;
@Nullable
private List<String> mExcludeBlocks;
private final String mApiKey;
private final String mCacheControl;
private final ForecastService mService;
private static ForecastClient mInstance;
/**
* Constructor.
*
* @param forecastConfiguration
*
* @see ForecastClient#createGson
* @see ForecastClient#createOkHttpClient
*/
private ForecastClient(ForecastConfiguration forecastConfiguration) {
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(Constants.API_BASE_URL)
.addConverterFactory(GsonConverterFactory.create(createGson()))
.client(createOkHttpClient(forecastConfiguration))
.build();
mApiKey = forecastConfiguration.getApiKey();
mLanguage = forecastConfiguration.getDefaultLanguage();
mUnit = forecastConfiguration.getDefaultUnit();
if (forecastConfiguration.getDefaultExcludeList() != null) {
Log.d(TAG, "exclude list");
mExcludeBlocks = new ArrayList<>(forecastConfiguration.getDefaultExcludeList());
}
CacheControl cacheControl =
new CacheControl.Builder().maxAge(forecastConfiguration.getCacheMaxAge(), TimeUnit.SECONDS)
.build();
mCacheControl = cacheControl.toString();
mService = retrofit.create(ForecastService.class);
}
/**
* Configure the ForecastClient.
*
* @param forecastConfiguration {@link ForecastConfiguration.Builder}
*/
public static void create(@NonNull ForecastConfiguration forecastConfiguration) {
mInstance = new ForecastClient(forecastConfiguration);
}
/**
* Accessor.
*
* @return mInstance
*/
public static ForecastClient getInstance() {
if (mInstance == null) {
throw new AssertionError("create() is missing !");
}
return mInstance;
}
/**
* Configure the http request.
*
* @return client
* @param forecastConfiguration
*
* @see ForecastConfiguration
*/
private static OkHttpClient createOkHttpClient(ForecastConfiguration forecastConfiguration) {
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
OkHttpClient client = new OkHttpClient();
client = client.newBuilder()
.addInterceptor(interceptor)
.cache(forecastConfiguration.getCache())
.connectTimeout(forecastConfiguration.getConnectionTimeout(), TimeUnit.SECONDS)
.readTimeout(forecastConfiguration.getConnectionTimeout(), TimeUnit.SECONDS)
.build();
return client;
}
/**
* Configure the gson.
*
* @return builder.create()
*/
private static Gson createGson() {
final long MILLIS = 1000;
GsonBuilder builder = new GsonBuilder();
builder.registerTypeAdapter(Date.class, new JsonDeserializer<Date>() {
public Date deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context)
throws JsonParseException {
return new Date(json.getAsJsonPrimitive().getAsLong() * MILLIS);
}
});
return builder.create();
}
/**
* Synchronous forecastResponse call.
*
* @return getForecastSync(latitude, longitude, null)
* @param latitude
* @param longitude
* @throws IOException
*
* @see ForecastResponse
*/
@SuppressWarnings("unused")
public Response<ForecastResponse> getForecastSync(double latitude, double longitude) throws IOException {
return getForecastSync(latitude, longitude, null);
}
/**
* Synchronous forecastResponse call.
*
* @return getForecastSync(latitude, longitude, null, null, null, false)
* @param latitude
* @param longitude
* @param time
* @throws IOException
*
* @see ForecastResponse
*/
public Response<ForecastResponse> getForecastSync(double latitude, double longitude, @Nullable Integer time)
throws IOException {
return getForecastSync(latitude, longitude, time, null, null, null, false);
}
/**
* Synchronous forecastResponse call.
*
* @return forecastCall.execute()
* @param latitude
* @param longitude
* @param time
* @param language
* @param unit
* @param excludeList
* @param extendHourly
* @throws IOException
*
* @see ForecastResponse
*/
public Response<ForecastResponse> getForecastSync(double latitude, double longitude, @Nullable Integer time,
@Nullable Language language, @Nullable Unit unit,
@Nullable List<String> excludeList, boolean extendHourly)
throws IOException {
Call<ForecastResponse> forecastCall = mService.getForecast(mApiKey, getLocation(latitude, longitude, time),
getQueryMapParameters(language, unit, excludeList, extendHourly), mCacheControl);
return forecastCall.execute();
}
/**
* Asynchronous forecastResponse call.
*
* @return getForecast(latitude, longitude, null, forecastCallback)
* @param latitude
* @param longitude
* @param forecastCallback
*
* @see ForecastResponse
*/
@SuppressWarnings("unused")
public Call<ForecastResponse> getForecast(double latitude, double longitude,
@NonNull Callback<ForecastResponse> forecastCallback) {
return getForecast(latitude, longitude, null, forecastCallback);
}
/**
* Asynchronous forecastResponse call.
*
* @return getForecast(latitude, longitude, null, null, null, false, forecastCallback)
* @param latitude
* @param longitude
* @param time
* @param forecastCallback
*
* @see ForecastResponse
*/
public Call<ForecastResponse> getForecast(double latitude, double longitude, @Nullable Integer time,
@NonNull Callback<ForecastResponse> forecastCallback) {
return getForecast(latitude, longitude, time, null, null, null, false, forecastCallback);
}
/**
* Asynchronous forecastResponse call.
*
* @return forecastCall
* @param latitude
* @param longitude
* @param time
* @param language
* @param unit
* @param excludeList
* @param extendHourly
* @param forecastCallback
*
* @see ForecastResponse
*/
public Call<ForecastResponse> getForecast(double latitude, double longitude, @Nullable Integer time,
@Nullable Language language, @Nullable Unit unit,
@Nullable List<String> excludeList, boolean extendHourly,
@NonNull Callback<ForecastResponse> forecastCallback) {
Call<ForecastResponse> forecastCall = mService.getForecast(mApiKey,
getLocation(latitude, longitude, time), getQueryMapParameters(language, unit, excludeList,
extendHourly), mCacheControl);
forecastCall.enqueue(forecastCallback);
return forecastCall;
}
/**
* Get the latitude and longitude for the request.
*
* @return location
* @param latitude
* @param longitude
* @param time
*/
private static String getLocation(double latitude, double longitude, @Nullable Integer time) {
String location = String.valueOf(latitude) + "," + String.valueOf(longitude);
if (time != null) {
location += "," + time.toString();
}
return location;
}
/**
* Configure queryMapParameters
*
* @return queryMap
*/
private Map<String, String> getQueryMapParameters(@Nullable Language language, @Nullable Unit unit,
@Nullable List<String> excludeBlocks, boolean extendHourly) {
Map<String, String> queryMap = new HashMap<>();
if (language != null) {
Log.d(TAG, "language");
queryMap.put(Constants.OPTIONS_LANGUAGE, language.getText());
} else if (mLanguage != null) {
Log.d(TAG, "mLanguage");
queryMap.put(Constants.OPTIONS_LANGUAGE, mLanguage.getText());
}
if (unit != null) {
Log.d(TAG, "unit");
queryMap.put(Constants.OPTIONS_UNIT, unit.getText());
} else if (mUnit != null) {
Log.d(TAG, "mUnit");
queryMap.put(Constants.OPTIONS_UNIT, mUnit.getText());
}
if (excludeBlocks != null && !excludeBlocks.isEmpty()) {
Log.d(TAG, "excludeBlocks");
String exclude = TextUtils.join(",", excludeBlocks);
Log.d(TAG, "exclude");
queryMap.put(Constants.OPTIONS_EXCLUDE, exclude);
} else if (mExcludeBlocks != null && !mExcludeBlocks.isEmpty()) {
Log.d(TAG, "mExcludeBlocks");
String exclude = TextUtils.join(",", mExcludeBlocks);
Log.d(TAG, "exclude");
queryMap.put(Constants.OPTIONS_EXCLUDE, exclude);
}
if (extendHourly) {
Log.d(TAG, "extendHourly");
queryMap.put(Constants.OPTIONS_EXTEND, Constants.OPTIONS_EXTEND_HOURLY);
}
return queryMap;
}
}
| [
"schultz.olivier83@gmail.com"
] | schultz.olivier83@gmail.com |
47a8640087aa6029583bf5798b1a7d4d6cd33c7e | 4a6f755eee87e257aa2ebab623b85c7392d217a5 | /boardEx/src/main/java/com/example/board/ServletInitializer.java | cafecba0e75705b55c6c528ce1ea898dd5e27428 | [] | no_license | hlyang7036/BoardEx | d58b03a88f93530cbb216e698e4ccd3b924f1946 | 64efab82751e6fd307e67286d7b95b2979d2ff8d | refs/heads/master | 2020-09-09T11:06:12.244964 | 2019-12-17T14:24:25 | 2019-12-17T14:24:25 | 221,430,457 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 408 | java | package com.example.board;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
public class ServletInitializer extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(BoardExApplication.class);
}
}
| [
"Hlyang7036@gmail.com"
] | Hlyang7036@gmail.com |
4967ca6ed12d7230982faf8db8b0f068bbd2fb27 | ba51fc02bf99b53f7f1893b512a272ce9eae32d8 | /server/src/reactor/ProtocolTask.java | 4c1f75ab0f21eccc856f881f5045928bf3d12803 | [] | no_license | NadavOs90/Fibage-Game | 58bd20a1585e5df9ff307a3bbee679a66309fef2 | 6f0d26ff9aee949dc9f9bcc3d26519381c408609 | refs/heads/master | 2021-04-06T06:10:51.983571 | 2018-03-15T13:50:00 | 2018-03-15T13:50:00 | 125,373,135 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,217 | java | package reactor;
import java.nio.ByteBuffer;
import java.nio.charset.CharacterCodingException;
import protocol.*;
import tokenizer.*;
/**
* This class supplies some data to the protocol, which then processes the data,
* possibly returning a reply. This class is implemented as an executor task.
*
*/
public class ProtocolTask<T> implements Runnable {
private final ServerProtocol<T> _protocol;
private final MessageTokenizer<T> _tokenizer;
private final ConnectionHandler<T> _handler;
private ProtocolCallback<T> _callback;
public ProtocolTask(final ServerProtocol<T> protocol, final MessageTokenizer<T> tokenizer, final ConnectionHandler<T> h, ProtocolCallback<T> callback) {
this._protocol = protocol;
this._tokenizer = tokenizer;
this._handler = h;
this._callback=callback;
}
// we synchronize on ourselves, in case we are executed by several threads
// from the thread pool.
public synchronized void run() {
// go over all complete messages and process them.
while (_tokenizer.hasMessage()) {
T msg = _tokenizer.nextMessage();
this._protocol.processMessage(msg, _callback);
}
}
public void addBytes(ByteBuffer b) {
_tokenizer.addBytes(b);
}
}
| [
"nadav.ostrowsky@biocatch.com"
] | nadav.ostrowsky@biocatch.com |
332266276fa24194ad5774f63f9b41f0620ca488 | 37dd58627b60e55487b190408629ea69e86a8f3b | /app/src/main/java/com/ug/eon/android/tv/prefs/SharedPrefsProviderImpl.java | 6a3a54f1881f3acb3967824f1b36250d8ed95e87 | [] | no_license | srbro/socblogstb | c57db81db9bb202b3465a563e8fc18c59646426c | 3f4a39596f4c767565939a5a34f0774a33904823 | refs/heads/master | 2020-03-18T06:28:43.061867 | 2018-05-30T10:03:53 | 2018-05-30T10:03:53 | 134,398,227 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,222 | java | package com.ug.eon.android.tv.prefs;
import android.content.Context;
import android.content.SharedPreferences;
/**
* Created by nemanja.todoric on 3/27/2018.
*/
public class SharedPrefsProviderImpl implements SharedPrefsProvider {
private static final String PREFS_NAME = "EData";
private Context context;
public SharedPrefsProviderImpl(Context c) {
context = c;
}
@Override
public String getString(String key, String defaultValue) {
SharedPreferences sharedPrefs = context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE);
return sharedPrefs.getString(key, defaultValue);
}
@Override
public void setString(String key, String value) {
SharedPreferences sharedPrefs = context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPrefs.edit();
editor.putString(key, value);
editor.apply();
}
@Override
public void remove(String key) {
SharedPreferences sharedPrefs = context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPrefs.edit();
editor.remove(key);
editor.apply();
}
}
| [
"srba.miljkovic@united.cloud"
] | srba.miljkovic@united.cloud |
4b16815afaa902efca883b22451b429eaa2fa271 | 819b37fa9d57e7805d1c110a29af4494579170c3 | /matrix-sdk/src/main/java/org/matrix/androidsdk/rest/model/sync/DeviceOneTimeKeysCountSyncResponse.java | c18f48cfca8ba7c459835313261d872a7a0796a6 | [
"Apache-2.0"
] | permissive | monkey1992/matrix-android-sdk | 4510fa0105365fb7821874917ff74babbea57621 | 3df15f668f408d36e68ea8b0210eeac32cd5a6a5 | refs/heads/master | 2021-04-27T14:01:32.109727 | 2018-02-15T15:21:43 | 2018-02-15T15:21:43 | 122,449,683 | 1 | 0 | Apache-2.0 | 2018-02-22T08:18:28 | 2018-02-22T08:18:28 | null | UTF-8 | Java | false | false | 773 | java | /*
* Copyright 2016 OpenMarket Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.matrix.androidsdk.rest.model.sync;
public class DeviceOneTimeKeysCountSyncResponse implements java.io.Serializable {
public Integer signed_curve25519;
} | [
"ylecollen@amdocs.com"
] | ylecollen@amdocs.com |
e6fbeb0ad36335f664c760cc9e7a4ea8137abadf | 28e1d561413bf91b14d098f8f7903f7cfe947d8d | /app/src/main/java/com/bme/janosvelenyak/mobillab/model/InlineResponse2004.java | dae86427664a6aadfb770a895513eeb3b3a80333 | [] | no_license | velenyak/mobilLab | c4f45b8cc88a55c5fcde71af10db311f66d570fd | 9c52540e86b342b8b662bac4a30fdc477fc42797 | refs/heads/master | 2020-03-11T23:23:08.711488 | 2018-10-08T22:07:26 | 2018-10-08T22:07:26 | 130,320,210 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,466 | java | package com.bme.janosvelenyak.mobillab.model;
import java.util.Objects;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
import com.google.gson.annotations.SerializedName;
@ApiModel(description = "")
public class InlineResponse2004 {
@SerializedName("pagination")
private InlineResponse2004Pagination pagination = null;
@SerializedName("data")
private List<InlineResponse2002Data> data = new ArrayList<InlineResponse2002Data>();
@SerializedName("meta")
private InlineResponse200Meta meta = null;
/**
**/
@ApiModelProperty(value = "")
public InlineResponse2004Pagination getPagination() {
return pagination;
}
public void setPagination(InlineResponse2004Pagination pagination) {
this.pagination = pagination;
}
/**
**/
@ApiModelProperty(value = "")
public List<InlineResponse2002Data> getData() {
return data;
}
public void setData(List<InlineResponse2002Data> data) {
this.data = data;
}
/**
**/
@ApiModelProperty(value = "")
public InlineResponse200Meta getMeta() {
return meta;
}
public void setMeta(InlineResponse200Meta meta) {
this.meta = meta;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
InlineResponse2004 inlineResponse2004 = (InlineResponse2004) o;
return Objects.equals(pagination, inlineResponse2004.pagination) &&
Objects.equals(data, inlineResponse2004.data) &&
Objects.equals(meta, inlineResponse2004.meta);
}
@Override
public int hashCode() {
return Objects.hash(pagination, data, meta);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class InlineResponse2004 {\n");
sb.append(" pagination: ").append(toIndentedString(pagination)).append("\n");
sb.append(" data: ").append(toIndentedString(data)).append("\n");
sb.append(" meta: ").append(toIndentedString(meta)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
| [
"janos.velenyak@gmail.com"
] | janos.velenyak@gmail.com |
75cd97dfefad2a3ad221394e2022dfdccd2ef31e | 937320b6feb538ab0d2a8a3f1aea74d39b8f0f79 | /vso/src/com/liquidlabs/vso/VSOMain.java | cdcf71f1f7431d8ab7c5d8bd40e0ba262a1fa1fb | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | NathenSample/Logscape | 95e476b4e29bac0defd6f028536941077f13939f | 68ed61a0c1350d3e22e341edac3aab5758fb40df | refs/heads/master | 2021-01-20T07:47:13.425980 | 2017-05-03T15:23:15 | 2017-05-03T15:23:15 | 90,045,561 | 0 | 0 | null | 2017-05-02T14:55:37 | 2017-05-02T14:55:37 | null | UTF-8 | Java | false | false | 21,647 | java | package com.liquidlabs.vso;
import java.io.*;
import java.lang.management.ManagementFactory;
import java.net.InetAddress;
import java.net.URISyntaxException;
import java.net.UnknownHostException;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Properties;
import java.util.Set;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import com.liquidlabs.common.*;
import com.liquidlabs.vso.deployment.bundle.*;
import org.apache.log4j.Logger;
import org.joda.time.DateTime;
import org.joda.time.DateTimeUtils;
import org.joda.time.format.*;
import com.liquidlabs.common.LifeCycle.State;
import com.liquidlabs.common.collection.Arrays;
import com.liquidlabs.common.file.FileUtil;
import com.liquidlabs.common.jmx.JmxHtmlServerImpl;
import com.liquidlabs.common.net.URI;
import com.liquidlabs.orm.ORMapperFactory;
import com.liquidlabs.space.VSpaceProperties;
import com.liquidlabs.transport.proxy.ProxyFactory;
import com.liquidlabs.vso.agent.ResourceAgent;
import com.liquidlabs.vso.agent.ResourceAgentImpl;
import com.liquidlabs.vso.agent.ResourceProfile;
import com.liquidlabs.vso.deployment.BundleDeploymentService;
import com.liquidlabs.vso.deployment.DeploymentService;
import com.liquidlabs.vso.deployment.bundle.Bundle.Status;
import com.liquidlabs.vso.lookup.LookupSpace;
import com.liquidlabs.vso.lookup.LookupSpaceImpl;
import com.liquidlabs.vso.resource.ResourceSpace;
import com.liquidlabs.vso.resource.ResourceSpaceImpl;
import com.liquidlabs.vso.work.WorkAllocator;
import com.liquidlabs.vso.work.WorkAllocatorImpl;
import com.liquidlabs.vso.work.WorkAssignment;
public class VSOMain {
static final Logger LOGGER = Logger.getLogger(VSOMain.class);
static Logging auditLogger = Logging.getAuditLogger("VAuditLogger", "VSOMain");
// -boot 8080 or stcp://lookuphost:8080
public static void main(String[] args) throws NumberFormatException, Exception {
try {
auditLogger.emit("boot", new Date().toString());
cleanupTmpDir();
writeToStatus("VSOMain ENTRY");
writeToStatus("PID:" + ManagementFactory.getRuntimeMXBean().getName());
writeToStatus("OperatingSystem:" + System.getProperty("os.name").toUpperCase() + " / " + System.getProperty("os.version"));
writeToStatus("VSOMain starting...:" + Arrays.toString(args));
printPropertiesToStdout();
String resourceType = VSOProperties.getResourceType();
boolean bootManagement = resourceType.contains("Management");
int port = VSOProperties.getLookupPort();
if (args.length == 0) {
writeToStatus("FATAL: Cannot run with NoArgs. Run logscape.[bat/sh]");
return;
}
URI lookupAddress = new URI(args[0]);
int profiles = 1;
writeToStatus("VSOMain boot Type:" + resourceType + " host:" + NetworkUtils.getIPAddress());
while (NetworkUtils.getIPAddress() == null) {
writeToStatus("Waiting for Nic:" + NetworkUtils.useNWIF);
Thread.sleep(30 * 1000);
}
if (bootManagement) {
writeToStatus("\r\n\r\n STARTING *MANAGER* 6 profiles\r\n\r\n");
profiles = 6;
writeToStatus("Wait 30 seconds for the DASHBOARD on PORT:" + System.getProperty("web.app.port"));
} else if (VSOProperties.isFailoverNode()) {
bootManagement = true;
writeToStatus("\r\n\r\n STARTING AGENT Role:" + VSOProperties.getResourceType() + " 6 profiles\r\n\r\n");
profiles = 6;
// LOGGER.warn("Removing:" + VSpaceProperties.baseSpaceDir());
// FileUtil.deleteDir(new File(VSpaceProperties.baseSpaceDir()));
if (lookupAddress.toString().contains("localhost")){
writeToStatus("\r\n\r\n WARNING - AGENT has ManagementHost as 'stcp://localhost' - this Agent will fail unless on the same host!\r\n ** After editing setup.conf ensure you run configure(.sh/bat) **");
}
} else {
writeToStatus("\r\n\r\n STARTING AGENT Role:" + VSOProperties.getResourceType() + " 1 profile\r\n\r\n");
profiles = 1;
if (lookupAddress.toString().contains("localhost")){
writeToStatus("\r\n\r\n WARNING - AGENT has ManagementHost as 'stcp://localhost' - this Agent will fail unless on the same host!\r\n ** After editing setup.conf ensure you run configure(.sh/bat) **");
}
}
writeToStatus("VSOMain lookup:" + lookupAddress + " PORT:" + port);
String host = lookupAddress.getHost();
if (host == null) {
System.err.println("The Management URL is not valid[" + lookupAddress + "]");
writeToStatus("The Given ManagementURL is not valid[" + lookupAddress + "]");
System.exit(-1);
}
resolveHost(host);
// setup so the client network connections can be resolved when SO_ADDR REUSE DOESNT WORK
Log4JLevelChanger.apply(args);
ProxyFactory proxyFactory = getProxyFactory(VSOProperties.getAgentBasePort());
listenForShutdown();
auditLogger.emit("bootAgent", VSOProperties.getResourceType());
if(bootManagement) {
boot(lookupAddress.toString(), proxyFactory, profiles);
} else {
agent(lookupAddress.toString(), profiles, proxyFactory);
}
} catch (Throwable t) {
System.out.println("Failed:" + t);
t.printStackTrace();
writeToStatus("FAILED:" + t);
// this was introduced because everynow and then we see a JVM running with a non-daemon thread being created
// it happens randomly. Being non-daemon VSOMain hangs...
Thread.sleep(10 * 1000);
writeToStatus("Calling System.exit():" + t);
System.exit(0);
} finally {
writeToStatus("STOPPED");
}
}
public static ResourceAgentImpl startAgent(String lookupAddress, int profiles, ProxyFactory proxyFactory) throws URISyntaxException, InterruptedException, UnknownHostException {
writeToStatus("Agent: Starting AGENT Type:" + VSOProperties.getResourceType() );
LookupSpace lookupSpace = null;
// when the system is bounced we prefer services to start on the Management host
if (VSOProperties.isFailoverNode()) {
Thread.sleep(2 * 1000);
}
writeToStatus("BOOT SEQUENCE WAIT");
String context = "_HA_VSOAgent";
String failoverAddress = getFailoverAddress();
if (getManagerAddress() != null) lookupAddress = getManagerAddress();
boolean started = false;
while (!started) {
LOGGER.info("Agent: boot sequence - wait for Management@" + lookupAddress);
boolean connected = false;
int count = 0;
/**
* Get Valid handle to LUSpace
*/
Integer waitForFailoverCount = Integer.getInteger("failover.wait.count", 10);
while (!connected) {
writeToStatus("Connection Attempt:" + count + " WaitForFailoverCount:" + waitForFailoverCount);
String ping = null;
try {
lookupSpace = LookupSpaceImpl.getLookRemoteSimple(lookupAddress, proxyFactory, context);
ping = lookupSpace.ping(VSOProperties.getResourceType(), System.currentTimeMillis());
connected = true;
System.err.println("Result of pinging Management Node:" + ping);
LOGGER.info("Agent: ping:" + ping);
} catch (Throwable t) {
Thread.sleep(5000);
if (count++ > waitForFailoverCount && failoverAddress != null) {
System.err.println("Failover:" + count);
writeToStatus("Attempting Failover Lookup.ping @" + failoverAddress);
lookupSpace = LookupSpaceImpl.getLookRemoteSimple(failoverAddress, proxyFactory, context);
ping = lookupSpace.ping(VSOProperties.getResourceType(), System.currentTimeMillis());
// success - flip to using the failover node
LOGGER.warn("**** USING FAILOVER NODE **** Booting from" + failoverAddress + " ping time:" + ping);
writeToStatus("Connected To failover:" + failoverAddress);
connected = true;
//lookupAddress = failoverAddress;
}
}
try {
Thread.sleep(Integer.getInteger("boot.pause.secs", 10) * 1000);
if (count++ % 10 == 0 && count > 0) {
writeToStatus("Waiting to connect to Management@" + lookupAddress);
Thread.sleep(Integer.getInteger("vsomain.pause.secs", 30) * 1000);
}
} catch (Throwable e) {
}
}
writeToStatus("BOOT SEQUENCE START");
LOGGER.info("Agent: boot - init network services");
if (failoverAddress != null) {
lookupAddress = lookupAddress + "," + failoverAddress;
}
try {
NetworkUtils.resetValues();
WorkAllocator workAllocator = WorkAllocatorImpl.getRemoteService("StartAgent", lookupSpace, proxyFactory);
ResourceSpace resourceSpace = ResourceSpaceImpl.getRemoteService("StartAgent", lookupSpace, proxyFactory);
DeploymentService bundleDeploymentService = BundleDeploymentService.getRemoteService("StartAgent", lookupSpace, proxyFactory);
JmxHtmlServerImpl jmxHtmlServer = new JmxHtmlServerImpl(VSOProperties.getJMXPort(VSOProperties.ports.SHARED), true);
jmxHtmlServer.start();
final ResourceAgentImpl agent = new ResourceAgentImpl(workAllocator, resourceSpace, bundleDeploymentService, lookupSpace, proxyFactory, lookupAddress, jmxHtmlServer.getURL(), profiles);
proxyFactory.registerMethodReceiver(ResourceAgent.NAME, agent);
agent.start();
LOGGER.info("Agent: started");
writeToStatus("BOOT SEQUENCE COMPLETE");
writeToStatus("BOOT SEQUENCE RUNNING");
Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() {
writeToStatus("STOPPED");
System.out.println("Agent shutdown hook called");
agent.stop();
}
});
started = true;
return agent;
} catch (Throwable t) {
writeToStatus("REBOOT");
LOGGER.info("Agent: Revert to boot again - Failed to startAgent:" + t.getMessage(), t);
Thread.sleep(1000);
}
}
writeToStatus("FAILED");
// should never happen
System.exit(-10);
return null;
}
private static void boot(String lookupAddress, ProxyFactory proxyFactory, int profiles) throws UnknownHostException, URISyntaxException, InterruptedException {
auditLogger.emit("bootManagement", new Date().toString());
writeToStatus("BOOT SEQUENCE INIT");
JmxHtmlServerImpl jmxHtmlServer = new JmxHtmlServerImpl(VSOProperties.getJMXPort(VSOProperties.ports.LOOKUP), true);
jmxHtmlServer.start();
if (getManagerAddress() != null) lookupAddress = getManagerAddress();
String failoverAddress = getFailoverAddress();
if (failoverAddress != null) lookupAddress += "," + failoverAddress;
LOGGER.info("BOOT Start - Creating BOOT Agent, Address:" + lookupAddress);
agent = new ResourceAgentImpl(lookupAddress, proxyFactory, jmxHtmlServer.getURL(), profiles);
agent.setBuildInfo();
agent.setStatus(LifeCycle.State.STARTED);
LOGGER.info("BOOT Start - Loading Boot bundle:" + bundleName());
proxyFactory.registerMethodReceiver(ResourceAgent.NAME, agent);
Bundle bootBundle = new BundleSerializer(new File(VSOProperties.getDownloadsDir())).loadBundle(bundleName());
List<Service> services = bootBundle.getServices();
List<WorkAssignment> assignments = new ArrayList<WorkAssignment>();
LOGGER.info("BOOT Start - [BootSequence]");
for (Service service : services) {
final WorkAssignment workAssignment = WorkAssignment.fromService(service, agent.getId());
workAssignment.setWorkingDirectory(".");
assignments.add(workAssignment);
try {
LOGGER.info("[BootSequence] Starting:" + workAssignment.getId());
auditLogger.emit("startWork", workAssignment.getId());
agent.start(workAssignment);
} catch (Throwable t) {
LOGGER.error(t);
}
if (workAssignment.getId().contains("Lookup")) {
Thread.sleep(1000);
}
}
writeToStatus("BOOT SEQUENCE COMPLETE");
LOGGER.info("BOOT Finished - [BootSequence] core services running");
LookupSpace lookupSpace = LookupSpaceImpl.getRemoteService(lookupAddress, proxyFactory,"VSOMainLU");
WorkAllocator workAllocator = WorkAllocatorImpl.getRemoteService("VSOMainWA", lookupSpace, proxyFactory);
ResourceSpace resourceSpace = ResourceSpaceImpl.getRemoteService("VSOMainRS", lookupSpace, proxyFactory);
DeploymentService deploymentService = BundleDeploymentService.getRemoteService("StartAgent", lookupSpace, proxyFactory);
registerBootAllocationCounts(proxyFactory, agent, bootBundle, assignments, lookupSpace, workAllocator, resourceSpace, agent.getId());
writeToStatus("BOOT RUNNING");
writeToStatus("AGENT STARTING");
agent.booted(lookupSpace, workAllocator, resourceSpace, deploymentService);
writeToStatus("AGENT STARTED");
writeToStatus("DEPLOY OTHERS");
auditLogger.emit("startWork", "Others[]");
LOGGER.info("BOOT Starting Other Bundles (replicator, logscape, dashboard, etc");
deploymentService.deployAllBundles();
scheduleFileCopyOfSysBundles(proxyFactory);
agent.go();
}
private static void scheduleFileCopyOfSysBundles(ProxyFactory proxyFactory) {
final String[] files = new String[] { "boot.zip", "replicator-1.0.zip", "vs-log-1.0.zip","lib-1.0.zip" };
ScheduledExecutorService scheduler = proxyFactory.getScheduler();
scheduler.scheduleAtFixedRate(new Runnable() {
public void run() {
int count = 0;
for (String file : files) {
try {
File dest = new File(VSOProperties.getWebAppRootDir() + "/bundles/" + file);
// dont do the copy if the files exists and we have been running for a bit and the file is old...
if (dest.exists() && count++ > 100) {
if (dest.lastModified() < new DateTime().minusMinutes(10).getMillis()) return;
}
dest.getParentFile().mkdirs();
FileUtil.copyFile(new File("downloads/" + file), dest);
} catch (Throwable t) {
LOGGER.warn(new File(".").getAbsolutePath() + " App.zip CopyFailed", t);
}
}
}
}, 10, 10, TimeUnit.MINUTES);
}
private static String bundleName() {
return VSOProperties.isHaEnabled() ? "boot-forked-1.0.bundle" : "boot-1.0.bundle";
}
private static void registerBootAllocationCounts(ProxyFactory proxyFactory, final ResourceAgent resourceAgent, Bundle bootBundle,
List<WorkAssignment> assignments, LookupSpace lookupSpace, WorkAllocator workAllocator, ResourceSpace resourceSpace, String resourceId) throws URISyntaxException {
BundleSpace bundleSpace = BundleSpaceImpl.getRemoteService("VSOMainB", lookupSpace, proxyFactory);
try {
String hostname = NetworkUtils.getHostname();
String id = "BOOT_REQUEST" + hostname +"-";
bootBundle.setStatus(Status.ACTIVE);
BundleHandlerImpl bundleHandler = new BundleHandlerImpl(bundleSpace);
bundleHandler.install(bootBundle);
ResourceProfile resourceProfile = resourceAgent.getProfiles().get(0);
for (WorkAssignment workAssignment : assignments) {
workAssignment.setStatus(State.RUNNING);
workAssignment.decrementAllocationsOutstanding();
workAllocator.saveWorkAssignment(workAssignment, resourceProfile.getResourceId());
bundleSpace.requestServiceStart(id + workAssignment.getServiceName(), workAssignment);
}
resourceSpace.assignResources(id + "_X", java.util.Arrays.asList(resourceId), "BOOT_LOOKUP" + hostname, 1000, "LookupSpace", -1);
} catch (Exception e) {
LOGGER.error(e);
}
}
private static boolean checkUsage(String[] args) {
if ((args.length == 3 && !args[0].equals("-boot"))
|| (args.length == 2 && args[0].equals("-boot")
|| args.length <= 1) ) {
usage();
}
return "-boot".equals(args[0]);
}
private static void cleanupTmpDir() {
String property = System.getProperty("java.io.tmpdir");
if (new File(property).getAbsolutePath().contains("logscape")) {
writeToStatus("Cleaning java.io.tmpdir:" + property);
File file = new File(property);
deleteDir(file);
file.mkdirs();
} }
static DateTimeFormatter formatter = ISODateTimeFormat.dateTime();
private static void writeToStatus(String string) {
try {
String statusMsg = formatter.print(DateTimeUtils.currentTimeMillis()) + " " + string;
System.out.println(statusMsg);
FileOutputStream fos = new FileOutputStream("status.txt", true);
fos.write((statusMsg + "\n").getBytes());
LOGGER.info(statusMsg);
fos.close();
} catch (Exception e) {
LOGGER.error(e);
}
}
static void resolveHost(String endPoint) {
try {
URI uri = new URI(endPoint);
InetAddress.getAllByName(uri.getHost());
} catch (Throwable t) {
writeToStatus("FAILED TO RESOLVE Host:" + endPoint);
throw new RuntimeException("Failed to resolveHost:" + endPoint, t);
}
}
private static void printPropertiesToStdout() {
Properties properties = System.getProperties();
Set<Object> keySet2 = properties.keySet();
List<String> keySet = new ArrayList<String>();
for (Object object : keySet2) {
if (object instanceof String) keySet.add((String) object);
}
Collections.sort(keySet);
for (Object object : keySet) {
System.out.println(object + " - " + properties.getProperty(object.toString()).toString());
}
}
// yes its a bit crappy but we need to listen for shutdown
static ResourceAgentImpl agent = null;
private static void agent(String lookup, int profiles, ProxyFactory proxyFactory) throws UnknownHostException, URISyntaxException, InterruptedException {
agent = startAgent(lookup, profiles, proxyFactory);
agent.go();
}
private static ProxyFactory getProxyFactory(int bootPort) throws UnknownHostException, URISyntaxException{
ORMapperFactory mapperFactory = LookupSpaceImpl.getSharedMapperFactory();
return mapperFactory.getProxyFactory();
}
private static void listenForShutdown() {
Thread t = new Thread(new Runnable(){
public void run() {
try {
System.out.println("Use 'bye' or 'exit' to stop the agent");
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
while(true) {
try {
String readLine = reader.readLine();
if (readLine != null && ("exit".equals(readLine.toLowerCase()) || "bye".equals(readLine.toLowerCase()))) {
writeToStatus("STOPPED");
System.err.println(" VSOMain....terminating VSO due to exit msg from hook");
LOGGER.info("\r\n\r\n\r\n******************* TERMINATING VSO DUE TO EXIT MESSAGE FROM BOOTSTRAPPER");
if (agent != null) agent.stop();
LOGGER.info("\r\n\r\n\r\n******************* sysexit");
System.exit(0);
}
} catch (IOException e) {
Thread.sleep(50);
}
}
} catch (Exception ex) {
LOGGER.error("ProcessHook error", ex);
}
}});
t.setName("VSO-stdin-ShutdownListener");
t.setDaemon(true);
t.start();
}
private static void usage() {
System.err.println("com.liquidlabs.vso.VSOMain [-boot] stcp://lookup.host:port numProfiles");
System.exit(1);
}
public static int deleteDir(File dir) {
int count = 0;
int failed = 0;
LOGGER.debug("Delete:" + dir);
if (dir != null && dir.exists()) {
File[] files = dir.listFiles();
if (files!= null) {
for (File file : files) {
if (file.isDirectory()) {
LOGGER.debug(count + " DeleteDir => " + file.getName());
count += FileUtil.deleteDir(file);
}
else {
boolean delete = file.delete();
if (delete) {
LOGGER.debug(count + " DeleteFile:" + file.getName());
count++;
} else {
LOGGER.debug(count + " DeleteFile:" + file.getName() + " LOCKED");
failed++;
}
}
}
}
count++;
LOGGER.debug(count+ " DeleteDIR:" + dir);
dir.delete();
}
if (failed != 0) {
LOGGER.debug("Failed!: " + failed);
return failed * -1;
}
return count;
}
public static String getManagerAddress() {
return getAddress("manager.address");
}
public static String getFailoverAddress() {
return getAddress("failover.address");
}
public static String getAddress(String property) {
// now try the failover address if there is one on the file system
File file = new File("downloads/connection.properties");
if (file.exists()) {
try {
Properties props = new Properties();
FileInputStream fis = new FileInputStream(file);
props.load(fis);
fis.close();
return props.getProperty(property);
} catch (Throwable e) {
LOGGER.info(e.toString());
}
}
return null;
}
}
| [
"support@logscape.com"
] | support@logscape.com |
ab2ea35691c1eda5c18419772d71bcefbcc96c72 | 102e79004dbb498a2ab1611facf23a78e969adfc | /common/src/main/java/com/cainiao/common/network/support/CniaoUtils.java | 454ae0e58a27b6dce4f04bf863147c3892ee1304 | [] | no_license | AdamRight/JetpackCNApp | f69aa48d22ace071f137edb4c5f8bc0c54dc6d5c | 70f00cf815d484b87ba03d0e45b8668dec141527 | refs/heads/master | 2023-04-02T22:49:47.316032 | 2021-04-02T13:57:38 | 2021-04-02T13:57:38 | 352,040,879 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,058 | java | package com.cainiao.common.network.support;
import androidx.annotation.Nullable;
import com.blankj.utilcode.util.EncryptUtils;
import java.util.Objects;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static com.cainiao.common.network.config.CniaoConfigKt.NET_CONFIG_APP_KEY;
/**
*
*/
public class CniaoUtils {
private CniaoUtils() {
}
/**
* 中文转 unicode
*
* @param string
* @return
*/
public static String unicodeEncode(String string) {
char[] utfBytes = string.toCharArray();
StringBuilder unicodeBytes = new StringBuilder();
for (char utfByte : utfBytes) {
String hexB = Integer.toHexString(utfByte);
if (hexB.length() <= 2) {
hexB = "00" + hexB;
}
unicodeBytes.append("\\u").append(hexB);
}
return unicodeBytes.toString();
}
/**
* unicode 转中文
* @param string
* @return
*/
static Pattern pattern = Pattern.compile("(\\\\u(\\p{XDigit}{4}))");
public static String unicodeDecode(String string) {
Matcher matcher = pattern.matcher(string);
char ch;
while (matcher.find()) {
ch = (char) Integer.parseInt(Objects.requireNonNull(matcher.group(2)), 16);
string = string.replace(Objects.requireNonNull(matcher.group(1)), ch + "");
}
return string;
}
/**
* 解析返回的data数据
*
* @param dataStr 未解密的响应数据
* @return 解密后的数据String
*/
@Nullable
public static String decodeData(@Nullable String dataStr) {
//java代码,无自动null判断,需要自行处理
if (dataStr != null) {
return new String(EncryptUtils.decryptBase64AES(
dataStr.getBytes(), NET_CONFIG_APP_KEY.getBytes(),
"AES/CBC/PKCS7Padding",
"J#y9sJesv*5HmqLq".getBytes()
));
} else {
return null;
}
}
}
| [
"36788619+AdamRight@users.noreply.github.com"
] | 36788619+AdamRight@users.noreply.github.com |
cb1ca35789475dc8e37544b4688229a072892316 | b90dd05f7bf1e39a114398dd2d8352100e6e31c5 | /src/test/java/com/ludo/paymybuddy/service/BankAccountServiceTest.java | 342191a6067c784a545ef816fefe9fe0d88e60fb | [] | no_license | Ludo76190/PayMyBuddy | ee01e5fcdf4e90e20d48c3f3c3d5f51371fce711 | 0e9bfadd2a80546e093320b602c7f240ea08292a | refs/heads/master | 2023-06-17T19:26:00.474488 | 2021-07-15T12:58:08 | 2021-07-15T12:58:08 | 384,039,673 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,358 | java | package com.ludo.paymybuddy.service;
import com.ludo.paymybuddy.model.BankAccount;
import com.ludo.paymybuddy.model.User;
import com.ludo.paymybuddy.repository.BankAccountRepository;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.springframework.boot.test.context.SpringBootTest;
import java.util.ArrayList;
import java.util.List;
import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.mockito.Mockito.any;
import static org.mockito.Mockito.when;
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@SpringBootTest
public class BankAccountServiceTest {
@InjectMocks
BankAccountServiceImpl bankAccountService;
@Mock
BankAccountRepository bankAccountRepository;
@Mock
UserService userService;
BankAccount bankAccount1 = new BankAccount();
BankAccount bankAccount2 = new BankAccount();
List<BankAccount> listBankAccount = new ArrayList<>();
User user1 = new User();
User user2 = new User();
@BeforeAll
public void setUp() {
user1.setFirstname("Allegaert");
user1.setLastname("Ludovic");
user1.setEmail("allegaertl@gmail.com");
user1.setPassword("azerty");
user2.setFirstname("Le Pallec");
user2.setLastname("Audrey");
user2.setEmail("alpaudrey@gmail.com");
user2.setPassword("qsdfgh");
bankAccount1.setUser(user1);
bankAccount1.setRib("fr76123456789");
bankAccount2.setUser(user2);
bankAccount2.setRib("fr76987654321");
listBankAccount.add(bankAccount1);
listBankAccount.add(bankAccount2);
}
@Test
void testSaveBankAccount() {
when(userService.getCurrentUser()).thenReturn(user1);
when(bankAccountRepository.save(any(BankAccount.class))).thenReturn(bankAccount1);
BankAccount saveBankAccount = bankAccountService.saveBankAccount(bankAccount1.getRib());
assertThat(saveBankAccount).isEqualTo(bankAccount1);
}
@Test
void testGetAllUserBankAccountById() {
List<BankAccount> bankAccount = bankAccountService.getAllUserBankAccountById(1);
assertNotNull(bankAccount);
}
}
| [
"allegaertl@gmail.com"
] | allegaertl@gmail.com |
22e1f262bcb89a6aa8cc94b22eac6695efac6f74 | 1a60e0cde166b7872b0ccd7e972b0ab1943a4a97 | /target/generated/src/main/java/org/kuali/rice/kim/v2_0/EntityEthnicityType.java | d39aa3099ab87a68b82024e2d75e43b1a3f67c73 | [] | no_license | hiteshtara/simpleDocumentActionsService-client | 6daacbdbd62d581a1283db38e2e292c3cd38bbff | 8714354d2ff3e375eb73cb0daf3437427ca6d82e | refs/heads/master | 2021-09-11T00:12:01.488214 | 2018-04-04T19:39:52 | 2018-04-04T19:39:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,647 | java |
package org.kuali.rice.kim.v2_0;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlType;
import org.w3c.dom.Element;
/**
* <p>Java class for EntityEthnicityType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="EntityEthnicityType">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="id" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="entityId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="ethnicityCode" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="ethnicityCodeUnmasked" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="subEthnicityCode" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="subEthnicityCodeUnmasked" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="suppressPersonal" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
* <element name="versionNumber" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/>
* <element name="objectId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <any processContents='skip' namespace='##other' maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "EntityEthnicityType", propOrder = {
"id",
"entityId",
"ethnicityCode",
"ethnicityCodeUnmasked",
"subEthnicityCode",
"subEthnicityCodeUnmasked",
"suppressPersonal",
"versionNumber",
"objectId",
"any"
})
public class EntityEthnicityType {
protected String id;
protected String entityId;
protected String ethnicityCode;
protected String ethnicityCodeUnmasked;
protected String subEthnicityCode;
protected String subEthnicityCodeUnmasked;
protected boolean suppressPersonal;
protected Long versionNumber;
protected String objectId;
@XmlAnyElement
protected List<Element> any;
/**
* Gets the value of the id property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getId() {
return id;
}
/**
* Sets the value of the id property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setId(String value) {
this.id = value;
}
/**
* Gets the value of the entityId property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getEntityId() {
return entityId;
}
/**
* Sets the value of the entityId property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setEntityId(String value) {
this.entityId = value;
}
/**
* Gets the value of the ethnicityCode property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getEthnicityCode() {
return ethnicityCode;
}
/**
* Sets the value of the ethnicityCode property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setEthnicityCode(String value) {
this.ethnicityCode = value;
}
/**
* Gets the value of the ethnicityCodeUnmasked property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getEthnicityCodeUnmasked() {
return ethnicityCodeUnmasked;
}
/**
* Sets the value of the ethnicityCodeUnmasked property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setEthnicityCodeUnmasked(String value) {
this.ethnicityCodeUnmasked = value;
}
/**
* Gets the value of the subEthnicityCode property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSubEthnicityCode() {
return subEthnicityCode;
}
/**
* Sets the value of the subEthnicityCode property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSubEthnicityCode(String value) {
this.subEthnicityCode = value;
}
/**
* Gets the value of the subEthnicityCodeUnmasked property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSubEthnicityCodeUnmasked() {
return subEthnicityCodeUnmasked;
}
/**
* Sets the value of the subEthnicityCodeUnmasked property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSubEthnicityCodeUnmasked(String value) {
this.subEthnicityCodeUnmasked = value;
}
/**
* Gets the value of the suppressPersonal property.
*
*/
public boolean isSuppressPersonal() {
return suppressPersonal;
}
/**
* Sets the value of the suppressPersonal property.
*
*/
public void setSuppressPersonal(boolean value) {
this.suppressPersonal = value;
}
/**
* Gets the value of the versionNumber property.
*
* @return
* possible object is
* {@link Long }
*
*/
public Long getVersionNumber() {
return versionNumber;
}
/**
* Sets the value of the versionNumber property.
*
* @param value
* allowed object is
* {@link Long }
*
*/
public void setVersionNumber(Long value) {
this.versionNumber = value;
}
/**
* Gets the value of the objectId property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getObjectId() {
return objectId;
}
/**
* Sets the value of the objectId property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setObjectId(String value) {
this.objectId = value;
}
/**
* Gets the value of the any property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the any property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getAny().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Element }
*
*
*/
public List<Element> getAny() {
if (any == null) {
any = new ArrayList<Element>();
}
return this.any;
}
}
| [
"mukadder@bu.edu"
] | mukadder@bu.edu |
b1c1dbfc3d1a60b8efd36d4d86287f35903270ef | 7c5431b270398e0781db1b7172eb587bccf2130e | /lab8/BankApp/src/main/java/cs545/bank/beans/ListAccountController.java | ab8f7db00718550d7cac5e976d2bac3111a9d512 | [] | no_license | TruongDung/WAA | 92f2f32030a2715a43fd2ab17ce31fddaf4d6473 | 7896187f4f8a53eb6e2acae786accd0581c46272 | refs/heads/master | 2020-03-18T18:39:48.295091 | 2018-06-20T00:13:53 | 2018-06-20T00:13:53 | 135,107,301 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 746 | java | package cs545.bank.beans;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.enterprise.context.ConversationScoped;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.inject.Named;
import cs545.bank.domain.Account;
@Named
@RequestScoped
public class ListAccountController implements Serializable{
private static final long serialVersionUID = 1L;
@Inject
private CacheManagerBean cacheManagerBean;
// @Inject
// DetailAccountController detailAccountController;
public List<Account> getAllAccounts() {
// detailAccountController.setAccountNumber(10);
System.out.println("test123");
return new ArrayList<>(cacheManagerBean.getAllAccounts());
}
}
| [
"truongdung0502@hotmail.com"
] | truongdung0502@hotmail.com |
22576ce61fa3d4043874c476e27aafd09319bdb6 | b8779dbb8a654ca8323a2987086b31744377bbc6 | /com/afrisoftech/hospayroll/TaxableIncomeintfr.java | fe30111de5e1ef4c593e3de41ca737aebdae1e59 | [] | no_license | cwaweru/FunsoftSIMS | ff89fa6ef57c7019d2b8db7b10466de3347749cb | f88c434aafa3b35951d0389ef21255cc73998c7e | refs/heads/master | 2021-01-10T12:44:35.348625 | 2015-10-11T05:45:43 | 2015-10-11T05:45:43 | 44,040,338 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 17,294 | java | /*
* deptintfr.java
*
* Created on August 13, 2002, 12:59 AM
*/
package com.afrisoftech.hospayroll;
/**
*
* @author root
*/
public class TaxableIncomeintfr extends javax.swing.JInternalFrame {
/** Creates new form deptintfr */
java.sql.Connection connectDB = null;
org.netbeans.lib.sql.pool.PooledConnectionSource pConnDB = null;
public TaxableIncomeintfr(java.sql.Connection connDb, org.netbeans.lib.sql.pool.PooledConnectionSource pconnDB) {
connectDB = connDb;
pConnDB = pconnDB;
initComponents();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
private void initComponents() {//GEN-BEGIN:initComponents
java.awt.GridBagConstraints gridBagConstraints;
try {
nBCachedRowSet1 = new org.netbeans.lib.sql.NBCachedRowSet();
} catch (java.sql.SQLException e1) {
e1.printStackTrace();
}
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jButton4 = new javax.swing.JButton();
jSeparator1 = new javax.swing.JSeparator();
jLabel3 = new javax.swing.JLabel();
jPanel1 = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
jLabel1 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jComboBox1 = new javax.swing.JComboBox();
datePicker1 = new com.afrisoftech.lib.DatePicker();
jButton5 = new javax.swing.JButton();
nBCachedRowSet1.setCommand("SELECT tax_type from tax_setup order by tax_type");
nBCachedRowSet1.setConnectionSource(pConnDB);
getContentPane().setLayout(new java.awt.GridBagLayout());
setClosable(true);
setIconifiable(true);
setTitle("Tax Brackets");
setDefaultCloseOperation(javax.swing.WindowConstants.HIDE_ON_CLOSE);
setFrameIcon(new javax.swing.ImageIcon(getClass().getResource("/ColorPreview.gif")));
setVisible(true);
jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/check.gif")));
jButton1.setMnemonic('O');
jButton1.setText("Ok");
jButton1.setToolTipText("Click here to enter data");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jButton1MouseClicked(evt);
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 8;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
getContentPane().add(jButton1, gridBagConstraints);
jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/note[1].gif")));
jButton2.setMnemonic('E');
jButton2.setText("Edit");
jButton2.setToolTipText("Click here to edit data");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jButton2.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jButton2MouseClicked(evt);
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 8;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
getContentPane().add(jButton2, gridBagConstraints);
jButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/BD14755_.GIF")));
jButton3.setMnemonic('C');
jButton3.setText("Close");
jButton3.setToolTipText("Clikck here to close window");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
jButton3.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jButton3MouseClicked(evt);
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 4;
gridBagConstraints.gridy = 8;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
getContentPane().add(jButton3, gridBagConstraints);
jButton4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/minusarm.gif")));
jButton4.setMnemonic('l');
jButton4.setText("Clear");
jButton4.setToolTipText("Clik here to clear fields");
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
}
});
jButton4.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jButton4MouseClicked(evt);
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 3;
gridBagConstraints.gridy = 8;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
getContentPane().add(jButton4, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 5;
gridBagConstraints.gridwidth = 5;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.weightx = 1.0;
getContentPane().add(jSeparator1, gridBagConstraints);
jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 6;
gridBagConstraints.gridwidth = 4;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.weightx = 1.0;
getContentPane().add(jLabel3, gridBagConstraints);
jPanel1.setLayout(new java.awt.GridBagLayout());
jPanel1.setBorder(new javax.swing.border.TitledBorder("Tax Table for Annual Income"));
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"Lower Limit", "Upper Limit", "Charge", "Rate(%)"
}
));
jScrollPane1.setViewportView(jTable1);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
jPanel1.add(jScrollPane1, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 2;
gridBagConstraints.gridwidth = 5;
gridBagConstraints.gridheight = 3;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 10.0;
gridBagConstraints.insets = new java.awt.Insets(10, 10, 10, 10);
getContentPane().add(jPanel1, gridBagConstraints);
jLabel1.setText("Effective from");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 0;
getContentPane().add(jLabel1, gridBagConstraints);
jLabel4.setText("Paye,Nssf etc.");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
getContentPane().add(jLabel4, gridBagConstraints);
jComboBox1.setModel(new org.netbeans.lib.sql.models.ComboBoxModel (nBCachedRowSet1, "tax_type", null, null, null));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 0;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
getContentPane().add(jComboBox1, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 3;
gridBagConstraints.gridy = 0;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 20);
getContentPane().add(datePicker1, gridBagConstraints);
jButton5.setMnemonic('R');
jButton5.setText("RemoveRow");
jButton5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt);
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 8;
gridBagConstraints.weightx = 1.0;
getContentPane().add(jButton5, gridBagConstraints);
setBounds(0, 0, 800, 350);
}//GEN-END:initComponents
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
int rows2Delete = jTable1.getSelectedRowCount();
int[] selectedRows = jTable1.getSelectedRows();
if (rows2Delete < 1) {
java.awt.Toolkit.getDefaultToolkit().beep();
javax.swing.JOptionPane.showMessageDialog(this, "There are no selected rows to delete!");
} else {
if (rows2Delete > 1) {
for (int i = 0; i < selectedRows.length; i++) {
javax.swing.table.DefaultTableModel defTableModel = (javax.swing.table.DefaultTableModel)jTable1.getModel();
defTableModel.removeRow(selectedRows[i]);
}
} else {
javax.swing.table.DefaultTableModel defTableModel = (javax.swing.table.DefaultTableModel)jTable1.getModel();
defTableModel.removeRow(jTable1.getSelectedRow());
}
} // Add your handling code here:
}//GEN-LAST:event_jButton5ActionPerformed
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
java.util.Calendar calendar = java.util.Calendar.getInstance();
long dateNow = calendar.getTimeInMillis();
java.sql.Date datenowSql= new java.sql.Date(dateNow);
System.out.println(datenowSql.toString());
// java.lang.Object name = "false";
try {
connectDB.setAutoCommit(false);
java.sql.PreparedStatement pstmt = connectDB.prepareStatement("insert into tax_bracket values(?,?,?,?,?,?)");
for (int i = 0; i < jTable1.getRowCount(); i++){
if (jTable1.getModel().getValueAt(i,0) != null){
pstmt.setObject(3,jTable1.getValueAt(i,0).toString());
pstmt.setObject(4,jTable1.getValueAt(i,1).toString());
pstmt.setObject(5,jTable1.getValueAt(i,2).toString());
pstmt.setObject(6,jTable1.getValueAt(i,3).toString());
// pstmt.setObject(5,jTable1.getValueAt(i,4).toString());
pstmt.setString(2,datePicker1.getDate().toString());
// pstmt.setDate(7, datenowSql);
pstmt.setObject(1,jComboBox1.getSelectedItem().toString());
/* if (jTable1.getModel().getValueAt(i,3) == null){
pstmt.setBoolean(5,false);
}else{
pstmt.setObject(5,jTable1.getValueAt(i,3).toString());
}
*/
pstmt.executeUpdate();
}
}
connectDB.commit();
connectDB.setAutoCommit(true);
this.getContentPane().removeAll();
this.initComponents();
jLabel3.setForeground(java.awt.Color.blue);
jLabel3.setText("Insert successful");
} catch(java.sql.SQLException sq){
javax.swing.JOptionPane.showMessageDialog(this, sq.getMessage(),"Error Message!",javax.swing.JOptionPane.ERROR_MESSAGE);
try {
connectDB.rollback();
}catch (java.sql.SQLException sql){
javax.swing.JOptionPane.showMessageDialog(this,sql.getMessage(),"Error Message!",javax.swing.JOptionPane.ERROR_MESSAGE);
}
jLabel3.setForeground(java.awt.Color.red);
jLabel3.setText("Sorry.insert not successful");
}// Add your handling code here:
}//GEN-LAST:event_jButton1ActionPerformed
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
javax.swing.JFrame dep = new TaxBracket(connectDB,pConnDB, jComboBox1.getSelectedItem().toString());
dep.setVisible(true); // Add your handling code here:
}//GEN-LAST:event_jButton2ActionPerformed
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
this.getContentPane().removeAll();
this.initComponents();// Add your handling code here:
}//GEN-LAST:event_jButton4ActionPerformed
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
setVisible(false); // Add your handling code here:
}//GEN-LAST:event_jButton3ActionPerformed
private void jButton2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton2MouseClicked
// Add your handling code here:
}//GEN-LAST:event_jButton2MouseClicked
private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton1MouseClicked
// Add your handling code here:
}//GEN-LAST:event_jButton1MouseClicked
private void jButton4MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton4MouseClicked
// Add your handling code here:
}//GEN-LAST:event_jButton4MouseClicked
private void jButton3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton3MouseClicked
// Add your handling code here:
}//GEN-LAST:event_jButton3MouseClicked
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel4;
private javax.swing.JButton jButton2;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel3;
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton5;
private javax.swing.JSeparator jSeparator1;
private javax.swing.JPanel jPanel1;
private javax.swing.JButton jButton4;
private org.netbeans.lib.sql.NBCachedRowSet nBCachedRowSet1;
private com.afrisoftech.lib.DatePicker datePicker1;
private javax.swing.JComboBox jComboBox1;
private javax.swing.JTable jTable1;
// End of variables declaration//GEN-END:variables
}
| [
"Charles@Funsoft.mshome.net"
] | Charles@Funsoft.mshome.net |
ecc5462fd0a44f2dcbe910a1c8795132ec7734a4 | a3c9b4e3c95a40166b958d01746af853ab7e1c5c | /app/src/main/java/com/example/anik/tripmate/TwoFragmentForEvent.java | 28a53f5cdebfa2c992d349e569d3581a2db94765 | [] | no_license | Anik-Roy/TripMate | 95ce41aecf074828ee894c960d241bf12d591fc7 | bd3c0da87295cf2adc5e6b91d0f0b3eb3e30acd9 | refs/heads/master | 2020-04-07T12:01:54.861539 | 2018-11-20T08:00:09 | 2018-11-20T08:00:09 | 158,351,668 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,640 | java | package com.example.anik.tripmate;
import android.app.ProgressDialog;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
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.ValueEventListener;
import com.google.firebase.storage.FirebaseStorage;
import com.google.firebase.storage.StorageReference;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
/**
* Created by anik on 2/6/18.
*/
public class TwoFragmentForEvent extends Fragment {
FirebaseAuth auth;
FirebaseStorage storage;
StorageReference storageReference;
private DatabaseReference newStudent;
FirebaseUser mCurrentUser;
String userId = "", userEmail = "";
RecyclerView recyclerView;
private eventAdapter adapter;
List<eventAlbum> eventList = new ArrayList<>();
Map<String, String> map = new HashMap<>();
int cnt = 0;
ProgressDialog progressDialog;
public TwoFragmentForEvent() {
// Required empty public constructor
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
auth = FirebaseAuth.getInstance();
storage = FirebaseStorage.getInstance();
storageReference = storage.getReference();
mCurrentUser = auth.getCurrentUser();
//Toast.makeText(getContext(), mCurrentUser.getEmail(), Toast.LENGTH_LONG).show();
FirebaseAuth auth = FirebaseAuth.getInstance();
FirebaseAuth.AuthStateListener authListener = new FirebaseAuth.AuthStateListener() {
@Override
public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
FirebaseUser firebaseUser = firebaseAuth.getCurrentUser();
if (firebaseUser != null) {
userId = firebaseUser.getUid();
userEmail = firebaseUser.getEmail();
} else {
Log.i("Email", "No User");
}
}
};
newStudent = FirebaseDatabase.getInstance().getReference().child("event");
View view = inflater.inflate(R.layout.fragment_two_my_event, container, false);
setHasOptionsMenu(true);
recyclerView = (RecyclerView) view.findViewById(R.id.recycler_view);
adapter = new eventAdapter(getActivity(), eventList);
RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getContext());
recyclerView.setLayoutManager(mLayoutManager);
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setNestedScrollingEnabled(false);
recyclerView.setAdapter(adapter);
progressDialog = new ProgressDialog(getContext());
progressDialog.show();
progressDialog.setTitle("Please wait!");
progressDialog.setMessage("Loading...");
progressDialog.setCancelable(false);
//getActivity().getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE,
// WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
newStudent.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot snapshot) {
if (snapshot.child(mCurrentUser.getUid()).exists()) {
final DatabaseReference tempRef = newStudent.child(mCurrentUser.getUid());
final String eventRoot = mCurrentUser.getUid();
ValueEventListener valueEventListener = tempRef.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
eventList.clear();
adapter.notifyDataSetChanged();
for(DataSnapshot data: dataSnapshot.getChildren()) {
String place = data.getKey();
String from = "", to = "", going = "";
Uri uri = null;
EventInfo eventInfo = data.getValue(EventInfo.class);
from = eventInfo.getFrom();
to = eventInfo.getTo();
uri = Uri.parse(eventInfo.getImage());
String toDate[] = to.split("\\.");
//System.out.println(toDate.length);
int dateValue = Integer.parseInt(toDate[0]);
int monthValue = Integer.parseInt(toDate[1]);
int yearValue = Integer.parseInt(toDate[2]);
Calendar c = Calendar.getInstance();
int curYear = c.get(Calendar.YEAR);
int curMonth = c.get(Calendar.MONTH)+1;
int curDate = c.get(Calendar.DATE);
boolean over = false;
if(curYear >= yearValue) {
if(curYear > yearValue) {
over = true;
}
else {
if(curMonth >= monthValue) {
if(curMonth > monthValue) {
over = true;
}
else {
if(curDate > dateValue) {
over = true;
}
}
}
}
}
if(over) {
continue;
}
Iterator it = eventInfo.getGoing().entrySet().iterator();
cnt = 0;
while (it.hasNext()) {
Map.Entry pair = (Map.Entry)it.next();
cnt++;
}
eventAlbum event = new eventAlbum(uri, place, from, to, eventRoot, String.valueOf(cnt));
eventList.add(event);
adapter.notifyDataSetChanged();
}
progressDialog.dismiss();
//getActivity().getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
}
@Override
public void onCancelled(DatabaseError databaseError) {
Log.w("photolink", "onCancelled", databaseError.toException());
progressDialog.dismiss();
//getActivity().getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
}
});
}
else {
progressDialog.dismiss();
//Toast.makeText(getContext(), "aaa", Toast.LENGTH_SHORT).show();
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
Log.i("Error", "Database Error");
progressDialog.dismiss();
}
});
return view;
}
}
| [
"argourab96@gmail.com"
] | argourab96@gmail.com |
5ec495bc24375a0422dc1a3bc3b21b0d15545f04 | 0586c701f1a4abf0d0bbcd61812a2ee714aa38f1 | /src/main/java/com/uoh/domain/vstp/Tiploc.java | 7c1893c751fed537ad88cc6a393dace10ff9e3b2 | [] | no_license | james-millner/networkrailsys-gather-app | aeffe7c3640e3f7ab42ded1d716a60758aa88b5e | a73e5ae5fd56e729e5da972610f124fe33bc8e78 | refs/heads/master | 2021-01-20T08:24:07.925638 | 2017-04-05T13:56:27 | 2017-04-05T13:56:27 | 86,441,712 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 440 | java | package com.uoh.domain.vstp;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.*;
/**
* com.uoh.domain.vstp.Tiploc Class will...
* Created by James Millner on 05/12/2016 at 20:31.
*/
@Embeddable
@Getter
@Setter
@Data
@Table(name = "vstp_tiploc")
public class Tiploc {
@JsonProperty(value = "tiploc_id")
private String tiploc_id;
}
| [
"u1257434@unimail.hud.ac.uk"
] | u1257434@unimail.hud.ac.uk |
4ad6eaa2c992c5f2c4c974de13d32a6b61566256 | fc6d79de52d65f3296aa972073264302b9d78b5f | /app/src/main/java/com/example/curso/guilhermeproject/Main2Activity.java | fa3fa4eacad3d008695715408d113efdf4672428 | [] | no_license | GuilhermeVieiraMendes/GuilhermeProject | 75e0f6e838336308376d809c76ab4f9c0f210e04 | 9241c2b6b0fa48bec9bb3c9c85e3beef8bfe5a5d | refs/heads/master | 2020-03-28T13:29:59.116610 | 2018-09-12T01:01:19 | 2018-09-12T01:01:19 | 148,400,204 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,011 | java | package com.example.curso.guilhermeproject;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
public class Main2Activity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
}
}
| [
"curso@nli.univale.br"
] | curso@nli.univale.br |
86ebdf39c7d2a64c9c73138ee5c4f74257e14966 | 61a1546844fc58017f70f92d251f2a8e7ade16fe | /src/main/java/com/yyn/controller/ELController.java | 20fbef691ad1524fda3e9b9eb88394314c356e5a | [] | no_license | minelabwot/Sensor | 771a88f4196efa1c8a9b7760bb663d83558ff03c | d1c4c9410dba6b0321e321aa6540a000ff3609dc | refs/heads/master | 2020-06-26T04:42:32.368690 | 2017-07-13T02:06:20 | 2017-07-13T02:06:20 | 97,000,651 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,118 | java | package com.yyn.controller;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Properties;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import com.yyn.model.Device;
import com.yyn.service.DeviceService;
import edu.bupt.linkSystemApplication.Application;
@Controller
@RequestMapping("/EL*")
public class ELController {
@Autowired
DeviceService ds;
@RequestMapping("/ELrun.do")
public String runEL(HttpServletRequest request,String id,String deviceType,Model model) {
String elroot = request.getSession().getServletContext().getRealPath("/WEB-INF/ELApp/");
System.out.println(elroot);
if(Application.INSTANCE.runApp(elroot)) {
Properties info = new Properties();
try {
info.load(new FileInputStream(elroot+"el_info.properties"));
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
int table_id = Integer.parseInt(info.getProperty("table_id"))+1;
System.out.println("新的table_id为"+table_id);
info.setProperty("table_id", ""+table_id);
try {
info.store(new FileOutputStream(elroot+"el_info.properties"),"");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
model.addAttribute("id", id);
model.addAttribute("deviceType", deviceType);
Device device = ds.getLink(id);
//向neo4j中添加
ds.addLink2Neo_instance(device);
//向tdb中添加
// Dataset dataset = (Dataset)request.getSession().getServletContext().getAttribute("dataset");
// ds.addELResult(id, dataset, device);
System.out.println(device.getCompany());
device = ds.getColumnLink(device.getTable_id());
ds.addLink2Neo_column(device);
return "forward:/deviceDetail.do";
}
}
| [
"1569806081@qq.com"
] | 1569806081@qq.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.