blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
sequencelengths
1
1
author_id
stringlengths
0
313
bcdbe175d7ca6b026d290b9ef3a9cc7c1476399c
e9e4f1e5fd16a7e673fc8fd64009f0e910e60542
/src/main/java/br/com/marktplace/domain/entity/BaseEntity.java
fceecf7516141216ccbcb186785eebf4b337ced1
[]
no_license
ltavares27/marketplace
49d10fe302f7fbcc4146b85489d7eae229add631
5a830e21dde7245910b1b5e34480b84ff40a14f2
refs/heads/main
2023-06-25T23:54:23.085439
2021-07-20T02:16:28
2021-07-20T02:16:28
387,620,824
0
0
null
null
null
null
UTF-8
Java
false
false
342
java
package br.com.marktplace.domain.entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.MappedSuperclass; @MappedSuperclass public abstract class BaseEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; }
17045f6ac7c145bb3b29d5058baa10f92ff4c834
928515be7b655c8a7a9df9fcd8d5de77b942d93e
/src/tinkerbell/mashup/batch/UserListBatch.java
e0d34c4eda6cb3275c5399b6d8ffa6f9ee67eda5
[]
no_license
WKD622/tinkerbell-twitter-mashup
bda8de5ebeee6bf971d801e23ab922aff9433d37
88cce8b5c9b7a615aed464337ca95ba508702709
refs/heads/master
2020-03-09T02:02:54.867013
2018-04-07T13:30:25
2018-04-07T13:30:25
128,531,056
0
1
null
null
null
null
UTF-8
Java
false
false
970
java
package tinkerbell.mashup.batch; import org.apache.spark.api.java.JavaRDD; import org.joda.time.DateTime; import com.datastax.spark.connector.japi.CassandraRow; public class UserListBatch extends Batch { @Override public void run(JavaRDD<CassandraRow> rdd) { JavaRDD<UserListRow> dd = rdd .map(row -> new UserListRow(row.getDateTime("t_ts"), row.getString("t_user"))); save(dd, "userlist_minute", UserListRow.class); save(dd, "userlist_hour", UserListRow.class); save(dd, "userlist_day", UserListRow.class); save(dd, "userlist_month", UserListRow.class); } public static void main(String[] args) { DateTime from = DateTime.now(); Batch batch = new UserListBatch(); while(!Thread.interrupted()) { if(from.plusMinutes(1).compareTo(DateTime.now()) > 0) { try { Thread.sleep(100); } catch (InterruptedException e) { return; } continue; } from = from.plusMinutes(1); batch.run(from); } } }
9991d26b6d0b079ab71d4f23da661570c41df283
9f5b333bec318ab75020ff65cc136153425011c1
/Java/Interpreter/OperadorY.java
aeb67c6a7ee1aaa92b6846a95f95f6afa9e02381
[]
no_license
MrDanielG/Design-Patterns
e1f3cf6b691d90fc3ccd33bc1289598036b42877
414c2c8001d2d2d5bc022659df72437fb8b4e81f
refs/heads/master
2022-11-08T06:21:15.470280
2020-06-20T12:41:08
2020-06-20T12:41:08
273,779,683
0
0
null
null
null
null
UTF-8
Java
false
false
895
java
public class OperadorY extends OperadorBinario { public OperadorY(Expresion operandoIzquierdo, Expresion operandoDerecho) { super(operandoIzquierdo, operandoDerecho); } @Override public boolean evalua(String descripcion) { return operandoIzquierdo.evalua(descripcion) && operandoDerecho.evalua(descripcion); } // parte analisis sintactico public static Expresion parsea() throws Exception { Expresion resultadoIzquierdo, resultadoDerecho; resultadoIzquierdo = Expresion.parsea(); while ((pieza != null) && (pieza.equals("y"))) { siguientePieza(); resultadoDerecho = Expresion.parsea(); resultadoIzquierdo = new OperadorY(resultadoIzquierdo, resultadoDerecho); } return resultadoIzquierdo; } }
0fe769e40f61dd0596f630af2ea443c06a8a5115
20a680a06e012b35c7ecb30a456b5c1c430a167f
/src/test/java/com/cybertek/tests/day1_selenium_intro/SeleniumTest.java
eb2bc7b5b3d2fe8c23b9e4f866e1f8ababa48920
[]
no_license
aliasici/seleniumprojectb20
9a8bc6a1e228ab00e515c7a8395b6622278e8231
4af2332ce8fd49a681e93e687438a977d247d6a4
refs/heads/master
2023-01-19T08:39:09.557478
2020-11-19T07:21:36
2020-11-19T07:21:36
289,728,231
0
0
null
null
null
null
UTF-8
Java
false
false
411
java
package com.cybertek.tests.day1_selenium_intro; import io.github.bonigarcia.wdm.WebDriverManager; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class SeleniumTest { public static void main(String[] args) { WebDriverManager.chromedriver().setup(); WebDriver driver = new ChromeDriver(); driver.get("https://www.facebook.com"); } }
394ef42d217a39c57513967d440644bbfa3ad370
20eb62855cb3962c2d36fda4377dfd47d82eb777
/IntroClassJava/dataset/smallest/f2997e14a460c6df0ed10aa9f6e792666e37d5c06a9a81445f14509e4a0113f59f5589ef37774dfea1f7d0ae9bb6c388e6eeb44e745e35f8511bbd4b82709d9a/000/mutations/310/smallest_f2997e14_000.java
54ac9c5076b6da9bd4ad7ead97cdc4b53d47dedb
[]
no_license
ozzydong/CapGen
356746618848065cce4e253e5d3c381baa85044a
0ba0321b6b1191443276021f1997833342f02515
refs/heads/master
2023-03-18T20:12:02.923428
2020-08-21T03:08:28
2020-08-21T03:08:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,412
java
package introclassJava; class IntObj { public int value; public IntObj () { } public IntObj (int i) { value = i; } } class FloatObj { public float value; public FloatObj () { } public FloatObj (float i) { value = i; } } class LongObj { public long value; public LongObj () { } public LongObj (long i) { value = i; } } class DoubleObj { public double value; public DoubleObj () { } public DoubleObj (double i) { value = i; } } class CharObj { public char value; public CharObj () { } public CharObj (char i) { value = i; } } public class smallest_f2997e14_000 { public java.util.Scanner scanner; public String output = ""; public static void main (String[]args) throws Exception { smallest_f2997e14_000 mainClass = new smallest_f2997e14_000 (); String output; if (args.length > 0) { mainClass.scanner = new java.util.Scanner (args[0]); } else { mainClass.scanner = new java.util.Scanner (System.in); } mainClass.exec (); System.out.println (mainClass.output); } public void exec () throws Exception { IntObj num1 = new IntObj (), num2 = new IntObj (), num3 = new IntObj (), num4 = new IntObj (); output += (String.format ("Please enter 4 numbers separated by spaces > ")); num1.value = scanner.nextInt (); num2.value = scanner.nextInt (); num3.value = scanner.nextInt (); num4.value = scanner.nextInt (); if (num1.value < num2.value && true && num1.value < num4.value) { output += (String.format ("%d is the smallest\n", num1.value)); } else if (num2.value < num1.value && num2.value < num3.value && num2.value < num4.value) { output += (String.format ("%d is the smallest\n", num2.value)); } else if (num3.value < num1.value && num3.value < num2.value && num3.value < num4.value) { output += (String.format ("%d is the smallest\n", num3.value)); } else if (num4.value < num1.value && num4.value < num2.value && num4.value < num3.value) { output += (String.format ("%d is the smallest\n", num4.value)); } if (true) return;; } }
70be079f31cfec89913df4db9a594e2358b64dff
ffc345e5c5f19febd0ed98d42be78b1abb832cf4
/sitestats/sitestats-impl/src/test/org/sakaiproject/sitestats/test/mocks/FakeAliasService.java
01fc17b28b8a66f9c04fef4c00976b60ef655b2a
[ "ECL-2.0" ]
permissive
unixcrh/Fudan-Sakai
50c89d41ee447f99d6347b14197ba701f6131a5f
924b4c0b702ada7eba4e0efb8db99cb99ed47dce
refs/heads/master
2020-12-24T17:54:54.747919
2012-04-13T14:53:40
2012-04-13T14:53:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,437
java
/** * $URL: https://source.sakaiproject.org/svn/sitestats/tags/sitestats-2.2.2/sitestats-impl/src/test/org/sakaiproject/sitestats/test/mocks/FakeAliasService.java $ * $Id: FakeAliasService.java 72172 2009-09-23 00:48:53Z [email protected] $ * * Copyright (c) 2006-2009 The Sakai Foundation * * Licensed under the Educational Community 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.osedu.org/licenses/ECL-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.sakaiproject.sitestats.test.mocks; import java.util.Collection; import java.util.List; import java.util.Map; import java.util.Set; import java.util.Stack; import org.sakaiproject.alias.api.AliasEdit; import org.sakaiproject.alias.api.AliasService; import org.sakaiproject.entity.api.Entity; import org.sakaiproject.entity.api.HttpAccess; import org.sakaiproject.entity.api.Reference; import org.sakaiproject.entity.api.ResourceProperties; import org.sakaiproject.exception.IdInvalidException; import org.sakaiproject.exception.IdUnusedException; import org.sakaiproject.exception.IdUsedException; import org.sakaiproject.exception.InUseException; import org.sakaiproject.exception.PermissionException; import org.w3c.dom.Document; import org.w3c.dom.Element; public class FakeAliasService implements AliasService { public AliasEdit add(String arg0) throws IdInvalidException, IdUsedException, PermissionException { // TODO Auto-generated method stub return null; } public String aliasReference(String arg0) { // TODO Auto-generated method stub return null; } public boolean allowAdd() { // TODO Auto-generated method stub return false; } public boolean allowEdit(String arg0) { // TODO Auto-generated method stub return false; } public boolean allowRemoveAlias(String arg0) { // TODO Auto-generated method stub return false; } public boolean allowRemoveTargetAliases(String arg0) { // TODO Auto-generated method stub return false; } public boolean allowSetAlias(String arg0, String arg1) { // TODO Auto-generated method stub return false; } public void cancel(AliasEdit arg0) { // TODO Auto-generated method stub } public void commit(AliasEdit arg0) { // TODO Auto-generated method stub } public int countAliases() { // TODO Auto-generated method stub return 0; } public int countSearchAliases(String arg0) { // TODO Auto-generated method stub return 0; } public AliasEdit edit(String arg0) throws IdUnusedException, PermissionException, InUseException { // TODO Auto-generated method stub return null; } public List getAliases(String arg0) { // TODO Auto-generated method stub return null; } public List getAliases(int arg0, int arg1) { // TODO Auto-generated method stub return null; } public List getAliases(String arg0, int arg1, int arg2) { // TODO Auto-generated method stub return null; } public String getTarget(String alias) throws IdUnusedException { final String aliasSuffix = "-alias"; if(alias.endsWith(aliasSuffix)) { return "/site/" + alias.substring(0, alias.indexOf(aliasSuffix)); } return null; } public void remove(AliasEdit arg0) throws PermissionException { // TODO Auto-generated method stub } public void removeAlias(String arg0) throws IdUnusedException, PermissionException, InUseException { // TODO Auto-generated method stub } public void removeTargetAliases(String arg0) throws PermissionException { // TODO Auto-generated method stub } public List searchAliases(String arg0, int arg1, int arg2) { // TODO Auto-generated method stub return null; } public void setAlias(String arg0, String arg1) throws IdUsedException, IdInvalidException, PermissionException { // TODO Auto-generated method stub } public String archive(String arg0, Document arg1, Stack arg2, String arg3, List arg4) { // TODO Auto-generated method stub return null; } public Entity getEntity(Reference arg0) { // TODO Auto-generated method stub return null; } public Collection getEntityAuthzGroups(Reference arg0, String arg1) { // TODO Auto-generated method stub return null; } public String getEntityDescription(Reference arg0) { // TODO Auto-generated method stub return null; } public ResourceProperties getEntityResourceProperties(Reference arg0) { // TODO Auto-generated method stub return null; } public String getEntityUrl(Reference arg0) { // TODO Auto-generated method stub return null; } public HttpAccess getHttpAccess() { // TODO Auto-generated method stub return null; } public String getLabel() { // TODO Auto-generated method stub return null; } public String merge(String arg0, Element arg1, String arg2, String arg3, Map arg4, Map arg5, Set arg6) { // TODO Auto-generated method stub return null; } public boolean parseEntityReference(String arg0, Reference arg1) { // TODO Auto-generated method stub return false; } public boolean willArchiveMerge() { // TODO Auto-generated method stub return false; } }
ac27fb3a068827e08fe3191f17ddba2f39f558c5
7310fe7022614c2cbe5a94847340d5548377194a
/dome-v3/VideoGame.java
9f2be6be7983ccd77804226f509ac7eea563fd1d
[ "Apache-2.0" ]
permissive
phantommelon/IP-Practical-19-01-15
79410fa1d5b9e839c4a21157cd120307b4a4fd26
95589c81a5342c102599053ee8c2fdd4265cf5e7
refs/heads/master
2016-09-01T22:37:24.505479
2015-01-26T23:27:03
2015-01-26T23:27:03
29,603,446
0
0
null
null
null
null
UTF-8
Java
false
false
631
java
/** * Write a description of class VideoGame here. * * @author (your name) * @version (a version number or a date) */ public class VideoGame extends Item { // instance variables - replace the example below with your own private int ageRating; /** * Constructor for objects of class VideoGame */ public VideoGame(String title, int time, int ageRating) { super(title, time); this.ageRating = ageRating; } /** * Prints the VideoGame's details. */ public void print() { super.print(); System.out.println("age rating: " + ageRating); } }
23b8942ba1a5b1ef8df76d42d41ed47e57bf06a3
45b69922c945420f326013b3371b766130c0bd81
/OopProject/src/ordercontents/OrderItem.java
324b77abb52f81a9d9d8a9ec6f641b9ab40cb9b4
[]
no_license
Powerofthesun/Object-Oriented-Logistics
a6abe04da7ba6cba3919bcbcfeb3f9939d251a1b
878f67e547926088b48e764bba35fc563786cb76
refs/heads/master
2021-01-18T22:32:25.348080
2016-11-02T00:14:51
2016-11-02T00:14:51
72,587,666
0
0
null
null
null
null
UTF-8
Java
false
false
140
java
package ordercontents; public interface OrderItem { public String getId(); public int getQuantity(); public String toString(); }
89a7928f978352c4cfcc44d48050299f2827756d
d0270e2d2361f1e2f5608da5e43781eb94bbf7df
/src/main/java/io.pivotal.pal.tracker/EnvController.java
c1877f7b768ad19774d732d98a29f15fd919f31e
[]
no_license
sihekuang/pal-tracker-1
763ec9db8f79ca657c74c85d5b8e7a40851c7a50
66d7949be5e6035710fd2a472bcc7149cc287136
refs/heads/master
2020-04-04T08:16:28.106342
2018-10-31T20:55:53
2018-10-31T20:55:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,261
java
package io.pivotal.pal.tracker; import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; import java.util.HashMap; import java.util.Map; @RestController public class EnvController { private String port; private String memorylimit; private String cfinstindex; private String cfinsaddr; public EnvController( @Value("${PORT:NOT SET}") String port, @Value("${MEMORY_LIMIT:NOT SET}") String memorylimit, @Value("${CF_INSTANCE_INDEX:NOT SET}") String cfinstindex, @Value("${CF_INSTANCE_ADDR:NOT SET}") String cfinsaddr ) { this.port= port; this.memorylimit = memorylimit; this.cfinstindex = cfinstindex; this.cfinsaddr = cfinsaddr; } @GetMapping("/env") public Map<String, String> getEnv() { Map<String, String> envMap = new HashMap<>(); envMap.put("PORT", port); envMap.put("MEMORY_LIMIT", memorylimit); envMap.put("CF_INSTANCE_INDEX", cfinstindex); envMap.put("CF_INSTANCE_ADDR", cfinsaddr); return envMap; } }
516fafedbbfc48fe42a81788453d09ecbbe77bcb
4fdb077f0edc4f15ab8aaf5ca32c64c99f963520
/src/main/java/pack1/Cmain.java
c308aed861f7b41c785e62eeab609cc29dfc8a4d
[]
no_license
acerbic808/Project_learn2
b973a86b6a77c24124e96dff5a99751244e9755c
b26d8e59bbde051607c82d48d14bd5d5b39ca89d
refs/heads/master
2023-02-20T00:11:00.243663
2021-01-17T01:44:22
2021-01-17T01:44:22
330,147,113
0
0
null
null
null
null
UTF-8
Java
false
false
431
java
package pack1; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class Cmain { public static void main(String[] args) { // TODO Auto-generated method stub classA a=new classA(); classB b=new classB(); a=new classB(); a.display(); classB t=(classB)new classA(); classA m=new classB(); WebDriver driver=new ChromeDriver(); driver.manage().deleteAllCookies(); } }
[ "“[email protected]”" ]
659a8efc9cedf5e8da8665847abefe4ac3be4b24
03396fd01219915f55adebcd577ec01201305966
/src/main/java/me/kjs/mall/member/exception/join/AlreadyExistEmailException.java
73a4c15647f6946edbb30393e1f813d13a36da91
[]
no_license
JsKim4/shopping_mall
23ee7286a3983e5bdcc32699bab1aa8d045c1bb7
2836f77118cfe89a35b607884001632e82f10655
refs/heads/master
2023-02-25T05:07:33.334387
2021-01-31T08:05:38
2021-01-31T08:05:38
334,603,475
2
1
null
null
null
null
UTF-8
Java
false
false
329
java
package me.kjs.mall.member.exception.join; import me.kjs.mall.common.exception.BadRequestException; import me.kjs.mall.common.exception.ExceptionStatus; public class AlreadyExistEmailException extends BadRequestException { public AlreadyExistEmailException() { super(ExceptionStatus.ALREADY_EXIST_EMAIL); } }
d5e0b89bcebbc539d39f7cae8dcebd3460231103
e5f7d978cacac228be983bdd2bda1d1eac242924
/src/main/java/com/github/bogdan/model/Status.java
01f7ffc438418fc2acc7117d43fc72ee9e134ebd
[]
no_license
BogdanPronin/suppeople
3ddc0011a80cc69ee054c9da28730d633cf2fffe
4479d7f72d9af504756b7be2f8c24b4e2017a602
refs/heads/master
2023-03-04T22:29:21.367101
2021-02-09T12:24:41
2021-02-09T12:24:41
288,355,219
0
0
null
null
null
null
UTF-8
Java
false
false
102
java
package com.github.bogdan.model; public enum Status { PROCESSING, CREATED, COMPLETED; }
424f45d8b567ac5201da872528ab560a081aebf1
f287d5f4ef8cf134b7c95755b68c347f33779376
/app/src/main/java/com/example/findjobs/NTD/NTDXemChiPhi.java
1d3357d27e78be1a29def5480d77f86bc63dcfb5
[]
no_license
dothiyenlinh/LTAndroid-FindJobs
869c72004ee198ab5dae067fa669ed9b31356fce
75c62c843da03994698fc235a1a801f91b46f667
refs/heads/master
2022-11-23T13:13:53.541236
2020-07-30T09:29:34
2020-07-30T09:29:34
282,641,869
0
0
null
null
null
null
UTF-8
Java
false
false
380
java
package com.example.findjobs.NTD; import android.os.Bundle; import androidx.appcompat.app.AppCompatActivity; import com.example.findjobs.R; public class NTDXemChiPhi extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_ntdxem_chi_phi); } }
b33d1a22a0841045add5dc1a3404f9a0ad3d8886
3911e06dec3e78ec428e1fd3ed1a20269944c6b1
/universal-application-tool-0.0.1/app/services/Path.java
fe5d107ed59229c6afb86bfc0b7ff5b7dfc79ed7
[ "CC0-1.0", "Apache-2.0" ]
permissive
ScotttP/civiform
8d4de7ab9d70593ea19efc8ab86bde7139018e75
ac46a60ce42356028410cff42dbcada1c38b86d0
refs/heads/main
2023-03-23T21:04:07.469115
2021-03-13T20:09:52
2021-03-13T20:09:52
347,517,843
1
0
Apache-2.0
2021-03-14T01:26:09
2021-03-14T01:26:08
null
UTF-8
Java
false
false
3,342
java
package services; import com.google.auto.value.AutoValue; import com.google.auto.value.extension.memoized.Memoized; import com.google.common.base.Joiner; import com.google.common.base.Splitter; import com.google.common.collect.ImmutableList; import java.util.ArrayList; /** * Represents a path into the applicant JSON data. Stored as the path to data without the JsonPath * prefix: $. */ @AutoValue public abstract class Path { private static final char JSON_PATH_DIVIDER = '.'; private static final String JSON_PATH_START = "$" + JSON_PATH_DIVIDER; private static final Splitter JSON_SPLITTER = Splitter.on(JSON_PATH_DIVIDER); private static final Joiner JSON_JOINER = Joiner.on(JSON_PATH_DIVIDER); public static Path empty() { return create(ImmutableList.of()); } public static Path create(String path) { path = path.trim(); if (path.startsWith(JSON_PATH_START)) { path = path.substring(JSON_PATH_START.length()); } if (path.isEmpty()) { return empty(); } return create(ImmutableList.copyOf(JSON_SPLITTER.splitToList(path))); } private static Path create(ImmutableList<String> pathSegments) { return new AutoValue_Path(pathSegments); } /** * The list of path segments. A path {@code applicant.favorites.color} would return ["applicant", * "favorites", "color"]. */ public abstract ImmutableList<String> segments(); /** A single path in JSON notation, without the $. JsonPath prefix. */ @Memoized public String path() { return JSON_JOINER.join(segments()); } /** * The {@link Path} of the parent. For example, a path {@code applicant.favorites.color} would * return {@code applicant.favorites}. */ @Memoized public Path parentPath() { if (segments().isEmpty()) { return Path.empty(); } return Path.create(segments().subList(0, segments().size() - 1)); } /** * The last segment in this path. For example, a path {@code applicant.favorites.color} would * return "color". */ @Memoized public String keyName() { if (segments().isEmpty()) { return ""; } return segments().get(segments().size() - 1); } /** * List of JSON annotation paths for each segment of the parent path. For example, a Path of * personality.favorites.color.blue would return [personality, personality.favorites, * personality.favorites.color]. */ @Memoized public ImmutableList<Path> parentPaths() { ArrayList<Path> parentPaths = new ArrayList<>(); Path currentPath = parentPath(); while (!currentPath.path().isEmpty()) { parentPaths.add(0, currentPath); currentPath = currentPath.parentPath(); } return ImmutableList.copyOf(parentPaths); } public abstract Builder toBuilder(); public static Builder builder() { return new AutoValue_Path.Builder(); } @AutoValue.Builder public abstract static class Builder { abstract Builder setSegments(ImmutableList<String> segments); public abstract ImmutableList.Builder<String> segmentsBuilder(); public abstract Path build(); public Builder setPath(String path) { return setSegments(ImmutableList.copyOf(JSON_SPLITTER.splitToList(path))); } public Builder append(String segment) { segmentsBuilder().add(segment.trim()); return this; } } }
ca951d7b054a2154fecaa7dcbd2999e3bd3e4b96
0d3255c6877868222f99eb847350d0f71f263f87
/Pi-dev-bibliotheque2.0-master/src/com/bibliotheque/gui/PublicationForm.java
3bd21b984a48e7f7ce7aceb484e5b25bf456ea37
[]
no_license
syrinekerriou/Pi-dev-Mobile
7d56f99c9e35dd611a86add80f81732a6dfb1745
f3067e4c6a44a58b120eedafe7b84b5e60e0b45d
refs/heads/master
2022-12-07T17:54:39.639923
2020-06-02T09:45:07
2020-06-02T09:45:07
268,761,710
1
0
null
null
null
null
UTF-8
Java
false
false
20,467
java
package com.bibliotheque.gui; import com.bibliotheque.Service.PublicationServices; import com.codename1.ui.Button; import com.codename1.ui.Container; import com.codename1.ui.EncodedImage; import com.codename1.ui.FontImage; import com.codename1.ui.Label; import com.codename1.ui.events.ActionEvent; import com.codename1.ui.events.ActionListener; import com.codename1.ui.layouts.BorderLayout; import com.codename1.ui.layouts.BoxLayout; import com.codename1.ui.layouts.FlowLayout; import com.codename1.ui.plaf.Style; import com.codename1.ui.plaf.UIManager; import com.bibliotheque.Entite.Publication; import com.bibliotheque.Service.ServiceUser; import java.io.IOException; public class PublicationForm extends BaseForm { private EncodedImage ei; public static Publication pub; public PublicationForm() { this(com.codename1.ui.util.Resources.getGlobalResources()); } @Override protected boolean isCurrentInbox() { return true; } public PublicationForm(com.codename1.ui.util.Resources resourceObjectInstance) { initGuiBuilderComponents(resourceObjectInstance); getToolbar().setTitleComponent( FlowLayout.encloseCenterMiddle( new Label("Publications", "Title") ) ); Style s = UIManager.getInstance().getComponentStyle("TitleCommand"); FontImage icon = FontImage.createMaterial(FontImage.MATERIAL_ADD, s); getToolbar().addCommandToRightBar("", icon, e -> { AddPublicationForm apf = new AddPublicationForm(); apf.AddPublication(); }); installSidemenu(resourceObjectInstance); getToolbar().addCommandToRightBar("", resourceObjectInstance.getImage("toolbar-profile-pic.png"), e -> { }); gui_Label_5.setShowEvenIfBlank(true); gui_Label_6.setShowEvenIfBlank(true); gui_Label_7.setShowEvenIfBlank(true); gui_Label_8.setShowEvenIfBlank(true); gui_Label_9.setShowEvenIfBlank(true); gui_Text_Area_1.setRows(2); gui_Text_Area_1.setColumns(100); gui_Text_Area_1.setEditable(false); gui_Text_Area_1_1.setRows(2); gui_Text_Area_1_1.setColumns(100); gui_Text_Area_1_1.setEditable(false); gui_Text_Area_1_2.setRows(2); gui_Text_Area_1_2.setColumns(100); gui_Text_Area_1_2.setEditable(false); gui_Text_Area_1_3.setRows(2); gui_Text_Area_1_3.setColumns(100); gui_Text_Area_1_3.setEditable(false); gui_Text_Area_1_4.setRows(2); gui_Text_Area_1_4.setColumns(100); gui_Text_Area_1_4.setEditable(false); } ////-- DON'T EDIT BELOW THIS LINE!!! protected com.codename1.ui.Container gui_Container_1 = new com.codename1.ui.Container(new com.codename1.ui.layouts.BorderLayout()); protected com.codename1.ui.Container gui_Container_2 = new com.codename1.ui.Container(new com.codename1.ui.layouts.FlowLayout()); protected com.codename1.ui.Label gui_Label_1 = new com.codename1.ui.Label(); protected com.codename1.ui.Container gui_Container_4 = new com.codename1.ui.Container(new com.codename1.ui.layouts.FlowLayout()); protected com.codename1.ui.Label gui_Label_4 = new com.codename1.ui.Label(); protected com.codename1.ui.Container gui_Container_3 = new com.codename1.ui.Container(new com.codename1.ui.layouts.BoxLayout(com.codename1.ui.layouts.BoxLayout.Y_AXIS)); protected com.codename1.ui.Label gui_Label_3 = new com.codename1.ui.Label(); protected com.codename1.ui.Label gui_Label_2 = new com.codename1.ui.Label(); protected com.codename1.ui.TextArea gui_Text_Area_1 = new com.codename1.ui.TextArea(); protected com.codename1.ui.Label gui_Label_6 = new com.codename1.ui.Label(); protected com.codename1.ui.Container gui_Container_1_1 = new com.codename1.ui.Container(new com.codename1.ui.layouts.BorderLayout()); protected com.codename1.ui.Container gui_Container_2_1 = new com.codename1.ui.Container(new com.codename1.ui.layouts.FlowLayout()); protected com.codename1.ui.Label gui_Label_1_1 = new com.codename1.ui.Label(); protected com.codename1.ui.Container gui_Container_4_1 = new com.codename1.ui.Container(new com.codename1.ui.layouts.FlowLayout()); protected com.codename1.ui.Label gui_Label_4_1 = new com.codename1.ui.Label(); protected com.codename1.ui.Container gui_Container_3_1 = new com.codename1.ui.Container(new com.codename1.ui.layouts.BoxLayout(com.codename1.ui.layouts.BoxLayout.Y_AXIS)); protected com.codename1.ui.Label gui_Label_3_1 = new com.codename1.ui.Label(); protected com.codename1.ui.Label gui_Label_2_1 = new com.codename1.ui.Label(); protected com.codename1.ui.TextArea gui_Text_Area_1_1 = new com.codename1.ui.TextArea(); protected com.codename1.ui.Label gui_Label_7 = new com.codename1.ui.Label(); protected com.codename1.ui.Container gui_Container_1_2 = new com.codename1.ui.Container(new com.codename1.ui.layouts.BorderLayout()); protected com.codename1.ui.Container gui_Container_2_2 = new com.codename1.ui.Container(new com.codename1.ui.layouts.FlowLayout()); protected com.codename1.ui.Label gui_Label_1_2 = new com.codename1.ui.Label(); protected com.codename1.ui.Container gui_Container_4_2 = new com.codename1.ui.Container(new com.codename1.ui.layouts.FlowLayout()); protected com.codename1.ui.Label gui_Label_4_2 = new com.codename1.ui.Label(); protected com.codename1.ui.Container gui_Container_3_2 = new com.codename1.ui.Container(new com.codename1.ui.layouts.BoxLayout(com.codename1.ui.layouts.BoxLayout.Y_AXIS)); protected com.codename1.ui.Label gui_Label_3_2 = new com.codename1.ui.Label(); protected com.codename1.ui.Label gui_Label_2_2 = new com.codename1.ui.Label(); protected com.codename1.ui.TextArea gui_Text_Area_1_2 = new com.codename1.ui.TextArea(); protected com.codename1.ui.Label gui_Label_8 = new com.codename1.ui.Label(); protected com.codename1.ui.Container gui_Container_1_3 = new com.codename1.ui.Container(new com.codename1.ui.layouts.BorderLayout()); protected com.codename1.ui.Container gui_Container_2_3 = new com.codename1.ui.Container(new com.codename1.ui.layouts.FlowLayout()); protected com.codename1.ui.Label gui_Label_1_3 = new com.codename1.ui.Label(); protected com.codename1.ui.Container gui_Container_4_3 = new com.codename1.ui.Container(new com.codename1.ui.layouts.FlowLayout()); protected com.codename1.ui.Label gui_Label_4_3 = new com.codename1.ui.Label(); protected com.codename1.ui.Container gui_Container_3_3 = new com.codename1.ui.Container(new com.codename1.ui.layouts.BoxLayout(com.codename1.ui.layouts.BoxLayout.Y_AXIS)); protected com.codename1.ui.Label gui_Label_3_3 = new com.codename1.ui.Label(); protected com.codename1.ui.Label gui_Label_2_3 = new com.codename1.ui.Label(); protected com.codename1.ui.TextArea gui_Text_Area_1_3 = new com.codename1.ui.TextArea(); protected com.codename1.ui.Label gui_Label_9 = new com.codename1.ui.Label(); protected com.codename1.ui.Container gui_Container_1_4 = new com.codename1.ui.Container(new com.codename1.ui.layouts.BorderLayout()); protected com.codename1.ui.Container gui_Container_2_4 = new com.codename1.ui.Container(new com.codename1.ui.layouts.FlowLayout()); protected com.codename1.ui.Label gui_Label_1_4 = new com.codename1.ui.Label(); protected com.codename1.ui.Container gui_Container_4_4 = new com.codename1.ui.Container(new com.codename1.ui.layouts.FlowLayout()); protected com.codename1.ui.Label gui_Label_4_4 = new com.codename1.ui.Label(); protected com.codename1.ui.Container gui_Container_3_4 = new com.codename1.ui.Container(new com.codename1.ui.layouts.BoxLayout(com.codename1.ui.layouts.BoxLayout.Y_AXIS)); protected com.codename1.ui.Label gui_Label_3_4 = new com.codename1.ui.Label(); protected com.codename1.ui.Label gui_Label_2_4 = new com.codename1.ui.Label(); protected com.codename1.ui.TextArea gui_Text_Area_1_4 = new com.codename1.ui.TextArea(); protected com.codename1.ui.Label gui_Label_5 = new com.codename1.ui.Label(); // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initGuiBuilderComponents(com.codename1.ui.util.Resources resourceObjectInstance) { setLayout(new com.codename1.ui.layouts.BoxLayout(com.codename1.ui.layouts.BoxLayout.Y_AXIS)); setInlineStylesTheme(resourceObjectInstance); setInlineStylesTheme(resourceObjectInstance); setTitle("InboxForm"); setName("InboxForm"); try { ei = EncodedImage.create("/loading.jpg"); } catch (IOException ex) { System.out.println(ex.getMessage()); } PublicationServices bs = new PublicationServices(); for (Publication b : bs.returnPublication()) { // DECLARATION Container gui_Container_1 = new com.codename1.ui.Container(new com.codename1.ui.layouts.BorderLayout()); com.codename1.ui.Container gui_Container_2 = new com.codename1.ui.Container(new com.codename1.ui.layouts.FlowLayout()); com.codename1.ui.Label gui_Label_1 = new com.codename1.ui.Label(); com.codename1.ui.Container gui_Container_4 = new com.codename1.ui.Container(new com.codename1.ui.layouts.FlowLayout()); com.codename1.ui.Label gui_Label_4 = new com.codename1.ui.Label(); com.codename1.ui.Container gui_Container_3 = new com.codename1.ui.Container(new com.codename1.ui.layouts.BoxLayout(com.codename1.ui.layouts.BoxLayout.Y_AXIS)); com.codename1.ui.Label gui_Label_3 = new com.codename1.ui.Label(); com.codename1.ui.Label gui_Label_2 = new com.codename1.ui.Label(); com.codename1.ui.TextArea gui_Text_Area_1 = new com.codename1.ui.TextArea(); com.codename1.ui.Label gui_Label_6 = new com.codename1.ui.Label(); com.codename1.ui.Container gui_Container_1_1 = new com.codename1.ui.Container(new com.codename1.ui.layouts.BorderLayout()); com.codename1.ui.Container gui_Container_2_1 = new com.codename1.ui.Container(new com.codename1.ui.layouts.FlowLayout()); com.codename1.ui.Label gui_Label_1_1 = new com.codename1.ui.Label(); com.codename1.ui.Container gui_Container_4_1 = new com.codename1.ui.Container(new com.codename1.ui.layouts.FlowLayout()); com.codename1.ui.Label gui_Label_4_1 = new com.codename1.ui.Label(); com.codename1.ui.Container gui_Container_3_1 = new com.codename1.ui.Container(new com.codename1.ui.layouts.BoxLayout(com.codename1.ui.layouts.BoxLayout.Y_AXIS)); com.codename1.ui.Label gui_Label_3_1 = new com.codename1.ui.Label(); com.codename1.ui.Label gui_Label_2_1 = new com.codename1.ui.Label(); com.codename1.ui.TextArea gui_Text_Area_1_1 = new com.codename1.ui.TextArea(); com.codename1.ui.Label gui_Label_7 = new com.codename1.ui.Label(); com.codename1.ui.Container gui_Container_1_2 = new com.codename1.ui.Container(new com.codename1.ui.layouts.BorderLayout()); com.codename1.ui.Container gui_Container_2_2 = new com.codename1.ui.Container(new com.codename1.ui.layouts.FlowLayout()); com.codename1.ui.Label gui_Label_1_2 = new com.codename1.ui.Label(); com.codename1.ui.Container gui_Container_4_2 = new com.codename1.ui.Container(new com.codename1.ui.layouts.FlowLayout()); com.codename1.ui.Label gui_Label_4_2 = new com.codename1.ui.Label(); com.codename1.ui.Container gui_Container_3_2 = new com.codename1.ui.Container(new com.codename1.ui.layouts.BoxLayout(com.codename1.ui.layouts.BoxLayout.Y_AXIS)); com.codename1.ui.Label gui_Label_3_2 = new com.codename1.ui.Label(); com.codename1.ui.Label gui_Label_2_2 = new com.codename1.ui.Label(); com.codename1.ui.TextArea gui_Text_Area_1_2 = new com.codename1.ui.TextArea(); com.codename1.ui.Label gui_Label_8 = new com.codename1.ui.Label(); com.codename1.ui.Container gui_Container_1_3 = new com.codename1.ui.Container(new com.codename1.ui.layouts.BorderLayout()); com.codename1.ui.Container gui_Container_2_3 = new com.codename1.ui.Container(new com.codename1.ui.layouts.FlowLayout()); com.codename1.ui.Label gui_Label_1_3 = new com.codename1.ui.Label(); com.codename1.ui.Container gui_Container_4_3 = new com.codename1.ui.Container(new com.codename1.ui.layouts.FlowLayout()); com.codename1.ui.Label gui_Label_4_3 = new com.codename1.ui.Label(); com.codename1.ui.Container gui_Container_3_3 = new com.codename1.ui.Container(new com.codename1.ui.layouts.BoxLayout(com.codename1.ui.layouts.BoxLayout.Y_AXIS)); com.codename1.ui.Label gui_Label_3_3 = new com.codename1.ui.Label(); com.codename1.ui.Label gui_Label_2_3 = new com.codename1.ui.Label(); com.codename1.ui.TextArea gui_Text_Area_1_3 = new com.codename1.ui.TextArea(); com.codename1.ui.Label gui_Label_9 = new com.codename1.ui.Label(); com.codename1.ui.Container gui_Container_1_4 = new com.codename1.ui.Container(new com.codename1.ui.layouts.BorderLayout()); com.codename1.ui.Container gui_Container_2_4 = new com.codename1.ui.Container(new com.codename1.ui.layouts.FlowLayout()); com.codename1.ui.Label gui_Label_1_4 = new com.codename1.ui.Label(); com.codename1.ui.Container gui_Container_4_4 = new com.codename1.ui.Container(new com.codename1.ui.layouts.FlowLayout()); com.codename1.ui.Label gui_Label_4_4 = new com.codename1.ui.Label(); com.codename1.ui.Container gui_Container_3_4 = new com.codename1.ui.Container(new com.codename1.ui.layouts.BoxLayout(com.codename1.ui.layouts.BoxLayout.Y_AXIS)); com.codename1.ui.Label gui_Label_3_4 = new com.codename1.ui.Label(); com.codename1.ui.Label gui_Label_2_4 = new com.codename1.ui.Label(); com.codename1.ui.TextArea gui_Text_Area_1_4 = new com.codename1.ui.TextArea(); com.codename1.ui.Label gui_Label_5 = new com.codename1.ui.Label(); //END DECLARATION gui_Container_1.setInlineStylesTheme(resourceObjectInstance); gui_Container_1.setName("Container_1"); gui_Label_6.setText(""); gui_Label_6.setUIID("Separator"); gui_Label_6.setInlineStylesTheme(resourceObjectInstance); gui_Label_6.setName("Label_6"); gui_Container_1_1.setInlineStylesTheme(resourceObjectInstance); gui_Container_1_1.setName("Container_1_1"); gui_Label_7.setText(""); gui_Label_7.setUIID("Separator"); gui_Label_7.setInlineStylesTheme(resourceObjectInstance); gui_Label_7.setName("Label_7"); gui_Container_1_2.setInlineStylesTheme(resourceObjectInstance); gui_Container_1_2.setName("Container_1_2"); gui_Label_8.setText(""); gui_Label_8.setUIID("Separator"); gui_Label_8.setInlineStylesTheme(resourceObjectInstance); gui_Label_8.setName("Label_8"); gui_Container_1_3.setInlineStylesTheme(resourceObjectInstance); gui_Container_1_3.setName("Container_1_3"); gui_Label_9.setText(""); gui_Label_9.setUIID("Separator"); gui_Label_9.setInlineStylesTheme(resourceObjectInstance); gui_Label_9.setName("Label_9"); gui_Container_1_4.setInlineStylesTheme(resourceObjectInstance); gui_Container_1_4.setName("Container_1_4"); gui_Label_5.setText(""); gui_Label_5.setUIID("Separator"); gui_Label_5.setInlineStylesTheme(resourceObjectInstance); gui_Label_5.setName("Label_5"); addComponent(gui_Container_1); gui_Container_2.setInlineStylesTheme(resourceObjectInstance); gui_Container_2.setName("Container_2"); gui_Container_4.setInlineStylesTheme(resourceObjectInstance); gui_Container_4.setName("Container_4"); ((com.codename1.ui.layouts.FlowLayout) gui_Container_4.getLayout()).setAlign(com.codename1.ui.Component.CENTER); gui_Container_3.setInlineStylesTheme(resourceObjectInstance); gui_Container_3.setName("Container_3"); gui_Container_1.addComponent(com.codename1.ui.layouts.BorderLayout.EAST, gui_Container_2); gui_Label_1.setText("11:31 AM"); gui_Label_1.setUIID("SmallFontLabel"); gui_Label_1.setInlineStylesTheme(resourceObjectInstance); gui_Label_1.setName("Label_1"); gui_Container_2.addComponent(gui_Label_1); gui_Container_1.addComponent(com.codename1.ui.layouts.BorderLayout.WEST, gui_Container_4); gui_Label_4.setUIID("Padding2"); gui_Label_4.setInlineStylesTheme(resourceObjectInstance); gui_Label_4.setName("Label_4"); gui_Label_4.setIcon(resourceObjectInstance.getImage("label_round.png")); gui_Container_4.addComponent(gui_Label_4); gui_Container_1.addComponent(com.codename1.ui.layouts.BorderLayout.CENTER, gui_Container_3); gui_Label_3.setText(b.getType()); // Label dateLabel = new Label(b.getDate().getDate()); gui_Label_3.addPointerPressedListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { pub = b; new CommentaireForm(resourceObjectInstance).show(); } }); gui_Label_3.setInlineStylesTheme(resourceObjectInstance); gui_Label_3.setName("Label_3"); gui_Label_2.setText(b.getDescription()); gui_Label_2.setUIID("RedLabel"); gui_Label_2.setInlineStylesTheme(resourceObjectInstance); gui_Label_2.setName("Label_2"); gui_Text_Area_1.setText("Hi Adrian, there is a new announcement for you from Oxford Learning Lab. Hello we completly..."); gui_Text_Area_1.setUIID("SmallFontLabel"); gui_Text_Area_1.setInlineStylesTheme(resourceObjectInstance); gui_Text_Area_1.setName("Text_Area_1"); gui_Text_Area_1.setColumns(100); gui_Text_Area_1.setRows(2); Container myContainer = new Container(new BorderLayout()); myContainer.add(BorderLayout.WEST, gui_Label_3); gui_Container_3.addComponent(myContainer); Button delete = new Button(); Style s = UIManager.getInstance().getComponentStyle("TitleCommand"); FontImage icon = FontImage.createMaterial(FontImage.MATERIAL_DELETE, s); delete.setIcon(icon); delete.setVisible(false); if (b.getIdUser() == ServiceUser.currentUser.getId()) { delete.setVisible(true); } delete.addActionListener(e -> { PublicationServices ps = new PublicationServices(); ps.SupprimerPublucation(b.getId()); new PublicationForm(resourceObjectInstance).show(); }); Container containerdel = new Container(new BorderLayout()); Container containerboth = new Container(new BoxLayout(BoxLayout.Y_AXIS)); containerdel.add(BorderLayout.EAST, delete); containerboth.addAll(gui_Label_2, containerdel); gui_Container_3.addComponent(containerboth); addComponent(gui_Label_6); addComponent(gui_Container_1_1); gui_Container_2_1.setInlineStylesTheme(resourceObjectInstance); gui_Container_2_1.setName("Container_2_1"); gui_Container_4_1.setInlineStylesTheme(resourceObjectInstance); gui_Container_4_1.setName("Container_4_1"); ((com.codename1.ui.layouts.FlowLayout) gui_Container_4_1.getLayout()).setAlign(com.codename1.ui.Component.CENTER); gui_Container_3_1.setInlineStylesTheme(resourceObjectInstance); gui_Container_3_1.setName("Container_3_1"); gui_Container_1_1.addComponent(com.codename1.ui.layouts.BorderLayout.EAST, gui_Container_2_1); addComponent(gui_Label_5); } }// </editor-fold> //-- DON'T EDIT ABOVE THIS LINE!!! }
4bc226410fb025f8fd1961124cb6ffd4b02e751e
35ee274853dcffb586b4a44d052aef85d03986e0
/src/com/albany/foodOnWheels/controller/EditProfileServlet.java
e836de3868e941e6f138ad0835f8682a37901072
[]
no_license
fernandoliu902/FoodTruck
4d2010339bf28e2e6391813a79c7cc6878a74f99
4f2b3eb2f70b6908f6c339c0392f7d6738073af4
refs/heads/master
2022-12-11T11:27:03.502396
2020-09-05T00:19:12
2020-09-05T00:19:12
292,970,434
0
0
null
null
null
null
UTF-8
Java
false
false
5,432
java
package com.albany.foodOnWheels.controller; import java.io.IOException; import java.util.List; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; import org.hibernate.criterion.Restrictions; import com.albany.foodOnWheels.model.FoodTruckOwner; import com.albany.foodOnWheels.model.User; import com.services.Connection; /** * Servlet implementation class EditProfileServlet */ @WebServlet({"/EditProfileServlet","/EditProfileServlet.do"}) public class EditProfileServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public EditProfileServlet() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String register = request.getParameter("register"); HttpSession httpSession = request.getSession(); Session session = null; Transaction tx = null; SessionFactory sessionFactory = Connection.getSessionFactory(); try { session = sessionFactory.openSession(); tx = session.beginTransaction(); List<User> userList = session.createCriteria(User.class) .add(Restrictions.eq("user_name",httpSession.getAttribute("user_name"))) .list(); System.out.println("profile" +userList.size()); User user= userList.get(0); user.setFirstname(request.getParameter("first_name")); user.setLastname(request.getParameter("last_name")); user.setAddress_line1(request.getParameter("address1")); user.setAddress_line_2(request.getParameter("address2")); user.setCity(request.getParameter("city")); user.setState(request.getParameter("state")); if(register.equals("user")) { user.setZipcode(Integer.parseInt(request.getParameter("zipcode"))); httpSession.setAttribute("zipcode", Integer.parseInt(request.getParameter("zipcode"))); } user.setPhone(request.getParameter("phone")); session.update(user); tx.commit(); if(register.equals("truck")) { tx = session.beginTransaction(); FoodTruckOwner truck_owner = new FoodTruckOwner(); List<FoodTruckOwner> foodTruckOwnerList = session.createCriteria(FoodTruckOwner.class) .list(); for(FoodTruckOwner foodtruckowner : foodTruckOwnerList) { //System.out.println(foodtruckowner.getUser().getUser_name()); if(foodtruckowner.getUser().getUser_name().equals(user.getUser_name())) { //System.out.println("truck find"); truck_owner = foodtruckowner; } } //System.out.println("profile2"+userList.size()); session.persist(user); truck_owner.setPhone(request.getParameter("phone")); String[] cuisine = request.getParameterValues("cuisine"); truck_owner.setCuisine(String.join(",",cuisine )); String[] days = request.getParameterValues("days"); truck_owner.setDays(String.join(",",days )); truck_owner.setWeekday_time( request.getParameter("week_day")); truck_owner.setWeekend_time( request.getParameter("week_end")); String[] payment = request.getParameterValues("payment"); truck_owner.setAccepted_payments(String.join(",",payment )); truck_owner.setAddress_line_1(request.getParameter("address1")); truck_owner.setAddress_line_2(request.getParameter("address2")); truck_owner.setCity(request.getParameter("city")); truck_owner.setState(request.getParameter("state")); session.update(truck_owner); session.getTransaction().commit(); System.out.println("Go to truck profile"); request.setAttribute("user", user); request.setAttribute("msg", "Your profile is updated successfully!"); request.setAttribute("truck", truck_owner); request.setAttribute("cuisine", truck_owner.getCuisine()); request.setAttribute("days", truck_owner.getDays()); request.setAttribute("payments", truck_owner.getAccepted_payments()); request.setAttribute("fileName", truck_owner.getImage_path()); RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/jsps/profile-truckowner.jsp"); dispatcher.forward(request, response); return; } else { System.out.println("Go to user profile"); request.setAttribute("user", user); request.setAttribute("msg", "Your profile is updated successfully!"); RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/jsps/profile.jsp"); dispatcher.forward(request, response); return; } } catch (Exception e) { tx.rollback(); e.printStackTrace(); } finally { session.close(); } } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub } }
bcdfa7835946e2f11fb2b1c06e35617ca7a9c8dd
b8a92184e829fe1f1c80eda78f6d302b35467da4
/src/main/java/com/buyout/sale/buyout/repository/ProductRepository.java
f34b25b9bea8c46bd6c6111da3c566a9d65d849c
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
team-plains/buyout
fac170776c6ae7ea4f3f419d6a1c34fc1444c185
4d5a3e3be00842dba937bad1d700eed7eaddbd50
refs/heads/main
2023-04-04T20:45:50.114167
2021-04-24T01:55:20
2021-04-24T01:55:20
357,413,646
1
0
MIT
2021-04-23T18:51:25
2021-04-13T03:33:07
HTML
UTF-8
Java
false
false
295
java
package com.buyout.sale.buyout.repository; import com.buyout.sale.buyout.models.Product; import org.springframework.data.jpa.repository.JpaRepository; public interface ProductRepository extends JpaRepository<Product, Long> { public Product findByProductName(String productName); }
2165cd46c11ed6ba78f054750c01ca992a40b12d
fb70e6d16baecf886869e14eb439fe334954b39e
/Lezerkardosjdk/java/sun/util/resources/cldr/tg/LocaleNames_tg.java
6a3dc9c57bdbd487d17f36b70fa7871c737beec2
[]
no_license
Savitar97/Prog2
ae5dfc46c8fc61974e4c2ddb59ce9e23ab955d23
8bc2c19240862218b1b06c4b5abe9081747a54c0
refs/heads/master
2020-07-25T00:16:11.948303
2020-02-29T23:49:42
2020-02-29T23:49:42
208,092,693
0
2
null
null
null
null
UTF-8
Java
false
false
3,997
java
/* * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * COPYRIGHT AND PERMISSION NOTICE * * Copyright (C) 1991-2012 Unicode, Inc. All rights reserved. Distributed under * the Terms of Use in http://www.unicode.org/copyright.html. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of the Unicode data files and any associated documentation (the "Data * Files") or Unicode software and any associated documentation (the * "Software") to deal in the Data Files or Software without restriction, * including without limitation the rights to use, copy, modify, merge, * publish, distribute, and/or sell copies of the Data Files or Software, and * to permit persons to whom the Data Files or Software are furnished to do so, * provided that (a) the above copyright notice(s) and this permission notice * appear with all copies of the Data Files or Software, (b) both the above * copyright notice(s) and this permission notice appear in associated * documentation, and (c) there is clear notice in each modified Data File or * in the Software as well as in the documentation associated with the Data * File(s) or Software that the data or software has been modified. * * THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY * KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR * CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THE DATA FILES OR SOFTWARE. * * Except as contained in this notice, the name of a copyright holder shall not * be used in advertising or otherwise to promote the sale, use or other * dealings in these Data Files or Software without prior written authorization * of the copyright holder. */ package sun.util.resources.cldr.tg; import sun.util.resources.OpenListResourceBundle; public class LocaleNames_tg extends OpenListResourceBundle { @Override protected final Object[][] getContents() { final Object[][] data = new Object[][] { { "AF", "\u0410\u0444\u0493\u043e\u043d\u0438\u0441\u0442\u0430\u043d" }, { "de", "\u041d\u0435\u043c\u0438\u0441\u04e3" }, { "en", "\u0410\u043d\u0433\u043b\u0438\u0441\u04e3" }, { "fr", "\u0424\u0430\u0440\u043e\u043d\u0441\u0430\u0432\u04e3" }, { "zh", "\u0427\u0438\u043d\u04e3" }, { "Arab", "\u0410\u0440\u0430\u0431\u04e3" }, }; return data; } }
62271221eb5f8d0766b82d5270978c037b634395
bef33c12dd4f74c1fa049dcd28035957b72dc6f2
/软件工程/minilibstudent/src/minilib/vo/User.java
abc464a867431e224536ab2cb4d50e533883e030
[]
no_license
zhxrabbit/Third-year-of-University-1
de7ad65ac6256687b1493fe6df9aa72a275f919c
3395581a5ed5f51add02afb0c12aa522e9ac3ad3
refs/heads/master
2020-04-12T10:09:55.642800
2018-12-24T03:57:22
2018-12-24T03:57:22
162,421,056
0
0
null
null
null
null
UTF-8
Java
false
false
1,201
java
package minilib.vo; public class User{ private String userid; private String idcard; private String sexid; private String username; private String birthday; private String deptid; private String typeid; private String password; public String getUserid() { return userid; } public void setUserid(String userid) { this.userid = userid; } public String getIdcard() { return idcard; } public void setIdcard(String idcard) { this.idcard = idcard; } public String getSexid() { return sexid; } public void setSexid(String sexid) { this.sexid = sexid; } public String getBirthday() { return birthday; } public void setBirthday(String birthday) { this.birthday = birthday; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getDeptid() { return deptid; } public void setDeptid(String deptid) { this.deptid = deptid; } public String getTypeid() { return typeid; } public void setTypeid(String typeid) { this.typeid = typeid; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } }
0cc19c913cd1ac8f6b43d274c647e5c1a5475487
c3c15a0c43a575477c0f1636fb1d08fd8fc45f03
/src/main/java/com/codecool/web/servlet/CouponsServlet.java
4c02740fa4388bc97865ba92912adc50fd9bca36
[]
no_license
CodecoolBase/intellij-maven-web-jdbc-quickstart-java
c36f7050a24b7f945b74f495f72183d528a2cf05
1866634f88dceb249fef83f2e3fcd93884e27bc0
refs/heads/master
2022-09-18T04:59:28.912438
2019-06-06T14:40:24
2019-06-06T14:40:24
128,528,389
0
1
null
2022-09-08T00:59:57
2018-04-07T12:58:52
Java
UTF-8
Java
false
false
2,515
java
package com.codecool.web.servlet; import com.codecool.web.dao.CouponDao; import com.codecool.web.dao.ShopDao; import com.codecool.web.dao.database.DatabaseCouponDao; import com.codecool.web.dao.database.DatabaseShopDao; import com.codecool.web.model.Coupon; import com.codecool.web.service.CouponService; import com.codecool.web.service.exception.ServiceException; import com.codecool.web.service.simple.SimpleCouponService; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.sql.Connection; import java.sql.SQLException; import java.util.List; @WebServlet("/protected/coupons") public final class CouponsServlet extends AbstractServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { try (Connection connection = getConnection(req.getServletContext())) { CouponDao couponDao = new DatabaseCouponDao(connection); ShopDao shopDao = new DatabaseShopDao(connection); CouponService couponService = new SimpleCouponService(couponDao, shopDao); List<Coupon> coupons = couponService.getCoupons(); req.setAttribute("coupons", coupons); req.getRequestDispatcher("coupons.jsp").forward(req, resp); } catch (SQLException ex) { throw new ServletException(ex); } } @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { try (Connection connection = getConnection(req.getServletContext())) { CouponDao couponDao = new DatabaseCouponDao(connection); ShopDao shopDao = new DatabaseShopDao(connection); CouponService couponService = new SimpleCouponService(couponDao, shopDao); String name = req.getParameter("name"); String percentage = req.getParameter("percentage"); Coupon coupon = couponService.addCoupon(name, percentage); String info = String.format("Coupon %s with id %s has been created", coupon.getName(), coupon.getId()); req.setAttribute("info", info); } catch (SQLException ex) { throw new ServletException(ex); } catch (ServiceException ex) { req.setAttribute("error", ex.getMessage()); } doGet(req, resp); } }
aa484877fb73c7d39a81bb9714608279c148eea7
711da63dd3a24f00b5b49c5fe88519d7445a143c
/bean-creation/src/main/java/com/flydean/services/ServiceA.java
0086c3e3f1cc408f0606fbcb6be6ba0d7f9beabd
[]
no_license
ddean2009/spring5-core-workshop
e6cda4538080482d2c42460a9e89b05a9ff9f25e
89cc7ebf0eeb0f28edf14b4d7e79b61c54c8989f
refs/heads/master
2022-12-23T11:10:42.425961
2021-03-30T04:47:02
2021-03-30T04:47:02
193,692,462
21
4
null
2022-12-16T14:49:58
2019-06-25T11:11:18
Java
UTF-8
Java
false
false
57
java
package com.flydean.services; public class ServiceA { }
04328134560bbde2373b59ac778d5beb917db454
6bd63e6fdd30fb1692f29fc074726d456d171ad2
/src/main/java/com/rds_software/googeauthtutorial/GLogonAuthServlet.java
435aac7ae05f21603c8f3a5032539d0f14dfc536
[]
no_license
lanarimarco/googleauthdemo
39319e7950d16375404febb160d95c4f7d689c83
cf89eddac884728c1cca19b0188914383b2af640
refs/heads/master
2020-04-24T08:40:16.748196
2019-02-21T09:03:33
2019-02-21T09:03:33
171,838,383
0
0
null
null
null
null
UTF-8
Java
false
false
1,445
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.rds_software.googeauthtutorial; import java.io.IOException; import java.net.URLEncoder; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * Attiva il flusso di autorizzazione. * Questa servlet risponderà al link "Entra con GMail". * @author lana */ @WebServlet(urlPatterns = {"/", "/glogon/auth"}) public class GLogonAuthServlet extends HttpServlet{ @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String baseUrl = req.getScheme() + "://" + req.getServerName() + ":" + req.getServerPort() + req.getContextPath(); //Se la validazione gmail ha successo String callbackUrl = baseUrl + "/glogon/callback"; //Se la validazione gmail non ha successo String fallbackUrl = baseUrl + "/glogon/fallback"; resp.sendRedirect("https://aspweb.rds-software.com/rds-google-apis/oauth2" + "?onSuccessUri=" + URLEncoder.encode(callbackUrl, "UTF-8") + "&onErrorUri=" + URLEncoder.encode(fallbackUrl, "UTF-8")); } }
bd2107dccc517123e070805c801b0ab57d9b8824
73ebc298e16a86d028e413415d15f63ee1deecdb
/RIP_UI/src/main/java/com/rip/rip_ui/application/wizard/diagram_tool/templates/UpdateQuery.java
409ebeb246a31bfef8a93a6394232005d0b6445a
[ "Apache-2.0" ]
permissive
Jayanayaka/RIP
a31bb4c3ef5b981f9d26d3cfdc11c2083da66bc0
a999e5e8d5c26eee39270e280ca7dbd2dbcf8510
refs/heads/master
2020-12-29T03:33:06.993286
2016-10-27T07:52:05
2016-10-27T07:52:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
314
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.rip.rip_ui.application.wizard.diagram_tool.templates; /** * * @author Supun */ public class UpdateQuery { }
4242022e4ee7a0b86db069393bd1ec0e0b63c5e5
4b0bf4787e89bcae7e4759bde6d7f3ab2c81f849
/aliyun-java-sdk-cassandra/src/main/java/com/aliyuncs/cassandra/model/v20190101/GetCmsUrlRequest.java
898f8b413b0918f6f6fbdda85ea1e6892bd58906
[ "Apache-2.0" ]
permissive
aliyun/aliyun-openapi-java-sdk
a263fa08e261f12d45586d1b3ad8a6609bba0e91
e19239808ad2298d32dda77db29a6d809e4f7add
refs/heads/master
2023-09-03T12:28:09.765286
2023-09-01T09:03:00
2023-09-01T09:03:00
39,555,898
1,542
1,317
NOASSERTION
2023-09-14T07:27:05
2015-07-23T08:41:13
Java
UTF-8
Java
false
false
1,589
java
/* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.aliyuncs.cassandra.model.v20190101; import com.aliyuncs.RpcAcsRequest; import com.aliyuncs.http.MethodType; import com.aliyuncs.cassandra.Endpoint; /** * @author auto create * @version */ public class GetCmsUrlRequest extends RpcAcsRequest<GetCmsUrlResponse> { private String clusterId; public GetCmsUrlRequest() { super("Cassandra", "2019-01-01", "GetCmsUrl", "Cassandra"); setMethod(MethodType.POST); try { com.aliyuncs.AcsRequest.class.getDeclaredField("productEndpointMap").set(this, Endpoint.endpointMap); com.aliyuncs.AcsRequest.class.getDeclaredField("productEndpointRegional").set(this, Endpoint.endpointRegionalType); } catch (Exception e) {} } public String getClusterId() { return this.clusterId; } public void setClusterId(String clusterId) { this.clusterId = clusterId; if(clusterId != null){ putQueryParameter("ClusterId", clusterId); } } @Override public Class<GetCmsUrlResponse> getResponseClass() { return GetCmsUrlResponse.class; } }
950306f02dfe17cf70fe2034233b262b18262e65
514e412944d3aba506709f32156dffc1bff56a14
/jee-jpa/src/entities/Store.java
3157fb9b8f2a95a3934cfebad8934208dbf5eaca
[]
no_license
eatsleepcode102/java-javaee
bfa6f3451a7d10b840184a9e8c37c8598ba08787
9b126dece6f807b24da2d678a1911f1dd5cddb89
refs/heads/master
2021-08-07T08:49:51.616572
2020-03-28T16:37:52
2020-03-28T16:37:52
131,375,327
0
0
null
null
null
null
UTF-8
Java
false
false
1,307
java
package entities; import java.io.Serializable; import javax.persistence.*; import java.sql.Timestamp; /** * The persistent class for the store database table. * */ @Entity @NamedQuery(name="Store.findAll", query="SELECT s FROM Store s") public class Store implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy=GenerationType.AUTO) @Column(name="store_id") private Integer storeId; @Column(name="last_update") private Timestamp lastUpdate; //bi-directional many-to-one association to Address @ManyToOne @JoinColumn(name="address_id") private Address address; //bi-directional many-to-one association to Staff @ManyToOne @JoinColumn(name="manager_staff_id") private Staff staff; public Store() { } public Integer getStoreId() { return this.storeId; } public void setStoreId(Integer storeId) { this.storeId = storeId; } public Timestamp getLastUpdate() { return this.lastUpdate; } public void setLastUpdate(Timestamp lastUpdate) { this.lastUpdate = lastUpdate; } public Address getAddress() { return this.address; } public void setAddress(Address address) { this.address = address; } public Staff getStaff() { return this.staff; } public void setStaff(Staff staff) { this.staff = staff; } }
de0ebe85976c83edae9095888af9632f88e49e98
7608dc17c244b32fcb02e22fdb98bc56aa2f89e1
/宠物/src/main/java/com/weeho/petim/hxim/PermissionsResultAction.java
6ca857d86c9fc3e0f259eeeac007120d4cea8f04
[]
no_license
alexlzl/AndroidDemo11
999f56f877ab4b83634c640c7dbc456101199d27
1f2799af9275ef144d34e33ad46507f019cfd437
refs/heads/master
2021-06-24T11:43:56.982231
2017-09-12T16:34:23
2017-09-12T16:34:35
103,295,359
0
0
null
null
null
null
UTF-8
Java
false
false
6,783
java
/** * Copyright 2015 Anthony Restaino Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package com.weeho.petim.hxim; import android.content.pm.PackageManager; import android.os.Handler; import android.os.Looper; import android.support.annotation.*; import android.util.Log; import java.util.Collections; import java.util.HashSet; import java.util.Set; /** * This abstract class should be used to create an if/else action that the PermissionsManager * can execute when the permissions you request are granted or denied. Simple use involves * creating an anonymous instance of it and passing that instance to the * requestPermissionsIfNecessaryForResult method. The result will be sent back to you as * either onGranted (all permissions have been granted), or onDenied (a required permission * has been denied). Ideally you put your functionality in the onGranted method and notify * the user what won't work in the onDenied method. */ public abstract class PermissionsResultAction { private static final String TAG = PermissionsResultAction.class.getSimpleName(); private final Set<String> mPermissions = new HashSet<String>(1); private Looper mLooper = Looper.getMainLooper(); /** * Default Constructor */ public PermissionsResultAction() {} /** * Alternate Constructor. Pass the looper you wish the PermissionsResultAction * callbacks to be executed on if it is not the current Looper. For instance, * if you are making a permissions request from a background thread but wish the * callback to be on the UI thread, use this constructor to specify the UI Looper. * * @param looper the looper that the callbacks will be called using. */ @SuppressWarnings("unused") public PermissionsResultAction(@NonNull Looper looper) {mLooper = looper;} /** * This method is called when ALL permissions that have been * requested have been granted by the user. In this method * you should put all your permissions sensitive code that can * only be executed with the required permissions. */ public abstract void onGranted(); /** * This method is called when a permission has been denied by * the user. It provides you with the permission that was denied * and will be executed on the Looper you pass to the constructor * of this class, or the Looper that this object was created on. * * @param permission the permission that was denied. */ public abstract void onDenied(String permission); /** * This method is used to determine if a permission not * being present on the current Android platform should * affect whether the PermissionsResultAction should continue * listening for events. By default, it returns true and will * simply ignore the permission that did not exist. Usually this will * work fine since most new permissions are introduced to * restrict what was previously allowed without permission. * If that is not the case for your particular permission you * request, override this method and return false to result in the * Action being denied. * * @param permission the permission that doesn't exist on this * Android version * @return return true if the PermissionsResultAction should * ignore the lack of the permission and proceed with exection * or false if the PermissionsResultAction should treat the * absence of the permission on the API level as a denial. */ @SuppressWarnings({"WeakerAccess", "SameReturnValue"}) public synchronized boolean shouldIgnorePermissionNotFound(String permission) { Log.d(TAG, "Permission not found: " + permission); return true; } @SuppressWarnings("WeakerAccess") @CallSuper protected synchronized final boolean onResult(final @NonNull String permission, int result) { if (result == PackageManager.PERMISSION_GRANTED) { return onResult(permission, Permissions.GRANTED); } else { return onResult(permission, Permissions.DENIED); } } /** * This method is called when a particular permission has changed. * This method will be called for all permissions, so this method determines * if the permission affects the state or not and whether it can proceed with * calling onGranted or if onDenied should be called. * * @param permission the permission that changed. * @param result the result for that permission. * @return this method returns true if its primary action has been completed * and it should be removed from the data structure holding a reference to it. */ @SuppressWarnings("WeakerAccess") @CallSuper protected synchronized final boolean onResult(final @NonNull String permission, Permissions result) { mPermissions.remove(permission); if (result == Permissions.GRANTED) { if (mPermissions.isEmpty()) { new Handler(mLooper).post(new Runnable() { @Override public void run() { onGranted(); } }); return true; } } else if (result == Permissions.DENIED) { new Handler(mLooper).post(new Runnable() { @Override public void run() { onDenied(permission); } }); return true; } else if (result == Permissions.NOT_FOUND) { if (shouldIgnorePermissionNotFound(permission)) { if (mPermissions.isEmpty()) { new Handler(mLooper).post(new Runnable() { @Override public void run() { onGranted(); } }); return true; } } else { new Handler(mLooper).post(new Runnable() { @Override public void run() { onDenied(permission); } }); return true; } } return false; } /** * This method registers the PermissionsResultAction object for the specified permissions * so that it will know which permissions to look for changes to. The PermissionsResultAction * will then know to look out for changes to these permissions. * * @param perms the permissions to listen for */ @SuppressWarnings("WeakerAccess") @CallSuper protected synchronized final void registerPermissions(@NonNull String[] perms) { Collections.addAll(mPermissions, perms); } }
11508ea7a62970a7017b338894f9e3bb75dbb9ad
973c76f9557d2b52e07407d780c0e5129eace04f
/PaperSelectionFrame.java
7e7c994275df80773eb7041f13e9cca7cca38b2b
[]
no_license
HarshitVatsa/Online-Quiz-Application
a4d75543f5850c5b64da3d6cb0a1adb8ab94e628
14182f10420caa89d2102c774e992e44dfa45a28
refs/heads/master
2022-12-09T06:39:56.765685
2020-09-07T01:32:47
2020-09-07T01:32:47
293,392,474
1
0
null
null
null
null
UTF-8
Java
false
false
17,562
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 techquizapp.gui; import java.awt.Color; import java.awt.Font; import java.awt.event.ItemEvent; import java.sql.SQLException; import java.util.ArrayList; import javax.swing.JOptionPane; import techquizapp.pojo.ExamPojo; import techquizapp.pojo.UserProfile; import testquizapp.dao.ExamDao; /** * * @author THE UNIVERSE BOSS */ public class PaperSelectionFrame extends javax.swing.JFrame { /** * Creates new form PaperSelectionFrame */ private String subjectname; public PaperSelectionFrame() { initComponents(); this.setLocationRelativeTo(null); lblUserName.setText("Hello "+UserProfile.getUserName()); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jPanel1 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jcSubject = new javax.swing.JComboBox<>(); jLabel5 = new javax.swing.JLabel(); jcExamId = new javax.swing.JComboBox<>(); btnTakeTest = new javax.swing.JButton(); lblLogout = new javax.swing.JLabel(); lblUserName = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jPanel1.setBackground(new java.awt.Color(0, 0, 0)); jLabel1.setFont(new java.awt.Font("Tahoma", 1, 20)); // NOI18N jLabel1.setForeground(new java.awt.Color(255, 153, 0)); jLabel1.setText("PAPER SELECTION PANEL"); jLabel2.setIcon(new javax.swing.ImageIcon("E:\\javadocx\\TECH-QUIZ-APP\\TECH QUIZ APP\\onlineexam\\examicon.png")); // NOI18N jLabel2.setText("jLabel2"); jLabel3.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N jLabel3.setForeground(new java.awt.Color(255, 255, 255)); jLabel3.setText("Fill paper Details"); jLabel4.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jLabel4.setForeground(new java.awt.Color(255, 153, 0)); jLabel4.setText("Choose The Subject"); jcSubject.setFont(new java.awt.Font("Tahoma", 1, 13)); // NOI18N jcSubject.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "", "Java", "C", "C++" })); jcSubject.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { jcSubjectItemStateChanged(evt); } }); jLabel5.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jLabel5.setForeground(new java.awt.Color(255, 153, 0)); jLabel5.setText("Choose The ExamId"); jcExamId.setFont(new java.awt.Font("Tahoma", 1, 13)); // NOI18N jcExamId.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { jcExamIdItemStateChanged(evt); } }); btnTakeTest.setBackground(new java.awt.Color(51, 51, 51)); btnTakeTest.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N btnTakeTest.setForeground(new java.awt.Color(255, 153, 0)); btnTakeTest.setText("Take The Test"); btnTakeTest.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnTakeTestActionPerformed(evt); } }); lblLogout.setFont(new java.awt.Font("Tahoma", 1, 13)); // NOI18N lblLogout.setForeground(new java.awt.Color(255, 153, 0)); lblLogout.setText("Logout"); lblLogout.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { lblLogoutMouseClicked(evt); } public void mouseEntered(java.awt.event.MouseEvent evt) { lblLogoutMouseEntered(evt); } public void mouseExited(java.awt.event.MouseEvent evt) { lblLogoutMouseExited(evt); } }); lblUserName.setFont(new java.awt.Font("Tahoma", 1, 13)); // NOI18N lblUserName.setForeground(new java.awt.Color(255, 153, 0)); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(36, 36, 36) .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(45, 45, 45) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel4) .addComponent(jLabel3) .addComponent(jcSubject, javax.swing.GroupLayout.PREFERRED_SIZE, 139, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(10, 10, 10) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(btnTakeTest) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jcExamId, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel5)))))) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(158, 158, 158) .addComponent(jLabel1))) .addContainerGap(137, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addGap(24, 24, 24) .addComponent(lblUserName, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lblLogout) .addGap(69, 69, 69)) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(lblUserName, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lblLogout, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(18, 18, 18) .addComponent(jLabel1) .addGap(18, 18, 18) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jLabel3) .addGap(18, 18, 18) .addComponent(jLabel4) .addGap(18, 18, 18) .addComponent(jcSubject, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel5))) .addGap(18, 18, 18) .addComponent(jcExamId, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(51, 51, 51) .addComponent(btnTakeTest) .addContainerGap(61, Short.MAX_VALUE)) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) ); pack(); }// </editor-fold>//GEN-END:initComponents private void lblLogoutMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblLogoutMouseClicked LoginFrame loginframe=new LoginFrame(); loginframe.setVisible(true); this.dispose(); }//GEN-LAST:event_lblLogoutMouseClicked private void lblLogoutMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblLogoutMouseEntered lblLogout.setForeground(Color.WHITE); Font f=new Font("Tahoma",Font.ITALIC,12); lblLogout.setFont(f); }//GEN-LAST:event_lblLogoutMouseEntered private void lblLogoutMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblLogoutMouseExited lblLogout.setForeground(new Color(255,153,0)); Font f=new Font("Tahoma",Font.BOLD,12); lblLogout.setFont(f); }//GEN-LAST:event_lblLogoutMouseExited private void jcExamIdItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jcExamIdItemStateChanged if(evt.getStateChange()==ItemEvent.DESELECTED) return; boolean result=validateInput(); if(result==false){ JOptionPane.showMessageDialog(null, "Please make a selection!","Error!",JOptionPane.ERROR_MESSAGE); return; } jcExamId.removeAllItems(); try{ if(ExamDao.isPaperSet(subjectname)==false){ JOptionPane.showMessageDialog(null, "Sorry!No exam paper has been set!","No Records",JOptionPane.ERROR_MESSAGE); return; } ArrayList<String>examList=ExamDao.getExamIdBySubject(UserProfile.getUserName(), subjectname); if(examList.isEmpty()){ JOptionPane.showMessageDialog(null, "You have given all exams for this sub!","Information!",JOptionPane.INFORMATION_MESSAGE); return; } for(String examid:examList){ jcExamId.addItem(examid); } } catch(SQLException e) { JOptionPane.showMessageDialog(null, "Error while connecting to DB!","Error!",JOptionPane.ERROR_MESSAGE); e.printStackTrace(); } }//GEN-LAST:event_jcExamIdItemStateChanged private void btnTakeTestActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnTakeTestActionPerformed int count=jcSubject.getSelectedIndex(); if(count==0){ JOptionPane.showMessageDialog(null,"Please choose a sub!","Error!",JOptionPane.ERROR_MESSAGE); return; } count=jcExamId.getItemCount(); if(count==0){ JOptionPane.showMessageDialog(null,"Please choose a examid!","Error!",JOptionPane.ERROR_MESSAGE); return; } String subject=jcSubject.getSelectedItem().toString(); String examid=jcExamId.getSelectedItem().toString(); int ans; ans=JOptionPane.showConfirmDialog(null, "You have choosen\""+subject+"\" and \""+examid+"\" paper!\n Is this ok?","Confirmation!",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE); if(ans==JOptionPane.YES_OPTION){ try{ int totalQue=ExamDao.getQuestionCountByExam(examid.trim()); ExamPojo exam=new ExamPojo(examid,subject,totalQue); TakeTestFrame taketest=new TakeTestFrame(); taketest.setVisible(true); this.dispose(); } catch(SQLException e) { JOptionPane.showMessageDialog(null, "Error while connecting to DB!","Error!",JOptionPane.ERROR_MESSAGE); e.printStackTrace(); } } }//GEN-LAST:event_btnTakeTestActionPerformed private void jcSubjectItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jcSubjectItemStateChanged if(evt.getStateChange()==ItemEvent.DESELECTED) return; boolean result=validateInput(); if(result==false){ JOptionPane.showMessageDialog(null, "Please make a selection!","Error!",JOptionPane.ERROR_MESSAGE); return; } jcExamId.removeAllItems(); try{ if(ExamDao.isPaperSet(subjectname)==false){ JOptionPane.showMessageDialog(null, "Sorry!No exam paper has been set!","No Records",JOptionPane.ERROR_MESSAGE); return; } ArrayList<String>examList=ExamDao.getExamIdBySubject(UserProfile.getUserName(), subjectname); if(examList.isEmpty()){ JOptionPane.showMessageDialog(null, "You have given all exams for this sub!","Information!",JOptionPane.INFORMATION_MESSAGE); return; } for(String examid:examList){ jcExamId.addItem(examid); } } catch(SQLException e) { JOptionPane.showMessageDialog(null, "Error while connecting to DB!","Error!",JOptionPane.ERROR_MESSAGE); e.printStackTrace(); } }//GEN-LAST:event_jcSubjectItemStateChanged /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(PaperSelectionFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(PaperSelectionFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(PaperSelectionFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(PaperSelectionFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new PaperSelectionFrame().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnTakeTest; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JPanel jPanel1; private javax.swing.JComboBox<String> jcExamId; private javax.swing.JComboBox<String> jcSubject; private javax.swing.JLabel lblLogout; private javax.swing.JLabel lblUserName; // End of variables declaration//GEN-END:variables public boolean validateInput() { int selectedIndex=jcSubject.getSelectedIndex(); if(selectedIndex==0) return false; subjectname=jcSubject.getSelectedItem().toString(); return true; } }
a412f245327a9379c1ae6a8e1f877b95f4d29c13
f8100ac7bd570613c5ac8c1c896339ee8d412a00
/app/src/main/java/com/bwie/dagger2app/CarModule.java
b30109f02a006aefbbdb6414eafc184295f0a2c8
[]
no_license
liqy/Dagger2App
2eb532bceafb9aadeb4fc810361b6b434c0b0c4a
e85601f368c4bd9855fc5798b062d6219d02125f
refs/heads/master
2021-01-22T10:18:22.904222
2017-09-04T08:23:18
2017-09-04T08:23:18
102,337,113
0
0
null
null
null
null
UTF-8
Java
false
false
322
java
package com.bwie.dagger2app; import javax.inject.Singleton; import dagger.Module; import dagger.Provides; /** * Created by liqy on 2017/9/4. */ @Module public class CarModule { public CarModule() { } @CarScope @Provides Engine provideEngine(){ return new Engine("保时捷"); } }
cd3bfeada259414ed30e805be1ca4e8f7da2ba5e
cf52a51c79ce3ad079b98a232983d0d06683fd2f
/src/main/scala/array/EmployeeImportance.java
39e2bba09c09e676ae29c76169e1cefd05a736d9
[ "MIT" ]
permissive
JYInMyHeart/leetcode
7e22201308dca672123c54db0fd42b753f7f82a5
05e9e0f97310d701803a45d309c677d8c14c95af
refs/heads/master
2020-03-25T13:48:33.062116
2020-02-07T11:38:14
2020-02-07T11:38:14
143,843,846
3
0
null
2018-08-15T06:38:32
2018-08-07T08:33:14
Scala
UTF-8
Java
false
false
1,146
java
package array; import java.util.List; /* // Employee info class Employee { // It's the unique id of each node; // unique id of this employee public int id; // the importance value of this employee public int importance; // the id of direct subordinates public List<Integer> subordinates; }; */ public class EmployeeImportance { public int getImportance(List<Employee> employees, int id) { int ans = 0; List<Integer> subEmployees = null; for(Employee e:employees){ if(id == e.id){ ans = e.importance; subEmployees = e.subordinates; break; } } if(subEmployees == null) return 0; for(int i:subEmployees){ ans += getImportance(employees,i); } return ans; } class Employee { // It's the unique id of each node; // unique id of this employee public int id; // the importance value of this employee public int importance; // the id of direct subordinates public List<Integer> subordinates; } }
a3737f93939f6df2d1bed137795dbf9ccfb168ea
37b9e3283d63032f06a28c74a73d157dc1b73d89
/web-app/src/main/java/org/wso2/iot/weatherstation/portal/InvokerController.java
0718f04d5a9251baffd6f6594d59c49f96cccf5a
[]
no_license
lashanfaliq95/FarmMonitor
cf3ade951b3eab41728c052c4752612758237cb6
b6ba3b5b0c111586e9b7e564f520f461783d15ce
refs/heads/master
2021-01-24T17:06:21.768693
2018-03-02T11:43:51
2018-03-02T11:43:51
123,226,415
0
1
null
null
null
null
UTF-8
Java
false
false
9,355
java
/* * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * * WSO2 Inc. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except * in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.wso2.iot.weatherstation.portal; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.http.HttpResponse; import org.apache.http.client.methods.HttpDelete; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.client.methods.HttpPut; import org.apache.http.client.methods.HttpRequestBase; import org.apache.http.conn.ssl.SSLConnectionSocketFactory; import org.apache.http.conn.ssl.SSLContextBuilder; import org.apache.http.conn.ssl.TrustSelfSignedStrategy; import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.security.KeyManagementException; import java.security.KeyStoreException; import java.security.NoSuchAlgorithmException; import static org.wso2.iot.weatherstation.portal.LoginController.ATTR_ACCESS_TOKEN; import static org.wso2.iot.weatherstation.portal.LoginController.ATTR_ENCODED_CLIENT_APP; import static org.wso2.iot.weatherstation.portal.LoginController.ATTR_REFRESH_TOKEN; public class InvokerController extends HttpServlet { private static final Log log = LogFactory.getLog(LoginController.class); @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { HttpSession session = req.getSession(false); if (session == null || session.getAttribute(ATTR_ACCESS_TOKEN) == null) { resp.sendError(401, "Unauthorized, Access token not found in the session"); return; } Object accessTokenObj = session.getAttribute(ATTR_ACCESS_TOKEN); String uri = req.getParameter("uri"); String method = req.getParameter("method"); String payload = req.getParameter("payload"); String contentType = req.getParameter("content-type"); if (uri == null || method == null) { resp.sendError(400, "Bad Request, uri or method not found"); return; } if (contentType == null || contentType.isEmpty()) contentType = ContentType.APPLICATION_JSON.toString(); uri = getServletContext().getInitParameter("deviceMgtEndpoint") + uri; HttpRequestBase executor = null; if ("GET".equalsIgnoreCase(method)) { executor = new HttpGet(uri); } else if ("POST".equalsIgnoreCase(method)) { executor = new HttpPost(uri); StringEntity payloadEntity = new StringEntity(payload, ContentType.create(contentType)); ((HttpPost) executor).setEntity(payloadEntity); } else if ("PUT".equalsIgnoreCase(method)) { executor = new HttpPut(uri); StringEntity payloadEntity = new StringEntity(payload, ContentType.create(contentType)); ((HttpPut) executor).setEntity(payloadEntity); } else if ("DELETE".equalsIgnoreCase(method)) { executor = new HttpDelete(uri); } else { resp.sendError(400, "Bad Request, method not supported"); return; } String accessToken = accessTokenObj.toString(); executor.setHeader("Authorization", "Bearer " + accessToken); String result = execute(executor, req, resp); if (result != null && !result.isEmpty()) resp.getWriter().write(result); } private String execute(HttpRequestBase executor, HttpServletRequest req, HttpServletResponse resp) throws IOException { return execute(executor, req, resp, 5); } private String execute(HttpRequestBase executor, HttpServletRequest req, HttpServletResponse resp, int retryCount) throws IOException { if (retryCount == 0) { resp.sendError(500, "Internal Server Error, unable to retrieve access token with refresh token"); } CloseableHttpClient client = null; try { client = getHTTPClient(); } catch (LoginException e) { resp.sendError(500, "Internal Server Error"); return null; } HttpResponse response = client.execute(executor); BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent(), "UTF8")); StringBuilder resultBuffer = new StringBuilder(); String line = ""; while ((line = rd.readLine()) != null) { resultBuffer.append(line); } String result = resultBuffer.toString(); if (response.getStatusLine().getStatusCode() == 401) { if (result.equals("Access token expired") || result.equals( "Invalid input. Access token validation failed")) { refreshToken(req, resp); execute(executor, req, resp, --retryCount); } } rd.close(); return result; } private void refreshToken(HttpServletRequest req, HttpServletResponse resp) throws IOException { log.debug("refreshing the token"); HttpPost tokenEndpoint = new HttpPost(getServletContext().getInitParameter("tokenEndpoint")); HttpSession session = req.getSession(false); StringEntity tokenEndpointPayload = new StringEntity( "grant_type=refresh_token&refresh_token=" + session.getAttribute("refreshToken") + "&scope=PRODUCTION", ContentType.APPLICATION_FORM_URLENCODED); tokenEndpoint.setEntity(tokenEndpointPayload); String encodedClientApp = req.getSession().getAttribute(ATTR_ENCODED_CLIENT_APP).toString(); tokenEndpoint.setHeader("Authorization", "Basic " + encodedClientApp); tokenEndpoint.setHeader("Content-Type", ContentType.APPLICATION_FORM_URLENCODED.toString()); CloseableHttpClient client = null; try { client = getHTTPClient(); } catch (LoginException e) { resp.sendError(500, "Internal Server Error"); return; } HttpResponse response = client.execute(tokenEndpoint); BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent(), "UTF8")); StringBuilder resultBuffer = new StringBuilder(); String line = ""; while ((line = rd.readLine()) != null) { resultBuffer.append(line); } String tokenResult = resultBuffer.toString(); if (response.getStatusLine().getStatusCode() == 200) { try { JSONParser jsonParser = new JSONParser(); JSONObject jTokenResult = (JSONObject) jsonParser.parse(tokenResult); String refreshToken = jTokenResult.get("refresh_token").toString(); String accessToken = jTokenResult.get("access_token").toString(); //String scope = jTokenResult.get("scope").toString(); session.setAttribute(ATTR_ACCESS_TOKEN, accessToken); session.setAttribute(ATTR_REFRESH_TOKEN, refreshToken); } catch (ParseException e) { log.error("Error while parsing refresh token response", e); resp.sendError(500, "Internal Server Error"); } } else { log.error("Error while parsing refresh token response, Token EP response : " + response.getStatusLine().getStatusCode()); resp.sendError(500, "Internal Server Error"); } rd.close(); } private CloseableHttpClient getHTTPClient() throws LoginException { SSLContextBuilder builder = new SSLContextBuilder(); try { builder.loadTrustMaterial(null, new TrustSelfSignedStrategy()); SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory( builder.build()); return HttpClients.custom().setSSLSocketFactory( sslsf).build(); } catch (NoSuchAlgorithmException | KeyStoreException | KeyManagementException e) { log.error(e.getMessage(), e); throw new LoginException("Error occurred while retrieving http client", e); } } }
d5d4b9e7ecbd9bf0fc05c4d2b1d655383fb2a58a
3aed10918f9233746ef0fe424179f97f2a13d0a4
/04_voogasalad/PubSub.java
af39e0ecf0fc925dc3b00c79fdf8332c2ff2788e
[ "MIT" ]
permissive
ramilmsh-archive/cs308_portfolio
aa3a8b72b74b800fe559f895047b30f788d6d555
3c7b0c285e1c8edc7a093b8345a4514ea72b1f38
refs/heads/master
2020-07-01T15:22:55.500321
2019-08-16T11:57:27
2019-08-16T11:57:27
201,209,856
0
0
null
null
null
null
UTF-8
Java
false
false
4,122
java
package util.pubsub; import util.pubsub.messages.Message; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.Properties; import java.util.function.Consumer; import java.util.function.Function; /** * Class that implements publish/subscribe pattern * * @author ramilmsh */ public class PubSub { private static PubSub instance; private HashMap<String, ArrayList<Consumer<Message>>> callbacks; private HashMap<String, Function<Message, Object>> callbacksSync; private HashMap<String, Class> channels; /** * Create a new instance of PubSub */ public PubSub(Properties config) { channels = new HashMap<>(); for (String name : config.stringPropertyNames()) { try { channels.put(name.toLowerCase(), Class.forName(config.getProperty(name))); } catch (ClassNotFoundException ignored) {} } callbacks = new HashMap<>(); callbacksSync = new HashMap<>(); } /** * Subscribe to a synchronous pubsub * * @param channel: pubsub * @param callback: callback that processes message */ public void subscribe(String channel, Consumer<Message> callback) { channel = channel.toLowerCase(); if (!channels.containsKey(channel)) return; if (!callbacks.containsKey(channel)) callbacks.put(channel, new ArrayList<>()); callbacks.get(channel).add(callback); } /** * Unsubscribe from an async channel * * @param channel: channel name * @param callback: callback to be removed */ public void unsubscribe(String channel, Consumer<Message> callback) { channel = channel.toLowerCase(); if (callbacks != null && callbacks.containsKey(channel)) callbacks.get(channel).remove(callback); } /** * Unsubscribe from a sync channel * * @param channel: channel name */ public void unsubscribeSync(String channel) { channel = channel.toLowerCase(); if (callbacksSync != null && callbacksSync.containsKey(channel)) callbacks.put(channel, null); } /** * Subscribe to a synchronous pubsub * * @param channel: pubsub * @param callback: callback that processes message */ public void subscribeSync(String channel, Function<Message, Object> callback) { channel = channel.toLowerCase(); if (!channels.containsKey(channel)) return; callbacksSync.put(channel, callback); } /** * Publish to an asynchronous pubsub * * @param channel: pubsub * @param msg: message */ public void publish(String channel, Message msg) { channel = channel.toLowerCase(); if (!(channels.containsKey(channel) && channels.get(channel).equals(msg.getClass()) && callbacks.containsKey(channel))) return; for (Consumer<Message> callback : callbacks.get(channel)) if (callback != null) callback.accept(msg); } /** * Publish to a synchronous pubsub * * @param channel: pubsub * @param msg: message * @return result of processing */ public Object publishSync(String channel, Message msg) { channel = channel.toLowerCase(); if (!(channels.containsKey(channel) && channels.get(channel).equals(msg.getClass()) && callbacks.containsKey(channel))) return null; return callbacksSync.get(channel).apply(msg); } /** * Singleton pattern for pubsub * * @return singleton instance of PubSub */ public static PubSub getInstance() { if (instance == null) try { Properties properties = new Properties(); properties.load(PubSub.class.getResourceAsStream("global.properties")); instance = new PubSub(properties); } catch (IOException e) { return null; } return instance; } }
49de6439f767053ae9c040a03d41dccf58dd1fa7
d0da699f050075f43304f65007d3cd15102e020b
/src/main/java/beans/ItemBean.java
c8e0b98fe3a42141a4556f2acc55e5235c236028
[]
no_license
xstelmah/roulette
1f00cabed0f29c71d96f01b705614091bd62fc8d
f359425496d8caf26fc78b34008e6a1ca91bd3dd
refs/heads/master
2021-01-21T12:59:20.841473
2016-05-13T17:53:08
2016-05-13T17:53:08
51,173,822
0
0
null
null
null
null
UTF-8
Java
false
false
2,547
java
package beans; import model.Game; import model.Item; import model.ItemRarity; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import service.dao.ItemService; import javax.faces.bean.ManagedBean; import javax.faces.bean.ManagedProperty; import javax.faces.bean.SessionScoped; import java.io.Serializable; import java.util.List; @ManagedBean(name = "itemBean") @SessionScoped public class ItemBean implements Serializable { private static final Logger LOG = LoggerFactory.getLogger(ItemBean.class); @ManagedProperty(value = "#{itemService}") private ItemService itemService; @ManagedProperty(value = "#{userBean}") private UserBean userBean; private Integer itemId; public ItemBean() { } private Integer countItemByRarity(ItemRarity rarity) { if (userBean == null || userBean.getUser() == null || userBean.getUser().getGames() == null) { return null; } Integer value = 0; List<Game> games = userBean.getUser().getGames(); for (Game game : games) { Item item = game.getItem(); if (item == null) return null; if (item.getRarity() == rarity) { value++; } } return value; } public Integer countItemByRarityCommon() { return countItemByRarity(ItemRarity.COMMON); } public Integer countItemByRarityUncommon() { return countItemByRarity(ItemRarity.UNCOMMON); } public Integer countItemByRarityRare() { return countItemByRarity(ItemRarity.RARE); } public Integer countItemByRarityMythical() { return countItemByRarity(ItemRarity.MYTHICAL); } public Integer countItemByRarityImmortal() { return countItemByRarity(ItemRarity.IMMORTAL); } public Integer countItemByRarityLegendary() { return countItemByRarity(ItemRarity.LEGENDARY); } public Integer countItemByRarityArcana() { return countItemByRarity(ItemRarity.ARCANA); } public Integer getItemId() { return itemId; } public void setItemId(Integer itemId) { this.itemId = itemId; } public ItemService getItemService() { return itemService; } public void setItemService(ItemService itemService) { this.itemService = itemService; } public void setUserBean(UserBean userBean) { this.userBean = userBean; } }
3446110e2622f0651cf2a9624e1be80905054a62
b6a6bf57dfe824d70bb4adf90e7cc8706f8d6fc1
/WiffleWeb/src/main/java/gov/nia/nrs/domain/Government.java
65d6eee27def2c2c465ae02ad181c136f3671b3f
[]
no_license
kangpond/WiffleWeb
4e686d5e65684b5de8b1c60ff836040aec43e6d0
c09ff98205ebf6d666afa410c383f51f3b98b9c6
refs/heads/home
2021-05-03T17:02:23.363498
2016-10-27T16:55:58
2016-10-27T16:55:58
72,024,524
0
0
null
2016-10-27T16:55:59
2016-10-26T16:53:41
null
UTF-8
Java
false
false
4,488
java
package gov.nia.nrs.domain; import java.util.Date; /** * Government */ public class Government implements java.io.Serializable { private static final long serialVersionUID = 1L; private String deptId; private String deptName; private String deptLevel; private String parentDeptId; private String revokeMark; private String effectiveDate; private String revokeDate; private String mainUserId; private String maintainFunctionId; private String maintainHost; private Date lastUpdateTime; private String deleteFlag; private String createDate; private String createTime; private String createUserId; private String address; public Government() { } public Government(String deptId, String deptName, String deptLevel, String parentDeptId, String mainUserId, String maintainFunctionId, String maintainHost, Date lastUpdateTime, String deleteFlag) { this.deptId = deptId; this.deptName = deptName; this.deptLevel = deptLevel; this.parentDeptId = parentDeptId; this.mainUserId = mainUserId; this.maintainFunctionId = maintainFunctionId; this.maintainHost = maintainHost; this.lastUpdateTime = lastUpdateTime; this.deleteFlag = deleteFlag; } public Government(String deptId, String deptName, String deptLevel, String parentDeptId, String revokeMark, String effectiveDate, String revokeDate, String mainUserId, String maintainFunctionId, String maintainHost, Date lastUpdateTime, String deleteFlag, String createDate, String createTime, String createUserId, String address) { this.deptId = deptId; this.deptName = deptName; this.deptLevel = deptLevel; this.parentDeptId = parentDeptId; this.revokeMark = revokeMark; this.effectiveDate = effectiveDate; this.revokeDate = revokeDate; this.mainUserId = mainUserId; this.maintainFunctionId = maintainFunctionId; this.maintainHost = maintainHost; this.lastUpdateTime = lastUpdateTime; this.deleteFlag = deleteFlag; this.createDate = createDate; this.createTime = createTime; this.createUserId = createUserId; this.address = address; } public String getDeptId() { return this.deptId; } public void setDeptId(String deptId) { this.deptId = deptId; } public String getDeptName() { return this.deptName; } public void setDeptName(String deptName) { this.deptName = deptName; } public String getDeptLevel() { return this.deptLevel; } public void setDeptLevel(String deptLevel) { this.deptLevel = deptLevel; } public String getParentDeptId() { return this.parentDeptId; } public void setParentDeptId(String parentDeptId) { this.parentDeptId = parentDeptId; } public String getRevokeMark() { return this.revokeMark; } public void setRevokeMark(String revokeMark) { this.revokeMark = revokeMark; } public String getEffectiveDate() { return this.effectiveDate; } public void setEffectiveDate(String effectiveDate) { this.effectiveDate = effectiveDate; } public String getRevokeDate() { return this.revokeDate; } public void setRevokeDate(String revokeDate) { this.revokeDate = revokeDate; } public String getMainUserId() { return this.mainUserId; } public void setMainUserId(String mainUserId) { this.mainUserId = mainUserId; } public String getMaintainFunctionId() { return this.maintainFunctionId; } public void setMaintainFunctionId(String maintainFunctionId) { this.maintainFunctionId = maintainFunctionId; } public String getMaintainHost() { return this.maintainHost; } public void setMaintainHost(String maintainHost) { this.maintainHost = maintainHost; } public Date getLastUpdateTime() { return this.lastUpdateTime; } public void setLastUpdateTime(Date lastUpdateTime) { this.lastUpdateTime = lastUpdateTime; } public String getDeleteFlag() { return this.deleteFlag; } public void setDeleteFlag(String deleteFlag) { this.deleteFlag = deleteFlag; } public String getCreateDate() { return this.createDate; } public void setCreateDate(String createDate) { this.createDate = createDate; } public String getCreateTime() { return this.createTime; } public void setCreateTime(String createTime) { this.createTime = createTime; } public String getCreateUserId() { return this.createUserId; } public void setCreateUserId(String createUserId) { this.createUserId = createUserId; } public String getAddress() { return this.address; } public void setAddress(String address) { this.address = address; } }
07010981fa9885fb1095581f6ba7f7402bdd8efd
73aba12ff6518614b7a5a620008fb1ba019ab8ce
/src/main/java/com/squareup/connect/models/V1RetrieveEmployeeRequest.java
31d7dccbfe63dc14bccc7122581c1833356cf0a3
[ "Apache-2.0" ]
permissive
square/connect-java-sdk
569668bf6459e9c4e1dbf27a0cea2071d4aebf5d
2d88b9c6233979f8123058567e425b9ea9d70fcc
refs/heads/master
2023-06-15T09:24:49.347250
2019-12-17T20:31:14
2019-12-17T20:31:14
85,248,752
45
23
Apache-2.0
2021-01-20T22:25:44
2017-03-16T22:54:55
Java
UTF-8
Java
false
false
1,262
java
/* * Square Connect API * Client library for accessing the Square Connect APIs * * OpenAPI spec version: 2.0 * Contact: [email protected] * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ package com.squareup.connect.models; import java.util.Objects; import io.swagger.annotations.ApiModel; /** * */ @ApiModel(description = "") public class V1RetrieveEmployeeRequest { @Override public boolean equals(java.lang.Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } return true; } @Override public int hashCode() { return Objects.hash(); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class V1RetrieveEmployeeRequest {\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(java.lang.Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } }
2b3c46cecfa5d77e8c6fa996c05f73c26feb2db1
7437161598e0df42ab061959eb0ba93e746089dc
/app/src/main/java/com/suji/lj/myapplication/Adapters/RecyclerViewDivider.java
c23a77bca4ee38520d92407246f373e22fe0cb2b
[]
no_license
bishop130/practice
5b1c623699cbb55d3e5d6545fb3dd1e21d249f91
a4787a0b92e7bfdcdb11986b2dd72b4e06053eda
refs/heads/master
2022-12-14T02:42:14.448336
2020-09-17T15:43:13
2020-09-17T15:43:13
115,410,016
0
0
null
null
null
null
UTF-8
Java
false
false
643
java
package com.suji.lj.myapplication.Adapters; import android.graphics.Rect; import android.view.View; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; public class RecyclerViewDivider extends RecyclerView.ItemDecoration{ private final int divHeight; public RecyclerViewDivider(int divHeight) { this.divHeight = divHeight; } @Override public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) { super.getItemOffsets(outRect, view, parent, state); outRect.top = divHeight; } }
7bdb0dea158b041fa36bd74ecca62bb6091e597a
7dd9440c9830e40d6b99ce1cde0550a5731c2408
/7.JDBCorm/src/hibernateexe/src/main/java/org/perscholas/util/HibernateUtil.java
73bda9617f8b14a61502e284dcd547e765852667
[]
no_license
imjesska/perScholas
6461c4c2adb3158f03bc88187c55e7133958ab68
1a19284d332d80cc6d10a46ad9d9194b65aa70b1
refs/heads/main
2023-04-28T10:58:55.197807
2021-05-12T21:31:15
2021-05-12T21:31:15
348,874,064
0
0
null
null
null
null
UTF-8
Java
false
false
1,118
java
package org.perscholas.util; import org.hibernate.SessionFactory; import org.hibernate.boot.registry.StandardServiceRegistryBuilder; import org.hibernate.cfg.Configuration; import org.hibernate.service.ServiceRegistry; import org.perscholas.models.Employee; import java.io.File; public class HibernateUtil { private static SessionFactory sessionFactory; public static SessionFactory getSessionFactory() { if (sessionFactory == null) { // loads configuration and mappings Configuration configuration = new Configuration().configure(new File("src/main/resources/hibernate.cfg.xml")); configuration.addAnnotatedClass(org.perscholas.models.Employee.class); ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder() .applySettings(configuration.getProperties()).build(); // builds a session factory from the service registry sessionFactory = configuration.buildSessionFactory(serviceRegistry); } return sessionFactory; } }
70340ede092d4ea430be1943d8d4b51383bf34f7
0286a55cf4512500bec5cc48d2d559eb92dad88c
/app/src/main/java/com/fangzuo/assist/Activity/DBActivity.java
72117a0e0e3acb73f70a6ad3182be12e852bb4b6
[]
no_license
pe4ch/KingdeePDAstandard
e58a1a9f1376b22911a551b45ebc5662390b0bcd
380f3c76994106819e8e1ebd0a9c0b2f526c5427
refs/heads/master
2020-09-05T04:27:14.660743
2019-09-26T01:37:39
2019-09-26T01:37:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
59,536
java
package com.fangzuo.assist.Activity; import android.app.AlertDialog; import android.app.DatePickerDialog; import android.app.ProgressDialog; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.util.Log; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.View; import android.widget.AdapterView; import android.widget.Button; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.DatePicker; import android.widget.EditText; import android.widget.ListView; import android.widget.RelativeLayout; import android.widget.Spinner; import android.widget.TextView; import com.fangzuo.assist.ABase.BaseActivity; import com.fangzuo.assist.Adapter.DepartmentSpAdapter; import com.fangzuo.assist.Adapter.EmployeeSpAdapter; import com.fangzuo.assist.Adapter.PiciSpAdapter; import com.fangzuo.assist.Adapter.ProductselectAdapter; import com.fangzuo.assist.Adapter.ProductselectAdapter1; import com.fangzuo.assist.Adapter.StorageSpAdapter; import com.fangzuo.assist.Adapter.UnitSpAdapter; import com.fangzuo.assist.Adapter.WaveHouseSpAdapter; import com.fangzuo.assist.Beans.CommonResponse; import com.fangzuo.assist.Beans.DownloadReturnBean; import com.fangzuo.assist.Beans.EventBusEvent.ClassEvent; import com.fangzuo.assist.Beans.GetBatchNoBean; import com.fangzuo.assist.Beans.InStoreNumBean; import com.fangzuo.assist.Beans.PurchaseInStoreUploadBean; import com.fangzuo.assist.Dao.BarCode; import com.fangzuo.assist.Dao.Department; import com.fangzuo.assist.Dao.Employee; import com.fangzuo.assist.Dao.InStorageNum; import com.fangzuo.assist.Dao.Product; import com.fangzuo.assist.Dao.Storage; import com.fangzuo.assist.Dao.T_Detail; import com.fangzuo.assist.Dao.T_main; import com.fangzuo.assist.Dao.Unit; import com.fangzuo.assist.Dao.WaveHouse; import com.fangzuo.assist.R; import com.fangzuo.assist.Service.DataService; import com.fangzuo.assist.Utils.Asynchttp; import com.fangzuo.assist.Utils.BasicShareUtil; import com.fangzuo.assist.Utils.CommonMethod; import com.fangzuo.assist.Utils.CommonUtil; import com.fangzuo.assist.Utils.Config; import com.fangzuo.assist.Utils.DataModel; import com.fangzuo.assist.Utils.EventBusInfoCode; import com.fangzuo.assist.Utils.GreenDaoManager; import com.fangzuo.assist.Utils.Info; import com.fangzuo.assist.Utils.Lg; import com.fangzuo.assist.Utils.MathUtil; import com.fangzuo.assist.Utils.MediaPlayer; import com.fangzuo.assist.Utils.ShareUtil; import com.fangzuo.assist.Utils.Toast; import com.fangzuo.assist.Utils.WebApi; import com.fangzuo.assist.widget.LoadingUtil; import com.fangzuo.assist.widget.MyWaveHouseSpinner; import com.fangzuo.assist.widget.SpinnerDepartMent; import com.fangzuo.assist.widget.SpinnerPeople; import com.fangzuo.assist.widget.SpinnerUnit; import com.fangzuo.assist.zxing.CustomCaptureActivity; import com.fangzuo.assist.zxing.activity.CaptureActivity; import com.fangzuo.greendao.gen.BarCodeDao; import com.fangzuo.greendao.gen.DaoSession; import com.fangzuo.greendao.gen.InStorageNumDao; import com.fangzuo.greendao.gen.ProductDao; import com.fangzuo.greendao.gen.T_DetailDao; import com.fangzuo.greendao.gen.T_mainDao; import com.google.gson.Gson; import com.google.zxing.integration.android.IntentIntegrator; import com.journeyapps.barcodescanner.BarcodeResult; import com.loopj.android.http.AsyncHttpClient; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.List; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; public class DBActivity extends BaseActivity { int activity = Config.DBActivity; @BindView(R.id.sp_storage_out) Spinner spStorageOut; @BindView(R.id.sp_wavehouse_out) MyWaveHouseSpinner spWavehouseOut; @BindView(R.id.sp_storage_in) Spinner spStorageIn; @BindView(R.id.sp_wavehouse_in) Spinner spWavehouseIn; @BindView(R.id.scanbyCamera) RelativeLayout scanbyCamera; @BindView(R.id.ed_code) EditText edCode; @BindView(R.id.search) RelativeLayout search; @BindView(R.id.tv_goodName) TextView tvGoodName; @BindView(R.id.tv_numoutStore) TextView tvNumoutStore; @BindView(R.id.tv_numinStore) TextView tvNuminStore; @BindView(R.id.tv_model) TextView tvModel; @BindView(R.id.ed_pihao) EditText edPihao; @BindView(R.id.sp_unit) SpinnerUnit spUnit; @BindView(R.id.ed_num) EditText edNum; @BindView(R.id.btn_add) Button btnAdd; @BindView(R.id.btn_finishorder) Button btnFinishorder; @BindView(R.id.btn_backorder) Button btnBackorder; @BindView(R.id.btn_checkorder) Button btnCheckorder; @BindView(R.id.tv_date) TextView tvDate; @BindView(R.id.sp_department) SpinnerDepartMent spDepartment; @BindView(R.id.sp_employee) SpinnerPeople spEmployee; @BindView(R.id.sp_sign_person) SpinnerPeople spSignPerson; @BindView(R.id.sp_capture_person) SpinnerPeople spCapturePerson; @BindView(R.id.cb_isStorage) CheckBox cbIsStorage; @BindView(R.id.ishebing) CheckBox ishebing; @BindView(R.id.isAutoAdd) CheckBox isAutoAdd; @BindView(R.id.sp_pihao) Spinner spPihao; private ShareUtil share; private CommonMethod method; private long ordercode; private EmployeeSpAdapter employeeAdapter; private StorageSpAdapter storageSpinner; private List<Product> products; private boolean fBatchManager = false; private UnitSpAdapter unitAdapter; // private PiciSpAdapter piciSpAdapter; private String pihao; // private String unitId; // private String unitName; // private double unitrate; private String instorageName; private String instorageId; private WaveHouseSpAdapter inwavehouseAdapter; private String outstorageName; private String outstorageId; private WaveHouseSpAdapter outwavehouseAdapter; private String inwavehouseID; private String inwavehouseName; private String outwavehouseID; private String outwavehouseName; private String date; // private String captureName; // private String captureId; // private String yanshouName; // private String yanshouId; private DepartmentSpAdapter departMentAdapter; private boolean isHebing = true; // private String departmentId; // private String departmentName; // public static final int DB = 12385; // private String employeename; // private String employeeId; // private T_mainDao t_mainDao; // private T_DetailDao t_detailDao; private boolean isGetDefaultStorage; private ProductselectAdapter1 productselectAdapter1; private Product product; private ProductselectAdapter productselectAdapter; private DecimalFormat df; private boolean isAuto; private String default_unitID; private double qty; private Storage storageIn; private Storage storageOut; private PiciSpAdapter piciSpAdapter; private boolean checkStorage = false; // 0不允许负库存false 1允许负库存出库true private String wavehouseAutoString = ""; private DBActivity mContext; @Override protected void initView() { setContentView(R.layout.activity_db); mContext = this; ButterKnife.bind(this); edPihao.setEnabled(false); ishebing.setChecked(isHebing); df = new DecimalFormat("######0.00"); share = ShareUtil.getInstance(mContext); isAuto = share.getDBisAuto(); isGetDefaultStorage = share.getBoolean(Info.Storage + activity); cbIsStorage.setChecked(isGetDefaultStorage); } @Override protected boolean isRegisterEventBus() { return true; } @Override protected void receiveEvent(ClassEvent event) { switch (event.Msg) { case EventBusInfoCode.ScanResult:// BarcodeResult res = (BarcodeResult) event.postEvent; OnReceive(res.getResult().getText()); break; case EventBusInfoCode.PRODUCTRETURN: product = (Product) event.postEvent; setDATA("", true); break; } } @Override protected void initData() { isAutoAdd.setChecked(share.getDBisAuto()); tvDate.setText(getTime(true)); method = CommonMethod.getMethod(mContext); // if (share.getDBOrderCode() == 0) { // ordercode = Long.parseLong(getTime(false) + "001"); // Log.e("ordercode", ordercode + ""); // share.setDBOrderCode(ordercode); // } else { // ordercode = share.getDBOrderCode(); // Log.e("ordercode", ordercode + ""); // } ordercode = CommonUtil.createOrderCode(this); loadBasicData(); } @Override protected void initListener() { btnBackorder.setOnClickListener(new NoDoubleClickListener() { @Override protected void onNoDoubleClick(View view) { if (DataModel.checkHasDetail(mContext, activity)) { // btnBackorder.setClickable(false); // LoadingUtil.show(mContext, "正在回单..."); // upload(); UpLoadActivity.start(mContext,activity); } else { Toast.showText(mContext, "无单据信息"); } } }); ishebing.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean b) { isHebing = b; } }); isAutoAdd.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean b) { isAuto = b; share.setDBisAuto(b); } }); cbIsStorage.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean b) { isGetDefaultStorage = b; share.setBooleam(Info.Storage + activity, b); } }); // edPihao.setOnEditorActionListener(new TextView.OnEditorActionListener() { // @Override // public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) { // if (i == 0 && keyEvent.getAction() == KeyEvent.ACTION_DOWN) { // getInstorageNum(product); // getOutstorageNum(product); // // } // return true; // } // }); spPihao.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { InStorageNum inStorageNum = (InStorageNum) piciSpAdapter.getItem(i); pihao = inStorageNum.FBatchNo; getInstorageNum(product); } @Override public void onNothingSelected(AdapterView<?> adapterView) { } }); edCode.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) { if (i == 0 && keyEvent.getAction() == KeyEvent.ACTION_DOWN) { setDATA(edCode.getText().toString(), false); setfocus(edCode); } return true; } }); spStorageIn.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { storageIn = (Storage) storageSpinner.getItem(i); instorageName = storageIn.FName; instorageId = storageIn.FItemID; inwavehouseID = "0"; Log.e("仓库入", storageIn.toString()); inwavehouseAdapter = method.getWaveHouseAdapter(storageIn, spWavehouseIn); getInstorageNum(product); } @Override public void onNothingSelected(AdapterView<?> adapterView) { } }); spStorageOut.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { storageOut = (Storage) storageSpinner.getItem(i); Log.e("仓库出", storageOut.toString()); if ("1".equals(storageOut.FUnderStock)) { checkStorage = true; } else { checkStorage = false; } outstorageName = storageOut.FName; outstorageId = storageOut.FItemID; outwavehouseID = "0"; getPici(); getOutstorageNum(product); // outwavehouseAdapter = method.getWaveHouseAdapter(storageOut, spWavehouseOut); spWavehouseOut.setAuto(mContext, storageOut, wavehouseAutoString); } @Override public void onNothingSelected(AdapterView<?> adapterView) { } }); spWavehouseIn.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { WaveHouse waveHouse = (WaveHouse) inwavehouseAdapter.getItem(i); inwavehouseID = waveHouse.FSPID; inwavehouseName = waveHouse.FName; Log.e("wavehouseName", inwavehouseName); getInstorageNum(product); } @Override public void onNothingSelected(AdapterView<?> adapterView) { } }); spWavehouseOut.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { WaveHouse waveHouse = (WaveHouse) spWavehouseOut.getAdapter().getItem(i); outwavehouseID = waveHouse.FSPID; outwavehouseName = waveHouse.FName; Log.e("wavehouseName", outwavehouseName); getOutstorageNum(product); } @Override public void onNothingSelected(AdapterView<?> adapterView) { } }); // spUnit.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { // @Override // public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { // Unit unit = (Unit) spUnit.getAdapter().getItem(i); // if (unit != null) { // unitId = unit.FMeasureUnitID; // unitName = unit.FName; // unitrate = MathUtil.toD(unit.FCoefficient); // Log.e("1111", unitrate + ""); // } // // } // // @Override // public void onNothingSelected(AdapterView<?> adapterView) { // // } // }); // spSignPerson.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { // @Override // public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { // Employee employee = (Employee) employeeAdapter.getItem(i); // yanshouName = employee.FName; // yanshouId = employee.FItemID; //// share.setDBSignPerson(i); // if (isFirst5){ // share.setDBSignPerson(i); // spSignPerson.setSelection(i); // } // else{ // spSignPerson.setSelection(share.getDBSignPerson()); // isFirst5=true; // } // } // // @Override // public void onNothingSelected(AdapterView<?> adapterView) { // // } // }); // spDepartment.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { // @Override // public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { // Department department = (Department) departMentAdapter.getItem(i); // departmentId = department.FItemID; // departmentName = department.FName; //// share.setDBDepartment(i); // if (isFirst){ // share.setDBDepartment(i); // spDepartment.setSelection(i); // } // else{ // spDepartment.setSelection(share.getDBDepartment()); // isFirst=true; // } // } // // @Override // public void onNothingSelected(AdapterView<?> adapterView) { // // } // }); // spCapturePerson.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { // @Override // public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { // Employee employee = (Employee) employeeAdapter.getItem(i); // captureName = employee.FName; // captureId = employee.FItemID; //// share.setDBcapturePerson(i); // if (isFirst2){ // share.setDBcapturePerson(i); // spCapturePerson.setSelection(i); // } // else{ // spCapturePerson.setSelection(share.getDBcapturePerson()); // isFirst2=true; // } // } // // @Override // public void onNothingSelected(AdapterView<?> adapterView) { // // } // }); // spEmployee.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { // @Override // public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { // Employee employee = (Employee) employeeAdapter.getItem(i); // employeename = employee.FName; // employeeId = employee.FItemID; //// share.setDBEmployee(i); // if (isFirst3){ // share.setDBEmployee(i); // spEmployee.setSelection(i); // } // else{ // spEmployee.setSelection(share.getDBEmployee()); // isFirst3=true; // } // } // // @Override // public void onNothingSelected(AdapterView<?> adapterView) { // // } // }); } @Override protected void OnReceive(String code) { // if (edNum.getText().toString().equals("")){ // setfocus(edNum); // return; // } // if (isAuto){ // Addorder(); // }else{ // edCode.setText(code); // setDATA(code, false); // } if (edPihao.hasFocus()) { edPihao.setText(code); if (isAuto) { Addorder(); } else if (edNum.getText().toString().equals("")) { setfocus(edNum); } } else { edCode.setText(code); setDATA(code, false); } } private void loadBasicData() { storageSpinner = method.getStorageSpinner(spStorageOut); method.getStorageSpinner(spStorageIn); spCapturePerson.setAutoSelection(getString(R.string.spCapturePerson_db), ""); spEmployee.setAutoSelection(getString(R.string.spEmployee_db), ""); spSignPerson.setAutoSelection(getString(R.string.spSignPerson_db), ""); spDepartment.setAutoSelection(getString(R.string.spDepartment_db), ""); // employeeAdapter = method.getEmployeeAdapter(spCapturePerson); // method.getEmployeeAdapter(spEmployee); // method.getEmployeeAdapter(spSignPerson); // departMentAdapter = method.getDepartMentAdapter(spDepartment); // spSignPerson.setSelection(share.getDBSignPerson()); // spDepartment.setSelection(share.getDBDepartment()); // spEmployee.setSelection(share.getDBEmployee()); } @OnClick({R.id.scanbyCamera, R.id.search, R.id.btn_add, R.id.btn_finishorder, R.id.btn_checkorder, R.id.tv_date}) public void onViewClicked(View view) { switch (view.getId()) { case R.id.scanbyCamera: IntentIntegrator intentIntegrator = new IntentIntegrator(mContext); // 设置自定义扫描Activity intentIntegrator.setCaptureActivity(CustomCaptureActivity.class); intentIntegrator.initiateScan(); // Intent in = new Intent(mContext, CaptureActivity.class); // startActivityForResult(in, 0); break; case R.id.search: Log.e("search", "onclick"); Bundle b = new Bundle(); b.putString("search", edCode.getText().toString()); b.putInt("where", Info.SEARCHPRODUCT); startNewActivityForResult(ProductSearchActivity.class, R.anim.activity_open, 0, Info.SEARCHFORRESULT, b); break; case R.id.btn_add: Addorder(); break; case R.id.btn_finishorder: finishOrder(); break; case R.id.btn_checkorder: Bundle b1 = new Bundle(); b1.putInt("activity", activity); startNewActivity(TableActivity.class, R.anim.activity_fade_in, R.anim.activity_fade_out, false, b1); break; case R.id.tv_date: datePicker(tvDate); break; } } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { Log.e("code", requestCode + "" + " " + resultCode); if (requestCode == 0) { if (resultCode == RESULT_OK) { Bundle b = data.getExtras(); String message = b.getString("result"); OnReceive(message); // edCode.setText(message); // Toast.showText(mContext, message); // edCode.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_ENTER)); } } } private void setDATA(String fnumber, boolean flag) { default_unitID = null; // edPihao.setText(""); getPici(); if (flag) { default_unitID = product.FUnitID; tvorisAuto(product); } else { BarCodeDao barCodeDao = daoSession.getBarCodeDao(); final ProductDao productDao = daoSession.getProductDao(); if (BasicShareUtil.getInstance(mContext).getIsOL()) { Asynchttp.post(mContext, getBaseUrl() + WebApi.SEARCHPRODUCTS, fnumber, new Asynchttp.Response() { @Override public void onSucceed(CommonResponse cBean, AsyncHttpClient client) { final DownloadReturnBean dBean = new Gson().fromJson(cBean.returnJson, DownloadReturnBean.class); if (dBean.products.size() == 1) { getProductOL(dBean, 0); default_unitID = dBean.products.get(0).FUnitID; // chooseUnit(default_unitID); } else if (dBean.products.size() > 1) { AlertDialog.Builder ab = new AlertDialog.Builder(mContext); ab.setTitle("请选择物料"); View v = LayoutInflater.from(mContext).inflate(R.layout.pd_alert, null); ListView lv = v.findViewById(R.id.lv_alert); productselectAdapter1 = new ProductselectAdapter1(mContext, dBean.products); lv.setAdapter(productselectAdapter1); ab.setView(v); final AlertDialog alertDialog = ab.create(); alertDialog.show(); lv.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { getProductOL(dBean, i); default_unitID = dBean.products.get(i).FUnitID; // chooseUnit(default_unitID); alertDialog.dismiss(); } }); } } @Override public void onFailed(String Msg, AsyncHttpClient client) { Toast.showText(mContext, Msg); } }); } else { final List<BarCode> barCodes = barCodeDao.queryBuilder().where(BarCodeDao.Properties.FBarCode.eq(fnumber)).build().list(); if (barCodes.size() > 0) { if (barCodes.size() == 1) { products = productDao.queryBuilder().where(ProductDao.Properties.FItemID.eq(barCodes.get(0).FItemID)).build().list(); default_unitID = barCodes.get(0).FUnitID; getProductOFL(products); } else { AlertDialog.Builder ab = new AlertDialog.Builder(mContext); ab.setTitle("请选择物料"); View v = LayoutInflater.from(mContext).inflate(R.layout.pd_alert, null); ListView lv = v.findViewById(R.id.lv_alert); productselectAdapter = new ProductselectAdapter(mContext, barCodes); lv.setAdapter(productselectAdapter); ab.setView(v); final AlertDialog alertDialog = ab.create(); alertDialog.show(); lv.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { BarCode barCode = (BarCode) productselectAdapter.getItem(i); products = productDao.queryBuilder().where(ProductDao.Properties.FItemID.eq(barCode.FItemID)).build().list(); default_unitID = barCode.FUnitID; getProductOFL(products); alertDialog.dismiss(); } }); } } else { MediaPlayer.getInstance(mContext).error(); Toast.showText(mContext, "未找到条码"); } } } } // //定位到指定单位 // private void chooseUnit(final String unitId){ // if (unitId != null && !"".equals(unitId)) { // new Handler().postDelayed(new Runnable() { // @Override // public void run() { // for (int i = 0; i < unitAdapter.getCount(); i++) { // if (unitId.equals(((Unit) unitAdapter.getItem(i)).FMeasureUnitID)) { // spUnit.setSelection(i); // Log.e(TAG,"定位了单位:"+((Unit) unitAdapter.getItem(i)).toString()); // } // } // } // }, 100); // } // } private void getProductOFL(List<Product> list) { if (list != null && list.size() > 0) { product = list.get(0); Lg.e("物料offline:" + product.toString()); tvorisAuto(product); } else { Toast.showText(mContext, "未找到物料"); edCode.setText(""); setfocus(edCode); edPihao.setEnabled(false); } } private void getProductOL(DownloadReturnBean dBean, int j) { product = dBean.products.get(j); Lg.e("物料online:" + product.toString()); tvorisAuto(product); } private void tvorisAuto(final Product product) { try { Lg.e("物料:" + product.toString()); edCode.setText(product.FNumber); tvModel.setText(product.FModel); tvGoodName.setText(product.FName); wavehouseAutoString = product.FSPID; if ((product.FBatchManager) != null && (product.FBatchManager).equals("1")) { fBatchManager = true; setfocus(edPihao); spPihao.setEnabled(true); edPihao.setEnabled(true); } else { spPihao.setEnabled(false); edPihao.setEnabled(false); fBatchManager = false; } if (isGetDefaultStorage) { for (int j = 0; j < storageSpinner.getCount(); j++) { if (((Storage) storageSpinner.getItem(j)).FItemID.equals(product.FDefaultLoc)) { spStorageOut.setSelection(j); break; } } new Handler().postDelayed(new Runnable() { @Override public void run() { spWavehouseOut.setAuto(mContext, storageOut, wavehouseAutoString); // for (int j = 0; j < waveHouseAdapter.getCount(); j++) { // if (((WaveHouse) waveHouseAdapter.getItem(j)).FSPID.equals(product.FSPID)) { // spWavehouse.setSelection(j); // break; // } // } } }, 50); } spUnit.setAuto(mContext, product.FUnitGroupID, default_unitID, SpinnerUnit.Id); // unitAdapter = CommonMethod.getMethod(mContext).getUnitAdapter(product.FUnitGroupID, spUnit); // chooseUnit(default_unitID); // if (default_unitID != null) { // for (int i = 0; i < unitAdapter.getCount(); i++) { // if (default_unitID.equals(((Unit) unitAdapter.getItem(i)).FMeasureUnitID)) { // spUnit.setSelection(i); // } // } // } new Handler().postDelayed(new Runnable() { @Override public void run() { getOutstorageNum(product); getInstorageNum(product); } }, 100); if (isAuto) { edNum.setText("1.0"); } // if ((isAuto && !fBatchManager) || (isAuto && fBatchManager && !edPihao.getText().toString().equals(""))) { if ((isAuto && !fBatchManager) || (isAuto && fBatchManager && !"".equals(pihao))) { // if ((isAuto && !fBatchManager) || (isAuto && fBatchManager)) { new Handler().postDelayed(new Runnable() { @Override public void run() { Addorder(); } }, 150); } else { edNum.setText("1.0"); setfocus(edPihao); } } catch (Exception e) { DataService.pushError(mContext, this.getClass().getSimpleName(), e); } } private void getInstorageNum(Product product) { if (product != null) { if (fBatchManager) { // pihao = edPihao.getText().toString(); if (pihao.equals("")) { pihao = ""; } } else { pihao = ""; } if (inwavehouseID == null) { inwavehouseID = "0"; } if (BasicShareUtil.getInstance(mContext).getIsOL()) { InStoreNumBean iBean = new InStoreNumBean(); iBean.FStockPlaceID = inwavehouseID; iBean.FBatchNo = pihao; iBean.FStockID = instorageId; iBean.FItemID = product.FItemID; String json = new Gson().toJson(iBean); Log.e("inStorenum", json); Asynchttp.post(mContext, getBaseUrl() + WebApi.GETINSTORENUM, json, new Asynchttp.Response() { @Override public void onSucceed(CommonResponse cBean, AsyncHttpClient client) { double inQty = MathUtil.toD(cBean.returnJson); tvNuminStore.setText((inQty / spUnit.getDataUnitrate()) + ""); Log.e("inQty", inQty + " " + spUnit.getDataUnitrate()); } @Override public void onFailed(String Msg, AsyncHttpClient client) { tvNuminStore.setText("0"); } }); } else { InStorageNumDao inStorageNumDao = daoSession.getInStorageNumDao(); List<InStorageNum> list1 = inStorageNumDao.queryBuilder().where( InStorageNumDao.Properties.FItemID.eq(product.FItemID), InStorageNumDao.Properties.FStockID.eq(instorageId), InStorageNumDao.Properties.FStockPlaceID.eq(inwavehouseID), InStorageNumDao.Properties.FBatchNo.eq(pihao) ).build().list(); if (list1.size() > 0) { Log.e("FQty", list1.get(0).FQty); Double inQty = MathUtil.toD(list1.get(0).FQty); Log.e("qty", qty + ""); if (inQty > 0) { tvNuminStore.setText((inQty / spUnit.getDataUnitrate()) + ""); } else { tvNuminStore.setText((0.0) + ""); } } else { tvNuminStore.setText("0"); } } } } private void getOutstorageNum(Product product) { if (product == null) { return; } if (fBatchManager) { // pihao = edPihao.getText().toString(); if (pihao == null || pihao.equals("")) { pihao = ""; } } else { pihao = ""; } // if (outwavehouseID == null) { // outwavehouseID = "0"; // } if (BasicShareUtil.getInstance(mContext).getIsOL()) { InStoreNumBean iBean = new InStoreNumBean(); iBean.FStockPlaceID = spWavehouseOut.getWaveHouseId(); iBean.FBatchNo = pihao; iBean.FStockID = outstorageId; iBean.FItemID = product.FItemID; String json = new Gson().toJson(iBean); Log.e("inStorenum", json); Asynchttp.post(mContext, getBaseUrl() + WebApi.GETINSTORENUM, json, new Asynchttp.Response() { @Override public void onSucceed(CommonResponse cBean, AsyncHttpClient client) { qty = MathUtil.toD(cBean.returnJson); Log.e("QTY", qty + " " + spUnit.getDataUnitrate()); // tvNumoutStore.setText((qty / unitrate) + ""); tvNumoutStore.setText(dealStoreNumForOut((qty / spUnit.getDataUnitrate()) + "")); qty = MathUtil.toD(dealStoreNumForOut(qty + "")); } @Override public void onFailed(String Msg, AsyncHttpClient client) { tvNumoutStore.setText("0"); } }); } else { InStorageNumDao inStorageNumDao = daoSession.getInStorageNumDao(); List<InStorageNum> list1 = inStorageNumDao.queryBuilder().where( InStorageNumDao.Properties.FItemID.eq(product.FItemID), InStorageNumDao.Properties.FStockID.eq(outstorageId), InStorageNumDao.Properties.FStockPlaceID.eq(spWavehouseOut.getWaveHouseId()), InStorageNumDao.Properties.FBatchNo.eq(pihao) ).build().list(); if (list1.size() > 0) { Log.e("FQty", list1.get(0).FQty); qty = MathUtil.toD(list1.get(0).FQty); Log.e("qty", qty + ""); if (qty > 0) { tvNumoutStore.setText((qty / spUnit.getDataUnitrate()) + ""); } else { tvNuminStore.setText((0.0) + ""); } } else { tvNumoutStore.setText("0"); } } } //处理网络库存与已添加的本地库存数量问题 private String dealStoreNumForOut(String num) { if (null==product)return num; if (null==outstorageId)return num; List<T_Detail> list1 = t_detailDao.queryBuilder().where( T_DetailDao.Properties.FProductId.eq(product.FItemID), T_DetailDao.Properties.FoutStorageid.eq(outstorageId) ).build().list(); List<T_Detail> list = new ArrayList<>(); list.addAll(list1); if (!"".equals(pihao)) { for (T_Detail bean : list) { if (!pihao.equals(bean.FBatch)) { list1.remove(bean); } } } if (!"".equals(spWavehouseOut.getWaveHouseId())) { for (T_Detail bean : list) { if (!spWavehouseOut.getWaveHouseId().equals(bean.Foutwavehouseid)) { list1.remove(bean); } } } if (list1.size() > 0) { double qty = 0; for (int i = 0; i < list1.size(); i++) { qty += MathUtil.toD(list1.get(i).FQuantity); } Lg.e("本地:FQty:" + qty); return MathUtil.toD(num) - qty + ""; } else { return num; } } //获取批次,根据调出仓库 private void getPici() { List<InStorageNum> container1 = new ArrayList<>(); piciSpAdapter = new PiciSpAdapter(mContext, container1); spPihao.setAdapter(piciSpAdapter); if (product == null) { return; } if (fBatchManager) { spPihao.setEnabled(true); if (!BasicShareUtil.getInstance(mContext).getIsOL()) { piciSpAdapter = CommonMethod.getMethod(mContext).getPici(storageOut, spWavehouseOut.getWaveHouseId(), product, spPihao); } else { final List<InStorageNum> container = new ArrayList<>(); GetBatchNoBean bean = new GetBatchNoBean(); bean.ProductID = product.FItemID; bean.StorageID = outstorageId; bean.WaveHouseID = spWavehouseOut.getWaveHouseId(); String json = new Gson().toJson(bean); Log.e(TAG, "getPici批次提交:" + json); Asynchttp.post(mContext, getBaseUrl() + WebApi.GETPICI, json, new Asynchttp.Response() { @Override public void onSucceed(CommonResponse cBean, AsyncHttpClient client) { Log.e(TAG, "getPici获取数据:" + cBean.returnJson); DownloadReturnBean dBean = new Gson().fromJson(cBean.returnJson, DownloadReturnBean.class); if (dBean.InstorageNum != null) { for (int i = 0; i < dBean.InstorageNum.size(); i++) { if (dBean.InstorageNum.get(i).FQty != null && MathUtil.toD(dBean.InstorageNum.get(i).FQty) > 0) { Log.e(TAG, "有库存的批次:" + dBean.InstorageNum.get(i).toString()); container.add(dBean.InstorageNum.get(i)); } } piciSpAdapter = new PiciSpAdapter(mContext, container); spPihao.setAdapter(piciSpAdapter); } piciSpAdapter.notifyDataSetChanged(); } @Override public void onFailed(String Msg, AsyncHttpClient client) { Log.e(TAG, "getPici获取数据错误:" + Msg); Toast.showText(mContext, Msg); } }); } } else { spPihao.setEnabled(false); } } private void Addorder() { try { String discount = "0"; if (inwavehouseID == null) { inwavehouseID = "0"; } // if (outwavehouseID == null) { // outwavehouseID = "0"; // } String num = edNum.getText().toString(); String num1 = edNum.getText().toString(); if ("".equals(edCode.getText().toString())) { Toast.showText(mContext, "请输入物料编号"); MediaPlayer.getInstance(mContext).error(); return; } if ("".equals(edNum.getText().toString())) { Toast.showText(mContext, "请输入数量"); MediaPlayer.getInstance(mContext).error(); return; } if (fBatchManager && pihao.equals("")) { Toast.showText(mContext, "请输入批次号"); MediaPlayer.getInstance(mContext).error(); return; } if (outstorageId.equals(instorageId)) { Toast.showText(mContext, "大兄弟,你太闲了,搬进去搬出来不累么"); MediaPlayer.getInstance(mContext).error(); return; } //是否开启库存管理 true,开启允许负库存 if (!checkStorage) { // if (qty < MathUtil.toD(num)) { if (MathUtil.toD(tvNumoutStore.getText().toString()) < MathUtil.toD(num)) { MediaPlayer.getInstance(mContext).error(); Toast.showText(mContext, "大兄弟 库存不够了"); return; } } if (isHebing) { List<T_Detail> detailhebing = t_detailDao.queryBuilder().where( T_DetailDao.Properties.Activity.eq(activity), T_DetailDao.Properties.FOrderId.eq(ordercode), T_DetailDao.Properties.FProductId.eq(product.FItemID), // T_DetailDao.Properties.FBatch.eq(edPihao.getText().toString()), T_DetailDao.Properties.FBatch.eq(pihao), T_DetailDao.Properties.FUnitId.eq(spUnit.getDataId()), T_DetailDao.Properties.FStorageId.eq(instorageId), T_DetailDao.Properties.FPositionId.eq(inwavehouseID), T_DetailDao.Properties.FDiscount.eq(discount), T_DetailDao.Properties.FoutStorageid.eq(outstorageId), T_DetailDao.Properties.Foutwavehouseid.eq(spWavehouseOut.getWaveHouseId()) ).build().list(); if (detailhebing.size() > 0) { for (int i = 0; i < detailhebing.size(); i++) { num = (MathUtil.toD(num) + MathUtil.toD(detailhebing.get(i).FQuantity)) + ""; t_detailDao.delete(detailhebing.get(i)); } } } List<T_main> dewlete = t_mainDao.queryBuilder().where(T_mainDao.Properties.OrderId.eq(ordercode)).build().list(); t_mainDao.deleteInTx(dewlete); String second = getTimesecond(); T_main t_main = new T_main(); t_main.FDepartment = spDepartment.getDataName(); t_main.FDepartmentId = spDepartment.getDataId(); t_main.FIndex = second; t_main.FPaymentDate = ""; t_main.orderId = ordercode; t_main.orderDate = share.getPROISdate(); t_main.FPurchaseUnit = spUnit.getDataName(); t_main.FMaker = share.getUserName(); t_main.FMakerId = share.getsetUserID(); t_main.FDirector = spSignPerson.getEmployeeName(); t_main.FDirectorId = spSignPerson.getEmployeeId(); t_main.saleWay = ""; t_main.FDeliveryAddress = ""; t_main.FRemark = ""; t_main.saleWayId = ""; t_main.FCustody = spCapturePerson.getEmployeeName(); t_main.FCustodyId = spCapturePerson.getEmployeeId(); t_main.FAcount = spEmployee.getEmployeeName(); t_main.FAcountID = spEmployee.getEmployeeId(); t_main.FSalesMan = spEmployee.getEmployeeName(); t_main.FSalesManId = spEmployee.getEmployeeId(); t_main.Rem = ""; t_main.FRedBlue = "0"; t_main.supplier = ""; t_main.supplierId = ""; t_main.FSendOutId = ""; t_main.sourceOrderTypeId = ""; t_main.activity = activity; T_Detail t_detail = new T_Detail(); // t_detail.FBatch = edPihao.getText().toString(); t_detail.FBatch = pihao; t_detail.FOrderId = ordercode; t_detail.FProductCode = edCode.getText().toString(); t_detail.FProductId = product.FItemID; t_detail.model = product.FModel; t_detail.FProductName = product.FName; t_detail.FIndex = second; t_detail.FUnitId = spUnit.getDataId(); t_detail.FUnit = spUnit.getDataName(); t_detail.FStorage = instorageName == null ? "" : instorageName; t_detail.FStorageId = instorageId == null ? "0" : instorageId; t_detail.FPosition = inwavehouseName == null ? "" : inwavehouseName; t_detail.FPositionId = inwavehouseID == null ? "0" : inwavehouseID; t_detail.FoutStorageid = outstorageId == null ? "0" : outstorageId; t_detail.FoutStoragename = outstorageName == null ? "" : outstorageName; t_detail.Foutwavehouseid = spWavehouseOut.getWaveHouseId(); t_detail.Foutwavehousename = spWavehouseOut.getWaveHouse(); t_detail.activity = activity; t_detail.FDiscount = discount; t_detail.FQuantity = num; t_detail.unitrate = spUnit.getDataUnitrate(); t_detail.FTaxUnitPrice = ""; if (!BasicShareUtil.getInstance(mContext).getIsOL()) { long insert1 = t_mainDao.insert(t_main); long insert = t_detailDao.insert(t_detail); if (insert1 > 0 && insert > 0) { MediaPlayer.getInstance(mContext).ok(); Toast.showText(mContext, "添加成功"); InStorageNumDao inStorageNumDao = daoSession.getInStorageNumDao(); List<InStorageNum> outnum = inStorageNumDao.queryBuilder().where( // InStorageNumDao.Properties.FBatchNo.eq(edPihao.getText().toString()), InStorageNumDao.Properties.FBatchNo.eq(pihao), InStorageNumDao.Properties.FStockID.eq(outstorageId), InStorageNumDao.Properties.FStockPlaceID.eq(spWavehouseOut.getWaveHouseId()), InStorageNumDao.Properties.FItemID.eq(product.FItemID)).build().list(); if (outnum.size() > 0) { if (checkStorage) { outnum.get(0).FQty = String.valueOf(((MathUtil.toD(outnum.get(0).FQty) + (MathUtil.toD("-" + edNum.getText().toString()))))); } else { Log.e("innum", outnum.get(0).FQty); Log.e("innum", outnum.size() + ""); outnum.get(0).FQty = (MathUtil.toD(outnum.get(0).FQty) - MathUtil.toD(edNum.getText().toString())) + ""; // outnum.get(0).FQty = (MathUtil.toD(outnum.get(0).FQty) + (MathUtil.toD(edNum.getText().toString()) / unitrate)) + ""; } inStorageNumDao.update(outnum.get(0)); } else { InStorageNum inStorageNum = new InStorageNum(); inStorageNum.FItemID = product.FItemID; inStorageNum.FBatchNo = edPihao.getText().toString(); inStorageNum.FStockPlaceID = spWavehouseOut.getWaveHouseId(); inStorageNum.FStockID = outstorageId == null ? "0" : outstorageId; inStorageNum.FQty = (MathUtil.toD("-" + edNum.getText().toString()) * spUnit.getDataUnitrate()) + ""; inStorageNumDao.insert(inStorageNum); } // outnum.get(0).FQty = (MathUtil.toD(outnum.get(0).FQty) - MathUtil.toD(edNum.getText().toString())) + ""; inStorageNumDao.update(outnum.get(0)); List<InStorageNum> innum = inStorageNumDao.queryBuilder().where( // InStorageNumDao.Properties.FBatchNo.eq(edPihao.getText().toString()), InStorageNumDao.Properties.FBatchNo.eq(pihao), InStorageNumDao.Properties.FStockID.eq(instorageId == null ? "0" : instorageId), InStorageNumDao.Properties.FStockPlaceID.eq(inwavehouseID == null ? "0" : inwavehouseID), InStorageNumDao.Properties.FItemID.eq(product.FItemID) ).build().list(); if (innum.size() > 0) { Log.e("innum", innum.get(0).FQty); Log.e("innum", innum.size() + ""); innum.get(0).FQty = (MathUtil.toD(innum.get(0).FQty) + (MathUtil.toD(edNum.getText().toString()) / spUnit.getDataUnitrate())) + ""; inStorageNumDao.update(innum.get(0)); } else { Log.e("InStorageNum", num1); InStorageNum i = new InStorageNum(); i.FQty = edNum.getText().toString(); i.FItemID = product.FItemID; // i.FBatchNo = edPihao.getText().toString(); i.FBatchNo = pihao; i.FStockID = instorageId; i.FStockPlaceID = inwavehouseID == null ? "0" : inwavehouseID; inStorageNumDao.insert(i); } resetAll(); } else { Toast.showText(mContext, "添加失败,请重试"); MediaPlayer.getInstance(mContext).error(); } } else { MediaPlayer.getInstance(mContext).ok(); long insert1 = t_mainDao.insert(t_main); long insert = t_detailDao.insert(t_detail); Toast.showText(mContext, "添加成功"); resetAll(); } } catch (Exception e) { DataService.pushError(mContext, this.getClass().getSimpleName(), e); } } @Override public void onBackPressed() { AlertDialog.Builder ab = new AlertDialog.Builder(mContext); ab.setTitle("确认退出"); ab.setMessage("退出会自动执行完单,是否退出?"); ab.setPositiveButton("确定", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { ordercode++; Log.e("ordercode", ordercode + ""); share.setOrderCode(DBActivity.this, ordercode); finish(); } }); ab.setNegativeButton("取消", null); ab.create().show(); } public void finishOrder() { AlertDialog.Builder ab = new AlertDialog.Builder(mContext); ab.setTitle("确认使用完单"); ab.setMessage("确认?"); ab.setPositiveButton("确定", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { ordercode++; Log.e("ordercode", ordercode + ""); share.setOrderCode(DBActivity.this, ordercode); } }); ab.setNegativeButton("取消", null); ab.create().show(); } private void upload() { PurchaseInStoreUploadBean pBean = new PurchaseInStoreUploadBean(); PurchaseInStoreUploadBean.purchaseInStore puBean = pBean.new purchaseInStore(); t_mainDao = daoSession.getT_mainDao(); t_detailDao = daoSession.getT_DetailDao(); ArrayList<String> detailContainer = new ArrayList<>(); ArrayList<PurchaseInStoreUploadBean.purchaseInStore> data = new ArrayList<>(); List<T_main> mains = t_mainDao.queryBuilder().where(T_mainDao.Properties.Activity.eq(activity)).build().list(); for (int i = 0; i < mains.size(); i++) { if (i > 0 && mains.get(i).orderId == mains.get(i - 1).orderId) { } else { detailContainer = new ArrayList<>(); puBean = pBean.new purchaseInStore(); String main; String detail = ""; T_main t_main = mains.get(i); main = t_main.FMakerId + "|" + t_main.orderDate + "|" + t_main.FDepartmentId + "|" + t_main.FSalesManId + "|" + t_main.FCustodyId + "|" + t_main.FDirectorId + "|"; puBean.main = main; List<T_Detail> details = t_detailDao.queryBuilder().where( T_DetailDao.Properties.FOrderId.eq(t_main.orderId), T_DetailDao.Properties.Activity.eq(activity) ).build().list(); for (int j = 0; j < details.size(); j++) { if (j != 0 && j % 49 == 0) { Log.e("j%49", j % 49 + ""); T_Detail t_detail = details.get(j); detail = detail + t_detail.FProductId + "|" + t_detail.FUnitId + "|" + t_detail.FQuantity + "|" + t_detail.FStorageId + "|" + t_detail.FoutStorageid + "|" + t_detail.FPositionId + "|" + t_detail.Foutwavehouseid + "|" + t_detail.FBatch + "|" ; detail = detail.subSequence(0, detail.length() - 1).toString(); detailContainer.add(detail); detail = ""; } else { Log.e("j", j + ""); Log.e("details.size()", details.size() + ""); T_Detail t_detail = details.get(j); detail = detail + t_detail.FProductId + "|" + t_detail.FUnitId + "|" + t_detail.FQuantity + "|" + t_detail.FStorageId + "|" + t_detail.FoutStorageid + "|" + t_detail.FPositionId + "|" + t_detail.Foutwavehouseid + "|" + t_detail.FBatch + "|"; Log.e("detail1", detail); } } if (detail.length() > 0) { detail = detail.subSequence(0, detail.length() - 1).toString(); } Log.e("detail", detail); detailContainer.add(detail); puBean.detail = detailContainer; data.add(puBean); } } postToServer(data); } private void postToServer(ArrayList<PurchaseInStoreUploadBean.purchaseInStore> data) { PurchaseInStoreUploadBean pBean = new PurchaseInStoreUploadBean(); pBean.list = data; Gson gson = new Gson(); Asynchttp.post(mContext, getBaseUrl() + WebApi.DBUPLOAD, gson.toJson(pBean), new Asynchttp.Response() { @Override public void onSucceed(CommonResponse cBean, AsyncHttpClient client) { Toast.showText(mContext, "上传成功"); MediaPlayer.getInstance(mContext).ok(); List<T_Detail> list = t_detailDao.queryBuilder().where( T_DetailDao.Properties.Activity.eq(activity) ).build().list(); List<T_main> list1 = t_mainDao.queryBuilder().where( T_mainDao.Properties.Activity.eq(activity) ).build().list(); for (int i = 0; i < list.size(); i++) { t_detailDao.delete(list.get(i)); } for (int i = 0; i < list1.size(); i++) { t_mainDao.delete(list1.get(i)); } btnBackorder.setClickable(true); LoadingUtil.dismiss(); } @Override public void onFailed(String Msg, AsyncHttpClient client) { Toast.showText(mContext, Msg); btnBackorder.setClickable(true); MediaPlayer.getInstance(mContext).ok(); LoadingUtil.dismiss(); } }); } private void resetAll() { qty = 0.0; edNum.setText(""); edPihao.setText(""); edCode.setText(""); tvNumoutStore.setText(""); tvNuminStore.setText(""); tvGoodName.setText(""); tvModel.setText(""); List<InStorageNum> container = new ArrayList<>(); piciSpAdapter = new PiciSpAdapter(mContext, container); spPihao.setAdapter(piciSpAdapter); setfocus(edCode); } //用于adpater首次更新时,不存入默认值,而是选中之前的选项 private boolean isFirst = false; private boolean isFirst2 = false; private boolean isFirst3 = false; private boolean isFirst4 = false; private boolean isFirst5 = false; private boolean isFirst6 = false; private boolean isFirst7 = false; }
f12094136d956e486299bd67fb32549aa0560145
5f27294f93fe6b9b49f5a495f90667d9046fc0b1
/com.jyh.threadtest/src/ReentrantLock/MyService.java
fad6887a03db53fd73dfdcda8270cfa571da1e30
[]
no_license
JiangCookie/Thread
edfa2bad480ea400b5b52340e86edefcc78cc140
fefa2e7ef0ee8a9b7edbe5cff693b0c47c916391
refs/heads/master
2020-03-22T03:39:52.054739
2018-07-10T01:35:42
2018-07-10T01:35:42
139,444,597
0
0
null
null
null
null
GB18030
Java
false
false
522
java
package ReentrantLock; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; /** * ReentrantLock同步测试 * @author jiang *调用ReentrantLock对象的lock()方法获取锁,调用unlock()方法释放锁 */ public class MyService { private Lock lock=new ReentrantLock(); public void testMethod(){ lock.lock(); for(int i=0;i<5;i++){ System.out.println("ThreadName="+Thread.currentThread().getName()+(" "+(i+1))); } lock.unlock(); } }
6cd6008556893b615c5b7190a231f69bd7f67ba6
9dfcfa4e59161a0dd7bc67d93dc410e2003a4853
/examples/quarkusnew.java
04a3063e5248c63255307a8956ed402322e8e35e
[ "MIT" ]
permissive
zemiak/jbang
8411f1724cc3ddf3872d38b06996d87ab56a564b
722e93332f76c40ddedc4aec2dd519822d95d8e5
refs/heads/master
2022-12-14T23:20:03.743670
2020-09-10T20:44:57
2020-09-19T16:23:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
823
java
//usr/bin/env jbang "$0" "$@" ; exit $? //REPOS xamdk=https://xam.dk/maven //DEPS io.quarkus:quarkus-resteasy:999-SNAPSHOT //DEPS io.quarkus:quarkus-smallrye-openapi:999-SNAPSHOT //DEPS io.quarkus:quarkus-swagger-ui:999-SNAPSHOT //DEPS io.quarkus:quarkus-openshift:999-SNAPSHOT //JAVA_OPTIONS -Djava.util.logging.manager=org.jboss.logmanager.LogManager //Q:CONFIG quarkus.swagger-ui.always-include=true //Q:CONFIG quarkus.kubernetes.deploy=true import io.quarkus.runtime.Quarkus; import javax.enterprise.context.ApplicationScoped; import javax.ws.rs.GET; import javax.ws.rs.Path; @Path("/hello") @ApplicationScoped public class quarkus { @GET public String sayHello() { return "hello from Quarkus with jbang.dev"; } public static void main(String[] args) { Quarkus.run(args); } }
feb77dfcc4e5db0024db3921cc0bb9a8effbf859
3c1ea9b3024601fa668866732b1ed5eb235adcfa
/app/src/androidTest/java/com/example/phonepay/ExampleInstrumentedTest.java
5e3ba901bfc5c1de8ce39ad8433d1ba3b78b90c0
[]
no_license
manav-mygate/PhonePay
471f764ff7c72ca96a5da127f0ebd23d846e5e2a
50c6a69aa3785e7375e332628c46e0849d2089de
refs/heads/master
2022-04-03T09:21:36.069083
2020-02-15T08:56:34
2020-02-15T08:56:34
240,673,296
0
0
null
null
null
null
UTF-8
Java
false
false
756
java
package com.example.phonepay; import android.content.Context; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); assertEquals("com.example.phonepay", appContext.getPackageName()); } }
9289386e36539bbc79d8b8763af94674dbb24e95
6a1c6071959da82cd89bc0725aca1004cf3ea9d6
/src/main/java/com/madzialenka/schoolmanagement/service/impl/SchoolServiceImpl.java
69b02e44553c44f860f70bfca7a4be16db10e93e
[]
no_license
Madzialenka/school-management
56ac10e131061110a99060c7058cf3de900e2154
80809cb20eba9c25ba1ffd5ef7bbce9b5e9239eb
refs/heads/master
2023-04-01T15:38:43.985236
2021-04-05T10:44:31
2021-04-05T14:49:56
321,398,366
2
0
null
null
null
null
UTF-8
Java
false
false
9,082
java
package com.madzialenka.schoolmanagement.service.impl; import com.madzialenka.schoolmanagement.api.dto.*; import com.madzialenka.schoolmanagement.db.entity.School; import com.madzialenka.schoolmanagement.db.entity.SchoolSubject; import com.madzialenka.schoolmanagement.db.entity.Student; import com.madzialenka.schoolmanagement.db.projection.SchoolSubjectCountProjection; import com.madzialenka.schoolmanagement.db.projection.SchoolSubjectGradesMeanProjection; import com.madzialenka.schoolmanagement.db.repository.SchoolRepository; import com.madzialenka.schoolmanagement.db.repository.SchoolSubjectRepository; import com.madzialenka.schoolmanagement.db.repository.StudentRepository; import com.madzialenka.schoolmanagement.exception.SchoolNotFoundException; import com.madzialenka.schoolmanagement.mapper.StudentResponseDTOMapper; import com.madzialenka.schoolmanagement.service.SchoolService; import lombok.RequiredArgsConstructor; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Sort; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.List; import java.util.Optional; import java.util.stream.Collectors; @Transactional @RequiredArgsConstructor @Service public class SchoolServiceImpl implements SchoolService { private static final String DEFAULT_SORT_BY = "id"; private static final Sort.Direction DEFAULT_SORT_DIRECTION = Sort.Direction.ASC; private static final int DEFAULT_PAGE_NUMBER = 0; private static final int DEFAULT_PAGE_SIZE = 1; private final SchoolRepository schoolRepository; private final SchoolSubjectRepository schoolSubjectRepository; private final StudentRepository studentRepository; private final StudentResponseDTOMapper studentResponseDTOMapper; @Override public SchoolResponseDTO createSchool(SchoolDataRequestDTO requestDTO) { School school = new School(); School savedSchool = updateAndSaveSchoolData(requestDTO, school); List<SchoolSubject> schoolSubjects = requestDTO.getSubjects().stream() .map(subjectRequestDTO -> createSchoolSubject(savedSchool, subjectRequestDTO)) .collect(Collectors.toList()); List<SchoolSubject> savedSubjects = schoolSubjectRepository.saveAll(schoolSubjects); return createSchoolResponseDTO(savedSchool, savedSubjects); } @Override public PageResponseDTO<SchoolResponseDTO> getSchools(String sortBy, Sort.Direction direction, Integer pageNumber, Integer pageSize) { sortBy = Optional.ofNullable(sortBy).orElse(DEFAULT_SORT_BY); direction = Optional.ofNullable(direction).orElse(DEFAULT_SORT_DIRECTION); pageNumber = Optional.ofNullable(pageNumber).orElse(DEFAULT_PAGE_NUMBER); pageSize = Optional.ofNullable(pageSize).orElse(DEFAULT_PAGE_SIZE); PageRequest pageable = PageRequest.of(pageNumber, pageSize, Sort.by(direction, sortBy)); Page<School> schools = schoolRepository.findAll(pageable); List<SchoolResponseDTO> elements = schools.getContent().stream() .map(school -> createSchoolResponseDTO(school, school.getSubjects())) .collect(Collectors.toList()); return createPageResponseDTO(schools, elements); } @Override public SchoolResponseDTO updateSchool(Long id, SchoolSimpleDataRequestDTO requestDTO) { School foundSchool = getSchoolById(id); updateSchool(requestDTO, foundSchool); School savedSchool = schoolRepository.save(foundSchool); return createSchoolResponseDTO(savedSchool, savedSchool.getSubjects()); } @Override public void deleteSchool(Long id) { School foundSchool = getSchoolById(id); schoolRepository.delete(foundSchool); } @Override public SchoolSubjectsGradesMeanResponseDTO getSchoolSubjectsGradesMean(Long id) { validateSchoolExistence(id); List<SchoolSubjectGradesMeanProjection> projections = schoolRepository.getSchoolSubjectsGradesMean(id); List<SchoolSubjectGradesMeanDTO> means = projections.stream() .map(this::createSchoolSubjectGradesMeanDTO) .collect(Collectors.toList()); return new SchoolSubjectsGradesMeanResponseDTO(means); } @Override public List<StudentResponseDTO> getBestStudents(Long id, Long limit) { validateSchoolExistence(id); List<Long> bestStudentsIds = schoolRepository.getBestStudentsIds(id, limit); List<Student> students = studentRepository.findAllByIdAndSortByBestGradesMean(bestStudentsIds); return students.stream() .map(studentResponseDTOMapper::map) .collect(Collectors.toList()); } @Override public List<StudentResponseDTO> getWorstStudents(Long id, Long limit) { validateSchoolExistence(id); List<Long> worstStudentsIds = schoolRepository.getWorstStudentsIds(id, limit); List<Student> students = studentRepository.findAllByIdAndSortByWorstGradesMean(worstStudentsIds); return students.stream() .map(studentResponseDTOMapper::map) .collect(Collectors.toList()); } @Override public SchoolSubjectCountSummaryResponseDTO getSchoolSubjectCountSummary(Long limit) { List<SchoolSubjectCountProjection> projections = schoolRepository.getSchoolSubjectCount(limit); List<SchoolSubjectCountDTO> subjectCounts = projections.stream() .map(this::createSchoolSubjectCountDTO) .collect(Collectors.toList()); return new SchoolSubjectCountSummaryResponseDTO(subjectCounts); } private SchoolSubjectCountDTO createSchoolSubjectCountDTO(SchoolSubjectCountProjection projection) { SchoolSubjectCountDTO dto = new SchoolSubjectCountDTO(); dto.setSubjectName(projection.getSubjectName()); dto.setCount(projection.getCount()); return dto; } private PageResponseDTO<SchoolResponseDTO> createPageResponseDTO(Page<School> schools, List<SchoolResponseDTO> elements) { return PageResponseDTO.<SchoolResponseDTO>builder() .elements(elements) .pageNumber(schools.getNumber()) .pageSize(schools.getSize()) .numberOfPages(schools.getTotalPages()) .numberOfElements(schools.getTotalElements()) .build(); } private SchoolSubjectGradesMeanDTO createSchoolSubjectGradesMeanDTO(SchoolSubjectGradesMeanProjection projection) { SchoolSubjectGradesMeanDTO dto = new SchoolSubjectGradesMeanDTO(); dto.setSchoolSubjectId(projection.getSchoolSubjectId()); dto.setMean(projection.getMean()); return dto; } private School getSchoolById(Long id) { return schoolRepository.findById(id).orElseThrow(() -> new SchoolNotFoundException(id)); } private void updateSchool(SchoolSimpleDataRequestDTO requestDTO, School foundSchool) { foundSchool.setTown(requestDTO.getTown()); foundSchool.setSchoolNumber(requestDTO.getSchoolNumber()); } private SchoolResponseDTO createSchoolResponseDTO(School savedSchool, List<SchoolSubject> savedSubjects) { SchoolResponseDTO responseDTO = new SchoolResponseDTO(); responseDTO.setId(savedSchool.getId()); responseDTO.setTown(savedSchool.getTown()); responseDTO.setSchoolNumber(savedSchool.getSchoolNumber()); List<SchoolSubjectResponseDTO> subjectResponseDTOs = savedSubjects.stream() .map(this::createSchoolSubjectResponseDTO) .collect(Collectors.toList()); responseDTO.setSubjects(subjectResponseDTOs); return responseDTO; } private SchoolSubjectResponseDTO createSchoolSubjectResponseDTO(SchoolSubject schoolSubject) { SchoolSubjectResponseDTO subjectResponseDTO = new SchoolSubjectResponseDTO(); subjectResponseDTO.setId(schoolSubject.getId()); subjectResponseDTO.setName(schoolSubject.getName()); subjectResponseDTO.setTeacherName(schoolSubject.getTeacherName()); return subjectResponseDTO; } private SchoolSubject createSchoolSubject(School savedSchool, SchoolSubjectDataRequestDTO subjectRequestDTO) { SchoolSubject subject = new SchoolSubject(); subject.setName(subjectRequestDTO.getName()); subject.setTeacherName(subjectRequestDTO.getTeacherName()); subject.setSchool(savedSchool); return subject; } private School updateAndSaveSchoolData(SchoolDataRequestDTO requestDTO, School school) { school.setTown(requestDTO.getTown()); school.setSchoolNumber(requestDTO.getSchoolNumber()); return schoolRepository.save(school); } private void validateSchoolExistence(Long id) { getSchoolById(id); } }
c457b468bcd7b1936f8a1c4a42c516aaa293bacd
b1a7673d19e266336ec932227207adf88c57b342
/gui/src/EA_Grille_Salaire.java
7c33f4dd0b0b0a79a5ff8f9b1c9647d2e7ce1c27
[]
no_license
Alexcgi15/ProjectAfpaJava
b1e7c432b87cc5fc039fe288aa0055ce76990e59
9dbc475ea8d8e2f28784764aeb8b8c529ff221af
refs/heads/master
2020-03-24T04:55:11.208161
2018-07-26T17:06:31
2018-07-26T17:06:31
142,468,958
0
0
null
null
null
null
UTF-8
Java
false
false
20,113
java
import javax.swing.JLabel; import javax.swing.JTextField; import javax.swing.table.DefaultTableModel; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * * @author afpa */ public class EA_Grille_Salaire extends javax.swing.JPanel { /** * Creates new form EA_Grille_Salaire */ public EA_Grille_Salaire() { initComponents(); ea_ouv_formulaire.setVisible(false); ea_etam_formulaire.setVisible(false); ea_cadre_formulaire.setVisible(false); } private void ChargeListe1() { // DefaultTableModel dtm = new DefaultTableModel(); // DAO.PersonnelDAO tab = new DAO.PersonnelDAO(); // // dtm.addColumn("id"); // dtm.addColumn("Nom"); // dtm.addColumn("Prenom"); // dtm.addColumn("Poste"); // // // for(Classe.Personnel p: tab.List_By_nom_centre_cout(nom)){ // String [] ligne = {Integer.toString(p.getId()),p.getNom(),p.getPrenom(),p.getPoste()}; // dtm.addRow(ligne); // } // // ea_liste_table.setModel(dtm); // ea_liste_table.getColumnModel().getColumn(0).setMinWidth(0); // ea_liste_table.getColumnModel().getColumn(0).setMaxWidth(0); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jButton9 = new javax.swing.JButton(); jButton10 = new javax.swing.JButton(); jPanel4 = new javax.swing.JPanel(); jPanel15 = new javax.swing.JPanel(); ea_ouv_ajout = new javax.swing.JButton(); ea_ouv_sup = new javax.swing.JButton(); jScrollPane1 = new javax.swing.JScrollPane(); ea_ouv_liste = new javax.swing.JTable(); ea_ouv_formulaire = new javax.swing.JPanel(); ea_ouv_coeff = new javax.swing.JTextField(); jLabel44 = new javax.swing.JLabel(); ea_ouv_salmini = new javax.swing.JTextField(); ea_ouv_salmax = new javax.swing.JTextField(); jLabel29 = new javax.swing.JLabel(); jLabel28 = new javax.swing.JLabel(); ea_ouv_modif = new javax.swing.JButton(); jPanel14 = new javax.swing.JPanel(); ea_etam_ajout = new javax.swing.JButton(); ea_etam_sup = new javax.swing.JButton(); jScrollPane2 = new javax.swing.JScrollPane(); ea_etam_liste = new javax.swing.JTable(); ea_etam_formulaire = new javax.swing.JPanel(); ea_etam_coeff = new javax.swing.JTextField(); jLabel47 = new javax.swing.JLabel(); ea_etam_salmini = new javax.swing.JTextField(); ea_etam_salmax = new javax.swing.JTextField(); jLabel34 = new javax.swing.JLabel(); jLabel35 = new javax.swing.JLabel(); ea_etam_modif = new javax.swing.JButton(); jPanel1 = new javax.swing.JPanel(); ea_cadre_ajout = new javax.swing.JButton(); ea_cadre_sup = new javax.swing.JButton(); jScrollPane3 = new javax.swing.JScrollPane(); ea_ouv_liste1 = new javax.swing.JTable(); ea_cadre_formulaire = new javax.swing.JPanel(); ea_cadre_coeff = new javax.swing.JTextField(); jLabel45 = new javax.swing.JLabel(); ea_cadre_salmini = new javax.swing.JTextField(); ea_cadre_salmax = new javax.swing.JTextField(); jLabel30 = new javax.swing.JLabel(); jLabel31 = new javax.swing.JLabel(); ea_cadre_modif = new javax.swing.JButton(); jButton9.setText("Modifier"); jButton10.setText("Supprimer"); setMaximumSize(new java.awt.Dimension(20000, 20000)); setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); jPanel4.setName(""); // NOI18N jPanel4.setPreferredSize(new java.awt.Dimension(915, 575)); jPanel4.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); jPanel15.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Ouvrier", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 11), new java.awt.Color(153, 153, 153))); // NOI18N jPanel15.setPreferredSize(new java.awt.Dimension(828, 220)); jPanel15.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); ea_ouv_ajout.setText("Ajouter"); ea_ouv_ajout.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); ea_ouv_ajout.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { ea_ouv_ajoutMouseClicked(evt); } }); jPanel15.add(ea_ouv_ajout, new org.netbeans.lib.awtextra.AbsoluteConstraints(390, 60, 80, -1)); ea_ouv_sup.setText("Supprimer"); ea_ouv_sup.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); ea_ouv_sup.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { ea_ouv_supMouseClicked(evt); } }); jPanel15.add(ea_ouv_sup, new org.netbeans.lib.awtextra.AbsoluteConstraints(390, 140, -1, -1)); ea_ouv_liste.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {null, null, null}, {null, null, null}, {null, null, null}, {null, null, null} }, new String [] { "Coefficient", "Salaire Mini", "Salaire Max" } )); jScrollPane1.setViewportView(ea_ouv_liste); jPanel15.add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 20, 340, 170)); ea_ouv_formulaire.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Formulaire", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 11), new java.awt.Color(153, 153, 153))); // NOI18N ea_ouv_formulaire.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); ea_ouv_formulaire.add(ea_ouv_coeff, new org.netbeans.lib.awtextra.AbsoluteConstraints(107, 28, 170, -1)); jLabel44.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel44.setText("Salaire max :"); ea_ouv_formulaire.add(jLabel44, new org.netbeans.lib.awtextra.AbsoluteConstraints(16, 78, -1, 22)); ea_ouv_formulaire.add(ea_ouv_salmini, new org.netbeans.lib.awtextra.AbsoluteConstraints(107, 127, 170, -1)); ea_ouv_formulaire.add(ea_ouv_salmax, new org.netbeans.lib.awtextra.AbsoluteConstraints(107, 79, 170, -1)); jLabel29.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel29.setText("Coefficient :"); ea_ouv_formulaire.add(jLabel29, new org.netbeans.lib.awtextra.AbsoluteConstraints(16, 27, -1, 22)); jLabel28.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel28.setText("Salaire mini :"); ea_ouv_formulaire.add(jLabel28, new org.netbeans.lib.awtextra.AbsoluteConstraints(16, 126, -1, 22)); jPanel15.add(ea_ouv_formulaire, new org.netbeans.lib.awtextra.AbsoluteConstraints(510, 20, 310, 180)); ea_ouv_modif.setText("Modifier"); ea_ouv_modif.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); ea_ouv_modif.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { ea_ouv_modifMouseClicked(evt); } }); jPanel15.add(ea_ouv_modif, new org.netbeans.lib.awtextra.AbsoluteConstraints(390, 100, 80, -1)); jPanel4.add(jPanel15, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 20, -1, -1)); jPanel14.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "ETAM", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 11), new java.awt.Color(153, 153, 153))); // NOI18N jPanel14.setPreferredSize(new java.awt.Dimension(828, 220)); jPanel14.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); ea_etam_ajout.setText("Ajouter"); ea_etam_ajout.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); ea_etam_ajout.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { ea_etam_ajoutMouseClicked(evt); } }); jPanel14.add(ea_etam_ajout, new org.netbeans.lib.awtextra.AbsoluteConstraints(390, 60, 80, -1)); ea_etam_sup.setText("Supprimer"); ea_etam_sup.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); ea_etam_sup.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { ea_etam_supMouseClicked(evt); } }); jPanel14.add(ea_etam_sup, new org.netbeans.lib.awtextra.AbsoluteConstraints(390, 140, -1, -1)); ea_etam_liste.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {null, null, null}, {null, null, null}, {null, null, null}, {null, null, null} }, new String [] { "Coefficient", "Salaire Mini", "Salaire Max" } )); jScrollPane2.setViewportView(ea_etam_liste); jPanel14.add(jScrollPane2, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 20, 340, 170)); ea_etam_formulaire.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Formulaire", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 11), new java.awt.Color(153, 153, 153))); // NOI18N ea_etam_formulaire.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); ea_etam_formulaire.add(ea_etam_coeff, new org.netbeans.lib.awtextra.AbsoluteConstraints(107, 28, 170, -1)); jLabel47.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel47.setText("Salaire max :"); ea_etam_formulaire.add(jLabel47, new org.netbeans.lib.awtextra.AbsoluteConstraints(16, 78, -1, 22)); ea_etam_formulaire.add(ea_etam_salmini, new org.netbeans.lib.awtextra.AbsoluteConstraints(107, 127, 170, -1)); ea_etam_formulaire.add(ea_etam_salmax, new org.netbeans.lib.awtextra.AbsoluteConstraints(107, 79, 170, -1)); jLabel34.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel34.setText("Coefficient :"); ea_etam_formulaire.add(jLabel34, new org.netbeans.lib.awtextra.AbsoluteConstraints(16, 27, -1, 22)); jLabel35.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel35.setText("Salaire mini :"); ea_etam_formulaire.add(jLabel35, new org.netbeans.lib.awtextra.AbsoluteConstraints(16, 126, -1, 22)); jPanel14.add(ea_etam_formulaire, new org.netbeans.lib.awtextra.AbsoluteConstraints(510, 20, 310, 180)); ea_etam_modif.setText("Modifier"); ea_etam_modif.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); ea_etam_modif.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { ea_etam_modifMouseClicked(evt); } }); jPanel14.add(ea_etam_modif, new org.netbeans.lib.awtextra.AbsoluteConstraints(390, 100, 80, -1)); jPanel4.add(jPanel14, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 237, -1, -1)); jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Cadre", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 11), new java.awt.Color(153, 153, 153))); // NOI18N jPanel1.setPreferredSize(new java.awt.Dimension(828, 220)); jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); ea_cadre_ajout.setText("Ajouter"); ea_cadre_ajout.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); ea_cadre_ajout.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { ea_cadre_ajoutMouseClicked(evt); } }); jPanel1.add(ea_cadre_ajout, new org.netbeans.lib.awtextra.AbsoluteConstraints(390, 60, 80, -1)); ea_cadre_sup.setText("Supprimer"); ea_cadre_sup.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); ea_cadre_sup.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { ea_cadre_supMouseClicked(evt); } }); jPanel1.add(ea_cadre_sup, new org.netbeans.lib.awtextra.AbsoluteConstraints(390, 140, -1, -1)); ea_ouv_liste1.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {null, null, null}, {null, null, null}, {null, null, null}, {null, null, null} }, new String [] { "Coefficient", "Salaire Mini", "Salaire Max" } )); jScrollPane3.setViewportView(ea_ouv_liste1); jPanel1.add(jScrollPane3, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 20, 340, 170)); ea_cadre_formulaire.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Formulaire", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 11), new java.awt.Color(153, 153, 153))); // NOI18N ea_cadre_formulaire.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); ea_cadre_formulaire.add(ea_cadre_coeff, new org.netbeans.lib.awtextra.AbsoluteConstraints(107, 28, 170, -1)); jLabel45.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel45.setText("Salaire max :"); ea_cadre_formulaire.add(jLabel45, new org.netbeans.lib.awtextra.AbsoluteConstraints(16, 78, -1, 22)); ea_cadre_formulaire.add(ea_cadre_salmini, new org.netbeans.lib.awtextra.AbsoluteConstraints(107, 127, 170, -1)); ea_cadre_formulaire.add(ea_cadre_salmax, new org.netbeans.lib.awtextra.AbsoluteConstraints(107, 79, 170, -1)); jLabel30.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel30.setText("Coefficient :"); ea_cadre_formulaire.add(jLabel30, new org.netbeans.lib.awtextra.AbsoluteConstraints(16, 27, -1, 22)); jLabel31.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel31.setText("Salaire mini :"); ea_cadre_formulaire.add(jLabel31, new org.netbeans.lib.awtextra.AbsoluteConstraints(16, 126, -1, 22)); jPanel1.add(ea_cadre_formulaire, new org.netbeans.lib.awtextra.AbsoluteConstraints(510, 20, 310, 180)); ea_cadre_modif.setText("Modifier"); ea_cadre_modif.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); ea_cadre_modif.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { ea_cadre_modifMouseClicked(evt); } }); jPanel1.add(ea_cadre_modif, new org.netbeans.lib.awtextra.AbsoluteConstraints(390, 100, 80, -1)); jPanel4.add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 463, -1, -1)); add(jPanel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, 766)); }// </editor-fold>//GEN-END:initComponents private void ea_ouv_ajoutMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_ea_ouv_ajoutMouseClicked ea_ouv_formulaire.setVisible(true); }//GEN-LAST:event_ea_ouv_ajoutMouseClicked private void ea_ouv_modifMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_ea_ouv_modifMouseClicked ea_ouv_formulaire.setVisible(true); }//GEN-LAST:event_ea_ouv_modifMouseClicked private void ea_ouv_supMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_ea_ouv_supMouseClicked ea_ouv_formulaire.setVisible(true); }//GEN-LAST:event_ea_ouv_supMouseClicked private void ea_etam_ajoutMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_ea_etam_ajoutMouseClicked ea_etam_formulaire.setVisible(true); }//GEN-LAST:event_ea_etam_ajoutMouseClicked private void ea_etam_modifMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_ea_etam_modifMouseClicked ea_etam_formulaire.setVisible(true); }//GEN-LAST:event_ea_etam_modifMouseClicked private void ea_etam_supMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_ea_etam_supMouseClicked ea_etam_formulaire.setVisible(true); }//GEN-LAST:event_ea_etam_supMouseClicked private void ea_cadre_ajoutMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_ea_cadre_ajoutMouseClicked ea_cadre_formulaire.setVisible(true); }//GEN-LAST:event_ea_cadre_ajoutMouseClicked private void ea_cadre_modifMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_ea_cadre_modifMouseClicked ea_cadre_formulaire.setVisible(true); }//GEN-LAST:event_ea_cadre_modifMouseClicked private void ea_cadre_supMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_ea_cadre_supMouseClicked ea_cadre_formulaire.setVisible(true); }//GEN-LAST:event_ea_cadre_supMouseClicked // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton ea_cadre_ajout; private javax.swing.JTextField ea_cadre_coeff; private javax.swing.JPanel ea_cadre_formulaire; private javax.swing.JButton ea_cadre_modif; private javax.swing.JTextField ea_cadre_salmax; private javax.swing.JTextField ea_cadre_salmini; private javax.swing.JButton ea_cadre_sup; private javax.swing.JButton ea_etam_ajout; private javax.swing.JTextField ea_etam_coeff; private javax.swing.JPanel ea_etam_formulaire; private javax.swing.JTable ea_etam_liste; private javax.swing.JButton ea_etam_modif; private javax.swing.JTextField ea_etam_salmax; private javax.swing.JTextField ea_etam_salmini; private javax.swing.JButton ea_etam_sup; private javax.swing.JButton ea_ouv_ajout; private javax.swing.JTextField ea_ouv_coeff; private javax.swing.JPanel ea_ouv_formulaire; private javax.swing.JTable ea_ouv_liste; private javax.swing.JTable ea_ouv_liste1; private javax.swing.JButton ea_ouv_modif; private javax.swing.JTextField ea_ouv_salmax; private javax.swing.JTextField ea_ouv_salmini; private javax.swing.JButton ea_ouv_sup; private javax.swing.JButton jButton10; private javax.swing.JButton jButton9; private javax.swing.JLabel jLabel28; private javax.swing.JLabel jLabel29; private javax.swing.JLabel jLabel30; private javax.swing.JLabel jLabel31; private javax.swing.JLabel jLabel34; private javax.swing.JLabel jLabel35; private javax.swing.JLabel jLabel44; private javax.swing.JLabel jLabel45; private javax.swing.JLabel jLabel47; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel14; private javax.swing.JPanel jPanel15; private javax.swing.JPanel jPanel4; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JScrollPane jScrollPane2; private javax.swing.JScrollPane jScrollPane3; // End of variables declaration//GEN-END:variables }
d9bf80dc81a24df6fa8c510114e33297f908b49b
ed81959b95a33a50bd1a69a2bfc0dc497d917923
/Testing/Projecton Source For Eclipse/src/boundries/DelayReportBoundary.java
e3f70057fe7fd079beccc0cd5fc3de41dbe73ad0
[]
no_license
ravivkomem/Projecton
94dc140548d0104dbd145832cc9804504a122a9a
96101051b64a77ce64d5b4cf09d667254bc7b392
refs/heads/master
2020-09-01T14:06:09.379342
2020-01-23T18:00:03
2020-01-23T18:00:03
218,974,283
0
0
null
null
null
null
UTF-8
Java
false
false
16,408
java
package boundries; import java.net.URL; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.ResourceBundle; import assets.Toast; import controllers.DelayReportController; import controllers.TimeManager; import controllers.Utilizer; import entities.DelayReport; import javafx.collections.FXCollections; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.chart.BarChart; import javafx.scene.chart.CategoryAxis; import javafx.scene.chart.NumberAxis; import javafx.scene.chart.XYChart; import javafx.scene.control.TextField; /** * The Class DelayReportBoundary. * @author Lee Hugi * This class control the delay report page * */ public class DelayReportBoundary implements Initializable{ /* ************************************* * ********* FXML Objects ************** * *************************************/ /** The delay bar chart. */ @FXML private BarChart<String, Number> dealyBarChart; /** The delay category bar chart. */ @FXML private CategoryAxis delayCategoryBarChart; /** The delay number bar chart. */ @FXML private NumberAxis delayNumberBarChart; /** The median text field. */ @FXML private TextField medianTextField; /** The std text field. */ @FXML private TextField stdTextField; @FXML private TextField avgTextField; /* ************************************* * ******* Private Objects ************* * *************************************/ /** The my controller. */ private DelayReportController myController = new DelayReportController(this); /** The Constant FIRST_CATAGORY. */ private static final String FIRST_CATAGORY = "Lecturer\nStation"; /** The Constant SECOND_CATAGORY. */ private static final String SECOND_CATAGORY = "Student\nStation"; /** The Constant THIRD_CATAGORY. */ private static final String THIRD_CATAGORY = "Employee\nStation"; /** The Constant FOURTH_CATAGORY. */ private static final String FOURTH_CATAGORY = "Moodle"; /** The Constant FIFTH_CATAGORY. */ private static final String FIFTH_CATAGORY = "Library"; /** The Constant SIXTH_CATAGORY. */ private static final String SIXTH_CATAGORY = "Class\nRooms"; /** The Constant SEVENTH_CATAGORY. */ private static final String SEVENTH_CATAGORY = "Laboratory"; /** The Constant EIGHTH_CATAGORY. */ private static final String EIGHTH_CATAGORY = "Computer\nFarm"; /** The Constant NINTH_CATAGORY. */ private static final String NINTH_CATAGORY = "College\nWebsite"; /** The Constant CATEGORY. */ private static final int CATEGORY = 9; /* ************************************ * ******* Public Methods ************* * ************************************/ @Override public void initialize(URL location, ResourceBundle resources) { medianTextField.setEditable(false); stdTextField.setEditable(false); avgTextField.setEditable(false); dealyBarChart.setTitle(""); delayCategoryBarChart.setCategories(FXCollections.<String>observableArrayList( Arrays.asList(FIRST_CATAGORY, SECOND_CATAGORY, THIRD_CATAGORY, FOURTH_CATAGORY,FIFTH_CATAGORY ,SIXTH_CATAGORY,SEVENTH_CATAGORY,EIGHTH_CATAGORY,NINTH_CATAGORY))); myController.getAllStepsDate(); } /** * this method gets object with delay report details * the method display the details in the page. * * @param delayReportList the delay report list */ @SuppressWarnings("unchecked") public void displayDealyReport(ArrayList<DelayReport> delayReportList) { ArrayList<Long> delayDays = new ArrayList<>(); int[] deleysCounter; delayDays.addAll(createDelayDaysList(delayReportList)); deleysCounter = createDelayDaysCntArray(delayReportList); long[] delayDaysArr; delayDaysArr = createDelayDaysArray(delayReportList); long[] medianArr; medianArr = createMedianArr(delayReportList); long[] standartDeviationArr; standartDeviationArr = createStandartDeviationArr(delayReportList); XYChart.Series<String,Number> series1 = new XYChart.Series<String, Number>(); series1.getData().add(new XYChart.Data<String,Number>(FIRST_CATAGORY, deleysCounter[0])); series1.getData().add(new XYChart.Data<String,Number>(SECOND_CATAGORY, deleysCounter[1])); series1.getData().add(new XYChart.Data<String,Number>(THIRD_CATAGORY, deleysCounter[2])); series1.getData().add(new XYChart.Data<String,Number>(FOURTH_CATAGORY, deleysCounter[3])); series1.getData().add(new XYChart.Data<String,Number>(FIFTH_CATAGORY, deleysCounter[4])); series1.getData().add(new XYChart.Data<String,Number>(SIXTH_CATAGORY, deleysCounter[5])); series1.getData().add(new XYChart.Data<String,Number>(SEVENTH_CATAGORY, deleysCounter[6])); series1.getData().add(new XYChart.Data<String,Number>(EIGHTH_CATAGORY, deleysCounter[7])); series1.getData().add(new XYChart.Data<String,Number>(NINTH_CATAGORY, deleysCounter[8])); series1.setName("Delay Counter"); dealyBarChart.getData().addAll(series1); XYChart.Series<String,Number> series2 = new XYChart.Series<String, Number>(); series2.getData().add(new XYChart.Data<String,Number>(FIRST_CATAGORY, deleysCounter[0] == 0 ? 0 :delayDaysArr[0]/deleysCounter[0])); series2.getData().add(new XYChart.Data<String,Number>(SECOND_CATAGORY, deleysCounter[1] == 0 ? 0 :delayDaysArr[1]/deleysCounter[1])); series2.getData().add(new XYChart.Data<String,Number>(THIRD_CATAGORY, deleysCounter[2] == 0 ? 0 :delayDaysArr[2]/deleysCounter[2])); series2.getData().add(new XYChart.Data<String,Number>(FOURTH_CATAGORY, deleysCounter[3] == 0 ? 0 :delayDaysArr[3]/deleysCounter[3])); series2.getData().add(new XYChart.Data<String,Number>(FIFTH_CATAGORY, deleysCounter[4] == 0 ? 0 :delayDaysArr[4]/deleysCounter[4])); series2.getData().add(new XYChart.Data<String,Number>(SIXTH_CATAGORY, deleysCounter[5] == 0 ? 0 :delayDaysArr[5]/deleysCounter[5])); series2.getData().add(new XYChart.Data<String,Number>(SEVENTH_CATAGORY, deleysCounter[6] == 0 ? 0 :delayDaysArr[6]/deleysCounter[6])); series2.getData().add(new XYChart.Data<String,Number>(EIGHTH_CATAGORY, deleysCounter[7] == 0 ? 0 :delayDaysArr[7]/deleysCounter[7])); series2.getData().add(new XYChart.Data<String,Number>(NINTH_CATAGORY, deleysCounter[8] == 0 ? 0 :delayDaysArr[8]/deleysCounter[8])); series2.setName("Avg Delay Days"); dealyBarChart.getData().addAll(series2); XYChart.Series<String,Number> series3 = new XYChart.Series<String, Number>(); series3.getData().add(new XYChart.Data<String,Number>(FIRST_CATAGORY, medianArr[0])); series3.getData().add(new XYChart.Data<String,Number>(SECOND_CATAGORY, medianArr[1])); series3.getData().add(new XYChart.Data<String,Number>(THIRD_CATAGORY, medianArr[2])); series3.getData().add(new XYChart.Data<String,Number>(FOURTH_CATAGORY, medianArr[3])); series3.getData().add(new XYChart.Data<String,Number>(FIFTH_CATAGORY, medianArr[4])); series3.getData().add(new XYChart.Data<String,Number>(SIXTH_CATAGORY, medianArr[5])); series3.getData().add(new XYChart.Data<String,Number>(SEVENTH_CATAGORY, medianArr[6])); series3.getData().add(new XYChart.Data<String,Number>(EIGHTH_CATAGORY, medianArr[7])); series3.getData().add(new XYChart.Data<String,Number>(NINTH_CATAGORY, medianArr[8])); series3.setName("Median Delay Days"); dealyBarChart.getData().addAll(series3); XYChart.Series<String,Number> series4 = new XYChart.Series<String, Number>(); series4.getData().add(new XYChart.Data<String,Number>(FIRST_CATAGORY, standartDeviationArr[0])); series4.getData().add(new XYChart.Data<String,Number>(SECOND_CATAGORY, standartDeviationArr[1])); series4.getData().add(new XYChart.Data<String,Number>(THIRD_CATAGORY, standartDeviationArr[2])); series4.getData().add(new XYChart.Data<String,Number>(FOURTH_CATAGORY, standartDeviationArr[3])); series4.getData().add(new XYChart.Data<String,Number>(FIFTH_CATAGORY, standartDeviationArr[4])); series4.getData().add(new XYChart.Data<String,Number>(SIXTH_CATAGORY, standartDeviationArr[5])); series4.getData().add(new XYChart.Data<String,Number>(SEVENTH_CATAGORY, standartDeviationArr[6])); series4.getData().add(new XYChart.Data<String,Number>(EIGHTH_CATAGORY, standartDeviationArr[7])); series4.getData().add(new XYChart.Data<String,Number>(NINTH_CATAGORY, standartDeviationArr[8])); series4.setName("Standart Deviation"); dealyBarChart.getData().addAll(series4); if(!delayDays.isEmpty()) { DecimalFormat df2 = new DecimalFormat("##.##"); medianTextField.setText(df2.format(Utilizer.calcMedian(delayDays))); stdTextField.setText(df2.format(Utilizer.calcStd(delayDays))); avgTextField.setText(df2.format(Utilizer.calcAvg(delayDays))); delayCategoryBarChart.setLabel("Subsytem"); delayNumberBarChart.setLabel("Quantity"); } else { Toast.makeText(ProjectFX.mainStage, "There is not delay days", 1500, 500, 500); } } private long[] createMedianArr(ArrayList<DelayReport> delayReportList) { long[] array = new long[CATEGORY]; ArrayList<Long> lecturerInformationList = new ArrayList<Long>(); ArrayList<Long> studendtInformationList = new ArrayList<Long>(); ArrayList<Long> employeeInformationList = new ArrayList<Long>(); ArrayList<Long> moodleSystemList = new ArrayList<Long>(); ArrayList<Long> librarayList = new ArrayList<Long>(); ArrayList<Long> classRoomsWithComputersList = new ArrayList<Long>(); ArrayList<Long> laboratoryList = new ArrayList<Long>(); ArrayList<Long> computerFarmList = new ArrayList<Long>(); ArrayList<Long> collegeWebsiteList = new ArrayList<Long>(); for (DelayReport report : delayReportList) { long daysBetween = TimeManager.getDaysBetween(report.getEstimateDate(), report.getEndDate()); if(daysBetween > 0) { switch (report.getSubsystem()) { case "Lecturer Information Station": lecturerInformationList.add(daysBetween); break; case "Student Information Station": studendtInformationList.add(daysBetween); break; case "Employee Information Station": employeeInformationList.add(daysBetween); break; case "Moodle System": moodleSystemList.add(daysBetween); break; case "Library System": librarayList.add(daysBetween); break; case "Class Rooms With Computers": classRoomsWithComputersList.add(daysBetween); break; case "Laboratory": laboratoryList.add(daysBetween); break; case "Computer Farm": computerFarmList.add(daysBetween); break; case "College Website": collegeWebsiteList.add(daysBetween); break; default: break; } } } array[0] = (long) Utilizer.calcMedian(lecturerInformationList); array[1] = (long) Utilizer.calcMedian(studendtInformationList); array[2] = (long) Utilizer.calcMedian(employeeInformationList); array[3] = (long) Utilizer.calcMedian(moodleSystemList); array[4] = (long) Utilizer.calcMedian(librarayList); array[5] = (long) Utilizer.calcMedian(classRoomsWithComputersList); array[6] = (long) Utilizer.calcMedian(laboratoryList); array[7] = (long) Utilizer.calcMedian(computerFarmList); array[8] = (long) Utilizer.calcMedian(collegeWebsiteList); return array; } private long[] createStandartDeviationArr(ArrayList<DelayReport> delayReportList) { long[] array = new long[CATEGORY]; ArrayList<Long> lecturerInformationList = new ArrayList<Long>(); ArrayList<Long> studendtInformationList = new ArrayList<Long>(); ArrayList<Long> employeeInformationList = new ArrayList<Long>(); ArrayList<Long> moodleSystemList = new ArrayList<Long>(); ArrayList<Long> librarayList = new ArrayList<Long>(); ArrayList<Long> classRoomsWithComputersList = new ArrayList<Long>(); ArrayList<Long> laboratoryList = new ArrayList<Long>(); ArrayList<Long> computerFarmList = new ArrayList<Long>(); ArrayList<Long> collegeWebsiteList = new ArrayList<Long>(); for (DelayReport report : delayReportList) { long daysBetween = TimeManager.getDaysBetween(report.getEstimateDate(), report.getEndDate()); if(daysBetween > 0) { switch (report.getSubsystem()) { case "Lecturer Information Station": lecturerInformationList.add(daysBetween); break; case "Student Information Station": studendtInformationList.add(daysBetween); break; case "Employee Information Station": employeeInformationList.add(daysBetween); break; case "Moodle System": moodleSystemList.add(daysBetween); break; case "Library System": librarayList.add(daysBetween); break; case "Class Rooms With Computers": classRoomsWithComputersList.add(daysBetween); break; case "Laboratory": laboratoryList.add(daysBetween); break; case "Computer Farm": computerFarmList.add(daysBetween); break; case "College Website": collegeWebsiteList.add(daysBetween); break; default: break; } } } array[0] = (long) Utilizer.calcStd(lecturerInformationList); array[1] = (long) Utilizer.calcStd(studendtInformationList); array[2] = (long) Utilizer.calcStd(employeeInformationList); array[3] = (long) Utilizer.calcStd(moodleSystemList); array[4] = (long) Utilizer.calcStd(librarayList); array[5] = (long) Utilizer.calcStd(classRoomsWithComputersList); array[6] = (long) Utilizer.calcStd(laboratoryList); array[7] = (long) Utilizer.calcStd(computerFarmList); array[8] = (long) Utilizer.calcStd(collegeWebsiteList); return array; } private long[] createDelayDaysArray(ArrayList<DelayReport> delayReportList) { long[] array = new long[CATEGORY]; for(int i=0;i<delayReportList.size();i++) { long daysBetween = TimeManager.getDaysBetween(delayReportList.get(i).getEstimateDate(), delayReportList.get(i).getEndDate()); if(daysBetween > 0) { switch (delayReportList.get(i).getSubsystem()) { case "Lecturer Information Station": array[0] += daysBetween; break; case "Student Information Station": array[1] += daysBetween; break; case "Employee Information Station": array[2] += daysBetween; break; case "Moodle System": array[3] += daysBetween; break; case "Library System": array[4] += daysBetween; break; case "Class Rooms With Computers": array[5] += daysBetween; break; case "Laboratory": array[6] += daysBetween; break; case "Computer Farm": array[7] += daysBetween; break; case "College Website": array[8] += daysBetween; break; default: System.out.println("Reached here with: " + delayReportList.get(i).getSubsystem()); break; } } } return array; } /** * this method create delay days counter array for display at bar chart . * * @param delayReportList the delay report list * @return the int[] */ private int[] createDelayDaysCntArray(ArrayList<DelayReport> delayReportList) { int[] array = new int[CATEGORY]; for(int i=0;i<delayReportList.size();i++) { long daysBetween = TimeManager.getDaysBetween(delayReportList.get(i).getEstimateDate(), delayReportList.get(i).getEndDate()); if(daysBetween > 0) { switch (delayReportList.get(i).getSubsystem()) { case "Lecturer Information Station": array[0]++; break; case "Student Information Station": array[1]++; break; case "Employee Information Station": array[2]++; break; case "Moodle System": array[3]++; break; case "Library System": array[4]++; break; case "Class Rooms With Computers": array[5]++; break; case "Laboratory": array[6]++; break; case "Computer Farm": array[7]++; break; case "College Website": array[8]++; break; default: break; } } } return array; } /** * this method create Delay Days List. * * @param delayReportList the delay report list * @return the array list */ private ArrayList<Long> createDelayDaysList(ArrayList<DelayReport> delayReportList) { ArrayList<Long> list = new ArrayList<>(); for(int i = 0 ; i < delayReportList.size() ; i++) { long daysBetween = TimeManager.getDaysBetween(delayReportList.get(i).getEstimateDate(), delayReportList.get(i).getEndDate()); if(daysBetween > 1) { list.add(Math.abs(daysBetween)); } } return list; } }
741d5e60c4e2c0b1db89ffc77ab5ee9cbbb42a1e
09f77ccd9c58bb6c7ae5442f39126b3838956b09
/app/src/test/java/com/example/larry/helloworld/ExampleUnitTest.java
e2f199c601ca39d1abf0d0abd87506921a1b44a6
[]
no_license
larry1285/Wearing
c901fcbaf9dc3426dbf221b91a1a8430bb76b917
6fe6d9aa9a42e1ec8a7a9b2f38829b087bd60506
refs/heads/master
2020-12-24T18:50:43.413812
2016-05-11T11:43:04
2016-05-11T11:43:04
58,539,633
0
0
null
null
null
null
UTF-8
Java
false
false
321
java
package com.example.larry.helloworld; import org.junit.Test; import static org.junit.Assert.*; /** * To work on unit tests, switch the Test Artifact in the Build Variants view. */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
e5ebf8295a8208d0968969a882e1f8e4dfeca76e
327d77efe37f65fd0d212fdde0033e307c5de46c
/app/src/main/java/pw/pbdiary/maeari/blog/MainActivity.java
9f7434cced5c848f3cc499385efd69bf37de53fd
[ "Apache-2.0", "MIT" ]
permissive
lego37yoon/maeari_blog
b8ea03fcf825eabdee78c6698b25d689dc6ba924
0ffebc7a6b49e181e21a4dbc9e6fec5263f81b0e
refs/heads/master
2021-06-21T01:26:07.106850
2019-08-04T14:48:14
2019-08-04T14:48:14
146,174,958
0
0
null
null
null
null
UTF-8
Java
false
false
1,257
java
package pw.pbdiary.maeari.blog; import android.content.Intent; import android.os.Bundle; import androidx.appcompat.app.AppCompatActivity; import android.view.View; import com.google.android.material.bottomappbar.BottomAppBar; import com.google.android.material.floatingactionbutton.FloatingActionButton; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); BottomAppBar mAppBar = findViewById(R.id.mainnav); setSupportActionBar(mAppBar); FloatingActionButton floatingActionButton = (FloatingActionButton) findViewById(R.id.newArticle); floatingActionButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent i = new Intent(getApplicationContext(),AddExBlogS1.class); startActivity(i); } }); } public void onNotiClicked(View view) { } public void onSettingsClicked(View view) { Intent intent = new Intent(getApplicationContext(),SettingsActivity.class); startActivity(intent); } }
64516615aedb9170b4831f65613e4365520253b7
0d2e336f550451a4ea89685ac0362001d762155e
/src/olmies/AllLecturersByFacultyByAcademicPeriodResponse.java
1612f1381990ecd36486d392eed53a1d2e5c7dd8
[]
no_license
ricardogaynorgaynor/spring-and-servelt-with-freemarker-and-soap-services
6855f9379b3791f7db85f660fed35672b3b2c119
d79750f5647dbb6bbc2e646a3c597cd25808eeef
refs/heads/master
2020-04-15T04:16:05.172392
2019-01-07T04:07:50
2019-01-07T04:07:50
164,376,514
0
0
null
null
null
null
UTF-8
Java
false
false
2,023
java
package olmies; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for anonymous complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="allLecturersByFacultyByAcademicPeriodResult" type="{http://olmiesservice.utech.edu.jm/}ArrayOfLecturerResult" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "allLecturersByFacultyByAcademicPeriodResult" }) @XmlRootElement(name = "allLecturersByFacultyByAcademicPeriodResponse", namespace = "http://olmiesservice.utech.edu.jm/") public class AllLecturersByFacultyByAcademicPeriodResponse { @XmlElement(namespace = "http://olmiesservice.utech.edu.jm/") protected ArrayOfLecturerResult allLecturersByFacultyByAcademicPeriodResult; /** * Gets the value of the allLecturersByFacultyByAcademicPeriodResult property. * * @return * possible object is * {@link ArrayOfLecturerResult } * */ public ArrayOfLecturerResult getAllLecturersByFacultyByAcademicPeriodResult() { return allLecturersByFacultyByAcademicPeriodResult; } /** * Sets the value of the allLecturersByFacultyByAcademicPeriodResult property. * * @param value * allowed object is * {@link ArrayOfLecturerResult } * */ public void setAllLecturersByFacultyByAcademicPeriodResult(ArrayOfLecturerResult value) { this.allLecturersByFacultyByAcademicPeriodResult = value; } }
de0925e0b9bc3e610f28d60d8807cf0a18e86ac7
cd341023aad9b29e386f3b6bddb5a3bf6ca6daab
/src/main/java/com/xueqi/Intelligent_office/service/FileService.java
1d054734f0daa87655d32c194e52f5966828bc83
[]
no_license
chenzifeng1/Intelligent_office
9c35d115369dec831098571dd7512246b9b21156
94588b12b35f973d12218bbfea7ea059c3615c65
refs/heads/master
2021-04-03T09:57:55.277217
2018-07-11T08:44:34
2018-07-11T08:44:34
124,888,140
0
0
null
null
null
null
UTF-8
Java
false
false
1,599
java
package com.xueqi.Intelligent_office.service; import com.xueqi.Intelligent_office.dto.JsonMessage; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletRequest; import java.io.*; @Service public class FileService { private static final Logger logger = LoggerFactory.getLogger(FileService.class); public String fileUpload(MultipartFile file, HttpServletRequest request){ if (!file.isEmpty()) { String saveFileName = file.getOriginalFilename(); File saveFile = new File(request.getSession().getServletContext().getRealPath("/upload/") + saveFileName); if (!saveFile.getParentFile().exists()) { saveFile.getParentFile().mkdirs(); } try { BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(saveFile)); out.write(file.getBytes()); out.flush(); out.close(); logger.info("文件位置:"+saveFile.getAbsolutePath()); return saveFile.getAbsolutePath(); } catch (FileNotFoundException e) { e.printStackTrace(); return saveFile.getAbsolutePath(); } catch (IOException e) { e.printStackTrace(); return " file upload failure:" + e.getMessage(); } } else { return "file upload failure,because the file is null"; } } }
02ab7909a8b3f3daa2615b5c5650199d833ff5cb
66519fad3df3a0ab37e44ab31ef5efd8bce879c8
/src/main/java/org/siouan/frontendgradleplugin/domain/usecase/AbstractGetExecutablePath.java
d5f48c3eeeb5613f0189bd6814e8fef971867b4b
[ "Apache-2.0" ]
permissive
emotionbug/frontend-gradle-plugin
1451f58c9b63596a8afca0f460b62a1cccc69291
adedc5c41367493dd3d4e3f0fe2e5cd9b47cb791
refs/heads/master
2023-05-05T18:41:31.010124
2021-05-30T14:43:59
2021-05-30T14:43:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,249
java
package org.siouan.frontendgradleplugin.domain.usecase; import java.nio.file.Path; import java.util.Optional; import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.siouan.frontendgradleplugin.domain.exception.ExecutableNotFoundException; import org.siouan.frontendgradleplugin.domain.model.Logger; import org.siouan.frontendgradleplugin.domain.model.Platform; import org.siouan.frontendgradleplugin.domain.provider.FileManager; /** * Gets the path to an executable given an install directory and a platform. * * @since 2.0.0 */ public abstract class AbstractGetExecutablePath { private final FileManager fileManager; private final Logger logger; protected AbstractGetExecutablePath(final FileManager fileManager, final Logger logger) { this.fileManager = fileManager; this.logger = logger; } /** * Gets the executable path. * * @param installDirectory Install directory. * @param platform Underlying platform. * @return The path. If the path is a single file name, it means it must be resolved using the PATH environment * variable. * @throws ExecutableNotFoundException If the executable is not found in the given install directory, or in the * install directory provided by the environment. */ @Nonnull public Path execute(@Nullable final Path installDirectory, @Nonnull final Platform platform) throws ExecutableNotFoundException { final Optional<Path> resolvedInstallDirectory; if (installDirectory == null) { resolvedInstallDirectory = getInstallDirectoryFromEnvironment(platform); logger.info("Install directory resolved from environment variable: {}", resolvedInstallDirectory); } else { logger.info("Install directory resolved from extension: {}", installDirectory); resolvedInstallDirectory = Optional.of(installDirectory); } final Path relativeExecutablePath; if (platform.isWindowsOs()) { relativeExecutablePath = getWindowsRelativeExecutablePath(); } else { relativeExecutablePath = getNonWindowsRelativeExecutablePath(); } final Path executablePath; if (resolvedInstallDirectory.isPresent()) { executablePath = resolvedInstallDirectory.get().resolve(relativeExecutablePath); if (fileManager.exists(executablePath)) { logger.info("Executable '{}' resolved from install directory", executablePath); return executablePath; } throw new ExecutableNotFoundException(executablePath); } executablePath = getExecutableFileName(platform); logger.info("Executable '{}' resolved from PATH environment variable", executablePath); return executablePath; } /** * Gets the executable file name. * * @return File name. */ @Nonnull private Path getExecutableFileName(@Nonnull final Platform platform) { return platform.isWindowsOs() ? getWindowsExecutableFileName() : getNonWindowsExecutableFileName(); } /** * Gets the executable path on Windows O/S, relative to the installation directory. * * @return Relative path. */ @Nonnull protected abstract Path getWindowsRelativeExecutablePath(); /** * Gets the executable path on non-Windows O/S, relative to the installation directory. * * @return Relative path. */ @Nonnull protected abstract Path getNonWindowsRelativeExecutablePath(); /** * Gets the executable file name on Windows O/S. * * @return File name. */ @Nonnull protected abstract Path getWindowsExecutableFileName(); /** * Gets the executable file name on non-Windows O/S. * * @return File name. */ @Nonnull protected abstract Path getNonWindowsExecutableFileName(); /** * Gets the install directory from the environment. * * @param platform Underlying platform. * @return Path provided by the environment. */ @Nonnull protected abstract Optional<Path> getInstallDirectoryFromEnvironment(@Nonnull final Platform platform); }
168b69daf9b3517f58eefa0e6988e9a8cd5421bf
e78f4b0ca4e2bb32dc018a70210b33a90d79c657
/app/src/main/java/com/bartech/sms/data/network/model/SmsVisitsCountRequest.java
284e21ebb33038853a750bc9782d0400c46223b3
[ "Apache-2.0" ]
permissive
AhmedSwilam/SMS
f0c9b6ec8834a85f2a16b02e696f88e987235a5d
66f46810b42dc955e86dbfcdaca1fca2f1969fcd
refs/heads/master
2020-04-11T16:26:14.776109
2018-12-15T16:50:00
2018-12-15T16:50:00
161,924,157
0
0
null
null
null
null
UTF-8
Java
false
false
484
java
package com.bartech.sms.data.network.model; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; /** * Created by Ahmed on 7/4/2018. */ public class SmsVisitsCountRequest { public SmsVisitsCountRequest(){ } public static class ServerSmsVisitsCountRequest{ @Expose @SerializedName("Id") private String Id; public ServerSmsVisitsCountRequest(String id) { Id = id; } } }
f870553e223f5e701a9783cd43b26c72a866d6bf
44f7d811afa05c7a0f6e9265ed397eff11761961
/springboot/src/main/java/com/jie/test/common/smallDemo/DataUse.java
91685b4b0c5c77acd6d063c9959b441fb3643640
[]
no_license
yiyongjie/myfeel
4a1bec8cc45fee901411bed6b3c2df69dc1a9de6
e65bd446dac13b857e644d92bd0028d8cfb8cc46
refs/heads/master
2020-04-08T22:16:22.680685
2019-02-20T08:36:27
2019-02-20T08:36:27
159,779,811
0
0
null
null
null
null
UTF-8
Java
false
false
11,822
java
package com.jie.test.common.smallDemo; import com.jie.test.common.model.gen.GenColumn; import com.jie.test.common.model.gen.GenContent; import lombok.extern.slf4j.Slf4j; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.sql.DataSource; import java.math.BigDecimal; import java.sql.*; import java.util.ArrayList; import java.util.Date; import java.util.List; @Slf4j public class DataUse { private static final String DRIVER = "com.mysql.cj.jdbc.Driver"; private static final String URL = "jdbc:mysql://localhost:3306/yyjtest?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8"; private static final String USERNAME = "root"; private static final String PASSWORD = "root123"; private static final String SQL = "SELECT * FROM ";// 数据库操作 static { try { Class.forName(DRIVER); } catch (ClassNotFoundException e) { log.error("can not load jdbc driver", e); } } /** * 获取数据库连接 * * @return */ public static Connection getConnection() { Connection conn = null; try { conn = DriverManager.getConnection(URL, USERNAME, PASSWORD); } catch (SQLException e) { log.error("get connection failure", e); } return conn; } /** * 关闭数据库连接 * @param conn */ public static void closeConnection(Connection conn) { if(conn != null) { try { conn.close(); } catch (SQLException e) { log.error("close connection failure", e); } } } /** * 获取数据库下的所有表名 */ public static List<String> getTableNames() throws SQLException { List<String> tableNames = new ArrayList<>(); Connection conn = getConnection(); Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery("SHOW TABLES"); try { //获取数据库的元数据 //从元数据中获取到所有的表名 while(rs.next()) { tableNames.add(rs.getString(1)); } } catch (SQLException e) { log.error("getTableNames failure", e); } finally { try { rs.close(); closeConnection(conn); } catch (SQLException e) { log.error("close ResultSet failure", e); } } return tableNames; } /** * 获取数据库下的所有表的注释 */ public static String getTableCommonts(String tableName) throws SQLException { String tablecommnet = ""; Connection conn = getConnection(); Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery("SHOW CREATE TABLE " + tableName); try { //获取数据库的元数据 //从元数据中获取到所有的表名 if(rs!=null){ rs.next(); } String createDDL = rs.getString(2); tablecommnet = parse(createDDL); } catch (SQLException e) { log.error("getTableNames failure", e); } finally { try { rs.close(); closeConnection(conn); } catch (SQLException e) { log.error("close ResultSet failure", e); } } return tablecommnet; } /** * 获取表中所有字段名称 * @param tableName 表名 * @return */ public static List<String> getColumnNames(String tableName) { List<String> columnNames = new ArrayList<>(); //与数据库的连接 Connection conn = getConnection(); PreparedStatement pStemt = null; String tableSql = SQL + tableName; try { pStemt = conn.prepareStatement(tableSql); //结果集元数据 ResultSetMetaData rsmd = pStemt.getMetaData(); //表列数 int size = rsmd.getColumnCount(); for (int i = 0; i < size; i++) { columnNames.add(rsmd.getColumnName(i + 1)); } } catch (SQLException e) { log.error("getColumnNames failure", e); } finally { if (pStemt != null) { try { pStemt.close(); closeConnection(conn); } catch (SQLException e) { log.error("getColumnNames close pstem and connection failure", e); } } } return columnNames; } /** * 获取表中所有字段类型 * @param tableName * @return */ public static List<String> getColumnTypes(String tableName) { List<String> columnTypes = new ArrayList<>(); //与数据库的连接 Connection conn = getConnection(); PreparedStatement pStemt = null; String tableSql = SQL + tableName; try { pStemt = conn.prepareStatement(tableSql); //结果集元数据 ResultSetMetaData rsmd = pStemt.getMetaData(); //表列数 int size = rsmd.getColumnCount(); for (int i = 0; i < size; i++) { columnTypes.add(rsmd.getColumnTypeName(i + 1)); } } catch (SQLException e) { log.error("getColumnTypes failure", e); } finally { if (pStemt != null) { try { pStemt.close(); closeConnection(conn); } catch (SQLException e) { log.error("getColumnTypes close pstem and connection failure", e); } } } return columnTypes; } /** * 获取表中字段的所有注释 * @param tableName * @return */ public static List<String> getColumnComments(String tableName) { List<String> columnTypes = new ArrayList<>(); //与数据库的连接 Connection conn = getConnection(); PreparedStatement pStemt = null; String tableSql = SQL + tableName; List<String> columnComments = new ArrayList<>();//列名注释集合 ResultSet rs = null; try { pStemt = conn.prepareStatement(tableSql); rs = pStemt.executeQuery("show full columns from " + tableName); while (rs.next()) { columnComments.add(rs.getString("Comment")); } } catch (SQLException e) { e.printStackTrace(); } finally { if (rs != null) { try { rs.close(); closeConnection(conn); } catch (SQLException e) { log.error("getColumnComments close ResultSet and connection failure", e); } } } return columnComments; } /** * 获取表主键 * @param tableName * @throws Exception */ public static String getMysqlTablePK(String tableName) throws Exception { Connection conn = getConnection(); ResultSet rs = null; rs = conn.getMetaData().getPrimaryKeys(conn.getCatalog().toUpperCase(), null, tableName.toUpperCase()); rs.next(); closeConnection(conn); return rs.getString("COLUMN_NAME"); } /** * 获取模板元素 * @param tableName * @return */ public static GenContent getModel(String tableName) throws Exception { GenContent genContent=new GenContent(); String[] splitTableName=tableName.split("_"); StringBuffer className=new StringBuffer(); StringBuffer varName=new StringBuffer(); //这是对象的类名,变量名 for(int i=0;i<splitTableName.length;i++){ //把下斜杠去掉再把每个斜杠后面的字符大写 String splitContent=splitTableName[i].substring(0,1).toUpperCase().concat(splitTableName[i].substring(1)); String splitVarContent=i==0?splitTableName[i].substring(0,1).concat(splitTableName[i].substring(1)):splitTableName[i].substring(0,1).toUpperCase().concat(splitTableName[i].substring(1)); className.append(splitContent); varName.append(splitVarContent); } //获取表的注释 String tableComment=getTableCommonts(tableName); //获取表的主键 String pk=getMysqlTablePK(tableName); genContent.setClassName(className.toString()); genContent.setVarName(varName.toString()); genContent.setTableName(tableName); genContent.setTableComment(tableComment); //拿到所有的字段属性 List<String> columnNames=getColumnNames(tableName); List<String> columnType=getColumnTypes(tableName); List<String> columnComment=getColumnComments(tableName); List<GenColumn> columns=new ArrayList<>(); for(int i=0;i<columnNames.size();i++){ GenColumn genColumn=new GenColumn(); genColumn.setColumn(columnNames.get(i)); genColumn.setColumnType(columnType.get(i)); genColumn.setColumnRemark(columnComment.get(i)); if(columnNames.get(i).equals(pk)){ genColumn.setIsPK(1); } String javaType=convertType(columnType.get(i)); genColumn.setColumnJavaType(javaType); //对象里的字段名称 StringBuffer ModelColunmName=new StringBuffer(); String[] splitColumnName=columnNames.get(i).split("_"); for(int j=0;j<splitColumnName.length;j++){ String splitContent=j==0?splitColumnName[j].substring(0,1).concat(splitColumnName[j].substring(1)):splitColumnName[j].substring(0,1).toUpperCase().concat(splitColumnName[j].substring(1)); ModelColunmName.append(splitContent); } genColumn.setModelColumn(ModelColunmName.toString()); columns.add(genColumn); } genContent.setGenColumns(columns); return genContent; } /** * 根据数据库类型转换为java类型 * @param columnType * @return */ public static String convertType(String columnType){ String javaType=""; switch (columnType){ case "INT":javaType="int";break; case "BIGINT":javaType="long";break; case "VARCHAR":javaType="String";break; case "DECIMAL":javaType="BigDecimal";break; case "DATETIME":javaType="Date";break; } return javaType; } /** * 截取注释信息 * @param all * @return */ public static String parse(String all) { String comment = null; int index = all.indexOf("COMMENT='"); if (index < 0) { return ""; } comment = all.substring(index + 9); comment = comment.substring(0, comment.length() - 1); return comment; } public static void main(String[] args) throws Exception { // List<String> tableNames = getTableNames(); // System.out.println("tableNames:" + tableNames); // for (String tableName : tableNames) { // System.out.println("ColumnNames:" + getColumnNames(tableName)); // System.out.println("ColumnTypes:" + getColumnTypes(tableName)); // System.out.println("ColumnComments:" + getColumnComments(tableName)); // System.out.println(getTableCommonts("user")); // } System.out.println(getMysqlTablePK("user_test")); // GenContent genContent=getModel("user_test"); // System.out.println(genContent.getClassName()); } }
e647cf7afa6af856571dcbfbcd0711cfb5ad739c
2cbaa5ae3362493be9b811779ac8ec09541af3ce
/AssignLabProject/src/java/Pojo/UsersAssistance.java
e1e89b468cfe180d289b6c9cf5be2c603cd1e016
[]
no_license
LabAssProject/AssignLabProject
2f1d3f2ff442c0ad5bc98773728231e00371f840
90aa3843f143b8c2b0fc65c17ebba4505e2e7018
refs/heads/master
2021-01-22T01:33:34.248872
2015-03-22T18:05:57
2015-03-22T18:05:57
32,624,260
0
0
null
null
null
null
UTF-8
Java
false
false
1,331
java
package Pojo; // Generated Mar 22, 2015 7:46:58 PM by Hibernate Tools 3.6.0 import java.util.HashSet; import java.util.Set; /** * UsersAssistance generated by hbm2java */ public class UsersAssistance implements java.io.Serializable { private int assisqueueId; private Set labs = new HashSet(0); private Set usersAssistanceHasTrainees = new HashSet(0); public UsersAssistance() { } public UsersAssistance(int assisqueueId) { this.assisqueueId = assisqueueId; } public UsersAssistance(int assisqueueId, Set labs, Set usersAssistanceHasTrainees) { this.assisqueueId = assisqueueId; this.labs = labs; this.usersAssistanceHasTrainees = usersAssistanceHasTrainees; } public int getAssisqueueId() { return this.assisqueueId; } public void setAssisqueueId(int assisqueueId) { this.assisqueueId = assisqueueId; } public Set getLabs() { return this.labs; } public void setLabs(Set labs) { this.labs = labs; } public Set getUsersAssistanceHasTrainees() { return this.usersAssistanceHasTrainees; } public void setUsersAssistanceHasTrainees(Set usersAssistanceHasTrainees) { this.usersAssistanceHasTrainees = usersAssistanceHasTrainees; } }
c0c6aa93c0dbd4a7b2069d0a8eb13e1cb4f81cba
ddd4c91bc3569c65458f49db481a6afd7004a298
/java-learn/src/main/java/com/thor/java/learn/annotation/MethodAnnotation.java
4711350511949cd4bd6cf4f926b57fdc1467273d
[]
no_license
4115019/thor
a06567ffff28a558c2117706ebd40be68eca993b
98661fe9e3b498378ca7c4a01b93a38cd02af77a
refs/heads/master
2022-09-02T10:59:46.164194
2020-04-18T06:25:50
2020-04-18T06:25:50
159,481,357
0
0
null
2022-09-01T23:08:00
2018-11-28T10:03:33
Java
UTF-8
Java
false
false
291
java
package com.thor.java.learn.annotation; import java.lang.annotation.*; /** * @author huangpin * @date 2019-06-10 */ @Documented @Inherited @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) public @interface MethodAnnotation { String desc() default "methodDefault"; }
ec6f14a3819216a55a7f06516a3fa8a739a9e6da
5fd0122ac80a720eda06bc829a6bcd8523512737
/databaseProvisioner/src/main/groovy/com/lemuelinchrist/hymns/lib/beans/HymnsEntity.java
480d3f145b139ab289e78341c2ea856e8dd9f074
[ "Apache-2.0" ]
permissive
Rejeev/hymnsforandroid
d27271b340d56f411b311185473291533c7028c2
b6b6616a274a042f4cb33f682aad0d58cd2d13f4
refs/heads/master
2021-02-11T03:51:45.411685
2020-05-10T07:07:47
2020-05-10T07:07:47
244,450,630
0
0
Apache-2.0
2020-03-14T03:18:59
2020-03-02T18:57:43
TSQL
UTF-8
Java
false
false
10,333
java
package com.lemuelinchrist.hymns.lib.beans; import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; import javax.persistence.Basic; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.OneToMany; /** * Created by lcantos on 8/6/13. */ @Entity @javax.persistence.Table(name = "hymns", schema = "", catalog = "") public class HymnsEntity { @Id @javax.persistence.Column(name = "_id") private String id; @Basic @javax.persistence.Column(name = "hymn_group") private String hymnGroup; @Basic @javax.persistence.Column(name = "first_stanza_line") private String firstStanzaLine; @Basic @javax.persistence.Column(name = "first_chorus_line") private String firstChorusLine; @Basic @javax.persistence.Column(name = "main_category") private String mainCategory; @Basic @javax.persistence.Column(name = "sub_category") private String subCategory; @Basic @javax.persistence.Column(name = "meter") private String meter; @Basic @javax.persistence.Column(name = "author") private String author; @Basic @javax.persistence.Column(name = "composer") private String composer; @Basic @javax.persistence.Column(name = "time") private String time; @Basic @javax.persistence.Column(name = "key") private String key; @Basic @javax.persistence.Column(name = "tune") private String tune; @Basic @javax.persistence.Column(name = "no") private String no; @Basic @javax.persistence.Column(name = "related") private String related; @OneToMany(mappedBy="parentHymn", fetch = FetchType.EAGER,cascade= CascadeType.ALL) private List<StanzaEntity> stanzas; @Basic @javax.persistence.Column(name = "parent_hymn") private String parentHymn; @Basic @javax.persistence.Column(name = "sheet_music_link") private String sheetMusicLink; // @OneToMany(mappedBy="hymn",fetch = FetchType.EAGER,cascade=CascadeType.ALL,orphanRemoval=true) // private List<RelatedEntity> relatedHymns; @Basic @javax.persistence.Column(name = "verse") private String verse; public String getParentHymn() { return parentHymn; } public void setParentHymn(String parentHymn) { this.parentHymn = parentHymn; } public String getSheetMusicLink() { return sheetMusicLink; } public void setSheetMusicLink(String sheetMusicLink) { this.sheetMusicLink = sheetMusicLink; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getHymnGroup() { return hymnGroup; } public void setHymnGroup(String hymnGroup) { this.hymnGroup = hymnGroup; } public String getFirstStanzaLine() { return firstStanzaLine; } public void setFirstStanzaLine(String firstStanzaLine) { this.firstStanzaLine = firstStanzaLine; } public String getFirstChorusLine() { return firstChorusLine; } public void setFirstChorusLine(String firstChorusLine) { this.firstChorusLine = firstChorusLine; } public String getMainCategory() { return mainCategory; } public void setMainCategory(String mainCategory) { this.mainCategory = mainCategory; } public String getSubCategory() { return subCategory; } public void setSubCategory(String subCategory) { this.subCategory = subCategory; } public String getMeter() { return meter; } public void setMeter(String meter) { this.meter = meter; } public String getAuthor() { return author; } public void setAuthor(String author) { this.author = author; } public String getComposer() { return composer; } public void setComposer(String composer) { this.composer = composer; } public String getTime() { return time; } public void setTime(String time) { this.time = time; } public String getKey() { return key; } public void setKey(String key) { this.key = key; } public String getTune() { return tune; } public void setTune(String tune) { this.tune = tune; } public String getNo() { return no; } public void setNo(String no) { this.no = no; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; HymnsEntity that = (HymnsEntity) o; if (author != null ? !author.equals(that.author) : that.author != null) return false; if (composer != null ? !composer.equals(that.composer) : that.composer != null) return false; if (firstChorusLine != null ? !firstChorusLine.equals(that.firstChorusLine) : that.firstChorusLine != null) return false; if (firstStanzaLine != null ? !firstStanzaLine.equals(that.firstStanzaLine) : that.firstStanzaLine != null) return false; if (hymnGroup != null ? !hymnGroup.equals(that.hymnGroup) : that.hymnGroup != null) return false; if (!id.equals(that.id)) return false; if (key != null ? !key.equals(that.key) : that.key != null) return false; if (mainCategory != null ? !mainCategory.equals(that.mainCategory) : that.mainCategory != null) return false; if (meter != null ? !meter.equals(that.meter) : that.meter != null) return false; if (no != null ? !no.equals(that.no) : that.no != null) return false; if (stanzas != null ? !stanzas.equals(that.stanzas) : that.stanzas != null) return false; if (subCategory != null ? !subCategory.equals(that.subCategory) : that.subCategory != null) return false; if (time != null ? !time.equals(that.time) : that.time != null) return false; if (tune != null ? !tune.equals(that.tune) : that.tune != null) return false; return true; } public List<StanzaEntity> getStanzas() { return stanzas; } public void setStanzas(List<StanzaEntity> stanzas) { this.stanzas = stanzas; } // @Override // public int hashCode() { // int result = id.hashCode(); // result = 31 * result + (hymnGroup != null ? hymnGroup.hashCode() : 0); // result = 31 * result + (firstStanzaLine != null ? firstStanzaLine.hashCode() : 0); // result = 31 * result + (firstChorusLine != null ? firstChorusLine.hashCode() : 0); // result = 31 * result + (mainCategory != null ? mainCategory.hashCode() : 0); // result = 31 * result + (subCategory != null ? subCategory.hashCode() : 0); // result = 31 * result + (meter != null ? meter.hashCode() : 0); // result = 31 * result + (author != null ? author.hashCode() : 0); // result = 31 * result + (composer != null ? composer.hashCode() : 0); // result = 31 * result + (time != null ? time.hashCode() : 0); // result = 31 * result + (key != null ? key.hashCode() : 0); // result = 31 * result + (tune != null ? tune.hashCode() : 0); // result = 31 * result + (no != null ? no.hashCode() : 0); // result = 31 * result + (chorusCount != null ? chorusCount.hashCode() : 0); // result = 31 * result + (stanzaCount != null ? stanzaCount.hashCode() : 0); // result = 31 * result + (stanzas != null ? stanzas.hashCode() : 0); // result = 31 * result + (relatedHymns != null ? relatedHymns.hashCode() : 0); // return result; // } @Override public String toString() { return "HymnsEntity{" + "id='" + id + '\'' + ", hymnGroup='" + hymnGroup + '\'' +"\n"+ ", firstStanzaLine='" + firstStanzaLine + '\'' +"\n"+ ", firstChorusLine='" + firstChorusLine + '\'' +"\n"+ ", mainCategory='" + mainCategory + '\'' +"\n"+ ", subCategory='" + subCategory + '\'' +"\n"+ ", meter='" + meter + '\'' +"\n"+ ", author='" + author + '\'' +"\n"+ ", composer='" + composer + '\'' +"\n"+ ", time='" + time + '\'' +"\n"+ ", key='" + key + '\'' +"\n"+ ", tune='" + tune + '\'' +"\n"+ ", no='" + no + '\'' +"\n"+ ", stanzas=" + stanzas +"\n"+ ", parentHymn='" + parentHymn + '\'' +"\n"+ ", sheetMusicLink='" + sheetMusicLink + '\'' +"\n"+ ", verse='" + verse + '\'' +"\n"+ ", related='" + related + '\'' +"\n"+ '}'; } public void setVerse(String verse) { this.verse = verse; } public String getVerse() { return verse; } public Set<String> getRelated() { if (related==null) return null; String [] relatedArray = related.split(","); HashSet<String> relatedSet = new HashSet<String>(Arrays.asList(relatedArray)); return relatedSet; } public int getNumberOfChorus() { int numberOfChorus=0; for(StanzaEntity stanza: this.stanzas) { if(stanza.getNo().toLowerCase().trim().equals("chorus")) numberOfChorus++; } return numberOfChorus; } public void setRelated(Set<String> related) { StringBuilder relatedBuilder = new StringBuilder(); if (related==null) { this.related=null; return; } for(String r: related) { relatedBuilder.append(r+","); } this.related = relatedBuilder.toString(); } public void removeRelated(String relatedText) { Set<String> related = getRelated(); related.remove(relatedText); setRelated(related); } public void setRelatedString(String related) { this.related = related; } public void addRelated(String relatedText) { Set<String> related = getRelated(); related.add(relatedText); setRelated(related); } }
84cae064d3416328dcc14edadc86ce9b3ccc5f96
129f58086770fc74c171e9c1edfd63b4257210f3
/src/testcases/CWE134_Uncontrolled_Format_String/CWE134_Uncontrolled_Format_String__Property_format_52b.java
4c4ef3ed66abea1ba80191e436dcbc51ec45852b
[]
no_license
glopezGitHub/Android23
1bd0b6a6c7ce3c7439a74f1e4dcef2c4c0fac4ba
6215d0684c4fbdc7217ccfbedfccfca69824cc5e
refs/heads/master
2023-03-07T15:14:59.447795
2023-02-06T13:59:49
2023-02-06T13:59:49
6,856,387
0
3
null
2023-02-06T18:38:17
2012-11-25T22:04:23
Java
UTF-8
Java
false
false
1,396
java
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE134_Uncontrolled_Format_String__Property_format_52b.java Label Definition File: CWE134_Uncontrolled_Format_String.label.xml Template File: sources-sinks-52b.tmpl.java */ /* * @description * CWE: 134 Uncontrolled Format String * BadSource: Property Read data from a system property * GoodSource: A hardcoded string * Sinks: format * GoodSink: dynamic formatted stdout with string defined * BadSink : dynamic formatted stdout without validation * Flow Variant: 52 Data flow: data passed as an argument from one method to another to another in three different classes in the same package * * */ package testcases.CWE134_Uncontrolled_Format_String; import testcasesupport.*; public class CWE134_Uncontrolled_Format_String__Property_format_52b { public void bad_sink(String data ) throws Throwable { (new CWE134_Uncontrolled_Format_String__Property_format_52c()).bad_sink(data ); } /* goodG2B() - use goodsource and badsink */ public void goodG2B_sink(String data ) throws Throwable { (new CWE134_Uncontrolled_Format_String__Property_format_52c()).goodG2B_sink(data ); } /* goodB2G() - use badsource and goodsink */ public void goodB2G_sink(String data ) throws Throwable { (new CWE134_Uncontrolled_Format_String__Property_format_52c()).goodB2G_sink(data ); } }
8f79eed25ee846384d0cf89bfbce07869a8f1fb0
e1c3302ffc9cab4aac75fbd642554d0f4674f4db
/app/src/androidTest/java/jwy/mvpinandroid/ExampleInstrumentedTest.java
e9edbfb06fd0d063c11277ee14ebfc4ce45fa1c7
[]
no_license
Jwangyou/MVPInAndroid
06f12f1887c9daac32bc20050e2c8697c23ac9e1
4d86dc3b674fc546c0213a5dc7aea718d9ba7758
refs/heads/master
2021-01-19T23:12:20.679053
2017-04-21T03:31:57
2017-04-21T03:31:57
88,935,188
1
0
null
null
null
null
UTF-8
Java
false
false
736
java
package jwy.mvpinandroid; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumentation test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("jwy.mvpinandroid", appContext.getPackageName()); } }
7425a04397823aaed67748de70f1cccc2e502120
21a672c92dcd855b874d34afe8a8e4aab5d8b562
/19-stpl-gtn-portal/ItemMs/stpl-gtn-item-common/src/main/java/com/stpl/gtn/item/domain/event/ItemMsGenericEvent.java
6d8b619ad85de4fb562114f340a54bfe3dbc9cec
[]
no_license
amanver16/ServiceMixDemo
fe445ea7d17ba50509a850942f59d9a986a20703
9da4e08c0b543e62ffe0e99d03eb23d156b4370e
refs/heads/master
2020-03-30T22:52:46.816969
2018-10-05T07:15:45
2018-10-05T07:15:45
151,681,632
0
1
null
null
null
null
UTF-8
Java
false
false
2,056
java
package com.stpl.gtn.item.domain.event; public class ItemMsGenericEvent { public ItemMsGenericEvent() { super(); } private String eventName; private String aggregateId; private String aggregateType; private String raisedTime; private String originCommandRequestId; private String originCommandName; private String originAggregateId; private String originIssuedTime; private String eventData; private String version = "1"; public String getEventName() { return eventName; } public void setEventName(String eventName) { this.eventName = eventName; } public String getAggregateId() { return aggregateId; } public void setAggregateId(String aggregateId) { this.aggregateId = aggregateId; } public String getAggregateType() { return aggregateType; } public void setAggregateType(String aggregateType) { this.aggregateType = aggregateType; } public String getRaisedTime() { return raisedTime; } public void setRaisedTime(String raisedTime) { this.raisedTime = raisedTime; } public String getOriginCommandRequestId() { return originCommandRequestId; } public void setOriginCommandRequestId(String originCommandRequestId) { this.originCommandRequestId = originCommandRequestId; } public String getOriginCommandName() { return originCommandName; } public void setOriginCommandName(String originCommandName) { this.originCommandName = originCommandName; } public String getOriginAggregateId() { return originAggregateId; } public void setOriginAggregateId(String originAggregateId) { this.originAggregateId = originAggregateId; } public String getOriginIssuedTime() { return originIssuedTime; } public void setOriginIssuedTime(String originIssuedTime) { this.originIssuedTime = originIssuedTime; } public String getEventData() { return eventData; } public void setEventData(String eventData) { this.eventData = eventData; } public String getVersion() { return version; } public void setVersion(String version) { this.version = version; } }
99f2bcfc8e2265d0987ccb4ae304b7031f801ca7
f33105373e0f786a9fef32a1ff8fc23b61992fc9
/Prototype/Otomate/Jeu.java
4df41a35001d45fcfd573a52fd9641cdee090e49
[]
no_license
OTomate/OTomate
1e06e137b2736c082d5cd80354509e3f1307dc5a
15a87de1e04da183a5aa6632f1b1675ec4085844
refs/heads/master
2021-06-01T06:18:41.073561
2016-06-19T22:28:01
2016-06-19T22:28:01
null
0
0
null
null
null
null
ISO-8859-1
Java
false
false
3,150
java
package Otomate; import Affichage.*; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import java.util.Random; import java.io.File; public class Jeu { public static int random(int min, int max) throws InterruptedException{ Random r = new Random(); int k = min + r.nextInt(max - min); return k; } //Attributs public static Grille plateau; static List<Joueur> joueurs; //Méthodes public static int initPartie(){ System.out.println("Partie avec deux joueurs."); System.out.println("On récupère les deux automates des joueurs :"); Joueur J1 = new Joueur("../../automates/Automate1.xml",false); Joueur J2 = new Joueur("../../automates/Automate2.xml",true); joueurs = new ArrayList<Joueur>(); joueurs.add(J1); joueurs.add(J2); plateau = new Grille(); Grille.initialisergrille(joueurs); return 0; } public static boolean finPartie() { int k = 0; for(int i=0; i<joueurs.size(); i++) { if(joueurs.get(i).getPersonnages().get(k).getVie() > 0) { k++; } } return k<=1; } public static void melange() { Random rnd = new Random(); int k; for(int i=joueurs.size(); i>0 ; i--) { k = rnd.nextInt(i); joueurs.add(joueurs.get(k)); joueurs.remove(k); } } public static List<Joueur> addJoueurs(String fichiers) throws InterruptedException { List<Joueur> joueurs = new LinkedList<Joueur>(); // int k = 1;//random(1,1); for(int i=0; i<1; i++) { joueurs.add(new Joueur(fichiers,false/*i==k*/)); } return joueurs; } public static void main(String[] pArgs) throws InterruptedException { plateau = new Grille(); // File repertoire = new File("../automate/"); // "../automates/" --> répertoire des automates en .xml String fichiers = new File("AutomateenXML.xml").toString(); // liste des noms de fichiers d'automates joueurs = addJoueurs(fichiers); // System.out.println("coucou" +1 ); Grille.initialisergrille(joueurs); // création de la grille // affichagePartie(plateau, joueurs); // lancement de l'affichage graphique // System.out.println("coucou"); Affichage.recharger(plateau,joueurs); while(/*!finPartie()*/true) { System.out.println(joueurs.get(0).getPersonnagesI(0).getPosition().getX() +" "+ joueurs.get(0).getPersonnagesI(0).getPosition().getY()); Thread.sleep(200); // (faux) timer 1 seconde melange(); for(int i=0; i<joueurs.size(); i++) { System.out.println("random : " + random(1,5)); //System.out.println("SBLEU : "+joueurs.get(i).getPersonnagesI(0).etat+"\n"); joueurs.get(i).getPersonnagesI(0).jouer(plateau, joueurs); } } } }
436b0969d7bcb19dec7ef42b71fe6c4aa4209182
ded401fb8e53a01a40b2d58e09681cc8411ebaa1
/Library/src/main/java/com/alticast/viettelottcommons/dialog/PhoneSignupFragment.java
b38b36aeed209651c99f1c9b5e9fa7919452b7ea
[]
no_license
morristech/Library2
a44cd15078d148cb1e1ffb8faf052e276a25bd87
6f60320af4de0ecb9a89352618252ad3ad22aa6b
refs/heads/master
2020-05-24T05:12:30.935671
2018-06-14T19:18:38
2018-06-14T19:18:38
null
0
0
null
null
null
null
UTF-8
Java
false
false
18,208
java
package com.alticast.viettelottcommons.dialog; import android.content.Context; import android.content.DialogInterface; import android.content.DialogInterface.OnDismissListener; import android.graphics.Typeface; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.support.v4.app.DialogFragment; import android.text.Editable; import android.text.TextWatcher; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.View.OnFocusChangeListener; import android.view.View.OnKeyListener; import android.view.ViewGroup; import android.view.inputmethod.InputMethodManager; import android.widget.Button; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.TextView; import com.alticast.viettelottcommons.R; import com.alticast.viettelottcommons.activity.App; import com.alticast.viettelottcommons.api.WindmillCallback; import com.alticast.viettelottcommons.loader.FrontEndLoader; import com.alticast.viettelottcommons.resource.ApiError; import com.alticast.viettelottcommons.resource.AuthCodeRes; import com.alticast.viettelottcommons.resource.ResultRes; import retrofit2.Call; public class PhoneSignupFragment extends DialogFragment implements OnClickListener { public static final String CLASS_NAME = PhoneSignupFragment.class.getName(); private static final String TAG = PhoneSignupFragment.class.getSimpleName(); private OnDismissListener mOnDismissListener; private TextView mEmailCheckMessageView; private TextView mPasswordCheckMessageView; private EditText mIdInput; private EditText mSmsInput; private EditText mPasswordInput; private EditText mPasswordConfirmInput; private Button mVerifyButton; private Button mCreateButton; private String mCheckedEmail; private TextView authInvalideCnt = null; private TextView auchCnt = null; private LinearLayout authCntLayout = null; private ProgressDialogFragment mProgressDialogFragment; private CntHandler cntHandler = null; public static PhoneSignupFragment newInstance(Context context) { PhoneSignupFragment fragment = new PhoneSignupFragment(); return fragment; } public PhoneSignupFragment() { } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setStyle(DialogFragment.STYLE_NORMAL, R.style.Dialog_Fullscreen); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragment_signup_phone_num, container, false); v.findViewById(R.id.close_button).setOnClickListener(this); mEmailCheckMessageView = (TextView) v.findViewById(R.id.email_check_message); mPasswordCheckMessageView = (TextView) v.findViewById(R.id.password_check_message); mIdInput = (EditText) v.findViewById(R.id.id_input); mSmsInput = (EditText) v.findViewById(R.id.sms_input); mPasswordInput = (EditText) v.findViewById(R.id.password_input); mPasswordConfirmInput = (EditText) v.findViewById(R.id.password_confirm_input); mVerifyButton = (Button) v.findViewById(R.id.verify_button); mCreateButton = (Button) v.findViewById(R.id.create_button); authInvalideCnt = (TextView) v.findViewById(R.id.authInvalideCnt); auchCnt = (TextView) v.findViewById(R.id.auchCnt); authCntLayout = (LinearLayout) v.findViewById(R.id.authCntLayout); authCntLayout.setVisibility(View.INVISIBLE); mPasswordInput.setTypeface(Typeface.SANS_SERIF); mPasswordConfirmInput.setTypeface(Typeface.SANS_SERIF); mVerifyButton.setOnClickListener(this); mCreateButton.setOnClickListener(this); mIdInput.addTextChangedListener(new SignUpTextWatcher(mIdInput)); mSmsInput.addTextChangedListener(new SignUpTextWatcher(mSmsInput)); mSmsInput.setEnabled(false); mPasswordInput.setEnabled(false); mPasswordConfirmInput.setEnabled(false); mPasswordInput.addTextChangedListener(new SignUpTextWatcher(mPasswordInput)); mPasswordConfirmInput.addTextChangedListener(new SignUpTextWatcher(mPasswordConfirmInput)); v.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) hideKeyboard(); } }); v.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) { showExitDialog(); return true; } return false; } }); return v; } @Override public void onDestroy() { super.onDestroy(); if (cntHandler == null) { return; } cntHandler.sendEmptyMessage(CntHandler.STOP); } @Override public void onDismiss(DialogInterface dialog) { super.onDismiss(dialog); if (mOnDismissListener != null) mOnDismissListener.onDismiss(dialog); } @Override public void onClick(View v) { int i = v.getId(); if (i == R.id.close_button) { showExitDialog(); } else if (i == R.id.verify_button) { verifyPhoneNumber(); } else if (i == R.id.create_button) { createAccount(); } } public void showExitDialog() { String title = getString(R.string.pop_quit_create_account_title); String message = getString(R.string.pop_quit_create_account_desc); showMessageDialog(title, message, new Runnable() { @Override public void run() { dismiss(); } }); } private void verifyPhoneNumber() { mEmailCheckMessageView.setText(""); String email = mIdInput.getText().toString(); showProgress(); FrontEndLoader.getInstance().checkID(email, new WindmillCallback() { @Override public void onSuccess(Object obj) { mVerifyButton.setEnabled(false); ResultRes result = (ResultRes) obj; if (result.isResult()) { mIdInput.setText(""); showMessageDialog(getString(R.string.create_account_already_title), getString(R.string.create_account_already_sub) + "\n" + getString(R.string.create_account_already_des)); } else { mCheckedEmail = mIdInput.getText().toString(); requestAuthCode(); } hideProgress(); } @Override public void onFailure(Call call, Throwable t) { hideProgress(); } @Override public void onError(ApiError error) { hideProgress(); mIdInput.setText(""); showMessageDialog(getString(R.string.notice), error.getError().getMessage()); } }); } private void createAccount() { final String email = mIdInput.getText().toString(); String password = mPasswordInput.getText().toString(); String passwordConfirm = mPasswordConfirmInput.getText().toString(); if (!password.equals(passwordConfirm)) { mPasswordConfirmInput.getText().clear(); mPasswordInput.getText().clear(); mPasswordCheckMessageView.setText(R.string.myaccount_wrongpassword); // showKeyboard(); return; } //########################################################### //cntHandler.sendEmptyMessage(CntHandler.STOP); //########################################################### String otp = mSmsInput.getText().toString().trim(); showProgress(); // FrontEndLoader.getInstance().checkID(); FrontEndLoader.getInstance().createAccount(email, password, otp, new WindmillCallback() { @Override public void onSuccess(Object obj) { hideProgress(); App.getToast(getActivity(), getString(R.string.create_account_title), getString(R.string.create_account_noti, email), false).show(); cntHandler.sendEmptyMessage(CntHandler.STOP); dismiss(); } @Override public void onFailure(Call call, Throwable t) { hideProgress(); } @Override public void onError(ApiError error) { hideProgress(); mSmsInput.setText(""); final MessageDialog dialog = new MessageDialog(); Bundle args = new Bundle(); args.putString(MessageDialog.PARAM_TITLE, getString(R.string.findPassword_invalid_sms_title)); args.putString(MessageDialog.PARAM_COLOR_MESSAGE, getString(R.string.findPassword_invalid_sms_msg)); args.putString(MessageDialog.PARAM_BUTTON_1, getString(R.string.ok)); dialog.setArguments(args); dialog.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); dialog.show(getChildFragmentManager(), MessageDialog.CLASS_NAME); } }); } public void setOnDismissListener(OnDismissListener onDismissListener) { this.mOnDismissListener = onDismissListener; } private void requestAuthCode() { FrontEndLoader.getInstance().requestAuthenticationCode(mCheckedEmail, new WindmillCallback() { @Override public void onSuccess(Object obj) { hideProgress(); AuthCodeRes codeRes = (AuthCodeRes) obj; if (cntHandler != null) { cntHandler.sendEmptyMessage(CntHandler.STOP); cntHandler = null; } mVerifyButton.setEnabled(false); cntHandler = new CntHandler(codeRes.getTimeout()); cntHandler.sendEmptyMessage(CntHandler.RUN); } @Override public void onFailure(Call call, Throwable t) { hideProgress(); } @Override public void onError(ApiError error) { hideProgress(); mIdInput.setText(""); showMessageDialog(getString(R.string.notice), error.getError().getMessage()); } }); } private void showMessageDialog(String title, String message) { final MessageDialog dialog = new MessageDialog(); Bundle args = new Bundle(); args.putString(MessageDialog.PARAM_TITLE, title); args.putString(MessageDialog.PARAM_MESSAGE, message); args.putString(MessageDialog.PARAM_BUTTON_1, getString(R.string.ok)); dialog.setArguments(args); dialog.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); dialog.show(getChildFragmentManager(), MessageDialog.CLASS_NAME); } private class CntHandler extends Handler { private boolean isStop = false; private final String TAG = CntHandler.class.getSimpleName(); private int cnt = 0; public static final int RUN = 0; public static final int STOP = 1; public static final int OVER = 2; private final int timeOffset = 1000; public CntHandler(int cnt) { this.cnt = cnt / 1000; } public boolean isStop() { return isStop; } private String changeTime(int time) { int min = time / 60; int tmpS = time % 60; String sec = null; if (tmpS < 10) { sec = "0" + tmpS; } else { sec = String.valueOf(tmpS); } if (min == 0) { return sec + " " + getString(R.string.sec); } else { return min + " " + getString(R.string.min) + " " + sec + " " + getString(R.string.sec); } } @Override public void handleMessage(Message msg) { super.handleMessage(msg); switch (msg.what) { case RUN: if (isStop) { return; } if (cnt > 0) { authCntLayout.setVisibility(View.VISIBLE); authInvalideCnt.setText(getString(R.string.create_account_auth_cnt_title)); auchCnt.setText(changeTime(cnt--)); mSmsInput.setEnabled(true); sendEmptyMessageDelayed(RUN, timeOffset); } else { mVerifyButton.setText(getString(R.string.create_account_id_re_button_phone)); //######################################### mVerifyButton.setEnabled(true); //######################################### authCntLayout.setVisibility(View.VISIBLE); mSmsInput.setEnabled(false); authInvalideCnt.setText(getString(R.string.create_account_auth_cnt_over)); auchCnt.setText(""); sendEmptyMessage(OVER); } break; case STOP: isStop = true; authCntLayout.setVisibility(View.INVISIBLE); break; default: break; } } } private class SignUpTextWatcher implements TextWatcher { private View targetView = null; public SignUpTextWatcher(View targetView) { super(); this.targetView = targetView; } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { int i = targetView.getId(); if (i == R.id.id_input) { if (cntHandler != null && !cntHandler.isStop) { mVerifyButton.setText(getString(R.string.create_account_id_re_button_phone)); } mVerifyButton.setEnabled(mIdInput.length() > 0 && !mIdInput.getText().toString().equals(mCheckedEmail)); } else if (i == R.id.sms_input || i == R.id.password_input || i == R.id.password_confirm_input) { } else { } mPasswordInput.setEnabled(mSmsInput.length() * mIdInput.length() > 0); mPasswordConfirmInput.setEnabled(mPasswordInput.length() > 0); mPasswordCheckMessageView.setText(""); mCreateButton.setEnabled(mIdInput.length() * mSmsInput.length() * mPasswordInput.length() * mPasswordConfirmInput.length() != 0); } @Override public void afterTextChanged(Editable s) { } } private void showMessageDialog(String title, String message, final Runnable onOk) { final MessageDialog dialog = new MessageDialog(); Bundle args = new Bundle(); args.putString(MessageDialog.PARAM_TITLE, title); args.putString(MessageDialog.PARAM_MESSAGE, message); args.putString(MessageDialog.PARAM_BUTTON_1, getString(R.string.yes)); args.putString(MessageDialog.PARAM_BUTTON_2, getString(R.string.no)); dialog.setArguments(args); dialog.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (v.getId() == R.id.button1) { onOk.run(); } dialog.dismiss(); } }); dialog.show(getChildFragmentManager(), MessageDialog.CLASS_NAME); } @Override public void dismiss() { hideKeyboard(); super.dismiss(); } public void showKeyboard() { try { mPasswordInput.postDelayed(new Runnable() { @Override public void run() { mPasswordInput.requestFocus(); InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(mPasswordInput, 0); } }, 100); } catch (Exception ignored) { } } public void hideKeyboard() { try { InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(mIdInput.getWindowToken(), 0); imm.hideSoftInputFromWindow(mPasswordInput.getWindowToken(), 0); imm.hideSoftInputFromWindow(mPasswordConfirmInput.getWindowToken(), 0); imm.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(), 0); } catch (NullPointerException ignored) { } } protected void showProgress() { if (mProgressDialogFragment != null && mProgressDialogFragment.isShowing()) { mProgressDialogFragment.dismiss(); } else { mProgressDialogFragment = new ProgressDialogFragment(); } mProgressDialogFragment.show(getFragmentManager(), ""); } protected void hideProgress() { if (mProgressDialogFragment != null && mProgressDialogFragment.isShowing()) { mProgressDialogFragment.dismiss(); } } }
0781e09f0187899b877bde0fc8f3df6f2f416621
1e3a2afac22eb81aafcce41a53dc0a0e4d27b5e2
/MyApplication/app/src/main/java/com/fule/myapplication/group/Group.java
125d251bc44d077c6747268b2e56345e7880156e
[]
no_license
jianyufeng/ChatTestRLY
7d7d36cd4c257a82569c7babd0eb800f38113b1f
9f5c562b6a1b456bf2a45df7002ceeee69a70209
refs/heads/master
2021-07-01T13:19:25.488149
2017-09-22T08:29:22
2017-09-22T08:29:22
104,450,517
0
0
null
null
null
null
UTF-8
Java
false
false
832
java
package com.fule.myapplication.group; /** * Created by Administrator on 2016/11/19. */ public class Group { public int getIcon() { return icon; } public Group() { } public void setIcon(int icon) { this.icon = icon; } private int icon; public String getGroupName() { return groupName; } public void setGroupName(String groupName) { this.groupName = groupName; } public String getGroupIcon() { return groupIcon; } public void setGroupIcon(String groupIcon) { this.groupIcon = groupIcon; } public int getIsMyCreate() { return isMyCreate; } public void setIsMyCreate(int isMyCreate) { this.isMyCreate = isMyCreate; } String groupName; String groupIcon; int isMyCreate; }
0ed06f514a2f02f5ed349843fc3898979c11c2e4
2f993b28611b3aa9d818f21979a279b9f012065b
/apis/demos/library/library-api/src/main/java/org/example/library/api/BooksResource.java
edb452fea1b4183b44a7b06f044462adeebec983
[]
no_license
EricWittmann/api-samples
4aaefc3c4528c23ea7304bb8dde6519159668e8e
9aa456ba552bd944a8c51a92cf8829ca46381198
refs/heads/master
2022-09-21T05:22:06.821172
2022-09-02T16:05:19
2022-09-02T16:05:19
70,914,823
7
2
null
2021-04-27T11:23:18
2016-10-14T13:53:57
Java
UTF-8
Java
false
false
1,202
java
package org.example.library.api; import java.lang.String; import java.util.List; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import org.example.library.api.beans.Book; /** * A JAX-RS interface. An implementation of this interface must be provided. */ @Path("/books") public interface BooksResource { /** * Gets a list of all `Book` entities. */ @GET @Produces("application/json") List<Book> getbooks(); /** * Creates a new instance of a `Book`. */ @POST @Consumes("application/json") void createBook(Book data); /** * Gets the details of a single instance of a `Book`. */ @Path("/{bookId}") @GET @Produces("application/json") Book getBook(@PathParam("bookId") String bookId); /** * Updates an existing `Book`. */ @Path("/{bookId}") @PUT @Consumes("application/json") void updateBook(@PathParam("bookId") String bookId, Book data); /** * Deletes an existing `Book`. */ @Path("/{bookId}") @DELETE void deleteBook(@PathParam("bookId") String bookId); }
e5ce942ab68c219101ed5c8dfba2dbead67b1646
e04869a89a3b496fba0a7dc8e8772eea6eb15239
/src/Board.java
7c75408c8a19eb94d6e2dd4b7af8aa08874d5f77
[]
no_license
monkeyGoCrazy/ChessGame
cefe4b5b2bde4a60c13a49c8ebeae0e8b6bf4db8
d98698101cba093bc03af774d96879f329bc194f
refs/heads/master
2021-01-10T06:09:27.055954
2016-08-30T02:05:58
2016-08-30T02:05:58
49,839,158
0
0
null
null
null
null
UTF-8
Java
false
false
1,274
java
/** * Created by mengleisun on 1/17/16. */ import java.util.*; public class Board { List<Piece> whiteSet; List<Piece> blackSet; Piece[][] board; PieceConstructer factory; Validation valid = new Validation("chess", "1"); public Board() { factory = new PieceConstructer(); whiteSet = factory.generate(PieceColor.Black); blackSet = factory.generate(PieceColor.White); board = new Piece[8][8]; setBoard(board,whiteSet,blackSet); } public void setBoard(Piece[][] board, List<Piece> whiteSet, List<Piece> blackSet) { for (Piece piece: whiteSet) { } for (Piece piece: blackSet) { } } public boolean kill(Location from, Location to) { return true; } public boolean gameOver(){ return true; } public boolean move(Location from, Location to) { //check valid if (board[from.y][from.x] == null) { return false; } Piece piece = board[from.y][from.x]; if (valid.isValidate(board,piece,to)) { Piece temp = board[0][0]; board[0][0] = null; board[to.y][to.x] = temp; return true; } else { return false; } } }
770a15534a2be717cccb7174194b400ad76297b0
69c174986cf33276c7a191234d4d2047d4d8b7be
/bp-elite-core/src/main/java/com/sohu/bp/elite/model/TEliteSquareItem.java
b6f066cc931de3d616b999bf224823106c3061a6
[]
no_license
kevinStudyJava/study
1f99cbcd22fa0037938e0cf5f5ca04cc01f477b2
fa09200ebb8a5adc78322eecb661800574f03160
refs/heads/master
2021-01-21T17:13:24.765390
2017-05-21T08:19:57
2017-05-21T08:19:57
91,940,884
0
1
null
null
null
null
UTF-8
Java
false
true
14,949
java
/** * Autogenerated by Thrift Compiler (0.9.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated */ package com.sohu.bp.elite.model; import org.apache.thrift.scheme.IScheme; import org.apache.thrift.scheme.SchemeFactory; import org.apache.thrift.scheme.StandardScheme; import org.apache.thrift.scheme.TupleScheme; import org.apache.thrift.protocol.TTupleProtocol; import org.apache.thrift.protocol.TProtocolException; import org.apache.thrift.EncodingUtils; import org.apache.thrift.TException; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.util.HashMap; import java.util.EnumMap; import java.util.Set; import java.util.HashSet; import java.util.EnumSet; import java.util.Collections; import java.util.BitSet; import java.nio.ByteBuffer; import java.util.Arrays; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class TEliteSquareItem implements org.apache.thrift.TBase<TEliteSquareItem, TEliteSquareItem._Fields>, java.io.Serializable, Cloneable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TEliteSquareItem"); private static final org.apache.thrift.protocol.TField FEED_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("feedType", org.apache.thrift.protocol.TType.I32, (short)1); private static final org.apache.thrift.protocol.TField FEED_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("feedId", org.apache.thrift.protocol.TType.I64, (short)2); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { schemes.put(StandardScheme.class, new TEliteSquareItemStandardSchemeFactory()); schemes.put(TupleScheme.class, new TEliteSquareItemTupleSchemeFactory()); } public int feedType; // required public long feedId; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { FEED_TYPE((short)1, "feedType"), FEED_ID((short)2, "feedId"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); static { for (_Fields field : EnumSet.allOf(_Fields.class)) { byName.put(field.getFieldName(), field); } } /** * Find the _Fields constant that matches fieldId, or null if its not found. */ public static _Fields findByThriftId(int fieldId) { switch(fieldId) { case 1: // FEED_TYPE return FEED_TYPE; case 2: // FEED_ID return FEED_ID; default: return null; } } /** * Find the _Fields constant that matches fieldId, throwing an exception * if it is not found. */ public static _Fields findByThriftIdOrThrow(int fieldId) { _Fields fields = findByThriftId(fieldId); if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); return fields; } /** * Find the _Fields constant that matches name, or null if its not found. */ public static _Fields findByName(String name) { return byName.get(name); } private final short _thriftId; private final String _fieldName; _Fields(short thriftId, String fieldName) { _thriftId = thriftId; _fieldName = fieldName; } public short getThriftFieldId() { return _thriftId; } public String getFieldName() { return _fieldName; } } // isset id assignments private static final int __FEEDTYPE_ISSET_ID = 0; private static final int __FEEDID_ISSET_ID = 1; private byte __isset_bitfield = 0; public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; static { Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); tmpMap.put(_Fields.FEED_TYPE, new org.apache.thrift.meta_data.FieldMetaData("feedType", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); tmpMap.put(_Fields.FEED_ID, new org.apache.thrift.meta_data.FieldMetaData("feedId", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TEliteSquareItem.class, metaDataMap); } public TEliteSquareItem() { this.feedType = 1; this.feedId = 0L; } public TEliteSquareItem( int feedType, long feedId) { this(); this.feedType = feedType; setFeedTypeIsSet(true); this.feedId = feedId; setFeedIdIsSet(true); } /** * Performs a deep copy on <i>other</i>. */ public TEliteSquareItem(TEliteSquareItem other) { __isset_bitfield = other.__isset_bitfield; this.feedType = other.feedType; this.feedId = other.feedId; } public TEliteSquareItem deepCopy() { return new TEliteSquareItem(this); } @Override public void clear() { this.feedType = 1; this.feedId = 0L; } public int getFeedType() { return this.feedType; } public TEliteSquareItem setFeedType(int feedType) { this.feedType = feedType; setFeedTypeIsSet(true); return this; } public void unsetFeedType() { __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __FEEDTYPE_ISSET_ID); } /** Returns true if field feedType is set (has been assigned a value) and false otherwise */ public boolean isSetFeedType() { return EncodingUtils.testBit(__isset_bitfield, __FEEDTYPE_ISSET_ID); } public void setFeedTypeIsSet(boolean value) { __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __FEEDTYPE_ISSET_ID, value); } public long getFeedId() { return this.feedId; } public TEliteSquareItem setFeedId(long feedId) { this.feedId = feedId; setFeedIdIsSet(true); return this; } public void unsetFeedId() { __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __FEEDID_ISSET_ID); } /** Returns true if field feedId is set (has been assigned a value) and false otherwise */ public boolean isSetFeedId() { return EncodingUtils.testBit(__isset_bitfield, __FEEDID_ISSET_ID); } public void setFeedIdIsSet(boolean value) { __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __FEEDID_ISSET_ID, value); } public void setFieldValue(_Fields field, Object value) { switch (field) { case FEED_TYPE: if (value == null) { unsetFeedType(); } else { setFeedType((Integer)value); } break; case FEED_ID: if (value == null) { unsetFeedId(); } else { setFeedId((Long)value); } break; } } public Object getFieldValue(_Fields field) { switch (field) { case FEED_TYPE: return Integer.valueOf(getFeedType()); case FEED_ID: return Long.valueOf(getFeedId()); } throw new IllegalStateException(); } /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { case FEED_TYPE: return isSetFeedType(); case FEED_ID: return isSetFeedId(); } throw new IllegalStateException(); } @Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof TEliteSquareItem) return this.equals((TEliteSquareItem)that); return false; } public boolean equals(TEliteSquareItem that) { if (that == null) return false; boolean this_present_feedType = true; boolean that_present_feedType = true; if (this_present_feedType || that_present_feedType) { if (!(this_present_feedType && that_present_feedType)) return false; if (this.feedType != that.feedType) return false; } boolean this_present_feedId = true; boolean that_present_feedId = true; if (this_present_feedId || that_present_feedId) { if (!(this_present_feedId && that_present_feedId)) return false; if (this.feedId != that.feedId) return false; } return true; } @Override public int hashCode() { return 0; } public int compareTo(TEliteSquareItem other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; TEliteSquareItem typedOther = (TEliteSquareItem)other; lastComparison = Boolean.valueOf(isSetFeedType()).compareTo(typedOther.isSetFeedType()); if (lastComparison != 0) { return lastComparison; } if (isSetFeedType()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.feedType, typedOther.feedType); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetFeedId()).compareTo(typedOther.isSetFeedId()); if (lastComparison != 0) { return lastComparison; } if (isSetFeedId()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.feedId, typedOther.feedId); if (lastComparison != 0) { return lastComparison; } } return 0; } public _Fields fieldForId(int fieldId) { return _Fields.findByThriftId(fieldId); } public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { schemes.get(iprot.getScheme()).getScheme().read(iprot, this); } public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { schemes.get(oprot.getScheme()).getScheme().write(oprot, this); } @Override public String toString() { StringBuilder sb = new StringBuilder("TEliteSquareItem("); boolean first = true; sb.append("feedType:"); sb.append(this.feedType); first = false; if (!first) sb.append(", "); sb.append("feedId:"); sb.append(this.feedId); first = false; sb.append(")"); return sb.toString(); } public void validate() throws org.apache.thrift.TException { // check for required fields // check for sub-struct validity } private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { try { write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); } catch (org.apache.thrift.TException te) { throw new java.io.IOException(te); } } private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { try { // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. __isset_bitfield = 0; read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); } catch (org.apache.thrift.TException te) { throw new java.io.IOException(te); } } private static class TEliteSquareItemStandardSchemeFactory implements SchemeFactory { public TEliteSquareItemStandardScheme getScheme() { return new TEliteSquareItemStandardScheme(); } } private static class TEliteSquareItemStandardScheme extends StandardScheme<TEliteSquareItem> { public void read(org.apache.thrift.protocol.TProtocol iprot, TEliteSquareItem struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField schemeField; iprot.readStructBegin(); while (true) { schemeField = iprot.readFieldBegin(); if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { break; } switch (schemeField.id) { case 1: // FEED_TYPE if (schemeField.type == org.apache.thrift.protocol.TType.I32) { struct.feedType = iprot.readI32(); struct.setFeedTypeIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 2: // FEED_ID if (schemeField.type == org.apache.thrift.protocol.TType.I64) { struct.feedId = iprot.readI64(); struct.setFeedIdIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } iprot.readFieldEnd(); } iprot.readStructEnd(); // check for required fields of primitive type, which can't be checked in the validate method struct.validate(); } public void write(org.apache.thrift.protocol.TProtocol oprot, TEliteSquareItem struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); oprot.writeFieldBegin(FEED_TYPE_FIELD_DESC); oprot.writeI32(struct.feedType); oprot.writeFieldEnd(); oprot.writeFieldBegin(FEED_ID_FIELD_DESC); oprot.writeI64(struct.feedId); oprot.writeFieldEnd(); oprot.writeFieldStop(); oprot.writeStructEnd(); } } private static class TEliteSquareItemTupleSchemeFactory implements SchemeFactory { public TEliteSquareItemTupleScheme getScheme() { return new TEliteSquareItemTupleScheme(); } } private static class TEliteSquareItemTupleScheme extends TupleScheme<TEliteSquareItem> { @Override public void write(org.apache.thrift.protocol.TProtocol prot, TEliteSquareItem struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; BitSet optionals = new BitSet(); if (struct.isSetFeedType()) { optionals.set(0); } if (struct.isSetFeedId()) { optionals.set(1); } oprot.writeBitSet(optionals, 2); if (struct.isSetFeedType()) { oprot.writeI32(struct.feedType); } if (struct.isSetFeedId()) { oprot.writeI64(struct.feedId); } } @Override public void read(org.apache.thrift.protocol.TProtocol prot, TEliteSquareItem struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; BitSet incoming = iprot.readBitSet(2); if (incoming.get(0)) { struct.feedType = iprot.readI32(); struct.setFeedTypeIsSet(true); } if (incoming.get(1)) { struct.feedId = iprot.readI64(); struct.setFeedIdIsSet(true); } } } }
bd175eb996a6fecd0ac33a7baf9e0df866c2c961
58c0840a501c1745e9a875bf832977f81a624b5f
/src/main/java/com/example/demo/config/AppConfig.java
14ac4345db83674d660f188a6ed8861ed1ae0816
[]
no_license
oxosec/heroku-sftp
1efd67f6a54298978426017348075fb0107b4a1a
f9a2536fcc8cdb876d2076ef469bc5d9035ad2c7
refs/heads/master
2021-06-18T14:05:47.838657
2017-06-16T16:42:22
2017-06-16T16:42:22
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,417
java
package com.example.demo.config; import javax.sql.DataSource; import org.apache.ibatis.session.SqlSessionFactory; import org.mybatis.spring.SqlSessionFactoryBean; import org.springframework.boot.SpringBootConfiguration; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.core.io.support.PathMatchingResourcePatternResolver; import org.springframework.jdbc.datasource.DataSourceTransactionManager; import org.springframework.transaction.PlatformTransactionManager; @SpringBootConfiguration public class AppConfig { @Bean @ConfigurationProperties(prefix = "spring.datasource") public DataSource dataSource() { return new org.apache.tomcat.jdbc.pool.DataSource(); } @Bean public SqlSessionFactory sqlSessionFactoryBean() throws Exception { SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean(); sqlSessionFactoryBean.setDataSource(dataSource()); PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); sqlSessionFactoryBean.setMapperLocations(resolver.getResources("classpath:/sqlmap/*.xml")); return sqlSessionFactoryBean.getObject(); } @Bean public PlatformTransactionManager transactionManager() { return new DataSourceTransactionManager(dataSource()); } }
02f75c673e7accac5153f00cc1cb451c38a5f962
fe4ab0780f917efa0e3dd457d57e4e234bd9eef8
/provider/src/main/java/com/yjy/service/HelloService2Impl.java
fd3917c78e0df777d807f3a95f4095ded0d90acd
[]
no_license
lwkjob/dubbox-test
7caf69dbd6daff265e8d489f8318f76fa15eefa1
b385c99a09aaac866e3c037e298e6dc08b68ec34
refs/heads/master
2020-06-30T22:10:23.188415
2016-10-28T09:08:40
2016-10-28T09:08:40
67,105,361
0
0
null
null
null
null
UTF-8
Java
false
false
295
java
package com.yjy.service; import org.springframework.stereotype.Service; /** * Created by lwk on 2016/10/28. */ @Service("helloService2") public class HelloService2Impl implements HelloService { @Override public String helloString(String msg) { return "我是2:"+msg; } }
fdf8500338e43902b4002a7099d4478b69f47d66
0b81d1aeb10ee2a53589459e362d9f19d7d75bb7
/auth-service/src/main/java/com/nagarro/nagp/authservice/model/LoginRequest.java
c2b79706b35b973d012e6f3ea6cdfcf103dd9fa0
[]
no_license
nav16011991/nagp-microservice-assignment
59f1553c68c911a0e10e5095a5db32ca18fe19e9
5e13a94ae7384c80269d4f2838cd5e8a1ed98e6b
refs/heads/main
2023-09-02T19:57:20.018801
2021-11-22T08:52:38
2021-11-22T08:52:38
427,909,063
0
1
null
null
null
null
UTF-8
Java
false
false
304
java
package com.nagarro.nagp.authservice.model; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; @Data @AllArgsConstructor @NoArgsConstructor @Builder public class LoginRequest { private String username; private String password; }
97fe25b8c465e250c8d70d1dafcfc5c30bad0c09
55e9dccd8369bc92bf81190cd563fc9b6b63e24d
/domain/fun/lottery/fun-box-lottery-pojo/src/main/java/com/hy/lottery/model/LotteryInfo.java
84eae79e9123d968e7647967c8575040b640c117
[]
no_license
wanglianglong0406/group
9adf4d1ae3384a17738c13533d16dda13a979a8a
3af13e0f9424ff5ea4eeecc6cc65d80163ab8b5b
refs/heads/master
2023-04-13T14:22:07.384669
2021-04-20T05:34:04
2021-04-20T05:34:04
359,695,659
0
1
null
null
null
null
UTF-8
Java
false
false
2,869
java
package com.hy.lottery.model; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.extension.activerecord.Model; import com.fasterxml.jackson.annotation.JsonIgnore; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import java.util.Date; /** * (LotteryInfo)表实体类 * * @author 寒夜 * @since 2020-11-23 15:31:44 */ @ApiModel(value = "彩票列表实体对象", description = "返回给客户端的数据封装再次实体对象中") @Data @Builder @AllArgsConstructor @NoArgsConstructor public class LotteryInfo extends Model<LotteryInfo> { //ID(唯一主键) 唯一主键 @TableId(type= IdType.ID_WORKER) @JsonIgnore private Long id; //期数 期数 @ApiModelProperty(value = "期数", name = "period", dataType = "String") private String period; //浮动数值 浮动数值 @ApiModelProperty(value = "浮动数值", name = "number", dataType = "Integer") private Integer number; //价格 价格 @ApiModelProperty(value = "价格", name = "price", dataType = "Long") private Long price; //结果 开奖结果: 1:红球 2 :绿球 3 :紫罗兰 @ApiModelProperty(value = "开奖结果 RED GREEN VIOLET ", name = "result", dataType = "String") private String result; //类型 类型(PARITY SAPRE BCONE EMEND) @ApiModelProperty(value = "类型(PARITY SAPRE BCONE EMEND)", name = "type", dataType = "String") private String type; //开奖状态 开奖状态 1 :未开 2 :已开 @ApiModelProperty(value = "开奖状态 1 :未开 2 :已开", name = "lotteryStatus", dataType = "Integer") private Integer lotteryStatus; //创建时间 创建时间 @JsonIgnore private Date createTime; //更新时间 更新时间 @JsonIgnore private Date updatedTime; //开始时间 开始时间 @ApiModelProperty(value = "开始时间", name = "startTime", dataType = "Date") private Long startTime; //结束时间 结束时间 @ApiModelProperty(value = "结束时间", name = "endTime", dataType = "Date") private Long endTime; //下单截至时间 下单截至时间(同一期 三分钟 ,2分30秒下单 时间,超过150秒 不允许下单,30秒显示开奖结果) @ApiModelProperty(value = "下单截至时间(同一期 三分钟 ,2分30秒下单 时间,超过150秒 不允许下单,30秒显示开奖结果)", name = "lastCreateOrderTime", dataType = "Date") private Long lastCreateOrderTime; //标识符 1 : 系统干预 2: 人工干预 3:其他 private String isFlag; /** 开奖时间 */ private Date openTime ; }
527ca381765b06a32ed32e593622ec19bca9b28a
418e7220865f69a1e1ca9c352a21e504b3515b47
/Spotify/src/spotify/Midlet.java
cd644312e28ed270a185868435199f418ace923e
[]
no_license
rodripf/SpotifyBTRemoteControl
e498c07b1f5ad19d33704bd492779b871072dc7e
6e0d8749992d0744f6601771fcf8e54129c7776a
refs/heads/master
2021-01-23T14:52:12.049742
2012-10-15T18:34:47
2012-10-15T18:34:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
13,608
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package spotify; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.Vector; import javax.bluetooth.BluetoothStateException; import javax.bluetooth.DeviceClass; import javax.bluetooth.DiscoveryAgent; import javax.bluetooth.DiscoveryListener; import javax.bluetooth.LocalDevice; import javax.bluetooth.RemoteDevice; import javax.bluetooth.ServiceRecord; import javax.bluetooth.UUID; import javax.microedition.io.Connector; import javax.microedition.io.StreamConnection; import javax.microedition.lcdui.Canvas; import javax.microedition.lcdui.Command; import javax.microedition.lcdui.CommandListener; import javax.microedition.lcdui.Display; import javax.microedition.lcdui.Displayable; import javax.microedition.lcdui.Form; import javax.microedition.lcdui.Gauge; import javax.microedition.lcdui.Graphics; import javax.microedition.lcdui.Image; import javax.microedition.lcdui.List; import javax.microedition.lcdui.TextBox; import javax.microedition.lcdui.TextField; import javax.microedition.midlet.*; /** * @author Rodrigo */ public class Midlet extends MIDlet implements DiscoveryListener, CommandListener { /*- * * ---- Debug attributes ---- */ static final boolean DEBUG = false; static final String DEBUG_address = "0013FDC157C8"; // N6630 static final String PLAY_PAUSE = "PlayPause"; static final String PLAY_NEXT = "PlayNext"; static final String PLAY_PREV = "PlayPrev"; static final String VOL_DOWN = "VolumeDown"; static final String VOL_UP = "VolumeUp"; static final String MUTE = "Mute"; static final String BUSCAR = "Search"; static final String NOW_PLAY = "NowPlaying"; /*- * * ---- Bluetooth attributes ---- */ protected UUID uuid = new UUID(0x1101); // serial port profile protected int inquiryMode = DiscoveryAgent.GIAC; // no pairing is needed protected int connectionOptions = ServiceRecord.NOAUTHENTICATE_NOENCRYPT; /*- * * ---- Echo loop attributes ---- */ protected int stopToken = 255; /*- * * ---- GUI attributes ---- */ protected Form infoArea = new Form("Spotify Remote Control"); protected Gauge gau = new Gauge("", false, Gauge.INDEFINITE, Gauge.CONTINUOUS_RUNNING); protected TextBox busqueda = new TextBox("Buscar y Reproducir", "", 50, TextField.ANY); protected Vector deviceList = new Vector(); Image logo, controls; protected void startApp() throws MIDletStateChangeException { try { logo = Image.createImage("/spotify.png"); controls = Image.createImage("/controls.png"); } catch (IOException ex) { ex.printStackTrace(); } makeInformationAreaGUI(); if (DEBUG) // skip inquiry in debug mode { startServiceSearch(new RemoteDevice(DEBUG_address) { }); } else { try { startDeviceInquiry(); } catch (Throwable t) { log(t); } } } /*- * ------- Device inquiry section ------- */ private void startDeviceInquiry() { try { logSet("Bienvenido!"); gau.setLabel("Buscando Equipos BT..."); infoArea.append(gau); DiscoveryAgent agent = getAgent(); agent.startInquiry(inquiryMode, this); } catch (Exception e) { log(e); } } public void deviceDiscovered(RemoteDevice btDevice, DeviceClass cod) { deviceList.addElement(btDevice); } public void inquiryCompleted(int discType) { makeDeviceSelectionGUI(); } /*- * ------- Service search section ------- */ private void startServiceSearch(RemoteDevice device) { try { logSet(""); // gau.setLabel("Intentando conectar con " + getFriendlyName(device) + "..."); // infoArea.append(gau); // startGauge(gau); UUID uuids[] = new UUID[]{uuid}; getAgent().searchServices(null, uuids, device, this); } catch (Exception e) { log(e); } } Vector urls = new Vector(); /** * This method is called when a service(s) are discovered.This method starts * a thread that handles the data exchange with the server. */ public void servicesDiscovered(int transId, ServiceRecord[] records) { for (int i = 0; i < records.length; i++) { ServiceRecord rec = records[i]; String url = rec.getConnectionURL(connectionOptions, false); log(url); urls.addElement(url); } } public void serviceSearchCompleted(int transID, int respCode) { String msg; switch (respCode) { case SERVICE_SEARCH_COMPLETED: msg = "La conexión se completó con éxito! Cargando info..."; makeMainGUI(); break; case SERVICE_SEARCH_TERMINATED: msg = "La búsqueda fue cancelada - DiscoveryAgent.cancelServiceSearch()"; break; case SERVICE_SEARCH_ERROR: msg = "Se produjo un error mientras se intentaba la conexión."; break; case SERVICE_SEARCH_NO_RECORDS: msg = "No se encontró spotify en la computadora seleccionada."; break; case SERVICE_SEARCH_DEVICE_NOT_REACHABLE: msg = "No pudo alcanzarse el dispositivo. Se perdió cobertura o está detrás de un firewall?"; break; default: msg = "Se produjo un error al intentar conectar."; } logSet(msg); } /*- * ------- The actual connection handling. ------- */ private void handleConnection(final String url, final String cmd) { Thread echo = new Thread() { public void run() { StreamConnection stream = null; InputStream in = null; OutputStream out = null; try { stream = (StreamConnection) Connector.open(url); out = stream.openOutputStream(); if (cmd.equals(NOW_PLAY)) { in = stream.openInputStream(); startReadThread(in); } out.write(cmd.getBytes()); out.flush(); } catch (IOException e) { log(e); } finally { if (out != null) { try { out.close(); stream.close(); } catch (IOException e) { log(e); } } } } }; echo.start(); } private void startReadThread(final InputStream in) { Thread reader = new Thread() { public void run() { boolean flag = true; byte[] s = new byte[512]; while (flag) { try { int read = in.read(s); if (read > 0) { String h = new String(s); if (h.startsWith(NOW_PLAY)) { nowPlaying = h.substring(NOW_PLAY.length()); main.repaint(); } flag = false; } } catch (Throwable e) { log(e); } finally { } } try { in.close(); } catch (IOException ex) { } } }; reader.start(); } public void send(String cmd) { for (int i = 0; i < urls.size(); i++) { String url = (String) urls.elementAt(i); handleConnection(url, cmd); } } /*- * ------- Graphic User Interface section ------- */ private void makeInformationAreaGUI() { infoArea.deleteAll(); infoArea.addCommand(new Command("Salir", Command.EXIT, 3)); infoArea.setCommandListener(this); Display.getDisplay(this).setCurrent(infoArea); } private void makeDeviceSelectionGUI() { final List devices = new List("Elija un dispositivo", List.IMPLICIT); for (int i = 0; i < deviceList.size(); i++) { devices.append(getDeviceStr((RemoteDevice) deviceList.elementAt(i)), null); } devices.setCommandListener(new CommandListener() { public void commandAction(Command arg0, Displayable arg1) { makeInformationAreaGUI(); startServiceSearch((RemoteDevice) deviceList.elementAt(devices.getSelectedIndex())); } }); Display.getDisplay(this).setCurrent(devices); } String ultima = ""; String nowPlaying = ""; protected Canvas main = new Canvas() { protected void paint(Graphics g) { int width = getWidth(); int height = getHeight(); g.setColor(71, 71, 71); g.fillRect(0, 0, width, height); g.setColor(255, 255, 255); g.drawImage(logo, width / 2, height / 2, g.BOTTOM | g.HCENTER); g.drawImage(controls, width / 2, height - 20, g.BOTTOM | g.HCENTER); g.setColor(209, 209, 209); int indexOf = nowPlaying.indexOf(" - "); if (!nowPlaying.equals("")) { String artist = nowPlaying.substring(0, indexOf); String song = nowPlaying.substring(indexOf + 2); g.drawString(artist, 0, 0, g.TOP | g.LEFT); g.drawString(song, 0, 30, g.TOP | g.LEFT); } } protected void keyPressed(int keyCode) { } protected void keyReleased(int keyCode) { int ga = getGameAction(keyCode); switch (ga) { case UP: send(VOL_UP); ultima = VOL_UP; break; case DOWN: send(VOL_DOWN); ultima = VOL_DOWN; break; case RIGHT: send(PLAY_NEXT); ultima = PLAY_NEXT; break; case LEFT: send(PLAY_PREV); ultima = PLAY_PREV; break; case FIRE: case GAME_A: send(PLAY_PAUSE); ultima = PLAY_PAUSE; break; default: switch (keyCode) { case KEY_POUND: send(MUTE); break; case KEY_STAR: makeBuscarGUI(); break; case KEY_NUM1: send(NOW_PLAY); break; } } main.repaint(); } }; private void makeMainGUI() { main.setFullScreenMode(true); Display.getDisplay(this).setCurrent(main); } private void makeBuscarGUI() { busqueda.addCommand(new Command("OK", Command.OK, 1)); busqueda.addCommand(new Command("Atrás", Command.BACK, 2)); busqueda.setCommandListener(this); Display.getDisplay(this).setCurrent(busqueda); } public void commandAction(Command com, Displayable dis) { String label = com.getLabel(); if ("Salir".equals(label)) { notifyDestroyed(); } else if ("Atrás".equals(label)) { //en buscar makeMainGUI(); } else if ("OK".equals(label)) {//confirmar busqueda send(BUSCAR + " \"" + busqueda.getString() + "\""); makeMainGUI(); } } synchronized private void log(String msg) { infoArea.append(msg); infoArea.append("\n\n"); } synchronized private void logSet(String msg) { infoArea.deleteAll(); infoArea.append(msg); infoArea.append("\n\n"); } private void log(Throwable e) { log(e.getMessage()); } /*- * ------- Utils section - contains utility functions ------- */ private DiscoveryAgent getAgent() { try { return LocalDevice.getLocalDevice().getDiscoveryAgent(); } catch (BluetoothStateException e) { throw new Error(e.getMessage()); } } private String getDeviceStr(RemoteDevice btDevice) { return getFriendlyName(btDevice); } private String getFriendlyName(RemoteDevice btDevice) { try { return btDevice.getFriendlyName(false); } catch (IOException e) { return "no name available"; } } protected void destroyApp(boolean unconditional) throws MIDletStateChangeException { throw new UnsupportedOperationException("Not supported yet."); } protected void pauseApp() { throw new UnsupportedOperationException("Not supported yet."); } }
719140eba676a105333bc533363a323994bb0781
78716f51578118ba2ccc1f80e7ae50e736c552e6
/libraries/lwjgl/src/java/org/lwjgl/opencl/APIUtil.java
c40010a2a79267e9df58e16dfe03bad148d8ea4f
[]
no_license
danodz/snake
1a90d149552c4305ade73d58b49f1d91c2cc5ab5
c9b8ab10abce386e62bf097d5d5d4bbc953327ef
refs/heads/master
2020-04-22T05:04:58.364319
2014-12-22T00:46:42
2014-12-22T00:46:42
28,319,050
1
0
null
null
null
null
UTF-8
Java
false
false
16,205
java
/* * Copyright (c) 2002-2010 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opencl; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLUtil; import org.lwjgl.PointerBuffer; import org.lwjgl.opencl.FastLongMap.Entry; import java.nio.*; import java.util.HashSet; import java.util.Set; import java.util.StringTokenizer; import static org.lwjgl.opencl.APPLEGLSharing.*; import static org.lwjgl.opencl.CL10.*; import static org.lwjgl.opencl.EXTDeviceFission.*; import static org.lwjgl.opencl.KHRGLSharing.*; /** * Utility class for OpenCL API calls. * * @author spasi */ final class APIUtil { private static final int INITIAL_BUFFER_SIZE = 256; private static final int INITIAL_LENGTHS_SIZE = 4; private static final int BUFFERS_SIZE = 32; private static final ThreadLocal<char[]> arrayTL = new ThreadLocal<char[]>() { protected char[] initialValue() { return new char[INITIAL_BUFFER_SIZE]; } }; private static final ThreadLocal<ByteBuffer> bufferByteTL = new ThreadLocal<ByteBuffer>() { protected ByteBuffer initialValue() { return BufferUtils.createByteBuffer(INITIAL_BUFFER_SIZE); } }; private static final ThreadLocal<PointerBuffer> bufferPointerTL = new ThreadLocal<PointerBuffer>() { protected PointerBuffer initialValue() { return BufferUtils.createPointerBuffer(INITIAL_BUFFER_SIZE); } }; private static final ThreadLocal<PointerBuffer> lengthsTL = new ThreadLocal<PointerBuffer>() { protected PointerBuffer initialValue() { return BufferUtils.createPointerBuffer(INITIAL_LENGTHS_SIZE); } }; private static final ThreadLocal<Buffers> buffersTL = new ThreadLocal<Buffers>() { protected Buffers initialValue() { return new Buffers(); } }; private APIUtil() { } private static char[] getArray(final int size) { char[] array = arrayTL.get(); if ( array.length < size ) { int sizeNew = array.length << 1; while ( sizeNew < size ) sizeNew <<= 1; array = new char[size]; arrayTL.set(array); } return array; } static ByteBuffer getBufferByte(final int size) { ByteBuffer buffer = bufferByteTL.get(); if ( buffer.capacity() < size ) { int sizeNew = buffer.capacity() << 1; while ( sizeNew < size ) sizeNew <<= 1; buffer = BufferUtils.createByteBuffer(size); bufferByteTL.set(buffer); } else buffer.clear(); return buffer; } private static ByteBuffer getBufferByteOffset(final int size) { ByteBuffer buffer = bufferByteTL.get(); if ( buffer.capacity() < size ) { int sizeNew = buffer.capacity() << 1; while ( sizeNew < size ) sizeNew <<= 1; final ByteBuffer bufferNew = BufferUtils.createByteBuffer(size); bufferNew.put(buffer); bufferByteTL.set(buffer = bufferNew); } else { buffer.position(buffer.limit()); buffer.limit(buffer.capacity()); } return buffer; } static PointerBuffer getBufferPointer(final int size) { PointerBuffer buffer = bufferPointerTL.get(); if ( buffer.capacity() < size ) { int sizeNew = buffer.capacity() << 1; while ( sizeNew < size ) sizeNew <<= 1; buffer = BufferUtils.createPointerBuffer(size); bufferPointerTL.set(buffer); } else buffer.clear(); return buffer; } static ShortBuffer getBufferShort() { return buffersTL.get().shorts; } static IntBuffer getBufferInt() { return buffersTL.get().ints; } static IntBuffer getBufferIntDebug() { return buffersTL.get().intsDebug; } static LongBuffer getBufferLong() { return buffersTL.get().longs; } static FloatBuffer getBufferFloat() { return buffersTL.get().floats; } static DoubleBuffer getBufferDouble() { return buffersTL.get().doubles; } static PointerBuffer getBufferPointer() { return buffersTL.get().pointers; } static PointerBuffer getLengths() { return getLengths(1); } static PointerBuffer getLengths(final int size) { PointerBuffer lengths = lengthsTL.get(); if ( lengths.capacity() < size ) { int sizeNew = lengths.capacity(); while ( sizeNew < size ) sizeNew <<= 1; lengths = BufferUtils.createPointerBuffer(size); lengthsTL.set(lengths); } else lengths.clear(); return lengths; } /** * Simple ASCII encoding. * * @param buffer The target buffer * @param string The source string */ private static ByteBuffer encode(final ByteBuffer buffer, final CharSequence string) { for ( int i = 0; i < string.length(); i++ ) { final char c = string.charAt(i); if ( LWJGLUtil.DEBUG && 0x80 <= c ) // Silently ignore and map to 0x1A. buffer.put((byte)0x1A); else buffer.put((byte)c); } return buffer; } /** * Reads a byte string from the specified buffer. * * @param buffer * * @return the buffer as a String. */ static String getString(final ByteBuffer buffer) { final int length = buffer.remaining(); final char[] charArray = getArray(length); for ( int i = buffer.position(); i < buffer.limit(); i++ ) charArray[i - buffer.position()] = (char)buffer.get(i); return new String(charArray, 0, length); } /** * Returns a buffer containing the specified string as bytes. * * @param string * * @return the String as a ByteBuffer */ static ByteBuffer getBuffer(final CharSequence string) { final ByteBuffer buffer = encode(getBufferByte(string.length()), string); buffer.flip(); return buffer; } /** * Returns a buffer containing the specified string as bytes, starting at the specified offset. * * @param string * * @return the String as a ByteBuffer */ static ByteBuffer getBuffer(final CharSequence string, final int offset) { final ByteBuffer buffer = encode(getBufferByteOffset(offset + string.length()), string); buffer.flip(); return buffer; } /** * Returns a buffer containing the specified string as bytes, including null-termination. * * @param string * * @return the String as a ByteBuffer */ static ByteBuffer getBufferNT(final CharSequence string) { final ByteBuffer buffer = encode(getBufferByte(string.length() + 1), string); buffer.put((byte)0); buffer.flip(); return buffer; } static int getTotalLength(final CharSequence[] strings) { int length = 0; for ( CharSequence string : strings ) length += string.length(); return length; } /** * Returns a buffer containing the specified strings as bytes. * * @param strings * * @return the Strings as a ByteBuffer */ static ByteBuffer getBuffer(final CharSequence[] strings) { final ByteBuffer buffer = getBufferByte(getTotalLength(strings)); for ( CharSequence string : strings ) encode(buffer, string); buffer.flip(); return buffer; } /** * Returns a buffer containing the specified strings as bytes, including null-termination. * * @param strings * * @return the Strings as a ByteBuffer */ static ByteBuffer getBufferNT(final CharSequence[] strings) { final ByteBuffer buffer = getBufferByte(getTotalLength(strings) + strings.length); for ( CharSequence string : strings ) { encode(buffer, string); buffer.put((byte)0); } buffer.flip(); return buffer; } /** * Returns a buffer containing the lengths of the specified strings. * * @param strings * * @return the String lengths in a PointerBuffer */ static PointerBuffer getLengths(final CharSequence[] strings) { PointerBuffer buffer = getLengths(strings.length); for ( CharSequence string : strings ) buffer.put(string.length()); buffer.flip(); return buffer; } /** * Returns a buffer containing the lengths of the specified buffers. * * @param buffers the buffer array * * @return the buffer lengths in a PointerBuffer */ static PointerBuffer getLengths(final ByteBuffer[] buffers) { PointerBuffer lengths = getLengths(buffers.length); for ( ByteBuffer buffer : buffers ) lengths.put(buffer.remaining()); lengths.flip(); return lengths; } static int getSize(final PointerBuffer lengths) { long size = 0; for ( int i = lengths.position(); i < lengths.limit(); i++ ) size += lengths.get(i); return (int)size; } private static class Buffers { final ShortBuffer shorts; final IntBuffer ints; final IntBuffer intsDebug; final LongBuffer longs; final FloatBuffer floats; final DoubleBuffer doubles; final PointerBuffer pointers; Buffers() { shorts = BufferUtils.createShortBuffer(BUFFERS_SIZE); ints = BufferUtils.createIntBuffer(BUFFERS_SIZE); intsDebug = BufferUtils.createIntBuffer(1); longs = BufferUtils.createLongBuffer(BUFFERS_SIZE); floats = BufferUtils.createFloatBuffer(BUFFERS_SIZE); doubles = BufferUtils.createDoubleBuffer(BUFFERS_SIZE); pointers = BufferUtils.createPointerBuffer(BUFFERS_SIZE); } } /* ------------------------------------------------------------------------ --------------------------------------------------------------------------- OPENCL API UTILITIES BELOW --------------------------------------------------------------------------- ------------------------------------------------------------------------ */ static Set<String> getExtensions(final String extensionList) { final Set<String> extensions = new HashSet<String>(); if ( extensionList != null ) { final StringTokenizer tokenizer = new StringTokenizer(extensionList); while ( tokenizer.hasMoreTokens() ) extensions.add(tokenizer.nextToken()); } return extensions; } static boolean isDevicesParam(final int param_name) { switch ( param_name ) { case CL_CONTEXT_DEVICES: case CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR: case CL_DEVICES_FOR_GL_CONTEXT_KHR: case CL_CGL_DEVICE_FOR_CURRENT_VIRTUAL_SCREEN_APPLE: case CL_CGL_DEVICES_FOR_SUPPORTED_VIRTUAL_SCREENS_APPLE: return true; } return false; } static CLPlatform getCLPlatform(final PointerBuffer properties) { long platformID = 0; final int keys = properties.remaining() / 2; for ( int k = 0; k < keys; k++ ) { final long key = properties.get(k << 1); if ( key == 0 ) break; if ( key == CL_CONTEXT_PLATFORM ) { platformID = properties.get((k << 1) + 1); break; } } if ( platformID == 0 ) throw new IllegalArgumentException("Could not find CL_CONTEXT_PLATFORM in cl_context_properties."); final CLPlatform platform = CLPlatform.getCLPlatform(platformID); if ( platform == null ) throw new IllegalStateException("Could not find a valid CLPlatform. Make sure clGetPlatformIDs has been used before."); return platform; } static ByteBuffer getNativeKernelArgs(final long user_func_ref, final CLMem[] clMems, final long[] sizes) { final ByteBuffer args = getBufferByte(8 + 4 + (clMems == null ? 0 : clMems.length * (4 + PointerBuffer.getPointerSize()))); args.putLong(0, user_func_ref); if ( clMems == null ) args.putInt(8, 0); else { args.putInt(8, clMems.length); int byteIndex = 12; for ( int i = 0; i < clMems.length; i++ ) { if ( LWJGLUtil.DEBUG && !clMems[i].isValid() ) throw new IllegalArgumentException("An invalid CLMem object was specified."); args.putInt(byteIndex, (int)sizes[i]); // CLMem size byteIndex += (4 + PointerBuffer.getPointerSize()); // Skip size and make room for the pointer } } return args; } // ------------------------------------------------------------------------------------ /** * Releases all sub-devices created from the specified CLDevice. * * @param device the CLDevice to clear */ static void releaseObjects(final CLDevice device) { // Release objects only if we're about to hit 0. if ( device.getReferenceCount() > 1 ) return; releaseObjects(device.getSubCLDeviceRegistry(), DESTRUCTOR_CLSubDevice); } /** * Releases all objects contained in the specified CLContext. * * @param context the CLContext to clear */ static void releaseObjects(final CLContext context) { // Release objects only if we're about to hit 0. if ( context.getReferenceCount() > 1 ) return; releaseObjects(context.getCLEventRegistry(), DESTRUCTOR_CLEvent); releaseObjects(context.getCLProgramRegistry(), DESTRUCTOR_CLProgram); releaseObjects(context.getCLSamplerRegistry(), DESTRUCTOR_CLSampler); releaseObjects(context.getCLMemRegistry(), DESTRUCTOR_CLMem); releaseObjects(context.getCLCommandQueueRegistry(), DESTRUCTOR_CLCommandQueue); } /** * Releases all objects contained in the specified CLProgram. * * @param program the CLProgram to clear */ static void releaseObjects(final CLProgram program) { // Release objects only if we're about to hit 0. if ( program.getReferenceCount() > 1 ) return; releaseObjects(program.getCLKernelRegistry(), DESTRUCTOR_CLKernel); } /** * Releases all objects contained in the specified CLCommandQueue. * * @param queue the CLCommandQueue to clear */ static void releaseObjects(final CLCommandQueue queue) { // Release objects only if we're about to hit 0. if ( queue.getReferenceCount() > 1 ) return; releaseObjects(queue.getCLEventRegistry(), DESTRUCTOR_CLEvent); } private static <T extends CLObjectChild> void releaseObjects(final CLObjectRegistry<T> registry, final ObjectDestructor<T> destructor) { if ( registry.isEmpty() ) return; for ( Entry<T> entry : registry.getAll() ) { final T object = entry.value; while ( object.isValid() ) destructor.release(object); } } private static final ObjectDestructor<CLDevice> DESTRUCTOR_CLSubDevice = new ObjectDestructor<CLDevice>() { public void release(final CLDevice object) { clReleaseDeviceEXT(object); } }; private static final ObjectDestructor<CLMem> DESTRUCTOR_CLMem = new ObjectDestructor<CLMem>() { public void release(final CLMem object) { clReleaseMemObject(object); } }; private static final ObjectDestructor<CLCommandQueue> DESTRUCTOR_CLCommandQueue = new ObjectDestructor<CLCommandQueue>() { public void release(final CLCommandQueue object) { clReleaseCommandQueue(object); } }; private static final ObjectDestructor<CLSampler> DESTRUCTOR_CLSampler = new ObjectDestructor<CLSampler>() { public void release(final CLSampler object) { clReleaseSampler(object); } }; private static final ObjectDestructor<CLProgram> DESTRUCTOR_CLProgram = new ObjectDestructor<CLProgram>() { public void release(final CLProgram object) { clReleaseProgram(object); } }; private static final ObjectDestructor<CLKernel> DESTRUCTOR_CLKernel = new ObjectDestructor<CLKernel>() { public void release(final CLKernel object) { clReleaseKernel(object); } }; private static final ObjectDestructor<CLEvent> DESTRUCTOR_CLEvent = new ObjectDestructor<CLEvent>() { public void release(final CLEvent object) { clReleaseEvent(object); } }; private interface ObjectDestructor<T extends CLObjectChild> { void release(T object); } }
12577c6f9ea71d2e168763a7acded7982097dfff
c85ae6d6ae3338a59bebdfe387558aadbbd2bd39
/CodingExercises/src/MegaBytesConverter.java
babaf35042a9aafa8ea3aa9a7dd883612a021589
[]
no_license
pajakwaldek/JavaProjects
a124c67731642bcc5953fadd0bc278b04067e9ee
3aec469faba2f35d140f61c6de831bd2d36707b7
refs/heads/master
2020-04-01T22:12:09.828805
2018-10-18T22:47:25
2018-10-18T22:47:25
153,690,851
0
0
null
null
null
null
UTF-8
Java
false
false
545
java
public class MegaBytesConverter { public static void main(String[] args) { printMegaBytesAndKiloBytes(2000); printMegaBytesAndKiloBytes(0); printMegaBytesAndKiloBytes(-2000); } public static void printMegaBytesAndKiloBytes(int kiloBytes){ if(kiloBytes >= 0) { System.out.println(kiloBytes + " KB = " + kiloBytes / 1024 + " MB and " + kiloBytes % 1024 + " KB"); } else if (kiloBytes < 0) { System.out.println("Invalid Value"); } } }
a32cc9dc5b04614fd59a716b57528bd07b452642
1d2a71aba141a9244463b54f21513a7ca820bf03
/src/by/lepnikau/philosophy/of/java/pattern/command/CommandDemo.java
b1b837917799589c8725936ab961d85ca7f9e22a
[]
no_license
ViachaslauL/PhilosophyOfJava
f4757b733dc52c9d0fee6c8a5029c442050ed568
148d8ed0e1dd41cbb3b63fb80c49cf06ade47b10
refs/heads/master
2023-08-12T07:18:14.676824
2021-10-11T08:18:10
2021-10-11T08:18:10
403,288,937
1
0
null
null
null
null
UTF-8
Java
false
false
450
java
package by.lepnikau.philosophy.of.java.pattern.command; public class CommandDemo { public static void main(String[] args) { Light light = new Light(); LightTurnOnCommand turnOnCommand = new LightTurnOnCommand(light); LightTurnOffCommand turnOffCommand = new LightTurnOffCommand(light); Switch aSwitch = new Switch(turnOnCommand, turnOffCommand); aSwitch.flipUp(); aSwitch.flipDown(); } }
e46e08f37f944707d5ca2f9f9c842500f5963a57
75c707019b6c1928b00adabd99aa0d7442317854
/src/main/java/de/blau/android/presets/PresetTextField.java
0c8f384aab04d54e5a012eeec2cf30e509e7a01e
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
MarcusWolschon/osmeditor4android
d774d41e46dbab82ac33d6128508ccd46506e79a
5170bfaac8e561a70b9d6ac03f412013ab563abc
refs/heads/master
2023-09-01T17:41:09.037801
2023-08-31T09:22:24
2023-08-31T09:22:24
32,623,844
343
109
NOASSERTION
2023-09-13T11:22:03
2015-03-21T07:25:43
Java
UTF-8
Java
false
false
1,891
java
package de.blau.android.presets; import java.io.IOException; import org.xmlpull.v1.XmlSerializer; import androidx.annotation.NonNull; public class PresetTextField extends PresetTagField implements PresetFieldJavaScript { private static final long serialVersionUID = 1L; /** * Script for pre-filling text fields */ String javascript = null; /** * Configured length of the text field */ private int length = 0; /** * Constructor * * @param key key for the PresetTextField */ public PresetTextField(@NonNull String key) { super(key); } /** * Copy constructor * * @param field PresetTextField to copy */ public PresetTextField(PresetTextField field) { super(field); this.javascript = field.javascript; } @Override public String getScript() { return javascript; } @Override public void setScript(String script) { javascript = script; } /** * Get a proposed length for the field * * @return the length in characters */ public int length() { return length; } /** * Set the length attribute * * @param length the length to set in characters */ void setLength(int length) { this.length = length; } @Override public PresetTagField copy() { return new PresetTextField(this); } @Override public void toXml(XmlSerializer s) throws IllegalArgumentException, IllegalStateException, IOException { s.startTag("", PresetParser.TEXT); s.attribute("", PresetParser.KEY_ATTR, key); standardFieldsToXml(s); s.endTag("", PresetParser.TEXT); } @Override public String toString() { return super.toString() + " javascript: " + javascript + " length: " + length; } }
2d59c30cc4ac29284d6c3519dddb6f89a9111bc2
3a2d6b22f8541545ab933d4cd609be925d6e303b
/HW4_AdapterFacade/src/Turkey.java
c3e35281d147a50a113aeb62ef228cb0919c5fa4
[]
no_license
132/DP
fdc2d26d2da4d07211c9ee46b1b85cf9489caf38
abcfa134c6385ebc842e9b6de9e6438b62da30f7
refs/heads/master
2021-08-14T06:34:49.451391
2017-11-14T21:40:46
2017-11-14T21:40:46
107,048,617
0
0
null
null
null
null
UTF-8
Java
false
false
173
java
public class Turkey implements ITurkey{ public void display() { System.out.println("Turkey display"); } public void act() { System.out.println("Turkey act"); } }
1dc32f133867a9db316c9f17b576216310a74624
217752ed36e5d82e587fc941ee05ebb8a1fca90e
/src/main/java/com/mascova/talarion/web/rest/ImageResource.java
edfacdabe0620eb55b8dc2bc6989c5bf7a3217a2
[]
no_license
gazibastug/salestock
b3061dbf456214774f525a53c251559d85c35cce
cc493c7e148aa35a91c3587effe0800189f1a6f4
refs/heads/master
2022-05-06T19:54:18.342756
2016-06-29T12:12:38
2016-06-29T12:12:38
null
0
0
null
null
null
null
UTF-8
Java
false
false
10,006
java
package com.mascova.talarion.web.rest; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.net.URI; import java.net.URISyntaxException; import java.util.List; import java.util.Optional; import javax.inject.Inject; import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.core.env.Environment; import org.springframework.data.domain.Page; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; import com.codahale.metrics.annotation.Timed; import com.mascova.talarion.domain.Image; import com.mascova.talarion.domain.User; import com.mascova.talarion.repository.ImageRepository; import com.mascova.talarion.repository.UserRepository; import com.mascova.talarion.repository.specification.ImageSpecificationBuilder; import com.mascova.talarion.security.SecurityUtils; import com.mascova.talarion.web.rest.util.PaginationUtil; /** * REST controller for managing Image. */ @RestController @RequestMapping("/api") public class ImageResource { private final Logger log = LoggerFactory.getLogger(ImageResource.class); @Inject private ImageRepository imageRepository; @Inject private Environment env; @Inject private UserRepository userRepository; /** * POST /image -> Create a new image. */ @RequestMapping(value = "/image", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) @Timed public ResponseEntity<Void> create(@RequestBody Image image) throws URISyntaxException { log.debug("REST request to save Image : {}", image); if (image.getId() != null) { return ResponseEntity.badRequest().header("Failure", "A new image cannot already have an ID") .build(); } imageRepository.save(image); return ResponseEntity.created(new URI("/api/image/" + image.getId())).build(); } /** * PUT /image -> Updates an existing image. */ @RequestMapping(value = "/image", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE) @Timed public ResponseEntity<Void> update(@RequestBody Image image) throws URISyntaxException { log.debug("REST request to update Image : {}", image); if (image.getId() == null) { return create(image); } imageRepository.save(image); return ResponseEntity.ok().build(); } /** * GET /image -> get all the images. */ @RequestMapping(value = "/image", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @Timed public ResponseEntity<List<Image>> getAll( @RequestParam(value = "page", required = false) Integer offset, @RequestParam(value = "size", required = false) Integer size, @RequestParam(value = "name", required = false) String name) throws URISyntaxException { ImageSpecificationBuilder builder = new ImageSpecificationBuilder(); if (StringUtils.isNotBlank(name)) { builder.with("name2", ":", name); } Page<Image> page = imageRepository.findAll(builder.build(), PaginationUtil.generatePageRequest(offset, size)); HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/image"); return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK); } /** * GET /image/:id -> get the "id" image. */ @RequestMapping(value = "/image/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @Timed public ResponseEntity<Image> get(@PathVariable Long id) { log.debug("REST request to get Image : {}", id); return Optional.ofNullable(imageRepository.findOne(id)) .map(image -> new ResponseEntity<>(image, HttpStatus.OK)) .orElse(new ResponseEntity<>(HttpStatus.NOT_FOUND)); } /** * DELETE /image/:id -> delete the "id" image. */ @RequestMapping(value = "/image/{id}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE) @Timed public void delete(@PathVariable Long id) { log.debug("REST request to delete Image : {}", id); imageRepository.delete(id); } /** * @throws IOException * */ @RequestMapping(value = "/image/file/gallery/{id}", method = RequestMethod.GET) @Timed public ResponseEntity<byte[]> getImageFileGallery(@PathVariable Long id) throws IOException { Image image = imageRepository.findOne(id); String systemPath = env.getProperty("image.host.path.system"); String relativePath = env.getProperty("image.host.path.relative.gallery"); if (StringUtils.equalsIgnoreCase(systemPath, "user.dir")) { systemPath = System.getProperty("user.dir") + "/src/main/webapp"; } File imageFile = new File(systemPath + relativePath + image.getName() + "." + image.getType()); InputStream in = null; try { in = new FileInputStream(imageFile); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } HttpHeaders headers = new HttpHeaders(); headers.add(HttpHeaders.CONTENT_TYPE, "image/" + image.getType()); return new ResponseEntity<byte[]>(IOUtils.toByteArray(in), headers, HttpStatus.OK); } /** * @throws IOException * */ @RequestMapping(value = "/image/file/profile/{login}", method = RequestMethod.GET) @Timed public ResponseEntity<byte[]> getImageFileProfile(@PathVariable String login) throws IOException { File imageFile = new File(System.getProperty("user.dir") + "/src/main/webapp" + env.getProperty("image.host.path.relative.profile") + SecurityUtils.getCurrentUserLogin() + "." + "png"); InputStream in = null; try { in = new FileInputStream(imageFile); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } HttpHeaders headers = new HttpHeaders(); headers.add(HttpHeaders.CONTENT_TYPE, "image/png"); return new ResponseEntity<byte[]>(IOUtils.toByteArray(in), headers, HttpStatus.OK); } @RequestMapping(value = "/image/file/profile/upload", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<User> uploadImageFileProfile(@RequestParam("file") MultipartFile file) throws IOException { User currentLoggedUser = userRepository.findOneByLogin(SecurityUtils.getCurrentUserLogin()) .get(); byte[] bytes; if (!file.isEmpty()) { bytes = file.getBytes(); // store file in storage try { System.out.println(System.getProperty("user.dir")); String hostUrl = env.getProperty("image.host.url"); String systemPath = env.getProperty("image.host.path.system"); String relativePath = env.getProperty("image.host.path.relative.profile"); if (StringUtils.equalsIgnoreCase(systemPath, "user.dir")) { systemPath = System.getProperty("user.dir") + "/src/main/webapp"; } String fileExt = FilenameUtils.getExtension(file.getOriginalFilename()); File savedFile = new File(systemPath + relativePath + currentLoggedUser.getLogin() + "." + fileExt); if (savedFile.delete()) { // System.out.println(file.getName() + " is deleted!"); } else { // System.out.println("Delete operation is failed."); } file.transferTo(savedFile); currentLoggedUser.setProfileImagePath(relativePath + currentLoggedUser.getLogin() + "." + fileExt); userRepository.save(currentLoggedUser); } catch (IOException e) { e.printStackTrace(); } } return new ResponseEntity<>(currentLoggedUser, HttpStatus.OK); } @RequestMapping(value = "/image/file/gallery/upload", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Image> uploadImageFileGallery(@RequestParam("file") MultipartFile file) throws IOException { Image image = new Image(); byte[] bytes; if (!file.isEmpty()) { bytes = file.getBytes(); // store file in storage try { System.out.println(System.getProperty("user.dir")); String hostUrl = env.getProperty("image.host.url"); String systemPath = env.getProperty("image.host.path.system"); String relativePath = env.getProperty("image.host.path.relative.gallery"); if (StringUtils.equalsIgnoreCase(systemPath, "user.dir")) { systemPath = System.getProperty("user.dir") + "/src/main/webapp"; } String fileExt = FilenameUtils.getExtension(file.getOriginalFilename()); String baseName = liquibase.util.file.FilenameUtils.getBaseName(file.getOriginalFilename()); File savedFile = new File(systemPath + relativePath + baseName + "." + fileExt); if (savedFile.delete()) { // System.out.println(file.getName() + " is deleted!"); } else { // System.out.println("Delete operation is failed."); } file.transferTo(savedFile); image.setName(baseName); image.setType(fileExt); image.setUri(hostUrl + "/" + relativePath + baseName + "." + fileExt); imageRepository.save(image); } catch (IOException e) { e.printStackTrace(); } } return new ResponseEntity<>(image, HttpStatus.OK); } }
a388277e8609eac2ab1f7688d80fbd54a9c9b3b6
490283eab8c0ff79565d615a3d0af34c82c0e00d
/src/main/java/com/lmig/gfc/rpn/models/TwoNumberCalculation.java
5c5993574de7eb5e62571c9d82615f16b2de3d51
[]
no_license
karenalyea/RPN
6a54bf55a7559ae6138e00f1054dd8f010f16336
878598e4a71ac3995f33fa407a3cc5d104511b0e
refs/heads/master
2021-08-22T06:27:50.397517
2017-11-29T14:17:55
2017-11-29T14:17:55
112,416,764
0
0
null
null
null
null
UTF-8
Java
false
false
901
java
package com.lmig.gfc.rpn.models; import java.util.Stack; public abstract class TwoNumberCalculation implements Godoer, Undoer { // abstract - know process but doesn't have enough info to do anything //removes ability to call new. have to call new on one of the kids //these are no longer needed to be seen by kids private Stack<Double> stack; private Undoer undoer; public TwoNumberCalculation(Stack<Double> stack) { this.stack = stack; } public void goDoIt() { double first = stack.pop(); double second = stack.pop(); double result = doMath(first, second); stack.push(result); undoer = new TwoArgumentUndoer(first, second); } //this is a dummy method. this is done in the children, so need //to put in a placeholder protected double doMath(double first, double second) { return 0; } @Override public void undo(Stack<Double> stack) { undoer.undo(stack); } }
975e098b914879a1d27d83de5e7c908bb182b492
89f48f22217aa6a648f1792e72f8ad4cf219ebb4
/src/com/sazuha/service/TeacherService.java
719a9c2d1acfef6a5e276a5b0cd265c218338d97
[]
no_license
Sazuha/education
2e140053a450d24443c4395d1dd9d5ea5c339970
0a1730a0bfcea3de171f119f3e565cbbf572fa83
refs/heads/master
2023-07-29T03:49:32.119727
2021-09-11T08:47:54
2021-09-11T08:47:54
405,140,612
0
0
null
null
null
null
UTF-8
Java
false
false
894
java
package com.sazuha.service; import com.sazuha.pojo.Course; import com.sazuha.pojo.Teacher; /** * @author ASUS */ public interface TeacherService { /** * 登录 * @param teacher * @return */ public Teacher teacherLogin(Teacher teacher); /** * 改密码 * @param id * @param password * @param newPassword */ public void changePassword(int id,String password,String newPassword); /** * 发布课程 * @param course * @return */ public int newCourse(Course course); /** * 下架课程 * @param id * @return */ public int delCourse(int id); /** * 修改课程 * @param course * @return */ public int updateCourse(Course course); /** * 删除不存在课程 * @param courseId */ public void isExistCourse(int courseId); }
1cf2456657b3528348d3c1913a21c298ba92498b
9bc91c914052b575207b23c579c3c073f09d1e5c
/ProyectoTeoria2/src/proyectoteoria2/ExpLaboral.java
20ab45459d2ff6b260e0d7d358bc922e0413fa8a
[ "MIT" ]
permissive
Rodrix183/ProyectoTeoria2
3334a38441cf87e0c7a12068f31b234c0b3beedd
28ab35b0960d01b70fb6825e4b4c2dc21339b397
refs/heads/master
2022-08-27T17:44:41.118116
2020-05-30T09:22:18
2020-05-30T09:22:18
265,380,785
0
0
null
null
null
null
UTF-8
Java
false
false
2,014
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 proyectoteoria2; import java.util.Objects; public class ExpLaboral { private int aniosExp; private String trabajoAnterior, PuestoAnterior; public ExpLaboral() { } public int getAniosExp() { return aniosExp; } public void setAniosExp(int aniosExp) { this.aniosExp = aniosExp; } public String getTrabajoAnterior() { return trabajoAnterior; } public void setTrabajoAnterior(String trabajoAnterior) { this.trabajoAnterior = trabajoAnterior; } public String getPuestoAnterior() { return PuestoAnterior; } public void setPuestoAnterior(String PuestoAnterior) { this.PuestoAnterior = PuestoAnterior; } @Override public String toString() { return "ExpLaboral{" + "aniosExp=" + aniosExp + ", trabajoAnterior=" + trabajoAnterior + ", PuestoAnterior=" + PuestoAnterior + '}'; } @Override public int hashCode() { int hash = 5; hash = 41 * hash + this.aniosExp; hash = 41 * hash + Objects.hashCode(this.trabajoAnterior); hash = 41 * hash + Objects.hashCode(this.PuestoAnterior); return hash; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final ExpLaboral other = (ExpLaboral) obj; if (this.aniosExp != other.aniosExp) { return false; } if (!Objects.equals(this.trabajoAnterior, other.trabajoAnterior)) { return false; } if (!Objects.equals(this.PuestoAnterior, other.PuestoAnterior)) { return false; } return true; } }
6a753c921db520944c6385a09085bc6ec02d7335
fafc9bf994f698854a181159fdeff30abc321b39
/src/edusoft/android/reuse/FixAccountType.java
bf5b99cd4aea6a721ae37bc00b194ce5f1877c8c
[]
no_license
tetaez01/moneysaver-psu-phuket-project-2
c2149d50decf6a9a992bfa15d9f87c62845aa590
7e3c42452e9edc6c566ce887e45f4f6aae2a68a8
refs/heads/master
2020-12-31T00:18:24.196930
2012-03-04T22:01:12
2012-03-04T22:01:12
50,512,129
0
0
null
null
null
null
TIS-620
Java
false
false
675
java
package edusoft.android.reuse; public class FixAccountType { public static String FIX_CASH_ACCOUNT_ID = "0"; public static String FIX_CASH_ACCOUNT_DESCRIPTION = "เงินสด"; public static String FIX_CURRENT_ACCOUNT_ID = "1"; public static String FIX_CURRENT_ACCOUNT_DESCRIPTION = "บัญชีกระแสรายวัน"; public static String FIX_SAVING_ACCOUNT_ID = "2"; public static String FIX_SAVING_ACCOUNT_DESCRIPTION = "บัญชีออมทรัพย์"; public static String FIX_DEPOSIT_ACCOUNT_ID = "3"; public static String FIX_DEPOSIT_ACCOUNT_DESCRIPTION = "บัญชีเงินฝากประจำ"; }
d9b49463cc1b370291d6e47df3b04b2da78053af
05b2bfce7e2d6982cef74689d3d19f1504155742
/src/main/java/com/jk/service/ContractService.java
c70f84af56a1f0f3e38bb7aa4c7ec93eb8a0b31d
[]
no_license
zoro5284/jk
04429b6dddd4a18ef1e5b58232191efc7ae7f923
13688a23193a8edc921e70e2c01da0702022cc59
refs/heads/master
2020-03-17T18:10:46.164013
2018-06-15T01:51:25
2018-06-15T01:51:25
133,817,152
0
0
null
null
null
null
UTF-8
Java
false
false
882
java
package com.jk.service; import com.jk.pagination.Page; import com.jk.pojo.Contract; import java.io.Serializable; import java.util.List; import java.util.Map; public interface ContractService { public List<Contract> findPage(Page page); //分页查询 public List<Contract> find(Map paraMap); //带条件查询,条件可以为null,既没有条件;返回list对象集合 public Contract get(Serializable id); //只查询一个,常用于修改 public void insert(Contract contract); //插入,用实体作为参数 public void update(Contract contract); //修改,用实体作为参数 public void deleteById(Serializable id); //按id删除,删除一条;支持整数型和字符串类型ID public void delete(Serializable[] ids); public void submit(Serializable[] ids); public void cancel(Serializable[] ids); }
e814c3b43f12e0046ec2cac7b0a88c0dc5be5847
5c675b7e87b7897fff912dd592277b979471afe0
/src/_Lessons_Basic/src/OOP/PHONE/Basephone.java
65f1602be968617c19010e886022bf21c5190a74
[]
no_license
AlexandrKananadze/My_projects
b57e6784b404cda0d0f8c194d46eae22e73083cb
a529e9a54a0b4776cf2642d1c1e5f6c4843b85ea
refs/heads/master
2023-06-05T15:36:50.423318
2021-06-29T12:04:38
2021-06-29T12:04:38
371,817,166
0
0
null
null
null
null
UTF-8
Java
false
false
1,413
java
package OOP.PHONE; public class Basephone { private int number; private String model; private double weight; // public Basephone(int number, String model, double weight) { // this.number=number; // this.model = model; // this.weight=weight; //} public Basephone(int number, String model){ this.number=number; this.model=model; } public Basephone(){}; public Basephone(int number, String model, double weight) { this(number,model); this.weight=weight; } public int getNumber() { return number; } public void setNumber(int number) { this.number = number; } public String getModel() { return model; } public void setModel(String model) { this.model = model; } public double getWeight() { return weight; } public void setWeight(double weight) { this.weight = weight; } public void recieveCall () { System.out.println("Incoming Call" + " " + number); } public void incomingCall(){ System.out.println("Incoming Call"+model+" "+"tel"+" "+number); } public static void sendMessage(int num1, int num2) { System.out.println("Сообщение отпралвено" + num1 +" "+ num2); } @Override public String toString() { return number+" "+model+" "+weight; } }
9cd8c843f684000d6986a83959c978882b90f9e6
abc436b861928d24fc1d43a6f9bcb6823146593e
/src/de/unigoe/informatik/swe/kcast/declaration/MyStruct.java
e0d6868142f4de9a243e1fd12aaadcfb1a205826
[ "Apache-2.0" ]
permissive
e-albrecht/skillmodelframework
077583efd53596cc4eb65246af9784ae156f70b7
37d82531958bed96ec8af6c7a05a47eaf31ba257
refs/heads/master
2020-04-16T19:40:18.272802
2019-01-15T15:00:52
2019-01-15T15:00:52
165,869,131
0
0
null
null
null
null
UTF-8
Java
false
false
2,907
java
package de.unigoe.informatik.swe.kcast.declaration; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; import de.unigoe.informatik.swe.krm.KnowledgeComponent; public class MyStruct extends MyTypeSpecifier{ /** * Name of the struct */ private String name; private List<MyDeclaration> elements; private static final Set<KnowledgeComponent> kcs0 = new HashSet<KnowledgeComponent>(Arrays.asList(KnowledgeComponent.DECLARATION)); private static final Set<KnowledgeComponent> kcs1 = new HashSet<KnowledgeComponent>(Arrays.asList(KnowledgeComponent.DATA_TYPE)); private static final Set<KnowledgeComponent> kcs2 = new HashSet<KnowledgeComponent>(Arrays.asList(KnowledgeComponent.ELABORATED_TYPE_SPECIFIER, KnowledgeComponent.STRUCT)); private static final Set<KnowledgeComponent> kcs3 = new HashSet<KnowledgeComponent>(); public MyStruct(String name) { this.name = name; elements = new ArrayList<MyDeclaration>(); } public MyStruct(String name, List<MyDeclaration> elements) { this.name = name; this.elements = elements; } public MyStruct(List<MyDeclaration> elements) { this.name =""; this.elements = elements; } @Override public boolean isVoidType() { return false; } @Override public boolean isArithmeticType() { return false; } @Override public boolean isCharacterType() { return false; } @Override public boolean isIntegerType() { return false; } @Override public boolean isFloatingType() { return false; } @Override public boolean isStruct() { return true; } @Override public boolean isUnion() { return false; } @Override public boolean isEnum() { return false; } public String getName() { return name; } public void setName(String name) { this.name = name; } public List<MyDeclaration> getElements() { return elements; } public void setElements(List<MyDeclaration> elements) { this.elements = elements; } public void addElement(MyDeclaration decl) { elements.add(decl); } @Override public Set<KnowledgeComponent> getKCs(int level) { Set<KnowledgeComponent> kcs = new HashSet<KnowledgeComponent>(); // add KCs for array kcs.addAll(kcs0); if (level > 0) { kcs.addAll(kcs1); if (level > 1) { kcs.addAll(kcs2); if (level > 2) kcs.addAll(kcs3); } } // add KCs for subelements for (MyDeclaration decl : elements) { if (decl != null) kcs.addAll(decl.getKCs(level)); } return kcs; } public boolean equals(Object o) { if (o instanceof MyStruct) { MyStruct s = (MyStruct) o; return (name.equals(s.getName()) && elements.equals(s.getElements())); } return false; } public String toString() { String text = "STRUCT\n"; text += "Name: " + name; text += "Elements: \n"; for (MyDeclaration elem : elements) { text += elem + "\n"; } return text; } }
468cde9512ec744b07f9cd5f1947807f9a40e7af
b31dd07e39ca37da5aa3f4f2793583cf365ddb4e
/WeTongji/src/com/wetongji_android/util/data/event/EventUtil.java
637cdf2de5b7e11783b04ed98270e2889ecd963d
[]
no_license
zichuanwang/WeTongji_Android
57edc66f27a7fddec1fd00d6db83235ea151be56
42565354ac9cbdfd184bb93fdfc4f339b7521ccc
refs/heads/master
2021-01-13T01:58:07.695921
2013-11-18T05:17:56
2013-11-18T05:17:56
7,689,804
2
0
null
null
null
null
UTF-8
Java
false
false
2,250
java
package com.wetongji_android.util.data.event; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.List; import android.content.Context; import android.text.format.DateUtils; import android.util.Pair; import com.wetongji_android.data.Event; import com.wetongji_android.util.date.DateParser; public class EventUtil { public static boolean isFutureEvent(Event event){ Date now=new Date(); Date begin=event.getBegin(); Date end=event.getEnd(); if(now.before(end)&&now.after(begin)){ return true; } else{ return false; } } public static boolean isPastEvent(Event event){ Date now=new Date(); Date end=event.getEnd(); if(now.after(end)){ return true; } else{ return false; } } @SuppressWarnings("deprecation") public static String getEventDisplayTime(Event event,Context context){ Calendar eventBegin=DateParser.parseDateAndTime(event.getBegin()); Calendar eventEnd=DateParser.parseDateAndTime(event.getEnd()); return DateUtils.formatDateRange(context, eventBegin.getTimeInMillis(), eventEnd.getTimeInMillis(), DateUtils.FORMAT_SHOW_TIME|DateUtils.FORMAT_24HOUR); } public static List<Pair<Date, List<Event>>> getSectionedEventList(List<Event> list){ List<Pair<Date, List<Event>>> result=new ArrayList<Pair<Date,List<Event>>>(); if(list==null||list.isEmpty()){ return result; } int current=0; int start=0; for(;current!=list.size();current++){ if(areEventsBeginInSameDay(list.get(start), list.get(current))){ continue; } else{ Pair<Date, List<Event>> pair= new Pair<Date, List<Event>>(list.get(start).getBegin(), list.subList(start, current)); result.add(pair); start=current; } } Pair<Date, List<Event>> pair= new Pair<Date, List<Event>>(list.get(start).getBegin(), list.subList(start, current)); result.add(pair); return result; } public static boolean areEventsBeginInSameDay(Event a,Event b){ Calendar aBegin=DateParser.parseDateAndTime(a.getBegin()); Calendar bBegin=DateParser.parseDateAndTime(b.getBegin()); return aBegin.get(Calendar.YEAR)==bBegin.get(Calendar.YEAR)&& aBegin.get(Calendar.DAY_OF_YEAR)==bBegin.get(Calendar.DAY_OF_YEAR); } }
2b6f64eb877b27a9a6e2aedfced1a2169b695c2e
ed5159d056e98d6715357d0d14a9b3f20b764f89
/src/irvine/oeis/a149/A149223.java
3a71ea837236e874828c502f4725d696e1e63f30
[]
no_license
flywind2/joeis
c5753169cf562939b04dd246f8a2958e97f74558
e5efd6971a0062ac99f4fae21a7c78c9f9e74fea
refs/heads/master
2020-09-13T18:34:35.080552
2019-11-19T05:40:55
2019-11-19T05:40:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
588
java
package irvine.oeis.a149; // Generated by gen_seq4.pl walk23 3 5 1 221201212121110 at 2019-07-08 22:06 // DO NOT EDIT here! import irvine.oeis.WalkCubeSequence; /** * A149223 Number of walks within <code>N^3</code> (the first octant of <code>Z^3)</code> starting at <code>(0,0,0)</code> and consisting of n steps taken from <code>{(-1, -1, 1), (-1, 0, 1), (-1, 1, -1), (1, -1, 1), (1, 1, 0)}</code>. * @author Georg Fischer */ public class A149223 extends WalkCubeSequence { /** Construct the sequence. */ public A149223() { super(0, 3, 5, "", 1, "221201212121110"); } }
cbc419e451b3bca29cae1d4973043edc23d7a299
fde7e72c955ed07d8da8ec8509b958b9b1fb8a6d
/jvm01/src/main/java/com/zyk/nio02/HttpRequestFilter.java
467cbd551928590659dce5f60c3563dba03038d3
[]
no_license
zyk1995/GeekBangHomeWork
269cd0255254caa511c0c3f3d4c3ec8d15233064
04b3dd91fd9992d92eab2f30aafe9859dd81ec3f
refs/heads/main
2023-06-23T13:23:38.759932
2021-07-25T07:51:08
2021-07-25T07:51:08
380,403,322
0
0
null
null
null
null
UTF-8
Java
false
false
246
java
package com.zyk.nio02; import io.netty.channel.ChannelHandlerContext; import io.netty.handler.codec.http.FullHttpRequest; public interface HttpRequestFilter { void filter(FullHttpRequest fullRequest, ChannelHandlerContext ctx); }
9f2a3964ccfa5eff294f2ae278b50c319857eb69
0a5f09a8b117a33565a1d59c87687e42508ebd3c
/ch13-exception/src/ExceptionEx09.java
28abf847bacfc8ca1d04a0a0e560f5684173a194
[]
no_license
1astkiss/workspace_java
fda7416d90603e0d12538719925b92488a808d1b
75bf76971c876de41b2df536a5f7fbc835f9fd06
refs/heads/master
2021-07-21T03:08:25.858267
2017-10-30T09:43:28
2017-10-30T09:43:28
105,214,175
0
0
null
null
null
null
UHC
Java
false
false
780
java
public class ExceptionEx09 { public static void main(String[] args) { System.out.println("no exception occurred"); System.out.println("프로그램 실행"); try { System.out.println("1"); }catch(Exception e) { System.out.println("예외처리"); }finally { System.out.println("중요 메시지"); } System.out.println("프로그램 종료"); System.out.println("=========="); System.out.println("exception occurred"); System.out.println("프로그램 실행"); try { System.out.println("1"); System.out.println(50/0); System.out.println("2"); }catch(Exception e) { System.out.println("예외처리"); }finally { System.out.println("중요 메시지"); } System.out.println("프로그램 종료"); } }
ed168fd115d76983fdd7e5c8ba1df1a7800ba76b
ccb56af2443d6837ebad4061c583cc6ecc47c9fc
/Programers/src/stack/Progarmmers12973.java
31688c062056f2b77fc748757e824194bcbd62fd
[]
no_license
justyou78/Algorithm
1ae0b2cdeb75da47a7dd9660cf1b18833be948f5
c9ae60b35beffb4acd7d1f78839e1697b5d5838c
refs/heads/master
2021-05-22T14:33:57.751835
2020-05-25T12:03:59
2020-05-25T12:03:59
252,963,769
0
0
null
null
null
null
UTF-8
Java
false
false
386
java
package stack; import java.util.Stack; public class Progarmmers12973 { public int solution(String s) { Stack<Character> st = new Stack<Character>(); for (int i = 0; i < s.length(); i++) { if (st.isEmpty()) { st.push(s.charAt(i)); } else { if (st.peek() == s.charAt(i)) { st.pop(); } } } if (st.isEmpty()) return 1; else return 0; } }
8fd993b2ed9c3e2bea1fa9a41aa84251ed919b8a
12e7520add420180e199cbc575285d5c526f5f4a
/src/birdsanctuary/Flyable.java
ce69bece1ea67b222e1647e3700298617b9490f8
[]
no_license
Abhijeetkale-333/BirdSanctuaryDay8
81bbce3f8de30c080b1c239e617102b4e2080f3a
6dce18a9d273f8cc28d37a0984eebe1b9f34f861
refs/heads/master
2023-04-08T07:44:18.787657
2021-04-13T19:13:50
2021-04-13T19:13:50
357,662,976
0
0
null
null
null
null
UTF-8
Java
false
false
87
java
package birdsanctuary; public interface Flyable { public abstract void fly(); }
bf1c4f821afd4ba961775d21256133c9ddbfb839
75f72edc67b78385af4d76c5fc0ce569055d7270
/src/solved/P11559_Event_Planning.java
5462869fa573e7449f6cdb4b3ce7cda86e5362f3
[]
no_license
mnhmasum/UVa-Accepted-Problems
5b79d2b56bd5656cc4e09f4a5b1ed3a1292fe950
1fc33b83b62652a5a13e300ea097e14a83430d8e
refs/heads/master
2020-03-21T22:38:30.046585
2018-07-30T13:31:05
2018-07-30T13:31:05
139,138,168
1
0
null
null
null
null
UTF-8
Java
false
false
1,498
java
package solved; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Scanner; /** * * @author mnhmasum */ public class P11559_Event_Planning { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); while (scanner.hasNextInt()) { int p = scanner.nextInt(); int b = scanner.nextInt(); int h = scanner.nextInt(); int w = scanner.nextInt(); int costAmount = 0; List l = new ArrayList(); for (int j = 0; j < h; j++) { boolean isValidHotel = true; int singleManCost = scanner.nextInt(); for (int k = 0; k < w; k++) { int bed = scanner.nextInt(); if (bed == 0) { isValidHotel = false; //System.out.println("hi"); } } if (isValidHotel) { costAmount = p * singleManCost; if (costAmount <= b) { l.add(costAmount); } } } if (l.isEmpty()) { System.out.println("stay home"); } else { System.out.println(Collections.min(l)); } } } }
d3457cf167e3e741fa61c04defe6c84bf1c166b8
1a1470c782596d9fdff1559cd053bb25aff8fa07
/src/com/estudos/java8/optional/Aluno.java
3bc24310209cc7e7076950d7b11e584739f65b3e
[]
no_license
sempejunior/studiesJavaVersions
f31d758f1b9d804e5cc32dcc882b68845a45f386
76e2084a7aebcafc721bbde1629d3c0aab001367
refs/heads/master
2020-12-27T04:34:57.363887
2020-02-04T02:26:58
2020-02-04T02:26:58
237,766,639
0
0
null
null
null
null
UTF-8
Java
false
false
567
java
package com.estudos.java8.optional; import java.util.Optional; public class Aluno { private Optional<Matricula> matricula; private String nome; public Aluno(String nome) { this.nome = nome; //Inicializa Optional como um container vazio this.matricula = Optional.empty(); } public Optional<Matricula> getMatricula() { return matricula; } public void setMatricula(Matricula matricula) { this.matricula = Optional.of(matricula); } public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } }
e5a15f20a5966c230ba9f1a323ca9d47cef2a8d4
70378834ee76a35cb734989a13ede4c47991c2a5
/src/cn/broccoli/blog/po/ShuoshuoExample.java
885930127e0e207e21e10c8a8844eda6b46406a9
[]
no_license
yizhixiaojitui/Broccoli
3636fb10a86f10f6e786bda675a68b3a2d5bc342
92f9af1ef47433d3b9b5152ad191565b9ce528de
refs/heads/master
2021-06-30T02:11:42.641172
2019-04-20T10:30:10
2019-04-20T10:30:10
136,560,081
0
0
null
null
null
null
UTF-8
Java
false
false
17,861
java
package cn.broccoli.blog.po; import java.util.ArrayList; import java.util.Date; import java.util.List; public class ShuoshuoExample { protected String orderByClause; protected boolean distinct; protected List<Criteria> oredCriteria; public ShuoshuoExample() { oredCriteria = new ArrayList<Criteria>(); } public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; } public String getOrderByClause() { return orderByClause; } public void setDistinct(boolean distinct) { this.distinct = distinct; } public boolean isDistinct() { return distinct; } public List<Criteria> getOredCriteria() { return oredCriteria; } public void or(Criteria criteria) { oredCriteria.add(criteria); } public Criteria or() { Criteria criteria = createCriteriaInternal(); oredCriteria.add(criteria); return criteria; } public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); if (oredCriteria.size() == 0) { oredCriteria.add(criteria); } return criteria; } protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); return criteria; } public void clear() { oredCriteria.clear(); orderByClause = null; distinct = false; } protected abstract static class GeneratedCriteria { protected List<Criterion> criteria; protected GeneratedCriteria() { super(); criteria = new ArrayList<Criterion>(); } public boolean isValid() { return criteria.size() > 0; } public List<Criterion> getAllCriteria() { return criteria; } public List<Criterion> getCriteria() { return criteria; } protected void addCriterion(String condition) { if (condition == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion(condition)); } protected void addCriterion(String condition, Object value, String property) { if (value == null) { throw new RuntimeException("Value for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value)); } protected void addCriterion(String condition, Object value1, Object value2, String property) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value1, value2)); } public Criteria andShuoIdIsNull() { addCriterion("shuo_id is null"); return (Criteria) this; } public Criteria andShuoIdIsNotNull() { addCriterion("shuo_id is not null"); return (Criteria) this; } public Criteria andShuoIdEqualTo(Integer value) { addCriterion("shuo_id =", value, "shuoId"); return (Criteria) this; } public Criteria andShuoIdNotEqualTo(Integer value) { addCriterion("shuo_id <>", value, "shuoId"); return (Criteria) this; } public Criteria andShuoIdGreaterThan(Integer value) { addCriterion("shuo_id >", value, "shuoId"); return (Criteria) this; } public Criteria andShuoIdGreaterThanOrEqualTo(Integer value) { addCriterion("shuo_id >=", value, "shuoId"); return (Criteria) this; } public Criteria andShuoIdLessThan(Integer value) { addCriterion("shuo_id <", value, "shuoId"); return (Criteria) this; } public Criteria andShuoIdLessThanOrEqualTo(Integer value) { addCriterion("shuo_id <=", value, "shuoId"); return (Criteria) this; } public Criteria andShuoIdIn(List<Integer> values) { addCriterion("shuo_id in", values, "shuoId"); return (Criteria) this; } public Criteria andShuoIdNotIn(List<Integer> values) { addCriterion("shuo_id not in", values, "shuoId"); return (Criteria) this; } public Criteria andShuoIdBetween(Integer value1, Integer value2) { addCriterion("shuo_id between", value1, value2, "shuoId"); return (Criteria) this; } public Criteria andShuoIdNotBetween(Integer value1, Integer value2) { addCriterion("shuo_id not between", value1, value2, "shuoId"); return (Criteria) this; } public Criteria andUserIdIsNull() { addCriterion("user_id is null"); return (Criteria) this; } public Criteria andUserIdIsNotNull() { addCriterion("user_id is not null"); return (Criteria) this; } public Criteria andUserIdEqualTo(Integer value) { addCriterion("user_id =", value, "userId"); return (Criteria) this; } public Criteria andUserIdNotEqualTo(Integer value) { addCriterion("user_id <>", value, "userId"); return (Criteria) this; } public Criteria andUserIdGreaterThan(Integer value) { addCriterion("user_id >", value, "userId"); return (Criteria) this; } public Criteria andUserIdGreaterThanOrEqualTo(Integer value) { addCriterion("user_id >=", value, "userId"); return (Criteria) this; } public Criteria andUserIdLessThan(Integer value) { addCriterion("user_id <", value, "userId"); return (Criteria) this; } public Criteria andUserIdLessThanOrEqualTo(Integer value) { addCriterion("user_id <=", value, "userId"); return (Criteria) this; } public Criteria andUserIdIn(List<Integer> values) { addCriterion("user_id in", values, "userId"); return (Criteria) this; } public Criteria andUserIdNotIn(List<Integer> values) { addCriterion("user_id not in", values, "userId"); return (Criteria) this; } public Criteria andUserIdBetween(Integer value1, Integer value2) { addCriterion("user_id between", value1, value2, "userId"); return (Criteria) this; } public Criteria andUserIdNotBetween(Integer value1, Integer value2) { addCriterion("user_id not between", value1, value2, "userId"); return (Criteria) this; } public Criteria andShuoTimeIsNull() { addCriterion("shuo_time is null"); return (Criteria) this; } public Criteria andShuoTimeIsNotNull() { addCriterion("shuo_time is not null"); return (Criteria) this; } public Criteria andShuoTimeEqualTo(Date value) { addCriterion("shuo_time =", value, "shuoTime"); return (Criteria) this; } public Criteria andShuoTimeNotEqualTo(Date value) { addCriterion("shuo_time <>", value, "shuoTime"); return (Criteria) this; } public Criteria andShuoTimeGreaterThan(Date value) { addCriterion("shuo_time >", value, "shuoTime"); return (Criteria) this; } public Criteria andShuoTimeGreaterThanOrEqualTo(Date value) { addCriterion("shuo_time >=", value, "shuoTime"); return (Criteria) this; } public Criteria andShuoTimeLessThan(Date value) { addCriterion("shuo_time <", value, "shuoTime"); return (Criteria) this; } public Criteria andShuoTimeLessThanOrEqualTo(Date value) { addCriterion("shuo_time <=", value, "shuoTime"); return (Criteria) this; } public Criteria andShuoTimeIn(List<Date> values) { addCriterion("shuo_time in", values, "shuoTime"); return (Criteria) this; } public Criteria andShuoTimeNotIn(List<Date> values) { addCriterion("shuo_time not in", values, "shuoTime"); return (Criteria) this; } public Criteria andShuoTimeBetween(Date value1, Date value2) { addCriterion("shuo_time between", value1, value2, "shuoTime"); return (Criteria) this; } public Criteria andShuoTimeNotBetween(Date value1, Date value2) { addCriterion("shuo_time not between", value1, value2, "shuoTime"); return (Criteria) this; } public Criteria andShuoIpIsNull() { addCriterion("shuo_ip is null"); return (Criteria) this; } public Criteria andShuoIpIsNotNull() { addCriterion("shuo_ip is not null"); return (Criteria) this; } public Criteria andShuoIpEqualTo(String value) { addCriterion("shuo_ip =", value, "shuoIp"); return (Criteria) this; } public Criteria andShuoIpNotEqualTo(String value) { addCriterion("shuo_ip <>", value, "shuoIp"); return (Criteria) this; } public Criteria andShuoIpGreaterThan(String value) { addCriterion("shuo_ip >", value, "shuoIp"); return (Criteria) this; } public Criteria andShuoIpGreaterThanOrEqualTo(String value) { addCriterion("shuo_ip >=", value, "shuoIp"); return (Criteria) this; } public Criteria andShuoIpLessThan(String value) { addCriterion("shuo_ip <", value, "shuoIp"); return (Criteria) this; } public Criteria andShuoIpLessThanOrEqualTo(String value) { addCriterion("shuo_ip <=", value, "shuoIp"); return (Criteria) this; } public Criteria andShuoIpLike(String value) { addCriterion("shuo_ip like", value, "shuoIp"); return (Criteria) this; } public Criteria andShuoIpNotLike(String value) { addCriterion("shuo_ip not like", value, "shuoIp"); return (Criteria) this; } public Criteria andShuoIpIn(List<String> values) { addCriterion("shuo_ip in", values, "shuoIp"); return (Criteria) this; } public Criteria andShuoIpNotIn(List<String> values) { addCriterion("shuo_ip not in", values, "shuoIp"); return (Criteria) this; } public Criteria andShuoIpBetween(String value1, String value2) { addCriterion("shuo_ip between", value1, value2, "shuoIp"); return (Criteria) this; } public Criteria andShuoIpNotBetween(String value1, String value2) { addCriterion("shuo_ip not between", value1, value2, "shuoIp"); return (Criteria) this; } public Criteria andShuoshuoIsNull() { addCriterion("shuoshuo is null"); return (Criteria) this; } public Criteria andShuoshuoIsNotNull() { addCriterion("shuoshuo is not null"); return (Criteria) this; } public Criteria andShuoshuoEqualTo(String value) { addCriterion("shuoshuo =", value, "shuoshuo"); return (Criteria) this; } public Criteria andShuoshuoNotEqualTo(String value) { addCriterion("shuoshuo <>", value, "shuoshuo"); return (Criteria) this; } public Criteria andShuoshuoGreaterThan(String value) { addCriterion("shuoshuo >", value, "shuoshuo"); return (Criteria) this; } public Criteria andShuoshuoGreaterThanOrEqualTo(String value) { addCriterion("shuoshuo >=", value, "shuoshuo"); return (Criteria) this; } public Criteria andShuoshuoLessThan(String value) { addCriterion("shuoshuo <", value, "shuoshuo"); return (Criteria) this; } public Criteria andShuoshuoLessThanOrEqualTo(String value) { addCriterion("shuoshuo <=", value, "shuoshuo"); return (Criteria) this; } public Criteria andShuoshuoLike(String value) { addCriterion("shuoshuo like", value, "shuoshuo"); return (Criteria) this; } public Criteria andShuoshuoNotLike(String value) { addCriterion("shuoshuo not like", value, "shuoshuo"); return (Criteria) this; } public Criteria andShuoshuoIn(List<String> values) { addCriterion("shuoshuo in", values, "shuoshuo"); return (Criteria) this; } public Criteria andShuoshuoNotIn(List<String> values) { addCriterion("shuoshuo not in", values, "shuoshuo"); return (Criteria) this; } public Criteria andShuoshuoBetween(String value1, String value2) { addCriterion("shuoshuo between", value1, value2, "shuoshuo"); return (Criteria) this; } public Criteria andShuoshuoNotBetween(String value1, String value2) { addCriterion("shuoshuo not between", value1, value2, "shuoshuo"); return (Criteria) this; } public Criteria andTypeIdIsNull() { addCriterion("type_id is null"); return (Criteria) this; } public Criteria andTypeIdIsNotNull() { addCriterion("type_id is not null"); return (Criteria) this; } public Criteria andTypeIdEqualTo(Byte value) { addCriterion("type_id =", value, "typeId"); return (Criteria) this; } public Criteria andTypeIdNotEqualTo(Byte value) { addCriterion("type_id <>", value, "typeId"); return (Criteria) this; } public Criteria andTypeIdGreaterThan(Byte value) { addCriterion("type_id >", value, "typeId"); return (Criteria) this; } public Criteria andTypeIdGreaterThanOrEqualTo(Byte value) { addCriterion("type_id >=", value, "typeId"); return (Criteria) this; } public Criteria andTypeIdLessThan(Byte value) { addCriterion("type_id <", value, "typeId"); return (Criteria) this; } public Criteria andTypeIdLessThanOrEqualTo(Byte value) { addCriterion("type_id <=", value, "typeId"); return (Criteria) this; } public Criteria andTypeIdIn(List<Byte> values) { addCriterion("type_id in", values, "typeId"); return (Criteria) this; } public Criteria andTypeIdNotIn(List<Byte> values) { addCriterion("type_id not in", values, "typeId"); return (Criteria) this; } public Criteria andTypeIdBetween(Byte value1, Byte value2) { addCriterion("type_id between", value1, value2, "typeId"); return (Criteria) this; } public Criteria andTypeIdNotBetween(Byte value1, Byte value2) { addCriterion("type_id not between", value1, value2, "typeId"); return (Criteria) this; } } public static class Criteria extends GeneratedCriteria { protected Criteria() { super(); } } public static class Criterion { private String condition; private Object value; private Object secondValue; private boolean noValue; private boolean singleValue; private boolean betweenValue; private boolean listValue; private String typeHandler; public String getCondition() { return condition; } public Object getValue() { return value; } public Object getSecondValue() { return secondValue; } public boolean isNoValue() { return noValue; } public boolean isSingleValue() { return singleValue; } public boolean isBetweenValue() { return betweenValue; } public boolean isListValue() { return listValue; } public String getTypeHandler() { return typeHandler; } protected Criterion(String condition) { super(); this.condition = condition; this.typeHandler = null; this.noValue = true; } protected Criterion(String condition, Object value, String typeHandler) { super(); this.condition = condition; this.value = value; this.typeHandler = typeHandler; if (value instanceof List<?>) { this.listValue = true; } else { this.singleValue = true; } } protected Criterion(String condition, Object value) { this(condition, value, null); } protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { super(); this.condition = condition; this.value = value; this.secondValue = secondValue; this.typeHandler = typeHandler; this.betweenValue = true; } protected Criterion(String condition, Object value, Object secondValue) { this(condition, value, secondValue, null); } } }
5bed51ccd507e85231ace618d31910297b353223
647c369a83c24d127182e657eb54fb8e12918a3b
/system-clock-provider/src/main/java/pro/buildmysoftware/clock/systemclockprovider/SystemClockProvider.java
ecd553bbe398f3b38e5692f66f85ef59b2d025f4
[]
no_license
hAckdamDys/jpms-training-simple
8fd37060d744a817e48e52272862efed1922a889
39c60fa08e7d588f83385255903783eb52a7e617
refs/heads/master
2020-09-06T01:13:29.176247
2019-11-07T15:28:04
2019-11-07T15:28:04
220,269,422
0
0
null
2019-11-07T15:32:38
2019-11-07T15:32:37
null
UTF-8
Java
false
false
285
java
package pro.buildmysoftware.clock.systemclockprovider; import pro.buildmysoftware.clock.api.ClockApiProvider; import java.time.Clock; public class SystemClockProvider implements ClockApiProvider { @Override public Clock provide() { return Clock.systemUTC(); } }
64adcaa826ae666b9a91442e704cb29ae5d4a678
88fb9ab04d982e394e56fde92a31d257931a7ba3
/src/main/java/ua/home/work/model/entity/Accessory.java
5d9408f770a8ee18f0c4449b9d7a92ba3f8de903
[]
no_license
StrakDD/FlowerShop
0f1e8d7c4c81d98b6fb9139718a60d150fa00a16
6f50f48e7ffe9fe277574093c17583159590416a
refs/heads/master
2021-01-01T18:56:23.899600
2017-07-28T20:22:35
2017-07-28T20:22:35
98,463,053
0
0
null
null
null
null
UTF-8
Java
false
false
1,382
java
package ua.home.work.model.entity; import ua.home.work.model.entity.Plant.Flower; /** * Created by Denis Starovoitenko on 27.07.2017. */ public class Accessory { private Flower flower; private boolean wrap; private boolean ribbon; private boolean basket; public Accessory(Flower flower){ this(flower, false, false, false); } public Accessory(Flower flower, boolean wrap, boolean ribbon, boolean basket){ this.flower = flower; this.wrap = wrap; this.ribbon = ribbon; this.basket = basket; } public Flower getFlower() { return flower; } public void setFlower(Flower flower) { this.flower = flower; } public boolean isWrap() { return wrap; } public void setWrap(boolean wrap) { this.wrap = wrap; } public boolean isRibbon() { return ribbon; } public void setRibbon(boolean ribbon) { this.ribbon = ribbon; } public boolean isBasket() { return basket; } public void setBasket(boolean basket) { this.basket = basket; } @Override public String toString() { return "Accessory{" + "flower=" + flower + ", wrap=" + wrap + ", ribbon=" + ribbon + ", basket=" + basket + '}'; } }
cc93b89cee4c2ba723da9522eaf4b3194bdf13c7
78a810a94ba22fec3896170e4aa4fab71be914be
/api/src/main/java/se/emilsjolander/intentbuilder/IntentBuilder.java
3373600b00506a24b1b1dc0e59afba9d108bad0f
[ "Apache-2.0" ]
permissive
bryant1410/IntentBuilder
a6c15a0af66c60c28f17ccc0e840427bfa1ab185
a7811825d6cab8e7f7be6b6f4f3f7ba2d46e1eab
refs/heads/master
2021-01-19T20:55:57.967361
2017-04-18T03:58:18
2017-04-18T03:58:18
88,579,642
1
0
null
2017-04-18T03:58:19
2017-04-18T03:58:19
null
UTF-8
Java
false
false
77
java
package se.emilsjolander.intentbuilder; public @interface IntentBuilder { }
69eca45629bbdbf2c94e094d7bbbe27f1f08949f
c6e9d89306da3dee1b2339014d8b8216309c052b
/src/org/adligo/fabricate_tests/models/common/ExpectedRoutineInterfaceTrial.java
a405b77b53846ff474f28406670b2d371fe78dee
[ "Apache-2.0" ]
permissive
adligo/fabricate_tests.adligo.org
70143d659c1cf50cc9ef23e1a0c1ac74ba87fa5a
b2d2c80d2c6fb84338fb1c1599888629b348abe0
refs/heads/master
2021-01-10T21:35:35.966080
2015-04-01T13:36:45
2015-04-01T13:36:45
33,228,690
0
0
null
null
null
null
UTF-8
Java
false
false
6,690
java
package org.adligo.fabricate_tests.models.common; import org.adligo.fabricate.models.common.ExpectedRoutineInterface; import org.adligo.fabricate.models.common.ExpectedRoutineInterfaceMutant; import org.adligo.fabricate.models.common.I_ExpectedRoutineInterface; import org.adligo.fabricate.models.common.I_FabricationRoutine; import org.adligo.tests4j.shared.asserts.common.ExpectedThrowable; import org.adligo.tests4j.shared.asserts.common.I_Thrower; import org.adligo.tests4j.system.shared.trials.SourceFileScope; import org.adligo.tests4j.system.shared.trials.Test; import org.adligo.tests4j_4mockito.MockitoSourceFileTrial; import java.util.Collections; import java.util.List; /** * @author scott * */ @SourceFileScope (sourceClass=ExpectedRoutineInterface.class, minCoverage=97.0) public class ExpectedRoutineInterfaceTrial extends MockitoSourceFileTrial { @SuppressWarnings("boxing") @Test public void testConstructor() { Class<?>[] clazzes = null; ExpectedRoutineInterface copy = new ExpectedRoutineInterface(String.class, clazzes); assertEquals(String.class.getName(), copy.getInterfaceClass().getName()); List<Class<?>> gts = copy.getGenericTypes(); assertEquals(0, gts.size()); assertEquals("java.util.Collections$EmptyList", gts.getClass().getName()); copy = new ExpectedRoutineInterface(String.class, Long.class, Integer.class); assertEquals(String.class.getName(), copy.getInterfaceClass().getName()); gts = copy.getGenericTypes(); assertEquals(Long.class.getName(), gts.get(0).getName()); assertEquals(Integer.class.getName(), gts.get(1).getName()); assertEquals(2, gts.size()); assertEquals("java.util.Collections$UnmodifiableRandomAccessList", gts.getClass().getName()); } @SuppressWarnings("boxing") @Test public void testConstructorCopy() { ExpectedRoutineInterfaceMutant mut = new ExpectedRoutineInterfaceMutant(); mut.setInterfaceClass(String.class); ExpectedRoutineInterface copy = new ExpectedRoutineInterface(mut); assertEquals(String.class.getName(), copy.getInterfaceClass().getName()); List<Class<?>> gts = copy.getGenericTypes(); assertEquals(0, gts.size()); assertEquals("java.util.Collections$EmptyList", gts.getClass().getName()); I_ExpectedRoutineInterface mock = mock(I_ExpectedRoutineInterface.class); doReturn(String.class).when(mock).getInterfaceClass(); when(mock.getGenericTypes()).thenReturn(null); copy = new ExpectedRoutineInterface(mock); assertEquals(String.class.getName(), copy.getInterfaceClass().getName()); gts = copy.getGenericTypes(); assertEquals(0, gts.size()); assertEquals("java.util.Collections$EmptyList", gts.getClass().getName()); mut.setGenericTypes(Collections.singletonList(Long.class)); copy = new ExpectedRoutineInterface(mut); assertEquals(String.class.getName(), copy.getInterfaceClass().getName()); gts = copy.getGenericTypes(); assertEquals(Long.class.getName(), gts.get(0).getName()); assertEquals(1, gts.size()); assertEquals("java.util.Collections$UnmodifiableRandomAccessList", gts.getClass().getName()); } @Test public void testConstructorExceptions() { ExpectedRoutineInterfaceMutant mut = new ExpectedRoutineInterfaceMutant(); assertThrown(new ExpectedThrowable(NullPointerException.class), new I_Thrower() { @SuppressWarnings("unused") @Override public void run() throws Throwable { new ExpectedRoutineInterface(mut); } }); assertThrown(new ExpectedThrowable(NullPointerException.class), new I_Thrower() { @SuppressWarnings("unused") @Override public void run() throws Throwable { new ExpectedRoutineInterface(null, String.class); } }); } @Test public void testMethodsGetsAndSets() { ExpectedRoutineInterfaceMutant mut = new ExpectedRoutineInterfaceMutant(); mut.setInterfaceClass(String.class); assertEquals(String.class.getName(), mut.getInterfaceClass().getName()); mut.setGenericTypes(Collections.singletonList(Long.class)); List<Class<?>> gts = mut.getGenericTypes(); assertEquals(Long.class.getName(), gts.get(0).getName()); assertEquals("java.util.ArrayList", gts.getClass().getName()); } @SuppressWarnings("boxing") @Test public void testMethodsEqualsHashCode() { ExpectedRoutineInterfaceMutant a = new ExpectedRoutineInterfaceMutant(); a.setInterfaceClass(String.class); ExpectedRoutineInterfaceMutant b = new ExpectedRoutineInterfaceMutant(); b.setInterfaceClass(I_FabricationRoutine.class); ExpectedRoutineInterfaceMutant c = new ExpectedRoutineInterfaceMutant(); c.setInterfaceClass(I_FabricationRoutine.class); c.setGenericTypes(Collections.singletonList(String.class)); ExpectedRoutineInterface a1 = new ExpectedRoutineInterface(a); ExpectedRoutineInterface b1 = new ExpectedRoutineInterface(b); ExpectedRoutineInterface c1 = new ExpectedRoutineInterface(c); //hash codes assertEquals(a1.hashCode(), a1.hashCode()); assertEquals(a1.hashCode(), a.hashCode()); assertNotEquals(a1.hashCode(), b1.hashCode()); assertNotEquals(a1.hashCode(), b.hashCode()); assertNotEquals(a1.hashCode(), c1.hashCode()); assertNotEquals(a1.hashCode(), c.hashCode()); assertEquals(b1.hashCode(), b1.hashCode()); assertEquals(b1.hashCode(), b.hashCode()); assertNotEquals(b1.hashCode(), a1.hashCode()); assertNotEquals(b1.hashCode(), a.hashCode()); assertNotEquals(b1.hashCode(), c1.hashCode()); assertNotEquals(b1.hashCode(), c.hashCode()); assertEquals(c1.hashCode(), c1.hashCode()); assertEquals(c1.hashCode(), c.hashCode()); assertNotEquals(c1.hashCode(), a1.hashCode()); assertNotEquals(c1.hashCode(), a.hashCode()); assertNotEquals(c1.hashCode(), b1.hashCode()); assertNotEquals(c1.hashCode(), b.hashCode()); //equals assertTrue(a1.equals(a1)); assertTrue(a1.equals(a)); assertFalse(a1.equals(b1)); assertFalse(a1.equals(b)); assertFalse(a1.equals(c1)); assertFalse(a1.equals(c)); assertTrue(b1.equals(b1)); assertTrue(b1.equals(b)); assertFalse(b1.equals(a1)); assertFalse(b1.equals(a)); assertFalse(b1.equals(c1)); assertFalse(b1.equals(c)); assertTrue(c1.equals(c1)); assertTrue(c1.equals(c)); assertFalse(c1.equals(a1)); assertFalse(c1.equals(a)); assertFalse(c1.equals(b1)); assertFalse(c1.equals(b)); } }
461b0b43e38400aa41b7f71b6f7fd05c9c689b73
ee0136bbe910da193611b1e9c0c04f29bfbc9790
/src/main/java/com/py/ds/channel/zyt/api/service/AccountService.java
d59d6c7e4002dce79fd0ea9a8f3f4608ae09162b
[]
no_license
tbwytxdd/api
f189c29bfe12f18bcd6bfd48027e98a05fe269ec
ccabde6052c3cc8956d534594ba74c0f49b3b9b0
refs/heads/master
2020-08-03T07:43:10.679066
2019-09-29T14:24:49
2019-09-29T14:24:49
211,672,718
0
0
null
null
null
null
UTF-8
Java
false
false
1,342
java
package com.py.ds.channel.zyt.api.service; import java.io.IOException; import java.util.HashMap; import java.util.Map; import com.py.ds.channel.zyt.api.xmlmodel.FOARes1; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import com.py.ds.channel.zyt.api.service.HttpService; import com.py.ds.channel.zyt.api.xmlmodel.FOAReq; import com.py.ds.channel.zyt.api.xmlmodel.FOARes; public class AccountService { private final Logger log = LoggerFactory.getLogger(this.getClass()); @Autowired private HttpService httpService; public FOARes openAccount(FOAReq foaReq){ Map<String,String> argsMap=new HashMap<String,String>(); String merid = "000330"; //商户号 S 30 0 Y v4.1.0.0 授权给调用方的商户号 String channel = "330000"; //交易渠道 S 20 0 N v4.1.0.0 FUNDAPI交易渠道 argsMap.put("merid", merid); argsMap.put("channel", channel);//要查询的关键字 try { ResponseEntity<String> result = httpService.postForString("http://IP:PORT/openapi/wmbusrestful/ds/pub/account/openfundaccount", argsMap); } catch (IOException e) { e.printStackTrace(); } //return new FOARes(); FOARes1 foaRes1 = new FOARes1(); foaRes1.setCode(""); return null; } }
fc225723ce5310267b1956d0bd454a3e47f5ae2e
d2c683d2e63b57d07cb46b6ee124e3f1130fd832
/app/src/main/java/com/example/newseye/AccountFragment.java
5b9cf6b0cdfd77071e84c2d412263320e8adab5e
[]
no_license
ArtiGaund/SmartIndiaHackathon2020
d5e7dff3057523c4a3d7f62430d4a67d7d4a9639
1ba714f11deb7032da9162992313ec805a5d2644
refs/heads/master
2022-11-26T05:06:14.993492
2020-07-30T16:29:23
2020-07-30T16:29:23
283,823,803
0
0
null
null
null
null
UTF-8
Java
false
false
6,656
java
package com.example.newseye; import android.app.ProgressDialog; import android.content.Intent; import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.net.Uri; import android.os.Bundle; import android.provider.MediaStore; import android.util.Base64; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; 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 java.io.ByteArrayOutputStream; import java.io.IOException; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import static android.app.Activity.RESULT_OK; public class AccountFragment extends Fragment { Button signOut; ProgressDialog progressdialog; ImageView userDp; TextView txtname,txtdep,txtemail,txtread,txtshared,txtfav; private static int RESULT_LOAD_IMAGE = 1; @Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View root = inflater.inflate(R.layout.fragment_account,container,false); signOut = root.findViewById(R.id.sign_out); userDp = root.findViewById(R.id.user_dp); txtname = root.findViewById(R.id.txt_name); txtdep = root.findViewById(R.id.txt_department); txtemail = root.findViewById(R.id.txt_email); txtread = root.findViewById(R.id.txt_read); txtshared = root.findViewById(R.id.txtshared); txtfav = root.findViewById(R.id.txtFavs); userDp.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent galleryIntent = new Intent(Intent.ACTION_PICK,android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); // Start the Intent startActivityForResult(galleryIntent,RESULT_LOAD_IMAGE); } }); FirebaseAuth firebaseAuth = FirebaseAuth.getInstance(); FirebaseUser currentUser = firebaseAuth.getCurrentUser(); loadProfile(currentUser); signOut.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { FirebaseAuth.getInstance().signOut(); startActivity(new Intent(getActivity(),LoginActivity.class)); getActivity().finish(); } }); return root; } private void loadProfile(final FirebaseUser currentUser) { progressdialog = new ProgressDialog(getActivity()); progressdialog.setMessage("Loading..."); progressdialog.show(); DatabaseReference ref = FirebaseDatabase.getInstance().getReference().child("users").child(currentUser.getUid()); ValueEventListener valueEventListener = new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { progressdialog.dismiss(); // Toast.makeText(getActivity(), ""+dataSnapshot.child("username").getValue(), Toast.LENGTH_SHORT).show(); String name = (String) dataSnapshot.child("username").getValue(); String userDP = (String) dataSnapshot.child("userDp").getValue(); String userdep = (String) dataSnapshot.child("department").getValue(); long artReads = (long) dataSnapshot.child("articlesRead").getValue(); long artShared = (long) dataSnapshot.child("articlesShared").getValue(); long favorites = (long) dataSnapshot.child("favorites").getValue(); if(userDP.equals("Default")) userDp.setImageResource(R.drawable.ic_account_circle_black_24dp); else { Bitmap imageBitmap = null; try { imageBitmap = decodeFromFirebaseBase64(userDP); } catch (IOException e) { e.printStackTrace(); } userDp.setImageBitmap(imageBitmap); } txtname.setText(name); txtdep.setText(userdep); txtemail.setText(currentUser.getEmail()); txtread.setText(""+artReads); txtshared.setText(""+artShared); txtfav.setText(""+favorites); } @Override public void onCancelled(@NonNull DatabaseError databaseError) {} }; ref.addListenerForSingleValueEvent(valueEventListener); } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == RESULT_LOAD_IMAGE && resultCode == RESULT_OK && null != data) { Uri selectedImage = data.getData(); userDp.setImageURI(selectedImage); Bitmap bitmap = null; try { bitmap = MediaStore.Images.Media.getBitmap(getActivity().getContentResolver(), selectedImage); } catch (IOException e) { e.printStackTrace(); } encodeBitmapAndSaveToFirebase(bitmap); } } public void encodeBitmapAndSaveToFirebase(Bitmap bitmap) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.PNG, 100, baos); String imageEncoded = Base64.encodeToString(baos.toByteArray(), Base64.DEFAULT); DatabaseReference ref = FirebaseDatabase.getInstance() .getReference() .child("users") .child(FirebaseAuth.getInstance().getCurrentUser().getUid()); ref.child("userDp").setValue(imageEncoded); } public static Bitmap decodeFromFirebaseBase64(String image) throws IOException { byte[] decodedByteArray = android.util.Base64.decode(image, Base64.DEFAULT); return BitmapFactory.decodeByteArray(decodedByteArray, 0, decodedByteArray.length); } }
6e045ce2f6b6f174ffe8598c6e5874a4dd41d817
1a4cb13589f04bcb41f2141fc71d33ff7f188538
/listas_sala/A6_LawDemeter/LabDemeter/src/refactor1/Applicant.java
49aa51acb3710d8d3b2be0fd18902612d7d6ed9a
[]
no_license
felipeuchida/ces28_2017_felipe.uchida
91a2c7f22dd3820d04eeec09c7a3ec6cabd94dc0
e9042f1c64f058b8cfdcae8365dcdf8990e8b726
refs/heads/master
2021-08-20T00:52:08.397160
2017-11-27T21:18:53
2017-11-27T21:18:53
100,273,874
0
0
null
null
null
null
UTF-8
Java
false
false
627
java
package refactor1; public class Applicant { int id; String nome; double averageGrade = 0.0; public ApplicationResult recordNewApplication(School school) { ApplicationResult retResult = school.register(this); return retResult; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } public double getAverageGrade() { return averageGrade; } public void setAverageGrade(double averageGrade) { this.averageGrade = averageGrade; } }
5c9a9b53b3f1aa23e28ae11169ee4932b93b77bc
e2c01cbead0455278b14dc86f992f5bf255d97e6
/src/main/java/hello/Application.java
dd63b49d3b863aa15433572eec6b7c435b78ce1b
[]
no_license
ddorante/Consuming-a-RESTful-Web-Service
7bdd42ecc157da7acfab9d863edb49a01dffbc8e
7f30e37a3bd5efdf028afafb36cf88e94624dc57
refs/heads/master
2020-03-27T22:06:08.927844
2018-09-06T09:41:54
2018-09-06T09:41:54
147,204,438
0
0
null
null
null
null
UTF-8
Java
false
false
1,532
java
package hello; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.web.client.RestTemplateBuilder; import org.springframework.context.annotation.Bean; import org.springframework.http.client.SimpleClientHttpRequestFactory; import org.springframework.web.client.RestTemplate; import java.net.InetSocketAddress; import java.net.Proxy; @SpringBootApplication public class Application { private static final Logger log = LoggerFactory.getLogger(Application.class); public static void main(String args[]) { SpringApplication.run(Application.class); } @Bean public RestTemplate restTemplate(RestTemplateBuilder builder) { SimpleClientHttpRequestFactory clientHttpReq = new SimpleClientHttpRequestFactory(); Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("proxy.indra.es", 8080)); clientHttpReq.setProxy(proxy); RestTemplate restTemplate = new RestTemplate(clientHttpReq); return restTemplate; //return builder.build(); } @Bean public CommandLineRunner run(RestTemplate restTemplate) throws Exception { return args -> { Quote quote = restTemplate.getForObject( "http://gturnquist-quoters.cfapps.io/api/random", Quote.class); log.info(quote.toString()); }; } }
[ "Xikitoelmejor_88" ]
Xikitoelmejor_88
e734587e7308e57fb776f9092cb47cc4621e94a2
81634d0c3076a422389e2483a460780b8372f49e
/src/outer_inner_classes/AnonimousInnerClass.java
0c9bd4981a72e63c9ae40743dc63b9ce07464943
[]
no_license
hishnizza/Learning
c098e42b3cafdd5cd367c4ac18e3358d3a9a213d
2fb486b25cf40e55695f1bd4392c29d5ae1e18f6
refs/heads/master
2020-03-27T22:28:13.171119
2018-09-03T17:27:37
2018-09-03T17:27:38
147,233,950
0
0
null
null
null
null
UTF-8
Java
false
false
518
java
/** * author Maria.Gavrilova * copyright 19.07.2018 © Devellar */ package outer_inner_classes; public abstract class AnonimousInnerClass { public abstract void print(); } class InnerClass { public static void main(String[] args) { AnonimousInnerClass inClass = new AnonimousInnerClass() { @Override public void print() { System.out.println("This is overriden method of abstract public class"); } }; inClass.print(); } }
44921bfc102873ddb947c0ff414f16b171132971
6f461acdb4dc2f2667c8682ff50c612096405570
/Core/src/main/java/com/gaea/game/core/ws/WSMessage.java
0008ff2bf73741160dff48bcca581274e9521022
[]
no_license
ymw520369/gaeagame
f1584aa3d5dd5a186b3318ea3530d2b5814b3749
0e989a1fc57a9221d230cc1e2e465fa6c3bedbc3
refs/heads/master
2021-01-19T18:49:09.886818
2017-10-09T10:18:20
2017-10-09T10:18:20
101,168,005
1
0
null
null
null
null
UTF-8
Java
false
false
447
java
package com.gaea.game.core.ws; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Created on 2017/8/2. * * @author Alan * @since 1.0 */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface WSMessage { boolean resp() default false; int messageType() default 0; int cmd() default 0; }
937dd055195c48008fb736ce62a3cfc413da8560
e575ede157a06f73079c549e9b85f027adcc5ba1
/app/src/main/java/com/example/ekonobeeva/myapplication_1/MyAdapter.java
fb2b051d866703a6c8255efe151594b6848ccb23
[]
no_license
EvgeniyaKonobeeva/My_Application
0b35934f42d9bae10ccd8df413281f714e027cd2
43b6d0b5ff72cd05428206d9d2df917ec4455e7c
refs/heads/master
2020-04-12T05:01:15.544285
2017-04-04T20:16:17
2017-04-04T20:16:17
64,940,913
0
1
null
null
null
null
UTF-8
Java
false
false
5,305
java
package com.example.ekonobeeva.myapplication_1; import android.content.Context; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; import java.util.ArrayList; import java.util.List; /** * Created by e.konobeeva on 28.07.2016. */ public class MyAdapter extends ArrayAdapter<Object>{ private List<Object> list; private int resource; private Context ctx; LayoutInflater lInflater; private static int count = 0; public MyAdapter(Context ctx, int resource, List<Object> list){ super(ctx, resource); this.ctx = ctx; this.resource = resource; this.list = list; lInflater = (LayoutInflater) ctx .getSystemService(Context.LAYOUT_INFLATER_SERVICE); } public MyAdapter(Context context, int resource){ super(context, resource); ctx = context; this.resource = resource; lInflater = (LayoutInflater) ctx .getSystemService(Context.LAYOUT_INFLATER_SERVICE); } @Override public int getCount() { if(list.size()%2 == 0){ return list.size()/2; }else{ return list.size()/2+1; } } @Override public int getViewTypeCount() { return 2; } @Override public int getItemViewType(int position) { return position%2; } @Override public Object getItem(int position) { return list.get(position); } static class ViewHolder{ TextView textViewFirst; ImageView imageViewFirst; TextView textViewSecond; ImageView imageViewSecond; } @Override public View getView(int position, View convertView, ViewGroup parent) { //Log.d("MY_INFO", "count = " + (count)); count++; final ViewHolder viewHolder; /*if(position%2==0){ resource = R.layout.right_layout; }else{ resource = R.layout.image_view_layout; }*/ if (convertView == null){ //Log.d("MY_INFO", "convertView == null"); convertView = lInflater.inflate(resource, parent, false); viewHolder = new ViewHolder(); /*viewHolder.textViewFirst = (TextView)convertView.findViewById(R.id.IDTextViewFirst); viewHolder.imageViewFirst = (ImageView)convertView.findViewById(R.id.IDImageViewFirst); viewHolder.textViewSecond = (TextView)convertView.findViewById(R.id.IDTextViewSecond); viewHolder.imageViewSecond = (ImageView)convertView.findViewById(R.id.IDImageViewSecond); convertView.setTag(viewHolder); */ }else{ //Log.d("MY_INFO", "convertView != null"); viewHolder = (ViewHolder) convertView.getTag(); } int n = position*2; ListContent listContent1 = (ListContent) getItem(n); viewHolder.textViewFirst.setText(listContent1.getString()); viewHolder.textViewFirst.setTag("tvf" + (n+1)); viewHolder.imageViewFirst.setImageResource(listContent1.getImRes()); viewHolder.imageViewFirst.setTag("ivf" + (n+1)); if(n+1 <list.size()){ ListContent listContent2 = (ListContent) getItem(n + 1); viewHolder.textViewSecond.setText(listContent2.getString()); viewHolder.textViewSecond.setTag("ivs" + (n+2)); viewHolder.imageViewSecond.setImageResource(listContent2.getImRes()); viewHolder.imageViewSecond.setTag("ivf" + (n+2)); }else{ viewHolder.textViewSecond.setVisibility(View.INVISIBLE); viewHolder.imageViewSecond.setVisibility(View.INVISIBLE); } viewHolder.imageViewFirst.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Toast.makeText(ctx, viewHolder.imageViewFirst.getTag().toString(), Toast.LENGTH_SHORT).show(); } }); viewHolder.imageViewSecond.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Toast.makeText(ctx, viewHolder.imageViewSecond.getTag().toString(), Toast.LENGTH_SHORT).show(); } }); viewHolder.textViewFirst.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Toast.makeText(ctx, viewHolder.textViewFirst.getTag().toString(), Toast.LENGTH_SHORT).show(); } }); viewHolder.textViewSecond.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Toast.makeText(ctx, viewHolder.textViewSecond.getTag().toString(), Toast.LENGTH_SHORT).show(); } }); return convertView; } View.OnClickListener onClickListener = new View.OnClickListener() { @Override public void onClick(View view) { Toast.makeText(ctx, view.getTag().toString(), Toast.LENGTH_SHORT).show(); } }; }