blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2
values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | 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 132
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 28
values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
806af2d6d98d453dc2c9115b0557379f0ec8bcc7 | 96abe7e24e35fc0a97061f27ebe261b5fda890a0 | /main/java/uk/org/softart/kc/client/models/loader/CubeGroup.java | 91ed0cbaa69fb7fe9848007137b4e05c71a27475 | [] | no_license | Kaneras/Project-Prehistorica | 9f16ce22c175bec0a2d7735f73e3f8812989b204 | fd098a42fc1f65ea188b88533e99de1cb4c71ea5 | refs/heads/master | 2020-12-25T14:33:01.360688 | 2016-08-17T23:15:32 | 2016-08-17T23:15:32 | 65,938,492 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 401 | java | package uk.org.softart.kc.client.models.loader;
import java.util.ArrayList;
import com.google.common.collect.Lists;
public class CubeGroup {
public ArrayList<CubeInfo> cubes = Lists.newArrayList();
public ArrayList<CubeGroup> cubeGroups = Lists.newArrayList();
public String name;
public boolean txMirror = false;
public boolean hidden = false;
public String identifier;
}
| [
"kaneras@softart.org.uk"
] | kaneras@softart.org.uk |
8c30cc83dcfa596815bf32590dc9614d8d077c46 | 4e2bd4a2f5b0096abe2c7c888d2c9ee63431cfea | /Project/ISAProject/src/main/java/tmnt/isa/project/model/Friendship.java | 1ec516db8a44296babe8fb5ec4f8b0fd12261f66 | [] | no_license | isa-tmnt/isaProject | ef8fc8459a16b976b7f5798c1495ad638122f2ac | d6b864fe0ec3a7c018efa51e4ecedcfb8f5bde9a | refs/heads/master | 2021-01-13T10:21:37.109565 | 2017-03-01T18:12:25 | 2017-03-01T18:12:25 | 72,210,085 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 740 | java | package tmnt.isa.project.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import lombok.Data;
@Entity
@Table(name="FRIENDSHIP")
@Data
public class Friendship {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name="FRIENDSHIP_ID", unique=true, nullable=false)
private Long id;
@Column(nullable=false)
private Long currentGuestId;
@Column(nullable=false)
private Long friendId;
public Friendship() {}
public Friendship(Long currentGuestId, Long friendId) {
super();
this.currentGuestId = currentGuestId;
this.friendId = friendId;
}
}
| [
"Zarko Petrovic"
] | Zarko Petrovic |
2290f142158d09b97f51e254d1ed675c44824e4a | fd77c0bb2c4483a3d71808f3aa28967055795c11 | /src/capitulo3/Frete.java | ea0fcb6c130b751725270efa41bdd5a0161a9da8 | [] | no_license | AllanMoraesNeves/Curso-SOLID-com-Java-Orienta-o-a-Objetos-com-Java | 45a2c0704cf09459ee09feb18187e17ad68bf550 | 7befa82d68a4ab0551e7ff6438fef16615ebf969 | refs/heads/master | 2021-09-09T16:59:55.431013 | 2018-03-18T11:50:48 | 2018-03-18T11:50:48 | 125,719,547 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 219 | java | package capitulo3;
public class Frete implements ServicoDeEntrega{
public double para(String cidade) {
if("SAO PAULO".equals(cidade.toUpperCase())) {
return 15;
}
return 30;
}
} | [
"allanmoraes.kk@gmail.com"
] | allanmoraes.kk@gmail.com |
4b4b02cd31eeb64fa1fc3623b69eb85959b05d80 | b1ee70d8479dc152a432bfb16e81d0104499d85d | /app/src/main/java/com/example/tugasuts/Intent.java | e1ac216c7b95393ab1875c0fcf4b552aec6c5a86 | [] | no_license | awmsome/tugasuts | 7f9ad5a42a66ca578fa74485c110b14cdade20d8 | b4e0299f4dae7e97ea49660122f1389c9314af77 | refs/heads/master | 2023-01-14T03:26:07.551174 | 2020-11-20T15:52:38 | 2020-11-20T15:52:38 | 314,599,573 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 293 | java | package com.example.tugasuts;
import android.content.Context;
public class Intent extends android.content.Intent {
public Intent(Context context, Class<DetailActivity> detailActivityClass) {
}
public void putExtra(String foto_film, String nama_film, String info_film) {
}
}
| [
"amazone.m@students.amikom.ac.id"
] | amazone.m@students.amikom.ac.id |
35a14de5af7c07608934be8c00529ab0eef03e62 | 8adb4d9e7dd0f46306caf50d0ec1fc37ef6c207f | /Linguist Assistant Redo/src/grammar/model/FeatureDAO.java | 2780b3294d3f954d1c00d5010df3544e59ef5ab2 | [] | no_license | laronandrew11/linguist-assistant | e10f15e846f58b62dd2663c8f7e9545188079cd3 | e3b23fa6cd1fae8b0f941f3fd54edccc545e5a4f | refs/heads/master | 2020-12-31T06:31:37.969331 | 2013-11-02T12:03:53 | 2013-11-02T12:03:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,560 | java | package grammar.model;
import java.io.ObjectInputStream.GetField;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import lexicon.model.Entry;
import lexicon.model.Language;
import commons.dao.DAOFactory;
import commons.dao.DAOUtil;
public class FeatureDAO {
private DAOFactory factory;
private static final String SQL_POSSIBLE_VALUES =
"SELECT name " +
" FROM FeatureValue " +
" WHERE featurePk = (?) ";
private static final String SQL_DEFAULT_VALUE =
"SELECT name " +
" FROM FeatureValue " +
" WHERE featurePk = (?) " +
" LIMIT 1; ";
private static final String FEATURE_FIELDS =
" name, description, " +
" languagePk, semanticCategoryPk ";
private static final String SQL_CREATE =
"INSERT INTO Feature(" + FEATURE_FIELDS + ") " +
" VALUES (?, ?, ?, ?) ";
private static final String SQL_RETRIEVE_ALL_FEATURES =
"SELECT pk, name, description, languagePk, categoryPk " +
" FROM Feature " +
" WHERE categoryPK = (?); ";
private static final String SQL_RETRIEVE_LEXICON_FEATURES =
"SELECT pk, name, description, languagePk, categoryPk " +
" FROM Feature " +
" WHERE languagePK = (?) " +
" AND " +
" categoryPk = (?) ";
private static final String SQL_RETRIEVE_LEXICON_FEATURE_VALUES =
"SELECT FeatureValue.name AS name " +
" FROM FeatureValue " +
" JOIN Feature " +
" ON Feature.pk = FeatureValue.featurePk " +
" JOIN LexiconFeature " +
" ON FeatureValue.pk = LexiconFeature.featureValuePk " +
" WHERE LexiconFeature.lexiconPk = (?) " +
" AND " +
" Feature.pk = (?); ";
private static final String SQL_UPDATE =
"UPDATE Feature SET " +
" name = (?), " +
" description = (?), " +
" languagePk = (?), " +
" categoryPk = (?) " +
" WHERE pk = (?)";
private static final String SQL_DELETE =
"DELETE FROM Feature WHERE pk = (?)";
public static void main(String[] args) {
DAOFactory factory = DAOFactory.getInstance();
FeatureDAO dao = new FeatureDAO(factory);
Entry entry = Entry.getInstance(1);
List<Feature> features = dao.retrieveAll(entry);
for (Feature feature : features) {
System.out.println(feature.getName() + " -- " + feature.getValue());
}
}
public FeatureDAO(DAOFactory aDAOFactory) {
factory = aDAOFactory;
}
List<String> getPossibleValues(Feature feature) {
List<String> possibleValues = new ArrayList<>();
Object[] values = {
feature.getPk(),
};
List<Integer> list = new ArrayList<>();
list.add(3);
Connection conn = null;
PreparedStatement ps = null;
ResultSet rs = null;
try {
String sql = SQL_POSSIBLE_VALUES;
conn = factory.getConnection();
ps = DAOUtil.prepareStatement(conn, sql, false, values);
rs = ps.executeQuery();
while (rs.next()) {
possibleValues.add(rs.getString("name"));
}
}
catch (SQLException e) {
e.printStackTrace();
}
finally {
DAOUtil.close(conn, ps, rs);
}
return possibleValues;
}
String getDefaultValue(Feature feature) {
String defaultValue = "";
Object[] values = {
feature.getPk()
};
Connection conn = null;
PreparedStatement ps = null;
ResultSet rs = null;
try {
String sql = SQL_DEFAULT_VALUE;
conn = factory.getConnection();
ps = DAOUtil.prepareStatement(conn, sql, false, values);
rs = ps.executeQuery();
rs.next();
defaultValue = rs.getString("name");
}
catch (SQLException e) {
e.printStackTrace();
}
finally {
DAOUtil.close(conn, ps, rs);
}
return defaultValue;
}
void create(Feature feature) {
Object[] values = {
feature.getName(),
feature.getDescription(),
feature.getLanguage().getPk(),
feature.getParent().getPk()
};
Connection conn = null;
PreparedStatement ps = null;
ResultSet rs = null;
try {
String sql = SQL_CREATE;
conn = factory.getConnection();
ps = DAOUtil.prepareStatement(conn, sql, false, values);
ps.executeUpdate();
}
catch (SQLException e) {
e.printStackTrace();
}
finally {
DAOUtil.close(conn, ps, rs);
}
}
public List<Feature> getAllFeatures(Constituent constituent) {
ArrayList<Feature> result = new ArrayList<Feature>();
Object[] values = {
constituent.getPk()
};
Connection conn = null;
PreparedStatement ps = null;
ResultSet rs = null;
try {
String sql = SQL_RETRIEVE_ALL_FEATURES;
conn = factory.getConnection();
ps = DAOUtil.prepareStatement(conn, sql, false, values);
rs = ps.executeQuery();
while (rs.next()) {
Feature feature = map(rs, constituent);
result.add(feature);
}
}
catch (SQLException ex) {
ex.printStackTrace();
}
finally {
DAOUtil.close(conn, ps, rs);
}
return result;
}
public List<Feature> retrieveAll(Entry entry) {
ArrayList<Feature> result = new ArrayList<Feature>();
Object[] values = {
entry.getConstituent().getPk(),
entry.getLanguage().getPk()
};
Connection conn = null;
PreparedStatement ps = null;
ResultSet rs = null;
// acquire features
try {
String sql = SQL_RETRIEVE_LEXICON_FEATURES;
conn = factory.getConnection();
ps = DAOUtil.prepareStatement(conn, sql, false, values);
rs = ps.executeQuery();
while (rs.next()) {
Feature feature = map(rs, entry.getConstituent());
result.add(feature);
}
}
catch (SQLException ex) {
ex.printStackTrace();
}
// assign values
try {
String sql = SQL_RETRIEVE_LEXICON_FEATURE_VALUES;
for (Feature feature : result) {
values = new Object[] {
entry.getPk(),
feature.getPk()
};
ps = DAOUtil.prepareStatement(conn, sql, false, values);
rs = ps.executeQuery();
if (rs.next()) {
feature.setValue(rs.getString("name"));
}
}
}
catch (SQLException ex) {
ex.printStackTrace();
}
finally {
DAOUtil.close(conn, ps, rs);
}
return result;
}
void update(Feature feature) {
Object[] values = {
feature.getName(),
feature.getDescription(),
feature.getLanguage().getPk(),
feature.getParent().getPk(),
feature.getPk(),
};
Connection conn = null;
PreparedStatement ps = null;
ResultSet rs = null;
try {
String sql = SQL_UPDATE;
conn = factory.getConnection();
ps = DAOUtil.prepareStatement(conn, sql, false, values);
ps.executeUpdate();
}
catch (SQLException e) {
e.printStackTrace();
}
finally {
DAOUtil.close(conn, ps, rs);
}
}
void delete(Feature feature) {
Object[] values = {
feature.getPk(),
};
Connection conn = null;
PreparedStatement ps = null;
ResultSet rs = null;
try {
String sql = SQL_DELETE;
conn = factory.getConnection();
ps = DAOUtil.prepareStatement(conn, sql, false, values);
ps.executeUpdate();
}
catch (SQLException e) {
e.printStackTrace();
}
finally {
DAOUtil.close(conn, ps, rs);
}
}
private Feature map(ResultSet rs, Constituent parent) throws SQLException {
Feature feature = Feature.getEmpty(parent);
feature.setPk(rs.getInt("pk"));
feature.setName(rs.getString("name"));
String value = getDefaultValue(feature);
feature.setValue(value);
feature.setDescription(rs.getString("description"));
Language language = Language.getInstance(rs.getInt("languagePk"));
feature.setLanguage(language);
return feature;
}
}
| [
"ivan.paner@gmail.com"
] | ivan.paner@gmail.com |
9effb17890d6f5b586303d2d86989fca1b2803c9 | 8bbc5768a7e520c11db8fb82fe61a0c740cdbb2f | /ssjpa/src/main/java/com/csy/edu/pojo/Resume.java | 8d80a5a2007b49c1983f9d4318eef6c3321cce67 | [] | no_license | chenshiyan/springmvc-homework | db9844c6517cabd154f1cff9bd5897e5b8f9e3a4 | 4cff01a9e09f4cd98188e64fd34388573d90ab9f | refs/heads/master | 2022-12-01T01:49:46.121577 | 2020-08-09T16:24:22 | 2020-08-09T16:24:22 | 286,273,458 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,102 | java | package com.csy.edu.pojo;
import javax.persistence.*;
@Entity
@Table(name = "tb_resume")
public class Resume {
@Id
@Column(name = "id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String address;
private String name;
private String phone;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
@Override
public String toString() {
return "Resume{" +
"id=" + id +
", address='" + address + '\'' +
", name='" + name + '\'' +
", phone='" + phone + '\'' +
'}';
}
}
| [
"13276908335@163.com"
] | 13276908335@163.com |
cb6f7411fa0a800729eb5672bca2f923609a7952 | 01869925bdb867fdbc5878c181ffca008c97c944 | /JavaCpp_Exempel09/SendDatagram.java | 8f2090c2eda978f189932c7bf05f14e9b6184884 | [] | no_license | Pates93/Java-for-cplusplus-programmers | d80c499c5f9fbde772adcbec6f0cdaeaa6da10ef | b043091fbc5f6ed5009ae1c511ecfa042f8e166e | refs/heads/master | 2020-04-21T12:26:14.341985 | 2019-02-07T11:36:50 | 2019-02-07T11:36:50 | 169,561,982 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 1,309 | java | /**
* @author Robert Jonsson (robert.jonsson@miun.se), ITM Östersund
* @version 1.0
* @file Ex04_06 - SendDatagram.java
*/
import java.net.*;
import java.io.*;
public class SendDatagram
{
public static void main(String[] args)
{
try
{
// Gör i ordning meddelandet som ska skickas
String meddelande = "JavaIII";
byte[] data = meddelande.getBytes();
// Skapar InetAddress till den dator meddelande ska skickas
// Använder getLocalHost eftersom vi skickar till oss själva
InetAddress till = InetAddress.getLocalHost();
// Skapar datagrammet och anger att den mottagande datorn "lyssnar" på porten 2345
DatagramPacket paket = new DatagramPacket(data, data.length, till, 2345);
// Skapar en socket för att skicka datagrammet. Stänger när vi är klara
DatagramSocket socket = new DatagramSocket();
System.out.print("Skickar meddelandet... ");
socket.send(paket);
System.out.println("klart");
socket.close();
}
catch (UnknownHostException addressFel)
{
// Kunde inte skapa InetAddress
addressFel.printStackTrace();
}
catch (SocketException socketFel)
{
// Kunde inte skapa DatagramSocket
socketFel.printStackTrace();
}
catch (IOException ioFel)
{
// Kunde inte skicka paketet
ioFel.printStackTrace();
}
}
} | [
"patur093@hotmail.com"
] | patur093@hotmail.com |
b349d416604ea005ae47e876e32e529b60a81e98 | 179fca2228367d32a63d115508383e89c801309c | /src/simplebank/Bank.java | 4494656e45d73702b549b8c50cfb7eb838a642e0 | [] | no_license | sumitdee/SimpleBank | 46e1dc7c7151bbb5d626cb9a2d681879d7c3de1b | b7f843f2bd1a31349e9df490c2b975f73e9d0ce8 | refs/heads/master | 2022-12-01T17:43:39.987078 | 2020-08-16T12:45:29 | 2020-08-16T12:45:29 | 287,941,930 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,864 | java | package simplebank;
import java.util.Scanner;
public class Bank {
Scanner scanB = new Scanner(System.in);
private String accountNumber;
private long availableBalance;
private String customerName;
void openAccount() {
System.out.println("Account number: ");
accountNumber = scanB.next();
System.out.println("What is the name of the customer?: ");
customerName = scanB.next();
System.out.println("Please input the intial balance you need to deposit: ");
availableBalance = scanB.nextLong();
}
void showAccountDetails() {
System.out.println("The account number is " + accountNumber);
System.out.println("The name of the customer is " + customerName);
System.out.println("The current Balance is " + availableBalance);
}
void depositMoney() {
long amount;
System.out.println("Please enter the amount you wish to deposit. ");
amount = scanB.nextLong();
availableBalance += amount;
}
void withdrawMoney() {
long amount;
System.out.println("Please enter the amount you wish to withdraw. ");
amount = scanB.nextLong();
if (availableBalance >= amount) {
System.out.println("Amount withdrawn.");
availableBalance -= amount;
System.out.println("The available balance after withdrawal is ~ " + availableBalance);
} else {
System.out.println("Transaction Failed.");
System.out.println("The available balance is " + availableBalance + ", but you are trying to withdraw " +
amount);
}
}
boolean searchAccount(String accountN){
if(accountNumber.equals(accountN)){
showAccountDetails();
return true;
}
return false;
}
}
| [
"sumidesh@SUMIDESH-LAP.in.oracle.com"
] | sumidesh@SUMIDESH-LAP.in.oracle.com |
1bae98fb8589584fe842ea8f4f9fcac4e92bd453 | e0db80abe352e66f29517abd1b000ef81dfcce56 | /src/main/java/automatas/meraki/analisisSemantico/Tipos/Tipo.java | 0a4a7a6fb55cc19c5481c888c18887e63c0d6b20 | [] | no_license | alexiabl/Meraki2 | 62a2e6dc97cddacc717405c931177ec55ea85195 | a96f15ef60df1b6781b3489b11083a531e726861 | refs/heads/master | 2020-03-20T07:48:52.449078 | 2018-07-11T04:18:05 | 2018-07-11T04:18:05 | 137,291,858 | 0 | 0 | null | 2018-06-21T15:08:11 | 2018-06-14T01:45:30 | Java | UTF-8 | Java | false | false | 411 | java | package automatas.meraki.analisisSemantico.Tipos;
import automatas.meraki.analisisSemantico.TipoTokenTerminal;
/**
* Created by alexiaborchgrevink on 6/13/18.
*/
public abstract class Tipo {
public String getIdentificador() {
return "Tipo";
}
public TipoTokenTerminal getTipoReal() {
return null;
}
public Object getValorReal() {
return "ValorTipo";
}
}
| [
"a1b9l9d6"
] | a1b9l9d6 |
f9440186523699ab6c54f9c56f0caf249aa1c6f8 | c885ef92397be9d54b87741f01557f61d3f794f3 | /results/Math-6/org.apache.commons.math3.optim.nonlinear.scalar.noderiv.SimplexOptimizer/BBC-F0-opt-90/tests/1/org/apache/commons/math3/optim/nonlinear/scalar/noderiv/SimplexOptimizer_ESTest.java | 97d01f6d8f2212cddcc8fbcde3dd5a94b52dda6b | [
"CC-BY-4.0",
"MIT"
] | permissive | pderakhshanfar/EMSE-BBC-experiment | f60ac5f7664dd9a85f755a00a57ec12c7551e8c6 | fea1a92c2e7ba7080b8529e2052259c9b697bbda | refs/heads/main | 2022-11-25T00:39:58.983828 | 2022-04-12T16:04:26 | 2022-04-12T16:04:26 | 309,335,889 | 0 | 1 | null | 2021-11-05T11:18:43 | 2020-11-02T10:30:38 | null | UTF-8 | Java | false | false | 12,179 | java | /*
* This file was automatically generated by EvoSuite
* Tue Oct 19 19:08:52 GMT 2021
*/
package org.apache.commons.math3.optim.nonlinear.scalar.noderiv;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.evosuite.runtime.EvoAssertions.*;
import org.apache.commons.math3.exception.MathUnsupportedOperationException;
import org.apache.commons.math3.optim.InitialGuess;
import org.apache.commons.math3.optim.OptimizationData;
import org.apache.commons.math3.optim.SimpleBounds;
import org.apache.commons.math3.optim.SimpleValueChecker;
import org.apache.commons.math3.optim.nonlinear.scalar.noderiv.MultiDirectionalSimplex;
import org.apache.commons.math3.optim.nonlinear.scalar.noderiv.NelderMeadSimplex;
import org.apache.commons.math3.optim.nonlinear.scalar.noderiv.SimplexOptimizer;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.junit.runner.RunWith;
@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true)
public class SimplexOptimizer_ESTest extends SimplexOptimizer_ESTest_scaffolding {
@Test(timeout = 4000)
public void test00() throws Throwable {
SimplexOptimizer simplexOptimizer0 = new SimplexOptimizer(2261.792, 2261.792);
OptimizationData[] optimizationDataArray0 = new OptimizationData[3];
SimpleBounds simpleBounds0 = SimpleBounds.unbounded(118);
optimizationDataArray0[0] = (OptimizationData) simpleBounds0;
double[] doubleArray0 = new double[2];
InitialGuess initialGuess0 = new InitialGuess(doubleArray0);
optimizationDataArray0[1] = (OptimizationData) initialGuess0;
// Undeclared exception!
try {
simplexOptimizer0.parseOptimizationData(optimizationDataArray0);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// 118 != 2
//
verifyException("org.apache.commons.math3.optim.BaseMultivariateOptimizer", e);
}
}
@Test(timeout = 4000)
public void test01() throws Throwable {
SimplexOptimizer simplexOptimizer0 = new SimplexOptimizer(455.2708366424296, 0.0);
// Undeclared exception!
try {
simplexOptimizer0.parseOptimizationData((OptimizationData[]) null);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.apache.commons.math3.optim.BaseOptimizer", e);
}
}
@Test(timeout = 4000)
public void test02() throws Throwable {
SimplexOptimizer simplexOptimizer0 = new SimplexOptimizer((-33.545227063992236), (-33.545227063992236));
OptimizationData[] optimizationDataArray0 = new OptimizationData[4];
MultiDirectionalSimplex multiDirectionalSimplex0 = new MultiDirectionalSimplex(28, 0.49999999999999994, 1161.159888, 28);
optimizationDataArray0[0] = (OptimizationData) multiDirectionalSimplex0;
double[] doubleArray0 = new double[9];
InitialGuess initialGuess0 = new InitialGuess(doubleArray0);
optimizationDataArray0[2] = (OptimizationData) initialGuess0;
// Undeclared exception!
try {
simplexOptimizer0.optimize(optimizationDataArray0);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// 28 != 9
//
verifyException("org.apache.commons.math3.optim.nonlinear.scalar.noderiv.AbstractSimplex", e);
}
}
@Test(timeout = 4000)
public void test03() throws Throwable {
SimplexOptimizer simplexOptimizer0 = new SimplexOptimizer(0.0, 1222.34141);
// Undeclared exception!
try {
simplexOptimizer0.optimize((OptimizationData[]) null);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.apache.commons.math3.optim.BaseOptimizer", e);
}
}
@Test(timeout = 4000)
public void test04() throws Throwable {
SimpleValueChecker simpleValueChecker0 = new SimpleValueChecker(3.6725170580355583E-9, 3.6725170580355583E-9);
SimplexOptimizer simplexOptimizer0 = new SimplexOptimizer(simpleValueChecker0);
OptimizationData[] optimizationDataArray0 = new OptimizationData[5];
double[] doubleArray0 = new double[1];
doubleArray0[0] = 3.6725170580355583E-9;
MultiDirectionalSimplex multiDirectionalSimplex0 = new MultiDirectionalSimplex(doubleArray0, 3.6725170580355583E-9, 0.0);
optimizationDataArray0[0] = (OptimizationData) multiDirectionalSimplex0;
InitialGuess initialGuess0 = new InitialGuess(doubleArray0);
optimizationDataArray0[1] = (OptimizationData) initialGuess0;
simplexOptimizer0.parseOptimizationData(optimizationDataArray0);
// Undeclared exception!
try {
simplexOptimizer0.doOptimize();
fail("Expecting exception: IllegalStateException");
} catch(IllegalStateException e) {
//
// illegal state: maximal count (0) exceeded: evaluations
//
verifyException("org.apache.commons.math3.optim.BaseOptimizer$MaxEvalCallback", e);
}
}
@Test(timeout = 4000)
public void test05() throws Throwable {
SimplexOptimizer simplexOptimizer0 = new SimplexOptimizer(1534.1307284083, 1534.1307284083);
OptimizationData[] optimizationDataArray0 = new OptimizationData[2];
double[] doubleArray0 = new double[9];
doubleArray0[0] = 1534.1307284083;
doubleArray0[1] = 1534.1307284083;
doubleArray0[2] = 1534.1307284083;
doubleArray0[3] = 1534.1307284083;
doubleArray0[4] = 1534.1307284083;
doubleArray0[5] = (-3409.8885926866);
doubleArray0[6] = 1534.1307284083;
doubleArray0[7] = 1.0;
doubleArray0[8] = 1534.1307284083;
OptimizationData[] optimizationDataArray1 = new OptimizationData[1];
SimpleBounds simpleBounds0 = new SimpleBounds(doubleArray0, doubleArray0);
optimizationDataArray1[0] = (OptimizationData) simpleBounds0;
simplexOptimizer0.parseOptimizationData(optimizationDataArray1);
NelderMeadSimplex nelderMeadSimplex0 = new NelderMeadSimplex(doubleArray0, 594.004335113681, (-1.0), 9.223372036854776E18, (-3409.8885926866));
optimizationDataArray0[0] = (OptimizationData) nelderMeadSimplex0;
simplexOptimizer0.parseOptimizationData(optimizationDataArray0);
// Undeclared exception!
try {
simplexOptimizer0.doOptimize();
fail("Expecting exception: MathUnsupportedOperationException");
} catch(MathUnsupportedOperationException e) {
//
// constraint
//
verifyException("org.apache.commons.math3.optim.nonlinear.scalar.noderiv.SimplexOptimizer", e);
}
}
@Test(timeout = 4000)
public void test06() throws Throwable {
NelderMeadSimplex nelderMeadSimplex0 = new NelderMeadSimplex(7, (-25.117));
SimplexOptimizer simplexOptimizer0 = new SimplexOptimizer((-25.117), 7);
OptimizationData[] optimizationDataArray0 = new OptimizationData[4];
optimizationDataArray0[0] = (OptimizationData) nelderMeadSimplex0;
double[] doubleArray0 = new double[5];
InitialGuess initialGuess0 = new InitialGuess(doubleArray0);
optimizationDataArray0[2] = (OptimizationData) initialGuess0;
simplexOptimizer0.parseOptimizationData(optimizationDataArray0);
// Undeclared exception!
try {
simplexOptimizer0.doOptimize();
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// 7 != 5
//
verifyException("org.apache.commons.math3.optim.nonlinear.scalar.noderiv.AbstractSimplex", e);
}
}
@Test(timeout = 4000)
public void test07() throws Throwable {
SimplexOptimizer simplexOptimizer0 = new SimplexOptimizer(0.0, 0.0);
// Undeclared exception!
try {
simplexOptimizer0.doOptimize();
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// null is not allowed
//
verifyException("org.apache.commons.math3.optim.nonlinear.scalar.noderiv.SimplexOptimizer", e);
}
}
@Test(timeout = 4000)
public void test08() throws Throwable {
NelderMeadSimplex nelderMeadSimplex0 = new NelderMeadSimplex(2);
SimplexOptimizer simplexOptimizer0 = new SimplexOptimizer((-2525.862743), (-568.304911504));
OptimizationData[] optimizationDataArray0 = new OptimizationData[6];
optimizationDataArray0[0] = (OptimizationData) nelderMeadSimplex0;
SimpleBounds simpleBounds0 = SimpleBounds.unbounded(2);
optimizationDataArray0[5] = (OptimizationData) simpleBounds0;
// Undeclared exception!
try {
simplexOptimizer0.optimize(optimizationDataArray0);
fail("Expecting exception: MathUnsupportedOperationException");
} catch(MathUnsupportedOperationException e) {
//
// constraint
//
verifyException("org.apache.commons.math3.optim.nonlinear.scalar.noderiv.SimplexOptimizer", e);
}
}
@Test(timeout = 4000)
public void test09() throws Throwable {
SimpleValueChecker simpleValueChecker0 = new SimpleValueChecker(3.6725170580355583E-9, 3.6725170580355583E-9);
SimplexOptimizer simplexOptimizer0 = new SimplexOptimizer(simpleValueChecker0);
OptimizationData[] optimizationDataArray0 = new OptimizationData[5];
double[] doubleArray0 = new double[1];
doubleArray0[0] = 3.6725170580355583E-9;
MultiDirectionalSimplex multiDirectionalSimplex0 = new MultiDirectionalSimplex(doubleArray0, 3.6725170580355583E-9, 0.0);
optimizationDataArray0[0] = (OptimizationData) multiDirectionalSimplex0;
InitialGuess initialGuess0 = new InitialGuess(doubleArray0);
optimizationDataArray0[1] = (OptimizationData) initialGuess0;
// Undeclared exception!
try {
simplexOptimizer0.optimize(optimizationDataArray0);
fail("Expecting exception: IllegalStateException");
} catch(IllegalStateException e) {
//
// illegal state: maximal count (0) exceeded: evaluations
//
verifyException("org.apache.commons.math3.optim.BaseOptimizer$MaxEvalCallback", e);
}
}
@Test(timeout = 4000)
public void test10() throws Throwable {
NelderMeadSimplex nelderMeadSimplex0 = new NelderMeadSimplex(7, (-25.117));
SimplexOptimizer simplexOptimizer0 = new SimplexOptimizer((-25.117), 7);
OptimizationData[] optimizationDataArray0 = new OptimizationData[4];
optimizationDataArray0[0] = (OptimizationData) nelderMeadSimplex0;
simplexOptimizer0.parseOptimizationData(optimizationDataArray0);
// Undeclared exception!
try {
simplexOptimizer0.doOptimize();
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.apache.commons.math3.optim.nonlinear.scalar.noderiv.AbstractSimplex", e);
}
}
@Test(timeout = 4000)
public void test11() throws Throwable {
SimplexOptimizer simplexOptimizer0 = new SimplexOptimizer((-33.545227063992236), (-33.545227063992236));
OptimizationData[] optimizationDataArray0 = new OptimizationData[4];
// Undeclared exception!
try {
simplexOptimizer0.optimize(optimizationDataArray0);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// null is not allowed
//
verifyException("org.apache.commons.math3.optim.nonlinear.scalar.noderiv.SimplexOptimizer", e);
}
}
}
| [
"pderakhshanfar@serg2.ewi.tudelft.nl"
] | pderakhshanfar@serg2.ewi.tudelft.nl |
fbd5b058683efa694c2701a6e5b62228be195dd1 | 82504ed8fabb2732fff4d9c4420f648ef68269c8 | /app/src/main/java/com/example/toshimishra/photolearn/TrainerAddQuizItem.java | 6af14fc02531d0b5aa20213d15d46c68c46c4318 | [] | no_license | SharanyaMenon/project-master | e597e5726f7d19714a80c03123ac1d4437c83a9a | badc15c22a0af904276e7d01b909b600d901073e | refs/heads/master | 2021-04-06T01:52:22.928445 | 2018-03-16T12:12:45 | 2018-03-16T12:12:45 | 125,342,674 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,350 | java | package com.example.toshimishra.photolearn;
import android.app.ProgressDialog;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RadioButton;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.storage.FirebaseStorage;
import com.google.firebase.storage.OnProgressListener;
import com.google.firebase.storage.StorageReference;
import com.google.firebase.storage.UploadTask;
import com.squareup.picasso.Picasso;
/**
* Created by SUGANTHI on 16-03-2018.
*/
public class TrainerAddQuizItem extends AppCompatActivity {
TextView text_ls,text_q;
Button button;
EditText et_question,et_opt1,et_opt2,et_opt3,et_opt4,ansExp;
RadioButton rb_ans1,rb_ans2,rb_ans3,rb_ans4;
private static final int SELECT_PHOTO = 100;
Uri selectedImage;
FirebaseStorage storage;
StorageReference storageRef, imageRef;
ProgressDialog progressDialog;
UploadTask uploadTask;
ImageView imageView;
String url ;
int ans;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_trainer_add_quizitem);
storage = FirebaseStorage.getInstance();
storageRef = storage.getReference();
text_ls = (TextView)findViewById(R.id.title_LS);
text_q = (TextView)findViewById(R.id.title_Q);
text_ls.setText(State.getCurrentSession().getCourseCode());
text_q.setText(State.getCurrentQuizTitle().getTitle());
et_question = (EditText)findViewById(R.id.xh_txt); //question
et_opt1 = (EditText)findViewById(R.id.Opt1); //option1
et_opt2 = (EditText)findViewById(R.id.Opt2); //option2
et_opt3 = (EditText)findViewById(R.id.Opt3); //option3
et_opt4 = (EditText)findViewById(R.id.Opt4); //option4
rb_ans1 = (RadioButton)findViewById(R.id.radioButton3);
rb_ans2 = (RadioButton)findViewById(R.id.radioButton4);
rb_ans3 = (RadioButton)findViewById(R.id.radioButton5);
rb_ans4 = (RadioButton)findViewById(R.id.radioButton6);
ansExp = (EditText)findViewById(R.id.Exp);
button = (Button)findViewById(R.id.bt_Add);
rb_ans1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ans = 1 ;
}
});
rb_ans2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ans = 2;
}
});
rb_ans3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ans = 3 ;
}
});
rb_ans4.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ans = 4 ;
}
});
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String ques = et_question.getText().toString();
String opt1 = et_opt1.getText().toString();
String opt2 = et_opt2.getText().toString();
String opt3 = et_opt3.getText().toString();
String opt4 = et_opt4.getText().toString();
String answerExp = ansExp.getText().toString();
new Trainer().createQuizItem(url,ques,opt1,opt2,opt3,opt4,ans,answerExp);
finish();
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent imageReturnedIntent) {
super.onActivityResult(requestCode, resultCode, imageReturnedIntent);
switch (requestCode) {
case SELECT_PHOTO:
if (resultCode == RESULT_OK) {
Toast.makeText(TrainerAddQuizItem.this, "Image selected, click on upload button", Toast.LENGTH_SHORT).show();
selectedImage = imageReturnedIntent.getData();
imageView = (ImageView) findViewById(R.id.img);
imageView.setImageURI(selectedImage);
}
}
}
public void selectImage(View view) {
Intent photoPickerIntent = new Intent(Intent.ACTION_PICK);
photoPickerIntent.setType("image/*");
startActivityForResult(photoPickerIntent, SELECT_PHOTO);
}
public void uploadImage(View view) {
//create reference to images folder and assing a name to the file that will be uploaded
imageRef = storageRef.child("images/" + selectedImage.getLastPathSegment());
//creating and showing progress dialog
progressDialog = new ProgressDialog(this);
progressDialog.setMax(100);
progressDialog.setMessage("Uploading...");
progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
progressDialog.show();
progressDialog.setCancelable(false);
//starting upload
uploadTask = imageRef.putFile(selectedImage);
// Observe state change events such as progress, pause, and resume
uploadTask.addOnProgressListener(new OnProgressListener<UploadTask.TaskSnapshot>() {
@Override
public void onProgress(UploadTask.TaskSnapshot taskSnapshot) {
double progress = (100.0 * taskSnapshot.getBytesTransferred()) / taskSnapshot.getTotalByteCount();
//sets and increments value of progressbar
progressDialog.incrementProgressBy((int) progress);
}
});
// Register observers to listen for when the download is done or if it fails
uploadTask.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception exception) {
// Handle unsuccessful uploads
Toast.makeText(TrainerAddQuizItem.this, "Error in uploading!", Toast.LENGTH_SHORT).show();
progressDialog.dismiss();
}
}).addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
@Override
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
// taskSnapshot.getMetadata() contains file metadata such as size, content-type, and download URL.
Uri downloadUrl = taskSnapshot.getDownloadUrl();
url = downloadUrl.toString();
Log.i("downloadURL", "download:" + downloadUrl);
Toast.makeText(TrainerAddQuizItem.this, "Upload successful", Toast.LENGTH_SHORT).show();
progressDialog.dismiss();
//showing the uploaded image in ImageView using the download url
Log.i("ImageView", "image:" + imageView);
Picasso.with(TrainerAddQuizItem.this).load(downloadUrl).into(imageView);
}
});
}
}
| [
"sugikushal@gmail.com"
] | sugikushal@gmail.com |
1845aa7a82e06018d110034aae28bb887a7a50a4 | e192426b4999eaaa5422213b7c53e36c313c4e55 | /src/test/java/controllers/ApplicationControllerFluentLeniumTest.java | 6186ef53c736e7cd70f1171485295305e6054562 | [] | no_license | mksjs/lms | 7fb2c9c93856476d7ff36d9bb26fea90b55e4fa7 | 11c95b974e6f7033709aef5a2edddcc7c08bafd8 | refs/heads/master | 2022-07-08T03:29:21.493682 | 2020-03-15T17:36:21 | 2020-03-15T17:36:21 | 236,912,720 | 1 | 0 | null | 2022-06-21T02:42:41 | 2020-01-29T05:46:54 | Java | UTF-8 | Java | false | false | 1,180 | java | /**
* Copyright (C) 2012-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package controllers;
import static org.junit.Assert.assertTrue;
import ninja.NinjaFluentLeniumTest;
import org.junit.Before;
import org.junit.Test;
public class ApplicationControllerFluentLeniumTest extends NinjaFluentLeniumTest {
@Test
public void testThatHomepageWorks() {
goTo("/");
System.out.println("title: " + window().title());
assertTrue(window().title().contains("Home page"));
$("#login").click();
assertTrue(url().contains("login"));
}
}
| [
"mksjs1998@gmail.com"
] | mksjs1998@gmail.com |
06c47c5571f84334f7898f55ce534597ef9ce899 | 899ffb948407321ec358a3d9c2d99038b54f0bc5 | /lipang-li_chung-yang_001270144-0b29d9b83aeb/finalProject/src/UserInterface/CustodianEnterprise/TradingManagerWorkAreaJPanel.java | ad30bd0c1d5bf10af26c7c687f8ae534db99cae4 | [] | no_license | t0912398031/INFO-5100 | 78932a82973303851059ac24e4d1fd9d6262e320 | f4106c3ac354fe7c64c9e0a88cd8fcc934caea31 | refs/heads/master | 2020-03-21T02:01:53.928611 | 2018-06-20T04:17:42 | 2018-06-20T04:17:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,285 | 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 UserInterface.CustodianEnterprise;
import UserInterface.AdminRole.*;
import Business.EcoSystem;
import Business.Enterprise.CustodyEnterprise;
import Business.Enterprise.Enterprise;
import Business.Organization.AccountingOrg;
import Business.Organization.AdminOrg;
import Business.Organization.Organization;
import Business.Organization.TradingOrg;
import Business.UserAccount.UserAccount;
import UserInterface.ShortMessage.ShortMessageJPanel;
import java.awt.CardLayout;
import javax.swing.JPanel;
/**
*
* @author Chung-Yang Li
*/
public class TradingManagerWorkAreaJPanel extends javax.swing.JPanel {
/**
* Creates new form AccountingWorkAreaJPanel
*/
private JPanel upc;
private TradingOrg organization;
private UserAccount account;
private Enterprise enterprise;
private EcoSystem ecoSystem;
public TradingManagerWorkAreaJPanel(JPanel upc, UserAccount account, TradingOrg organization, Enterprise enterprise, EcoSystem ecoSystem) {
initComponents();
this.upc = upc;
this.account = account;
this.organization = organization;
this.enterprise = enterprise;
this.ecoSystem = ecoSystem;
setBackground(new java.awt.Color(255, 255, 153));
}
/**
* 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() {
jLabel4 = new javax.swing.JLabel();
btnManageOrg = new javax.swing.JButton();
InMail = new javax.swing.JButton();
InMail1 = new javax.swing.JButton();
lbl_show_thephoto = new javax.swing.JLabel();
jLabel4.setFont(new java.awt.Font("新細明體", 0, 24)); // NOI18N
jLabel4.setText("Trading Manager Work Area");
btnManageOrg.setText("Trading");
btnManageOrg.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnManageOrgActionPerformed(evt);
}
});
InMail.setText("InMail");
InMail.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
InMailActionPerformed(evt);
}
});
InMail1.setText("Manage Rate");
InMail1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
InMail1ActionPerformed(evt);
}
});
lbl_show_thephoto.setBackground(new java.awt.Color(255, 255, 204));
lbl_show_thephoto.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/manager.png"))); // NOI18N
lbl_show_thephoto.setOpaque(true);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, 639, Short.MAX_VALUE)
.addContainerGap())
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(btnManageOrg, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(InMail, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(InMail1, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lbl_show_thephoto)
.addGap(71, 71, 71))))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(btnManageOrg)
.addGap(18, 18, 18)
.addComponent(InMail)
.addGap(18, 18, 18)
.addComponent(InMail1))
.addComponent(lbl_show_thephoto, javax.swing.GroupLayout.PREFERRED_SIZE, 240, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(288, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
private void btnManageOrgActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnManageOrgActionPerformed
TradingJPanel mojp = new TradingJPanel(upc, account,organization,enterprise, ecoSystem);
upc.add("TradingJPanel", mojp);
CardLayout cardLayout = (CardLayout) upc.getLayout();
cardLayout.next(upc);// TODO add your handling code here:
}//GEN-LAST:event_btnManageOrgActionPerformed
private void InMailActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_InMailActionPerformed
ShortMessageJPanel smjp = new ShortMessageJPanel(upc, account, ecoSystem);
upc.add("ShortMessageJPanel_SysAdmin", smjp);
CardLayout layout = (CardLayout) upc.getLayout();
layout.next(upc);
}//GEN-LAST:event_InMailActionPerformed
private void InMail1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_InMail1ActionPerformed
CustodyEnterprise ce = (CustodyEnterprise)enterprise;
ManageRateJPanel smjp = new ManageRateJPanel(upc, ce, ecoSystem);
upc.add("ManageRateJPanel", smjp);
CardLayout layout = (CardLayout) upc.getLayout();
layout.next(upc);// TODO add your handling code here:
}//GEN-LAST:event_InMail1ActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton InMail;
private javax.swing.JButton InMail1;
private javax.swing.JButton btnManageOrg;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel lbl_show_thephoto;
// End of variables declaration//GEN-END:variables
}
| [
"you@example.com"
] | you@example.com |
18cc0d4a7f016527e687f9af20b595532a4be0f3 | 065c1f648e8dd061a20147ff9c0dbb6b5bc8b9be | /eclipsejdt_cluster/68637/tar_1.java | 3d6a8d338518bd19e5797e6120b325a00638efb7 | [] | no_license | martinezmatias/GenPat-data-C3 | 63cfe27efee2946831139747e6c20cf952f1d6f6 | b360265a6aa3bb21bd1d64f1fc43c3b37d0da2a4 | refs/heads/master | 2022-04-25T17:59:03.905613 | 2020-04-15T14:41:34 | 2020-04-15T14:41:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,076 | java | /*******************************************************************************
* Copyright (c) 2000, 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jdt.core.dom;
import java.util.List;
/**
* Instanceof expression AST node type.
* <pre>
* InstanceofExpression:
* Expression <b>instanceof</b> Type
* </pre>
*
* @since 2.0
*/
public class InstanceofExpression extends Expression {
/**
* The "leftOperand" structural property of this node type.
* @since 3.0
*/
public static final ChildPropertyDescriptor LEFT_OPERAND_PROPERTY =
new ChildPropertyDescriptor(InstanceofExpression.class, "leftOperand", Expression.class, MANDATORY, CYCLE_RISK); //$NON-NLS-1$
/**
* The "rightOperand" structural property of this node type.
* @since 3.0
*/
public static final ChildPropertyDescriptor RIGHT_OPERAND_PROPERTY =
new ChildPropertyDescriptor(InstanceofExpression.class, "rightOperand", Type.class, MANDATORY, CYCLE_RISK); //$NON-NLS-1$
/**
* A list of property descriptors (element type:
* {@link StructuralPropertyDescriptor}),
* or null if uninitialized.
*/
private static final List PROPERTY_DESCRIPTORS;
static {
createPropertyList(InstanceofExpression.class);
addProperty(LEFT_OPERAND_PROPERTY);
addProperty(RIGHT_OPERAND_PROPERTY);
PROPERTY_DESCRIPTORS = reapPropertyList();
}
/**
* Returns a list of structural property descriptors for this node type.
* Clients must not modify the result.
*
* @param apiLevel the API level; one of the
* <code>AST.LEVEL_*</code>LEVEL
* @return a list of property descriptors (element type:
* {@link StructuralPropertyDescriptor})
* @since 3.0
*/
public static List propertyDescriptors(int apiLevel) {
return PROPERTY_DESCRIPTORS;
}
/**
* The left operand; lazily initialized; defaults to an unspecified,
* but legal, simple name.
*/
private Expression leftOperand = null;
/**
* The right operand; lazily initialized; defaults to an unspecified,
* but legal, simple type.
*/
private Type rightOperand = null;
/**
* Creates a new AST node for an instanceof expression owned by the given
* AST. By default, the node has unspecified (but legal) operator,
* left and right operands.
*
* @param ast the AST that is to own this node
*/
InstanceofExpression(AST ast) {
super(ast);
}
/* (omit javadoc for this method)
* Method declared on ASTNode.
*/
final List internalStructuralPropertiesForType(int apiLevel) {
return propertyDescriptors(apiLevel);
}
/* (omit javadoc for this method)
* Method declared on ASTNode.
*/
final ASTNode internalGetSetChildProperty(ChildPropertyDescriptor property, boolean get, ASTNode child) {
if (property == LEFT_OPERAND_PROPERTY) {
if (get) {
return getLeftOperand();
} else {
setLeftOperand((Expression) child);
return null;
}
}
if (property == RIGHT_OPERAND_PROPERTY) {
if (get) {
return getRightOperand();
} else {
setRightOperand((Type) child);
return null;
}
}
// allow default implementation to flag the error
return super.internalGetSetChildProperty(property, get, child);
}
/* (omit javadoc for this method)
* Method declared on ASTNode.
*/
public int getNodeType() {
return INSTANCEOF_EXPRESSION;
}
/* (omit javadoc for this method)
* Method declared on ASTNode.
*/
ASTNode clone0(AST target) {
InstanceofExpression result = new InstanceofExpression(target);
result.setSourceRange(this.getStartPosition(), this.getLength());
result.setLeftOperand((Expression) getLeftOperand().clone(target));
result.setRightOperand((Type) getRightOperand().clone(target));
return result;
}
/* (omit javadoc for this method)
* Method declared on ASTNode.
*/
public boolean subtreeMatch(ASTMatcher matcher, Object other) {
// dispatch to correct overloaded match method
return matcher.match(this, other);
}
/* (omit javadoc for this method)
* Method declared on ASTNode.
*/
void accept0(ASTVisitor visitor) {
boolean visitChildren = visitor.visit(this);
if (visitChildren) {
// visit children in normal left to right reading order
acceptChild(visitor, getLeftOperand());
acceptChild(visitor, getRightOperand());
}
visitor.endVisit(this);
}
/**
* Returns the left operand of this instanceof expression.
*
* @return the left operand node
*/
public Expression getLeftOperand() {
if (this.leftOperand == null) {
preLazyInit();
this.leftOperand= new SimpleName(this.ast);
postLazyInit(this.leftOperand, LEFT_OPERAND_PROPERTY);
}
return this.leftOperand;
}
/**
* Sets the left operand of this instanceof expression.
*
* @param expression the left operand node
* @exception IllegalArgumentException if:
* <ul>
* <li>the node belongs to a different AST</li>
* <li>the node already has a parent</li>
* <li>a cycle in would be created</li>
* </ul>
*/
public void setLeftOperand(Expression expression) {
if (expression == null) {
throw new IllegalArgumentException();
}
ASTNode oldChild = this.leftOperand;
preReplaceChild(oldChild, expression, LEFT_OPERAND_PROPERTY);
this.leftOperand = expression;
postReplaceChild(oldChild, expression, LEFT_OPERAND_PROPERTY);
}
/**
* Returns the right operand of this instanceof expression.
*
* @return the right operand node
*/
public Type getRightOperand() {
if (this.rightOperand == null) {
preLazyInit();
this.rightOperand= new SimpleType(this.ast);
postLazyInit(this.rightOperand, RIGHT_OPERAND_PROPERTY);
}
return this.rightOperand;
}
/**
* Sets the right operand of this instanceof expression.
*
* @param referenceType the right operand node
* @exception IllegalArgumentException if:
* <ul>
* <li>the node belongs to a different AST</li>
* <li>the node already has a parent</li>
* <li>a cycle in would be created</li>
* </ul>
*/
public void setRightOperand(Type referenceType) {
if (referenceType == null) {
throw new IllegalArgumentException();
}
ASTNode oldChild = this.rightOperand;
preReplaceChild(oldChild, referenceType, RIGHT_OPERAND_PROPERTY);
this.rightOperand = referenceType;
postReplaceChild(oldChild, referenceType, RIGHT_OPERAND_PROPERTY);
}
/* (omit javadoc for this method)
* Method declared on ASTNode.
*/
int memSize() {
// treat Operator as free
return BASE_NODE_SIZE + 2 * 4;
}
/* (omit javadoc for this method)
* Method declared on ASTNode.
*/
int treeSize() {
return
memSize()
+ (this.leftOperand == null ? 0 : getLeftOperand().treeSize())
+ (this.rightOperand == null ? 0 : getRightOperand().treeSize());
}
}
| [
"375833274@qq.com"
] | 375833274@qq.com |
f3a0126cab812314b440aea9e47f3fb474d9a8f5 | 758bb1f3b67bf280b4e50d955e68fa5495f98394 | /app/src/main/java/de/dieter/midgard/MidChar/Gottheit.java | 95abca33e6f50175f6a036f3ad7c5a82e2876abd | [] | no_license | GilDuath/Chalpeca | a921009a6db5983f74682cbcf867a9a6be7fa76b | 2d03620144c28012e1b14f2b18b3bb78c91fcb57 | refs/heads/master | 2021-01-16T21:27:01.349435 | 2016-06-21T03:59:20 | 2016-06-21T03:59:20 | 61,600,941 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,520 | java | package de.dieter.midgard.MidChar;
import android.content.Context;
/**
* Project: Chalpeca
* Package: de.dieter.midgard.MidChar
* <p/>
* Created by Dieter on 05.06.2016.
*/
public class Gottheit {
private String name;
private String beschreibung;
private String pantheon;
private String aspekt;
private String symbol;
private String farbe;
private String tier;
private Context context;
public Gottheit(Context context) {
this.context = context;
}
public String getTier() {
return tier;
}
public void setTier(String tier) {
this.tier = tier;
}
public String getBeschreibung() {
return beschreibung;
}
public void setBeschreibung(String beschreibung) {
this.beschreibung = beschreibung;
}
public String getPantheon() {
return pantheon;
}
public void setPantheon(String pantheon) {
this.pantheon = pantheon;
}
public String getAspekt() {
return aspekt;
}
public void setAspekt(String aspekt) {
this.aspekt = aspekt;
}
public String getSymbol() {
return symbol;
}
public void setSymbol(String symbol) {
this.symbol = symbol;
}
public String getFarbe() {
return farbe;
}
public void setFarbe(String farbe) {
this.farbe = farbe;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
| [
"GilDuath@Culsu.De"
] | GilDuath@Culsu.De |
511754e90a4fb1a48f67cba1b01942d052df91cd | 1a115fc134ec8e690caf653300e1aa2fbcec441e | /src/main/java/com/capstone/recipestashapi/security/oauth2/user/OAuth2UserInfo.java | 38baac635fe4c6781e20b69ec5730c4496aa6349 | [] | no_license | jasyl/recipe-stash-api | 410db5fb853c421ffc4e059db387d15808b19916 | 45fb55a94f45e2ff989cc7fe9ee30eedf93cb3a5 | refs/heads/master | 2023-03-04T08:11:17.131833 | 2021-02-19T20:23:15 | 2021-02-19T20:23:15 | 333,558,774 | 0 | 0 | null | 2021-02-08T20:46:28 | 2021-01-27T21:00:43 | Java | UTF-8 | Java | false | false | 515 | java | package com.capstone.recipestashapi.security.oauth2.user;
import java.util.Map;
public abstract class OAuth2UserInfo {
protected Map<String, Object> attributes;
public OAuth2UserInfo(Map<String, Object> attributes) {
this.attributes = attributes;
}
public Map<String, Object> getAttributes() {
return attributes;
}
public abstract String getId();
public abstract String getName();
public abstract String getEmail();
public abstract String getImageUrl();
}
| [
"jasylop@gmail.com"
] | jasylop@gmail.com |
5711c4469ac38c186ae9a3bd0967b77cfb972954 | 4fcf6310f9f946faaa13d8d3167055d84ac9af2e | /src/controllers/LoginAndRegistrationWindowController.java | 98f141647a2e4cea2508807f244cb55bb6447f50 | [] | no_license | DvDs20/4-praktinis-IS | 22ddf66053b351349ae7f7892f6f7a3757b550fe | a0b5265dc0d44d90a96300d0dcd3829264fc31c0 | refs/heads/master | 2023-05-11T03:53:58.401775 | 2021-05-30T22:52:23 | 2021-05-30T22:52:23 | 369,768,734 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,232 | java | package controllers;
import backEnd.UserRepository;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.PasswordField;
import javafx.scene.control.TextField;
import javafx.scene.layout.Pane;
import javafx.stage.Stage;
import models.User;
import security.EncryptDecryptFile;
import javax.swing.*;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
public class LoginAndRegistrationWindowController {
@FXML
private Pane loginPane;
@FXML
private TextField usernameTextField;
@FXML
private PasswordField passwordField;
@FXML
private Button signInButton;
@FXML
private Button signUpButton;
@FXML
private Pane registrationPane;
@FXML
private TextField usernameForRegistrationTextField;
@FXML
private PasswordField passwordForRegistrationField;
@FXML
private PasswordField confirmPasswordField;
@FXML
private Button backToSignInPaneButton;
@FXML
private Button confirmRegistrationButton;
UserRepository userRepository = new UserRepository();
public void signInButtonClicked(ActionEvent actionEvent) throws IOException {
signInButton.getScene().getWindow().hide();
try {
User user = userRepository.login(usernameTextField.getText(), passwordField.getText());
if (user != null) {
userRepository.setUser(user);
EncryptDecryptFile.decryptFile("C:\\Users\\deivi\\Documents\\Informacijos saugumas\\4 praktinis darbas\\UsersFiles\\" + user.getUsername() + ".txt");
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("../frontEnd/mainWindow.fxml"));
Parent parent = fxmlLoader.load();
Stage stage = new Stage();
stage.setTitle(user.getUsername());
stage.setScene(new Scene(parent));
stage.setResizable(false);
stage.show();
}
else {
throw new Exception("user = null");
}
}
catch (Exception exception) {
JOptionPane.showMessageDialog(null, exception.getMessage());
Parent parent = FXMLLoader.load(getClass().getResource("../frontEnd/login&RegistrationWindow.fxml"));
Stage stage = new Stage();
stage.setTitle("Sign in | Sign up");
stage.setScene(new Scene(parent));
stage.show();
}
}
public void signUpButtonClicked(ActionEvent actionEvent) {
loginPane.setVisible(!loginPane.isVisible());
registrationPane.setVisible(!registrationPane.isVisible());
}
public void backToSignInPaneButtonClicked(ActionEvent actionEvent) {
registrationPane.setVisible(!registrationPane.isVisible());
loginPane.setVisible(!loginPane.isVisible());
}
public void confirmRegistrationButtonClicked(ActionEvent actionEvent) {
try {
userRepository.register(usernameForRegistrationTextField.getText(), passwordForRegistrationField.getText(), confirmPasswordField.getText());
Path path = Paths.get("C:\\Users\\deivi\\Documents\\Informacijos saugumas\\4 praktinis darbas\\UsersFiles\\" + usernameForRegistrationTextField.getText() + ".txt");
try {
Path filePath = Files.createFile(path);
System.out.println("File created at path: " + filePath);
}
catch (IOException ioException) {
ioException.printStackTrace();
}
EncryptDecryptFile.encryptFile(String.valueOf(path));
JOptionPane.showMessageDialog(null, "Registration successful!");
registrationPane.setVisible(!registrationPane.isVisible());
loginPane.setVisible(!loginPane.isVisible());
}
catch (Exception exception) {
JOptionPane.showMessageDialog(null, exception.getMessage());
}
}
}
| [
"kvietkauskasdeividas@gmail.com"
] | kvietkauskasdeividas@gmail.com |
d929c11f502e1b32732d4ea95877cfc37a5c496e | af65a99bb8b338dd0b6bebfac37a8354c850a2b9 | /urule-console/src/main/java/com/bstek/urule/console/repository/database/BaseDbFileSystem.java | f80c5ffd39dc574e03118b41f940f9ce398ab8b8 | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | zsy1988cool/urule | b44a26240ecc01c079faa8fcef5457148c8f092d | 1b7edeef8bb6e9b365b249cb9900fe82cf23ad5d | refs/heads/master | 2022-12-13T02:06:43.660754 | 2019-09-19T03:30:03 | 2019-09-19T03:30:03 | 209,455,334 | 0 | 0 | Apache-2.0 | 2022-12-10T03:12:56 | 2019-09-19T03:33:15 | JavaScript | UTF-8 | Java | false | false | 2,200 | java | /*******************************************************************************
* Copyright 2017 Bstek
*
* 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.bstek.urule.console.repository.database;
import org.apache.jackrabbit.core.fs.FileSystemException;
import org.apache.jackrabbit.core.fs.db.DbFileSystem;
import com.bstek.urule.console.repository.RepositoryBuilder;
/**
* @author Jacky.gao
* @since 2017年12月6日
*/
public abstract class BaseDbFileSystem extends DbFileSystem {
@Override
public void init() throws FileSystemException {
if (initialized) {
throw new IllegalStateException("already initialized");
}
try {
setSchema(databaseType());
conHelper = createConnectionHelper(RepositoryBuilder.datasource);
// make sure schemaObjectPrefix consists of legal name characters only
schemaObjectPrefix = conHelper.prepareDbIdentifier(schemaObjectPrefix);
// check if schema objects exist and create them if necessary
if (isSchemaCheckEnabled()) {
createCheckSchemaOperation().run();
}
// build sql statements
buildSQLStatements();
// finally verify that there's a file system root entry
verifyRootExists();
initialized = true;
} catch (Exception e) {
String msg = "failed to initialize file system";
throw new FileSystemException(msg, e);
}
}
public abstract String databaseType();
}
| [
"zsy1988cool01@gmail.com"
] | zsy1988cool01@gmail.com |
462a49e68294ce376f75be9343142d5c849ee3e8 | 631f2e97d99fec0caed57a63c051e37cad19de43 | /src/main/java/com/hivemq/extension/sdk/api/events/client/parameters/AuthenticationFailedInput.java | 00055602c7ee1c1f1091d270061bf3b1b8f6e87b | [
"Apache-2.0"
] | permissive | yongjhih/hivemq-extension-sdk | 28e394d21b2535137280a4c2d46d472292d65b8e | 65af6066b1cf0fdcc6f055118190ecaf5803ea93 | refs/heads/master | 2020-04-15T04:42:44.005689 | 2019-01-07T07:23:14 | 2019-01-07T07:23:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,089 | java | /*
* Copyright 2018 dc-square GmbH
*
* 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.hivemq.extension.sdk.api.events.client.parameters;
import com.hivemq.extension.sdk.api.events.client.ClientLifecycleEventListener;
import com.hivemq.extension.sdk.api.annotations.DoNotImplement;
/**
* Input object for the method {@link ClientLifecycleEventListener#onAuthenticationFailedDisconnect(AuthenticationFailedInput)}.
*
* @author Christoph Schäbel
* @since 4.0.0
*/
@DoNotImplement
public interface AuthenticationFailedInput extends DisconnectEventInput {
}
| [
"christoph.schaebel@dc-square.de"
] | christoph.schaebel@dc-square.de |
8a8ef2b0e53e20ba5533a1a6fceafdbe4230ebd4 | a405f37d560ed527de6f19dfb7f7eff22a4afd11 | /HibManyToMany/src/com/vaannila/student/Course.java | 670b8dca3e3ec2e3817cc2aa3e9f0301d955bf44 | [] | no_license | rahsharma/hibernateExample | 56714e5b39ec24dbde14faf21e65e1f068242198 | 709702932813c35819e537227f60d6d4191a301e | refs/heads/master | 2021-07-03T13:15:43.808348 | 2017-09-25T05:23:27 | 2017-09-25T05:23:27 | 104,704,450 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 774 | java | package com.vaannila.student;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name="COURSE")
public class Course {
private long courseId;
private String courseName;
public Course() {
}
public Course(String courseName) {
this.courseName = courseName;
}
@Id
@GeneratedValue
@Column(name="COURSE_ID")
public long getCourseId() {
return this.courseId;
}
public void setCourseId(long courseId) {
this.courseId = courseId;
}
@Column(name="COURSE_NAME", nullable=false)
public String getCourseName() {
return this.courseName;
}
public void setCourseName(String courseName) {
this.courseName = courseName;
}
} | [
"rahul.q.sharma@ericsson.com"
] | rahul.q.sharma@ericsson.com |
d9b8fe16fa0dbb9c8d9ee90cf651abf205e687a0 | fc4e0c9d846bddb5768fde39ee07284a668a1e75 | /0013_RomanToInt/Solution.java | bf3c56033c14eb0aebabddfd94f1ffb845b7178e | [] | no_license | chialin-liu/Leetcode | d9f9ce94ac8cc3bdb71145d9fc59d7c2311e4ef7 | bf5ee75fe266353ce574d8aa38973f325b239079 | refs/heads/master | 2020-06-19T09:48:08.036214 | 2020-03-14T09:55:00 | 2020-03-14T09:55:00 | 196,667,938 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 736 | java | class Solution {
public int romanToInt(String s) {
int res = toNumber(s.charAt(0));
for(int i = 1; i < s.length(); i++){
if(toNumber(s.charAt(i)) > toNumber(s.charAt(i - 1))){
res += toNumber(s.charAt(i)) - 2 * toNumber(s.charAt(i - 1));
}
else{
res += toNumber(s.charAt(i));
}
}
return res;
}
public int toNumber(char s){
switch(s){
case 'I': return 1;
case 'V': return 5;
case 'X': return 10;
case 'L': return 50;
case 'C': return 100;
case 'D': return 500;
case 'M': return 1000;
}
return -1;
}
}
| [
"charles.ee96@g2.nctu.edu.tw"
] | charles.ee96@g2.nctu.edu.tw |
e09681f5451e79a890819a7590f93e8635ca28b2 | 6f517a75198f7adcaf3f329a9cab7fbc2aae9c25 | /job_scheduler/src/main/java/controllers/GlobalExceptionHandler.java | c3247f1e73097dee47a37c833fdd6f044eb8c525 | [] | no_license | franollo/job_scheduler | 9cc3481e3b0ab3fcb90438bf0b9476f1349a1dce | 2b4030d9e93c7cf1c9e6ee228e97934130395d40 | refs/heads/master | 2020-04-06T03:34:12.274623 | 2016-09-09T08:03:20 | 2016-09-09T08:03:20 | 49,171,813 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,303 | java | package main.java.controllers;
import main.java.exceptions.ObjectAuthorizationException;
import org.hibernate.exception.ConstraintViolationException;
import org.hibernate.exception.GenericJDBCException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import javax.persistence.PersistenceException;
import javax.servlet.http.HttpServletResponse;
/**
* Global exception handler for all controllers
* @author Marcin Frankowski
*/
@RestControllerAdvice
public class GlobalExceptionHandler {
/**
* Sets HTTP status 400 when exception is caught
* @param response HTTP response
* @param e exception to handle
*/
@ExceptionHandler({GenericJDBCException.class, ConstraintViolationException.class, PersistenceException.class})
public void handleGenericJDBCException(HttpServletResponse response, Exception e) {
response.setStatus(400);
}
/**
* Sets HTTP status 401 when exception is caught
* @param response HTTP response
* @param e exception to handle
*/
@ExceptionHandler(ObjectAuthorizationException.class)
public void handleObjectAuthorizationException(HttpServletResponse response, Exception e) {
response.setStatus(401);
}
}
| [
"marcinfrank1@gmail.com"
] | marcinfrank1@gmail.com |
20276138eb07608988914112999ce0228eec98cd | f7ef4e707ac7f4f263f25144b3a8ca8e529585bc | /4_Arrays_Strings_Memory_SourceControl/src/pkg4_arrays_strings_memory_sourcecontrol/Task3g_LargestSumSubsequence.java | 37f63b54f839ccd1869b59a37dcaa1af7d8383a4 | [] | no_license | kenot/swift | 55bdf89ab8daa1842ff70b5bcf4a3fbbddf6e4c5 | bc5b324c4dbecaa816240c1afa0797fdc1998b73 | refs/heads/master | 2021-01-19T13:36:43.132281 | 2017-03-18T16:05:00 | 2017-03-18T16:05:00 | 82,402,228 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,363 | 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 pkg4_arrays_strings_memory_sourcecontrol;
import java.util.Scanner;
/**
*
* @author tonek
*/
public class Task3g_LargestSumSubsequence {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int numberCount = sc.nextInt();
int[] numbers = new int[numberCount];
numbers[0] = sc.nextInt();
int currentMax = numbers[0];
int globalMax = numbers[0];
int currentStart = 0;
int bestSumIdxStart = 0;
int bestSumIdxEnd = 0;
for(int i = 1; i < numberCount; i++){
numbers[i] = sc.nextInt();
currentMax += numbers[i];
if (currentMax < 0){
currentStart = i + 1;
currentMax = 0;
}
if (globalMax < currentMax) {
globalMax = currentMax;
bestSumIdxStart = currentStart;
bestSumIdxEnd = i;
}
}
for(int i = bestSumIdxStart; i <= bestSumIdxEnd ; i++){
System.out.print(numbers[i] + " ");
}
System.out.println();
}
}
| [
"tonek@tonek-HP-Pavilion-Notebook"
] | tonek@tonek-HP-Pavilion-Notebook |
481e2f257cd49206fe5b739443729909ca27242d | f0ec814efa117c0fd320384481f89557fd331207 | /src/main/java/com/dialogflow/data/repository/jpa/RecetteJpaRepository.java | 9cc74ddc2da55009c87167a3f2497ca537dd88d2 | [] | no_license | freeekey1/immoflow-api | e39ab1d90c60942934be1046090897e587765008 | bc2e55b85103997a2eb3b61c241238d1096b0a52 | refs/heads/master | 2021-05-11T02:57:49.588029 | 2018-01-28T23:18:43 | 2018-01-28T23:18:43 | 117,899,653 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 298 | java | package com.dialogflow.data.repository.jpa;
import org.springframework.data.repository.PagingAndSortingRepository;
import com.dialogflow.bean.jpa.RecetteEntity;
/**
* Repository : Recette.
*/
public interface RecetteJpaRepository extends PagingAndSortingRepository<RecetteEntity, Integer> {
}
| [
"zerta.kamal@gmail.com"
] | zerta.kamal@gmail.com |
412f83c1d1ae87ba6061ed8094bdad7a22714ad3 | abfb440fa1031ce253be1593ab83b4a59a74486c | /Coffee.java | 768cea92874cc3b948218f9c15e5fa11c444fdbf | [] | no_license | mkcoder/decorator-in-java | 3c68ec11a21c24ac89bcfb92fc2b16d45ffd9f77 | f2cdc4e6f01694009ccd8403bc570ad3d3930dae | refs/heads/master | 2020-12-24T14:53:06.855364 | 2015-03-11T01:58:20 | 2015-03-11T01:58:20 | 31,992,701 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 233 | java | /**
* Created by muhammadkhalilullah on 3/8/2015.
*/
public abstract class Coffee implements ICoffee
{
static double price;
static String order;
public abstract double GetPrice();
public abstract String Order();
}
| [
"mk.muhammad.khan10@gmail.com"
] | mk.muhammad.khan10@gmail.com |
d5472ea8658ca60b7208bfdb5af63c5589eaaf28 | 6614f254cf14e1e572fce9dfdf02ddf2ef453a71 | /Algorithms/src/Solution_508.java | e843dd579e7e40e48587005017fb046e84c786ee | [] | no_license | TenMoons/fucking-leetcode | b7a04b6b3f3e51eaa02430699df47c9dd0c9810d | 3395c7bdc5d0564f7256d610b2372d7b7b52c799 | refs/heads/master | 2021-09-12T07:41:07.485791 | 2021-09-03T15:25:05 | 2021-09-03T15:25:05 | 245,947,279 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,310 | java | import java.util.ArrayList;
import java.util.HashMap;
/**
* 508. 出现次数最多的子树元素和
*/
public class Solution_508 {
class TreeNode {
int val;
TreeNode left, right;
public TreeNode(int val) {
this.val = val;
}
}
private HashMap<Integer, Integer> map = new HashMap<>();
private int maxCnt = Integer.MIN_VALUE;
public int[] findFrequentTreeSum(TreeNode root) {
if (root == null)
return new int[0];
dfs(root);
ArrayList<Integer> list = new ArrayList<>();
for (int key : map.keySet()) {
if (map.get(key) == maxCnt)
list.add(key);
}
int[] res = new int[list.size()];
for (int i = 0; i < res.length; i++)
res[i] = list.get(i);
return res;
}
private int dfs(TreeNode root) {
if (root == null)
return 0;
int leftSum = dfs(root.left); // 左子树元素和
int rightSum = dfs(root.right); // 右子树元素和
int curSum = root.val + leftSum + rightSum; // 当前节点的子树元素和
map.put(curSum, map.getOrDefault(curSum, 0) + 1); // 次数+1
maxCnt = Math.max(maxCnt, map.get(curSum)); // 更新最值
return curSum;
}
}
| [
"tenmoons@foxmail.com"
] | tenmoons@foxmail.com |
11f2ad23d7cbe9cfef15f52149baa838daa7f296 | bd875a001d5cd9c3ee4e67835f598dd252a61130 | /src/main/java/eu/redbyte/upvsdemo/rest/identity/IdentityResult.java | 5e0bd94ba5f265e44426f47660f8f1131fcb6890 | [
"MIT"
] | permissive | slovak-egov/upvs-demo | d5cac75a2506b363fa230f2c3a9aed0a00a269a0 | 6590fae8f8baf00fa793cbe8061d2cb349e2c471 | refs/heads/master | 2021-10-02T19:34:11.448753 | 2018-11-30T10:38:59 | 2018-11-30T10:38:59 | 285,545,423 | 0 | 0 | MIT | 2020-08-06T10:48:32 | 2020-08-06T10:48:32 | null | UTF-8 | Java | false | false | 446 | java | package eu.redbyte.upvsdemo.rest.identity;
import java.io.Serializable;
/**
* @author Michal Sabo
*/
public class IdentityResult implements Serializable {
private String ico;
private String result;
public IdentityResult(String ico, String result) {
this.ico = ico;
this.result = result;
}
public String getIco() {
return ico;
}
public String getResult() {
return result;
}
}
| [
"sabo@redbyte.eu"
] | sabo@redbyte.eu |
05242ad543abf74426a79c4358d13bce66dda8ef | 02e3ecd5ffd5d65b2a4d63f32b7647c2ab7c7061 | /first-websocket/src/main/java/com/first/demo/websocket/redis/RedisConfig.java | 299306b92d2af1538c0328907d25d01d6d930605 | [] | no_license | 1467842/websocket | 7f8901109d4de4ad86503e5ccd665485da2d7fcb | d83f380e85b02d9140a0ecd3597e35be1e17d7f4 | refs/heads/master | 2020-03-26T23:23:54.552680 | 2018-08-22T10:27:01 | 2018-08-22T10:27:01 | 145,534,361 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,518 | java | package com.first.demo.websocket.redis;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.cache.RedisCacheManager;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.RedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;
/**
* Created with IntelliJ IDEA.
* Description:
* User: 郑志辉
* Date: 2018-04-10
* Time: 上午9:53
*/
@Configuration
public class RedisConfig {
@Bean
@ConditionalOnMissingBean(name = "redisTemplate")
public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory) {
Jackson2JsonRedisSerializer<Object> jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer<Object>(Object.class);
ObjectMapper om = new ObjectMapper();
om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
jackson2JsonRedisSerializer.setObjectMapper(om);
RedisTemplate<String, Object> template = new RedisTemplate<String, Object>();
template.setConnectionFactory(redisConnectionFactory);
template.setKeySerializer(jackson2JsonRedisSerializer);
template.setValueSerializer(jackson2JsonRedisSerializer);
template.setHashKeySerializer(jackson2JsonRedisSerializer);
template.setHashValueSerializer(jackson2JsonRedisSerializer);
template.afterPropertiesSet();
return template;
}
@Bean
@ConditionalOnMissingBean(StringRedisTemplate.class)
public StringRedisTemplate stringRedisTemplate(
RedisConnectionFactory redisConnectionFactory) {
StringRedisTemplate template = new StringRedisTemplate();
template.setConnectionFactory(redisConnectionFactory);
return template;
}
}
| [
"zhangyunlong@dcjinchan.com"
] | zhangyunlong@dcjinchan.com |
f7a0533286cb31cb621d849acd8212bf878190cb | 69632af1ccef783dcbaafe9807c8e74a486c8d7c | /gradle-test2-api/src/test/java/com/github/uuidcode/gradle/test2/ProjectServiceTest.java | d2232dbafd77a011777fbcade7fd30626a23f980 | [] | no_license | uuidcode/gradle-test2 | 27a7b8d29530e644bdc4856a932f1af5fd2b9db0 | f921b8baf047c2d4f184fcee5dd2797211f9e60c | refs/heads/master | 2020-05-01T16:07:33.371398 | 2019-05-23T12:56:17 | 2019-05-23T12:56:17 | 177,564,755 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 381 | java | package com.github.uuidcode.gradle.test2;
import org.junit.Test;
import static org.assertj.core.api.Assertions.assertThat;
public class ProjectServiceTest {
@Test
public void test() {
ProjectService projectService = new ProjectService();
Project project = projectService.findById(100L);
assertThat(project.getProjectId()).isEqualTo(100L);
}
} | [
"ted.song@daumkakao.com"
] | ted.song@daumkakao.com |
a4f78419161bffb7fbf6308eb57f8d1a87dbd603 | ee72a6742a3b898026bc19a91e7222ff80e6ff43 | /mall-permission/src/main/java/com/wyl/mall/permission/client/PermissionServiceClient.java | 81bf3d13b6b89bce95762ea72f07aa195ad1120a | [] | no_license | zhangruhong/mall | 719c875e7626fc5b86d5326f370bdc4ba6569bf2 | 4c8df95ec0512fb8fcd4952cb47670a665d8a6ee | refs/heads/master | 2020-06-02T21:24:08.083515 | 2018-06-22T08:26:00 | 2018-06-22T08:26:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,296 | java | package com.wyl.mall.permission.client;
import com.wyl.mall.permission.Constants;
import com.wyl.mall.permission.dto.ResourceDTO;
import com.wyl.mall.permission.dto.UserDTO;
import com.wyl.zodiac.web.response.Response;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
* @author 陈宇霖
* @version V1.0
* @Title: PermissionServiceClient
* @Package com.hoau.cancer.permission.client
* @Description: 调用权限管理系统接口客户端
* @date 2017/9/18 18:28
*/
@FeignClient(Constants.PERMISSION_SERVICE_NAME)
public interface PermissionServiceClient {
/**
* 获取用户权限菜单接口
*
* @param userCode
* @param systemCode
* @param language
* @return
* @author 陈宇霖
* @date 2017年09月18日18:37:04
*/
@RequestMapping(value = Constants.PERMISSION_GET_RESOURCES_URL, method = RequestMethod.GET)
Response<List<ResourceDTO>> getResources(@RequestParam("userCode") String userCode,
@RequestParam("systemCode") String systemCode,
@RequestParam(value = "language", required = false) String language);
/**
* 获取单个菜单接口
*
* @param systemCode
* @param entryUri
* @param language
* @return
* @author 陈宇霖
* @date 2017年09月18日20:53:41
*/
@RequestMapping(value = Constants.PERMISSION_GET_RESOURCE_URL, method = RequestMethod.GET)
Response<ResourceDTO> getResource(@RequestParam("systemCode") String systemCode,
@RequestParam("entryUri") String entryUri,
@RequestParam(value = "language", required = false) String language);
/**
* 获取用户信息接口
*
* @param userCode
* @return
* @author 陈宇霖
* @date 2017年09月18日21:10:12
*/
@RequestMapping(value = Constants.PERMISSION_GET_USER_URL, method = RequestMethod.GET)
Response<UserDTO> getUser(@RequestParam("userCode") String userCode);
}
| [
"lu.wen@ksudi.com"
] | lu.wen@ksudi.com |
f43ca38d7cd08ed1c8f5592b2ed9d2c23b3eada2 | 5e2daada9de4f19ce9675ab5fb86c57f51950fd1 | /app/src/main/java/com/udmurtlyk/extrainputmethod/latin/settings/DebugSettings.java | ee1a3fa2b940323e4e2998fc01f1d91d723f09dd | [
"Apache-2.0"
] | permissive | support-for-minority-languages/Multilang-AOSP-Keyboard | c344d4084cb43b8067ce81707e99fb044ba8e5b6 | 18d742dcedb727b1ff3ee0a6ca5b7f2239813cb7 | refs/heads/master | 2020-04-28T04:12:53.900670 | 2019-03-11T08:33:10 | 2019-03-11T08:33:10 | 174,968,719 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,262 | java | /*
* Copyright (C) 2010 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.udmurtlyk.extrainputmethod.latin.settings;
public final class DebugSettings {
public static final String PREF_DEBUG_MODE = "debug_mode";
public static final String PREF_FORCE_NON_DISTINCT_MULTITOUCH = "force_non_distinct_multitouch";
public static final String PREF_FORCE_PHYSICAL_KEYBOARD_SPECIAL_KEY =
"force_physical_keyboard_special_key";
public static final String PREF_SHOW_UI_TO_ACCEPT_TYPED_WORD =
"pref_show_ui_to_accept_typed_word";
public static final String PREF_HAS_CUSTOM_KEY_PREVIEW_ANIMATION_PARAMS =
"pref_has_custom_key_preview_animation_params";
public static final String PREF_KEY_PREVIEW_SHOW_UP_START_X_SCALE =
"pref_key_preview_show_up_start_x_scale";
public static final String PREF_KEY_PREVIEW_SHOW_UP_START_Y_SCALE =
"pref_key_preview_show_up_start_y_scale";
public static final String PREF_KEY_PREVIEW_DISMISS_END_X_SCALE =
"pref_key_preview_dismiss_end_x_scale";
public static final String PREF_KEY_PREVIEW_DISMISS_END_Y_SCALE =
"pref_key_preview_dismiss_end_y_scale";
public static final String PREF_KEY_PREVIEW_SHOW_UP_DURATION =
"pref_key_preview_show_up_duration";
public static final String PREF_KEY_PREVIEW_DISMISS_DURATION =
"pref_key_preview_dismiss_duration";
public static final String PREF_SLIDING_KEY_INPUT_PREVIEW = "pref_sliding_key_input_preview";
public static final String PREF_KEY_LONGPRESS_TIMEOUT = "pref_key_longpress_timeout";
private DebugSettings() {
// This class is not publicly instantiable.
}
}
| [
"exey13@gmail.com"
] | exey13@gmail.com |
2c955f6613d5d25e52d76125a304dcb4700d38e7 | e8f7a323c46dd047460d9db5a899d1917f0dd332 | /jbpm-designer-extensions-backend/src/main/java/org/jbpm/designer/extensions/emf/util/ShapeMap.java | 0b9f52e169de4ed476c40553c386080d9d71e486 | [] | no_license | ifu-lobuntu/jbpm-designer-extensions | cc1e67366ea23bf4b7129730c502868a5f5e2035 | 8166cb1064b4e830d04346381f441a2e9830219d | refs/heads/master | 2020-12-21T21:02:46.439177 | 2016-08-07T07:38:16 | 2016-08-07T07:38:16 | 31,703,967 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,520 | java | package org.jbpm.designer.extensions.emf.util;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.xmi.XMLResource;
import org.jbpm.designer.extensions.api.StencilInfo;
import org.jbpm.designer.extensions.diagram.Shape;
import org.jbpm.designer.extensions.diagram.ShapeReference;
import org.omg.dd.di.DiagramElement;
public class ShapeMap {
private class Mapping {
Shape shape;
DiagramElement diagramElement;
public Mapping(Shape shape, DiagramElement diagramElement) {
super();
this.shape = shape;
this.diagramElement = diagramElement;
}
}
private Map<String, Mapping> shapeMap = new HashMap<String, Mapping>();
private Map<DiagramElement, Shape> diagramElementToShapeMap = new HashMap<DiagramElement, Shape>();
private Map<EObject, DiagramElement> modelElementToDiagramElementMap = new HashMap<EObject, DiagramElement>();
private XMLResource resource;
public ShapeMap(XMLResource resource) {
super();
this.resource = resource;
}
public void linkElements(DiagramElement de, Shape shape) {
this.shapeMap.put(shape.getResourceId(), new Mapping(shape, de));
if(de.getModelElement()!=null){
this.modelElementToDiagramElementMap.put(getModelElement(de), de);
}
this.diagramElementToShapeMap.put(de, shape);
}
protected EObject getModelElement(DiagramElement de) {
return de.getModelElement().isEmpty()?null:de.getModelElement().get(0);
}
public Shape getShape(DiagramElement de) {
return diagramElementToShapeMap.get(de);
}
public DiagramElement getDiagramElement(Shape shape) {
return shapeMap.get(shape.getResourceId()).diagramElement;
}
public Collection<Shape> values() {
Set<Shape> result = new HashSet<Shape>();
for (Mapping mapping : shapeMap.values()) {
result.add(mapping.shape);
}
return result;
}
public Shape get(String resourceId) {
return shapeMap.get(resourceId).shape;
}
public Shape get(ShapeReference ref) {
return get(ref.getResourceId());
}
public Map<Shape, Set<Shape>> buildIncomingMap() {
Map<Shape, Set<Shape>> incomingMap = new HashMap<Shape, Set<Shape>>();
for (Shape shape : values()) {
for (ShapeReference sr : shape.getOutgoing()) {
Shape outgoing = get(sr);
Set<Shape> set = incomingMap.get(outgoing);
if (set == null) {
incomingMap.put(outgoing, set = new HashSet<Shape>());
}
set.add(shape);
}
}
return incomingMap;
}
public XMLResource getResource() {
return resource;
}
public EObject getModelElement(String resourceId) {
Mapping mapping = this.shapeMap.get(resourceId);
DiagramElement de = mapping.diagramElement;
return getModelElement(de);
}
public DiagramElement getDiagramElement(String resourceId) {
return this.shapeMap.get(resourceId).diagramElement;
}
public Shape getShape(EObject element) {
return get(getId(element));
}
public String getId(EObject modelElement) {
return JBPMECoreHelper.getID(modelElement);
}
public <T extends EObject> List<T> getOutgoingModelElements(Shape shape, StencilInfo ... stencils){
List<T> result = new ArrayList<T>();
for (ShapeReference sr : shape.getOutgoing()) {
for (StencilInfo si : stencils) {
if(get(sr).getStencilId().equals(si.getStencilId())){
result.add((T) getModelElement(sr.getResourceId()));
break;
}
}
}
return result;
}
public <T extends EObject> T findEObjectById(String resourceId) {
EObject r = this.resource.getEObject(resourceId);
if(r==null){
for (Resource resource : this.resource.getResourceSet().getResources()) {
r=resource.getEObject(resourceId);
if(r!=null){
break;
}
}
}
return (T) r;
}
}
| [
"ampieb@gmail.com"
] | ampieb@gmail.com |
4765673f431ca51a4ed86eabb4f12e563945dee0 | 79cba4d1e87edbbfdd36b7ac7a6969939dd87146 | /src/l50_Collections/CollectionExample.java | 745cb4ed0a6390dd3db19a3718e136f4db7a1aa2 | [] | no_license | khodchenko/JavaLessons | 4fd0ffa2e79980ad55146eea54a9ecd1eeec0a9e | e6cdf01ecc3efca3e242a37dc950a4734d0d4a99 | refs/heads/main | 2023-02-20T14:40:05.708751 | 2021-01-21T12:16:17 | 2021-01-21T12:16:17 | 332,210,186 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,431 | java | package l50_Collections;
import java.lang.reflect.Array;
import java.util.*;
class Book {
@Override
public String toString() {
return "Book{" +
"author='" + author + '\'' +
'}';
}
String author;
public Book(String author) {
this.author = author;
}
}
public class CollectionExample {
public static void main(String[] args) {
// List collection = new ArrayList();
// Set collection2 = new HashSet();
// Queue collection3 = new PriorityQueue();
// Map collection4 = new HashMap();
// Collection collection = new ArrayList();
// collection.add("1");
// collection.add("2");
// collection.add("3");
// collection.remove("2");
//
// for (Object o:collection)
// {
// System.out.println(o);
// }
// List collection = new ArrayList();
// List collection1 = new ArrayList();
// collection.add("1");
// collection.add("2");
// collection.add("5");
// collection.set(2,"7");
// collection.add("7");
// for(int i =0;i<collection.size();i++){
// System.out.println(collection.get(i));
// }
// Queue collection = new PriorityQueue();
// collection.offer("1");
// collection.offer("2");
// collection.offer("3");
// Iterator iterator = collection.iterator();
// while (iterator.hasNext()){
// System.out.println(iterator.next());
// }
// System.out.println(collection.size());
//
// }
// Set collection = new HashSet();
// collection.add("1");
// collection.add("2");
// collection.add("2");
// collection.add("2");
// collection.add("2");
// collection.add("3");
// for(Object o : collection){
// System.out.println(o);
// }
Map collection = new HashMap();
collection.put(1, "11");
collection.put(2, new Book("22"));
collection.put(3, "33");
collection.put(4, "44");
collection.put(5, "55");
// for (int i = 1; i < collection.size(); i++) {
// System.out.println(collection.get(i));
// }
Set set = collection.entrySet();
for(Object o:set){
System.out.println(o);
}
}
}
| [
"khodch3nk0@gmail.com"
] | khodch3nk0@gmail.com |
138f73e5b8cc1df8f1877ca4d907b414d27f1d8e | 584e026f98c46131669c02bb4789e68b495c36aa | /src/main/java/org/apache/commons/lang3/exception/ExceptionContext.java | 4901cce7ccbff7a444bd6ebdf8d45cc39d08d079 | [
"Apache-2.0"
] | permissive | Wrch1994/lang-33-buggy | cd0db5c356bc5c0a494740e11d127b08f1c51909 | 61bfe086a6ed00988cbf706d6770476326c76c0c | refs/heads/master | 2022-12-29T20:54:10.011948 | 2020-06-23T13:33:40 | 2020-06-23T13:33:40 | 274,413,973 | 0 | 0 | Apache-2.0 | 2020-10-13T23:01:34 | 2020-06-23T13:32:41 | Java | UTF-8 | Java | false | false | 2,434 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.commons.lang3.exception;
import java.util.Set;
/**
* Allows the storage and retrieval of contextual information based on label-value
* pairs for exceptions.
*
* @see ContextedException
* @see ContextedRuntimeException
* @author Apache Software Foundation
* @author D. Ashmore
* @since 3.0
*/
public interface ExceptionContext {
/**
* Adds a contextual label-value pair into this context.
* <p>
* This label-value pair provides information useful for debugging.
*
* @param label the label of the item to add, null not recommended
* @param value the value of item to add, may be null
* @return context itself to allow method chaining
*/
public ExceptionContext addValue(String label, Object value);
/**
* Retrieves a contextual data value associated with the label.
*
* @param label the label to get the contextual value for, may be null
* @return the contextual value associated with the label, may be null
*/
public Object getValue(String label);
/**
* Retrieves the labels defined in the contextual data.
*
* @return the set of labels, never null
*/
public Set<String> getLabelSet();
/**
* Implementors provide the given base message with context label/value item
* information appended.
*
* @param baseMessage the base exception message <b>without</b> context information appended
* @return the exception message <b>with</b> context information appended, never null
*/
public String getFormattedExceptionMessage(String baseMessage);
}
| [
"1830769105@qq.com"
] | 1830769105@qq.com |
f7a85e8363773ad503044fa08b5dc01824d6a5cc | 1c7d2d5cc03112ae3fc1351c0c544faf2132c03f | /com/google/android/android/internal/measurement/zzwf.java | f61d395e5ce47b5d7e4dd6562a82210cc772d8fb | [] | no_license | RishikReddy2408/OS_Hack_1.0.1 | e49eff837ae4f9a03fee9f56c5a3041a3e58dce4 | 23352a6ec7ee17e23a1f5bc0b85ae07f0c3aeeb6 | refs/heads/master | 2020-08-21T13:05:23.391312 | 2019-10-20T05:51:15 | 2019-10-20T05:51:15 | 216,165,741 | 6 | 3 | null | null | null | null | UTF-8 | Java | false | false | 3,225 | java | package com.google.android.android.internal.measurement;
import java.util.Collections;
import java.util.List;
final class zzwf
extends zzwd
{
private static final Class<?> zzcal = Collections.unmodifiableList(Collections.emptyList()).getClass();
private zzwf()
{
super(null);
}
private static List get(Object paramObject, long paramLong)
{
return (List)zzyh.get(paramObject, paramLong);
}
private static List get(Object paramObject, long paramLong, int paramInt)
{
throw new Runtime("d2j fail translate: java.lang.RuntimeException: fail exe a5 = a4\n\tat com.googlecode.dex2jar.ir.ts.an.BaseAnalyze.exec(BaseAnalyze.java:92)\n\tat com.googlecode.dex2jar.ir.ts.an.BaseAnalyze.exec(BaseAnalyze.java:1)\n\tat com.googlecode.dex2jar.ir.ts.Cfg.dfs(Cfg.java:255)\n\tat com.googlecode.dex2jar.ir.ts.an.BaseAnalyze.analyze0(BaseAnalyze.java:75)\n\tat com.googlecode.dex2jar.ir.ts.an.BaseAnalyze.analyze(BaseAnalyze.java:69)\n\tat com.googlecode.dex2jar.ir.ts.UnSSATransformer.transform(UnSSATransformer.java:274)\n\tat com.googlecode.d2j.dex.Dex2jar$2.optimize(Dex2jar.java:163)\n\tat com.googlecode.d2j.dex.Dex2Asm.convertCode(Dex2Asm.java:414)\n\tat com.googlecode.d2j.dex.ExDex2Asm.convertCode(ExDex2Asm.java:42)\n\tat com.googlecode.d2j.dex.Dex2jar$2.convertCode(Dex2jar.java:128)\n\tat com.googlecode.d2j.dex.Dex2Asm.convertMethod(Dex2Asm.java:509)\n\tat com.googlecode.d2j.dex.Dex2Asm.convertClass(Dex2Asm.java:406)\n\tat com.googlecode.d2j.dex.Dex2Asm.convertDex(Dex2Asm.java:422)\n\tat com.googlecode.d2j.dex.Dex2jar.doTranslate(Dex2jar.java:172)\n\tat com.googlecode.d2j.dex.Dex2jar.to(Dex2jar.java:272)\n\tat com.googlecode.dex2jar.tools.Dex2jarCmd.doCommandLine(Dex2jarCmd.java:108)\n\tat com.googlecode.dex2jar.tools.BaseCmd.doMain(BaseCmd.java:288)\n\tat com.googlecode.dex2jar.tools.Dex2jarCmd.main(Dex2jarCmd.java:32)\nCaused by: java.lang.NullPointerException\n");
}
final void getField(Object paramObject, long paramLong)
{
Object localObject = (List)zzyh.get(paramObject, paramLong);
if ((localObject instanceof zzwc))
{
localObject = ((zzwc)localObject).zzww();
}
else
{
if (zzcal.isAssignableFrom(localObject.getClass())) {
return;
}
if (((localObject instanceof zzxe)) && ((localObject instanceof zzvs)))
{
paramObject = (zzvs)localObject;
if (!paramObject.zztw()) {
return;
}
paramObject.zzsm();
return;
}
localObject = Collections.unmodifiableList((List)localObject);
}
zzyh.add(paramObject, paramLong, localObject);
}
final List read(Object paramObject, long paramLong)
{
return get(paramObject, paramLong, 10);
}
final void visitTypeInsn(Object paramObject1, Object paramObject2, long paramLong)
{
List localList2 = get(paramObject2, paramLong);
paramObject2 = localList2;
List localList1 = get(paramObject1, paramLong, localList2.size());
int i = localList1.size();
int j = localList2.size();
if ((i > 0) && (j > 0)) {
localList1.addAll(localList2);
}
if (i > 0) {
paramObject2 = localList1;
}
zzyh.add(paramObject1, paramLong, paramObject2);
}
}
| [
"rishik.s.m.reddy@gmail.com"
] | rishik.s.m.reddy@gmail.com |
1184cf782e62f51cef9a7c3efae740b99f529cd3 | 1c93cf9d72a2fad8dd93dd1bf295530790d635ad | /app/src/main/java/nhom7/thh/meomeonote/entity/Cat.java | a2355c97ab4d0ca45238cb807c3b04526c5e9fd2 | [] | no_license | noha612/MeoMeoNote | 2d194c114290b9c4a9f576b63b123cd865544d39 | e3f8bf475571f83e7262147c65527fb57c17326f | refs/heads/master | 2022-11-11T05:42:22.934605 | 2020-06-28T04:32:25 | 2020-06-28T04:32:25 | 273,717,946 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 738 | java | package nhom7.thh.meomeonote.entity;
public class Cat {
private int id;
private String catShortName;
private String catname;
private int status;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getCatShortName() {
return catShortName;
}
public void setCatShortName(String catShortName) {
this.catShortName = catShortName;
}
public String getCatname() {
return catname;
}
public void setCatname(String catname) {
this.catname = catname;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
}
| [
"hoangpn314@gmail.com"
] | hoangpn314@gmail.com |
3a5b989806caee44869a5cf67512681cb5cd1f72 | 065c1f648e8dd061a20147ff9c0dbb6b5bc8b9be | /eclipsejdt_cluster/10908/tar_1.java | d99a852b862741a2a8b7deef3915efcf0b2a5ba7 | [] | no_license | martinezmatias/GenPat-data-C3 | 63cfe27efee2946831139747e6c20cf952f1d6f6 | b360265a6aa3bb21bd1d64f1fc43c3b37d0da2a4 | refs/heads/master | 2022-04-25T17:59:03.905613 | 2020-04-15T14:41:34 | 2020-04-15T14:41:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,951 | java | package org.eclipse.jdt.internal.core;
/*
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved.
*/
import org.eclipse.core.resources.*;
import org.eclipse.jdt.core.*;
import org.eclipse.jdt.core.jdom.*;
/**
* <p>This operation creates an instance method.
*
* <p>Required Attributes:<ul>
* <li>Containing type
* <li>The source code for the method. No verification of the source is
* performed.
* </ul>
*/
public class CreateMethodOperation extends CreateTypeMemberOperation {
protected String[] fParameterTypes;
/**
* When executed, this operation will create a method
* in the given type with the specified source.
*/
public CreateMethodOperation(IType parentElement, String source, boolean force) {
super(parentElement, source, force);
}
/**
* Returns the type signatures of the parameter types of the
* current <code>DOMMethod</code>
*/
protected String[] convertDOMMethodTypesToSignatures() {
if (fParameterTypes == null) {
if (fDOMNode != null) {
String[] domParameterTypes = ((IDOMMethod)fDOMNode).getParameterTypes();
if (domParameterTypes != null) {
fParameterTypes = new String[domParameterTypes.length];
// convert the DOM types to signatures
int i;
for (i = 0; i < fParameterTypes.length; i++) {
fParameterTypes[i] = Signature.createTypeSignature(domParameterTypes[i].toCharArray(), false);
}
}
}
}
return fParameterTypes;
}
/**
* @see CreateTypeMemberOperation#generateElementDOM
*/
protected IDOMNode generateElementDOM() throws JavaModelException {
if (fDOMNode == null) {
fDOMNode = (new DOMFactory()).createMethod(fSource);
if (fDOMNode == null) { //syntactically incorrect source
fDOMNode = generateSyntaxIncorrectDOM();
}
if (fAlteredName != null && fDOMNode != null) {
fDOMNode.setName(fAlteredName);
}
}
return fDOMNode;
}
/**
* @see CreateElementInCUOperation#generateResultHandle
*/
protected IJavaElement generateResultHandle() {
String[] types = convertDOMMethodTypesToSignatures();
String name;
if (((IDOMMethod) fDOMNode).isConstructor()) {
name = fDOMNode.getParent().getName();
} else {
name = fDOMNode.getName();
}
return getType().getMethod(name, types);
}
/**
* @see CreateElementInCUOperation#getMainTaskName
*/
public String getMainTaskName(){
return Util.bind("operation.createMethodProgress"/*nonNLS*/);
}
/**
* @see CreateTypeMemberOperation#verifyNameCollision
*/
protected IJavaModelStatus verifyNameCollision() {
if (fDOMNode != null) {
IType type = getType();
String name = fDOMNode.getName();
if (name == null) { //constructor
name = type.getElementName();
}
String[] types = convertDOMMethodTypesToSignatures();
if (type.getMethod(name, types).exists()) {
return new JavaModelStatus(IJavaModelStatusConstants.NAME_COLLISION);
}
}
return JavaModelStatus.VERIFIED_OK;
}
}
| [
"375833274@qq.com"
] | 375833274@qq.com |
0407d7a80e492c2dfe3b8d4a3049e121c11942a9 | 6ac6204e59b67a8072d73c070d6eb5333bc8bf41 | /HW_columns/HW_Columns/src/columns/Utils.java | 0773cd7869eee22771e7abaa4e3470b83042a39d | [] | no_license | yemelin/homeworks_tmp | 5f01920bb1266491de63e1723ffea7e8f4f965c2 | 2534f68bb073f78b16556ae8d52895a76fd8d94d | refs/heads/master | 2016-09-10T13:12:28.989879 | 2015-06-29T13:59:15 | 2015-06-29T14:18:55 | 33,262,576 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 159 | java | package columns;
public class Utils {
static void Delay(long t) {
try {
Thread.sleep(t);
}
catch (InterruptedException e) {};
}
}
| [
"yemelin@gmail.com"
] | yemelin@gmail.com |
bed185710602c7e4e7f9e987eb95aa10107443a4 | ce72413687bb0b9ebdc37c8df9a92ecd74dbd1a3 | /scripts/rad/Event.java | c1790e3d081e7d9cacbbf86cafd3f2d2e22f490c | [] | no_license | luiz158/jdf-collateral | ac7672bff1fb2d0754419e7254ccf9410712e4c8 | 27894943fd85077e724193e63c404ce4ff650dad | refs/heads/master | 2020-12-30T20:05:33.233149 | 2014-03-26T09:46:15 | 2014-03-26T09:46:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,530 | java | package com.acme.model;
import static javax.persistence.GenerationType.IDENTITY;
import java.util.ArrayList;
import java.util.Collection;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
@SuppressWarnings("serial")
@Entity
public class Event implements java.io.Serializable
{
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(updatable = false, nullable = false)
private Long id = null;
private String name;
private String description;
private String picture;
@ManyToMany
private Collection<Member> attendees = new ArrayList<Member>();
public String getDescription()
{
return this.description;
}
public Long getId()
{
return this.id;
}
public String getName()
{
return this.name;
}
public String getPicture()
{
return this.picture;
}
public void setDescription(final String description)
{
this.description = description;
}
public void setId(final Long id)
{
this.id = id;
}
public void setName(final String name)
{
this.name = name;
}
public void setPicture(final String picture)
{
this.picture = picture;
}
public Collection<Member> getAttendees()
{
return attendees;
}
public void setAttendees(Collection<Member> attendees)
{
this.attendees = attendees;
}
@Override
public int hashCode()
{
final int prime = 31;
int result = 1;
result = prime * result + ((name == null) ? 0 : name.hashCode());
return result;
}
@Override
public boolean equals(Object obj)
{
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Event other = (Event) obj;
if (name == null)
{
if (other.name != null)
return false;
}
else if (!name.equals(other.name))
return false;
return true;
}
@Override
public String toString()
{
String result = "";
if (name != null && !name.trim().isEmpty())
result += name;
if (description != null && !description.trim().isEmpty())
result += " " + description;
if (picture != null && !picture.trim().isEmpty())
result += " " + picture;
return result;
}
} | [
"pmuir@bleepbleep.org.uk"
] | pmuir@bleepbleep.org.uk |
52c722691da6f046b156acc2f90f2b3fd1000b96 | 46167791cbfeebc8d3ddc97112764d7947fffa22 | /quarkus/src/main/java/com/justexample/entity/Entity0066.java | ac97e091389e19b6192ed34252c911a507cc04d0 | [] | no_license | kahlai/unrealistictest | 4f668b4822a25b4c1f06c6b543a26506bb1f8870 | fe30034b05f5aacd0ef69523479ae721e234995c | refs/heads/master | 2023-08-25T09:32:16.059555 | 2021-11-09T08:17:22 | 2021-11-09T08:17:22 | 425,726,016 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,130 | java | package com.example.entity;
import java.sql.Timestamp;
import javax.persistence.Entity;
import javax.persistence.Id;
@Entity
public class Entity0066 {
@Id
private Long id;
private String code;
private String name;
private String status;
private int seq;
private Timestamp createdDate;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public int getSeq() {
return seq;
}
public void setSeq(int seq) {
this.seq = seq;
}
public Timestamp getCreatedDate() {
return createdDate;
}
public void setCreatedDate(Timestamp createdDate) {
this.createdDate = createdDate;
}
}
| [
"laikahhoe@gmail.com"
] | laikahhoe@gmail.com |
3590e7d58e78c6929e50e5cbe68d6ec20a3e4dbf | 81597b9d6b50df808035699d741a4e6cb994398e | /study_pdf/src/main/java/com/spinach/frame/itextpdf/javaone/edition14/part1/Sample07_CorrectedWatermark.java | 01563e2630460840532536bd9e5c5a986f0e9d40 | [] | no_license | spinachgit/study_frame_third | d78fa794c39adbaaa708eae6c05e4d9ed30eb32f | 23fe388e291ffff7a5da7d0987117e3106d024d2 | refs/heads/master | 2021-05-12T18:19:08.267682 | 2018-03-04T06:27:22 | 2018-03-04T06:27:22 | 113,398,256 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,555 | java | /*
* This code sample was written in the context of
*
* JavaOne 2014: PDF is dead. Long live PDF... and Java!
* Tutorial Session by Bruno Lowagie and Raf Hens
*
* Copyright 2014, iText Group NV
*/
package com.spinach.frame.itextpdf.javaone.edition14.part1;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.Element;
import com.itextpdf.text.Font;
import com.itextpdf.text.Font.FontFamily;
import com.itextpdf.text.Phrase;
import com.itextpdf.text.Rectangle;
import com.itextpdf.text.pdf.ColumnText;
import com.itextpdf.text.pdf.PdfContentByte;
import com.itextpdf.text.pdf.PdfReader;
import com.itextpdf.text.pdf.PdfStamper;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
/**
* Example that shows how NOT to watermark a less simple PDF.
*/
public class Sample07_CorrectedWatermark {
/** The original PDF file. */
public static final String SRC
= "src/main/webapp/resources/itextpdf/pdfs/superman.pdf";
/** The resulting PDF file. */
public static final String DEST
= "results/javaone/edition2014/part1/correct_watermark.pdf";
/**
* Fills out an interactive form.
* @param args no arguments needed
* @throws DocumentException
* @throws IOException
*/
public static void main(String[] args) throws DocumentException, IOException {
File file = new File(DEST);
file.getParentFile().mkdirs();
new Sample07_CorrectedWatermark().manipulatePdf(SRC, DEST);
}
/**
* Fills out and flattens a form with the name, company and country.
* @param src the path to the original form
* @param dest the path to the filled out form
* @throws DocumentException
* @throws IOException
*/
public void manipulatePdf(String src, String dest) throws DocumentException, IOException {
PdfReader reader = new PdfReader(src);
PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(dest));
int n = reader.getNumberOfPages();
Rectangle pagesize;
for (int i = 1; i <= n; i++) {
PdfContentByte over = stamper.getOverContent(i);
pagesize = reader.getPageSize(i);
float x = (pagesize.getLeft() + pagesize.getRight()) / 2;
float y = (pagesize.getBottom() + pagesize.getTop()) / 2;
ColumnText.showTextAligned(over, Element.ALIGN_CENTER, new Phrase("Watermark", new Font(FontFamily.HELVETICA, 40)), x, y, 45);
}
stamper.close();
reader.close();
}
}
| [
"1043204960@qq.com"
] | 1043204960@qq.com |
7f6db8c6193c7f9d4d09de621eaf1c2f037848af | 04f44ccb6896c58c8094ebd4ac2b9fd2f07460df | /src/java/project/viewresponse.java | feebca181cb91963d56cd58b372ac5d040fabe56 | [] | no_license | dhruvaaronwalter/hostel-allotment-system--summer-training-project | c97d111bc2861f53a97bcfd0ae3d5721b173cf2a | 519efcb8141e687c4969e74f25e7fbeb9de0ee54 | refs/heads/master | 2021-01-15T13:18:35.795243 | 2014-10-06T20:31:12 | 2014-10-06T20:31:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,134 | 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 project;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.*;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
/**
*
* @author Dhruv
*/
public class viewresponse extends HttpServlet {
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
* methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
try {
HttpSession session=request.getSession(false);
if(session==null)
{out.print("<br><br><hr size=8>"
+ "<center><font size=5 face='Consolas'>You need to be logged in to view this page!</font><hr size=8></center>");return;
}
session = request.getSession(true);
String e=session.getAttribute("enrollmentno").toString();
String s=session.getAttribute("studentname").toString();
Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/hostel","root","123");
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery("select * from query where enrollno='"+e+"'");
out.print("<body background='abstractblue.jpg'>"
+ "<center><font size='10' face='stencil'>Query Response<br><hr size=8><br></font>"
+ "<table border=1 width=1000><tr><th><font size=6 face='cooper'>"
+ "Your Query</font></th><th><font size=6 face='cooper'>Response</font></th>");
while(rs.next())
{
out.print("<tr><td><font size=5 face='book antiqua'><i>"+rs.getString("qry")+"</i></font></td>"
+"<td><font size=5 face='book antiqua'><i>"+rs.getString("ans")+"</i></td></tr>");
}
out.print("</table></body>");
}
catch(Exception e){out.print(e);}
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
| [
"dhruvwalter@gmail.com"
] | dhruvwalter@gmail.com |
eb32c8e6b600a64f5c023ee0ad76b6716445ec89 | 3f3a2e436ea4d7d9fda28bf2db825c38484418f1 | /microservice-consumer-movie-feign-logging/src/main/java/com/sugelamei/config/FeignLogConfig.java | 5fed4f19452af70a2e9bb4c4b783ca50a001a910 | [] | no_license | superdevops-cn/spring-cloud-microservice | dc1b280b782035cb9c57f6b9d210244c0154db46 | a60b8b0ac23c0912c2e2c7386813df1286b9c0dc | refs/heads/master | 2021-07-05T12:55:31.041757 | 2020-01-20T13:33:55 | 2020-01-20T13:33:55 | 228,393,914 | 0 | 0 | null | 2021-03-31T21:52:21 | 2019-12-16T13:31:04 | Java | UTF-8 | Java | false | false | 338 | java | package com.sugelamei.config;
import feign.Logger;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class FeignLogConfig {
@Bean
Logger.Level feignLogLevel(){
return Logger.Level.FULL;
//return Logger.Level.BASIC;
}
}
| [
"939956697@qq.com"
] | 939956697@qq.com |
381cd59eceab1e08035f95a030a15e658dce036d | 9350785e8648d91fa5611367b430ee0d87b304d9 | /backend/src/main/java/com/bulletjournal/firebase/FcmMessageParams.java | 3b295bd93c8d19190aaf054da082f3c48a17b590 | [] | no_license | zywangzy/BulletJournal | 595deec50b86d8dc5512099bee544872b5a6f2a1 | 0139c2158919cd1c2d9d33ba541bf1b731346c81 | refs/heads/master | 2022-11-20T18:51:01.373391 | 2020-07-23T03:58:16 | 2020-07-23T03:58:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,217 | java | package com.bulletjournal.firebase;
public class FcmMessageParams {
private String title;
private String message;
private String token;
private String topic;
public FcmMessageParams(String title, String message, String token, String topic) {
this.title = title;
this.message = message;
this.token = token;
this.topic = topic;
}
public String getTopic() {
return topic;
}
public void setTopic(String topic) {
this.topic = topic;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
@Override
public String toString() {
return "FcmMessageParams{" +
"title='" + title + '\'' +
", message='" + message + '\'' +
", token='" + token + '\'' +
", topic='" + topic + '\'' +
'}';
}
}
| [
"xguo.tufts@gmail.com"
] | xguo.tufts@gmail.com |
dbfeb556b37cb7ac70ceb5cc18a60ee229050468 | fcd46f84c746f5ed1dd38ce24f9cf5b27e150d78 | /finder-web/src/main/java/com/skin/finder/acl/SimpleUserManager.java | a13deaa6826b3d8b23175fdead4b3fd0d5c7e7e3 | [
"Apache-2.0"
] | permissive | lambertwe/finder-parent | f03936ac7c1a9cec3901fbd2dd4e82e92296b099 | 378a643fda255a79582a4666637875c05bfb07fd | refs/heads/master | 2022-05-01T10:38:31.872493 | 2021-07-01T02:07:44 | 2021-07-01T02:07:44 | 177,890,255 | 0 | 0 | Apache-2.0 | 2022-03-31T18:47:21 | 2019-03-27T00:37:04 | Java | UTF-8 | Java | false | false | 12,758 | java | /*
* $RCSfile: SimpleUserManager.java,v $
* $Revision: 1.1 $
*
* Copyright (C) 2008 Skin, Inc. All rights reserved.
*
* This software is the proprietary information of Skin, Inc.
* Use is subject to license terms.
*/
package com.skin.finder.acl;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.skin.finder.FileComparator;
import com.skin.finder.config.ConfigFactory;
import com.skin.finder.util.IO;
import com.skin.finder.util.StringUtil;
/**
* <p>Title: SimpleUserManager</p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2006</p>
* @author xuesong.net
* @version 1.0
*/
public class SimpleUserManager implements UserManager {
private String home;
private static final Logger logger = LoggerFactory.getLogger(SimpleUserManager.class);
/**
*
*/
public SimpleUserManager() {
File file = new File(ConfigFactory.getLocation(), "user");
this.home = file.getAbsolutePath();
}
/**
* @param home
*/
public SimpleUserManager(String home) {
this.home = home;
}
/**
* @return SimpleUserManager
*/
public static SimpleUserManager getInstance() {
File home = new File(ConfigFactory.getLocation(), "user");
return new SimpleUserManager(home.getAbsolutePath());
}
/**
* @param userName
* @return User
*/
@Override
public User getByName(String userName) {
return this.load(new File(this.home, userName + ".dat"));
}
/**
* @return int
*/
@Override
public int getUserCount() {
/**
* 此处不再做检查,需要确保该目录不存在非dat文件
*/
File[] files = new File(this.home).listFiles();
return (files != null ? files.length : 0);
}
/**
* @param pageNum
* @param pageSize
* @return List<User>
*/
@Override
public List<User> getUserList(int pageNum, int pageSize) {
List<File> files = this.getFileList();
List<User> list = new ArrayList<User>();
if(files == null || files.isEmpty()) {
return list;
}
int i = (pageNum - 1) * pageSize;
int length = files.size();
for(; i < length; i++) {
File file = files.get(i);
String name = file.getName();
User user = new User();
user.setUserName(name.substring(0, name.length() - 4));
user.setCreateTime(new Date(file.lastModified()));
list.add(user);
if(list.size() >= pageSize) {
break;
}
}
return list;
}
/**
* @return List<File>
*/
private List<File> getFileList() {
File[] files = new File(this.home).listFiles();
List<File> list = new ArrayList<File>();
if(files == null || files.length < 1) {
return list;
}
for(File file : files) {
/**
* 文件名需符合用户名规范
*/
String name = file.getName();
if(name.endsWith(".dat")) {
list.add(file);
}
}
java.util.Collections.sort(list, FileComparator.getInstance());
return list;
}
/**
* @param user
*/
@Override
public int update(User user) {
String userName = user.getUserName();
if(user.getUserId() == null) {
long userId = Math.abs(userName.hashCode());
user.setUserId(userId);
}
try {
this.save(user, new File(this.home, userName + ".dat"));
return 1;
}
catch(IOException e) {
logger.error(e.getMessage(), e);
throw new RuntimeException(e);
}
}
@Override
public int create(User user) {
String userName = user.getUserName();
long userId = Math.abs(userName.hashCode());
user.setUserId(userId);
try {
this.save(user, new File(this.home, userName + ".dat"));
return 1;
}
catch(IOException e) {
logger.error(e.getMessage(), e);
throw new RuntimeException(e);
}
}
@Override
public int delete(String userName) {
/**
* 安全校验, 必须是合法的用户名
* 不能包含特殊字符: ../.../../myname
*/
if(!this.check(userName)) {
return 0;
}
File file = new File(this.home, userName + ".dat");
if(file.exists()) {
file.delete();
return 1;
}
return 0;
}
/**
* @param file
* @return User
*/
public User load(File file) {
logger.debug("load: {}", file.getAbsoluteFile());
if(!file.exists() || !file.isFile()) {
return null;
}
InputStream inputStream = null;
try {
inputStream = new FileInputStream(file);
User user = load(inputStream, "utf-8");
Date lastModified = new Date(file.lastModified());
if(user == null) {
return null;
}
if(user.getCreateTime() == null) {
user.setCreateTime(lastModified);
}
if(user.getUpdateTime() == null) {
user.setUpdateTime(lastModified);
}
return user;
}
catch(Exception e) {
logger.error(e.getMessage(), e);
}
finally {
IO.close(inputStream);
}
return null;
}
/**
* @param inputStream
* @param charset
* @return Map<String, String>
*/
private User load(InputStream inputStream, String charset) {
if(inputStream != null) {
try {
return load(new InputStreamReader(inputStream, charset));
}
catch(IOException e) {
logger.error(e.getMessage(), e);
}
}
return null;
}
/**
* @param reader
* @return Map<String, String>
*/
private User load(Reader reader) {
if(reader == null) {
return null;
}
try {
String line = null;
BufferedReader buffer = new BufferedReader(reader);
User user = new User();
while((line = buffer.readLine()) != null) {
line = line.trim();
if(line.length() < 1) {
continue;
}
if(line.startsWith("#")) {
continue;
}
int i = line.indexOf("=");
if(i > -1) {
String name = line.substring(0, i).trim();
String value = line.substring(i + 1).trim();
if(name.length() > 0 && value.length() > 0) {
this.setProperty(user, name, value);
}
}
}
return user;
}
catch(IOException e) {
logger.warn(e.getMessage(), e);
}
return null;
}
/**
* @param file
* @param user
* @throws IOException
*/
private void save(User user, File file) throws IOException {
Date sysTime = new Date();
File parent = file.getParentFile();
if(!parent.exists()) {
parent.mkdirs();
}
if(user.getCreateTime() == null) {
user.setCreateTime(sysTime);
}
user.setUpdateTime(sysTime);
String content = this.stringify(user);
IO.write(file, content.getBytes("utf-8"));
}
/**
* @param user
* @return String
*/
private String stringify(User user) {
StringBuilder buffer = new StringBuilder();
this.append(buffer, "userId", user.getUserId());
this.append(buffer, "groupId", user.getGroupId());
this.append(buffer, "userName", user.getUserName());
this.append(buffer, "nickName", user.getNickName());
this.append(buffer, "userSalt", user.getUserSalt());
this.append(buffer, "password", user.getPassword());
this.append(buffer, "userLevel", user.getUserLevel());
this.append(buffer, "userGender", user.getUserGender());
this.append(buffer, "userAvatar", user.getUserAvatar());
this.append(buffer, "userSignature", user.getUserSignature());
this.append(buffer, "userEmail", user.getUserEmail());
this.append(buffer, "createTime", user.getCreateTime());
this.append(buffer, "updateTime", user.getUpdateTime());
this.append(buffer, "expireTime", user.getExpireTime());
this.append(buffer, "lastLoginTime", user.getLastLoginTime());
this.append(buffer, "lastLoginIp", user.getLastLoginIp());
this.append(buffer, "userStatus", user.getUserStatus());
this.append(buffer, "userOrder", user.getUserOrder());
return buffer.toString();
}
/**
* @param user
* @param name
* @param value
*/
private void setProperty(User user, String name, String value) {
if(name.equals("userId")) {
user.setUserId(Long.parseLong(value));
}
else if(name.equals("groupId")) {
user.setGroupId(Long.parseLong(value));
}
else if(name.equals("userName")) {
user.setUserName(value);
}
else if(name.equals("nickName")) {
user.setNickName(value);
}
else if(name.equals("userSalt")) {
user.setUserSalt(value);
}
else if(name.equals("password")) {
user.setPassword(value);
}
else if(name.equals("userLevel")) {
user.setUserLevel(Integer.parseInt(value));
}
else if(name.equals("userGender")) {
user.setUserGender(Integer.parseInt(value));
}
else if(name.equals("userAvatar")) {
user.setUserAvatar(value);
}
else if(name.equals("userSignature")) {
user.setUserSignature(value);
}
else if(name.equals("userEmail")) {
user.setUserEmail(value);
}
else if(name.equals("createTime")) {
user.setCreateTime(new Date(Long.parseLong(value)));
}
else if(name.equals("updateTime")) {
user.setUpdateTime(new Date(Long.parseLong(value)));
}
else if(name.equals("expireTime")) {
user.setExpireTime(new Date(Long.parseLong(value)));
}
else if(name.equals("lastLoginTime")) {
user.setLastLoginTime(new Date(Long.parseLong(value)));
}
else if(name.equals("lastLoginIp")) {
user.setLastLoginIp(value);
}
else if(name.equals("userStatus")) {
user.setUserStatus(Integer.parseInt(value));
}
else if(name.equals("userOrder")) {
user.setUserOrder(Integer.parseInt(value));
}
}
/**
* @param buffer
* @param name
* @param value
* @return StringBuilder
*/
private StringBuilder append(StringBuilder buffer, String name, Object value) {
if(value == null) {
return buffer;
}
if(value instanceof Date) {
buffer.append(name);
buffer.append(" = ");
buffer.append(((Date)value).getTime());
buffer.append("\r\n");
return buffer;
}
if(value instanceof Number) {
buffer.append(name);
buffer.append(" = ");
buffer.append(value.toString());
buffer.append("\r\n");
return buffer;
}
buffer.append(name);
buffer.append(" = ");
buffer.append(StringUtil.escape(value.toString()));
buffer.append("\r\n");
return buffer;
}
/**
* @param userName
* @return boolean
*/
public boolean check(String userName) {
if(userName.length() < 4 || userName.length() > 20) {
return false;
}
String chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
for(int i = 0; i < userName.length(); i++) {
char c = userName.charAt(i);
if(chars.indexOf(c) < 0) {
return false;
}
}
return true;
}
}
| [
"171809180@qq.com"
] | 171809180@qq.com |
215a142cc1b92027576ed78c256c701efb5b7bf4 | 09d785d591088bdc34c1cb4ba7790cc7ff8a4f9d | /club_web/club_lib/db_club_log/src/main/java/dsqp/db_club_log/model/LogAdminGameCardModel.java | 15ff9640da963e3eb528751e0f6a3ec62412ff05 | [] | no_license | fangxinxin/club | fd4e9fcbd5029540b8b07c4bd45e67ff2ccda0a3 | c2ea0d0cf44de2cc295d675436d205650149969d | refs/heads/master | 2021-05-10T08:14:31.197279 | 2018-01-25T08:17:56 | 2018-01-25T08:17:56 | 118,883,221 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,949 | java | package dsqp.db_club_log.model;
import java.util.Date;
/**
* Created by Aris on 2017/7/26.
*/
public class LogAdminGameCardModel {
private long id;
private long adminId;
private String adminName;
private int gameId;
private long promoterId;
private int changeNum;
private long changeBefore;
private long changeAfter;
private Date createTime;
private Date createDate;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public long getAdminId() {
return adminId;
}
public void setAdminId(long adminId) {
this.adminId = adminId;
}
public String getAdminName() {
return adminName;
}
public void setAdminName(String adminName) {
this.adminName = adminName;
}
public int getGameId() {
return gameId;
}
public void setGameId(int gameId) {
this.gameId = gameId;
}
public long getPromoterId() {
return promoterId;
}
public void setPromoterId(long promoterId) {
this.promoterId = promoterId;
}
public int getChangeNum() {
return changeNum;
}
public void setChangeNum(int changeNum) {
this.changeNum = changeNum;
}
public long getChangeBefore() {
return changeBefore;
}
public void setChangeBefore(long changeBefore) {
this.changeBefore = changeBefore;
}
public long getChangeAfter() {
return changeAfter;
}
public void setChangeAfter(long changeAfter) {
this.changeAfter = changeAfter;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getCreateDate() {
return createDate;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
}
| [
"390010431@qq.com"
] | 390010431@qq.com |
a61747cda90cf13813988e38c7efe5f44b053268 | 05ed35e1653079f86609c4777e5309b2d6190510 | /src/main/java/com/touzhijia/utils/MapConverterUtils.java | 015bb56925feb4d391893b7ae38d9fe3d86c76c4 | [] | no_license | P79N6A/Api_AutoTest | a569fbb541b4f4ae661a84c02a82c55c67753289 | 5b6d7f452b6bed8baff14312bbc0a1d714179ccc | refs/heads/master | 2020-04-10T14:51:22.133647 | 2018-12-09T17:46:11 | 2018-12-09T17:46:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,103 | java | package com.touzhijia.utils;
import com.alibaba.fastjson.JSON;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.HashMap;
import java.util.Map;
/**
* Map<String,Object>转换工具类
* Created by chenxl on 2018/4/1.
*/
public class MapConverterUtils {
private static final Logger logger = LoggerFactory.getLogger(MapConverterUtils.class);
public static Map<String, Object> JsonToMap(String jsonStr) {
Map<String, Object> map = new HashMap<>();
if (StringUtils.isNotEmpty(jsonStr)) {
try {
map = JSON.parseObject(jsonStr, map.getClass());
} catch (Exception e) {
//Json字符串格式不正确时会出现该错误,如少写了"{",少写引号 ;
logger.info("Json字符串转换成Map出错,错误信息:{}", e.getMessage());
e.printStackTrace();
return map;
}
} else {
//直接返回空的map实例,调用时需要判断size,不用判断null ;
return map;
}
return map;
}
}
| [
"chenxl@touzhijia.com"
] | chenxl@touzhijia.com |
e36254576c279ff2348f324230ff8a143be2976a | 48e835e6f176a8ac9ae3ca718e8922891f1e5a18 | /benchmark/validation/org/glassfish/jersey/server/model/InnerClassWithGenericTypeTest.java | 4c1a919e7a391863cf536c368d4db5a3e205fc11 | [] | no_license | STAMP-project/dspot-experiments | f2c7a639d6616ae0adfc491b4cb4eefcb83d04e5 | 121487e65cdce6988081b67f21bbc6731354a47f | refs/heads/master | 2023-02-07T14:40:12.919811 | 2019-11-06T07:17:09 | 2019-11-06T07:17:09 | 75,710,758 | 14 | 19 | null | 2023-01-26T23:57:41 | 2016-12-06T08:27:42 | null | UTF-8 | Java | false | false | 3,346 | java | /**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2010-2017 Oracle and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can
* obtain a copy of the License at
* https://oss.oracle.com/licenses/CDDL+GPL-1.1
* or LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at LICENSE.txt.
*
* GPL Classpath Exception:
* Oracle designates this particular file as subject to the "Classpath"
* exception as provided by Oracle in the GPL Version 2 section of the License
* file that accompanied this code.
*
* Modifications:
* If applicable, add the following below the License Header, with the fields
* enclosed by brackets [] replaced by your own identifying information:
* "Portions Copyright [year] [name of copyright owner]"
*
* Contributor(s):
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package org.glassfish.jersey.server.model;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import org.glassfish.jersey.server.ApplicationHandler;
import org.junit.Assert;
import org.junit.Test;
import static org.glassfish.jersey.server.RequestContextBuilder.from;
/**
* Taken from Jersey-1: jersey-tests:com.sun.jersey.impl.subresources.InnerClassWithGenericTypeTest
*
* @author Paul Sandoz
*/
public class InnerClassWithGenericTypeTest {
ApplicationHandler app;
@Path("/")
public static class RootResource {
@Path("sub")
public InnerClassWithGenericTypeTest.RootResource.SubResource getSub() {
return new InnerClassWithGenericTypeTest.RootResource.SubResource(new ArrayList<String>(), new HashSet<Integer>());
}
public class SubResource extends InnerClassWithGenericTypeTest.RootResource {
public SubResource(List<String> list, Set<Integer> s) {
}
@GET
public String get() {
return "sub";
}
}
}
@Test
public void testInnerClass() throws Exception {
app = createApplication(InnerClassWithGenericTypeTest.RootResource.class);
Assert.assertEquals("sub", app.apply(from("/sub", "GET").build()).get().getEntity());
}
}
| [
"benjamin.danglot@inria.fr"
] | benjamin.danglot@inria.fr |
702c2e884361cd266a51c7a3aa86f8e6c52629f8 | c1f0c1d828c5fd6b5d049fd826b3dd13ee97917f | /IOTechCore/src/main/java/vn/iotech/utils/PermissionUtils.java | 75ef4b738662640e2dbeb62f1e051e940809afa9 | [] | no_license | hieudt32/RouterManager | da46c579b3d32e1b31a2a1b70fa600e1bc370292 | 7f0241e7c9ca11bf75ad6f8f05f2c1105716200c | refs/heads/master | 2021-01-24T21:25:39.981920 | 2018-03-20T07:13:18 | 2018-03-20T07:13:18 | 123,271,288 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 159 | java | package vn.iotech.utils;
/**
* PermissionUtils
* Created by akai on 12/21/2017.
*/
public class PermissionUtils {
public PermissionUtils() {
}
}
| [
"baotudau32@gmail.com"
] | baotudau32@gmail.com |
88616aa85cd676884c5b068b01bc3aa84540a05f | 76410a57b3d79a7aa99a23d38dd3cec5de64489c | /src/frames/ExtraWindow.java | fb56a4d6b6b19b6fe6a7cc870556e4436d5bcb08 | [] | no_license | AvatarHurden/Calculadora | ba2fdee43d75338b843fc259cc315d302ff39470 | 253aa38454d476a84960f612450176b707a33f25 | refs/heads/master | 2018-12-28T13:23:59.094795 | 2015-04-22T22:25:13 | 2015-04-22T22:25:13 | 34,419,166 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 2,874 | java | package frames;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.math.BigDecimal;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JDialog;
import main.Main;
import calculadoras.Padrão;
import calculadoras.engine.EstatísticaEngine;
public abstract class ExtraWindow extends JDialog {
Padrão calculadora;
JButton addToList, openExtras;
protected BigDecimal numberToAdd;
ImageIcon arrowLeft, arrowRight;
GridBagConstraints c = new GridBagConstraints();
public ExtraWindow(){
setLayout(new GridBagLayout());
c.anchor = GridBagConstraints.EAST;
calculadora = new Padrão(false);
c.gridx = 0;
c.gridy = 0;
add(calculadora.getGui(),c);
addToList = new JButton("Add to List");
addToList.setPreferredSize(new Dimension(114,26));
addToList.setFocusable(false);
c.insets = new Insets(5,5,5,5);
c.gridy = 1;
add(addToList,c);
addToList.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
numberToAdd = calculadora.getEngine().getDisplayedNumber();
addToList();
}
});
addWindowListener(new WindowListener() {
public void windowOpened(WindowEvent arg0) {}
public void windowIconified(WindowEvent arg0) {}
public void windowDeiconified(WindowEvent arg0) {}
public void windowDeactivated(WindowEvent arg0) {}
public void windowClosing(WindowEvent arg0) {
calculadora.getEngine().resetAll();
openExtras.doClick();
}
public void windowClosed(WindowEvent arg0) {}
public void windowActivated(WindowEvent arg0) {}
});
pack();
}
public void showWindow(boolean show){
setVisible(show);
calculadora.requestFocus();
}
public JButton addButton(){
arrowLeft = new ImageIcon(ExtraWindow.class.getResource("/images/Arrow Left.png"));
arrowRight = new ImageIcon(ExtraWindow.class.getResource("/images/Arrow Right.png"));
openExtras = new JButton(arrowRight);
openExtras.setFocusable(false);
openExtras.setPreferredSize(new Dimension(arrowLeft.getIconWidth()+10,arrowLeft.getIconHeight()+10));
openExtras.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
toggle();
}
});
return openExtras;
}
public void toggle(){
if (openExtras.getIcon() == arrowRight) {
openExtras.setIcon(arrowLeft);
showWindow(true);
setLocation(Main.getFrame().getLocation().x+Main.getFrame().getWidth(),Main.getFrame().getY());
} else {
openExtras.setIcon(arrowRight);
showWindow(false);
}
}
public abstract void addToList();
}
| [
"agieselvedana@gmail.com"
] | agieselvedana@gmail.com |
0444a61848956b2596a6d660a4a77fd5c8af1700 | 6003b6ec14e6573525fcd20d37a1cb2ae6c0f467 | /src/main/jdk8/org/omg/CosNaming/NamingContextExtOperations.java | 997dbebf143d2010d80fc0aac345fbe1d1dc0c61 | [] | no_license | amazingWu/Java8-Source-Code | 7dc1ac0486c47030457cb336c0d7bb18f68ae352 | 9dd6549efe0c9bc97858abf01076f436868acc56 | refs/heads/master | 2020-04-27T20:29:32.179756 | 2019-03-20T15:19:17 | 2019-03-20T15:19:17 | 174,660,018 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,212 | java | package org.omg.CosNaming;
/**
* org/omg/CosNaming/NamingContextExtOperations.java .
* Generated by the IDL-to-Java compiler (portable), version "3.2"
* from c:/re/workspace/8-2-build-windows-amd64-cygwin/jdk8u91/6644/corba/src/share/classes/org/omg/CosNaming/nameservice.idl
* Friday, April 1, 2016 12:59:26 AM PDT
*/
/**
* <code>NamingContextExt</code> is the extension of <code>NamingContext</code>
* which
* contains a set of name bindings in which each name is unique and is
* part of Interoperable Naming Service.
* Different names can be bound to an object in the same or different
* contexts at the same time. Using <tt>NamingContextExt</tt>, you can use
* URL-based names to bind and resolve. <p>
*
* See <a href="http://www.omg.org/technology/documents/formal/naming_service.htm">
* CORBA COS
* Naming Specification.</a>
*/
public interface NamingContextExtOperations extends org.omg.CosNaming.NamingContextOperations
{
/**
* This operation creates a stringified name from the array of Name
* components.
*
* @param n Name of the object <p>
*
* @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
* Indicates the name does not identify a binding.<p>
*
*/
String to_string (org.omg.CosNaming.NameComponent[] n) throws org.omg.CosNaming.NamingContextPackage.InvalidName;
/**
* This operation converts a Stringified Name into an equivalent array
* of Name Components.
*
* @param sn Stringified Name of the object <p>
*
* @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
* Indicates the name does not identify a binding.<p>
*
*/
org.omg.CosNaming.NameComponent[] to_name (String sn) throws org.omg.CosNaming.NamingContextPackage.InvalidName;
/**
* This operation creates a URL based "iiopname://" format name
* from the Stringified Name of the object.
*
* @param addr internet based address of the host machine where Name Service is running <p>
* @param sn Stringified Name of the object <p>
*
* @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
* Indicates the name does not identify a binding.<p>
* @exception org.omg.CosNaming.NamingContextPackage.InvalidAddress
* Indicates the internet based address of the host machine is
* incorrect <p>
*
*/
String to_url (String addr, String sn) throws org.omg.CosNaming.NamingContextExtPackage.InvalidAddress, org.omg.CosNaming.NamingContextPackage.InvalidName;
/**
* This operation resolves the Stringified name into the object
* reference.
*
* @param sn Stringified Name of the object <p>
*
* @exception org.omg.CosNaming.NamingContextPackage.NotFound
* Indicates there is no object reference for the given name. <p>
* @exception org.omg.CosNaming.NamingContextPackage.CannotProceed
* Indicates that the given compound name is incorrect <p>
* @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
* Indicates the name does not identify a binding.<p>
*
*/
org.omg.CORBA.Object resolve_str (String sn) throws org.omg.CosNaming.NamingContextPackage.NotFound, org.omg.CosNaming.NamingContextPackage.CannotProceed, org.omg.CosNaming.NamingContextPackage.InvalidName;
} // interface NamingContextExtOperations
| [
"18267853511@163.com"
] | 18267853511@163.com |
a57b1be30e34a56f297e3d167ca648cf0b1c918f | e93c098885e3bd7068e5b80fd05d2091a0f325a4 | /test/demo/src/main/java/com/example/demo/pattern/command/ICuisine.java | 4c08190e834737759c40eaf7ef9d003580912471 | [] | no_license | GaodaGG/gwh_practice | 03f12849b51c20251b480398b7e20c1844b4e2b8 | 2aa81ec6cbbf584c67b39464c88792760f7b6feb | refs/heads/main | 2023-07-12T06:15:09.255658 | 2021-08-22T07:26:06 | 2021-08-22T07:26:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 133 | java | package com.example.demo.pattern.command;
/**
* 定义接口
*/
public interface ICuisine {
void cook(); // 烹调、制作
}
| [
"hang_15236270334@163.com"
] | hang_15236270334@163.com |
20c82b3d10a8d95dc66f3a820520d6748d75602b | 7800993d13e30a3de8b0bd02f5a3b3d420585914 | /hert-framework-service-api/base-service-api/src/main/java/com/hert/base/api/form/edit/DeptForm.java | 5710932c15bd2a1db4c831eca8d09067f6b96d66 | [] | no_license | hert1/hert-framework-parent | bebdedf4208b5a896438ee24907e05fde5527051 | 2ba0c053e7f9c3ab64b4144cb6c34fce426824ed | refs/heads/master | 2022-07-03T13:31:32.378307 | 2019-11-04T08:08:06 | 2019-11-04T08:08:06 | 200,397,913 | 0 | 0 | null | 2022-06-21T02:09:16 | 2019-08-03T16:35:36 | Java | UTF-8 | Java | false | false | 1,108 | java | package com.hert.base.api.form.edit;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @author hert
* @create 2019/8/10
* @since 1.0.0
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "DeptForm对象", description = "DeptForm对象")
public class DeptForm {
/**
* 主键
*/
@ApiModelProperty(value = "主键")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* 父主键
*/
@ApiModelProperty(value = "父主键")
private Integer parentId;
/**
* 部门名
*/
@ApiModelProperty(value = "部门名")
private String deptName;
/**
* 部门全称
*/
@ApiModelProperty(value = "部门全称")
private String fullName;
/**
* 排序
*/
@ApiModelProperty(value = "排序")
private Integer sort;
}
| [
"13689287209@163.com"
] | 13689287209@163.com |
ef452824d9c872c6b7da4115314afaf9295fcabc | 5882bf08511ee567d112047590106614cb90d8d4 | /java-features/src/main/java/com/demo/slk/design/vedingmachine/exception/NotFullPaidException.java | 70c61c2bd2cdcfab281d31e26487337ccea8ed10 | [] | no_license | sohanKumawat/java-sample-project | c91ca805d9f35f85d2ba7568e79b65e9f75130fc | 645e57116710919c25b9592cb53997f6dcc93f8c | refs/heads/master | 2021-10-10T22:01:24.271795 | 2019-01-18T01:50:54 | 2019-01-18T01:50:54 | 46,863,763 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 490 | java | package com.demo.slk.design.vedingmachine.exception;
public class NotFullPaidException extends RuntimeException {
private static final long serialVersionUID = -7733640640318245263L;
private String message;
private long remaining;
public NotFullPaidException(String message, long remaining) {
this.message = message;
this.remaining = remaining;
}
public long getRemaining() {
return remaining;
}
@Override
public String getMessage() {
return message + remaining;
}
}
| [
"sohanmnit@gmail.com"
] | sohanmnit@gmail.com |
f8235e29a569c6ac535e535d0a393e86222fb4b6 | 72cd2dfb8c61ae9fbb86a7979177ff7e89df54cb | /java8/src/java8/simple/Fibonacci.java | 53b373a097251cac0b9d505289af15a11068e3d3 | [] | no_license | AniketAndhale/dailywork | 57c23b23093e9c82b45449cbd8de3ecddc089ab6 | caba51f21c903b1ecdb362f6285fea92e66a0faf | refs/heads/master | 2023-01-09T16:40:33.793864 | 2020-03-14T11:58:14 | 2020-03-14T11:58:14 | 233,229,881 | 0 | 0 | null | 2023-01-07T14:27:58 | 2020-01-11T12:41:53 | Java | UTF-8 | Java | false | false | 434 | java | package java8.simple;
import java.util.Scanner;
public class Fibonacci {
public static void main(String[] args) {
int t1=0,t2=1;
Scanner sc=new Scanner (System.in);
System.out.println("Enter no for fibbonaccie series");
int no=sc.nextInt();
for (int i = 1; i <= no; ++i)
{
System.out.print(t1 + " + ");
int sum = t1 + t2;
t1 = t2;
t2 = sum;
}
}
}
| [
"aniketandhale3648@gmail.com"
] | aniketandhale3648@gmail.com |
55f5947d320cfa6ceb6b5e469e4298b8650ec107 | b6fd298e71c07945451081d2d1182bada683432b | /src/main/java/me/jko/demorediskeyspacenoti/client/subscriber/RedisMessageSubscriber.java | 0cf3d0a1acecb23013b254940d029b891f246d5b | [] | no_license | junhee-ko/demo-redis-keyspace-notification | d906bd044c4ab880a22a19f93c91e23bc38b86d2 | 50ff02802d8c15fa835bcf79a61d130d495111e4 | refs/heads/main | 2023-02-05T21:48:43.698577 | 2020-12-24T06:58:03 | 2020-12-24T06:58:03 | 323,845,114 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 530 | java | package me.jko.demorediskeyspacenoti.client.subscriber;
import org.springframework.data.redis.connection.Message;
import org.springframework.data.redis.connection.MessageListener;
import org.springframework.stereotype.Component;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@Component
public class RedisMessageSubscriber implements MessageListener {
@Override
public void onMessage(Message message, byte[] pattern) {
log.info("key : {}, event : {}", new String(message.getBody()), new String(message.getChannel()));
}
}
| [
"junheee.ko@gmail.com"
] | junheee.ko@gmail.com |
24322d70bdc016ab480139c37ad6b14286e96947 | f0410f4b2f13f8755c045d8e45556ba570ace5bc | /infotech-msc-master/modularABox/src/um/ece/abox/module/helper/memo/SHIQOntologyABoxHelper.java | 2b290235a896a73beed02d511df5a184eb2a6aba | [] | no_license | nova0930/myInfotech | a18a6941a82e79c805a089dc63fcfd69b8011442 | 2c980720a39f2a599ba397da07d0fccc87cf207a | refs/heads/master | 2021-01-11T01:14:39.332684 | 2016-01-22T21:26:53 | 2016-01-22T21:26:53 | 34,749,340 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,987 | java | package um.ece.abox.module.helper.memo;
import java.util.*;
import org.semanticweb.owlapi.model.*;
import org.semanticweb.owlapi.util.OWLEntityCollector;
import um.ece.abox.module.helper.*;
import um.ece.abox.module.model.ABoxModule;
/**
* An ontology ABox helper for description logic SHIQ.
* It is a memory based ABox helper that assumes ABoxes can
* be loaded into computer memories.
* @author Jia
*
*/
public class SHIQOntologyABoxHelper extends AbstractOntologyABoxHelper {
// helpers for convenient ontology operations
OntologyHelper ontHelper;
// store of abox assertions.
Set<OWLAxiom> abox;
Map<OWLNamedIndividual, Set<OWLAxiom>> ind_assertions;
OWLOntology ont;
// individual collector from assertions.
OWLEntityCollector sigCollector;
Set<OWLEntity> objects;
// for connected components
Map<OWLNamedIndividual, ABoxModule> modules;
public SHIQOntologyABoxHelper(OWLOntology ont) {
this.ont = ont;
this.ontHelper = new SHIQOntologyHelper();
this.abox = ont.getABoxAxioms(true);
this.ind_assertions = new HashMap<OWLNamedIndividual, Set<OWLAxiom>>();
this.objects = new HashSet<OWLEntity>();
this.sigCollector = new OWLEntityCollector(this.objects);
this.sigCollector.setCollectClasses(false);
this.sigCollector.setCollectDataProperties(false);
this.sigCollector.setCollectDatatypes(false);
this.sigCollector.setCollectObjectProperties(false);
this.modules = new HashMap<OWLNamedIndividual, ABoxModule>();
preprocess();
}
private void preprocess() {
for (OWLAxiom axiom : abox) {
// check individuals in an property assertion
this.objects.clear();
this.sigCollector.reset(this.objects);
axiom.accept(this.sigCollector);
// put assertion into map for each individual
for (OWLEntity o : objects) {
Set<OWLAxiom> set = this.ind_assertions.get(o);
if (set == null)
set = new HashSet<OWLAxiom>();
set.add(axiom);
this.ind_assertions.put((OWLNamedIndividual)o, set);
}
}
}
public void loadABox(String url) {
// cares are only needed for large ABoxes.
return;
}
public Set<OWLNamedIndividual> getNamedIndividuals() {
return this.ind_assertions.keySet();
}
public Set<OWLAxiom> getAssertions(OWLNamedIndividual ind) {
return this.ind_assertions.get(ind);
}
public Set<OWLAxiom> getAssertions(OWLNamedIndividual ind, AxiomType<?>... types) {
Set<OWLAxiom> assertions = this.getAssertions(ind);
return iterable2Set(this.ontHelper.getAxioms(assertions, types));
}
public Set<OWLNamedIndividual> getNeighbors(OWLNamedIndividual ind) {
// get all explicit role assertions of the given individual.
Set<OWLAxiom> roleAssertions = this.getAssertions(ind, AxiomType.OBJECT_PROPERTY_ASSERTION);
// get all the other individuals in the assertions.
this.objects.clear();
this.sigCollector.reset(this.objects);
for (OWLAxiom ax : roleAssertions)
ax.accept(this.sigCollector);
this.objects.remove(ind);
Set<OWLNamedIndividual> inds = new HashSet<OWLNamedIndividual>();
for (OWLEntity o : objects)
inds.add((OWLNamedIndividual) o);
return inds;
}
public Set<OWLNamedIndividual> getNeighbors(OWLNamedIndividual ind, OWLObjectPropertyExpression role) {
// get all explicit role assertions of the given individual.
Set<OWLAxiom> roleAssertions = this.getAssertions(ind, AxiomType.OBJECT_PROPERTY_ASSERTION);
// get all the other individuals in the assertions.
this.objects.clear();
this.sigCollector.reset(this.objects);
for (OWLAxiom ax : roleAssertions) {
// if the role assertion is the explicit R-assertion.
if (this.getDirectedRole((OWLObjectPropertyAssertionAxiom)ax, ind).equals(role))
ax.accept(this.sigCollector);
}
this.objects.remove(ind);
Set<OWLNamedIndividual> inds = new HashSet<OWLNamedIndividual>();
for (OWLEntity o : objects)
inds.add((OWLNamedIndividual) o);
return inds;
}
public ABoxModule getConnectedComponent(OWLNamedIndividual ind) {
if (this.modules.get(ind) != null)
return this.modules.get(ind);
ABoxModule m = super.getConnectedComponent(ind);
for (OWLNamedIndividual in : m.getSignature())
this.modules.put(in, m);
return m;
}
public Set<ABoxModule> getConnectedComponents() {
Set<ABoxModule> components = new HashSet<ABoxModule>();
Set<OWLNamedIndividual> allInds = this.getNamedIndividuals();
for (OWLNamedIndividual ind : allInds)
if (this.modules.get(ind) == null)
this.getConnectedComponent(ind);
components.addAll(this.modules.values());
return components;
}
public Set<OWLClassExpression> getClasses(OWLNamedIndividual ind) {
return ind.getTypes(this.ont);
}
public Set<OWLAxiom> getAssertions(AxiomType<?>... types) {
return iterable2Set(this.ontHelper.getAxioms(this.abox, types));
}
private <T> Set<T> iterable2Set(Iterable<T> data) {
Set<T> s = new HashSet<T>();
for (T d : data)
s.add(d);
return s;
}
}
| [
"zhang.1855@miami.edu"
] | zhang.1855@miami.edu |
9e07412ee2517aac6400367eae326a3d0531f2da | 63b007ebfac164be647e211df4b776aa465a8bb5 | /src/main/java/net/ilexiconn/jurassicraft/common/item/ItemSapling.java | 8414090b5690a93e833be98e5d39af4558908b79 | [
"LicenseRef-scancode-public-domain"
] | permissive | iLexiconn/JurassiCraft | 2eee4317d9eed041f61faefc2be99c69230a2449 | f5bfd4b068b96e7abc573cdf758718c76fd0c6b0 | refs/heads/master | 2021-01-21T21:39:59.851144 | 2016-07-11T08:37:11 | 2016-07-11T08:37:11 | 20,406,475 | 6 | 6 | null | 2015-03-31T20:24:05 | 2014-06-02T14:18:25 | Java | UTF-8 | Java | false | false | 917 | java | package net.ilexiconn.jurassicraft.common.item;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
/**
* @author ProPercivalalb
*/
public class ItemSapling extends ItemBlock {
private Block targetBlock;
public ItemSapling(Block block) {
super(block);
this.targetBlock = block;
this.setMaxDamage(0);
this.setHasSubtypes(true);
}
@SideOnly(Side.CLIENT)
public IIcon getIconFromDamage(int par1) {
return this.targetBlock.getIcon(2, par1);
}
public int getMetadata(int par1) {
return par1;
}
public String getUnlocalizedName(ItemStack par1ItemStack) {
int i = par1ItemStack.getItemDamage();
return super.getUnlocalizedName() + "." + i;
}
}
| [
"me@ilexiconn.net"
] | me@ilexiconn.net |
f903a251a7df069afd00aaac9b3f7d740f340212 | 7aad61d7baae63edcc69422cfe09003cebf173b3 | /smiles/smilesfulfilmentprocess/src/com/smiles/fulfilmentprocess/actions/consignment/WaitBeforeTransmissionAction.java | 3aaa55fce4589ab8a8e1eb57e9305efe12c0304d | [] | no_license | venkatsoda/smiles | 812063686c2ad8d26b0165fee528418a0698e24e | 688b921a56c64d64d8175af093592808edb5ec83 | refs/heads/master | 2020-04-02T05:51:36.142727 | 2018-10-26T09:29:17 | 2018-10-26T09:29:17 | 154,111,780 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 948 | java | /*
* [y] hybris Platform
*
* Copyright (c) 2017 SAP SE or an SAP affiliate company. All rights reserved.
*
* This software is the confidential and proprietary information of SAP
* ("Confidential Information"). You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the
* license agreement you entered into with SAP.
*/
package com.smiles.fulfilmentprocess.actions.consignment;
import de.hybris.platform.ordersplitting.model.ConsignmentProcessModel;
import de.hybris.platform.processengine.action.AbstractSimpleDecisionAction;
public class WaitBeforeTransmissionAction extends AbstractSimpleDecisionAction<ConsignmentProcessModel>
{
@Override
public Transition executeAction(final ConsignmentProcessModel process)
{
// If you return NOK this action will be called again.
// You might want to do this when you want to poll a resource to be ready.
return Transition.OK;
}
}
| [
"venkatsoda@gmail.com"
] | venkatsoda@gmail.com |
1ebd9bae3aafd07353fb9f5457de8fc39fc1eced | 5901ee4aeff739838a092f84d37527f01f06f284 | /src/alibaba/interview1.java | 1b47dc13612a2c5ee58f5b397257807a9e411d56 | [] | no_license | mark2447/leetcode | 42a8bde1074a4e602523940b7d6c0cec65eced7c | cac88661e899a9166371c0055a7347349a8f1a26 | refs/heads/master | 2021-07-16T09:50:16.914801 | 2020-09-15T02:24:18 | 2020-09-15T02:24:18 | 207,008,043 | 0 | 0 | null | 2020-09-15T02:24:19 | 2019-09-07T18:13:50 | Java | UTF-8 | Java | false | false | 47 | java | package alibaba;
public class interview1 {
}
| [
"hwj97055@gmail.com"
] | hwj97055@gmail.com |
f4719ee3254099c64775ea1f324bf2aef1dda77d | 1df27f4b714dbf1619dd3fe3fd666fe4226bd6fd | /ScaleFIt/app/src/main/java/www/team4/com/scalefit/CustomPagerAdapter.java | e156bfd1a95162a2e27a9c4cf3f7e5c4f0664157 | [] | no_license | HealthCareApps/Group-4-Weight-Management | 1c05cabf9148a419b89e879e8b14a68716e181fe | 1058a7662448ee473147f71786b61da0d701d446 | refs/heads/master | 2021-01-10T17:47:56.544749 | 2016-05-09T03:13:54 | 2016-05-09T03:13:54 | 52,137,036 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,620 | java | package www.team4.com.scalefit;
import android.content.Context;
import android.support.v4.view.PagerAdapter;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
/**
* Created by Reaper on 4/10/2016.
*/
public class CustomPagerAdapter extends PagerAdapter{
Context mContext;
LayoutInflater mLayoutInflater;
public CustomPagerAdapter(Context context) {
mContext = context;
mLayoutInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
int[] mResources = {
R.drawable.hydrate,
R.drawable.woman_stretching,
R.drawable.drinking_water,
R.drawable.healthy_meal,
};
@Override
public int getCount() {
return mResources.length;
}
@Override
public boolean isViewFromObject(View view, Object object) {
return view == ((LinearLayout) object);
}
@Override
public Object instantiateItem(ViewGroup container, int position) {
View itemView = mLayoutInflater.inflate(R.layout.pager_item, container, false);
ImageView imageView = (ImageView) itemView.findViewById(R.id.imageView);
imageView.setImageResource(mResources[position]);
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
container.addView(itemView);
return itemView;
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
container.removeView((LinearLayout) object);
}
}
| [
"ajoiseus@fau.edu"
] | ajoiseus@fau.edu |
1304d0f25fff6daec3dadbb1d96428395e78a041 | bae9145db15835f0e06298a7055d46cc50ec6fce | /gabriel-crud-criteria/EjercicioEmpleados/src/main/java/com/arelance/ejercicioempleados/controler/PostRegistroServlet.java | 8491f4d8b422d373a18f65796cc73fd39c63ae29 | [] | no_license | Ambliqui/crud-criteria-clase | bd8cff170ba871eaf06c4571f9d2d19041e3a332 | 1a500a10240d94d821907aab3f860715b4507d3a | refs/heads/main | 2023-08-28T21:50:24.151650 | 2021-10-22T12:05:56 | 2021-10-22T12:05:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,264 | 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.arelance.ejercicioempleados.controler;
import com.arelance.ejercicioempleados.domain.Empleado;
import com.arelance.ejercicioempleados.facade.EmpleadoFacadeLocal;
import java.io.IOException;
import java.io.PrintWriter;
import javax.inject.Inject;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
*
* @author usuario
*/
@WebServlet(name = "PostRegistroServlet", urlPatterns = {"/PostRegistroServlet"})
public class PostRegistroServlet extends HttpServlet {
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
* methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Inject
private EmpleadoFacadeLocal empleadoFacadeLocal;
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String nombre = request.getParameter("fname");
String apellido = request.getParameter("lname");
Integer salario = Integer.parseInt(request.getParameter("salary"));
String departamento = request.getParameter("dept");
Empleado e = new Empleado();
e.setNombreEmpleado(nombre);
e.setApellidoEmpleado(apellido);
e.setSalario(salario);
e.setDepartamentoEmpleado(departamento);
empleadoFacadeLocal.create(e);
request.getRequestDispatcher("PreIndexServlet").forward(request, response);
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
| [
"pedro@zepyrshut.com"
] | pedro@zepyrshut.com |
7e495520ac942a8589e23ec9d339427e150d17c5 | c83b05dcc059edd40622efe0b920a86ea31d0822 | /src/com/gummy/gummypapers/NavigationBarCategoryAdapater.java | 39498021ae42f76b3175f48d518d8a8aafca9b8d | [] | no_license | st3rdroids/GummyWallpapers | ae9b595d6f27fa3e79133fab824077c1f80f2075 | ee171e391230b5418b8fb6577eef1aad69afb0f6 | HEAD | 2016-09-06T21:41:29.723109 | 2013-10-15T00:37:10 | 2013-10-15T00:37:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,676 | java |
package com.gummy.gummypapers;
import android.content.Context;
import android.database.DataSetObserver;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.SpinnerAdapter;
import android.widget.TextView;
import com.gummy.gummypapers.R;
import java.util.ArrayList;
public class NavigationBarCategoryAdapater implements SpinnerAdapter {
Context mContext;
ArrayList<WallpaperCategory> mCategories;
public NavigationBarCategoryAdapater(Context c, ArrayList<WallpaperCategory> cats) {
mContext = c;
WallpaperCategory allCats = new WallpaperCategory(cats.size() + "", "<All>");
for (WallpaperCategory cat : cats) {
for (Wallpaper wall : cat.getWallpapers()) {
allCats.addWallpaper(wall);
}
}
cats.add(0, allCats);
mCategories = cats;
}
public ArrayList<WallpaperCategory> getCategories() {
return mCategories;
}
@Override
public int getCount() {
return mCategories.size();
}
@Override
public Object getItem(int position) {
return mCategories.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public int getItemViewType(int position) {
return 0;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View v = LayoutInflater.from(mContext).inflate(
R.layout.navigation_bar_category_spinner, parent, false);
TextView catTitle = (TextView) v.findViewById(R.id.category);
catTitle.setText(mCategories.get(position).getName());
return v;
}
@Override
public int getViewTypeCount() {
return 1;
}
@Override
public boolean hasStableIds() {
return true;
}
@Override
public boolean isEmpty() {
return mCategories.isEmpty();
}
@Override
public void registerDataSetObserver(DataSetObserver observer) {
}
@Override
public void unregisterDataSetObserver(DataSetObserver observer) {
}
@Override
public View getDropDownView(int position, View convertView, ViewGroup parent) {
View v = LayoutInflater.from(mContext).inflate(
R.layout.navigation_bar_category_spinner, parent, false);
TextView catTitle = (TextView) v.findViewById(R.id.category);
catTitle.setText(mCategories.get(position).getName());
TextView desc = (TextView) v.findViewById(R.id.category_description);
desc.setVisibility(View.GONE);
return v;
}
}
| [
"chadfran84@gmail.com"
] | chadfran84@gmail.com |
e1fab2edf7ac8159c5587c6dc5951550c4282fdd | 2593bee61fff4da3c50cb3c77f80b1667b0270f5 | /src/main/java/com/ironhack/BankingSystem/enums/Status.java | 23631f27d55b3e4753c30571bb97f32664c49478 | [] | no_license | EN-IH-WDPT-JUN21/jegor-chomczuk-banking-system-API | e885ef2e492275f283a73161e3a107583f436f9e | 5d1b0984eea8cca3370c7575f7fb614a23ae0e50 | refs/heads/main | 2023-08-07T04:53:03.040655 | 2021-09-30T06:51:44 | 2021-09-30T06:51:44 | 408,918,275 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 85 | java | package com.ironhack.BankingSystem.enums;
public enum Status {
FROZEN, ACTIVE
}
| [
"jegor.chomczuk@gmail.com"
] | jegor.chomczuk@gmail.com |
25fa0787d380d05d2d9805e616673e50d15becd0 | 4e84c9dbc699cfdf090a2872a7e2bdf79b9dc971 | /fanweHybridLive/src/main/java/com/fanwe/xianrou/manager/ImageViewManager.java | c15f187e919a415c87fc1aa8d0c1e91e136e93d3 | [] | no_license | nickoo123/FanweLive11 | d994f5b6d36a0dd7ac06858f8c78239bfca629a4 | 2cecccf5c6795c4492f6c9d213d6cf27b6188dd4 | refs/heads/master | 2023-03-19T18:17:29.493984 | 2020-03-20T08:50:41 | 2020-03-20T08:50:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,932 | java | package com.fanwe.xianrou.manager;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.view.View;
import android.widget.ImageView;
public class ImageViewManager {
private Bitmap[] mBitmaps = null;
private ImageView[] mItems = null;
private int mCurrentIndex = -1;
public int getCurrentIndex() {
return mCurrentIndex;
}
public void setItems(ImageView[] items, Bitmap[] bitmaps) {
if (items != null && items.length > 0) {
mItems = items;
mBitmaps = bitmaps;
for (int i = 0; i < mItems.length; i++) {
mItems[i].setId(i);
mItems[i].setImageBitmap(mBitmaps[i]);
mItems[i].setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
setSelectIndex(view, view.getId());
}
});
}
}
}
public boolean setSelectIndex(View view, int index) {
if (mItems != null && mItems.length > 0 && index < mItems.length) {
if (index != mCurrentIndex) {
mItems[index].setBackgroundColor(Color.YELLOW);
if (mCurrentIndex != -1) {
mItems[mCurrentIndex].setBackgroundColor(Color.TRANSPARENT);
}
mCurrentIndex = index;
if (mListener != null) {
mListener.onItemClick(view, index);
}
return true;
}
}
return false;
}
private OnItemClickListener mListener = null;
public void setOnItemClickListener(OnItemClickListener listener) {
this.mListener = listener;
}
public interface OnItemClickListener {
void onItemClick(View view, int index);
}
}
| [
"zq090428"
] | zq090428 |
31151a33532a9b6c37aeddbde84c65ed12ac5d1c | 87509a3f68a7b4000c582ddeb162609dd0f1e2db | /src/main/java/com/ServletInitializer.java | 716b5abfb55be9b005b9c35fe2144187ad19e142 | [] | no_license | koku10karin10/CORE | db5914f23b0bb21fd0b2def3d89b76f008c407bf | 19d19715bf45c2b491761310e1d74b98b394303c | refs/heads/main | 2023-08-16T01:37:11.665361 | 2021-10-19T12:08:49 | 2021-10-19T12:08:49 | 411,253,219 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 391 | java | package com;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
public class ServletInitializer extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(CoreApplication.class);
}
}
| [
"is12vanillaice@gmail.com"
] | is12vanillaice@gmail.com |
650eea281b7541badfec63db77db6dc4fc4367ec | fd02f5c5d8e7442f3e967c6a0604e87b6534fc20 | /app/src/main/java/com/example/anany/restaurantleftoverfood/Adapters/ShelterAdapter.java | 74ae0b12170242e04a48586e1510a9bf81ed03bb | [] | no_license | ishaanjav/Donation_Stations | 81eb5dd503191bd52665facf9c8c4ffdf2e44d37 | d506e42048f6c207e00b29b1d3670d68ad446f71 | refs/heads/master | 2022-03-08T07:22:55.848237 | 2019-10-29T00:09:22 | 2019-10-29T00:09:22 | 217,184,099 | 4 | 1 | null | null | null | null | UTF-8 | Java | false | false | 22,761 | java | package com.example.anany.restaurantleftoverfood.Adapters;
import android.Manifest;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Paint;
import android.graphics.Typeface;
import android.net.Uri;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.app.ActivityCompat;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.TextUtils;
import android.text.style.ForegroundColorSpan;
import android.text.style.StyleSpan;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import android.widget.Toast;
import com.example.anany.restaurantleftoverfood.FragmentMap;
import com.example.anany.restaurantleftoverfood.Home;
import com.example.anany.restaurantleftoverfood.R;
import com.example.anany.restaurantleftoverfood.Storage.ShelterInfo;
import com.example.anany.restaurantleftoverfood.Storage.Singleton;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
public class ShelterAdapter extends ArrayAdapter<ShelterInfo> {
private Context mContext;
private List<ShelterInfo> list = new ArrayList<>();
Button inMap, moreInfo;
ImageView call, website;
public ShelterAdapter(@NonNull Context context, ArrayList<ShelterInfo> list) {
super(context, 0, list);
mContext = context;
this.list = list;
}
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
View listItem = convertView;
final ShelterInfo row = list.get(position);
if (listItem == null) {
if (row.getType().contains("elt")) {
listItem = LayoutInflater.from(mContext).inflate(R.layout.shelter_rows, parent, false);
} else {
listItem = LayoutInflater.from(mContext).inflate(R.layout.restaurant_rows, parent, false);
}
}
if (row.getType().contains("elt")) {
listItem = LayoutInflater.from(mContext).inflate(R.layout.shelter_rows, parent, false);
} else {
listItem = LayoutInflater.from(mContext).inflate(R.layout.restaurant_rows, parent, false);
}
TextView nameView = listItem.findViewById(R.id.shelterName);
TextView addressView = listItem.findViewById(R.id.shelterDistance);
TextView hours = listItem.findViewById(R.id.shelterHours);
TextView managerView = listItem.findViewById(R.id.shelterManagerName);
inMap = listItem.findViewById(R.id.map);
moreInfo = listItem.findViewById(R.id.moreInfo);
call = listItem.findViewById(R.id.phone);
website = listItem.findViewById(R.id.web);
if (row.getType().contains("elt")) {
TextView special = listItem.findViewById(R.id.special);
if (special != null)
special.setText(row.getStatus().trim());
}
nameView.setPaintFlags(nameView.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
nameView.setText(row.getName());
hours.setText(getHours(row.getOpeningHours()));
double dis = Double.parseDouble(row.getDistance());
if (row.getUnits().contains("i")) {
dis *= 69;
} else {
dis *= 111;
}
final boolean map = row.isInMap();
if (map) {
} else {
inMap.setBackgroundColor(0XFFd5caca);
}
dis = Math.round(dis * 10) / 10d;
addressView.setText(dis + " " + row.getUnits());
managerView.setText(row.getManagerName());
//DONE Write code for View More Info and View In Map buttons
inMap.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//DONE Write code to show the location in map.
if (map) {
OutputStreamWriter outputStreamWriter = null;
try {
outputStreamWriter = new OutputStreamWriter(mContext.openFileOutput("inMap.txt", Context.MODE_PRIVATE));
outputStreamWriter.write("" + row.getLat() + " " + row.getLon());
outputStreamWriter.close();
Home t = (Home) mContext;
Singleton.setShowInMap(true);
Singleton.setLat(row.getLat());
Singleton.setLon(row.getLon());
Singleton.setName(row.getName());
Singleton.setPhone(row.getContactPhone());
Singleton.setAddress(row.getAddress());
Singleton.setHours(row.getOpeningHours());
Singleton.setType(row.getType());
Singleton.setWebsite(row.getWebsite());
makeToast("FIRSTTIME: " + FragmentMap.firsttime);
if (FragmentMap.firsttime == 0)
FragmentMap.animateLocation(row.getLat(), row.getLon());
TabLayout layout = (TabLayout) (t.findViewById(R.id.tabs));
layout.getTabAt(2).select();
} catch (Exception e) {
makeToast("ERROR: " + e.toString() + "\nPlease try again.");
}
} else {
makeToast("You have specified in settings that you don't want to view " + row.getType() + "s in the map.");
}
}
});
moreInfo.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//DONE Write code to show the Alert Dialog.
Dialog show = new Dialog(mContext);
show.requestWindowFeature(Window.FEATURE_NO_TITLE);
if (row.getType().contains("est"))
show.setContentView(R.layout.show_more_info2);
else
show.setContentView(R.layout.show_more_info3);
show.setCancelable(true);
show.getWindow().setBackgroundDrawableResource(R.color.transparent);
ImageView web, pho;
TextView title = show.findViewById(R.id.title);
title.setPaintFlags(title.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
title.setText(row.getName());
TextView location = show.findViewById(R.id.location);
location.setText(row.getType());
TextView address = show.findViewById(R.id.address);
address.setText(row.getAddress());
TextView specialText = show.findViewById(R.id.special);
TextView special = show.findViewById(R.id.specialT);
if (!row.getType().contains("elt")) {
specialText.setText("# of Donations: ");
}
special.setText(row.getStatus());
TextView manager = show.findViewById(R.id.manager);
manager.setText(row.getManagerName());
//DONE IF they are a shelter, get and display the amount of food needed. (ID: amount)
if (row.getType().contains("elt")) {
TextView amount = show.findViewById(R.id.amount);
if (amount != null)
amount.setText(row.getAmount());
}
TextView hours = show.findViewById(R.id.hours);
String raw = row.getOpeningHours();
String[] days = raw.split("( ){3}");
String result = "";
result += days[0];
for (int i = 1; i < days.length; i++) {
result += "\n" + days[i];
}
result.replace("Monday", "Mon");
result.replace("Tuesday", "Tue");
result.replace("Wednesday", "Wed");
result.replace("Thursday", "Thu");
result.replace("Friday", "Fri");
result.replace("Saturday", "Sat");
result.replace("Sunday", "Sun");
String s = row.getOpeningHours();
int r = s.indexOf("Tuesday");
String mon = "Mon: " + s.substring(8, r - 3);
int r2 = s.indexOf("Wednesday", r - 3);
String tue = "Tue: " + s.substring(r + 9, r2 - 3);
int r3 = s.indexOf("Thursday", r2 - 3);
String wed = "Wed: " + s.substring(r2 + 11, r3 - 3);
int r4 = s.indexOf("Friday", r3 - 3);
String thu = "Thu: " + s.substring(r3 + 10, r4 - 3);
int r5 = s.indexOf("Saturday", r4 - 3);
String fri = "Fri: " + s.substring(r4 + 8, r5 - 3);
int r6 = s.indexOf("Sunday", r5 - 3);
String sat = "Sat: " + s.substring(r5 + 10, r6 - 3);
String sun = "Sun: " + s.substring(r6 + 8, row.getOpeningHours().length() - 3);
/* mon.replace("Monday", "Mon");
tue.replace("Tuesday", "Tue");
wed.replace("Wednesday", "Wed");
thu.replace("Thursday", "Thu");
fri.replace("Friday", "Fri");
sat.replace("Saturday", "Sat");
sun.replace("Sunday", "Sun");*/
if (mon.contains(",")) {
String[] splitter = mon.split(", ");
mon = splitter[0];
int count = 0;
for (String rs : splitter) {
if (count != 0)
mon += ",\n" + " " + rs;
count++;
}
}
if (tue.contains(",")) {
String[] splitter = tue.split(", ");
tue = splitter[0];
int count = 0;
for (String rs : splitter) {
if (count != 0)
tue += ",\n" + " " + rs;
count++;
}
}
if (wed.contains(",")) {
String[] splitter = wed.split(", ");
wed = splitter[0];
int count = 0;
for (String rs : splitter) {
if (count != 0)
wed += ",\n" + " " + rs;
count++;
}
}
if (thu.contains(",")) {
String[] splitter = thu.split(", ");
thu = splitter[0];
int count = 0;
for (String rs : splitter) {
if (count != 0)
thu += ",\n" + " " + rs;
count++;
}
}
if (fri.contains(",")) {
String[] splitter = fri.split(", ");
fri = splitter[0];
int count = 0;
for (String rs : splitter) {
if (count != 0)
fri += ",\n" + " " + rs;
count++;
}
}
if (sat.contains(",")) {
String[] splitter = sat.split(", ");
sat = splitter[0];
int count = 0;
for (String rs : splitter) {
if (count != 0)
sat += ",\n" + " " + rs;
count++;
}
}
if (sun.contains(",")) {
String[] splitter = sun.split(", ");
sun = splitter[0];
int count = 0;
for (String rs : splitter) {
if (count != 0)
sun += ",\n" + " " + rs;
count++;
}
}
SpannableString ss = new SpannableString(mon);
ss.setSpan(new StyleSpan(Typeface.BOLD), 0, 4, SpannableString.SPAN_EXCLUSIVE_EXCLUSIVE);
ss.setSpan(new ForegroundColorSpan(0XFFa16767), 0, 4, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
SpannableString s2 = new SpannableString(tue);
s2.setSpan(new StyleSpan(Typeface.BOLD), 0, 4, SpannableString.SPAN_EXCLUSIVE_EXCLUSIVE);
s2.setSpan(new ForegroundColorSpan(0XFFa16767), 0, 4, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
SpannableString s3 = new SpannableString(wed);
s3.setSpan(new StyleSpan(Typeface.BOLD), 0, 4, SpannableString.SPAN_EXCLUSIVE_EXCLUSIVE);
s3.setSpan(new ForegroundColorSpan(0XFFa16767), 0, 4, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
SpannableString s4 = new SpannableString(thu);
s4.setSpan(new StyleSpan(Typeface.BOLD), 0, 4, SpannableString.SPAN_EXCLUSIVE_EXCLUSIVE);
s4.setSpan(new ForegroundColorSpan(0XFFa16767), 0, 4, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
SpannableString s5 = new SpannableString(fri);
s5.setSpan(new StyleSpan(Typeface.BOLD), 0, 4, SpannableString.SPAN_EXCLUSIVE_EXCLUSIVE);
s5.setSpan(new ForegroundColorSpan(0XFFa16767), 0, 4, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
SpannableString s6 = new SpannableString(sat);
s6.setSpan(new StyleSpan(Typeface.BOLD), 0, 4, SpannableString.SPAN_EXCLUSIVE_EXCLUSIVE);
s6.setSpan(new ForegroundColorSpan(0XFFa16767), 0, 4, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
SpannableString s7 = new SpannableString(sun);
s7.setSpan(new ForegroundColorSpan(0XFFa16767), 0, 4, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
s7.setSpan(new StyleSpan(Typeface.BOLD), 0, 4, SpannableString.SPAN_EXCLUSIVE_EXCLUSIVE);
String m = ss.toString();
String rf = s2.toString();
hours.setText(TextUtils.concat(ss, "\n", s2, "\n", s3, "\n", s4, "\n", s5, "\n", s6, "\n", s7));
//hours.setText(getHours(row.));
web = show.findViewById(R.id.webIcon);
pho = show.findViewById(R.id.phoneIcon);
pho.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:+1 732-306-9190"));
if (ActivityCompat.checkSelfPermission(mContext, Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions((Activity) mContext, new String[]{Manifest.permission.CALL_PHONE}, 1);
} else
makeToast("Calling " + row.getName() + "\nat " + row.getContactPhone() + ".");
//mContext.startActivity(intent);
return false;
}
});
if (row.getWebsite().contains("Not ")) {
RelativeLayout back = show.findViewById(R.id.imgB);
back.setBackgroundColor(0XFFbfbfbf);
}
web.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (row.getWebsite().contains("Not ")) {
makeToast(row.getName() + " does not have a website.");
} else {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(row.getWebsite()));
mContext.startActivity(intent);
}
return false;
}
});
TextView distance = show.findViewById(R.id.distance);
double dif = row.getDis();
if (row.getUnits().equals("mi")) {
dif *= 69;
} else
dif *= 110;
dif = Math.round(dif * 10) / 10d;
distance.setText(dif + " " + row.getUnits());
TextView phone = show.findViewById(R.id.phone);
phone.setText(row.getContactPhone());
show.show();
}
});
call.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:+1 732-306-9190"));
if (ActivityCompat.checkSelfPermission(mContext, Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions((Activity) mContext, new String[]{Manifest.permission.CALL_PHONE}, 1);
} else
makeToast("Calling " + row.getName() + "\nat " + row.getContactPhone() + ".");
//mContext.startActivity(intent);
return false;
}
});
if (row.getWebsite().contains("Not av")) {
website.setVisibility(View.INVISIBLE);
} else {
website.setVisibility(View.VISIBLE);
website.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(row.getWebsite()));
mContext.startActivity(intent);
return false;
}
});
}
if (row.isSame()) {
ScrollView rel = listItem.findViewById(R.id.back);
rel.setBackgroundColor(0xFFffe6e7);
} else {
ScrollView rel = listItem.findViewById(R.id.back);
rel.setBackgroundColor(0xFFffffff);
}
return listItem;
}
private void makeToast(String s) {
Toast.makeText(mContext, s, Toast.LENGTH_LONG).show();
}
private String getHours(String openingHours) {
Calendar calendar = Calendar.getInstance();
int day = calendar.get(Calendar.DAY_OF_WEEK);
String next = "";
String result = "";
int part = 0;
switch (day) {
case Calendar.SUNDAY:
part = openingHours.indexOf("Sunday");
break;
case Calendar.MONDAY:
part = openingHours.indexOf("Monday");
next = "Tue";
break;
case Calendar.TUESDAY:
part = openingHours.indexOf("Tuesday");
next = "Wed";
break;
case Calendar.WEDNESDAY:
next = "Thu";
part = openingHours.indexOf("Wednesday");
break;
case Calendar.THURSDAY:
part = openingHours.indexOf("Thursday");
next = "Fri";
break;
case Calendar.FRIDAY:
part = openingHours.indexOf("Friday");
next = "Sat";
break;
case Calendar.SATURDAY:
part = openingHours.indexOf("Saturday");
next = "Sun";
break;
}
int firstS = openingHours.indexOf(" ", part + 1);
if (Character.isDigit(openingHours.charAt(firstS + 1))) {
if (day == 1) {
result = openingHours.substring(firstS + 1, openingHours.length() - 3);
} else {
result = openingHours.substring(firstS + 1, openingHours.indexOf(next) - 3);
}
String splitter[] = result.split(",");
if (splitter.length > 1) {
result = splitter[0];
int count = 0;
for (String s : splitter) {
if (count != 0)
result += ",\n" + s;
count++;
}
}
/*
int firstPM = openingHours.indexOf("PM", firstS + 5);
if (day != 1) {
if (firstPM < openingHours.indexOf(next)) {
result = openingHours.substring(firstS + 1, firstPM + 2);
if (openingHours.length() > firstPM + 5) {
if (openingHours.charAt(firstPM + 2) == ',') {
result += ",\n" + openingHours.substring(firstPM + 4, openingHours.indexOf("PM", firstPM + 5) + 2);
}
}
} else {
int firstAM = openingHours.indexOf("AM", firstS + 5);
int nextAM = openingHours.indexOf("AM", firstAM + 5);
result = openingHours.substring(firstS + 1, nextAM + 2);
if (openingHours.length() > nextAM + 5) {
if (openingHours.charAt(nextAM + 2) == ',') {
result += ",\n" + openingHours.substring(nextAM + 4, openingHours.indexOf("PM", firstPM + 5) + 2);
}
}
}
} else {
result = openingHours.substring(firstS + 1, firstPM + 2);
if (openingHours.length() > firstPM + 5) {
if (openingHours.charAt(firstPM + 2) == ',') {
result += ",\n" + openingHours.substring(firstPM + 4, openingHours.indexOf("PM", firstPM + 5) + 2);
}
}
}*/
} else {
if (day != 1) {
int location = openingHours.indexOf(next);
location -= 3;
result = openingHours.substring(firstS + 1, location);
} else {
result = openingHours.substring(firstS + 1, openingHours.length() - 3);
}
}
return result;
}
} | [
"ishaanjav@gmail.com"
] | ishaanjav@gmail.com |
b7459a450b3d0153e3e2d2547281bc99dc567f62 | acef374dc34ebb72558b0e35855f9220e7fe7c2a | /src/main/java/MonicaReto5/C3_Reto5/Interface/InterfaceClient.java | 681ce463d52c7eb6c0c19bbee86c0ed23208d48b | [] | no_license | mceronj/Cloud5 | dc41ab3dbe65ba9bfb69a2127994f34ec408d72e | 4a1cc929dc60f34f501903a21621486dd1acb74e | refs/heads/main | 2023-08-26T17:26:44.507622 | 2021-11-05T22:29:14 | 2021-11-05T22:29:14 | 425,093,130 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 440 | 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 MonicaReto5.C3_Reto5.Interface;
import MonicaReto5.C3_Reto5.Model.Client;
import org.springframework.data.repository.CrudRepository;
/**
*
* @author Usuario
*/
public interface InterfaceClient extends CrudRepository<Client,Integer>{
}
| [
"91890811+mceronj@users.noreply.github.com"
] | 91890811+mceronj@users.noreply.github.com |
453ab1f2f3dac77ad43fa9c06f20fa0d1cb63358 | f2889f9a683bdc4a7c35d3eedd7926bae6e60dbb | /app/src/main/java/com/yilong/keyboard/view/BlurImageView.java | a4d478955106871af49b67a7db3b35137d1bf277 | [] | no_license | zhkqy/KeyboardProject | ad0123df594ecafa8299e81c1ceacf618d4ec063 | 62d3416d9a88ad5818ee869e1bd5eb341f0e2a6f | refs/heads/master | 2020-03-22T05:23:05.770571 | 2018-07-06T07:19:37 | 2018-07-06T07:19:37 | 139,561,811 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,107 | java | package com.yilong.keyboard.view;
import android.content.Context;
import android.graphics.Canvas;
import android.util.AttributeSet;
import android.widget.ImageView;
import com.yilong.keyboard.R;
import com.yilong.keyboard.utils.ScreenUtils;
/**
* Created by zhkqy on 2018/5/29.
*/
public class BlurImageView extends ImageView {
private Context mContext;
public BlurImageView(Context context) {
super(context);
init(context);
}
public BlurImageView(Context context, AttributeSet attrs) {
super(context, attrs);
init(context);
}
private void init(Context context) {
this.mContext = context;
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int height = ScreenUtils.getScreenHeight(mContext);
super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY));
}
@Override
public void draw(Canvas canvas) {
super.draw(canvas);
canvas.drawColor(getContext().getResources().getColor(R.color.blackOpaque40));
}
}
| [
"yilong_cl@163.com"
] | yilong_cl@163.com |
0142af0b11e47f5f129cafc8298dac05a8300a47 | fd4f8f7f2d8b7a8f462d4485532c616839bb557a | /workspace/it.unibo.android.sensorSupport/sensorData/it/unibo/android/sensorData/interfaces/motionSensors/IAndroidGyroscopeUncalibratedData.java | f482a45288b55fe9117ac5028ab0db6af49852f3 | [] | no_license | CarloAntenucci/AndroidSensorSupport | 5a5a1293241d9124cb72c5c93743a98896a7164e | 30a28d09524bf5e8cfe155b6fdfe6740968a74c2 | refs/heads/master | 2020-06-06T05:07:30.158178 | 2014-08-01T13:57:02 | 2014-08-01T13:57:02 | 22,429,733 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 631 | java | /**
* @author Carlo Antenucci
*/
package it.unibo.android.sensorData.interfaces.motionSensors;
/**
*/
import it.unibo.android.sensorData.interfaces.IAndroidThreeAxisSensorDataWithCorrection;
public interface IAndroidGyroscopeUncalibratedData extends
IAndroidThreeAxisSensorDataWithCorrection, IAndroidGyroscopeData {
/**
* Get method that
* @return the drift on the X axis
*/
public float getDriftX();
/**
* Get method that
* @return the drift on the Y axis
*/
public float getDriftY();
/**
* Get method that
* @return the drift on the Z axis
*/
public float getDriftZ();
}
| [
"carlo.antenucci@studio.unibo.it"
] | carlo.antenucci@studio.unibo.it |
d00437a3071f720b622dc8fe190fc496c11f9069 | ae9e33902ab91f1a74f59715c7d93c12b93da534 | /EBank/src/com/ebank/exceptions/AccountNotFoundExceptions.java | 1c9518b7a263b006f328ae6e44bcda56d94ed6c7 | [] | no_license | harshadpathan402/myRepo | c33665a908acb970cadca0e4ca7ce9a351e3f3a2 | 66d316b68c22aed14345340109776e1900d8c8e7 | refs/heads/master | 2021-01-22T05:54:31.232446 | 2017-08-02T15:04:16 | 2017-08-02T15:04:16 | 92,506,046 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 256 | java | package com.ebank.exceptions;
public class AccountNotFoundExceptions extends Exception{
String s1;
public AccountNotFoundExceptions(String s2) {
s1 = s2;
}
@Override
public String toString() {
return ("AccountNotFoundExceptions : "+s1);
}
}
| [
"harshad.pathan@jbilling.com"
] | harshad.pathan@jbilling.com |
725b86a4e37033b734150095d63e3183e3d408a8 | e8e7881c05de44f80373018697b94fdd9d2578c0 | /services/service-manager/src/main/java/org/rxjava/service/manager/repository/PermissionRepository.java | 5f9c055ad33ed81149fd39e22d20d50df5e9eb28 | [
"MIT"
] | permissive | Silin956/taro-mall | bc78d59c84ecdc0dd8141bc980388f6c439ed6ff | 680a400eb4efd856e0f5d07c38bb14f7415c44a5 | refs/heads/master | 2020-07-07T14:23:54.069214 | 2019-08-12T18:44:18 | 2019-08-12T18:44:18 | 203,374,475 | 1 | 0 | null | 2019-08-20T12:45:01 | 2019-08-20T12:45:01 | null | UTF-8 | Java | false | false | 738 | java | package org.rxjava.service.manager.repository;
import org.rxjava.service.manager.entity.Permission;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.ReactiveMongoTemplate;
import org.springframework.data.repository.reactive.ReactiveSortingRepository;
import org.springframework.stereotype.Repository;
/**
* @author happy 2019-04-27 00:13
*/
@Repository
public interface PermissionRepository extends ReactiveSortingRepository<Permission, String>, SpecialPermissionRepository {
}
interface SpecialPermissionRepository {
}
class SpecialPermissionRepositoryImpl implements SpecialPermissionRepository {
@Autowired
private ReactiveMongoTemplate reactiveMongoTemplate;
} | [
"wugang@billbear.cn"
] | wugang@billbear.cn |
645cfc968555745c34a807b81bb7abf5ab2f92a8 | 97436d2f7716bfca963e20a6daa32e551522ab3d | /Documents/NetBeansProjects/Amazon/src/udemy/map/Location.java | 3b0d6532eb9b3854fe2b3af6891a0e9560fef75b | [] | no_license | SasanAzizian/sample | 0bfc0aa1b874d533e959aca9575eb61c0e92c5cc | 76307334a6564a67c9d63424e827659cb3f854f7 | refs/heads/master | 2021-01-25T10:57:41.486468 | 2017-11-03T16:35:00 | 2017-11-03T16:35:00 | 93,901,889 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 788 | java | package udemy.map;
/**
*
* @author sazizian
*/
import java.util.HashMap;
import java.util.Map;
public class Location {
private final int locationID;
private final String description;
private final Map<String, Integer> exits;
public Location(int locationID, String description) {
this.locationID = locationID;
this.description = description;
this.exits = new HashMap<String, Integer>();
}
public void addExit(String direction, int location) {
exits.put(direction, location);
}
public int getLocationID() {
return locationID;
}
public String getDescription() {
return description;
}
public Map<String, Integer> getExits() {
return new HashMap<String, Integer>(exits);
}
}
| [
"sasan.azizian@gmail.com"
] | sasan.azizian@gmail.com |
1b808388c811e327c7f671680aaec1ba2555bce7 | 933fbb7770d09afdf122522df49a51aa94620574 | /example/maven-root/project4/src/test/java/org/gradle/test/performance/smalljavamultiproject/project4/p11/Test224.java | 08b93d4e94d98ecbe63d1d0ab807f57c689d8c04 | [] | no_license | hoanghainguyen/gradle-maven-transform | cc62b277dfd821c828d51f1eb828036bf4fa1e6e | 7fe1bcaf564c5ccee7aa3458adc8e6b5385adf87 | refs/heads/master | 2020-03-22T07:53:29.514636 | 2017-12-10T20:57:48 | 2017-12-10T20:57:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,167 | java | package org.gradle.test.performance.smalljavamultiproject.project4.p11;
import org.junit.Test;
import static org.junit.Assert.*;
public class Test224 {
Production224 objectUnderTest = new Production224();
@Test
public void testProperty0() {
Production221 value = new Production221();
objectUnderTest.setProperty0(value);
assertEquals(value, objectUnderTest.getProperty0());
}
@Test
public void testProperty1() {
Production222 value = new Production222();
objectUnderTest.setProperty1(value);
assertEquals(value, objectUnderTest.getProperty1());
}
@Test
public void testProperty2() {
Production223 value = new Production223();
objectUnderTest.setProperty2(value);
assertEquals(value, objectUnderTest.getProperty2());
}
@Test
public void testProperty3() {
String value = "value";
objectUnderTest.setProperty3(value);
assertEquals(value, objectUnderTest.getProperty3());
}
@Test
public void testProperty4() {
String value = "value";
objectUnderTest.setProperty4(value);
assertEquals(value, objectUnderTest.getProperty4());
}
@Test
public void testProperty5() {
String value = "value";
objectUnderTest.setProperty5(value);
assertEquals(value, objectUnderTest.getProperty5());
}
@Test
public void testProperty6() {
String value = "value";
objectUnderTest.setProperty6(value);
assertEquals(value, objectUnderTest.getProperty6());
}
@Test
public void testProperty7() {
String value = "value";
objectUnderTest.setProperty7(value);
assertEquals(value, objectUnderTest.getProperty7());
}
@Test
public void testProperty8() {
String value = "value";
objectUnderTest.setProperty8(value);
assertEquals(value, objectUnderTest.getProperty8());
}
@Test
public void testProperty9() {
String value = "value";
objectUnderTest.setProperty9(value);
assertEquals(value, objectUnderTest.getProperty9());
}
} | [
"uklance@gmail.com"
] | uklance@gmail.com |
5cdb2c8a4d71d26f31cfeeed404f372e871c7dca | d1d4aa114b5444d8e0a0c22086fb93ceb2f26bc2 | /app/src/main/java/com/xx/xxx/androidmediacodec/MainActivity.java | fa2cd8062eed003d91e71a59871e5e4415cd352a | [] | no_license | baoshujun/AndroidMediaCodec | 7df4c7d5d3b674220b039c588e4d42c67df66faa | b080265f799bd7b8237050c793be1bc0d4176392 | refs/heads/master | 2020-04-07T22:57:18.477756 | 2018-11-24T09:33:06 | 2018-11-24T09:33:06 | 158,791,728 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 793 | java | package com.xx.xxx.androidmediacodec;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void onClicked(View view) {
switch (view.getId()){
case R.id.button://解码
toAcitivity(DecodeActivityList.class);
break;
case R.id.button2://编码
break;
}
}
private void toAcitivity(Class clazz){
Intent intent = new Intent(this,clazz);
startActivity(intent);
}
}
| [
"bao.shujun@tlkg.com"
] | bao.shujun@tlkg.com |
6a1bc685eff40e9b378f8b3a994a9d054947ed9f | 8484f5d9d6e182f42082e7eba46b7ef555050a5a | /dietApp/src/test/java/eu/tcitsolutions/dietApp/DietAppApplicationTests.java | f87cce6100dbeda36a9d48934d47e7da170841b9 | [] | no_license | Curek91/dietApp | f65b46ab622d9ff6cef0c77c577042018c051950 | 9539152d20ce504b8105ef4a6eecc8d9a703ba4b | refs/heads/master | 2023-01-14T00:15:10.174136 | 2019-08-30T11:01:01 | 2019-08-30T11:01:01 | 133,226,985 | 0 | 0 | null | 2023-01-04T04:04:24 | 2018-05-13T10:32:26 | Java | UTF-8 | Java | false | false | 342 | java | package eu.tcitsolutions.dietApp;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class DietAppApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"tomasz.cur@sollers.eu"
] | tomasz.cur@sollers.eu |
d0ea932b51dd7bee78fb2644ebf52a2bf7c26f85 | ae924140343bfccb7d86651ef2059cde2d70eda6 | /src/main/java/com/example/webproject/controller/InformationController.java | df90868c178b5e93cc584039427079f175bcc61f | [] | no_license | JessZHENG/webproject | 7d5c460f40b872e728649e6948eecbd15207c650 | d59eddc8b39077c01b520f14bc0d99ef0c61a834 | refs/heads/master | 2022-02-16T17:54:26.814239 | 2020-01-16T14:10:19 | 2020-01-16T14:10:19 | 234,244,146 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,710 | java | package com.example.webproject.controller;
import com.example.webproject.entity.Information;
import com.example.webproject.repository.InformationRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("/info")
public class InformationController {//信息文件相关控制(检索、查询、浏览)
@Autowired
private InformationRepository informationRepository;
@GetMapping
public List<Information> list(
@RequestParam(value = "title",required = false,defaultValue = "")String title,
@RequestParam(value = "summary",required = false,defaultValue = "")String summary,
@RequestParam(value = "content",required = false,defaultValue = "")String content,
@RequestParam(value = "pageIndex",required = false,defaultValue = "0")int pageIndex,
@RequestParam(value = "pageSize",required = false,defaultValue = "10")int pageSize
){
Pageable pageable= PageRequest.of(pageIndex,pageSize);
Page<Information> page=informationRepository.findByTitleContainingOrSummaryContainingOrContentContaining(title,summary,content,pageable);
return page.getContent();
}
}
| [
"43813897+JessZHENG@users.noreply.github.com"
] | 43813897+JessZHENG@users.noreply.github.com |
d9991f3573dfc4ae932534293c93e5b009f4967b | 1c975e7dd817706d13755a0c22455236d7689df7 | /src/main/java/seviciosExternos/BankServiceImplementation.java | d4a1dbdcd497fe60ab724e78e91064d06a1f9af1 | [] | no_license | GabiAlifraco/TP-DDS-2016 | b4d4f394ed721e1204162d157c861a973f2e336c | 679c3afcfc320e00277a77d12bf27f48a2ed2b6d | refs/heads/master | 2021-01-18T23:48:49.866189 | 2018-10-18T20:15:20 | 2018-10-18T20:15:20 | 84,381,493 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,305 | java | package seviciosExternos;
import java.util.Arrays;
import java.util.List;
import javax.ws.rs.core.MediaType;
import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.WebResource;
import DTOs.BancoDTO;
import json.JsonFactory;
public class BankServiceImplementation implements BankService {
private JsonFactory jsonFactory = new JsonFactory();
private Client client = Client.create();
private static final String API = "http://private-96b476-ddsutn.apiary-mock.com/";
private static final String RESOURCE = "banks";
public List<BancoDTO> getSucursalesBancosByNombreBanco(String nombreBanco, String tipoServicio) {
WebResource recurso = this.client.resource(API).path(RESOURCE);
WebResource recursoConParametros = recurso.queryParam("banco=", nombreBanco + "&servicio=" + tipoServicio);
WebResource.Builder builder = recursoConParametros.accept(MediaType.APPLICATION_JSON);
ClientResponse response = builder.get(ClientResponse.class);
return mapearJsonABancoDTO(response);
}
private List<BancoDTO> mapearJsonABancoDTO(ClientResponse response){
BancoDTO[] bancosDTO = jsonFactory.fromJson(response.getEntity(String.class), BancoDTO[].class);
return Arrays.asList(bancosDTO);
}
} | [
"maru.bondarenco@gmail.com"
] | maru.bondarenco@gmail.com |
c35a21c287b0f3134ea78864318c8578eb52fb81 | 59db133e64c4fa70fcc7a46d12c964569739b68d | /src/view/events/JFXAutoCompleteEvent.java | 842389cfd78ef084993f262f7b9ba3a57d1f0135 | [] | no_license | newPersonKing/JAVAFX | 00c335aabd7d26370464eeedbbe03311061a4c1f | f1e7a0d6ca1f5cb67594fbd6c91ac9a0199fddd6 | refs/heads/master | 2020-03-21T10:51:38.518278 | 2018-06-24T11:07:55 | 2018-06-24T11:07:55 | 138,475,006 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,375 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package view.events;
import javafx.event.Event;
import javafx.event.EventType;
/**
* @author Shadi Shaheen
* @version 1.0.0
* @since 2018-02-01
*/
public class JFXAutoCompleteEvent<T> extends Event {
private T object;
public JFXAutoCompleteEvent(EventType<? extends Event> eventType, T object) {
super(eventType);
this.object = object;
}
public T getObject(){
return object;
}
//TODO: more events to be added
public static final EventType<JFXAutoCompleteEvent> SELECTION =
new EventType<JFXAutoCompleteEvent>(Event.ANY, "DIALOG_CLOSED");
}
| [
"guoyong@emcc.net.com"
] | guoyong@emcc.net.com |
b87c6ba4c22180cb602cf353e105ce9224835980 | 33e7e854745addbeeb53d5702793240d1927d583 | /gulimall-coupon/src/main/java/com/honyelchak/gulimall/coupon/dao/HomeSubjectDao.java | 700d813589d67faf3c9477ae9c7ce289fd197710 | [
"Apache-2.0"
] | permissive | Honyelchak/gulimall | 64f1acfd134ca49dbe3ec81a9cbb5d639374405e | a6c21aa832a76f6816908dcf316177d0d602703c | refs/heads/main | 2023-03-03T18:45:35.318563 | 2021-02-19T12:11:31 | 2021-02-19T12:11:31 | 333,087,073 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 496 | java | package com.honyelchak.gulimall.coupon.dao;
import com.honyelchak.gulimall.coupon.entity.HomeSubjectEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* 首页专题表【jd首页下面很多专题,每个专题链接新的页面,展示专题商品信息】
*
* @author honyelchak
* @email 554417388@qq.com
* @date 2021-01-27 15:11:37
*/
@Mapper
public interface HomeSubjectDao extends BaseMapper<HomeSubjectEntity> {
}
| [
"554417388@qq.com"
] | 554417388@qq.com |
bb26afe65f93b4cddd5ed77584276f968936bb22 | b87073ef66ce328e454a6f94aaeeb12915e25edb | /casa-do-codigo/src/main/java/br/com/zupacademy/luiz/casadocodigo/livro/LivroResponse.java | 44b3ca4ec5577eaca87f23d5382be6ff53031962 | [
"Apache-2.0"
] | permissive | luizffdemoraes/orange-talents-04-template-casa-do-codigo | a78add74b0bf5dd259347641565019f8ed3835fc | 500b3eae401c14080095f0ab7c3b551c5b4e7d07 | refs/heads/main | 2023-04-11T22:29:04.773696 | 2021-05-17T22:16:54 | 2021-05-17T22:16:54 | 363,918,857 | 0 | 0 | Apache-2.0 | 2021-05-03T12:15:41 | 2021-05-03T12:15:40 | null | UTF-8 | Java | false | false | 1,633 | java | package br.com.zupacademy.luiz.casadocodigo.livro;
import java.math.BigDecimal;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.stream.Collectors;
import br.com.zupacademy.luiz.casadocodigo.autor.Autor;
import br.com.zupacademy.luiz.casadocodigo.categoria.Categoria;
public class LivroResponse {
private String titulo;
private String resumo;
private String sumario;
private BigDecimal preco;
private Integer numPaginas;
private String isbn;
private String dataPublicacao;
private Categoria categoria;
private Autor autor;
public LivroResponse(Livro livro) {
this.titulo = livro.getTitulo();
this.resumo = livro.getResumo();
this.sumario = livro.getSumario();
this.preco = livro.getPreco();
this.numPaginas = livro.getNumPaginas();
this.isbn = livro.getIsbn();
this.dataPublicacao = livro.getDataPublicacao().format(DateTimeFormatter.ofPattern("dd/MM/yyyy"));
this.categoria = livro.getCategoria();
this.autor = livro.getAutor();
}
public String getTitulo() {
return titulo;
}
public String getResumo() {
return resumo;
}
public String getSumario() {
return sumario;
}
public BigDecimal getPreco() {
return preco;
}
public Integer getNumPaginas() {
return numPaginas;
}
public String getIsbn() {
return isbn;
}
public String getDataPublicacao() {
return dataPublicacao;
}
public Categoria getCategoria() {
return categoria;
}
public Autor getAutor() {
return autor;
}
public static List<LivroResponse> converter(List<Livro> livros) {
return livros.stream().map(LivroResponse::new).collect(Collectors.toList());
}
}
| [
"luiz.moraes@host.docker.internal"
] | luiz.moraes@host.docker.internal |
1c57310a4e098a0e12884bb20a7c38fa8f18f01a | 6d9ed24e77cf795cc119b46575e1197e7738db84 | /app/src/main/java/com/dopamin/mestaslovenije/input/DatabaseHelper.java | 77e642f435d4469b011bdd8f8b659f26414bc591 | [] | no_license | ZigaByte/MestaSlovenije2018 | 8581ab54a8774cc20f0453fc02dcda920d63ce26 | ce55ab3300c4d96c680b7babc799a1da3cf71884 | refs/heads/master | 2021-09-10T13:25:22.872512 | 2018-03-26T22:10:07 | 2018-03-26T22:10:07 | 108,676,945 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,593 | java | package com.dopamin.mestaslovenije.input;
import android.content.ContentValues;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.provider.ContactsContract;
import android.util.Log;
import com.dopamin.mestaslovenije.level.components.Location;
import java.util.ArrayList;
/**
* Created by Žiga on 29. 10. 2017.
*/
public class DatabaseHelper extends SQLiteOpenHelper{
public static final int DATABASE_VERSION = 8;
public static final String DATABASE_NAME = "Database.db";
public DatabaseHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
@Override
public void onOpen(SQLiteDatabase db) {
super.onOpen(db);
DatabaseLoader.database = db;
}
public void onCreate(SQLiteDatabase db) {
db.execSQL(DatabaseSchema.Location.SQL_CREATE_LOCATIONS);
db.execSQL(DatabaseSchema.Stage.SQL_CREATE_STAGES);
db.execSQL(DatabaseSchema.Score.SQL_CREATE_SCORES);
// Fill the database. Locations first
loadStage(db, "mesta1.txt", 0, "Večja mesta");
loadStage(db, "mesta2.txt", 1, "Srednja mesta");
loadStage(db, "gore.txt", 2, "Gore");
loadStage(db, "elektrarne.txt", 3, "Elektrarne");
loadStage(db, "mesta3.txt", 4, "Manjša mesta");
loadStage(db, "mesta4.txt", 5, "Majhna mesta");
loadStage(db, "znamenitosti.txt", 6, "Znamenitosti");
loadStage(db, "smucisca.txt", 7, "Smučišča");
loadStage(db, "stadioni.txt", 8, "Stadioni");
loadStage(db, "naravne_znamenitosti.txt", 9, "Naravne znamenitosti");
loadStage(db, "podjetja.txt", 10, "Podjetja");
loadStage(db, "zdravilisca.txt", 11, "Zdravilišča");
loadStage(db, "gradovi.txt", 12, "Gradovi");
loadStage(db, "izviri.txt", 13, "Izviri");
loadStage(db, "muzeji.txt", 14, "Muzeji");
}
// Called from onCreate for every stage
public void loadStage(SQLiteDatabase db, String file, int stage_id, String stageName){
// Insert the Stage
ContentValues valuesStage = new ContentValues();
valuesStage.put(DatabaseSchema.Stage.COLUMN_NAME, stageName);
valuesStage.put(DatabaseSchema.Stage.COLUMN_ID, stage_id);
db.insert(DatabaseSchema.Stage.TABLE_NAME, null, valuesStage);
// Insert all the locations
Log.e("Hello", file);
ArrayList<Location> locations = LocationsLoader.load(file);
for(Location l : locations){
//Log.e("INserting into " + stageName, l.name);
ContentValues values = new ContentValues();
values.put(DatabaseSchema.Location.COLUMN_NAME, l.name);
values.put(DatabaseSchema.Location.COLUMN_N, l.coordinate.n);
values.put(DatabaseSchema.Location.COLUMN_E, l.coordinate.e);
values.put(DatabaseSchema.Location.COLUMN_COUNT, 0);
values.put(DatabaseSchema.Location.COLUMN_STAGE_ID, stage_id);
db.insert(DatabaseSchema.Location.TABLE_NAME, null, values);
}
}
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL(DatabaseSchema.Location.SQL_DELETE_LOCATIONS);
db.execSQL(DatabaseSchema.Stage.SQL_DELETE_STAGES);
db.execSQL(DatabaseSchema.Score.SQL_DELETE_SCORES); // Should probably transfer data
onCreate(db);
}
public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) {
onUpgrade(db, oldVersion, newVersion);
}
}
| [
"zvene28@gmail.com"
] | zvene28@gmail.com |
2eda828dfeb92c82979c44080c47904deed1498c | ac54c24f38c5a3d2d2f6bb0f3513937ad6a320ef | /src/main/java/com/dccj/exception/AppException.java | a4792fbe9a9b774bb290a7c7878b520f1c421612 | [] | no_license | 742699560/dachangchejian | 5229a7cb2330bbcfeaaaeaec0c8497cdddceeee5 | 04aa642aae36dcd1a26472612f6954ceeceec744 | refs/heads/master | 2022-12-23T15:28:13.496160 | 2020-03-23T06:53:52 | 2020-03-23T07:10:08 | 249,328,597 | 0 | 0 | null | 2022-12-16T12:01:49 | 2020-03-23T03:39:02 | JavaScript | UTF-8 | Java | false | false | 397 | java | package com.dccj.exception;
public class AppException extends RuntimeException {
/**
*
*/
private static final long serialVersionUID = 1L;
public AppException() {
super();
}
public AppException(Throwable cause) {
super(cause);
}
public AppException(String message) {
super(message);
}
public AppException(String message, Throwable cause) {
super(message, cause);
}
}
| [
"dingrou@ruisasi.com"
] | dingrou@ruisasi.com |
1317789646bf80bdec2ca0791e28ac0f1d8f6c63 | 3b49db12b3bb00bad5e8ac90b99a9b12da24c183 | /src/main/java/com/demo/Student.java | 49160e4f66be091bd3f260d4504565b2c9017890 | [] | no_license | MDefs/mate-academy | d60ee6af1d7598d9a57a5f5a7197f9a8748f0563 | a74cf2432797d21cc2807ba9be1f7b0ff80909bd | refs/heads/master | 2020-03-28T04:48:59.938702 | 2018-09-06T22:00:28 | 2018-09-06T22:00:28 | 147,738,358 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 787 | java | package com.demo;
public class Student {
private String fullName;
private int age;
private String department;
private String groupName;
private boolean babyFace;
public Student(String fullName, int age, String department, String groupName, boolean babyFace) {
this.fullName = fullName;
this.age = age;
this.department = department;
this.groupName = groupName;
this.babyFace = babyFace;
}
public String getFullName() {
return fullName;
}
public boolean haveBabyFace() {
return babyFace;
}
public int getAge() {
return age;
}
public String getGroupName() {
return groupName;
}
public String getDepartment() {
return department;
}
}
| [
"sqsokol@gmail.com"
] | sqsokol@gmail.com |
7ceca02c859c30a7abab3cfea4909d5f751b9c87 | 4cfda4f1b4d7703e1b460359012082c158103476 | /miliconvert/xsmt/trunk/plugins/org.miliconvert.xsmt.mpgt/src/mpia/schema/TypeDictionaryDicoTypePortSousCategorie.java | a0b08411ec7b52b2d6612b074e3bb408fa75a7b3 | [] | no_license | opensourcejavadeveloper/military_xml_project_miliconvert | e62dee54499fdb8abaa76a9d44ed97ace19dc887 | bb0276970c243ec3acc07fd4b255673d6d7dd080 | refs/heads/master | 2022-01-10T18:11:39.021413 | 2018-08-20T12:45:02 | 2018-08-20T12:45:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 21,045 | java | /**
* <copyright>
* </copyright>
*
* $Id$
*/
package mpia.schema;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.eclipse.emf.common.util.Enumerator;
/**
* <!-- begin-user-doc -->
* A representation of the literals of the enumeration '<em><b>Type Dictionary Dico Type Port Sous Categorie</b></em>',
* and utility methods for working with them.
* <!-- end-user-doc -->
* @see mpia.schema.SchemaPackage#getTypeDictionaryDicoTypePortSousCategorie()
* @model extendedMetaData="name='type_Dictionary_Dico_TypePortSousCategorie'"
* @generated
*/
public enum TypeDictionaryDicoTypePortSousCategorie implements Enumerator {
/**
* The '<em><b>ARTIF</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #ARTIF_VALUE
* @generated
* @ordered
*/
ARTIF(0, "ARTIF", "ARTIF"),
/**
* The '<em><b>REARB</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #REARB_VALUE
* @generated
* @ordered
*/
REARB(1, "REARB", "REARB"),
/**
* The '<em><b>SUPBA</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #SUPBA_VALUE
* @generated
* @ordered
*/
SUPBA(2, "SUPBA", "SUPBA"),
/**
* The '<em><b>SPEED</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #SPEED_VALUE
* @generated
* @ordered
*/
SPEED(3, "SPEED", "SPEED"),
/**
* The '<em><b>TESTB</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #TESTB_VALUE
* @generated
* @ordered
*/
TESTB(4, "TESTB", "TESTB"),
/**
* The '<em><b>BASFC</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #BASFC_VALUE
* @generated
* @ordered
*/
BASFC(5, "BASFC", "BASFC"),
/**
* The '<em><b>BASGC</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #BASGC_VALUE
* @generated
* @ordered
*/
BASGC(6, "BASGC", "BASGC"),
/**
* The '<em><b>CLSMB</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #CLSMB_VALUE
* @generated
* @ordered
*/
CLSMB(7, "CLSMB", "CLSMB"),
/**
* The '<em><b>NUCSMB</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #NUCSMB_VALUE
* @generated
* @ordered
*/
NUCSMB(8, "NUCSMB", "NUCSMB"),
/**
* The '<em><b>SMB</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #SMB_VALUE
* @generated
* @ordered
*/
SMB(9, "SMB", "SMB"),
/**
* The '<em><b>COMC</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #COMC_VALUE
* @generated
* @ordered
*/
COMC(10, "COMC", "COMC"),
/**
* The '<em><b>BLD</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #BLD_VALUE
* @generated
* @ordered
*/
BLD(11, "BLD", "BLD"),
/**
* The '<em><b>BLDREP</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #BLDREP_VALUE
* @generated
* @ordered
*/
BLDREP(12, "BLDREP", "BLDREP"),
/**
* The '<em><b>LANDP</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #LANDP_VALUE
* @generated
* @ordered
*/
LANDP(13, "LANDP", "LANDP"),
/**
* The '<em><b>PASSG</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #PASSG_VALUE
* @generated
* @ordered
*/
PASSG(14, "PASSG", "PASSG"),
/**
* The '<em><b>FISH</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #FISH_VALUE
* @generated
* @ordered
*/
FISH(15, "FISH", "FISH"),
/**
* The '<em><b>TANKER</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #TANKER_VALUE
* @generated
* @ordered
*/
TANKER(16, "TANKER", "TANKER"),
/**
* The '<em><b>SAIL</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #SAIL_VALUE
* @generated
* @ordered
*/
SAIL(17, "SAIL", "SAIL"),
/**
* The '<em><b>FLUVCI</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #FLUVCI_VALUE
* @generated
* @ordered
*/
FLUVCI(18, "FLUVCI", "FLUVCI"),
/**
* The '<em><b>FLUVMI</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #FLUVMI_VALUE
* @generated
* @ordered
*/
FLUVMI(19, "FLUVMI", "FLUVMI"),
/**
* The '<em><b>PRIV</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #PRIV_VALUE
* @generated
* @ordered
*/
PRIV(20, "PRIV", "PRIV"),
/**
* The '<em><b>QUARAN</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #QUARAN_VALUE
* @generated
* @ordered
*/
QUARAN(21, "QUARAN", "QUARAN"),
/**
* The '<em><b>REP</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #REP_VALUE
* @generated
* @ordered
*/
REP(22, "REP", "REP"),
/**
* The '<em><b>REPSER</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #REPSER_VALUE
* @generated
* @ordered
*/
REPSER(23, "REPSER", "REPSER"),
/**
* The '<em><b>NAVREP</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #NAVREP_VALUE
* @generated
* @ordered
*/
NAVREP(24, "NAVREP", "NAVREP"),
/**
* The '<em><b>ROW</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #ROW_VALUE
* @generated
* @ordered
*/
ROW(25, "ROW", "ROW"),
/**
* The '<em><b>NOTRM</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #NOTRM_VALUE
* @generated
* @ordered
*/
NOTRM(26, "NOTRM", "NOTRM"),
/**
* The '<em><b>OTRM</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #OTRM_VALUE
* @generated
* @ordered
*/
OTRM(27, "OTRM", "OTRM"),
/**
* The '<em><b>NOS</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #NOS_VALUE
* @generated
* @ordered
*/
NOS(28, "NOS", "NOS");
/**
* The '<em><b>ARTIF</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>ARTIF</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #ARTIF
* @model
* @generated
* @ordered
*/
public static final int ARTIF_VALUE = 0;
/**
* The '<em><b>REARB</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>REARB</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #REARB
* @model
* @generated
* @ordered
*/
public static final int REARB_VALUE = 1;
/**
* The '<em><b>SUPBA</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>SUPBA</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #SUPBA
* @model
* @generated
* @ordered
*/
public static final int SUPBA_VALUE = 2;
/**
* The '<em><b>SPEED</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>SPEED</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #SPEED
* @model
* @generated
* @ordered
*/
public static final int SPEED_VALUE = 3;
/**
* The '<em><b>TESTB</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>TESTB</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #TESTB
* @model
* @generated
* @ordered
*/
public static final int TESTB_VALUE = 4;
/**
* The '<em><b>BASFC</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>BASFC</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #BASFC
* @model
* @generated
* @ordered
*/
public static final int BASFC_VALUE = 5;
/**
* The '<em><b>BASGC</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>BASGC</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #BASGC
* @model
* @generated
* @ordered
*/
public static final int BASGC_VALUE = 6;
/**
* The '<em><b>CLSMB</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>CLSMB</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #CLSMB
* @model
* @generated
* @ordered
*/
public static final int CLSMB_VALUE = 7;
/**
* The '<em><b>NUCSMB</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>NUCSMB</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #NUCSMB
* @model
* @generated
* @ordered
*/
public static final int NUCSMB_VALUE = 8;
/**
* The '<em><b>SMB</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>SMB</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #SMB
* @model
* @generated
* @ordered
*/
public static final int SMB_VALUE = 9;
/**
* The '<em><b>COMC</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>COMC</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #COMC
* @model
* @generated
* @ordered
*/
public static final int COMC_VALUE = 10;
/**
* The '<em><b>BLD</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>BLD</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #BLD
* @model
* @generated
* @ordered
*/
public static final int BLD_VALUE = 11;
/**
* The '<em><b>BLDREP</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>BLDREP</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #BLDREP
* @model
* @generated
* @ordered
*/
public static final int BLDREP_VALUE = 12;
/**
* The '<em><b>LANDP</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>LANDP</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #LANDP
* @model
* @generated
* @ordered
*/
public static final int LANDP_VALUE = 13;
/**
* The '<em><b>PASSG</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>PASSG</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #PASSG
* @model
* @generated
* @ordered
*/
public static final int PASSG_VALUE = 14;
/**
* The '<em><b>FISH</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>FISH</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #FISH
* @model
* @generated
* @ordered
*/
public static final int FISH_VALUE = 15;
/**
* The '<em><b>TANKER</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>TANKER</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #TANKER
* @model
* @generated
* @ordered
*/
public static final int TANKER_VALUE = 16;
/**
* The '<em><b>SAIL</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>SAIL</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #SAIL
* @model
* @generated
* @ordered
*/
public static final int SAIL_VALUE = 17;
/**
* The '<em><b>FLUVCI</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>FLUVCI</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #FLUVCI
* @model
* @generated
* @ordered
*/
public static final int FLUVCI_VALUE = 18;
/**
* The '<em><b>FLUVMI</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>FLUVMI</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #FLUVMI
* @model
* @generated
* @ordered
*/
public static final int FLUVMI_VALUE = 19;
/**
* The '<em><b>PRIV</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>PRIV</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #PRIV
* @model
* @generated
* @ordered
*/
public static final int PRIV_VALUE = 20;
/**
* The '<em><b>QUARAN</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>QUARAN</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #QUARAN
* @model
* @generated
* @ordered
*/
public static final int QUARAN_VALUE = 21;
/**
* The '<em><b>REP</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>REP</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #REP
* @model
* @generated
* @ordered
*/
public static final int REP_VALUE = 22;
/**
* The '<em><b>REPSER</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>REPSER</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #REPSER
* @model
* @generated
* @ordered
*/
public static final int REPSER_VALUE = 23;
/**
* The '<em><b>NAVREP</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>NAVREP</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #NAVREP
* @model
* @generated
* @ordered
*/
public static final int NAVREP_VALUE = 24;
/**
* The '<em><b>ROW</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>ROW</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #ROW
* @model
* @generated
* @ordered
*/
public static final int ROW_VALUE = 25;
/**
* The '<em><b>NOTRM</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>NOTRM</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #NOTRM
* @model
* @generated
* @ordered
*/
public static final int NOTRM_VALUE = 26;
/**
* The '<em><b>OTRM</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>OTRM</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #OTRM
* @model
* @generated
* @ordered
*/
public static final int OTRM_VALUE = 27;
/**
* The '<em><b>NOS</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>NOS</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #NOS
* @model
* @generated
* @ordered
*/
public static final int NOS_VALUE = 28;
/**
* An array of all the '<em><b>Type Dictionary Dico Type Port Sous Categorie</b></em>' enumerators.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private static final TypeDictionaryDicoTypePortSousCategorie[] VALUES_ARRAY =
new TypeDictionaryDicoTypePortSousCategorie[] {
ARTIF,
REARB,
SUPBA,
SPEED,
TESTB,
BASFC,
BASGC,
CLSMB,
NUCSMB,
SMB,
COMC,
BLD,
BLDREP,
LANDP,
PASSG,
FISH,
TANKER,
SAIL,
FLUVCI,
FLUVMI,
PRIV,
QUARAN,
REP,
REPSER,
NAVREP,
ROW,
NOTRM,
OTRM,
NOS,
};
/**
* A public read-only list of all the '<em><b>Type Dictionary Dico Type Port Sous Categorie</b></em>' enumerators.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static final List<TypeDictionaryDicoTypePortSousCategorie> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY));
/**
* Returns the '<em><b>Type Dictionary Dico Type Port Sous Categorie</b></em>' literal with the specified literal value.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static TypeDictionaryDicoTypePortSousCategorie get(String literal) {
for (int i = 0; i < VALUES_ARRAY.length; ++i) {
TypeDictionaryDicoTypePortSousCategorie result = VALUES_ARRAY[i];
if (result.toString().equals(literal)) {
return result;
}
}
return null;
}
/**
* Returns the '<em><b>Type Dictionary Dico Type Port Sous Categorie</b></em>' literal with the specified name.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static TypeDictionaryDicoTypePortSousCategorie getByName(String name) {
for (int i = 0; i < VALUES_ARRAY.length; ++i) {
TypeDictionaryDicoTypePortSousCategorie result = VALUES_ARRAY[i];
if (result.getName().equals(name)) {
return result;
}
}
return null;
}
/**
* Returns the '<em><b>Type Dictionary Dico Type Port Sous Categorie</b></em>' literal with the specified integer value.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static TypeDictionaryDicoTypePortSousCategorie get(int value) {
switch (value) {
case ARTIF_VALUE: return ARTIF;
case REARB_VALUE: return REARB;
case SUPBA_VALUE: return SUPBA;
case SPEED_VALUE: return SPEED;
case TESTB_VALUE: return TESTB;
case BASFC_VALUE: return BASFC;
case BASGC_VALUE: return BASGC;
case CLSMB_VALUE: return CLSMB;
case NUCSMB_VALUE: return NUCSMB;
case SMB_VALUE: return SMB;
case COMC_VALUE: return COMC;
case BLD_VALUE: return BLD;
case BLDREP_VALUE: return BLDREP;
case LANDP_VALUE: return LANDP;
case PASSG_VALUE: return PASSG;
case FISH_VALUE: return FISH;
case TANKER_VALUE: return TANKER;
case SAIL_VALUE: return SAIL;
case FLUVCI_VALUE: return FLUVCI;
case FLUVMI_VALUE: return FLUVMI;
case PRIV_VALUE: return PRIV;
case QUARAN_VALUE: return QUARAN;
case REP_VALUE: return REP;
case REPSER_VALUE: return REPSER;
case NAVREP_VALUE: return NAVREP;
case ROW_VALUE: return ROW;
case NOTRM_VALUE: return NOTRM;
case OTRM_VALUE: return OTRM;
case NOS_VALUE: return NOS;
}
return null;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private final int value;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private final String name;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private final String literal;
/**
* Only this class can construct instances.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private TypeDictionaryDicoTypePortSousCategorie(int value, String name, String literal) {
this.value = value;
this.name = name;
this.literal = literal;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int getValue() {
return value;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getName() {
return name;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getLiteral() {
return literal;
}
/**
* Returns the literal value of the enumerator, which is its string representation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
return literal;
}
} //TypeDictionaryDicoTypePortSousCategorie
| [
"you@example.com"
] | you@example.com |
8a05637a244c3a383dadd02e7cf70ed341651d2f | 403c262a2e1a5954631c9a52a43fa964fc08a405 | /app/src/main/java/cz/inlive/inlive/utils/Constants.java | 5575757708c581e24a8d19d69c6aa71fdf0acbe2 | [] | no_license | Tkadla-GSG/InLive | e0cbc5b81fe4b7362f9ca3fa5ea052ce66643cba | f2e15b15b43fe21613629ab8d3369de8343530f2 | refs/heads/master | 2021-01-10T19:33:56.460807 | 2014-10-09T11:54:48 | 2014-10-09T11:54:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 943 | java | package cz.inlive.inlive.utils;
import android.app.AlarmManager;
/**
* Created by Tkadla on 13. 9. 2014.
*/
public class Constants {
//API
public static String URL_BASE = "http://inlive.deevy.eu/api/1/";
//GCM
public static String SENDER_ID = "1061629046123";
//Message types
public static String TYPE_INFO = "info";
public static String TYPE_UPDATE = "update";
public static String TYPE_BET = "bet";
//UI
public static final int INFO_PER_PAGE = 10;
public static final int MAX_INFO_IN_DB = 50;
public static final int MAX_BETS_IN_DB = 300;
//Default slack for first update
public static final long UPDATE_SLACK = 1 * 7 * 24 * 60 * 60 * 1000; // 1 week in milies
public static final long HOUR_MILIES = 5 * 60 * 1000; //1 * 60 * 60 * 1000;
//Default time delay for update service
public static final long UPDATE_DELAY = AlarmManager.INTERVAL_FIFTEEN_MINUTES;
}
| [
"tkadlecek.j@gmail.com"
] | tkadlecek.j@gmail.com |
d1220ca90cae50cd280e1cbbc5a2a9e88eab6993 | 897f376d78b0c4c160147d9fe71a9b9f698607e5 | /fac-android/ele-rct-exam-center-data/src/main/java/com/nd/sdp/ele/rct/exam/data/client/ClientApiGenerator.java | e6ce635c9149bd2b3470cb8b26ac5c43d20c1f94 | [] | no_license | liangbx361/FacRnComponent | 98cf331790c58b1a15b09b3ae9335f2799229aac | fddc905bedd37ef8c3bd320b531d478691c23f8d | refs/heads/master | 2021-01-17T17:09:45.730341 | 2016-08-12T11:17:02 | 2016-08-12T11:17:02 | 65,547,815 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,860 | java | package com.nd.sdp.ele.rct.exam.data.client;
import com.nd.hy.android.hermes.frame.base.HermesLogger;
import com.nd.sdp.ele.rct.exam.data.common.RetrofitErrorHandler;
import com.nd.sdp.ele.rct.exam.data.common.StringConverter;
import retrofit.RequestInterceptor;
import retrofit.RestAdapter;
import retrofit.client.Client;
import retrofit.converter.Converter;
public class ClientApiGenerator {
public static <T> T buildApi(Class<T> clazz,
String baseUrl,
RequestInterceptor interceptor,
Client client) {
return buildApi(clazz,
client,
baseUrl,
new DefaultLogger(),
new StringConverter(),
interceptor,
new RetrofitErrorHandler());
}
public static <T> T buildApi(Class<T> clazz,
Client client,
String baseUrl,
RestAdapter.Log logger,
Converter converter,
RequestInterceptor interceptor,
retrofit.ErrorHandler errorHandler) {
RestAdapter adapter = new RestAdapter.Builder()
.setEndpoint(baseUrl)
.setLog(logger)
.setConverter(converter)
.setClient(client)
.setRequestInterceptor(interceptor)
.setErrorHandler(errorHandler)
.setLogLevel(RestAdapter.LogLevel.FULL)
.build();
return adapter.create(clazz);
}
private static class DefaultLogger implements RestAdapter.Log {
@Override
public void log(String message) {
HermesLogger.D.print(message);
}
}
}
| [
"958800@gitlab.localhost"
] | 958800@gitlab.localhost |
df23b972abf392c3a08a96527d8205b93e2400b2 | cf8adc55995596f965bc0fd16b7089cc210068ad | /src/test/java/com/webstersys/demoapp/service/mapper/UserMapperTest.java | b3dec0110f0f113c06f997a8157918853663fc16 | [] | no_license | ubheamar/jhipster-demo-application | 6dce913d7f68bea05775dfdecbbf96ab4a6cb8cc | fcca617771f10e811e8c934bda29a6c375dd3e63 | refs/heads/master | 2022-12-03T17:10:11.922931 | 2020-08-26T04:08:11 | 2020-08-26T04:08:11 | 289,977,251 | 0 | 0 | null | 2020-08-26T04:08:13 | 2020-08-24T16:14:10 | Java | UTF-8 | Java | false | false | 4,336 | java | package com.webstersys.demoapp.service.mapper;
import static org.assertj.core.api.Assertions.assertThat;
import com.webstersys.demoapp.domain.User;
import com.webstersys.demoapp.service.dto.UserDTO;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.apache.commons.lang3.RandomStringUtils;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
/**
* Unit tests for {@link UserMapper}.
*/
public class UserMapperTest {
private static final String DEFAULT_LOGIN = "johndoe";
private static final Long DEFAULT_ID = 1L;
private UserMapper userMapper;
private User user;
private UserDTO userDto;
@BeforeEach
public void init() {
userMapper = new UserMapper();
user = new User();
user.setLogin(DEFAULT_LOGIN);
user.setPassword(RandomStringUtils.random(60));
user.setActivated(true);
user.setEmail("johndoe@localhost");
user.setFirstName("john");
user.setLastName("doe");
user.setImageUrl("image_url");
user.setLangKey("en");
userDto = new UserDTO(user);
}
@Test
public void usersToUserDTOsShouldMapOnlyNonNullUsers() {
List<User> users = new ArrayList<>();
users.add(user);
users.add(null);
List<UserDTO> userDTOS = userMapper.usersToUserDTOs(users);
assertThat(userDTOS).isNotEmpty();
assertThat(userDTOS).size().isEqualTo(1);
}
@Test
public void userDTOsToUsersShouldMapOnlyNonNullUsers() {
List<UserDTO> usersDto = new ArrayList<>();
usersDto.add(userDto);
usersDto.add(null);
List<User> users = userMapper.userDTOsToUsers(usersDto);
assertThat(users).isNotEmpty();
assertThat(users).size().isEqualTo(1);
}
@Test
public void userDTOsToUsersWithAuthoritiesStringShouldMapToUsersWithAuthoritiesDomain() {
Set<String> authoritiesAsString = new HashSet<>();
authoritiesAsString.add("ADMIN");
userDto.setAuthorities(authoritiesAsString);
List<UserDTO> usersDto = new ArrayList<>();
usersDto.add(userDto);
List<User> users = userMapper.userDTOsToUsers(usersDto);
assertThat(users).isNotEmpty();
assertThat(users).size().isEqualTo(1);
assertThat(users.get(0).getAuthorities()).isNotNull();
assertThat(users.get(0).getAuthorities()).isNotEmpty();
assertThat(users.get(0).getAuthorities().iterator().next().getName()).isEqualTo("ADMIN");
}
@Test
public void userDTOsToUsersMapWithNullAuthoritiesStringShouldReturnUserWithEmptyAuthorities() {
userDto.setAuthorities(null);
List<UserDTO> usersDto = new ArrayList<>();
usersDto.add(userDto);
List<User> users = userMapper.userDTOsToUsers(usersDto);
assertThat(users).isNotEmpty();
assertThat(users).size().isEqualTo(1);
assertThat(users.get(0).getAuthorities()).isNotNull();
assertThat(users.get(0).getAuthorities()).isEmpty();
}
@Test
public void userDTOToUserMapWithAuthoritiesStringShouldReturnUserWithAuthorities() {
Set<String> authoritiesAsString = new HashSet<>();
authoritiesAsString.add("ADMIN");
userDto.setAuthorities(authoritiesAsString);
User user = userMapper.userDTOToUser(userDto);
assertThat(user).isNotNull();
assertThat(user.getAuthorities()).isNotNull();
assertThat(user.getAuthorities()).isNotEmpty();
assertThat(user.getAuthorities().iterator().next().getName()).isEqualTo("ADMIN");
}
@Test
public void userDTOToUserMapWithNullAuthoritiesStringShouldReturnUserWithEmptyAuthorities() {
userDto.setAuthorities(null);
User user = userMapper.userDTOToUser(userDto);
assertThat(user).isNotNull();
assertThat(user.getAuthorities()).isNotNull();
assertThat(user.getAuthorities()).isEmpty();
}
@Test
public void userDTOToUserMapWithNullUserShouldReturnNull() {
assertThat(userMapper.userDTOToUser(null)).isNull();
}
@Test
public void testUserFromId() {
assertThat(userMapper.userFromId(DEFAULT_ID).getId()).isEqualTo(DEFAULT_ID);
assertThat(userMapper.userFromId(null)).isNull();
}
}
| [
"jhipster-bot@jhipster.tech"
] | jhipster-bot@jhipster.tech |
9393ac30cbbe5c8e1e0b960f7604b10848973d0e | 2072403efa96c129553303549d26b808f3262e73 | /PAC-ejb/src/main/java/entities/Incident.java | 82f0187055b961adf0b0fe9baf7581afebfa1b51 | [] | no_license | DP-Team2018/PAC | 4502cf18515c985415c7efe39570840b8b56dc83 | 796af6eca90afa66da88814388823837a02d20bf | refs/heads/master | 2020-03-22T15:47:53.784196 | 2019-02-21T20:27:50 | 2019-02-21T20:27:50 | 140,279,274 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,307 | java | package entities;
import java.io.Serializable;
import java.lang.String;
import java.util.Date;
import javax.persistence.*;
/**
* Entity implementation class for Entity: Incident
*
*/
@Entity
public class Incident implements Serializable {
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Id
private int id;
private Date date_incident;
private String commentaire;
private String jointe;
@OneToOne
private Agent agent;
@OneToOne
private Flux flux;
private static final long serialVersionUID = 1L;
public Incident() {
super();
}
public int getId() {
return this.id;
}
public void setId(int id) {
this.id = id;
}
public Date getDate_incident() {
return this.date_incident;
}
public void setDate_incident(Date date_incident) {
this.date_incident = date_incident;
}
public String getCommentaire() {
return this.commentaire;
}
public void setCommentaire(String commentaire) {
this.commentaire = commentaire;
}
public String getJointe() {
return this.jointe;
}
public void setJointe(String jointe) {
this.jointe = jointe;
}
public Agent getAgent() {
return agent;
}
public void setAgent(Agent agent) {
this.agent = agent;
}
public Flux getFlux() {
return flux;
}
public void setFlux(Flux flux) {
this.flux = flux;
}
}
| [
"35900204+fedichebbi@users.noreply.github.com"
] | 35900204+fedichebbi@users.noreply.github.com |
2f7ccec036a559ea537587f16aba2cc410082636 | 15c2c261e721b9eafc10301bd6461ad3182746a0 | /src/main/java/com/aotuhome/commons/JsonUtil.java | 66d498b8a86a48b69f48ab49e80b7f75899ae70d | [] | no_license | ShallowDreamzrc/autohome | ba03ae8d56316a5b7a5f620c8ef398a9c9f611e8 | 14c2edb4567b7cfac41ac362599ac107a70a582c | refs/heads/master | 2020-04-20T04:46:13.431392 | 2019-03-22T05:56:44 | 2019-03-22T05:56:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,918 | java | package com.aotuhome.commons;
import com.alibaba.fastjson.JSON;
import com.aotuhome.dto.RequestBean;
import org.codehaus.jackson.JsonGenerationException;
import org.codehaus.jackson.map.JsonMappingException;
import org.codehaus.jackson.map.ObjectMapper;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.Map;
public class JsonUtil {
static String jsonData = "";
public static String MapToJson(Map<String, Object> obj) {
ObjectMapper mapper = new ObjectMapper();
try {
jsonData = mapper.writeValueAsString(obj);
} catch (JsonGenerationException e) {
e.printStackTrace();
} catch (JsonMappingException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return jsonData;
}
public static JSONObject JsonToJsonObject(String json){
JSONObject jObject = new JSONObject(json);
return jObject;
}
public static String resultSetToJson(ResultSet rs){
//
JSONArray array = new JSONArray();
//
ResultSetMetaData metaData = null;
try {
metaData = rs.getMetaData();
} catch (SQLException e) {
e.printStackTrace();
}
int columnCount = 0;
try {
columnCount = metaData.getColumnCount();
} catch (SQLException e) {
e.printStackTrace();
}
try {
while (rs.next()) {
JSONObject jsonObj = new JSONObject();
//
for (int i = 1; i <= columnCount; i++) {
String columnName = metaData.getColumnLabel(i);
String value = rs.getString(columnName);
jsonObj.put(columnName, value);
}
array.put(jsonObj);
}
} catch (JSONException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
return array.toString();
}
}
| [
"zhanghuibin@autohome.com.cn"
] | zhanghuibin@autohome.com.cn |
2786ca930fc80eef5970b1180e29258a3cc51b6c | 0633a91895b6c61f4d44832267c29170f6dead63 | /bitcoin-observe/src/main/java/com/sharingif/blockchain/bitcoin/withdrawal/service/impl/WithdrawalServiceImpl.java | 8343f82ca6e1d7830035ae79809a2c71ed8c266b | [] | no_license | xlslin/bcoin-exchange | bd8ec272061d2335d05fe3ca613e576a2e28373e | c93126f6561522df16ac1a1ea742b7bc91323d75 | refs/heads/master | 2020-05-02T10:41:50.316114 | 2019-03-06T09:51:08 | 2019-03-06T09:51:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 20,975 | java | package com.sharingif.blockchain.bitcoin.withdrawal.service.impl;
import com.sharingif.blockchain.api.bitcoin.entity.*;
import com.sharingif.blockchain.api.bitcoin.service.BitCoinApiService;
import com.sharingif.blockchain.bitcoin.account.model.entity.Account;
import com.sharingif.blockchain.bitcoin.account.model.entity.AccountJnl;
import com.sharingif.blockchain.bitcoin.account.model.entity.AccountUnspent;
import com.sharingif.blockchain.bitcoin.account.service.AccountService;
import com.sharingif.blockchain.bitcoin.api.withdrawal.entity.ApplyWithdrawalBitCoinReq;
import com.sharingif.blockchain.bitcoin.api.withdrawal.entity.ApplyWithdrawalBitCoinRsp;
import com.sharingif.blockchain.bitcoin.app.constants.CoinType;
import com.sharingif.blockchain.bitcoin.app.constants.Constants;
import com.sharingif.blockchain.bitcoin.app.exception.InvalidAddressException;
import com.sharingif.blockchain.bitcoin.block.dao.TransactionBusinessDAO;
import com.sharingif.blockchain.bitcoin.block.model.entity.BlockChain;
import com.sharingif.blockchain.bitcoin.block.model.entity.Transaction;
import com.sharingif.blockchain.bitcoin.block.model.entity.TransactionBusiness;
import com.sharingif.blockchain.bitcoin.block.service.BitCoinBlockService;
import com.sharingif.blockchain.bitcoin.block.service.TransactionService;
import com.sharingif.blockchain.bitcoin.withdrawal.dao.WithdrawalDAO;
import com.sharingif.blockchain.bitcoin.withdrawal.model.entity.Withdrawal;
import com.sharingif.blockchain.bitcoin.withdrawal.model.entity.WithdrawalTransaction;
import com.sharingif.blockchain.bitcoin.withdrawal.model.entity.WithdrawalVin;
import com.sharingif.blockchain.bitcoin.withdrawal.model.entity.WithdrawalVout;
import com.sharingif.blockchain.bitcoin.withdrawal.service.WithdrawalService;
import com.sharingif.blockchain.bitcoin.withdrawal.service.WithdrawalTransactionService;
import com.sharingif.cube.batch.core.JobConfig;
import com.sharingif.cube.batch.core.JobModel;
import com.sharingif.cube.batch.core.JobService;
import com.sharingif.cube.core.util.StringUtils;
import com.sharingif.cube.persistence.database.pagination.PaginationCondition;
import com.sharingif.cube.persistence.database.pagination.PaginationRepertory;
import com.sharingif.cube.support.service.base.impl.BaseServiceImpl;
import org.bitcoincore.api.wallet.entity.Unspent;
import org.bitcoinj.core.Base58;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Service
public class WithdrawalServiceImpl extends BaseServiceImpl<Withdrawal, java.lang.String> implements WithdrawalService {
private int omniUsdtProperty;
private WithdrawalDAO withdrawalDAO;
private TransactionService transactionService;
private TransactionBusinessDAO transactionBusinessDAO;
private AccountService accountService;
private JobConfig withdrawalInitNoticeNoticeJobConfig;
private JobConfig withdrawalSuccessNoticeJobConfig;
private JobConfig withdrawalFailureNoticeJobConfig;
private JobService jobService;
private BitCoinApiService bitCoinApiService;
private BitCoinBlockService bitCoinBlockService;
private WithdrawalTransactionService withdrawalTransactionService;
@Value("${omni.usdt.property}")
public void setOmniUsdtProperty(int omniUsdtProperty) {
this.omniUsdtProperty = omniUsdtProperty;
}
@Resource
public void setWithdrawalDAO(WithdrawalDAO withdrawalDAO) {
super.setBaseDAO(withdrawalDAO);
this.withdrawalDAO = withdrawalDAO;
}
@Resource
public void setTransactionBusinessDAO(TransactionBusinessDAO transactionBusinessDAO) {
this.transactionBusinessDAO = transactionBusinessDAO;
}
@Resource
public void setAccountService(AccountService accountService) {
this.accountService = accountService;
}
@Resource
public void setWithdrawalInitNoticeNoticeJobConfig(JobConfig withdrawalInitNoticeNoticeJobConfig) {
this.withdrawalInitNoticeNoticeJobConfig = withdrawalInitNoticeNoticeJobConfig;
}
@Resource
public void setWithdrawalSuccessNoticeJobConfig(JobConfig withdrawalSuccessNoticeJobConfig) {
this.withdrawalSuccessNoticeJobConfig = withdrawalSuccessNoticeJobConfig;
}
@Resource
public void setWithdrawalFailureNoticeJobConfig(JobConfig withdrawalFailureNoticeJobConfig) {
this.withdrawalFailureNoticeJobConfig = withdrawalFailureNoticeJobConfig;
}
@Resource
public void setJobService(JobService jobService) {
this.jobService = jobService;
}
@Resource
public void setBitCoinApiService(BitCoinApiService bitCoinApiService) {
this.bitCoinApiService = bitCoinApiService;
}
@Resource
public void setBitCoinBlockService(BitCoinBlockService bitCoinBlockService) {
this.bitCoinBlockService = bitCoinBlockService;
}
@Resource
public void setWithdrawalTransactionService(WithdrawalTransactionService withdrawalTransactionService) {
this.withdrawalTransactionService = withdrawalTransactionService;
}
@Resource
public void setTransactionService(TransactionService transactionService) {
this.transactionService = transactionService;
}
@Override
public WithdrawalTransactionService getWithdrawalTransactionService() {
return withdrawalTransactionService;
}
@Override
public void addUntreated(TransactionBusiness transactionBusiness) {
transactionBusiness.setType(TransactionBusiness.TYPE_WITHDRAWAL);
transactionBusiness.setStatus(TransactionBusiness.STATUS_UNTREATED);
transactionBusiness.setSettleStatus(TransactionBusiness.SETTLE_STATUS_UNTREATED);
transactionBusiness.setTxStatus(BlockChain.STATUS_UNVERIFIED);
transactionBusinessDAO.insert(transactionBusiness);
withdrawal(transactionBusiness);
}
@Override
public int updateStatusToProcessing(String id) {
Withdrawal withdrawal = new Withdrawal();
withdrawal.setId(id);
withdrawal.setStatus(Withdrawal.STATUS_PROCESSING);
return withdrawalDAO.updateById(withdrawal);
}
@Override
public int updateStatusToNoticing(String id) {
Withdrawal withdrawal = new Withdrawal();
withdrawal.setId(id);
withdrawal.setStatus(Withdrawal.STATUS_NOTICING);
return withdrawalDAO.updateById(withdrawal);
}
@Override
public int updateStatusToSuccessNoticed(String id) {
Withdrawal withdrawal = new Withdrawal();
withdrawal.setId(id);
withdrawal.setStatus(Withdrawal.STATUS_SUCCESS_NOTICED);
return withdrawalDAO.updateById(withdrawal);
}
@Override
public int updateStatusToFailureNoticed(String id) {
Withdrawal withdrawal = new Withdrawal();
withdrawal.setId(id);
withdrawal.setStatus(Withdrawal.STATUS_FAILURE_NOTICED);
return withdrawalDAO.updateById(withdrawal);
}
@Override
public ApplyWithdrawalBitCoinRsp apply(ApplyWithdrawalBitCoinReq req) {
// 校验地址
String btcAddress = req.getAddress();
// 先判断长度是否是34
// if(btcAddress.length() != 34) {
// throw new InvalidAddressException();
// }
try {
Base58.decodeChecked(btcAddress);
} catch (Exception e) {
throw new InvalidAddressException();
}
Withdrawal withdrawal = Withdrawal.convertApplyWithdrawalBitCoinReqToWithdrawal(req);
withdrawal.setStatus(Withdrawal.STATUS_UNTREATED);
withdrawalDAO.insert(withdrawal);
ApplyWithdrawalBitCoinRsp rsp = new ApplyWithdrawalBitCoinRsp();
rsp.setId(withdrawal.getId());
rsp.setWithdrawalId(withdrawal.getWithdrawalId());
return rsp;
}
@Transactional
protected void updateStatusToProcessing(List<Withdrawal> withdrawalList) {
for(Withdrawal withdrawal : withdrawalList) {
updateStatusToProcessing(withdrawal.getId());
}
}
@Transactional
protected void updateWithdrawal(String txHash, BigInteger totalFee, List<AccountUnspent> accountUnspentList, List<Withdrawal> withdrawalList) {
withdrawalTransactionService.addWithdrawalTransaction(txHash, totalFee, accountUnspentList, withdrawalList);
BigInteger withdrawalFee = totalFee.divide(new BigInteger(String.valueOf(withdrawalList.size())));
for(int i=0; i<withdrawalList.size()-1; i++) {
Withdrawal withdrawal = withdrawalList.get(i);
Withdrawal updateWithdrawal = new Withdrawal();
updateWithdrawal.setId(withdrawal.getId());
updateWithdrawal.setTxHash(txHash);
updateWithdrawal.setFee(withdrawalFee);
withdrawalDAO.updateById(updateWithdrawal);
totalFee = totalFee.subtract(withdrawalFee);
}
Withdrawal withdrawal = withdrawalList.get(withdrawalList.size()-1);
Withdrawal updateWithdrawal = new Withdrawal();
updateWithdrawal.setId(withdrawal.getId());
updateWithdrawal.setTxHash(txHash);
updateWithdrawal.setFee(totalFee);
withdrawalDAO.updateById(updateWithdrawal);
}
@Override
public void btc(List<Withdrawal> withdrawalList) {
// 取现总金额
BigInteger withdrawalTotalBalance = BigInteger.ZERO;
for(Withdrawal withdrawal : withdrawalList) {
withdrawalTotalBalance = withdrawalTotalBalance.add(withdrawal.getAmount());
}
// 取现手续费
BigInteger fee = Constants.BTC_COIN_TRANSFOR_FEE;
// 根据取现总金额获取可取现的账号和unspent
List<AccountUnspent> accountUnspentList = accountService.getAccountListByBalance(withdrawalTotalBalance.add(fee));
if(accountUnspentList == null) {
logger.error("withdrawal btc failure, Insufficient balance, withdrawal balance:{}", withdrawalTotalBalance.add(fee));
return;
}
SignMessageReq req = new SignMessageReq();
req.setFee(fee);
List<SignMessageVinReq> vinList = new ArrayList<SignMessageVinReq>(accountUnspentList.size());
for(AccountUnspent accountUnspent : accountUnspentList) {
List<Unspent> unspentList = accountUnspent.getUnspentList();
if(unspentList == null || unspentList.isEmpty()) {
continue;
}
SignMessageVinReq signMessageVinReq = accountUnspent.getSignMessageVinReq();
vinList.add(signMessageVinReq);
}
req.setVinList(vinList);
List<SignMessageVoutReq> voutList = new ArrayList<SignMessageVoutReq>(withdrawalList.size());
for(Withdrawal withdrawal : withdrawalList) {
SignMessageVoutReq signMessageVoutReq = new SignMessageVoutReq();
signMessageVoutReq.setToAddress(withdrawal.getTxTo());
signMessageVoutReq.setAmount(withdrawal.getAmount());
voutList.add(signMessageVoutReq);
}
req.setVoutList(voutList);
SignMessageRsp rsp = bitCoinApiService.signMessage(req);
String hexstring = rsp.getHexValue();
updateStatusToProcessing(withdrawalList);
accountUnspentList.forEach(accountUnspent ->{
accountService.lockAccount(accountUnspent.getAccount().getId());
});
String txHash = bitCoinBlockService.sendRawTransaction(hexstring);
if(StringUtils.isTrimEmpty(txHash)) {
logger.error("withdrawal generate txhash is null, withdrawalList:{}", withdrawalList);
return;
}
updateWithdrawal(txHash, fee, accountUnspentList, withdrawalList);
}
@Transactional
protected void updateWithdrawal(String txHash, BigInteger fee, AccountUnspent accountUnspent, Withdrawal withdrawal) {
withdrawalTransactionService.addWithdrawalTransaction(txHash, fee, accountUnspent, withdrawal);
Withdrawal updateWithdrawal = new Withdrawal();
updateWithdrawal.setId(withdrawal.getId());
updateWithdrawal.setTxHash(txHash);
updateWithdrawal.setFee(fee);
withdrawalDAO.updateById(updateWithdrawal);
}
@Override
public void usdt(List<Withdrawal> withdrawalList) {
withdrawalList.forEach(withdrawal -> {
// 取现手续费
BigInteger fee = Constants.BTC_COIN_TRANSFOR_FEE;
// USDT收款人btc金额
BigInteger tranferToBalance = Constants.USDT_RECIPIENT_BTC_AMOUNT;
AccountUnspent accountUnspent = accountService.getUsdtAccountByBalance(fee.add(tranferToBalance), withdrawal.getAmount());
if(accountUnspent == null) {
logger.error("withdrawal omni failure, Insufficient balance, fee:{},withdrawal balance:{}", fee.add(tranferToBalance), withdrawal.getAmount());
return;
}
OmniSimpleSendSignMessageReq req = new OmniSimpleSendSignMessageReq();
req.setFee(fee);
SignMessageVinReq vin = accountUnspent.getSignMessageVinReq();
req.setVin(vin);
SignMessageVoutReq vout = new SignMessageVoutReq();
vout.setToAddress(withdrawal.getTxTo());
vout.setAmount(tranferToBalance);
req.setVout(vout);
String opReturn = String.format("6f6d6e6900000000%08x%016x", omniUsdtProperty, withdrawal.getAmount());
req.setOpReturn(opReturn);
req.setChange(accountUnspent.getAccount().getAddress());
SignMessageRsp rsp = bitCoinApiService.omniSimpleSendSignMessage(req);
String hexstring = rsp.getHexValue();
updateStatusToProcessing(withdrawal.getId());
accountService.lockAccount(accountUnspent.getAccount().getId());
Account btcAccount = accountService.getAccount(accountUnspent.getAccount().getAddress(), CoinType.BTC.name());
accountService.lockAccount(btcAccount.getId());
String txHash = bitCoinBlockService.sendRawTransaction(hexstring);
if(StringUtils.isTrimEmpty(txHash)) {
logger.error("withdrawal generate txhash is null, withdrawalList:{}", withdrawalList);
return;
}
updateWithdrawal(txHash, fee, accountUnspent, withdrawal);
});
}
@Override
public void withdrawal(TransactionBusiness transactionBusiness) {
accountService.frozenBalance(
transactionBusiness.getTxFrom()
,transactionBusiness.getCoinType()
,transactionBusiness.getAmount()
,transactionBusiness.getTxFrom()
,transactionBusiness.getTxTo()
,AccountJnl.TYPE_WITHDRAWAL
,transactionBusiness.getId()
,transactionBusiness.getTxTime()
);
}
@Transactional
protected void readyInitNotice(WithdrawalTransaction withdrawalTransaction, List<WithdrawalVout> withdrawalVoutList) {
for(WithdrawalVout withdrawalVout : withdrawalVoutList) {
JobModel jobModel = new JobModel();
jobModel.setLookupPath(withdrawalInitNoticeNoticeJobConfig.getLookupPath());
jobModel.setDataId(withdrawalVout.getWithdrawalId());
jobModel.setPlanExecuteTime(new Date());
jobService.add(null, jobModel);
Withdrawal updateWithdrawal = new Withdrawal();
updateWithdrawal.setId(withdrawalVout.getWithdrawalId());
updateWithdrawal.setStatus(Withdrawal.STATUS_INIT_NOTICE);
withdrawalDAO.updateById(updateWithdrawal);
}
withdrawalTransactionService.updateStatusToInitNotice(withdrawalTransaction.getTxHash());
}
@Override
public void readyInitNotice(List<WithdrawalTransaction> withdrawalTransactionList) {
withdrawalTransactionList.forEach(withdrawalTransaction -> {
List<WithdrawalVout> withdrawalVoutList = withdrawalTransactionService.getWithdrawalVoutService().getByTxHash(withdrawalTransaction.getTxHash());
readyInitNotice(withdrawalTransaction, withdrawalVoutList);
});
}
@Transactional
protected void initNotice(String withdrawalId, String txHash) {
Withdrawal updateWithdrawal = new Withdrawal();
updateWithdrawal.setId(withdrawalId);
updateWithdrawal.setStatus(Withdrawal.STATUS_INIT_NOTICED);
withdrawalDAO.updateById(updateWithdrawal);
Withdrawal queryWithdrawal = new Withdrawal();
queryWithdrawal.setTxHash(txHash);
queryWithdrawal.setStatus(Withdrawal.STATUS_INIT_NOTICE);
List<Withdrawal> withdrawalList = withdrawalDAO.queryListForUpdate(queryWithdrawal);
if(withdrawalList == null || withdrawalList.isEmpty()) {
withdrawalTransactionService.updateStatusToInitNoticed(txHash);
}
}
protected void initNotice(Withdrawal withdrawal) {
DepositWithdrawalNoticeReq req = new DepositWithdrawalNoticeReq();
req.setId(withdrawal.getId());
req.setCoinType(withdrawal.getCoinType());
req.setTxTo(withdrawal.getTxTo());
req.setAmount(withdrawal.getAmount());
req.setStatus(DepositWithdrawalNoticeReq.STATUS_PROCESSING);
bitCoinApiService.depositWithdrawalNotice(req);
initNotice(withdrawal.getId(), withdrawal.getTxHash());
}
@Override
public void initNotice(String id) {
Withdrawal withdrawal = withdrawalDAO.queryById(id);
if(!Withdrawal.STATUS_INIT_NOTICE.equals(withdrawal.getStatus())) {
return;
}
initNotice(withdrawal);
}
protected void withdrawalSuccess(TransactionBusiness transactionBusiness) {
accountService.subtractFrozenBalance(
transactionBusiness.getTxFrom()
,transactionBusiness.getCoinType()
,transactionBusiness.getAmount()
,transactionBusiness.getTxFrom()
,transactionBusiness.getTxTo()
,transactionBusiness.getId()
,transactionBusiness.getTxTime()
);
}
protected void withdrawalFailure(TransactionBusiness transactionBusiness) {
accountService.unFrozenBalance(
transactionBusiness.getTxFrom()
,transactionBusiness.getCoinType()
,transactionBusiness.getAmount()
,transactionBusiness.getTxFrom()
,transactionBusiness.getTxTo()
,AccountJnl.TYPE_WITHDRAWAL_REBACK
,transactionBusiness.getId()
,transactionBusiness.getTxTime()
);
}
@Override
public void withdrawalConfirmed(TransactionBusiness transactionBusiness, String txStatus) {
if(BlockChain.STATUS_VERIFY_VALID.equals(txStatus)) {
withdrawalSuccess(transactionBusiness);
} else {
withdrawalFailure(transactionBusiness);
}
}
@Transactional
protected void finishNotice(TransactionBusiness transactionBusiness) {
TransactionBusiness updateTransactionBusiness = new TransactionBusiness();
updateTransactionBusiness.setId(transactionBusiness.getId());
updateTransactionBusiness.setStatus(TransactionBusiness.STATUS_FINISH_NOTICED);
transactionBusinessDAO.updateById(updateTransactionBusiness);
WithdrawalTransaction withdrawalTransaction = withdrawalTransactionService.getById(transactionBusiness.getTxHash());
if(withdrawalTransaction == null) {
return;
}
int withdrawalVinCount = withdrawalTransactionService.getWithdrawalVinService().getCountByTxHash(transactionBusiness.getTxHash());
int transactionBusinessCount = transactionBusinessDAO.queryCountByTxHashTypeStatus(transactionBusiness.getTxHash(), TransactionBusiness.TYPE_WITHDRAWAL ,TransactionBusiness.STATUS_FINISH_NOTICED);
// 解锁取现时锁定的账号
accountService.unLockAccount(transactionBusiness.getTxFrom(), transactionBusiness.getCoinType());
if(withdrawalVinCount == transactionBusinessCount) {
withdrawalTransactionService.updateStatusToSuccess(transactionBusiness.getTxHash());
Withdrawal updateWithdrawal = new Withdrawal();
updateWithdrawal.setTxHash(transactionBusiness.getTxHash());
updateWithdrawal.setTxTime(transactionBusiness.getTxTime());
updateWithdrawal.setStatus(Withdrawal.STATUS_SUCCESS);
withdrawalDAO.updateByTxHash(updateWithdrawal);
}
}
@Override
public void finishNotice(List<TransactionBusiness> transactionBusinessList) {
transactionBusinessList.forEach(transactionBusiness -> {
finishNotice(transactionBusiness);
});
}
@Transactional
protected void readyWithdrawalNotice(Withdrawal withdrawal, JobConfig jobConfig) {
updateStatusToNoticing(withdrawal.getId());
JobModel jobModel = new JobModel();
jobModel.setLookupPath(jobConfig.getLookupPath());
jobModel.setDataId(withdrawal.getId());
jobModel.setPlanExecuteTime(withdrawal.getTxTime());
jobService.add(null, jobModel);
}
@Override
public void readyWithdrawalSuccessNotice(List<Withdrawal> withdrawalList) {
withdrawalList.forEach(withdrawal -> {
readyWithdrawalNotice(withdrawal, withdrawalSuccessNoticeJobConfig);
});
}
@Override
public void withdrawalSuccessNotice(String id) {
Withdrawal withdrawal = getById(id);
Transaction transaction = transactionService.getVerifyValidStatusByTxHash(withdrawal.getTxHash());
DepositWithdrawalNoticeReq req = new DepositWithdrawalNoticeReq();
req.setId(withdrawal.getId());
req.setBlockNumber(transaction.getBlockNumber());
req.setBlockHash(transaction.getBlockHash());
req.setTxHash(withdrawal.getTxHash());
req.setTxIndex(transaction.getTxIndex());
req.setCoinType(withdrawal.getCoinType());
req.setTxTo(withdrawal.getTxTo());
req.setAmount(withdrawal.getAmount());
req.setFee(withdrawal.getFee());
req.setStatus(DepositWithdrawalNoticeReq.STATUS_SUCCESS);
bitCoinApiService.depositWithdrawalNotice(req);
updateStatusToSuccessNoticed(id);
}
@Override
public void readyWithdrawalFailureNotice(List<Withdrawal> withdrawalList) {
withdrawalList.forEach(withdrawal -> {
readyWithdrawalNotice(withdrawal, withdrawalFailureNoticeJobConfig);
});
}
@Override
public void withdrawalFailureNotice(String id) {
// 发送通知信息
Withdrawal withdrawal = getById(id);
DepositWithdrawalNoticeReq req = new DepositWithdrawalNoticeReq();
req.setId(withdrawal.getId());
req.setTxHash(withdrawal.getTxHash());
req.setCoinType(withdrawal.getCoinType());
req.setTxTo(withdrawal.getTxTo());
req.setAmount(withdrawal.getAmount());
req.setStatus(DepositWithdrawalNoticeReq.STATUS_FAIL);
bitCoinApiService.depositWithdrawalNotice(req);
updateStatusToFailureNoticed(id);
}
}
| [
"JolyEmail@Gmail.COM"
] | JolyEmail@Gmail.COM |
1c51595507f0cb17d5d387b9bc82ebfc845d0c1e | d12bdaf7828d063811bd551bc52faf17bf56d1fc | /src/PlasticCheese.java | 538c03c99ba99625a526b4152a40959355341d5a | [] | no_license | multible/Pizzeria-Abstract-Factory | c3ab3cb9aea24149c5c3c712e6034877b6d5736e | 093d1f68cdc79776da55d11b29d1e0d9218f5560 | refs/heads/main | 2023-01-25T00:29:22.585080 | 2020-12-08T20:13:59 | 2020-12-08T20:13:59 | 319,719,021 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 111 | java |
public class PlasticCheese implements PCheese{
public String toString() {
return "Plastic Cheese";
}
}
| [
"christophreinartz@gmx.de"
] | christophreinartz@gmx.de |
5adb24891ca7de1e4cd3486dcc7b038d622b2f5f | 2aa0f87be7b0b05bd66a360b249b43f412bf41ac | /src/test/java/controller/command/PrepareCabinetCommandTest.java | 9c35a81ff27d6df9e56ef05a05f779b7bf09a061 | [] | no_license | HrudenIvan/library_servlet | 06e386070607d8506dc67aff2c77dbeec3d6d3ed | 916d632b19eddd149789643847732be711ac5286 | refs/heads/main | 2023-08-11T07:03:25.397137 | 2021-10-05T22:16:42 | 2021-10-05T22:16:42 | 403,625,952 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,559 | java | package controller.command;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import javax.servlet.RequestDispatcher;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.junit.Test;
import org.mockito.MockedStatic;
import org.mockito.Mockito;
import dao.OrderDAOMock;
import dao.UserDAOMock;
import model.DAO.OrderDAOImpl;
import model.DAO.UserDAOImpl;
public class PrepareCabinetCommandTest {
@Test
public void executeShouldForvardToPrivateCabinetPage() throws Exception {
HttpServletRequest req = mock(HttpServletRequest.class);
HttpServletResponse resp = mock(HttpServletResponse.class);
RequestDispatcher reqDisp = mock(RequestDispatcher.class);
HttpSession session = mock(HttpSession.class);
when(req.getSession()).thenReturn(session);
when(session.getAttribute("currentUserId")).thenReturn(1L);
when(req.getRequestDispatcher("privateCabinet.jsp")).thenReturn(reqDisp);
try (MockedStatic<UserDAOImpl> userDAOMock = Mockito.mockStatic(UserDAOImpl.class)) {
userDAOMock.when(() -> UserDAOImpl.getInstance()).thenReturn(new UserDAOMock());
try (MockedStatic<OrderDAOImpl> orderDAOMock = Mockito.mockStatic(OrderDAOImpl.class)) {
orderDAOMock.when(() -> OrderDAOImpl.getInstance()).thenReturn(new OrderDAOMock());
Command com = CommandFactory.getCommand("prepareCabinet");
com.execute(req, resp);
verify(reqDisp).forward(req, resp);
}
}
}
}
| [
"Hruden.Ivan@gmail.com"
] | Hruden.Ivan@gmail.com |
51bf38c2797d6ee1aed5d06cde36047dba5cd26e | 31733383fe875555f0536a55b6cbbce34618d88d | /src/main/java/com/goosen1/commons/model/commons/ParameterInvalidItem.java | 1001d814b2300ec6c01c95a8d1a6e88d9ae3ce22 | [
"MIT"
] | permissive | goosen123/frame-service-demo1 | c8f720868958af69586d10bd8d3b554934c6e427 | b12d7ab0238a156ffe569d2a1552977c46b12f5e | refs/heads/master | 2020-03-14T01:41:26.336397 | 2018-06-22T09:26:32 | 2018-06-22T09:26:32 | 131,382,809 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 885 | java | package com.goosen1.commons.model.commons;
//import lombok.AllArgsConstructor;
//import lombok.Builder;
//import lombok.Data;
//import lombok.NoArgsConstructor;
/**
* 参数无效项
* @author Goosen
* 2018年6月6日-下午3:28:39
*/
//@Builder
//@AllArgsConstructor
//@NoArgsConstructor
//@Data
public class ParameterInvalidItem {
/**
* 无效字段的名称
*/
private String fieldName;
/**
* 错误信息
*/
private String message;
public ParameterInvalidItem() {
}
public ParameterInvalidItem(String fieldName,String message) {
this.fieldName = fieldName;
this.message = message;
}
public String getFieldName() {
return fieldName;
}
public void setFieldName(String fieldName) {
this.fieldName = fieldName;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}
| [
"2630344884@qq.com"
] | 2630344884@qq.com |
eff6599260ea5a9efe4a597c88069449485fe226 | 271faef941cd2b4c68fe6ee67f0ed79c120f1f70 | /CouponSystemWeb/src/couponSystemServices/Credentials.java | 889a32436a64190ac636f6bd808f47e1820ee0db | [] | no_license | eliKnaffo/CouponSystemWeb | 766d95401ff906de43890ba3f76626be7f1158ad | 3c4956e5f2584d33aec4268418366f0aa9093aeb | refs/heads/master | 2021-12-10T18:06:21.001976 | 2021-12-08T12:00:02 | 2021-12-08T12:00:02 | 182,822,826 | 0 | 0 | null | 2019-04-22T16:22:08 | 2019-04-22T16:08:56 | Java | UTF-8 | Java | false | false | 1,091 | java | package couponSystemServices;
import javax.ws.rs.Consumes;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import system.core.javabeans.ClientType;
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public class Credentials {
public String name;
public String password;
public ClientType clientType;
public Credentials() {
super();
}
public Credentials(String name, String password, ClientType clientType) {
super();
this.name = name;
this.password = password;
this.clientType = clientType;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public ClientType getClientType() {
return clientType;
}
public void setClientType(ClientType clientType) {
this.clientType = clientType;
}
@Override
public String toString() {
return "Credentials [name=" + name + ", password=" + password + ", clientType=" + clientType + "]";
}
}
| [
"eli.knaffo@gmail.com"
] | eli.knaffo@gmail.com |
b4a6fefaa73132afa426d91e7bcabaaa9e116fd2 | e5b64499795c6b1a3ad2e5a8dd151e11ff90ba7a | /Myssm_ZBZ/src/com/ssh/user/controller/DMSGController.java | b35347b99213d8541e868364d6a16bfc5d76a2b4 | [] | no_license | suhaihao/projects- | 0d27cc401f9e74d2b502a441b0f18798fbd37b6d | d63057b1c035ebd639abde88994198ba7708d299 | refs/heads/master | 2020-04-09T11:40:52.835243 | 2018-12-04T09:28:53 | 2018-12-04T09:28:53 | 160,319,763 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 56,027 | java | package com.ssh.user.controller;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.context.ServletConfigAware;
import org.springframework.web.context.ServletContextAware;
import com.jspsmart.upload.SmartUpload;
import com.ssh.user.model.DDJ01;
import com.ssh.user.model.DDJ02;
import com.ssh.user.model.DMSG;
import com.ssh.user.model.DMSG_NR;
import com.ssh.user.model.DSYS05;
import com.ssh.user.model.Dsys01;
import com.ssh.user.model.Dsys11;
import com.ssh.user.model.User;
import com.ssh.user.service.DDJ01Service;
import com.ssh.user.service.DDJ02Service;
import com.ssh.user.service.DSYS05Service;
import com.ssh.user.service.Dsys01Service;
import com.ssh.user.service.Dsys11Service;
import com.ssh.user.service.UserService;
import com.ssh.user.util.CopeFile;
import com.ssh.user.util.EHCache;
import com.ssh.user.util.Page;
@Controller
@Scope("prototype")
@RequestMapping(value = "/onlin")
public class DMSGController implements ServletConfigAware, ServletContextAware {
@Autowired
private DDJ02Service dDJ02Service;
@Autowired
private UserService userService;
@Autowired
private DDJ01Service dDJ01Service;
@Autowired
private Dsys01Service dsys01Service;
@Autowired
private Dsys11Service dsys11Service;
@Autowired
private DSYS05Service dSYS05Service;
private ServletContext servletContext;
private ServletConfig servletConfig;
private EHCache eHCache = new EHCache("ehcacheMenu_zbz");
private EHCache eHCacheMSG = new EHCache("ehcacheMSG");
private EHCache ehcacheMSG_INFO = new EHCache("ehcacheMSG_INFO");
@Override
public void setServletContext(ServletContext arg0) {
this.servletContext = arg0;
}
@Override
public void setServletConfig(ServletConfig arg0) {
this.servletConfig = arg0;
}
@RequestMapping(value = "/sel.do")
public String OnlinSel(HttpServletRequest request,
HttpServletResponse response, Model model,
@ModelAttribute("msg") String msg) {
request.setAttribute("msg", msg);
User user = (User) request.getSession().getAttribute("user");
String KEY = user.getXXDBLB() + "," + user.getJFID();
String str;
try {
str = (String) eHCacheMSG.getCacheElement(KEY);
Page page = null;
if (str != null) {
JSONArray array = JSONArray.fromObject(str);
List<DMSG> listdmsg = JSONArray.toList(array, DMSG.class);
String ys = request.getParameter("page");
if (ys == null) {
page = new Page(10, listdmsg.size(), 1);
} else {
page = new Page(10, Integer.parseInt(request
.getParameter("allSize")), Integer.parseInt(ys));
}
request.setAttribute("page", page);
List<DMSG> listdNew = new ArrayList<DMSG>();
for (int i = page.getMin() - 1; i < listdmsg.size(); i++) {
listdNew.add(listdmsg.get(i));
if (i - page.getMin() - 1 == 10) {
break;
}
}
request.setAttribute("listdmsg", listdNew);
} else {
page = new Page(10, 1, 1);
request.setAttribute("page", page);
}
} catch (Exception e) {
e.printStackTrace();
}
return "jf_dmsg";
}
@RequestMapping(value = "/selNH.do")
public String nhjh(HttpServletRequest request, HttpServletResponse response) {
String MC = request.getParameter("MC");
String DDJ01_JFID = request.getParameter("DDJ01_JFID");
String DDJ01_MC = request.getParameter("DDJ01_MC");
String XZQH = request.getParameter("XZQH");
String XZQHMC = request.getParameter("XZQHMC");
if (DDJ01_MC != null) {
try {
DDJ01_MC = new String(DDJ01_MC.getBytes("ISO8859-1"), "GBK");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
request.setAttribute("DDJ01_MC", DDJ01_MC);
}
if (XZQHMC != null) {
try {
XZQHMC = new String(XZQHMC.getBytes("ISO8859-1"), "GBK");
request.setAttribute("XZQHMC", XZQHMC);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
Map<String, Object> map = new HashMap<String, Object>();
String ys = request.getParameter("page");
String dfw02 = request.getParameter("dfw02");
if (dfw02 != null) {
request.setAttribute("dfw02", dfw02);
}
Page page = null;
if (ys == null) {
if (MC != null) {
map.put("MC", MC);
request.setAttribute("MC", MC);
}
if (DDJ01_JFID != null) {
map.put("DDJ01_JFID", DDJ01_JFID);
request.setAttribute("DDJ01_JFID", DDJ01_JFID);
}
if (XZQH != null) {
map.put("XZQH", XZQH);
request.setAttribute("XZQH", XZQH);
}
page = new Page(10,dDJ02Service.getCountSelectAll(map), 1);
} else {
if (MC == null&&XZQH==null&&DDJ01_JFID==null) {
page = new Page(10, Integer.parseInt(request
.getParameter("allSize")), Integer.parseInt(ys));
} else {
if (MC != null) {
map.put("MC", MC);
request.setAttribute("MC", MC);
}
if (DDJ01_JFID != null) {
map.put("DDJ01_JFID", DDJ01_JFID);
request.setAttribute("DDJ01_JFID", DDJ01_JFID);
}
if (XZQH != null) {
map.put("XZQH", XZQH);
request.setAttribute("XZQH", XZQH);
}
page = new Page(10,dDJ02Service.getCountSelectAll(map),Integer.parseInt(ys));
}
}
request.setAttribute("page", page);
map.put("max", page.getMax());
map.put("min", page.getMin());
List<DDJ02> listddj02 = dDJ02Service.SelectAll(map);
request.setAttribute("listddj02", listddj02);
return "ddj02_add_MSG";
}
@RequestMapping(value = "/selZFZZandRY.do")
public String selZFZZandRY(HttpServletRequest request,
HttpServletResponse response) {
String JFID = request.getParameter("JFID");
User user = (User) request.getSession().getAttribute("user");
String JFNAME = request.getParameter("JFNAME");
if (JFNAME != null && !JFNAME.equals("")) {
try {
JFNAME = new String(JFNAME.getBytes("ISO8859-1"), "GBK");
request.setAttribute("JFNAME", JFNAME);
} catch (UnsupportedEncodingException e1) {
e1.printStackTrace();
}
}
String XXDBLB = request.getParameter("XXDBLB");
String DDJ01_JFID = request.getParameter("DDJ01_JFID");
if (DDJ01_JFID == null) {
DDJ01_JFID = user.getDDJ01_JFID();
}
String ys = request.getParameter("page");
Map<String, Object> map = new HashMap<String, Object>();
Page page = null;
if (ys == null) {
if (JFNAME != null) {
map.put("JFNAME", JFNAME);
request.setAttribute("JFNAME", JFNAME);
}
if (JFID != null) {
map.put("JFID", JFID);
request.setAttribute("JFID", JFID);
}
if (XXDBLB != null) {
map.put("XXDBLB", XXDBLB);
request.setAttribute("XXDBLB", XXDBLB);
}
if (DDJ01_JFID != null) {
map.put("DDJ01_JFID", DDJ01_JFID);
request.setAttribute("DDJ01_JFID", DDJ01_JFID);
}
page = new Page(10, userService.getCountAllSize(map), 1);
} else {
if (JFNAME == null && DDJ01_JFID == null && XXDBLB == null
&& JFID == null) {
page = new Page(10, Integer.parseInt(request
.getParameter("allSize")), Integer.parseInt(ys));
} else {
if (JFNAME != null) {
map.put("JFNAME", JFNAME);
request.setAttribute("JFNAME", JFNAME);
}
if (XXDBLB != null) {
map.put("XXDBLB", XXDBLB);
request.setAttribute("XXDBLB", XXDBLB);
}
if (DDJ01_JFID != null) {
map.put("DDJ01_JFID", DDJ01_JFID);
request.setAttribute("DDJ01_JFID", DDJ01_JFID);
}
if (JFID != null) {
map.put("JFID", JFID);
request.setAttribute("JFID", JFID);
}
page = new Page(10, userService.getCountAllSize(map),
Integer.parseInt(ys));
}
}
request.setAttribute("page", page);
map.put("MAX", page.getMax());
map.put("MIN", page.getMin());
List<User> listUser = userService.SelectAllList(map);
request.setAttribute("listUser", listUser);
List<DDJ01> listddj01 = dDJ01Service.SelectAlllSize();
request.setAttribute("listddj01", listddj01);
return "users_add_MSG";
}
@RequestMapping(value = "/selZFZZ.do")
public String selZFZZ(HttpServletRequest request,
HttpServletResponse response) {
User user = (User) request.getSession().getAttribute("user");
String JFID = "";
if (user.getXXDBLB().equals("3")) {
JFID = user.getDDJ01_JFID();
}
String MC = request.getParameter("MC");
if (MC != null && !MC.equals("")) {
try {
MC = new String(MC.getBytes("ISO8859-1"), "GBK");
request.setAttribute("MC", MC);
} catch (UnsupportedEncodingException e1) {
e1.printStackTrace();
}
}
String ys = request.getParameter("page");
Map<String, Object> map = new HashMap<String, Object>();
Page page = null;
if (ys == null) {
if (MC != null) {
map.put("MC", MC);
}
if (JFID != null) {
map.put("JFID", JFID);
}
page = new Page(10, dDJ01Service.getCount(map), 1);
} else {
if (MC == null) {
page = new Page(10, Integer.parseInt(request
.getParameter("allSize")), Integer.parseInt(ys));
} else {
if (JFID != null) {
map.put("JFID", JFID);
}
if (MC != null) {
map.put("MC", MC);
}
page = new Page(10, dDJ01Service.getCount(map),
Integer.parseInt(ys));
}
}
request.setAttribute("page", page);
map.put("MAX", page.getMax());
map.put("MIN", page.getMin());
List<DDJ01> listddj01 = dDJ01Service.SelectAllZFZZ(map);
request.setAttribute("listddj01", listddj01);
return "users_add_MSG_ZFZZ";
}
@RequestMapping(value = "/selZFYR.do")
public void selZFYR(HttpServletRequest request, HttpServletResponse response) {
String DDJ01_JFID = request.getParameter("id");
String MC = request.getParameter("mc");
String XXDBLB = "3";
Map<String, Object> map = new HashMap<String, Object>();
if (XXDBLB != null) {
map.put("XXDBLB", XXDBLB);
}
if (DDJ01_JFID != null) {
map.put("DDJ01_JFID", DDJ01_JFID);
}
map.put("MAX", 10);
map.put("MIN", 1);
List<User> listUser = userService.SelectAllList(map);
if (listUser.size() >= 1) {
User user = listUser.get(0);
String str = user.getJFID() + "," + MC + "," + user.getXXDBLB()
+ "," + user.getZPLJ();
try {
response.setCharacterEncoding("UTF-8");
response.getWriter().println(str);
} catch (IOException e) {
e.printStackTrace();
}
} else {
try {
response.getWriter().println("0");
} catch (IOException e) {
e.printStackTrace();
}
}
}
@SuppressWarnings("unchecked")
@RequestMapping(value = "/selZBZandRY.do")
public String selZBZandRY(HttpServletRequest request,
HttpServletResponse response) {
String JFNAME = request.getParameter("JFNAME");
if (JFNAME != null && !JFNAME.equals("")) {
try {
JFNAME = new String(JFNAME.getBytes("ISO8859-1"), "GBK");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
String RYFL = request.getParameter("RYFL");
String XXDBLB = request.getParameter("XXDBLB");
String ys = request.getParameter("page");
Map<String, Object> map = new HashMap<String, Object>();
Page page = null;
if (ys == null) {
if (JFNAME != null) {
map.put("JFNAME", JFNAME);
request.setAttribute("JFNAME", JFNAME);
}
if (RYFL != null) {
map.put("RYFL", RYFL);
request.setAttribute("RYFL", RYFL);
}
if (XXDBLB != null) {
map.put("XXDBLB", XXDBLB);
request.setAttribute("XXDBLB", XXDBLB);
}
page = new Page(10, dsys01Service.GetCount(map), 1);
} else {
if (JFNAME != null) {
map.put("JFNAME", JFNAME);
request.setAttribute("JFNAME", JFNAME);
}
if (RYFL != null) {
map.put("RYFL", RYFL);
request.setAttribute("RYFL", RYFL);
}
if (XXDBLB != null) {
map.put("XXDBLB", XXDBLB);
request.setAttribute("XXDBLB", XXDBLB);
}
page = new Page(10, dsys01Service.GetCount(map),
Integer.parseInt(ys));
}
request.setAttribute("page", page);
map.put("MAX", page.getMax());
map.put("MIN", page.getMin());
if (XXDBLB.equals("0")) {
List<Dsys01> listdsys01 = dsys01Service.SelectAllPage_ZBZ(map);
for (int i = 0; i < listdsys01.size(); i++) {
listdsys01.get(i).setJFDSYS05_CODE(
listdsys01.get(i).getJFDSYS05_CODE() + "植保站");
}
request.setAttribute("listdsys01", listdsys01);
} else {
List<Dsys01> listdsys01 = dsys01Service.SelectAllPage(map);
request.setAttribute("listdsys01", listdsys01);
}
try {
if (eHCache.getCacheElement("listzj_rylb") == null) {
List<Dsys11> listzj_rylb = dsys11Service
.SelecetAllBM("ZJ_RYLB");
request.setAttribute("listzj_rylb", listzj_rylb);
eHCache.addToCache("listzj_rylb", listzj_rylb, false);
} else {
List<Dsys11> listzj_rylb;
listzj_rylb = (List<Dsys11>) eHCache
.getCacheElement("listzj_rylb");
request.setAttribute("listzj_rylb", listzj_rylb);
}
} catch (Exception e) {
e.printStackTrace();
}
return "users_zbz_MSG";
}
@SuppressWarnings("unchecked")
@RequestMapping(value = "/addmsg.do")
public String addMSG(HttpServletRequest request,
HttpServletResponse response, Model model) {
try {
if (request.getParameter("DF_JFID") != null) {
User user = (User) request.getSession().getAttribute("user");
DSYS05 dSYS05 = dSYS05Service.SelectByBM(user
.getJFDSYS05_CODE());
String SZ_LB = user.getXXDBLB();
String SZ_JFID = user.getJFID() + "";
String SZ_MC = "";
if (user.getXXDBLB().equals("0")) {
SZ_MC = dSYS05.getText() + "植保站";
} else if (user.getXXDBLB().equals("1")) {
SZ_MC = dSYS05.getText() + "植保站" + ":" + user.getJFNAME();
}
String SZ_TX_LJ = user.getZPLJ();
String DF_LB = request.getParameter("DF_LB");
String DF_JFID = request.getParameter("DF_JFID");
String DF_MC = request.getParameter("DF_MC");
String DF_TX_LJ = request.getParameter("DF_TX_LJ");
String NR = request.getParameter("NR");
try {
DF_MC = new String(DF_MC.getBytes("ISO8859-1"), "GBK");
NR = new String(NR.getBytes("ISO8859-1"), "GBK");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
SimpleDateFormat sdf = new SimpleDateFormat("yy-MM-dd HH:mm:ss");
// 内存key
String KEY = SZ_LB + "," + SZ_JFID;
// mapkey
String MAPKEY = SZ_LB + "," + SZ_JFID + "," + DF_LB + ","
+ DF_JFID;
// 对方的内存key
String KEY_DF = DF_LB + "," + DF_JFID;
// 对方mapkey
String MAPKEY_DF = DF_LB + "," + DF_JFID + "," + SZ_LB + ","
+ SZ_JFID;
if (eHCacheMSG.getCacheElement(KEY) == null) {
List<DMSG> list = new ArrayList<DMSG>();
DMSG dMSG = new DMSG();
dMSG.setSZ_LB(SZ_LB);
dMSG.setSZ_JFID(SZ_JFID);
dMSG.setSZ_MC(SZ_MC);
dMSG.setSZ_TX_LJ(SZ_TX_LJ);
dMSG.setFS_RQ(sdf.format(new Date()));
dMSG.setNR_LB("0");
dMSG.setNR(NR);
dMSG.setDF_LB(DF_LB);
dMSG.setDF_JFID(DF_JFID);
dMSG.setDF_MC(DF_MC);
dMSG.setDF_TX_LJ(DF_TX_LJ);
dMSG.setJLS_WEB(0);
dMSG.setJLS_SJ(1);
dMSG.setList(MAPKEY);
dMSG.setFX("0");
list.add(dMSG);
eHCacheMSG.getCache().remove(KEY);
eHCacheMSG.addToCache(KEY, JSONArray.fromObject(list)
.toString(), true);
List<DMSG_NR> listnr = new ArrayList<DMSG_NR>();
DMSG_NR dMSG_NR = new DMSG_NR();
dMSG_NR.setFS_RQ(sdf.format(new Date()));
dMSG_NR.setNR(NR);
dMSG_NR.setFX("0");
listnr.add(dMSG_NR);
ehcacheMSG_INFO.getCache().remove(MAPKEY);
ehcacheMSG_INFO.addToCache(MAPKEY,
JSONArray.fromObject(listnr).toString(), true);
// 插入其他人的
if (eHCacheMSG.getCacheElement(KEY_DF) == null) {
List<DMSG> listQT = new ArrayList<DMSG>();
DMSG dMSGQT = new DMSG();
dMSGQT.setSZ_LB(DF_LB);
dMSGQT.setSZ_JFID(DF_JFID);
dMSGQT.setSZ_MC(DF_MC);
dMSGQT.setSZ_TX_LJ(DF_TX_LJ);
dMSGQT.setFS_RQ(sdf.format(new Date()));
dMSGQT.setNR_LB("0");
dMSGQT.setNR(NR);
dMSGQT.setDF_LB(SZ_LB);
dMSGQT.setDF_JFID(SZ_JFID);
dMSGQT.setDF_MC(SZ_MC);
dMSGQT.setDF_TX_LJ(SZ_TX_LJ);
dMSGQT.setJLS_WEB(1);
dMSGQT.setJLS_SJ(1);
dMSGQT.setFX("1");
dMSGQT.setList(MAPKEY_DF);
listQT.add(dMSGQT);
eHCacheMSG.getCache().remove(KEY_DF);
eHCacheMSG.addToCache(KEY_DF,
JSONArray.fromObject(listQT).toString(), true);
List<DMSG_NR> listnrQT = new ArrayList<DMSG_NR>();
DMSG_NR dMSG_NRQT = new DMSG_NR();
dMSG_NRQT.setFS_RQ(sdf.format(new Date()));
dMSG_NRQT.setNR(NR);
dMSG_NRQT.setFX("1");
listnrQT.add(dMSG_NRQT);
ehcacheMSG_INFO.getCache().remove(MAPKEY_DF);
ehcacheMSG_INFO.addToCache(MAPKEY_DF, JSONArray
.fromObject(listnrQT).toString(), true);
} else {
boolean isAddQT = true;
String str_DF = (String) eHCacheMSG
.getCacheElement(KEY_DF);
JSONArray array_DF = JSONArray.fromObject(str_DF);
List<DMSG> listQT = JSONArray.toList(array_DF,
DMSG.class);
if (listQT.get(0) == null) {
listQT = new ArrayList<DMSG>();
}
// 修改其他人
if (eHCacheMSG.getCacheElement(KEY_DF) != null) {
for (int i = 0; i < listQT.size(); i++) {
if (listQT.get(i).getDF_JFID().equals(DF_JFID)
&& listQT.get(i).getDF_LB()
.equals(DF_LB)
|| listQT.get(i).getDF_JFID()
.equals(SZ_JFID)
&& listQT.get(i).getDF_LB()
.equals(SZ_LB)) {
DMSG dMSGQT = listQT.get(i);
listQT.remove(i);
dMSGQT.setFS_RQ(sdf.format(new Date()));
dMSGQT.setNR_LB("0");
dMSGQT.setNR(NR);
dMSGQT.setJLS_WEB(dMSGQT.getJLS_WEB() + 1);
dMSGQT.setJLS_SJ(dMSGQT.getJLS_SJ() + 1);
listQT.add(0, dMSGQT);
eHCacheMSG.getCache().remove(KEY_DF);
eHCacheMSG.addToCache(KEY_DF, JSONArray
.fromObject(listQT).toString(),
true);
String str_info = (String) ehcacheMSG_INFO
.getCacheElement(MAPKEY_DF);
JSONArray arrayinfo = JSONArray
.fromObject(str_info);
List<DMSG_NR> listnrQT = JSONArray.toList(
arrayinfo, DMSG_NR.class);
DMSG_NR dMSG_NRQT = new DMSG_NR();
dMSG_NRQT.setFS_RQ(sdf.format(new Date()));
dMSG_NRQT.setNR(NR);
dMSG_NRQT.setFX("1");
listnrQT.add(dMSG_NRQT);
ehcacheMSG_INFO.getCache().remove(MAPKEY_DF);
ehcacheMSG_INFO.addToCache(MAPKEY_DF,
JSONArray.fromObject(listnrQT)
.toString(), true);
isAddQT = false;
break;
}
}
}
// 判断是否要添加其他人
if (isAddQT) {
DMSG dMSGQT = new DMSG();
dMSGQT.setSZ_LB(DF_LB);
dMSGQT.setSZ_JFID(DF_JFID);
dMSGQT.setSZ_MC(DF_MC);
dMSGQT.setSZ_TX_LJ(DF_TX_LJ);
dMSGQT.setFS_RQ(sdf.format(new Date()));
dMSGQT.setNR_LB("0");
dMSGQT.setNR(NR);
dMSGQT.setDF_LB(SZ_LB);
dMSGQT.setDF_JFID(SZ_JFID);
dMSGQT.setDF_MC(SZ_MC);
dMSGQT.setDF_TX_LJ(SZ_TX_LJ);
dMSGQT.setJLS_WEB(1);
dMSGQT.setJLS_SJ(1);
dMSGQT.setFX("1");
dMSGQT.setList(MAPKEY_DF);
listQT.add(0, dMSGQT);
eHCacheMSG.getCache().remove(KEY_DF);
eHCacheMSG.addToCache(KEY_DF,
JSONArray.fromObject(listQT).toString(),
true);
List<DMSG_NR> listnrQT = new ArrayList<DMSG_NR>();
DMSG_NR dMSG_NRQT = new DMSG_NR();
dMSG_NRQT.setFS_RQ(sdf.format(new Date()));
dMSG_NRQT.setNR(NR);
dMSG_NRQT.setFX("1");
listnrQT.add(dMSG_NRQT);
ehcacheMSG_INFO.getCache().remove(MAPKEY_DF);
ehcacheMSG_INFO.addToCache(MAPKEY_DF, JSONArray
.fromObject(listnrQT).toString(), true);
}
}
} else {
String str = (String) eHCacheMSG.getCacheElement(KEY);
JSONArray array = JSONArray.fromObject(str);
List<DMSG> list = JSONArray.toList(array, DMSG.class);
boolean isAdd = true;
for (int i = 0; i < list.size(); i++) {
if (list.get(i).getDF_JFID().equals(DF_JFID)
&& list.get(i).getDF_LB().equals(DF_LB)
|| list.get(i).getDF_JFID().equals(SZ_JFID)
&& list.get(i).getDF_LB().equals(SZ_LB)) {
DMSG dMSG = list.get(i);
list.remove(i);
dMSG.setFS_RQ(sdf.format(new Date()));
dMSG.setNR_LB("0");
dMSG.setNR(NR);
dMSG.setJLS_WEB(0);
dMSG.setJLS_SJ(dMSG.getJLS_SJ() + 1);
list.add(0, dMSG);
//修改
eHCacheMSG.getCache().remove(KEY);
eHCacheMSG
.addToCache(KEY, JSONArray.fromObject(list)
.toString(), true);
String str_info = (String) ehcacheMSG_INFO
.getCacheElement(MAPKEY);
JSONArray arrayinfo = JSONArray
.fromObject(str_info);
List<DMSG_NR> listnr = JSONArray.toList(arrayinfo,
DMSG_NR.class);
DMSG_NR dMSG_NR = new DMSG_NR();
dMSG_NR.setFS_RQ(sdf.format(new Date()));
dMSG_NR.setNR(NR);
dMSG_NR.setFX("0");
listnr.add(dMSG_NR);
ehcacheMSG_INFO.getCache().remove(MAPKEY);
ehcacheMSG_INFO.addToCache(MAPKEY, JSONArray
.fromObject(listnr).toString(), true);
isAdd = false;
break;
}
}
// 判断是否要添加新对话
if (isAdd) {
DMSG dMSG = new DMSG();
dMSG.setSZ_LB(SZ_LB);
dMSG.setSZ_JFID(SZ_JFID);
dMSG.setSZ_MC(SZ_MC);
dMSG.setSZ_TX_LJ(SZ_TX_LJ);
dMSG.setFS_RQ(sdf.format(new Date()));
dMSG.setNR_LB("0");
dMSG.setNR(NR);
dMSG.setDF_LB(DF_LB);
dMSG.setDF_JFID(DF_JFID);
dMSG.setDF_MC(DF_MC);
dMSG.setDF_TX_LJ(DF_TX_LJ);
dMSG.setJLS_WEB(0);
dMSG.setJLS_SJ(1);
dMSG.setList(MAPKEY);
dMSG.setFX("0");
list.add(0, dMSG);
eHCacheMSG.getCache().remove(KEY);
eHCacheMSG.addToCache(KEY, JSONArray.fromObject(list)
.toString(), true);
List<DMSG_NR> listnr = new ArrayList<DMSG_NR>();
DMSG_NR dMSG_NR = new DMSG_NR();
dMSG_NR.setFS_RQ(sdf.format(new Date()));
dMSG_NR.setNR(NR);
dMSG_NR.setFX("0");
listnr.add(dMSG_NR);
ehcacheMSG_INFO.getCache().remove(MAPKEY);
ehcacheMSG_INFO.addToCache(MAPKEY, JSONArray
.fromObject(listnr).toString(), true);
}
boolean isAddQT = true;
String str_DF = (String) eHCacheMSG.getCacheElement(KEY_DF);
JSONArray array_DF = JSONArray.fromObject(str_DF);
List<DMSG> listQT = JSONArray.toList(array_DF, DMSG.class);
if (listQT.get(0) == null) {
listQT = new ArrayList<DMSG>();
}
// 修改其他人
if (eHCacheMSG.getCacheElement(KEY_DF) != null) {
for (int i = 0; i < listQT.size(); i++) {
if (listQT.get(i).getDF_JFID().equals(DF_JFID)
&& listQT.get(i).getDF_LB().equals(DF_LB)
|| listQT.get(i).getDF_JFID()
.equals(SZ_JFID)
&& listQT.get(i).getDF_LB().equals(SZ_LB)) {
DMSG dMSGQT = listQT.get(i);
listQT.remove(i);
dMSGQT.setFS_RQ(sdf.format(new Date()));
dMSGQT.setNR_LB("0");
dMSGQT.setNR(NR);
dMSGQT.setJLS_WEB(dMSGQT.getJLS_WEB() + 1);
dMSGQT.setJLS_SJ(dMSGQT.getJLS_SJ() + 1);
listQT.add(0, dMSGQT);
//修改
eHCacheMSG.getCache().remove(KEY_DF);
eHCacheMSG.addToCache(KEY_DF, JSONArray
.fromObject(listQT).toString(), true);
String str_info = (String) ehcacheMSG_INFO
.getCacheElement(MAPKEY_DF);
JSONArray arrayinfo = JSONArray
.fromObject(str_info);
List<DMSG_NR> listnrQT = JSONArray.toList(
arrayinfo, DMSG_NR.class);
DMSG_NR dMSG_NRQT = new DMSG_NR();
dMSG_NRQT.setFS_RQ(sdf.format(new Date()));
dMSG_NRQT.setNR(NR);
dMSG_NRQT.setFX("1");
listnrQT.add(dMSG_NRQT);
ehcacheMSG_INFO.getCache().remove(MAPKEY_DF);
ehcacheMSG_INFO.addToCache(MAPKEY_DF, JSONArray
.fromObject(listnrQT).toString(), true);
isAddQT = false;
break;
}
}
}
// 判断是否要添加其他人
if (isAddQT) {
DMSG dMSGQT = new DMSG();
dMSGQT.setSZ_LB(DF_LB);
dMSGQT.setSZ_JFID(DF_JFID);
dMSGQT.setSZ_MC(DF_MC);
dMSGQT.setSZ_TX_LJ(DF_TX_LJ);
dMSGQT.setFS_RQ(sdf.format(new Date()));
dMSGQT.setNR_LB("0");
dMSGQT.setNR(NR);
dMSGQT.setDF_LB(SZ_LB);
dMSGQT.setDF_JFID(SZ_JFID);
dMSGQT.setDF_MC(SZ_MC);
dMSGQT.setDF_TX_LJ(SZ_TX_LJ);
dMSGQT.setJLS_WEB(1);
dMSGQT.setJLS_SJ(1);
dMSGQT.setFX("1");
dMSGQT.setList(MAPKEY_DF);
listQT.add(0, dMSGQT);
eHCacheMSG.getCache().remove(KEY_DF);
eHCacheMSG.addToCache(KEY_DF,
JSONArray.fromObject(listQT).toString(), true);
List<DMSG_NR> listnrQT = new ArrayList<DMSG_NR>();
DMSG_NR dMSG_NRQT = new DMSG_NR();
dMSG_NRQT.setFS_RQ(sdf.format(new Date()));
dMSG_NRQT.setNR(NR);
dMSG_NRQT.setFX("1");
listnrQT.add(dMSG_NRQT);
ehcacheMSG_INFO.getCache().remove(MAPKEY_DF);
ehcacheMSG_INFO.addToCache(MAPKEY_DF, JSONArray
.fromObject(listnrQT).toString(), true);
}
}
} else {
// 上传的图片
int maxFileSize = 2;// 兆
String AllowedExtensions = ",.jpg,.jpeg,.gif,.png,";// 允许上传的文件类型
Random rdm = new Random(System.currentTimeMillis());// 获得随机种子
SmartUpload mySmartUpload = new SmartUpload();
mySmartUpload.initialize(servletConfig, request, response);
mySmartUpload.upload();
String saveurl = "";
String wjm = "";
for (int i = 0; i < mySmartUpload.getFiles().getCount(); i++) {
// 唯一文件名
long time = Math.abs(rdm.nextInt()) % 1000000000;
// 获取文件
com.jspsmart.upload.File myfile = mySmartUpload.getFiles()
.getFile(i);
// 获取文件大小
int filesize = myfile.getSize() / 1024 / 1024;
// 获取文件名长度
int len = myfile.getFileName().length();
// 获取文件后缀
if (len != 0) {
String hz = myfile.getFileName().substring(
myfile.getFileName().indexOf("."), len);
// 获取文件名
wjm = myfile.getFileName();
if (filesize > maxFileSize) {
model.addAttribute("msg", "1");
return "redirect:/onlin/sel.do";
}
if (AllowedExtensions.indexOf(hz) == -1) {
model.addAttribute("msg", "2");
return "redirect:/onlin/sel.do";
}
myfile.saveAs("/assets/img/head/" + time + hz);
CopeFile copeFile=new CopeFile();
String oldPath=request.getSession().getServletContext().getRealPath("\\assets\\img\\head\\"+time + hz) ;
String newPath=oldPath.split("Myssm_ZBZ")[0]+"Myssm"+oldPath.split("Myssm_ZBZ")[1];
copeFile.copyFile(oldPath, newPath);
saveurl = "//assets//img//head//" + time + hz;
// 处理相关数据
User user = (User) request.getSession().getAttribute(
"user");
DSYS05 dSYS05 = dSYS05Service.SelectByBM(user
.getJFDSYS05_CODE());
String SZ_LB = user.getXXDBLB();
String SZ_JFID = user.getJFID() + "";
String SZ_MC = "";
if (user.getXXDBLB().equals("0")) {
SZ_MC = dSYS05.getText() + "植保站";
} else if (user.getXXDBLB().equals("1")) {
SZ_MC = dSYS05.getText() + "植保站" + ":"
+ user.getJFNAME();
}
String SZ_TX_LJ = user.getZPLJ();
String DF_LB = mySmartUpload.getRequest().getParameter(
"DF_LB");
String DF_JFID = mySmartUpload.getRequest()
.getParameter("DF_JFID");
String DF_MC = mySmartUpload.getRequest().getParameter(
"DF_MC");
String DF_TX_LJ = mySmartUpload.getRequest()
.getParameter("DF_TX_LJ");
SimpleDateFormat sdf = new SimpleDateFormat(
"yy-MM-dd HH:mm:ss");
// 内存key
String KEY = SZ_LB + "," + SZ_JFID;
// mapkey
String MAPKEY = SZ_LB + "," + SZ_JFID + "," + DF_LB
+ "," + DF_JFID;
// 对方的内存key
String KEY_DF = DF_LB + "," + DF_JFID;
// 对方mapkey
String MAPKEY_DF = DF_LB + "," + DF_JFID + "," + SZ_LB
+ "," + SZ_JFID;
if (eHCacheMSG.getCacheElement(KEY) == null) {
List<DMSG> list = new ArrayList<DMSG>();
DMSG dMSG = new DMSG();
dMSG.setSZ_LB(SZ_LB);
dMSG.setSZ_JFID(SZ_JFID);
dMSG.setSZ_MC(SZ_MC);
dMSG.setSZ_TX_LJ(SZ_TX_LJ);
dMSG.setFS_RQ(sdf.format(new Date()));
dMSG.setNR_LB("1");
dMSG.setNR("[图片]");
dMSG.setTB_DZ(saveurl);
dMSG.setDF_LB(DF_LB);
dMSG.setDF_JFID(DF_JFID);
dMSG.setDF_MC(DF_MC);
dMSG.setDF_TX_LJ(DF_TX_LJ);
dMSG.setJLS_WEB(0);
dMSG.setJLS_SJ(1);
dMSG.setList(MAPKEY);
dMSG.setFX("0");
list.add(dMSG);
eHCacheMSG.getCache().remove(KEY);
eHCacheMSG
.addToCache(KEY, JSONArray.fromObject(list)
.toString(), true);
List<DMSG_NR> listnr = new ArrayList<DMSG_NR>();
DMSG_NR dMSG_NR = new DMSG_NR();
dMSG_NR.setFS_RQ(sdf.format(new Date()));
dMSG_NR.setTB_DZ(saveurl);
dMSG_NR.setFX("0");
listnr.add(dMSG_NR);
ehcacheMSG_INFO.getCache().remove(MAPKEY);
ehcacheMSG_INFO.addToCache(MAPKEY, JSONArray
.fromObject(listnr).toString(), true);
// 插入其他人的
if (eHCacheMSG.getCacheElement(KEY_DF) == null) {
List<DMSG> listQT = new ArrayList<DMSG>();
DMSG dMSGQT = new DMSG();
dMSGQT.setSZ_LB(DF_LB);
dMSGQT.setSZ_JFID(DF_JFID);
dMSGQT.setSZ_MC(DF_MC);
dMSGQT.setSZ_TX_LJ(DF_TX_LJ);
dMSGQT.setFS_RQ(sdf.format(new Date()));
dMSGQT.setNR_LB("1");
dMSGQT.setNR("[图片]");
dMSGQT.setTB_DZ(saveurl);
dMSGQT.setDF_LB(SZ_LB);
dMSGQT.setDF_JFID(SZ_JFID);
dMSGQT.setDF_MC(SZ_MC);
dMSGQT.setDF_TX_LJ(SZ_TX_LJ);
dMSGQT.setJLS_WEB(1);
dMSGQT.setJLS_SJ(1);
dMSGQT.setFX("1");
dMSGQT.setList(MAPKEY_DF);
listQT.add(dMSGQT);
eHCacheMSG.getCache().remove(KEY_DF);
eHCacheMSG.addToCache(KEY_DF, JSONArray
.fromObject(listQT).toString(), true);
List<DMSG_NR> listnrQT = new ArrayList<DMSG_NR>();
DMSG_NR dMSG_NRQT = new DMSG_NR();
dMSG_NRQT.setFS_RQ(sdf.format(new Date()));
dMSG_NRQT.setTB_DZ(saveurl);
dMSG_NRQT.setFX("1");
listnrQT.add(dMSG_NRQT);
ehcacheMSG_INFO.getCache().remove(MAPKEY_DF);
ehcacheMSG_INFO.addToCache(MAPKEY_DF, JSONArray
.fromObject(listnrQT).toString(), true);
} else {
String str_DF = (String) eHCacheMSG
.getCacheElement(KEY_DF);
JSONArray array_DF = JSONArray
.fromObject(str_DF);
List<DMSG> listQT = JSONArray.toList(array_DF,
DMSG.class);
if (listQT.get(0) == null) {
listQT = new ArrayList<DMSG>();
}
boolean isAddQT = true;
// 修改其他人
if (eHCacheMSG.getCacheElement(KEY_DF) != null) {
for (int i1 = 0; i1 < listQT.size(); i1++) {
if (listQT.get(i1).getDF_JFID()
.equals(DF_JFID)
&& listQT.get(i1).getDF_LB()
.equals(DF_LB)
|| listQT.get(i1).getDF_JFID()
.equals(SZ_JFID)
&& listQT.get(i1).getDF_LB()
.equals(SZ_LB)) {
DMSG dMSGQT = listQT.get(i1);
listQT.remove(i1);
dMSGQT.setFS_RQ(sdf
.format(new Date()));
dMSGQT.setNR_LB("1");
dMSGQT.setNR("[图片]");
dMSGQT.setTB_DZ(saveurl);
dMSGQT.setJLS_WEB(dMSGQT
.getJLS_WEB() + 1);
dMSGQT.setJLS_SJ(dMSGQT.getJLS_SJ() + 1);
listQT.add(0, dMSGQT);
eHCacheMSG.getCache().remove(KEY_DF);
eHCacheMSG.addToCache(KEY_DF,
JSONArray
.fromObject(listQT)
.toString(), true);
String str_info = (String) ehcacheMSG_INFO
.getCacheElement(MAPKEY_DF);
JSONArray arrayinfo = JSONArray
.fromObject(str_info);
List<DMSG_NR> listnrQT = JSONArray
.toList(arrayinfo,
DMSG_NR.class);
DMSG_NR dMSG_NRQT = new DMSG_NR();
dMSG_NRQT.setFS_RQ(sdf
.format(new Date()));
dMSG_NRQT.setTB_DZ(saveurl);
dMSG_NRQT.setFX("1");
listnrQT.add(dMSG_NRQT);
ehcacheMSG_INFO.getCache().remove(MAPKEY_DF);
ehcacheMSG_INFO.addToCache(
MAPKEY_DF,
JSONArray.fromObject(
listnrQT)
.toString(), true);
isAddQT = false;
break;
}
}
}
// 判断是否要添加其他人
if (isAddQT) {
DMSG dMSGQT = new DMSG();
dMSGQT.setSZ_LB(DF_LB);
dMSGQT.setSZ_JFID(DF_JFID);
dMSGQT.setSZ_MC(DF_MC);
dMSGQT.setSZ_TX_LJ(DF_TX_LJ);
dMSGQT.setFS_RQ(sdf.format(new Date()));
dMSGQT.setNR_LB("1");
dMSGQT.setNR("[图片]");
dMSGQT.setTB_DZ(saveurl);
dMSGQT.setDF_LB(SZ_LB);
dMSGQT.setDF_JFID(SZ_JFID);
dMSGQT.setDF_MC(SZ_MC);
dMSGQT.setDF_TX_LJ(SZ_TX_LJ);
dMSGQT.setJLS_WEB(1);
dMSGQT.setJLS_SJ(1);
dMSGQT.setFX("1");
dMSGQT.setList(MAPKEY_DF);
listQT.add(0, dMSGQT);
eHCacheMSG.getCache().remove(KEY_DF);
eHCacheMSG.addToCache(KEY_DF, JSONArray
.fromObject(listQT).toString(),
true);
List<DMSG_NR> listnrQT = new ArrayList<DMSG_NR>();
DMSG_NR dMSG_NRQT = new DMSG_NR();
dMSG_NRQT.setFS_RQ(sdf.format(new Date()));
dMSG_NRQT.setTB_DZ(saveurl);
dMSG_NRQT.setFX("1");
listnrQT.add(dMSG_NRQT);
ehcacheMSG_INFO.getCache().remove(MAPKEY_DF);
ehcacheMSG_INFO.addToCache(MAPKEY_DF,
JSONArray.fromObject(listnrQT)
.toString(), true);
}
}
} else {
String str = (String) eHCacheMSG
.getCacheElement(KEY);
JSONArray array = JSONArray.fromObject(str);
List<DMSG> list = JSONArray.toList(array,
DMSG.class);
boolean isAdd = true;
for (int i1 = 0; i1 < list.size(); i1++) {
if (list.get(i1).getDF_JFID().equals(DF_JFID)
&& list.get(i1).getDF_LB()
.equals(DF_LB)
|| list.get(i1).getDF_JFID()
.equals(SZ_JFID)
&& list.get(i1).getDF_LB()
.equals(SZ_LB)) {
DMSG dMSG = list.get(i1);
list.remove(i1);
dMSG.setFS_RQ(sdf.format(new Date()));
dMSG.setNR_LB("1");
dMSG.setNR("[图片]");
dMSG.setTB_DZ(saveurl);
dMSG.setJLS_WEB(0);
dMSG.setJLS_SJ(dMSG.getJLS_SJ() + 1);
list.add(0, dMSG);
eHCacheMSG.getCache().remove(KEY);
eHCacheMSG.addToCache(KEY, JSONArray
.fromObject(list).toString(), true);
String str_info = (String) ehcacheMSG_INFO
.getCacheElement(MAPKEY);
JSONArray arrayinfo = JSONArray
.fromObject(str_info);
List<DMSG_NR> listnr = JSONArray.toList(
arrayinfo, DMSG_NR.class);
DMSG_NR dMSG_NR = new DMSG_NR();
dMSG_NR.setFS_RQ(sdf.format(new Date()));
dMSG_NR.setTB_DZ(saveurl);
dMSG_NR.setFX("0");
listnr.add(dMSG_NR);
ehcacheMSG_INFO.getCache().remove(MAPKEY);
ehcacheMSG_INFO.addToCache(MAPKEY,
JSONArray.fromObject(listnr)
.toString(), true);
isAdd = false;
break;
}
}
// 判断是否要添加新对话
if (isAdd) {
DMSG dMSG = new DMSG();
dMSG.setSZ_LB(SZ_LB);
dMSG.setSZ_JFID(SZ_JFID);
dMSG.setSZ_MC(SZ_MC);
dMSG.setSZ_TX_LJ(SZ_TX_LJ);
dMSG.setFS_RQ(sdf.format(new Date()));
dMSG.setNR_LB("1");
dMSG.setNR("[图片]");
dMSG.setTB_DZ(saveurl);
dMSG.setDF_LB(DF_LB);
dMSG.setDF_JFID(DF_JFID);
dMSG.setDF_MC(DF_MC);
dMSG.setDF_TX_LJ(DF_TX_LJ);
dMSG.setJLS_WEB(0);
dMSG.setJLS_SJ(1);
dMSG.setList(MAPKEY);
dMSG.setFX("0");
list.add(0, dMSG);
eHCacheMSG.getCache().remove(KEY);
eHCacheMSG.addToCache(KEY, JSONArray
.fromObject(list).toString(), true);
List<DMSG_NR> listnr = new ArrayList<DMSG_NR>();
DMSG_NR dMSG_NR = new DMSG_NR();
dMSG_NR.setFS_RQ(sdf.format(new Date()));
dMSG_NR.setTB_DZ(saveurl);
dMSG_NR.setFX("0");
listnr.add(dMSG_NR);
ehcacheMSG_INFO.getCache().remove(MAPKEY);
ehcacheMSG_INFO.addToCache(MAPKEY, JSONArray
.fromObject(listnr).toString(), true);
}
String str_DF = (String) eHCacheMSG
.getCacheElement(KEY_DF);
JSONArray array_DF = JSONArray.fromObject(str_DF);
List<DMSG> listQT = JSONArray.toList(array_DF,
DMSG.class);
if (listQT.get(0) == null) {
listQT = new ArrayList<DMSG>();
}
boolean isAddQT = true;
// 修改其他人
if (eHCacheMSG.getCacheElement(KEY_DF) != null) {
for (int i1 = 0; i1 < listQT.size(); i1++) {
if (listQT.get(i1).getDF_JFID()
.equals(DF_JFID)
&& listQT.get(i1).getDF_LB()
.equals(DF_LB)
|| listQT.get(i1).getDF_JFID()
.equals(SZ_JFID)
&& listQT.get(i1).getDF_LB()
.equals(SZ_LB)) {
DMSG dMSGQT = listQT.get(i1);
listQT.remove(i1);
dMSGQT.setFS_RQ(sdf.format(new Date()));
dMSGQT.setNR_LB("1");
dMSGQT.setNR("[图片]");
dMSGQT.setTB_DZ(saveurl);
dMSGQT.setJLS_WEB(dMSGQT.getJLS_WEB() + 1);
dMSGQT.setJLS_SJ(dMSGQT.getJLS_SJ() + 1);
listQT.add(0, dMSGQT);
eHCacheMSG.getCache().remove(KEY_DF);
eHCacheMSG.addToCache(KEY_DF, JSONArray
.fromObject(listQT).toString(),
true);
String str_info = (String) ehcacheMSG_INFO
.getCacheElement(MAPKEY_DF);
JSONArray arrayinfo = JSONArray
.fromObject(str_info);
List<DMSG_NR> listnrQT = JSONArray
.toList(arrayinfo,
DMSG_NR.class);
DMSG_NR dMSG_NRQT = new DMSG_NR();
dMSG_NRQT.setFS_RQ(sdf
.format(new Date()));
dMSG_NRQT.setTB_DZ(saveurl);
dMSG_NRQT.setFX("1");
listnrQT.add(dMSG_NRQT);
ehcacheMSG_INFO.getCache().remove(MAPKEY_DF);
ehcacheMSG_INFO.addToCache(MAPKEY_DF,
JSONArray.fromObject(listnrQT)
.toString(), true);
isAddQT = false;
break;
}
}
}
// 判断是否要添加其他人
if (isAddQT) {
DMSG dMSGQT = new DMSG();
dMSGQT.setSZ_LB(DF_LB);
dMSGQT.setSZ_JFID(DF_JFID);
dMSGQT.setSZ_MC(DF_MC);
dMSGQT.setSZ_TX_LJ(DF_TX_LJ);
dMSGQT.setFS_RQ(sdf.format(new Date()));
dMSGQT.setNR_LB("1");
dMSGQT.setNR("[图片]");
dMSGQT.setTB_DZ(saveurl);
dMSGQT.setDF_LB(SZ_LB);
dMSGQT.setDF_JFID(SZ_JFID);
dMSGQT.setDF_MC(SZ_MC);
dMSGQT.setDF_TX_LJ(SZ_TX_LJ);
dMSGQT.setJLS_WEB(1);
dMSGQT.setJLS_SJ(1);
dMSGQT.setFX("1");
dMSGQT.setList(MAPKEY_DF);
listQT.add(0, dMSGQT);
eHCacheMSG.getCache().remove(KEY_DF);
eHCacheMSG.addToCache(KEY_DF, JSONArray
.fromObject(listQT).toString(), true);
List<DMSG_NR> listnrQT = new ArrayList<DMSG_NR>();
DMSG_NR dMSG_NRQT = new DMSG_NR();
dMSG_NRQT.setFS_RQ(sdf.format(new Date()));
dMSG_NRQT.setTB_DZ(saveurl);
dMSG_NRQT.setFX("1");
listnrQT.add(dMSG_NRQT);
ehcacheMSG_INFO.getCache().remove(MAPKEY_DF);
ehcacheMSG_INFO.addToCache(MAPKEY_DF, JSONArray
.fromObject(listnrQT).toString(), true);
}
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
return "redirect:/onlin/sel.do";
}
@SuppressWarnings("unchecked")
@RequestMapping(value = "/msginfo.do")
public String msginfo(HttpServletRequest request,
HttpServletResponse response, Model model,
@ModelAttribute("msg") String msg) {
request.setAttribute("msg", msg);
String list = request.getParameter("list");
String SZ_LB = request.getParameter("SZ_LB");
String SZ_JFID = request.getParameter("SZ_JFID");
String SZ_TX_LJ = request.getParameter("SZ_TX_LJ");
String DF_LB = request.getParameter("DF_LB");
request.setAttribute("DF_LB", DF_LB);
String DF_JFID = request.getParameter("DF_JFID");
request.setAttribute("DF_JFID", DF_JFID);
String DF_TX_LJ = request.getParameter("DF_TX_LJ");
request.setAttribute("SZ_TX_LJ", SZ_TX_LJ);
request.setAttribute("DF_TX_LJ", DF_TX_LJ);
// 内存key
String KEY = SZ_LB + "," + SZ_JFID;
try {
if (eHCacheMSG.getCacheElement(KEY) != null) {
String str = (String) eHCacheMSG.getCacheElement(KEY);
JSONArray array = JSONArray.fromObject(str);
List<DMSG> list1 = JSONArray.toList(array, DMSG.class);
for (int i = 0; i < list1.size(); i++) {
if (list1.get(i).getDF_JFID().equals(DF_JFID)
&& list1.get(i).getSZ_JFID().equals(SZ_JFID)) {
DMSG dMSG = list1.get(i);
list1.remove(i);
dMSG.setJLS_WEB(0);
request.setAttribute("SZ_MC", dMSG.getSZ_MC());
request.setAttribute("DF_MC", dMSG.getDF_MC());
list1.add(dMSG);
eHCacheMSG.getCache().remove(KEY);
eHCacheMSG.addToCache(KEY, JSONArray.fromObject(list1)
.toString(), true);
break;
}
}
}
String str = (String) ehcacheMSG_INFO.getCacheElement(list);
JSONArray arrayinfo = JSONArray.fromObject(str);
List<DMSG_NR> listnr = JSONArray.toList(arrayinfo, DMSG_NR.class);
request.setAttribute("listnr", listnr);
} catch (Exception e) {
e.printStackTrace();
}
return "jf_dmsg_INFO";
}
@SuppressWarnings("unchecked")
@RequestMapping(value = "/msginfoadd.do")
public String msginfoadd(HttpServletRequest request,
HttpServletResponse response, Model model) {
try {
if (request.getParameter("DF_JFID") != null) {
User user = (User) request.getSession().getAttribute("user");
String SZ_LB = user.getXXDBLB();
model.addAttribute("SZ_LB", SZ_LB);
String SZ_JFID = user.getJFID() + "";
model.addAttribute("SZ_JFID", SZ_JFID);
String SZ_MC = user.getJFNAME();
model.addAttribute("SZ_MC", SZ_MC);
String SZ_TX_LJ = user.getZPLJ();
model.addAttribute("SZ_TX_LJ", SZ_TX_LJ);
String DF_LB = request.getParameter("DF_LB");
model.addAttribute("DF_LB", DF_LB);
String DF_JFID = request.getParameter("DF_JFID");
model.addAttribute("DF_JFID", DF_JFID);
String DF_MC = request.getParameter("DF_MC");
model.addAttribute("DF_MC", DF_MC);
String DF_TX_LJ = request.getParameter("DF_TX_LJ");
model.addAttribute("DF_TX_LJ", DF_TX_LJ);
String NR = request.getParameter("NR");
try {
DF_MC = new String(DF_MC.getBytes("ISO8859-1"), "GBK");
NR = new String(NR.getBytes("ISO8859-1"), "GBK");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
SimpleDateFormat sdf = new SimpleDateFormat("yy-MM-dd HH:mm:ss");
// 内存key
String KEY = SZ_LB + "," + SZ_JFID;
// mapkey
String MAPKEY = SZ_LB + "," + SZ_JFID + "," + DF_LB + ","
+ DF_JFID;
model.addAttribute("list", MAPKEY);
// 对方的内存key
String KEY_DF = DF_LB + "," + DF_JFID;
// 对方mapkey
String MAPKEY_DF = DF_LB + "," + DF_JFID + "," + SZ_LB + ","
+ SZ_JFID;
if (eHCacheMSG.getCacheElement(KEY) != null) {
String str = (String) eHCacheMSG.getCacheElement(KEY);
JSONArray array = JSONArray.fromObject(str);
List<DMSG> list = JSONArray.toList(array, DMSG.class);
boolean isAdd = true;
for (int i = 0; i < list.size(); i++) {
if (list.get(i).getDF_JFID().equals(DF_JFID)
&& list.get(i).getDF_LB().equals(DF_LB)
|| list.get(i).getDF_JFID().equals(SZ_JFID)
&& list.get(i).getDF_LB().equals(SZ_LB)) {
DMSG dMSG = list.get(i);
list.remove(i);
dMSG.setFS_RQ(sdf.format(new Date()));
dMSG.setNR_LB("0");
dMSG.setNR(NR);
dMSG.setJLS_WEB(0);
dMSG.setJLS_SJ(dMSG.getJLS_SJ() + 1);
list.add(0, dMSG);
eHCacheMSG.getCache().remove(KEY);
eHCacheMSG
.addToCache(KEY, JSONArray.fromObject(list)
.toString(), true);
String str_info = (String) ehcacheMSG_INFO
.getCacheElement(MAPKEY);
JSONArray arrayinfo = JSONArray
.fromObject(str_info);
List<DMSG_NR> listnr = JSONArray.toList(arrayinfo,
DMSG_NR.class);
DMSG_NR dMSG_NR = new DMSG_NR();
dMSG_NR.setFS_RQ(sdf.format(new Date()));
dMSG_NR.setNR(NR);
dMSG_NR.setFX("0");
listnr.add(dMSG_NR);
ehcacheMSG_INFO.getCache().remove(MAPKEY);
ehcacheMSG_INFO.addToCache(MAPKEY, JSONArray
.fromObject(listnr).toString(), true);
isAdd = false;
break;
}
}
// 修改其他人
if (eHCacheMSG.getCacheElement(KEY_DF) != null) {
String str_DF = (String) eHCacheMSG
.getCacheElement(KEY_DF);
JSONArray array_DF = JSONArray.fromObject(str_DF);
List<DMSG> listQT = JSONArray.toList(array_DF,
DMSG.class);
boolean isAddQT = true;
for (int i = 0; i < listQT.size(); i++) {
if (listQT.get(i).getDF_JFID().equals(DF_JFID)
&& listQT.get(i).getDF_LB().equals(DF_LB)
|| listQT.get(i).getDF_JFID()
.equals(SZ_JFID)
&& listQT.get(i).getDF_LB().equals(SZ_LB)) {
DMSG dMSGQT = listQT.get(i);
listQT.remove(i);
dMSGQT.setFS_RQ(sdf.format(new Date()));
dMSGQT.setNR_LB("0");
dMSGQT.setNR(NR);
dMSGQT.setJLS_WEB(dMSGQT.getJLS_WEB() + 1);
dMSGQT.setJLS_SJ(dMSGQT.getJLS_SJ() + 1);
listQT.add(0, dMSGQT);
eHCacheMSG.getCache().remove(KEY_DF);
eHCacheMSG.addToCache(KEY_DF, JSONArray
.fromObject(listQT).toString(), true);
String str_info = (String) ehcacheMSG_INFO
.getCacheElement(MAPKEY_DF);
JSONArray arrayinfo = JSONArray
.fromObject(str_info);
List<DMSG_NR> listnrQT = JSONArray.toList(
arrayinfo, DMSG_NR.class);
DMSG_NR dMSG_NRQT = new DMSG_NR();
dMSG_NRQT.setFS_RQ(sdf.format(new Date()));
dMSG_NRQT.setNR(NR);
dMSG_NRQT.setFX("1");
listnrQT.add(dMSG_NRQT);
ehcacheMSG_INFO.getCache().remove(MAPKEY_DF);
ehcacheMSG_INFO.addToCache(MAPKEY_DF, JSONArray
.fromObject(listnrQT).toString(), true);
isAddQT = false;
break;
}
}
}
}
} else {
// 上传的图片
int maxFileSize = 2;// 兆
String AllowedExtensions = ",.jpg,.jpeg,.gif,.png,";// 允许上传的文件类型
Random rdm = new Random(System.currentTimeMillis());// 获得随机种子
SmartUpload mySmartUpload = new SmartUpload();
mySmartUpload.initialize(servletConfig, request, response);
mySmartUpload.upload();
String saveurl = "";
String wjm = "";
for (int i = 0; i < mySmartUpload.getFiles().getCount(); i++) {
// 唯一文件名
long time = Math.abs(rdm.nextInt()) % 1000000000;
// 获取文件
com.jspsmart.upload.File myfile = mySmartUpload.getFiles()
.getFile(i);
// 获取文件大小
int filesize = myfile.getSize() / 1024 / 1024;
// 获取文件名长度
int len = myfile.getFileName().length();
// 获取文件后缀
if (len != 0) {
String hz = myfile.getFileName().substring(
myfile.getFileName().indexOf("."), len);
// 获取文件名
wjm = myfile.getFileName();
if (filesize > maxFileSize) {
model.addAttribute("msg", "1");
return "redirect:/onlin/sel.do";
}
if (AllowedExtensions.indexOf(hz) == -1) {
model.addAttribute("msg", "2");
return "redirect:/onlin/sel.do";
}
myfile.saveAs("/assets/img/head/" + time + hz);
CopeFile copeFile=new CopeFile();
String oldPath=request.getSession().getServletContext().getRealPath("\\assets\\img\\head\\"+time + hz) ;
String newPath=oldPath.split("Myssm_ZBZ")[0]+"Myssm"+oldPath.split("Myssm_ZBZ")[1];
copeFile.copyFile(oldPath, newPath);
saveurl = "//assets//img//head//" + time + hz;
// 处理相关数据
User user = (User) request.getSession().getAttribute(
"user");
String SZ_LB = user.getXXDBLB();
model.addAttribute("SZ_LB", SZ_LB);
String SZ_JFID = user.getJFID() + "";
model.addAttribute("SZ_JFID", SZ_JFID);
String SZ_MC = user.getJFNAME();
model.addAttribute("SZ_MC", SZ_MC);
String SZ_TX_LJ = user.getZPLJ();
model.addAttribute("SZ_TX_LJ", SZ_TX_LJ);
String DF_LB = mySmartUpload.getRequest().getParameter(
"DF_LB");
model.addAttribute("DF_LB", DF_LB);
String DF_JFID = mySmartUpload.getRequest()
.getParameter("DF_JFID");
model.addAttribute("DF_JFID", DF_JFID);
String DF_MC = mySmartUpload.getRequest().getParameter(
"DF_MC");
model.addAttribute("DF_MC", DF_MC);
String DF_TX_LJ = mySmartUpload.getRequest()
.getParameter("DF_TX_LJ");
model.addAttribute("DF_TX_LJ", DF_TX_LJ);
SimpleDateFormat sdf = new SimpleDateFormat(
"yy-MM-dd HH:mm:ss");
// 内存key
String KEY = SZ_LB + "," + SZ_JFID;
// mapkey
String MAPKEY = SZ_LB + "," + SZ_JFID + "," + DF_LB
+ "," + DF_JFID;
model.addAttribute("list", MAPKEY);
// 对方的内存key
String KEY_DF = DF_LB + "," + DF_JFID;
// 对方mapkey
String MAPKEY_DF = DF_LB + "," + DF_JFID + "," + SZ_LB
+ "," + SZ_JFID;
if (eHCacheMSG.getCacheElement(KEY) != null) {
String str = (String) eHCacheMSG
.getCacheElement(KEY);
JSONArray array = JSONArray.fromObject(str);
List<DMSG> list = JSONArray.toList(array,
DMSG.class);
boolean isAdd = true;
for (int i1 = 0; i1 < list.size(); i1++) {
if (list.get(i1).getDF_JFID().equals(DF_JFID)
&& list.get(i1).getDF_LB()
.equals(DF_LB)
|| list.get(i1).getDF_JFID()
.equals(SZ_JFID)
&& list.get(i1).getDF_LB()
.equals(SZ_LB)) {
DMSG dMSG = list.get(i1);
list.remove(i1);
dMSG.setFS_RQ(sdf.format(new Date()));
dMSG.setNR_LB("1");
dMSG.setNR("[图片]");
dMSG.setTB_DZ(saveurl);
dMSG.setJLS_WEB(0);
dMSG.setJLS_SJ(dMSG.getJLS_SJ() + 1);
list.add(0, dMSG);
eHCacheMSG.getCache().remove(KEY);
eHCacheMSG.addToCache(KEY, JSONArray
.fromObject(list).toString(), true);
String str_info = (String) ehcacheMSG_INFO
.getCacheElement(MAPKEY);
JSONArray arrayinfo = JSONArray
.fromObject(str_info);
List<DMSG_NR> listnr = JSONArray.toList(
arrayinfo, DMSG_NR.class);
DMSG_NR dMSG_NR = new DMSG_NR();
dMSG_NR.setFS_RQ(sdf.format(new Date()));
dMSG_NR.setTB_DZ(saveurl);
dMSG_NR.setFX("0");
listnr.add(dMSG_NR);
ehcacheMSG_INFO.getCache().remove(MAPKEY);
ehcacheMSG_INFO.addToCache(MAPKEY,
JSONArray.fromObject(listnr)
.toString(), true);
isAdd = false;
break;
}
}
// 修改其他人
if (eHCacheMSG.getCacheElement(KEY_DF) != null) {
String str_DF = (String) eHCacheMSG
.getCacheElement(KEY_DF);
JSONArray array_DF = JSONArray
.fromObject(str_DF);
List<DMSG> listQT = JSONArray.toList(array_DF,
DMSG.class);
boolean isAddQT = true;
for (int i1 = 0; i1 < listQT.size(); i1++) {
if (listQT.get(i1).getDF_JFID()
.equals(DF_JFID)
&& listQT.get(i1).getDF_LB()
.equals(DF_LB)
|| listQT.get(i1).getDF_JFID()
.equals(SZ_JFID)
&& listQT.get(i1).getDF_LB()
.equals(SZ_LB)) {
DMSG dMSGQT = listQT.get(i1);
listQT.remove(i1);
dMSGQT.setFS_RQ(sdf.format(new Date()));
dMSGQT.setNR_LB("1");
dMSGQT.setNR("[图片]");
dMSGQT.setTB_DZ(saveurl);
dMSGQT.setJLS_WEB(dMSGQT.getJLS_WEB() + 1);
dMSGQT.setJLS_SJ(dMSGQT.getJLS_SJ() + 1);
listQT.add(0, dMSGQT);
eHCacheMSG.getCache().remove(KEY_DF);
eHCacheMSG.addToCache(KEY_DF, JSONArray
.fromObject(listQT).toString(),
true);
String str_info = (String) ehcacheMSG_INFO
.getCacheElement(MAPKEY_DF);
JSONArray arrayinfo = JSONArray
.fromObject(str_info);
List<DMSG_NR> listnrQT = JSONArray
.toList(arrayinfo,
DMSG_NR.class);
DMSG_NR dMSG_NRQT = new DMSG_NR();
dMSG_NRQT.setFS_RQ(sdf
.format(new Date()));
dMSG_NRQT.setTB_DZ(saveurl);
dMSG_NRQT.setFX("1");
listnrQT.add(dMSG_NRQT);
ehcacheMSG_INFO.getCache().remove(MAPKEY_DF);
ehcacheMSG_INFO.addToCache(MAPKEY_DF,
JSONArray.fromObject(listnrQT)
.toString(), true);
isAddQT = false;
break;
}
}
}
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
return "redirect:/onlin/msginfo.do";
}
}
| [
"suhai505604843@qq.com"
] | suhai505604843@qq.com |
132634ede0179dfa6f496a799fc7f75296723940 | 2b833a746e0a0a30a390c888b92978f20dfff345 | /DesignPattern/Singleton/src/com/freedom/singleton1/Minister.java | 424bbc9585daa3034cf1296fa8f484dcb3dd5644 | [] | no_license | freedom93/java-review | 4d8320ed220c260668a94007db0efe5c005a513c | cdfad8907f6851ee74708709d99d1059b6709b3e | refs/heads/master | 2021-01-21T12:03:00.768538 | 2015-01-16T08:45:05 | 2015-01-16T08:45:05 | 27,056,821 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,141 | java | package com.freedom.singleton1;
/**
* 事先声明,本人爱扯,不喜欢看故事的请自动屏蔽注释。
* @author freedom
* Minister 大臣
* 大臣天天要上早朝拜见皇帝,今天拜的皇帝和昨天、前天的都是一样的!
* 请忽略今天和昨天不一样的情况,因为昨天的PK肯定试一次惨不忍睹的厮杀,
* 在历史的长河中,平均发生的概率在1/365以下。
* 在singleton2中通用的单例模式会解决同一朝代有两个皇帝,你怎么确定你每天拜见都是同一个皇帝问题。
*/
public class Minister {
public static void main(String[] args) {
// 第一天
Emperor emperor1 = Emperor.getInstance();
emperor1.emperorInfo(); //第一天见的皇帝特征:名?字?高否?帅否?……
// 第二天
Emperor emperor2 = Emperor.getInstance();
Emperor.emperorInfo(); //第二天见的皇帝特征:和昨天一样高?一样帅?……
// 第三天
Emperor emperor3 = Emperor.getInstance();
emperor2.emperorInfo();//第三天见的皇帝特征:和昨天、前天一样高?一样帅?……
}
}
| [
"1563607296@qq.com"
] | 1563607296@qq.com |
ce06b666617c6aa3f45f4e00e958949f7a303378 | b6a77cc52a0ffbc1bee5b78aa1efa6bb7c4335e7 | /src/com/websharp/activity/list/ActivityCzjl.java | 297417e671b227c931c72b5f5c5ad0b1c6aa7307 | [] | no_license | dengzhenhao/JSCN_STB_YX | b16a0cfd4f6915466c2ff656541278f14503a506 | 7fc9dc53a2e67c11d878d0e017225ca4b64cad09 | refs/heads/master | 2020-04-04T23:25:19.924329 | 2018-11-06T09:28:09 | 2018-11-06T09:28:09 | 156,358,108 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,637 | java | package com.websharp.activity.list;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.LinearLayout;
import android.widget.Spinner;
import android.widget.TextView;
import java.util.ArrayList;
import org.json.JSONException;
import org.json.JSONObject;
import com.google.gson.Gson;
import com.websharp.activity.BaseActivity;
import com.websharp.activity.list.ActivityDbjl.AdapterPlayRecord;
import com.websharp.dao.EntityAccountBook;
import com.websharp.dao.EntityCustomerOrder;
import com.websharp.dao.EntityPayAmountRecord;
import com.websharp.dao.EntityPlayRecord;
import com.websharp.data.AppUtil;
import com.websharp.data.GlobalData;
import com.websharp.http.AsyncHttpCallBack;
import com.websharp.http.SwzfHttpHandler;
import com.websharp.stb.R;
import com.websharp.widget.PullRefreshListView;
import com.websharputil.common.ConvertUtil;
import com.websharputil.common.LogUtil;
import com.websharputil.common.Util;
public class ActivityCzjl extends BaseActivity {
LinearLayout layout_back;
TextView tv_title;
PullRefreshListView lv_info;
AdapterPayAmountRecord adapterPayAmountRecord;
ArrayList<String> listExpand = new ArrayList<String>();
Spinner sp_year;
String curYear = GlobalData.GetYearList().get(0);
boolean isRefresh = true;
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.layout_back:
finish();
break;
}
}
@Override
public void initLayout() {
setContentView(R.layout.activity_list_czjl);
}
@Override
public void init() {
layout_back = (LinearLayout) findViewById(R.id.layout_back);
tv_title = (TextView) findViewById(R.id.tv_title);
lv_info = (PullRefreshListView) findViewById(R.id.lv_info);
sp_year = (Spinner) findViewById(R.id.sp_year);
}
@Override
public void bindData() {
layout_back.setOnClickListener(this);
Bundle b = getIntent().getExtras();
tv_title.setText(b == null ? "" : b.getString("title"));
adapterPayAmountRecord = new AdapterPayAmountRecord(new ArrayList<EntityPayAmountRecord>());
lv_info.setAdapter(adapterPayAmountRecord);
lv_info.setCanLoadMore(true);
lv_info.setCanRefresh(true);
lv_info.setAutoLoadMore(true);
lv_info.setMoveToFirstItemAfterRefresh(true);
lv_info.setDoRefreshOnUIChanged(false);
ArrayAdapter adapterSource = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item,
GlobalData.GetYearList());
adapterSource.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
sp_year.setAdapter(adapterSource);
sp_year.setSelection(0, true);
sp_year.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> arg0, View arg1, int position, long arg3) {
curYear = GlobalData.GetYearList().get(position);
lv_info.pull2RefreshManually();
}
@Override
public void onNothingSelected(AdapterView<?> arg0) {
}
});
lv_info.setOnRefreshListener(new PullRefreshListView.OnRefreshListener() {
@Override
public void onRefresh() {
listExpand.clear();
adapterPayAmountRecord.mList.clear();
adapterPayAmountRecord.notifyDataSetChanged();
isRefresh = true;
SwzfHttpHandler.PAGEINDEX_CZJL = 1;
// http://mboss.sz96296.com/Handlers/Boss/QueryDataHandler.ashx?data=201701-201712,8512003007619|1|20&id=11&token=a11dcf7941b8bad5d94324a43fb25583c84f2a9157ff3cca
new SwzfHttpHandler(cb, ActivityCzjl.this).callSQL("11",
curYear + "01-" + curYear + "12" + "," + GlobalData.curCustomer.CUST_CODE,
(SwzfHttpHandler.PAGEINDEX_CZJL - 1) * SwzfHttpHandler.PAGE_SIZE + 1 + "",
SwzfHttpHandler.PAGEINDEX_CZJL * SwzfHttpHandler.PAGE_SIZE + "");
}
});
lv_info.setOnLoadListener(new PullRefreshListView.OnLoadMoreListener() {
@Override
public void onLoadMore() {
isRefresh = false;
SwzfHttpHandler.PAGEINDEX_CZJL++;
new SwzfHttpHandler(cb, ActivityCzjl.this).callSQL("11",
curYear + "01-" + curYear + "12" + "," + GlobalData.curCustomer.CUST_CODE,
(SwzfHttpHandler.PAGEINDEX_CZJL - 1) * SwzfHttpHandler.PAGE_SIZE + 1 + "",
SwzfHttpHandler.PAGEINDEX_CZJL * SwzfHttpHandler.PAGE_SIZE + "");
}
});
lv_info.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View v, int position, long arg3) {
LinearLayout layout_container = (LinearLayout) v.findViewById(R.id.layout_container);
LogUtil.d("container:%s", position - 1);
layout_container.removeAllViews();
if (layout_container.getVisibility() == View.GONE) {
LayoutInflater mInflater = LayoutInflater.from(ActivityCzjl.this);
// layout_container.addView(AppUtil.getKeyValueView("缴费金额",
// ConvertUtil.ParsetDoubleStringToFormat(
// ConvertUtil.ParsetStringToDouble(
// adapterPayAmountRecord.mList.get(position - 1).AMOUNT, 0) / 100 + "",
// ConvertUtil.FORMAT_DECIMAL_FORMAT_3),
// mInflater));
// layout_container.addView(AppUtil.getKeyValueView("缴费时间",
// adapterPayAmountRecord.mList.get(position - 1).PAYMENT_DATE, mInflater));
// layout_container
// .addView(
// AppUtil.getKeyValueView("交费类型",
// GlobalData.GetStaticDataName("OPERATION_TYPE",
// adapterPayAmountRecord.mList.get(position - 1).OPERATION_TYPE),
// mInflater));
layout_container.addView(AppUtil.getKeyValueView("营业点",
adapterPayAmountRecord.mList.get(position - 1).ORGANIZE_NAME, mInflater));
layout_container.addView(AppUtil.getKeyValueView("操作员",
adapterPayAmountRecord.mList.get(position - 1).STAFF_NAME, mInflater));
layout_container.addView(AppUtil.getKeyValueView("银行名称",
adapterPayAmountRecord.mList.get(position - 1).BANK_NAME, mInflater));
layout_container
.addView(
AppUtil.getKeyValueView("凭证类型",
GlobalData.GetStaticDataName("CERTIFIED_TYPE",
adapterPayAmountRecord.mList.get(position - 1).CERTIFIED_TYPE),
mInflater));
layout_container.addView(AppUtil.getKeyValueViewLast("备注",
adapterPayAmountRecord.mList.get(position - 1).REMARK, mInflater));
listExpand.add(position - 1 + "");
layout_container.setVisibility(View.VISIBLE);
} else {
layout_container.setVisibility(View.GONE);
listExpand.remove(position - 1 + "");
}
}
});
lv_info.pull2RefreshManually();
}
AsyncHttpCallBack cb = new AsyncHttpCallBack() {
@Override
public void onSuccess(String response) {
super.onSuccess(response);
if (isRefresh) {
lv_info.onRefreshComplete();
} else {
lv_info.onLoadMoreComplete();
}
LogUtil.d("%s", response);
JSONObject obj;
try {
obj = new JSONObject(response);
if (obj.optString("code").equals("0")) {
Gson gson = new Gson();
ArrayList<EntityPayAmountRecord> listPay;
listPay = gson.fromJson(obj.getJSONObject("data").getString("Result"),
new com.google.gson.reflect.TypeToken<ArrayList<EntityPayAmountRecord>>() {
}.getType());
if (listPay.size() < SwzfHttpHandler.PAGE_SIZE) {
lv_info.setCanLoadMore(false);
} else {
lv_info.setCanLoadMore(true);
}
lv_info.changeEndViewByState();
if (isRefresh) {
GlobalData.listPayAmountRecord = (ArrayList<EntityPayAmountRecord>) listPay.clone();
} else {
GlobalData.listPayAmountRecord.addAll(listPay);
}
adapterPayAmountRecord.mList = GlobalData.listPayAmountRecord;
adapterPayAmountRecord.notifyDataSetChanged();
} else {
Util.createToast(ActivityCzjl.this, obj.optString("message"), 3000).show();
}
} catch (JSONException e) {
e.printStackTrace();
}
}
@Override
public void onFailure(String message) {
super.onFailure(message);
LogUtil.d("%s", message);
if (isRefresh) {
lv_info.onRefreshComplete();
} else {
lv_info.onLoadMoreComplete();
}
}
};
private static class ViewHolder {
private TextView tv_amount;
private TextView tv_payment_date;
private TextView tv_payment_method;
private TextView tv_operation_type;
private LinearLayout layout_container;
}
class AdapterPayAmountRecord extends BaseAdapter {
ArrayList<EntityPayAmountRecord> mList;
private LayoutInflater mInflater;
public AdapterPayAmountRecord(ArrayList<EntityPayAmountRecord> list) {
this.mList = list;
}
@Override
public int getCount() {
return mList.size();
}
@Override
public Object getItem(int position) {
return mList.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (getCount() == 0)
return null;
ViewHolder holder = null;
if (mInflater == null) {
mInflater = LayoutInflater.from(ActivityCzjl.this);
}
if (convertView == null) {
convertView = mInflater.inflate(R.layout.item_czjl, null);
holder = new ViewHolder();
holder.tv_amount = (TextView) convertView.findViewById(R.id.tv_amount);
holder.tv_payment_date = (TextView) convertView.findViewById(R.id.tv_payment_date);
holder.tv_operation_type = (TextView) convertView.findViewById(R.id.tv_operation_type);
holder.layout_container = (LinearLayout) convertView.findViewById(R.id.layout_container);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.tv_amount.setText(ConvertUtil.ParsetDoubleStringToFormat(
ConvertUtil.ParsetStringToDouble(mList.get(position).AMOUNT, 0) / 100 + "",
ConvertUtil.FORMAT_DECIMAL_FORMAT_3));
holder.tv_payment_date.setText(mList.get(position).PAYMENT_DATE);
// holder.tv_payment_method
// .setText(GlobalData.GetStaticDataName("PAYMENT_METHOD",
// mList.get(position).PAYMENT_METHOD));
holder.tv_operation_type
.setText(GlobalData.GetStaticDataName("OPERATION_TYPE", mList.get(position).OPERATION_TYPE));
holder.layout_container.removeAllViews();
if (listExpand.contains(position + "")) {
holder.layout_container
.addView(AppUtil.getKeyValueView("营业点", mList.get(position).ORGANIZE_NAME, mInflater));
holder.layout_container
.addView(AppUtil.getKeyValueView("操作员", mList.get(position).STAFF_NAME, mInflater));
holder.layout_container
.addView(AppUtil.getKeyValueView("银行名称", mList.get(position).BANK_NAME, mInflater));
holder.layout_container.addView(AppUtil.getKeyValueView("凭证类型",
GlobalData.GetStaticDataName("CERTIFIED_TYPE", mList.get(position).CERTIFIED_TYPE), mInflater));
holder.layout_container.addView(AppUtil.getKeyValueView("备注", mList.get(position).REMARK, mInflater));
holder.layout_container.setVisibility(View.VISIBLE);
} else {
holder.layout_container.setVisibility(View.GONE);
}
// holder.layout_container.setOnClickListener(new
// View.OnClickListener() {
//
// @Override
// public void onClick(View v) {
// // TODO Auto-generated method stub
//
// }
// });
return convertView;
}
}
}
| [
"dengzhenhao@163.com"
] | dengzhenhao@163.com |
c0ed729bfe8ddfd5455739f3b8a5f9de3ad880fd | 106a391c38ef15e939850bb591139dd5a1bd26aa | /01.项目源码/trunk/0.0.1/shareride-admin/src/main/java/com/dower/sharerideadmin/core/serverdb/dao/NnaUsersMapper.java | 7c9a14f0f91d16af8b432758b98cbf71184577e2 | [] | no_license | firstDower/sharecar | e24bbaf13b2c8d9ba4d77d4e97ae767d764458ab | b4bba5481643598aee13368f8e1c89aeb4fda1dd | refs/heads/master | 2022-07-19T15:35:10.158262 | 2020-09-28T10:04:24 | 2020-09-28T10:04:24 | 140,530,906 | 1 | 1 | null | 2022-06-30T20:25:11 | 2018-07-11T06:23:37 | JavaScript | UTF-8 | Java | false | false | 944 | java | package com.dower.sharerideadmin.core.serverdb.dao;
import com.dower.sharerideadmin.core.serverdb.model.NnaUsers;
import com.dower.sharerideadmin.core.serverdb.model.NnaUsersExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface NnaUsersMapper {
long countByExample(NnaUsersExample example);
int deleteByExample(NnaUsersExample example);
int deleteByPrimaryKey(Integer numUserId);
int insert(NnaUsers record);
int insertSelective(NnaUsers record);
List<NnaUsers> selectByExample(NnaUsersExample example);
NnaUsers selectByPrimaryKey(Integer numUserId);
int updateByExampleSelective(@Param("record") NnaUsers record, @Param("example") NnaUsersExample example);
int updateByExample(@Param("record") NnaUsers record, @Param("example") NnaUsersExample example);
int updateByPrimaryKeySelective(NnaUsers record);
int updateByPrimaryKey(NnaUsers record);
} | [
"1306068431@qq.com"
] | 1306068431@qq.com |
7d478b0e15387b9298e6073b1ac27e2057085e77 | 743e4fe5dce8d113f116fc001bf8ad833d45b4c1 | /src/main/java/com/idealo/model/OfferTypeAgent.java | e32d580447f0c681525c8584c79ee775bbaea1b8 | [] | no_license | paras-aggarwal/cart-checkout | 624427f605dd6ae9026ae45ed2b37f1c9f60cc79 | 8e56038bebf466e5bd9e4a188dcc7dff9f237e6c | refs/heads/master | 2023-07-14T00:47:17.850028 | 2021-08-23T18:05:26 | 2021-08-23T18:05:26 | 399,201,578 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 361 | java | package com.idealo.model;
public interface OfferTypeAgent {
/**
* This method apply any offer price that is applicable on a specific item
* @param itemRecord
* @param config
* @return ItemRecord object with new count and new price after adding item to cart and apply offers
*/
ItemRecord applyOffer(ItemRecord itemRecord, Config config);
}
| [
"paras.aggarwal@outlook.com"
] | paras.aggarwal@outlook.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.