blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
listlengths
0
50
license_type
stringclasses
2 values
repo_name
stringlengths
7
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
557 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
82 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
5.41M
extension
stringclasses
11 values
content
stringlengths
7
5.41M
authors
listlengths
1
1
author
stringlengths
0
161
778cda26dfed7ada8a6022f5dc902aa31aca6f45
34f70c2a8f77b2d5986a1c8397cf2afd883e00ec
/MediumComet.java
e985fac007ad69a3505eda05cf397ac4b44d4bc4
[]
no_license
jberroa/Asteroids
8bd7871483ef05bbe89d70dc95d873535863be13
b1ccb7aa6fdd13960d4af0fb61431d093d45c56a
refs/heads/master
2021-05-02T05:49:23.500126
2016-12-21T17:38:00
2016-12-21T17:38:00
77,072,246
0
0
null
null
null
null
UTF-8
Java
false
false
1,015
java
import java.applet.Applet; import java.applet.AudioClip; import java.net.URL; import java.util.Random; import java.util.Vector; public class MediumComet extends Comet { private double XPOS; private double YPOS; public MediumComet(double xPos, double yPos, double xVel, double yVel) { super(xPos, yPos, xVel, yVel, 30); XPOS = xPos; YPOS = yPos; } public java.util.Vector<Comet> explode() { // play sound because one of the comet was exploded URL soundPath = CometsMain.class.getResource("explosion.wav"); final AudioClip theSound = Applet.newAudioClip(soundPath); theSound.play(); CometsMain.score += 50; Random m = new Random(); // add three small comets Vector<Comet> Lcomet = new Vector<Comet>(); Lcomet.add(new SmallComet(this.XPOS, this.YPOS, m.nextInt(10), m .nextInt(10))); Lcomet.add(new SmallComet(this.XPOS, this.YPOS, m.nextInt(10), m .nextInt(10))); Lcomet.add(new SmallComet(this.XPOS, this.YPOS, m.nextInt(10), m .nextInt(10))); return Lcomet; } }
[ "development@jorges-MacBook-Pro.local" ]
development@jorges-MacBook-Pro.local
2811766f0ee01e789dd2cd76bc2d27ad62f6d954
a0b8e6d757d70e06336c40e3cf5762f494887480
/rainbow-dao/src/main/java/org/rainbow/mapper/system/SysDeptMapper.java
1423a0c45d7e35ab0c1d3775ef94ac3e64771982
[ "Apache-2.0" ]
permissive
TOP-LH/rainbow-web
80370436e9036653d11a9c37bec6e6d8602d29d7
cdb6cf3044e36565e14ea17875361c52c09ec08a
refs/heads/master
2023-01-09T11:11:36.415099
2020-11-06T07:35:13
2020-11-06T07:35:13
null
0
0
null
null
null
null
UTF-8
Java
false
false
223
java
package org.rainbow.mapper.system; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.rainbow.beans.system.SysDept; /** * @author lihao3 */ public interface SysDeptMapper extends BaseMapper<SysDept> { }
[ "lihao3@wison.com" ]
lihao3@wison.com
45ce639e73ec437cab8f4e6b510e03f955bd2992
f139f874aeaa8a11e31bc1b90ad68cdd3e0866a6
/src/es/guillesoft/flascar/ui/FileViewAdapter.java
01a300cf9a3af35492a7c1c52969603d8f6f822c
[]
no_license
ariasdelrio/Flascar
24388d070c84d8e671319b96876dbb5a7eb41a7d
d740f2952bc8af090dc035ded3bb5ad84c028a98
refs/heads/master
2021-01-19T05:07:47.071740
2011-06-28T12:05:44
2011-06-28T12:05:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,385
java
package es.guillesoft.flascar.ui; import java.io.File; import es.guillesoft.flascar.R; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.TextView; public class FileViewAdapter extends BaseAdapter { private Context context; private File [] files; public FileViewAdapter( Context context, File [] files ) { this.context = context; this.files = files; } @Override public int getCount() { return files.length; } @Override public Object getItem( int position ) { return files[position]; } @Override public long getItemId( int position ) { return position; } @Override public View getView( int position, View convertView, ViewGroup parent ) { File file = files[position]; View view = convertView; if( view == null ) { LayoutInflater inflater = (LayoutInflater)context.getSystemService( Context.LAYOUT_INFLATER_SERVICE ); view = inflater.inflate( R.layout.select_file_row, null ); } ImageView imgIcon = (ImageView) view.findViewById( R.id.icon ); imgIcon.setImageResource( file.isDirectory() ? R.drawable.folder : R.drawable.deck ); TextView txtName = ( TextView ) view.findViewById( R.id.text ); txtName.setText( file.getName() ); return view; } }
[ "madtxl@gmail.com" ]
madtxl@gmail.com
f64e7260f04476db76b13c566e3aa748fd50f343
d77a4c41618f8a5caae4e4fa39a7f70cdd2cc4a7
/j1d_08_Eingabe/src/app/Eingabe.java
b9f2288f9495b2c3bf1c9ffa72d6b10dc5323894
[]
no_license
derbaltasar/java1
91685c9675132f5432b52d455acfdd721ddaa6dc
9a9c8f7055190b411cea62fcbb8779e62745fd83
refs/heads/master
2020-12-28T21:52:05.026435
2015-06-04T14:04:02
2015-06-04T14:04:02
null
0
0
null
null
null
null
ISO-8859-1
Java
false
false
518
java
package app; import java.util.Scanner; public class Eingabe { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.print("Vorname: "); String vorname = sc.next();//hält an System.out.print("Nachname:"); String nachname = sc.next();//hält an System.out.println("Alter:"); int alter = sc.nextInt(); //Formatstring System.out.printf("Vorname: %s, Nachname: %s, Alter: %d", vorname,nachname,alter); } }
[ "Student@10.101.102.104" ]
Student@10.101.102.104
5a0b010ef6186e4020003ba02d6319ee418c0dff
7056806d3b1feb2268b3beaa7b01481b0acfd080
/src/main/java/fnguide/index/monitoring/stock/StockCommonService.java
2ba2813677ed3dd6db92a715af4a2c97803745c4
[]
no_license
fagan2888/IndexMonitoringSystem
e159972d5abd747bdeb0e35e97aed7e38276a6b9
082170ff01dd0c9a228c2ea03d81c4b6b5d58042
refs/heads/master
2021-05-28T06:18:11.798115
2014-12-10T10:55:11
2014-12-10T10:55:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
499
java
package fnguide.index.monitoring.stock; import org.mybatis.spring.support.SqlSessionDaoSupport; import org.springframework.stereotype.Service; @Service public class StockCommonService extends SqlSessionDaoSupport{ public String GetUnmByUcd(String u_cd){ String u_nm = (String) getSqlSession().selectOne("StockConstitutionQueryMapper.selectUnmWithUcd", u_cd); return u_nm; } public String GetPDay(String dt){ return (String) getSqlSession().selectOne("common.selectPday", dt); } }
[ "reinitiate@gmail.com" ]
reinitiate@gmail.com
24303a55d4d3efbf1fc05235d192af046ecd96cc
49107bc35744d00b98f61725ef8e66c91a12f08c
/MavLink/Java/Mav10/SET_CAM_SHUTTER_class.java
f7b8204674ad1f52dbb0f5f3412180cd9467faa6
[]
no_license
sixtov/Scripts
998e2e879d0b7e2b28f0ffa60eb92e9381f762c2
9834ac3087e3168816d1fbab276222575e8407a6
refs/heads/master
2021-01-10T21:53:02.476831
2015-07-10T15:07:01
2015-07-10T15:07:01
38,880,767
0
1
null
null
null
null
UTF-8
Java
false
false
3,034
java
//MavLink 1.0 //package gov.nasa.larc.AP; //import gov.nasa.larc.serial.Loggable; /** Message ID: SET_CAM_SHUTTER(151) -------------------------------------- -------------------------------------- */ public class SET_CAM_SHUTTER_class //implements Loggable { public static final int msgID = 151; public short cam_no; // Camera id public short cam_mode; // Camera mode: 0 = auto, 1 = manual public short trigger_pin; // Trigger pin, 0-3 for PtGrey FireFly public int interval; // Shutter interval, in microseconds public int exposure; // Exposure time, in microseconds public float gain; // Camera gain private packet rcvPacket; private packet sndPacket; public SET_CAM_SHUTTER_class() { rcvPacket = new packet(msgID); sndPacket = new packet(msgID); } public SET_CAM_SHUTTER_class(SET_CAM_SHUTTER_class o) { cam_no = o.cam_no; cam_mode = o.cam_mode; trigger_pin = o.trigger_pin; interval = o.interval; exposure = o.exposure; gain = o.gain; } public boolean parse(byte[] b) { return parse(b, false); } public boolean parse(byte[] b, boolean valid) { rcvPacket.load(b); boolean pstatus = valid || rcvPacket.isPacket(); if (pstatus) { rcvPacket.updateSeqNum(); // int[] mavLen = {1, 1, 1, 2, 2, 4}; // int[] javLen = {2, 2, 2, 4, 4, 4}; cam_no = rcvPacket.getShortB(); cam_mode = rcvPacket.getShortB(); trigger_pin = rcvPacket.getShortB(); interval = rcvPacket.getIntS(); exposure = rcvPacket.getIntS(); gain = rcvPacket.getFloat(); } return(pstatus); } public byte[] encode() { return encode( cam_no ,cam_mode ,trigger_pin ,interval ,exposure ,gain ); } public byte[] encode( short v_cam_no ,short v_cam_mode ,short v_trigger_pin ,int v_interval ,int v_exposure ,float v_gain ) { // int[] mavLen = {1, 1, 1, 2, 2, 4}; // int[] javLen = {2, 2, 2, 4, 4, 4}; sndPacket.setSndSeq(); sndPacket.resetDataIdx(); sndPacket.putByteS(v_cam_no); // Add "cam_no" parameter sndPacket.putByteS(v_cam_mode); // Add "cam_mode" parameter sndPacket.putByteS(v_trigger_pin); // Add "trigger_pin" parameter sndPacket.putShortI(v_interval); // Add "interval" parameter sndPacket.putShortI(v_exposure); // Add "exposure" parameter sndPacket.putFloat(v_gain); // Add "gain" parameter // encode the checksum sndPacket.putChkSum(); return sndPacket.getPacket(); } public String getLogHeader() { String param = ( " time" + ", SET_CAM_SHUTTER_cam_no" + ", SET_CAM_SHUTTER_cam_mode" + ", SET_CAM_SHUTTER_trigger_pin" + ", SET_CAM_SHUTTER_interval" + ", SET_CAM_SHUTTER_exposure" + ", SET_CAM_SHUTTER_gain" ); return param; } public String getLogData() { String param = ( System.currentTimeMillis() + ", " + cam_no + ", " + cam_mode + ", " + trigger_pin + ", " + interval + ", " + exposure + ", " + gain ); return param; } }
[ "sixto.l.vazquez@nasa.gov" ]
sixto.l.vazquez@nasa.gov
47f6e2499e733454cfeb7115a8143dd9e2ff6412
7cb68d645bbf93477796d85a2e68b5226b2e10b1
/src/test/java/com/hrms/API/steps/practice/SyntaxAPIAuthenticationSteps.java
6988d02f76692ffd2e261c46b61fb7237058ed86
[]
no_license
salimkocabas/Syntax-HRMS-Project-Cucumber-Tests
c95d37e8ddc15d73650f5ebcadd931dc8a09caf6
b4ad0a73fc21ba8fa8082a64a5dbb52a19ed36d4
refs/heads/master
2023-07-12T19:39:16.956253
2021-08-25T03:47:59
2021-08-25T03:47:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,902
java
package com.hrms.API.steps.practice; import cucumber.api.java.en.Given; import io.restassured.response.Response; import io.restassured.specification.RequestSpecification; import static io.restassured.RestAssured.*; import com.hrms.utils.APIConstants; import com.hrms.utils.CommonMethods; public class SyntaxAPIAuthenticationSteps { /** * Please import the following import static io.restassured.RestAssured.*; - you * need to manually type it */ /** Declaring global and static variables */ private Response response; public static String Token; private static RequestSpecification request; /** * Assigning /generateToken.php URI to a String with variable name * 'generateTokenURI' */ String generateTokenURI = "http://18.232.148.34/syntaxapi/api/generateToken.php"; /** * Here is our Background 'Given' which will always run prior to any scenario we * execute */ @Given("user generates token") public void user_generates_token() { /** * Using given() method to set our header and assigning it to 'request' which * returns RequestSpecification(we declared this as a static variable ) */ request = given().header("Content-Type", "application/json"); /** * Using request.log().all() methods to print out all information that is being * sent as a request This is just for you to visually see what log().all() does * - you can cancel out */ // System.out.println(request.log().all()); /** * Reading JSON File stored in JSONFiles folder using public static readJson() * method stored in common methods for now -- we will store this common method * in different location next class then pass path of your generateToken.json * file as String argument then immediately use .when() to hit generateTokenURI * API by using post() and then storing into 'response' which returns 'Response' * (We declared this as a global variable) Please note this is all in one * statement */ response = request.body(CommonMethods.readJson(APIConstants.GENERATE_TOKEN_JSON)).when().post(generateTokenURI); /** * Using prettyPrint() method so you can see your payload in generateToken.json * file which was converted to a String in previous step */ // System.out.println(response.prettyPrint()); /** * Our JSON payload was converted to a String and stored into 'response' so now * we will use response.jsonPath().getString("token") this will grab the String * that is paired with 'token' in the response, we then stored our token into * 'Token'(We declared this as a Static variable) BUT "Bearer(space)" was added * and concatenated with response.jsonPath().getString("token") to ensure * 'Bearer' keyword is stored with our token */ Token = "Bearer " + response.jsonPath().getString("token"); /** * Printing out stored 'Token'(optional) */ // System.out.println(Token); } }
[ "salimkocabas@gmail.com" ]
salimkocabas@gmail.com
68d02c22059e2b59973c84ffeef4530e9801f688
3fac26f6e05465a905252953a0f7f662ccaf6a4f
/fastcure/MainActivity.java
084485f29ba56035e01ab6fdc877c6b4b9924a62
[]
no_license
aayuprasad/FastCure-Mobile-App
c7132d074556ee2ffc917326c166c20142129fd8
519ad7bb3cc3b47ae64f022308cea8d45c41d437
refs/heads/main
2023-06-11T20:56:29.931964
2021-07-07T18:30:14
2021-07-07T18:30:14
383,891,002
0
0
null
null
null
null
UTF-8
Java
false
false
2,166
java
package com.example.fastcure; import androidx.appcompat.app.AppCompatActivity; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.preference.PreferenceManager; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class MainActivity extends AppCompatActivity { Button patlogin, patreg, doclogin, docreg; DBHelper DB; SharedPreferences pref; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); patlogin = (Button) findViewById(R.id.patlogin); patreg = (Button) findViewById(R.id.patreg); docreg = (Button) findViewById(R.id.docreg); doclogin = (Button) findViewById(R.id.doclogin); DB = new DBHelper(this); patlogin.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(getApplicationContext(), PatientLoginActivity.class); startActivity(intent); } }); patreg.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(getApplicationContext(), PatientRegActivity.class); startActivity(intent); } }); doclogin.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(getApplicationContext(), DoctorLoginActivity.class); startActivity(intent); } }); docreg.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(getApplicationContext(), DoctorRegActivity.class); startActivity(intent); } }); } }
[ "noreply@github.com" ]
noreply@github.com
52d46915f570cf73af5fa72214adf29e6aa93d90
1e7ab77b11bd7124d624e2f4c5a705a28e917c2d
/app/src/main/java/com/example/savchenko/fulldrive/network/FeedBurnerService.java
2e39e3b9b6e6f1cb03cb1e10a7186c54371bf57f
[]
no_license
samaromku/FullDrive
c1888b3b0bd68ccd9560a0e7f11a61d5c0f022fd
c53e3b17ee34fe075c03ae83f43b788d5e68d807
refs/heads/master
2021-09-03T19:52:15.400421
2018-01-11T14:12:03
2018-01-11T14:12:03
117,103,079
0
0
null
null
null
null
UTF-8
Java
false
false
306
java
package com.example.savchenko.fulldrive.network; import com.example.savchenko.fulldrive.entities.Rss; import io.reactivex.Observable; import retrofit2.http.GET; /** * Created by savchenko on 11.01.18. */ public interface FeedBurnerService { @GET("/TechCrunch") Observable<Rss> getNews(); }
[ "savchenko@magnit.ru" ]
savchenko@magnit.ru
abdedd6d6f9ebe0eaa07d281077f9068663ae259
192b08d5e8e3c401df99461f6d5ad502d7606679
/src/main/java/edu/mangement/security/CustomUserDetail.java
69e46250991bed7f65f211c6740d28de94c1516b
[]
no_license
clickpixz/management_saler
743fe40f269d85150c272ab3c16b52a67a9a29c3
df111180b17bd91fb01f2e19aa405350f4c0774c
refs/heads/master
2022-11-23T21:25:22.208519
2020-07-31T07:39:01
2020-07-31T07:39:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,324
java
package edu.mangement.security; import edu.mangement.constant.SystemConstant; import edu.mangement.model.MemberDTO; import lombok.AllArgsConstructor; import lombok.Data; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; import java.util.Collection; import java.util.Collections; /** * Created by IntelliJ IDEA * USER : ctc * DATE : 5/17/2020 * TIME : 6:54 PM */ @Data @AllArgsConstructor public class CustomUserDetail implements UserDetails { MemberDTO member; @Override public Collection<? extends GrantedAuthority> getAuthorities() { return Collections.singleton(new SimpleGrantedAuthority(SystemConstant.ROLE_ADMIN)); } @Override public String getPassword() { return member.getPassword(); } @Override public String getUsername() { return member.getUsername(); } @Override public boolean isAccountNonExpired() { return true; } @Override public boolean isAccountNonLocked() { return true; } @Override public boolean isCredentialsNonExpired() { return true; } @Override public boolean isEnabled() { return true; } }
[ "ninhhoangcuongtnnd15@gmail.com" ]
ninhhoangcuongtnnd15@gmail.com
2122baa665760e933a1cc14ee7bfd376229e74a3
68d6b3e2f9c9a437aa8b967c614811936bbc85d9
/spring-boot-ordered-launcher/src/main/java/net/mfjassociates/boot/launcher/OrderedLauncher.java
3a964dd29cb6d246991f30ac4ac789e659b112dd
[]
no_license
marioja/spring-boot-ordered-launcher
34b166646e31285bc5f949124e4cd1c800e1540c
6788ff8baee28a568b476971f294a7ac90435e2d
refs/heads/master
2021-01-21T10:46:55.304245
2017-03-07T02:00:10
2017-03-07T02:00:10
83,489,937
0
0
null
null
null
null
UTF-8
Java
false
false
170
java
package net.mfjassociates.boot.launcher; import org.springframework.boot.loader.PropertiesLauncher; public class OrderedLauncher extends PropertiesLauncher { }
[ "mario@mfjassociates.net" ]
mario@mfjassociates.net
167c67b9fdfe9a22fe132ccef9785c5db5384e4e
1535dc903447d4d57a0257c1849a860159532a0d
/bbsweb/src/com/itstar/bbs/action/SelectUserAction.java
42bcbde4ad07dd65cf1742da714238c906ea7d55
[]
no_license
qyh123/bbs
7b32dd405e0c1c2b62eefef0cb8d90453f2ae7dd
2abbeecc92c8e9f8fc2561a195511d9c1dcdbd52
refs/heads/master
2021-01-21T09:47:35.753421
2017-05-18T08:54:50
2017-05-18T08:54:50
91,667,736
2
0
null
null
null
null
GB18030
Java
false
false
2,387
java
/** * */ package com.itstar.bbs.action; import java.util.ArrayList; import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import com.itstar.util.Page; import com.itstar.bbs.form.SelectUserForm; import com.itstar.bbs.select.SelectTools; import com.itstar.model.BBSUser; /** * */ public class SelectUserAction extends Action { public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ServletException, java.io.IOException { response.setContentType("text/html;charset=GBK"); request.setCharacterEncoding("GBK"); SelectUserForm userform = (SelectUserForm) form; // 1、定义当前页 int currentPage = 1; // 接收传过来的当前页 try { if (request.getParameter("pages") != null && !request.getParameter("pages").equals("")) { currentPage = Integer.parseInt(request.getParameter("pages")); } } catch (Exception e) { request.setAttribute("error","当前页转换成数字格式时出现异常<br>"+e); return mapping.findForward("error"); } try { // 获得form值 String userSearch = userform.getUserSearch(); String user = userform.getUser(); // 获取list SelectTools st = new SelectTools(); List<BBSUser> userlist = new ArrayList<BBSUser>(); userlist = st.judgementUser(userform); // 获得总记录数 Page page = new Page(userlist, String.valueOf(currentPage)); // 判断是否有记录 if (userlist.size() == 0) { request.setAttribute("errormessage", "不存在此会员!"); } request.setAttribute("currentPage", currentPage); request.setAttribute("pageSize", page.allpage); request.setAttribute("allRecorders", page.allCol); request.setAttribute("userType", user); request.setAttribute("userSearch", userSearch); request.setAttribute("list", page.relist); return mapping.findForward("success"); } catch (RuntimeException e) { // TODO Auto-generated catch block request.setAttribute("error","运行时出现异常<br>"+e); return mapping.findForward("error"); } } }
[ "435256454@qq.com" ]
435256454@qq.com
728855857dbce8e8112af7ac1b5b123ed177b526
18575af93f1e6e926caabdb429ee697d932fd7b6
/src/main/java/Lesson3/AddingInThreads/SymulatorWindowsa.java
c41b0390018a631a02f970fa9234cdaf10d263e7
[]
no_license
paluszkirulez/Programowanie2
6a875b689a7af743450d731b2b86a5364f893607
17fa2a869d4e1bb9ee5f9f9f0fdf4c50b0748e16
refs/heads/master
2020-03-19T08:22:37.543573
2018-06-11T18:45:46
2018-06-11T18:45:46
136,198,860
0
0
null
null
null
null
UTF-8
Java
false
false
361
java
package Lesson3.AddingInThreads; import java.util.List; import java.util.Optional; import java.util.function.IntFunction; public class SymulatorWindowsa { public static void sumuj(List<Integer> integers) throws InterruptedException { Thread.sleep(10000); System.err.println( integers.stream().mapToInt(Integer::intValue).sum()); } }
[ "bartek.dawid1@gmail.com" ]
bartek.dawid1@gmail.com
3e7a42e242751f7164c7c7c653b36f38546a4cab
01e2054c980ab1d7af039006f4099cc2d3bc9141
/res/mvp/PresenterWithAdapter.java
009549cc91468ea0abf248ed93f0d78226085413
[]
no_license
GthanosAI/AutoAndroidProject
253ac99c4b01f2396826289c5168ee29a157af12
a8c3a06e8a65e62a72857d793a1ef4495a4025a5
refs/heads/master
2020-04-09T04:34:18.478034
2019-04-03T06:37:02
2019-04-03T06:37:02
160,028,739
1
0
null
null
null
null
UTF-8
Java
false
false
324
java
package ${package_name}.${sub_path}; import android.util.Log; import java.util.List; import cn.com.earth.mvp.MvpBasePresenter; import ${package_name}.${model_path}.${model_name}; public class ${page_name}Presenter extends MvpBasePresenter<I${page_name}View>{ public void handlerItemClick(${model_name} item){ } }
[ "gthanos@yeah.net" ]
gthanos@yeah.net
d3b547045b4d48d1363f2d32b2a4a802fd01ecec
833c2a9ff4fa32b24c5f5c64c1a6d36e8eb71392
/src/main/java/org/mateuszziebura/krystiantask/repository/HistoryRepository.java
8357d6a149210645cb55f4172bb49bf1eae0f6e0
[]
no_license
MateuszZie/krystian-task
0bbaf245f5f8001f1e7c3f296c18622f7250b5b0
bb77dd30afbb8f5df3aa13f567f5f706082f3d4c
refs/heads/main
2023-06-24T15:28:32.042163
2021-07-23T17:56:14
2021-07-23T17:56:14
388,043,941
0
0
null
null
null
null
UTF-8
Java
false
false
249
java
package org.mateuszziebura.krystiantask.repository; import org.mateuszziebura.krystiantask.domain.History; import org.springframework.data.jpa.repository.JpaRepository; public interface HistoryRepository extends JpaRepository<History,Integer> { }
[ "mateusz_860@op.pl" ]
mateusz_860@op.pl
468a2c935aee1681efb43ab337841209387c2d51
c21f31c5627b36158236bf5dccd8c7aa4e0e8278
/data/PathOut.java
ffa0e7d082ca9ffee01f79415a76ab6dccdc722e
[]
no_license
hubnic/LAB-3
b78b9d892e2abd83b82c1031153661c16ca624d9
f51b8da976b381ae75976dd75156383d27796f1b
refs/heads/master
2021-05-30T03:02:27.288074
2015-03-18T18:58:55
2015-04-07T17:48:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
274
java
package data; import java.util.ArrayList; import java.util.List; public class PathOut { public List<Aretes> PathOut = new ArrayList<Aretes>(); public int nbAretes; public int sommetDepart; public void addAreteIn(Aretes addAretes){ PathOut.add(addAretes); } }
[ "nicolas.hubert.1@etsmtl.net" ]
nicolas.hubert.1@etsmtl.net
a1d20ded6e92e88ddcc047f7bc977608b59c254a
96a6dfed04ce3a5c4b19f726c2e036d5492ca39a
/src/main/java/com/stackroute/Muzixapp/exception/UserAlreadyExistsException.java
bf2c6832840284a6986eb33a9b8fb7522db203e3
[]
no_license
Moupali/SpringBootAssignmentUsingMuzixApp
2bd12073e6d82906e0d13b2aa9a3ce3e27efb203
3e32e10a19d83fadadcc31f6ef009404331222c1
refs/heads/master
2022-01-24T04:34:19.871809
2019-07-29T07:05:24
2019-07-29T07:05:24
199,380,674
0
0
null
2022-01-21T23:27:39
2019-07-29T04:54:27
Java
UTF-8
Java
false
false
350
java
package com.stackroute.Muzixapp.exception; public class UserAlreadyExistsException extends Exception{ private String message; public UserAlreadyExistsException() { } public UserAlreadyExistsException(String message) { super(message); this.message=message; } }
[ "moupali.dutta.68@gmail.com" ]
moupali.dutta.68@gmail.com
aa3dc0ff46c61ea980fefa6ef1ce01738fbf0e31
58cd3947ad68d2661919d1037ff89bd5919fd901
/src/ServerSide/src/main/java/vn/zalopay/ducnm8/da/interact/TransferDAImpl.java
3cc17e1a7a565dea6c063e3c4ff3de3dad120920
[]
no_license
minhduc2803/Snail-Project
8c5349e5a3089023d8fff3ed10f4d159d14c9892
cb3660917c6a82b19996cfdc1355a43a7a4bb389
refs/heads/master
2023-01-11T19:04:24.824330
2020-11-04T08:06:29
2020-11-04T08:06:29
294,295,932
0
0
null
null
null
null
UTF-8
Java
false
false
2,743
java
package vn.zalopay.ducnm8.da.interact; import io.vertx.core.Future; import org.apache.logging.log4j.Logger; import vn.zalopay.ducnm8.common.mapper.EntityMapper; import vn.zalopay.ducnm8.da.BaseTransactionDA; import vn.zalopay.ducnm8.da.Executable; import vn.zalopay.ducnm8.model.Transfer; import vn.zalopay.ducnm8.utils.AsyncHandler; import javax.sql.DataSource; import java.sql.ResultSet; import java.sql.SQLException; import lombok.extern.log4j.Log4j2; @Log4j2 public class TransferDAImpl extends BaseTransactionDA implements TransferDA { private final DataSource dataSource; private final AsyncHandler asyncHandler; private static final String INSERT_TRANSFER_STATEMENT = "INSERT INTO transfer (`sender_id`,`receiver_id`,`amount`,`message`,`transfer_time`) VALUES (?, ?, ?, ?, ?);"; private static final String SELECT_TRANSFER_BY_ID = "SELECT * FROM transfer WHERE id = ?"; public TransferDAImpl(DataSource dataSource, AsyncHandler asyncHandler) { super(); this.dataSource = dataSource; this.asyncHandler = asyncHandler; } @Override public Executable<Transfer> insert(Transfer transfer) { log.info("insert a transfer, senderId = {} receiverId = {}", transfer.getSenderId(), transfer.getReceiverId()); return connection -> { Future<Transfer> future = Future.future(); asyncHandler.run( () -> { Object[] params = {transfer.getSenderId(), transfer.getReceiverId(), transfer.getAmount(), transfer.getMessage(), transfer.getTransferTime()}; try { long id = executeWithParamsAndGetId(connection.unwrap(), INSERT_TRANSFER_STATEMENT, params, "insertTransfer", true); transfer.setId(id); future.complete(transfer); log.info("insert a transfer successfully"); } catch (Exception e) { log.error(e.getMessage()); future.fail(e.getMessage()); } }); return future; }; } @Override public Future<Transfer> selectTransferById(long id) { Future<Transfer> future = Future.future(); asyncHandler.run( () -> { Object[] params = {id}; queryEntity( "queryTransfer", future, SELECT_TRANSFER_BY_ID, params, this::mapRs2EntityTransfer, dataSource::getConnection, false); }); return future; } private Transfer mapRs2EntityTransfer(ResultSet resultSet) throws Exception { Transfer transfer = null; while (resultSet.next()) { transfer = new Transfer(); EntityMapper.getInstance().loadResultSetIntoObject(resultSet, transfer); } return transfer; } }
[ "hontomoni@gmail.com" ]
hontomoni@gmail.com
44d079b1929b3041abf6fa64ae5cbc5f6545336c
4607d462e0000395a7efa01f14d126b4403d868f
/app/src/main/java/com/ekspeace/barbershop/View/UserInfo.java
6e15761a5896361dce4360c91a8610aa76c20bb1
[]
no_license
Ekspeace/BarberShop
4327ec2311cef632428a1a71fbfb0cdf213790da
28ee8c47175905535ee69e786d9e3d0129ddff8f
refs/heads/master
2023-08-27T01:01:09.201718
2021-09-27T19:59:50
2021-09-27T19:59:50
375,719,126
0
0
null
null
null
null
UTF-8
Java
false
false
5,047
java
package com.ekspeace.barbershop.View; import androidx.appcompat.app.AppCompatActivity; import androidx.constraintlayout.widget.ConstraintLayout; import androidx.lifecycle.ViewModelProvider; import androidx.localbroadcastmanager.content.LocalBroadcastManager; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.os.Bundle; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.ImageView; import android.widget.Toast; import com.ekspeace.barbershop.Constants.PopUp; import com.ekspeace.barbershop.Constants.Utils; import com.ekspeace.barbershop.R; import com.parse.ParseFile; import com.parse.ParseObject; import java.io.File; public class UserInfo extends AppCompatActivity { private ImageView ivBack, ivHome; private EditText etName, etNumber; private Button btnConfirm; private ConstraintLayout loading; private byte[] haircutImage, specialImage; private String specialInfo; private View layout; private PopUp popUp; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_user_info); popUp = new PopUp(); LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance(this); localBroadcastManager.registerReceiver(NetworkError,new IntentFilter(Utils.connection)); LayoutInflater inflater = getLayoutInflater(); layout = inflater.inflate(R.layout.custom_toast, findViewById(R.id.custom_toast_container)); InitializeWidgets(); ClickEvents(); } private void InitializeWidgets(){ ivBack = findViewById(R.id.user_back); ivHome = findViewById(R.id.user_home); etName = findViewById(R.id.user_name); etNumber = findViewById(R.id.user_number); btnConfirm = findViewById(R.id.user_confirm); loading = findViewById(R.id.progress_bar_user); specialInfo = SpecialService.info; specialImage = SpecialService.inputData; haircutImage = InsertHairCutPicture.inputData; } private void ClickEvents(){ ivBack.setOnClickListener(view -> finish()); ivHome.setOnClickListener(view -> startActivity(new Intent(this, MainActivity.class))); btnConfirm.setOnClickListener(view -> { SaveAppointment(); }); } private void SaveAppointment(){ String service = getIntent().getStringExtra(Utils.service); String timeDate = getIntent().getStringExtra(Utils.timeDate); String barber = getIntent().getStringExtra(Utils.barber); String name = etName.getText().toString().trim(); String number = etNumber.getText().toString().trim(); if (TextUtils.isEmpty(number)) { etNumber.setError("Contact number is Required."); return; } if (TextUtils.isEmpty(name)) { etName.setError("Name is required"); return; } btnConfirm.setVisibility(View.GONE); loading.setVisibility(View.VISIBLE); if(Utils.isOnline(this)) { ParseObject userAppointment = new ParseObject("UserAppointment"); userAppointment.put("userName", name); userAppointment.put("userNumber", number); userAppointment.put("userService", service); userAppointment.put("userTimeDate", timeDate); userAppointment.put("userBarber", barber); if(specialImage != null){ParseFile parseFile = new ParseFile(specialImage);userAppointment.put("userSpecialServiceImage", parseFile);} if(haircutImage != null){ParseFile parseFile = new ParseFile(haircutImage);userAppointment.put("userHaircutImage", parseFile);} if(specialInfo != null){if(!specialInfo.isEmpty())userAppointment.put("userSpecialServiceInfo", specialInfo);} userAppointment.saveInBackground(e -> { if (e == null) { loading.setVisibility(View.GONE); PopUp.Toast(UserInfo.this, layout, "Appointment has been successfully confirmed", Toast.LENGTH_SHORT); startActivity(new Intent(UserInfo.this, MainActivity.class)); } else { loading.setVisibility(View.GONE); btnConfirm.setVisibility(View.VISIBLE); PopUp.Toast(UserInfo.this, layout, e.getMessage(), Toast.LENGTH_LONG); } }); }else { loading.setVisibility(View.GONE); btnConfirm.setVisibility(View.VISIBLE); popUp.InternetDialog(this); } } private final BroadcastReceiver NetworkError = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { SaveAppointment(); } }; }
[ "tshelezas@gmail.com" ]
tshelezas@gmail.com
7aa01d5021ab058b04ec7ae67d7ebe3b30dec85a
e30029307c0769b7986c5ffdfcbe227619963126
/src/framePack/LoginPanel.java
6126ba55c6aa34c2a4a748a2c52f5703851be914
[]
no_license
atmshiblesadik/Graph-Simulation
87b971576b0e8f83df330f4b7ff6edebbf0e3f3f
6e33158e7d013b826e554333ed329b7bb8926102
refs/heads/master
2020-06-13T10:09:31.324979
2019-07-02T05:52:27
2019-07-02T05:52:27
194,622,986
0
0
null
null
null
null
UTF-8
Java
false
false
1,725
java
package framePack; import eventPack.LoginEvent; import eventPack.registerEvent; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.JPasswordField; import javax.swing.JButton; public class LoginPanel extends JPanel { private static boolean create=false; private static LoginPanel loginRef=null; private static JPasswordField pass=null; private static JTextField text1=null; public static LoginPanel getRef() { if(create==false) { loginRef=new LoginPanel(); create=true; return loginRef; }else return loginRef; } private LoginPanel() { this.loginRef=this; this.setLayout(null); this.setName("Login Window"); this.setSize(400,500); this.setLocation(250,80); initialize(); this.setVisible(true); } private void initialize() { JLabel labeluser = new JLabel("User Name: "); labeluser.setBounds(35, 80, 80, 25); add(labeluser); text1 = new JTextField(); text1.setBounds(128, 77, 220, 30); text1.setText(""); add(text1); JLabel labelPassword = new JLabel("Password: "); labelPassword.setBounds(35, 163, 80, 25); add(labelPassword); pass = new JPasswordField(); pass.setBounds(128, 160, 220, 30); add(pass); //Login_Button JButton login = new JButton("Login"); login.setBounds(35, 250, 100, 35); add(login); login.addActionListener(new LoginEvent()); //Register_Button JButton register = new JButton("Register"); register.setBounds(250, 250,100, 35); add(register); register.addActionListener(new registerEvent()); } public static String getUserName() { return text1.getText(); } public static char[] getPasss() { return pass.getPassword(); } }
[ "shiblesadik@outlook.com" ]
shiblesadik@outlook.com
ace9929b25d9b40d2fef6ea8d84de2705aa219e1
9705e6ec96be53c3d21d1e6f1eb777ac4b851b3a
/Fluid/src/cs567/smoke/SeedDrop.java
16ba7ba1824dbc3d4f732d9bf3675057fb39eea1
[]
no_license
sytianhe/FluidSimulation
57aba46277eda803ff4293a4018235926b84ee83
a83969d93ca335ac8073932662ebb6de42dfeaf9
refs/heads/master
2020-05-17T00:47:52.799610
2013-05-14T07:07:30
2013-05-14T07:07:30
9,224,069
1
0
null
null
null
null
UTF-8
Java
false
false
14,709
java
package cs567.smoke; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; import javax.media.opengl.GL; import javax.media.opengl.GL2; import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLEventListener; import javax.media.opengl.awt.GLCanvas; import javax.swing.JFrame; import javax.vecmath.Point2d; import javax.vecmath.Vector2d; import javax.vecmath.Vector2f; import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.util.awt.Screenshot; /** * * CS5643: Final Project Seed Drop Experiment. * * We randomly generate and drop shapes into a fluid, and measure some stuff about how they fall. * * * Base code by * @author Doug James, April 2007 * * Extended by * @author homoflashmanicus, 2013 */ public class SeedDrop implements GLEventListener { /** EXPERIMENT PARAMETERS. */ float time; /** Number of shapes to sample. Sampled uniformly or at random?*/ int N_SHAPES = 50; /** Number of drops per shape. Sampled uniformly or at random?*/ int N_SAMPLES_PER_SHAPE = 20; /** Count the number of shapes so far. */ int shapeCounter = 0; /** Count the number of samples per shape so far. */ int sampleCounter = 0; int N_SHAPE_PARAMETERS = 2; /** Store shape parameters. */ double[] ShapeParameters; /** Store average velocity per drop per shape. */ double[][] AvgVelocity; /** Store terminal velocity per drop per shape. */ double[][] TerminalVelocity; /** Store max horizontal displacement. */ double[][] MaxDisplacment; /** Store max horizontal displacement. */ double[][] FinalDisplacment; /** Start Position. */ Point2d StartPosition = new Point2d(Constants.N/2f, Constants.N - 10f); /** Start Velocity. */ Vector2d StartVelocity = new Vector2d(); ArrayList<Point2d> path = new ArrayList<Point2d>(); /** Grid height at which we take measurments. To avoid the pesky computational reigion at the edges. */ float MeasureHeight = 10; /** Current rigid body being simulated. */ RigidBody rb; /** Rigid body density. */ float density = 5f; /** Track terminal velocity of rb. */ double terminalVelocity; /** Track max discplacement of rigid body. */ double maxDisplacement; /** Keep my fluid safe. */ FluidSolver fs; /** NOW FOR A BUNCH OF (MOSTLY) DISPLAY PARAMETERS. */ /** Times steps per frame. */ int N_STEPS_PER_FRAME = 1; /** Size of time step (in seconds). */ public float dt = Constants.dt; /** Size of grid. */ private int n = Constants.n; /** Main window frame. */ JFrame frame = null; /** Frame dimensions. */ static final int dim = 600; /** Reference to current FrameExporter, or null if no frames being dumped. */ FrameExporter frameExporter; /** Reference to file writer, or null if no date is being saved. */ FileWriter writer; private int width, height; /** Toggle display and or advance simulation. */ boolean simulate = false; boolean veldisplay = false; boolean forcedisplay = false; /** Draws wireframe if true, and pixel blocks if false. */ boolean drawWireframe = false; /** Useful for displaying stuff. */ private OrthoMap orthoMap; /** * Main constructor. Call start() to begin simulation. * */ SeedDrop(){ //Initialize data storage ShapeParameters = new double[N_SHAPES*N_SHAPE_PARAMETERS]; AvgVelocity = new double[N_SHAPES][N_SAMPLES_PER_SHAPE]; TerminalVelocity = new double[N_SHAPES][N_SAMPLES_PER_SHAPE]; MaxDisplacment = new double[N_SHAPES][N_SAMPLES_PER_SHAPE]; FinalDisplacment = new double[N_SHAPES][N_SAMPLES_PER_SHAPE]; //Initialize fluid solver fs = new FluidSolver(); fs.setNumerofFrame(N_STEPS_PER_FRAME); } /** Simulate then display particle system and any builder * adornments. */ void simulateAndDisplayScene(GL2 gl) { ////////////////////// // SIMULATE /////////////////////// if(simulate && shapeCounter < N_SHAPES) { //initialzie new experiment as needed if(rb == null){ System.out.println("CREATING NEW RIDIG BODY"); sampleCounter = 0; // GENERATE NEW SHAPE RANDOMELY. // SHAPE SHOULD CONSERVE SOME QUANTITY????? // eg volume, surface area, mass, etc double a = 4f + 4f * Math.random(); //Major axis double b = 1f + 3f * Math.random(); //Minor axis ShapeParameters[2*shapeCounter] = a; ShapeParameters[2*shapeCounter+1] = b; rb = new RigidEllipse2(StartPosition, StartVelocity, 0, 0, density, a , b); fs.addRigidBody(rb); time = 0; maxDisplacement = 0; terminalVelocity = 0; path.clear(); } //PERFORM FLUID SIMULATION for(int s=0; s<N_STEPS_PER_FRAME; s++) { fs.velocitySolver(); fs.densitySolver(); //Add some smoke if you want to see fluid motion. time += dt; } //Update and tracked quantities // KEEP RECORD OF TERMINAL VELOCITY AND MAX HOR terminalVelocity = Math.max( rb.v.lengthSquared(), terminalVelocity) ; maxDisplacement = Math.max(Math.abs(rb.getPosition().x-StartPosition.x), maxDisplacement); path.add(new Point2d(rb.x)); if(rb.getPosition().y < MeasureHeight) { System.out.println("RIGID BODY REACHED BOTTOM"); //Shape reached the bottom, so save data. AvgVelocity[shapeCounter][sampleCounter] = (StartPosition.y - MeasureHeight)/time; TerminalVelocity[shapeCounter][sampleCounter] = terminalVelocity; MaxDisplacment[shapeCounter][sampleCounter] = maxDisplacement ; FinalDisplacment[shapeCounter][sampleCounter] = (rb.getPosition().x - StartPosition.x); //Reset fluid system. And measurument variables fs.reset(); time = 0; maxDisplacement = 0; terminalVelocity = 0; path.clear(); if(sampleCounter < N_SAMPLES_PER_SHAPE-1){ System.out.println("RESET RIGID BODY AND ROTATE"); //Setup new drop with the same shape sampleCounter += 1; rb.reset(); rb.theta += Math.PI * sampleCounter/(N_SAMPLES_PER_SHAPE); } else{ System.out.println("CLEAR RIGID BODY FOR NEW SHAPE"); //clear rb for a new shape shapeCounter += 1; fs.RB.clear(); rb = null; } } } else if(simulate && shapeCounter == N_SHAPES ){ System.out.println("ALL DONE"); //SAVE RESULTS AND END SIMULATION // TODO : SAVE AND EXIT long timeNS = -System.currentTimeMillis(); String filename = "data/seeddrop"+timeNS + ".txt";/// BUG: DIRECTORY MUST EXIST! try { writer = new FileWriter(filename); writer.write("SHAPECLASS " + RigidEllipse2.class.getName() + "\n"); writer.write("NSHAPES " + N_SHAPES + "\n"); writer.write("N_SAMPLES_PER_SHAPE " + N_SAMPLES_PER_SHAPE + "\n"); writer.write("DENSITY " + density + "\n"); writer.write("\n"); writer.write("i j majorAxis minorAxis AvgVel TermVel MaxDispX FinalDispX"); writer.write("\n"); for (int i =0; i< N_SHAPES; i++){ for (int j=0; j< N_SAMPLES_PER_SHAPE; j ++){ String str = "" + i + " " + j + " "; str += ShapeParameters[2*i]+ " "; str += ShapeParameters[2*i+1]+ " "; str += AvgVelocity[i][j] + " "; str += TerminalVelocity[i][j] + " "; str += MaxDisplacment[i][j] + " "; str += FinalDisplacment[i][j] + "\n"; writer.write(str); } } writer.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } System.exit(0); } //////////////////// // DRAW //////////////////// {//DRAW PATH: if (path.size()>1){ gl.glLineWidth((float) 1f); gl.glColor3d(0.0, 0.0, 1.0); gl.glBegin(GL2.GL_LINES); for(Point2d p : path){ gl.glVertex2d(p.x/Constants.N, p.y/Constants.N); } gl.glEnd(); } } if(rb!=null){ rb.display(gl); } if(veldisplay){ /// DON'T DRAW 0, n+1 border: for(int i=1; i<=n; i++) { gl.glBegin(gl.GL_LINES); gl.glLineWidth(0.05f); gl.glColor3f(1.0f, 0.0f, 0.0f); float x = (i + 0.5f)/(float)n; for(int j=1; j<=n; j++) { float y = (j + 0.5f)/(float)n; Vector2f temp = new Vector2f(fs.u[Constants.I(i,j)], fs.v[Constants.I(i,j)]); //System.out.println(temp); temp.scale(10f); gl.glVertex2f(x, y); float u = temp.x; float v = temp.y; gl.glVertex2f(x+u/n, y+v/n); } gl.glEnd(); } } if(forcedisplay){ /// DON'T DRAW 0, n+1 border: for(int i=1; i<=n; i++) { gl.glBegin(gl.GL_LINES); gl.glLineWidth(0.1f); gl.glColor3f(0.0f, 1.0f, 0.0f); float x = (i - 0.5f)/(float)n; for(int j=1; j<=n; j++) { float y = (j - 0.5f)/(float)n; Vector2f temp = new Vector2f(fs.fx[Constants.I(i,j)], fs.fy[Constants.I(i,j)]); gl.glVertex2f(x, y); float u = 0.1f*temp.x; float v = 0.1f*temp.y; gl.glVertex2f(x+u, y+v); } gl.glEnd(); } } } /** * Builds/shows window, and starts simulator. */ public void start() { if(frame != null) return; frame = new JFrame("SEED DROP! HIT SPACE TO START"); GLCanvas canvas = new GLCanvas(); canvas.addGLEventListener(this); canvas.addKeyListener(new KeyAdapter() { public void keyTyped(KeyEvent e) { dispatchKey(e.getKeyChar(), e); } }); frame.add(canvas); final Animator animator = new Animator(canvas); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { // Run this on another thread than the AWT event queue to // make sure the call to Animator.stop() completes before // exiting new Thread(new Runnable() { public void run() { animator.stop(); System.exit(0); } }).start(); } }); frame.pack(); frame.setSize(dim, dim); frame.setLocation(200, 0); frame.setVisible(true); animator.start(); } /** GLEventListener implementation: Initializes JOGL renderer. */ public void init(GLAutoDrawable drawable) { // DEBUG PIPELINE (can use to provide GL error feedback... disable for speed) //drawable.setGL(new DebugGL(drawable.getGL())); GL2 gl = drawable.getGL().getGL2(); System.err.println("INIT GL IS: " + gl.getClass().getName()); gl.setSwapInterval(1); gl.glLineWidth(1); } /** GLEventListener implementation */ public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {} /** GLEventListener implementation */ public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { System.out.println("width="+width+", height="+height); height = Math.max(height, 1); // avoid height=0; this.width = width; this.height = height; GL2 gl = drawable.getGL().getGL2(); gl.glViewport(0,0,width,height); /// SETUP ORTHOGRAPHIC PROJECTION AND MAPPING INTO UNIT CELL: gl.glMatrixMode(GL2.GL_PROJECTION); gl.glLoadIdentity(); orthoMap = new OrthoMap(width, height);//Hide grungy details in OrthoMap orthoMap.apply_glOrtho(gl); /// GET READY TO DRAW: gl.glMatrixMode(GL2.GL_MODELVIEW); gl.glLoadIdentity(); } /** * Main event loop: OpenGL display + simulation * advance. GLEventListener implementation. */ public void display(GLAutoDrawable drawable) { GL2 gl = drawable.getGL().getGL2(); gl.glClearColor(0,0,0,0); gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); {/// DRAW COMPUTATIONAL CELL BOUNDARY: gl.glBegin(GL.GL_LINE_STRIP); if(simulate) gl.glColor3f(0,0,0); else gl.glColor3f(1,0,0); gl.glEnd(); } if (drawWireframe) gl.glPolygonMode(GL.GL_FRONT_AND_BACK, GL2.GL_LINE); else gl.glPolygonMode(GL.GL_FRONT_AND_BACK, GL2.GL_FILL); simulateAndDisplayScene(gl);/// <<<-- MAIN CALL if(frameExporter != null) frameExporter.writeFrame(); } private float getDrawDensity(int i, int j) { float d = 2*fs.getDensity(i,j);///arbitrary scaling if(d < 0) d=0; return d; } /** * Handles keyboard events, e.g., spacebar toggles * simulation/pausing, and escape resets the current Task. */ public void dispatchKey(char key, KeyEvent e) { if(key == ' ') {//SPACEBAR --> TOGGLE SIMULATE simulate = !simulate; } else if (key == 'r') {//RESET USE ONLY IF YOU DONT CARE ABOUT THE FINAL DATA System.out.println("RESET!"); frameExporter = null; fs.reset(); rb = null; shapeCounter += 1; path.clear(); } // else if (key == 'd'){ // density += 1; // if(rb != null) rb.density = density; // System.out.println("DENSITY CHANGED: " + density); // } // else if (key == 'D'){ // density -= 1; // if(rb != null) rb.density = density; // System.out.println("DENSITY CHANGED: " + density); // } else if (key == 'v') {// velocity field display veldisplay = !veldisplay; if (veldisplay){ System.out.println("VELOCITY FIELD ON"); } else { System.out.println("VELOCITY FIELD OFF"); } forcedisplay = false; } else if (key == 'f') {// force field display forcedisplay = !forcedisplay; if (forcedisplay){ System.out.println("FORCE FIELD ON"); } else{ System.out.println("FORCE FIELD OFF"); } veldisplay = false; } else if (key == 'e') {//toggle exporter frameExporter = ((frameExporter==null) ? (new FrameExporter()) : null); System.out.println("'e' : frameExporter = "+frameExporter); } } /** * ID of latest FrameExporter */ private static int exportId = -1; /** * Code to dump frames---very useful for slow/large runs. */ private class FrameExporter { private int nFrames = 0; FrameExporter() { exportId += 1; } void writeFrame() { long timeNS = -System.nanoTime(); String number = Utils.getPaddedNumber(nFrames, 5, "0"); String filename = "frames/export"+exportId+"-"+number+".png";/// BUG: DIRECTORY MUST EXIST! try{ java.io.File file = new java.io.File(filename); if(file.exists()) System.out.println("WARNING: OVERWRITING PREVIOUS FILE: "+filename); /// WRITE IMAGE: ( :P Screenshot asks for width/height --> cache in GLEventListener.reshape() impl) Screenshot.writeToFile(file, width, height); timeNS += System.nanoTime(); System.out.println((timeNS/1000000)+"ms: Wrote image: "+filename); }catch(Exception e) { e.printStackTrace(); System.out.println("OOPS: "+e); } nFrames += 1; } } /** * ### Ready. Set. ### */ public static void main(String[] args) { SeedDrop sim = new SeedDrop(); sim.start(); } @Override public void dispose(GLAutoDrawable arg0) { // TODO Auto-generated method stub } }
[ "michael.flashman@gmail.com" ]
michael.flashman@gmail.com
a373d061c5c086987984eec7e7411a0418d88145
ccde7c6637757521be250afc851e67cdbf886f62
/src/models/MyArrayList.java
8b84da1160cf126091ed9048a81347989ec8a4e4
[]
no_license
YusraFrouz/PublicTransportTicketing
be093ac794bca5227686f81f9f973da7f22283f4
b7d7465b68224d9f5949b25e7821ef10ea45ae9b
refs/heads/master
2021-01-02T09:05:15.797699
2017-08-11T03:39:42
2017-08-11T03:39:42
99,140,252
0
0
null
2017-08-05T06:35:56
2017-08-02T16:46:31
Java
UTF-8
Java
false
false
379
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 models; import java.util.ArrayList; import java.io.Serializable; /** * * @author ihsani */ public class MyArrayList<Employee> extends ArrayList implements Serializable{ }
[ "fathimayusra@yahoo.com" ]
fathimayusra@yahoo.com
026c8cad57005339854a55223e3d8f71c0265cb4
fa93c9be2923e697fb8a2066f8fb65c7718cdec7
/sources/com/avito/android/item_visibility_tracker/ItemVisibilityTrackerKt.java
d18c8b0240dd98e75ba955778d773463ec40aa17
[]
no_license
Auch-Auch/avito_source
b6c9f4b0e5c977b36d5fbc88c52f23ff908b7f8b
76fdcc5b7e036c57ecc193e790b0582481768cdc
refs/heads/master
2023-05-06T01:32:43.014668
2021-05-25T10:19:22
2021-05-25T10:19:22
370,650,685
0
0
null
null
null
null
UTF-8
Java
false
false
245
java
package com.avito.android.item_visibility_tracker; import kotlin.Metadata; @Metadata(bv = {1, 0, 3}, d1 = {"\u0000\u0002\n\u0000¨\u0006\u0000"}, d2 = {"serp-core_release"}, k = 2, mv = {1, 4, 2}) public final class ItemVisibilityTrackerKt { }
[ "auchhunter@gmail.com" ]
auchhunter@gmail.com
168579b786926d09c6bb8ae6108ce160bd2e6d0c
8db1d263da5ba0fc7bcbf6cb94ee0859d039190a
/src/test/java/com/cybertek/tests/day6_css/cssLocator.java
f12acbd06cc085303dc6763e7cf4148d0f46f68c
[]
no_license
Baros2535/EU5TestNGSelenium
f5f76a067c37fe1ca9e3fe79bb627f0dfd84643b
04e620af748c9ef5d43f8c3990a9dd0f2a775fea
refs/heads/master
2023-06-23T18:42:07.850740
2021-07-27T15:00:58
2021-07-27T15:00:58
369,652,746
0
0
null
null
null
null
UTF-8
Java
false
false
613
java
package com.cybertek.tests.day6_css; import com.cybertek.utilities.WebDriverFactory; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; public class cssLocator { public static void main(String[] args) { WebDriver driver= WebDriverFactory.getDriver("chrome"); driver.get("http://practice.cybertekschool.com/multiple_buttons"); By locationOfButton2= By.cssSelector("#disappearing_button"); WebElement foundOfButton2= driver.findElement(locationOfButton2); foundOfButton2.click(); driver.quit(); } }
[ "brsaltn.25@gmail.com" ]
brsaltn.25@gmail.com
af2c70243c3392ef5fd5e2aff83bf5325ef85542
83a51f6ee901b08570ff42670c37348d0bf3c2e5
/src/test/java/com/ldh/book/springboot/web/dto/HelloResponseDtoTest.java
dffa51a6ee2eb5b3de45996834b8d38ff8c0d4dc
[]
no_license
ldonghee/gradle_springboot
e6c31830076195563f5762069c39da66d86a8f96
f9ccc960b54b894f2412d027bbe9975681de8fc8
refs/heads/master
2023-01-12T07:45:30.082992
2020-11-18T23:32:44
2020-11-18T23:32:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
504
java
package com.ldh.book.springboot.web.dto; import org.junit.Test; import static org.assertj.core.api.Assertions.assertThat; public class HelloResponseDtoTest { @Test public void 롬복_기능_테스트() { // given String name = "test"; int amount = 1000; // when HelloResponseDto dto = new HelloResponseDto(name, amount); // then assertThat(dto.getName()).isEqualTo(name); assertThat(dto.getAmount()).isEqualTo(amount); } }
[ "ehdgml3206@naver.com" ]
ehdgml3206@naver.com
85bd007b6f19e5f73b1563353b09376ad9dff1e6
978dd7fb28ac15f92cf0187b4d09739ba8058827
/src/teste/FileUploadBancoServlet.java
6f629a1e546ffce5827ed854da95b8e50a1b64ea
[]
no_license
rfigueiredo27/gerenciador_site
00d01472d638c93bb3bd46844b62d22d52ee5693
af6cfe55ccd64f33ddce1d18f5b53b506ac62048
refs/heads/master
2020-03-21T00:59:07.793878
2018-06-19T19:15:04
2018-06-19T19:15:04
137,918,453
0
0
null
null
null
null
ISO-8859-1
Java
false
false
9,328
java
package teste; import javax.servlet.Servlet; import javax.servlet.http.HttpServlet; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.PrintWriter; import java.sql.CallableStatement; import java.sql.Connection; import java.sql.DriverManager; import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import oracle.jdbc.OracleTypes; import org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.FileItemFactory; import org.apache.commons.fileupload.FileUploadException; import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.fileupload.servlet.ServletFileUpload; import teste.FileUploadBancoListener; /** * This is a File Upload Servlet that is used with AJAX * to monitor the progress of the uploaded file. It will * return an XML object containing the meta information * as well as the percent complete. * * @author Frank T. Rios * * Initial Creation Date: 6/24/2007 */ public class FileUploadBancoServlet extends HttpServlet implements Servlet { private static final long serialVersionUID = 2740693677625051632L; public FileUploadBancoServlet() { super(); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out = response.getWriter(); HttpSession session = request.getSession(); FileUploadBancoListener listener = null; StringBuffer buffy = new StringBuffer(); long bytesRead = 0, contentLength = 0; // Make sure the session has started if (session == null) { return; } else if (session != null) { // Check to see if we've created the listener object yet listener = (FileUploadBancoListener)session.getAttribute("LISTENER"); if (listener == null) { return; } else { // Get the meta information bytesRead = listener.getBytesRead(); contentLength = listener.getContentLength(); } } /* * XML Response Code */ response.setContentType("text/xml"); buffy.append("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"); buffy.append("<response>\n"); buffy.append("\t<bytes_read>" + bytesRead + "</bytes_read>\n"); buffy.append("\t<content_length>" + contentLength + "</content_length>\n"); // Check to see if we're done if (bytesRead == contentLength) { buffy.append("\t<finished />\n"); // No reason to keep listener in session since we're done session.setAttribute("LISTENER", null); } else { // Calculate the percent complete long percentComplete = ((100 * bytesRead) / contentLength); buffy.append("\t<percent_complete>" + percentComplete + "</percent_complete>\n"); } buffy.append("</response>\n"); out.println(buffy.toString()); out.flush(); out.close(); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // create file upload factory and upload servlet FileItemFactory factory = new DiskFileItemFactory(); ServletFileUpload upload = new ServletFileUpload(factory); // set file upload progress listener FileUploadBancoListener listener = new FileUploadBancoListener(); HttpSession sessao = request.getSession(); sessao.setAttribute("LISTENER", listener); // upload servlet allows to set upload listener upload.setProgressListener(listener); /*List uploadedItems = null; FileItem fileItem = null; String //filePath = "c:\\temp"; // Path to store file on local system filePath = "http:\\\\rjweb12.tre-rj.jus.br\\site\\webtemp"; System.out.println(filePath);*/ try { int idArea = 61; String retorno = ""; PrintWriter out = response.getWriter(); /*String vsql = "{call gecoi.g_inclusao_arquivo(?, ?, ?, ?, " + "?, ?, ?, " + "?, ?, ?, Empty_Blob(), ?, ?, " + "?)}";*/ String vsql = "{call gecoi.g_proc_inc_arq_cont_exist(?, ?, ?, ?, ?, ?, ?, ?, ?)"; CallableStatement cs; List<FileItem> items = upload.parseRequest(request); //int total = items.size(); /*Iterator iteracao = items.iterator(); while (iteraracao.hasNext()) { FileItem item = (FileItem) iteracao.next(); if (!item.isFormField()) { is = item.getInputStream(); } }*/ /*FileItem item = items.get(0); String numProcesso = item.getString(); item = items.get(1); String anoProcesso = item.getString(); item = items.get(2); String numContrato = item.getString(); item = items.get(3); String anoContrato = item.getString(); item = items.get(4); String vigenciaIni = item.getString(); item = items.get(5); String vigenciaFim = item.getString(); item = items.get(6); String descContrato = item.getString(); item = items.get(7); String dataPublicacao = item.getString(); FileItem arquivo = items.get(8);*/ FileItem arquivo = items.get(0); String vnome = arquivo.getName().toString(); String vnomeArquivo = vnome.substring(vnome.lastIndexOf("\\")+1); //nome do arquivo //HttpSession sessao = request.getSession(true); Class.forName("oracle.jdbc.driver.OracleDriver"); Connection connection = DriverManager.getConnection("jdbc:oracle:thin:@rjdbs03:1521:ursa", "gecoi", "5851385"); //Connection connection = (Connection) sessao.getAttribute("connection"); //sessao.setAttribute("LISTENER", listener); // upload servlet allows to set upload listener upload.setProgressListener(listener); cs = connection.prepareCall(vsql); /* // variáveis da inclusão de conteudo cs.setString(1,"1/12-2/12-descContrato"); //descricao_conteudo cs.setString(2,"01/12/2013 a 30/12/2013");//vobservacao cs.setString(3,"gecoi"); //vlogon_usuario_criacao cs.setString(4,"gecoi"); //vlogon_usuario_ult_alteracao // variáveis da inclusão de conteudo_area cs.setInt(5, idArea); //vid_area cs.setString(6,"01/12/2013"); //vdata_inicio_exib cs.setDate(7, null); // variáveis da inclusão de arquivo cs.setString(8,"1/12-2/12-descContrato"); //vdescricao_arquivo cs.setBinaryStream(9,arquivo.getInputStream(), (int) arquivo.getSize()); //arquivo cs.setString(10,vnomeArquivo.substring(vnomeArquivo.lastIndexOf(".")));//nome cs.setString(11,"");//nome_arquivo_reduzido cs.setInt(12,0);//ordem // retorno cs.registerOutParameter(13, OracleTypes.VARCHAR); //retorno */ // retorno cs.registerOutParameter(1, OracleTypes.VARCHAR); //retorno //List<FileItem> items = upload.parseRequest(request); //FileItem arquivo = items.get(0); //String vnome = arquivo.getName().toString(); // variáveis da alteração do conteúdo cs.setInt(2,77584); //id do conteudo cs.setString(3,"descricao"); //descricao cs.setString(4,"observacao"); //observacao cs.setString(5,"usuario"); //usuario // variáveis da inclusão de arquivo //File arquivo = new File(diretorio + nomeArquivo); //FileInputStream fis = new FileInputStream(arquivo); //cs.setBinaryStream(6, fis, (int)arquivo.length()); //cs.setString(7,nomeArquivo.substring(nomeArquivo.lastIndexOf(".")+1));//extensao cs.setBinaryStream(6,arquivo.getInputStream(), (int) arquivo.getSize()); //arquivo cs.setString(7,vnomeArquivo.substring(vnomeArquivo.lastIndexOf(".")+1));//extensao cs.setInt(8,5); //ordem cs.setInt(9,2);//publicado cs.execute(); //retorno = cs.getString(13); out.println(retorno); connection.close(); /* // iterate over all uploaded files uploadedItems = upload.parseRequest(request); Iterator i = uploadedItems.iterator(); while (i.hasNext()) { fileItem = (FileItem) i.next(); if (fileItem.isFormField() == false) { if (fileItem.getSize() > 0) { File uploadedFile = null; String myFullFileName = fileItem.getName(), myFileName = "", slashType = (myFullFileName.lastIndexOf("\\") > 0) ? "\\" : "/"; // Windows or UNIX int startIndex = myFullFileName.lastIndexOf(slashType); // Ignore the path and get the filename myFileName = myFullFileName.substring(startIndex + 1, myFullFileName.length()); // Create new File object uploadedFile = new File(filePath, myFileName); // Write the uploaded file to the system fileItem.write(uploadedFile); } } } */ } catch (FileUploadException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } } }
[ "renan.figueiredo.05@gmail.com" ]
renan.figueiredo.05@gmail.com
f352378a13030c5bfb760aa7c944ece001aed223
d0835aca1415b8aa9cfda95fb187c2e033fd50df
/Chapter 6/Shapes2.java
bb1954c4c90a991886a87d7d02c4df5a55457870
[]
no_license
arviinnd-5989/Java---A-beginner-s-guide
c08496ed55ca9648dfb5d5323c6622004bb81803
3cafbebdb62b229eb369bfb0017dc548f12ba416
refs/heads/master
2022-12-22T01:22:01.610952
2020-09-14T05:22:03
2020-09-14T05:22:03
295,311,615
0
0
null
null
null
null
UTF-8
Java
false
false
857
java
class TwoDShape{ private double width; private double height; double getWidth(){return width;} double getHeight(){return height;} void setWidth(double w){width=w;} void setHeight(double h){height = h;} void showDim(){ System.out.println(width + " " + height); } } class Triangle extends TwoDShape{ String style; double area(){ return getWidth()*getHeight()/2; } void showStyle(){ System.out.println(style); } } class Shapes2{ public static void main (String args[]){ Triangle t1 = new Triangle(); Triangle t2 = new Triangle(); t1.setWidth(4.0); t1.setHeight(4.0); t1.style = "filled"; t2.setWidth(8.0); t2.setHeight(12.0); t2.style = "outlined"; System.out.println("t1"); t1.showStyle(); t1.showDim(); System.out.println(t1.area()); System.out.println(); System.out.println("t2"); t2.showStyle(); t2.showDim(); System.out.println(t2.area()); } }
[ "arvindn.iitkgp@gmail.com" ]
arvindn.iitkgp@gmail.com
e9e3d1709b9735cf9190b84a1aa5e8234e839a63
dd125eb61e8d3b7d67becaf595ffaff328dbb519
/restaurante/aplicacion/src/main/java/com/ceiba/plato/consulta/ManejadorListarPlato.java
afaf19d77bc3b496e40c8ac589fc679f97c31167
[]
no_license
FelipeCristancho/adn-restaurante
ba3d160d61bf09ec107963e0a9f9e86695b9dc41
5e60390f99d8bab51f3be3010d8a05be25e84631
refs/heads/master
2023-04-14T16:09:24.820445
2021-04-29T20:09:51
2021-04-29T20:09:51
357,982,556
0
0
null
null
null
null
UTF-8
Java
false
false
448
java
package com.ceiba.plato.consulta; import com.ceiba.plato.modelo.dto.DtoPlato; import com.ceiba.plato.puerto.dao.DaoPlato; import org.springframework.stereotype.Component; import java.util.List; @Component public class ManejadorListarPlato { private final DaoPlato daoPlato; public ManejadorListarPlato(DaoPlato daoPlato) { this.daoPlato = daoPlato; } public List<DtoPlato> ejecutar(){return this.daoPlato.listar();} }
[ "felipe.cristancho@ceiba.com.co" ]
felipe.cristancho@ceiba.com.co
8605a5dfe328efd0bcffd0f6791bc8dbb7781e49
64457379e0e325dc9ca0434ce76a101f0a3c3c17
/exercise/week11/codiattis/src/main/java/at/nacs/codiattis/configuration/WebMvcConfiguration.java
97fca6a98131f0915d479a3471c5de8fc213ab74
[]
no_license
dibakh/back-end
f8c6fdd3796b9eabc6b7b365ecc963d773adb10e
cb0b4ead72c9b9b56693df458ab12be9b5e88e63
refs/heads/master
2022-12-23T02:01:06.299598
2019-05-26T08:01:24
2019-05-26T08:01:24
174,180,083
0
0
null
2022-12-10T05:34:16
2019-03-06T16:25:00
Java
UTF-8
Java
false
false
489
java
package at.nacs.codiattis.configuration; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @Configuration public class WebMvcConfiguration implements WebMvcConfigurer { @Override public void addViewControllers(ViewControllerRegistry registry) { registry.addViewController("/login").setViewName("login"); } }
[ "diba.kheirkhah@gmail.com" ]
diba.kheirkhah@gmail.com
5575c8874506e3419e895d1bff768162736c680f
a4178e5042f43f94344789794d1926c8bdba51c0
/iwxxm2Converter/src/test/resources/iwxxm/2.1/output/org/isotc211/_2005/gmd/EXTemporalExtentType.java
d525bddcbffe91149ccfb8bc083fbf85d348ee6d
[ "Apache-2.0" ]
permissive
moryakovdv/iwxxmConverter
c6fb73bc49765c4aeb7ee0153cca04e3e3846ab0
5c2b57e57c3038a9968b026c55e381eef0f34dad
refs/heads/master
2023-07-20T06:58:00.317736
2023-07-05T10:10:10
2023-07-05T10:10:10
128,777,786
11
7
Apache-2.0
2023-07-05T10:03:12
2018-04-09T13:38:59
Java
UTF-8
Java
false
false
2,267
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2018.02.27 at 12:41:52 PM MSK // package org.isotc211._2005.gmd; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlSeeAlso; import javax.xml.bind.annotation.XmlType; import org.isotc211._2005.gco.AbstractObjectType; import org.isotc211._2005.gts.TMPrimitivePropertyType; /** * Time period covered by the content of the dataset * * <p>Java class for EX_TemporalExtent_Type complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="EX_TemporalExtent_Type"> * &lt;complexContent> * &lt;extension base="{http://www.isotc211.org/2005/gco}AbstractObject_Type"> * &lt;sequence> * &lt;element name="extent" type="{http://www.isotc211.org/2005/gts}TM_Primitive_PropertyType"/> * &lt;/sequence> * &lt;/extension> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "EX_TemporalExtent_Type", propOrder = { "extent" }) @XmlSeeAlso({ EXSpatialTemporalExtentType.class }) public class EXTemporalExtentType extends AbstractObjectType { @XmlElement(required = true) protected TMPrimitivePropertyType extent; /** * Gets the value of the extent property. * * @return * possible object is * {@link TMPrimitivePropertyType } * */ public TMPrimitivePropertyType getExtent() { return extent; } /** * Sets the value of the extent property. * * @param value * allowed object is * {@link TMPrimitivePropertyType } * */ public void setExtent(TMPrimitivePropertyType value) { this.extent = value; } public boolean isSetExtent() { return (this.extent!= null); } }
[ "moryakovdv@gmail.com" ]
moryakovdv@gmail.com
62736c4edf9f24e012a0f6669ee332208eeaadba
37394f912ab7eb93300fe9711ef5f166b1a7ad94
/src/test/java/varcode/java/draft/_draftParameterizeTest.java
6e4b0f9dd3760de83eb2b14b170b7291e9e85805
[]
no_license
edefazio/varcode
dd99b7a09bce7755403f75c266858dea0f606509
94099daafb0259f96b4f90a64194d88975c88fd8
refs/heads/master
2021-01-17T15:55:20.742671
2019-04-23T01:09:02
2019-04-23T01:09:02
67,149,267
11
2
null
null
null
null
UTF-8
Java
false
false
3,622
java
/* * Copyright 2017 Eric. * * 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 varcode.java.draft; import junit.framework.TestCase; import varcode.java.draft.$; import varcode.java.draft.draftAction.ExpandField; import varcode.java.model._class; import varcode.java.model._fields._field; /** * * @author Eric */ public class _draftParameterizeTest extends TestCase { public void testParameterizeField() { _field _f = _field.of( "public int count = 100;" ); ExpandField tf = ExpandField.parameterize( _f, "100", "count" ); _class _c = _class.of("public class A"); //this should work fine //tf.draftTo( _c, Context.EMPTY ); tf.draftTo( _c, "count", 1 ); assertEquals( "1", _c.getField("count").getInit().getCode().toString() ); //System.out.println( _c ); //tf.draftTo( _c, Context.EMPTY ); } public void testParameterizeFields() { _field _f = _field.of( "public int count;" ); ExpandField tf = ExpandField.parameterize( _f, "int", "type", "count", "name" ); _class _c = _class.of("public class A"); tf.draftTo( _c, "type", long.class, "name", "a" ); assertEquals( "long", _c.getField("a").getType() ); _c = _class.of("public class A"); tf.draftTo( _c, "name", new String[]{"a", "b"}, "type", new Class[]{long.class, int.class} ); assertEquals( "long", _c.getField("a").getType() ); assertEquals( "int", _c.getField("b").getType() ); _c = _class.of("public class A"); //multi _field // this will add (3) int fields // @$({"count", "name"}) _f = _field.of( "public int count;" ); tf = ExpandField.parameterize( _f, "count", "name" ); tf.draftTo( _c, "name", new String[]{"x", "y", "z"} ); assertEquals( "int", _c.getField( "x" ).getType() ); assertEquals( "int", _c.getField( "y" ).getType() ); assertEquals( "int", _c.getField( "z" ).getType() ); } /* public void testParamOptional() { _field _f = _field.of( "public int count = 100;" ); ExpandField tf = ExpandField.parameterizeOptional( _f, " = 100", "value" ); _class _c = _class.of("A"); tf.draftTo( _c, Context.EMPTY ); System.out.println( _c ); } */ @$({"Inner", "postfix"}) public class ParameterizedInner { @$({"value", "name"}) public final String key = "value"; public String getName() { return "MyInner"; } } public void testTailorField() { _field _f = _field.of( "@$({\"value\", \"name\"})", "public final String key = value;" ); } }
[ "Eric@DESKTOP-N6A4VCK" ]
Eric@DESKTOP-N6A4VCK
b425be74d5418bce0e9d252e34805fe9391c1da4
f82077981e8fcbe96aa425cddf8bff6b6623a67e
/src/main/java/com/abrar/openapi/entity/RoleMenuMap.java
1d649d8ba9e85b6ea10190f9ce32ce7b3f22d1f7
[]
no_license
AbrarAlvi/ssdg-openapi
bf33633b42e41c11240bf72c0f807ca3232d4fc6
4a6c0efaed77764c3e8e485dcfc3c50aaa4cee96
refs/heads/master
2021-04-27T15:21:04.890645
2018-04-06T08:26:48
2018-04-06T08:26:48
122,468,099
0
0
null
null
null
null
UTF-8
Java
false
false
3,545
java
package com.abrar.openapi.entity; import java.sql.Timestamp; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.SequenceGenerator; import javax.persistence.Table; /** * RoleMenuMap entity. * File Name :RoleMenuMap.java * Created on :Feb 23, 2011 * @author :Sushil Shakya */ @SequenceGenerator(name="role_menu_map_seq", sequenceName="slpo_aop.role_menu_map_seq") @Entity @Table(name="ume_role_menu_map", schema="slpo_aop") public class RoleMenuMap implements java.io.Serializable { private static final long serialVersionUID = 8439944285802842743L; private Integer umiRoleMenuPk; private RoleM roleM; private MenuM menuM; private String umcRolePrivStatus; private String umvRecordAddUser; private Timestamp umdRecordAddDate; private String umvRecordUpdateUser; private Timestamp umdRecordUpdateDate; public RoleMenuMap() { } @Id @GeneratedValue(generator="role_menu_map_seq", strategy=GenerationType.SEQUENCE) @Column(name="UMI_ROLE_MENU_PK", unique=true, nullable=false) public Integer getUmiRoleMenuPk() { return this.umiRoleMenuPk; } public void setUmiRoleMenuPk(Integer umiRoleMenuPk) { this.umiRoleMenuPk = umiRoleMenuPk; } @ManyToOne(fetch=FetchType.EAGER) @JoinColumn(name="UMI_ROLE_ID", nullable=false) public RoleM getRoleM() { return this.roleM; } public void setRoleM(RoleM roleM) { this.roleM = roleM; } @ManyToOne(fetch=FetchType.EAGER) @JoinColumn(name="UMI_MENU_ID", nullable=false) public MenuM getMenuM() { return this.menuM; } public void setMenuM(MenuM menuM) { this.menuM = menuM; } @Column(name="UMC_ROLE_PRIV_STATUS", nullable=false, length=1) public String getUmcRolePrivStatus() { return this.umcRolePrivStatus; } public void setUmcRolePrivStatus(String umcRolePrivStatus) { this.umcRolePrivStatus = umcRolePrivStatus; } @Column(name="UMV_RECORD_ADD_USER", length=20) public String getUmvRecordAddUser() { return this.umvRecordAddUser; } public void setUmvRecordAddUser(String umvRecordAddUser) { this.umvRecordAddUser = umvRecordAddUser; } @Column(name="UMD_RECORD_ADD_DATE", length=19) public Timestamp getUmdRecordAddDate() { return this.umdRecordAddDate; } public void setUmdRecordAddDate(Timestamp umdRecordAddDate) { this.umdRecordAddDate = umdRecordAddDate; } @Column(name="UMV_RECORD_UPDATE_USER", length=20) public String getUmvRecordUpdateUser() { return this.umvRecordUpdateUser; } public void setUmvRecordUpdateUser(String umvRecordUpdateUser) { this.umvRecordUpdateUser = umvRecordUpdateUser; } @Column(name="UMD_RECORD_UPDATE_DATE", length=19) public Timestamp getUmdRecordUpdateDate() { return this.umdRecordUpdateDate; } public void setUmdRecordUpdateDate(Timestamp umdRecordUpdateDate) { this.umdRecordUpdateDate = umdRecordUpdateDate; } public String toString() { return (umiRoleMenuPk+", "+roleM.getUmiRoleId()+", "+menuM.getUmiMenuId()+", "+umcRolePrivStatus+", "+umvRecordAddUser).toString(); } }
[ "abraralvi7@gmail.com" ]
abraralvi7@gmail.com
11ca7e473269523aec20bb88ad347bb2075bf620
c0bfa317d27128479a13f0ea30b60ef9f756bde6
/Trzeci_Zjazd.zip_expanded/Drugi_Zjazd.zip_expanded/06-WindowBuilder/src/przyklady/Rozmowa2.java
86ad9307220379590368a8fdcc41f03970876d2f
[]
no_license
LukaszSajenko/exercises
b6910c0afa341ed9395e88fd430f44d4298f914f
89c1b903d80fc800b6c4885cb6318ce1e8378c9c
refs/heads/master
2021-05-14T10:46:01.521673
2018-01-05T08:42:16
2018-01-05T08:42:16
116,361,933
0
0
null
null
null
null
UTF-8
Java
false
false
2,372
java
package przyklady; import java.awt.EventQueue; import javax.swing.JFrame; import java.awt.Color; import javax.swing.BoxLayout; import javax.swing.JLabel; import java.awt.Component; import javax.swing.JTextField; import javax.swing.JButton; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.awt.Font; import java.awt.Dimension; import javax.swing.SwingConstants; public class Rozmowa2 { private static final Font LABEL_FONT = new Font("Times New Roman", Font.PLAIN, 20); private JFrame frame; private JTextField textField; private JLabel lblWitaj; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { Rozmowa2 window = new Rozmowa2(); window.frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the application. */ public Rozmowa2() { initialize(); } /** * Initialize the contents of the frame. */ private void initialize() { frame = new JFrame(); frame.getContentPane().setBackground(Color.WHITE); frame.getContentPane().setForeground(Color.BLACK); frame.getContentPane().setLayout(new BoxLayout(frame.getContentPane(), BoxLayout.Y_AXIS)); JLabel lblJakMaszNa = new JLabel("Jak masz na imi\u0119?"); lblJakMaszNa.setFont(LABEL_FONT); frame.getContentPane().add(lblJakMaszNa); textField = new JTextField(); textField.setMaximumSize(new Dimension(120000, 80)); textField.setFont(LABEL_FONT); textField.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { powitaj(); } }); frame.getContentPane().add(textField); textField.setColumns(10); lblWitaj = new JLabel("Witaj "); lblWitaj.setFont(LABEL_FONT); JButton btnOk = new JButton("OK"); btnOk.setMaximumSize(new Dimension(1000, 35)); btnOk.setMinimumSize(new Dimension(70, 35)); btnOk.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { powitaj(); } }); frame.getContentPane().add(btnOk); frame.getContentPane().add(lblWitaj); frame.setBounds(100, 100, 450, 300); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } private void powitaj() { String imie = textField.getText(); lblWitaj.setText("Witaj " + imie + "!"); } }
[ "lsajenko121@gmail.com" ]
lsajenko121@gmail.com
f11233ca3ab6636196e03bdbd675780dfcf7864d
dd79f05ff48f80d20ad3dec7b48e183030653010
/connectionhub/Hub/src/main/java/com/webstudio/hub/config/AppConfig.java
a48d19b15662ccb846e170fb1dc2a1fd26bbae40
[]
no_license
amaryadav344/AlienSoftTools
89b257e66350d691eef00c276ead932ef501dfc0
c75e7c15673ebc46b22b7bbfa9493ba54b505ec6
refs/heads/master
2023-04-08T02:20:42.645055
2020-05-21T14:29:17
2020-05-21T14:29:17
252,964,284
0
0
null
null
null
null
UTF-8
Java
false
false
1,557
java
package com.webstudio.hub.config; import com.business.utils.FileHelper; import com.business.utils.HelperFunctions; import com.business.utils.XMLWorker; import com.business.utils.config.BusinessConfig; import com.webstudio.hub.common.Constants; import com.webstudio.hub.models.Branch; import org.springframework.stereotype.Component; import javax.annotation.PostConstruct; import java.io.IOException; @Component(Constants.ApplicationBeans.APP_CONFIG) public class AppConfig { private BusinessConfig businessConfig; private HubConfig hubConfig; public BusinessConfig getBusinessConfig() { return businessConfig; } private void setBusinessConfig(BusinessConfig businessConfig) { this.businessConfig = businessConfig; } HubConfig getHubConfig() { return hubConfig; } private void setHubConfig(HubConfig hubConfig) { this.hubConfig = hubConfig; } @PostConstruct public void InitializeConfig() throws IOException { String content = FileHelper.ReadCompleteFile(HelperFunctions.getExecutableHomePath(AppConfig.class, "HubConfig.xml")); HubConfig hub = XMLWorker.getInstance().readCustomType(content, HubConfig.class); String content2 = FileHelper.ReadCompleteFile(hub.getBranches().stream().filter(Branch::isDefault).findFirst().get().getBusinessConfigPath()); BusinessConfig businessConfig = XMLWorker.getInstance().readCustomType(content2, BusinessConfig.class); setBusinessConfig(businessConfig); setHubConfig(hub); } }
[ "amaryadav344@gmail.com" ]
amaryadav344@gmail.com
fbb69306c1c61162c3a7ee01ad39e9483b4e9a49
7f2504d2e1242acc4f5f6a087a5e64b6f39ed584
/src/main/java/com/github/amznlabs/swa_sample_seller/utilities/JsonUtils.java
a1926a99e79ad3b2b790e84af51ce4db01fbc346
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
cnxtech/swa-sample-seller
c5631c9a1ea92893e6935aff05704666fd2d626b
2c4203e33c59ae66f4a87bcd68b19dd723617de6
refs/heads/master
2023-08-31T15:49:42.324808
2018-06-05T20:11:00
2018-06-05T20:11:00
193,994,195
0
0
Apache-2.0
2023-07-22T09:23:35
2019-06-27T00:13:48
Java
UTF-8
Java
false
false
1,052
java
// Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. package com.github.amznlabs.swa_sample_seller.utilities; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; public class JsonUtils { private static final Logger LOGGER = LoggerFactory.getLogger(JsonUtils.class); /** * Pretty prints a JSON string. * * @param json A String of valid JSON. * @return Pretty printed JSON, or the original json if it can't be pretty printed. */ public static String prettyPrintJson(String json) { ObjectMapper mapper = new ObjectMapper(); try { Object object = mapper.readValue(json, Object.class); return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(object); } catch (JsonProcessingException e) { return json; } catch (IOException e) { return json; } } }
[ "vukevin@amazon.com" ]
vukevin@amazon.com
2561e9d7ba23c1c26e6715aab1b5c78649e9d701
dcbdd2e9fe61605551d301e20d40e637d08a239c
/ksc-sdk-java-network/src/main/java/com/ksc/network/slb/model/transform/LoadBalancerAclEntryStaxUnmarshaller.java
69651a88bbc988a819e0baeec498c5fa27e08586
[]
no_license
KscSDK/ksc-sdk-java
557e2fdc5edff42350ac9f281e67056fef62f3e5
e3acf4c97e7efe4af8e227bdf307e24814898802
refs/heads/master
2023-07-20T20:05:55.228476
2023-07-19T03:36:59
2023-07-19T03:36:59
67,019,969
49
75
null
2023-03-13T08:03:07
2016-08-31T08:45:15
Java
UTF-8
Java
false
false
3,025
java
package com.ksc.network.slb.model.transform; import com.ksc.network.slb.model.LoadBalancerAclEntry; import com.ksc.transform.SimpleTypeStaxUnmarshallers; import com.ksc.transform.StaxUnmarshallerContext; import com.ksc.transform.Unmarshaller; import javax.xml.stream.events.XMLEvent; public class LoadBalancerAclEntryStaxUnmarshaller implements Unmarshaller<LoadBalancerAclEntry, StaxUnmarshallerContext> { private static LoadBalancerAclEntryStaxUnmarshaller instance; public static LoadBalancerAclEntryStaxUnmarshaller getInstance() { if (instance == null) instance = new LoadBalancerAclEntryStaxUnmarshaller(); return instance; } @Override public LoadBalancerAclEntry unmarshall(StaxUnmarshallerContext context) throws Exception { LoadBalancerAclEntry LoadBalancerAclEntry = new LoadBalancerAclEntry(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; while (true) { XMLEvent xmlEvent = context.nextEvent(); if (xmlEvent.isEndDocument()) return LoadBalancerAclEntry; if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) { if (context.testExpression("LoadBalancerAclEntryId", targetDepth)) { LoadBalancerAclEntry.setLoadBalancerAclEntryId(SimpleTypeStaxUnmarshallers.StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("CidrBlock", targetDepth)) { LoadBalancerAclEntry.setCidrBlock(SimpleTypeStaxUnmarshallers.StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("LoadBalancerAclId", targetDepth)) { LoadBalancerAclEntry.setLoadBalancerAclId(SimpleTypeStaxUnmarshallers.StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("RuleNumber", targetDepth)) { LoadBalancerAclEntry.setRuleNumber(SimpleTypeStaxUnmarshallers.StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("RuleAction", targetDepth)) { LoadBalancerAclEntry.setRuleAction(SimpleTypeStaxUnmarshallers.StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("Protocol", targetDepth)) { LoadBalancerAclEntry.setProtocol(SimpleTypeStaxUnmarshallers.StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } } else if (xmlEvent.isEndElement()) { if (context.getCurrentDepth() < originalDepth) { return LoadBalancerAclEntry; } } } } }
[ "zhanghongyu@kingsoft.com" ]
zhanghongyu@kingsoft.com
a4db605bc147efdad70d62249af47b6b7c862b73
2dba76b74410e1143e9a770e8e40f7cdd4b52e4d
/open-metadata-resources/open-metadata-samples/open-metadata-security-samples/src/main/java/org/odpi/openmetadata/metadatasecurity/samples/CocoPharmaServerSecurityConnector.java
e76f48c18a3541b98c9ea366fd89ba0be1f6b5be
[ "CC-BY-4.0", "Apache-2.0" ]
permissive
moyabrannan/egeria
2b779ae5fc04b3c89817c7bf471a688dbf00a86c
3167ba1986a4a214e4cb6863a05a00c7df4087ff
refs/heads/master
2020-07-17T20:30:06.627951
2020-01-08T10:10:17
2020-01-08T10:10:17
201,465,315
0
0
Apache-2.0
2019-08-09T12:42:02
2019-08-09T12:42:02
null
UTF-8
Java
false
false
68,648
java
/* SPDX-License-Identifier: Apache 2.0 */ /* Copyright Contributors to the ODPi Egeria project. */ package org.odpi.openmetadata.metadatasecurity.samples; import org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException; import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException; import org.odpi.openmetadata.frameworks.connectors.ffdc.UserNotAuthorizedException; import org.odpi.openmetadata.frameworks.connectors.properties.beans.Asset; import org.odpi.openmetadata.frameworks.connectors.properties.beans.Connection; import org.odpi.openmetadata.metadatasecurity.connectors.OpenMetadataServerSecurityConnector; import org.odpi.openmetadata.metadatasecurity.properties.AssetAuditHeader; import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.*; import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.typedefs.AttributeTypeDef; import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.typedefs.TypeDef; import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.typedefs.TypeDefPatch; import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.typedefs.TypeDefSummary; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * CocoPharmaServerSecurityConnector provides a specific security connector for Coco Pharmaceuticals * users that overrides the default behavior of that open metadata security connector that does * not allow any access to anything. */ public class CocoPharmaServerSecurityConnector extends OpenMetadataServerSecurityConnector { /* * These variables represent the different groups of user. Typically these would be * implemented as a look up to a user directory such as LDAP rather than in memory lists. * The lists are used here to make the demo easier to set up. */ private List<String> allUsers = new ArrayList<>(); private List<String> assetOnboardingExit = new ArrayList<>(); private List<String> serverAdmins = new ArrayList<>(); private List<String> serverOperators = new ArrayList<>(); private List<String> serverInvestigators = new ArrayList<>(); private List<String> metadataArchitects = new ArrayList<>(); private List<String> npaAccounts = new ArrayList<>(); private List<String> externalUsers = new ArrayList<>(); private List<String> defaultZoneMembership = new ArrayList<>(); private List<String> zonesForExternals = new ArrayList<>(); private Map<String, List<String>> zoneAccess = new HashMap<>(); private Map<String, String> ownerZones = new HashMap<>(); /* * Zones requiring special processing */ private final String personalFilesZoneName = "personal-files"; private final String quarantineZoneName = "quarantine"; private final String dataLakeZoneName = "data-lake"; private final String externalAccessZoneName = "external-access"; /** * Constructor sets up the security groups */ public CocoPharmaServerSecurityConnector() { List<String> allEmployees = new ArrayList<>(); List<String> assetOnboarding = new ArrayList<>(); /* * Standard zones in use by Coco Pharmaceuticals */ final String researchZoneName = "research"; final String hrZoneName = "human-resources"; final String financeZoneName = "finance"; final String clinicalTrialsZoneName = "clinical-trials"; final String infrastructureZoneName = "infrastructure"; final String developmentZoneName = "development"; final String manufacturingZoneName = "manufacturing"; final String governanceZoneName = "governance"; final String trashCanZoneName = "trash-can"; /* * Coco Pharmaceuticals personas */ final String zachNowUserId = "zach"; final String steveStarterUserId = "steves"; final String terriDaringUserId = "terri"; final String tanyaTidieUserId = "tanyatidie"; final String pollyTaskerUserId = "pollytasker"; final String tessaTubeUserId = "tessatube"; final String callieQuartileUserId = "calliequartile"; final String ivorPadlockUserId = "ivorpadlock"; final String bobNitterUserId = "bobnitter"; final String faithBrokerUserId = "faithbroker"; final String sallyCounterUserId = "sallycounter"; final String lemmieStageUserId = "lemmiestage"; final String erinOverviewUserId = "erinoverview"; final String harryHopefulUserId = "harryhopeful"; final String garyGeekeUserId = "garygeeke"; final String grantAbleUserId = "grantable"; final String robbieRecordsUserId = "robbierecords"; final String reggieMintUserId = "reggiemint"; final String peterProfileUserId = "peterprofile"; final String nancyNoahUserId = "nancynoah"; final String sidneySeekerUserId = "sidneyseeker"; final String tomTallyUserId = "tomtally"; final String julieStitchedUserId = "juliestitched"; final String desSignaUserId = "dessigna"; final String angelaCummingUserId = "angelacummings"; final String julesKeeperUserId = "jukeskeeper"; final String stewFasterUserId = "stewFaster"; /* * System (NPA) accounts */ final String archiverUserId = "archiver01"; final String etlEngineUserId = "dlETL"; final String cocoMDS1UserId = "cocoMDS1npa"; final String cocoMDS2UserId = "cocoMDS2npa"; final String cocoMDS3UserId = "cocoMDS3npa"; final String cocoMDS4UserId = "cocoMDS4npa"; final String cocoMDS5UserId = "cocoMDS5npa"; final String cocoMDS6UserId = "cocoMDS6npa"; final String cocoMDSxUserId = "cocoMDSxnpa"; final String discoDL01UserId = "discoDL01npa"; /* * Set up default zone membership */ defaultZoneMembership.add(quarantineZoneName); /* * Add all the users into the all group */ allUsers.add(zachNowUserId); allUsers.add(steveStarterUserId); allUsers.add(terriDaringUserId); allUsers.add(tanyaTidieUserId); allUsers.add(pollyTaskerUserId); allUsers.add(tessaTubeUserId); allUsers.add(callieQuartileUserId); allUsers.add(ivorPadlockUserId); allUsers.add(bobNitterUserId); allUsers.add(faithBrokerUserId); allUsers.add(sallyCounterUserId); allUsers.add(lemmieStageUserId); allUsers.add(erinOverviewUserId); allUsers.add(harryHopefulUserId); allUsers.add(garyGeekeUserId); allUsers.add(grantAbleUserId); allUsers.add(robbieRecordsUserId); allUsers.add(reggieMintUserId); allUsers.add(peterProfileUserId); allUsers.add(nancyNoahUserId); allUsers.add(sidneySeekerUserId); allUsers.add(tomTallyUserId); allUsers.add(julieStitchedUserId); allUsers.add(desSignaUserId); allUsers.add(angelaCummingUserId); allUsers.add(julesKeeperUserId); allUsers.add(stewFasterUserId); allUsers.add(archiverUserId); allUsers.add(etlEngineUserId); allUsers.add(cocoMDS1UserId); allUsers.add(cocoMDS2UserId); allUsers.add(cocoMDS3UserId); allUsers.add(cocoMDS4UserId); allUsers.add(cocoMDS5UserId); allUsers.add(cocoMDS6UserId); allUsers.add(cocoMDSxUserId); allUsers.add(discoDL01UserId); allEmployees.add(zachNowUserId); allEmployees.add(steveStarterUserId); allEmployees.add(terriDaringUserId); allEmployees.add(tanyaTidieUserId); allEmployees.add(pollyTaskerUserId); allEmployees.add(tessaTubeUserId); allEmployees.add(callieQuartileUserId); allEmployees.add(ivorPadlockUserId); allEmployees.add(bobNitterUserId); allEmployees.add(faithBrokerUserId); allEmployees.add(sallyCounterUserId); allEmployees.add(lemmieStageUserId); allEmployees.add(erinOverviewUserId); allEmployees.add(harryHopefulUserId); allEmployees.add(garyGeekeUserId); allEmployees.add(reggieMintUserId); allEmployees.add(peterProfileUserId); allEmployees.add(sidneySeekerUserId); allEmployees.add(tomTallyUserId); allEmployees.add(julesKeeperUserId); allEmployees.add(stewFasterUserId); assetOnboarding.add(peterProfileUserId); assetOnboarding.add(erinOverviewUserId); assetOnboardingExit.add(erinOverviewUserId); serverAdmins.add(garyGeekeUserId); serverOperators.add(garyGeekeUserId); serverInvestigators.add(garyGeekeUserId); metadataArchitects.add(erinOverviewUserId); metadataArchitects.add(peterProfileUserId); externalUsers.add(grantAbleUserId); externalUsers.add(julieStitchedUserId); externalUsers.add(angelaCummingUserId); externalUsers.add(robbieRecordsUserId); zonesForExternals.add(externalAccessZoneName); npaAccounts.add(archiverUserId); npaAccounts.add(etlEngineUserId); npaAccounts.add(cocoMDS1UserId); npaAccounts.add(cocoMDS2UserId); npaAccounts.add(cocoMDS3UserId); npaAccounts.add(cocoMDS4UserId); npaAccounts.add(cocoMDS5UserId); npaAccounts.add(cocoMDS6UserId); npaAccounts.add(cocoMDSxUserId); npaAccounts.add(discoDL01UserId); List<String> zoneSetUp = new ArrayList<>(); /* * Set up the assignment of zones for specific users */ ownerZones.put(tanyaTidieUserId, clinicalTrialsZoneName); /* * Set up the zones */ zoneAccess.put(trashCanZoneName, npaAccounts); zoneAccess.put(personalFilesZoneName, allEmployees); zoneAccess.put(quarantineZoneName, assetOnboarding); zoneAccess.put(dataLakeZoneName, allEmployees); zoneAccess.put(externalAccessZoneName, externalUsers); zoneSetUp.add(callieQuartileUserId); zoneSetUp.add(tessaTubeUserId); zoneAccess.put(researchZoneName, zoneSetUp); zoneSetUp.add(tanyaTidieUserId); zoneAccess.put(clinicalTrialsZoneName, zoneSetUp); zoneSetUp = new ArrayList<>(); zoneSetUp.add(faithBrokerUserId); zoneAccess.put(hrZoneName, zoneSetUp); zoneSetUp = new ArrayList<>(); zoneSetUp.add(reggieMintUserId); zoneSetUp.add(tomTallyUserId); zoneSetUp.add(sallyCounterUserId); zoneAccess.put(financeZoneName, zoneSetUp); zoneSetUp = new ArrayList<>(); zoneSetUp.add(garyGeekeUserId); zoneAccess.put(infrastructureZoneName, zoneSetUp); zoneSetUp = new ArrayList<>(); zoneSetUp.add(pollyTaskerUserId); zoneSetUp.add(bobNitterUserId); zoneSetUp.add(lemmieStageUserId); zoneSetUp.add(nancyNoahUserId); zoneSetUp.add(desSignaUserId); zoneAccess.put(developmentZoneName, zoneSetUp); zoneSetUp = new ArrayList<>(); zoneSetUp.add(stewFasterUserId); zoneAccess.put(manufacturingZoneName, zoneSetUp); zoneSetUp = new ArrayList<>(); zoneSetUp.add(garyGeekeUserId); zoneSetUp.add(erinOverviewUserId); zoneSetUp.add(ivorPadlockUserId); zoneSetUp.add(julesKeeperUserId); zoneSetUp.add(pollyTaskerUserId); zoneSetUp.add(faithBrokerUserId); zoneSetUp.add(reggieMintUserId); zoneAccess.put(governanceZoneName, zoneSetUp); } /** * Check that the calling user is authorized to issue a (any) request to the OMAG Server Platform. * * @param userId calling user * * @throws UserNotAuthorizedException the user is not authorized to access this function */ @Override public void validateUserForServer(String userId) throws UserNotAuthorizedException { if (allUsers.contains(userId)) { return; } super.validateUserForServer(userId); } /** * Check that the calling user is authorized to update the configuration for a server. * * @param userId calling user * * @throws UserNotAuthorizedException the user is not authorized to change configuration */ @Override public void validateUserAsServerAdmin(String userId) throws UserNotAuthorizedException { if (serverAdmins.contains(userId)) { return; } super.validateUserAsServerAdmin(userId); } /** * Check that the calling user is authorized to issue operator requests to the OMAG Server. * * @param userId calling user * * @throws UserNotAuthorizedException the user is not authorized to issue operator commands to this server */ @Override public void validateUserAsServerOperator(String userId) throws UserNotAuthorizedException { if (serverOperators.contains(userId)) { return; } super.validateUserAsServerOperator(userId); } /** * Check that the calling user is authorized to issue operator requests to the OMAG Server. * * @param userId calling user * * @throws UserNotAuthorizedException the user is not authorized to issue diagnostic commands to this server */ @Override public void validateUserAsServerInvestigator(String userId) throws UserNotAuthorizedException { if (serverInvestigators.contains(userId)) { return; } super.validateUserAsServerInvestigator(userId); } /** * Check that the calling user is authorized to issue this request. * * @param userId calling user * @param serviceName name of called service * * @throws UserNotAuthorizedException the user is not authorized to access this service */ @Override public void validateUserForService(String userId, String serviceName) throws UserNotAuthorizedException { if (allUsers.contains(userId)) { return; } super.validateUserForService(userId, serviceName); } /** * Check that the calling user is authorized to issue this specific request. * * @param userId calling user * @param serviceName name of called service * @param serviceOperationName name of called operation * * @throws UserNotAuthorizedException the user is not authorized to access this service */ @Override public void validateUserForServiceOperation(String userId, String serviceName, String serviceOperationName) throws UserNotAuthorizedException { final String assetOwnerServiceName = "Asset Owner OMAS"; final String deleteAssetOperationName = "deleteAsset"; /* * Coco Pharmaceuticals have decided that the assetDelete method from Asset Owner OMAS is too powerful * to use and so this test means that only non-personal accounts (NPA) can use it. * * They delete an asset by moving it to the "trash-can" zone where it is cleaned up by automated * processes the next day. */ if ((assetOwnerServiceName.equals(serviceName)) && (deleteAssetOperationName.equals(serviceOperationName))) { if (npaAccounts.contains(userId)) { return; } } else { if (allUsers.contains(userId)) { return; } } super.validateUserForServiceOperation(userId, serviceName, serviceOperationName); } /** * Tests for whether a specific user should have access to a connection. * * @param userId identifier of user * @param connection connection object * @throws UserNotAuthorizedException the user is not authorized to access this service */ @Override public void validateUserForConnection(String userId, Connection connection) throws UserNotAuthorizedException { if (connection == null) { return; } if ((connection.getClearPassword() == null) && (connection.getEncryptedPassword() == null) && (connection.getSecuredProperties() == null)) { return; } if (npaAccounts.contains(userId)) { return; } super.validateUserForConnection(userId, connection); } /** * Tests for whether a specific user should have access to an asset based on its zones. * * @param userId identifier of user * @param assetZones name of the zones * @param updateRequested is the asset to be changed * @param zoneMembershipChanged is the asset's zone membership to be changed * @param userIsAssetOwner is the user one of the owner's of the asset * @return whether the user is authorized to access asset in these zones */ private boolean userHasAccessToAssetZones(String userId, List<String> assetZones, boolean updateRequested, boolean zoneMembershipChanged, boolean userIsAssetOwner) { List<String> testZones; /* * The quarantine zone is the default zone if it is not set up */ if ((assetZones == null) || (assetZones.isEmpty())) { testZones = new ArrayList<>(); testZones.add(quarantineZoneName); } else { testZones = assetZones; } /* * If the quarantine zone is included in the list of zones then only the rules for the quarantine * zone are considered. */ if (testZones.contains(quarantineZoneName)) { List<String> zoneAccounts = zoneAccess.get(quarantineZoneName); if ((zoneAccounts != null) && (zoneAccounts.contains(userId))) { return true; } } else /* allow access to the asset if any other zone permits it */ { for (String zoneName : testZones) { if (zoneName != null) { /* * The data lake zone is special - only npaAccounts can update assets in the data lake zone. * Another user may update these assets only if they have access via another one of the asset's zone. */ if ((zoneName.equals(dataLakeZoneName)) && (updateRequested)) { if (npaAccounts.contains(userId)) { return true; } } /* * Access to personal files is only permitted by the owner of the asset. If they assign the * asset to another zone, this may allow others to read and change the asset. */ else if (zoneName.equals(personalFilesZoneName)) { if (userIsAssetOwner) { return true; } } /* * Standard look up of user's assigned to zones */ else { List<String> zoneAccounts = zoneAccess.get(zoneName); if ((zoneAccounts != null) && (zoneAccounts.contains(userId))) { return true; } } } } } return false; } /** * Adds the requested zone to the list of zones for an asset (avoiding duplicates). * * @param currentZones current list of zones * @param zoneToAdd new zone * @return new list of zones */ private List<String> addZoneName(List<String> currentZones, String zoneToAdd) { if (zoneToAdd == null) { return currentZones; } List<String> resultingZones; if (currentZones == null) { resultingZones = new ArrayList<>(); resultingZones.add(zoneToAdd); } else { resultingZones = currentZones; if (! resultingZones.contains(zoneToAdd)) { resultingZones.add(zoneToAdd); } } return resultingZones; } /** * Remove the requested zone from the list of zones if it is present. * * @param currentZones current list of zones * @param zoneToRemove obsolete zone * @return new list of zones */ private List<String> removeZoneName(List<String> currentZones, String zoneToRemove) { if ((zoneToRemove == null) || (currentZones == null)) { return currentZones; } List<String> resultingZones = new ArrayList<>(currentZones); resultingZones.remove(zoneToRemove); return resultingZones; } /** * Tests for whether a specific user is the owner of an asset. This test does not cover * the use of profile names for asset owner. * * @param userId identifier of user * @param asset asset to test * @return boolean flag */ private boolean isUserAssetOwner(String userId, Asset asset) { if (asset != null) { if (userId != null) { return userId.equals(asset.getOwner()); } } return false; } /** * Test whether the zone has changed because this may need special processing. * * @param oldZoneMembership zone membership before update * @param newZoneMembership zone membership after update * @return boolean true if they are different */ private boolean hasZoneChanged(List<String> oldZoneMembership, List<String> newZoneMembership) { /* * Are they the same object or both null? */ if (oldZoneMembership == newZoneMembership) { return false; } /* * If either is null they are different because already tested that they are not both null. */ if ((oldZoneMembership == null) || (newZoneMembership == null)) { return true; } /* * If they each contain the other then they are equal */ return ! ((oldZoneMembership.containsAll(newZoneMembership)) && (newZoneMembership.containsAll(oldZoneMembership))); } /** * Test to see if a specific zone has been removed. * * @param zoneName name of zone ot test for * @param oldZoneMembership old zone membership * @param newZoneMembership new zone membership * @return flag - true if the zone has been removed; otherwise false */ private boolean zoneBeenRemoved(String zoneName, List<String> oldZoneMembership, List<String> newZoneMembership) { /* * Being defensive to prevent NPEs in the server processing. */ if (zoneName == null) { return false; } /* * Are they the same object or both null? */ if (oldZoneMembership == newZoneMembership) { return false; } /* * If the old zone is null then nothing could have been removed. */ if (oldZoneMembership == null) { return false; } if (oldZoneMembership.contains(zoneName)) { /* * Determine if the new zone still contains the zone of interest. */ if (newZoneMembership == null) { return true; } else if (newZoneMembership.contains(zoneName)) { return false; } else { return true; } } else { return false; } } /** * Determine the appropriate setting for the supported zones depending on the user and the * default supported zones set up for the service. This is called whenever an asset is accessed. * * @param supportedZones default setting of the supported zones for the service * @param serviceName name of the called service * @param user name of the user * * @return list of supported zones for the user * @throws InvalidParameterException one of the parameter values is invalid * @throws PropertyServerException there is a problem calculating the zones */ public List<String> setSupportedZonesForUser(List<String> supportedZones, String serviceName, String user) throws InvalidParameterException, PropertyServerException { if (externalUsers.contains(user)) { return zonesForExternals; } return supportedZones; } /** * Determine the appropriate setting for the asset zones depending on the content of the asset and the * default zones. This is called whenever a new asset is created. * * The default behavior is to use the default values, unless the zones have been explicitly set up, * in which case, they are left unchanged. * * @param defaultZones setting of the default zones for the service * @param asset initial values for the asset * * @return list of zones to set in the asset * @throws InvalidParameterException one of the asset values is invalid * @throws PropertyServerException there is a problem calculating the zones */ @Override public List<String> initializeAssetZones(List<String> defaultZones, Asset asset) throws InvalidParameterException, PropertyServerException { if (asset != null) { if (asset.getZoneMembership() == null) { return defaultZoneMembership; } } return super.initializeAssetZones(defaultZones, asset); } /** * Determine the appropriate setting for the asset zones depending on the content of the asset and the * settings of both default zones and supported zones. This method is called whenever an asset's * values are changed. * * The default behavior is to keep the updated zones as they are. * * @param defaultZones setting of the default zones for the service * @param supportedZones setting of the supported zones for the service * @param originalAsset original values for the asset * @param updatedAsset updated values for the asset * * @return list of zones to set in the asset * @throws InvalidParameterException one of the asset values is invalid * @throws PropertyServerException there is a problem calculating the zones */ @Override public List<String> verifyAssetZones(List<String> defaultZones, List<String> supportedZones, Asset originalAsset, Asset updatedAsset) throws InvalidParameterException, PropertyServerException { if (updatedAsset != null) { if (updatedAsset.getOwner() != null) { return addZoneName(updatedAsset.getZoneMembership(), ownerZones.get(updatedAsset.getOwner())); } else { return updatedAsset.getZoneMembership(); } } return null; } /** * Test to see that the separation of duty rules are adhered to in the quarantine zone. * * @param userId calling user * @param auditHeader audit header of the asset * @return boolean flag - true = all in ok */ private boolean validateSeparationOfDuties(String userId, AssetAuditHeader auditHeader) { if (auditHeader != null) { if (userId.equals(auditHeader.getCreatedBy())) { return false; } return true; } return false; } /** * Tests for whether a specific user should have the right to create an asset within a zone. * * @param userId identifier of user * @throws UserNotAuthorizedException the user is not authorized to access this zone */ @Override public void validateUserForAssetCreate(String userId, Asset asset) throws UserNotAuthorizedException { if (asset != null) { if (userHasAccessToAssetZones(userId, asset.getZoneMembership(), true, false, this.isUserAssetOwner(userId, asset))) { return; } } /* * Any other conditions, use superclass to throw user not authorized exception */ super.validateUserForAssetCreate(userId, asset); } /** * Tests for whether a specific user should have read access to a specific asset within a zone. * * @param userId identifier of user * @throws UserNotAuthorizedException the user is not authorized to access this zone */ @Override public void validateUserForAssetRead(String userId, Asset asset) throws UserNotAuthorizedException { if (asset != null) { if (userHasAccessToAssetZones(userId, asset.getZoneMembership(), false, false, this.isUserAssetOwner(userId, asset))) { return; } } /* * Any other conditions, use superclass to throw user not authorized exception */ super.validateUserForAssetRead(userId, asset); } /** * Tests for whether a specific user should have the right to update an asset. * This is used for a general asset update, which may include changes to the * zones and the ownership. * * @param userId identifier of user * @param originalAsset original asset details * @param originalAssetAuditHeader details of the asset's audit header * @param newAsset new asset details * @throws UserNotAuthorizedException the user is not authorized to change this asset */ @Override public void validateUserForAssetDetailUpdate(String userId, Asset originalAsset, AssetAuditHeader originalAssetAuditHeader, Asset newAsset) throws UserNotAuthorizedException { final String methodName = "validateUserForAssetDetailUpdate"; if (userId != null) { if ((originalAsset != null) && (newAsset != null)) { if (userHasAccessToAssetZones(userId, originalAsset.getZoneMembership(), true, this.hasZoneChanged(originalAsset.getZoneMembership(), newAsset.getZoneMembership()), this.isUserAssetOwner(userId, originalAsset))) { /* * Do not allow zone to be null */ if (newAsset.getZoneMembership() != null) { if (zoneBeenRemoved(quarantineZoneName, originalAsset.getZoneMembership(), newAsset.getZoneMembership())) { /* * Perform special processing for quarantine zone. * The owner must be specified */ if ((newAsset.getOwner() != null) && (newAsset.getOwnerType() != null)) { if (validateSeparationOfDuties(userId, originalAssetAuditHeader)) { return; } else { super.throwUnauthorizedZoneChange(userId, newAsset, originalAsset.getZoneMembership(), newAsset.getZoneMembership(), methodName); } } else { super.throwIncompleteAsset(userId, newAsset, methodName); } } else { return; } } else { super.throwIncompleteAsset(userId, newAsset, methodName); } } } } /* * Any other conditions, use superclass to throw user not authorized exception */ super.validateUserForAssetDetailUpdate(userId, originalAsset, originalAssetAuditHeader, newAsset); } /** * Tests for whether a specific user should have the right to update elements attached directly * to an asset such as glossary terms, schema and connections. * * @param userId identifier of user * @param asset original asset details * @throws UserNotAuthorizedException the user is not authorized to change this asset */ @Override public void validateUserForAssetAttachmentUpdate(String userId, Asset asset) throws UserNotAuthorizedException { if (asset != null) { if (userHasAccessToAssetZones(userId, asset.getZoneMembership(), true, false, this.isUserAssetOwner(userId, asset))) { return; } } /* * Any other conditions, use superclass to throw user not authorized exception */ super.validateUserForAssetAttachmentUpdate(userId, asset); } /** * Tests for whether a specific user should have the right to attach feedback - such as comments, * ratings, tags and likes, to the asset. * * @param userId identifier of user * @param asset original asset details * @throws UserNotAuthorizedException the user is not authorized to change this asset */ public void validateUserForAssetFeedback(String userId, Asset asset) throws UserNotAuthorizedException { if (asset != null) { if (userHasAccessToAssetZones(userId, asset.getZoneMembership(), false, false, this.isUserAssetOwner(userId, asset))) { return; } } /* * Any other conditions, use superclass to throw user not authorized exception */ super.validateUserForAssetAttachmentUpdate(userId, asset); } /** * Tests for whether a specific user should have the right to delete an asset within a zone. * * @param userId identifier of user * @param asset asset details * @throws UserNotAuthorizedException the user is not authorized to change this asset */ @Override public void validateUserForAssetDelete(String userId, Asset asset) throws UserNotAuthorizedException { if (asset != null) { if (userHasAccessToAssetZones(userId, asset.getZoneMembership(), true, false, this.isUserAssetOwner(userId, asset))) { return; } } /* * Any other conditions, use superclass to throw user not authorized exception */ super.validateUserForAssetDelete(userId, asset); } /* * ========================================================================================================= * Type security * * Any valid user can see the types but only the metadata architects can change them. * The logic returns if valid access; otherwise it calls the superclass to throw the * user not authorized exception. */ /** * Tests for whether a specific user should have the right to create a type within a repository. * * @param userId identifier of user * @param metadataCollectionName configurable name of the metadata collection * @param typeDef type details * @throws UserNotAuthorizedException the user is not authorized to maintain types */ @Override public void validateUserForTypeCreate(String userId, String metadataCollectionName, TypeDef typeDef) throws UserNotAuthorizedException { if (metadataArchitects.contains(userId)) { return; } if (localServerUserId != null) { if (localServerUserId.equals(userId)) { return; } } super.validateUserForTypeCreate(userId, metadataCollectionName, typeDef); } /** * Tests for whether a specific user should have the right to create a type within a repository. * * @param userId identifier of user * @param metadataCollectionName configurable name of the metadata collection * @param attributeTypeDef type details * @throws UserNotAuthorizedException the user is not authorized to maintain types */ @Override public void validateUserForTypeCreate(String userId, String metadataCollectionName, AttributeTypeDef attributeTypeDef) throws UserNotAuthorizedException { if (metadataArchitects.contains(userId)) { return; } if (localServerUserId != null) { if (localServerUserId.equals(userId)) { return; } } super.validateUserForTypeCreate(userId, metadataCollectionName, attributeTypeDef); } /** * Tests for whether a specific user should have read access to a specific type within a repository. * * @param userId identifier of user * @param metadataCollectionName configurable name of the metadata collection * @param typeDef type details * @throws UserNotAuthorizedException the user is not authorized to retrieve types */ @Override public void validateUserForTypeRead(String userId, String metadataCollectionName, TypeDef typeDef) throws UserNotAuthorizedException { if (allUsers.contains(userId)) { return; } if (localServerUserId != null) { if (localServerUserId.equals(userId)) { return; } } super.validateUserForTypeRead(userId, metadataCollectionName, typeDef); } /** * Tests for whether a specific user should have read access to a specific type within a repository. * * @param userId identifier of user * @param metadataCollectionName configurable name of the metadata collection * @param attributeTypeDef type details * @throws UserNotAuthorizedException the user is not authorized to retrieve types */ @Override public void validateUserForTypeRead(String userId, String metadataCollectionName, AttributeTypeDef attributeTypeDef) throws UserNotAuthorizedException { if (allUsers.contains(userId)) { return; } if (localServerUserId != null) { if (localServerUserId.equals(userId)) { return; } } super.validateUserForTypeRead(userId, metadataCollectionName, attributeTypeDef); } /** * Tests for whether a specific user should have the right to update a typeDef within a repository. * * @param userId identifier of user * @param metadataCollectionName configurable name of the metadata collection * @param typeDef current typeDef details * @param patch proposed changes to type * @throws UserNotAuthorizedException the user is not authorized to maintain types */ @Override public void validateUserForTypeUpdate(String userId, String metadataCollectionName, TypeDef typeDef, TypeDefPatch patch) throws UserNotAuthorizedException { if (metadataArchitects.contains(userId)) { return; } if (localServerUserId != null) { if (localServerUserId.equals(userId)) { return; } } super.validateUserForTypeUpdate(userId, metadataCollectionName, typeDef, patch); } /** * Tests for whether a specific user should have the right to delete a type within a repository. * * @param userId identifier of user * @param metadataCollectionName configurable name of the metadata collection * @param typeDef type details * @throws UserNotAuthorizedException the user is not authorized to maintain types */ @Override public void validateUserForTypeDelete(String userId, String metadataCollectionName, TypeDef typeDef) throws UserNotAuthorizedException { if (metadataArchitects.contains(userId)) { return; } if (localServerUserId != null) { if (localServerUserId.equals(userId)) { return; } } super.validateUserForTypeDelete(userId, metadataCollectionName, typeDef); } /** * Tests for whether a specific user should have the right to delete a type within a repository. * * @param userId identifier of user * @param metadataCollectionName configurable name of the metadata collection * @param attributeTypeDef type details * @throws UserNotAuthorizedException the user is not authorized to maintain types */ @Override public void validateUserForTypeDelete(String userId, String metadataCollectionName, AttributeTypeDef attributeTypeDef) throws UserNotAuthorizedException { if (metadataArchitects.contains(userId)) { return; } if (localServerUserId != null) { if (localServerUserId.equals(userId)) { return; } } super.validateUserForTypeDelete(userId, metadataCollectionName, attributeTypeDef); } /** * Tests for whether a specific user should have the right to change the identifiers for a type within a repository. * * @param userId identifier of user * @param metadataCollectionName configurable name of the metadata collection * @param originalTypeDef type details * @param newTypeDefGUID the new identifier for the type. * @param newTypeDefName new name for this type. * @throws UserNotAuthorizedException the user is not authorized to maintain types */ @Override public void validateUserForTypeReIdentify(String userId, String metadataCollectionName, TypeDef originalTypeDef, String newTypeDefGUID, String newTypeDefName) throws UserNotAuthorizedException { if (metadataArchitects.contains(userId)) { return; } if (localServerUserId != null) { if (localServerUserId.equals(userId)) { return; } } super.validateUserForTypeReIdentify(userId, metadataCollectionName, originalTypeDef, newTypeDefGUID, newTypeDefName); } /** * Tests for whether a specific user should have the right to change the identifiers for a type within a repository. * * @param userId identifier of user * @param metadataCollectionName configurable name of the metadata collection * @param originalAttributeTypeDef type details * @param newTypeDefGUID the new identifier for the type. * @param newTypeDefName new name for this type. * @throws UserNotAuthorizedException the user is not authorized to maintain types */ @Override public void validateUserForTypeReIdentify(String userId, String metadataCollectionName, AttributeTypeDef originalAttributeTypeDef, String newTypeDefGUID, String newTypeDefName) throws UserNotAuthorizedException { if (metadataArchitects.contains(userId)) { return; } if (localServerUserId != null) { if (localServerUserId.equals(userId)) { return; } } super.validateUserForTypeReIdentify(userId, metadataCollectionName, originalAttributeTypeDef, newTypeDefGUID, newTypeDefName); } /* * ========================================================================================================= * Instance Security * * No specific security checks made when instances are written and retrieved from the local repository. * The methods override the super class that throws a user not authorized exception on all access/update * requests. */ /** * Tests for whether a specific user should have the right to create a instance within a repository. * * @param userId identifier of user * @param metadataCollectionName configurable name of the metadata collection * @param entityTypeGUID unique identifier (guid) for the new entity's type. * @param initialProperties initial list of properties for the new entity null means no properties. * @param initialClassifications initial list of classifications for the new entity null means no classifications. * @param initialStatus initial status typically DRAFT, PREPARED or ACTIVE. * @throws UserNotAuthorizedException the user is not authorized to maintain instances */ @Override public void validateUserForEntityCreate(String userId, String metadataCollectionName, String entityTypeGUID, InstanceProperties initialProperties, List<Classification> initialClassifications, InstanceStatus initialStatus) throws UserNotAuthorizedException { } /** * Tests for whether a specific user should have read access to a specific instance within a repository. * * @param userId identifier of user * @param metadataCollectionName configurable name of the metadata collection * @param instance instance details * @throws UserNotAuthorizedException the user is not authorized to retrieve instances */ @Override public void validateUserForEntityRead(String userId, String metadataCollectionName, EntityDetail instance) throws UserNotAuthorizedException { } /** * Tests for whether a specific user should have read access to a specific instance within a repository. * * @param userId identifier of user * @param metadataCollectionName configurable name of the metadata collection * @param instance instance details * @throws UserNotAuthorizedException the user is not authorized to retrieve instances */ @Override public void validateUserForEntitySummaryRead(String userId, String metadataCollectionName, EntitySummary instance) throws UserNotAuthorizedException { } /** * Tests for whether a specific user should have read access to a specific instance within a repository. * * @param userId identifier of user * @param metadataCollectionName configurable name of the metadata collection * @param instance instance details * @throws UserNotAuthorizedException the user is not authorized to retrieve instances */ @Override public void validateUserForEntityProxyRead(String userId, String metadataCollectionName, EntityProxy instance) throws UserNotAuthorizedException { } /** * Tests for whether a specific user should have the right to update a instance within a repository. * * @param userId identifier of user * @param metadataCollectionName configurable name of the metadata collection * @param instance instance details * @throws UserNotAuthorizedException the user is not authorized to maintain instances */ @Override public void validateUserForEntityUpdate(String userId, String metadataCollectionName, EntityDetail instance) throws UserNotAuthorizedException { } /** * Tests for whether a specific user should have the right to add a classification to an entity instance * within a repository. * * @param userId identifier of user * @param metadataCollectionName configurable name of the metadata collection * @param instance instance details * @param classificationName String name for the classification. * @param properties list of properties for the classification. * @throws UserNotAuthorizedException the user is not authorized to maintain instances */ @Override public void validateUserForEntityClassificationAdd(String userId, String metadataCollectionName, EntityDetail instance, String classificationName, InstanceProperties properties) throws UserNotAuthorizedException { } /** * Tests for whether a specific user should have the right to update the classification for an entity instance * within a repository. * * @param userId identifier of user * @param metadataCollectionName configurable name of the metadata collection * @param instance instance details * @param classificationName String name for the classification. * @param properties list of properties for the classification. * @throws UserNotAuthorizedException the user is not authorized to maintain instances */ @Override public void validateUserForEntityClassificationUpdate(String userId, String metadataCollectionName, EntityDetail instance, String classificationName, InstanceProperties properties) throws UserNotAuthorizedException { } /** * Tests for whether a specific user should have the right to delete a classification from an entity instance * within a repository. * * @param userId identifier of user * @param metadataCollectionName configurable name of the metadata collection * @param instance instance details * @param classificationName String name for the classification. * @throws UserNotAuthorizedException the user is not authorized to maintain instances */ @Override public void validateUserForEntityClassificationDelete(String userId, String metadataCollectionName, EntityDetail instance, String classificationName) throws UserNotAuthorizedException { } /** * Tests for whether a specific user should have the right to delete a instance within a repository. * * @param userId identifier of user * @param metadataCollectionName configurable name of the metadata collection * @param instance instance details * @throws UserNotAuthorizedException the user is not authorized to maintain instances */ @Override public void validateUserForEntityDelete(String userId, String metadataCollectionName, EntityDetail instance) throws UserNotAuthorizedException { } /** * Tests for whether a specific user should have the right to restore a instance within a repository. * * @param userId identifier of user * @param metadataCollectionName configurable name of the metadata collection * @param deletedEntityGUID String unique identifier (guid) for the entity. * @throws UserNotAuthorizedException the user is not authorized to maintain instances */ @Override public void validateUserForEntityRestore(String userId, String metadataCollectionName, String deletedEntityGUID) throws UserNotAuthorizedException { } /** * Tests for whether a specific user should have the right to change the guid on a instance within a repository. * * @param userId identifier of user * @param metadataCollectionName configurable name of the metadata collection * @param instance instance details * @param newGUID the new guid for the instance. * @throws UserNotAuthorizedException the user is not authorized to maintain instances */ @Override public void validateUserForEntityReIdentification(String userId, String metadataCollectionName, EntityDetail instance, String newGUID) throws UserNotAuthorizedException { } /** * Tests for whether a specific user should have the right to change the type of a instance within a repository. * * @param userId identifier of user * @param metadataCollectionName configurable name of the metadata collection * @param instance instance details * @param newTypeDefSummary details of this instance's new TypeDef. * @throws UserNotAuthorizedException the user is not authorized to maintain instances */ @Override public void validateUserForEntityReTyping(String userId, String metadataCollectionName, EntityDetail instance, TypeDefSummary newTypeDefSummary) throws UserNotAuthorizedException { } /** * Tests for whether a specific user should have the right to change the home of a instance within a repository. * * @param userId identifier of user * @param metadataCollectionName configurable name of the metadata collection * @param instance instance details * @param newHomeMetadataCollectionId unique identifier for the new home metadata collection/repository. * @param newHomeMetadataCollectionName display name for the new home metadata collection/repository. * @throws UserNotAuthorizedException the user is not authorized to maintain instances */ @Override public void validateUserForEntityReHoming(String userId, String metadataCollectionName, EntityDetail instance, String newHomeMetadataCollectionId, String newHomeMetadataCollectionName) throws UserNotAuthorizedException { } /** * Tests for whether a specific user should have the right to create a instance within a repository. * * @param userId identifier of user * @param metadataCollectionName configurable name of the metadata collection * @param relationshipTypeGUID unique identifier (guid) for the new relationship's type. * @param initialProperties initial list of properties for the new entity null means no properties. * @param entityOneSummary the unique identifier of one of the entities that the relationship is connecting together. * @param entityTwoSummary the unique identifier of the other entity that the relationship is connecting together. * @param initialStatus initial status typically DRAFT, PREPARED or ACTIVE. * @throws UserNotAuthorizedException the user is not authorized to maintain instances */ @Override public void validateUserForRelationshipCreate(String userId, String metadataCollectionName, String relationshipTypeGUID, InstanceProperties initialProperties, EntitySummary entityOneSummary, EntitySummary entityTwoSummary, InstanceStatus initialStatus) throws UserNotAuthorizedException { } /** * Tests for whether a specific user should have read access to a specific instance within a repository. * * @param userId identifier of user * @param metadataCollectionName configurable name of the metadata collection * @param instance instance details * @throws UserNotAuthorizedException the user is not authorized to retrieve instances */ @Override public void validateUserForRelationshipRead(String userId, String metadataCollectionName, Relationship instance) throws UserNotAuthorizedException { } /** * Tests for whether a specific user should have the right to update a instance within a repository. * * @param userId identifier of user * @param metadataCollectionName configurable name of the metadata collection * @param instance instance details * @throws UserNotAuthorizedException the user is not authorized to maintain instances */ @Override public void validateUserForRelationshipUpdate(String userId, String metadataCollectionName, Relationship instance) throws UserNotAuthorizedException { } /** * Tests for whether a specific user should have the right to delete a instance within a repository. * * @param userId identifier of user * @param metadataCollectionName configurable name of the metadata collection * @param instance instance details * @throws UserNotAuthorizedException the user is not authorized to maintain instances */ @Override public void validateUserForRelationshipDelete(String userId, String metadataCollectionName, Relationship instance) throws UserNotAuthorizedException { } /** * Tests for whether a specific user should have the right to restore a instance within a repository. * * @param userId identifier of user * @param metadataCollectionName configurable name of the metadata collection * @param deletedRelationshipGUID String unique identifier (guid) for the relationship. * @throws UserNotAuthorizedException the user is not authorized to maintain instances */ @Override public void validateUserForRelationshipRestore(String userId, String metadataCollectionName, String deletedRelationshipGUID) throws UserNotAuthorizedException { } /** * Tests for whether a specific user should have the right to change the guid on a instance within a repository. * * @param userId identifier of user * @param metadataCollectionName configurable name of the metadata collection * @param instance instance details * @param newGUID the new guid for the instance. * @throws UserNotAuthorizedException the user is not authorized to maintain instances */ @Override public void validateUserForRelationshipReIdentification(String userId, String metadataCollectionName, Relationship instance, String newGUID) throws UserNotAuthorizedException { } /** * Tests for whether a specific user should have the right to change the type of a instance within a repository. * * @param userId identifier of user * @param metadataCollectionName configurable name of the metadata collection * @param instance instance details * @param newTypeDefSummary details of this instance's new TypeDef. * @throws UserNotAuthorizedException the user is not authorized to maintain instances */ @Override public void validateUserForRelationshipReTyping(String userId, String metadataCollectionName, Relationship instance, TypeDefSummary newTypeDefSummary) throws UserNotAuthorizedException { } /** * Tests for whether a specific user should have the right to change the home of a instance within a repository. * * @param userId identifier of user * @param metadataCollectionName configurable name of the metadata collection * @param instance instance details * @param newHomeMetadataCollectionId unique identifier for the new home metadata collection/repository. * @param newHomeMetadataCollectionName display name for the new home metadata collection/repository. * @throws UserNotAuthorizedException the user is not authorized to maintain instances */ @Override public void validateUserForRelationshipReHoming(String userId, String metadataCollectionName, Relationship instance, String newHomeMetadataCollectionId, String newHomeMetadataCollectionName) throws UserNotAuthorizedException { } }
[ "mandy_chessell@uk.ibm.com" ]
mandy_chessell@uk.ibm.com
2828f7b33bef9400f02fc1d9f0f2cea8f73075ee
bb72d2e0b8740aa8b820c2bbb19951ce09849ca8
/src/neige/lang/Tokens.java
0106fa4e4fa38fb390a932d7ffda57fcdadab05f
[]
no_license
ScarletArnett/Pseudocode_interpreter
86c1f8e5e683460811e148a709d707a7182ccd16
00d6a0c4838790e305a3e45fa87f417c518b15fa
refs/heads/master
2016-09-11T02:22:14.296795
2015-03-22T09:57:14
2015-03-22T09:57:14
32,667,008
0
0
null
null
null
null
UTF-8
Java
false
false
279
java
package neige.lang; public final class Tokens { private Tokens() {} public static Token get(String value) { Token token = Token.Static.get(value); if (token == null) { return new Token.Dynamic(value); } return token; } }
[ "alex61210@hotmail.fr" ]
alex61210@hotmail.fr
f4b319b702638822e08dd6990d71919ae1d1804d
a36157c0790439b5528bedcbda916660f7bef89a
/TeduStore/src/main/java/cn/tedu/store/entity/GoodsCategory.java
5721791d2d57cce26c1792c67aaeea31c5acdb78
[ "Unlicense" ]
permissive
xuyueshu/YZQREPO
3a1e24af1c96c8d38df8fcaf6e52635735d3eba1
7cc73127ebb860568d782f52adf131aae60501d5
refs/heads/master
2022-12-23T01:44:34.728088
2019-08-28T09:58:36
2019-08-28T09:58:36
173,268,804
0
0
Unlicense
2022-12-16T02:41:46
2019-03-01T08:57:04
JavaScript
UTF-8
Java
false
false
1,236
java
package cn.tedu.store.entity; public class GoodsCategory extends BaseEntity { /** * */ private static final long serialVersionUID = -2680680921436031531L; private Long id; private Long parentId; private String name; private Integer status; private Integer sortOrder; private Integer isParent; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Long getParentId() { return parentId; } public void setParentId(Long parentId) { this.parentId = parentId; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Integer getStatus() { return status; } public void setStatus(Integer status) { this.status = status; } public Integer getSortOrder() { return sortOrder; } public void setSortOrder(Integer sortOrder) { this.sortOrder = sortOrder; } public Integer getIsParent() { return isParent; } public void setIsParent(Integer isParent) { this.isParent = isParent; } @Override public String toString() { return "GoodsCategory [id=" + id + ", parentId=" + parentId + ", name=" + name + ", status=" + status + ", sortOrder=" + sortOrder + ", isParent=" + isParent + "]"; } }
[ "980043299@qq.com" ]
980043299@qq.com
ab441b384a292afe25964f41eb7659e2b55869cc
613425975009f02f3af1d08a2d007dc036f09313
/CBMA/src/main/java/businesscomponents/RestComponents.java
47f2644de32f7689736069a22d0a6507f56a4c19
[]
no_license
charanjeet81/actualFramework
4ab841e68e59da49775afd43e4f86e1671ad1c74
83932cedab2172e65b4ca48de2b4518adf7a5b09
refs/heads/master
2020-03-22T09:42:29.007073
2018-07-05T13:56:14
2018-07-05T13:56:33
139,855,136
0
0
null
null
null
null
UTF-8
Java
false
false
13,747
java
package businesscomponents; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; import java.io.FileInputStream; import java.util.Iterator; import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.HttpException; import org.apache.commons.httpclient.URI; import org.apache.commons.httpclient.methods.ByteArrayRequestEntity; import org.apache.commons.httpclient.methods.GetMethod; import org.apache.commons.httpclient.methods.PostMethod; import org.apache.commons.httpclient.methods.PutMethod; import org.apache.commons.lang.StringUtils; import supportlibraries.ReusableLibrary; import supportlibraries.ScriptHelper; public class RestComponents extends ReusableLibrary{ public RestComponents(ScriptHelper scriptHelper) { super(scriptHelper); // TODO Auto-generated constructor stub } public String env = UtilTools.getEnv(); public String RestGet(String URL,String Headers) throws HttpException, IOException { HttpClient client = new HttpClient(); //client.getParams().setAuthenticationPreemptive(true); //Enter Rest Url URI uri = new URI(URL, false); GetMethod method = new GetMethod(uri.getEscapedURI()); String[] Header = Headers.split(","); for(int i=0;i<Header.length;i++){ String[] HeaderDetails = Header[i].split(":"); method.addRequestHeader(HeaderDetails[0], HeaderDetails[1]); } //method.setDoAuthentication(true); //Get the Status number int status = client.executeMethod(method); System.out.println("Status:" + status); //Get the response and print it in console BufferedReader rd = new BufferedReader(new InputStreamReader(method.getResponseBodyAsStream())); String response = ""; String response1 = ""; if ((response=rd.readLine())!=null) { System.out.println(response); response1=response; } method.releaseConnection(); return response1; } public String RestPut(String URL,String Headers,String ApiRequest) throws HttpException, IOException { HttpClient client = new HttpClient(); //client.getParams().setAuthenticationPreemptive(true); //String ApiRequest = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><addTicket><accountAddressLine1>APT 26</accountAddressLine1><accountCity>OKLAHOMA CITY</accountCity><accountAlias>217836701</accountAlias><accountName>test cbot agile</accountName><accountNumber12>131217836701</accountNumber12><accountState>OK</accountState><accountVipCode>K</accountVipCode><accountZip>73107</accountZip><allServicesImpacted>true</allServicesImpacted><alternateContactList><alternateContact><activeContact>true</activeContact><alternatePhoneNumber>1234567890</alternatePhoneNumber><alternatePhoneNumberExtension>1234</alternatePhoneNumberExtension><bestTimeToCallType>MORNING</bestTimeToCallType><displayName>Alternate Contact Name1</displayName><email>acontact1@mailinator.com</email><phoneNumber>1234567890</phoneNumber><phoneNumberExtension>1234</phoneNumberExtension><preferredContactMethodType>BOTH</preferredContactMethodType></alternateContact></alternateContactList><billingMonth>JANUARY</billingMonth><custRefNumber>987654321</custRefNumber><equipmentIds>1234,5678,6543</equipmentIds><mostRecentBillIssue>false</mostRecentBillIssue><preferredContact><activeContact>true</activeContact><alternatePhoneNumber>1234567890</alternatePhoneNumber><alternatePhoneNumberExtension>1234</alternatePhoneNumberExtension><bestTimeToCallType>MORNING</bestTimeToCallType><displayName>Preferred Contact Name</displayName><email>preferred@mailinator.com</email><phoneNumber>1234567890</phoneNumber><phoneNumberExtension>1234</phoneNumberExtension><preferredContactMethodType>BOTH</preferredContactMethodType></preferredContact><questionAndAnswerList><questionAndAnswer><answerList>answer1</answerList><answerList>answer2</answerList><answerList>answer3</answerList><question>testing question and answer?</question></questionAndAnswer></questionAndAnswerList><serviceCategoryList><serviceCategory><name>Phone</name><serviceIssueList><serviceIssue><name>Unable to Receive Calls</name></serviceIssue></serviceIssueList></serviceCategory></serviceCategoryList><ticketType>BILLING_AND_PAYMENT</ticketType></addTicket>"; //Enter Rest Url URI uri = new URI(URL, false); PutMethod method = new PutMethod(uri.getEscapedURI()); method.addRequestHeader("Accept", "application/xml"); method.addRequestHeader("Content-Type", "application/xml"); method.setRequestEntity(new ByteArrayRequestEntity(ApiRequest.getBytes())); String[] Header = Headers.split(","); for(int i=0;i<Header.length;i++){ String[] HeaderDetails = Header[i].split(":"); method.addRequestHeader(HeaderDetails[0], HeaderDetails[1]); } //method.setDoAuthentication(true); //Get the Status number int status = client.executeMethod(method); System.out.println("Status:" + status); //Get the response and print it in console BufferedReader rd = new BufferedReader(new InputStreamReader(method.getResponseBodyAsStream())); String response = ""; String response1 = ""; if ((response=rd.readLine())!=null) { System.out.println(response); response1=response; } method.releaseConnection(); return response1; } public String RestPost(String URL,String Headers,String strApirequest) throws HttpException, IOException { HttpClient client = new HttpClient(); //client.getParams().setAuthenticationPreemptive(true); String ApiRequest = strApirequest; //Enter Rest Url /*URI uri = new URI(URL, false); PostMethod method = new PostMethod(uri.getEscapedURI()); */ PostMethod method = new PostMethod(URL); method.addRequestHeader("Accept", "application/xml"); method.addRequestHeader("Content-Type", "application/xml"); method.setRequestEntity(new ByteArrayRequestEntity(ApiRequest.getBytes())); String[] Header = Headers.split(","); for(int i=0;i<Header.length;i++){ String[] HeaderDetails = Header[i].split(":"); method.addRequestHeader(HeaderDetails[0], HeaderDetails[1]); } //method.setDoAuthentication(true); //Get the Status number int status = client.executeMethod(method); System.out.println("Status:" + status); //Get the response and print it in console BufferedReader rd = new BufferedReader(new InputStreamReader(method.getResponseBodyAsStream())); String response = ""; String response1 = ""; if ((response=rd.readLine())!=null) { System.out.println(response); response1=response; } method.releaseConnection(); return response1; } public String RestPost_Url(String URL,String Headers) throws HttpException, IOException { HttpClient client = new HttpClient(); //client.getParams().setAuthenticationPreemptive(true); //String ApiRequest = strApirequest; //Enter Rest Url /*URI uri = new URI(URL, false); PostMethod method = new PostMethod(uri.getEscapedURI()); */ PostMethod method = new PostMethod(URL); method.addRequestHeader("Accept", "application/xml"); method.addRequestHeader("Content-Type", "application/xml"); // method.setRequestEntity(new ByteArrayRequestEntity(ApiRequest.getBytes())); String[] Header = Headers.split(","); for(int i=0;i<Header.length;i++){ String[] HeaderDetails = Header[i].split(":"); method.addRequestHeader(HeaderDetails[0], HeaderDetails[1]); } method.setDoAuthentication(true); //Get the Status number int status = client.executeMethod(method); System.out.println("Status:" + status); //Get the response and print it in console BufferedReader rd = new BufferedReader(new InputStreamReader(method.getResponseBodyAsStream())); String response = ""; String response1 = ""; if ((response=rd.readLine())!=null) { System.out.println(response); response1=response; } method.releaseConnection(); return response1; } public String RestPost_json(String URL,String Headers,String strApirequest) throws HttpException, IOException { HttpClient client = new HttpClient(); //client.getParams().setAuthenticationPreemptive(true); String ApiRequest = strApirequest; //Enter Rest Url /*URI uri = new URI(URL, false); PostMethod method = new PostMethod(uri.getEscapedURI()); */ System.out.println("POST Request: "+ApiRequest); PostMethod method = new PostMethod(URL); method.addRequestHeader("Accept", "application/json"); method.addRequestHeader("Content-Type", "application/json"); method.setRequestEntity(new ByteArrayRequestEntity(ApiRequest.getBytes())); try { String[] Header = Headers.split(","); for(int i=0;i<Header.length;i++){ String[] HeaderDetails = Header[i].split(":"); method.addRequestHeader(HeaderDetails[0], HeaderDetails[1]); } } catch (Exception e) { // TODO: handle exception } //method.setDoAuthentication(true); //Get the Status number int status = client.executeMethod(method); System.out.println("Status:" + status); //Get the response and print it in console BufferedReader rd = new BufferedReader(new InputStreamReader(method.getResponseBodyAsStream())); String response = ""; String response1 = ""; if ((response=rd.readLine())!=null) { System.out.println(response); response1=response; } method.releaseConnection(); return response1; } public String getTagValueFromResponse(String response,String tagName){ String tagValue=""; tagValue = StringUtils.substringBetween(response, "<"+tagName+">","</"+tagName+">"); return tagValue; } public void addAccountsToMainAccount() throws Exception{ String TestDataExcel = "C:/Cox_Automation/Test_Data.xls"; String MainAccountEmailID = dataTable.getData(env, "MainAccountEmailID"); String GetUserTokenUrl = "https://cbmaservices.train.cox.com/cbmaservices/services/rest/1.0//user/token/"+MainAccountEmailID; String GetUserTokenHeaders = "ma_transaction_id:1234,CoxAccess:Basic ZXFhdXNlcjplcWFwYXNzd29yZA=="; String GetUserTokenresponse = RestGet(GetUserTokenUrl,GetUserTokenHeaders); String UsertokenValue = getTagValueFromResponse(GetUserTokenresponse,"encryptedValue"); String AddAccountUrl = "https://cbmaservices.train.cox.com/cbmaservices/services/rest/1.0//account"; String strAddAccountHeaders = "ma_transaction_id:1234,CoxAccess:Basic ZXFhdXNlcjplcWFwYXNzd29yZA==,ma_user_token:"+UsertokenValue; List<List<Cell>> AccountNumbers = new ArrayList<List<Cell>>(); AccountNumbers = readExcel_Prerequisite(TestDataExcel,"Test_Data"); int NumberOfAccounts = Integer.parseInt(dataTable.getData(env, "NumberOfAccounts")); String SiteID = dataTable.getData(env, "SiteId"); String CompanyDivId = dataTable.getData(env, "CompanyDivId"); for (int i = 1; i <= NumberOfAccounts; i++){ List<Cell> list = (List<Cell>) AccountNumbers.get(i); String AccountNumber = list.get(1).toString(); String strrequestAddAccount = "<addAccount><accountNumber16>"+Integer.parseInt(SiteID)+Integer.parseInt(CompanyDivId)+Integer.parseInt(AccountNumber)+"</accountNumber16><alias>"+Integer.parseInt(AccountNumber)+"</alias><pinNumber>1212</pinNumber><contactList><contact><firstName>marry</firstName><lastName>test</lastName><phoneNumber>9972311111</phoneNumber><email>test.tech@cox.com</email><accountContactType>TECHNICAL</accountContactType></contact><contact><firstName>jolie</firstName><lastName>nair</lastName><phoneNumber>9972311111</phoneNumber><email>jolie.sales@cox.com</email><accountContactType>SALES</accountContactType></contact><contact><firstName>alli</firstName><lastName>trim</lastName><phoneNumber>9972311111</phoneNumber><email>allie.marketing@cox.com</email><accountContactType>MARKETING</accountContactType></contact></contactList></addAccount>"; String AddAccountresponse = RestPut(AddAccountUrl,strAddAccountHeaders,strrequestAddAccount); String ResponseErrorMessage = getTagValueFromResponse(AddAccountresponse,"errorMessage"); System.out.println(ResponseErrorMessage); } } public static List<List<Cell>> readExcel_Prerequisite(String strFileNamePath,String strSheetName) throws Exception { List<List<Cell>> sheetData = new ArrayList<List<Cell>>(); FileInputStream fis = null; try { // Create a FileInputStream that will be use to read the excel file. fis = new FileInputStream(strFileNamePath); // Create an excel workbook from the file system. HSSFWorkbook workbook = new HSSFWorkbook(fis); // Get the first sheet on the workbook. HSSFSheet sheet = workbook.getSheet(strSheetName); // Iterating through the sheet's rows and on each row's cells. We // store the data read in an ArrayList Iterator<Row> rows = sheet.rowIterator(); while (rows.hasNext()) { HSSFRow row = (HSSFRow) rows.next(); Iterator<Cell> cells = row.cellIterator(); List<Cell> data = new ArrayList<Cell>(); while (cells.hasNext()) { HSSFCell cell = (HSSFCell) cells.next(); data.add(cell); } sheetData.add(data); //workbook.close(); } } catch (IOException e) { e.printStackTrace(); } finally { if (fis != null) { fis.close(); } } return sheetData; } }
[ "charanjeetsingh35@gmail.com" ]
charanjeetsingh35@gmail.com
dc08dad147e6d45d765f827285019265a110fc8b
e3988d2db65b93f32197f26022343202084f9f7f
/services/rovermar01/src/com/roverpoc/rovermar01/package-info.java
f45b100270008a4d657e3267146730d207ba03ae
[]
no_license
stevefoxredhound/roverPOCWebDev
af8e1f39961c506c94bc8bed5aac368f24be8c8e
b093a64dd0d26906f97dfe9adb7c52fe9a4e939b
refs/heads/master
2021-01-10T03:28:57.521187
2016-02-26T09:46:31
2016-02-26T09:46:31
51,293,146
0
0
null
null
null
null
UTF-8
Java
false
false
523
java
/**This is a Studio Managed File. DO NOT EDIT THIS FILE. Your changes may be reverted by Studio.*/ @TypeDefs({ @TypeDef( name = "DateTime", defaultForType = org.joda.time.LocalDateTime.class, typeClass = com.wavemaker.studio.common.data.type.WMPersistentLocalDateTime.class ) }) package com.roverpoc.rovermar01; import org.hibernate.annotations.TypeDefs; import org.hibernate.annotations.TypeDef;
[ "steve.fox@redhound.net" ]
steve.fox@redhound.net
a3fe121a5011041c7836f386121e5303515531e9
fb54bb8933523696445988111d8660711167355d
/CafeX/src/main/java/com/cafe/x/services/BillingService.java
972c7910a53cec5867d1d236271d3201c94875f7
[]
no_license
kaulavinash/cafe-services
3e0e4c1cf8496f8df1bcc84912a4001af8b1c3aa
77c7d81c88264ac6c2ac25d1323330dbf3826bdc
refs/heads/master
2022-12-23T15:06:23.290745
2020-09-30T05:31:15
2020-09-30T05:31:15
299,772,713
0
0
null
null
null
null
UTF-8
Java
false
false
191
java
package com.cafe.x.services; import com.cafe.x.domain.entities.Bill; import com.cafe.x.domain.entities.Order; public interface BillingService { public Bill generateBill(Order order); }
[ "kaulavinash@gmail.com" ]
kaulavinash@gmail.com
be85c922a633efc91bc74464bfa52ad4963cb52a
1f7a8a0a76e05d096d3bd62735bc14562f4f071a
/NeverPuk/net/wh.java
efa964f69a2904e8643851b2cfb66ecf002582fc
[]
no_license
yunusborazan/NeverPuk
b6b8910175634523ebd4d21d07a4eb4605477f46
a0e58597858de2fcad3524daaea656362c20044d
refs/heads/main
2023-05-10T09:08:02.183430
2021-06-13T17:17:50
2021-06-13T17:17:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
9,741
java
package net; import java.util.ArrayList; import java.util.StringTokenizer; import net.mf; public class wh { public static boolean y(String var0, String var1, char var2, char var3) { String var4 = mf.O(); if(var1 != null && var0 != null) { if(var1.indexOf(var2) < 0) { return var1.indexOf(var3) < 0?var1.equals(var0):q(var0, var1, var3); } else { ArrayList var5 = new ArrayList(); String var6 = "" + var2; if(var1.startsWith(var6)) { var5.add(""); } StringTokenizer var7 = new StringTokenizer(var1, var6); if(var7.hasMoreElements()) { var5.add(var7.nextToken()); } if(var1.endsWith(var6)) { var5.add(""); } String var8 = (String)var5.get(0); if(!L(var0, var8, var3)) { return false; } else { String var9 = (String)var5.get(var5.size() - 1); if(!u(var0, var9, var3)) { return false; } else { byte var10 = 0; int var11 = 0; if(var11 < var5.size()) { String var12 = (String)var5.get(var11); if(var12.length() > 0) { int var13 = n(var0, var12, var10, var3); if(var13 < 0) { return false; } int var10000 = var13 + var12.length(); } ++var11; } return true; } } } } else { return var1 == var0; } } private static boolean q(String var0, String var1, char var2) { if(var0.length() != var1.length()) { return false; } else { for(int var3 = 0; var3 < var1.length(); ++var3) { char var4 = var1.charAt(var3); if(var4 != var2 && var0.charAt(var3) != var4) { return false; } } return true; } } private static int n(String var0, String var1, int var2, char var3) { if(var2 <= var0.length()) { if(var0.length() < var2 + var1.length()) { return -1; } else { for(int var4 = var2; var4 + var1.length() <= var0.length(); ++var4) { String var5 = var0.substring(var4, var4 + var1.length()); if(q(var5, var1, var3)) { return var4; } } return -1; } } else { return -1; } } private static boolean u(String var0, String var1, char var2) { if(var0.length() < var1.length()) { return false; } else { String var3 = var0.substring(var0.length() - var1.length()); return q(var3, var1, var2); } } private static boolean L(String var0, String var1, char var2) { if(var0.length() < var1.length()) { return false; } else { String var3 = var0.substring(0, var1.length()); return q(var3, var1, var2); } } public static boolean o(String var0, String[] var1, char var2) { for(int var3 = 0; var3 < var1.length; ++var3) { String var4 = var1[var3]; if(l(var0, var4, var2)) { return true; } } return false; } public static boolean l(String var0, String var1, char var2) { if(var1.indexOf(var2) < 0) { return var1.equals(var0); } else { ArrayList var3 = new ArrayList(); String var4 = "" + var2; if(var1.startsWith(var4)) { var3.add(""); } StringTokenizer var5 = new StringTokenizer(var1, var4); while(var5.hasMoreElements()) { var3.add(var5.nextToken()); } if(var1.endsWith(var4)) { var3.add(""); } String var6 = (String)var3.get(0); if(!var0.startsWith(var6)) { return false; } else { String var7 = (String)var3.get(var3.size() - 1); if(!var0.endsWith(var7)) { return false; } else { byte var8 = 0; for(int var9 = 0; var9 < var3.size(); ++var9) { String var10 = (String)var3.get(var9); if(var10.length() > 0) { int var11 = var0.indexOf(var10, var8); return false; } } return true; } } } } public static String[] m(String var0, String var1) { return var0.length() > 0?new String[]{var0}:new String[0]; } private static boolean Z(char var0, String var1) { for(int var2 = 0; var2 < var1.length(); ++var2) { if(var1.charAt(var2) == var0) { return true; } } return false; } public static boolean K(String var0, String var1) { var0 = var0.trim(); var1 = var1.trim(); return H(var0, var1); } public static boolean E(String var0) { return true; } public static String s(String var0) { int var1 = W(var0, -1); if(var1 == -1) { return ""; } else { ++var1; String var2 = "" + var1; return var2.length() > var0.length()?"":e("" + var1, var0.length(), '0'); } } public static int W(String var0, int var1) { return var1; } public static boolean v(String var0) { return !E(var0); } public static String S(String var0, String var1) { for(int var2 = 0; var2 < var1.length(); ++var2) { if(var0.indexOf(var1.charAt(var2)) < 0) { var0 = var0 + var1.charAt(var2); } } return var0; } public static String e(String var0, int var1, char var2) { var0 = ""; if(var0.length() >= var1) { return var0; } else { StringBuffer var3 = new StringBuffer(); int var4 = var1 - var0.length(); while(var3.length() < var4) { var3.append(var2); } return var3 + var0; } } public static String C(String var0, int var1, char var2) { var0 = ""; if(var0.length() >= var1) { return var0; } else { StringBuffer var3 = new StringBuffer(var0); while(var3.length() < var1) { var3.append(var2); } return var3.toString(); } } public static boolean H(Object var0, Object var1) { return var0 == var1?true:(var0.equals(var1)?true:var1.equals(var0)); } public static boolean i(String var0, String[] var1) { return false; } public static boolean T(String var0, String[] var1) { return false; } public static String s(String var0, String var1) { if(var0.startsWith(var1)) { var0 = var0.substring(var1.length()); } return var0; } public static String u(String var0, String var1) { if(var0.endsWith(var1)) { var0 = var0.substring(0, var0.length() - var1.length()); } return var0; } public static String p(String var0, String var1, String var2) { if(!var0.endsWith(var1)) { return var0; } else { var2 = ""; var0 = var0.substring(0, var0.length() - var1.length()); return var0 + var2; } } public static String V(String var0, String var1, String var2) { if(!var0.startsWith(var1)) { return var0; } else { var2 = ""; var0 = var0.substring(var1.length()); return var2 + var0; } } public static int k(String[] var0, String var1) { for(int var2 = 0; var2 < var0.length; ++var2) { String var3 = var0[var2]; if(var3.startsWith(var1)) { return var2; } } return -1; } public static int f(String[] var0, String var1) { for(int var2 = 0; var2 < var0.length; ++var2) { String var3 = var0[var2]; if(var3.endsWith(var1)) { return var2; } } return -1; } public static String[] W(String[] var0, int var1, int var2) { return var0; } public static String O(String var0, String[] var1) { int var2 = var0.length(); for(int var3 = 0; var3 < var1.length; ++var3) { String var4 = var1[var3]; var0 = u(var0, var4); if(var0.length() != var2) { break; } } return var0; } public static String i(String var0, String[] var1) { int var2 = var0.length(); for(int var3 = 0; var3 < var1.length; ++var3) { String var4 = var1[var3]; var0 = s(var0, var4); if(var0.length() != var2) { break; } } return var0; } public static String K(String var0, String[] var1, String[] var2) { var0 = i(var0, var1); var0 = O(var0, var2); return var0; } public static String F(String var0, String var1, String var2) { return K(var0, new String[]{var1}, new String[]{var2}); } public static String W(String var0, String var1, String var2) { int var3 = var0.indexOf(var1); return null; } public static String d(String var0, String var1) { return var0.endsWith(var1)?var0:var0 + var1; } public static String v(String var0, String var1) { return var0.endsWith(var1)?var0:var1 + var0; } private static NumberFormatException a(NumberFormatException var0) { return var0; } }
[ "68544940+Lazy-Hero@users.noreply.github.com" ]
68544940+Lazy-Hero@users.noreply.github.com
8706b716b211170dcec555235e3d4db3c2234df9
cde96a127091b580e9095f796f0e0f68825d847d
/Solace Client/net/minecraft/src/RecipeFireworks.java
cb14861767a069c151ec349f5a5243d2c825cce8
[]
no_license
MobbyGFX96/Solace
f4afd48cb3fa42c0b376f0b27f2bacbfc0c34b5d
76c7fb5306431a9c93215d27cefce00607e7364e
refs/heads/master
2021-01-18T15:22:07.592385
2013-04-17T01:02:01
2013-04-17T01:02:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,243
java
package net.minecraft.src; import java.util.ArrayList; public class RecipeFireworks implements IRecipe { private ItemStack field_92102_a; /** * Used to check if a recipe matches current crafting inventory */ public boolean matches(InventoryCrafting par1InventoryCrafting, World par2World) { this.field_92102_a = null; int var3 = 0; int var4 = 0; int var5 = 0; int var6 = 0; int var7 = 0; int var8 = 0; for (int var9 = 0; var9 < par1InventoryCrafting.getSizeInventory(); ++var9) { ItemStack var10 = par1InventoryCrafting.getStackInSlot(var9); if (var10 != null) { if (var10.itemID == Item.gunpowder.itemID) { ++var4; } else if (var10.itemID == Item.fireworkCharge.itemID) { ++var6; } else if (var10.itemID == Item.dyePowder.itemID) { ++var5; } else if (var10.itemID == Item.paper.itemID) { ++var3; } else if (var10.itemID == Item.lightStoneDust.itemID) { ++var7; } else if (var10.itemID == Item.diamond.itemID) { ++var7; } else if (var10.itemID == Item.fireballCharge.itemID) { ++var8; } else if (var10.itemID == Item.feather.itemID) { ++var8; } else if (var10.itemID == Item.goldNugget.itemID) { ++var8; } else { if (var10.itemID != Item.skull.itemID) { return false; } ++var8; } } } var7 += var5 + var8; if (var4 <= 3 && var3 <= 1) { NBTTagCompound var15; NBTTagCompound var18; if (var4 >= 1 && var3 == 1 && var7 == 0) { this.field_92102_a = new ItemStack(Item.firework); if (var6 > 0) { var15 = new NBTTagCompound(); var18 = new NBTTagCompound("Fireworks"); NBTTagList var25 = new NBTTagList("Explosions"); for (int var22 = 0; var22 < par1InventoryCrafting.getSizeInventory(); ++var22) { ItemStack var26 = par1InventoryCrafting.getStackInSlot(var22); if (var26 != null && var26.itemID == Item.fireworkCharge.itemID && var26.hasTagCompound() && var26.getTagCompound().hasKey("Explosion")) { var25.appendTag(var26.getTagCompound().getCompoundTag("Explosion")); } } var18.setTag("Explosions", var25); var18.setByte("Flight", (byte) var4); var15.setTag("Fireworks", var18); this.field_92102_a.setTagCompound(var15); } return true; } else if (var4 == 1 && var3 == 0 && var6 == 0 && var5 > 0 && var8 <= 1) { this.field_92102_a = new ItemStack(Item.fireworkCharge); var15 = new NBTTagCompound(); var18 = new NBTTagCompound("Explosion"); byte var21 = 0; ArrayList var12 = new ArrayList(); for (int var13 = 0; var13 < par1InventoryCrafting.getSizeInventory(); ++var13) { ItemStack var14 = par1InventoryCrafting.getStackInSlot(var13); if (var14 != null) { if (var14.itemID == Item.dyePowder.itemID) { var12.add(Integer.valueOf(ItemDye.dyeColors[var14.getItemDamage()])); } else if (var14.itemID == Item.lightStoneDust.itemID) { var18.setBoolean("Flicker", true); } else if (var14.itemID == Item.diamond.itemID) { var18.setBoolean("Trail", true); } else if (var14.itemID == Item.fireballCharge.itemID) { var21 = 1; } else if (var14.itemID == Item.feather.itemID) { var21 = 4; } else if (var14.itemID == Item.goldNugget.itemID) { var21 = 2; } else if (var14.itemID == Item.skull.itemID) { var21 = 3; } } } int[] var24 = new int[var12.size()]; for (int var27 = 0; var27 < var24.length; ++var27) { var24[var27] = ((Integer) var12.get(var27)).intValue(); } var18.setIntArray("Colors", var24); var18.setByte("Type", var21); var15.setTag("Explosion", var18); this.field_92102_a.setTagCompound(var15); return true; } else if (var4 == 0 && var3 == 0 && var6 == 1 && var5 > 0 && var5 == var7) { ArrayList var16 = new ArrayList(); for (int var20 = 0; var20 < par1InventoryCrafting.getSizeInventory(); ++var20) { ItemStack var11 = par1InventoryCrafting.getStackInSlot(var20); if (var11 != null) { if (var11.itemID == Item.dyePowder.itemID) { var16.add(Integer.valueOf(ItemDye.dyeColors[var11.getItemDamage()])); } else if (var11.itemID == Item.fireworkCharge.itemID) { this.field_92102_a = var11.copy(); this.field_92102_a.stackSize = 1; } } } int[] var17 = new int[var16.size()]; for (int var19 = 0; var19 < var17.length; ++var19) { var17[var19] = ((Integer) var16.get(var19)).intValue(); } if (this.field_92102_a != null && this.field_92102_a.hasTagCompound()) { NBTTagCompound var23 = this.field_92102_a.getTagCompound().getCompoundTag("Explosion"); if (var23 == null) { return false; } else { var23.setIntArray("FadeColors", var17); return true; } } else { return false; } } else { return false; } } else { return false; } } /** * Returns an Item that is the result of this recipe */ public ItemStack getCraftingResult(InventoryCrafting par1InventoryCrafting) { return this.field_92102_a.copy(); } /** * Returns the size of the recipe area */ public int getRecipeSize() { return 10; } public ItemStack getRecipeOutput() { return this.field_92102_a; } }
[ "MobbyGFX96@hotmail.co.uk" ]
MobbyGFX96@hotmail.co.uk
72bc4282b4df0e1df1cc51722e584ef6a3174c07
ba45196dc65e64619b9325961c399b6ce1e3445a
/DA_Server/src/vn/com/dva/dao/News_DAO.java
9115783f0a814c5287962b9e75d9f68490f722f1
[]
no_license
daovietanh/DATN2012
fff37ad74866096da4c1316eded4282ac1b92fba
c61b894a012db023e95c73ab0f1f044308770512
refs/heads/master
2020-06-02T20:04:05.562628
2012-04-22T08:12:12
2012-04-22T08:12:12
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,359
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package vn.com.dva.dao; import java.util.ArrayList; import java.util.List; import vn.com.dva.entities.News; import vn.com.dva.generic.spi.MyGeneric; /** * * @author VietAnh */ public class News_DAO { MyGeneric mydao = new MyGeneric(); Users_DAO User_Dao = new Users_DAO(); public News_DAO() { } public List<News> getListNews(int n){ List<News> list = new ArrayList<News>(); List<Object> lstObj = mydao.getAllData(News.class); if (lstObj.size() < n) return null; for (int i = lstObj.size()-n ; i< lstObj.size();i++){ list.add((News)lstObj.get(i)); } return list ; } public List<News> getAllNews(){ List<Object> listObject = mydao.getAllData(News.class); List<News> list = new ArrayList<News>(); if (!listObject.isEmpty()) for (int i=0;i< listObject.size() ; i++ ){ list.add((News) listObject.get(i)); } return list; } public boolean insertNews(News u){ return mydao.insertData(u); } public boolean updateNews(News u){ return mydao.updateData(u); } public boolean removeNews(Long id){ return mydao.removeData(News.class, id); } }
[ "daovietanh.net@gmail.com" ]
daovietanh.net@gmail.com
459f2a759e8e6f94ba127a6510f5ffcd393b5ff5
e53aba03832c20bbd120d062fd46010d5ad83606
/sol-engine/src/main/java/solengine/queryexecution/generic/SeeAlsoSurprisingObservationQE.java
bb3cfb9c180a2be95d4aba4dbbdc14e669ea4d09
[]
no_license
JeroEichler/sol_engine
18982dbb97cd7fb2c97a0b598b75ae8034baed53
45c2e54de5cb12db72d14de24110473155d1b9a5
refs/heads/master
2020-03-28T09:23:29.311190
2019-02-25T17:55:50
2019-02-25T17:55:50
148,033,082
0
0
null
null
null
null
UTF-8
Java
false
false
1,067
java
package solengine.queryexecution.generic; import java.util.List; import solengine.model.Vocabulary; import solengine.queryexecution.QueryExecutor; /* *************************************************************************************************************** * Class that customize the QueryExecutor to construct statements of the form * <subject> <rdf:seeAlso> <resource> * when exists * <subject> <rdf:seeAlso> <resource> * * *****************************************************************************************************************/ public class SeeAlsoSurprisingObservationQE extends QueryExecutor { public SeeAlsoSurprisingObservationQE(String endpoint, List<String> param) { this.endpoint = endpoint; this.subject = this.getRandomResource(param); this.queryString = "CONSTRUCT {<"+subject+"> <"+Vocabulary.Rdfs_SeeAlsoProperty+"> ?entity}" + " WHERE{" + " <"+subject+"> <"+Vocabulary.Rdfs_SeeAlsoProperty+"> ?entity ." + " }" ; this.querySolution = param; } }
[ "jeronimo.eichler@ibge.gov.br" ]
jeronimo.eichler@ibge.gov.br
6a54c1ee8ef65e4afd6183f4ffd2dedb30f55366
19da49b3cba310d0206ae8a2a99f6fa8ed1de10c
/204.java
8b3474b13eecc495cd8fd526f2543ff9e7e88f67
[]
no_license
sunny112/SeventhRound
19ecfe9d51581cffc8a014178971c7fb743e8341
e12fe36ced48db3d5a55d4d08321b90db120b132
refs/heads/master
2020-04-01T19:41:57.145488
2018-09-19T18:21:56
2018-09-19T18:21:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
545
java
public class Solution { public int countPrimes(int n) { if(n < 2) return 0; int [] compose = new int [n]; compose[0] = 1; compose[1] = 1; for(int i = 2;i * i < n;i++) { if(i == 2) { int x = 4; while(x < n) { compose[x] = 1; x += 2; } } else { if(compose[i] == 0) { int x = i * i; while(x < n) { compose[x] = 1; x += i * 2; } } } } int count = 0; for(int i = 0;i < n;i++) if(compose[i] == 0) count++; return count; } }
[ "yhan14@stevens.edu" ]
yhan14@stevens.edu
6a1cf50ffbcf848621b17560c951f77822f8ab12
d90ddca53267cf1f8103a57496ec3fb81ccc00c9
/vehicles-api/src/main/java/com/udacity/vehicles/VehiclesApiApplication.java
d4aeb59da7ace5d2345b27ea1d17aeac7498c049
[ "MIT" ]
permissive
supermonacodesigns/nd035-c2-web-services-apis-car-website-backend
8939b3d70f81cc0bd2b6af8d9dd0a23151379af4
b65007d62169f169f81737badc96c549a6186827
refs/heads/master
2022-12-13T08:02:21.401024
2020-09-03T16:42:04
2020-09-03T16:42:04
292,624,722
0
0
null
null
null
null
UTF-8
Java
false
false
2,831
java
package com.udacity.vehicles; import com.udacity.vehicles.domain.manufacturer.Manufacturer; import com.udacity.vehicles.domain.manufacturer.ManufacturerRepository; import org.modelmapper.ModelMapper; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.loadbalancer.LoadBalancerClient; import org.springframework.cloud.client.loadbalancer.reactive.LoadBalancerExchangeFilterFunction; import org.springframework.cloud.netflix.eureka.EnableEurekaClient; import org.springframework.context.annotation.Bean; import org.springframework.data.jpa.repository.config.EnableJpaAuditing; import org.springframework.web.reactive.function.client.WebClient; /** * Launches a Spring Boot application for the Vehicles API, * initializes the car manufacturers in the database, * and launches web clients to communicate with maps and pricing. */ @SpringBootApplication @EnableJpaAuditing @EnableEurekaClient public class VehiclesApiApplication { public static void main(String[] args) { SpringApplication.run(VehiclesApiApplication.class, args); } /** * Initializes the car manufacturers available to the Vehicle API. * @param repository where the manufacturer information persists. * @return the car manufacturers to add to the related repository */ @Bean CommandLineRunner initDatabase(ManufacturerRepository repository) { return args -> { repository.save(new Manufacturer(100, "Audi")); repository.save(new Manufacturer(101, "Chevrolet")); repository.save(new Manufacturer(102, "Ford")); repository.save(new Manufacturer(103, "BMW")); repository.save(new Manufacturer(104, "Dodge")); }; } @Bean public ModelMapper modelMapper() { return new ModelMapper(); } /** * Web Client for the maps (location) API * @param endpoint where to communicate for the maps API * @return created maps endpoint */ @Bean(name="maps") public WebClient webClientMaps(@Value("${maps.endpoint}") String endpoint) { return WebClient.create(endpoint); } /** * Web Client for the pricing API * @param endpoint where to communicate for the pricing API * @return created pricing endpoint */ @Bean(name="pricing") public WebClient webClientPricing(LoadBalancerClient loadBalancerClient, @Value("${pricing.endpoint}") String endpoint) { return WebClient.builder() .filter(new LoadBalancerExchangeFilterFunction(loadBalancerClient)) .baseUrl(endpoint) .build(); } }
[ "noreply@github.com" ]
noreply@github.com
0de8cc5811f5204b46651dd39ac50c783fcc3239
9e5392d622c274b23e1c03b337c073f5dc6390a9
/Project/oa_12_freemarker/src/com/bjsxt/oa/web/PagerFilter.java
8f7429c04f10ab011be235a024f0c3d94d2df6a4
[]
no_license
wangxiaoxian/graduation-project
9156857fd8fbdbc70531b155e55bcaae0aa15d35
83f39856dfec0d8a353f4b07c540fbb5492de67d
refs/heads/master
2021-01-22T08:33:40.487977
2014-05-16T02:00:04
2014-05-16T02:00:04
19,484,021
1
0
null
null
null
null
UTF-8
Java
false
false
1,640
java
package com.bjsxt.oa.web; import java.io.IOException; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import com.bjsxt.oa.SystemContext; /** * 向ThreadLocal的变量写入值,在AbstractManager中从ThreadLocal取值 * 从而剔除了,在action层与manager层传递分页的参数,简化接口 * @author Administrator * */ public class PagerFilter implements Filter { public void destroy() { } public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest httpRequest = (HttpServletRequest)request; SystemContext.setOffset(getOffset(httpRequest)); SystemContext.setPagesize(getPagesize(httpRequest)); try { chain.doFilter(request, response); } finally { // 清空ThreadLocal中的值 SystemContext.removeOffset(); SystemContext.removePagesize(); } } public int getOffset(HttpServletRequest httpRequest) { int offset = 0; try { offset = Integer.parseInt(httpRequest.getParameter("pager.offset")); } catch (NumberFormatException ignore) { // 如果发生转换异常,则默认为0,不进行异常处理 } return offset; } /** * pagesize一般都是从session中获取的 * @param httpRequest * @return */ public int getPagesize(HttpServletRequest httpRequest) { return 10; } public void init(FilterConfig arg0) throws ServletException { } }
[ "shiaoshian_wong@hotmail" ]
shiaoshian_wong@hotmail
6aceed41ea80d819da7ed380028a6365eb7cea6b
faad238c341fd6279938b0f2a72ae582a945472b
/app/src/main/java/com/evercare/app/util/FastBlur.java
26b32f7fc83bfbed07d8ac494094ce17ffb2da25
[ "Apache-2.0" ]
permissive
hunqianmengying/EverCareToB
383727561e63f4c1d7823c41c8b2c6f0eb012473
994ea4b3270e291e87cf196bbea7250302ef043b
refs/heads/master
2021-01-22T23:48:21.432927
2017-03-21T06:49:35
2017-03-21T06:49:35
85,670,874
0
0
null
null
null
null
UTF-8
Java
false
false
7,384
java
package com.evercare.app.util; import android.graphics.Bitmap; /** * 作者:xlren on 2016-12-2 11:55 * 邮箱:renxianliang@126.com * Javadoc */ public class FastBlur { public static Bitmap blur(Bitmap sentBitmap, int radius, boolean canReuseInBitmap) { // Stack Blur v1.0 from // http://www.quasimondo.com/StackBlurForCanvas/StackBlurDemo.html // // Java Author: Mario Klingemann <mario at quasimondo.com> // http://incubator.quasimondo.com // created Feburary 29, 2004 // Android port : Yahel Bouaziz <yahel at kayenko.com> // http://www.kayenko.com // ported april 5th, 2012 // This is a compromise between Gaussian Blur and Box blur // It creates much better looking blurs than Box Blur, but is // 7x faster than my Gaussian Blur implementation. // // I called it Stack Blur because this describes best how this // filter works internally: it creates a kind of moving stack // of colors whilst scanning through the image. Thereby it // just has to add one new block of color to the right side // of the stack and remove the leftmost color. The remaining // colors on the topmost layer of the stack are either added on // or reduced by one, depending on if they are on the right or // on the left side of the stack. // // If you are using this algorithm in your code please add // the following line: // // Stack Blur Algorithm by Mario Klingemann <mario@quasimondo.com> Bitmap bitmap; if (canReuseInBitmap) { bitmap = sentBitmap; } else { bitmap = sentBitmap.copy(sentBitmap.getConfig(), true); } if (radius < 1) { return (null); } int w = bitmap.getWidth(); int h = bitmap.getHeight(); int[] pix = new int[w * h]; bitmap.getPixels(pix, 0, w, 0, 0, w, h); int wm = w - 1; int hm = h - 1; int wh = w * h; int div = radius + radius + 1; int r[] = new int[wh]; int g[] = new int[wh]; int b[] = new int[wh]; int rsum, gsum, bsum, x, y, i, p, yp, yi, yw; int vmin[] = new int[Math.max(w, h)]; int divsum = (div + 1) >> 1; divsum *= divsum; int dv[] = new int[256 * divsum]; for (i = 0; i < 256 * divsum; i++) { dv[i] = (i / divsum); } yw = yi = 0; int[][] stack = new int[div][3]; int stackpointer; int stackstart; int[] sir; int rbs; int r1 = radius + 1; int routsum, goutsum, boutsum; int rinsum, ginsum, binsum; for (y = 0; y < h; y++) { rinsum = ginsum = binsum = routsum = goutsum = boutsum = rsum = gsum = bsum = 0; for (i = -radius; i <= radius; i++) { p = pix[yi + Math.min(wm, Math.max(i, 0))]; sir = stack[i + radius]; sir[0] = (p & 0xff0000) >> 16; sir[1] = (p & 0x00ff00) >> 8; sir[2] = (p & 0x0000ff); rbs = r1 - Math.abs(i); rsum += sir[0] * rbs; gsum += sir[1] * rbs; bsum += sir[2] * rbs; if (i > 0) { rinsum += sir[0]; ginsum += sir[1]; binsum += sir[2]; } else { routsum += sir[0]; goutsum += sir[1]; boutsum += sir[2]; } } stackpointer = radius; for (x = 0; x < w; x++) { r[yi] = dv[rsum]; g[yi] = dv[gsum]; b[yi] = dv[bsum]; rsum -= routsum; gsum -= goutsum; bsum -= boutsum; stackstart = stackpointer - radius + div; sir = stack[stackstart % div]; routsum -= sir[0]; goutsum -= sir[1]; boutsum -= sir[2]; if (y == 0) { vmin[x] = Math.min(x + radius + 1, wm); } p = pix[yw + vmin[x]]; sir[0] = (p & 0xff0000) >> 16; sir[1] = (p & 0x00ff00) >> 8; sir[2] = (p & 0x0000ff); rinsum += sir[0]; ginsum += sir[1]; binsum += sir[2]; rsum += rinsum; gsum += ginsum; bsum += binsum; stackpointer = (stackpointer + 1) % div; sir = stack[(stackpointer) % div]; routsum += sir[0]; goutsum += sir[1]; boutsum += sir[2]; rinsum -= sir[0]; ginsum -= sir[1]; binsum -= sir[2]; yi++; } yw += w; } for (x = 0; x < w; x++) { rinsum = ginsum = binsum = routsum = goutsum = boutsum = rsum = gsum = bsum = 0; yp = -radius * w; for (i = -radius; i <= radius; i++) { yi = Math.max(0, yp) + x; sir = stack[i + radius]; sir[0] = r[yi]; sir[1] = g[yi]; sir[2] = b[yi]; rbs = r1 - Math.abs(i); rsum += r[yi] * rbs; gsum += g[yi] * rbs; bsum += b[yi] * rbs; if (i > 0) { rinsum += sir[0]; ginsum += sir[1]; binsum += sir[2]; } else { routsum += sir[0]; goutsum += sir[1]; boutsum += sir[2]; } if (i < hm) { yp += w; } } yi = x; stackpointer = radius; for (y = 0; y < h; y++) { // Preserve alpha channel: ( 0xff000000 & pix[yi] ) pix[yi] = (0xff000000 & pix[yi]) | (dv[rsum] << 16) | (dv[gsum] << 8) | dv[bsum]; rsum -= routsum; gsum -= goutsum; bsum -= boutsum; stackstart = stackpointer - radius + div; sir = stack[stackstart % div]; routsum -= sir[0]; goutsum -= sir[1]; boutsum -= sir[2]; if (x == 0) { vmin[y] = Math.min(y + r1, hm) * w; } p = x + vmin[y]; sir[0] = r[p]; sir[1] = g[p]; sir[2] = b[p]; rinsum += sir[0]; ginsum += sir[1]; binsum += sir[2]; rsum += rinsum; gsum += ginsum; bsum += binsum; stackpointer = (stackpointer + 1) % div; sir = stack[stackpointer]; routsum += sir[0]; goutsum += sir[1]; boutsum += sir[2]; rinsum -= sir[0]; ginsum -= sir[1]; binsum -= sir[2]; yi += w; } } bitmap.setPixels(pix, 0, w, 0, 0, w, h); return (bitmap); } }
[ "chengyu@evercare.com.cn" ]
chengyu@evercare.com.cn
55ebaae225d796767a87dfaa47e3a9bf64e4331d
a4805da270caa833f7251c83913c23eab7dd8389
/src/com/poke/cyberion/poi/ParticlesRunnable.java
7844c3f095f7e25ce6cc8783750b84c884cf12ee
[ "Apache-2.0" ]
permissive
Poke-le-Pompe/CyberionPOI
d0a55be0c8c79b54bd359e1396c315cb6a5df934
3c1cb5e2e759749bca9bf208fda1886551a5ed62
refs/heads/main
2023-07-27T05:52:56.230973
2021-09-12T18:01:12
2021-09-12T18:01:12
331,450,219
0
0
null
null
null
null
UTF-8
Java
false
false
775
java
package com.poke.cyberion.poi; import org.bukkit.Location; import org.bukkit.Particle; import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitRunnable; import com.poke.cyberion.poi.objects.POI; public class ParticlesRunnable extends BukkitRunnable { @Override public void run() { CyberionPlugin plugin = CyberionPlugin.getInstance(); for (POI poi : plugin.getListPOI()) { for (Player player : plugin.getServer().getOnlinePlayers()) { if(!plugin.getVisitedList().playerAlreadyVisited(player, poi)) { Location loc = new Location(poi.getLoc().getWorld(), poi.getLoc().getX()+0.5, poi.getLoc().getY()+0.5, poi.getLoc().getZ()+0.5); player.spawnParticle(Particle.VILLAGER_HAPPY, loc, 3, 0.5, 0.5, 0.5); } } } } }
[ "jerem.bronner@gmail.com" ]
jerem.bronner@gmail.com
fa6a0f6b5bff1679f1e4d72f21425552de311da4
8520182247679590cdace9bb14fbec23cbeb78fa
/aCis_gameserver/java/net/sf/l2j/gameserver/handler/usercommandhandlers/Escape.java
b12a6bbff858b9b47abcb4286ac2ad67be050a50
[]
no_license
nick1pas/server
4fd08cf63a95be2c6524bcf02dfce1a7df3e7aa7
03555db6ff8a5504c7a9496a1af499b39b7f21cf
refs/heads/master
2023-06-06T07:16:04.133302
2017-07-24T20:39:49
2017-07-24T20:39:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,633
java
package net.sf.l2j.gameserver.handler.usercommandhandlers; import net.sf.l2j.gameserver.datatables.SkillTable; import net.sf.l2j.gameserver.handler.IUserCommandHandler; import net.sf.l2j.gameserver.instancemanager.ZoneManager; import net.sf.l2j.gameserver.model.actor.instance.Player; import net.sf.l2j.gameserver.model.zone.type.L2BossZone; import net.sf.l2j.gameserver.network.SystemMessageId; import net.sf.l2j.gameserver.scripting.quests.audio.Sound; public class Escape implements IUserCommandHandler { private static final int[] COMMAND_IDS = { 52 }; @Override public boolean useUserCommand(int id, Player activeChar) { if (activeChar.isCastingNow() || activeChar.isSitting() || activeChar.isMovementDisabled() || activeChar.isOutOfControl() || activeChar.isInOlympiadMode() || activeChar.isInObserverMode() || activeChar.isFestivalParticipant() || activeChar.isInJail() || ZoneManager.getInstance().getZone(activeChar, L2BossZone.class) != null || activeChar.isInFunEvent()) { activeChar.sendPacket(SystemMessageId.NO_UNSTUCK_PLEASE_SEND_PETITION); return false; } activeChar.stopMove(null); // Official timer 5 minutes, for GM 1 second if (activeChar.isGM()) activeChar.doCast(SkillTable.getInstance().getInfo(2100, 1)); else { activeChar.sendPacket(Sound.SYSTEM_MSG_809.getPacket()); activeChar.sendPacket(SystemMessageId.STUCK_TRANSPORT_IN_FIVE_MINUTES); activeChar.doCast(SkillTable.getInstance().getInfo(2099, 1)); } return true; } @Override public int[] getUserCommandList() { return COMMAND_IDS; } }
[ "danilohityz12@gmail.com" ]
danilohityz12@gmail.com
ae13aac79d261ebb5d1fb034b4d5eb374d773730
8ccfcb5a0fb1a5a8cad435a27f746b34f45269c7
/src/dino/Service.java
57b3b497c0df6d92781c7d34d0e04de150af1843
[]
no_license
XoLMeS/dino-runner
56347c692a675de0ef087bee44b8162ff68b29d4
77b51ae1de55b21db647bc9611435b8df454a0f2
refs/heads/master
2021-01-20T18:58:09.539828
2016-06-24T08:44:15
2016-06-24T08:44:15
60,417,155
0
0
null
null
null
null
UTF-8
Java
false
false
4,930
java
package dino; import java.io.IOException; import java.util.ArrayList; import java.util.List; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.google.appengine.api.datastore.DatastoreService; import com.google.appengine.api.datastore.DatastoreServiceFactory; import com.google.appengine.api.datastore.Entity; import com.google.appengine.api.datastore.FetchOptions; import com.google.appengine.api.datastore.Key; import com.google.appengine.api.datastore.PreparedQuery; import com.google.appengine.api.datastore.Query; import com.google.appengine.api.datastore.Query.SortDirection; import com.google.appengine.api.datastore.QueryResultList; import com.google.appengine.repackaged.com.google.gson.Gson; public class Service extends HttpServlet { private static DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); @Override public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { resp.setContentType("application/json"); resp.setCharacterEncoding("UTF-8"); List<Entity> list = new ArrayList<>(); String user_name = req.getParameter("user_name"); String user_link = req.getParameter("user_link"); String capacity = req.getParameter("capacity"); if ((user_name != null) && (user_link != null) && capacity.equals("")) { Entity user = lookForColisionsInDatabase(user_name, user_link); if (user != null) { list.add(user); } } else if ((capacity != null) && !capacity.equals("")) { list = getUsers(Integer.valueOf(capacity)); } String json = new Gson().toJson(list); if (list.size() == 0) { resp.getWriter().write(new Gson().toJson(null)); } else { resp.getWriter().write(json); } } @Override public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException { resp.setContentType("application/json"); resp.setCharacterEncoding("UTF-8"); String method = req.getParameter("method"); String user_name = req.getParameter("user_name"); String user_link = req.getParameter("user_link"); String shadow = req.getParameter("shadow"); String coins = req.getParameter("coins"); String score = req.getParameter("score"); if (((user_name != null) && (user_link != null)) && !user_name.equals("") && !user_link.equals("")) { switch (method) { case "saveNewUser": Entity user = lookForColisionsInDatabase(user_name, user_link); if (user == null) { saveNewUser(user_name, user_link); } break; case "update": Entity user2 = lookForColisionsInDatabase(user_name, user_link); if (user2 != null) { if (!shadow.equals("")) { user2.setProperty("Shadow", shadow); } if (!coins.equals("")) { user2.setProperty("Coins", coins); } if (!score.equals("")) { user2.setProperty("Highscore", score); } datastore.put(user2); } break; default: break; } } } public Entity lookForColisionsInDatabase(String nickname, String link) { Query q = new Query("User"); q.addSort("Highscore", SortDirection.DESCENDING); PreparedQuery pq = datastore.prepare(q); FetchOptions fetchOptions = FetchOptions.Builder.withDefaults(); QueryResultList<Entity> results = pq.asQueryResultList(fetchOptions); int size = results.size(); for (int i = 0; i < size; i++) { if (((results.get(i).getProperty("Name") != null) && results.get(i).getProperty("Name").equals(nickname)) && ((results.get(i).getProperty("Link") != null) && results.get(i).getProperty("Link").equals(link))) return results.get(i); } return null; } private List<Entity> getUsers(int cap) { Query q = new Query("User"); q.addSort("Highscore", SortDirection.DESCENDING); PreparedQuery pq = datastore.prepare(q); FetchOptions fetchOptions = FetchOptions.Builder.withLimit(cap); QueryResultList<Entity> results = pq.asQueryResultList(fetchOptions); return results; } private boolean saveNewUser(String user_name, String user_link) { Key key = datastore.put(new User(user_name, user_link).getUserEntity()); if ((key != null) || !key.equals("")) return true; return false; } }
[ "andrew.panassiouk@gmail.com" ]
andrew.panassiouk@gmail.com
2fadc334174f97087e8d91fffcc02cb20771e1ad
0a6c0d9eb66e36fd9bfc8af7ba5724dfd2b28b38
/src/main/java/com/getir/readingisgood/service/ProductService.java
eb1b498f0cccd45adbe36523133e2392da955c23
[]
no_license
MustafAks/reading-is-good
1489d5eaee93d5db2ea84a47d321a5292c134099
9fff9b1fc2a27a405ccc7d4bb6201e67dd29e573
refs/heads/master
2023-04-20T07:03:20.767332
2021-05-09T12:32:14
2021-05-09T12:32:14
365,744,069
0
2
null
null
null
null
UTF-8
Java
false
false
3,091
java
package com.getir.readingisgood.service; import com.getir.readingisgood.entity.Product; import com.getir.readingisgood.exception.ErrorCodeEnum; import com.getir.readingisgood.exception.ReadingIsGoodApiException; import com.getir.readingisgood.model.UpdateProductQuantityRequest; import com.getir.readingisgood.repository.ProductRepository; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.stereotype.Service; import javax.transaction.Transactional; import java.util.Optional; import static net.logstash.logback.argument.StructuredArguments.kv; @Slf4j @Service @RequiredArgsConstructor public class ProductService { private final ProductRepository productRepository; @Transactional public Product createProduct(Product product) { if(product == null){ throw new ReadingIsGoodApiException(ErrorCodeEnum.CONTENT_NOT_FOUND_ERROR); } log.info("******** Incoming ProductCreateRequest Start ********"); log.info("createProduct-start {}", kv("product", product)); log.info("******** Incoming ProductCreateRequest End ********"); return productRepository.save(product); } @Transactional public void updateProductQuantity(UpdateProductQuantityRequest request) { log.info("******** Incoming updateProductQuantity Start ********"); log.info("UpdateProductRequest-start {}", kv("request", request)); log.info("******** Incoming updateProductQuantity End ********"); if (request.getId() != null) { Product dbProduct = this.getProductById(request.getId()); Integer differance = dbProduct.getQuantity() - request.getQuantity(); if (differance > 0) { dbProduct.setQuantity(differance); productRepository.save(dbProduct); } else { throw new ReadingIsGoodApiException(ErrorCodeEnum.PRODUCT_NOT_AVAIBLE); } } else { throw new ReadingIsGoodApiException(ErrorCodeEnum.PRODUCT_ID_MUST_NOT_BLANK); } } public Product getProductById(Long id) { log.info("******** Incoming getProductById Start ********"); Optional<Product> dbProductEntity = productRepository.findById(id); if (dbProductEntity.isPresent()) { log.info("******** Incoming getCustomerById End ********"); return dbProductEntity.get(); } else { throw new ReadingIsGoodApiException(ErrorCodeEnum.PRODUCT_NOT_FOUND); } } public Page<Product> getAllProducts(int pageIndex, int pageSize) { log.info("******** Incoming getAllProducts Start ********"); log.info("getAllEvents {} {}", kv("pageIndex", pageIndex), kv("pageSize", pageSize)); Page<Product> response = productRepository.findAll(PageRequest.of(pageIndex, pageSize)); log.info("******** Incoming getAllProducts End ********"); return response; } }
[ "mustafaaksu9079@gmail.com" ]
mustafaaksu9079@gmail.com
66fbeaf6a6723a615ebfdc05235b168195c211a1
ef279c3d67f22aef932c1771089eae1ca3ceb145
/app/src/main/java/com/udindev/ngaos/ui/auth/base/LoginRegisterViewModelFactory.java
42fcc373bb104c475e1dfb3ba2d47b354cd78b29
[]
no_license
nngarfdn/Ngaos
78a9e87a24c06f9c3bfe3ac0d1d9734354a44142
39ee8c0ac067a355f5570ec5bb8f8fdc9cc1c656
refs/heads/master
2023-06-09T03:22:27.988510
2021-06-28T03:39:10
2021-06-28T03:39:10
350,191,442
0
0
null
null
null
null
UTF-8
Java
false
false
607
java
package com.udindev.ngaos.ui.auth.base; import android.app.Application; import androidx.lifecycle.ViewModel; import androidx.lifecycle.ViewModelProvider; import com.udindev.ngaos.ui.auth.main.viewmodel.LoginRegisterViewModel; public class LoginRegisterViewModelFactory implements ViewModelProvider.Factory { private Application mApplication; public LoginRegisterViewModelFactory(Application application) { mApplication = application; } @Override public <T extends ViewModel> T create(Class<T> modelClass) { return (T) new LoginRegisterViewModel(mApplication); } }
[ "33192900+nngarfdn@users.noreply.github.com" ]
33192900+nngarfdn@users.noreply.github.com
ee419197f5e44d52a9ad86b46a10a3e93bc7592b
74242b9b6794d57ec19cdf295e1be3c94b5e14ee
/main/java/com/cbj/almacen/repository/InventarioDao.java
5185377475ade4cf3e4c0251c91023f944f002d4
[]
no_license
RichichiDomotics/src
d5e1f18026a9cfe1460b7e04f5c0930aa722a4ca
0a022e5933f0d5b9a46cf015df798ee3888b0628
refs/heads/master
2021-01-21T22:34:33.509161
2017-09-01T22:55:58
2017-09-01T22:55:58
102,158,813
0
0
null
null
null
null
UTF-8
Java
false
false
1,331
java
package com.cbj.almacen.repository; import com.cbj.almacen.domain.Inventario; import com.cbj.almacen.domain.Inventarioview; import java.util.List; /** * Created by RICHARD on 17/05/2014. */ public interface InventarioDao { public boolean insertInventario(Inventario inventario); public boolean updateInventario(Inventario inventario); public boolean deleteInventario(int id); public Inventario findInventario(int id); List<Inventario> findInventarioSalidas(String consecutivo, String idCliente, String descripcion, String caducidad); List<Inventarioview> findInventarioReporte(String consecutivo, String camara, String idCliente, String claveProducto, String tunel); List<Integer> findInventarioReporteRD(String consecutivo, String camara, String idCliente, String claveProducto, String tunel); public Inventario findByClienteConsecutivo(String idCliente, int consecutivo); public Inventario findByClienteFolioSalida(String idCliente, int folioSalida); public List<Inventario> findByConsecutivo(int consecutivo); public List<Inventario> getArrastreSaldosInventarioAgrupado(final int consecutivo); public List<Object[]> getSaldoXCamara(); public List<Object[]> getSaldoXTunel(); public List<Object[]> getSaldoXCliente(); public List<Object[]> getTodasCamaras(); }
[ "larryconther@gmail.com" ]
larryconther@gmail.com
627b321a7357e284dab7e338fa0f5444bcdfef0f
0126ae96524147f5fff7032b02364cf07008edf8
/DatabaseInterface.java
493d54e83a94f7af57076063f503a690f364408d
[]
no_license
msmir066/PasswordDatabase_PasswordCracker
083c75a7effc65807cf7217176184ccefff54ff9
39887b4dcba1469f8a0f7ddb58a6fcb97e6ce62c
refs/heads/master
2020-04-27T03:35:33.831755
2019-03-05T22:16:43
2019-03-05T22:16:43
174,028,796
0
0
null
null
null
null
UTF-8
Java
false
false
801
java
// CSI2110/CSI2510 Assignment#4 2018 // Lucia Moura, Robert Laganiere // This interface is to be used, and not be changed public interface DatabaseInterface { public String save(String plainPassword, String encryptedPassword); // Stores plainPassword and corresponding encryptedPassword in a map. // if there was a value associated with this key, it is replaced, // and previous value returned; otherwise, null is returned // The key is the encryptedPassword the value is the plainPassword public String decrypt(String encryptedPassword); // returns plain password corresponding to encrypted password public int size(); // returns the number of password pairs stored in the database public void printStatistics(); // print statistics based on type of Database }
[ "noreply@github.com" ]
noreply@github.com
0476d9cb433db794b8cbe74849dc979ad0fcb6ef
321c6e15678579d160034b2256d58e55bf87405f
/bootcampjpa/src/test/java/com/everis/bootcamp/bootcampjpa/BootcampjpaApplicationTests.java
f4a1b2106e27b8f5c6a249c57da1176d120284d7
[]
no_license
claimis/bootcampjpa
85dc00353804b577a212416eca2c0f7cb877cd7c
f7f4266ee5d22c92ffb49ed9b40cc66bb3f4f01e
refs/heads/master
2020-05-17T22:45:58.165009
2019-04-29T06:55:33
2019-04-29T06:55:33
184,012,476
0
0
null
null
null
null
UTF-8
Java
false
false
353
java
package com.everis.bootcamp.bootcampjpa; 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 BootcampjpaApplicationTests { @Test public void contextLoads() { } }
[ "" ]
900856462992182ce078813736f40b4d1b6411e9
72ffa8b5633ccbd8f811db2caafa013d370f5bca
/IO/src/com/cx/FileInputOutputStreamTest.java
502bf660f3df4bb35d7c6464c40243feeef7e8ef
[]
no_license
Javachenxu/JavaStudy
bd83e91d82e21138c8c0b763b4d46a182f16b512
73fb08b291154d053996882fc7a33c03cd36491a
refs/heads/master
2023-01-14T02:52:13.048116
2020-11-16T15:47:28
2020-11-16T15:47:28
305,748,220
0
0
null
null
null
null
UTF-8
Java
false
false
1,674
java
package com.cx; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import org.junit.Test; public class FileInputOutputStreamTest { //字节流不能准确的传输文本文件。 @Test public void testFileInputStream() { //造文件 //造流 FileInputStream fis = null; try { File file = new File("hello.txt"); fis = new FileInputStream(file); byte[] buffer = new byte[5]; int len; while ((len = fis.read(buffer)) != -1) { String str = new String(buffer, 0, len); System.out.print(str); } } catch (Exception e) { e.printStackTrace(); }finally { //关闭资源 if(fis != null) try { fis.close(); } catch (Exception e) { e.printStackTrace(); } } } //字节流复制非文本文件 @Test public void testFileInputOutputStream() { FileInputStream fis = null; FileOutputStream fos = null; try { File srcFile = new File("fate.jpg"); //命令大小写不敏感 File destFile = new File("fate2.jpg"); fis = new FileInputStream(srcFile); fos = new FileOutputStream(destFile); byte[] buffer = new byte[1024]; int len; while ((len = fis.read(buffer)) != -1) { fos.write(buffer,0,len); } System.out.println("复制成功"); } catch (Exception e) { e.printStackTrace(); } finally { try { if (fis != null) fis.close(); } catch (Exception e) { e.printStackTrace(); } try { if (fos != null) fos.close(); } catch (Exception e) { e.printStackTrace(); } } } }
[ "chenxu135790@outlook.com" ]
chenxu135790@outlook.com
d143c5d1252173e3064290ad37769850547af60a
9ade79c7c3a21aa4705d243810c5d3917ac47349
/j2ee/hq100/push/ios/IOSBroadcast.java
cce05fe861cfa3f367d56b876433bb15d6c8e3c2
[]
no_license
lgcwn/J2EE_Util
b43cf60e87c5fc26cd0fa4abe0252403db350433
4ee682db1cca724ac902ed80606d477cb5a37245
refs/heads/master
2021-01-21T10:09:31.260433
2017-09-07T08:03:32
2017-09-07T08:03:32
91,682,150
1
0
null
null
null
null
UTF-8
Java
false
false
349
java
package com.up72.hq.push.ios; import com.up72.hq.push.IOSNotification; public class IOSBroadcast extends IOSNotification { public IOSBroadcast(String appkey,String appMasterSecret) throws Exception { setAppMasterSecret(appMasterSecret); setPredefinedKeyValue("appkey", appkey); this.setPredefinedKeyValue("type", "broadcast"); } }
[ "435164706@qq.com" ]
435164706@qq.com
89e5dd32e96f6fb6afad111f6ef13a555508a5f9
c27feed32773297dfb447489bb05e71e3d543e31
/91Money_Core/src/main/java/com/qfedu/core/constant/GlobalConst.java
45a67aa1ee972db118bece58b60b9c517bba26d8
[]
no_license
osanaii/PaymentItem
ee01084590dedd4d1987404b26d9cd1de846f45d
6bdfea8a16de79ffce7e8b31afb7a45f732d860b
refs/heads/master
2022-12-23T18:40:13.734953
2019-07-02T07:02:06
2019-07-02T07:02:06
187,156,893
0
0
null
2022-12-16T00:42:12
2019-05-17T06:10:41
HTML
UTF-8
Java
false
false
122
java
package com.qfedu.core.constant; /** *@Author feri *@Date Created in 2018/7/27 16:18 */ public class GlobalConst { }
[ "yszhao1@amarsoft.com" ]
yszhao1@amarsoft.com
283fe0ccaf73422d3460759297a3eea6b85a225a
0dccef976f19741f67479f32f15d76c1e90e7f94
/CustomItems$1.java
78da63c16f8502dfa16310b02ea8d544c89aac97
[]
no_license
Tominous/LabyMod-1.9
a960959d67817b1300272d67bd942cd383dfd668
33e441754a0030d619358fc20ca545df98d55f71
refs/heads/master
2020-05-24T21:35:00.931507
2017-02-06T21:04:08
2017-02-06T21:04:08
187,478,724
1
0
null
2019-05-19T13:14:46
2019-05-19T13:14:46
null
UTF-8
Java
false
false
565
java
import java.util.Comparator; final class CustomItems$1 implements Comparator { public int compare(Object o1, Object o2) { CustomItemProperties cip1 = (CustomItemProperties)o1; CustomItemProperties cip2 = (CustomItemProperties)o2; if (cip1.layer != cip2.layer) { return cip1.layer - cip2.layer; } if (cip1.weight != cip2.weight) { return cip2.weight - cip1.weight; } if (!cip1.basePath.equals(cip2.basePath)) { return cip1.basePath.compareTo(cip2.basePath); } return cip1.name.compareTo(cip2.name); } }
[ "admin@timo.de.vc" ]
admin@timo.de.vc
6576c6276c357d5f928a723c669898ef20c7bbda
b4a66765f1a1c52e19da94bfb16125cfd0a83b88
/src/com/actitime/generic/GetPropertyValues.java
d8c8c377f82bbeb188bda10b41dd48439294d48f
[]
no_license
smkamble/Automation
5b2f7ac4c615f9792597809e2806d89a4186a29a
3848719692addae4bbba531efaba14213cfed080
refs/heads/master
2020-04-22T10:15:59.018831
2018-09-07T14:56:18
2018-09-07T14:56:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
567
java
package com.actitime.generic; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.util.Properties; /** * * @author Nishi * */ public class GetPropertyValues { static String filePath=".\\config.properties"; /** * @description getValue * @param key * @return */ public static String getValue(String key){ Properties prop=new Properties(); try { prop.load(new FileInputStream(new File(filePath))); } catch (IOException e) { e.printStackTrace(); } String value=prop.getProperty(key); return value; } }
[ "nishimittaldec12@gmail.com" ]
nishimittaldec12@gmail.com
b123cec7929441d0f16485d1fdaeb75167ae4cb8
8ae46126fb253ed98434f734353b1c7e2f856e08
/odm/gensrc_openclinica/org/cdisk/odm/jaxb/TransactionType.java
ffbc0cd923d9e0ae31e8012dda4a90ad1c74fa0b
[]
no_license
FreekDB/trait_odm_to_i2b2
ea803a3285085b61884b571d813aee03b594bee0
242ccdd1f32008f30cd4eaf2767ff58db3ac4834
refs/heads/master
2020-04-05T18:32:20.781548
2014-08-25T12:13:38
2014-08-25T12:13:38
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,767
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2014.05.06 at 02:44:20 PM CEST // package org.cdisk.odm.jaxb; import javax.xml.bind.annotation.XmlEnum; import javax.xml.bind.annotation.XmlEnumValue; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for TransactionType. * * <p>The following schema fragment specifies the expected content contained within this class. * <p> * <pre> * &lt;simpleType name="TransactionType"> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string"> * &lt;enumeration value="Insert"/> * &lt;enumeration value="Update"/> * &lt;enumeration value="Remove"/> * &lt;enumeration value="Upsert"/> * &lt;enumeration value="Context"/> * &lt;/restriction> * &lt;/simpleType> * </pre> * */ @XmlType(name = "TransactionType") @XmlEnum public enum TransactionType { @XmlEnumValue("Insert") INSERT("Insert"), @XmlEnumValue("Update") UPDATE("Update"), @XmlEnumValue("Remove") REMOVE("Remove"), @XmlEnumValue("Upsert") UPSERT("Upsert"), @XmlEnumValue("Context") CONTEXT("Context"); private final String value; TransactionType(String v) { value = v; } public String value() { return value; } public static TransactionType fromValue(String v) { for (TransactionType c: TransactionType.values()) { if (c.value.equals(v)) { return c; } } throw new IllegalArgumentException(v); } }
[ "wardblonde@hotmail.com" ]
wardblonde@hotmail.com
669c41afe2d5c57434354c2220a0d7c4a6f8bd8c
f19705d7647682646cfce24d824d9df171943715
/src/main/java/me/noci/oitc/mapmanager/MapManager.java
1ed0c73e0a36e7903f9a35b23794ba4ab0a270e8
[]
no_license
xNoci/OneInTheChamber
141848024ba12ea3a2bfd07e38c0bbe0a166380f
5e5473bdb66ebaf3061bdb227a187927b905f02f
refs/heads/master
2023-04-20T03:32:07.802308
2021-05-08T08:09:15
2021-05-08T08:09:15
346,377,891
0
0
null
null
null
null
UTF-8
Java
false
false
3,539
java
package me.noci.oitc.mapmanager; import com.google.common.collect.Lists; import com.google.common.collect.Sets; import me.noci.oitc.mapmanager.loader.MapLoader; import me.noci.oitc.mapmanager.loader.file.FileMapLoader; import me.noci.oitc.utils.FileUtils; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.scheduler.BukkitRunnable; import java.io.File; import java.nio.file.Path; import java.util.*; import java.util.function.BiConsumer; public class MapManager { private final JavaPlugin plugin; private final Set<Map> loadedMaps = Sets.newHashSet(); private final File mapWorldFolder; private final MapLoader mapLoader; public static Map createNewMap() { return new Map(); } public MapManager(JavaPlugin plugin) { this.plugin = plugin; this.mapLoader = new FileMapLoader(plugin); this.mapWorldFolder = new File(plugin.getConfig().getString("mapWorldFolder", plugin.getServer().getWorldContainer().getPath())); if (!this.mapWorldFolder.exists()) { this.mapWorldFolder.mkdirs(); } loadMaps(); } private boolean existsMap(String name) { return loadedMaps.stream().map(map -> map.get(MapData.MAP_NAME, String.class)).anyMatch(mapName -> mapName.equalsIgnoreCase(name)); } private boolean copyWorldToFolder(Map toCopy) { Path worldSrc = new File(plugin.getServer().getWorldContainer(), toCopy.get(MapData.WORLD_NAME, String.class)).toPath(); Path worldDest = new File(mapWorldFolder, toCopy.get(MapData.WORLD_NAME, String.class)).toPath(); return FileUtils.copyDir(worldSrc, worldDest); } private void loadMaps() { loadedMaps.addAll(mapLoader.loadMaps()); } public void saveMap(Map map, BiConsumer<Boolean, String> savedSuccessful) { new BukkitRunnable() { @Override public void run() { String mapName = map.get(MapData.MAP_NAME, String.class); if (existsMap(mapName)) { savedSuccessful.accept(false, String.format("Eine Map mit dem Namen %s existiert bereits.", mapName)); return; } if (!mapLoader.saveMap(map)) { savedSuccessful.accept(false, "Ein Fehler beim Speichern der Map ist aufgetreten."); return; } if (!copyWorldToFolder(map)) { savedSuccessful.accept(false, "Ein Fehler beim Kopieren der Welt ist aufgetreten."); return; } loadedMaps.add(map); savedSuccessful.accept(true, ""); } }.runTaskAsynchronously(plugin); } public Map getRandomMap() { List<Map> maps = Lists.newArrayList(loadedMaps); if (maps.size() == 0) return null; Collections.shuffle(maps); return maps.get(0); } public Iterator<String> getLoadedMapNames() { return loadedMaps.stream().map(map -> map.get(MapData.MAP_NAME, String.class)).iterator(); } public Optional<Map> getMap(String mapName) { return loadedMaps.stream().filter(map -> map.get(MapData.MAP_NAME, String.class).equalsIgnoreCase(mapName)).findFirst(); } public void copyWorldToServer(String worldName) { Path src = new File(mapWorldFolder, worldName).toPath(); Path dest = new File(plugin.getServer().getWorldContainer(), worldName).toPath(); FileUtils.copyDir(src, dest); } }
[ "nocigit@gmail.com" ]
nocigit@gmail.com
2fdf015eed9b98b5872f66175cd99319cb19dd10
a7d2f13cd1cab38628e7dde7f75a1d6ca2e4149f
/src/main/java/com/cas/controller/SocietyController.java
33251110150c6c109b853124112c2ac0e591c504
[]
no_license
nmkyuppie/webservice-springboot
f4894ba7a9ea835cffaf53423c57bc9ec9f16626
66c91f646b4a74fe043d18da6884a44b65fd6528
refs/heads/master
2023-08-07T18:36:32.005355
2020-05-10T15:49:03
2020-05-10T15:49:03
206,764,882
1
0
null
2023-07-22T15:30:33
2019-09-06T09:53:28
Java
UTF-8
Java
false
false
6,540
java
package com.cas.controller; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.servlet.http.HttpSession; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.transaction.annotation.Isolation; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import org.springframework.ui.ModelMap; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.SessionAttributes; import org.springframework.web.servlet.ModelAndView; import com.cas.business.entity.Block; import com.cas.business.entity.Circle; import com.cas.business.entity.District; import com.cas.business.entity.Society; import com.cas.business.repository.BlockRepository; import com.cas.business.repository.CircleRepository; import com.cas.business.repository.DistrictRepository; import com.cas.business.repository.SocietyRepository; import com.cas.business.service.SocietyService; import com.cas.utils.Utils.Menu; import lombok.extern.slf4j.Slf4j; @Controller @Slf4j @SessionAttributes({"userDetails","societyInfo"}) public class SocietyController { @Autowired SocietyService societyService; @Autowired SocietyRepository societyRepository; @Autowired DistrictRepository districtRepository; @Autowired CircleRepository circleRepository; @Autowired BlockRepository blockRepository; /** * Needs to fulfill the expectation of session attributes * @return */ @ModelAttribute("societyInfo") public Society setUpSociety() { return null; } @GetMapping("/society/list") public ModelAndView getBranchPage() { Map<String, Object> model = new HashMap<>(); List<Society> societyList = societyService.findAll(); model.put("societyList", societyList); return new ModelAndView("society", model); } @GetMapping("/society/add") public ModelAndView getAddBranchPage(@ModelAttribute("society") Society society, BindingResult result, ModelMap model) { model = setUpData(model); return new ModelAndView("addsociety", model); } @PostMapping("/society/edit") public ModelAndView getEditBranchPage(@ModelAttribute("societyId") String societyId, BindingResult result, ModelMap model) { Society society = societyService.findById(Integer.parseInt(societyId)); model.addAttribute("society", society); model = setUpData(model); return new ModelAndView("addsociety", model); } @PostMapping(value="/society/add") @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.READ_UNCOMMITTED) public String saveBranch(@ModelAttribute("society") Society society, BindingResult result, ModelMap model) { model = setUpData(model); societyService.save(society); model.addAttribute("message", "Society has been saved successfully."); return "addsociety"; } @GetMapping(value="/society/basicDetails") @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.READ_UNCOMMITTED) public ModelAndView getBasicDetailsPage(@ModelAttribute("societyId") String societyId) { return new ModelAndView("basicDetails"); } @GetMapping("/society/info") public ModelAndView getSocietyPage(@ModelAttribute("regno") String registrationNumber, @ModelAttribute("societyInfo") Society society, BindingResult result, ModelMap model, HttpSession session) { society = societyRepository.findByRegistrationNumber(registrationNumber); model = setUpData(model); model.put(Menu.SOCIETY_DETAILS_M.toString(), "active"); model.put("pageName", "societyinfo"); model.put("disabled", "true"); model.put("method", "GET"); model.put("action", "/society/edit"); model.put("buttonIcon", "fa fa-pencil"); model.put("buttonText", "Edit"); model.put("areaCoverage", society.getAreaCoverage()); model.put("societyInfo", society); log.info("kirti"+society); session.setAttribute("societyInfo", society); return new ModelAndView("basicdetails", model); } @GetMapping("/society/edit") public ModelAndView getSocietyPage1(@ModelAttribute("societyInfo") Society society, BindingResult result, ModelMap model, HttpSession session) { society = (Society) session.getAttribute("societyInfo"); model = setUpData(model); model.put(Menu.SOCIETY_DETAILS_M.toString(), "active"); model.put("pageName", "societyinfo"); model.put("disabled", "false"); model.put("method", "POST"); model.put("action", "/society/save"); model.put("buttonIcon", "fa fa-floppy-o"); model.put("buttonText", "Save"); model.put("areaCoverage", society.getAreaCoverage()); return new ModelAndView("basicdetails", model); } @PostMapping(value="/society/save") @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.READ_UNCOMMITTED) public ModelAndView saveSocietyBasicDetails(@ModelAttribute("society") Society society, BindingResult result, ModelMap model, HttpSession session) { model = setUpData(model); societyService.save(society); model.addAttribute("message", "Society has been saved successfully."); model = setUpData(model); model.put(Menu.SOCIETY_DETAILS_M.toString(), "active"); model.put("pageName", "societyinfo"); model.put("disabled", "true"); model.put("method", "GET"); model.put("action", "/society/edit"); model.put("buttonIcon", "fa fa-pencil"); model.put("buttonText", "Edit"); model.put("areaCoverage", society.getAreaCoverage()); model.put("societyInfo", society); log.info("kirti"+society); session.setAttribute("societyInfo", society); return new ModelAndView("basicdetails", model); } private ModelMap setUpData(ModelMap model) { List<District> districtList = districtRepository.findAll(); List<Circle> circleList = new ArrayList<>(); if(!districtList.isEmpty()) { circleList = circleRepository.findByDistrictId(districtList.get(0).getId()); } List<Block> blockList = new ArrayList<>(); if(!circleList.isEmpty()) { blockList = blockRepository.findByCircleId(districtList.get(0).getId()); } model.put("districtList", districtList); model.put("circleList", circleList); model.put("blockList", blockList); return model; } }
[ "nmkyuppie@gmail.com" ]
nmkyuppie@gmail.com
0a5442832fecf72853422672012598087499f8f5
05dc27508c6e29d6d51836cc4b5ff27573e51aa4
/demo/src/main/java/usach/cl/demo/Model/Idea.java
7a7a8f265d667ddff31466228f2f186b7714985f
[]
no_license
bsantanar/DemoFingeso
ef51cb19262e1807a7c481595559cb4feca846b6
5a245ca06be3ce68c2f69c663b31bd05841fae55
refs/heads/master
2021-10-11T12:56:12.503698
2019-01-25T22:11:17
2019-01-25T22:11:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,138
java
package usach.cl.demo.Model; import org.bson.types.ObjectId; import org.springframework.data.annotation.Id; import org.springframework.data.mongodb.core.mapping.Document; import java.util.Date; @Document(value = "idea") public class Idea { @Id private ObjectId id; private String contenido; private int likes; private Date fecha; public Idea() { } public Idea(String contenido, Date date) { this.contenido = contenido; this.fecha = new Date(); this.likes = 0; } public String getId() { return id.toHexString(); } public void setId(ObjectId id) { this.id = id; } public String getContenido() { return contenido; } public void setContenido(String contenido) { this.contenido = contenido; } public Date getDate() { return fecha; } public void setDate(Date date) { this.fecha = date; } public int getLikes() { return likes; } public void setLikes(int likes) { this.likes = likes; } }
[ "bastian.santana@usach.cl" ]
bastian.santana@usach.cl
cedd27fdc24c35a7b832b17c530e86e32a762710
7e6c3cda3c3007d6c6a8e0a21cc4cd034edc1331
/soa1/PA165/eshop-ws/src/main/java/cz/fi/muni/pa165/ws/app/WebServiceConfig.java
e018bc3e93e05c8ca0916f4ca55f8e95b71418bc
[]
no_license
RacekM/PA165-REST
a1c6ec3f167679157d78c663c6fb0f42044c3ab7
6af90a7e47024ee06a37c0b011ab87f76d5136a6
refs/heads/master
2020-04-05T21:32:23.978490
2018-12-03T12:38:28
2018-12-03T12:38:28
157,223,894
0
0
null
null
null
null
UTF-8
Java
false
false
3,945
java
package cz.fi.muni.pa165.ws.app; import java.util.List; import org.springframework.boot.context.embedded.ServletRegistrationBean; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.core.io.ClassPathResource; import org.springframework.ws.config.annotation.EnableWs; import org.springframework.ws.config.annotation.WsConfigurerAdapter; import org.springframework.ws.server.EndpointInterceptor; import org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor; import org.springframework.ws.transport.http.MessageDispatcherServlet; import org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition; import org.springframework.xml.xsd.SimpleXsdSchema; import org.springframework.xml.xsd.XsdSchema; /** * Our configuration class note @EnableWs for the usage of Spring-WS * http://docs.spring.io/spring-ws/docs/current/api/org/springframework/ws/config/annotation/EnableWs.html */ @EnableWs @Configuration @ComponentScan("cz.fi.muni.pa165.ws") public class WebServiceConfig extends WsConfigurerAdapter { /** * Creation of the MessageDispatcherServlet, note that it is different from * a DispatcherServlet see * http://docs.spring.io/spring-ws/site/reference/html/server.html in * particular if you need to use it in a standard DispatcherServlet (section * 5.3.2) * * @param applicationContext * @return */ @Bean public ServletRegistrationBean dispatcherServlet(ApplicationContext applicationContext) { final MessageDispatcherServlet servlet = new MessageDispatcherServlet(); servlet.setApplicationContext(applicationContext); servlet.setTransformWsdlLocations(true); return new ServletRegistrationBean(servlet, "/*"); } /** * * WSDL definition from the provided schema (in our case products) when the * application is run you can find the WSDL file at * http://localhost:8080/spring-ws-seminar/products.wsdl * * See * http://docs.spring.io/spring-ws/docs/current/reference/html/server.html * */ @Bean(name = "products") public DefaultWsdl11Definition productsWsdl11Definition(XsdSchema productsSchema) { DefaultWsdl11Definition wsdl11Definition = new DefaultWsdl11Definition(); wsdl11Definition.setPortTypeName("productsPort"); wsdl11Definition.setLocationUri("/"); wsdl11Definition.setTargetNamespace("http://muni.fi.cz/pa165/ws/entities/products"); wsdl11Definition.setSchema(productsSchema); return wsdl11Definition; } /** * Setting the schema for the products see * http://docs.spring.io/spring-ws/site/spring-xml/apidocs/org/springframework/xml/xsd/SimpleXsdSchema.html * */ @Bean public XsdSchema productsSchema() { return new SimpleXsdSchema(new ClassPathResource("products.xsd")); } /** * adding the payload interceptor * * @param interceptors */ @Override public void addInterceptors(List<EndpointInterceptor> interceptors) { interceptors.add(this.myPayLoadInterceptor()); } /** * We are setting here a payload interceptor to validate both requests and * responses See * http://docs.spring.io/spring-ws/site/apidocs/org/springframework/ws/soap/server/endpoint/interceptor/PayloadValidatingInterceptor.html * * @return */ @Bean public PayloadValidatingInterceptor myPayLoadInterceptor() { final PayloadValidatingInterceptor interceptor = new PayloadValidatingInterceptor(); interceptor.setXsdSchema(this.productsSchema()); interceptor.setValidateRequest(true); interceptor.setValidateResponse(true); return interceptor; } }
[ "445411@mail.muni.cz" ]
445411@mail.muni.cz
b7fe6c0039fa6699ae074adfd6a6719cefc6c7f4
83b568d13480cccbe561d0d730d7a878f6079e6a
/Remove Element.java
56104f90659c33499814753c7c0adfeaa72b95c7
[]
no_license
AngelQian/LeetcodeUpdates
618913636c7cc22edd0b4a3c52e3bd0cf59d8354
5bb6fbcd02ef81ca2783ee82e80fef2132c52b1b
refs/heads/master
2021-01-21T04:54:23.683962
2016-06-02T18:58:36
2016-06-02T18:58:36
24,541,993
0
0
null
null
null
null
UTF-8
Java
false
false
223
java
public class Solution { public int removeElement(int[] A, int elem) { int i=0,j=0; for(;j<A.length;j++) { if(A[j]!=elem) A[i++]=A[j]; } return i; } }
[ "qian222@126.com" ]
qian222@126.com
fb573624e20d11e285235a997d515393b771d4bc
0493ffe947dad031c7b19145523eb39209e8059a
/OpenJdk8uTest/src/test/java/beans/EventHandler/Test6788531.java
8f0ada638624ca863fb2acef8ae6f99eabb72f01
[]
no_license
thelinh95/Open_Jdk8u_Test
7612f1b63b5001d1df85c1df0d70627b123de80f
4df362a71e680dbd7dfbb28c8922e8f20373757a
refs/heads/master
2021-01-16T19:27:30.506632
2017-08-13T23:26:05
2017-08-13T23:26:05
100,169,775
0
1
null
null
null
null
UTF-8
Java
false
false
2,273
java
package test.java.beans.EventHandler; /* * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6788531 * @summary Tests public method lookup problem in EventHandler * @author Sergey Malenkov */ import javax.swing.JButton; import java.awt.event.ActionListener; import java.beans.EventHandler; public class Test6788531 { public static void main(String[] args) throws Exception { JButton button = new JButton("hi"); button.addActionListener(EventHandler.create(ActionListener.class, new Private(), "run")); button.addActionListener(EventHandler.create(ActionListener.class, new PrivateGeneric(), "run", "actionCommand")); button.doClick(); } public static class Public { public void run() { throw new Error("method is overridden"); } } static class Private extends Public { public void run() { System.out.println("default"); } } public static class PublicGeneric<T> { public void run(T object) { throw new Error("method is overridden"); } } static class PrivateGeneric extends PublicGeneric<String> { public void run(String string) { System.out.println(string); } } }
[ "truongthelinh95@gmail.com" ]
truongthelinh95@gmail.com
b6a533cc7291957114a861bb94ce88084f153909
3971647758f1c1da196eb1dc1c730a0c7216d18b
/src/main/java/com/proelkady/app/ws/service/UserService.java
f28696ca71e4e34cab8a02c2e9381bdf899eb774
[]
no_license
proelkady/spring-boot-mobile-ws
eeccf20d883e126d09a6c58d4dbc5b0454ce34ef
63bdc237d3f539285020b1c1334d92eb9ebd085a
refs/heads/master
2020-06-19T05:01:40.779369
2019-07-18T19:57:45
2019-07-18T19:57:45
196,572,539
0
0
null
null
null
null
UTF-8
Java
false
false
663
java
package com.proelkady.app.ws.service; import java.util.List; import org.springframework.security.core.userdetails.UserDetailsService; import com.proelkady.app.ws.shared.UserDto; public interface UserService extends UserDetailsService { UserDto createUser(UserDto user); UserDto loadUserByEmail(String email); UserDto findUserById(String userId); UserDto updateUser(String userId, UserDto userDto); void deleteUser(String userId); List<UserDto> getUsers(int page, int limit); boolean verifyEmailToken(String token); boolean requestPasswordReset(String email); boolean resetPassword(String token, String password); }
[ "pro.elkady@gmail.com" ]
pro.elkady@gmail.com
3509f219b614b2f56e415ac6dd4af601d2f02f40
66d06f261f215e9acec4913589f78adf76ae14f5
/src/nameGenerator/HumanMaleClassicalFantasyNameGenerator.java
80a4d0014564f038f1e97d353bee6f3d14e16bef
[]
no_license
benoitberoule/RPGtoolbox
30db0b44a9570ee5e948999420bbe82d002baa49
856f426db35b7b5c973b04f2ceea3735e94569f0
refs/heads/master
2021-01-10T14:11:46.437976
2016-02-12T15:13:12
2016-02-12T15:13:12
36,196,245
2
0
null
2015-08-12T14:03:25
2015-05-24T22:09:54
Java
UTF-8
Java
false
false
1,432
java
/*This class generate classical fantasy names for human (or medieval names) * The names are simply randomly chosen in a list * */ package nameGenerator; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; public class HumanMaleClassicalFantasyNameGenerator extends NameGenerator{ /*Attributes*/ FileInputStream ipsName; InputStreamReader ipsrName; BufferedReader brName; int part1Name; /*Methods*/ public HumanMaleClassicalFantasyNameGenerator() { try { ipsName = new FileInputStream("./NameGenerator/Human/classicalFantasyHuman"); ipsrName = new InputStreamReader(ipsName); } catch (FileNotFoundException e) { e.printStackTrace(); } } /*Return a randomly generate human name*/ @Override public String generate() throws IOException { String name = ""; /*select the name*/ int rand = (int) (Math.random()*part1Name); for(int i = 0 ; i < rand ; ++i) { brName.readLine(); } name = brName.readLine(); ipsName.getChannel().position(0); return name; } @Override public void initiate() throws IOException { brName = new BufferedReader(ipsrName); part1Name = 0; while ( brName.readLine() != null) { part1Name++; } ipsName.getChannel().position(0); } @Override public void close() throws IOException { brName.close(); } }
[ "benoit.beroule@gmail.com" ]
benoit.beroule@gmail.com
437bb7c6e911f86f315bd84727875f4ed9433dfd
471e6dc0d258b88a1e5e4a6322b8b6da86d2374b
/iWeb2/src/iweb2/ch2/webcrawler/transport/http/HTTPUtils.java
548b348d054cefc096491139da4c87e3ebe39904
[]
no_license
hanzg2014/IT_BOOKS
c77e08a5b7b92a39c3f29e88e11a79372a711089
233343d58156ddb6966899621fb96bd5785af24d
refs/heads/master
2021-07-09T14:14:59.221110
2017-10-06T12:26:17
2017-10-06T12:26:17
83,967,488
2
2
null
null
null
null
UTF-8
Java
false
false
3,774
java
package iweb2.ch2.webcrawler.transport.http; class HTTPUtils { /** * Extracts MIME type. Ideally the value should be extracted from HTTP header. * But if it is missing an attempt can be made to determine content type * based on URL and/or data. * * @param contentTypeHeaderValue * @param url document URL. * @param data document content * * @return MIME type for document content or null if couldn't determine the type. */ public static String getContentType(String contentTypeHeaderValue, String url, byte[] data) { String type = null; if( contentTypeHeaderValue != null && contentTypeHeaderValue.trim().length() > 0) { int i = contentTypeHeaderValue.indexOf(";"); if( i > -1 ) { type = contentTypeHeaderValue.substring(0, i); } else { type = contentTypeHeaderValue.substring(0); } } if( type == null ) { /* here url and content itself can be used to determine content type. */ } return type; } /** * Extracts charset from HTTP header. If HTTP header is missing an attempt can be * made to determine charset based on content type and data. * * For example, documents with type 'text/html' can define document charset using 'meta' tag. * Such documents should use characters compatible with ISO-8859-1 charset until the meta tag * that defines document charset. For more details see: * http://www.w3.org/TR/html4/charset.html#h-5.2.2 * * @param contentTypeHeaderValue * @param contentType type of data. Can be used to interpret the data. * @param data * @return charset or null. */ public static String getCharset(String contentTypeHeaderValue, String contentType, byte[] data) { String charset = getCharset(contentTypeHeaderValue); if( charset == null || charset.trim().length() == 0 ) { /* here we can implement charset detection based on content analysis. */ } return charset; } private static String getCharset(String contentTypeHeaderValue) { String charset = null; String ATTR_NAME = "charset="; if( contentTypeHeaderValue != null ) { int i = contentTypeHeaderValue.toLowerCase().indexOf(ATTR_NAME); if( i > -1 ) { charset = contentTypeHeaderValue. substring(i + ATTR_NAME.length()).toUpperCase(); } } return charset; } /** * Decodes content according to content encoding. This is just a place holder. * * @param contentEncoding content type. * @param encodedContent content received from the server * @return decoded content. */ public static byte[] decodeContent(String contentEncoding, byte[] encodedContent) throws HTTPTransportException { byte[] decodedContent = null; if( "gzip".equalsIgnoreCase(contentEncoding) ) { throw new HTTPTransportException("Content-Encoding 'gzip' is not supported."); } else if( "deflate".equalsIgnoreCase(contentEncoding) ) { throw new HTTPTransportException("Content-Encoding 'deflate' is not supported."); } else if( "compress".equalsIgnoreCase(contentEncoding)) { throw new HTTPTransportException("Content-Encoding 'compress' is not supported."); } else { decodedContent = encodedContent; } return decodedContent; } }
[ "hanzg@hanzgs-MacBook-Pro.local" ]
hanzg@hanzgs-MacBook-Pro.local
6e0faffe3ec611a2af48be119e3810c8a2cc47d0
eb8dfaf02f67e470d2e74d6822b224e99607b47e
/DiceGameJDBC/src/main/java/itAcademyExercise/diceGame/domain/Games.java
c0d669b20f4d1ca77c47020418a1ed068f339da1
[]
no_license
Alitunja27/diceGameJDBC
3c73118a1b9adc329bf903a7a067a1696024f826
0cf2f075164f33aa9b12273fc676a380ab3fed9b
refs/heads/master
2020-11-24T21:50:29.619429
2019-12-16T09:55:55
2019-12-16T09:55:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,462
java
package itAcademyExercise.diceGame.domain; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.ManyToOne; @Entity public class Games { @Id private Integer id; //private List<Integer> diceList = new ArrayList<>(); private Integer dice1,dice2; private String gameResult; @ManyToOne private Player player; public Games() { } public Games(Integer id, Integer dice1, Integer dice2, String gameResult, Integer playerId){ super(); this.id = id; this.dice1=dice1; this.dice2=dice2; this.gameResult=gameResult; this.player=new Player(playerId,"",null,""); } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public Integer getDice1() { return dice1; } public void setDice1(Integer dice1) { this.dice1 = dice1; } public Integer getDice2() { return dice2; } public void setDice2(Integer dice2) { this.dice2 = dice2; } public String getGameResult() { return gameResult; } public void setGameResult(String gameResult) { this.gameResult = gameResult; } public Player getPlayer() { return player; } public void setPlayer(Player player) { this.player = player; } }
[ "alitunja27@gmail.com" ]
alitunja27@gmail.com
803769bcb77746c7654f85f983c535861407b256
2ecfff7e324699dec15a4322490f4fd0b332de75
/Java/springProjects/language/src/main/java/com/mjk/language/services/LanguageService.java
c0cdd8c4aaac85da512b1b2408221c3bdb054837
[]
no_license
sunset375/CodingDojo
ff4cb51a0452b5835d8d55fb62c5b1a76dd08b32
a41a0bdeae89b09774be3dedf241489e96fd82c9
refs/heads/master
2023-06-26T20:02:18.895586
2021-07-26T15:56:37
2021-07-26T15:56:37
359,514,067
0
0
null
null
null
null
UTF-8
Java
false
false
870
java
package com.mjk.language.services; import java.util.List; import org.springframework.stereotype.Service; import com.mjk.language.models.Language; import com.mjk.language.repositories.LanguageRepository; @Service public class LanguageService { private final LanguageRepository languageRepo; public LanguageService(LanguageRepository languageRepo) { this.languageRepo = languageRepo; } public List<Language> allLanguage() { return languageRepo.findAll(); } public Language createLanguage(Language language) { return languageRepo.save(language); } public Language getOneLanguage(Long id) { return this.languageRepo.findById(id).orElse(null); } public Language updateLanguage(Language language) { return this.languageRepo.save(language); } public void deleteLanguage(Long id) { this.languageRepo.deleteById(id); } }
[ "myungjaekim92@gmail.com" ]
myungjaekim92@gmail.com
18fc606e26dae3d86fa0e9498193aedba08e6d07
927ef0edf67e716a0e26ff0902d080ef7cfda898
/maven/WindnTrees0.0.1/application/src/main/java/app/configuration/ThymeleafConfigurator.java
2d980359e5e3073aa4498f62539bc5968d2b0027
[ "Apache-2.0" ]
permissive
shamszia/windntrees.support
ffd1b3995c983b6e3504ec40ec726c039ae4ffb5
755dae0bffaa8cebc98a6d14707cbeede66bc91c
refs/heads/master
2022-12-22T16:27:04.039669
2022-11-21T11:16:23
2022-11-21T11:16:23
163,095,844
1
1
Apache-2.0
2022-12-16T12:12:05
2018-12-25T16:05:35
JavaScript
UTF-8
Java
false
false
3,236
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 app.configuration; import nz.net.ultraq.thymeleaf.LayoutDialect; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.PropertySource; import org.thymeleaf.spring4.SpringTemplateEngine; import org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver; import org.thymeleaf.spring4.view.ThymeleafViewResolver; import org.thymeleaf.templatemode.TemplateMode; /** * * @author shams */ @Configuration @PropertySource("classpath:application.properties") public class ThymeleafConfigurator implements ApplicationContextAware { protected ApplicationContext mAppContext = null; @Override public void setApplicationContext(ApplicationContext ac) throws BeansException { mAppContext = ac; } @Bean public SpringResourceTemplateResolver templateResolver(){ // SpringResourceTemplateResolver automatically integrates with Spring's own // resource resolution infrastructure, which is highly recommended. SpringResourceTemplateResolver templateResolver = new SpringResourceTemplateResolver(); templateResolver.setApplicationContext(this.mAppContext); templateResolver.setPrefix("/WEB-INF/views/"); templateResolver.setSuffix(".html"); // HTML is the default value, added here for the sake of clarity. templateResolver.setTemplateMode(TemplateMode.HTML); // Template cache is true by default. Set to false if you want // templates to be automatically updated when modified. templateResolver.setCacheable(true); return templateResolver; } @Bean public SpringTemplateEngine templateEngine(){ // SpringTemplateEngine automatically applies SpringStandardDialect and // enables Spring's own MessageSource message resolution mechanisms. SpringTemplateEngine templateEngine = new SpringTemplateEngine(); templateEngine.setTemplateResolver(templateResolver()); // Enabling the SpringEL compiler with Spring 4.2.4 or newer can // speed up execution in most scenarios, but might be incompatible // with specific cases when expressions in one template are reused // across different data types, so this flag is "false" by default // for safer backwards compatibility. templateEngine.setEnableSpringELCompiler(true); templateEngine.addDialect(new LayoutDialect()); return templateEngine; } @Bean public ThymeleafViewResolver viewResolver(){ ThymeleafViewResolver viewResolver = new ThymeleafViewResolver(); viewResolver.setTemplateEngine(templateEngine()); viewResolver.setCharacterEncoding("UTF-8"); viewResolver.setOrder(2); return viewResolver; } }
[ "shams@invincibletec.com" ]
shams@invincibletec.com
8589dd42d6c4105fcf8609d6f44e9222d0f56ca5
8e3b2929dd9f23454b4c908750e850007edb7fac
/API/src/org/inventivetalent/packetlistener/metrics/Metrics.java
afb14cd20cb1062a10ee2a0158330ab36fb7d7fb
[]
no_license
yannicklamprecht/PacketListenerAPI
2144dc137ad81f1dddc173d520e0701cbe67d018
d1415c3dbf3831324ef25aa09213fb7a566e46ae
refs/heads/master
2022-03-06T13:47:01.755835
2019-11-02T23:04:59
2019-11-02T23:04:59
98,517,325
1
0
null
2019-11-02T23:05:00
2017-07-27T09:16:03
Java
UTF-8
Java
false
false
28,648
java
package org.inventivetalent.packetlistener.metrics; import org.bukkit.Bukkit; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.plugin.ServicePriority; import org.bukkit.plugin.java.JavaPlugin; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import javax.net.ssl.HttpsURLConnection; import java.io.ByteArrayOutputStream; import java.io.DataOutputStream; import java.io.File; import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.net.URL; import java.util.*; import java.util.logging.Level; import java.util.zip.GZIPOutputStream; /** * bStats collects some data for plugin authors. * * Check out https://bStats.org/ to learn more about bStats! */ public class Metrics { // The version of this bStats class public static final int B_STATS_VERSION = 1; // The url to which the data is sent private static final String URL = "https://bStats.org/submitData"; // Should failed requests be logged? private static boolean logFailedRequests; // The uuid of the server private static String serverUUID; // The plugin private final JavaPlugin plugin; // A list with all custom charts private final List<CustomChart> charts = new ArrayList<>(); /** * Class constructor. * * @param plugin The plugin which stats should be submitted. */ public Metrics(JavaPlugin plugin) { if (plugin == null) { throw new IllegalArgumentException("Plugin cannot be null!"); } this.plugin = plugin; // Get the config file File bStatsFolder = new File(plugin.getDataFolder().getParentFile(), "bStats"); File configFile = new File(bStatsFolder, "config.yml"); YamlConfiguration config = YamlConfiguration.loadConfiguration(configFile); // Check if the config file exists if (!config.isSet("serverUuid")) { // Add default values config.addDefault("enabled", true); // Every server gets it's unique random id. config.addDefault("serverUuid", UUID.randomUUID().toString()); // Should failed request be logged? config.addDefault("logFailedRequests", false); // Inform the server owners about bStats config.options().header( "bStats collects some data for plugin authors like how many servers are using their plugins.\n" + "To honor their work, you should not disable it.\n" + "This has nearly no effect on the server performance!\n" + "Check out https://bStats.org/ to learn more :)" ).copyDefaults(true); try { config.save(configFile); } catch (IOException ignored) { } } // Load the data serverUUID = config.getString("serverUuid"); logFailedRequests = config.getBoolean("logFailedRequests", false); if (config.getBoolean("enabled", true)) { boolean found = false; // Search for all other bStats Metrics classes to see if we are the first one for (Class<?> service : Bukkit.getServicesManager().getKnownServices()) { try { service.getField("B_STATS_VERSION"); // Our identifier :) found = true; // We aren't the first break; } catch (NoSuchFieldException ignored) { } } // Register our service Bukkit.getServicesManager().register(Metrics.class, this, plugin, ServicePriority.Normal); if (!found) { // We are the first! startSubmitting(); } } } /** * Adds a custom chart. * * @param chart The chart to add. */ public void addCustomChart(CustomChart chart) { if (chart == null) { throw new IllegalArgumentException("Chart cannot be null!"); } charts.add(chart); } /** * Starts the Scheduler which submits our data every 30 minutes. */ private void startSubmitting() { final Timer timer = new Timer(true); // We use a timer cause the Bukkit scheduler is affected by server lags timer.scheduleAtFixedRate(new TimerTask() { @Override public void run() { if (!plugin.isEnabled()) { // Plugin was disabled timer.cancel(); return; } // Nevertheless we want our code to run in the Bukkit main thread, so we have to use the Bukkit scheduler // Don't be afraid! The connection to the bStats server is still async, only the stats collection is sync ;) Bukkit.getScheduler().runTask(plugin, new Runnable() { @Override public void run() { submitData(); } }); } }, 1000 * 60 * 5, 1000 * 60 * 30); // Submit the data every 30 minutes, first time after 5 minutes to give other plugins enough time to start // WARNING: Changing the frequency has no effect but your plugin WILL be blocked/deleted! // WARNING: Just don't do it! } /** * Gets the plugin specific data. * This method is called using Reflection. * * @return The plugin specific data. */ public JSONObject getPluginData() { JSONObject data = new JSONObject(); String pluginName = plugin.getDescription().getName(); String pluginVersion = plugin.getDescription().getVersion(); data.put("pluginName", pluginName); // Append the name of the plugin data.put("pluginVersion", pluginVersion); // Append the version of the plugin JSONArray customCharts = new JSONArray(); for (CustomChart customChart : charts) { // Add the data of the custom charts JSONObject chart = customChart.getRequestJsonObject(); if (chart == null) { // If the chart is null, we skip it continue; } customCharts.add(chart); } data.put("customCharts", customCharts); return data; } /** * Gets the server specific data. * * @return The server specific data. */ private JSONObject getServerData() { // Minecraft specific data int playerAmount = Bukkit.getOnlinePlayers().size(); int onlineMode = Bukkit.getOnlineMode() ? 1 : 0; String bukkitVersion = org.bukkit.Bukkit.getVersion(); bukkitVersion = bukkitVersion.substring(bukkitVersion.indexOf("MC: ") + 4, bukkitVersion.length() - 1); // OS/Java specific data String javaVersion = System.getProperty("java.version"); String osName = System.getProperty("os.name"); String osArch = System.getProperty("os.arch"); String osVersion = System.getProperty("os.version"); int coreCount = Runtime.getRuntime().availableProcessors(); JSONObject data = new JSONObject(); data.put("serverUUID", serverUUID); data.put("playerAmount", playerAmount); data.put("onlineMode", onlineMode); data.put("bukkitVersion", bukkitVersion); data.put("javaVersion", javaVersion); data.put("osName", osName); data.put("osArch", osArch); data.put("osVersion", osVersion); data.put("coreCount", coreCount); return data; } /** * Collects the data and sends it afterwards. */ private void submitData() { final JSONObject data = getServerData(); JSONArray pluginData = new JSONArray(); // Search for all other bStats Metrics classes to get their plugin data for (Class<?> service : Bukkit.getServicesManager().getKnownServices()) { try { service.getField("B_STATS_VERSION"); // Our identifier :) } catch (NoSuchFieldException ignored) { continue; // Continue "searching" } // Found one! try { pluginData.add(service.getMethod("getPluginData").invoke(Bukkit.getServicesManager().load(service))); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException ignored) { } } data.put("plugins", pluginData); // Create a new thread for the connection to the bStats server new Thread(new Runnable() { @Override public void run() { try { // Send the data sendData(data); } catch (Exception e) { // Something went wrong! :( if (logFailedRequests) { plugin.getLogger().log(Level.WARNING, "Could not submit plugin stats of " + plugin.getName(), e); } } } }).start(); } /** * Sends the data to the bStats server. * * @param data The data to send. * @throws Exception If the request failed. */ private static void sendData(JSONObject data) throws Exception { if (data == null) { throw new IllegalArgumentException("Data cannot be null!"); } if (Bukkit.isPrimaryThread()) { throw new IllegalAccessException("This method must not be called from the main thread!"); } HttpsURLConnection connection = (HttpsURLConnection) new URL(URL).openConnection(); // Compress the data to save bandwidth byte[] compressedData = compress(data.toString()); // Add headers connection.setRequestMethod("POST"); connection.addRequestProperty("Accept", "application/json"); connection.addRequestProperty("Connection", "close"); connection.addRequestProperty("Content-Encoding", "gzip"); // We gzip our request connection.addRequestProperty("Content-Length", String.valueOf(compressedData.length)); connection.setRequestProperty("Content-Type", "application/json"); // We send our data in JSON format connection.setRequestProperty("User-Agent", "MC-Server/" + B_STATS_VERSION); // Send data connection.setDoOutput(true); DataOutputStream outputStream = new DataOutputStream(connection.getOutputStream()); outputStream.write(compressedData); outputStream.flush(); outputStream.close(); connection.getInputStream().close(); // We don't care about the response - Just send our data :) } /** * Gzips the given String. * * @param str The string to gzip. * @return The gzipped String. * @throws IOException If the compression failed. */ private static byte[] compress(final String str) throws IOException { if (str == null) { return null; } ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); GZIPOutputStream gzip = new GZIPOutputStream(outputStream); gzip.write(str.getBytes("UTF-8")); gzip.close(); return outputStream.toByteArray(); } /** * Represents a custom chart. */ public static abstract class CustomChart { // The id of the chart protected final String chartId; /** * Class constructor. * * @param chartId The id of the chart. */ public CustomChart(String chartId) { if (chartId == null || chartId.isEmpty()) { throw new IllegalArgumentException("ChartId cannot be null or empty!"); } this.chartId = chartId; } protected JSONObject getRequestJsonObject() { JSONObject chart = new JSONObject(); chart.put("chartId", chartId); try { JSONObject data = getChartData(); if (data == null) { // If the data is null we don't send the chart. return null; } chart.put("data", data); } catch (Throwable t) { if (logFailedRequests) { Bukkit.getLogger().log(Level.WARNING, "Failed to get data for custom chart with id " + chartId, t); } return null; } return chart; } protected abstract JSONObject getChartData(); } /** * Represents a custom simple pie. */ public static abstract class SimplePie extends CustomChart { /** * Class constructor. * * @param chartId The id of the chart. */ public SimplePie(String chartId) { super(chartId); } /** * Gets the value of the pie. * * @return The value of the pie. */ public abstract String getValue(); @Override protected JSONObject getChartData() { JSONObject data = new JSONObject(); String value = getValue(); if (value == null || value.isEmpty()) { // Null = skip the chart return null; } data.put("value", value); return data; } } /** * Represents a custom advanced pie. */ public static abstract class AdvancedPie extends CustomChart { /** * Class constructor. * * @param chartId The id of the chart. */ public AdvancedPie(String chartId) { super(chartId); } /** * Gets the values of the pie. * * @param valueMap Just an empty map. The only reason it exists is to make your life easier. You don't have to create a map yourself! * @return The values of the pie. */ public abstract HashMap<String, Integer> getValues(HashMap<String, Integer> valueMap); @Override protected JSONObject getChartData() { JSONObject data = new JSONObject(); JSONObject values = new JSONObject(); HashMap<String, Integer> map = getValues(new HashMap<String, Integer>()); if (map == null || map.isEmpty()) { // Null = skip the chart return null; } boolean allSkipped = true; for (Map.Entry<String, Integer> entry : map.entrySet()) { if (entry.getValue() == 0) { continue; // Skip this invalid } allSkipped = false; values.put(entry.getKey(), entry.getValue()); } if (allSkipped) { // Null = skip the chart return null; } data.put("values", values); return data; } } /** * Represents a custom single line chart. */ public static abstract class SingleLineChart extends CustomChart { /** * Class constructor. * * @param chartId The id of the chart. */ public SingleLineChart(String chartId) { super(chartId); } /** * Gets the value of the chart. * * @return The value of the chart. */ public abstract int getValue(); @Override protected JSONObject getChartData() { JSONObject data = new JSONObject(); int value = getValue(); if (value == 0) { // Null = skip the chart return null; } data.put("value", value); return data; } } /** * Represents a custom multi line chart. */ public static abstract class MultiLineChart extends CustomChart { /** * Class constructor. * * @param chartId The id of the chart. */ public MultiLineChart(String chartId) { super(chartId); } /** * Gets the values of the chart. * * @param valueMap Just an empty map. The only reason it exists is to make your life easier. You don't have to create a map yourself! * @return The values of the chart. */ public abstract HashMap<String, Integer> getValues(HashMap<String, Integer> valueMap); @Override protected JSONObject getChartData() { JSONObject data = new JSONObject(); JSONObject values = new JSONObject(); HashMap<String, Integer> map = getValues(new HashMap<String, Integer>()); if (map == null || map.isEmpty()) { // Null = skip the chart return null; } boolean allSkipped = true; for (Map.Entry<String, Integer> entry : map.entrySet()) { if (entry.getValue() == 0) { continue; // Skip this invalid } allSkipped = false; values.put(entry.getKey(), entry.getValue()); } if (allSkipped) { // Null = skip the chart return null; } data.put("values", values); return data; } } /** * Represents a custom simple bar chart. */ public static abstract class SimpleBarChart extends CustomChart { /** * Class constructor. * * @param chartId The id of the chart. */ public SimpleBarChart(String chartId) { super(chartId); } /** * Gets the value of the chart. * * @param valueMap Just an empty map. The only reason it exists is to make your life easier. You don't have to create a map yourself! * @return The value of the chart. */ public abstract HashMap<String, Integer> getValues(HashMap<String, Integer> valueMap); @Override protected JSONObject getChartData() { JSONObject data = new JSONObject(); JSONObject values = new JSONObject(); HashMap<String, Integer> map = getValues(new HashMap<String, Integer>()); if (map == null || map.isEmpty()) { // Null = skip the chart return null; } for (Map.Entry<String, Integer> entry : map.entrySet()) { JSONArray categoryValues = new JSONArray(); categoryValues.add(entry.getValue()); values.put(entry.getKey(), categoryValues); } data.put("values", values); return data; } } /** * Represents a custom advanced bar chart. */ public static abstract class AdvancedBarChart extends CustomChart { /** * Class constructor. * * @param chartId The id of the chart. */ public AdvancedBarChart(String chartId) { super(chartId); } /** * Gets the value of the chart. * * @param valueMap Just an empty map. The only reason it exists is to make your life easier. You don't have to create a map yourself! * @return The value of the chart. */ public abstract HashMap<String, int[]> getValues(HashMap<String, int[]> valueMap); @Override protected JSONObject getChartData() { JSONObject data = new JSONObject(); JSONObject values = new JSONObject(); HashMap<String, int[]> map = getValues(new HashMap<String, int[]>()); if (map == null || map.isEmpty()) { // Null = skip the chart return null; } boolean allSkipped = true; for (Map.Entry<String, int[]> entry : map.entrySet()) { if (entry.getValue().length == 0) { continue; // Skip this invalid } allSkipped = false; JSONArray categoryValues = new JSONArray(); for (int categoryValue : entry.getValue()) { categoryValues.add(categoryValue); } values.put(entry.getKey(), categoryValues); } if (allSkipped) { // Null = skip the chart return null; } data.put("values", values); return data; } } /** * Represents a custom simple map chart. */ public static abstract class SimpleMapChart extends CustomChart { /** * Class constructor. * * @param chartId The id of the chart. */ public SimpleMapChart(String chartId) { super(chartId); } /** * Gets the value of the chart. * * @return The value of the chart. */ public abstract Country getValue(); @Override protected JSONObject getChartData() { JSONObject data = new JSONObject(); Country value = getValue(); if (value == null) { // Null = skip the chart return null; } data.put("value", value.getCountryIsoTag()); return data; } } /** * Represents a custom advanced map chart. */ public static abstract class AdvancedMapChart extends CustomChart { /** * Class constructor. * * @param chartId The id of the chart. */ public AdvancedMapChart(String chartId) { super(chartId); } /** * Gets the value of the chart. * * @param valueMap Just an empty map. The only reason it exists is to make your life easier. You don't have to create a map yourself! * @return The value of the chart. */ public abstract HashMap<Country, Integer> getValues(HashMap<Country, Integer> valueMap); @Override protected JSONObject getChartData() { JSONObject data = new JSONObject(); JSONObject values = new JSONObject(); HashMap<Country, Integer> map = getValues(new HashMap<Country, Integer>()); if (map == null || map.isEmpty()) { // Null = skip the chart return null; } boolean allSkipped = true; for (Map.Entry<Country, Integer> entry : map.entrySet()) { if (entry.getValue() == 0) { continue; // Skip this invalid } allSkipped = false; values.put(entry.getKey().getCountryIsoTag(), entry.getValue()); } if (allSkipped) { // Null = skip the chart return null; } data.put("values", values); return data; } } /** * A enum which is used for custom maps. */ public enum Country { /** * bStats will use the country of the server. */ AUTO_DETECT("AUTO", "Auto Detected"), ANDORRA("AD", "Andorra"), UNITED_ARAB_EMIRATES("AE", "United Arab Emirates"), AFGHANISTAN("AF", "Afghanistan"), ANTIGUA_AND_BARBUDA("AG", "Antigua and Barbuda"), ANGUILLA("AI", "Anguilla"), ALBANIA("AL", "Albania"), ARMENIA("AM", "Armenia"), NETHERLANDS_ANTILLES("AN", "Netherlands Antilles"), ANGOLA("AO", "Angola"), ANTARCTICA("AQ", "Antarctica"), ARGENTINA("AR", "Argentina"), AMERICAN_SAMOA("AS", "American Samoa"), AUSTRIA("AT", "Austria"), AUSTRALIA("AU", "Australia"), ARUBA("AW", "Aruba"), ÅLAND_ISLANDS("AX", "Åland Islands"), AZERBAIJAN("AZ", "Azerbaijan"), BOSNIA_AND_HERZEGOVINA("BA", "Bosnia and Herzegovina"), BARBADOS("BB", "Barbados"), BANGLADESH("BD", "Bangladesh"), BELGIUM("BE", "Belgium"), BURKINA_FASO("BF", "Burkina Faso"), BULGARIA("BG", "Bulgaria"), BAHRAIN("BH", "Bahrain"), BURUNDI("BI", "Burundi"), BENIN("BJ", "Benin"), SAINT_BARTHÉLEMY("BL", "Saint Barthélemy"), BERMUDA("BM", "Bermuda"), BRUNEI("BN", "Brunei"), BOLIVIA("BO", "Bolivia"), BONAIRE_SINT_EUSTATIUS_AND_SABA("BQ", "Bonaire, Sint Eustatius and Saba"), BRAZIL("BR", "Brazil"), BAHAMAS("BS", "Bahamas"), BHUTAN("BT", "Bhutan"), BOUVET_ISLAND("BV", "Bouvet Island"), BOTSWANA("BW", "Botswana"), BELARUS("BY", "Belarus"), BELIZE("BZ", "Belize"), CANADA("CA", "Canada"), COCOS_ISLANDS("CC", "Cocos Islands"), THE_DEMOCRATIC_REPUBLIC_OF_CONGO("CD", "The Democratic Republic Of Congo"), CENTRAL_AFRICAN_REPUBLIC("CF", "Central African Republic"), CONGO("CG", "Congo"), SWITZERLAND("CH", "Switzerland"), CÔTE_D_IVOIRE("CI", "Côte d'Ivoire"), COOK_ISLANDS("CK", "Cook Islands"), CHILE("CL", "Chile"), CAMEROON("CM", "Cameroon"), CHINA("CN", "China"), COLOMBIA("CO", "Colombia"), COSTA_RICA("CR", "Costa Rica"), CUBA("CU", "Cuba"), CAPE_VERDE("CV", "Cape Verde"), CURAÇAO("CW", "Curaçao"), CHRISTMAS_ISLAND("CX", "Christmas Island"), CYPRUS("CY", "Cyprus"), CZECH_REPUBLIC("CZ", "Czech Republic"), GERMANY("DE", "Germany"), DJIBOUTI("DJ", "Djibouti"), DENMARK("DK", "Denmark"), DOMINICA("DM", "Dominica"), DOMINICAN_REPUBLIC("DO", "Dominican Republic"), ALGERIA("DZ", "Algeria"), ECUADOR("EC", "Ecuador"), ESTONIA("EE", "Estonia"), EGYPT("EG", "Egypt"), WESTERN_SAHARA("EH", "Western Sahara"), ERITREA("ER", "Eritrea"), SPAIN("ES", "Spain"), ETHIOPIA("ET", "Ethiopia"), FINLAND("FI", "Finland"), FIJI("FJ", "Fiji"), FALKLAND_ISLANDS("FK", "Falkland Islands"), MICRONESIA("FM", "Micronesia"), FAROE_ISLANDS("FO", "Faroe Islands"), FRANCE("FR", "France"), GABON("GA", "Gabon"), UNITED_KINGDOM("GB", "United Kingdom"), GRENADA("GD", "Grenada"), GEORGIA("GE", "Georgia"), FRENCH_GUIANA("GF", "French Guiana"), GUERNSEY("GG", "Guernsey"), GHANA("GH", "Ghana"), GIBRALTAR("GI", "Gibraltar"), GREENLAND("GL", "Greenland"), GAMBIA("GM", "Gambia"), GUINEA("GN", "Guinea"), GUADELOUPE("GP", "Guadeloupe"), EQUATORIAL_GUINEA("GQ", "Equatorial Guinea"), GREECE("GR", "Greece"), SOUTH_GEORGIA_AND_THE_SOUTH_SANDWICH_ISLANDS("GS", "South Georgia And The South Sandwich Islands"), GUATEMALA("GT", "Guatemala"), GUAM("GU", "Guam"), GUINEA_BISSAU("GW", "Guinea-Bissau"), GUYANA("GY", "Guyana"), HONG_KONG("HK", "Hong Kong"), HEARD_ISLAND_AND_MCDONALD_ISLANDS("HM", "Heard Island And McDonald Islands"), HONDURAS("HN", "Honduras"), CROATIA("HR", "Croatia"), HAITI("HT", "Haiti"), HUNGARY("HU", "Hungary"), INDONESIA("ID", "Indonesia"), IRELAND("IE", "Ireland"), ISRAEL("IL", "Israel"), ISLE_OF_MAN("IM", "Isle Of Man"), INDIA("IN", "India"), BRITISH_INDIAN_OCEAN_TERRITORY("IO", "British Indian Ocean Territory"), IRAQ("IQ", "Iraq"), IRAN("IR", "Iran"), ICELAND("IS", "Iceland"), ITALY("IT", "Italy"), JERSEY("JE", "Jersey"), JAMAICA("JM", "Jamaica"), JORDAN("JO", "Jordan"), JAPAN("JP", "Japan"), KENYA("KE", "Kenya"), KYRGYZSTAN("KG", "Kyrgyzstan"), CAMBODIA("KH", "Cambodia"), KIRIBATI("KI", "Kiribati"), COMOROS("KM", "Comoros"), SAINT_KITTS_AND_NEVIS("KN", "Saint Kitts And Nevis"), NORTH_KOREA("KP", "North Korea"), SOUTH_KOREA("KR", "South Korea"), KUWAIT("KW", "Kuwait"), CAYMAN_ISLANDS("KY", "Cayman Islands"), KAZAKHSTAN("KZ", "Kazakhstan"), LAOS("LA", "Laos"), LEBANON("LB", "Lebanon"), SAINT_LUCIA("LC", "Saint Lucia"), LIECHTENSTEIN("LI", "Liechtenstein"), SRI_LANKA("LK", "Sri Lanka"), LIBERIA("LR", "Liberia"), LESOTHO("LS", "Lesotho"), LITHUANIA("LT", "Lithuania"), LUXEMBOURG("LU", "Luxembourg"), LATVIA("LV", "Latvia"), LIBYA("LY", "Libya"), MOROCCO("MA", "Morocco"), MONACO("MC", "Monaco"), MOLDOVA("MD", "Moldova"), MONTENEGRO("ME", "Montenegro"), SAINT_MARTIN("MF", "Saint Martin"), MADAGASCAR("MG", "Madagascar"), MARSHALL_ISLANDS("MH", "Marshall Islands"), MACEDONIA("MK", "Macedonia"), MALI("ML", "Mali"), MYANMAR("MM", "Myanmar"), MONGOLIA("MN", "Mongolia"), MACAO("MO", "Macao"), NORTHERN_MARIANA_ISLANDS("MP", "Northern Mariana Islands"), MARTINIQUE("MQ", "Martinique"), MAURITANIA("MR", "Mauritania"), MONTSERRAT("MS", "Montserrat"), MALTA("MT", "Malta"), MAURITIUS("MU", "Mauritius"), MALDIVES("MV", "Maldives"), MALAWI("MW", "Malawi"), MEXICO("MX", "Mexico"), MALAYSIA("MY", "Malaysia"), MOZAMBIQUE("MZ", "Mozambique"), NAMIBIA("NA", "Namibia"), NEW_CALEDONIA("NC", "New Caledonia"), NIGER("NE", "Niger"), NORFOLK_ISLAND("NF", "Norfolk Island"), NIGERIA("NG", "Nigeria"), NICARAGUA("NI", "Nicaragua"), NETHERLANDS("NL", "Netherlands"), NORWAY("NO", "Norway"), NEPAL("NP", "Nepal"), NAURU("NR", "Nauru"), NIUE("NU", "Niue"), NEW_ZEALAND("NZ", "New Zealand"), OMAN("OM", "Oman"), PANAMA("PA", "Panama"), PERU("PE", "Peru"), FRENCH_POLYNESIA("PF", "French Polynesia"), PAPUA_NEW_GUINEA("PG", "Papua New Guinea"), PHILIPPINES("PH", "Philippines"), PAKISTAN("PK", "Pakistan"), POLAND("PL", "Poland"), SAINT_PIERRE_AND_MIQUELON("PM", "Saint Pierre And Miquelon"), PITCAIRN("PN", "Pitcairn"), PUERTO_RICO("PR", "Puerto Rico"), PALESTINE("PS", "Palestine"), PORTUGAL("PT", "Portugal"), PALAU("PW", "Palau"), PARAGUAY("PY", "Paraguay"), QATAR("QA", "Qatar"), REUNION("RE", "Reunion"), ROMANIA("RO", "Romania"), SERBIA("RS", "Serbia"), RUSSIA("RU", "Russia"), RWANDA("RW", "Rwanda"), SAUDI_ARABIA("SA", "Saudi Arabia"), SOLOMON_ISLANDS("SB", "Solomon Islands"), SEYCHELLES("SC", "Seychelles"), SUDAN("SD", "Sudan"), SWEDEN("SE", "Sweden"), SINGAPORE("SG", "Singapore"), SAINT_HELENA("SH", "Saint Helena"), SLOVENIA("SI", "Slovenia"), SVALBARD_AND_JAN_MAYEN("SJ", "Svalbard And Jan Mayen"), SLOVAKIA("SK", "Slovakia"), SIERRA_LEONE("SL", "Sierra Leone"), SAN_MARINO("SM", "San Marino"), SENEGAL("SN", "Senegal"), SOMALIA("SO", "Somalia"), SURINAME("SR", "Suriname"), SOUTH_SUDAN("SS", "South Sudan"), SAO_TOME_AND_PRINCIPE("ST", "Sao Tome And Principe"), EL_SALVADOR("SV", "El Salvador"), SINT_MAARTEN_DUTCH_PART("SX", "Sint Maarten (Dutch part)"), SYRIA("SY", "Syria"), SWAZILAND("SZ", "Swaziland"), TURKS_AND_CAICOS_ISLANDS("TC", "Turks And Caicos Islands"), CHAD("TD", "Chad"), FRENCH_SOUTHERN_TERRITORIES("TF", "French Southern Territories"), TOGO("TG", "Togo"), THAILAND("TH", "Thailand"), TAJIKISTAN("TJ", "Tajikistan"), TOKELAU("TK", "Tokelau"), TIMOR_LESTE("TL", "Timor-Leste"), TURKMENISTAN("TM", "Turkmenistan"), TUNISIA("TN", "Tunisia"), TONGA("TO", "Tonga"), TURKEY("TR", "Turkey"), TRINIDAD_AND_TOBAGO("TT", "Trinidad and Tobago"), TUVALU("TV", "Tuvalu"), TAIWAN("TW", "Taiwan"), TANZANIA("TZ", "Tanzania"), UKRAINE("UA", "Ukraine"), UGANDA("UG", "Uganda"), UNITED_STATES_MINOR_OUTLYING_ISLANDS("UM", "United States Minor Outlying Islands"), UNITED_STATES("US", "United States"), URUGUAY("UY", "Uruguay"), UZBEKISTAN("UZ", "Uzbekistan"), VATICAN("VA", "Vatican"), SAINT_VINCENT_AND_THE_GRENADINES("VC", "Saint Vincent And The Grenadines"), VENEZUELA("VE", "Venezuela"), BRITISH_VIRGIN_ISLANDS("VG", "British Virgin Islands"), U_S__VIRGIN_ISLANDS("VI", "U.S. Virgin Islands"), VIETNAM("VN", "Vietnam"), VANUATU("VU", "Vanuatu"), WALLIS_AND_FUTUNA("WF", "Wallis And Futuna"), SAMOA("WS", "Samoa"), YEMEN("YE", "Yemen"), MAYOTTE("YT", "Mayotte"), SOUTH_AFRICA("ZA", "South Africa"), ZAMBIA("ZM", "Zambia"), ZIMBABWE("ZW", "Zimbabwe"); private String isoTag; private String name; Country(String isoTag, String name) { this.isoTag = isoTag; this.name = name; } /** * Gets the name of the country. * * @return The name of the country. */ public String getCountryName() { return name; } /** * Gets the iso tag of the country. * * @return The iso tag of the country. */ public String getCountryIsoTag() { return isoTag; } /** * Gets a country by it's iso tag. * * @param isoTag The iso tag of the county. * @return The country with the given iso tag or <code>null</code> if unknown. */ public static Country byIsoTag(String isoTag) { for (Country country : Country.values()) { if (country.getCountryIsoTag().equals(isoTag)) { return country; } } return null; } /** * Gets a country by a locale. * * @param locale The locale. * @return The country from the giben locale or <code>null</code> if unknown country or if the locale does not contain a country. */ public static Country byLocale(Locale locale) { return byIsoTag(locale.getCountry()); } } }
[ "inventivetalent@inventivegames.de" ]
inventivetalent@inventivegames.de
8d3da5021a5ec55c17bb1bfcf1677b2d861e98e5
cadcc0ae13f360484e3413db78468700169d1d03
/gui.java
da882181686cabc9545d668cbcbc2e75ac1968f4
[]
no_license
lauiepee/spot-then-sequence
af9b0b6a9bb6c7f53c0d867d9c17f065eddaa846
e4ab2a86ee7c956c014b3db24617b1c595cabc34
refs/heads/master
2020-03-29T08:13:32.688962
2018-12-26T07:55:20
2018-12-26T07:55:20
149,389,539
0
0
null
null
null
null
UTF-8
Java
false
false
22,786
java
import java.awt.EventQueue; import java.awt.Image; import javax.swing.JFrame; import javax.swing.ImageIcon; import javax.swing.JLabel; import javax.swing.JOptionPane; import java.io.IOException; import javax.swing.JButton; import javax.swing.JPanel; import javax.swing.JTextArea; import java.awt.SystemColor; import java.awt.Font; import java.awt.Cursor; import java.util.Calendar; import java.util.Random; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import javax.swing.SwingConstants; import java.awt.Component; import javax.swing.border.BevelBorder; public class gui { private String playername = ""; private String playermatch = ""; private JFrame frmSpotThenSequence; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { gui window = new gui(); window.frmSpotThenSequence.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the application. * @throws IOException */ public gui() throws IOException { initialize(); } /** * Initialize the contents of the frame. * @throws IOException */ private void initialize() throws IOException { playername = JOptionPane.showInputDialog("What is your player name?"); JOptionPane.showMessageDialog(null, "Welcome, " + playername + "!"); frmSpotThenSequence = new JFrame(); frmSpotThenSequence.setLocationByPlatform(true); frmSpotThenSequence.setResizable(false); frmSpotThenSequence.setVisible(true); frmSpotThenSequence.setFont(new Font("Courier New", Font.PLAIN, 12)); frmSpotThenSequence.setForeground(SystemColor.desktop); frmSpotThenSequence.setBackground(SystemColor.desktop); frmSpotThenSequence.setTitle("Spot Then Sequence"); frmSpotThenSequence.setBounds(100, 100, 554, 536); frmSpotThenSequence.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frmSpotThenSequence.getContentPane().setLayout(null); String[] images = {"/a.png", "/b.png", "/c.png", "/d.png", "/e.png", "/f.png", "/g.png", "/h.png", "/i.png", "/j.png", "/k.png", "/l.png", "/m.png"}; Random rand = new Random(); int num = rand.nextInt(images.length-1) + 1; Random rand2 = new Random(); int num2 = rand2.nextInt(images.length-1) + 1; JLabel lblNewLabel_1 = new JLabel(""); lblNewLabel_1.setIcon(new ImageIcon("C:\\Users\\lauri\\Downloads\\rank.png")); lblNewLabel_1.setBounds(398, 35, 39, 53); frmSpotThenSequence.getContentPane().add(lblNewLabel_1); Image img = new ImageIcon(this.getClass().getResource(images[num])).getImage(); JButton btnNewButton = new JButton("New button"); btnNewButton.setBounds(698, 549, 115, 29); frmSpotThenSequence.getContentPane().add(btnNewButton); JPanel panel = new JPanel(); panel.setBackground(SystemColor.activeCaption); panel.setBounds(0, 227, 548, 272); frmSpotThenSequence.getContentPane().add(panel); panel.setLayout(null); JPanel panel_1 = new JPanel(); panel_1.setBounds(15, 16, 518, 242); panel.add(panel_1); panel_1.setLayout(null); JLabel lblNewLabel_2 = new JLabel(""); lblNewLabel_2.setIcon(new ImageIcon(img)); JTextArea textArea = new JTextArea(); textArea.setDisabledTextColor(SystemColor.desktop); textArea.setBackground(SystemColor.menu); textArea.setForeground(SystemColor.desktop); textArea.setFont(new Font("SimSun", Font.PLAIN, 12)); textArea.setEnabled(false); textArea.setEditable(false); textArea.setBounds(295, 83, 243, 128); frmSpotThenSequence.getContentPane().add(textArea); JLabel lblNewLabel = new JLabel(""); lblNewLabel.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent arg0) { Calendar cal = Calendar.getInstance(); textArea.append(playername + " " + cal.getTime()); switch (num){ case 0: playermatch = "TREE"; matching(playermatch, num, num2); break; case 1: playermatch = "BALLOON"; matching(playermatch, num, num2); break; case 2: playermatch = "HAND"; matching(playermatch, num, num2); break; case 3: playermatch = "CANDLE"; matching(playermatch, num, num2); break; case 4: playermatch = "TARGET"; matching(playermatch, num, num2); break; case 5: playermatch = "ICE"; matching(playermatch, num, num2); break; case 6: playermatch = "BOMB"; matching(playermatch, num, num2); break; case 7: playermatch = "LIPS"; matching(playermatch, num, num2); break; case 8: playermatch = "DOLPHIN"; matching(playermatch, num, num2); break; case 9: playermatch = "SHADES"; matching(playermatch, num, num2); break; case 10: playermatch = "BULB"; matching(playermatch, num, num2); break; case 11: playermatch = "YINYANG"; matching(playermatch, num, num2); break; case 12: playermatch = "TARGET"; matching(playermatch, num, num2); break; } } }); lblNewLabel.setBounds(176, 16, 63, 76); panel_1.add(lblNewLabel); // RIGHT JLabel label = new JLabel(""); label.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent arg0) { Calendar cal = Calendar.getInstance(); textArea.append(playername + " " + cal.getTime()); switch (num){ case 0: playermatch = "DOLPHIN"; matching(playermatch, num, num2); break; case 1: playermatch = "SHADES"; matching(playermatch, num, num2); break; case 2: playermatch = "CHEESE"; matching(playermatch, num, num2); break; case 3: playermatch = "TREE"; matching(playermatch, num, num2); break; case 4: playermatch = "ICE"; matching(playermatch, num, num2); break; case 5: playermatch = "YINYANG"; matching(playermatch, num, num2); break; case 6: playermatch = "LIPS"; matching(playermatch, num, num2); break; case 7: playermatch = "BALLOON"; matching(playermatch, num, num2); break; case 8: playermatch = "TARGET"; matching(playermatch, num, num2); break; case 9: playermatch = "CHEESE"; matching(playermatch, num, num2); break; case 10: playermatch = "BOMB"; matching(playermatch, num, num2); break; case 11: playermatch = "BULB"; matching(playermatch, num, num2); break; case 12: playermatch = "HAND"; matching(playermatch, num, num2); break; } } }); label.setBounds(236, 73, 63, 97); panel_1.add(label); // BOTTOM JLabel label_1 = new JLabel(""); label_1.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent arg0) { Calendar cal = Calendar.getInstance(); textArea.append(playername + " " + cal.getTime()); switch (num){ case 0: playermatch = "BULB"; matching(playermatch, num, num2); break; case 1: playermatch = "TREE"; matching(playermatch, num, num2); break; case 2: playermatch = "BOMB"; matching(playermatch, num, num2); break; case 3: playermatch = "TARGET"; matching(playermatch, num, num2); break; case 4: playermatch = "BALLOON"; matching(playermatch, num, num2); break; case 5: playermatch = "CANDLE"; matching(playermatch, num, num2); break; case 6: playermatch = "ICE"; matching(playermatch, num, num2); break; case 7: playermatch = "HAND"; matching(playermatch, num, num2); break; case 8: playermatch = "YINYANG"; matching(playermatch, num, num2); break; case 9: playermatch = "DOLPHIN"; matching(playermatch, num, num2); break; case 10: playermatch = "CANDLE"; matching(playermatch, num, num2); break; case 11: playermatch = "LIPS"; matching(playermatch, num, num2); break; case 12: playermatch = "SHADES"; matching(playermatch, num, num2); break; } } }); label_1.setBounds(176, 124, 57, 76); panel_1.add(label_1); // LEFT JLabel label_2 = new JLabel(""); label_2.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent arg0) { Calendar cal = Calendar.getInstance(); textArea.setText("" + cal.getTime()); switch (num){ case 0: playermatch = "ICE"; JOptionPane.showMessageDialog(null, "ICE"); break; case 1: playermatch = "YINYANG"; JOptionPane.showMessageDialog(null, "YINYANG"); break; case 2: playermatch = "TREE"; JOptionPane.showMessageDialog(null, "TREE"); break; case 3: playermatch = "LIPS"; JOptionPane.showMessageDialog(null, "LIPS"); break; case 4: playermatch = "CHEESE"; JOptionPane.showMessageDialog(null, "CHEESE"); break; case 5: playermatch = "HAND"; JOptionPane.showMessageDialog(null, "HAND"); break; case 6: playermatch = "SHADES"; JOptionPane.showMessageDialog(null, "SHADES"); break; case 7: playermatch = "DOLPHIN"; JOptionPane.showMessageDialog(null, "DOLPHIN"); break; case 8: playermatch = "BOMB"; JOptionPane.showMessageDialog(null, "BOMB"); break; case 9: playermatch = "CANDLE"; JOptionPane.showMessageDialog(null, "CANDLE"); break; case 10: playermatch = "BALLOON"; JOptionPane.showMessageDialog(null, "BALLOON"); break; case 11: playermatch = "CHEESE"; JOptionPane.showMessageDialog(null, "CHEESE"); break; case 12: playermatch = "BULB"; JOptionPane.showMessageDialog(null, "BULB"); break; } } }); label_2.setBounds(119, 73, 63, 81); panel_1.add(label_2); lblNewLabel_2.setBounds(108, 0, 211, 236); panel_1.add(lblNewLabel_2); System.out.println("NUM: " + num); System.out.println("NUM2 (Server): " + num2); JButton btnPass = new JButton("PASS"); btnPass.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null)); btnPass.setBackground(SystemColor.activeCaption); btnPass.setAlignmentX(Component.CENTER_ALIGNMENT); btnPass.setVerticalAlignment(SwingConstants.BOTTOM); btnPass.setHorizontalTextPosition(SwingConstants.CENTER); btnPass.setFont(new Font("Surabanglus", Font.PLAIN, 25)); btnPass.setBounds(370, 97, 115, 40); panel_1.add(btnPass); btnPass.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); JTextArea txtrPlayerName = new JTextArea(); txtrPlayerName.setEditable(false); txtrPlayerName.setLineWrap(true); txtrPlayerName.setText(playername); txtrPlayerName.setFont(new Font("Surabanglus", Font.PLAIN, 20)); txtrPlayerName.setBackground(SystemColor.menu); txtrPlayerName.setBounds(398, 0, 135, 42); frmSpotThenSequence.getContentPane().add(txtrPlayerName); JLabel lblNewLabel_3 = new JLabel("New label"); lblNewLabel_3.setBounds(65, 16, 202, 197); frmSpotThenSequence.getContentPane().add(lblNewLabel_3); Image img_server = new ImageIcon(this.getClass().getResource(images[num2])).getImage(); lblNewLabel_3.setIcon(new ImageIcon(img_server)); JLabel lblNewLabel_4 = new JLabel("New label"); lblNewLabel_4.setIcon(new ImageIcon("C:\\Users\\lauri\\Downloads\\spot-then-sequence-master\\spot-then-sequence-master\\Back_1.png")); lblNewLabel_4.setBounds(40, 16, 202, 195); frmSpotThenSequence.getContentPane().add(lblNewLabel_4); JTextArea txtrRanks = new JTextArea(); txtrRanks.setEditable(false); txtrRanks.setFont(new Font("Surabanglus", Font.BOLD, 35)); txtrRanks.setBackground(SystemColor.control); txtrRanks.setText("RANKS"); txtrRanks.setBounds(435, 19, 98, 69); frmSpotThenSequence.getContentPane().add(txtrRanks); } private void matching(String playermatch, int num, int num2){ if(num2 == 0){ System.out.println("STRING: " + playermatch); switch(num){ case 1: case 2: case 3: if(playermatch == "TREE") JOptionPane.showMessageDialog(null, "CORRECT"); break; case 4: case 5: case 6: if(playermatch == "ICE") JOptionPane.showMessageDialog(null, "CORRECT"); break; case 7: case 8: case 9: if(playermatch == "DOLPHIN") JOptionPane.showMessageDialog(null, "CORRECT"); break; case 10: case 11: case 12: if(playermatch == "BULB") JOptionPane.showMessageDialog(null, "CORRECT"); break; default: JOptionPane.showMessageDialog(null, "THERE IS SUMTHING WRONG"); break; } } else if(num2 == 1){ System.out.println("STRING: " + playermatch); switch(num){ case 0: case 2: case 3: if(playermatch == "TREE") JOptionPane.showMessageDialog(null, "CORRECT"); break; case 4: case 7: case 10: if(playermatch == "BALLOON") JOptionPane.showMessageDialog(null, "CORRECT"); break; case 5: case 8: case 11: if(playermatch == "YINYANG") JOptionPane.showMessageDialog(null, "CORRECT"); break; case 6: case 9: case 12: if(playermatch == "SHADES") JOptionPane.showMessageDialog(null, "CORRECT"); break; default: JOptionPane.showMessageDialog(null, "THERE IS SUMTHING WRONG"); break; } } else if(num2 == 2){ System.out.println("STRING: " + playermatch); switch(num){ case 0: case 1: case 3: if(playermatch == "TREE") JOptionPane.showMessageDialog(null, "CORRECT"); break; case 4: case 9: case 11: if(playermatch == "CHEESE") JOptionPane.showMessageDialog(null, "CORRECT"); break; case 5: case 7: case 12: if(playermatch == "HAND") JOptionPane.showMessageDialog(null, "CORRECT"); break; case 6: case 8: case 10: if(playermatch == "BOMB") JOptionPane.showMessageDialog(null, "CORRECT"); break; default: JOptionPane.showMessageDialog(null, "THERE IS SUMTHING WRONG"); break; } } else if(num2 == 3){ System.out.println("STRING: " + playermatch); switch(num){ case 0: case 1: case 3: if(playermatch == "TREE") JOptionPane.showMessageDialog(null, "CORRECT"); break; case 4: case 8: case 12: if(playermatch == "TARGET") JOptionPane.showMessageDialog(null, "CORRECT"); break; case 5: case 9: case 10: if(playermatch == "CANDLE") JOptionPane.showMessageDialog(null, "CORRECT"); break; case 6: case 7: case 11: if(playermatch == "LIPS") JOptionPane.showMessageDialog(null, "CORRECT"); break; default: JOptionPane.showMessageDialog(null, "THERE IS SUMTHING WRONG"); break; } } else if(num2 == 4){ System.out.println("STRING: " + playermatch); switch(num){ case 0: case 5: case 6: if(playermatch == "ICE") JOptionPane.showMessageDialog(null, "CORRECT"); break; case 1: case 7: case 10: if(playermatch == "BALLOON") JOptionPane.showMessageDialog(null, "CORRECT"); break; case 2: case 9: case 11: if(playermatch == "CHEESE") JOptionPane.showMessageDialog(null, "CORRECT"); break; case 3: case 8: case 12: if(playermatch == "TARGET") JOptionPane.showMessageDialog(null, "CORRECT"); break; default: JOptionPane.showMessageDialog(null, "THERE IS SUMTHING WRONG"); break; } } else if(num2 == 5){ System.out.println("STRING: " + playermatch); switch(num){ case 0: case 4: case 6: if(playermatch == "ICE") JOptionPane.showMessageDialog(null, "CORRECT"); break; case 1: case 8: case 11: if(playermatch == "YINYANG") JOptionPane.showMessageDialog(null, "CORRECT"); break; case 2: case 7: case 12: if(playermatch == "HAND") JOptionPane.showMessageDialog(null, "CORRECT"); break; case 3: case 9: case 10: if(playermatch == "CANDLE") JOptionPane.showMessageDialog(null, "CORRECT"); break; default: JOptionPane.showMessageDialog(null, "THERE IS SUMTHING WRONG"); break; } } else if(num2 == 6){ System.out.println("STRING: " + playermatch); switch(num){ case 0: case 4: case 5: if(playermatch == "ICE") JOptionPane.showMessageDialog(null, "CORRECT"); break; case 2: case 8: case 10: if(playermatch == "BOMB") JOptionPane.showMessageDialog(null, "CORRECT"); break; case 3: case 7: case 11: if(playermatch == "LIPS") JOptionPane.showMessageDialog(null, "CORRECT"); break; case 1: case 9: case 12: if(playermatch == "SHADES") JOptionPane.showMessageDialog(null, "CORRECT"); break; default: JOptionPane.showMessageDialog(null, "THERE IS SUMTHING WRONG"); break; } } else if (num2 == 7){ System.out.println("STRING: " + playermatch); switch(num){ case 3: case 6: case 11: if(playermatch == "LIPS") JOptionPane.showMessageDialog(null, "CORRECT"); break; case 0: case 8: case 9: if(playermatch == "DOLPHIN") JOptionPane.showMessageDialog(null, "CORRECT"); break; case 1: case 4: case 10: if(playermatch == "BALLOON") JOptionPane.showMessageDialog(null, "CORRECT"); break; case 2: case 5: case 12: if(playermatch == "HAND") JOptionPane.showMessageDialog(null, "CORRECT"); break; default: JOptionPane.showMessageDialog(null, "THERE IS SUMTHING WRONG"); break; } } else if(num2 == 8){ System.out.println("STRING: " + playermatch); switch(num){ case 0: case 7: case 9: if(playermatch == "DOLPHIN") JOptionPane.showMessageDialog(null, "CORRECT"); break; case 2: case 6: case 10: if(playermatch == "BOMB") JOptionPane.showMessageDialog(null, "CORRECT"); break; case 3: case 4: case 12 : if(playermatch == "TARGET") JOptionPane.showMessageDialog(null, "CORRECT"); break; case 1: case 5: case 11: if(playermatch == "YINYANG") JOptionPane.showMessageDialog(null, "CORRECT"); break; default: JOptionPane.showMessageDialog(null, "THERE IS SUMTHING WRONG"); break; } } else if(num2 == 9){ System.out.println("STRING: " + playermatch); switch(num){ case 1: case 6: case 12: if(playermatch == "SHADES") JOptionPane.showMessageDialog(null, "CORRECT"); break; case 3: case 5: case 10: if(playermatch == "CANDLE") JOptionPane.showMessageDialog(null, "CORRECT"); break; case 2: case 4: case 11 : if(playermatch == "CHEESE") JOptionPane.showMessageDialog(null, "CORRECT"); break; case 0: case 7: case 8: if(playermatch == "DOLPHIN") JOptionPane.showMessageDialog(null, "CORRECT"); break; default: JOptionPane.showMessageDialog(null, "THERE IS SUMTHING WRONG"); break; } }else if(num2 == 10){ System.out.println("STRING: " + playermatch); switch(num){ case 0: case 10: case 11: if(playermatch == "BULB") JOptionPane.showMessageDialog(null, "CORRECT"); break; case 1: case 4: case 7: if(playermatch == "BALLOON") JOptionPane.showMessageDialog(null, "CORRECT"); break; case 2: case 6: case 8 : if(playermatch == "BOMB") JOptionPane.showMessageDialog(null, "CORRECT"); break; case 3: case 5: case 9: if(playermatch == "CANDLE") JOptionPane.showMessageDialog(null, "CORRECT"); break; default: JOptionPane.showMessageDialog(null, "THERE IS SUMTHING WRONG"); break; } } else if(num2 == 11){ System.out.println("STRING: " + playermatch); switch(num){ case 1: case 5: case 8: if(playermatch == "YINYANG") JOptionPane.showMessageDialog(null, "CORRECT"); break; case 2: case 4: case 9: if(playermatch == "CHEESE") JOptionPane.showMessageDialog(null, "CORRECT"); break; case 0: case 10: case 12 : if(playermatch == "BULB") JOptionPane.showMessageDialog(null, "CORRECT"); break; case 3: case 6: case 7: if(playermatch == "LIPS") JOptionPane.showMessageDialog(null, "CORRECT"); break; default: JOptionPane.showMessageDialog(null, "THERE IS SUMTHING WRONG"); break; } } else if(num2 == 12){ System.out.println("STRING: " + playermatch); switch(num){ case 3: case 4: case 8: if(playermatch == "TARGET") JOptionPane.showMessageDialog(null, "CORRECT"); break; case 0: case 10: case 11: if(playermatch == "BULB") JOptionPane.showMessageDialog(null, "CORRECT"); break; case 2: case 5: case 7 : if(playermatch == "HAND") JOptionPane.showMessageDialog(null, "CORRECT"); break; case 1: case 6: case 9: if(playermatch == "SHADES") JOptionPane.showMessageDialog(null, "CORRECT"); break; default: JOptionPane.showMessageDialog(null, "THERE IS SUMTHING WRONG"); break; } } else{ System.out.println("STRING: " + playermatch); } } }
[ "noreply@github.com" ]
noreply@github.com
0ae9b97503a209383b933e920b3300c03b71940f
de7630d1085cac54291a55d7cf571bdd521c1b06
/MahdaClient/src/ir/rayacell/mahdaclient/param/ShowOnlineMapParam.java
6a74e5579005ff5d26b9ec282887152ac13ecdfd
[]
no_license
sadeghebadi/Test-Keyboard-in-my-first-java-Program
f40aacd3e045605a173d125ac18686a5276e82c9
eba6ad768f6a2d5fc1e062863b811f3d9538db6f
refs/heads/master
2016-09-05T18:43:40.876776
2015-05-13T08:06:50
2015-05-13T08:06:50
35,536,157
0
0
null
null
null
null
UTF-8
Java
false
false
772
java
package ir.rayacell.mahdaclient.param; import ir.rayacell.mahdaclient.manager.NetworkManager; import ir.rayacell.mahdaclient.model.BaseModel; import ir.rayacell.mahdaclient.model.ShowOlineMapResponceModel; import ir.rayacell.mahdaclient.model.StatusResponceModel; public class ShowOnlineMapParam extends BaseParam { public ShowOnlineMapParam(BaseModel model) { super(model.getCommand_id(), model.getPhone_number(), model .getCommand_type()); ShowOlineMapResponceModel mModel = (ShowOlineMapResponceModel) model; mCommand = new String(); mCommand = "*" + mModel.getCommand_id() + "*" + mModel.getCommand_type() + "*" + mModel.getPhone_number() + "*" + mModel.getLatitude() + "*" + mModel.getLongitude() + "*" + mModel.getIPaddress() + "*"; } }
[ "sadegh@example.com" ]
sadegh@example.com
fcc512ab785873610fca14a1fcc61a9117e5dc24
43df0aeaa5664d26eb7f852bcd1092335e2afdb0
/SlidingMenu_library/build/generated/source/r/debug/com/jeremyfeinstein/slidingmenu/lib/R.java
fcbe0a51e5dd9590025acb210c99d4966195e8e2
[ "Apache-2.0" ]
permissive
Jackqgm/BeijingNews
d1e87b178776f80766721f15e40b9c096c472146
0b49c0745e7364a8b2079f241cdc9d6893b0bb09
refs/heads/master
2020-12-24T02:39:14.069715
2020-02-16T15:15:34
2020-02-16T15:17:48
233,406,855
0
0
null
null
null
null
UTF-8
Java
false
false
12,800
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * gradle plugin from the resource data it found. It * should not be modified by hand. */ package com.jeremyfeinstein.slidingmenu.lib; public final class R { public static final class attr { public static int behindOffset = 0x7f040001; public static int behindScrollScale = 0x7f040002; public static int behindWidth = 0x7f040003; public static int coordinatorLayoutStyle = 0x7f040004; public static int fadeDegree = 0x7f040005; public static int fadeEnabled = 0x7f040006; public static int font = 0x7f040007; public static int fontProviderAuthority = 0x7f040008; public static int fontProviderCerts = 0x7f040009; public static int fontProviderFetchStrategy = 0x7f04000a; public static int fontProviderFetchTimeout = 0x7f04000b; public static int fontProviderPackage = 0x7f04000c; public static int fontProviderQuery = 0x7f04000d; public static int fontStyle = 0x7f04000e; public static int fontWeight = 0x7f04000f; public static int keylines = 0x7f040010; public static int layout_anchor = 0x7f040011; public static int layout_anchorGravity = 0x7f040012; public static int layout_behavior = 0x7f040013; public static int layout_dodgeInsetEdges = 0x7f040014; public static int layout_insetEdge = 0x7f040015; public static int layout_keyline = 0x7f040016; public static int mode = 0x7f040017; public static int selectorDrawable = 0x7f040018; public static int selectorEnabled = 0x7f040019; public static int shadowDrawable = 0x7f04001a; public static int shadowWidth = 0x7f04001b; public static int statusBarBackground = 0x7f04001c; public static int touchModeAbove = 0x7f04001d; public static int touchModeBehind = 0x7f04001e; public static int viewAbove = 0x7f04001f; public static int viewBehind = 0x7f040020; } public static final class bool { public static int abc_action_bar_embed_tabs = 0x7f050001; } public static final class color { public static int notification_action_color_filter = 0x7f060001; public static int notification_icon_bg_color = 0x7f060002; public static int notification_material_background_media_default_color = 0x7f060003; public static int primary_text_default_material_dark = 0x7f060004; public static int ripple_material_light = 0x7f060005; public static int secondary_text_default_material_dark = 0x7f060006; public static int secondary_text_default_material_light = 0x7f060007; } public static final class dimen { public static int compat_button_inset_horizontal_material = 0x7f080001; public static int compat_button_inset_vertical_material = 0x7f080002; public static int compat_button_padding_horizontal_material = 0x7f080003; public static int compat_button_padding_vertical_material = 0x7f080004; public static int compat_control_corner_material = 0x7f080005; public static int notification_action_icon_size = 0x7f080006; public static int notification_action_text_size = 0x7f080007; public static int notification_big_circle_margin = 0x7f080008; public static int notification_content_margin_start = 0x7f080009; public static int notification_large_icon_height = 0x7f08000a; public static int notification_large_icon_width = 0x7f08000b; public static int notification_main_column_padding_top = 0x7f08000c; public static int notification_media_narrow_margin = 0x7f08000d; public static int notification_right_icon_size = 0x7f08000e; public static int notification_right_side_padding_top = 0x7f08000f; public static int notification_small_icon_background_padding = 0x7f080010; public static int notification_small_icon_size_as_large = 0x7f080011; public static int notification_subtext_size = 0x7f080012; public static int notification_top_pad = 0x7f080013; public static int notification_top_pad_large_text = 0x7f080014; } public static final class drawable { public static int notification_action_background = 0x7f090001; public static int notification_bg = 0x7f090002; public static int notification_bg_low = 0x7f090003; public static int notification_bg_low_normal = 0x7f090004; public static int notification_bg_low_pressed = 0x7f090005; public static int notification_bg_normal = 0x7f090006; public static int notification_bg_normal_pressed = 0x7f090007; public static int notification_icon_background = 0x7f090008; public static int notification_template_icon_bg = 0x7f090009; public static int notification_template_icon_low_bg = 0x7f09000a; public static int notification_tile_bg = 0x7f09000b; public static int notify_panel_notification_icon_bg = 0x7f09000c; } public static final class id { public static int action0 = 0x7f0c0001; public static int action_container = 0x7f0c0002; public static int action_divider = 0x7f0c0003; public static int action_image = 0x7f0c0004; public static int action_text = 0x7f0c0005; public static int actions = 0x7f0c0006; public static int async = 0x7f0c0007; public static int blocking = 0x7f0c0008; public static int bottom = 0x7f0c0009; public static int cancel_action = 0x7f0c000a; public static int chronometer = 0x7f0c000b; public static int end = 0x7f0c000c; public static int end_padder = 0x7f0c000d; public static int forever = 0x7f0c000e; public static int fullscreen = 0x7f0c000f; public static int icon = 0x7f0c0010; public static int icon_group = 0x7f0c0011; public static int info = 0x7f0c0012; public static int italic = 0x7f0c0013; public static int left = 0x7f0c0014; public static int line1 = 0x7f0c0015; public static int line3 = 0x7f0c0016; public static int margin = 0x7f0c0017; public static int media_actions = 0x7f0c0018; public static int none = 0x7f0c0019; public static int normal = 0x7f0c001a; public static int notification_background = 0x7f0c001b; public static int notification_main_column = 0x7f0c001c; public static int notification_main_column_container = 0x7f0c001d; public static int right = 0x7f0c001e; public static int right_icon = 0x7f0c001f; public static int right_side = 0x7f0c0020; public static int selected_view = 0x7f0c0021; public static int slidingmenumain = 0x7f0c0022; public static int start = 0x7f0c0023; public static int status_bar_latest_event_content = 0x7f0c0024; public static int tag_transition_group = 0x7f0c0025; public static int text = 0x7f0c0026; public static int text2 = 0x7f0c0027; public static int time = 0x7f0c0028; public static int title = 0x7f0c0029; public static int top = 0x7f0c002a; } public static final class integer { public static int cancel_button_image_alpha = 0x7f0d0001; public static int status_bar_notification_info_maxnum = 0x7f0d0002; } public static final class layout { public static int notification_action = 0x7f0f0001; public static int notification_action_tombstone = 0x7f0f0002; public static int notification_media_action = 0x7f0f0003; public static int notification_media_cancel_action = 0x7f0f0004; public static int notification_template_big_media = 0x7f0f0005; public static int notification_template_big_media_custom = 0x7f0f0006; public static int notification_template_big_media_narrow = 0x7f0f0007; public static int notification_template_big_media_narrow_custom = 0x7f0f0008; public static int notification_template_custom_big = 0x7f0f0009; public static int notification_template_icon_group = 0x7f0f000a; public static int notification_template_lines_media = 0x7f0f000b; public static int notification_template_media = 0x7f0f000c; public static int notification_template_media_custom = 0x7f0f000d; public static int notification_template_part_chronometer = 0x7f0f000e; public static int notification_template_part_time = 0x7f0f000f; public static int slidingmenumain = 0x7f0f0010; } public static final class string { public static int status_bar_notification_info_overflow = 0x7f150001; } public static final class style { public static int TextAppearance_Compat_Notification = 0x7f160001; public static int TextAppearance_Compat_Notification_Info = 0x7f160002; public static int TextAppearance_Compat_Notification_Info_Media = 0x7f160003; public static int TextAppearance_Compat_Notification_Line2 = 0x7f160004; public static int TextAppearance_Compat_Notification_Line2_Media = 0x7f160005; public static int TextAppearance_Compat_Notification_Media = 0x7f160006; public static int TextAppearance_Compat_Notification_Time = 0x7f160007; public static int TextAppearance_Compat_Notification_Time_Media = 0x7f160008; public static int TextAppearance_Compat_Notification_Title = 0x7f160009; public static int TextAppearance_Compat_Notification_Title_Media = 0x7f16000a; public static int Widget_Compat_NotificationActionContainer = 0x7f16000b; public static int Widget_Compat_NotificationActionText = 0x7f16000c; public static int Widget_Support_CoordinatorLayout = 0x7f16000d; } public static final class styleable { public static int[] CoordinatorLayout = { 0x7f040010, 0x7f04001c }; public static int CoordinatorLayout_keylines = 0; public static int CoordinatorLayout_statusBarBackground = 1; public static int[] CoordinatorLayout_Layout = { 0x010100b3, 0x7f040011, 0x7f040012, 0x7f040013, 0x7f040014, 0x7f040015, 0x7f040016 }; public static int CoordinatorLayout_Layout_android_layout_gravity = 0; public static int CoordinatorLayout_Layout_layout_anchor = 1; public static int CoordinatorLayout_Layout_layout_anchorGravity = 2; public static int CoordinatorLayout_Layout_layout_behavior = 3; public static int CoordinatorLayout_Layout_layout_dodgeInsetEdges = 4; public static int CoordinatorLayout_Layout_layout_insetEdge = 5; public static int CoordinatorLayout_Layout_layout_keyline = 6; public static int[] FontFamily = { 0x7f040008, 0x7f040009, 0x7f04000a, 0x7f04000b, 0x7f04000c, 0x7f04000d }; public static int FontFamily_fontProviderAuthority = 0; public static int FontFamily_fontProviderCerts = 1; public static int FontFamily_fontProviderFetchStrategy = 2; public static int FontFamily_fontProviderFetchTimeout = 3; public static int FontFamily_fontProviderPackage = 4; public static int FontFamily_fontProviderQuery = 5; public static int[] FontFamilyFont = { 0x01010532, 0x0101053f, 0x01010533, 0x7f040007, 0x7f04000e, 0x7f04000f }; public static int FontFamilyFont_android_font = 0; public static int FontFamilyFont_android_fontStyle = 1; public static int FontFamilyFont_android_fontWeight = 2; public static int FontFamilyFont_font = 3; public static int FontFamilyFont_fontStyle = 4; public static int FontFamilyFont_fontWeight = 5; public static int[] SlidingMenu = { 0x7f040001, 0x7f040002, 0x7f040003, 0x7f040005, 0x7f040006, 0x7f040017, 0x7f040018, 0x7f040019, 0x7f04001a, 0x7f04001b, 0x7f04001d, 0x7f04001e, 0x7f04001f, 0x7f040020 }; public static int SlidingMenu_behindOffset = 0; public static int SlidingMenu_behindScrollScale = 1; public static int SlidingMenu_behindWidth = 2; public static int SlidingMenu_fadeDegree = 3; public static int SlidingMenu_fadeEnabled = 4; public static int SlidingMenu_mode = 5; public static int SlidingMenu_selectorDrawable = 6; public static int SlidingMenu_selectorEnabled = 7; public static int SlidingMenu_shadowDrawable = 8; public static int SlidingMenu_shadowWidth = 9; public static int SlidingMenu_touchModeAbove = 10; public static int SlidingMenu_touchModeBehind = 11; public static int SlidingMenu_viewAbove = 12; public static int SlidingMenu_viewBehind = 13; } }
[ "724645516@qq.com" ]
724645516@qq.com
2c20ea5dad6c967ddad14be05ccc3c803d5e7f3d
3c140e64fb6ad6644ab7cd6792b338e294a25672
/Learning-WebDriver/src/main/java/com/slgerkamp/selenium/chapter09/TestDeletePostUsingPageObject.java
0817ba293f67f094b666c8de729e6fbba23edf7d
[]
no_license
cosmic-cowboy/selenium-webDriver-practical-guide
ffac9a341b19b5fa28bb9f954310fe0f6363f51a
5ec2c34da5cc4fd12311770375e5a3c6dda1d929
refs/heads/master
2021-07-04T12:52:16.349137
2021-05-11T03:21:44
2021-05-11T03:21:44
28,526,131
0
0
null
2021-06-04T00:59:55
2014-12-27T02:00:04
Java
UTF-8
Java
false
false
809
java
package com.slgerkamp.selenium.chapter09; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.support.PageFactory; import com.slgerkamp.selenium.lib.Utils; public class TestDeletePostUsingPageObject { public static void main(String[] args) { WebDriver driver = new FirefoxDriver(); // 管理画面にログイン AdminLoginPage adminLoginPage = PageFactory.initElements(driver, AdminLoginPage.class); adminLoginPage.login( Utils.getProperty("wordpressAdminId"), Utils.getProperty("wordpressAdminPass") ); // 投稿一覧画面に移動して、最新の投稿を削除 AdminAllPostsPage adminAllPostsPage = PageFactory.initElements(driver, AdminAllPostsPage.class); adminAllPostsPage.deleteLatestPost(); } }
[ "slgerkamp@gmail.com" ]
slgerkamp@gmail.com
2545bd93a9fb1712cbb711e28f2c07b9a4bb0136
1816704eaacfdadfdc84806f67d77e2c00bf5453
/InvestigaciónOperaciones/IORNLGeneticPanel$3.java
67e66ab1b28ecc14c27a732893d980969cb04bae
[]
no_license
afre/ProyectoEstructuras
9fe20db4fc752538cbf929bc0563a62e8e184c67
4b3394a6e6b8be69372944c21c3748b95a8ffa04
refs/heads/master
2021-01-15T13:48:44.449744
2015-07-27T14:16:31
2015-07-27T14:16:31
39,709,899
0
0
null
null
null
null
UTF-8
Java
false
false
4,036
java
/* */ import java.awt.event.ActionEvent; /* */ import java.awt.event.ActionListener; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ class IORNLGeneticPanel$3 /* */ implements ActionListener /* */ { /* */ private final IORNLGeneticPanel this$0; /* */ /* 317 */ IORNLGeneticPanel$3(IORNLGeneticPanel this$0) { this.this$0 = this$0; } /* */ /* 319 */ public void actionPerformed(ActionEvent e) { IORNLGeneticPanel.access$2(this.this$0); } /* */ } /* Location: C:\Program Files (x86)\Accelet\IORTutorial\IORTutorial.jar!\IORNLGeneticPanel$3.class * Java compiler version: 2 (46.0) * JD-Core Version: 0.7.1 */
[ "a.frex_b@hotmail.com" ]
a.frex_b@hotmail.com
ef59767bc12f7fa6e5f0b696a72eb2ac223e31eb
cdde57a8f259aafe4b366c8fd1e2875173e07607
/src/main/java/fun/zrbac/entity/Message.java
a9f4a676ff26d1c07e852b687076c29dc09ae9fe
[]
no_license
ZrBac/SpringBootBlog
b980f56c6e72085db975c77fde9266f77a5a97f6
48c1f1e8dc71abddf39f31ce00a82fdbb23aebf3
refs/heads/master
2023-06-24T01:50:26.739560
2020-09-15T05:25:06
2020-09-15T05:25:06
286,968,310
0
0
null
null
null
null
UTF-8
Java
false
false
2,982
java
package fun.zrbac.entity; import java.util.ArrayList; import java.util.Date; import java.util.List; public class Message { private Long id; private String nickname; private String email; private String content; private String avatar; private Date createTime; private Long parentMessageId; private boolean adminMessage; //回复留言 private List<Message> replyMessages = new ArrayList<>(); private Message parentMessage; private String parentNickname; public Message() { } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getNickname() { return nickname; } public void setNickname(String nickname) { this.nickname = nickname; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } public String getAvatar() { return avatar; } public void setAvatar(String avatar) { this.avatar = avatar; } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public Long getParentMessageId() { return parentMessageId; } public void setParentMessageId(Long parentMessageId) { this.parentMessageId = parentMessageId; } public List<Message> getReplyMessages() { return replyMessages; } public void setReplyMessages(List<Message> replyMessages) { this.replyMessages = replyMessages; } public Message getParentMessage() { return parentMessage; } public void setParentMessage(Message parentMessage) { this.parentMessage = parentMessage; } public String getParentNickname() { return parentNickname; } public void setParentNickname(String parentNickname) { this.parentNickname = parentNickname; } public boolean isAdminMessage() { return adminMessage; } public void setAdminMessage(boolean adminMessage) { this.adminMessage = adminMessage; } @Override public String toString() { return "Message{" + "id=" + id + ", nickname='" + nickname + '\'' + ", email='" + email + '\'' + ", content='" + content + '\'' + ", avatar='" + avatar + '\'' + ", createTime=" + createTime + ", parentMessageId=" + parentMessageId + ", adminMessage=" + adminMessage + ", replyMessages=" + replyMessages + ", parentMessage=" + parentMessage + ", parentNickname='" + parentNickname + '\'' + '}'; } }
[ "944052796@qq.com" ]
944052796@qq.com
84fe3e7423bf5f56584bf894ce450076af7aec56
e8f3bd9c24ab3daf8af7e9bddb03bb1d7692523b
/1-springboot-hello-world/springboot-hello-world/src/test/java/com/ravasconcelos/helloworld/HelloWorldApplicationTests.java
342e038ba4f9f8863f722b14a8865d54dafe392f
[ "Apache-2.0" ]
permissive
ravasconcelos/springboot-tutorials
6ad7c4436a98a9d3f774cf9aaad2fb661b105629
58a8d492c0a116f4815f04bd9248e42fadcdf31d
refs/heads/main
2022-12-30T14:49:55.292601
2020-10-05T00:14:53
2020-10-05T00:14:53
301,250,065
0
0
null
null
null
null
UTF-8
Java
false
false
233
java
package com.ravasconcelos.helloworld; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class HelloWorldApplicationTests { @Test void contextLoads() { } }
[ "rodolfo.vasconcelos@ethoca.com" ]
rodolfo.vasconcelos@ethoca.com
56cd8c69e99142f921c5042db8bcaebad683997c
a7b8732003dcb65a7b0fe5e7b52b5c81e1e8e07e
/HelloWorld/src/cn/ucai/day15/dec/ITeacher.java
d7d21e1596671125d5b0df336cf96ad6ca514926
[]
no_license
MyCloudream/JavaTeachingSource
846ba9404cebcfd8617312fdddd71c3d97721c99
89fbb99891496f0cd14bbc10efeaf03e76229d09
refs/heads/master
2021-01-01T05:14:09.957682
2016-05-27T01:49:08
2016-05-27T01:49:08
59,795,264
0
0
null
null
null
null
UTF-8
Java
false
false
89
java
package cn.ucai.day15.dec; public interface ITeacher { public abstract void teach(); }
[ "chenjun_work@163.com" ]
chenjun_work@163.com
3f0fd03b1ed8487ff74deacf4b6c3dee39e23ca8
d6a257929fb07f8ac11f4fcc4090e5820024c244
/app/src/androidTest/java/ezlife/movil/oneparkingapp/ExampleInstrumentedTest.java
45e842264ef594b4ec9cfa4d0f44ee355d46ce4c
[]
no_license
Ezlifers/OneParkingAndroid
39b1e948e5f63e5b8a84eea1109dcb5b4f1782e8
5b13e640e8f0b56cb76999eeef0397ea6dc1f26d
refs/heads/master
2020-06-17T05:51:28.077463
2017-05-06T15:58:12
2017-05-06T15:58:12
68,255,564
0
0
null
null
null
null
UTF-8
Java
false
false
756
java
package ezlife.movil.oneparkingapp; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumentation test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("ezlife.movil.oneparkingapp", appContext.getPackageName()); } }
[ "dario.chamorro.v@gmail.com" ]
dario.chamorro.v@gmail.com
ae349da2e87ce24b3f43211c34a706eb86a11261
edd0fb8a882838cd84c9d5197b22bb2250cbc7b8
/app/src/main/java/sopac/org/pacifictides/TidesDatabase.java
1c9f4414872f3405d8bf0949d6ca59a128a027a1
[]
no_license
sopac/PacificTides
41c5540d6a0ca18b9ae4cdb725c01c201d1515e4
3d36640aad1fcd6a58895d59f3d39aefb6ed3106
refs/heads/master
2021-01-23T04:49:04.435359
2017-02-06T04:51:25
2017-02-06T04:51:25
80,393,434
0
0
null
null
null
null
UTF-8
Java
false
false
482
java
package sopac.org.pacifictides; import android.content.Context; import com.readystatesoftware.sqliteasset.SQLiteAssetHelper; /** * Created by sachin on 1/30/17. */ public class TidesDatabase extends SQLiteAssetHelper { private static final String DATABASE_NAME = "tides.db"; private static final int DATABASE_VERSION = 1; public TidesDatabase(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); setForcedUpgrade(); } }
[ "sachindras@spc.int" ]
sachindras@spc.int
bbd201fedb41340fff751007f58e83941c3e4d3c
7c2dfacfb34393c78d0af73d3109e838a9e2823e
/src/hr/fer/zemris/neurofuzzysystem/expert/input/A.java
d14418dafca1dccedcaf54e13d402d88abfdb229
[]
no_license
KarloKnezevic/NeuroFuzzySystem
bcfb001a4d742a2dafb96b35da559d15d1947fee
40aafedcdc98ce62ef2484ceda026a4d3899aed6
refs/heads/master
2021-01-20T13:38:48.539770
2017-02-23T10:52:36
2017-02-23T10:52:36
82,696,815
2
0
null
null
null
null
UTF-8
Java
false
false
965
java
package hr.fer.zemris.neurofuzzysystem.expert.input; public class A implements IMeasuredData { private double Acc; private double minDomain; private double maxDomain; private double membershipFunctionValue; public A(double minDomain, double maxDomain) { this.minDomain = minDomain; this.maxDomain = maxDomain; } @Override public void pickData(IInput sensor) { // senzor ne mjeri akceleraciju } @Override public double getX() { return Acc; } @Override public double getMinDomain() { return minDomain; } @Override public double getMaxDomain() { return maxDomain; } @Override public void setMemFun(double w) { membershipFunctionValue = w; } @Override public double getMemFun() { return membershipFunctionValue; } @Override public String getDataName() { return "A"; } @Override public void setX(double x) { Acc = x; } @Override public IMeasuredData getCopy() { return new A(minDomain, maxDomain); } }
[ "knezevic.karlo1@gmail.com" ]
knezevic.karlo1@gmail.com
437b690729f96125bef8aa405eaf2ca9087a2c9d
59910011a32c2346d4f9610fa12da631f9abb0bf
/app/src/test/java/com/guaguale/ExampleUnitTest.java
d0123bce41accd39a6f17e99b84f929f10329307
[]
no_license
2223512468/GuaGuaLe
f9ee45cca015f54f01e44cc08b250386a7772427
0df216a1b5858c9a472402221717e82fa4c3bd62
refs/heads/master
2020-04-06T07:09:22.500575
2018-03-07T05:15:38
2018-03-07T05:15:38
124,181,983
0
0
null
null
null
null
UTF-8
Java
false
false
305
java
package com.guaguale; import org.junit.Test; import static org.junit.Assert.*; /** * To work on unit tests, switch the Test Artifact in the Build Variants view. */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
[ "2223512468@qq.com" ]
2223512468@qq.com
6d7286f3aeb5cbcc69550231f179b6c175edfa8e
7d70c8868713090bd33aa150949a52004dc63675
/jOOQ-test/src/org/jooq/test/sqlserver/generatedclasses/tables/records/T_785Record.java
0f11778cb9153e7f6d47c47ec82e409f877f01ee
[ "Apache-2.0", "BSD-3-Clause" ]
permissive
Crustpunk/jOOQ
07ff1d2c4dedf0ad783900416a8e51536fbc053e
ca8e85fe19acebc05b73dd5a4671225de79096f2
refs/heads/master
2021-01-20T22:59:36.616694
2012-11-27T16:01:17
2012-11-27T16:01:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,140
java
/** * This class is generated by jOOQ */ package org.jooq.test.sqlserver.generatedclasses.tables.records; /** * This class is generated by jOOQ. */ @java.lang.SuppressWarnings("all") public class T_785Record extends org.jooq.impl.TableRecordImpl<org.jooq.test.sqlserver.generatedclasses.tables.records.T_785Record> implements org.jooq.Record3<java.lang.Integer, java.lang.String, java.lang.String> { private static final long serialVersionUID = 1110234421; /** * The table column <code>dbo.t_785.ID</code> */ public void setId(java.lang.Integer value) { setValue(org.jooq.test.sqlserver.generatedclasses.tables.T_785.T_785.ID, value); } /** * The table column <code>dbo.t_785.ID</code> */ public java.lang.Integer getId() { return getValue(org.jooq.test.sqlserver.generatedclasses.tables.T_785.T_785.ID); } /** * The table column <code>dbo.t_785.NAME</code> */ public void setName(java.lang.String value) { setValue(org.jooq.test.sqlserver.generatedclasses.tables.T_785.T_785.NAME, value); } /** * The table column <code>dbo.t_785.NAME</code> */ public java.lang.String getName() { return getValue(org.jooq.test.sqlserver.generatedclasses.tables.T_785.T_785.NAME); } /** * The table column <code>dbo.t_785.VALUE</code> */ public void setValue(java.lang.String value) { setValue(org.jooq.test.sqlserver.generatedclasses.tables.T_785.T_785.VALUE, value); } /** * The table column <code>dbo.t_785.VALUE</code> */ public java.lang.String getValue() { return getValue(org.jooq.test.sqlserver.generatedclasses.tables.T_785.T_785.VALUE); } /** * Create a detached T_785Record */ public T_785Record() { super(org.jooq.test.sqlserver.generatedclasses.tables.T_785.T_785); } // ------------------------------------------------------------------------- // Record3 type implementation // ------------------------------------------------------------------------- /** * {@inheritDoc} */ @Override public org.jooq.Row3<java.lang.Integer, java.lang.String, java.lang.String> fieldsRow() { return org.jooq.impl.Factory.row(field1(), field2(), field3()); } /** * {@inheritDoc} */ @Override public org.jooq.Row3<java.lang.Integer, java.lang.String, java.lang.String> valuesRow() { return org.jooq.impl.Factory.row(value1(), value2(), value3()); } /** * {@inheritDoc} */ @Override public org.jooq.Field<java.lang.Integer> field1() { return org.jooq.test.sqlserver.generatedclasses.tables.T_785.T_785.ID; } /** * {@inheritDoc} */ @Override public org.jooq.Field<java.lang.String> field2() { return org.jooq.test.sqlserver.generatedclasses.tables.T_785.T_785.NAME; } /** * {@inheritDoc} */ @Override public org.jooq.Field<java.lang.String> field3() { return org.jooq.test.sqlserver.generatedclasses.tables.T_785.T_785.VALUE; } /** * {@inheritDoc} */ @Override public java.lang.Integer value1() { return getId(); } /** * {@inheritDoc} */ @Override public java.lang.String value2() { return getName(); } /** * {@inheritDoc} */ @Override public java.lang.String value3() { return getValue(); } }
[ "lukas.eder@gmail.com" ]
lukas.eder@gmail.com
7f1a77eaf551f7402bbea127490d04d57f9be3d3
34b8e226da9f7b8427c43bd1327deb5d129537c1
/function/src/main/java/intersky/function/receiver/WebAppReceiver.java
50da7f70a4237b431d1c9e75b911dd17a3ae3001
[]
no_license
xpx456/xpxproject
11485d4a475c10f19dbbfed2b44cfb4644a87d12
c19c69bc998cbbb3ebc0076c394db9746e906dce
refs/heads/master
2021-04-23T08:46:43.530627
2021-03-04T09:38:24
2021-03-04T09:38:24
249,913,946
0
1
null
null
null
null
UTF-8
Java
false
false
1,784
java
package intersky.function.receiver; import android.annotation.SuppressLint; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.os.Handler; import android.os.Message; import intersky.appbase.BaseReceiver; import intersky.function.handler.WebAppHandler; import intersky.function.presenter.WebAppPresenter; import intersky.function.view.activity.WebAppActivity; import intersky.scan.ScanUtils; @SuppressLint("NewApi") public class WebAppReceiver extends BaseReceiver { public static final String GET_PICTURE_PATH= "get_picture_path"; public Handler mHandler; public WebAppReceiver(Handler mHandler) { this.mHandler = mHandler; this.intentFilter = new IntentFilter(); intentFilter.addAction(GET_PICTURE_PATH); intentFilter.addAction(ScanUtils.ACTION_SCAN_FINISH); intentFilter.addAction(WebAppActivity.ACTION_WEBAPP_ADDPICTORE); } @Override public void onReceive(Context context, Intent intent) { // TODO Auto-generated method stub if (intent.getAction().equals(GET_PICTURE_PATH)) { Message msg = new Message(); msg.what = WebAppActivity.GET_PIC_PATH; msg.obj = intent.getStringExtra("path"); if(mHandler != null) mHandler.sendMessage(msg); } else if (intent.getAction().equals(ScanUtils.ACTION_SCAN_FINISH)) { Message msg = new Message(); msg.what = WebAppActivity.SCANNIN_GREQUEST_CODE_WITH_JSON; msg.obj = intent; if(mHandler != null) mHandler.sendMessage(msg); } else if (intent.getAction().equals(WebAppActivity.ACTION_WEBAPP_ADDPICTORE)) { Message msg = new Message(); msg.what = WebAppHandler.ADD_PICTURE; msg.obj = intent; if(mHandler != null) mHandler.sendMessage(msg); } } }
[ "xpx456@163.com" ]
xpx456@163.com
97a88cbbf9754f06aecf2d1edfe4d0825a965f73
1ca786875a71ad500ad2bd2670cbf8d42cb05c9d
/hw04/untitled.java
65e68949922d84422ff57e9b2304aee36b3ae009
[]
no_license
tiy319/CSE2
86721aa381d4bb9a4b28b48176c54d70f4002966
fa7f2c9aa901eea920c5a8a972b4beb637e4fa72
refs/heads/master
2016-09-05T18:08:47.198475
2015-11-17T22:14:25
2015-11-17T22:14:25
41,553,466
0
0
null
null
null
null
UTF-8
Java
false
false
2,672
java
public class untitled { //main method public static void main ( String [] args){ String n1=input.next(); int h=1; while(h==1){ int n=0;//input n to count int x=1;//input x to run ot stop inner while loop while(x==1){//check condition of inner while loop for (int i =0;i<MondayCost.length();i++){//define for loop of number of letters of input string MondayCost if(Character.isLetter(MondayCost.charAt(i))){//check condition n++;}//define n and end if function else{//check is above condition is not satisified n=n;//define n }}//end if function and for loop if (n!=0){//check condition of count variables n System.out.print("Sorry, you did not enter an integer. Try again: $");//print if above condition satisified MondayCost=myScanner.next();//input string x=1;//define x n=0;}//define n and end if function else{//check if above condition is not satisified x--;//define x }//end else }//end while loop double Monday=Double.parseDouble(MondayCost);//convert string into double if(Monday<0){//check double condition System.out.print("Please enter positive number: $");//print result MondayCost=myScanner.next();//input string n=0;//define n x=1;//define x while(x==1){//check x for (int i =0;i<MondayCost.length();i++){//define for loop of number of letter of MondayCost String if(Character.isLetter(MondayCost.charAt(i))){//check condition n++;}//defien n and end if else{//check is above condition is not satisified n=n;//define n }}//end of else and end of for loop if (n!=0){//check condition System.out.print("Sorry, you did not enter an integer. Try again: $");//print result MondayCost=myScanner.next();//input string x=1;//define x n=0;}//define n and end if else{//check if above condition is not satisified x--;//define x }//end else }//end while loop }//end if function else{//check if if is not satisified j--;//define j }//end else }//end while loop double Monday=Double.parseDouble(MondayCost);//convert string into double }}
[ "tiy319@lehigh.edu" ]
tiy319@lehigh.edu
9c3b95292d78ff163bb4cb7be5668a52bd9eeac0
605a831f7ddf93208c350c6d929a8f49c116c407
/src/com/gazman/Main.java
85e3b4c9ae12eac0c753febad0eda0ef2ff6bb1f
[]
no_license
Ilya-Gazman/semi-primes
30e2a625a4a9399093b8dbb602a9eb683db63f8a
d7bdd902f5bf63245bc11d05b2b50971a66a091d
refs/heads/master
2021-01-10T16:29:44.766263
2016-01-22T11:40:26
2016-01-22T11:40:26
50,177,784
0
0
null
null
null
null
UTF-8
Java
false
false
740
java
package com.gazman; import com.gazman.factor.BaseFactor; import com.gazman.factor.Factor2; import java.math.BigInteger; import java.util.Random; public class Main extends BaseFactor { private static Random random = new Random(); public static void main(String[] args) { new Main().init(); } private void init() { int length = 20; BigInteger a = BigInteger.probablePrime(length, random); BigInteger b = BigInteger.probablePrime(length, random); a = BigInteger.valueOf(907); b = BigInteger.valueOf(733); BigInteger input = a.multiply(b); log(a, b); log(input); log("---------"); log(); new Factor2().factor(input); } }
[ "gazman1986@gmail.com" ]
gazman1986@gmail.com
20fe8081f565d5d77e56add2604b80cefcac5616
1b3bcf3cb6a5179cd4993c5c9a9170c470db8561
/src/createdbyNguyenManhCuong/connect/LoginService.java
09292683895f4c57f92c46008872f1df8e06ba4f
[]
no_license
NguyenManhCuongKawoa/-Sales-Application-Java-Swing-
9eb5261112d5367b6e6af20eef4b3906c9cec1b8
0870aeba93710a909ed87e998f7f582d583a2c91
refs/heads/master
2023-02-11T01:01:15.864815
2021-01-09T03:28:32
2021-01-09T03:28:32
328,064,823
0
0
null
null
null
null
UTF-8
Java
false
false
4,075
java
package createdbyNguyenManhCuong.connect; import java.sql.Connection; import java.sql.Date; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.ArrayList; import createdbyNguyenManhCuong.model.AccountInformation; public class LoginService { public static Connection connection = SQLServerConnection.getConnection("DESKTOP-GBDCA67\\NGUYENMANHCUONG", "MyProjectBasketballShop"); public static AccountInformation login(String accountName, String password) { AccountInformation account = new AccountInformation(); try { String sql = "select * from AccountInformation where accountName=? and password=?"; PreparedStatement preStatement = connection.prepareStatement(sql); preStatement.setString(1, accountName); preStatement.setString(2, password); ResultSet res = preStatement.executeQuery(); if(res.next()) { account.setId(res.getInt("id")); account.setAccountName(res.getString("accountName")); account.setPassword(res.getString("password")); account.setUserName(res.getString("userName")); account.setGender(res.getString("gender")); account.setPhone(res.getString("phone")); account.setDateOfBirth(res.getDate("dateOfBirth")); account.setAddress(res.getString("address")); account.setAccountImage(res.getBytes("image")); return account; } } catch (Exception ex) { ex.printStackTrace(); } return null; } public static AccountInformation getAccount(int accountID) { AccountInformation account = new AccountInformation(); try { String sql = "select * from AccountInformation where id = ?"; PreparedStatement preStatement = connection.prepareStatement(sql); preStatement.setInt(1, accountID); ResultSet res = preStatement.executeQuery(); if(res.next()) { account.setId(res.getInt("id")); account.setAccountName(res.getString("accountName")); account.setPassword(res.getString("password")); account.setUserName(res.getString("userName")); account.setGender(res.getString("gender")); account.setPhone(res.getString("phone")); account.setDateOfBirth(res.getDate("dateOfBirth")); account.setAddress(res.getString("address")); account.setAccountImage(res.getBytes("image")); return account; } } catch (Exception ex) { ex.printStackTrace(); } return null; } public static boolean changePassword(int id, String password) { try { String sql = "update AccountInformation set password = ? where id = ?"; PreparedStatement preStatement = connection.prepareStatement(sql); preStatement.setString(1, password); preStatement.setInt(2, id); int change = preStatement.executeUpdate(); if(change > 0) { return true; } } catch (Exception ex) { ex.printStackTrace(); } return false; } public static boolean changeInformationAccount(int id, AccountInformation account) { try { String sql = "update AccountInformation set userName = ?, gender = ?, phone = ?, address = ?, dateOfBirth = ?, image = ? where id = ?"; PreparedStatement preStatement = connection.prepareStatement(sql); preStatement.setNString(1, account.getUserName()); preStatement.setString(2, account.getGender()); preStatement.setString(3, account.getPhone()); preStatement.setString(4, account.getAddress()); preStatement.setDate(5, (Date) account.getDateOfBirth()); preStatement.setBytes(6, account.getAccountImage()); preStatement.setInt(7, id); int change = preStatement.executeUpdate(); if(change > 0) { return true; } } catch (Exception ex) { ex.printStackTrace(); } return false; } public static ArrayList<String> layTatCaCacAccount() { ArrayList<String> arrAccount = new ArrayList<String>(); try { String sql = "select * from AccountInformation"; PreparedStatement preStatement = connection.prepareStatement(sql); ResultSet res = preStatement.executeQuery(); while(res.next()) { arrAccount.add(res.getString("accountName")); } return arrAccount; } catch (Exception ex) { ex.printStackTrace(); } return null; } }
[ "manhcuong0978481376@gmail.com" ]
manhcuong0978481376@gmail.com
8ed93030f50b1d3bc08fe685f5dc824c6ac21688
7d74a09c0dc2851304a79aeee49daf099f72d950
/src/br/ufc/qx/tizeeter/controller/TizeetController.java
aef16e4dbc8fdb3e8830752cde4661e7dad160bd
[]
no_license
pereiraneto/Tizeeter
0d2aa20c6dff57a50856a5f9dda3427d4156548b
c56ad0feeecd4e334412a613013af70116d53e32
refs/heads/master
2021-01-19T18:05:36.749228
2017-08-22T23:12:49
2017-08-22T23:12:49
101,115,400
0
0
null
null
null
null
UTF-8
Java
false
false
592
java
package br.ufc.qx.tizeeter.controller; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import br.ufc.qx.tizeeter.dao.TizeetDAO; public class TizeetController extends TizeeterGenericBaseHttpServlet<TizeetDAO> { private static final long serialVersionUID = 5288235092948947056L; public TizeetController() { setDAO(new TizeetDAO()); } @Override public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } }
[ "pereira.neto.12@gmail.com" ]
pereira.neto.12@gmail.com
263a0e86800bb71cee5a96f74b355986b17cbebd
81819e801b978803d2559890e45a1110eb0d7e06
/Praktikum_4_2.java
8ec4783e8b54fc268fc1bb7a797f3ce718b2bbb5
[]
no_license
arvelinotio/Praktikum_Provis_4
8dd915e09ab1265fd7723b4c9665af8942697476
ffca875fb668d4c01b2806bf0baae193a45d3504
refs/heads/master
2022-04-18T03:41:22.829937
2020-04-12T16:45:16
2020-04-12T16:45:16
255,126,706
0
0
null
null
null
null
UTF-8
Java
false
false
12,967
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. */ /** * * @author WIN 10 */ public class Praktikum_4_2 extends javax.swing.JFrame { int nilai_a, nilai_b; boolean hasil; public Praktikum_4_2() { initComponents(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); txtpertama = new javax.swing.JTextField(); jLabel3 = new javax.swing.JLabel(); txtkedua = new javax.swing.JTextField(); btnsama = new javax.swing.JButton(); btntidaksama = new javax.swing.JButton(); btnlebih = new javax.swing.JButton(); btnkurang = new javax.swing.JButton(); btnlebihsama = new javax.swing.JButton(); btnkurangsama = new javax.swing.JButton(); jLabel5 = new javax.swing.JLabel(); txthasil = new javax.swing.JTextField(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jLabel1.setFont(new java.awt.Font("Tahoma", 1, 16)); // NOI18N jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel1.setText("PROGRAM OPERATOR PEMBANDING"); jLabel2.setText("NILAI A"); jLabel3.setText("NILAI B"); btnsama.setText("=="); btnsama.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnsamaActionPerformed(evt); } }); btntidaksama.setText("!="); btntidaksama.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btntidaksamaActionPerformed(evt); } }); btnlebih.setText(">"); btnlebih.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnlebihActionPerformed(evt); } }); btnkurang.setText("<"); btnkurang.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnkurangActionPerformed(evt); } }); btnlebihsama.setText(">="); btnlebihsama.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnlebihsamaActionPerformed(evt); } }); btnkurangsama.setText("<="); btnkurangsama.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnkurangsamaActionPerformed(evt); } }); jLabel5.setText("HASIL"); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(47, 47, 47) .addComponent(jLabel1)) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() .addGap(73, 73, 73) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel2) .addComponent(jLabel3)) .addGap(49, 49, 49) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(txtkedua, javax.swing.GroupLayout.PREFERRED_SIZE, 156, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txtpertama, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 156, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(layout.createSequentialGroup() .addComponent(jLabel5) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(txthasil, javax.swing.GroupLayout.PREFERRED_SIZE, 172, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(14, 14, 14)))) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() .addGap(104, 104, 104) .addComponent(btnsama) .addGap(18, 18, 18) .addComponent(btntidaksama) .addGap(18, 18, 18) .addComponent(btnlebih) .addGap(18, 18, 18) .addComponent(btnkurang))) .addGap(18, 18, 18) .addComponent(btnlebihsama) .addGap(18, 18, 18) .addComponent(btnkurangsama))) .addContainerGap(42, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jLabel1) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(txtpertama, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3) .addComponent(txtkedua, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(27, 27, 27) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(btnsama) .addComponent(btntidaksama) .addComponent(btnlebih) .addComponent(btnkurang) .addComponent(btnlebihsama) .addComponent(btnkurangsama)) .addGap(36, 36, 36) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel5) .addComponent(txthasil, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(47, Short.MAX_VALUE)) ); pack(); }// </editor-fold>//GEN-END:initComponents private void btnsamaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnsamaActionPerformed nilai_a = Integer.valueOf(txtpertama.getText()); nilai_b = Integer.valueOf(txtkedua.getText()); hasil = nilai_a == nilai_b; txthasil.setText(String.valueOf(hasil)); }//GEN-LAST:event_btnsamaActionPerformed private void btntidaksamaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btntidaksamaActionPerformed nilai_a = Integer.valueOf(txtpertama.getText()); nilai_b = Integer.valueOf(txtkedua.getText()); hasil = nilai_a != nilai_b; txthasil.setText(String.valueOf(hasil)); }//GEN-LAST:event_btntidaksamaActionPerformed private void btnlebihActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnlebihActionPerformed nilai_a = Integer.valueOf(txtpertama.getText()); nilai_b = Integer.valueOf(txtkedua.getText()); hasil = nilai_a > nilai_b; txthasil.setText(String.valueOf(hasil)); }//GEN-LAST:event_btnlebihActionPerformed private void btnkurangActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnkurangActionPerformed nilai_a = Integer.valueOf(txtpertama.getText()); nilai_b = Integer.valueOf(txtkedua.getText()); hasil = nilai_a < nilai_b; txthasil.setText(String.valueOf(hasil)); }//GEN-LAST:event_btnkurangActionPerformed private void btnlebihsamaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnlebihsamaActionPerformed nilai_a = Integer.valueOf(txtpertama.getText()); nilai_b = Integer.valueOf(txtkedua.getText()); hasil = nilai_a >= nilai_b; txthasil.setText(String.valueOf(hasil)); }//GEN-LAST:event_btnlebihsamaActionPerformed private void btnkurangsamaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnkurangsamaActionPerformed nilai_a = Integer.valueOf(txtpertama.getText()); nilai_b = Integer.valueOf(txtkedua.getText()); hasil = nilai_a <= nilai_b; txthasil.setText(String.valueOf(hasil)); }//GEN-LAST:event_btnkurangsamaActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(Praktikum_4_2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Praktikum_4_2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Praktikum_4_2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Praktikum_4_2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new Praktikum_4_2().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnkurang; private javax.swing.JButton btnkurangsama; private javax.swing.JButton btnlebih; private javax.swing.JButton btnlebihsama; private javax.swing.JButton btnsama; private javax.swing.JButton btntidaksama; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel5; private javax.swing.JTextField txthasil; private javax.swing.JTextField txtkedua; private javax.swing.JTextField txtpertama; // End of variables declaration//GEN-END:variables }
[ "noreply@github.com" ]
noreply@github.com
c21ad1ecf8debbe779e7f6aa826856e68611da2e
892f3a80073bc5a40cc0a5497bd474b6677a85bb
/examples/mini-service/src/main/java/org/springside/examples/miniservice/ws/dto/UserDTO.java
15143903452a77832e9d445e3a3055c4bbe08a17
[ "Apache-2.0" ]
permissive
gitchina/springside-3.3.4
96762405923525a5a876592bcebe40095a642552
d34053002db93e977658837a57b17704cb3fcc24
refs/heads/master
2022-12-21T02:04:01.769961
2020-02-26T14:25:29
2020-02-26T14:25:29
23,353,383
0
4
Apache-2.0
2022-12-15T23:38:47
2014-08-26T13:53:49
Java
UTF-8
Java
false
false
1,738
java
package org.springside.examples.miniservice.ws.dto; import java.util.List; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlType; import org.apache.commons.lang.builder.ToStringBuilder; import org.springside.examples.miniservice.ws.WsConstants; import com.google.common.collect.Lists; /** * Web Service传输User信息的DTO. * * 只传输外部接口需要的属性.使用JAXB 2.0的annotation标注JAVA-XML映射,尽量使用默认约定. * * @author calvin */ @XmlType(name = "User", namespace = WsConstants.NS) public class UserDTO { private Long id; private String loginName; private String name; private String email; private List<RoleDTO> roleList = Lists.newArrayList(); public Long getId() { return id; } public void setId(Long value) { id = value; } public String getLoginName() { return loginName; } public void setLoginName(String value) { loginName = value; } public String getName() { return name; } public void setName(String value) { name = value; } public String getEmail() { return email; } public void setEmail(String value) { email = value; } //配置输出xml为<roleList><role><id>1</id></role></roleList> @XmlElementWrapper(name = "roleList") @XmlElement(name = "role") public List<RoleDTO> getRoleList() { return roleList; } public void setRoleList(List<RoleDTO> roleList) { this.roleList = roleList; } /** * 重新实现toString()函数方便在日志中打印DTO信息. */ @Override public String toString() { return ToStringBuilder.reflectionToString(this); } }
[ "ChivalrousDig@gmail.com" ]
ChivalrousDig@gmail.com
2e5c43a15e3512a2c824766f7894e12c6d097488
8862e320433db9e20cbf76565e557e11208eb7ee
/modules/core/src/main/java/org/eclipse/imagen/WritablePropertySourceImpl.java
43e15b01b4d3e3780a63fe938357c3c516f4407e
[ "Apache-2.0" ]
permissive
jqyx/imagen
fab6a264d7f60452698ccf0e65e8fee211efa301
7933781dd2771edd276f4c681023dc155dd5f1f4
refs/heads/master
2020-05-15T05:52:11.936252
2019-05-01T15:40:15
2019-05-01T15:40:15
182,112,599
0
0
null
2019-04-18T15:27:07
2019-04-18T15:27:07
null
UTF-8
Java
false
false
20,779
java
/* * Copyright (c) [2019,] 2019, Oracle and/or its affiliates. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package org.eclipse.imagen; import java.beans.PropertyChangeListener; import java.util.Collections; import java.util.Hashtable; import java.util.HashSet; import java.util.Iterator; import java.util.Map; import java.util.Set; import org.eclipse.imagen.util.CaselessStringKey; /** * A utility implementation of the <code>WritablePropertySource</code> * interface. The same internal superclass data structures are used and * are supplemented by a <code>PropertyChangeSupportJAI</code> to handle * property event firing. All events fired by an instance of this class * will be <code>PropertySourceChangeEvent</code>s with an event source * equal to the object used to create the <code>PropertyChangeSupportJAI</code> * helper object. This object is user-specifiable at construction time or * automatically created when a <code>PropertyChangeListener</code> is * added or removed and the <code>PropertyChangeSupportJAI</code> specified * at construction was <code>null</code>. * * @see CaselessStringKey * @see PropertySource * @see PropertySourceChangeEvent * @see PropertySourceImpl * @see WritablePropertySource * @see PropertyChangeEmitter * @see PropertyChangeSupportJAI * * @since JAI 1.1 */ public class WritablePropertySourceImpl extends PropertySourceImpl implements WritablePropertySource { /** * Helper object for bean-style property events. Its default * value is <code>null</code> which indicates that no events * are to be fired. */ protected PropertyChangeSupportJAI manager = null; /** * Constructs a <code>WritablePropertySourceImpl</code> instance with * no properties set. */ public WritablePropertySourceImpl() { super(); } /** * Constructs a <code>WritablePropertySourceImpl</code> instance which * will derive properties from one or both of the supplied parameters. * The <code>propertyMap</code> and <code>propertySource</code> parameters * will be used to initialize the name-value and * name-<code>PropertySource</code> mappings, respectively. * Entries in the <code>propertyMap</code> object will be assumed * to be properties if the key is a <code>String</code> or a * <code>CaselessStringKey</code>. The <code>propertySource</code> * object will be queried for the names of properties that it emits * but requests for associated values will not be made at this time * so as to to defer any calculation that such requests might provoke. * The case of property names will be retained but will be ignored * insofar as the name is used as a key to the property value. * * @param propertyMap A <code>Map</code> from which to copy properties * which have keys which are either <code>String</code>s or * <code>CaselessStringKey</code>s. * @param propertySource A <code>PropertySource</code> from which to * derive properties. * @param manager The object which will actually fire the events. * May be <code>null</code> in which case a default * event manager will be created as needed with this * object as its event source. */ public WritablePropertySourceImpl(Map propertyMap, PropertySource source, PropertyChangeSupportJAI manager) { super(propertyMap, source); this.manager = manager; } /** * Returns the value of a property. If the property name is not * recognized, <code>java.awt.Image.UndefinedProperty</code> will * be returned. * * <p> If the requested name is found in the name-value mapping, * the corresponding value will be returned. Otherwise the * name-<code>PropertySource</code> mapping will be queried and the * value will be derived from the found <code>PropertySource</code>, * if any. If the value is derived from a <code>PropertySource</code>, * a record will be kept of this and this property will be referred to * as a "cached property". Derivation of the value from a * <code>PropertySource</code> rather than from the name-value * mapping may cause a <code>PropertySourceChangeEvent<code> to be fired. * * @param propertyName the name of the property, as a <code>String</code>. * * @return the value of the property, as an * <code>Object</code>, or the value * <code>java.awt.Image.UndefinedProperty</code>. * * @exception IllegalArgumentException if <code>propertyName</code> * is <code>null</code>. */ public Object getProperty(String propertyName) { if(propertyName == null) { throw new IllegalArgumentException(JaiI18N.getString("Generic0")); } synchronized(properties) { // Check whether a value mapping exists. boolean isMapped = properties.containsKey(new CaselessStringKey(propertyName)); // Retrieve the value. Object value = super.getProperty(propertyName); // Fire an event if necessary, i.e., if there is an event manager // and the property value was just derived from a PropertySource in // the name-PropertySource mapping. if(manager != null && !isMapped && value != java.awt.Image.UndefinedProperty) { // Value was derived from a PropertySource -> event. Object eventSource = manager.getPropertyChangeEventSource(); PropertySourceChangeEvent evt = new PropertySourceChangeEvent(eventSource, propertyName, java.awt.Image.UndefinedProperty, value); manager.firePropertyChange(evt); } return value; } } /** * Adds the property value associated with the supplied name to * the <code>PropertySource</code>. Values set by this means will * supersede any previously defined value of the property. * * <p> <code>PropertySourceChangeEvent<code>s may be fired * with a name set to that of the property (retaining case) and old and * new values set to the previous and current values of the property, * respectively. The value returned by the <code>getSource()</code> * method of the event is determined by the value passed to the * constructor of the <code>PropertyChangeSupportJAI</code> parameter. * Neither the old nor the new value may be <code>null</code>: undefined * properties must as usual be indicated by the constant value * <code>java.awt.Image.UndefinedProperty</code>. It is however * legal for either but not both of the old and new property values * to equal <code>java.awt.Image.UndefinedProperty</code>. * * @param propertyName the name of the property, as a <code>String</code>. * @param propertyValue the property, as a general <code>Object</code>. * * @exception IllegalArgumentException if <code>propertyName</code> * or <code>propertyValue</code> * is <code>null</code>. */ public void setProperty(String propertyName, Object propertyValue) { if(propertyName == null || propertyValue == null) { throw new IllegalArgumentException(JaiI18N.getString("Generic0")); } synchronized(properties) { CaselessStringKey key = new CaselessStringKey(propertyName); // Set the entry in the name-value mapping. Object oldValue = properties.put(key, propertyValue); if(oldValue == null) { oldValue = java.awt.Image.UndefinedProperty; } // Suppress the name if present in the cached properties listing. cachedPropertyNames.remove(key); if(manager != null && !oldValue.equals(propertyValue)) { Object eventSource = manager.getPropertyChangeEventSource(); PropertySourceChangeEvent evt = new PropertySourceChangeEvent(eventSource, propertyName, oldValue, propertyValue); manager.firePropertyChange(evt); } } } /** * Removes the named property from the <code>PropertySource</code>. * <code>PropertySourceChangeEvent<code>s may be fired if the property * values is actually removed from the name-value mapping. In this case * the new value of the property event will be * <code>java.awt.Image.UndefinedProperty</code>. * * @param propertyName the name of the property, as a <code>String</code>. * @param propertyValue the property, as a general <code>Object</code>. * * @exception IllegalArgumentException if <code>propertyName</code> * is <code>null</code>. */ public void removeProperty(String propertyName) { if(propertyName == null) { throw new IllegalArgumentException(JaiI18N.getString("Generic0")); } synchronized(properties) { CaselessStringKey key = new CaselessStringKey(propertyName); // Remove the entry from the name-value mapping and save its value. Object oldValue = properties.remove(key); // Remove the entry from the name-PropertySource mapping and from // the list of cached properties. propertySources.remove(key); cachedPropertyNames.remove(key); if(manager != null && oldValue != null) { Object eventSource = manager.getPropertyChangeEventSource(); PropertySourceChangeEvent evt = new PropertySourceChangeEvent(eventSource, propertyName, oldValue, java.awt.Image.UndefinedProperty); manager.firePropertyChange(evt); } } } /** * Copies from the supplied <code>Map</code> to the property set all * entries wherein the key is an instance of <code>String</code> * or <code>CaselessStringKey</code>. Values set by this means will * supersede any previously defined values of the respective properties. * All property values are copied by reference. * <code>PropertySourceChangeEvent<code>s may be fired for each * property added. If the property was not previously defined the * old value of the property event will be * <code>java.awt.Image.UndefinedProperty</code>. * * @param propertyMap A <code>Map</code> from which to copy properties * which have keys which are either <code>String</code>s or * <code>CaselessStringKey</code>s. If <code>null</code> no * properties will be added. */ public void addProperties(Map propertyMap) { if(propertyMap != null) { synchronized(properties) { Iterator keys = propertyMap.keySet().iterator(); while(keys.hasNext()) { Object key = keys.next(); if(key instanceof String) { setProperty((String)key, propertyMap.get(key)); } else if(key instanceof CaselessStringKey) { setProperty(((CaselessStringKey)key).getName(), propertyMap.get(key)); } } } } } /** * Adds a <code>PropertySource</code> to the * name-<code>PropertySource</code> mapping. The * actual property values are not requested at this time but instead * an entry for the name of each property emitted by the * <code>PropertySource</code> is added to the * name-<code>PropertySource</code> mapping. Properties defined by * this <code>PropertySource</code> supersede those of all other * previously added <code>PropertySource</code>s including that * specified at construction, if any. Note that this method will not * provoke any events as no properties will actually have changed. * * @param propertySource A <code>PropertySource</code> from which to * derive properties. If <code>null</code> nothing is done. */ public void addProperties(PropertySource propertySource) { if(propertySource != null) { synchronized(properties) { String[] names = propertySource.getPropertyNames(); if(names != null) { int length = names.length; for(int i = 0; i < length; i++) { propertySources.put(new CaselessStringKey(names[i]), propertySource); } } } } } /** * Clears all properties from the <code>PropertySource</code> by * invoking <code>removeProperty()</code> with all known names. * <code>PropertySourceChangeEvent<code>s may be fired * for each stored property removed. In this case the new value * of the property event will be * <code>java.awt.Image.UndefinedProperty</code>. */ public void clearProperties() { synchronized(properties) { String[] names = getPropertyNames(); if(names != null) { int length = names.length; for(int i = 0; i < length; i++) { removeProperty(names[i]); } } } } /** * Clears the name-value mapping of all properties. * <code>PropertySourceChangeEvent<code>s may be fired * for each stored property removed. In this case the new value * of the property event will be * <code>java.awt.Image.UndefinedProperty</code>. */ public void clearPropertyMap() { synchronized(properties) { Iterator keys = properties.keySet().iterator(); while(keys.hasNext()) { CaselessStringKey key = (CaselessStringKey)keys.next(); Object oldValue = properties.get(key); keys.remove(); if(manager != null) { Object eventSource = manager.getPropertyChangeEventSource(); PropertySourceChangeEvent evt = new PropertySourceChangeEvent(eventSource, key.getName(), oldValue, java.awt.Image.UndefinedProperty); manager.firePropertyChange(evt); } } // Also clear cached names. cachedPropertyNames.clear(); } } /** * Clears the name-<code>PropertySource</code> mapping. * No events will be fired. */ public void clearPropertySourceMap() { synchronized(properties) { propertySources.clear(); } } /** * Clears from the name-value mapping all properties which were * derived from a source in the name-<code>PropertySource</code> mapping. * <code>PropertySourceChangeEvent<code>s may be fired * for each stored property removed. In this case the new value * of the property event will be * <code>java.awt.Image.UndefinedProperty</code>. */ public void clearCachedProperties() { synchronized(properties) { Iterator names = cachedPropertyNames.iterator(); while(names.hasNext()) { CaselessStringKey name = (CaselessStringKey)names.next(); Object oldValue = properties.remove(name); names.remove(); // remove name from cachedPropertyNames. if(manager != null) { Object eventSource = manager.getPropertyChangeEventSource(); PropertySourceChangeEvent evt = new PropertySourceChangeEvent(eventSource, name.getName(), oldValue, java.awt.Image.UndefinedProperty); manager.firePropertyChange(evt); } } } } /** * Removes from the name-<code>PropertySource</code> mapping all entries * which refer to the supplied <code>PropertySource</code>. */ public void removePropertySource(PropertySource propertySource) { synchronized(properties) { Iterator keys = propertySources.keySet().iterator(); while(keys.hasNext()) { Object ps = propertySources.get(keys.next()); if(ps.equals(propertySource)) { keys.remove(); // remove this entry from propertySources. } } } } /** * Add a <code>PropertyChangeListener</code> to the listener list. The * listener is registered for all properties. * * <p> If the property event utility object was not set at construction, * then it will be initialized to a <code>PropertyChangeSupportJAI</code> * whose property event source is this object. */ public void addPropertyChangeListener(PropertyChangeListener listener) { getEventManager().addPropertyChangeListener(listener); } /** * Add a <code>PropertyChangeListener</code> for a specific property. The * listener will be invoked only when a call on * firePropertyChange names that specific property. * * <p> If the property event utility object was not set at construction, * then it will be initialized to a <code>PropertyChangeSupportJAI</code> * whose property event source is this object. */ public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) { getEventManager().addPropertyChangeListener(propertyName, listener); } /** * Remove a <code>PropertyChangeListener</code> from the listener list. * This removes a <code>PropertyChangeListener</code> that was registered * for all properties. * * <p> If the property event utility object was not set at construction, * then it will be initialized to a <code>PropertyChangeSupportJAI</code> * whose property event source is this object. */ public void removePropertyChangeListener(PropertyChangeListener listener) { getEventManager().removePropertyChangeListener(listener); } /** * Remove a <code>PropertyChangeListener</code> for a specific property. * * <p> If the property event utility object was not set at construction, * then it will be initialized to a <code>PropertyChangeSupportJAI</code> * whose property event source is this object. */ public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) { getEventManager().removePropertyChangeListener(propertyName, listener); } /** * Returns the utility property event manager. If none has been set, * initialize it to one whose source is this object. */ private PropertyChangeSupportJAI getEventManager() { if(manager == null) { synchronized(this) { manager = new PropertyChangeSupportJAI(this); } } return manager; } }
[ "qingyun.xie@oracle.com" ]
qingyun.xie@oracle.com
54b2beb7afaa88bc223e4e519a463b5295d4dc9e
2af25b5d8f5501ad6a76ba3669a81029df53f394
/src/main/java/org/pstcl/sldc/scada/ScadaApplication.java
59400620c4eaaeecdd297932813459110a4eb03f
[]
no_license
Prabhnoor1997/ScadaDataService
6dafd9adbc9ec0ca2198e14631c9931b759f508c
11184b569e5a17544191d4a6ffb7c8f8dba4261e
refs/heads/master
2020-04-26T03:02:06.778770
2019-04-15T06:14:22
2019-04-15T06:14:22
173,253,700
0
0
null
2019-03-01T07:15:08
2019-03-01T07:15:08
null
UTF-8
Java
false
false
597
java
package org.pstcl.sldc.scada; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class ScadaApplication { public static void main(String[] args) { SpringApplication.run(ScadaApplication.class, args); } } // //a_FREQUENCY = "*/Rate=10" //a_DRAWAL = "nrldc_pg.line.pseb_drwl.mw/rate=10" //a_SCHEDULE = "nrldc_pg.shdl.pseb_s.mw/rate=10" //a_ODUD = "nrldc_pg.line.pseb_od_ud.mw/rate=10" //a_LOAD ="nrldc_pg.ld.pseb_load.mw/rate=10" //a_CURRENTTIME = "nrldc_pg.line.pseb_drwl.mw/rate=10"
[ "40257916+pstcl@users.noreply.github.com" ]
40257916+pstcl@users.noreply.github.com
6e3e5b729805080785e04eb854602d0549836740
fea6437008402efd0a349d516a3f6f9380aaa288
/search/src/main/java/com/oneops/search/msg/processor/RelationMessageProcessor.java
76e6e4b3631e17ed19e4bc6828e3b901b81cea17
[ "Apache-2.0" ]
permissive
maniacs-oss/oneops
4d956d749bf372f9327f007c9b670b05c01919c8
3089dd370a393e5dc1b2e4cad61b4c7e372ba711
refs/heads/master
2021-01-25T06:06:55.311400
2017-06-05T23:01:35
2017-06-05T23:01:35
93,527,122
1
0
null
2017-06-06T14:23:32
2017-06-06T14:23:32
null
UTF-8
Java
false
false
7,255
java
package com.oneops.search.msg.processor; /******************************************************************************* * * Copyright 2015 Walmart, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * *******************************************************************************/ import com.oneops.cms.cm.domain.CmsCIRelation; import com.oneops.cms.simple.domain.CmsCIRelationSimple; import com.oneops.cms.util.CmsUtil; import com.oneops.search.domain.CmsCISearch; import com.oneops.search.msg.index.Indexer; import org.apache.log4j.Logger; import org.elasticsearch.action.get.GetResponse; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchType; import org.elasticsearch.client.Client; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.search.SearchHit; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service public class RelationMessageProcessor implements MessageProcessor { private Logger logger = Logger.getLogger(this.getClass()); @Autowired private CmsUtil cmsUtil; @Autowired private Indexer indexer; @Autowired private Client client; @Override public void processMessage(String message, String msgType, String msgId) { try { Thread.sleep(3000);//wait for CI events to get processed } catch (InterruptedException ignore) { } CmsCIRelationSimple relation = cmsUtil.custCIRelation2CIRelationSimple(GSON.fromJson(message, CmsCIRelation.class), "df", false); relation = processRelationMsg(relation, indexer.getIndexName()); String releaseMsg = GSON_ES.toJson(relation); indexer.indexEvent("relation", releaseMsg); indexer.index(String.valueOf(relation.getCiRelationId()), "relation", releaseMsg); } private CmsCIRelationSimple processRelationMsg(CmsCIRelationSimple relation, String index) { CmsCISearch fromCI = fetchCI(index, String.valueOf(relation.getFromCiId())); if (fromCI != null) { relation.setFromCi(fromCI); } CmsCISearch toCI = fetchCI(index, String.valueOf(relation.getToCiId())); if (toCI != null) { relation.setToCi(toCI); } return relation; } private CmsCISearch fetchCI(String index, String ciId) { GetResponse response = client.prepareGet(index, "ci", String.valueOf(ciId)) .execute() .actionGet(); if (response.getSourceAsString() == null || response.getSourceAsString().isEmpty()) { return null; } CmsCISearch ci = GSON_ES.fromJson(response.getSourceAsString(), CmsCISearch.class); if (ci.getWorkorder() != null) { ci.setWorkorder(null); } if (ci.getOps() != null) { ci.setOps(null); } return ci; } /** * @param ciMsg */ void processRelationForCi(String ciMsg) { CmsCISearch ci = GSON_ES.fromJson(ciMsg, CmsCISearch.class); SearchResponse scrollResp = client.prepareSearch(indexer.getIndexName()) .setSearchType(SearchType.SCAN) .setTypes("relation") .setScroll(new TimeValue(60000)) .setQuery(QueryBuilders.termQuery("fromCiId", ci.getCiId())) .setSize(100).execute().actionGet(); //Scroll until no hits are returned while (true) { for (SearchHit hit : scrollResp.getHits()) { CmsCIRelationSimple relation = GSON_ES.fromJson(hit.getSourceAsString(), CmsCIRelationSimple.class); relation.setFromCi(ci); indexer.index(String.valueOf(relation.getCiRelationId()), "relation", GSON_ES.toJson(relation)); } scrollResp = client.prepareSearchScroll(scrollResp.getScrollId()).setScroll(new TimeValue(600000)).execute().actionGet(); //Break condition: No hits are returned if (scrollResp.getHits().getHits().length == 0) { break; } } scrollResp = client.prepareSearch(indexer.getIndexName()) .setSearchType(SearchType.SCAN) .setTypes("relation") .setScroll(new TimeValue(60000)) .setQuery(QueryBuilders.termQuery("toCiId", ci.getCiId())) .setSize(100).execute().actionGet(); //Scroll until no hits are returned while (true) { for (SearchHit hit : scrollResp.getHits()) { CmsCIRelationSimple relation = GSON_ES.fromJson(hit.getSourceAsString(), CmsCIRelationSimple.class); relation.setToCi(ci); indexer.index(String.valueOf(relation.getCiRelationId()), "relation", GSON_ES.toJson(relation)); } scrollResp = client.prepareSearchScroll(scrollResp.getScrollId()).setScroll(new TimeValue(600000)).execute().actionGet(); //Break condition: No hits are returned if (scrollResp.getHits().getHits().length == 0) { break; } } } public void processRelationDeleteMsg(String ciId) { logger.info("Deleting from/to relations for ciId " + ciId); //Fetch and delete relation for given fromCI fetchAndDeleteRecords("fromCiId", ciId); //Fetch and delete relation for given toCI fetchAndDeleteRecords("toCiId", ciId); } /** */ private void fetchAndDeleteRecords(String field, String ciId) { SearchResponse scrollResp = client.prepareSearch(indexer.getIndexName()) .setSearchType(SearchType.SCAN) .setTypes("relation") .setScroll(new TimeValue(60000)) .setQuery(QueryBuilders.termQuery(field, ciId)) .setSize(100).execute().actionGet(); //100 hits per shard will be returned for each scroll //Scroll until no hits are returned while (true) { for (SearchHit hit : scrollResp.getHits()) { indexer.getTemplate().delete(indexer.getIndexName(), "relation", String.valueOf(hit.getId())); logger.info("Deleted message with id::" + hit.getId() + " and type::relation" + " from ES for " + field + " " + ciId); } scrollResp = client.prepareSearchScroll(scrollResp.getScrollId()).setScroll(new TimeValue(600000)).execute().actionGet(); //Break condition: No hits are returned if (scrollResp.getHits().getHits().length == 0) { break; } } } }
[ "kornev@gmail.com" ]
kornev@gmail.com