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
5b5abfdf7b7b2290030bbdb89aa77e1652341d32
8ce089992ea00e7bdc2fb9d6e65e01dfe41c2cf2
/src/main/java/com/example/role/validation/definition/RoleDefinitionUniqueRoleNameValidator.java
72612586d41c6e943792caf264e45040484a6aea
[ "MIT" ]
permissive
DanailMinchev/spring-boot-auth
36c9f620758565e4de89ee96d22c155f4686f45b
515a64562e8248fe96fd5d1e96273125cb096b65
refs/heads/master
2020-06-26T01:56:08.768505
2016-11-23T19:32:17
2016-11-23T19:32:17
74,607,119
0
0
null
null
null
null
UTF-8
Java
false
false
241
java
package com.example.role.validation.definition; public interface RoleDefinitionUniqueRoleNameValidator { public String getId(); public void setId(String id); public String getName(); public void setName(String name); }
[ "DanailMinchev@users.noreply.github.com" ]
DanailMinchev@users.noreply.github.com
54747fb3687439636c9f3166f8289c0c46373a26
59e72d05e54c7c2f1a5be8ce285ba9c754f9efbe
/javaee-tutorial/examples/case-studies/dukes-tutoring/dukes-tutoring-common/src/dukestutoring/entity/TutoringSession.java
034385c2a863eb77194e6767242edc5596d79b15
[ "BSD-3-Clause-No-Nuclear-License-2014" ]
permissive
niceguynobrain/Java-EE
82ced9ddfa65f6f6118f18ddaaa66002038467be
91b52b01bedcfd664eb4793573f0b785412546b6
refs/heads/master
2021-01-10T07:09:26.744208
2016-03-09T01:59:46
2016-03-09T01:59:46
52,047,875
0
0
null
null
null
null
UTF-8
Java
false
false
3,469
java
/* * Copyright 2012 Oracle and/or its affiliates. * All rights reserved. You may not modify, use, * reproduce, or distribute this software except in * compliance with the terms of the License at: * http://developers.sun.com/license/berkeley_license.html */ /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package dukestutoring.entity; import dukestutoring.util.CalendarUtil; import java.io.Serializable; import java.util.ArrayList; import java.util.Calendar; import java.util.List; import javax.persistence.*; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlTransient; /** * * @author ian */ @Entity @NamedQueries({ @NamedQuery(name = "TutoringSession.findByDate",query = "SELECT DISTINCT t " + "FROM TutoringSession t " + "WHERE t.sessionDate = :date ") }) @XmlRootElement(name = "TutoringSession") @XmlAccessorType(XmlAccessType.FIELD) public class TutoringSession implements Serializable { private static final long serialVersionUID = 1L; @Temporal(value = javax.persistence.TemporalType.DATE) private Calendar sessionDate; @OneToMany(mappedBy = "tutoringSession", cascade = CascadeType.ALL) private List<StatusEntry> statusEntries; @XmlTransient @ManyToMany() private List<Student> students; @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; public TutoringSession() { Calendar cal = Calendar.getInstance(); CalendarUtil.stripTime(cal); this.setSessionDate(cal); this.students = new ArrayList<Student>(); } public Long getId() { return id; } public void setId(Long id) { this.id = id; } @Override public int hashCode() { int hash = 0; hash += ((id != null) ? id.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof TutoringSession)) { return false; } TutoringSession other = (TutoringSession) object; if (((this.id == null) && (other.id != null)) || ((this.id != null) && !this.id.equals(other.id))) { return false; } return true; } @Override public String toString() { return "dukestutoring.entity.Session[id=" + id + "]"; } /** * @return the students */ public List<Student> getStudents() { return students; } /** * @param students the students to set */ public void setStudents(List<Student> students) { this.setStudents(students); } /** * @return the statusEntries */ public List<StatusEntry> getStatusEntries() { return statusEntries; } /** * @param statusEntries the statusEntries to set */ public void setStatusEntries(List<StatusEntry> statusEntries) { this.statusEntries = statusEntries; } /** * @return the sessionDate */ public Calendar getSessionDate() { return sessionDate; } /** * @param sessionDate the sessionDate to set */ public void setSessionDate(Calendar sessionDate) { this.sessionDate = sessionDate; } }
[ "NICEGUYNOBRAIN@HOTMAIL.COM" ]
NICEGUYNOBRAIN@HOTMAIL.COM
cc60efae961bb3ce09f376acf5d28565f6f50f28
b1e28b66bf9eda815afc2f5efa46fd4619dc18a9
/src/lab04/lab04.java
ce8d83f46da6af73a11c435ffc74ec880934daf0
[]
no_license
ronaldsin/csci2020u
953dd078835bc19be4f59602d9aa556d2e64260e
844fa471d113ecad238ac22f6f87d76fb02ac525
refs/heads/master
2020-12-11T18:07:17.797565
2020-03-11T00:20:08
2020-03-11T00:20:08
233,919,808
0
0
null
null
null
null
UTF-8
Java
false
false
3,612
java
package lab04; import javafx.application.Application; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.geometry.Insets; import javafx.scene.Scene; import javafx.scene.control.*; import javafx.scene.layout.GridPane; import javafx.stage.Stage; public class lab04 extends Application { public static void main(String[] args) { launch(args); } @Override public void start(Stage primaryStage) { GridPane main = new GridPane(); main.setPadding(new Insets(11, 300, 75, 11 )); main.setHgap(10); main.setVgap(5); Label usernameLabel = new Label("Username:"); main.setConstraints(usernameLabel, 0, 0); TextField usernameTextField = new TextField (); usernameTextField.setPromptText("Please enter your username:"); main.setConstraints(usernameTextField, 1, 0); Label passwordLabel = new Label("Password:"); main.setConstraints(passwordLabel, 0, 1); PasswordField passwordField = new PasswordField (); passwordField.setPromptText("Please enter your password:"); main.setConstraints(passwordField, 1, 1); Label fullnameLabel = new Label("Full Name:"); main.setConstraints(fullnameLabel, 0, 2); TextField fullnameTextField = new TextField (); fullnameTextField.setPromptText("Please enter your full name:"); main.setConstraints(fullnameTextField, 1, 2); Label emailLabel = new Label("E-Mail:"); main.setConstraints(emailLabel, 0, 3); TextField emailTextField = new TextField (); emailTextField.setPromptText("Please enter your E-Mail: "); main.setConstraints(emailTextField, 1, 3); Label phonenumLabel = new Label("Phone #:"); main.setConstraints(phonenumLabel, 0, 4); TextField phonenumTextField = new TextField (); phonenumTextField.setPromptText("Please enter your phone number: "); main.setConstraints(phonenumTextField, 1, 4); Label birthdayLabel = new Label("Date of Birth:"); birthdayLabel.setMinWidth(75); main.setConstraints(birthdayLabel, 0, 5); DatePicker birthdayDatePicker = new DatePicker(); birthdayDatePicker.setPromptText("Please enter your birthday: "); main.setConstraints(birthdayDatePicker, 1, 5); Button btReg = new Button("Register"); main.setConstraints(btReg, 1, 7); btReg.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { System.out.println("Username: " + usernameTextField.getText()); System.out.println("Password: " + passwordField.getText()); System.out.println("Full name: " + fullnameTextField.getText()); System.out.println("Phone number: " + phonenumTextField.getText()); System.out.println("Birthday: " + birthdayDatePicker.getValue()); } }); main.getChildren().addAll(usernameLabel, usernameTextField); main.getChildren().addAll(passwordLabel, passwordField); main.getChildren().addAll(fullnameLabel, fullnameTextField); main.getChildren().addAll(emailLabel, emailTextField); main.getChildren().addAll(phonenumLabel, phonenumTextField); main.getChildren().addAll(birthdayLabel, birthdayDatePicker); main.getChildren().add(btReg); Scene scene = new Scene(main); primaryStage.setScene(scene); primaryStage.setTitle("Lab 04 Solution"); primaryStage.show(); } }
[ "ronald.sin@ontariotechu.net" ]
ronald.sin@ontariotechu.net
f8ff296223c179c17aef2496e6d952ecc034a067
3b91cf8523c8aec0aff0ace8ca06ee1286da64f1
/starter-spring-demo/src/main/java/com/wk/study/demo/fristdemo/ConfigDemo.java
78c7b11df31b181e859d6ae76c25ed77acfd7c7a
[]
no_license
Numberonekai/study
92981b5c369555eed246d3f3668e3866cad79664
6d33fb51b987af7b55d4520e9d774027d86b579f
refs/heads/master
2023-06-21T07:06:10.200669
2019-12-27T13:09:36
2019-12-27T13:09:36
196,342,988
0
0
null
2023-06-13T22:53:46
2019-07-11T07:30:44
Java
UTF-8
Java
false
false
441
java
package com.wk.study.demo.fristdemo; import org.springframework.beans.factory.annotation.Configurable; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Lazy; /** * @auther: kai2.wang * @date: 2019/10/10 11:06 * @description: * @version: 1.0 */ @Configurable public class ConfigDemo { @Bean @Lazy public TestService testService(){ return new TestService(); } }
[ "kai2.wang@zhaopin.com.cn" ]
kai2.wang@zhaopin.com.cn
b30b404b045f36ae3085e9b8dcc9783b8d6d5f8f
b4c3c34ef1c97e718c30dbda9388b00719b2e772
/src/main/java/com/zonekey/disrec/dao/DeviceMapper.java
a3816e49cbd37ea7cb4698d73e7578f65bc25d69
[]
no_license
github188/disrec
1c7524c50b5bbcaa42ac905f77a75be23f5496fa
90f9f5e1e323510988ecd70e3f752a23f513d3c9
refs/heads/master
2021-01-15T12:54:06.667298
2015-10-21T08:18:13
2015-10-21T08:18:13
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,657
java
/***************************** * Copyright (c) 2014 by Zonekey Co. Ltd. All rights reserved. ****************************/ package com.zonekey.disrec.dao; import java.util.List; import java.util.Map; import org.apache.ibatis.annotations.Param; import com.zonekey.disrec.dao.base.BaseMapper; import com.zonekey.disrec.dao.base.MyBatisRepository; import com.zonekey.disrec.vo.AreaView; import com.zonekey.disrec.vo.DeviceView; import com.zonekey.disrec.vo.PageBean; /** * @Title: @{#} DeviceMapper.java * @Description: <p>通过@MapperScannerConfigurer扫描目录中的所有接口, 动态在Spring Context中生成实现.方法名称必须与Mapper.xml中保持一致.</p> * @author <a href="mailto:cuiwx@zonekey.com.cn">cuiwx</a> * @date 2014年9月20日 下午7:37:47 * @version v 1.0 */ @MyBatisRepository public interface DeviceMapper extends BaseMapper<DeviceView, String> { public List<DeviceView> findByPage(PageBean pageBean); public List<Map<String,Object>> findByAreaId(Map<String,Object> map); public List<Map<String,Object>> findDevice(Map<String,Object> map); public long count(PageBean pageBean); public int delete(Map<String,Object> map); public int deleteBy(AreaView areaView); public int checkMac(DeviceView deviceView); public int checkType(DeviceView deviceView); public DeviceView findDeviceByMac(@Param("mac")String mac); public String getMacById(Map<String,Object> map); public List<Map<String,String>> getMacByInnerId(@Param("innerids")List<String> innerids,@Param("typeid")String typeid); public DeviceView getDeviceView(String areaId); public List<DeviceView> findDeviceControl(Map<String, Object> map); }
[ "jeanwinhuang@live.com" ]
jeanwinhuang@live.com
8c1d20fab19ad968bca2bf7f987d3bd31cb122df
7fc4834429fc2e1fe5d1387ee7cccf81270d23d0
/HvtApp/app/src/main/java/application/haveri/tourism/data/model/api/response/haveri_data/MediaGallery.java
cc071d4ba8a2cd445d2d8353b5b8ae51c6ee7b28
[]
no_license
satishru/satishru-Haveri-App-Latest-2020
bef50ff1ffa5740e7f537d63a620c242fb3fe980
278d01c28ef2354bfe1e7db4b145a1dbc7641f80
refs/heads/master
2022-11-13T15:58:01.861327
2020-07-01T05:43:05
2020-07-01T05:43:05
275,434,792
0
0
null
null
null
null
UTF-8
Java
false
false
1,008
java
package application.haveri.tourism.data.model.api.response.haveri_data; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; import java.io.Serializable; import java.util.ArrayList; import java.util.List; public class MediaGallery implements Serializable { @SerializedName("images") @Expose private List<Images> imagesData = null; @SerializedName("videos") @Expose private List<Videos> videosData = null; public List<Images> getImagesData() { if(imagesData == null) { imagesData = new ArrayList<>(); } return imagesData; } public void setImagesData(List<Images> imagesData) { this.imagesData = imagesData; } public List<Videos> getVideosData() { if(videosData == null) { videosData = new ArrayList<>(); } return videosData; } public void setVideosData(List<Videos> videosData) { this.videosData = videosData; } }
[ "ujjammanavar.satish@gmail.com" ]
ujjammanavar.satish@gmail.com
0f469534926308a933ec1fe5b3f5bac20d7d59b1
281a94e26bc3c8ea4394305c0ee1f2c9fd8cbf04
/src/main/java/codetop/leetcode/editor/cn/[14]最长公共前缀.java
77c9898eb9f73f6c3bda7401d268ebe2aa1b44cc
[]
no_license
phuijiao/leetcode
b90402b5cd67d764b9e306e9dd774bec571ecc64
b074446fe97c84fe673369350ce17b46478d7af8
refs/heads/main
2023-07-31T16:53:59.506158
2021-09-18T07:36:04
2021-09-18T07:36:04
341,054,603
0
1
null
null
null
null
UTF-8
Java
false
false
1,331
java
//编写一个函数来查找字符串数组中的最长公共前缀。 // // 如果不存在公共前缀,返回空字符串 ""。 // // // // 示例 1: // // //输入:strs = ["flower","flow","flight"] //输出:"fl" // // // 示例 2: // // //输入:strs = ["dog","racecar","car"] //输出:"" //解释:输入不存在公共前缀。 // // // // 提示: // // // 1 <= strs.length <= 200 // 0 <= strs[i].length <= 200 // strs[i] 仅由小写英文字母组成 // // Related Topics 字符串 // 👍 1736 👎 0 package codetop.leetcode.editor.cn; import java.util.Arrays; /** * @author phuijiao * @date 2021-08-21 11:39:43 */ class LongestCommonPrefix { public static void main(String[] args) { Solution solution = new Solution(); } private static //leetcode submit region begin(Prohibit modification and deletion) class Solution { public String longestCommonPrefix(String[] strs) { int len = strs.length; if (len == 1) { return strs[0]; } Arrays.sort(strs); for (int i = 0; i < strs[0].length(); i++) { if (strs[0].charAt(i) != strs[len - 1].charAt(i)) { return strs[0].substring(0, i); } } return strs[0]; } } //leetcode submit region end(Prohibit modification and deletion) }
[ "phuijiao@163.com" ]
phuijiao@163.com
533b38f419faf6d033af0e35bb324818572e7580
084b587332dabc83ce894a69adf51e0d17bf37c5
/weimeng-lbd-soa-provder-server/src/main/java/com/weimob/arch/demo/service/biz/PartnerBizService.java
08c43239a8038ff6e88a092fec527b79fa5054eb
[]
no_license
maderjlbd/weimeng-lbd-soa-provder-parent
2873eb95a3ba31d5699247df006653ec5488a30b
4f2ad67f2b8f05c94af3de076426314c744266c0
refs/heads/master
2021-01-24T08:08:30.611187
2017-06-05T07:49:57
2017-06-05T07:49:57
93,377,688
0
0
null
null
null
null
UTF-8
Java
false
false
83
java
package com.weimob.arch.demo.service.biz; public interface PartnerBizService { }
[ "kjgzefncd@876" ]
kjgzefncd@876
703af10da646e7ebc9f6a373bd2606d5ab3497cf
826aee6e9b6d74b08a4069c2e4fb7b66f93b90e7
/src/tw/com/entity/DeletionsPending.java
c0f786a259b6df96d10d85b641b73bd9c4d375fc
[ "Apache-2.0" ]
permissive
cartwrightian/cfnassist
d913b5d57e74a0afe48cf4167a6360d20de077d6
9b7c4e568f2b03ebf799f884293c0484526a0332
refs/heads/master
2023-02-06T02:49:19.552496
2022-03-30T14:56:27
2022-03-30T14:56:27
13,739,399
18
7
Apache-2.0
2023-01-30T04:13:12
2013-10-21T10:33:58
Java
UTF-8
Java
false
false
2,798
java
package tw.com.entity; import java.util.Collections; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import tw.com.SetsDeltaIndex; import tw.com.exceptions.CannotFindVpcException; public class DeletionsPending implements Iterable<DeletionPending> { private static final Logger logger = LoggerFactory.getLogger(DeletionsPending.class); @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((deleted == null) ? 0 : deleted.hashCode()); result = prime * result + ((items == null) ? 0 : items.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; DeletionsPending other = (DeletionsPending) obj; if (deleted == null) { if (other.deleted != null) return false; } else if (!deleted.equals(other.deleted)) return false; if (items == null) { if (other.items != null) return false; } else if (!items.equals(other.items)) return false; return true; } @Override public String toString() { return "DeletionsPending [items=" + items + "]"; } LinkedList<DeletionPending> items; LinkedList<DeletionPending> deleted; public DeletionsPending() { items = new LinkedList<DeletionPending>(); deleted = new LinkedList<DeletionPending>(); } public void add(int delta, StackNameAndId stackId) { DeletionPending item = new DeletionPending(delta, stackId); items.add(item); } @Override public Iterator<DeletionPending> iterator() { Collections.sort(items); return items.iterator(); } public void markIdAsDeleted(String stackId) { for(DeletionPending item : items) { StackNameAndId itemStackId = item.getStackId(); if (itemStackId.getStackId().equals(stackId)) { logger.info(String.format("Matched stackid %s, marking stack as deleted", stackId)); deleted.add(item); return; } } } public boolean hasMore() { return deleted.size()<items.size(); } public void updateDeltaIndex(SetsDeltaIndex setsDeltaIndex) throws CannotFindVpcException { if (deleted.size()==0) { logger.warn("Failed to delete any stacks"); return; } int lowest = deleted.get(0).getDelta()-1; for(DeletionPending update : deleted) { int delta = update.getDelta()-1; if (delta<lowest) { lowest=delta; } } logger.info(String.format("Updating delta index to %s", lowest)); setsDeltaIndex.setDeltaIndex(lowest); } public List<String> getNamesOfDeleted() { List<String> names = new LinkedList<String>(); for(DeletionPending update : deleted) { names.add(update.getStackId().getStackName()); } return names; } }
[ "icartwright@thoughtworks.com" ]
icartwright@thoughtworks.com
b8ddb7b866213454f76cd71201688f073371b84d
48bb621d03678998b7891352cb30e59c9032bb91
/Lab4/Coin.java
bf3ad3762e9ca19d35405d0cd8fe383e1578b50e
[]
no_license
jay-CS/CECS277_Assignments
3dd91bba2e40a7cee7d9d60d8cee8894f131705a
2b883ac020d5469fa7c3b1ac756d7472e6f295e6
refs/heads/master
2020-03-20T12:29:50.101663
2019-09-28T20:06:37
2019-09-28T20:06:37
137,431,785
0
0
null
null
null
null
UTF-8
Java
false
false
637
java
public class Coin { //name of the string private String name; //Value of coin private double value; /** * Initializes instance variables */ public Coin() { name = " "; value = 0.0; } /** * Sets instance variables * @param name, name of the coin * @param val, value of the coin */ public Coin(String name, double val) { this.name = name; value = val; } /** * Gets the value of the coin * @return value, the value of the coin */ public double getVal() { return value; } /** * Returns the coin and value as a string */ public String toString() { return name + " @ " + value; } }
[ "noreply@github.com" ]
noreply@github.com
9bd83d95d89156f3e08bd8bf292e7598a96f2b22
4e3a5e6953a74110cbf3ac1f92c982dcea82b92a
/src/leetcode/Main1893.java
fe9ab0d3023e998a4f775cdc2506574f39c48211
[ "Apache-2.0" ]
permissive
Felix-xhf/Data-structure-and-algorithm
bf038af1ef04f8a36e58933b89ec39fba4e9dd98
5151224ee6e9800b1747aa30eecbba900a629f79
refs/heads/main
2023-07-04T06:31:44.939175
2021-08-09T07:10:50
2021-08-09T07:10:50
388,695,083
3
0
Apache-2.0
2021-08-06T02:42:24
2021-07-23T06:07:47
Java
UTF-8
Java
false
false
1,668
java
package leetcode; import java.util.HashSet; import java.util.Set; /* * @program:Exer * * @author: Felix_XHF * * @create:2021-07-23 19:49 */ public class Main1893 { public boolean isCovered1(int[][] ranges, int left, int right) { Set<Integer> set = new HashSet<>(); for (int[] range : ranges) { for (int j = range[0]; j <= range[1]; j++) { set.add(j); } } for (int i = left; i <=right; i++) { if (set.add(i)){ return false; } } return true; } public boolean isCovered(int[][] ranges, int left, int right) { int[] temp = merge(ranges[0],ranges[1]); int count = 2; while (count<ranges.length){ temp = merge(temp,ranges[count]); count++; } return temp[0] <=left && temp[1] >= right; } private int[] merge(int[] arr1,int[] arr2){ int left; int right; if (arr1[0] < arr2[0]){ left = arr1[0]; }else{ left = arr2[0]; } if (arr1[1] > arr2[1]){ right = arr1[1]; }else { right = arr2[1]; } System.out.println(right); System.out.println(left); return new int[]{left,right}; } public static void main(String[] args) { Main1893 main1893 = new Main1893(); int[][] ints = new int[3][2]; ints[0] = new int[]{1,2}; ints[1] = new int[]{3,4}; ints[2] = new int[]{5,6}; boolean covered = main1893.isCovered1(ints, 2, 5); System.out.println(covered); } }
[ "1465662738@qq.com" ]
1465662738@qq.com
b4e8a730ed4799b5a16e1c1d97676ff0c8e5c1d1
c9b085b4d5bc10dcd2cd50651233c9a9813e011f
/src/factura/Localidad.java
9fa452b778ff5d79a51f98abaccf8938f533806b
[]
no_license
RoRinaldi/CAECE
4e4032ba0100aa9bbb43ac00275f393ddfb40dcb
333503e1b40899f96b1ab0710018af33b3e84bd4
refs/heads/master
2020-06-24T11:28:24.129650
2017-07-11T20:21:01
2017-07-11T20:21:01
96,933,467
0
0
null
null
null
null
UTF-8
Java
false
false
656
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 factura; /** * * @author alumno */ public class Localidad { private String nombre; private Partido partido; public String getNombre() { return nombre; } public void setNombre(String nombre) { this.nombre = nombre; } public Partido getPartido() { return partido; } public void setPartido(Partido partido) { this.partido = partido; } }
[ "noreply@github.com" ]
noreply@github.com
920bb4f20d43b98b738e8596b12e8ba44aaeb32a
94868c3888e0dfd3cf8dd36bbde97e6ec8bfd96f
/src/sample/User/Database/Const.java
5b2b504d88c3d18ab363a40e4cc19ca49d11627f
[]
no_license
AlarikaRoderick/course_project_saipis
a68199b6022eea49919d0b0b3b83abd13a9ba0d7
7b10393960652c22ce9764eec4b961908e36caeb
refs/heads/master
2020-03-30T06:52:12.879047
2018-09-29T19:09:53
2018-09-29T19:09:53
150,895,225
0
0
null
null
null
null
UTF-8
Java
false
false
276
java
package sample.User.Database; public class Const { public static final String USER_TABLE = "user"; public static final String USER_ID = "idUsers"; public static final String USER_USERNAME = "UserName"; public static final String USER_PASSWORD = "Password"; }
[ "lena.rodevich@gmail.com" ]
lena.rodevich@gmail.com
e10b687e48ab9d6490f62bf4de326e6b8d8b2041
124df74bce796598d224c4380c60c8e95756f761
/com.raytheon.uf.common.datadelivery.service/src/com/raytheon/uf/common/datadelivery/service/BaseSubscriptionNotificationRequest.java
3670927e413e5d575871fb51d65b5b6f1145db6d
[]
no_license
Mapoet/AWIPS-Test
19059bbd401573950995c8cc442ddd45588e6c9f
43c5a7cc360b3cbec2ae94cb58594fe247253621
refs/heads/master
2020-04-17T03:35:57.762513
2017-02-06T17:17:58
2017-02-06T17:17:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,820
java
/** * This software was developed and / or modified by Raytheon Company, * pursuant to Contract DG133W-05-CQ-1067 with the US Government. * * U.S. EXPORT CONTROLLED TECHNICAL DATA * This software product contains export-restricted data whose * export/transfer/disclosure is restricted by U.S. law. Dissemination * to non-U.S. persons whether in the United States or abroad requires * an export license or other authorization. * * Contractor Name: Raytheon Company * Contractor Address: 6825 Pine Street, Suite 340 * Mail Stop B8 * Omaha, NE 68106 * 402.291.0100 * * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. **/ package com.raytheon.uf.common.datadelivery.service; import com.raytheon.uf.common.datadelivery.registry.Subscription; import com.raytheon.uf.common.serialization.ISerializableObject; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; import com.raytheon.uf.common.serialization.comm.IServerRequest; /** * Base abstract class for the subscription notification request. * * <pre> * * SOFTWARE HISTORY * * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Sep 20, 2012 1157 mpduff Initial creation * * </pre> * * @author mpduff * @version 1.0 */ @DynamicSerialize public abstract class BaseSubscriptionNotificationRequest<T extends Subscription> implements IServerRequest, ISerializableObject { @DynamicSerializeElement private String message; @DynamicSerializeElement private String userId; @DynamicSerializeElement private T subscription; @DynamicSerializeElement private String category; @DynamicSerializeElement private int priority; public void setMessage(String message) { this.message = message; } public String getMessage() { return this.message; } public void setUserId(String userId) { this.userId = userId; } public String getUserId() { return this.userId; } public T getSubscription() { return this.subscription; } public void setSubscription(T subscription) { this.subscription = subscription; } public String getCategory() { return this.category; } public void setCategory(String category) { this.category = category; } public void setPriority(int priority) { this.priority = priority; } public int getPriority() { return this.priority; } public abstract BaseSubscriptionNotificationResponse<T> getResponse(); }
[ "joshua.t.love@saic.com" ]
joshua.t.love@saic.com
b1d9f86b23875417e98c2e8570e25951216fd2db
15fc18917d4c25e180d0fc8a3ec36cfb04b3645b
/src/com/action/UserSignUpAction.java
d502ec01a937b13184763682afa286f2df3b28d7
[ "MIT" ]
permissive
Neutree/j2ee-ssh-study
55fb84351bfa833ea48c377d857b27b39674c671
ae8ecf87f5f74f98cc22869b94be3df1348b6b41
refs/heads/master
2016-08-12T16:02:11.813468
2015-11-06T08:24:11
2015-11-06T08:24:11
45,536,581
0
0
null
null
null
null
UTF-8
Java
false
false
1,479
java
package com.action; import java.util.Map; import javax.servlet.http.HttpServletRequest; import org.apache.struts2.ServletActionContext; import com.model.Userlist; import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.ActionSupport; import com.service.UserManager; import com.service.UserManagerImpl; public class UserSignUpAction extends ActionSupport{ /** * */ private static final long serialVersionUID = -2997250919777519138L; private String userName; private String passWord; private String passWord2; private UserManagerImpl userManamger; public UserManagerImpl getUserManamger() { return userManamger; } public void setUserManamger(UserManagerImpl userManamger) { this.userManamger = userManamger; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public String getPassWord() { return passWord; } public void setPassWord(String passWord) { this.passWord = passWord; } public String getPassWord2() { return passWord2; } public void setPassWord2(String passWord2) { this.passWord2 = passWord2; } @Override public String execute() throws Exception { if(passWord.equals(passWord2)&&!passWord.equals("")) { if(! userManamger.save(new Userlist(userName, passWord))) return "error"; return "success"; } else return "error"; } }
[ "czd666666@gmail.com" ]
czd666666@gmail.com
b748ebf714699c85ba916737bc4d1316e663ccd9
7fce45def65c721a56baf9950859afdaa1fc9dda
/app/src/main/java/my/studentguide/android/olevelemath/MainActivity.java
c55aa0a8d47b2009923bc05bfa3a13cccc90a1cb
[]
no_license
irvintingsieze/OlevelEMath
694dbeb710a9ceae08da2d025db133355e6e3ca8
8e9bc4a58d23f209114b269be2fab7aa9a5dea1f
refs/heads/master
2022-12-28T12:35:04.280843
2020-10-10T20:17:11
2020-10-10T20:17:11
302,933,836
0
0
null
null
null
null
UTF-8
Java
false
false
1,565
java
package my.studentguide.android.olevelemath; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.view.Window; import my.studentguide.android.olevelemath.Secondary3.sec3_topics_learn; import my.studentguide.android.olevelemath.Secondary4.sec4_topics_learn; public class MainActivity extends AppCompatActivity { @Override public void onWindowFocusChanged(boolean hasFocus) { super.onWindowFocusChanged(hasFocus); View decorView = getWindow().getDecorView(); if (hasFocus) { decorView.setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); } } @Override protected void onCreate(Bundle savedInstanceState) { this.requestWindowFeature(Window.FEATURE_NO_TITLE); super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } public void sec3Selection(View view){ Intent i = new Intent(this, sec3_topics_learn.class); startActivity(i); } public void sec4Selection(View view){ Intent i = new Intent(this, sec4_topics_learn.class); startActivity(i); } }
[ "iting@e.ntu.edu.sg" ]
iting@e.ntu.edu.sg
813625562522f1db2766fc7f5c58ef8459220519
8af1164bac943cef64e41bae312223c3c0e38114
/results-java/aosp-mirror--platform_frameworks_base/29564cd24589867f653cd22cabbaac6493cfc530/after/ContextImpl.java
129fa89c20a86f9d12115bf3d25e0ab7b4c9ebb5
[]
no_license
fracz/refactor-extractor
3ae45c97cc63f26d5cb8b92003b12f74cc9973a9
dd5e82bfcc376e74a99e18c2bf54c95676914272
refs/heads/master
2021-01-19T06:50:08.211003
2018-11-30T13:00:57
2018-11-30T13:00:57
87,353,478
0
0
null
null
null
null
UTF-8
Java
false
false
97,243
java
/* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.app; import android.app.usage.IUsageStatsManager; import android.app.usage.UsageStatsManager; import android.appwidget.AppWidgetManager; import android.os.Build; import android.service.persistentdata.IPersistentDataBlockService; import android.service.persistentdata.PersistentDataBlockManager; import com.android.internal.appwidget.IAppWidgetService; import com.android.internal.policy.PolicyManager; import com.android.internal.util.Preconditions; import android.bluetooth.BluetoothManager; import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.ContentProvider; import android.content.ContentResolver; import android.content.Context; import android.content.ContextWrapper; import android.content.IContentProvider; import android.content.Intent; import android.content.IntentFilter; import android.content.IIntentReceiver; import android.content.IntentSender; import android.content.IRestrictionsManager; import android.content.ReceiverCallNotAllowedException; import android.content.RestrictionsManager; import android.content.ServiceConnection; import android.content.SharedPreferences; import android.content.pm.ApplicationInfo; import android.content.pm.ILauncherApps; import android.content.pm.IPackageManager; import android.content.pm.LauncherApps; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.res.AssetManager; import android.content.res.CompatibilityInfo; import android.content.res.Configuration; import android.content.res.Resources; import android.database.DatabaseErrorHandler; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase.CursorFactory; import android.graphics.Bitmap; import android.graphics.drawable.Drawable; import android.hardware.ConsumerIrManager; import android.hardware.ISerialManager; import android.hardware.SerialManager; import android.hardware.SystemSensorManager; import android.hardware.hdmi.HdmiControlManager; import android.hardware.hdmi.IHdmiControlService; import android.hardware.camera2.CameraManager; import android.hardware.display.DisplayManager; import android.hardware.input.InputManager; import android.hardware.usb.IUsbManager; import android.hardware.usb.UsbManager; import android.location.CountryDetector; import android.location.ICountryDetector; import android.location.ILocationManager; import android.location.LocationManager; import android.media.AudioManager; import android.media.MediaRouter; import android.media.projection.MediaProjectionManager; import android.media.session.MediaSessionManager; import android.media.tv.ITvInputManager; import android.media.tv.TvInputManager; import android.net.ConnectivityManager; import android.net.IConnectivityManager; import android.net.EthernetManager; import android.net.IEthernetManager; import android.net.INetworkPolicyManager; import android.net.NetworkPolicyManager; import android.net.NetworkScoreManager; import android.net.Uri; import android.net.nsd.INsdManager; import android.net.nsd.NsdManager; import android.net.wifi.IWifiManager; import android.net.wifi.WifiManager; import android.net.wifi.passpoint.IWifiPasspointManager; import android.net.wifi.passpoint.WifiPasspointManager; import android.net.wifi.p2p.IWifiP2pManager; import android.net.wifi.p2p.WifiP2pManager; import android.net.wifi.IWifiScanner; import android.net.wifi.WifiScanner; import android.net.wifi.IRttManager; import android.net.wifi.RttManager; import android.nfc.NfcManager; import android.os.BatteryManager; import android.os.Binder; import android.os.Bundle; import android.os.Debug; import android.os.DropBoxManager; import android.os.Environment; import android.os.FileUtils; import android.os.Handler; import android.os.IBinder; import android.os.IPowerManager; import android.os.IUserManager; import android.os.Looper; import android.os.PowerManager; import android.os.Process; import android.os.RemoteException; import android.os.ServiceManager; import android.os.UserHandle; import android.os.SystemVibrator; import android.os.UserManager; import android.os.storage.IMountService; import android.os.storage.StorageManager; import android.phone.PhoneManager; import android.print.IPrintManager; import android.print.PrintManager; import android.service.fingerprint.IFingerprintService; import android.service.fingerprint.FingerprintManager; import android.telecomm.TelecommManager; import android.telephony.TelephonyManager; import android.content.ClipboardManager; import android.util.AndroidRuntimeException; import android.util.ArrayMap; import android.util.Log; import android.util.Slog; import android.view.DisplayAdjustments; import android.view.ContextThemeWrapper; import android.view.Display; import android.view.WindowManagerImpl; import android.view.accessibility.AccessibilityManager; import android.view.accessibility.CaptioningManager; import android.view.inputmethod.InputMethodManager; import android.view.textservice.TextServicesManager; import android.accounts.AccountManager; import android.accounts.IAccountManager; import android.app.admin.DevicePolicyManager; import android.app.job.IJobScheduler; import android.app.trust.TrustManager; import com.android.internal.annotations.GuardedBy; import com.android.internal.app.IAppOpsService; import com.android.internal.os.IDropBoxManagerService; import com.android.internal.telecomm.ITelecommService; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.HashMap; class ReceiverRestrictedContext extends ContextWrapper { ReceiverRestrictedContext(Context base) { super(base); } @Override public Intent registerReceiver(BroadcastReceiver receiver, IntentFilter filter) { return registerReceiver(receiver, filter, null, null); } @Override public Intent registerReceiver(BroadcastReceiver receiver, IntentFilter filter, String broadcastPermission, Handler scheduler) { if (receiver == null) { // Allow retrieving current sticky broadcast; this is safe since we // aren't actually registering a receiver. return super.registerReceiver(null, filter, broadcastPermission, scheduler); } else { throw new ReceiverCallNotAllowedException( "BroadcastReceiver components are not allowed to register to receive intents"); } } @Override public Intent registerReceiverAsUser(BroadcastReceiver receiver, UserHandle user, IntentFilter filter, String broadcastPermission, Handler scheduler) { if (receiver == null) { // Allow retrieving current sticky broadcast; this is safe since we // aren't actually registering a receiver. return super.registerReceiverAsUser(null, user, filter, broadcastPermission, scheduler); } else { throw new ReceiverCallNotAllowedException( "BroadcastReceiver components are not allowed to register to receive intents"); } } @Override public boolean bindService(Intent service, ServiceConnection conn, int flags) { throw new ReceiverCallNotAllowedException( "BroadcastReceiver components are not allowed to bind to services"); } } /** * Common implementation of Context API, which provides the base * context object for Activity and other application components. */ class ContextImpl extends Context { private final static String TAG = "ContextImpl"; private final static boolean DEBUG = false; /** * Map from package name, to preference name, to cached preferences. */ private static ArrayMap<String, ArrayMap<String, SharedPreferencesImpl>> sSharedPrefs; final ActivityThread mMainThread; final LoadedApk mPackageInfo; private final IBinder mActivityToken; private final UserHandle mUser; private final ApplicationContentResolver mContentResolver; private final String mBasePackageName; private final String mOpPackageName; private final ResourcesManager mResourcesManager; private final Resources mResources; private final Display mDisplay; // may be null if default display private final DisplayAdjustments mDisplayAdjustments = new DisplayAdjustments(); private final Configuration mOverrideConfiguration; private final boolean mRestricted; private Context mOuterContext; private int mThemeResource = 0; private Resources.Theme mTheme = null; private PackageManager mPackageManager; private Context mReceiverRestrictedContext = null; private final Object mSync = new Object(); @GuardedBy("mSync") private File mDatabasesDir; @GuardedBy("mSync") private File mPreferencesDir; @GuardedBy("mSync") private File mFilesDir; @GuardedBy("mSync") private File mNoBackupFilesDir; @GuardedBy("mSync") private File mCacheDir; @GuardedBy("mSync") private File mCodeCacheDir; @GuardedBy("mSync") private File[] mExternalObbDirs; @GuardedBy("mSync") private File[] mExternalFilesDirs; @GuardedBy("mSync") private File[] mExternalCacheDirs; @GuardedBy("mSync") private File[] mExternalMediaDirs; private static final String[] EMPTY_FILE_LIST = {}; /** * Override this class when the system service constructor needs a * ContextImpl. Else, use StaticServiceFetcher below. */ /*package*/ static class ServiceFetcher { int mContextCacheIndex = -1; /** * Main entrypoint; only override if you don't need caching. */ public Object getService(ContextImpl ctx) { ArrayList<Object> cache = ctx.mServiceCache; Object service; synchronized (cache) { if (cache.size() == 0) { // Initialize the cache vector on first access. // At this point sNextPerContextServiceCacheIndex // is the number of potential services that are // cached per-Context. for (int i = 0; i < sNextPerContextServiceCacheIndex; i++) { cache.add(null); } } else { service = cache.get(mContextCacheIndex); if (service != null) { return service; } } service = createService(ctx); cache.set(mContextCacheIndex, service); return service; } } /** * Override this to create a new per-Context instance of the * service. getService() will handle locking and caching. */ public Object createService(ContextImpl ctx) { throw new RuntimeException("Not implemented"); } } /** * Override this class for services to be cached process-wide. */ abstract static class StaticServiceFetcher extends ServiceFetcher { private Object mCachedInstance; @Override public final Object getService(ContextImpl unused) { synchronized (StaticServiceFetcher.this) { Object service = mCachedInstance; if (service != null) { return service; } return mCachedInstance = createStaticService(); } } public abstract Object createStaticService(); } private static final HashMap<String, ServiceFetcher> SYSTEM_SERVICE_MAP = new HashMap<String, ServiceFetcher>(); private static int sNextPerContextServiceCacheIndex = 0; private static void registerService(String serviceName, ServiceFetcher fetcher) { if (!(fetcher instanceof StaticServiceFetcher)) { fetcher.mContextCacheIndex = sNextPerContextServiceCacheIndex++; } SYSTEM_SERVICE_MAP.put(serviceName, fetcher); } // This one's defined separately and given a variable name so it // can be re-used by getWallpaperManager(), avoiding a HashMap // lookup. private static ServiceFetcher WALLPAPER_FETCHER = new ServiceFetcher() { public Object createService(ContextImpl ctx) { return new WallpaperManager(ctx.getOuterContext(), ctx.mMainThread.getHandler()); }}; static { registerService(ACCESSIBILITY_SERVICE, new ServiceFetcher() { public Object getService(ContextImpl ctx) { return AccessibilityManager.getInstance(ctx); }}); registerService(CAPTIONING_SERVICE, new ServiceFetcher() { public Object getService(ContextImpl ctx) { return new CaptioningManager(ctx); }}); registerService(ACCOUNT_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { IBinder b = ServiceManager.getService(ACCOUNT_SERVICE); IAccountManager service = IAccountManager.Stub.asInterface(b); return new AccountManager(ctx, service); }}); registerService(ACTIVITY_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { return new ActivityManager(ctx.getOuterContext(), ctx.mMainThread.getHandler()); }}); registerService(ALARM_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { IBinder b = ServiceManager.getService(ALARM_SERVICE); IAlarmManager service = IAlarmManager.Stub.asInterface(b); return new AlarmManager(service, ctx); }}); registerService(AUDIO_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { return new AudioManager(ctx); }}); registerService(MEDIA_ROUTER_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { return new MediaRouter(ctx); }}); registerService(BLUETOOTH_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { return new BluetoothManager(ctx); }}); registerService(HDMI_CONTROL_SERVICE, new StaticServiceFetcher() { public Object createStaticService() { IBinder b = ServiceManager.getService(HDMI_CONTROL_SERVICE); return new HdmiControlManager(IHdmiControlService.Stub.asInterface(b)); }}); registerService(CLIPBOARD_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { return new ClipboardManager(ctx.getOuterContext(), ctx.mMainThread.getHandler()); }}); registerService(CONNECTIVITY_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { IBinder b = ServiceManager.getService(CONNECTIVITY_SERVICE); return new ConnectivityManager(IConnectivityManager.Stub.asInterface(b)); }}); registerService(COUNTRY_DETECTOR, new StaticServiceFetcher() { public Object createStaticService() { IBinder b = ServiceManager.getService(COUNTRY_DETECTOR); return new CountryDetector(ICountryDetector.Stub.asInterface(b)); }}); registerService(DEVICE_POLICY_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { return DevicePolicyManager.create(ctx, ctx.mMainThread.getHandler()); }}); registerService(DOWNLOAD_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { return new DownloadManager(ctx.getContentResolver(), ctx.getPackageName()); }}); registerService(BATTERY_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { return new BatteryManager(); }}); registerService(NFC_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { return new NfcManager(ctx); }}); registerService(DROPBOX_SERVICE, new StaticServiceFetcher() { public Object createStaticService() { return createDropBoxManager(); }}); registerService(INPUT_SERVICE, new StaticServiceFetcher() { public Object createStaticService() { return InputManager.getInstance(); }}); registerService(DISPLAY_SERVICE, new ServiceFetcher() { @Override public Object createService(ContextImpl ctx) { return new DisplayManager(ctx.getOuterContext()); }}); registerService(INPUT_METHOD_SERVICE, new StaticServiceFetcher() { public Object createStaticService() { return InputMethodManager.getInstance(); }}); registerService(TEXT_SERVICES_MANAGER_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { return TextServicesManager.getInstance(); }}); registerService(KEYGUARD_SERVICE, new ServiceFetcher() { public Object getService(ContextImpl ctx) { // TODO: why isn't this caching it? It wasn't // before, so I'm preserving the old behavior and // using getService(), instead of createService() // which would do the caching. return new KeyguardManager(); }}); registerService(LAYOUT_INFLATER_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { return PolicyManager.makeNewLayoutInflater(ctx.getOuterContext()); }}); registerService(LOCATION_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { IBinder b = ServiceManager.getService(LOCATION_SERVICE); return new LocationManager(ctx, ILocationManager.Stub.asInterface(b)); }}); registerService(NETWORK_POLICY_SERVICE, new ServiceFetcher() { @Override public Object createService(ContextImpl ctx) { return new NetworkPolicyManager(INetworkPolicyManager.Stub.asInterface( ServiceManager.getService(NETWORK_POLICY_SERVICE))); } }); registerService(NOTIFICATION_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { final Context outerContext = ctx.getOuterContext(); return new NotificationManager( new ContextThemeWrapper(outerContext, Resources.selectSystemTheme(0, outerContext.getApplicationInfo().targetSdkVersion, com.android.internal.R.style.Theme_Dialog, com.android.internal.R.style.Theme_Holo_Dialog, com.android.internal.R.style.Theme_DeviceDefault_Dialog, com.android.internal.R.style.Theme_DeviceDefault_Light_Dialog)), ctx.mMainThread.getHandler()); }}); registerService(NSD_SERVICE, new ServiceFetcher() { @Override public Object createService(ContextImpl ctx) { IBinder b = ServiceManager.getService(NSD_SERVICE); INsdManager service = INsdManager.Stub.asInterface(b); return new NsdManager(ctx.getOuterContext(), service); }}); // Note: this was previously cached in a static variable, but // constructed using mMainThread.getHandler(), so converting // it to be a regular Context-cached service... registerService(POWER_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { IBinder b = ServiceManager.getService(POWER_SERVICE); IPowerManager service = IPowerManager.Stub.asInterface(b); if (service == null) { Log.wtf(TAG, "Failed to get power manager service."); } return new PowerManager(ctx.getOuterContext(), service, ctx.mMainThread.getHandler()); }}); registerService(SEARCH_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { return new SearchManager(ctx.getOuterContext(), ctx.mMainThread.getHandler()); }}); registerService(SENSOR_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { return new SystemSensorManager(ctx.getOuterContext(), ctx.mMainThread.getHandler().getLooper()); }}); registerService(STATUS_BAR_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { return new StatusBarManager(ctx.getOuterContext()); }}); registerService(STORAGE_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { try { return new StorageManager( ctx.getContentResolver(), ctx.mMainThread.getHandler().getLooper()); } catch (RemoteException rex) { Log.e(TAG, "Failed to create StorageManager", rex); return null; } }}); registerService(TELEPHONY_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { return new TelephonyManager(ctx.getOuterContext()); }}); registerService(TELECOMM_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { return new TelecommManager(ctx.getOuterContext()); }}); registerService(PHONE_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { return new PhoneManager(ctx.getOuterContext()); }}); registerService(UI_MODE_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { return new UiModeManager(); }}); registerService(USB_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { IBinder b = ServiceManager.getService(USB_SERVICE); return new UsbManager(ctx, IUsbManager.Stub.asInterface(b)); }}); registerService(SERIAL_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { IBinder b = ServiceManager.getService(SERIAL_SERVICE); return new SerialManager(ctx, ISerialManager.Stub.asInterface(b)); }}); registerService(VIBRATOR_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { return new SystemVibrator(ctx); }}); registerService(WALLPAPER_SERVICE, WALLPAPER_FETCHER); registerService(WIFI_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { IBinder b = ServiceManager.getService(WIFI_SERVICE); IWifiManager service = IWifiManager.Stub.asInterface(b); return new WifiManager(ctx.getOuterContext(), service); }}); registerService(WIFI_PASSPOINT_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { IBinder b = ServiceManager.getService(WIFI_PASSPOINT_SERVICE); IWifiPasspointManager service = IWifiPasspointManager.Stub.asInterface(b); return new WifiPasspointManager(ctx.getOuterContext(), service); }}); registerService(WIFI_P2P_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { IBinder b = ServiceManager.getService(WIFI_P2P_SERVICE); IWifiP2pManager service = IWifiP2pManager.Stub.asInterface(b); return new WifiP2pManager(service); }}); registerService(WIFI_SCANNING_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { IBinder b = ServiceManager.getService(WIFI_SCANNING_SERVICE); IWifiScanner service = IWifiScanner.Stub.asInterface(b); return new WifiScanner(ctx.getOuterContext(), service); }}); registerService(WIFI_RTT_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { IBinder b = ServiceManager.getService(WIFI_RTT_SERVICE); IRttManager service = IRttManager.Stub.asInterface(b); return new RttManager(ctx.getOuterContext(), service); }}); registerService(ETHERNET_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { IBinder b = ServiceManager.getService(ETHERNET_SERVICE); IEthernetManager service = IEthernetManager.Stub.asInterface(b); return new EthernetManager(ctx.getOuterContext(), service); }}); registerService(WINDOW_SERVICE, new ServiceFetcher() { Display mDefaultDisplay; public Object getService(ContextImpl ctx) { Display display = ctx.mDisplay; if (display == null) { if (mDefaultDisplay == null) { DisplayManager dm = (DisplayManager)ctx.getOuterContext(). getSystemService(Context.DISPLAY_SERVICE); mDefaultDisplay = dm.getDisplay(Display.DEFAULT_DISPLAY); } display = mDefaultDisplay; } return new WindowManagerImpl(display); }}); registerService(USER_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { IBinder b = ServiceManager.getService(USER_SERVICE); IUserManager service = IUserManager.Stub.asInterface(b); return new UserManager(ctx, service); }}); registerService(APP_OPS_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { IBinder b = ServiceManager.getService(APP_OPS_SERVICE); IAppOpsService service = IAppOpsService.Stub.asInterface(b); return new AppOpsManager(ctx, service); }}); registerService(CAMERA_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { return new CameraManager(ctx); } }); registerService(LAUNCHER_APPS_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { IBinder b = ServiceManager.getService(LAUNCHER_APPS_SERVICE); ILauncherApps service = ILauncherApps.Stub.asInterface(b); return new LauncherApps(ctx, service); } }); registerService(RESTRICTIONS_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { IBinder b = ServiceManager.getService(RESTRICTIONS_SERVICE); IRestrictionsManager service = IRestrictionsManager.Stub.asInterface(b); return new RestrictionsManager(ctx, service); } }); registerService(PRINT_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { IBinder iBinder = ServiceManager.getService(Context.PRINT_SERVICE); IPrintManager service = IPrintManager.Stub.asInterface(iBinder); return new PrintManager(ctx.getOuterContext(), service, UserHandle.myUserId(), UserHandle.getAppId(Process.myUid())); }}); registerService(CONSUMER_IR_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { return new ConsumerIrManager(ctx); }}); registerService(MEDIA_SESSION_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { return new MediaSessionManager(ctx); } }); registerService(TRUST_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { IBinder b = ServiceManager.getService(TRUST_SERVICE); return new TrustManager(b); } }); registerService(FINGERPRINT_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { IBinder binder = ServiceManager.getService(FINGERPRINT_SERVICE); IFingerprintService service = IFingerprintService.Stub.asInterface(binder); return new FingerprintManager(ctx.getOuterContext(), service); } }); registerService(TV_INPUT_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { IBinder iBinder = ServiceManager.getService(TV_INPUT_SERVICE); ITvInputManager service = ITvInputManager.Stub.asInterface(iBinder); return new TvInputManager(service, UserHandle.myUserId()); } }); registerService(NETWORK_SCORE_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { return new NetworkScoreManager(ctx); } }); registerService(USAGE_STATS_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { IBinder iBinder = ServiceManager.getService(USAGE_STATS_SERVICE); IUsageStatsManager service = IUsageStatsManager.Stub.asInterface(iBinder); return new UsageStatsManager(ctx.getOuterContext(), service); } }); registerService(JOB_SCHEDULER_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { IBinder b = ServiceManager.getService(JOB_SCHEDULER_SERVICE); return new JobSchedulerImpl(IJobScheduler.Stub.asInterface(b)); }}); registerService(PERSISTENT_DATA_BLOCK_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { IBinder b = ServiceManager.getService(PERSISTENT_DATA_BLOCK_SERVICE); IPersistentDataBlockService persistentDataBlockService = IPersistentDataBlockService.Stub.asInterface(b); if (persistentDataBlockService != null) { return new PersistentDataBlockManager(persistentDataBlockService); } else { // not supported return null; } } }); registerService(MEDIA_PROJECTION_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { return new MediaProjectionManager(ctx); } }); registerService(APPWIDGET_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { IBinder b = ServiceManager.getService(APPWIDGET_SERVICE); return new AppWidgetManager(ctx, IAppWidgetService.Stub.asInterface(b)); }}); } static ContextImpl getImpl(Context context) { Context nextContext; while ((context instanceof ContextWrapper) && (nextContext=((ContextWrapper)context).getBaseContext()) != null) { context = nextContext; } return (ContextImpl)context; } // The system service cache for the system services that are // cached per-ContextImpl. Package-scoped to avoid accessor // methods. final ArrayList<Object> mServiceCache = new ArrayList<Object>(); @Override public AssetManager getAssets() { return getResources().getAssets(); } @Override public Resources getResources() { return mResources; } @Override public PackageManager getPackageManager() { if (mPackageManager != null) { return mPackageManager; } IPackageManager pm = ActivityThread.getPackageManager(); if (pm != null) { // Doesn't matter if we make more than one instance. return (mPackageManager = new ApplicationPackageManager(this, pm)); } return null; } @Override public ContentResolver getContentResolver() { return mContentResolver; } @Override public Looper getMainLooper() { return mMainThread.getLooper(); } @Override public Context getApplicationContext() { return (mPackageInfo != null) ? mPackageInfo.getApplication() : mMainThread.getApplication(); } @Override public void setTheme(int resid) { mThemeResource = resid; } @Override public int getThemeResId() { return mThemeResource; } @Override public Resources.Theme getTheme() { if (mTheme == null) { mThemeResource = Resources.selectDefaultTheme(mThemeResource, getOuterContext().getApplicationInfo().targetSdkVersion); mTheme = mResources.newTheme(); mTheme.applyStyle(mThemeResource, true); } return mTheme; } @Override public ClassLoader getClassLoader() { return mPackageInfo != null ? mPackageInfo.getClassLoader() : ClassLoader.getSystemClassLoader(); } @Override public String getPackageName() { if (mPackageInfo != null) { return mPackageInfo.getPackageName(); } // No mPackageInfo means this is a Context for the system itself, // and this here is its name. return "android"; } /** @hide */ @Override public String getBasePackageName() { return mBasePackageName != null ? mBasePackageName : getPackageName(); } /** @hide */ @Override public String getOpPackageName() { return mOpPackageName != null ? mOpPackageName : getBasePackageName(); } @Override public ApplicationInfo getApplicationInfo() { if (mPackageInfo != null) { return mPackageInfo.getApplicationInfo(); } throw new RuntimeException("Not supported in system context"); } @Override public String getPackageResourcePath() { if (mPackageInfo != null) { return mPackageInfo.getResDir(); } throw new RuntimeException("Not supported in system context"); } @Override public String getPackageCodePath() { if (mPackageInfo != null) { return mPackageInfo.getAppDir(); } throw new RuntimeException("Not supported in system context"); } public File getSharedPrefsFile(String name) { return makeFilename(getPreferencesDir(), name + ".xml"); } @Override public SharedPreferences getSharedPreferences(String name, int mode) { SharedPreferencesImpl sp; synchronized (ContextImpl.class) { if (sSharedPrefs == null) { sSharedPrefs = new ArrayMap<String, ArrayMap<String, SharedPreferencesImpl>>(); } final String packageName = getPackageName(); ArrayMap<String, SharedPreferencesImpl> packagePrefs = sSharedPrefs.get(packageName); if (packagePrefs == null) { packagePrefs = new ArrayMap<String, SharedPreferencesImpl>(); sSharedPrefs.put(packageName, packagePrefs); } // At least one application in the world actually passes in a null // name. This happened to work because when we generated the file name // we would stringify it to "null.xml". Nice. if (mPackageInfo.getApplicationInfo().targetSdkVersion < Build.VERSION_CODES.KITKAT) { if (name == null) { name = "null"; } } sp = packagePrefs.get(name); if (sp == null) { File prefsFile = getSharedPrefsFile(name); sp = new SharedPreferencesImpl(prefsFile, mode); packagePrefs.put(name, sp); return sp; } } if ((mode & Context.MODE_MULTI_PROCESS) != 0 || getApplicationInfo().targetSdkVersion < android.os.Build.VERSION_CODES.HONEYCOMB) { // If somebody else (some other process) changed the prefs // file behind our back, we reload it. This has been the // historical (if undocumented) behavior. sp.startReloadIfChangedUnexpectedly(); } return sp; } private File getPreferencesDir() { synchronized (mSync) { if (mPreferencesDir == null) { mPreferencesDir = new File(getDataDirFile(), "shared_prefs"); } return mPreferencesDir; } } @Override public FileInputStream openFileInput(String name) throws FileNotFoundException { File f = makeFilename(getFilesDir(), name); return new FileInputStream(f); } @Override public FileOutputStream openFileOutput(String name, int mode) throws FileNotFoundException { final boolean append = (mode&MODE_APPEND) != 0; File f = makeFilename(getFilesDir(), name); try { FileOutputStream fos = new FileOutputStream(f, append); setFilePermissionsFromMode(f.getPath(), mode, 0); return fos; } catch (FileNotFoundException e) { } File parent = f.getParentFile(); parent.mkdir(); FileUtils.setPermissions( parent.getPath(), FileUtils.S_IRWXU|FileUtils.S_IRWXG|FileUtils.S_IXOTH, -1, -1); FileOutputStream fos = new FileOutputStream(f, append); setFilePermissionsFromMode(f.getPath(), mode, 0); return fos; } @Override public boolean deleteFile(String name) { File f = makeFilename(getFilesDir(), name); return f.delete(); } // Common-path handling of app data dir creation private static File createFilesDirLocked(File file) { if (!file.exists()) { if (!file.mkdirs()) { if (file.exists()) { // spurious failure; probably racing with another process for this app return file; } Log.w(TAG, "Unable to create files subdir " + file.getPath()); return null; } FileUtils.setPermissions( file.getPath(), FileUtils.S_IRWXU|FileUtils.S_IRWXG|FileUtils.S_IXOTH, -1, -1); } return file; } @Override public File getFilesDir() { synchronized (mSync) { if (mFilesDir == null) { mFilesDir = new File(getDataDirFile(), "files"); } return createFilesDirLocked(mFilesDir); } } @Override public File getNoBackupFilesDir() { synchronized (mSync) { if (mNoBackupFilesDir == null) { mNoBackupFilesDir = new File(getDataDirFile(), "no_backup"); } return createFilesDirLocked(mNoBackupFilesDir); } } @Override public File getExternalFilesDir(String type) { // Operates on primary external storage return getExternalFilesDirs(type)[0]; } @Override public File[] getExternalFilesDirs(String type) { synchronized (mSync) { if (mExternalFilesDirs == null) { mExternalFilesDirs = Environment.buildExternalStorageAppFilesDirs(getPackageName()); } // Splice in requested type, if any File[] dirs = mExternalFilesDirs; if (type != null) { dirs = Environment.buildPaths(dirs, type); } // Create dirs if needed return ensureDirsExistOrFilter(dirs); } } @Override public File getObbDir() { // Operates on primary external storage return getObbDirs()[0]; } @Override public File[] getObbDirs() { synchronized (mSync) { if (mExternalObbDirs == null) { mExternalObbDirs = Environment.buildExternalStorageAppObbDirs(getPackageName()); } // Create dirs if needed return ensureDirsExistOrFilter(mExternalObbDirs); } } @Override public File getCacheDir() { synchronized (mSync) { if (mCacheDir == null) { mCacheDir = new File(getDataDirFile(), "cache"); } return createFilesDirLocked(mCacheDir); } } @Override public File getCodeCacheDir() { synchronized (mSync) { if (mCodeCacheDir == null) { mCodeCacheDir = new File(getDataDirFile(), "code_cache"); } return createFilesDirLocked(mCodeCacheDir); } } @Override public File getExternalCacheDir() { // Operates on primary external storage return getExternalCacheDirs()[0]; } @Override public File[] getExternalCacheDirs() { synchronized (mSync) { if (mExternalCacheDirs == null) { mExternalCacheDirs = Environment.buildExternalStorageAppCacheDirs(getPackageName()); } // Create dirs if needed return ensureDirsExistOrFilter(mExternalCacheDirs); } } @Override public File[] getExternalMediaDirs() { synchronized (mSync) { if (mExternalMediaDirs == null) { mExternalMediaDirs = Environment.buildExternalStorageAppMediaDirs(getPackageName()); } // Create dirs if needed return ensureDirsExistOrFilter(mExternalMediaDirs); } } @Override public File getFileStreamPath(String name) { return makeFilename(getFilesDir(), name); } @Override public String[] fileList() { final String[] list = getFilesDir().list(); return (list != null) ? list : EMPTY_FILE_LIST; } @Override public SQLiteDatabase openOrCreateDatabase(String name, int mode, CursorFactory factory) { return openOrCreateDatabase(name, mode, factory, null); } @Override public SQLiteDatabase openOrCreateDatabase(String name, int mode, CursorFactory factory, DatabaseErrorHandler errorHandler) { File f = validateFilePath(name, true); int flags = SQLiteDatabase.CREATE_IF_NECESSARY; if ((mode & MODE_ENABLE_WRITE_AHEAD_LOGGING) != 0) { flags |= SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING; } SQLiteDatabase db = SQLiteDatabase.openDatabase(f.getPath(), factory, flags, errorHandler); setFilePermissionsFromMode(f.getPath(), mode, 0); return db; } @Override public boolean deleteDatabase(String name) { try { File f = validateFilePath(name, false); return SQLiteDatabase.deleteDatabase(f); } catch (Exception e) { } return false; } @Override public File getDatabasePath(String name) { return validateFilePath(name, false); } @Override public String[] databaseList() { final String[] list = getDatabasesDir().list(); return (list != null) ? list : EMPTY_FILE_LIST; } private File getDatabasesDir() { synchronized (mSync) { if (mDatabasesDir == null) { mDatabasesDir = new File(getDataDirFile(), "databases"); } if (mDatabasesDir.getPath().equals("databases")) { mDatabasesDir = new File("/data/system"); } return mDatabasesDir; } } @Override public Drawable getWallpaper() { return getWallpaperManager().getDrawable(); } @Override public Drawable peekWallpaper() { return getWallpaperManager().peekDrawable(); } @Override public int getWallpaperDesiredMinimumWidth() { return getWallpaperManager().getDesiredMinimumWidth(); } @Override public int getWallpaperDesiredMinimumHeight() { return getWallpaperManager().getDesiredMinimumHeight(); } @Override public void setWallpaper(Bitmap bitmap) throws IOException { getWallpaperManager().setBitmap(bitmap); } @Override public void setWallpaper(InputStream data) throws IOException { getWallpaperManager().setStream(data); } @Override public void clearWallpaper() throws IOException { getWallpaperManager().clear(); } @Override public void startActivity(Intent intent) { warnIfCallingFromSystemProcess(); startActivity(intent, null); } /** @hide */ @Override public void startActivityAsUser(Intent intent, UserHandle user) { startActivityAsUser(intent, null, user); } @Override public void startActivity(Intent intent, Bundle options) { warnIfCallingFromSystemProcess(); if ((intent.getFlags()&Intent.FLAG_ACTIVITY_NEW_TASK) == 0) { throw new AndroidRuntimeException( "Calling startActivity() from outside of an Activity " + " context requires the FLAG_ACTIVITY_NEW_TASK flag." + " Is this really what you want?"); } mMainThread.getInstrumentation().execStartActivity( getOuterContext(), mMainThread.getApplicationThread(), null, (Activity)null, intent, -1, options); } /** @hide */ @Override public void startActivityAsUser(Intent intent, Bundle options, UserHandle user) { try { ActivityManagerNative.getDefault().startActivityAsUser( mMainThread.getApplicationThread(), getBasePackageName(), intent, intent.resolveTypeIfNeeded(getContentResolver()), null, null, 0, Intent.FLAG_ACTIVITY_NEW_TASK, null, null, options, user.getIdentifier()); } catch (RemoteException re) { } } @Override public void startActivities(Intent[] intents) { warnIfCallingFromSystemProcess(); startActivities(intents, null); } /** @hide */ @Override public void startActivitiesAsUser(Intent[] intents, Bundle options, UserHandle userHandle) { if ((intents[0].getFlags()&Intent.FLAG_ACTIVITY_NEW_TASK) == 0) { throw new AndroidRuntimeException( "Calling startActivities() from outside of an Activity " + " context requires the FLAG_ACTIVITY_NEW_TASK flag on first Intent." + " Is this really what you want?"); } mMainThread.getInstrumentation().execStartActivitiesAsUser( getOuterContext(), mMainThread.getApplicationThread(), null, (Activity)null, intents, options, userHandle.getIdentifier()); } @Override public void startActivities(Intent[] intents, Bundle options) { warnIfCallingFromSystemProcess(); if ((intents[0].getFlags()&Intent.FLAG_ACTIVITY_NEW_TASK) == 0) { throw new AndroidRuntimeException( "Calling startActivities() from outside of an Activity " + " context requires the FLAG_ACTIVITY_NEW_TASK flag on first Intent." + " Is this really what you want?"); } mMainThread.getInstrumentation().execStartActivities( getOuterContext(), mMainThread.getApplicationThread(), null, (Activity)null, intents, options); } @Override public void startIntentSender(IntentSender intent, Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags) throws IntentSender.SendIntentException { startIntentSender(intent, fillInIntent, flagsMask, flagsValues, extraFlags, null); } @Override public void startIntentSender(IntentSender intent, Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags, Bundle options) throws IntentSender.SendIntentException { try { String resolvedType = null; if (fillInIntent != null) { fillInIntent.migrateExtraStreamToClipData(); fillInIntent.prepareToLeaveProcess(); resolvedType = fillInIntent.resolveTypeIfNeeded(getContentResolver()); } int result = ActivityManagerNative.getDefault() .startActivityIntentSender(mMainThread.getApplicationThread(), intent, fillInIntent, resolvedType, null, null, 0, flagsMask, flagsValues, options); if (result == ActivityManager.START_CANCELED) { throw new IntentSender.SendIntentException(); } Instrumentation.checkStartActivityResult(result, null); } catch (RemoteException e) { } } @Override public void sendBroadcast(Intent intent) { warnIfCallingFromSystemProcess(); String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); try { intent.prepareToLeaveProcess(); ActivityManagerNative.getDefault().broadcastIntent( mMainThread.getApplicationThread(), intent, resolvedType, null, Activity.RESULT_OK, null, null, null, AppOpsManager.OP_NONE, false, false, getUserId()); } catch (RemoteException e) { } } @Override public void sendBroadcast(Intent intent, String receiverPermission) { warnIfCallingFromSystemProcess(); String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); try { intent.prepareToLeaveProcess(); ActivityManagerNative.getDefault().broadcastIntent( mMainThread.getApplicationThread(), intent, resolvedType, null, Activity.RESULT_OK, null, null, receiverPermission, AppOpsManager.OP_NONE, false, false, getUserId()); } catch (RemoteException e) { } } @Override public void sendBroadcast(Intent intent, String receiverPermission, int appOp) { warnIfCallingFromSystemProcess(); String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); try { intent.prepareToLeaveProcess(); ActivityManagerNative.getDefault().broadcastIntent( mMainThread.getApplicationThread(), intent, resolvedType, null, Activity.RESULT_OK, null, null, receiverPermission, appOp, false, false, getUserId()); } catch (RemoteException e) { } } @Override public void sendOrderedBroadcast(Intent intent, String receiverPermission) { warnIfCallingFromSystemProcess(); String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); try { intent.prepareToLeaveProcess(); ActivityManagerNative.getDefault().broadcastIntent( mMainThread.getApplicationThread(), intent, resolvedType, null, Activity.RESULT_OK, null, null, receiverPermission, AppOpsManager.OP_NONE, true, false, getUserId()); } catch (RemoteException e) { } } @Override public void sendOrderedBroadcast(Intent intent, String receiverPermission, BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, String initialData, Bundle initialExtras) { sendOrderedBroadcast(intent, receiverPermission, AppOpsManager.OP_NONE, resultReceiver, scheduler, initialCode, initialData, initialExtras); } @Override public void sendOrderedBroadcast(Intent intent, String receiverPermission, int appOp, BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, String initialData, Bundle initialExtras) { warnIfCallingFromSystemProcess(); IIntentReceiver rd = null; if (resultReceiver != null) { if (mPackageInfo != null) { if (scheduler == null) { scheduler = mMainThread.getHandler(); } rd = mPackageInfo.getReceiverDispatcher( resultReceiver, getOuterContext(), scheduler, mMainThread.getInstrumentation(), false); } else { if (scheduler == null) { scheduler = mMainThread.getHandler(); } rd = new LoadedApk.ReceiverDispatcher( resultReceiver, getOuterContext(), scheduler, null, false).getIIntentReceiver(); } } String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); try { intent.prepareToLeaveProcess(); ActivityManagerNative.getDefault().broadcastIntent( mMainThread.getApplicationThread(), intent, resolvedType, rd, initialCode, initialData, initialExtras, receiverPermission, appOp, true, false, getUserId()); } catch (RemoteException e) { } } @Override public void sendBroadcastAsUser(Intent intent, UserHandle user) { String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); try { intent.prepareToLeaveProcess(); ActivityManagerNative.getDefault().broadcastIntent(mMainThread.getApplicationThread(), intent, resolvedType, null, Activity.RESULT_OK, null, null, null, AppOpsManager.OP_NONE, false, false, user.getIdentifier()); } catch (RemoteException e) { } } @Override public void sendBroadcastAsUser(Intent intent, UserHandle user, String receiverPermission) { String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); try { intent.prepareToLeaveProcess(); ActivityManagerNative.getDefault().broadcastIntent( mMainThread.getApplicationThread(), intent, resolvedType, null, Activity.RESULT_OK, null, null, receiverPermission, AppOpsManager.OP_NONE, false, false, user.getIdentifier()); } catch (RemoteException e) { } } @Override public void sendOrderedBroadcastAsUser(Intent intent, UserHandle user, String receiverPermission, BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, String initialData, Bundle initialExtras) { sendOrderedBroadcastAsUser(intent, user, receiverPermission, AppOpsManager.OP_NONE, resultReceiver, scheduler, initialCode, initialData, initialExtras); } @Override public void sendOrderedBroadcastAsUser(Intent intent, UserHandle user, String receiverPermission, int appOp, BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, String initialData, Bundle initialExtras) { IIntentReceiver rd = null; if (resultReceiver != null) { if (mPackageInfo != null) { if (scheduler == null) { scheduler = mMainThread.getHandler(); } rd = mPackageInfo.getReceiverDispatcher( resultReceiver, getOuterContext(), scheduler, mMainThread.getInstrumentation(), false); } else { if (scheduler == null) { scheduler = mMainThread.getHandler(); } rd = new LoadedApk.ReceiverDispatcher( resultReceiver, getOuterContext(), scheduler, null, false).getIIntentReceiver(); } } String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); try { intent.prepareToLeaveProcess(); ActivityManagerNative.getDefault().broadcastIntent( mMainThread.getApplicationThread(), intent, resolvedType, rd, initialCode, initialData, initialExtras, receiverPermission, appOp, true, false, user.getIdentifier()); } catch (RemoteException e) { } } @Override public void sendStickyBroadcast(Intent intent) { warnIfCallingFromSystemProcess(); String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); try { intent.prepareToLeaveProcess(); ActivityManagerNative.getDefault().broadcastIntent( mMainThread.getApplicationThread(), intent, resolvedType, null, Activity.RESULT_OK, null, null, null, AppOpsManager.OP_NONE, false, true, getUserId()); } catch (RemoteException e) { } } @Override public void sendStickyOrderedBroadcast(Intent intent, BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, String initialData, Bundle initialExtras) { warnIfCallingFromSystemProcess(); IIntentReceiver rd = null; if (resultReceiver != null) { if (mPackageInfo != null) { if (scheduler == null) { scheduler = mMainThread.getHandler(); } rd = mPackageInfo.getReceiverDispatcher( resultReceiver, getOuterContext(), scheduler, mMainThread.getInstrumentation(), false); } else { if (scheduler == null) { scheduler = mMainThread.getHandler(); } rd = new LoadedApk.ReceiverDispatcher( resultReceiver, getOuterContext(), scheduler, null, false).getIIntentReceiver(); } } String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); try { intent.prepareToLeaveProcess(); ActivityManagerNative.getDefault().broadcastIntent( mMainThread.getApplicationThread(), intent, resolvedType, rd, initialCode, initialData, initialExtras, null, AppOpsManager.OP_NONE, true, true, getUserId()); } catch (RemoteException e) { } } @Override public void removeStickyBroadcast(Intent intent) { String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); if (resolvedType != null) { intent = new Intent(intent); intent.setDataAndType(intent.getData(), resolvedType); } try { intent.prepareToLeaveProcess(); ActivityManagerNative.getDefault().unbroadcastIntent( mMainThread.getApplicationThread(), intent, getUserId()); } catch (RemoteException e) { } } @Override public void sendStickyBroadcastAsUser(Intent intent, UserHandle user) { String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); try { intent.prepareToLeaveProcess(); ActivityManagerNative.getDefault().broadcastIntent( mMainThread.getApplicationThread(), intent, resolvedType, null, Activity.RESULT_OK, null, null, null, AppOpsManager.OP_NONE, false, true, user.getIdentifier()); } catch (RemoteException e) { } } @Override public void sendStickyOrderedBroadcastAsUser(Intent intent, UserHandle user, BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, String initialData, Bundle initialExtras) { IIntentReceiver rd = null; if (resultReceiver != null) { if (mPackageInfo != null) { if (scheduler == null) { scheduler = mMainThread.getHandler(); } rd = mPackageInfo.getReceiverDispatcher( resultReceiver, getOuterContext(), scheduler, mMainThread.getInstrumentation(), false); } else { if (scheduler == null) { scheduler = mMainThread.getHandler(); } rd = new LoadedApk.ReceiverDispatcher( resultReceiver, getOuterContext(), scheduler, null, false).getIIntentReceiver(); } } String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); try { intent.prepareToLeaveProcess(); ActivityManagerNative.getDefault().broadcastIntent( mMainThread.getApplicationThread(), intent, resolvedType, rd, initialCode, initialData, initialExtras, null, AppOpsManager.OP_NONE, true, true, user.getIdentifier()); } catch (RemoteException e) { } } @Override public void removeStickyBroadcastAsUser(Intent intent, UserHandle user) { String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); if (resolvedType != null) { intent = new Intent(intent); intent.setDataAndType(intent.getData(), resolvedType); } try { intent.prepareToLeaveProcess(); ActivityManagerNative.getDefault().unbroadcastIntent( mMainThread.getApplicationThread(), intent, user.getIdentifier()); } catch (RemoteException e) { } } @Override public Intent registerReceiver(BroadcastReceiver receiver, IntentFilter filter) { return registerReceiver(receiver, filter, null, null); } @Override public Intent registerReceiver(BroadcastReceiver receiver, IntentFilter filter, String broadcastPermission, Handler scheduler) { return registerReceiverInternal(receiver, getUserId(), filter, broadcastPermission, scheduler, getOuterContext()); } @Override public Intent registerReceiverAsUser(BroadcastReceiver receiver, UserHandle user, IntentFilter filter, String broadcastPermission, Handler scheduler) { return registerReceiverInternal(receiver, user.getIdentifier(), filter, broadcastPermission, scheduler, getOuterContext()); } private Intent registerReceiverInternal(BroadcastReceiver receiver, int userId, IntentFilter filter, String broadcastPermission, Handler scheduler, Context context) { IIntentReceiver rd = null; if (receiver != null) { if (mPackageInfo != null && context != null) { if (scheduler == null) { scheduler = mMainThread.getHandler(); } rd = mPackageInfo.getReceiverDispatcher( receiver, context, scheduler, mMainThread.getInstrumentation(), true); } else { if (scheduler == null) { scheduler = mMainThread.getHandler(); } rd = new LoadedApk.ReceiverDispatcher( receiver, context, scheduler, null, true).getIIntentReceiver(); } } try { return ActivityManagerNative.getDefault().registerReceiver( mMainThread.getApplicationThread(), mBasePackageName, rd, filter, broadcastPermission, userId); } catch (RemoteException e) { return null; } } @Override public void unregisterReceiver(BroadcastReceiver receiver) { if (mPackageInfo != null) { IIntentReceiver rd = mPackageInfo.forgetReceiverDispatcher( getOuterContext(), receiver); try { ActivityManagerNative.getDefault().unregisterReceiver(rd); } catch (RemoteException e) { } } else { throw new RuntimeException("Not supported in system context"); } } private void validateServiceIntent(Intent service) { if (service.getComponent() == null && service.getPackage() == null) { if (getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.L) { IllegalArgumentException ex = new IllegalArgumentException( "Service Intent must be explicit: " + service); throw ex; } else { Log.w(TAG, "Implicit intents with startService are not safe: " + service + " " + Debug.getCallers(2, 3)); } } } @Override public ComponentName startService(Intent service) { warnIfCallingFromSystemProcess(); return startServiceCommon(service, mUser); } @Override public boolean stopService(Intent service) { warnIfCallingFromSystemProcess(); return stopServiceCommon(service, mUser); } @Override public ComponentName startServiceAsUser(Intent service, UserHandle user) { return startServiceCommon(service, user); } private ComponentName startServiceCommon(Intent service, UserHandle user) { try { validateServiceIntent(service); service.prepareToLeaveProcess(); ComponentName cn = ActivityManagerNative.getDefault().startService( mMainThread.getApplicationThread(), service, service.resolveTypeIfNeeded(getContentResolver()), user.getIdentifier()); if (cn != null) { if (cn.getPackageName().equals("!")) { throw new SecurityException( "Not allowed to start service " + service + " without permission " + cn.getClassName()); } else if (cn.getPackageName().equals("!!")) { throw new SecurityException( "Unable to start service " + service + ": " + cn.getClassName()); } } return cn; } catch (RemoteException e) { return null; } } @Override public boolean stopServiceAsUser(Intent service, UserHandle user) { return stopServiceCommon(service, user); } private boolean stopServiceCommon(Intent service, UserHandle user) { try { validateServiceIntent(service); service.prepareToLeaveProcess(); int res = ActivityManagerNative.getDefault().stopService( mMainThread.getApplicationThread(), service, service.resolveTypeIfNeeded(getContentResolver()), user.getIdentifier()); if (res < 0) { throw new SecurityException( "Not allowed to stop service " + service); } return res != 0; } catch (RemoteException e) { return false; } } @Override public boolean bindService(Intent service, ServiceConnection conn, int flags) { warnIfCallingFromSystemProcess(); return bindServiceCommon(service, conn, flags, Process.myUserHandle()); } /** @hide */ @Override public boolean bindServiceAsUser(Intent service, ServiceConnection conn, int flags, UserHandle user) { return bindServiceCommon(service, conn, flags, user); } private boolean bindServiceCommon(Intent service, ServiceConnection conn, int flags, UserHandle user) { IServiceConnection sd; if (conn == null) { throw new IllegalArgumentException("connection is null"); } if (mPackageInfo != null) { sd = mPackageInfo.getServiceDispatcher(conn, getOuterContext(), mMainThread.getHandler(), flags); } else { throw new RuntimeException("Not supported in system context"); } validateServiceIntent(service); try { IBinder token = getActivityToken(); if (token == null && (flags&BIND_AUTO_CREATE) == 0 && mPackageInfo != null && mPackageInfo.getApplicationInfo().targetSdkVersion < android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH) { flags |= BIND_WAIVE_PRIORITY; } service.prepareToLeaveProcess(); int res = ActivityManagerNative.getDefault().bindService( mMainThread.getApplicationThread(), getActivityToken(), service, service.resolveTypeIfNeeded(getContentResolver()), sd, flags, user.getIdentifier()); if (res < 0) { throw new SecurityException( "Not allowed to bind to service " + service); } return res != 0; } catch (RemoteException e) { return false; } } @Override public void unbindService(ServiceConnection conn) { if (conn == null) { throw new IllegalArgumentException("connection is null"); } if (mPackageInfo != null) { IServiceConnection sd = mPackageInfo.forgetServiceDispatcher( getOuterContext(), conn); try { ActivityManagerNative.getDefault().unbindService(sd); } catch (RemoteException e) { } } else { throw new RuntimeException("Not supported in system context"); } } @Override public boolean startInstrumentation(ComponentName className, String profileFile, Bundle arguments) { try { if (arguments != null) { arguments.setAllowFds(false); } return ActivityManagerNative.getDefault().startInstrumentation( className, profileFile, 0, arguments, null, null, getUserId(), null /* ABI override */); } catch (RemoteException e) { // System has crashed, nothing we can do. } return false; } @Override public Object getSystemService(String name) { ServiceFetcher fetcher = SYSTEM_SERVICE_MAP.get(name); return fetcher == null ? null : fetcher.getService(this); } private WallpaperManager getWallpaperManager() { return (WallpaperManager) WALLPAPER_FETCHER.getService(this); } /* package */ static DropBoxManager createDropBoxManager() { IBinder b = ServiceManager.getService(DROPBOX_SERVICE); IDropBoxManagerService service = IDropBoxManagerService.Stub.asInterface(b); if (service == null) { // Don't return a DropBoxManager that will NPE upon use. // This also avoids caching a broken DropBoxManager in // getDropBoxManager during early boot, before the // DROPBOX_SERVICE is registered. return null; } return new DropBoxManager(service); } @Override public int checkPermission(String permission, int pid, int uid) { if (permission == null) { throw new IllegalArgumentException("permission is null"); } try { return ActivityManagerNative.getDefault().checkPermission( permission, pid, uid); } catch (RemoteException e) { return PackageManager.PERMISSION_DENIED; } } @Override public int checkCallingPermission(String permission) { if (permission == null) { throw new IllegalArgumentException("permission is null"); } int pid = Binder.getCallingPid(); if (pid != Process.myPid()) { return checkPermission(permission, pid, Binder.getCallingUid()); } return PackageManager.PERMISSION_DENIED; } @Override public int checkCallingOrSelfPermission(String permission) { if (permission == null) { throw new IllegalArgumentException("permission is null"); } return checkPermission(permission, Binder.getCallingPid(), Binder.getCallingUid()); } private void enforce( String permission, int resultOfCheck, boolean selfToo, int uid, String message) { if (resultOfCheck != PackageManager.PERMISSION_GRANTED) { throw new SecurityException( (message != null ? (message + ": ") : "") + (selfToo ? "Neither user " + uid + " nor current process has " : "uid " + uid + " does not have ") + permission + "."); } } public void enforcePermission( String permission, int pid, int uid, String message) { enforce(permission, checkPermission(permission, pid, uid), false, uid, message); } public void enforceCallingPermission(String permission, String message) { enforce(permission, checkCallingPermission(permission), false, Binder.getCallingUid(), message); } public void enforceCallingOrSelfPermission( String permission, String message) { enforce(permission, checkCallingOrSelfPermission(permission), true, Binder.getCallingUid(), message); } @Override public void grantUriPermission(String toPackage, Uri uri, int modeFlags) { try { ActivityManagerNative.getDefault().grantUriPermission( mMainThread.getApplicationThread(), toPackage, ContentProvider.getUriWithoutUserId(uri), modeFlags, resolveUserId(uri)); } catch (RemoteException e) { } } @Override public void revokeUriPermission(Uri uri, int modeFlags) { try { ActivityManagerNative.getDefault().revokeUriPermission( mMainThread.getApplicationThread(), ContentProvider.getUriWithoutUserId(uri), modeFlags, resolveUserId(uri)); } catch (RemoteException e) { } } @Override public int checkUriPermission(Uri uri, int pid, int uid, int modeFlags) { try { return ActivityManagerNative.getDefault().checkUriPermission( ContentProvider.getUriWithoutUserId(uri), pid, uid, modeFlags, resolveUserId(uri)); } catch (RemoteException e) { return PackageManager.PERMISSION_DENIED; } } private int resolveUserId(Uri uri) { return ContentProvider.getUserIdFromUri(uri, getUserId()); } @Override public int checkCallingUriPermission(Uri uri, int modeFlags) { int pid = Binder.getCallingPid(); if (pid != Process.myPid()) { return checkUriPermission(uri, pid, Binder.getCallingUid(), modeFlags); } return PackageManager.PERMISSION_DENIED; } @Override public int checkCallingOrSelfUriPermission(Uri uri, int modeFlags) { return checkUriPermission(uri, Binder.getCallingPid(), Binder.getCallingUid(), modeFlags); } @Override public int checkUriPermission(Uri uri, String readPermission, String writePermission, int pid, int uid, int modeFlags) { if (DEBUG) { Log.i("foo", "checkUriPermission: uri=" + uri + "readPermission=" + readPermission + " writePermission=" + writePermission + " pid=" + pid + " uid=" + uid + " mode" + modeFlags); } if ((modeFlags&Intent.FLAG_GRANT_READ_URI_PERMISSION) != 0) { if (readPermission == null || checkPermission(readPermission, pid, uid) == PackageManager.PERMISSION_GRANTED) { return PackageManager.PERMISSION_GRANTED; } } if ((modeFlags&Intent.FLAG_GRANT_WRITE_URI_PERMISSION) != 0) { if (writePermission == null || checkPermission(writePermission, pid, uid) == PackageManager.PERMISSION_GRANTED) { return PackageManager.PERMISSION_GRANTED; } } return uri != null ? checkUriPermission(uri, pid, uid, modeFlags) : PackageManager.PERMISSION_DENIED; } private String uriModeFlagToString(int uriModeFlags) { StringBuilder builder = new StringBuilder(); if ((uriModeFlags & Intent.FLAG_GRANT_READ_URI_PERMISSION) != 0) { builder.append("read and "); } if ((uriModeFlags & Intent.FLAG_GRANT_WRITE_URI_PERMISSION) != 0) { builder.append("write and "); } if ((uriModeFlags & Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION) != 0) { builder.append("persistable and "); } if ((uriModeFlags & Intent.FLAG_GRANT_PREFIX_URI_PERMISSION) != 0) { builder.append("prefix and "); } if (builder.length() > 5) { builder.setLength(builder.length() - 5); return builder.toString(); } else { throw new IllegalArgumentException("Unknown permission mode flags: " + uriModeFlags); } } private void enforceForUri( int modeFlags, int resultOfCheck, boolean selfToo, int uid, Uri uri, String message) { if (resultOfCheck != PackageManager.PERMISSION_GRANTED) { throw new SecurityException( (message != null ? (message + ": ") : "") + (selfToo ? "Neither user " + uid + " nor current process has " : "User " + uid + " does not have ") + uriModeFlagToString(modeFlags) + " permission on " + uri + "."); } } public void enforceUriPermission( Uri uri, int pid, int uid, int modeFlags, String message) { enforceForUri( modeFlags, checkUriPermission(uri, pid, uid, modeFlags), false, uid, uri, message); } public void enforceCallingUriPermission( Uri uri, int modeFlags, String message) { enforceForUri( modeFlags, checkCallingUriPermission(uri, modeFlags), false, Binder.getCallingUid(), uri, message); } public void enforceCallingOrSelfUriPermission( Uri uri, int modeFlags, String message) { enforceForUri( modeFlags, checkCallingOrSelfUriPermission(uri, modeFlags), true, Binder.getCallingUid(), uri, message); } public void enforceUriPermission( Uri uri, String readPermission, String writePermission, int pid, int uid, int modeFlags, String message) { enforceForUri(modeFlags, checkUriPermission( uri, readPermission, writePermission, pid, uid, modeFlags), false, uid, uri, message); } /** * Logs a warning if the system process directly called a method such as * {@link #startService(Intent)} instead of {@link #startServiceAsUser(Intent, UserHandle)}. * The "AsUser" variants allow us to properly enforce the user's restrictions. */ private void warnIfCallingFromSystemProcess() { if (Process.myUid() == Process.SYSTEM_UID) { Slog.w(TAG, "Calling a method in the system process without a qualified user: " + Debug.getCallers(5)); } } @Override public Context createApplicationContext(ApplicationInfo application, int flags) throws NameNotFoundException { LoadedApk pi = mMainThread.getPackageInfo(application, mResources.getCompatibilityInfo(), flags | CONTEXT_REGISTER_PACKAGE); if (pi != null) { final boolean restricted = (flags & CONTEXT_RESTRICTED) == CONTEXT_RESTRICTED; ContextImpl c = new ContextImpl(this, mMainThread, pi, mActivityToken, new UserHandle(UserHandle.getUserId(application.uid)), restricted, mDisplay, mOverrideConfiguration); if (c.mResources != null) { return c; } } throw new PackageManager.NameNotFoundException( "Application package " + application.packageName + " not found"); } @Override public Context createPackageContext(String packageName, int flags) throws NameNotFoundException { return createPackageContextAsUser(packageName, flags, mUser != null ? mUser : Process.myUserHandle()); } @Override public Context createPackageContextAsUser(String packageName, int flags, UserHandle user) throws NameNotFoundException { final boolean restricted = (flags & CONTEXT_RESTRICTED) == CONTEXT_RESTRICTED; if (packageName.equals("system") || packageName.equals("android")) { return new ContextImpl(this, mMainThread, mPackageInfo, mActivityToken, user, restricted, mDisplay, mOverrideConfiguration); } LoadedApk pi = mMainThread.getPackageInfo(packageName, mResources.getCompatibilityInfo(), flags | CONTEXT_REGISTER_PACKAGE, user.getIdentifier()); if (pi != null) { ContextImpl c = new ContextImpl(this, mMainThread, pi, mActivityToken, user, restricted, mDisplay, mOverrideConfiguration); if (c.mResources != null) { return c; } } // Should be a better exception. throw new PackageManager.NameNotFoundException( "Application package " + packageName + " not found"); } @Override public Context createConfigurationContext(Configuration overrideConfiguration) { if (overrideConfiguration == null) { throw new IllegalArgumentException("overrideConfiguration must not be null"); } return new ContextImpl(this, mMainThread, mPackageInfo, mActivityToken, mUser, mRestricted, mDisplay, overrideConfiguration); } @Override public Context createDisplayContext(Display display) { if (display == null) { throw new IllegalArgumentException("display must not be null"); } return new ContextImpl(this, mMainThread, mPackageInfo, mActivityToken, mUser, mRestricted, display, mOverrideConfiguration); } private int getDisplayId() { return mDisplay != null ? mDisplay.getDisplayId() : Display.DEFAULT_DISPLAY; } @Override public boolean isRestricted() { return mRestricted; } @Override public DisplayAdjustments getDisplayAdjustments(int displayId) { return mDisplayAdjustments; } private File getDataDirFile() { if (mPackageInfo != null) { return mPackageInfo.getDataDirFile(); } throw new RuntimeException("Not supported in system context"); } @Override public File getDir(String name, int mode) { name = "app_" + name; File file = makeFilename(getDataDirFile(), name); if (!file.exists()) { file.mkdir(); setFilePermissionsFromMode(file.getPath(), mode, FileUtils.S_IRWXU|FileUtils.S_IRWXG|FileUtils.S_IXOTH); } return file; } /** {@hide} */ public int getUserId() { return mUser.getIdentifier(); } static ContextImpl createSystemContext(ActivityThread mainThread) { LoadedApk packageInfo = new LoadedApk(mainThread); ContextImpl context = new ContextImpl(null, mainThread, packageInfo, null, null, false, null, null); context.mResources.updateConfiguration(context.mResourcesManager.getConfiguration(), context.mResourcesManager.getDisplayMetricsLocked(Display.DEFAULT_DISPLAY)); return context; } static ContextImpl createAppContext(ActivityThread mainThread, LoadedApk packageInfo) { if (packageInfo == null) throw new IllegalArgumentException("packageInfo"); return new ContextImpl(null, mainThread, packageInfo, null, null, false, null, null); } static ContextImpl createActivityContext(ActivityThread mainThread, LoadedApk packageInfo, IBinder activityToken) { if (packageInfo == null) throw new IllegalArgumentException("packageInfo"); if (activityToken == null) throw new IllegalArgumentException("activityInfo"); return new ContextImpl(null, mainThread, packageInfo, activityToken, null, false, null, null); } private ContextImpl(ContextImpl container, ActivityThread mainThread, LoadedApk packageInfo, IBinder activityToken, UserHandle user, boolean restricted, Display display, Configuration overrideConfiguration) { mOuterContext = this; mMainThread = mainThread; mActivityToken = activityToken; mRestricted = restricted; if (user == null) { user = Process.myUserHandle(); } mUser = user; mPackageInfo = packageInfo; mContentResolver = new ApplicationContentResolver(this, mainThread, user); mResourcesManager = ResourcesManager.getInstance(); mDisplay = display; mOverrideConfiguration = overrideConfiguration; final int displayId = getDisplayId(); CompatibilityInfo compatInfo = null; if (container != null) { compatInfo = container.getDisplayAdjustments(displayId).getCompatibilityInfo(); } if (compatInfo == null && displayId == Display.DEFAULT_DISPLAY) { compatInfo = packageInfo.getCompatibilityInfo(); } mDisplayAdjustments.setCompatibilityInfo(compatInfo); mDisplayAdjustments.setActivityToken(activityToken); Resources resources = packageInfo.getResources(mainThread); if (resources != null) { if (activityToken != null || displayId != Display.DEFAULT_DISPLAY || overrideConfiguration != null || (compatInfo != null && compatInfo.applicationScale != resources.getCompatibilityInfo().applicationScale)) { resources = mResourcesManager.getTopLevelResources(packageInfo.getResDir(), packageInfo.getSplitResDirs(), packageInfo.getOverlayDirs(), packageInfo.getApplicationInfo().sharedLibraryFiles, displayId, overrideConfiguration, compatInfo, activityToken); } } mResources = resources; if (container != null) { mBasePackageName = container.mBasePackageName; mOpPackageName = container.mOpPackageName; } else { mBasePackageName = packageInfo.mPackageName; ApplicationInfo ainfo = packageInfo.getApplicationInfo(); if (ainfo.uid == Process.SYSTEM_UID && ainfo.uid != Process.myUid()) { // Special case: system components allow themselves to be loaded in to other // processes. For purposes of app ops, we must then consider the context as // belonging to the package of this process, not the system itself, otherwise // the package+uid verifications in app ops will fail. mOpPackageName = ActivityThread.currentPackageName(); } else { mOpPackageName = mBasePackageName; } } } void installSystemApplicationInfo(ApplicationInfo info, ClassLoader classLoader) { mPackageInfo.installSystemApplicationInfo(info, classLoader); } final void scheduleFinalCleanup(String who, String what) { mMainThread.scheduleContextCleanup(this, who, what); } final void performFinalCleanup(String who, String what) { //Log.i(TAG, "Cleanup up context: " + this); mPackageInfo.removeContextRegistrations(getOuterContext(), who, what); } final Context getReceiverRestrictedContext() { if (mReceiverRestrictedContext != null) { return mReceiverRestrictedContext; } return mReceiverRestrictedContext = new ReceiverRestrictedContext(getOuterContext()); } final void setOuterContext(Context context) { mOuterContext = context; } final Context getOuterContext() { return mOuterContext; } final IBinder getActivityToken() { return mActivityToken; } static void setFilePermissionsFromMode(String name, int mode, int extraPermissions) { int perms = FileUtils.S_IRUSR|FileUtils.S_IWUSR |FileUtils.S_IRGRP|FileUtils.S_IWGRP |extraPermissions; if ((mode&MODE_WORLD_READABLE) != 0) { perms |= FileUtils.S_IROTH; } if ((mode&MODE_WORLD_WRITEABLE) != 0) { perms |= FileUtils.S_IWOTH; } if (DEBUG) { Log.i(TAG, "File " + name + ": mode=0x" + Integer.toHexString(mode) + ", perms=0x" + Integer.toHexString(perms)); } FileUtils.setPermissions(name, perms, -1, -1); } private File validateFilePath(String name, boolean createDirectory) { File dir; File f; if (name.charAt(0) == File.separatorChar) { String dirPath = name.substring(0, name.lastIndexOf(File.separatorChar)); dir = new File(dirPath); name = name.substring(name.lastIndexOf(File.separatorChar)); f = new File(dir, name); } else { dir = getDatabasesDir(); f = makeFilename(dir, name); } if (createDirectory && !dir.isDirectory() && dir.mkdir()) { FileUtils.setPermissions(dir.getPath(), FileUtils.S_IRWXU|FileUtils.S_IRWXG|FileUtils.S_IXOTH, -1, -1); } return f; } private File makeFilename(File base, String name) { if (name.indexOf(File.separatorChar) < 0) { return new File(base, name); } throw new IllegalArgumentException( "File " + name + " contains a path separator"); } /** * Ensure that given directories exist, trying to create them if missing. If * unable to create, they are filtered by replacing with {@code null}. */ private File[] ensureDirsExistOrFilter(File[] dirs) { File[] result = new File[dirs.length]; for (int i = 0; i < dirs.length; i++) { File dir = dirs[i]; if (!dir.exists()) { if (!dir.mkdirs()) { // recheck existence in case of cross-process race if (!dir.exists()) { // Failing to mkdir() may be okay, since we might not have // enough permissions; ask vold to create on our behalf. final IMountService mount = IMountService.Stub.asInterface( ServiceManager.getService("mount")); int res = -1; try { res = mount.mkdirs(getPackageName(), dir.getAbsolutePath()); } catch (RemoteException e) { } if (res != 0) { Log.w(TAG, "Failed to ensure directory: " + dir); dir = null; } } } } result[i] = dir; } return result; } // ---------------------------------------------------------------------- // ---------------------------------------------------------------------- // ---------------------------------------------------------------------- private static final class ApplicationContentResolver extends ContentResolver { private final ActivityThread mMainThread; private final UserHandle mUser; public ApplicationContentResolver( Context context, ActivityThread mainThread, UserHandle user) { super(context); mMainThread = Preconditions.checkNotNull(mainThread); mUser = Preconditions.checkNotNull(user); } @Override protected IContentProvider acquireProvider(Context context, String auth) { return mMainThread.acquireProvider(context, ContentProvider.getAuthorityWithoutUserId(auth), resolveUserIdFromAuthority(auth), true); } @Override protected IContentProvider acquireExistingProvider(Context context, String auth) { return mMainThread.acquireExistingProvider(context, ContentProvider.getAuthorityWithoutUserId(auth), resolveUserIdFromAuthority(auth), true); } @Override public boolean releaseProvider(IContentProvider provider) { return mMainThread.releaseProvider(provider, true); } @Override protected IContentProvider acquireUnstableProvider(Context c, String auth) { return mMainThread.acquireProvider(c, ContentProvider.getAuthorityWithoutUserId(auth), resolveUserIdFromAuthority(auth), false); } @Override public boolean releaseUnstableProvider(IContentProvider icp) { return mMainThread.releaseProvider(icp, false); } @Override public void unstableProviderDied(IContentProvider icp) { mMainThread.handleUnstableProviderDied(icp.asBinder(), true); } @Override public void appNotRespondingViaProvider(IContentProvider icp) { mMainThread.appNotRespondingViaProvider(icp.asBinder()); } /** @hide */ protected int resolveUserIdFromAuthority(String auth) { return ContentProvider.getUserIdFromAuthority(auth, mUser.getIdentifier()); } } }
[ "fraczwojciech@gmail.com" ]
fraczwojciech@gmail.com
c199b95f5e3ddf0c3385a19944aa87fcc489afcc
edde42df009475ae2672aed16bee5ce53187de94
/app/src/test/java/com/example/shreyanshsachan/recyclerlist/ExampleUnitTest.java
491d37e3b73ada2f04adfbdf64ca0b85496aee2c
[]
no_license
shreyansh2607/RecyclerList
f9d96becc6387183bd392a05883c9c07e7c13a1b
88a6418d6126a0ec792ed27751e651a0225541c2
refs/heads/master
2021-01-20T20:24:11.048118
2016-06-14T07:56:31
2016-06-14T07:56:31
61,103,260
0
0
null
null
null
null
UTF-8
Java
false
false
333
java
package com.example.shreyanshsachan.recyclerlist; 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); } }
[ "shreyansh2607@gmail.com" ]
shreyansh2607@gmail.com
ea4b34463f6cad331d5c8ba905576bd9f7acc6f5
18c45081047b67c0e6c450dce6d93d79b8bc5f40
/src/main/java/org/sid/catservice/entities/ProduitProjection.java
59f8ff96b598f22aca3a74c6a9152a5fe06af9a9
[]
no_license
Genius-coding/cat-service
2e8548e43c07a339bcb16d5842d22e0f77f409a2
039d2c8bf35c86f15332f71bccc43ea72ee025b2
refs/heads/master
2022-12-26T15:18:35.029224
2020-09-24T20:52:38
2020-09-24T20:52:38
298,392,523
0
0
null
null
null
null
UTF-8
Java
false
false
297
java
package org.sid.catservice.entities; import org.sid.catservice.entities.Produit; import org.springframework.data.rest.core.config.Projection; @Projection(name = "P1", types = Produit.class) public interface ProduitProjection { public String getDesignation(); public double getPrice(); }
[ "mohamed.boussarsar@outlook.com" ]
mohamed.boussarsar@outlook.com
7fecc6e41ce9a1ab1f62d54ea37116240b9c2eb6
63e36d35f51bea83017ec712179302a62608333e
/OnePlusCamera/android/support/v4/view/MarginLayoutParamsCompat.java
46813aad31e2430f893d31b02eddc1011bf38f6b
[]
no_license
hiepgaf/oneplus_blobs_decompiled
672aa002fa670bdcba8fdf34113bc4b8e85f8294
e1ab1f2dd111f905ff1eee18b6a072606c01c518
refs/heads/master
2021-06-26T11:24:21.954070
2017-08-26T12:45:56
2017-08-26T12:45:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,890
java
package android.support.v4.view; import android.os.Build.VERSION; import android.view.ViewGroup.MarginLayoutParams; public class MarginLayoutParamsCompat { static final MarginLayoutParamsCompatImpl IMPL = new MarginLayoutParamsCompatImplJbMr1(); static { if (Build.VERSION.SDK_INT < 17) { IMPL = new MarginLayoutParamsCompatImplBase(); return; } } public static int getLayoutDirection(ViewGroup.MarginLayoutParams paramMarginLayoutParams) { return IMPL.getLayoutDirection(paramMarginLayoutParams); } public static int getMarginEnd(ViewGroup.MarginLayoutParams paramMarginLayoutParams) { return IMPL.getMarginEnd(paramMarginLayoutParams); } public static int getMarginStart(ViewGroup.MarginLayoutParams paramMarginLayoutParams) { return IMPL.getMarginStart(paramMarginLayoutParams); } public static boolean isMarginRelative(ViewGroup.MarginLayoutParams paramMarginLayoutParams) { return IMPL.isMarginRelative(paramMarginLayoutParams); } public static void resolveLayoutDirection(ViewGroup.MarginLayoutParams paramMarginLayoutParams, int paramInt) { IMPL.resolveLayoutDirection(paramMarginLayoutParams, paramInt); } public static void setLayoutDirection(ViewGroup.MarginLayoutParams paramMarginLayoutParams, int paramInt) { IMPL.setLayoutDirection(paramMarginLayoutParams, paramInt); } public static void setMarginEnd(ViewGroup.MarginLayoutParams paramMarginLayoutParams, int paramInt) { IMPL.setMarginEnd(paramMarginLayoutParams, paramInt); } public static void setMarginStart(ViewGroup.MarginLayoutParams paramMarginLayoutParams, int paramInt) { IMPL.setMarginStart(paramMarginLayoutParams, paramInt); } static abstract interface MarginLayoutParamsCompatImpl { public abstract int getLayoutDirection(ViewGroup.MarginLayoutParams paramMarginLayoutParams); public abstract int getMarginEnd(ViewGroup.MarginLayoutParams paramMarginLayoutParams); public abstract int getMarginStart(ViewGroup.MarginLayoutParams paramMarginLayoutParams); public abstract boolean isMarginRelative(ViewGroup.MarginLayoutParams paramMarginLayoutParams); public abstract void resolveLayoutDirection(ViewGroup.MarginLayoutParams paramMarginLayoutParams, int paramInt); public abstract void setLayoutDirection(ViewGroup.MarginLayoutParams paramMarginLayoutParams, int paramInt); public abstract void setMarginEnd(ViewGroup.MarginLayoutParams paramMarginLayoutParams, int paramInt); public abstract void setMarginStart(ViewGroup.MarginLayoutParams paramMarginLayoutParams, int paramInt); } static class MarginLayoutParamsCompatImplBase implements MarginLayoutParamsCompat.MarginLayoutParamsCompatImpl { public int getLayoutDirection(ViewGroup.MarginLayoutParams paramMarginLayoutParams) { return 0; } public int getMarginEnd(ViewGroup.MarginLayoutParams paramMarginLayoutParams) { return paramMarginLayoutParams.rightMargin; } public int getMarginStart(ViewGroup.MarginLayoutParams paramMarginLayoutParams) { return paramMarginLayoutParams.leftMargin; } public boolean isMarginRelative(ViewGroup.MarginLayoutParams paramMarginLayoutParams) { return false; } public void resolveLayoutDirection(ViewGroup.MarginLayoutParams paramMarginLayoutParams, int paramInt) {} public void setLayoutDirection(ViewGroup.MarginLayoutParams paramMarginLayoutParams, int paramInt) {} public void setMarginEnd(ViewGroup.MarginLayoutParams paramMarginLayoutParams, int paramInt) { paramMarginLayoutParams.rightMargin = paramInt; } public void setMarginStart(ViewGroup.MarginLayoutParams paramMarginLayoutParams, int paramInt) { paramMarginLayoutParams.leftMargin = paramInt; } } static class MarginLayoutParamsCompatImplJbMr1 implements MarginLayoutParamsCompat.MarginLayoutParamsCompatImpl { public int getLayoutDirection(ViewGroup.MarginLayoutParams paramMarginLayoutParams) { return MarginLayoutParamsCompatJellybeanMr1.getLayoutDirection(paramMarginLayoutParams); } public int getMarginEnd(ViewGroup.MarginLayoutParams paramMarginLayoutParams) { return MarginLayoutParamsCompatJellybeanMr1.getMarginEnd(paramMarginLayoutParams); } public int getMarginStart(ViewGroup.MarginLayoutParams paramMarginLayoutParams) { return MarginLayoutParamsCompatJellybeanMr1.getMarginStart(paramMarginLayoutParams); } public boolean isMarginRelative(ViewGroup.MarginLayoutParams paramMarginLayoutParams) { return MarginLayoutParamsCompatJellybeanMr1.isMarginRelative(paramMarginLayoutParams); } public void resolveLayoutDirection(ViewGroup.MarginLayoutParams paramMarginLayoutParams, int paramInt) { MarginLayoutParamsCompatJellybeanMr1.resolveLayoutDirection(paramMarginLayoutParams, paramInt); } public void setLayoutDirection(ViewGroup.MarginLayoutParams paramMarginLayoutParams, int paramInt) { MarginLayoutParamsCompatJellybeanMr1.setLayoutDirection(paramMarginLayoutParams, paramInt); } public void setMarginEnd(ViewGroup.MarginLayoutParams paramMarginLayoutParams, int paramInt) { MarginLayoutParamsCompatJellybeanMr1.setMarginEnd(paramMarginLayoutParams, paramInt); } public void setMarginStart(ViewGroup.MarginLayoutParams paramMarginLayoutParams, int paramInt) { MarginLayoutParamsCompatJellybeanMr1.setMarginStart(paramMarginLayoutParams, paramInt); } } } /* Location: /Users/joshua/Desktop/system_framework/classes-dex2jar.jar!/android/support/v4/view/MarginLayoutParamsCompat.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */
[ "joshuous@gmail.com" ]
joshuous@gmail.com
de172bf6aa6b7edb003ff3df0d503e6b1b0e21a3
04b98f77c1c3c2cb42bfd65760aaa6eab4943e18
/src/main/java/com/amazon/jobhistory/service/dto/package-info.java
80f593e41f43a652119eb6bc4664b455d4c6bb08
[]
no_license
srimukh9/jobhistory
b37af6f863c1b8d74d20f2d999968239d6333c51
afe7ad007ecf65fd2799a4b16e17509afa7d6cf7
refs/heads/master
2022-12-22T06:24:09.297303
2020-02-06T16:01:20
2020-02-06T16:01:20
238,730,023
1
0
null
2022-12-16T04:43:50
2020-02-06T16:14:02
Java
UTF-8
Java
false
false
77
java
/** * Data Transfer Objects. */ package com.amazon.jobhistory.service.dto;
[ "ysrimukh@38f9d35e4a80.ant.amazon.com" ]
ysrimukh@38f9d35e4a80.ant.amazon.com
8f5f125f978ae646e039eba82f887e13978af3f0
c6fcf0e580e6b34ea3ef2ce4d00272a3c6707f61
/src/com/worker/SettingWorker/MoreInfoChangeWorker.java
f26e0015db76be6f5fc36cb5d98185629fe9c58e
[]
no_license
URJACK/ISAProgramming
4a7bf89fc648d130cbec32023f0df0185ca2822b
9974e6dcb946c90f5b6256228c8bfe0dab0c13d0
refs/heads/master
2021-01-23T16:36:26.589125
2017-06-16T09:25:13
2017-06-16T09:25:13
93,303,366
1
0
null
null
null
null
UTF-8
Java
false
false
1,844
java
package com.worker.SettingWorker; import com.json.Info_Status; import com.model.User; import com.tool.SessionOpenner; import org.hibernate.Session; import org.hibernate.Transaction; import javax.servlet.http.HttpServletRequest; /** * Created by FuFangzhou on 2017/6/7. */ public class MoreInfoChangeWorker implements SettingWorker { @Override public int work(HttpServletRequest rq, Info_Status is) { String account = rq.getParameter("account"); String introduce = rq.getParameter("introduce"); String major = rq.getParameter("major"); int clazz; if (!account.equals(rq.getSession().getAttribute("account"))) { is.setInfo("ANS"); is.setStatus(false); return 0; } try { clazz = Integer.parseInt(rq.getParameter("clazz")); } catch (Exception e) { is.setStatus(false); is.setInfo("Class设置只能为整数"); return 3; } Session session = null; try { session = SessionOpenner.getInstance().getSession(); Transaction tr = session.beginTransaction(); User user = (User) session.createQuery(String.format("FROM User WHERE account='%s'", account)).list().get(0); user.setIntroduce(introduce); user.setMajor(major); user.setClazz(clazz); session.saveOrUpdate(user); tr.commit(); is.setInfo("成功的修改了信息"); is.setStatus(true); return 1; } catch (Exception e) { is.setInfo("修改信息失败,可能是输入有误或者是服务器出错"); is.setStatus(false); return 2; } finally { if (session != null) session.close(); } } }
[ "316585692@qq.com" ]
316585692@qq.com
6e5854691e98cfe05aded143acea5c633498c3d7
8446388645c95ef2d69748d74f2073d385caa099
/sensor-emulator-master/sensor-emulator-master/src/main/java/com/vihari/egenchallenge/SensorController.java
03244d509a4ba10186b6210daefa8d552661652f
[]
no_license
viharij/Egen
ef51eb19d25f4db6f7f4233422ef301de2eec055
891cd5bf1cd240b63d6e1543b71d525836c219ab
refs/heads/master
2021-01-16T18:11:43.069926
2017-08-11T16:40:10
2017-08-11T16:40:10
100,051,287
0
0
null
null
null
null
UTF-8
Java
false
false
3,150
java
package com.vihari.egenchallenge; import java.util.ArrayList; import java.util.HashMap; import org.easyrules.api.RulesEngine; import org.easyrules.core.RulesEngineBuilder; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import com.vihari.egenchallenge.Alerts; import com.vihari.egenchallenge.Metrics; import com.vihari.egenchallenge.SensorAPI; @RestController public class SensorController { /* To insert Data of JSon with Timestamp and Value into MongoDB*/ @RequestMapping(value = "metric", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) public HashMap<String, String> addMetric(@RequestBody Metrics uiRequest) { /* Checking the rule condition and inserted in Alert if necessary*/ Rules rule=new Rules(uiRequest); RulesEngine ruleEngine =RulesEngineBuilder.aNewRulesEngine() .named("alertrule") .build(); ruleEngine.registerRule(rule); ruleEngine.fireRules(); /*API call to insert into Metric collection at MongoDB*/ SensorAPI sensorAPI = new SensorAPI(); String metricID = sensorAPI.createMetric(uiRequest); HashMap<String,String > resp = new HashMap<String, String>(); resp.put("Inserted_Metric with ID", metricID); return resp; } /* To insert Data of AlertRule Data with Timestamp and Value into MongoDB*/ @RequestMapping(value = "alert", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) public HashMap<String, String> addAlert(@RequestBody Alerts uiRequest) { SensorAPI sensorAPI = new SensorAPI(); String metricID = sensorAPI.createAlert(uiRequest); HashMap<String,String > resp = new HashMap<String, String>(); resp.put("Inserted_Alert with ID", metricID); return resp; } /* To read entire data in Metrics_Collection from MongoDB*/ @RequestMapping(value = "readAllMetrics", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<ArrayList> getAllMetrics() { SensorAPI SensorAPI = new SensorAPI(); ArrayList<Metrics> metric = SensorAPI.getAllMetrics(); return ResponseProcessor.returnPolishedResponse(ArrayList.class,metric); } /* To read entire data in Alerts_Collection from MongoDB*/ @RequestMapping(value = "readAllAlerts", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<ArrayList> getAllAlerts() { SensorAPI SensorAPI = new SensorAPI(); ArrayList<Metrics> metric = SensorAPI.getAllAlerts(); return ResponseProcessor.returnPolishedResponse(ArrayList.class,metric); } }
[ "viharij@hotmail.com" ]
viharij@hotmail.com
3d131be7d3d3317d5ffec9b853236e93cebe2a63
31b98c799f9d878eeb2a5f75e6a19f7d73e69e64
/Template Method Pattern/TemplateMethod/src/TM/AbstGameConnectHelper.java
aa8343d794cecd4e30283c60228fb5db186a46cc
[]
no_license
DongGeon0908/Java
228e49e4c342489130d7975f025dcb3d2fb260af
b97cbd80f0a489a781a6c1f84a4a961a088061d1
refs/heads/master
2023-04-27T19:11:13.900318
2021-05-19T03:21:59
2021-05-19T03:21:59
326,665,026
0
0
null
null
null
null
UTF-8
Java
false
false
1,048
java
package TM; public abstract class AbstGameConnectHelper { protected abstract String doSecurity(String string); protected abstract boolean authentication(String id, String password); protected abstract int authorization(String userName); protected abstract String connection(String info); // 템플릿 메소드 public String requestConnection(String encodedInfo) { // 보안 작업 -> 암호화 된 문자열을 복호화 String decodedInfo = doSecurity(encodedInfo); // 반환된 것을 가지고 아이디, 암호를 할당 String id = "aaa"; String password = "bbb"; if (!authentication(id, password)) { throw new Error("아이디 암호 불일치"); } String userName = "userName"; int i = authorization(password); switch (i) { case -1: throw new Error("셧 다운"); case 0: // 게임 매니저 break; case 1: // 유료회원 break; case 2: // 무료회원 break; case 3: // 권한 없음 break; default: // 기타 상황 break; } return connection(decodedInfo); } }
[ "wrjssmjdhappy@gmail.com" ]
wrjssmjdhappy@gmail.com
c462cb0d2f38f352fadda2414bd6ef8bda1f4859
a05011dff80b0367c2bcc2ffe02a89ad74c1cd5c
/XuLyChuoi/src/xulychuoi/XuLyChuoi.java
b760c7719fc5af7a821a9c702eae048609758c90
[]
no_license
sulleynguyen1992/javaadvance
772ab87ffec25ecab54ac3d00bba2c8d30a13449
8e5d6fa61d5ad287f3e6309ca5612958c2a69f81
refs/heads/master
2021-05-14T08:01:46.191410
2018-02-26T18:59:57
2018-02-26T18:59:57
116,282,926
0
0
null
null
null
null
UTF-8
Java
false
false
983
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 xulychuoi; /** * * @author sulleynguyen */ public class XuLyChuoi { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here String name = " Nguyen Trac Thang "; System.out.println(name); name = name.trim(); System.out.println("name: " + name); String[] arr = name.split(" "); String goodName = ""; for (String word : arr) { if (word.trim().length()!= 0) { goodName += word + " "; } } for (int i = 0; i < arr.length; i++) { System.out.println(arr[i]); } goodName = goodName.trim(); System.out.println("name 3: " + goodName); } }
[ "sulleynguyen@gmail.com" ]
sulleynguyen@gmail.com
f5f3e91dc78c6ef0725fc4718f084dca7cecdd26
0d7212ad0140791d2fb80d6a3543cc5f8817e0f6
/app_check/src/main/java/com/wms/ui/ScheduleCheckActivity.java
9b2ef489853d91c0b5ef25d285efce3e359d5f65
[]
no_license
xinxinyun/wms
3905792e85a43b795014cfcef59dc07673b97f93
0fb3b4015872d672003439f2c697c01fcc0add57
refs/heads/master
2021-07-09T06:52:17.825680
2020-08-28T00:42:58
2020-08-28T00:42:58
183,143,802
1
0
null
null
null
null
UTF-8
Java
false
false
12,306
java
package com.wms.ui; import android.graphics.Color; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.TypeReference; import com.wms.adapter.SchduleOnAdapter; import com.wms.bean.MaterialInfo; import com.wms.bean.MaterialOnSchedule; import com.wms.contants.WmsContanst; import com.wms.event.BackResult; import com.wms.event.GetRFIDThread; import com.wms.event.MyApp; import com.wms.util.Beeper; import com.wms.util.CallBackUtil; import com.wms.util.MLog; import com.wms.util.OkhttpUtil; import com.wms.util.SimpleFooter; import com.wms.util.SimpleHeader; import com.wms.util.StatusBarUtil; import com.wms.util.ZrcListView; import java.net.ConnectException; import java.net.SocketTimeoutException; import java.util.ArrayList; import java.util.HashMap; import cn.pedant.SweetAlert.SweetAlertDialog; import okhttp3.Call; public class ScheduleCheckActivity extends AppCompatActivity implements BackResult { private static final String TAG = "临期商品盘点"; private ZrcListView listView; private ArrayList<MaterialOnSchedule> materialInfoList; private SchduleOnAdapter adapter; private GetRFIDThread rfidThread ;//RFID标签信息获取线程 private ArrayList<String> rfidList = new ArrayList<>(); private SweetAlertDialog pTipDialog; private int epcSize = 0; /** * 缓存EPC码 */ private ArrayList<String> epcCodeList = new ArrayList<>(); /** * 异步回调刷新数据 */ private Handler myHandler = new Handler() { public void handleMessage(Message msg) { super.handleMessage(msg); switch (msg.what) { case 1: //动态更新列表内容 materialInfoList = JSON.parseObject(msg.obj.toString(), new TypeReference<ArrayList<MaterialOnSchedule>>() { }); if (materialInfoList == null || materialInfoList.size() == 0) { View view = findViewById(R.id.noResult); listView.setEmptyView(view); return; } //转换数据结构,方便实时查找 for (MaterialOnSchedule materialInfo : materialInfoList) { rfidList.add(materialInfo.getFridCode()); } adapter = new SchduleOnAdapter(getBaseContext(), materialInfoList); listView.setAdapter(adapter); SweetAlertDialog sweetAlertDialog = new SweetAlertDialog(ScheduleCheckActivity.this , SweetAlertDialog.SUCCESS_TYPE); sweetAlertDialog.setContentText("物资清单下载成功!"); sweetAlertDialog.setConfirmButton("开始盘点", new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sweetAlertDialog) { sweetAlertDialog.hide(); startInventory(); } }); sweetAlertDialog.setCancelable(true); sweetAlertDialog.show(); break; case 2: //报警提示物资已找到 Beeper.beep(Beeper.BEEPER_SHORT); pTipDialog.setContentText("您当前已找到" + epcSize + "件物资"); break; } } }; @Override public void postResult(String epcCode) { epcCode = epcCode.replaceAll(" ", ""); //如果不是重复扫描并且包含在物资盘点清单中,则直接蜂鸣声音并更新数量&& rfidList.contains(epcCode) if (!epcCodeList.contains(epcCode) && rfidList.contains(epcCode)) { Log.d(TAG, "已读取到RFID码【" + epcCode + "】"); Beeper.beep(Beeper.BEEPER_SHORT); epcCodeList.add(epcCode); epcSize++; Message message = Message.obtain(); message.what = 2; myHandler.sendMessage(message); } } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_out_time); Toolbar mToolbarTb = (Toolbar) findViewById(R.id.outtimeToolbar); setSupportActionBar(mToolbarTb); getSupportActionBar().setTitle(""); getSupportActionBar().setDisplayHomeAsUpEnabled(true); mToolbarTb.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); StatusBarUtil.setRootViewFitsSystemWindows(this, true); //设置状态栏透明 StatusBarUtil.setTranslucentStatus(this); StatusBarUtil.setStatusBarColor(this, Color.parseColor("#00CCFF")); pTipDialog = new SweetAlertDialog(this, SweetAlertDialog.WARNING_TYPE); pTipDialog.setCustomImage(R.drawable.blue_button_background); listView = (ZrcListView) findViewById(R.id.zOutTimeListView); // 设置下拉刷新的样式(可选,但如果没有Header则无法下拉刷新) SimpleHeader header = new SimpleHeader(this); header.setTextColor(0xff0066aa); header.setCircleColor(0xff33bbee); listView.setHeadable(header); // 设置加载更多的样式(可选) SimpleFooter footer = new SimpleFooter(this); footer.setCircleColor(0xff33bbee); listView.setFootable(footer); // 设置列表项出现动画(可选) listView.setItemAnimForTopIn(R.anim.topitem_in); listView.setItemAnimForBottomIn(R.anim.bottomitem_in); listView.refresh(); // 主动下拉刷新 // 下拉刷新事件回调(可选) listView.setOnRefreshStartListener(new ZrcListView.OnStartListener() { @Override public void onStart() { initData(); } }); MLog.e("poweron = " + MyApp.getMyApp().getIdataLib().powerOn()); rfidThread=new GetRFIDThread(); rfidThread.setBackResult(this); rfidThread.start(); } /** * 下载仓储区域盘点物资清单 */ private void initData() { HashMap<String, String> paramMap = new HashMap<>(); paramMap.put("token", "wms"); OkhttpUtil.okHttpPostJson(WmsContanst.OUTTIME_INVENTORY_SUBMIT, JSON.toJSONString(paramMap), new CallBackUtil.CallBackString() {//回调 @Override public void onFailure(Call call, Exception e) { Log.e(TAG, e.toString()); String errMsg = "物资清单下载失败!"; if (e instanceof SocketTimeoutException) { errMsg = "网络连接超时,请下拉刷新重试!"; } else if (e instanceof ConnectException) { errMsg = "网络连接失败,请连接网络!"; } listView.setRefreshSuccess(errMsg); } @Override public void onResponse(String response) { try { listView.setRefreshSuccess("加载成功"); Message message = Message.obtain(); message.what = 1; message.obj = response; myHandler.sendMessage(message); } catch (Exception e) { Log.e(TAG, e.toString()); String errMsg = "物资清单下载失败!"; if (e instanceof SocketTimeoutException) { errMsg = "网络连接超时,请下拉刷新重试!"; } listView.setRefreshSuccess(errMsg); } } }); } /** * 开始扫描 */ private void startInventory() { //如果物资计划列表为空,则不进行盘点 if (materialInfoList == null || materialInfoList.size() == 0) { final SweetAlertDialog sweetAlertDialog2 = new SweetAlertDialog(ScheduleCheckActivity.this, SweetAlertDialog.WARNING_TYPE); sweetAlertDialog2.setContentText("未下载到物资清单,请下拉刷新重试!"); sweetAlertDialog2.setConfirmButton("确定", new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sweetAlertDialog) { sweetAlertDialog2.hide(); listView.refresh(); } }); sweetAlertDialog2.show(); return; } //开启RFID盘存 if (!rfidThread.isIfPostMsg()) { rfidThread.setIfPostMsg(true); MLog.e("RFID开始盘存 = " + MyApp.getMyApp().getIdataLib().startInventoryTag()); } pTipDialog.setContentText("您当前已盘点" + epcSize + "件物资"); pTipDialog.setCancelable(false); //结束操作 pTipDialog.setConfirmButton("查看盘点结果", new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sweetAlertDialog) { //停止盘存 rfidThread.setIfPostMsg(false); MyApp.getMyApp().getIdataLib().stopInventory(); pTipDialog.hide(); //汇总计划列表 for (MaterialInfo materialInfo : materialInfoList) { String fridCode = materialInfo.getFridCode(); if (rfidList.contains(fridCode)) { materialInfo.setCheckQuantity(1); } } adapter.notifyDataSetChanged(); } }); pTipDialog.show(); } /** * rfid模块下线 */ private void offlineRFIDModule() { if(rfidThread!=null) { rfidThread.destoryThread(); } MLog.e("powerOff = " + MyApp.getMyApp().getIdataLib().powerOff()); rfidThread=null; } /** * 清除已扫描到的RFID码的缓存数据 */ private void clearScanRFID() { epcSize = 0; epcCodeList.clear(); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_schedule, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { //开始盘存 case R.id.menu_schedule_beginInventonry: //开始盘存 this.clearScanRFID(); this.startInventory(); break; case R.id.menu_schedule_revertInventory: //盘存复查 pTipDialog.show(); startInventory(); break; case R.id.menu_schedule_endInventory: clearScanRFID(); break; } return super.onOptionsItemSelected(item); } @Override protected void onDestroy() { super.onDestroy(); offlineRFIDModule(); if (pTipDialog != null) { pTipDialog.dismiss(); pTipDialog = null; } } @Override public void onBackPressed() { offlineRFIDModule(); finish(); } }
[ "1138454231@qq.com" ]
1138454231@qq.com
2b2f3107767290512f41594a9a6d0ad92d58352a
ca25c5fafd8ea71c555ca8ed15a5f2b9caaf90de
/src/TempTest76_100/Combination.java
3ded8dec9fd20df1575c63485398a167537e02d7
[]
no_license
crazyLayne/leetcode
2e5194f6d7ced26234b75ff6cabd2628fb26136d
3661bd42313086e71f19109ebb35f62362378e74
refs/heads/master
2020-03-26T14:20:48.579158
2018-08-19T14:53:02
2018-08-19T14:53:02
144,983,374
2
0
null
null
null
null
UTF-8
Java
false
false
805
java
package TempTest76_100; import java.util.ArrayList; import java.util.List; public class Combination { public static void main (String args[]){ combine(5,4); int[] nums=new int[2]; System.out.println(nums[1]); System.out.println(nums); } public static List<List<Integer>> combine(int n, int k) { List<List<Integer>> ans=new ArrayList<>(); List<Integer> an=new ArrayList<>(); recursion(n,k,ans,an,0,0); return ans; } public static void recursion(int n,int k,List<List<Integer>> ans,List<Integer> an,int count,int st){ if(count==k){ ans.add(new ArrayList<Integer>(an)); }else if(k-count>n-st)return; else if(count<k){ for(int i=st;i<n;i++){ an.add(i+1); recursion(n,k,ans,an,count+1,i+1); an.remove((Integer)(i+1)); } } } }
[ "1205240809@qq.com" ]
1205240809@qq.com
fb1f47506dd7dbc76880fa22c8a33b7966401256
91a38cfd3c11bc9bc9841997df38dbbc53e3467e
/app/src/main/java/edu/aku/hassannaqvi/mapps_form6/core/AndroidDatabaseManager.java
3b1725261c4a32501035dfd1aa721279e46998b2
[]
no_license
shznaqvi/MaPPSForm6
8beafad77b51fc284c7860592aa819a49c418bd2
824b798b6b55f76824aa21f222b4d7fc53eaed69
refs/heads/master
2021-06-04T13:20:00.228427
2019-07-26T05:59:51
2019-07-26T05:59:51
116,122,967
0
0
null
null
null
null
UTF-8
Java
false
false
63,512
java
package edu.aku.hassannaqvi.mapps_form6.core;//add your package name here example: package com.example.dbm; //all required import files import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; import android.database.Cursor; import android.graphics.Color; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.AdapterView.OnItemSelectedListener; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.HorizontalScrollView; import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.ScrollView; import android.widget.Spinner; import android.widget.TableLayout; import android.widget.TableRow; import android.widget.TableRow.LayoutParams; import android.widget.TextView; import android.widget.Toast; import java.util.ArrayList; import java.util.LinkedList; public class AndroidDatabaseManager extends Activity implements OnItemClickListener { //in the below line Change the text 'yourCustomSqlHelper' with your custom sqlitehelper class name. //Do not change the variable name dbm DatabaseHelper dbm; // all global variables TableLayout tableLayout; TableRow.LayoutParams tableRowParams; HorizontalScrollView hsv; ScrollView mainscrollview; LinearLayout mainLayout; TextView tvmessage; Button previous; Button next; Spinner select_table; TextView tv; indexInfo info = new indexInfo(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //in the below line Change the text 'yourCustomSqlHelper' with your custom sqlitehelper class name dbm = new DatabaseHelper(AndroidDatabaseManager.this); mainscrollview = new ScrollView(AndroidDatabaseManager.this); //the main linear layout to which all tables spinners etc will be added.In this activity every element is created dynamically to avoid using xml file mainLayout = new LinearLayout(AndroidDatabaseManager.this); mainLayout.setOrientation(LinearLayout.VERTICAL); mainLayout.setBackgroundColor(Color.WHITE); mainLayout.setScrollContainer(true); mainscrollview.addView(mainLayout); //all required layouts are created dynamically and added to the main scrollview setContentView(mainscrollview); //the first row of layout which has a text view and spinner final LinearLayout firstrow = new LinearLayout(AndroidDatabaseManager.this); firstrow.setPadding(0, 10, 0, 20); LinearLayout.LayoutParams firstrowlp = new LinearLayout.LayoutParams(0, 150); firstrowlp.weight = 1; TextView maintext = new TextView(AndroidDatabaseManager.this); maintext.setText("Select Table"); maintext.setTextSize(22); maintext.setLayoutParams(firstrowlp); select_table = new Spinner(AndroidDatabaseManager.this); select_table.setLayoutParams(firstrowlp); firstrow.addView(maintext); firstrow.addView(select_table); mainLayout.addView(firstrow); ArrayList<Cursor> alc; //the horizontal scroll view for table if the table content doesnot fit into screen hsv = new HorizontalScrollView(AndroidDatabaseManager.this); //the main table layout where the content of the sql tables will be displayed when user selects a table tableLayout = new TableLayout(AndroidDatabaseManager.this); tableLayout.setHorizontalScrollBarEnabled(true); hsv.addView(tableLayout); //the second row of the layout which shows number of records in the table selected by user final LinearLayout secondrow = new LinearLayout(AndroidDatabaseManager.this); secondrow.setPadding(0, 20, 0, 10); LinearLayout.LayoutParams secondrowlp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); secondrowlp.weight = 1; TextView secondrowtext = new TextView(AndroidDatabaseManager.this); secondrowtext.setText("No. Of Records : "); secondrowtext.setTextSize(20); secondrowtext.setLayoutParams(secondrowlp); tv = new TextView(AndroidDatabaseManager.this); tv.setTextSize(20); tv.setLayoutParams(secondrowlp); secondrow.addView(secondrowtext); secondrow.addView(tv); mainLayout.addView(secondrow); //A button which generates a text view from which user can write custome queries final EditText customquerytext = new EditText(this); customquerytext.setVisibility(View.GONE); customquerytext.setHint("Enter Your Query here and Click on Submit Query Button .Results will be displayed below"); mainLayout.addView(customquerytext); final Button submitQuery = new Button(AndroidDatabaseManager.this); submitQuery.setVisibility(View.GONE); submitQuery.setText("Submit Query"); submitQuery.setBackgroundColor(Color.parseColor("#BAE7F6")); mainLayout.addView(submitQuery); final TextView help = new TextView(AndroidDatabaseManager.this); help.setText("Click on the row below to update values or delete the tuple"); help.setPadding(0, 5, 0, 5); // the spinner which gives user a option to add new row , drop or delete table final Spinner spinnertable = new Spinner(AndroidDatabaseManager.this); mainLayout.addView(spinnertable); mainLayout.addView(help); hsv.setPadding(0, 10, 0, 10); hsv.setScrollbarFadingEnabled(false); hsv.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_INSET); mainLayout.addView(hsv); //the third layout which has buttons for the pagination of content from database final LinearLayout thirdrow = new LinearLayout(AndroidDatabaseManager.this); previous = new Button(AndroidDatabaseManager.this); previous.setText("Previous"); previous.setBackgroundColor(Color.parseColor("#BAE7F6")); previous.setLayoutParams(secondrowlp); next = new Button(AndroidDatabaseManager.this); next.setText("Next"); next.setBackgroundColor(Color.parseColor("#BAE7F6")); next.setLayoutParams(secondrowlp); TextView tvblank = new TextView(this); tvblank.setLayoutParams(secondrowlp); thirdrow.setPadding(0, 10, 0, 10); thirdrow.addView(previous); thirdrow.addView(tvblank); thirdrow.addView(next); mainLayout.addView(thirdrow); //the text view at the bottom of the screen which displays error or success messages after a query is executed tvmessage = new TextView(AndroidDatabaseManager.this); tvmessage.setText("Error Messages will be displayed here"); String Query = "SELECT name _id FROM sqlite_master WHERE type ='table'"; tvmessage.setTextSize(18); mainLayout.addView(tvmessage); final Button customQuery = new Button(AndroidDatabaseManager.this); customQuery.setText("Custom Query"); customQuery.setBackgroundColor(Color.parseColor("#BAE7F6")); mainLayout.addView(customQuery); customQuery.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { //set drop down to custom Query indexInfo.isCustomQuery = true; secondrow.setVisibility(View.GONE); spinnertable.setVisibility(View.GONE); help.setVisibility(View.GONE); customquerytext.setVisibility(View.VISIBLE); submitQuery.setVisibility(View.VISIBLE); select_table.setSelection(0); customQuery.setVisibility(View.GONE); } }); //when user enter a custom query in text view and clicks on submit query button //display results in tablelayout submitQuery.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { tableLayout.removeAllViews(); customQuery.setVisibility(View.GONE); ArrayList<Cursor> alc2; String Query10 = customquerytext.getText().toString(); Log.d("query", Query10); //pass the query to getdata method and get results alc2 = dbm.getData(Query10); final Cursor c4 = alc2.get(0); Cursor Message2 = alc2.get(1); Message2.moveToLast(); //if the query returns results display the results in table layout if (Message2.getString(0).equalsIgnoreCase("Success")) { tvmessage.setBackgroundColor(Color.parseColor("#2ecc71")); if (c4 != null) { tvmessage.setText("Queru Executed successfully.Number of rows returned :" + c4.getCount()); if (c4.getCount() > 0) { indexInfo.maincursor = c4; refreshTable(1); } } else { tvmessage.setText("Queru Executed successfully"); refreshTable(1); } } else { //if there is any error we displayed the error message at the bottom of the screen tvmessage.setBackgroundColor(Color.parseColor("#e74c3c")); tvmessage.setText("Error:" + Message2.getString(0)); } } }); //layout parameters for each row in the table tableRowParams = new TableRow.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); tableRowParams.setMargins(0, 0, 2, 0); // a query which returns a cursor with the list of tables in the database.We use this cursor to populate spinner in the first row alc = dbm.getData(Query); //the first cursor has reults of the query final Cursor c = alc.get(0); //the second cursor has error messages Cursor Message = alc.get(1); Message.moveToLast(); String msg = Message.getString(0); Log.d("Message from sql = ", msg); ArrayList<String> tablenames = new ArrayList<String>(); if (c != null) { c.moveToFirst(); tablenames.add("click here"); do { //add names of the table to tablenames array list tablenames.add(c.getString(0)); } while (c.moveToNext()); } //an array adapter with above created arraylist ArrayAdapter<String> tablenamesadapter = new ArrayAdapter<String>(AndroidDatabaseManager.this, android.R.layout.simple_spinner_item, tablenames) { public View getView(int position, View convertView, ViewGroup parent) { View v = super.getView(position, convertView, parent); v.setBackgroundColor(Color.WHITE); TextView adap = (TextView) v; adap.setTextSize(20); return adap; } public View getDropDownView(int position, View convertView, ViewGroup parent) { View v = super.getDropDownView(position, convertView, parent); v.setBackgroundColor(Color.WHITE); return v; } }; tablenamesadapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); if (tablenamesadapter != null) { //set the adpater to select_table spinner select_table.setAdapter(tablenamesadapter); } // when a table names is selecte display the table contents select_table.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) { if (pos == 0 && !indexInfo.isCustomQuery) { secondrow.setVisibility(View.GONE); hsv.setVisibility(View.GONE); thirdrow.setVisibility(View.GONE); spinnertable.setVisibility(View.GONE); help.setVisibility(View.GONE); tvmessage.setVisibility(View.GONE); customquerytext.setVisibility(View.GONE); submitQuery.setVisibility(View.GONE); customQuery.setVisibility(View.GONE); } if (pos != 0) { secondrow.setVisibility(View.VISIBLE); spinnertable.setVisibility(View.VISIBLE); help.setVisibility(View.VISIBLE); customquerytext.setVisibility(View.GONE); submitQuery.setVisibility(View.GONE); customQuery.setVisibility(View.VISIBLE); hsv.setVisibility(View.VISIBLE); tvmessage.setVisibility(View.VISIBLE); thirdrow.setVisibility(View.VISIBLE); c.moveToPosition(pos - 1); indexInfo.cursorpostion = pos - 1; //displaying the content of the table which is selected in the select_table spinner Log.d("selected table name is", "" + c.getString(0)); indexInfo.table_name = c.getString(0); tvmessage.setText("Error Messages will be displayed here"); tvmessage.setBackgroundColor(Color.WHITE); //removes any data if present in the table layout tableLayout.removeAllViews(); ArrayList<String> spinnertablevalues = new ArrayList<String>(); spinnertablevalues.add("Click here to change this table"); spinnertablevalues.add("Add row to this table"); spinnertablevalues.add("Delete this table"); spinnertablevalues.add("Drop this table"); ArrayAdapter<String> spinnerArrayAdapter = new ArrayAdapter<String>(getApplicationContext(), android.R.layout.simple_spinner_dropdown_item, spinnertablevalues); spinnerArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_item); // a array adapter which add values to the spinner which helps in user making changes to the table ArrayAdapter<String> adapter = new ArrayAdapter<String>(AndroidDatabaseManager.this, android.R.layout.simple_spinner_item, spinnertablevalues) { public View getView(int position, View convertView, ViewGroup parent) { View v = super.getView(position, convertView, parent); v.setBackgroundColor(Color.WHITE); TextView adap = (TextView) v; adap.setTextSize(20); return adap; } public View getDropDownView(int position, View convertView, ViewGroup parent) { View v = super.getDropDownView(position, convertView, parent); v.setBackgroundColor(Color.WHITE); return v; } }; adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinnertable.setAdapter(adapter); String Query2 = "select * from " + c.getString(0); Log.d("", "" + Query2); //getting contents of the table which user selected from the select_table spinner ArrayList<Cursor> alc2 = dbm.getData(Query2); final Cursor c2 = alc2.get(0); //saving cursor to the static indexinfo class which can be resued by the other functions indexInfo.maincursor = c2; // if the cursor returned form the database is not null we display the data in table layout if (c2 != null) { int counts = c2.getCount(); indexInfo.isEmpty = false; Log.d("counts", "" + counts); tv.setText("" + counts); //the spinnertable has the 3 items to drop , delete , add row to the table selected by the user //here we handle the 3 operations. spinnertable.setOnItemSelectedListener((new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) { ((TextView) parentView.getChildAt(0)).setTextColor(Color.rgb(0, 0, 0)); //when user selects to drop the table the below code in if block will be executed if (spinnertable.getSelectedItem().toString().equals("Drop this table")) { // an alert dialog to confirm user selection runOnUiThread(new Runnable() { @Override public void run() { if (!isFinishing()) { new AlertDialog.Builder(AndroidDatabaseManager.this) .setTitle("Are you sure ?") .setMessage("Pressing yes will remove " + indexInfo.table_name + " table from database") .setPositiveButton("yes", new DialogInterface.OnClickListener() { // when user confirms by clicking on yes we drop the table by executing drop table query public void onClick(DialogInterface dialog, int which) { String Query6 = "Drop table " + indexInfo.table_name; ArrayList<Cursor> aldropt = dbm.getData(Query6); Cursor tempc = aldropt.get(1); tempc.moveToLast(); Log.d("Drop table Mesage", tempc.getString(0)); if (tempc.getString(0).equalsIgnoreCase("Success")) { tvmessage.setBackgroundColor(Color.parseColor("#2ecc71")); tvmessage.setText(indexInfo.table_name + "Dropped successfully"); refreshactivity(); } else { //if there is any error we displayd the error message at the bottom of the screen tvmessage.setBackgroundColor(Color.parseColor("#e74c3c")); tvmessage.setText("Error:" + tempc.getString(0)); spinnertable.setSelection(0); } } }) .setNegativeButton("No", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { spinnertable.setSelection(0); } }) .create().show(); } } }); } //when user selects to drop the table the below code in if block will be executed if (spinnertable.getSelectedItem().toString().equals("Delete this table")) { // an alert dialog to confirm user selection runOnUiThread(new Runnable() { @Override public void run() { if (!isFinishing()) { new AlertDialog.Builder(AndroidDatabaseManager.this) .setTitle("Are you sure?") .setMessage("Clicking on yes will delete all the contents of " + indexInfo.table_name + " table from database") .setPositiveButton("yes", new DialogInterface.OnClickListener() { // when user confirms by clicking on yes we drop the table by executing delete table query public void onClick(DialogInterface dialog, int which) { String Query7 = "Delete from " + indexInfo.table_name; Log.d("delete table query", Query7); ArrayList<Cursor> aldeletet = dbm.getData(Query7); Cursor tempc = aldeletet.get(1); tempc.moveToLast(); Log.d("Delete table Mesage", tempc.getString(0)); if (tempc.getString(0).equalsIgnoreCase("Success")) { tvmessage.setBackgroundColor(Color.parseColor("#2ecc71")); tvmessage.setText(indexInfo.table_name + " table content deleted successfully"); indexInfo.isEmpty = true; refreshTable(0); } else { tvmessage.setBackgroundColor(Color.parseColor("#e74c3c")); tvmessage.setText("Error:" + tempc.getString(0)); spinnertable.setSelection(0); } } }) .setNegativeButton("No", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { spinnertable.setSelection(0); } }) .create().show(); } } }); } //when user selects to add row to the table the below code in if block will be executed if (spinnertable.getSelectedItem().toString().equals("Add row to this table")) { //we create a layout which has textviews with column names of the table and edittexts where //user can enter value which will be inserted into the datbase. final LinkedList<TextView> addnewrownames = new LinkedList<TextView>(); final LinkedList<EditText> addnewrowvalues = new LinkedList<EditText>(); final ScrollView addrowsv = new ScrollView(AndroidDatabaseManager.this); Cursor c4 = indexInfo.maincursor; if (indexInfo.isEmpty) { getcolumnnames(); for (int i = 0; i < indexInfo.emptytablecolumnnames.size(); i++) { String cname = indexInfo.emptytablecolumnnames.get(i); TextView tv = new TextView(getApplicationContext()); tv.setText(cname); addnewrownames.add(tv); } for (int i = 0; i < addnewrownames.size(); i++) { EditText et = new EditText(getApplicationContext()); addnewrowvalues.add(et); } } else { for (int i = 0; i < c4.getColumnCount(); i++) { String cname = c4.getColumnName(i); TextView tv = new TextView(getApplicationContext()); tv.setText(cname); addnewrownames.add(tv); } for (int i = 0; i < addnewrownames.size(); i++) { EditText et = new EditText(getApplicationContext()); addnewrowvalues.add(et); } } final RelativeLayout addnewlayout = new RelativeLayout(AndroidDatabaseManager.this); RelativeLayout.LayoutParams addnewparams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); addnewparams.addRule(RelativeLayout.ALIGN_PARENT_TOP); for (int i = 0; i < addnewrownames.size(); i++) { TextView tv = addnewrownames.get(i); EditText et = addnewrowvalues.get(i); int t = i + 400; int k = i + 500; int lid = i + 600; tv.setId(t); tv.setTextColor(Color.parseColor("#000000")); et.setBackgroundColor(Color.parseColor("#F2F2F2")); et.setTextColor(Color.parseColor("#000000")); et.setId(k); final LinearLayout ll = new LinearLayout(AndroidDatabaseManager.this); LinearLayout.LayoutParams tvl = new LinearLayout.LayoutParams(0, 100); tvl.weight = 1; ll.addView(tv, tvl); ll.addView(et, tvl); ll.setId(lid); Log.d("Edit Text Value", "" + et.getText().toString()); RelativeLayout.LayoutParams rll = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT); rll.addRule(RelativeLayout.BELOW, ll.getId() - 1); rll.setMargins(0, 20, 0, 0); addnewlayout.addView(ll, rll); } addnewlayout.setBackgroundColor(Color.WHITE); addrowsv.addView(addnewlayout); Log.d("Button Clicked", ""); //the above form layout which we have created above will be displayed in an alert dialog runOnUiThread(new Runnable() { @Override public void run() { if (!isFinishing()) { new AlertDialog.Builder(AndroidDatabaseManager.this) .setTitle("values") .setCancelable(false) .setView(addrowsv) .setPositiveButton("Add", new DialogInterface.OnClickListener() { // after entering values if user clicks on add we take the values and run a insert query public void onClick(DialogInterface dialog, int which) { indexInfo.index = 10; //tableLayout.removeAllViews(); //trigger select table listener to be triggerd String Query4 = "Insert into " + indexInfo.table_name + " ("; for (int i = 0; i < addnewrownames.size(); i++) { TextView tv = addnewrownames.get(i); tv.getText().toString(); if (i == addnewrownames.size() - 1) { Query4 = Query4 + tv.getText().toString(); } else { Query4 = Query4 + tv.getText().toString() + ", "; } } Query4 = Query4 + " ) VALUES ( "; for (int i = 0; i < addnewrownames.size(); i++) { EditText et = addnewrowvalues.get(i); et.getText().toString(); if (i == addnewrownames.size() - 1) { Query4 = Query4 + "'" + et.getText().toString() + "' ) "; } else { Query4 = Query4 + "'" + et.getText().toString() + "' , "; } } //this is the insert query which has been generated Log.d("Insert Query", Query4); ArrayList<Cursor> altc = dbm.getData(Query4); Cursor tempc = altc.get(1); tempc.moveToLast(); Log.d("Add New Row", tempc.getString(0)); if (tempc.getString(0).equalsIgnoreCase("Success")) { tvmessage.setBackgroundColor(Color.parseColor("#2ecc71")); tvmessage.setText("New Row added succesfully to " + indexInfo.table_name); refreshTable(0); } else { tvmessage.setBackgroundColor(Color.parseColor("#e74c3c")); tvmessage.setText("Error:" + tempc.getString(0)); spinnertable.setSelection(0); } } }) .setNegativeButton("close", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { spinnertable.setSelection(0); } }) .create().show(); } } }); } } public void onNothingSelected(AdapterView<?> arg0) { } })); //display the first row of the table with column names of the table selected by the user TableRow tableheader = new TableRow(getApplicationContext()); tableheader.setBackgroundColor(Color.BLACK); tableheader.setPadding(0, 2, 0, 2); for (int k = 0; k < c2.getColumnCount(); k++) { LinearLayout cell = new LinearLayout(AndroidDatabaseManager.this); cell.setBackgroundColor(Color.WHITE); cell.setLayoutParams(tableRowParams); final TextView tableheadercolums = new TextView(getApplicationContext()); // tableheadercolums.setBackgroundDrawable(gd); tableheadercolums.setPadding(0, 0, 4, 3); tableheadercolums.setText("" + c2.getColumnName(k)); tableheadercolums.setTextColor(Color.parseColor("#000000")); //columsView.setLayoutParams(tableRowParams); cell.addView(tableheadercolums); tableheader.addView(cell); } tableLayout.addView(tableheader); c2.moveToFirst(); //after displaying columnnames in the first row we display data in the remaining columns //the below paginatetbale function will display the first 10 tuples of the tables //the remaining tuples can be viewed by clicking on the next button paginatetable(c2.getCount()); } else { //if the cursor returned from the database is empty we show that table is empty help.setVisibility(View.GONE); tableLayout.removeAllViews(); getcolumnnames(); TableRow tableheader2 = new TableRow(getApplicationContext()); tableheader2.setBackgroundColor(Color.BLACK); tableheader2.setPadding(0, 2, 0, 2); LinearLayout cell = new LinearLayout(AndroidDatabaseManager.this); cell.setBackgroundColor(Color.WHITE); cell.setLayoutParams(tableRowParams); final TextView tableheadercolums = new TextView(getApplicationContext()); tableheadercolums.setPadding(0, 0, 4, 3); tableheadercolums.setText(" Table Is Empty "); tableheadercolums.setTextSize(30); tableheadercolums.setTextColor(Color.RED); cell.addView(tableheadercolums); tableheader2.addView(cell); tableLayout.addView(tableheader2); tv.setText("" + 0); } } } @Override public void onNothingSelected(AdapterView<?> arg0) { } }); } //get columnnames of the empty tables and save them in a array list public void getcolumnnames() { ArrayList<Cursor> alc3 = dbm.getData("PRAGMA table_info(" + indexInfo.table_name + ")"); Cursor c5 = alc3.get(0); indexInfo.isEmpty = true; if (c5 != null) { indexInfo.isEmpty = true; ArrayList<String> emptytablecolumnnames = new ArrayList<String>(); c5.moveToFirst(); do { emptytablecolumnnames.add(c5.getString(1)); } while (c5.moveToNext()); indexInfo.emptytablecolumnnames = emptytablecolumnnames; } } //displays alert dialog from which use can update or delete a row public void updateDeletePopup(int row) { Cursor c2 = indexInfo.maincursor; // a spinner which gives options to update or delete the row which user has selected ArrayList<String> spinnerArray = new ArrayList<String>(); spinnerArray.add("Click Here to Change this row"); spinnerArray.add("Update this row"); spinnerArray.add("Delete this row"); //create a layout with text values which has the column names and //edit texts which has the values of the row which user has selected final ArrayList<String> value_string = indexInfo.value_string; final LinkedList<TextView> columnames = new LinkedList<TextView>(); final LinkedList<EditText> columvalues = new LinkedList<EditText>(); for (int i = 0; i < c2.getColumnCount(); i++) { String cname = c2.getColumnName(i); TextView tv = new TextView(getApplicationContext()); tv.setText(cname); columnames.add(tv); } for (int i = 0; i < columnames.size(); i++) { String cv = value_string.get(i); EditText et = new EditText(getApplicationContext()); value_string.add(cv); et.setText(cv); columvalues.add(et); } int lastrid = 0; // all text views , edit texts are added to this relative layout lp final RelativeLayout lp = new RelativeLayout(AndroidDatabaseManager.this); lp.setBackgroundColor(Color.WHITE); RelativeLayout.LayoutParams lay = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); lay.addRule(RelativeLayout.ALIGN_PARENT_TOP); final ScrollView updaterowsv = new ScrollView(AndroidDatabaseManager.this); LinearLayout lcrud = new LinearLayout(AndroidDatabaseManager.this); LinearLayout.LayoutParams paramcrudtext = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); paramcrudtext.setMargins(0, 20, 0, 0); //spinner which displays update , delete options final Spinner crud_dropdown = new Spinner(getApplicationContext()); ArrayAdapter<String> crudadapter = new ArrayAdapter<String>(AndroidDatabaseManager.this, android.R.layout.simple_spinner_item, spinnerArray) { public View getView(int position, View convertView, ViewGroup parent) { View v = super.getView(position, convertView, parent); v.setBackgroundColor(Color.WHITE); TextView adap = (TextView) v; adap.setTextSize(20); return adap; } public View getDropDownView(int position, View convertView, ViewGroup parent) { View v = super.getDropDownView(position, convertView, parent); v.setBackgroundColor(Color.WHITE); return v; } }; crudadapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); crud_dropdown.setAdapter(crudadapter); lcrud.setId(299); lcrud.addView(crud_dropdown, paramcrudtext); RelativeLayout.LayoutParams rlcrudparam = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT); rlcrudparam.addRule(RelativeLayout.BELOW, lastrid); lp.addView(lcrud, rlcrudparam); for (int i = 0; i < columnames.size(); i++) { TextView tv = columnames.get(i); EditText et = columvalues.get(i); int t = i + 100; int k = i + 200; int lid = i + 300; tv.setId(t); tv.setTextColor(Color.parseColor("#000000")); et.setBackgroundColor(Color.parseColor("#F2F2F2")); et.setSingleLine(true); et.setTextColor(Color.parseColor("#000000")); et.setId(k); Log.d("text View Value", "" + tv.getText().toString()); final LinearLayout ll = new LinearLayout(AndroidDatabaseManager.this); ll.setBackgroundColor(Color.parseColor("#FFFFFF")); ll.setId(lid); LinearLayout.LayoutParams lpp = new LinearLayout.LayoutParams(0, 100); lpp.weight = 1; tv.setLayoutParams(lpp); et.setLayoutParams(lpp); et.setPadding(0, 0, 0, 0); ll.addView(tv); ll.addView(et); Log.d("Edit Text Value", "" + et.getText().toString()); RelativeLayout.LayoutParams rll = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT); rll.addRule(RelativeLayout.BELOW, ll.getId() - 1); rll.setMargins(0, 20, 0, 0); lastrid = ll.getId(); lp.addView(ll, rll); } updaterowsv.addView(lp); //after the layout has been created display it in a alert dialog runOnUiThread(new Runnable() { @Override public void run() { if (!isFinishing()) { new AlertDialog.Builder(AndroidDatabaseManager.this) .setTitle("values") .setView(updaterowsv) .setCancelable(false) .setPositiveButton("Ok", new DialogInterface.OnClickListener() { //this code will be executed when user changes values of edit text or spinner and clicks on ok button public void onClick(DialogInterface dialog, int which) { //get spinner value String spinner_value = crud_dropdown.getSelectedItem().toString(); //it he spinner value is update this row get the values from //edit text fields generate a update query and execute it if (spinner_value.equalsIgnoreCase("Update this row")) { indexInfo.index = 10; String Query3 = "UPDATE " + indexInfo.table_name + " SET "; for (int i = 0; i < columnames.size(); i++) { TextView tvc = columnames.get(i); EditText etc = columvalues.get(i); if (!etc.getText().toString().equals("null")) { Query3 = Query3 + tvc.getText().toString() + " = "; if (i == columnames.size() - 1) { Query3 = Query3 + "'" + etc.getText().toString() + "'"; } else { Query3 = Query3 + "'" + etc.getText().toString() + "' , "; } } } Query3 = Query3 + " where "; for (int i = 0; i < columnames.size(); i++) { TextView tvc = columnames.get(i); if (!value_string.get(i).equals("null")) { Query3 = Query3 + tvc.getText().toString() + " = "; if (i == columnames.size() - 1) { Query3 = Query3 + "'" + value_string.get(i) + "' "; } else { Query3 = Query3 + "'" + value_string.get(i) + "' and "; } } } Log.d("Update Query", Query3); //dbm.getData(Query3); ArrayList<Cursor> aluc = dbm.getData(Query3); Cursor tempc = aluc.get(1); tempc.moveToLast(); Log.d("Update Mesage", tempc.getString(0)); if (tempc.getString(0).equalsIgnoreCase("Success")) { tvmessage.setBackgroundColor(Color.parseColor("#2ecc71")); tvmessage.setText(indexInfo.table_name + " table Updated Successfully"); refreshTable(0); } else { tvmessage.setBackgroundColor(Color.parseColor("#e74c3c")); tvmessage.setText("Error:" + tempc.getString(0)); } } //it he spinner value is delete this row get the values from //edit text fields generate a delete query and execute it if (spinner_value.equalsIgnoreCase("Delete this row")) { indexInfo.index = 10; String Query5 = "DELETE FROM " + indexInfo.table_name + " WHERE "; for (int i = 0; i < columnames.size(); i++) { TextView tvc = columnames.get(i); if (!value_string.get(i).equals("null")) { Query5 = Query5 + tvc.getText().toString() + " = "; if (i == columnames.size() - 1) { Query5 = Query5 + "'" + value_string.get(i) + "' "; } else { Query5 = Query5 + "'" + value_string.get(i) + "' and "; } } } Log.d("Delete Query", Query5); dbm.getData(Query5); ArrayList<Cursor> aldc = dbm.getData(Query5); Cursor tempc = aldc.get(1); tempc.moveToLast(); Log.d("Update Mesage", tempc.getString(0)); if (tempc.getString(0).equalsIgnoreCase("Success")) { tvmessage.setBackgroundColor(Color.parseColor("#2ecc71")); tvmessage.setText("Row deleted from " + indexInfo.table_name + " table"); refreshTable(0); } else { tvmessage.setBackgroundColor(Color.parseColor("#e74c3c")); tvmessage.setText("Error:" + tempc.getString(0)); } } } }) .setNegativeButton("close", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { } }) .create().show(); } } }); } public void refreshactivity() { finish(); startActivity(getIntent()); } public void refreshTable(int d) { Cursor c3 = null; tableLayout.removeAllViews(); if (d == 0) { String Query8 = "select * from " + indexInfo.table_name; ArrayList<Cursor> alc3 = dbm.getData(Query8); c3 = alc3.get(0); //saving cursor to the static indexinfo class which can be resued by the other functions indexInfo.maincursor = c3; } if (d == 1) { c3 = indexInfo.maincursor; } // if the cursor returened form tha database is not null we display the data in table layout if (c3 != null) { int counts = c3.getCount(); Log.d("counts", "" + counts); tv.setText("" + counts); TableRow tableheader = new TableRow(getApplicationContext()); tableheader.setBackgroundColor(Color.BLACK); tableheader.setPadding(0, 2, 0, 2); for (int k = 0; k < c3.getColumnCount(); k++) { LinearLayout cell = new LinearLayout(AndroidDatabaseManager.this); cell.setBackgroundColor(Color.WHITE); cell.setLayoutParams(tableRowParams); final TextView tableheadercolums = new TextView(getApplicationContext()); tableheadercolums.setPadding(0, 0, 4, 3); tableheadercolums.setText("" + c3.getColumnName(k)); tableheadercolums.setTextColor(Color.parseColor("#000000")); cell.addView(tableheadercolums); tableheader.addView(cell); } tableLayout.addView(tableheader); c3.moveToFirst(); //after displaying column names in the first row we display data in the remaining columns //the below paginate table function will display the first 10 tuples of the tables //the remaining tuples can be viewed by clicking on the next button paginatetable(c3.getCount()); } else { TableRow tableheader2 = new TableRow(getApplicationContext()); tableheader2.setBackgroundColor(Color.BLACK); tableheader2.setPadding(0, 2, 0, 2); LinearLayout cell = new LinearLayout(AndroidDatabaseManager.this); cell.setBackgroundColor(Color.WHITE); cell.setLayoutParams(tableRowParams); final TextView tableheadercolums = new TextView(getApplicationContext()); tableheadercolums.setPadding(0, 0, 4, 3); tableheadercolums.setText(" Table Is Empty "); tableheadercolums.setTextSize(30); tableheadercolums.setTextColor(Color.RED); cell.addView(tableheadercolums); tableheader2.addView(cell); tableLayout.addView(tableheader2); tv.setText("" + 0); } } //the function which displays tuples from database in a table layout public void paginatetable(final int number) { final Cursor c3 = indexInfo.maincursor; indexInfo.numberofpages = (c3.getCount() / 10) + 1; indexInfo.currentpage = 1; c3.moveToFirst(); int currentrow = 0; //display the first 10 tuples of the table selected by user do { final TableRow tableRow = new TableRow(getApplicationContext()); tableRow.setBackgroundColor(Color.BLACK); tableRow.setPadding(0, 2, 0, 2); for (int j = 0; j < c3.getColumnCount(); j++) { LinearLayout cell = new LinearLayout(this); cell.setBackgroundColor(Color.WHITE); cell.setLayoutParams(tableRowParams); final TextView columsView = new TextView(getApplicationContext()); String column_data = ""; try { column_data = c3.getString(j); } catch (Exception e) { // Column data is not a string , do not display it } columsView.setText(column_data); columsView.setTextColor(Color.parseColor("#000000")); columsView.setPadding(0, 0, 4, 3); cell.addView(columsView); tableRow.addView(cell); } tableRow.setVisibility(View.VISIBLE); currentrow = currentrow + 1; //we create listener for each table row when clicked a alert dialog will be displayed //from where user can update or delete the row tableRow.setOnClickListener(new OnClickListener() { public void onClick(View v) { final ArrayList<String> value_string = new ArrayList<String>(); for (int i = 0; i < c3.getColumnCount(); i++) { LinearLayout llcolumn = (LinearLayout) tableRow.getChildAt(i); TextView tc = (TextView) llcolumn.getChildAt(0); String cv = tc.getText().toString(); value_string.add(cv); } indexInfo.value_string = value_string; //the below function will display the alert dialog updateDeletePopup(0); } }); tableLayout.addView(tableRow); } while (c3.moveToNext() && currentrow < 10); indexInfo.index = currentrow; // when user clicks on the previous button update the table with the previous 10 tuples from the database previous.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { int tobestartindex = (indexInfo.currentpage - 2) * 10; //if the tbale layout has the first 10 tuples then toast that this is the first page if (indexInfo.currentpage == 1) { Toast.makeText(getApplicationContext(), "This is the first page", Toast.LENGTH_LONG).show(); } else { indexInfo.currentpage = indexInfo.currentpage - 1; c3.moveToPosition(tobestartindex); boolean decider = true; for (int i = 1; i < tableLayout.getChildCount(); i++) { TableRow tableRow = (TableRow) tableLayout.getChildAt(i); if (decider) { tableRow.setVisibility(View.VISIBLE); for (int j = 0; j < tableRow.getChildCount(); j++) { LinearLayout llcolumn = (LinearLayout) tableRow.getChildAt(j); TextView columsView = (TextView) llcolumn.getChildAt(0); columsView.setText("" + c3.getString(j)); } decider = !c3.isLast(); if (!c3.isLast()) { c3.moveToNext(); } } else { tableRow.setVisibility(View.GONE); } } indexInfo.index = tobestartindex; Log.d("index =", "" + indexInfo.index); } } }); // when user clicks on the next button update the table with the next 10 tuples from the database next.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //if there are no tuples to be shown toast that this the last page if (indexInfo.currentpage >= indexInfo.numberofpages) { Toast.makeText(getApplicationContext(), "This is the last page", Toast.LENGTH_LONG).show(); } else { indexInfo.currentpage = indexInfo.currentpage + 1; boolean decider = true; for (int i = 1; i < tableLayout.getChildCount(); i++) { TableRow tableRow = (TableRow) tableLayout.getChildAt(i); if (decider) { tableRow.setVisibility(View.VISIBLE); for (int j = 0; j < tableRow.getChildCount(); j++) { LinearLayout llcolumn = (LinearLayout) tableRow.getChildAt(j); TextView columsView = (TextView) llcolumn.getChildAt(0); columsView.setText("" + c3.getString(j)); } decider = !c3.isLast(); if (!c3.isLast()) { c3.moveToNext(); } } else { tableRow.setVisibility(View.GONE); } } } } }); } @Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { // TODO Auto-generated method stub } //a static class to save cursor,table values etc which is used by functions to share data in the program. static class indexInfo { public static int index = 10; public static int numberofpages = 0; public static int currentpage = 0; public static String table_name = ""; public static Cursor maincursor; public static int cursorpostion = 0; public static ArrayList<String> value_string; public static ArrayList<String> tableheadernames; public static ArrayList<String> emptytablecolumnnames; public static boolean isEmpty; public static boolean isCustomQuery; } }
[ "shznaqvi@gmail.com" ]
shznaqvi@gmail.com
bdc20366a5dd1bfed5e62d41063bee71877af0ad
b0123c70aa0429ba567f0b8ec145c561085cf3a4
/src/test/java/com/example/alimi/Repository/ScheduleInfoRepositoryTest.java
2a9d293080f57cbfc1fe38aaf55f16604100e36c
[]
no_license
GreedTy/Alimi
21c04fcd17a40d8e170a6ffc9b5c0f15a9612a9c
eb0048259a30637fd6bfc940cb9adc99631cb91a
refs/heads/main
2023-06-20T06:36:29.043236
2021-07-14T17:50:41
2021-07-14T17:50:41
384,886,257
0
0
null
null
null
null
UTF-8
Java
false
false
2,759
java
package com.example.alimi.Repository; import com.example.alimi.Domain.Day; import com.example.alimi.Domain.ScheduleInfo; import com.example.alimi.Domain.StudyGroup; import com.example.alimi.Domain.StudyReservation; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase; import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit.jupiter.SpringExtension; import java.util.HashSet; import java.util.List; import java.util.Set; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.*; @ExtendWith(SpringExtension.class) @AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE) @DataJpaTest class ScheduleInfoRepositoryTest { @Autowired ScheduleInfoRepository scheduleInfoRepository; @Test public void scheduleInfoList() { ScheduleInfo scheduleInfo = new ScheduleInfo(); //StudySchedule studySchedule = new StudySchedule(); /*scheduleInfo.setName("영어 문법 공부"); scheduleInfo.setDay(Day.MON); scheduleInfo.setStart_hour("11:00"); scheduleInfo.setEnd_hour("13:00"); StudySchedule studySchedule = new StudySchedule(); studySchedule.setScheduleInfo(scheduleInfo); StudyGroup studyGroup = new StudyGroup(); studyGroup.setName("영어모임"); studySchedule.setStudyGroup(studyGroup); ScheduleInfo scheduleInfo1 = new ScheduleInfo(); scheduleInfo1.setName("수학 문법 공부"); scheduleInfo1.setDay(Day.TUE); scheduleInfo1.setStart_hour("18:00"); scheduleInfo1.setEnd_hour("20:00"); StudySchedule studySchedule1 = new StudySchedule(); studySchedule1.setScheduleInfo(scheduleInfo1); StudyGroup studyGroup1 = new StudyGroup(); studyGroup1.setName("영어모임"); studySchedule1.setStudyGroup(studyGroup1); Set<StudySchedule> studyScheduleSet = new HashSet<>(); studyScheduleSet.add(studySchedule); studyScheduleSet.add(studySchedule1); scheduleInfo.setStudySchedules(studyScheduleSet); scheduleInfoRepository.save(scheduleInfo); scheduleInfoRepository.save(scheduleInfo1); scheduleInfoRepository.findAll().stream().forEach( c-> { System.out.println(c.getName()); System.out.println(c.getDay()); System.out.println(c.getStart_hour()); System.out.println(c.getEnd_hour()); });*/ } }
[ "yhi002521@gmail.com" ]
yhi002521@gmail.com
dd5adc734dceefa09cb01f968aaaf586f36f39d9
da58bcde1b510cbff702802532a34b4d473ef44d
/arc-core/src/arc/graphics/gl/FrameBuffer.java
ef541b884dd5bd798326844c514058e96f0f3aec
[ "MIT" ]
permissive
genNAowl/Arc
5e04a2d1071955928d92d5c4213ea0a19476ff01
4c1628cd48133c5c1fd6bd430146c7b661381521
refs/heads/master
2023-05-05T03:20:32.752914
2021-05-26T20:01:19
2021-05-26T20:01:19
332,317,272
0
1
MIT
2021-02-04T23:12:46
2021-01-23T22:05:16
null
UTF-8
Java
false
false
5,848
java
package arc.graphics.gl; import arc.graphics.*; import arc.graphics.Pixmap.*; import arc.graphics.Texture.*; import arc.graphics.g2d.*; import arc.util.*; /** * <p> * Encapsulates OpenGL ES 2.0 frame buffer objects. This is a simple helper class which should cover most FBO uses. It will * automatically create a texture for the color attachment and a renderbuffer for the depth buffer. You can get a hold of the * texture by {@link FrameBuffer#getTexture()}. This class will only work with OpenGL ES 2.0. * </p> * * <p> * FrameBuffers are managed. In case of an OpenGL context loss, which only happens on Android when a user switches to another * application or receives an incoming call, the framebuffer will be automatically recreated. * </p> * * <p> * A FrameBuffer must be disposed if it is no longer needed * </p> * @author mzechner, realitix */ public class FrameBuffer extends GLFrameBuffer<Texture>{ private Format format; /** * Creates a GLFrameBuffer from the specifications provided by bufferBuilder **/ protected FrameBuffer(GLFrameBufferBuilder<? extends GLFrameBuffer<Texture>> bufferBuilder){ super(bufferBuilder); } /** Creates a new 2x2 buffer. Resize before use. */ public FrameBuffer(){ this(2, 2); } /** Creates a new FrameBuffer having the given dimensions in the format RGBA8888 and no depth buffer.*/ public FrameBuffer(int width, int height){ this(Format.rgba8888, width, height, false, false); } /** Creates a new FrameBuffer having the given dimensions and no depth buffer. */ public FrameBuffer(Pixmap.Format format, int width, int height){ this(format, width, height, false, false); } /** Creates a new FrameBuffer having the given dimensions and potentially a depth buffer attached. */ public FrameBuffer(Pixmap.Format format, int width, int height, boolean hasDepth){ this(format, width, height, hasDepth, false); } /** Creates a new FrameBuffer having the given dimensions and potentially a depth buffer attached. */ public FrameBuffer(int width, int height, boolean hasDepth){ this(Format.rgba8888, width, height, hasDepth, false); } /** * Creates a new FrameBuffer having the given dimensions and potentially a depth and a stencil buffer attached. * @param format the format of the color buffer; according to the OpenGL ES 2.0 spec, only RGB565, RGBA4444 and RGB5_A1 are * color-renderable * @param width the width of the framebuffer in pixels * @param height the height of the framebuffer in pixels * @param hasDepth whether to attach a depth buffer * @throws ArcRuntimeException in case the FrameBuffer could not be created */ public FrameBuffer(Pixmap.Format format, int width, int height, boolean hasDepth, boolean hasStencil){ create(format, width, height, hasDepth, hasStencil); } protected void create(Pixmap.Format format, int width, int height, boolean hasDepth, boolean hasStencil){ width = Math.max(width, 2); height = Math.max(height, 2); this.format = format; FrameBufferBuilder frameBufferBuilder = new FrameBufferBuilder(width, height); frameBufferBuilder.addBasicColorTextureAttachment(format); if(hasDepth) frameBufferBuilder.addBasicDepthRenderBuffer(); if(hasStencil) frameBufferBuilder.addBasicStencilRenderBuffer(); this.bufferBuilder = frameBufferBuilder; build(); } /** Blits this buffer onto the screen using the specified shader. */ public void blit(Shader shader){ Draw.blit(this, shader); } /** Note that this does nothing if the width and height are correct. */ public void resize(int width, int height){ //prevent incomplete attachment issues. width = Math.max(width, 2); height = Math.max(height, 2); //ignore pointless resizing if(width == getWidth() && height == getHeight()) return; TextureFilter min = getTexture().getMinFilter(), mag = getTexture().getMagFilter(); boolean hasDepth = depthbufferHandle != 0, hasStencil = stencilbufferHandle != 0; dispose(); FrameBufferBuilder frameBufferBuilder = new FrameBufferBuilder(width, height); frameBufferBuilder.addBasicColorTextureAttachment(format); if(hasDepth) frameBufferBuilder.addBasicDepthRenderBuffer(); if(hasStencil) frameBufferBuilder.addBasicStencilRenderBuffer(); this.bufferBuilder = frameBufferBuilder; this.textureAttachments.clear(); this.framebufferHandle = 0; this.depthbufferHandle = 0; this.stencilbufferHandle = 0; this.depthStencilPackedBufferHandle = 0; this.hasDepthStencilPackedBuffer = this.isMRT = false; build(); getTexture().setFilter(min, mag); } /** See {@link GLFrameBuffer#unbind()} */ public static void unbind(){ GLFrameBuffer.unbind(); } @Override protected Texture createTexture(FrameBufferTextureAttachmentSpec attachmentSpec){ GLOnlyTextureData data = new GLOnlyTextureData(bufferBuilder.width, bufferBuilder.height, 0, attachmentSpec.internalFormat, attachmentSpec.format, attachmentSpec.type); Texture result = new Texture(data); result.setFilter(TextureFilter.linear, TextureFilter.linear); result.setWrap(TextureWrap.clampToEdge, TextureWrap.clampToEdge); return result; } @Override protected void disposeColorTexture(Texture colorTexture){ colorTexture.dispose(); } @Override protected void attachFrameBufferColorTexture(Texture texture){ Gl.framebufferTexture2D(Gl.framebuffer, GL20.GL_COLOR_ATTACHMENT0, GL20.GL_TEXTURE_2D, texture.getTextureObjectHandle(), 0); } }
[ "arnukren@gmail.com" ]
arnukren@gmail.com
9188a6b4f9fa7fd517bf14503c6a9adb4af80c12
0184dd0d5e4ec421d467e924e8c9c286107386ec
/src/main/java/by/it_academy/Weather/WeatherList.java
5b069419430f2cd47fe8a12f1aa28dc006497b39
[]
no_license
MaryiaDuk/FinalProject
8da5355225a2597b01933e8fc46ba5beda0bcb14
af10b8192bbeec1aacc8ac2f075752202ff22192
refs/heads/master
2020-03-16T09:41:52.776413
2018-05-08T14:26:11
2018-05-08T14:26:11
132,620,872
0
0
null
null
null
null
UTF-8
Java
false
false
186
java
package by.it_academy.Weather; import java.util.List; public class WeatherList { private List<Weather> place; public List<Weather> getPlace() { return place; } }
[ "mashaduk1996@gmail.com" ]
mashaduk1996@gmail.com
e4d08d7f3404113eb89951dd8b75f236a2fad944
b81f25f239c55d7104eac6fa669d073c7588ed37
/src/main/java/com/appsdeveloper/app/ws/SpringApplicationContext.java
b5fde47d426a594765b41c6c320d2ec5016140bc
[]
no_license
anhphu195/todo-app-ws
50a204cec3e32e6e3c3e9f127e1a19baf470d3ea
7f4025a83905390523d88e1690418d91785ef7fe
refs/heads/main
2023-02-19T22:00:13.388731
2021-01-25T05:25:28
2021-01-25T05:25:28
332,372,188
0
0
null
null
null
null
UTF-8
Java
false
false
563
java
package com.appsdeveloper.app.ws; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; public class SpringApplicationContext implements ApplicationContextAware { private static ApplicationContext CONTEXT; @Override public void setApplicationContext(ApplicationContext context) throws BeansException { CONTEXT = context; } public static Object getBean(String beanName) { return CONTEXT.getBean(beanName); } }
[ "anhphu195@gmail.com" ]
anhphu195@gmail.com
735cc725ed5c502d671eccc0b82219e763d90451
1fe32e81615616ab87e11e099ffab893817f061e
/src/main/java/com/switchfully/jan/order/controlers/dto/AdminDto.java
a75f6f011622001314108fcdf85b4d4dd24b27f9
[]
no_license
JanKlok64/order
e05eb11e8f30850ccbdca577856430070062a6b5
c5d9b73d26ec620a7b89e4dd0b320929156526d0
refs/heads/master
2023-01-04T10:48:14.285914
2020-10-29T15:44:59
2020-10-29T15:44:59
307,960,373
0
0
null
null
null
null
UTF-8
Java
false
false
1,353
java
package com.switchfully.jan.order.controlers.dto; import com.switchfully.jan.order.instances.Address; public class AdminDto { private String uuid; private String firstName; private String lastName; private String email; private Address address; private String phoneNumber; public String getUuid() { return uuid; } public String getFirstName() { return firstName; } public String getLastName() { return lastName; } public String getEmail() { return email; } public Address getAddress() { return address; } public String getPhoneNumber() { return phoneNumber; } public AdminDto setUuid(String uuid) { this.uuid = uuid; return this; } public AdminDto setFirstName(String firstName) { this.firstName = firstName; return this; } public AdminDto setLastName(String lastName) { this.lastName = lastName; return this; } public AdminDto setEmail(String email) { this.email = email; return this; } public AdminDto setAddress(Address address) { this.address = address; return this; } public AdminDto setPhoneNumber(String phoneNumber) { this.phoneNumber = phoneNumber; return this; } }
[ "jan.klok@cegeka.com" ]
jan.klok@cegeka.com
0bd629d743fb0e531be32119a9cfadbe5d8cf05b
8dd048e13d3eda700679fef15bf1cb850b5dc702
/datastructures/src/linkedList/PalindromeLinkedList.java
ef201758ba4ac61e1ecc26de652e170e7a642346
[]
no_license
llenroc/dsa-1
24060f2029c35bb745c2ddda42a4a37785165fd0
c875ce35ce52c91d98193467e3c2e4ad00b670c5
refs/heads/master
2023-09-02T21:24:40.365423
2021-11-19T07:43:07
2021-11-19T07:43:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,733
java
package linkedList; import java.util.Stack; //https://leetcode.com/explore/interview/card/top-interview-questions-easy/93/linked-list/772/ public class PalindromeLinkedList { static ListNode left; public static void main(String[] args) { ListNode l1 = new ListNode(1); ListNode l2 = new ListNode(2); ListNode l3 = new ListNode(1); l1.next = l2; l2.next = l3; left = l1; System.out.println(lPalin(l1)); } public static int lPalin(ListNode head) { if (head == null) return 1; int isp = lPalin(head.next); if (isp == 0) return 0; int isp1 = (left.val == head.val) ? 1 : 0; left = left.next; return isp1; } public boolean isPalindromeStack1(ListNode head) { Stack<Integer> stack = new Stack<>(); int length = length(head); ListNode current = head; int halfLength = length % 2 == 0 ? length / 2 : length / 2 + 1; while (halfLength-- != 0) { if (length % 2 != 0 && halfLength == 0) { current = current.next; break; } stack.push(current.val); current = current.next; } while (current != null) { int top = stack.pop(); if (top != current.val) return false; current = current.next; } return true; } private int length(ListNode current) { int count = 0; while (current != null) { current = current.next; count++; } return count; } public boolean isPalindromeStack2(ListNode head) { ListNode current; current = head; Stack<Integer> stack = new Stack<>(); while (current != null) { stack.push(current.val); current = current.next; } current = head; while (!stack.isEmpty()) { int top = stack.pop(); if (current.val != top) return false; else current = current.next; } return true; } }
[ "diptikaushik09@gmail.com" ]
diptikaushik09@gmail.com
03405c26854986a5c3f9110c7868db01bd2e889f
c7e3e98a958b707b78881c334397e814d266219f
/android/app/src/debug/java/com/transistorsoft/backgroundgeolocation/react/ReactNativeFlipper.java
6d7a8d5c00ec551643282bb4dbb28ce5cc1ebcfe
[ "MIT" ]
permissive
infinitosolucoes/rn-background-geolocation-demo
6a70d78a694fe504b44fc4b303dd4fe0486b58a6
44d2a06b3787d770f5558ca7804671d390a4cf64
refs/heads/master
2023-03-30T02:27:13.080199
2021-03-25T18:02:13
2021-03-25T18:02:13
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,297
java
/** * Copyright (c) Facebook, Inc. and its affiliates. * * <p>This source code is licensed under the MIT license found in the LICENSE file in the root * directory of this source tree. */ package com.transistorsoft.backgroundgeolocation.react; import android.content.Context; import com.facebook.flipper.android.AndroidFlipperClient; import com.facebook.flipper.android.utils.FlipperUtils; import com.facebook.flipper.core.FlipperClient; import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin; import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin; import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin; import com.facebook.flipper.plugins.inspector.DescriptorMapping; import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin; import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor; import com.facebook.flipper.plugins.network.NetworkFlipperPlugin; import com.facebook.flipper.plugins.react.ReactFlipperPlugin; import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin; import com.facebook.react.ReactInstanceManager; import com.facebook.react.bridge.ReactContext; import com.facebook.react.modules.network.NetworkingModule; import okhttp3.OkHttpClient; public class ReactNativeFlipper { public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) { if (FlipperUtils.shouldEnableFlipper(context)) { final FlipperClient client = AndroidFlipperClient.getInstance(context); client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults())); client.addPlugin(new ReactFlipperPlugin()); client.addPlugin(new DatabasesFlipperPlugin(context)); client.addPlugin(new SharedPreferencesFlipperPlugin(context)); client.addPlugin(CrashReporterPlugin.getInstance()); NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin(); NetworkingModule.setCustomClientBuilder( new NetworkingModule.CustomClientBuilder() { @Override public void apply(OkHttpClient.Builder builder) { builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin)); } }); client.addPlugin(networkFlipperPlugin); client.start(); // Fresco Plugin needs to ensure that ImagePipelineFactory is initialized // Hence we run if after all native modules have been initialized ReactContext reactContext = reactInstanceManager.getCurrentReactContext(); if (reactContext == null) { reactInstanceManager.addReactInstanceEventListener( new ReactInstanceManager.ReactInstanceEventListener() { @Override public void onReactContextInitialized(ReactContext reactContext) { reactInstanceManager.removeReactInstanceEventListener(this); reactContext.runOnNativeModulesQueueThread( new Runnable() { @Override public void run() { client.addPlugin(new FrescoFlipperPlugin()); } }); } }); } else { client.addPlugin(new FrescoFlipperPlugin()); } } } }
[ "christocracy@gmail.com" ]
christocracy@gmail.com
ceba77eef9c549e91e6133fad023ea8b651545ca
40bbe6f6fed3f027ad8b3d25fb9c8775be3d808d
/src/test/java/com/sdt/api/client/demo/ApiClientDemoApplicationTests.java
c59e884e75b6573cf3ddad20272b21c803d3b7c6
[]
no_license
otacu/api-client-demo
f37df5f56efc4d4fb9c287624fa4df42997c7dba
00de1000e29327255f354ac11fc0ad32c8bace08
refs/heads/master
2022-07-07T11:26:35.699944
2019-12-24T10:28:58
2019-12-24T10:28:58
229,920,727
0
0
null
2022-06-17T02:44:50
2019-12-24T10:21:44
Java
UTF-8
Java
false
false
231
java
package com.sdt.api.client.demo; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class ApiClientDemoApplicationTests { @Test void contextLoads() { } }
[ "jingsheng-ye@msyc.cc" ]
jingsheng-ye@msyc.cc
5accfe5b32ca1100c134cb260632d3277e39b852
e977c424543422f49a25695665eb85bfc0700784
/benchmark/icse15/944370/buggy-version/incubator/aries/trunk/jndi/jndi-url/src/test/java/org/apache/aries/jndi/url/ServiceRegistryContextTest.java
a57b8e74433379e4999f5ac22b70e28e6677857a
[]
no_license
amir9979/pattern-detector-experiment
17fcb8934cef379fb96002450d11fac62e002dd3
db67691e536e1550245e76d7d1c8dced181df496
refs/heads/master
2022-02-18T10:24:32.235975
2019-09-13T15:42:55
2019-09-13T15:42:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
22,346
java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.aries.jndi.url; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import java.lang.reflect.Field; import java.sql.SQLException; import java.util.Hashtable; import java.util.Properties; import javax.naming.Binding; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NameClassPair; import javax.naming.NameNotFoundException; import javax.naming.NamingEnumeration; import javax.naming.NamingException; import javax.naming.spi.ObjectFactory; import javax.sql.DataSource; import org.apache.aries.jndi.ContextHelper; import org.apache.aries.jndi.OSGiObjectFactoryBuilder; import org.apache.aries.mocks.BundleContextMock; import org.apache.aries.mocks.BundleMock; import org.apache.aries.unittest.mocks.MethodCall; import org.apache.aries.unittest.mocks.Skeleton; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.framework.Constants; import org.osgi.framework.ServiceException; import org.osgi.framework.ServiceFactory; import org.osgi.framework.ServiceReference; import org.osgi.framework.ServiceRegistration; /** * Tests for our JNDI implementation for the service registry. */ public class ServiceRegistryContextTest { /** The service we register by default */ private Runnable service; /** The bundle context for the test */ private BundleContext bc; /** The service registration for the service */ private ServiceRegistration reg; /** * This method does the setup to ensure we always have a service. * @throws NamingException * @throws NoSuchFieldException * @throws SecurityException * @throws IllegalAccessException * @throws IllegalArgumentException */ @Before public void registerService() throws NamingException, SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException { bc = Skeleton.newMock(new BundleContextMock(), BundleContext.class); new Activator().start(bc); new org.apache.aries.jndi.startup.Activator().start(bc); Field f = ContextHelper.class.getDeclaredField("context"); f.setAccessible(true); f.set(null, bc); OSGiObjectFactoryBuilder.setBundleContext(bc); service = Skeleton.newMock(Runnable.class); registerService(service); } /** * Register a service in our map. * * @param service2 The service to register. */ private void registerService(Runnable service2) { ServiceFactory factory = Skeleton.newMock(ServiceFactory.class); Skeleton skel = Skeleton.getSkeleton(factory); skel.setReturnValue(new MethodCall(ServiceFactory.class, "getService", Bundle.class, ServiceRegistration.class), service2); Hashtable<String, String> props = new Hashtable<String, String>(); props.put("rubbish", "smelly"); reg = bc.registerService(new String[] {"java.lang.Runnable"}, factory, props); } /** * Make sure we clear the caches out before the next test. */ @After public void teardown() { BundleContextMock.clear(); Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader()); } @Test public void testBaseLookup() throws NamingException { BundleMock mock = new BundleMock("scooby.doo", new Properties()); Thread.currentThread().setContextClassLoader(mock.getClassLoader()); InitialContext ctx = new InitialContext(); Context ctx2 = (Context) ctx.lookup("osgi:service"); Runnable r = (Runnable) ctx2.lookup("java.lang.Runnable"); assertNotNull(r); } /** * This test checks that we correctly register and deregister the url context * object factory in the service registry. */ @Test public void testJNDIRegistration() { ServiceReference ref = bc.getServiceReference(ObjectFactory.class.getName()); assertNotNull("The aries url context object factory was not registered", ref); ObjectFactory factory = (ObjectFactory) bc.getService(ref); assertNotNull("The aries url context object factory was null", factory); } @Test public void jndiLookupServiceNameTest() throws NamingException, SQLException { InitialContext ctx = new InitialContext(new Hashtable<Object, Object>()); BundleMock mock = new BundleMock("scooby.doo", new Properties()); Thread.currentThread().setContextClassLoader(mock.getClassLoader()); DataSource first = Skeleton.newMock(DataSource.class); DataSource second = Skeleton.newMock(DataSource.class); Hashtable<String, String> properties = new Hashtable<String, String>(); properties.put("osgi.jndi.service.name", "jdbc/myDataSource"); bc.registerService(DataSource.class.getName(), first, properties); properties = new Hashtable<String, String>(); properties.put("osgi.jndi.service.name", "jdbc/myDataSource2"); bc.registerService(DataSource.class.getName(), second, properties); DataSource s = (DataSource) ctx.lookup("osgi:service/jdbc/myDataSource"); assertNotNull(s); s = (DataSource) ctx.lookup("osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/myDataSource2)"); assertNotNull(s); s.isWrapperFor(DataSource.class); // don't care about the method, just need to call something. Skeleton.getSkeleton(second).assertCalled(new MethodCall(DataSource.class, "isWrapperFor", Class.class)); } /** * This test does a simple JNDI lookup to prove that works. * @throws NamingException */ @Test public void simpleJNDILookup() throws NamingException { System.setProperty(Context.URL_PKG_PREFIXES, "helloMatey"); InitialContext ctx = new InitialContext(new Hashtable<Object, Object>()); BundleMock mock = new BundleMock("scooby.doo", new Properties()); Thread.currentThread().setContextClassLoader(mock.getClassLoader()); Runnable s = (Runnable) ctx.lookup("aries:services/java.lang.Runnable"); assertNotNull("We didn't get a service back from our lookup :(", s); s.run(); Skeleton.getSkeleton(service).assertCalledExactNumberOfTimes(new MethodCall(Runnable.class, "run"), 1); Skeleton skel = Skeleton.getSkeleton(mock.getBundleContext()); skel.assertCalled(new MethodCall(BundleContext.class, "getServiceReferences", "java.lang.Runnable", null)); mock = new BundleMock("scooby.doo", new Properties()); Thread.currentThread().setContextClassLoader(mock.getClassLoader()); s = (Runnable) ctx.lookup("osgi:service/java.lang.Runnable"); // Check we have the packages set correctly String packages = System.getProperty(Context.URL_PKG_PREFIXES, null); assertTrue(ctx.getEnvironment().containsValue(packages)); assertNotNull("We didn't get a service back from our lookup :(", s); s.run(); Skeleton.getSkeleton(service).assertCalledExactNumberOfTimes(new MethodCall(Runnable.class, "run"), 2); skel = Skeleton.getSkeleton(mock.getBundleContext()); skel.assertCalled(new MethodCall(BundleContext.class, "getServiceReferences", "java.lang.Runnable", null)); } /** * This test checks that we can pass a filter in without things blowing up. * Right now our mock service registry does not implement filtering, so the * effect is the same as simpleJNDILookup, but we at least know it is not * blowing up. * * @throws NamingException */ @Test public void jndiLookupWithFilter() throws NamingException { BundleMock mock = new BundleMock("scooby.doo", new Properties()); Thread.currentThread().setContextClassLoader(mock.getClassLoader()); InitialContext ctx = new InitialContext(); Object s = ctx.lookup("aries:services/java.lang.Runnable/(rubbish=smelly)"); assertNotNull("We didn't get a service back from our lookup :(", s); service.run(); Skeleton.getSkeleton(service).assertCalledExactNumberOfTimes(new MethodCall(Runnable.class, "run"), 1); Skeleton.getSkeleton(mock.getBundleContext()).assertCalled(new MethodCall(BundleContext.class, "getServiceReferences", "java.lang.Runnable", "(rubbish=smelly)")); } /** * Check that we get a NameNotFoundException if we lookup after the service * has been unregistered. * * @throws NamingException */ @Test(expected=NameNotFoundException.class) public void testLookupWhenServiceHasBeenRemoved() throws NamingException { reg.unregister(); BundleMock mock = new BundleMock("scooby.doo", new Properties()); Thread.currentThread().setContextClassLoader(mock.getClassLoader()); InitialContext ctx = new InitialContext(); ctx.lookup("aries:services/java.lang.Runnable"); } /** * Check that we get a NameNotFoundException if we lookup something not in the * registry. * * @throws NamingException */ @Test(expected=NameNotFoundException.class) public void testLookupForServiceWeNeverHad() throws NamingException { BundleMock mock = new BundleMock("scooby.doo", new Properties()); Thread.currentThread().setContextClassLoader(mock.getClassLoader()); InitialContext ctx = new InitialContext(); ctx.lookup("aries:services/java.lang.Integer"); } /** * This test checks that we can list the contents of the repository using the * list method * * @throws NamingException */ public void listRepositoryContents() throws NamingException { InitialContext ctx = new InitialContext(); NamingEnumeration<NameClassPair> serviceList = ctx.list("aries:services/java.lang.Runnable/(rubbish=smelly)"); checkThreadRetrievedViaListMethod(serviceList); assertFalse("The repository contained more objects than we expected", serviceList.hasMoreElements()); //Now add a second service registerService(new Thread()); serviceList = ctx.list("aries:services/java.lang.Runnable/(rubbish=smelly)"); checkThreadRetrievedViaListMethod(serviceList); checkThreadRetrievedViaListMethod(serviceList); assertFalse("The repository contained more objects than we expected", serviceList.hasMoreElements()); } @Test public void checkProxyDynamism() throws NamingException { BundleMock mock = new BundleMock("scooby.doo", new Properties()); Thread.currentThread().setContextClassLoader(mock.getClassLoader()); InitialContext ctx = new InitialContext(); String className = Runnable.class.getName(); Runnable t = Skeleton.newMock(Runnable.class); Runnable t2 = Skeleton.newMock(Runnable.class); // we don't want the default service reg.unregister(); ServiceRegistration reg = bc.registerService(className, t, null); bc.registerService(className, t2, null); Runnable r = (Runnable) ctx.lookup("osgi:service/java.lang.Runnable"); r.run(); Skeleton.getSkeleton(t).assertCalledExactNumberOfTimes(new MethodCall(Runnable.class, "run"), 1); Skeleton.getSkeleton(t2).assertNotCalled(new MethodCall(Runnable.class, "run")); reg.unregister(); r.run(); Skeleton.getSkeleton(t).assertCalledExactNumberOfTimes(new MethodCall(Runnable.class, "run"), 1); Skeleton.getSkeleton(t2).assertCalledExactNumberOfTimes(new MethodCall(Runnable.class, "run"), 1); } @Test public void checkServiceListLookup() throws NamingException { BundleMock mock = new BundleMock("scooby.doo", new Properties()); Thread.currentThread().setContextClassLoader(mock.getClassLoader()); InitialContext ctx = new InitialContext(); String className = Runnable.class.getName(); Runnable t = Skeleton.newMock(Runnable.class); // we don't want the default service reg.unregister(); ServiceRegistration reg = bc.registerService(className, t, null); ServiceRegistration reg2 = bc.registerService("java.lang.Thread", new Thread(), null); Context ctx2 = (Context) ctx.lookup("osgi:servicelist/java.lang.Runnable"); Runnable r = (Runnable) ctx2.lookup(String.valueOf(reg.getReference().getProperty(Constants.SERVICE_ID))); r.run(); Skeleton.getSkeleton(t).assertCalled(new MethodCall(Runnable.class, "run")); reg.unregister(); try { r.run(); fail("Should have received a ServiceException"); } catch (ServiceException e) { assertEquals("service exception has the wrong type", ServiceException.UNREGISTERED, e.getType()); } try { ctx2.lookup(String.valueOf(reg2.getReference().getProperty(Constants.SERVICE_ID))); fail("Expected a NameNotFoundException"); } catch (NameNotFoundException e) { } } @Test public void checkServiceListList() throws NamingException { BundleMock mock = new BundleMock("scooby.doo", new Properties()); Thread.currentThread().setContextClassLoader(mock.getClassLoader()); InitialContext ctx = new InitialContext(); String className = Runnable.class.getName(); Runnable t = Skeleton.newMock(Runnable.class); // we don't want the default service reg.unregister(); ServiceRegistration reg = bc.registerService(className, t, null); ServiceRegistration reg2 = bc.registerService(className, new Thread(), null); NamingEnumeration<NameClassPair> ne = ctx.list("osgi:servicelist/" + className); assertTrue(ne.hasMoreElements()); NameClassPair ncp = ne.nextElement(); assertEquals(String.valueOf(reg.getReference().getProperty(Constants.SERVICE_ID)), ncp.getName()); assertTrue("Class name not correct. Was: " + ncp.getClassName(), ncp.getClassName().contains("Proxy")); assertTrue(ne.hasMoreElements()); ncp = ne.nextElement(); assertEquals(String.valueOf(reg2.getReference().getProperty(Constants.SERVICE_ID)), ncp.getName()); assertEquals("Class name not correct.", Thread.class.getName(), ncp.getClassName()); assertFalse(ne.hasMoreElements()); } @Test public void checkServiceListListBindings() throws NamingException { BundleMock mock = new BundleMock("scooby.doo", new Properties()); Thread.currentThread().setContextClassLoader(mock.getClassLoader()); InitialContext ctx = new InitialContext(); String className = Runnable.class.getName(); MethodCall run = new MethodCall(Runnable.class, "run"); Runnable t = Skeleton.newMock(Runnable.class); Runnable t2 = Skeleton.newMock(Runnable.class); // we don't want the default service reg.unregister(); ServiceRegistration reg = bc.registerService(className, t, null); ServiceRegistration reg2 = bc.registerService(className, t2, null); NamingEnumeration<Binding> ne = ctx.listBindings("osgi:servicelist/" + className); assertTrue(ne.hasMoreElements()); Binding bnd = ne.nextElement(); assertEquals(String.valueOf(reg.getReference().getProperty(Constants.SERVICE_ID)), bnd.getName()); assertTrue("Class name not correct. Was: " + bnd.getClassName(), bnd.getClassName().contains("Proxy")); Runnable r = (Runnable) bnd.getObject(); assertNotNull(r); r.run(); Skeleton.getSkeleton(t).assertCalledExactNumberOfTimes(run, 1); Skeleton.getSkeleton(t2).assertNotCalled(run); assertTrue(ne.hasMoreElements()); bnd = ne.nextElement(); assertEquals(String.valueOf(reg2.getReference().getProperty(Constants.SERVICE_ID)), bnd.getName()); assertTrue("Class name not correct. Was: " + bnd.getClassName(), bnd.getClassName().contains("Proxy")); r = (Runnable) bnd.getObject(); assertNotNull(r); r.run(); Skeleton.getSkeleton(t).assertCalledExactNumberOfTimes(run, 1); Skeleton.getSkeleton(t2).assertCalledExactNumberOfTimes(run, 1); assertFalse(ne.hasMoreElements()); } @Test(expected=ServiceException.class) public void checkProxyWhenServiceGoes() throws ServiceException, NamingException { BundleMock mock = new BundleMock("scooby.doo", new Properties()); Thread.currentThread().setContextClassLoader(mock.getClassLoader()); InitialContext ctx = new InitialContext(); Runnable r = (Runnable) ctx.lookup("osgi:service/java.lang.Runnable"); r.run(); Skeleton.getSkeleton(service).assertCalled(new MethodCall(Runnable.class, "run")); reg.unregister(); r.run(); } @Test public void checkServiceOrderObserved() throws NamingException { BundleMock mock = new BundleMock("scooby.doo", new Properties()); Thread.currentThread().setContextClassLoader(mock.getClassLoader()); InitialContext ctx = new InitialContext(); String className = Runnable.class.getName(); Runnable t = Skeleton.newMock(Runnable.class); Runnable t2 = Skeleton.newMock(Runnable.class); // we don't want the default service reg.unregister(); ServiceRegistration reg = bc.registerService(className, t, null); ServiceRegistration reg2 = bc.registerService(className, t2, null); Runnable r = (Runnable) ctx.lookup("osgi:service/java.lang.Runnable"); r.run(); Skeleton.getSkeleton(t).assertCalledExactNumberOfTimes(new MethodCall(Runnable.class, "run"), 1); Skeleton.getSkeleton(t2).assertNotCalled(new MethodCall(Runnable.class, "run")); reg.unregister(); reg2.unregister(); Hashtable<String, Object> props = new Hashtable<String, Object>(); props.put(Constants.SERVICE_RANKING, 55); t = Skeleton.newMock(Runnable.class); t2 = Skeleton.newMock(Runnable.class); bc.registerService(className, t, null); bc.registerService(className, t2, props); r = (Runnable) ctx.lookup("osgi:service/java.lang.Runnable"); r.run(); Skeleton.getSkeleton(t).assertNotCalled(new MethodCall(Runnable.class, "run")); Skeleton.getSkeleton(t2).assertCalledExactNumberOfTimes(new MethodCall(Runnable.class, "run"), 1); } /** * Check that the NamingEnumeration passed in has another element, which represents a java.lang.Thread * @param serviceList * @throws NamingException */ private void checkThreadRetrievedViaListMethod(NamingEnumeration<NameClassPair> serviceList) throws NamingException { assertTrue("The repository was empty", serviceList.hasMoreElements()); NameClassPair ncp = serviceList.next(); assertNotNull("We didn't get a service back from our lookup :(", ncp); assertNotNull("The object from the SR was null", ncp.getClassName()); assertEquals("The service retrieved was not of the correct type", "java.lang.Thread", ncp.getClassName()); assertEquals("aries:services/java.lang.Runnable/(rubbish=smelly)", ncp.getName().toString()); } /** * This test checks that we can list the contents of the repository using the * list method * * @throws NamingException */ public void listRepositoryBindings() throws NamingException { InitialContext ctx = new InitialContext(); NamingEnumeration<Binding> serviceList = ctx.listBindings("aries:services/java.lang.Runnable/(rubbish=smelly)"); Object returnedService = checkThreadRetrievedViaListBindingsMethod(serviceList); assertFalse("The repository contained more objects than we expected", serviceList.hasMoreElements()); assertTrue("The returned service was not the service we expected", returnedService == service); //Now add a second service Thread secondService = new Thread(); registerService(secondService); serviceList = ctx.listBindings("aries:services/java.lang.Runnable/(rubbish=smelly)"); Object returnedService1 = checkThreadRetrievedViaListBindingsMethod(serviceList); Object returnedService2 = checkThreadRetrievedViaListBindingsMethod(serviceList); assertFalse("The repository contained more objects than we expected", serviceList.hasMoreElements()); assertTrue("The services were not the ones we expected!",(returnedService1 == service || returnedService2 == service) && (returnedService1 == secondService || returnedService2 == secondService) && (returnedService1 != returnedService2)); } /** * Check that the NamingEnumeration passed in has another element, which represents a java.lang.Thread * @param serviceList * @return the object in the registry * @throws NamingException */ private Object checkThreadRetrievedViaListBindingsMethod(NamingEnumeration<Binding> serviceList) throws NamingException { assertTrue("The repository was empty", serviceList.hasMoreElements()); Binding binding = serviceList.nextElement(); assertNotNull("We didn't get a service back from our lookup :(", binding); assertNotNull("The object from the SR was null", binding.getObject()); assertTrue("The service retrieved was not of the correct type", binding.getObject() instanceof Thread); assertEquals("aries:services/java.lang.Runnable/(rubbish=smelly)", binding.getName().toString()); return binding.getObject(); } }
[ "durieuxthomas@hotmail.com" ]
durieuxthomas@hotmail.com
c960eeecc2ea89241a14c04620f85d92ab7aaad7
771be70007cc90309862cd02417bb8eace30bba7
/nepxion-thunder/src/test/java/com/nepxion/thunder/testcase/eventbus/MyEvent.java
64658ddec88521efc21dd3a6667bfb3693016ae0
[ "Apache-2.0" ]
permissive
johnwoocxl/john-thunder
53260fe0842eecafe7196d9aecba4e8cda717cd3
fa83efa2a721764399a5814f6e01a3548973c150
refs/heads/master
2021-01-01T04:29:49.993332
2016-05-20T08:08:51
2016-05-20T08:08:51
59,276,131
1
2
null
null
null
null
UTF-8
Java
false
false
435
java
package com.nepxion.thunder.testcase.eventbus; /** * <p>Title: Nepxion Thunder</p> * <p>Description: Nepxion Thunder For Distribution</p> * <p>Copyright: Copyright (c) 2015</p> * <p>Company: Nepxion</p> * @author Haojun Ren * @email 1394997@qq.com * @version 1.0 */ import com.nepxion.thunder.common.eventbus.Event; public class MyEvent extends Event { public MyEvent(Object source) { super(source); } }
[ "jun.wu@wz-inc.com" ]
jun.wu@wz-inc.com
e3a6c0c9d461053a1f18810a39ea4f455421eaec
0ca33d88d305f30bcf626507732ec292588b608e
/CII2/src/Questions/Questions.java
20219a4ca2c272b4d0808f8567f24f990822b45b
[]
no_license
mishka251/jade_laba
88bc7bf91cfa25f89e4558c612725db29a029325
a773a7acc2b0ea35dc4718532649e71a9da0466b
refs/heads/master
2020-10-01T02:46:47.500236
2019-12-11T22:19:19
2019-12-11T22:19:19
227,437,550
0
0
null
null
null
null
UTF-8
Java
false
false
2,674
java
package Questions; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; import jade.core.Agent; import jade.domain.DFService; import jade.domain.FIPAAgentManagement.*; import jade.domain.FIPAException; import jade.wrapper.AgentController; import jade.wrapper.ContainerController; import jade.wrapper.StaleProxyException; public class Questions extends Agent { @Override public void setup() { String fileName = "input.txt"; try { readFile(fileName); } catch (IOException e) { e.printStackTrace(); } DFAgentDescription dfd = new DFAgentDescription(); dfd.setName(getAID()); ServiceDescription sd = new ServiceDescription(); sd.setType("questions-agent"); sd.setName("Questions-storage"); dfd.addServices(sd); try { DFService.register(this, dfd); } catch (FIPAException fe) { fe.printStackTrace(); } } /** * Парсинг строки входного файла в массив объектов инициализации вопроса * * @param line строка входного файла формат nameSub;nameQuestion;comples * @return массив обхектов для инициализации вопрсоа */ Object[] parseStr(String line) { String[] vals = line.split(";"); String nameSubj = vals[0]; String nameQuestion = vals[1]; int complex = Integer.parseInt(vals[2]); return new Object[]{nameQuestion, nameSubj, complex, 1}; } /** * Инициализация агента-вопрсоа * * @param cc контроллер контейнера JADE * @param args аргументы агента */ void initQuestion(ContainerController cc, Object[] args) { try { AgentController agent = cc.createNewAgent("questionAgent" + System.currentTimeMillis() + args[0], "Questions.Question", args); agent.start(); } catch (StaleProxyException e) { e.printStackTrace(); } } /** * Чтение файла и создание агентов * * @param fileName имя файла с вопросами * @throws IOException если нет файла */ void readFile(String fileName) throws IOException { ContainerController cc = getContainerController(); Files.lines(Paths.get(fileName)) .map(this::parseStr) .forEach(obj -> initQuestion(cc, obj)); } }
[ "mishkabelka251@gmail.com" ]
mishkabelka251@gmail.com
35a220031605463d3e0f786160957a62ef6fa970
c839a0b41fb7d1b07871d16df632c069cb0f80f1
/app/src/main/java/edu/udayton/minidribbble/model/Comment.java
ee5a420bec7791bbc18dc0a436bef3b8cb7b0e3c
[]
no_license
ReggieXu/MiniDribbble
834e55999aa05a42d6206b00fb3c01bfb8321ccf
c42cb3d4826df00a8ecf9e88ecbe1fe4c5a13a59
refs/heads/master
2021-01-19T20:55:10.628705
2017-08-24T01:19:27
2017-08-24T01:19:27
101,239,719
0
0
null
null
null
null
UTF-8
Java
false
false
196
java
package edu.udayton.minidribbble.model; import java.util.Date; public class Comment { public User author; public String content; public Date createdAt; public int likeCount; }
[ "xurengui5261@gmail.com" ]
xurengui5261@gmail.com
207d24ec9575a3df988ae9273824a34ad1016c5b
6ad215d36c1a1e2e14ec5dc2023cf43227134ab9
/src/day55_OOPRecap_CollectionsIntro/Encapsulation.java
d53ffe4611c4720080d0a690a624eb9d149f7a96
[]
no_license
KseniiaMazanko/JavaProgramming_B23
839f3504b808bb0510c70f1ac041c0650d566b1d
ef3862ba8a40bae90545d1cfe3564ebc822ea4e5
refs/heads/master
2023-08-16T04:31:36.981801
2021-09-30T22:59:19
2021-09-30T22:59:19
387,605,760
0
0
null
null
null
null
UTF-8
Java
false
false
641
java
package day55_OOPRecap_CollectionsIntro; public class Encapsulation { private String bookName; public String getBookName(){ return bookName; } public void setBookName(String bookName){ if(bookName.isEmpty()){ throw new RuntimeException("Book name can not be empty"); } this.bookName=bookName; } } class Test{ public static void main(String[] args) { Encapsulation obj = new Encapsulation(); obj.setBookName("");//setting a book name to an empty string so we could see the custom exception System.out.println(obj.getBookName()); } }
[ "ksmazanko@gmail.com" ]
ksmazanko@gmail.com
6ad4388add42a0c241ecfc6372e359c310e55f10
723e26bc6f17e6a37c2e8f5ea4d30d7ba86ff3e6
/src/TipoDespesa.java
78e339bc27a4456b6e3914ce97d308de0f808ecd
[]
no_license
dieandgoaway/ControleFinanceiro
d3087b336eb5dc232bd18e3e257a555d815a0c14
b5845b94edfe3f619fe239cabe9d5ad31c0b06de
refs/heads/main
2023-03-17T19:07:06.824704
2021-03-22T02:33:09
2021-03-22T02:33:09
350,155,745
0
0
null
null
null
null
ISO-8859-2
Java
false
false
1,044
java
public class TipoDespesa { private String nomeTipo; private int contadorDespesas = 0; private Despesas[] despesasTipo = new Despesas[100]; // Método Construtor da Classe. public TipoDespesa(String nomeTipo, Despesas despesasTipo) { this.nomeTipo = nomeTipo; this.despesasTipo[0] = despesasTipo; this.contadorDespesas++; } public void adicionarDespesa(Despesas despesasTipo) { this.despesasTipo[contadorDespesas] = despesasTipo; this.contadorDespesas++; } public String getNomeTipo() { return nomeTipo; } public int getContadorDespesas() { return contadorDespesas; } public void setContadorDespesas(int contadorDespesas) { this.contadorDespesas = contadorDespesas; } public void setNomeTipo(String nomeTipo) { this.nomeTipo = nomeTipo; } //Metodo getter modificado para ter como saida o nome da despesa de interesse public String getDespesasTipo(int i) { return despesasTipo[i].getNome(); } public void setDespesasTipo(Despesas[] despesasTipo) { this.despesasTipo = despesasTipo; } }
[ "diegaozims@hotmail.com.br" ]
diegaozims@hotmail.com.br
ecd9246efa5b48eaa6d345ae58d5af3b283a10ec
d6c5be861c79d2240c5ab98cd88f3d9665534ad4
/src/main/java/ga/matthewtgm/utils/PlayerUtils.java
f1638e34d128f8c945dc02f47260446eb3afdbd9
[ "Apache-2.0" ]
permissive
landon-dev/gopine-client
7e4e77db8edacf2df100b20da40a826523cf2f55
cc1785d83930c2b2155ffb3ef1767dd735a7b4ff
refs/heads/main
2023-01-14T18:23:23.518439
2020-11-18T21:42:34
2020-11-18T21:42:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,415
java
package ga.matthewtgm.utils; import net.gopine.mixins.renderer.RenderManagerMixin; import net.minecraft.client.renderer.entity.RenderPlayer; import net.minecraft.client.renderer.entity.RendererLivingEntity; import net.minecraft.client.renderer.entity.layers.LayerRenderer; import java.lang.reflect.Method; public class PlayerUtils { public Method getMethod(Class clazz, String methodName, boolean fromSuperclazz) { if(fromSuperclazz) { Class superClass = clazz.getSuperclass(); if(superClass == null) { return null; } else { return getMethod(superClass, methodName, false); } } else { try { return clazz.getMethod(methodName); } catch(Exception e) { return null; } } } /** * Adds layers to the player skin (Capes, wings, etc) * @param layer the layer being added */ public void addLayer(LayerRenderer layer) { try { Method method = RendererLivingEntity.class.getDeclaredMethod("addLayer", LayerRenderer.class); method.setAccessible(true); for (RenderPlayer render : new RenderManagerMixin().getSkinMap().values()) { method.invoke(render, layer); } } catch(Exception e) { e.printStackTrace(); } } }
[ "matthewtgm120@gmail.com" ]
matthewtgm120@gmail.com
fc9c903b9f3d292b8aa72fafaee5f8b419f8126a
b5639b98531c2da943876074883148cc2087e1b5
/TravelAgency/src/main/java/business/dto/HotelDTO.java
c229917070ae1087c3885782dce85dc558d70bbf
[]
no_license
Codrut19/ExercitiiJavaFundamentals-1
3ad460690808558f0ea6132052ea4cb0d22c9210
a1fddace0da10b3b591aa4ab8f44c4e1b8b73ad2
refs/heads/master
2023-02-25T23:10:46.747933
2021-01-25T05:38:23
2021-01-25T05:38:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,103
java
package business.dto; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; import java.util.Set; public class HotelDTO { @NotNull @NotBlank @NotEmpty @Pattern(regexp = "([a-z-A-Z])*") private String name; @NotBlank @NotEmpty @NotNull private String address; @NotNull private int stars; @NotNull private String description; @NotNull private CityDTO cityDTO; private Set<RoomDTO> roomDTOSet; private Set<TripDTO> tripDTOSet; public HotelDTO() { } public HotelDTO(@NotNull @NotBlank @NotEmpty @Pattern(regexp = "([a-z-A-Z])*") String name, @NotBlank @NotEmpty @NotNull String address, @NotEmpty @NotBlank @NotNull @Pattern(regexp = "([0-9])*") int stars, @NotEmpty @NotBlank @NotNull @Pattern(regexp = "([a-z-A-Z-0-9])*") String description) { this.name = name; this.address = address; this.stars = stars; this.description = description; } public HotelDTO(@NotNull @NotBlank @NotEmpty @Pattern(regexp = "([a-z-A-Z])*") String name, @NotBlank @NotEmpty @NotNull String address, @NotEmpty @NotBlank @NotNull @Pattern(regexp = "([0-9])*") int stars, @NotEmpty @NotBlank @NotNull @Pattern(regexp = "([a-z-A-Z-0-9])*") String description, @NotNull CityDTO cityDTO, @NotNull Set<RoomDTO> roomDTOSet, @NotNull Set<TripDTO> tripDTOSet) { this.name = name; this.address = address; this.stars = stars; this.description = description; this.cityDTO = cityDTO; this.roomDTOSet = roomDTOSet; this.tripDTOSet = tripDTOSet; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getStars() { return stars; } public void setStars(int stars) { this.stars = stars; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public CityDTO getCityDTO() { return cityDTO; } public void setCityDTO(CityDTO cityDTO) { this.cityDTO = cityDTO; } public Set<RoomDTO> getRoomDTOSet() { return roomDTOSet; } public void setRoomDTOSetSet(Set<RoomDTO> roomDTOSet) { this.roomDTOSet = roomDTOSet; } public Set<TripDTO> getTripDTOSet() { return tripDTOSet; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public void setTripDTOSetSet(Set<TripDTO> tripDTOSet) { this.tripDTOSet = tripDTOSet; } @Override public String toString() { return "HotelDTO{" + "name='" + name + '\'' + ", address='" + address + '\'' + ", stars=" + stars + ", description='" + description + '\'' + '}'; } }
[ "c_tin.aurel@yahoo.com" ]
c_tin.aurel@yahoo.com
283b03aecf4378bc9ae8e30e145c1659c5653674
8d09642b1ed79374e8281e9d09d4911ad22231a5
/src/main/java/com/nd/controller/ForgotPasswordController.java
e048695f621f47d0cc73ce63caa56a7413344f08
[]
no_license
nextDigits/ND-SpinAndWin-v1
855372d08c11644c566cb705382385cf5e24e780
6699005a38065fb3d17f44adacb094ea0e2b35d7
refs/heads/master
2021-01-19T10:41:59.075401
2017-03-17T04:34:56
2017-03-17T04:34:56
73,029,594
0
0
null
2017-03-12T23:28:29
2016-11-07T00:55:16
Java
UTF-8
Java
false
false
2,006
java
package com.nd.controller; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.annotation.InitBinder; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; import com.nd.request.UserAccessRequest; import com.nd.response.UserAccessResponse; import com.nd.service.UserAccessService; import com.nd.validator.ForgotPasswordValidator; import com.nd.validator.SignInValidator; @Validated @RestController public class ForgotPasswordController { private final ForgotPasswordValidator forgotPasswordValidator; private final UserAccessService userAccessService; @Autowired public ForgotPasswordController(ForgotPasswordValidator forgotPasswordValidator, UserAccessService userAccessService) { this.forgotPasswordValidator = forgotPasswordValidator; this.userAccessService = userAccessService; } @InitBinder protected void initBinder(WebDataBinder binder) { binder.setValidator(forgotPasswordValidator); } @RequestMapping(value = "/nextdigit/v1/useraccess/forgotpassword", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(HttpStatus.OK) public UserAccessResponse signIn(final HttpServletRequest request, final HttpServletResponse response, @RequestBody @Valid UserAccessRequest signInRequest) throws Exception { return userAccessService.forgotPassword(signInRequest); } }
[ "nextDigits@gmail.com" ]
nextDigits@gmail.com
3770cacd6b57428c3b762cfd67b09594f94fceee
038bfeae0559c8c242967aad3c3253b2803c6f6e
/src/test/java/com/mfra/myvirus/model/strategy/CommonStrategyTest.java
21d8ba4a16ae132d9e5a667b2f72d6a1079a6fda
[]
no_license
MichaelRondon/MyVirus
ed6e06afa3c6574c439ed3255742d196c6733901
c30c9d5b58a3e1f3f1ae951a7ffa4de38ee22afb
refs/heads/master
2020-04-11T12:50:40.938131
2018-12-17T22:16:03
2018-12-17T22:16:03
161,794,125
0
0
null
null
null
null
UTF-8
Java
false
false
9,020
java
package com.mfra.myvirus.model.strategy; import com.mfra.myvirus.Application; import com.mfra.myvirus.model.Organ; import com.mfra.myvirus.model.Player; import com.mfra.myvirus.model.State; import com.mfra.myvirus.model.cards.CardFactory; import com.mfra.myvirus.model.cards.MultiOrganCard; import com.mfra.myvirus.model.cards.MultiVirusCard; import java.util.ArrayList; import java.util.List; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; /** * */ @RunWith(SpringRunner.class) @SpringBootTest(classes = Application.class) public class CommonStrategyTest { @Autowired private CommonStrategy commonStrategy; private Player player1; private Player player2; private Player player3; private Player player4; private List<Player> players = new ArrayList<>(); @Before public void setUp() { player1 = new Player("player1", commonStrategy, players); player2 = new Player("player2", commonStrategy, players); player3 = new Player("player3", commonStrategy, players); player4 = new Player("player4", commonStrategy, players); players.add(player1); players.add(player2); players.add(player3); players.add(player4); player1.addCard(CardFactory.getInstance().getOrganCard(Organ.BRAIN)); player1.addCard(CardFactory.getInstance().getMedicineCard(Organ.BONE)); player1.addCard(CardFactory.getInstance().getMedicineCard(Organ.HEART)); player2.addCard(CardFactory.getInstance().getVirusCard(Organ.BRAIN)); player2.addCard(CardFactory.getInstance().getVirusCard(Organ.BRAIN)); player2.addCard(CardFactory.getInstance().getVirusCard(Organ.BRAIN)); player3.addCard(CardFactory.getInstance().getVirusCard(Organ.HEART)); player3.addCard(CardFactory.getInstance().getOrganCard(Organ.BONE)); player3.addCard(CardFactory.getInstance().getMedicineCard(Organ.BONE)); } @Test public void testForOrganAndVirus() { player1.play(); Assert.assertEquals(2, player1.getHandCards().getTotalCards()); Assert.assertEquals(2, player1.getHandCards().getMedicines().size()); Assert.assertEquals(1, new Rank(player1).getOrgansByStates(State.HEALTH).size()); player1.addCard(CardFactory.getInstance().getMedicineCard(Organ.BRAIN)); player2.play(); Assert.assertEquals(2, player2.getHandCards().getTotalCards()); Assert.assertEquals(2, player2.getHandCards().getVirus().size()); Assert.assertEquals(0, new Rank(player2).getOrgansByStates(State.values()).size()); Assert.assertEquals(1, new Rank(player1).getOrgansByStates(State.SICK).size()); player2.addCard(CardFactory.getInstance().getVirusCard(Organ.BRAIN)); player3.play(); Assert.assertEquals(2, player3.getHandCards().getTotalCards()); Assert.assertEquals(1, player3.getHandCards().getVirus().size()); Assert.assertEquals(1, player3.getHandCards().getMedicines().size()); Assert.assertEquals(1, new Rank(player3).getOrgansByStates(State.HEALTH).size()); player3.addCard(CardFactory.getInstance().getMedicineCard(Organ.BONE)); player1.play(); Assert.assertEquals(2, player1.getHandCards().getTotalCards()); Assert.assertEquals(2, player1.getHandCards().getMedicines().size()); Assert.assertEquals(1, new Rank(player1).getOrgansByStates(State.HEALTH).size()); player1.addCard(CardFactory.getInstance().getOrganCard(Organ.BONE)); player2.play(); Assert.assertEquals(2, player2.getHandCards().getTotalCards()); Assert.assertEquals(2, player2.getHandCards().getVirus().size()); Assert.assertEquals(1, new Rank(player1).getOrgansByStates(State.SICK).size()); player2.addCard(CardFactory.getInstance().getVirusCard(Organ.BRAIN)); player3.play(); Assert.assertEquals(2, player3.getHandCards().getTotalCards()); Assert.assertEquals(1, player3.getHandCards().getVirus().size()); Assert.assertEquals(1, player3.getHandCards().getMedicines().size()); Assert.assertEquals(1, new Rank(player1).getOrgansByStates(State.values()).size()); Assert.assertEquals(1, new Rank(player3).getOrgansByStates(State.VACCINATED).size()); player3.addCard(CardFactory.getInstance().getMedicineCard(Organ.BONE)); player1.play(); Assert.assertEquals(2, player1.getHandCards().getTotalCards()); Assert.assertEquals(2, player1.getHandCards().getMedicines().size()); Assert.assertEquals(2, new Rank(player1).getOrgansByStates(State.values()).size()); Assert.assertEquals(1, new Rank(player1).getOrgansByStates(State.HEALTH).size()); Assert.assertEquals(1, new Rank(player1).getOrgansByStates(State.SICK).size()); player1.addCard(CardFactory.getInstance().getMedicineCard(Organ.HEART)); player2.play(); Assert.assertEquals(2, player2.getHandCards().getTotalCards()); Assert.assertEquals(2, player2.getHandCards().getVirus().size()); Assert.assertEquals(0, new Rank(player2).getOrgansByStates(State.values()).size()); Assert.assertEquals(0, new Rank(player1).getOrgansByStates(State.SICK).size()); Assert.assertEquals(1, new Rank(player1).getOrgansByStates(State.HEALTH).size()); Assert.assertEquals(1, new Rank(player3).getOrgansByStates(State.VACCINATED).size()); player2.addCard(CardFactory.getInstance().getVirusCard(Organ.BONE)); player3.play(); Assert.assertEquals(2, player3.getHandCards().getTotalCards()); Assert.assertEquals(1, player3.getHandCards().getVirus().size()); Assert.assertEquals(1, player3.getHandCards().getMedicines().size()); Assert.assertEquals(1, new Rank(player3).getOrgansByStates(State.IMMUNE).size()); player3.addCard(new MultiVirusCard()); player1.play(); Assert.assertEquals(2, player1.getHandCards().getTotalCards()); Assert.assertEquals(2, player1.getHandCards().getMedicines().size()); Assert.assertEquals(1, new Rank(player1).getOrgansByStates(State.values()).size()); Assert.assertEquals(1, new Rank(player1).getOrgansByStates(State.VACCINATED).size()); player1.addCard(new MultiOrganCard()); player2.play(); Assert.assertEquals(2, player2.getHandCards().getTotalCards()); Assert.assertEquals(2, player2.getHandCards().getVirus().size()); Assert.assertEquals(0, new Rank(player2).getOrgansByStates(State.values()).size()); Assert.assertEquals(1, new Rank(player1).getOrgansByStates(State.HEALTH).size()); player2.addCard(CardFactory.getInstance().getVirusCard(Organ.BONE)); player3.play(); Assert.assertEquals(2, player3.getHandCards().getTotalCards()); Assert.assertEquals(1, player3.getHandCards().getVirus().size()); Assert.assertEquals(1, player3.getHandCards().getMedicines().size()); Assert.assertEquals(1, new Rank(player3).getOrgansByStates(State.IMMUNE).size()); Assert.assertEquals(1, new Rank(player1).getOrgansByStates(State.values()).size()); player3.addCard(new MultiVirusCard()); player1.play(); Assert.assertEquals(2, player1.getHandCards().getTotalCards()); Assert.assertEquals(2, player1.getHandCards().getMedicines().size()); Assert.assertEquals(2, new Rank(player1).getOrgansByStates(State.values()).size()); Assert.assertEquals(0, new Rank(player1).getOrgansByStates(State.VACCINATED).size()); Assert.assertEquals(1, new Rank(player1).getOrgansByStates(State.SICK).size()); Assert.assertEquals(1, new Rank(player1).getOrgansByStates(State.HEALTH).size()); player1.addCard(CardFactory.getInstance().getOrganCard(Organ.STOMACH)); player2.play(); Assert.assertEquals(2, player2.getHandCards().getTotalCards()); Assert.assertEquals(2, player2.getHandCards().getVirus().size()); Assert.assertEquals(0, new Rank(player2).getOrgansByStates(State.values()).size()); Assert.assertEquals(1, new Rank(player1).getOrgansByStates(State.HEALTH).size()); player2.addCard(new MultiVirusCard()); System.out.println("player1: "+player1.getBodyClon()); System.out.println("player1: "+player1.getHandCards()); System.out.println("player2: "+player2.getBodyClon()); System.out.println("player2: "+player2.getHandCards()); System.out.println("player3: "+player3.getBodyClon()); System.out.println("player3: "+player3.getHandCards()); } }
[ "michael.rondon@globant.com" ]
michael.rondon@globant.com
07252f71ce610209ebbdc6d0e0b5b56598eb0fae
2262b4b5c1ceb77c07b950e3de78d9ea883cd1aa
/common/app/model/rewards/Reward.java
fb05efa8c682f56a0bd13f6c02cddc82a846712a
[]
no_license
DailySoccer/EpicEleven
b1e2a26ed9d76e4f6514ab78dd82d953e0ec5808
d3e3877156cab6dca66b41f44e1f07dd0690de07
refs/heads/master
2021-03-27T11:54:31.734856
2017-01-09T08:13:08
2017-01-09T08:13:08
18,361,409
0
0
null
null
null
null
UTF-8
Java
false
false
713
java
package model.rewards; import com.fasterxml.jackson.annotation.JsonTypeInfo; import org.bson.types.ObjectId; import org.jongo.marshall.jackson.oid.Id; @JsonTypeInfo(use=JsonTypeInfo.Id.CLASS, property="_class") public class Reward { public enum RewardType { GOLD } @Id public ObjectId rewardId; public RewardType type; public boolean pickedUp; protected Reward() { } protected Reward(RewardType type) { this.rewardId = new ObjectId(); this.type = type; this.pickedUp = false; } protected String debug() { return String.format("%s(%s) %s", type.toString(), rewardId.toString(), pickedUp ? "PICKED UP" : "WAITING"); } }
[ "ximo.m.albors@gmail.com" ]
ximo.m.albors@gmail.com
b9fe56793ed1ed3824a3a1493f2321c272f82751
5bad0576628fdb8140e340d90f99a1d378658dce
/src/main/java/com/epam/oops/Sweets.java
d58ad430fb82108f79d0490875c2b60779cd6d97
[]
no_license
vsrimanvith/vaddeboyina_sri_manvith_Maven_Oops
bd59125ad96cc9d0533673cd5d24df6da28607d6
31e9a845cc07cb2951a3a39f703d0d5f2a0dfaf2
refs/heads/master
2023-01-07T22:12:57.758927
2020-02-06T15:02:09
2020-02-06T15:02:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
326
java
package com.epam.oops; class Sweets extends Details { public Sweets(String name,int cost,int weight) { super(name,cost,weight); } public void display() { System.out.println("Sweet-name:"+this.name); System.out.println("Sweet-cost:Rs."+this.cost+"/-"); System.out.println("Sweet-weight:"+this.weight+"Grams"); } }
[ "noreply@github.com" ]
noreply@github.com
d99070a050ade3ecb332e9068b0df0e0dfc77541
a75aae4b0b5bb416a9bbdcc30631e374ad4e841a
/Examples/LearningPractice/src/main/java/Interface/Adventure.java
56fc38f0027458e12d88e77431bcccd035687f71
[]
no_license
kaldihin/Practice
88d69cb1f8f6a8c885c6003096edcc2fc4aa940e
ceab3f3adca91e3792f042657d61604c4206e603
refs/heads/master
2020-03-26T23:57:44.293518
2020-01-23T15:39:18
2020-01-23T15:39:18
145,581,673
0
0
null
null
null
null
UTF-8
Java
false
false
1,021
java
package Interface; interface CanFight { void fight(); } interface CanSwim { void swim(); } interface CanFly { void fly(); } interface CanClimb { void climb(); } class ActionCharacter { public void fight() { System.out.println("Fights"); } } class Hero extends ActionCharacter implements CanFight, CanSwim, CanFly, CanClimb { public void swim() { System.out.println("Swims"); } public void fly() { System.out.println("Flies"); } public void climb() { System.out.println("Climbs"); } } public class Adventure { public static void t(CanFight x) { x.fight(); } public static void u(CanSwim x) { x.swim(); } public static void v(CanFly x) { x.fly(); } public static void y(CanClimb x) { x.climb(); } public static void w(ActionCharacter x) { x.fight(); } public static void main(String[] args) { Hero h = new Hero(); t(h); u(h); v(h); y(h); w(h); } }
[ "geniy9494@gmail.com" ]
geniy9494@gmail.com
3e9b92826eb755f7ae6b4e55049914f49c2db037
a07e0760e7631ccd2d44877a1826bc5433fe97da
/gm_common/src/main/java/com/gomai/utils/SbException.java
5599e80cb3fbd356364899e5c56ead3b5245d1e3
[]
no_license
mengying1999/gomai
7449d57b4bf446273fecbabf71f43b95f1858daa
576c4e2f84bf313350e78a18e5e9e6aefeb22cdf
refs/heads/master
2021-03-25T17:56:58.629044
2020-05-30T06:06:04
2020-05-30T06:06:04
247,637,441
0
0
null
null
null
null
UTF-8
Java
false
false
422
java
package com.gomai.utils; public class SbException extends RuntimeException{ private static final long serialVersionUID = -8201518085425482189L; public Integer getCode() { return code; } public void setCode(Integer code) { this.code = code; } private Integer code; public SbException(Integer code,String message) { super(message); this.code = code; } }
[ "2237914905@qq.com" ]
2237914905@qq.com
f918ccff1ae5a6377baa1166ed6e4f6bf518b353
be73270af6be0a811bca4f1710dc6a038e4a8fd2
/crash-reproduction-moho/results/LANG-51b-1-19-NSGA_II-WeightedSum:TestLen:CallDiversity/org/apache/commons/lang/BooleanUtils_ESTest.java
521159fb0a322ec3328d2fd241bc285cdc48ddbe
[]
no_license
STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application
cf118b23ecb87a8bf59643e42f7556b521d1f754
3bb39683f9c343b8ec94890a00b8f260d158dfe3
refs/heads/master
2022-07-29T14:44:00.774547
2020-08-10T15:14:49
2020-08-10T15:14:49
285,804,495
0
0
null
null
null
null
UTF-8
Java
false
false
554
java
/* * This file was automatically generated by EvoSuite * Sat Jan 18 20:39:19 UTC 2020 */ package org.apache.commons.lang; import org.junit.Test; import static org.junit.Assert.*; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.junit.runner.RunWith; @RunWith(EvoRunner.class) @EvoRunnerParameters(useVFS = true, useJEE = true) public class BooleanUtils_ESTest extends BooleanUtils_ESTest_scaffolding { @Test public void notGeneratedAnyTest() { // EvoSuite did not generate any tests } }
[ "pouria.derakhshanfar@gmail.com" ]
pouria.derakhshanfar@gmail.com
be0ce67ddff984125c6bcb8d94f580a7c604d041
08826f46ae17a195302507d8786802fdfcd7d7e5
/app/src/main/java/ug/co/dave/marketprice/VendorCommodityBaseAdapter.java
a4b72c8a2c251a990dc044fec943195829da9ec7
[]
no_license
agabadave/MarketPrice.Android
ff77d8ee2c4b37d2b6c4555c00e6ebb71dc355f6
ddb0dbef0abedb6237cea2096e007e9c03fd3075
refs/heads/master
2021-01-01T17:17:13.579674
2014-12-22T06:34:59
2014-12-22T06:34:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,275
java
package ug.co.dave.marketprice; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.TextView; import ug.co.dave.marketprice.entities.Vendor; import ug.co.dave.marketprice.entities.VendorCommodity; /** * Created by dave on 12/20/2014. */ public class VendorCommodityBaseAdapter extends BaseAdapter { private Vendor vendor; private Context context; public VendorCommodityBaseAdapter(Vendor vendor, Context context) { this.vendor = vendor; this.context = context; } @Override public int getCount() { return vendor.getVendorCommodities().size(); } @Override public Object getItem(int position) { return vendor.getVendorCommodities().get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { VendorCommodity vendorCommodity = vendor.getVendorCommodities().get(position); VendorCommodityHolder holder = null; if(convertView == null){ LayoutInflater inflater = LayoutInflater.from(context); convertView = inflater.inflate(R.layout.vendor_commodity, null); holder = new VendorCommodityHolder(); holder.title = (TextView)convertView.findViewById(R.id.vendor_commodity_title); holder.value = (TextView)convertView.findViewById(R.id.vendor_commodity_price); holder.unitOfSale = (TextView)convertView.findViewById(R.id.vendor_commodity_unit_sale); convertView.setTag(holder); } else holder = (VendorCommodityHolder)convertView.getTag(); //now passing the paramters... holder.title.setText(vendorCommodity.getCommodity().getName()); holder.value.setText(Double.toString(vendorCommodity.getPrice())); holder.unitOfSale.setText(vendorCommodity.getCommodity().getUnitOfSale()); return convertView; } private static class VendorCommodityHolder{ public TextView title; public TextView value; public TextView unitOfSale; } }
[ "agabadave02@gmail.com" ]
agabadave02@gmail.com
89182a344b9b85f595bd80d5ec06adcf9480f0c2
a1166f6fdae64e97d73c7277009d575aa532f740
/src/main/java/com/miaosha/controller/AccountController.java
8cc57c3211cb891d577a20ea147d94d8af7b38b0
[]
no_license
yafei1508/pharmacy
3795dcb6b45b4036fcd4eab40477786be4d2b676
5761270229367fea2e9738e0978ac8e006a35f38
refs/heads/master
2020-05-17T22:28:40.071751
2019-04-29T06:02:01
2019-04-29T06:02:01
179,404,606
0
1
null
null
null
null
UTF-8
Java
false
false
3,864
java
package com.miaosha.controller; import com.miaosha.controller.viewobject.AccountVO; import com.miaosha.error.BusinessException; import com.miaosha.error.EmBusinessError; import com.miaosha.response.CommonReturnType; import com.miaosha.service.AccountService; import com.miaosha.service.impl.AccountServiceImpl; import com.miaosha.service.model.AccountModel; import com.miaosha.utils.JwtUtils; import com.miaosha.utils.LoginToken; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; import java.math.BigInteger; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Map; @Controller("account") @RequestMapping("/account") @CrossOrigin(allowCredentials = "true", allowedHeaders = "*") public class AccountController extends BaseController { @Autowired private AccountService accountService; @Autowired private HttpServletRequest httpServletRequest; @LoginToken @RequestMapping(value = "/login", method = {RequestMethod.POST}) @ResponseBody public CommonReturnType login(@RequestParam(name = "account", required = false) String account, @RequestParam(name = "encryptPassword", required = false) String password) throws BusinessException { //入参校验 System.out.println(account + password); Map<String, String[]> map = httpServletRequest.getParameterMap(); for (String s : map.keySet()) { System.out.println(s + " " + map.get(s)[0]); } System.out.println(httpServletRequest.getParameterNames()); if (org.apache.commons.lang3.StringUtils.isEmpty(account) || org.apache.commons.lang3.StringUtils.isEmpty(password)) { throw new BusinessException(EmBusinessError.PARAMETER_VALIDATION_ERROR); } AccountModel accountModel = accountService.validateLogin(account, password); //用户登录服务,校验用户登录是否合法 //将登陆凭证加入到用户登陆成功的session内 String token = JwtUtils.generateToken(accountModel.getAccount()); AccountVO accountVO = this.convertFromModel(accountModel); accountVO.setToken(token); return CommonReturnType.create(accountVO); } @RequestMapping(value = "/logout", method = {RequestMethod.GET}) @ResponseBody public CommonReturnType logout() throws BusinessException { return CommonReturnType.create(null); } private AccountVO convertFromModel(AccountModel accountModel) { AccountVO accountVO = new AccountVO(); if (accountModel == null) { return null; } BeanUtils.copyProperties(accountModel, accountVO); return accountVO; } // private String EncodeByMd5(String plainText) { // //定义一个字节数组 // byte[] secretBytes = null; // try { // // 生成一个MD5加密计算摘要 // MessageDigest md = MessageDigest.getInstance("MD5"); // //对字符串进行加密 // md.update(plainText.getBytes()); // //获得加密后的数据 // secretBytes = md.digest(); // } catch (NoSuchAlgorithmException e) { // throw new RuntimeException("没有md5这个算法!"); // } // //将加密后的数据转换为16进制数字 // String md5code = new BigInteger(1, secretBytes).toString(16);// 16进制数字 // // 如果生成数字未满32位,需要前面补0 // for (int i = 0; i < 32 - md5code.length(); i++) { // md5code = "0" + md5code; // } // return md5code; // } }
[ "gogolee@yeah.net" ]
gogolee@yeah.net
ac49df2b75cd976480ebb98847c30085fb499363
cd96f0111f4779360613fa9d9aabe52f6ac94c0c
/src/main/java/file/generator/repositorio/UserRepository.java
e208c69c66fd0ee4d3854d4df8bb1d778e1960bf
[]
no_license
Odilio/file-generator
3536b4fc2ee46609c0e7d78e3940207345e86b01
8bae9c3e8e4ee2c4f34b8e8e415a7e262bc546a2
refs/heads/master
2023-03-29T18:27:59.515532
2021-03-27T12:50:06
2021-03-27T12:50:06
340,667,306
0
0
null
null
null
null
UTF-8
Java
false
false
816
java
package file.generator.repositorio; import java.util.List; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; import org.springframework.stereotype.Repository; import file.generator.model.User; @Repository public interface UserRepository extends JpaRepository<User, Long>{ @Query("select c from User c where c.id = :id") User findById(@Param("id") long id); @Query("select c from User c where c.email = :email") User findByEmail(@Param("email") String email); List<User> findAll(); @Query("select c from User c") Page<User> findAllPage(Pageable pageable); }
[ "odilionoronha@gmail.com" ]
odilionoronha@gmail.com
76080b0e79cc1bd7e91cc607613192269be8459e
1cd510b3c61db6dc11aa4cb7cf51147f7013187b
/revisao/anoNasc.java
4db5016a0156772b809c67dea85015c42690b505
[]
no_license
mateusgalves/lista-1-revis-o
16acff72ce19e66439bfa9a538fc670a5adc7b12
9c16adc4c98738a1df8eb4a41850de18786c5b39
refs/heads/master
2020-07-07T19:50:20.669077
2019-08-20T21:59:29
2019-08-20T21:59:29
203,460,250
0
0
null
null
null
null
UTF-8
Java
false
false
287
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 lista.pkg1.exercico.revisao; /** * * @author Home */ class anoNasc { }
[ "noreply@github.com" ]
noreply@github.com
41e32e37d4e5d7644450f04b7499211878b92166
cac8c89c667a4e18ca897d99bff8102d3fee7daa
/MiniApp/app/src/main/java/com/miniapp/home/models/WalletResponse.java
97fd77a02e337d17b9098e301585fbd49970cbbd
[]
no_license
ManpreetKaurTuteja/mini
51c7874850941aadd0db1bac49be163de4f7c566
df60538bfd6618d6f71d420c3f1aebacfa95c3b9
refs/heads/master
2020-03-19T13:31:37.919977
2018-06-08T07:43:30
2018-06-08T07:43:30
136,583,764
0
0
null
null
null
null
UTF-8
Java
false
false
507
java
package com.miniapp.home.models; import java.util.List; /** * Created by mac on 07/04/18. */ public class WalletResponse { int status; String message; String balance; List<WalletHistory> historyList; public int getStatus() { return status; } public void setStatus(int status) { this.status = status; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } }
[ "mac@Manpreets-MacBook-Pro.local" ]
mac@Manpreets-MacBook-Pro.local
2d37770f851cd60986c7c7bf76dbd8c8621ba22a
23bff27a5e0709da76f770ac3d18fe6cfc8c4ffa
/src/week6/week6q3.java
5b46a2541d7890d6c632a390a32cfe068a9fc519
[]
no_license
sagarv26/NPTEL-Java-Online-Course
2a094ce3a43fac7aeab7d5c3706ef871edb99f30
d1ec5cb335b9f6e1c10f95c90567d1288a6a8a23
refs/heads/master
2022-04-24T19:25:50.552735
2020-04-20T08:44:20
2020-04-20T08:44:20
257,220,821
3
0
null
null
null
null
UTF-8
Java
false
false
959
java
/** * * A part of the Java program is given, which can be completed in many ways, for example using the concept of thread, etc. Follow the given code and complete the program so that your program prints the message "NPTEL Java". Note: Your program should utilize the given interface/ class. * */ package week6; public class week6q3 { public static void main(String[] args) { // An object of MyThread class is created MyThread t = new MyThread(); // run() of class MyThread is called t.run(); } } //Interface A is defined with an abstract method run() interface A { public abstract void run(); } //Class B is defined which implements A and an empty implementation of run() class B implements A { public void run() {} } //Class MyThread is defined which extends class B class MyThread extends B { // run() is overriden and 'NPTEL Java' is printed. public void run() { System.out.print("NPTEL Java"); } }
[ "sagarvhande@gmail.com" ]
sagarvhande@gmail.com
1e09c9a49d19207dad3579ca63b227712fd5a266
bbc289925df822a1dc632ab81fc2a1ccdc110566
/src/main/java/cn/silently9527/service/impl/ToolkitCommandServiceImpl.java
f1d87cfddb2e22c69073bffe23abeb1bd0273b51
[]
no_license
silently9527/Toolkit
8cc7fa9a83652bbb455a56bb01c717c3ae2e9a45
a9aed7dd9205e46ea18ed40fe45db333dba53b6a
refs/heads/master
2023-07-16T12:45:07.612504
2021-08-17T09:36:43
2021-08-17T09:36:43
332,457,712
70
14
null
null
null
null
UTF-8
Java
false
false
662
java
package cn.silently9527.service.impl; import cn.silently9527.domain.ToolkitCommand; import cn.silently9527.domain.executor.ToolkitCommandExecutor; import cn.silently9527.domain.executor.ToolkitCommandExecutorComposite; import cn.silently9527.service.ToolkitCommandService; import com.intellij.openapi.actionSystem.DataContext; public class ToolkitCommandServiceImpl implements ToolkitCommandService { private ToolkitCommandExecutor toolkitCommandExecutor = new ToolkitCommandExecutorComposite(); @Override public void execute(ToolkitCommand command, DataContext dataContext) { toolkitCommandExecutor.execute(command, dataContext); } }
[ "380303318@qq.com" ]
380303318@qq.com
7e9d9e3d710bf6125573b371f1bd95bcd17bfc89
389d42bda55a1d3059e52461f4301fb08571a1b6
/tessera-core/src/test/java/com/quorum/tessera/transaction/TransactionManagerTest.java
2714ec728301337e46332ea40d6b13b2f8e001a1
[ "Apache-2.0" ]
permissive
Kuner/tessera
607aef2375ee071e171943db9171fa6e095ac17d
470153eae794704a34ada2fdd202d744134ed523
refs/heads/master
2020-04-06T21:37:02.452836
2018-11-13T15:47:29
2018-11-13T15:47:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
19,805
java
package com.quorum.tessera.transaction; import com.quorum.tessera.api.model.DeleteRequest; import com.quorum.tessera.api.model.ReceiveRequest; import com.quorum.tessera.api.model.ReceiveResponse; import com.quorum.tessera.api.model.ResendRequest; import com.quorum.tessera.api.model.ResendRequestType; import com.quorum.tessera.api.model.ResendResponse; import com.quorum.tessera.api.model.SendRequest; import com.quorum.tessera.api.model.SendResponse; import com.quorum.tessera.enclave.model.MessageHash; import com.quorum.tessera.encryption.Enclave; import com.quorum.tessera.encryption.EncodedPayload; import com.quorum.tessera.encryption.EncodedPayloadWithRecipients; import com.quorum.tessera.encryption.PublicKey; import com.quorum.tessera.nacl.NaclException; import com.quorum.tessera.transaction.exception.TransactionNotFoundException; import com.quorum.tessera.transaction.model.EncryptedTransaction; import java.util.Base64; import static org.assertj.core.api.Assertions.*; import org.junit.After; import org.junit.Before; import org.junit.Test; import static org.mockito.Mockito.*; import com.quorum.tessera.util.Base64Decoder; import java.util.Arrays; import java.util.Collections; import java.util.Optional; public class TransactionManagerTest { private TransactionManager transactionManager; private PayloadEncoder payloadEncoder; private EncryptedTransactionDAO encryptedTransactionDAO; private PayloadPublisher payloadPublisher; private Enclave enclave; @Before public void onSetUp() { payloadEncoder = mock(PayloadEncoder.class); enclave = mock(Enclave.class); encryptedTransactionDAO = mock(EncryptedTransactionDAO.class); payloadPublisher = mock(PayloadPublisher.class); transactionManager = new TransactionManagerImpl(Base64Decoder.create(), payloadEncoder, encryptedTransactionDAO, payloadPublisher, enclave); } @After public void onTearDown() { verifyNoMoreInteractions(payloadEncoder, encryptedTransactionDAO, payloadPublisher, enclave); } @Test public void send() { EncodedPayloadWithRecipients encodedPayloadWithRecipients = mock(EncodedPayloadWithRecipients.class); EncodedPayload encodedPayload = mock(EncodedPayload.class); when(encodedPayloadWithRecipients.getEncodedPayload()).thenReturn(encodedPayload); when(encodedPayload.getCipherText()).thenReturn("CIPHERTEXT".getBytes()); when(enclave.encryptPayload(any(), any(), any())).thenReturn(encodedPayloadWithRecipients); String sender = Base64.getEncoder().encodeToString("SENDER".getBytes()); String receiver = Base64.getEncoder().encodeToString("RECEIVER".getBytes()); byte[] payload = Base64.getEncoder().encode("PAYLOAD".getBytes()); SendRequest sendRequest = new SendRequest(); sendRequest.setFrom(sender); sendRequest.setTo(receiver); sendRequest.setPayload(payload); SendResponse result = transactionManager.send(sendRequest); assertThat(result).isNotNull(); verify(enclave).encryptPayload(any(), any(), any()); verify(payloadEncoder).encode(encodedPayloadWithRecipients); verify(encryptedTransactionDAO).save(any(EncryptedTransaction.class)); verify(payloadPublisher,times(2)).publishPayload(any(EncodedPayloadWithRecipients.class), any(PublicKey.class)); verify(enclave).getForwardingKeys(); } @Test public void delete() { String encodedKey = Base64.getEncoder().encodeToString("SOMEKEY".getBytes()); DeleteRequest deleteRequest = new DeleteRequest(); deleteRequest.setKey(encodedKey); transactionManager.delete(deleteRequest); verify(encryptedTransactionDAO).delete(any(MessageHash.class)); } @Test public void storePayload() { byte[] input = "SOMEDATA".getBytes(); EncodedPayloadWithRecipients encodedPayloadWithRecipients = mock(EncodedPayloadWithRecipients.class); EncodedPayload encodedPayload = mock(EncodedPayload.class); when(encodedPayloadWithRecipients.getEncodedPayload()).thenReturn(encodedPayload); when(encodedPayload.getCipherText()).thenReturn("CIPHERTEXT".getBytes()); when(payloadEncoder.decodePayloadWithRecipients(input)).thenReturn(encodedPayloadWithRecipients); transactionManager.storePayload(input); verify(encryptedTransactionDAO).save(any(EncryptedTransaction.class)); verify(payloadEncoder).encode(encodedPayloadWithRecipients); verify(payloadEncoder).decodePayloadWithRecipients(input); } @Test public void resendAll() { EncryptedTransaction someTransaction = new EncryptedTransaction(mock(MessageHash.class), "someTransaction".getBytes()); EncryptedTransaction someOtherTransaction = new EncryptedTransaction(mock(MessageHash.class), "someOtherTransaction".getBytes()); when(encryptedTransactionDAO.retrieveAllTransactions()) .thenReturn(Arrays.asList(someTransaction, someOtherTransaction)); EncodedPayloadWithRecipients encodedPayloadWithRecipients = mock(EncodedPayloadWithRecipients.class); when(encodedPayloadWithRecipients.getRecipientKeys()) .thenReturn(Arrays.asList(PublicKey.from("PUBLICKEY".getBytes()))); when(payloadEncoder.decodePayloadWithRecipients(any(byte[].class))).thenReturn(encodedPayloadWithRecipients); String publicKeyData = Base64.getEncoder().encodeToString("PUBLICKEY".getBytes()); ResendRequest resendRequest = new ResendRequest(); resendRequest.setPublicKey(publicKeyData); resendRequest.setType(ResendRequestType.ALL); ResendResponse result = transactionManager.resend(resendRequest); assertThat(result).isNotNull(); verify(encryptedTransactionDAO).retrieveAllTransactions(); verify(payloadEncoder, times(2)).decodePayloadWithRecipients(any(byte[].class)); verify(payloadPublisher, times(2)).publishPayload(any(EncodedPayloadWithRecipients.class), any(PublicKey.class)); } @Test public void resendIndividualNoExistingTransactionFound() { when(encryptedTransactionDAO.retrieveByHash(any(MessageHash.class))) .thenReturn(Optional.empty()); String publicKeyData = Base64.getEncoder().encodeToString("PUBLICKEY".getBytes()); PublicKey recipientKey = PublicKey.from(publicKeyData.getBytes()); byte[] keyData = Base64.getEncoder().encode("KEY".getBytes()); ResendRequest resendRequest = new ResendRequest(); resendRequest.setKey(new String(keyData)); resendRequest.setPublicKey(recipientKey.encodeToBase64()); resendRequest.setType(ResendRequestType.INDIVIDUAL); try { transactionManager.resend(resendRequest); failBecauseExceptionWasNotThrown(TransactionNotFoundException.class); } catch (TransactionNotFoundException ex) { verify(encryptedTransactionDAO).retrieveByHash(any(MessageHash.class)); } } @Test public void resendIndividual() { byte[] encodedPayloadData = "getRecipientKeys".getBytes(); EncryptedTransaction encryptedTransaction = mock(EncryptedTransaction.class); when(encryptedTransaction.getEncodedPayload()).thenReturn(encodedPayloadData); when(encryptedTransactionDAO.retrieveByHash(any(MessageHash.class))) .thenReturn(Optional.of(encryptedTransaction)); EncodedPayload encodedPayload = mock(EncodedPayload.class); when(encodedPayload.getRecipientBoxes()).thenReturn(Arrays.asList("RECIPIENTBOX".getBytes())); byte[] encodedOutcome = "SUCCESS".getBytes(); String publicKeyData = Base64.getEncoder().encodeToString("PUBLICKEY".getBytes()); PublicKey recipientKey = PublicKey.from(publicKeyData.getBytes()); EncodedPayloadWithRecipients encodedPayloadWithRecipients = mock(EncodedPayloadWithRecipients.class); when(encodedPayloadWithRecipients.getEncodedPayload()).thenReturn(encodedPayload); when(payloadEncoder.decodePayloadWithRecipients(encodedPayloadData, recipientKey)) .thenReturn(encodedPayloadWithRecipients); when(payloadEncoder.encode(any(EncodedPayloadWithRecipients.class))).thenReturn(encodedOutcome); byte[] keyData = Base64.getEncoder().encode("KEY".getBytes()); ResendRequest resendRequest = new ResendRequest(); resendRequest.setKey(new String(keyData)); resendRequest.setPublicKey(recipientKey.encodeToBase64()); resendRequest.setType(ResendRequestType.INDIVIDUAL); ResendResponse result = transactionManager.resend(resendRequest); assertThat(result).isNotNull(); assertThat(result.getPayload()).contains(encodedOutcome); verify(encryptedTransactionDAO).retrieveByHash(any(MessageHash.class)); verify(payloadEncoder).decodePayloadWithRecipients(encodedPayloadData, recipientKey); verify(payloadEncoder).encode(any(EncodedPayloadWithRecipients.class)); } @Test public void receive() { byte[] keyData = Base64.getEncoder().encode("KEY".getBytes()); String recipient = Base64.getEncoder().encodeToString("recipient".getBytes()); ReceiveRequest receiveRequest = new ReceiveRequest(); receiveRequest.setKey(new String(keyData)); receiveRequest.setTo(recipient); MessageHash messageHash = new MessageHash(keyData); EncryptedTransaction encryptedTransaction = new EncryptedTransaction(messageHash, keyData); EncodedPayloadWithRecipients encodedPayloadWithRecipients = mock(EncodedPayloadWithRecipients.class); when(payloadEncoder.decodePayloadWithRecipients(any(byte[].class))).thenReturn(encodedPayloadWithRecipients); when(encryptedTransactionDAO.retrieveByHash(any(MessageHash.class))) .thenReturn(Optional.of(encryptedTransaction)); byte[] expectedOutcome = "Encrytpted payload".getBytes(); when(enclave.unencryptTransaction(any(EncodedPayloadWithRecipients.class), any(PublicKey.class))) .thenReturn(expectedOutcome); PublicKey publicKey = mock(PublicKey.class); when(enclave.getPublicKeys()).thenReturn(Collections.singleton(publicKey)); ReceiveResponse receiveResponse = transactionManager.receive(receiveRequest); assertThat(receiveResponse).isNotNull(); assertThat(receiveResponse.getPayload()) .isEqualTo(expectedOutcome); verify(payloadEncoder, times(2)).decodePayloadWithRecipients(any(byte[].class)); verify(encryptedTransactionDAO).retrieveByHash(any(MessageHash.class)); verify(enclave, times(2)).unencryptTransaction(any(EncodedPayloadWithRecipients.class), any(PublicKey.class)); verify(enclave).getPublicKeys(); } @Test public void receiveNoTransactionInDatabase() { byte[] keyData = Base64.getEncoder().encode("KEY".getBytes()); String recipient = Base64.getEncoder().encodeToString("recipient".getBytes()); ReceiveRequest receiveRequest = new ReceiveRequest(); receiveRequest.setKey(new String(keyData)); receiveRequest.setTo(recipient); EncodedPayloadWithRecipients encodedPayloadWithRecipients = mock(EncodedPayloadWithRecipients.class); when(payloadEncoder.decodePayloadWithRecipients(any(byte[].class))).thenReturn(encodedPayloadWithRecipients); when(encryptedTransactionDAO.retrieveByHash(any(MessageHash.class))) .thenReturn(Optional.empty()); try { transactionManager.receive(receiveRequest); failBecauseExceptionWasNotThrown(TransactionNotFoundException.class); } catch (TransactionNotFoundException ex) { verify(encryptedTransactionDAO).retrieveByHash(any(MessageHash.class)); } } @Test public void receiveNoRecipientKeyFound() { byte[] keyData = Base64.getEncoder().encode("KEY".getBytes()); String recipient = Base64.getEncoder().encodeToString("recipient".getBytes()); ReceiveRequest receiveRequest = new ReceiveRequest(); receiveRequest.setKey(new String(keyData)); receiveRequest.setTo(recipient); MessageHash messageHash = new MessageHash(keyData); EncryptedTransaction encryptedTransaction = new EncryptedTransaction(messageHash, keyData); EncodedPayloadWithRecipients encodedPayloadWithRecipients = mock(EncodedPayloadWithRecipients.class); when(payloadEncoder.decodePayloadWithRecipients(any(byte[].class))).thenReturn(encodedPayloadWithRecipients); when(encryptedTransactionDAO.retrieveByHash(any(MessageHash.class))) .thenReturn(Optional.of(encryptedTransaction)); PublicKey publicKey = mock(PublicKey.class); when(enclave.getPublicKeys()).thenReturn(Collections.singleton(publicKey)); when(enclave.unencryptTransaction(any(EncodedPayloadWithRecipients.class), any(PublicKey.class))).thenThrow(NaclException.class); try { transactionManager.receive(receiveRequest); failBecauseExceptionWasNotThrown(NoRecipientKeyFoundException.class); } catch (NoRecipientKeyFoundException ex) { verify(encryptedTransactionDAO).retrieveByHash(any(MessageHash.class)); verify(enclave).getPublicKeys(); verify(enclave).unencryptTransaction(any(EncodedPayloadWithRecipients.class), any(PublicKey.class)); verify(payloadEncoder).decodePayloadWithRecipients(any(byte[].class)); } } @Test public void receiveHH() { byte[] keyData = Base64.getEncoder().encode("KEY".getBytes()); String recipient = Base64.getEncoder().encodeToString("recipient".getBytes()); ReceiveRequest receiveRequest = new ReceiveRequest(); receiveRequest.setKey(new String(keyData)); receiveRequest.setTo(recipient); MessageHash messageHash = new MessageHash(keyData); EncryptedTransaction encryptedTransaction = new EncryptedTransaction(messageHash, keyData); EncodedPayloadWithRecipients encodedPayloadWithRecipients = mock(EncodedPayloadWithRecipients.class); when(payloadEncoder.decodePayloadWithRecipients(any(byte[].class))) .thenReturn(encodedPayloadWithRecipients) .thenReturn(null); when(encryptedTransactionDAO.retrieveByHash(any(MessageHash.class))) .thenReturn(Optional.of(encryptedTransaction)); byte[] expectedOutcome = "Encrytpted payload".getBytes(); when(enclave.unencryptTransaction(any(EncodedPayloadWithRecipients.class), any(PublicKey.class))) .thenReturn(expectedOutcome); PublicKey publicKey = mock(PublicKey.class); when(enclave.getPublicKeys()).thenReturn(Collections.singleton(publicKey)); try { transactionManager.receive(receiveRequest); failBecauseExceptionWasNotThrown(IllegalStateException.class); } catch (IllegalStateException ex) { verify(payloadEncoder, times(2)).decodePayloadWithRecipients(any(byte[].class)); verify(encryptedTransactionDAO).retrieveByHash(any(MessageHash.class)); verify(enclave).unencryptTransaction(any(EncodedPayloadWithRecipients.class), any(PublicKey.class)); verify(enclave).getPublicKeys(); } } @Test public void receiveNullRecipientThrowsNoRecipientKeyFound() { byte[] keyData = Base64.getEncoder().encode("KEY".getBytes()); ReceiveRequest receiveRequest = new ReceiveRequest(); receiveRequest.setKey(new String(keyData)); MessageHash messageHash = new MessageHash(keyData); EncryptedTransaction encryptedTransaction = new EncryptedTransaction(messageHash, keyData); EncodedPayloadWithRecipients encodedPayloadWithRecipients = mock(EncodedPayloadWithRecipients.class); when(payloadEncoder.decodePayloadWithRecipients(any(byte[].class))).thenReturn(encodedPayloadWithRecipients); when(encryptedTransactionDAO.retrieveByHash(any(MessageHash.class))) .thenReturn(Optional.of(encryptedTransaction)); PublicKey publicKey = mock(PublicKey.class); when(enclave.getPublicKeys()).thenReturn(Collections.singleton(publicKey)); when(enclave.unencryptTransaction(any(EncodedPayloadWithRecipients.class), any(PublicKey.class))).thenThrow(NaclException.class); try { transactionManager.receive(receiveRequest); failBecauseExceptionWasNotThrown(NoRecipientKeyFoundException.class); } catch (NoRecipientKeyFoundException ex) { verify(encryptedTransactionDAO).retrieveByHash(any(MessageHash.class)); verify(enclave).getPublicKeys(); verify(enclave).unencryptTransaction(any(EncodedPayloadWithRecipients.class), any(PublicKey.class)); verify(payloadEncoder).decodePayloadWithRecipients(any(byte[].class)); } } @Test public void receiveEmptyRecipientThrowsNoRecipientKeyFound() { byte[] keyData = Base64.getEncoder().encode("KEY".getBytes()); ReceiveRequest receiveRequest = new ReceiveRequest(); receiveRequest.setKey(new String(keyData)); receiveRequest.setTo(""); MessageHash messageHash = new MessageHash(keyData); EncryptedTransaction encryptedTransaction = new EncryptedTransaction(messageHash, keyData); EncodedPayloadWithRecipients encodedPayloadWithRecipients = mock(EncodedPayloadWithRecipients.class); when(payloadEncoder.decodePayloadWithRecipients(any(byte[].class))).thenReturn(encodedPayloadWithRecipients); when(encryptedTransactionDAO.retrieveByHash(any(MessageHash.class))) .thenReturn(Optional.of(encryptedTransaction)); PublicKey publicKey = mock(PublicKey.class); when(enclave.getPublicKeys()).thenReturn(Collections.singleton(publicKey)); when(enclave.unencryptTransaction(any(EncodedPayloadWithRecipients.class), any(PublicKey.class))).thenThrow(NaclException.class); try { transactionManager.receive(receiveRequest); failBecauseExceptionWasNotThrown(NoRecipientKeyFoundException.class); } catch (NoRecipientKeyFoundException ex) { verify(encryptedTransactionDAO).retrieveByHash(any(MessageHash.class)); verify(enclave).getPublicKeys(); verify(enclave).unencryptTransaction(any(EncodedPayloadWithRecipients.class), any(PublicKey.class)); verify(payloadEncoder).decodePayloadWithRecipients(any(byte[].class)); } } }
[ "melowe.quorum@gmail.com" ]
melowe.quorum@gmail.com
c2092a1c8bcf68f31298195853e3a3a84b8cfd3c
a70c2f48fd981d506093bda26da61afb6977493e
/day02/Suitang2.java
0b3b1eb735f47441539a9cd2ba2f41226d1db2e5
[]
no_license
A203/LiChuanHong
f2589006f292308f4a8bd47d8798c1cbd760bae4
b3a98c190502f74efec88b8f1f601323b9cd4000
refs/heads/master
2021-01-19T14:56:17.024808
2015-07-14T10:20:18
2015-07-14T10:20:18
38,682,319
0
0
null
null
null
null
UTF-8
Java
false
false
552
java
package day02; import java.util.Scanner; public class Suitang2 { public static void main(String[] args){ Scanner scanner=new Scanner(System.in); int day=scanner.nextInt(); String monthstring=""; switch(day) { case 1:monthstring="monday";break; case 2:monthstring="tuesday";break; case 3:monthstring="wednesday";break; case 4:monthstring="thurday";break; case 5:monthstring="friday";break; case 6:monthstring="saturday";break; case 7:monthstring="sunday";break; default:monthstring="error day"; } System.out.println(monthstring); } }
[ "780869080@qq.com" ]
780869080@qq.com
8f287beefaad3e4ee1ed5f6128e76961b6e9ed41
41b2fdcbb359672b997bd561ae71e1f3a28275ce
/com/upgrad/bloomfilter/BloomFilter.java
400a7ea8b4708b7f6b925de9a1071c14991f77be
[]
no_license
Rajakuman/ProjectCodes
38da2a8868a5c85aa16b4dc584f8cc2b54a460a2
506b5f7629ece541da0ec56d725eb1043eb5b389
refs/heads/master
2020-03-26T04:56:36.683262
2018-08-14T06:52:30
2018-08-14T06:52:30
144,529,949
0
0
null
null
null
null
UTF-8
Java
false
false
1,990
java
package com.upgrad.bloomfilter; /* * Java Program to Implement Bloom Filter */ import java.security.*; import java.math.*; import java.nio.*; /* Class BloomFilter */ class BloomFilter { private byte[] set; private int keySize, setSize, size; private MessageDigest md; /* Constructor */ public BloomFilter(int capacity, int k) { setSize = capacity; set = new byte[setSize]; keySize = k; size = 0; try { md = MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException e) { throw new IllegalArgumentException("Error : MD5 Hash not found"); } } /* Function to clear bloom set */ public void makeEmpty() { set = new byte[setSize]; size = 0; try { md = MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException e) { throw new IllegalArgumentException("Error : MD5 Hash not found"); } } /* Function to check is empty */ public boolean isEmpty() { return size == 0; } /* Function to get size of objects added */ public int getSize() { return size; } /* Function to get hash - MD5 */ private int getHash(int i) { md.reset(); byte[] bytes = ByteBuffer.allocate(4).putInt(i).array(); System.out.println("bytes"+bytes.toString()); md.update(bytes, 0, bytes.length); return Math.abs(new BigInteger(1, md.digest()).intValue()) % (set.length-1 ); } /* Function to add an object */ public void add(Object obj) { int[] tmpset = getSetArray(obj); for (int i : tmpset) set[i] = 1; size++; } /* Function to check is an object is present */ public boolean contains(Object obj) { int[] tmpset = getSetArray(obj); for (int i : tmpset) if (set[i] != 1) return false; return true; } /* Function to get set array for an object */ private int[] getSetArray(Object obj) { int[] tmpset = new int[keySize]; tmpset[0] = getHash(obj.hashCode()); for (int i = 1; i < keySize; i++) tmpset[i] = (getHash(tmpset[i - 1])); return tmpset; } }
[ "nrajakumaran@gmail.com" ]
nrajakumaran@gmail.com
21d2b193ea8b16a4d79f0fbeccd24bc0b45b7742
1aa8e2e2b6d825e8b9c2c0dcd78fe24058c18d91
/app/src/main/java/com/example/wenbiaozheng/redpoint/RedPointManager.java
cee6f087c80c9055eb77d533d5065b8e82e9105e
[]
no_license
wenjiang/RedPoint
93a1a3362c668012fcb884db5de60f4777780864
fcd53cbce061dafdb477f42eb5bfc0661decd0fd
refs/heads/master
2020-03-26T22:51:58.522278
2018-08-21T02:02:53
2018-08-21T02:02:53
145,492,261
0
0
null
null
null
null
UTF-8
Java
false
false
9,136
java
package com.example.wenbiaozheng.redpoint; import android.app.Activity; import android.util.Log; import android.view.Gravity; import android.view.View; import com.example.wenbiaozheng.redpoint.view.QBadgeView; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public enum RedPointManager { Instance; private static final String TAG = "RedPointManager"; public static final int TYPE_NORMAL = 0; private Map<Integer, Integer> mRedPointMap = new HashMap<>(); //ViewId对应的控件上的红点数字 private Map<Integer, List<String>> mRedPointReasonMap = new HashMap<>(); //ViewId对应的控件上的节点名称 private Map<Integer, QBadgeView> mRedPointViewMap = new HashMap<>(); //ViewId对应的红点View private Map<String, Integer> mRedPointReasonCountMap = new HashMap<>(); //节点对应的红点数字 private Map<String, List<Integer>> mRedPointReasonBindMap = new HashMap<>(); //经过该节点的ViewId public void add(Activity activity, int viewId, String reason, boolean supportRepeat) { if (mRedPointReasonMap.containsKey(viewId)) { List<String> reasonList = mRedPointReasonMap.get(viewId); if (reasonList != null) { if (reasonList.contains(reason)) { if(!supportRepeat) { Log.i(TAG, "已经添加了红点出现的节点:" + reason); return; }else{ Log.i(TAG, "重复添加红点的节点:" + reason); reasonList.add(reason); mRedPointReasonMap.put(viewId, reasonList); addRedPointCount(viewId); addRedReasonCount(reason); addRedReasonBind(reason, viewId); } } else { Log.i(TAG, "添加红点的节点:" + reason); reasonList.add(reason); mRedPointReasonMap.put(viewId, reasonList); addRedPointCount(viewId); addRedPointView(activity, viewId); addRedReasonCount(reason); addRedReasonBind(reason, viewId); } } else { Log.i(TAG, "添加红点的节点:" + reason); reasonList = new ArrayList<>(); reasonList.add(reason); mRedPointReasonMap.put(viewId, reasonList); addRedPointCount(viewId); addRedPointView(activity, viewId); addRedReasonCount(reason); addRedReasonBind(reason, viewId); } } else { Log.i(TAG, "添加红点的节点:" + reason); List<String> reasonList = new ArrayList<>(); reasonList.add(reason); mRedPointReasonMap.put(viewId, reasonList); addRedPointCount(viewId); addRedPointView(activity, viewId); addRedReasonCount(reason); addRedReasonBind(reason, viewId); } } private void addRedReasonBind(String reason, int viewId) { if(mRedPointReasonBindMap.containsKey(reason)){ List<Integer> viewIdList = mRedPointReasonBindMap.get(reason); if(viewIdList != null){ if(!viewIdList.contains(viewId)){ viewIdList.add(viewId); mRedPointReasonBindMap.put(reason, viewIdList); } } }else{ List<Integer> viewIdList = new ArrayList<>(); viewIdList.add(viewId); mRedPointReasonBindMap.put(reason, viewIdList); } } private void addRedPointView(Activity activity, int viewId) { if (!mRedPointViewMap.containsKey(viewId)) { QBadgeView badgeView = new QBadgeView(activity); badgeView.setBadgeGravity(Gravity.END | Gravity.TOP); mRedPointViewMap.put(viewId, badgeView); } } private void addRedReasonCount(String reason){ if(mRedPointReasonCountMap.containsKey(reason)){ int count = mRedPointReasonCountMap.get(reason); count++; mRedPointReasonCountMap.put(reason, count); }else{ mRedPointReasonCountMap.put(reason, 1); } } private void addRedPointCount(int viewId) { if (mRedPointMap.containsKey(viewId)) { int count = mRedPointMap.get(viewId); count++; mRedPointMap.put(viewId, count); } else { mRedPointMap.put(viewId, 1); } } public void remove(int viewId, String reason) { if (mRedPointMap.containsKey(viewId)) { int count = mRedPointMap.get(viewId); count--; if (count == 0) { Log.i(TAG, "这个节点:" + reason + "的红点已经为0了"); mRedPointMap.remove(viewId); mRedPointReasonMap.remove(viewId); } else { mRedPointMap.put(viewId, count); if (mRedPointReasonMap.containsKey(viewId)) { List<String> reasonList = mRedPointReasonMap.get(viewId); if (reasonList != null) { reasonList.remove(reason); mRedPointReasonMap.put(viewId, reasonList); Log.i(TAG, "这个节点:" + reason + "的红点的数量:" + count); } } } } } public void show(Activity activity, int viewId, int type) { if (mRedPointMap.containsKey(viewId)) { int count = mRedPointMap.get(viewId); if (count > 0) { Log.i(TAG, "显示红点"); View view = activity.findViewById(viewId); if (mRedPointViewMap.containsKey(viewId)) { QBadgeView badgeView = mRedPointViewMap.get(viewId); badgeView.bindTarget(view).setBadgeNumber(count); } } else { Log.i(TAG, "不显示红点"); if (mRedPointViewMap.containsKey(viewId)) { QBadgeView badgeView = mRedPointViewMap.get(viewId); badgeView.hide(false); mRedPointViewMap.remove(viewId); } } } else { Log.i(TAG, "不显示红点"); if (mRedPointViewMap.containsKey(viewId)) { QBadgeView badgeView = mRedPointViewMap.get(viewId); badgeView.hide(false); mRedPointViewMap.remove(viewId); } } } public void hide(Activity activity, String reason, boolean isAnimate){ if(mRedPointReasonBindMap.containsKey(reason)){ List<Integer> bindViewIdList = mRedPointReasonBindMap.get(reason); for(int viewId : bindViewIdList){ if(mRedPointReasonMap.containsKey(viewId)){ List<String> reasonList = mRedPointReasonMap.get(viewId); if(reasonList.size() > 1){ reasonList.remove(reason); mRedPointReasonMap.put(viewId, reasonList); if(mRedPointMap.containsKey(viewId)){ int count = mRedPointMap.get(viewId); count--; mRedPointMap.put(viewId, count); QBadgeView badgeView = mRedPointViewMap.get(viewId); View view = activity.findViewById(viewId); badgeView.setBadgeNumber(count); badgeView.bindTarget(view); } }else{ if(mRedPointMap.containsKey(viewId)) { int count = mRedPointMap.get(viewId); count--; mRedPointMap.put(viewId, count); } mRedPointReasonMap.remove(viewId); QBadgeView badgeView = mRedPointViewMap.get(viewId); badgeView.hide(isAnimate); Log.i(TAG, "清除reason:" + reason + "上的所有红点"); if(mRedPointReasonCountMap.containsKey(reason)){ int count = mRedPointReasonCountMap.get(reason); count--; mRedPointReasonCountMap.put(reason, count); } } } } } } public int countOfReason(String reason){ if(mRedPointReasonCountMap.containsKey(reason)){ return mRedPointReasonCountMap.get(reason); }else{ return 0; } } public int getViewRedPoint(int viewId){ if(mRedPointMap.containsKey(viewId)){ return mRedPointMap.get(viewId); }else{ return 0; } } }
[ "zhengwenbiao@yy.com" ]
zhengwenbiao@yy.com
5258e8119a443efd31d8cc5a34e1c9bdf8593779
876e52c85e404df80b557ff4b4d222e382cd009c
/common/src/main/java/com/study/common/exception/NotFoundException.java
2946f18805e0248219e20169e9323734dcd715e7
[]
no_license
SaltzmanAlaric/springcloud
64093c3fc176b2613b2c7c62485a5b79bc6bc6f4
cf88877a27dcbafa18b0d4d05c4d46e3427c2f2c
refs/heads/master
2023-01-14T06:42:50.821275
2020-11-19T06:19:58
2020-11-19T06:19:58
304,554,905
0
0
null
null
null
null
UTF-8
Java
false
false
241
java
package com.study.common.exception; /** * 404异常类. */ public class NotFoundException extends RuntimeException { public NotFoundException() { } public NotFoundException(String message) { super(message); } }
[ "SaltzmanAlaric@github.com" ]
SaltzmanAlaric@github.com
1072c99367af8ddc1d461e2329bec31eaa6a6909
ac9fea6547079ba54e0aed7b89b451f7a02651c3
/src/main/visible01.java
e93bfb7694eea5f68161069a155241655ae2e18b
[]
no_license
kingbedenono/JAVAproject
03177e45591924a3759d2fb5170ede085908a310
cd146014bd6d8a327fad0997f6390c41e1860ac9
refs/heads/master
2021-05-07T14:48:12.498243
2017-11-07T16:52:07
2017-11-07T16:52:07
109,863,147
0
0
null
null
null
null
UTF-8
Java
false
false
86,415
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 main; import java.*; import java.sql.*; import java.util.Arrays; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JComboBox; import javax.swing.JOptionPane; import javax.swing.JTable; import javax.swing.table.DefaultTableModel; /** * * @author Stanley */ public class visible01 extends javax.swing.JFrame { /** * Creates new form visible01 */ //private Connection con; private MyConnection con; private ResultSetMetaData rstmeta; String empAdd=""; public visible01() { initComponents(); String p="SELECT name FROM language"; String f="name"; String incident="select first_name from employee"; String name="first_name"; String pp="select name from company "; String kk="name"; String oc="SELECT name FROM location "; String a="id"; String b="select id from address"; fillCombo(addemplo, b, a); fillCombo(loc,oc,kk); fillCombo(company,pp,kk); fillCombo(foreman,incident,name); fillCombo(incidentC, incident, name); fillCombo(lang,p,f); this.setTitle("7 minutes training Safety"); } private void supprimer( String query, JTable table, String query1,int ligne, String [] tete) {//GEN-FIRST:event_supprimerActionPerformed int diag = JOptionPane.showConfirmDialog(null, "Voulez-vous vraiment supprimer cet employé?"); if (diag == 0) { if (ligne == -1) { System.out.println("aucune ligne"); } else { try { con = MyConnection.getConnection(); con.getStatement().executeUpdate(query); rempliremp(query1, table,tete); } catch (SQLException ex) { Logger.getLogger(visible01.class.getName()).log(Level.SEVERE, null, ex); } }//GEN-LAST:event_supprimerActionPerformed } } /** * * @param query */ public void insert(String query){ try { con = MyConnection.getConnection(); con.getStatement().executeUpdate(query); } catch (SQLException ex) { Logger.getLogger(visible01.class.getName()).log(Level.SEVERE, null, ex); } } public void select(String query){ try { con = MyConnection.getConnection(); con.getStatement().executeQuery(query); } catch (SQLException ex) { Logger.getLogger(visible01.class.getName()).log(Level.SEVERE, null, ex); } } public void rempliremp(String query, JTable tablo, String[] tete) { // String query = "select datembe,typee,nome,prenome,numate,adressee,salee from employe"; int nbcol,nblig; try { con = MyConnection.getConnection(); con.getStatement().executeQuery(query); ResultSet rst; rst = con.getStatement().getResultSet(); rstmeta = (ResultSetMetaData) rst.getMetaData(); nbcol = rstmeta.getColumnCount(); nblig = 0; while (rst.next()) { nblig++; } System.out.println(nblig); Object[][] liste = new Object[nblig][nbcol]; int i = 0, j = 0; rst.beforeFirst(); while (rst.next()) { for (i = 1; i <= nbcol; i++) { liste[j][i - 1] = (String) rst.getObject(i).toString(); } j = j + 1; } tablo.setModel(new javax.swing.table.DefaultTableModel(liste, tete)); tablo.repaint(); } catch (SQLException ex) { Logger.getLogger(visible01.class.getName()).log(Level.SEVERE, null, ex); } } public void fillCombo(JComboBox box ,String query, String filed){ try { con = MyConnection.getConnection(); ResultSet rs = con.getStatement().executeQuery(query); while(rs.next()){ String Name = rs.getString(filed); box.addItem(Name); } } catch (SQLException ex) { Logger.getLogger(visible01.class.getName()).log(Level.SEVERE, null, ex); } } /** * 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() { jButton4 = new javax.swing.JButton(); jTabbedPane1 = new javax.swing.JTabbedPane(); jTabbedPane2 = new javax.swing.JTabbedPane(); jPanel7 = new javax.swing.JPanel(); jPanel8 = new javax.swing.JPanel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); userN = new javax.swing.JTextField(); userP = new javax.swing.JPasswordField(); jLabel10 = new javax.swing.JLabel(); jPanel9 = new javax.swing.JPanel(); jScrollPane1 = new javax.swing.JScrollPane(); loginT = new javax.swing.JTable(); t1 = new javax.swing.JTextField(); t2 = new javax.swing.JPasswordField(); updatelogin = new javax.swing.JButton(); deleteLogin = new javax.swing.JButton(); jLabel11 = new javax.swing.JLabel(); jPanel1 = new javax.swing.JPanel(); jTabbedPane6 = new javax.swing.JTabbedPane(); jPanel19 = new javax.swing.JPanel(); jLabel9 = new javax.swing.JLabel(); date = new javax.swing.JTextField(); jLabel27 = new javax.swing.JLabel(); jScrollPane9 = new javax.swing.JScrollPane(); des = new javax.swing.JTextArea(); jLabel26 = new javax.swing.JLabel(); jComboBox1 = new javax.swing.JComboBox(); jLabel28 = new javax.swing.JLabel(); jLabel29 = new javax.swing.JLabel(); jLabel30 = new javax.swing.JLabel(); foreman = new javax.swing.JComboBox(); loc = new javax.swing.JComboBox(); jButton3 = new javax.swing.JButton(); jButton5 = new javax.swing.JButton(); jPanel20 = new javax.swing.JPanel(); jScrollPane10 = new javax.swing.JScrollPane(); mettings = new javax.swing.JTable(); jPanel2 = new javax.swing.JPanel(); jTabbedPane5 = new javax.swing.JTabbedPane(); jPanel17 = new javax.swing.JPanel(); jLabel17 = new javax.swing.JLabel(); fname = new javax.swing.JTextField(); jLabel18 = new javax.swing.JLabel(); lname = new javax.swing.JTextField(); jLabel19 = new javax.swing.JLabel(); jScrollPane7 = new javax.swing.JScrollPane(); add = new javax.swing.JTextArea(); jLabel20 = new javax.swing.JLabel(); phone = new javax.swing.JTextField(); jLabel21 = new javax.swing.JLabel(); jLabel22 = new javax.swing.JLabel(); title = new javax.swing.JTextField(); jLabel23 = new javax.swing.JLabel(); email = new javax.swing.JTextField(); jLabel24 = new javax.swing.JLabel(); company = new javax.swing.JComboBox(); lang = new javax.swing.JComboBox(); jButton15 = new javax.swing.JButton(); jButton16 = new javax.swing.JButton(); jLabel25 = new javax.swing.JLabel(); addemplo = new javax.swing.JComboBox(); jPanel18 = new javax.swing.JPanel(); jScrollPane8 = new javax.swing.JScrollPane(); emptable = new javax.swing.JTable(); affi = new javax.swing.JLabel(); pho = new javax.swing.JButton(); emai = new javax.swing.JButton(); jPanel3 = new javax.swing.JPanel(); jTabbedPane4 = new javax.swing.JTabbedPane(); jPanel10 = new javax.swing.JPanel(); jPanel12 = new javax.swing.JPanel(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); jButton6 = new javax.swing.JButton(); jButton7 = new javax.swing.JButton(); jScrollPane2 = new javax.swing.JScrollPane(); jTextArea1 = new javax.swing.JTextArea(); jTextField4 = new javax.swing.JTextField(); jButton8 = new javax.swing.JButton(); jLabel12 = new javax.swing.JLabel(); jComboBox2 = new javax.swing.JComboBox(); jLabel16 = new javax.swing.JLabel(); jTextField1 = new javax.swing.JTextField(); jPanel11 = new javax.swing.JPanel(); jPanel13 = new javax.swing.JPanel(); jScrollPane3 = new javax.swing.JScrollPane(); jTable2 = new javax.swing.JTable(); jTextField5 = new javax.swing.JTextField(); jScrollPane4 = new javax.swing.JScrollPane(); jTextArea2 = new javax.swing.JTextArea(); jTextField6 = new javax.swing.JTextField(); jButton9 = new javax.swing.JButton(); jButton10 = new javax.swing.JButton(); jButton11 = new javax.swing.JButton(); jLabel15 = new javax.swing.JLabel(); jPanel4 = new javax.swing.JPanel(); jTabbedPane3 = new javax.swing.JTabbedPane(); jPanel14 = new javax.swing.JPanel(); jPanel16 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); incidate = new javax.swing.JTextField(); jLabel7 = new javax.swing.JLabel(); jScrollPane5 = new javax.swing.JScrollPane(); incides = new javax.swing.JTextArea(); jLabel8 = new javax.swing.JLabel(); jButton12 = new javax.swing.JButton(); saveincidents = new javax.swing.JButton(); incidentC = new javax.swing.JComboBox(); empshow = new javax.swing.JLabel(); jLabel13 = new javax.swing.JLabel(); addempincident = new javax.swing.JButton(); jPanel15 = new javax.swing.JPanel(); jScrollPane6 = new javax.swing.JScrollPane(); inciT = new javax.swing.JTable(); jButton14 = new javax.swing.JButton(); jPanel5 = new javax.swing.JPanel(); jPanel6 = new javax.swing.JPanel(); jLabel14 = new javax.swing.JLabel(); jButton4.setText("jButton4"); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jTabbedPane2.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jTabbedPane2MouseClicked(evt); } }); jTabbedPane2.addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { jTabbedPane2KeyPressed(evt); } }); jLabel2.setFont(new java.awt.Font("Times New Roman", 0, 24)); // NOI18N jLabel2.setText("User Name:"); jLabel3.setFont(new java.awt.Font("Times New Roman", 0, 24)); // NOI18N jLabel3.setText("Password: "); jButton1.setBackground(new java.awt.Color(255, 51, 51)); jButton1.setText("Cancel"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jButton2.setBackground(new java.awt.Color(102, 255, 102)); jButton2.setText("Enter"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); jLabel10.setIcon(new javax.swing.ImageIcon(getClass().getResource("/main/logo.jpg"))); // NOI18N javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8); jPanel8.setLayout(jPanel8Layout); jPanel8Layout.setHorizontalGroup( jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel8Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jButton1) .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel2) .addComponent(jLabel3))) .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel8Layout.createSequentialGroup() .addGap(56, 56, 56) .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(userN) .addComponent(userP, javax.swing.GroupLayout.DEFAULT_SIZE, 359, Short.MAX_VALUE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(jPanel8Layout.createSequentialGroup() .addGap(136, 136, 136) .addComponent(jLabel10) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 215, Short.MAX_VALUE) .addComponent(jButton2) .addGap(39, 39, 39)))) ); jPanel8Layout.setVerticalGroup( jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel8Layout.createSequentialGroup() .addGap(55, 55, 55) .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(userN, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(49, 49, 49) .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3) .addComponent(userP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel8Layout.createSequentialGroup() .addGap(128, 128, 128) .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(jPanel8Layout.createSequentialGroup() .addGap(109, 109, 109) .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap(217, Short.MAX_VALUE)) ); javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7); jPanel7.setLayout(jPanel7Layout); jPanel7Layout.setHorizontalGroup( jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); jPanel7Layout.setVerticalGroup( jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); jTabbedPane2.addTab("Add new user", jPanel7); loginT.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {null, null} }, new String [] { "UserName", "Password" } ) { boolean[] canEdit = new boolean [] { true, false }; public boolean isCellEditable(int rowIndex, int columnIndex) { return canEdit [columnIndex]; } }); loginT.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { loginTMouseClicked(evt); } }); jScrollPane1.setViewportView(loginT); updatelogin.setBackground(new java.awt.Color(255, 255, 51)); updatelogin.setText("Update"); updatelogin.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { updateloginActionPerformed(evt); } }); deleteLogin.setBackground(new java.awt.Color(255, 204, 204)); deleteLogin.setText("Delete"); deleteLogin.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { deleteLoginActionPerformed(evt); } }); jLabel11.setIcon(new javax.swing.ImageIcon(getClass().getResource("/main/logo.jpg"))); // NOI18N javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9); jPanel9.setLayout(jPanel9Layout); jPanel9Layout.setHorizontalGroup( jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel9Layout.createSequentialGroup() .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 280, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 143, Short.MAX_VALUE) .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createSequentialGroup() .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(jPanel9Layout.createSequentialGroup() .addComponent(updatelogin) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 167, Short.MAX_VALUE) .addComponent(deleteLogin)) .addComponent(t1) .addComponent(t2)) .addContainerGap()) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createSequentialGroup() .addComponent(jLabel11) .addGap(115, 115, 115)))) ); jPanel9Layout.setVerticalGroup( jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createSequentialGroup() .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 559, Short.MAX_VALUE) .addContainerGap()) .addGroup(jPanel9Layout.createSequentialGroup() .addGap(24, 24, 24) .addComponent(t1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(91, 91, 91) .addComponent(t2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(updatelogin) .addComponent(deleteLogin)) .addGap(68, 68, 68) .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(55, 55, 55)) ); jTabbedPane2.addTab("Update/Delete User", jPanel9); jTabbedPane1.addTab("User", jTabbedPane2); jTabbedPane6.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jTabbedPane6MouseClicked(evt); } }); jLabel9.setText("Date"); date.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { dateActionPerformed(evt); } }); jLabel27.setText("Description"); des.setColumns(20); des.setRows(5); jScrollPane9.setViewportView(des); jLabel26.setText("Duration"); jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "0.5", "1", "1.5", "2", "2.5", "3", "3.5", "4", "4.5", "5" })); jLabel28.setText("hrs"); jLabel29.setText("Foreman"); jLabel30.setText("Location"); jButton3.setBackground(new java.awt.Color(102, 255, 102)); jButton3.setText("Save"); jButton5.setBackground(new java.awt.Color(255, 0, 51)); jButton5.setText("Cancel"); jButton5.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton5ActionPerformed(evt); } }); javax.swing.GroupLayout jPanel19Layout = new javax.swing.GroupLayout(jPanel19); jPanel19.setLayout(jPanel19Layout); jPanel19Layout.setHorizontalGroup( jPanel19Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel19Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel19Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jButton5) .addGroup(jPanel19Layout.createSequentialGroup() .addGroup(jPanel19Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel27) .addComponent(jLabel9) .addComponent(jLabel29) .addComponent(jLabel30)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel19Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(foreman, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jScrollPane9, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 318, Short.MAX_VALUE) .addComponent(date, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(loc, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(51, 51, 51) .addGroup(jPanel19Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel19Layout.createSequentialGroup() .addComponent(jLabel26) .addGap(30, 30, 30) .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(28, 28, 28) .addComponent(jLabel28)) .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addContainerGap(101, Short.MAX_VALUE)) ); jPanel19Layout.setVerticalGroup( jPanel19Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel19Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel19Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel9) .addComponent(date, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel26) .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel28)) .addGap(40, 40, 40) .addGroup(jPanel19Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel27) .addComponent(jScrollPane9, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(25, 25, 25) .addGroup(jPanel19Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel29) .addComponent(foreman, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(26, 26, 26) .addGroup(jPanel19Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel30) .addComponent(loc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton3)) .addGap(49, 49, 49) .addComponent(jButton5) .addContainerGap(143, Short.MAX_VALUE)) ); jTabbedPane6.addTab("Create meeting", jPanel19); mettings.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {null, null, null, null}, {null, null, null, null}, {null, null, null, null}, {null, null, null, null} }, new String [] { "Title 1", "Title 2", "Title 3", "Title 4" } )); jScrollPane10.setViewportView(mettings); javax.swing.GroupLayout jPanel20Layout = new javax.swing.GroupLayout(jPanel20); jPanel20.setLayout(jPanel20Layout); jPanel20Layout.setHorizontalGroup( jPanel20Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel20Layout.createSequentialGroup() .addContainerGap(57, Short.MAX_VALUE) .addComponent(jScrollPane10, javax.swing.GroupLayout.PREFERRED_SIZE, 604, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(104, 104, 104)) ); jPanel20Layout.setVerticalGroup( jPanel20Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel20Layout.createSequentialGroup() .addContainerGap() .addComponent(jScrollPane10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(122, Short.MAX_VALUE)) ); jTabbedPane6.addTab("Check Meettings", jPanel20); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jTabbedPane6) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jTabbedPane6, javax.swing.GroupLayout.PREFERRED_SIZE, 609, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)) ); jTabbedPane1.addTab("Meetings", jPanel1); jTabbedPane5.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jTabbedPane5MouseClicked(evt); } }); jLabel17.setText("First Name"); jLabel18.setText("Last Name"); jLabel19.setText("Address"); add.setColumns(20); add.setRows(5); jScrollPane7.setViewportView(add); jLabel20.setText("Phone"); jLabel21.setText("Language"); jLabel22.setText("Title"); jLabel23.setText("Email"); jLabel24.setText("Company"); jButton15.setBackground(new java.awt.Color(153, 255, 153)); jButton15.setText("Save"); jButton15.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton15ActionPerformed(evt); } }); jButton16.setBackground(new java.awt.Color(255, 102, 102)); jButton16.setText("Cancel"); jLabel25.setIcon(new javax.swing.ImageIcon(getClass().getResource("/main/logo.jpg"))); // NOI18N addemplo.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseReleased(java.awt.event.MouseEvent evt) { addemploMouseReleased(evt); } }); javax.swing.GroupLayout jPanel17Layout = new javax.swing.GroupLayout(jPanel17); jPanel17.setLayout(jPanel17Layout); jPanel17Layout.setHorizontalGroup( jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel17Layout.createSequentialGroup() .addGroup(jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel17Layout.createSequentialGroup() .addComponent(jLabel17) .addGap(18, 18, 18) .addComponent(fname)) .addGroup(jPanel17Layout.createSequentialGroup() .addGroup(jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel18, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel19) .addComponent(jLabel20) .addComponent(jLabel22) .addComponent(jLabel24)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(lname) .addGroup(jPanel17Layout.createSequentialGroup() .addGroup(jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(jPanel17Layout.createSequentialGroup() .addComponent(phone, javax.swing.GroupLayout.PREFERRED_SIZE, 242, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(26, 26, 26)) .addGroup(jPanel17Layout.createSequentialGroup() .addComponent(title, javax.swing.GroupLayout.PREFERRED_SIZE, 184, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel23) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED))) .addGroup(jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(email) .addGroup(jPanel17Layout.createSequentialGroup() .addComponent(jLabel21) .addGap(18, 18, 18) .addComponent(lang, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) .addGroup(jPanel17Layout.createSequentialGroup() .addComponent(company, javax.swing.GroupLayout.PREFERRED_SIZE, 184, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jLabel25) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 86, Short.MAX_VALUE) .addGroup(jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jButton15, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 190, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton16, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 190, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel17Layout.createSequentialGroup() .addComponent(addemplo, javax.swing.GroupLayout.PREFERRED_SIZE, 164, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jScrollPane7, javax.swing.GroupLayout.PREFERRED_SIZE, 364, javax.swing.GroupLayout.PREFERRED_SIZE))))) .addContainerGap()) ); jPanel17Layout.setVerticalGroup( jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel17Layout.createSequentialGroup() .addGap(26, 26, 26) .addGroup(jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel17) .addComponent(fname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(33, 33, 33) .addGroup(jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel18) .addComponent(lname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel17Layout.createSequentialGroup() .addGap(46, 46, 46) .addGroup(jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel19) .addComponent(addemplo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(jPanel17Layout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jScrollPane7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel17Layout.createSequentialGroup() .addGap(23, 23, 23) .addComponent(jLabel20)) .addGroup(jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(phone, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel21)) .addComponent(lang, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel22) .addGroup(jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(title, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel23) .addComponent(email, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel17Layout.createSequentialGroup() .addGroup(jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel17Layout.createSequentialGroup() .addGap(24, 24, 24) .addGroup(jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel24) .addComponent(company, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(jPanel17Layout.createSequentialGroup() .addGap(18, 18, 18) .addComponent(jButton15))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton16) .addGap(24, 24, 24)) .addGroup(jPanel17Layout.createSequentialGroup() .addGap(24, 24, 24) .addComponent(jLabel25, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(152, Short.MAX_VALUE)))) ); jTabbedPane5.addTab("Add new Employee", jPanel17); emptable.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {null, null, null, null}, {null, null, null, null}, {null, null, null, null}, {null, null, null, null} }, new String [] { "Title 1", "Title 2", "Title 3", "Title 4" } )); jScrollPane8.setViewportView(emptable); affi.setBackground(new java.awt.Color(255, 255, 255)); affi.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N pho.setText("Get Phone number"); pho.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { phoActionPerformed(evt); } }); emai.setText("Get Email"); emai.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { emaiActionPerformed(evt); } }); javax.swing.GroupLayout jPanel18Layout = new javax.swing.GroupLayout(jPanel18); jPanel18.setLayout(jPanel18Layout); jPanel18Layout.setHorizontalGroup( jPanel18Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel18Layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel18Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jScrollPane8, javax.swing.GroupLayout.PREFERRED_SIZE, 594, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel18Layout.createSequentialGroup() .addGroup(jPanel18Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(emai, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(pho, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(117, 117, 117) .addComponent(affi, javax.swing.GroupLayout.PREFERRED_SIZE, 376, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(92, 92, 92)) ); jPanel18Layout.setVerticalGroup( jPanel18Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel18Layout.createSequentialGroup() .addGap(29, 29, 29) .addComponent(jScrollPane8, javax.swing.GroupLayout.PREFERRED_SIZE, 165, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel18Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel18Layout.createSequentialGroup() .addGap(53, 53, 53) .addComponent(pho)) .addGroup(jPanel18Layout.createSequentialGroup() .addGap(67, 67, 67) .addComponent(affi, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(47, 47, 47) .addComponent(emai) .addContainerGap(186, Short.MAX_VALUE)) ); jTabbedPane5.addTab("Update Employee list", jPanel18); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jTabbedPane5) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jTabbedPane5) ); jTabbedPane1.addTab("Employee", jPanel2); jLabel4.setText("Uploader"); jLabel5.setText("Description"); jLabel6.setText("Link/ Url "); jButton6.setBackground(new java.awt.Color(255, 51, 51)); jButton6.setText("Cancel"); jButton7.setBackground(new java.awt.Color(51, 255, 51)); jButton7.setText("Save"); jTextArea1.setColumns(20); jTextArea1.setRows(5); jScrollPane2.setViewportView(jTextArea1); jButton8.setText("Browse"); jLabel12.setIcon(new javax.swing.ImageIcon(getClass().getResource("/main/logo.jpg"))); // NOI18N jComboBox2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); jLabel16.setText("Expiration date"); jTextField1.setText("jTextField1"); javax.swing.GroupLayout jPanel12Layout = new javax.swing.GroupLayout(jPanel12); jPanel12.setLayout(jPanel12Layout); jPanel12Layout.setHorizontalGroup( jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel12Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel12Layout.createSequentialGroup() .addComponent(jButton6) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 201, Short.MAX_VALUE) .addComponent(jLabel12) .addGap(148, 148, 148) .addComponent(jButton7, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()) .addGroup(jPanel12Layout.createSequentialGroup() .addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel12Layout.createSequentialGroup() .addComponent(jLabel16) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jTextField1)) .addComponent(jButton8, javax.swing.GroupLayout.PREFERRED_SIZE, 152, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel12Layout.createSequentialGroup() .addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel4) .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel6)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jTextField4) .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 492, Short.MAX_VALUE) .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, 206, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addGap(8, 136, Short.MAX_VALUE)))) ); jPanel12Layout.setVerticalGroup( jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel12Layout.createSequentialGroup() .addGap(45, 45, 45) .addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel4) .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(26, 26, 26) .addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel5) .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(21, 21, 21) .addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel16)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 72, Short.MAX_VALUE) .addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel6) .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel12Layout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jButton8) .addGap(30, 30, 30) .addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton6) .addComponent(jButton7))) .addGroup(jPanel12Layout.createSequentialGroup() .addGap(47, 47, 47) .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap()) ); javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10); jPanel10.setLayout(jPanel10Layout); jPanel10Layout.setHorizontalGroup( jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel10Layout.createSequentialGroup() .addComponent(jPanel12, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap()) ); jPanel10Layout.setVerticalGroup( jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel10Layout.createSequentialGroup() .addComponent(jPanel12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)) ); jTabbedPane4.addTab("Add new Training Materials", jPanel10); jTable2.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {null, null, null}, {null, null, null}, {null, null, null}, {null, null, null} }, new String [] { "Name", "Description", "Link" } )); jScrollPane3.setViewportView(jTable2); jTextField5.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField5ActionPerformed(evt); } }); jTextArea2.setColumns(20); jTextArea2.setRows(5); jScrollPane4.setViewportView(jTextArea2); jButton9.setText("Browse"); jButton10.setBackground(new java.awt.Color(255, 255, 51)); jButton10.setText("Update"); jButton11.setBackground(new java.awt.Color(255, 204, 204)); jButton11.setText("Delete"); jLabel15.setIcon(new javax.swing.ImageIcon(getClass().getResource("/main/logo.jpg"))); // NOI18N javax.swing.GroupLayout jPanel13Layout = new javax.swing.GroupLayout(jPanel13); jPanel13.setLayout(jPanel13Layout); jPanel13Layout.setHorizontalGroup( jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel13Layout.createSequentialGroup() .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel13Layout.createSequentialGroup() .addGap(141, 141, 141) .addComponent(jLabel15))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jTextField5) .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 218, Short.MAX_VALUE) .addComponent(jTextField6)) .addComponent(jButton9)) .addGroup(jPanel13Layout.createSequentialGroup() .addComponent(jButton10, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 44, Short.MAX_VALUE) .addComponent(jButton11))) .addGap(0, 80, Short.MAX_VALUE)) ); jPanel13Layout.setVerticalGroup( jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel13Layout.createSequentialGroup() .addContainerGap() .addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 182, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(29, 29, 29) .addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(31, 31, 31) .addComponent(jButton9) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton10) .addComponent(jButton11)) .addGap(79, 79, 79)) .addGroup(jPanel13Layout.createSequentialGroup() .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 360, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(27, 27, 27) .addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 31, Short.MAX_VALUE)) ); javax.swing.GroupLayout jPanel11Layout = new javax.swing.GroupLayout(jPanel11); jPanel11.setLayout(jPanel11Layout); jPanel11Layout.setHorizontalGroup( jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel13, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); jPanel11Layout.setVerticalGroup( jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel11Layout.createSequentialGroup() .addComponent(jPanel13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)) ); jTabbedPane4.addTab("Update/retire Training materials", jPanel11); javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3Layout.setHorizontalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jTabbedPane4) ); jPanel3Layout.setVerticalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addComponent(jTabbedPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 511, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)) ); jTabbedPane1.addTab("Training materials", jPanel3); jTabbedPane3.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jTabbedPane3MouseClicked(evt); } }); jLabel1.setText("Incident Date"); jLabel7.setText("Incidents Description"); incides.setColumns(20); incides.setRows(5); jScrollPane5.setViewportView(incides); jLabel8.setText("Employees involved "); jButton12.setBackground(new java.awt.Color(255, 51, 51)); jButton12.setText("Cancel"); jButton12.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton12ActionPerformed(evt); } }); saveincidents.setBackground(new java.awt.Color(51, 255, 51)); saveincidents.setText("Save"); saveincidents.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { saveincidentsActionPerformed(evt); } }); empshow.setFont(new java.awt.Font("Vivaldi", 0, 36)); // NOI18N empshow.setText("list of employee"); empshow.setBorder(new javax.swing.border.MatteBorder(null)); jLabel13.setIcon(new javax.swing.ImageIcon(getClass().getResource("/main/logo.jpg"))); // NOI18N addempincident.setText("Add"); addempincident.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { addempincidentActionPerformed(evt); } }); javax.swing.GroupLayout jPanel16Layout = new javax.swing.GroupLayout(jPanel16); jPanel16.setLayout(jPanel16Layout); jPanel16Layout.setHorizontalGroup( jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel16Layout.createSequentialGroup() .addGap(45, 45, 45) .addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel16Layout.createSequentialGroup() .addComponent(jButton12) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 188, Short.MAX_VALUE) .addComponent(jLabel13) .addGap(123, 123, 123) .addComponent(saveincidents) .addGap(87, 87, 87)) .addGroup(jPanel16Layout.createSequentialGroup() .addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(empshow, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel16Layout.createSequentialGroup() .addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel1) .addComponent(jLabel7) .addComponent(jLabel8)) .addGap(24, 24, 24) .addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(incidate) .addComponent(jScrollPane5, javax.swing.GroupLayout.DEFAULT_SIZE, 326, Short.MAX_VALUE) .addComponent(incidentC, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) .addGap(18, 18, 18) .addComponent(addempincident) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) ); jPanel16Layout.setVerticalGroup( jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel16Layout.createSequentialGroup() .addGap(22, 22, 22) .addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1) .addComponent(incidate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel7) .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 179, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel8) .addComponent(incidentC, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(addempincident)) .addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel16Layout.createSequentialGroup() .addGap(27, 27, 27) .addComponent(empshow, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(jPanel16Layout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel16Layout.createSequentialGroup() .addGap(41, 41, 41) .addComponent(jButton12, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addContainerGap()) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel16Layout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(saveincidents, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)))) ); javax.swing.GroupLayout jPanel14Layout = new javax.swing.GroupLayout(jPanel14); jPanel14.setLayout(jPanel14Layout); jPanel14Layout.setHorizontalGroup( jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel16, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); jPanel14Layout.setVerticalGroup( jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel14Layout.createSequentialGroup() .addComponent(jPanel16, javax.swing.GroupLayout.PREFERRED_SIZE, 443, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)) ); jTabbedPane3.addTab("Add new Incident", jPanel14); inciT.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {null, null, null}, {null, null, null}, {null, null, null}, {null, null, null} }, new String [] { "Name", "Description", "Employee Involved" } )); jScrollPane6.setViewportView(inciT); jButton14.setText("Print Report"); jButton14.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton14ActionPerformed(evt); } }); javax.swing.GroupLayout jPanel15Layout = new javax.swing.GroupLayout(jPanel15); jPanel15.setLayout(jPanel15Layout); jPanel15Layout.setHorizontalGroup( jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel15Layout.createSequentialGroup() .addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(70, 70, 70) .addComponent(jButton14, javax.swing.GroupLayout.DEFAULT_SIZE, 228, Short.MAX_VALUE) .addContainerGap()) ); jPanel15Layout.setVerticalGroup( jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel15Layout.createSequentialGroup() .addContainerGap(122, Short.MAX_VALUE) .addGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel15Layout.createSequentialGroup() .addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel15Layout.createSequentialGroup() .addComponent(jButton14, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(112, 112, 112)))) ); jTabbedPane3.addTab("View incidents", jPanel15); javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); jPanel4.setLayout(jPanel4Layout); jPanel4Layout.setHorizontalGroup( jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jTabbedPane3) ); jPanel4Layout.setVerticalGroup( jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jTabbedPane3) ); jTabbedPane1.addTab("Incidents", jPanel4); javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5); jPanel5.setLayout(jPanel5Layout); jPanel5Layout.setHorizontalGroup( jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 770, Short.MAX_VALUE) ); jPanel5Layout.setVerticalGroup( jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 609, Short.MAX_VALUE) ); jTabbedPane1.addTab("Reports", jPanel5); jLabel14.setIcon(new javax.swing.ImageIcon(getClass().getResource("/main/logo.jpg"))); // NOI18N javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6); jPanel6.setLayout(jPanel6Layout); jPanel6Layout.setHorizontalGroup( jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel6Layout.createSequentialGroup() .addGap(269, 269, 269) .addComponent(jLabel14) .addContainerGap(323, Short.MAX_VALUE)) ); jPanel6Layout.setVerticalGroup( jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup() .addContainerGap(492, Short.MAX_VALUE) .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(30, 30, 30)) ); jTabbedPane1.addTab("About", jPanel6); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jTabbedPane1) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jTabbedPane1) ); pack(); }// </editor-fold>//GEN-END:initComponents private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed // TODO add your handling code here: userN.setText(null); userP.setText(null); }//GEN-LAST:event_jButton1ActionPerformed private void jTextField5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField5ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jTextField5ActionPerformed private void jButton14ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton14ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jButton14ActionPerformed private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed // TODO add your handling code here: String name=userN.getText(); char [] pass= userP.getPassword(); String password=""; for(int i=0; i< pass.length; i++){ password=password+pass[i]; } if(name != null && password !=null){ String query; query = "insert into login values(null,'"+ name +"','" + password +"')"; insert(query); } else{ JOptionPane.showMessageDialog(null,"those fields can't be empty"); } System.out.println("ok"); }//GEN-LAST:event_jButton2ActionPerformed private void jButton15ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton15ActionPerformed String name= fname.getText(); String llname= lname.getText(); int address= 1234; String tel= phone.getText(); // int languu= (Integer) addemplo.getSelectedItem(); String ti= title.getText(); String em= email.getText(); // int comp= (int)company.getSelectedItem(); int comp=2; String q="insert into employee values (null, '" + fname.getText() + "', '" + lname.getText() + "'," + " 2, '"+ phone.getText()+"', '"+phone.getText()+"', '"+title.getText()+ "', 1, 1)"; try { con = MyConnection.getConnection(); con.getStatement().executeUpdate(q); } catch (SQLException ex) { Logger.getLogger(visible01.class.getName()).log(Level.SEVERE, null, ex); } }//GEN-LAST:event_jButton15ActionPerformed private void jTabbedPane2KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTabbedPane2KeyPressed // TODO add your handling code here: String q="select login , pass from login"; String[] tete = {"login", "password"}; rempliremp(q,loginT,tete); }//GEN-LAST:event_jTabbedPane2KeyPressed private void jTabbedPane2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTabbedPane2MouseClicked String q="select login , pass from login"; String[] tete = {"login", "password"}; rempliremp(q,loginT,tete); // TODO add your handling code here: }//GEN-LAST:event_jTabbedPane2MouseClicked private void deleteLoginActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteLoginActionPerformed int ligne = loginT.getSelectedRow(); String q = "delete from login where login ='" + loginT.getValueAt(ligne, 0).toString() + "'"; String q1="select login , pass from login"; String[] tete = {"login", "password"}; supprimer( q,loginT,q1,ligne,tete); }//GEN-LAST:event_deleteLoginActionPerformed private void loginTMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_loginTMouseClicked // TODO add your handling code here: int ligne = loginT.getSelectedRow(); t1.setText(loginT.getValueAt(ligne, 0).toString()); t2.setText(loginT.getValueAt(ligne, 1).toString()); }//GEN-LAST:event_loginTMouseClicked private void updateloginActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_updateloginActionPerformed // TODO add your handling code here: int ligne = loginT.getSelectedRow(); String bb=Arrays.toString(t2.getPassword()); String pp=loginT.getValueAt(ligne, 1).toString(); String q="update login set login='"+ t1.getText()+ "', pass ='"+ bb +"' where pass='"+ pp +"'"; insert(q); String[] tete = {"login", "password"}; rempliremp(q,loginT,tete); System.out.println("done"); }//GEN-LAST:event_updateloginActionPerformed private void jTabbedPane5MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTabbedPane5MouseClicked // TODO add your handling code here: String q="select first_name, last_name,phone,email from employee"; String [] te={"Fisrt Name","Last name","phone","email"}; rempliremp(q,emptable,te ); }//GEN-LAST:event_jTabbedPane5MouseClicked private void phoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_phoActionPerformed // TODO add your handling code here: int ligne = emptable.getSelectedRow(); affi.setText(emptable.getValueAt(ligne, 2).toString()); }//GEN-LAST:event_phoActionPerformed private void emaiActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_emaiActionPerformed // TODO add your handling code here: int ligne = emptable.getSelectedRow(); affi.setText(emptable.getValueAt(ligne, 3).toString()); }//GEN-LAST:event_emaiActionPerformed private void addempincidentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addempincidentActionPerformed // TODO add your handling code here: empAdd= empAdd+ (String) incidentC.getSelectedItem() +" , "; empshow.setText(empAdd); }//GEN-LAST:event_addempincidentActionPerformed private void jButton12ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton12ActionPerformed empshow.setText(""); empAdd=""; // TODO add your handling code here: }//GEN-LAST:event_jButton12ActionPerformed private void dateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dateActionPerformed // TODO add your handling code here: }//GEN-LAST:event_dateActionPerformed private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed date.setText(""); des.setText(""); // TODO add your handling code here: }//GEN-LAST:event_jButton5ActionPerformed private void jTabbedPane6MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTabbedPane6MouseClicked // TODO add your handling code here: String query="select date, description, duration,foreman_id, location_id from meeting"; String [] tete={"Date", "Description", "Duration", "Foreman", "Location"}; rempliremp(query, mettings,tete); }//GEN-LAST:event_jTabbedPane6MouseClicked private void saveincidentsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveincidentsActionPerformed // TODO add your handling code here: // String query = "insert into incident values (null,'"+incidate.getText()+"','"+incides.getText()+"','"+empAdd+"')"; String one= incidate.getText(); String two =incides.getText(); if( one != null && two != null){ String query = "insert into incident values (null,'"+incidate.getText()+"','"+incides.getText()+"','"+empAdd+"')"; insert(query); System.out.println("ok"); } else{ JOptionPane.showMessageDialog(null,"those fields can't be empty"); } }//GEN-LAST:event_saveincidentsActionPerformed private void jTabbedPane3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTabbedPane3MouseClicked // TODO add your handling code here: String query= "select name, date, employee from incident"; String [] tete= {"Date","Description", "Employee"}; rempliremp(query,inciT,tete); }//GEN-LAST:event_jTabbedPane3MouseClicked private void addemploMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_addemploMouseReleased // TODO add your handling code here: String l=(String) addemplo.getSelectedItem(); String query="select street, number from address where id= "+ l +""; String address =""; int nbcol; try { con = MyConnection.getConnection(); con.getStatement().executeQuery(query); ResultSet rst; rst = con.getStatement().getResultSet(); rstmeta = (ResultSetMetaData) rst.getMetaData(); nbcol = rstmeta.getColumnCount(); int i = 0; rst.beforeFirst(); while (rst.next()) { for (i = 1; i <= nbcol; i++) { address =address+ " "+(String) rst.getObject(i).toString(); } } } catch (SQLException ex) { Logger.getLogger(visible01.class.getName()).log(Level.SEVERE, null, ex); } add.setText(address); }//GEN-LAST:event_addemploMouseReleased /** * @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(visible01.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(visible01.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(visible01.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(visible01.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 visible01().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JTextArea add; private javax.swing.JButton addempincident; private javax.swing.JComboBox addemplo; private javax.swing.JLabel affi; private javax.swing.JComboBox company; private javax.swing.JTextField date; private javax.swing.JButton deleteLogin; private javax.swing.JTextArea des; private javax.swing.JButton emai; private javax.swing.JTextField email; private javax.swing.JLabel empshow; private javax.swing.JTable emptable; private javax.swing.JTextField fname; private javax.swing.JComboBox foreman; private javax.swing.JTable inciT; private javax.swing.JTextField incidate; private javax.swing.JComboBox incidentC; private javax.swing.JTextArea incides; private javax.swing.JButton jButton1; private javax.swing.JButton jButton10; private javax.swing.JButton jButton11; private javax.swing.JButton jButton12; private javax.swing.JButton jButton14; private javax.swing.JButton jButton15; private javax.swing.JButton jButton16; private javax.swing.JButton jButton2; private javax.swing.JButton jButton3; private javax.swing.JButton jButton4; private javax.swing.JButton jButton5; private javax.swing.JButton jButton6; private javax.swing.JButton jButton7; private javax.swing.JButton jButton8; private javax.swing.JButton jButton9; private javax.swing.JComboBox jComboBox1; private javax.swing.JComboBox jComboBox2; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel11; private javax.swing.JLabel jLabel12; private javax.swing.JLabel jLabel13; private javax.swing.JLabel jLabel14; private javax.swing.JLabel jLabel15; private javax.swing.JLabel jLabel16; private javax.swing.JLabel jLabel17; private javax.swing.JLabel jLabel18; private javax.swing.JLabel jLabel19; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel20; private javax.swing.JLabel jLabel21; private javax.swing.JLabel jLabel22; private javax.swing.JLabel jLabel23; private javax.swing.JLabel jLabel24; private javax.swing.JLabel jLabel25; private javax.swing.JLabel jLabel26; private javax.swing.JLabel jLabel27; private javax.swing.JLabel jLabel28; private javax.swing.JLabel jLabel29; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel30; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JLabel jLabel9; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel10; private javax.swing.JPanel jPanel11; private javax.swing.JPanel jPanel12; private javax.swing.JPanel jPanel13; private javax.swing.JPanel jPanel14; private javax.swing.JPanel jPanel15; private javax.swing.JPanel jPanel16; private javax.swing.JPanel jPanel17; private javax.swing.JPanel jPanel18; private javax.swing.JPanel jPanel19; private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel20; private javax.swing.JPanel jPanel3; private javax.swing.JPanel jPanel4; private javax.swing.JPanel jPanel5; private javax.swing.JPanel jPanel6; private javax.swing.JPanel jPanel7; private javax.swing.JPanel jPanel8; private javax.swing.JPanel jPanel9; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JScrollPane jScrollPane10; private javax.swing.JScrollPane jScrollPane2; private javax.swing.JScrollPane jScrollPane3; private javax.swing.JScrollPane jScrollPane4; private javax.swing.JScrollPane jScrollPane5; private javax.swing.JScrollPane jScrollPane6; private javax.swing.JScrollPane jScrollPane7; private javax.swing.JScrollPane jScrollPane8; private javax.swing.JScrollPane jScrollPane9; private javax.swing.JTabbedPane jTabbedPane1; private javax.swing.JTabbedPane jTabbedPane2; private javax.swing.JTabbedPane jTabbedPane3; private javax.swing.JTabbedPane jTabbedPane4; private javax.swing.JTabbedPane jTabbedPane5; private javax.swing.JTabbedPane jTabbedPane6; private javax.swing.JTable jTable2; private javax.swing.JTextArea jTextArea1; private javax.swing.JTextArea jTextArea2; private javax.swing.JTextField jTextField1; private javax.swing.JTextField jTextField4; private javax.swing.JTextField jTextField5; private javax.swing.JTextField jTextField6; private javax.swing.JComboBox lang; private javax.swing.JTextField lname; private javax.swing.JComboBox loc; private javax.swing.JTable loginT; private javax.swing.JTable mettings; private javax.swing.JButton pho; private javax.swing.JTextField phone; private javax.swing.JButton saveincidents; private javax.swing.JTextField t1; private javax.swing.JPasswordField t2; private javax.swing.JTextField title; private javax.swing.JButton updatelogin; private javax.swing.JTextField userN; private javax.swing.JPasswordField userP; // End of variables declaration//GEN-END:variables }
[ "Kokou.Kingbede@mail.nidec.com" ]
Kokou.Kingbede@mail.nidec.com
ae9317409810a6a102696336ed909c88acbab95c
f051ee9d89950383a842a6e2094083f6b4b8b316
/Lecture/Java/Work/javaApplication/src/main/java/java11/st3/BoxTest.java
9d1df40ddda8aa3b509e5f3ec5db9d680ba4a1f6
[]
no_license
BBongR/workspace
6d3b5c5a05bee75c031a80b971c859b6749e541e
2f020cd7809e28a2cae0199cac59375d407f58cf
refs/heads/master
2021-09-13T14:49:51.825677
2018-02-07T09:18:40
2018-02-07T09:18:40
106,399,804
0
0
null
null
null
null
UTF-8
Java
false
false
333
java
package java11.st3; public class BoxTest { public static void main(String[] args) { //int tmp; // Box 인스턴스를 생성하시오 Box tmp = new Box(); // width, length, height tmp.setWidth(100); tmp.setLength(100); tmp.setHeight(100); // 부피를 계산하고 출력하시오 tmp.printVolumn(); } }
[ "suv1214@naver.com" ]
suv1214@naver.com
b5fa0d1ce283c5b2decdea17f0d136494818f16f
19067de7fc119d21a7ffdf1738684bedd6b5e535
/lib_qrcodescanner/src/main/java/co/tton/android/lib/qrcodescanner/decoding/Intents.java
08cf4c0b855d5a37351d36b1d01ab5a421d27343
[]
no_license
MonkeyEatBanana/base
dfb95598b1033a75b7dde00c902487f760d51840
2ef9adbbed96ed1dfea35b6f142b8bd608d72784
refs/heads/master
2020-03-10T17:06:58.943282
2018-04-14T07:58:31
2018-04-14T07:58:31
129,491,974
0
0
null
null
null
null
UTF-8
Java
false
false
6,685
java
/* * Copyright (C) 2008 ZXing authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package co.tton.android.lib.qrcodescanner.decoding; /** * This class provides the constants to use when sending an Intent to Barcode Scanner. * These strings are effectively API and cannot be changed. */ public final class Intents { private Intents() { } public static final class Scan { /** * Send this intent to open the Barcodes app in scanning mode, find a barcode, and return * the results. */ public static final String ACTION = "com.google.zxing.client.android.SCAN"; /** * By default, sending Scan.ACTION will decode all barcodes that we understand. However it * may be useful to limit scanning to certain formats. Use Intent.putExtra(MODE, value) with * one of the values below ({@link #PRODUCT_MODE}, {@link #ONE_D_MODE}, {@link #QR_CODE_MODE}). * Optional. * <p> * Setting this is effectively shorthnad for setting explicit formats with {@link #SCAN_FORMATS}. * It is overridden by that setting. */ public static final String MODE = "SCAN_MODE"; /** * Comma-separated list of formats to scan for. The values must match the names of * {@link com.google.zxing.BarcodeFormat}s, such as {@link com.google.zxing.BarcodeFormat#EAN_13}. * Example: "EAN_13,EAN_8,QR_CODE" * <p> * This overrides {@link #MODE}. */ public static final String SCAN_FORMATS = "SCAN_FORMATS"; /** * @see com.google.zxing.DecodeHintType#CHARACTER_SET */ public static final String CHARACTER_SET = "CHARACTER_SET"; /** * Decode only UPC and EAN barcodes. This is the right choice for shopping apps which get * prices, reviews, etc. for products. */ public static final String PRODUCT_MODE = "PRODUCT_MODE"; /** * Decode only 1D barcodes (currently UPC, EAN, Code 39, and Code 128). */ public static final String ONE_D_MODE = "ONE_D_MODE"; /** * Decode only QR codes. */ public static final String QR_CODE_MODE = "QR_CODE_MODE"; /** * Decode only Data Matrix codes. */ public static final String DATA_MATRIX_MODE = "DATA_MATRIX_MODE"; /** * If a barcode is found, Barcodes returns RESULT_OK to onActivityResult() of the app which * requested the scan via startSubActivity(). The barcodes contents can be retrieved with * intent.getStringExtra(RESULT). If the user presses Back, the result code will be * RESULT_CANCELED. */ public static final String RESULT = "SCAN_RESULT"; /** * Call intent.getStringExtra(RESULT_FORMAT) to determine which barcode format was found. * See Contents.Format for possible values. */ public static final String RESULT_FORMAT = "SCAN_RESULT_FORMAT"; /** * Setting this to false will not save scanned codes in the history. */ public static final String SAVE_HISTORY = "SAVE_HISTORY"; private Scan() { } } public static final class Encode { /** * Send this intent to encode a piece of data as a QR code and display it full screen, so * that another person can scan the barcode from your screen. */ public static final String ACTION = "com.google.zxing.client.android.ENCODE"; /** * The data to encode. Use Intent.putExtra(DATA, data) where data is either a String or a * Bundle, depending on the type and format specified. Non-QR Code formats should * just use a String here. For QR Code, see Contents for details. */ public static final String DATA = "ENCODE_DATA"; /** * The type of data being supplied if the format is QR Code. Use * Intent.putExtra(TYPE, type) with one of Contents.Type. */ public static final String TYPE = "ENCODE_TYPE"; /** * The barcode format to be displayed. If this isn't specified or is blank, * it defaults to QR Code. Use Intent.putExtra(FORMAT, format), where * format is one of Contents.Format. */ public static final String FORMAT = "ENCODE_FORMAT"; private Encode() { } } public static final class SearchBookContents { /** * Use Google Book Search to search the contents of the book provided. */ public static final String ACTION = "com.google.zxing.client.android.SEARCH_BOOK_CONTENTS"; /** * The book to search, identified by ISBN number. */ public static final String ISBN = "ISBN"; /** * An optional field which is the text to search for. */ public static final String QUERY = "QUERY"; private SearchBookContents() { } } public static final class WifiConnect { /** * Internal intent used to trigger connection to a wi-fi network. */ public static final String ACTION = "com.google.zxing.client.android.WIFI_CONNECT"; /** * The network to connect to, all the configuration provided here. */ public static final String SSID = "SSID"; /** * The network to connect to, all the configuration provided here. */ public static final String TYPE = "TYPE"; /** * The network to connect to, all the configuration provided here. */ public static final String PASSWORD = "PASSWORD"; private WifiConnect() { } } public static final class Share { /** * Give the user a choice of items to encode as a barcode, then render it as a QR Code and * display onscreen for a friend to scan with their phone. */ public static final String ACTION = "com.google.zxing.client.android.SHARE"; private Share() { } } }
[ "kaili@promote.cache-dns.local" ]
kaili@promote.cache-dns.local
2b9f17a2b1b96a683018a3e8aca40eefa32a9cd2
801656b393399a1ffd1a6d4b9c90a6660192e1e5
/app/src/main/java/com/app/prashant/monolith/articleObject/Thumbnail.java
12e8462691ab91a218abf80fb31caebfd96f0ae0
[ "Apache-2.0" ]
permissive
prshntpnwr/Monolith
dd753b0991add2c4736187120809692367de45d7
e95a4b9f1416ad1d0135232447bc27de49961039
refs/heads/master
2021-01-17T07:54:07.306514
2019-01-12T17:51:17
2019-01-12T17:51:17
83,812,990
2
0
null
null
null
null
UTF-8
Java
false
false
858
java
package com.app.prashant.monolith.articleObject; import org.simpleframework.xml.Attribute; import org.simpleframework.xml.Root; @Root(strict = false) public class Thumbnail { @Attribute private String height; @Attribute private String width; @Attribute private String url; public String getHeight() { return height; } public void setHeight(String height) { this.height = height; } public String getWidth() { return width; } public void setWidth(String width) { this.width = width; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } @Override public String toString() { return "ClassPojo [height = " + height + ", width = " + width + ", url = " + url + "]"; } }
[ "prashant.panwar777@gmail.com" ]
prashant.panwar777@gmail.com
c07f83858ef28b1423b7f748af4dc82385da8287
e0a276dc26a9b4b27fe38cea7c701a35a6ef2313
/Util/src/main/java/com/ak/rsm/medium/Layer1Medium.java
489ceca907c1c0d614f81da15df1e77002f00b77
[]
no_license
ak-git/DesktopFX
825914f1d0e8db0ced1b525c23e2ba9e00d83764
320f545568edeb0c549e9f9848ddf06ceb39a216
refs/heads/master
2023-08-22T19:55:30.803074
2023-08-12T10:34:22
2023-08-12T10:34:22
174,195,325
1
1
null
2020-02-19T06:25:50
2019-03-06T18:06:41
Java
UTF-8
Java
false
false
1,125
java
package com.ak.rsm.medium; import com.ak.math.ValuePair; import com.ak.rsm.measurement.Measurement; import com.ak.rsm.prediction.Prediction; import com.ak.rsm.prediction.Predictions; import com.ak.util.Strings; import javax.annotation.Nonnull; import java.util.Collection; import java.util.stream.Collectors; public final class Layer1Medium extends AbstractMediumLayers { @Nonnull private final ValuePair rho; public Layer1Medium(@Nonnull Collection<? extends Measurement> measurements) { super(measurements); Measurement average = Measurement.average(measurements); rho = ValuePair.Name.RHO.of(average.resistivity(), average.resistivity() * average.inexact().getApparentRelativeError()); } @Override public ValuePair rho() { return rho; } @Override public String toString() { return "%s; %s %n%s" .formatted(rho, toStringRMS(), measurements().stream().map(Object::toString).collect(Collectors.joining(Strings.NEW_LINE))); } @Override @Nonnull public Prediction apply(@Nonnull Measurement measurement) { return Predictions.of(measurement, rho.value()); } }
[ "ak.mail.ru@gmail.com" ]
ak.mail.ru@gmail.com
c770a03355083a720cb784987e4eed61e17900a0
d912f3ccca96560bca4977ac0b614d2c6a76e035
/src/main/java/com/alconn/copang/search/SearchService.java
2117600031ce89b9c6213c4e896fa02db90bbaf4
[]
no_license
yunjs24/copang-backend
864401645e95a5ec3a9b9b59d006a497002f89da
709eb2fbaafd2380295776892f15e2b808f96814
refs/heads/master
2023-06-17T04:02:19.740239
2021-07-14T02:06:36
2021-07-14T02:06:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,064
java
package com.alconn.copang.search; import com.alconn.copang.item.ItemDetail; import com.alconn.copang.item.ItemQueryRepository; import com.alconn.copang.item.dto.ItemDetailForm; import com.alconn.copang.item.dto.ItemDetailForm.MainForm; import com.alconn.copang.item.dto.ItemForm; import com.alconn.copang.item.dto.ItemViewForm; import com.alconn.copang.item.dto.ItemViewForm.MainViewForm; import com.alconn.copang.item.mapper.ItemMapper; import java.util.List; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Transactional(readOnly = true) @Service @RequiredArgsConstructor public class SearchService { private final ItemQueryRepository itemQueryRepository; private final ItemMapper itemMapper; public List<ItemForm.ItemSingle> searchByKeyword(String keyword) { return null; } public ItemViewForm.MainViewForm search(ItemSearchCondition condition) { return itemQueryRepository.search(condition, itemMapper); } }
[ "noreply@github.com" ]
noreply@github.com
cf86618dc3856bc05a5efbf22ee372719937cf82
978dd3351a701b5f1ea7f07746b97f5c5cfda1d3
/SwingCalendar.java
487481152bbac2fd3bd958c96230b4eeb90aff51
[]
no_license
KimGumin/security119
25ea1e75219e0e981d0a472bb230822eaa4f57d4
44f941749fcd21dbb8e055ca4402f96bff14719c
refs/heads/master
2021-07-08T12:49:12.388106
2020-11-20T13:21:32
2020-11-20T13:21:32
209,511,907
0
0
null
null
null
null
UTF-8
Java
false
false
14,208
java
import java.awt.*; import java.awt.event.*; import java.io.*; import javax.swing.*; import javax.swing.border.*; import java.util.*; public class SwingCalendar extends JFrame { Calendar today = Calendar.getInstance(); Calendar lastca = Calendar.getInstance(); Calendar ca = Calendar.getInstance(); Calendar cal = Calendar.getInstance(); MyP1 myp1; MyP2 myp2; MyP3 myp3; int dayIndex; // 요일 int lastDay; // 달마다 다른 날짜 수 int y, m; int DayOfMon = today.get(Calendar.DAY_OF_MONTH); int j = 0; int n = DayOfMon; String s = ""; JLabel memoLabel = new JLabel(); SwingCalendar() { setTitle("Calendar"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container c = getContentPane(); myp2 = new MyP2(); myp3 = new MyP3(); myp1 = new MyP1(); myp1.settingJFrame.setPanelColor(Color.lightGray); myp1.settingJFrame.setArrowColor(Color.white, Color.black); myp1.settingJFrame.setFuncColor(Color.white, Color.black); myp1.settingJFrame.setTextColor(Color.black); myp1.settingJFrame.setDayColor(Color.orange, Color.black, 3, Color.black); myp1.settingJFrame.setDateColor(Color.white, Color.gray); c.add(myp2, BorderLayout.CENTER); c.add(myp1, BorderLayout.NORTH); c.add(myp3, BorderLayout.SOUTH); setSize(500, 500); setResizable(false); setVisible(true); } class MyP1 extends JPanel { JButton t; JButton left, right;// 좌우 화살표 버튼 JButton gotoday;// Today JButton settingBtn;// 설정버튼 (테마) SettingJFrame settingJFrame; Color datetextColor;// 달력의 일 버튼들의 텍스트 색상 Color dateColor;// 이번달 일 버튼의 색상 Color nondateColor;// 이번달 일이 아닌 버튼들의 색상 MyP1() { dateColor = Color.white; nondateColor = Color.GRAY; datetextColor = Color.black; setLayout(new FlowLayout()); setBackground(Color.LIGHT_GRAY); left = new JButton("◀"); right = new JButton("▶"); gotoday = new JButton("Today"); t = new JButton(""); settingBtn = new JButton("설정"); settingJFrame = new SettingJFrame(); setDays(ca); t.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String mydate = JOptionPane.showInputDialog("년/월을 공백없이 입력하세요"); y = Integer.parseInt(mydate.substring(0, 4)); System.out.println(y); m = Integer.parseInt(mydate.substring(4)) - 1; System.out.println(m); ca.set(y, m, ca.get(Calendar.DAY_OF_WEEK)); setDays(ca); } }); left.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (m >= 1) { lastca.setTime(ca.getTime()); System.out.println(lastca); m = m - 1; ca.set(y, m, 1); setDays(ca); } else { lastca.setTime(ca.getTime()); System.out.println(lastca); y = y - 1; m = 11; ca.set(y, m, 1); setDays(ca); } } }); right.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (m < 11) { lastca.setTime(ca.getTime()); System.out.println(lastca); m = m + 1; ca.set(y, m, 1); setDays(ca); } else { lastca.setTime(ca.getTime()); System.out.println(lastca); y = y + 1; m = 0; ca.set(y, m, 1); setDays(ca); } } }); gotoday.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { lastca.setTime(ca.getTime()); System.out.println(lastca); y = today.get(Calendar.YEAR); m = today.get(Calendar.MONTH); ca.set(y, m, DayOfMon); setDays(ca); } }); settingBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (settingJFrame == null) { settingJFrame = new SettingJFrame(); } settingJFrame.setVisible(true); } }); add(settingBtn); add(left); add(t); add(right); add(gotoday); } class SettingJFrame extends JFrame { JButton defaultTh; JButton blackTh; JButton blueTh; JButton pinkTh; SettingJFrame() { setTitle("테마설정"); setLayout(new FlowLayout()); makeGUI(); setResizable(false); setSize(200, 120); } public void makeGUI() { defaultTh = new JButton("기본"); defaultTh.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setPanelColor(Color.lightGray); setArrowColor(Color.white, Color.black); setFuncColor(Color.white, Color.BLACK); setTextColor(Color.black); setDayColor(Color.orange, Color.black, 3, Color.black); setDateColor(Color.white, Color.gray); } }); blackTh = new JButton("Black"); blackTh.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setPanelColor(Color.black); setArrowColor(Color.white, Color.black); setFuncColor(Color.white, Color.BLACK); setTextColor(Color.white); setDayColor(Color.white, Color.white, 0, Color.black); setDateColor(Color.black, Color.gray); } }); blueTh = new JButton("Blue"); blueTh.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setPanelColor(new Color(102, 115, 255)); setArrowColor(Color.white, Color.black); setFuncColor(Color.white, Color.BLACK); setTextColor(Color.white); setDayColor(Color.white, Color.white, 0, Color.black); setDateColor(new Color(75, 89, 242), Color.gray); } }); pinkTh = new JButton("Pink"); pinkTh.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setPanelColor(new Color(251, 208, 217)); setArrowColor(Color.white, Color.black); setFuncColor(Color.white, Color.black); setTextColor(Color.white); setDayColor(Color.white, Color.white, 0, Color.black); setDateColor(Color.pink, Color.gray); } }); add(defaultTh); add(blackTh); add(blueTh); add(pinkTh); } public void setPanelColor(Color c) { myp1.setBackground(c); myp2.setBackground(c); myp3.setBackground(c); } public void setDayColor(Color back, Color border, int thick, Color text) { for (int i = 0; i < myp2.l_day.length; i++) { myp2.l_day[i].setBackground(back); myp2.l_day[i].setBorder(new LineBorder(border, thick)); } for (int i = 1; i <= 5; i++) { myp2.l_day[i].setForeground(text); } } public void setDateColor(Color c1, Color c2) { myp1.dateColor = c1; myp1.nondateColor = c2; myp1.setDays(ca); } public void setArrowColor(Color back, Color text) { myp1.left.setBackground(back); myp1.right.setBackground(back); myp1.left.setForeground(text); myp1.right.setForeground(text); } public void setFuncColor(Color back, Color text) { myp1.settingBtn.setBackground(back); myp1.gotoday.setBackground(back); myp1.t.setBackground(back); myp3.clearBut.setBackground(back); myp3.delBut.setBackground(back); myp3.saveBut.setBackground(back); myp1.settingBtn.setForeground(text); myp1.gotoday.setForeground(text); myp1.t.setForeground(text); myp3.clearBut.setForeground(text); myp3.delBut.setForeground(text); myp3.saveBut.setForeground(text); } public void setTextColor(Color c) { myp1.datetextColor = c; memoLabel.setForeground(c); } } public void setDays(Calendar inputca) { y = inputca.get(Calendar.YEAR); m = inputca.get(Calendar.MONTH); t.setText(" " + y + "년 " + (m + 1) + "월" + " ");// t버튼 재설정 cal.set(y, m, 1); // 입력월의 초일로 날짜 셋팅 n = cal.get(Calendar.DAY_OF_WEEK);// n=1~7(일~토) JButton[] b_date = myp2.b_date; JTextArea memoArea = myp3.memoArea; for (int i = n - 1; i < cal.getActualMaximum(Calendar.DAY_OF_MONTH) + n - 1; i++) { int j = i; if (b_date[j].getActionListeners().length == 0) {// 이미 action리스너를 달아뒀다면 또 추가하지않는다 b_date[j].addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { DayOfMon = j - n + 2; System.out.println("ActionListener 작동 " + DayOfMon); // -------------------------------저장된 메모 불러오기---------------------------------- memoLoad(); // ------------------------------------------------------------------- } }); } memoLabel.setText( Integer.toString(y) + "년 " + Integer.toString(m + 1) + "월 " + Integer.toString(DayOfMon) + "일"); } cal.add(Calendar.DATE, -n + 1); // 일을 첫번째 주의 일요일(좌상단) // 버튼에 String넣고 색을 넣는 반복문 for (int i = 0; i < b_date.length; i++, cal.add(Calendar.DATE, 1)) {// i++,날짜++ s = Integer.toString(cal.get(Calendar.DATE)); b_date[i].setText(s); b_date[i].setForeground(datetextColor); if (cal.get(Calendar.MONTH) != m) { // 월(month)이 다른 경우 b_date[i].setBackground(nondateColor); b_date[i].setEnabled(false); } else { b_date[i].setBackground(dateColor); b_date[i].setEnabled(true); } } int lastDOM = DayOfMon; Calendar mycal=Calendar.getInstance(); mycal.set(y, m,1); int maxday=mycal.getActualMaximum(Calendar.DAY_OF_MONTH); System.out.println(maxday); System.out.println(lastDOM); if(lastDOM>maxday) DayOfMon=maxday; System.out.println(DayOfMon); memoLoad(); } public void memoLoad() { String readstr; BufferedReader BR = null; try { File file = new File("MemoData/" + y + ((m + 1) < 10 ? "0" : "") + (m + 1) + (DayOfMon < 10 ? "0" : "") + DayOfMon + ".txt"); BR = new BufferedReader(new FileReader(file)); while ((readstr = BR.readLine()) != null) { myp3.memoArea.setText(readstr); } } catch (IOException e1) {// 파일이 만들어지지않은상태에서 발생하는 에러-> 즉 아직 memoArea는 비어있어야함 System.out.println("MemoData/" + y + ((m + 1) < 10 ? "0" : "") + (m + 1) + (DayOfMon < 10 ? "0" : "") + DayOfMon + ".txt" + "은 아직 만들어지지 않았습니다."); myp3.memoArea.setText(""); } finally { try { if (BR != null) BR.close(); } catch (IOException e1) { e1.printStackTrace(); } } memoLabel.setText( Integer.toString(y) + "년 " + Integer.toString(m + 1) + "월 " + Integer.toString(DayOfMon) + "일"); } } class MyP2 extends JPanel { JLabel l_day[] = new JLabel[7]; // 요일 라벨 JButton b_date[] = new JButton[42]; // 날짜 버튼 MyP2() { setBackground(Color.lightGray); setLayout(new GridLayout(7, 7, 1, 1)); setDayLabel(); setDateLabel(); for (int i = 0; i < l_day.length; i++) { l_day[i].setOpaque(true); l_day[i].setBackground(Color.ORANGE); l_day[i].setBorder(new LineBorder(Color.BLACK, 3)); add(l_day[i]); } for (int i = 0; i < b_date.length; i++) add(b_date[i]); } public void setDayLabel() { l_day[0] = new JLabel(" 일 ", JLabel.CENTER); l_day[0].setForeground(Color.RED); l_day[1] = new JLabel(" 월 ", JLabel.CENTER); l_day[2] = new JLabel(" 화 ", JLabel.CENTER); l_day[3] = new JLabel(" 수 ", JLabel.CENTER); l_day[4] = new JLabel(" 목 ", JLabel.CENTER); l_day[5] = new JLabel(" 금 ", JLabel.CENTER); l_day[6] = new JLabel(" 토 ", JLabel.CENTER); l_day[6].setForeground(Color.BLUE); } public void setDateLabel() { for (int i = 0; i < b_date.length; i++) { b_date[i] = new JButton(); } } } class MyP3 extends JPanel { JTextArea memoArea; JScrollPane memoAreaSP; JPanel memoPanel; JPanel memoSubPanel; JButton saveBut; JButton delBut; JButton clearBut; MyP3() { setBackground(Color.lightGray); memoPanel = new JPanel(); memoPanel.setOpaque(false); memoArea = new JTextArea(5, 20); memoArea.setLineWrap(true); memoArea.setWrapStyleWord(true); memoAreaSP = new JScrollPane(memoArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); memoSubPanel = new JPanel(); memoSubPanel.setOpaque(false); saveBut = new JButton("저장"); saveBut.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { try { File f = new File("MemoData"); if (!f.isDirectory()) f.mkdir(); String memo = memoArea.getText(); if (memo.length() > 0) { BufferedWriter out = new BufferedWriter( new FileWriter("MemoData/" + y + ((m + 1) < 10 ? "0" : "") + (m + 1) + (DayOfMon < 10 ? "0" : "") + DayOfMon + ".txt")); String str = memoArea.getText(); out.write(str); out.close(); } } catch (IOException e) { } } }); delBut = new JButton("삭제"); delBut.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { memoArea.setText(""); File f = new File("MemoData/" + y + ((m + 1) < 10 ? "0" : "") + (m + 1) + (DayOfMon < 10 ? "0" : "") + DayOfMon + ".txt"); if (f.exists()) { f.delete(); } } }); clearBut = new JButton("비우기"); clearBut.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { memoArea.setText(null); } }); memoSubPanel.add(saveBut); memoSubPanel.add(delBut); memoSubPanel.add(clearBut); memoPanel.setLayout(new BorderLayout()); memoPanel.add(memoLabel, BorderLayout.NORTH); memoPanel.add(memoAreaSP, BorderLayout.CENTER); memoPanel.add(memoSubPanel, BorderLayout.SOUTH); add(memoPanel); // JButton AddScd = new JButton("일정추가"); // add(AddScd); // AddScd.addActionListener(new ActionListener() { // public void actionPerformed(ActionEvent e) { // String s = JOptionPane.showInputDialog("일정"); // System.out.println(s); // memoArea.append(s); // } // }); } } public static void main(String[] args) { new SwingCalendar(); } }
[ "noreply@github.com" ]
noreply@github.com
0017af5fbb020f71d634f0f6dde8dad1b428cfc6
ddebaaa0ee8b7e398bc603d0eff4a1677d06bc31
/src/backendimpl/PeerServiceImpl.java
5fdaa6bde9cbb23be882c874ab1c81106cf7b740
[]
no_license
ituaijagbone/p2p
33ae849574b4c029995fbca5ba113fe47b56e108
a9d371f84b264b5be85a31703e61bde579bc4b7c
refs/heads/master
2016-09-06T22:19:44.231916
2015-01-04T10:29:11
2015-01-04T10:29:11
28,667,523
0
0
null
null
null
null
UTF-8
Java
false
false
4,919
java
package backendimpl; import p2pinterfaces.P2PPeerService; import peerserviceimpl.PeerToPeerServer; import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.rmi.RemoteException; import java.util.ArrayList; /** * Created by itua ijagbone on 9/25/14. */ public class PeerServiceImpl implements P2PPeerService{ String fileDir = ""; PeerObject peer = null; String neighbourPorts[] = null; private PeerToPeerServer ppServer; public PeerServiceImpl(String fileDir) { this.fileDir = fileDir; } /** * Returns file that requesting peer wants to download * @param fileName file name the requesting peer wants to download from another peer server * @return byte array contain the file */ @Override public byte[] downloadFile(String fileName) { String filePath = "tmp/" + fileName; if (!fileDir.isEmpty()) filePath = fileDir + fileName; try { File file = new File(filePath); byte buffer[] = new byte[(int)file.length()]; BufferedInputStream input = new BufferedInputStream( new FileInputStream(filePath)); input.read(buffer, 0, buffer.length); input.close(); return buffer; } catch (IOException e) { System.err.println("File download Error on server"); e.printStackTrace(); return null; } } /** * Queries peers for file. Client peer connects with neighboring peer. This cycle * continues util all neighboring peers of neighboring peers has been reached based * on the time to live value. Each peer uses binary search find the file in its own local directory, * if returns an Array List containing the concatenation of the IP Address and port number of * the peer with the file. * @param portIds an array list holding all visited peers in search for file so far * @param fileName file name * @param ttl time to live of the request * @return */ @Override public ArrayList<String> query(ArrayList<String> portIds, String fileName, int ttl) { // Add peer to already visited peers to avoid finite loop portIds.add(peer.getIpAddress()+":"+peer.getPortNumber()); ArrayList<String> result = new ArrayList<String>(); // Return result if time to live of query has expired if (ttl <= 0) { return result; } ttl = ttl - 1; for (String i: neighbourPorts) { try { String ipPort[] = i.split(" "); if (!portIds.contains(ipPort[0]+":"+ipPort[1])) { ppServer = new PeerToPeerServer(ipPort[1], ipPort[0], Integer.parseInt(ipPort[1])); ArrayList<String> tmp = ppServer.query(portIds, fileName, ttl); if (tmp != null) { for (int j = 0; j < tmp.size(); j++) { String tmpPort = tmp.get(j); if (!result.contains(tmpPort)) { result.add(tmpPort); } } } // result.addAll(ppServer.query(portIds, fileName, ttl)); } }catch (Exception e) { System.out.println("MalformedURLException - Wrong url cannot reach peer"); continue; } } // Search for file in local directory String strTmp = search(fileName); if (strTmp != null && !result.contains(strTmp)) { result.add(strTmp); } return result; } @Override public synchronized void updateFiles(String[] fileNames) throws RemoteException { peer.setFileNames(fileNames); } /** * Create the peer model * @param peerId peer id * @param fileNames array containing files in peer's directory * @param portNumber port number * @param neighbourPorts port numbers of peer's neighbor * @param ipAddress ip address that peer is running on (default is localhost) */ public void register(String peerId, String[] fileNames, int portNumber, String[] neighbourPorts, String ipAddress) { String id = peerId; peer = new PeerObject(fileNames, id, portNumber, ipAddress); this.neighbourPorts = neighbourPorts; } /** * Search the peer object through its array of file names if the file name is present * @param fileName file name * @return ipaddress + port number of the peer if file exist or null */ public String search(String fileName) { String result = null; if (peer.searchFiles(fileName)) result = peer.getIpAddress()+":"+peer.getPortNumber(); return result; } }
[ "i.ijagbone@gmail.com" ]
i.ijagbone@gmail.com
3a0c54e7ccff4fda0e2c1a12fd7455b381b4653e
91702111b109d820f3e19c78dd1bd3146231db36
/crm-work/src/main/java/com/crm/work/model/pojo/ReportSearchCondition.java
ebb014be559cdce96f1987924849d706d99064c8
[]
no_license
lipengyao2016/crm
6984c20110871b468134d33020beca0e77526cd8
3b0118734c0dd9e9d3d988357f6d9250f6fd6677
refs/heads/master
2023-01-10T12:18:59.600035
2019-07-01T10:10:07
2019-07-01T10:10:07
194,648,767
0
0
null
2023-01-02T22:12:48
2019-07-01T10:08:23
Java
UTF-8
Java
false
false
1,062
java
package com.crm.work.model.pojo; import com.crm.common.SearchCondition; import io.swagger.annotations.ApiModel; import java.util.List; @ApiModel("汇报检索模型") public class ReportSearchCondition extends SearchCondition { private String title; private int reportType; private int type; private Long uid; private List<Long> rids; public List<Long> getRids() { return rids; } public void setRids(List<Long> rids) { this.rids = rids; } public Long getUid() { return uid; } public void setUid(Long uid) { this.uid = uid; } public int getType() { return type; } public void setType(int type) { this.type = type; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public int getReportType() { return reportType; } public void setReportType(int reportType) { this.reportType = reportType; } }
[ "yao50cn@163.com" ]
yao50cn@163.com
64286b6830c79ce136b9416acc9f493064d79436
ded3c68963f57a4816286c16248b8523814c71d6
/petservice_back/src/main/java/cn/jbolt/common/model/base/BaseVip.java
fc752b4c3ad073d5c230a8ad2e7782d5190480b1
[ "ICU" ]
permissive
HelloMMMMM/petservice_2019_3
1a9b9f504af45ad603ad220d42b293fb79011914
4f6b8e51a653f5c0058d55d104fde0acb101a0a6
refs/heads/master
2020-05-19T17:30:52.267397
2019-05-06T06:30:42
2019-05-06T06:30:42
185,136,182
0
0
null
null
null
null
UTF-8
Java
false
false
932
java
package cn.jbolt.common.model.base; import com.jfinal.plugin.activerecord.Model; import com.jfinal.plugin.activerecord.IBean; /** * Generated by JFinal, do not modify this file. */ @SuppressWarnings({"serial", "unchecked"}) public abstract class BaseVip<M extends BaseVip<M>> extends Model<M> implements IBean { public M setId(java.lang.Integer id) { set("id", id); return (M)this; } public java.lang.Integer getId() { return getInt("id"); } public M setPrice(java.math.BigDecimal price) { set("price", price); return (M)this; } public java.math.BigDecimal getPrice() { return get("price"); } public M setDesc(java.lang.String desc) { set("desc", desc); return (M)this; } public java.lang.String getDesc() { return getStr("desc"); } public M setName(java.lang.String name) { set("name", name); return (M)this; } public java.lang.String getName() { return getStr("name"); } }
[ "1694327880@qq.com" ]
1694327880@qq.com
607abf38ca6c67dea079988bd28a500bd0d2fce4
0cf378b7320592a952d5343a81b8a67275ab5fab
/webprotege-client/src/main/java/edu/stanford/bmir/protege/web/client/obo/OBOTermXRefsEditorPortletPresenter.java
de91e76c33ad83985b0529c44d01603ee5ec3aa5
[ "BSD-2-Clause" ]
permissive
curtys/webprotege-attestation
945de9f6c96ca84b7022a60f4bec4886c81ab4f3
3aa909b4a8733966e81f236c47d6b2e25220d638
refs/heads/master
2023-04-11T04:41:16.601854
2023-03-20T12:18:44
2023-03-20T12:18:44
297,962,627
0
0
MIT
2021-08-24T08:43:21
2020-09-23T12:28:24
Java
UTF-8
Java
false
false
3,459
java
package edu.stanford.bmir.protege.web.client.obo; import com.google.gwt.user.client.ui.IsWidget; import com.google.gwt.user.client.ui.SimplePanel; import edu.stanford.bmir.protege.web.client.dispatch.DispatchServiceManager; import edu.stanford.bmir.protege.web.client.lang.DisplayNameRenderer; import edu.stanford.bmir.protege.web.client.permissions.LoggedInUserProjectPermissionChecker; import edu.stanford.bmir.protege.web.client.portlet.PortletUi; import edu.stanford.bmir.protege.web.shared.access.BuiltInAction; import edu.stanford.bmir.protege.web.shared.event.WebProtegeEventBus; import edu.stanford.bmir.protege.web.shared.obo.GetOboTermXRefsAction; import edu.stanford.bmir.protege.web.shared.obo.SetOboTermXRefsAction; import edu.stanford.bmir.protege.web.shared.project.ProjectId; import edu.stanford.bmir.protege.web.client.selection.SelectionModel; import edu.stanford.webprotege.shared.annotations.Portlet; import org.semanticweb.owlapi.model.OWLEntity; import javax.annotation.Nonnull; import javax.inject.Inject; /** * Author: Matthew Horridge<br> * Stanford University<br> * Bio-Medical Informatics Research Group<br> * Date: 22/05/2012 */ @Portlet(id = "portlets.obo.TermXRefs", title = "OBO Term XRefs") public class OBOTermXRefsEditorPortletPresenter extends AbstractOBOTermPortletPresenter { @Nonnull private final DispatchServiceManager dispatch; @Nonnull private final IsWidget editorHolder; @Nonnull private final XRefListEditor editor; @Nonnull private final LoggedInUserProjectPermissionChecker permissionChecker; @Inject public OBOTermXRefsEditorPortletPresenter(@Nonnull SelectionModel selectionModel, @Nonnull ProjectId projectId, @Nonnull DispatchServiceManager dispatch, @Nonnull XRefListEditor editor, @Nonnull LoggedInUserProjectPermissionChecker permissionChecker, DisplayNameRenderer displayNameRenderer) { super(selectionModel, projectId, displayNameRenderer); this.dispatch = dispatch; this.editor = editor; this.editorHolder = new SimplePanel(editor); this.permissionChecker = permissionChecker; } @Override public void startPortlet(PortletUi portletUi, WebProtegeEventBus eventBus) { portletUi.setWidget(editorHolder); editor.setEnabled(false); permissionChecker.hasPermission(BuiltInAction.EDIT_ONTOLOGY, perm -> editor.setEnabled(perm)); } @Override protected boolean isDirty() { return editor.isDirty(); } @Override protected void commitChangesForEntity(OWLEntity entity) { editor.getValue().ifPresent(xrefs -> dispatch.execute(new SetOboTermXRefsAction(getProjectId(), entity, xrefs), result -> { })); } @Override protected void displayEntity(OWLEntity entity) { dispatch.execute(new GetOboTermXRefsAction(getProjectId(), entity), this, result -> editor.setValue(result.getxRefs())); } @Override protected void clearDisplay() { editor.clearValue(); } @Override protected String getTitlePrefix() { return "XRefs"; } }
[ "matthew.horridge@stanford.edu" ]
matthew.horridge@stanford.edu
a01186ad9261fe851f23feb635a69a4bb75f10c4
6aaf5a70dae182925c46f1e31a8462fd69e27b7f
/src/main/java/com/afrikatek/documentsservice/domain/MarriageDetails.java
93c1c9fe0cab7e9b2859f5764cb1f08aa0ca335b
[]
no_license
murukaimberi/documents-service
11751e4a3c2233b63f0c907ed56da76ee8c76827
31cae535773c580a6c4e0367b7b8bd3a795fc16e
refs/heads/main
2023-03-31T20:16:41.705021
2021-04-08T15:47:16
2021-04-08T15:47:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,217
java
package com.afrikatek.documentsservice.domain; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import java.io.Serializable; import java.time.LocalDate; import javax.persistence.*; import javax.validation.constraints.*; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; /** * A MarriageDetails. */ @Entity @Table(name = "marriage_details") @Cache(usage = CacheConcurrencyStrategy.READ_WRITE) public class MarriageDetails implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator") @SequenceGenerator(name = "sequenceGenerator") private Long id; @NotNull @Column(name = "date_of_marriage", nullable = false) private LocalDate dateOfMarriage; @NotNull @Column(name = "spouse_full_name", nullable = false) private String spouseFullName; @NotNull @Column(name = "place_of_marriage", nullable = false) private String placeOfMarriage; @NotNull @Column(name = "spouse_place_of_birth", nullable = false) private String spousePlaceOfBirth; @NotNull @Column(name = "country_of_marriage", nullable = false) private String countryOfMarriage; @NotNull @Column(name = "spouse_country_of_birth", nullable = false) private String spouseCountryOfBirth; @NotNull @Column(name = "marriage_number", nullable = false) private String marriageNumber; @NotNull @Column(name = "married_before", nullable = false) private Boolean marriedBefore; @NotNull @Column(name = "marriage_order", nullable = false) private String marriageOrder; @NotNull @Column(name = "devorce_order", nullable = false) private String devorceOrder; @NotNull @Column(name = "previous_sppouses", nullable = false) private String previousSppouses; @JsonIgnoreProperties( value = { "democraphicDetails", "declaration", "guardian", "addresses", "countryOfBirths", "user", "marriageDetails", "nextOfKeen", "appointmentSlot", }, allowSetters = true ) @OneToOne(optional = false) @NotNull @JoinColumn(unique = true) private Applicant applicant; // jhipster-needle-entity-add-field - JHipster will add fields here public Long getId() { return id; } public void setId(Long id) { this.id = id; } public MarriageDetails id(Long id) { this.id = id; return this; } public LocalDate getDateOfMarriage() { return this.dateOfMarriage; } public MarriageDetails dateOfMarriage(LocalDate dateOfMarriage) { this.dateOfMarriage = dateOfMarriage; return this; } public void setDateOfMarriage(LocalDate dateOfMarriage) { this.dateOfMarriage = dateOfMarriage; } public String getSpouseFullName() { return this.spouseFullName; } public MarriageDetails spouseFullName(String spouseFullName) { this.spouseFullName = spouseFullName; return this; } public void setSpouseFullName(String spouseFullName) { this.spouseFullName = spouseFullName; } public String getPlaceOfMarriage() { return this.placeOfMarriage; } public MarriageDetails placeOfMarriage(String placeOfMarriage) { this.placeOfMarriage = placeOfMarriage; return this; } public void setPlaceOfMarriage(String placeOfMarriage) { this.placeOfMarriage = placeOfMarriage; } public String getSpousePlaceOfBirth() { return this.spousePlaceOfBirth; } public MarriageDetails spousePlaceOfBirth(String spousePlaceOfBirth) { this.spousePlaceOfBirth = spousePlaceOfBirth; return this; } public void setSpousePlaceOfBirth(String spousePlaceOfBirth) { this.spousePlaceOfBirth = spousePlaceOfBirth; } public String getCountryOfMarriage() { return this.countryOfMarriage; } public MarriageDetails countryOfMarriage(String countryOfMarriage) { this.countryOfMarriage = countryOfMarriage; return this; } public void setCountryOfMarriage(String countryOfMarriage) { this.countryOfMarriage = countryOfMarriage; } public String getSpouseCountryOfBirth() { return this.spouseCountryOfBirth; } public MarriageDetails spouseCountryOfBirth(String spouseCountryOfBirth) { this.spouseCountryOfBirth = spouseCountryOfBirth; return this; } public void setSpouseCountryOfBirth(String spouseCountryOfBirth) { this.spouseCountryOfBirth = spouseCountryOfBirth; } public String getMarriageNumber() { return this.marriageNumber; } public MarriageDetails marriageNumber(String marriageNumber) { this.marriageNumber = marriageNumber; return this; } public void setMarriageNumber(String marriageNumber) { this.marriageNumber = marriageNumber; } public Boolean getMarriedBefore() { return this.marriedBefore; } public MarriageDetails marriedBefore(Boolean marriedBefore) { this.marriedBefore = marriedBefore; return this; } public void setMarriedBefore(Boolean marriedBefore) { this.marriedBefore = marriedBefore; } public String getMarriageOrder() { return this.marriageOrder; } public MarriageDetails marriageOrder(String marriageOrder) { this.marriageOrder = marriageOrder; return this; } public void setMarriageOrder(String marriageOrder) { this.marriageOrder = marriageOrder; } public String getDevorceOrder() { return this.devorceOrder; } public MarriageDetails devorceOrder(String devorceOrder) { this.devorceOrder = devorceOrder; return this; } public void setDevorceOrder(String devorceOrder) { this.devorceOrder = devorceOrder; } public String getPreviousSppouses() { return this.previousSppouses; } public MarriageDetails previousSppouses(String previousSppouses) { this.previousSppouses = previousSppouses; return this; } public void setPreviousSppouses(String previousSppouses) { this.previousSppouses = previousSppouses; } public Applicant getApplicant() { return this.applicant; } public MarriageDetails applicant(Applicant applicant) { this.setApplicant(applicant); return this; } public void setApplicant(Applicant applicant) { this.applicant = applicant; } // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here @Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof MarriageDetails)) { return false; } return id != null && id.equals(((MarriageDetails) o).id); } @Override public int hashCode() { // see https://vladmihalcea.com/how-to-implement-equals-and-hashcode-using-the-jpa-entity-identifier/ return getClass().hashCode(); } // prettier-ignore @Override public String toString() { return "MarriageDetails{" + "id=" + getId() + ", dateOfMarriage='" + getDateOfMarriage() + "'" + ", spouseFullName='" + getSpouseFullName() + "'" + ", placeOfMarriage='" + getPlaceOfMarriage() + "'" + ", spousePlaceOfBirth='" + getSpousePlaceOfBirth() + "'" + ", countryOfMarriage='" + getCountryOfMarriage() + "'" + ", spouseCountryOfBirth='" + getSpouseCountryOfBirth() + "'" + ", marriageNumber='" + getMarriageNumber() + "'" + ", marriedBefore='" + getMarriedBefore() + "'" + ", marriageOrder='" + getMarriageOrder() + "'" + ", devorceOrder='" + getDevorceOrder() + "'" + ", previousSppouses='" + getPreviousSppouses() + "'" + "}"; } }
[ "gmurukai@hotmail.com" ]
gmurukai@hotmail.com
67d5d83207e6878117c43e900b21b111263bd982
095b76d9bf382d9a2a9784bbec2101ff34242dad
/src/GUI/CartViewer.java
5cb10a5ffdee5eb60186c34b53d4465cb8cfb408
[]
no_license
scottrigg/eSecShop
030cab6326ceca075f22c42f1fbeeaff7db85b84
fde3ec2e6cd9867ac45f359c9ce188bb73f2ba3a
refs/heads/master
2021-01-18T15:11:45.051216
2016-06-30T22:41:27
2016-06-30T22:41:27
62,346,530
0
0
null
2016-06-30T22:38:28
2016-06-30T22:38:28
null
UTF-8
Java
false
false
1,480
java
package GUI; import java.awt.BorderLayout; import java.awt.Container; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JScrollPane; import javax.swing.JTable; import order.ShoppingCart; import productData.Product; import java.util.ArrayList; public class CartViewer extends JFrame { private JTable table; ArrayList<Product> plist = new ArrayList<Product>(); public CartViewer() { String[] columnNames = { "Product ID.", "Product Name","Product Type", "Description", "Price"}; // column name Object[][] rowData = new Object[50][14]; // column and array number ShoppingCart sc = new ShoppingCart(); plist = ShoppingCart.getCart(); try { int count = 0; // STEP 5: Extract data from result set for (Product p :plist) { rowData[count][0] = p.getProductID(); rowData[count][1] = p.getName(); rowData[count][2] = p.getType(); rowData[count][3] = p.getStatement(); rowData[count][4] = p.getPrice(); count++; } } catch (Exception ex) { ex.printStackTrace(); } finally { Container container = getContentPane(); table = new JTable(rowData, columnNames); container.add(new JScrollPane(table), BorderLayout.CENTER); setSize(1200, 400); setVisible(true); this.setTitle("All product information"); this.setLocationRelativeTo(null); } }// end ViewTable } // end class
[ "noreply@github.com" ]
noreply@github.com
526cefe2572f019075a2c6a0582ca589f4424aca
874680a42710d7123fa51b6a54ae8a9bc83667bc
/sqlite/src/androidTest/java/com/test/okamiy/sqlite/ExampleInstrumentedTest.java
7f4325730e662ca1c33817c4b53911a3be4f855e
[]
no_license
OkamiyGit/DatabaseTest
3faf68471076cfd7225660699c0cc0a6505a20c6
d4f141f6f0ec03c7620509933c90dac951d9908a
refs/heads/master
2021-08-15T03:58:22.383544
2017-11-17T09:15:19
2017-11-17T09:15:19
111,083,644
0
0
null
null
null
null
UTF-8
Java
false
false
748
java
package com.test.okamiy.sqlite; 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("com.test.okamiy.sqlite", appContext.getPackageName()); } }
[ "542839122@qq.com" ]
542839122@qq.com
a24d8f68ce92f4c86bc115a37707c46b42854d53
ba6935cc30df6c1e6134c06e1f3af2fd239a0b96
/03_bank/src/com/java/bank/dto/BankDto.java
8af8f0f6c496e25c8284ea444bf16cdd06cb015f
[]
no_license
sohyeonpark0901/Spring-BASIC
3ae4547233a6575e40fc3596ad9d2f9770551956
7011327a14beb14a8f3561722a68e9ddd7e6766c
refs/heads/main
2023-04-07T08:29:12.949680
2021-04-08T08:33:22
2021-04-08T08:33:22
352,920,085
0
0
null
null
null
null
UTF-8
Java
false
false
738
java
package com.java.bank.dto; public class BankDto { private int num; private String id; private String name; private long balance; public BankDto(int num, String id, String name, long balance) { super(); this.num = num; this.id = id; this.name = name; this.balance = balance; } public BankDto() {} public int getNum() { return num; } public void setNum(int num) { this.num = num; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public long getBalance() { return balance; } public void setBalance(long balance) { this.balance = balance; } }
[ "shg5865@naver.com" ]
shg5865@naver.com
d163d17b2df72558289d053601fc2698d6700da6
49ad9360c0adcdcb62fcb64d294d898f604af99e
/src/main/java/com/qiucheni/factory/ObjectFactory.java
1ab422b24321c2cdf1bae72959bb050450a5504e
[]
no_license
QiuChenI/BeanResolver4j
250fb40d9c828058827f7ef14c9eb02b19e22369
77eb467c65d1256611cc480c386816523f285803
refs/heads/master
2023-08-18T21:56:32.432295
2021-10-14T08:27:40
2021-10-14T08:27:40
417,013,940
2
0
null
null
null
null
UTF-8
Java
false
false
229
java
package com.qiucheni.factory; public interface ObjectFactory { public Object getInstance(Class<?> clazz); public Object getBasicInstance(Class<?> clazz,String value); public boolean isBasicType(Class<?> clazz); }
[ "2419500847@qq.com" ]
2419500847@qq.com
647df987516a912237ebd2b32b02da733284021e
515a8916bd68b46167fa36ead92e1fc49f9e9429
/src/main/java/de/init/kosit/commons/transform/ObjektConvert.java
9e95b9cdf5b596d351057d7d0500179cb30c1aa7
[]
no_license
itplr-kosit/xml-mutate
41a8dbc81e2184400f5fe921423595253bcbd143
e418cb0dca0bd6ae8fe9f56da2b355ac6457b82a
refs/heads/master
2023-07-24T23:25:50.958297
2023-07-18T18:03:37
2023-07-18T18:03:37
240,177,543
1
2
null
2022-06-20T21:15:35
2020-02-13T04:35:05
Java
UTF-8
Java
false
false
1,425
java
// Generated by delombok at Fri Aug 13 16:11:22 CEST 2021 package de.init.kosit.commons.transform; import javax.xml.bind.Unmarshaller; import javax.xml.transform.dom.DOMSource; import de.init.kosit.commons.convert.ConversionService; import net.sf.saxon.dom.NodeOverNodeInfo; import net.sf.saxon.s9api.Destination; import net.sf.saxon.s9api.XdmDestination; /** * Convert, der via JAXB in ein Zielobjekt umwandelt. * * @author Andreas Penski */ class ObjektConvert<T> implements Convert<T> { private final XdmDestination xdmDestination = new XdmDestination(); private final ConversionService conversionService; private final Class<T> targetClass; private Unmarshaller.Listener listener; ObjektConvert(final ConversionService conversionService, final Class<T> targetClass, final Unmarshaller.Listener listener) { this(conversionService, targetClass); this.listener = listener; } public ObjektConvert(final ConversionService conversionService, final Class<T> targetClass) { this.conversionService = conversionService; this.targetClass = targetClass; } @Override public Destination createDestination() { return xdmDestination; } @Override public T getResult() { return this.conversionService.readXml(new DOMSource(NodeOverNodeInfo.wrap(xdmDestination.getXdmNode().getUnderlyingNode())), targetClass, listener); } }
[ "renzo.kottmann@finanzen.bremen.de" ]
renzo.kottmann@finanzen.bremen.de
8ab3ed587b2cd583733791f7ea9383189704f0a7
81169a4fc7007c0fb8e822140c3ba122d8183235
/src/com/aicp/extras/TitleProvider.java
02ebc1a3e2926cc4b023f3fca8254c0f6aab4871
[]
no_license
AICP/packages_apps_AicpExtras
68104e95207e0bc5ccc608c6944d014703f7ca01
a2ebdefc464b1641b4d0c5f5111790424b9e3147
refs/heads/s12.1
2023-08-17T21:42:48.426233
2022-09-04T14:02:00
2022-09-04T14:02:00
44,540,647
30
182
null
2022-10-12T18:20:32
2015-10-19T14:31:38
Java
UTF-8
Java
false
false
684
java
/* * Copyright (C) 2017 AICP * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.aicp.extras; public interface TitleProvider { CharSequence getTitle(); }
[ "spiritcroc@gmail.com" ]
spiritcroc@gmail.com
2f9a955339a3267965e795420568253ff04178ee
7078a7f0d049046d8c0aa222c93367998e5d54c8
/src/main/java/com/naosim/dddwork/MainDDD.java
d6b725fd25972ec00647bb90c456a76899f5f7e6
[]
no_license
naosim/dddwork
cf94a4d502de07b628cf21cc2990a78bf8956afd
e4686d0272a45226694ef89711d81b752ae7202a
refs/heads/master
2021-01-19T11:37:37.177053
2017-02-17T03:54:10
2017-02-17T03:54:10
82,255,181
0
0
null
null
null
null
UTF-8
Java
false
false
707
java
package com.naosim.dddwork; import com.naosim.dddwork.lib.ApiHandler; public class MainDDD { public static void main(String[] args) { ApiHandler apiHandler = new ApiHandler(); // args = new String[]{ // "input", "20170103","0900", "1700" // }; args = new String[]{ "total", "201701" }; System.out.println(args); try { if(args.length < 1) { throw new RuntimeException("引数が足りません"); } String methodType = args[0]; apiHandler.handle(methodType, args); } catch (Exception e) { e.printStackTrace(); } } }
[ "n-fujita@biglobe.co.jp" ]
n-fujita@biglobe.co.jp
e4081355326fb7ca2d0c1882efe3e6e289986987
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/12/12_40f3ab84202b76281abbb1fa794e35f6d414af23/MerkleTreeTest/12_40f3ab84202b76281abbb1fa794e35f6d414af23_MerkleTreeTest_t.java
cd9294080a7ee9e52a9a47d4edcbbb3eae69d1d9
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
4,606
java
package test.ccn.security.crypto; import java.util.Arrays; import java.util.Random; import org.bouncycastle.asn1.x509.DigestInfo; import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import com.parc.ccn.security.crypto.CCNDigestHelper; import com.parc.ccn.security.crypto.MerklePath; import com.parc.ccn.security.crypto.MerkleTree; public class MerkleTreeTest { protected static Random _rand = new Random(); // don't need SecureRandom @BeforeClass public static void setUpBeforeClass() throws Exception { } @Before public void setUp() throws Exception { } @Test public void testMerkleTree() throws Exception { int [] sizes = new int[]{128,256,512,4096}; try { testTree(0, sizes[0], false); Assert.fail("MerkleTree should throw an exception for tree sizes < 2."); } catch (IllegalArgumentException e) { // ok } try { testTree(1, sizes[0], false); Assert.fail("MerkleTree should throw an exception for tree sizes < 2."); } catch (IllegalArgumentException e) { // ok } System.out.println("Testing small trees."); for (int i=2; i < 515; ++i) { testTree(i,sizes[i%sizes.length],false); } System.out.println("Testing large trees."); int [] nodecounts = new int[]{1000,1001,1025,1098,1536,1575,2053,5147,8900,9998,9999,10000}; for (int i=0; i < nodecounts.length; ++i) { testTree(nodecounts[i],sizes[i%sizes.length],false); } } public static void testTree(int numLeaves, int nodeLength, boolean digest) throws Exception { try { byte [][] data = makeContent(numLeaves, nodeLength, digest); testTree(data, numLeaves, digest); } catch (Exception e) { System.out.println("Building tree of " + numLeaves + " Nodes. Caught a " + e.getClass().getName() + " exception: " + e.getMessage()); throw e; } } public static byte [][] makeContent(int numNodes, int nodeLength, boolean digest) { byte [][] bufs = new byte[numNodes][]; byte [] tmpbuf = null; if (digest) tmpbuf = new byte[nodeLength]; int blocklen = (digest ? CCNDigestHelper.DEFAULT_DIGEST_LENGTH : nodeLength); for (int i=0; i < numNodes; ++i) { bufs[i] = new byte[blocklen]; if (digest) { _rand.nextBytes(tmpbuf); bufs[i] = CCNDigestHelper.digest(tmpbuf); } else { _rand.nextBytes(bufs[i]); } } return bufs; } public static void testTree(byte [][] content, int count, boolean digest) { // Generate a merkle tree. Verify each path for the content. MerkleTree tree = new MerkleTree(content, digest, count, 0, ((count-1) >= 0) && ((count-1) < content.length) ? content[count-1].length : 0); MerklePath [] paths = new MerklePath[count]; for (int i=0; i < count; ++i) { paths[i] = tree.path(i); //checkPath(tree, paths[i]); byte [] root = paths[i].root(content[i],digest); boolean result = Arrays.equals(root, tree.root()); if (!result) { System.out.println("Constructed tree of " + count + " blocks (of " + content.length + "), numleaves: " + tree.numLeaves() + " max pathlength: " + tree.maxDepth()); System.out.println("Path " + i + " verified for leaf " + paths[i].leafNodeIndex() + "? " + result); } Assert.assertTrue("Path " + i + " failed to verify.", result); try { byte [] encodedPath = paths[i].derEncodedPath(); DigestInfo info = CCNDigestHelper.digestDecoder(encodedPath); MerklePath decoded = new MerklePath(info.getDigest()); if (!decoded.equals(paths[i])) { System.out.println("Path " + i + " failed to encode and decode."); Assert.fail("Path " + i + " failed to encode and decode."); } } catch (Exception e) { System.out.println("Exception encoding path " + i + " :" + e.getClass().getName() + ": " + e.getMessage()); e.printStackTrace(); Assert.fail("Exception encoding path " + i + " :" + e.getClass().getName() + ": " + e.getMessage()); } } } protected static void checkPath(MerkleTree tree, MerklePath path) { // Check path against the tree, and see if it contains the hashes it should. System.out.println("Checking path for nodeID: " + path.leafNodeIndex() + " path length: " + path.pathLength() + " num components: " + path.pathLength()); StringBuffer buf = new StringBuffer("Path nodes: "); for (int i=0; i < path.pathLength(); ++i) { buf.append(tree.getNodeIndex(path.entry(i))); buf.append(" "); } System.out.println(buf.toString()); } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
08938a37ed1f493a505d8d139e39da1d39eefe0d
b59472ded3c2a1439f3b16d0941d8dec6520dac5
/src/proyecto-original/Revelaciones-branch-5.1/src/Model/src/cl/bicevida/revelaciones/ejb/service/local/GrillaServiceLocal.java
b959c4272be0d36c2562aba75ee17593e4793a50
[]
no_license
vicky1404/rev-ii
a0672bf6d1ffa16f9a2c99b2465359d0a69d51bd
cc264cf7612ad3b2b4c9705f6b8cf29639ef7fa2
refs/heads/master
2020-05-16T09:19:22.181375
2013-08-05T02:14:06
2013-08-05T02:14:06
34,520,890
0
0
null
null
null
null
UTF-8
Java
false
false
1,301
java
package cl.bicevida.revelaciones.ejb.service.local; import cl.bicevida.revelaciones.ejb.entity.Estructura; import cl.bicevida.revelaciones.ejb.entity.Grilla; import cl.bicevida.revelaciones.ejb.entity.SubGrilla; import cl.bicevida.revelaciones.ejb.entity.Version; import java.util.List; import javax.ejb.Local; @Local public interface GrillaServiceLocal { Object mergeEntity(Grilla entity); public Object mergeSubGrilla(SubGrilla entity); Object persistEntity(Grilla entity); Grilla findGrilla(Long idGrilla) throws Exception; void mergeGrillaList(List<Grilla> grillaList) throws Exception; Grilla findGrillaById(Long idGrilla) throws Exception; /** * @param grilla * @throws Exception */ void persistCell(Grilla grid) throws Exception; void desagregarGrilla(final List<Version> versionList)throws Exception; void consolidarGrilla(final List<Estructura> estructuraList)throws Exception; Long getMaxIdSubGrilla() throws Exception; Long getMaxIdSubColumna() throws Exception; void eliminarSubGrilla(SubGrilla subGrilla) throws Exception; void eliminarSubGrillas(List<SubGrilla> subGrillaList) throws Exception; }
[ "rodrigo.reyesco@17bb37fe-d5a1-dcfe-262a-f88f89c0b580" ]
rodrigo.reyesco@17bb37fe-d5a1-dcfe-262a-f88f89c0b580
2d98d8657b5db555bef255f4530baa3ea2e280a3
e22595a75f20f7302f2a539cbd34015de027b252
/src/test/java/com/adactin/runner/Runner.java
fa202e7b553d8d91e4c7c555fcae2bb9e914e491
[]
no_license
Devalalini/Adactin
82743e9efa55648eca5aef5557136b26f33d6879
2c76b995253f9ae335bab298452f525ea0220576
refs/heads/master
2023-04-05T19:20:28.367873
2020-07-06T17:58:05
2020-07-06T17:58:05
271,716,966
0
0
null
2021-04-26T20:22:46
2020-06-12T05:35:10
HTML
UTF-8
Java
false
false
1,237
java
package com.adactin.runner; import java.io.IOException; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.runner.RunWith; import org.openqa.selenium.WebDriver; import com.adactin.utility.FileReaderManager; import com.cucumber.baseclass.BaseClass; import cucumber.api.CucumberOptions; import cucumber.api.junit.Cucumber; @RunWith(Cucumber.class) @CucumberOptions(features = "src//test//java//com//adactin//feature//Adactin.feature", glue="com\\adactin\\stepdefinition" , // tags= {"@Login"}, monochrome = true, dryRun = false, strict = true, plugin= {"html:Report\\CucumberReport","json:Report\\CucumberReport.json", "com.cucumber.listener.ExtentCucumberFormatter:Report\\extentReport.html"}) public class Runner extends BaseClass { public static WebDriver driver; @BeforeClass public static void browserOpen() throws IOException { String browserName = FileReaderManager.getInstance().getCRInstance().getBrowserName(); driver=BrowserLaunch(browserName); } @AfterClass public static void browserClose() { driver.close(); } }
[ "devsdeva97@gmail.com" ]
devsdeva97@gmail.com
e73b3d3faa0152d124811fb60a844ee5bc7d64f6
3e286e201c56f87d5cd91504d5b64595edb9d76f
/src/main/java/com/trocaae/application/repository/SolicitacaoRepository.java
0a04a458069d08a06acea5202d066ed0e917067f
[]
no_license
Valerieps/troca-ae
6f8e94db74d2024626753fd8846ced482dfd2725
703718bf1383d2da8b5d165959c465cda4035286
refs/heads/develop
2021-08-15T23:53:57.482333
2020-08-07T20:46:54
2020-08-07T20:46:54
210,455,555
3
0
null
2019-11-11T02:13:19
2019-09-23T21:25:22
Java
UTF-8
Java
false
false
396
java
package com.trocaae.application.repository; import com.trocaae.application.model.sql.Solicitacao; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import java.util.List; @Repository public interface SolicitacaoRepository extends JpaRepository<Solicitacao, Long> { List<Solicitacao> findAllBySolicitanteId(Long usuarioId); }
[ "francielly.neves2@gmail.com" ]
francielly.neves2@gmail.com
5689ce9ec8815357ec4122335e7c25dd307c3f5f
2ef5def5bfd71a484f966d2f79c2380c8e329c4c
/docroot/WEB-INF/service/sg/com/para/intranet/timesheet/services/service/TimesheetLocalServiceClp.java
2f9f441df4b6248d64f9d7a1f7e6bf9c6c9d5af0
[]
no_license
Intranet-DevOps/intranet-timesheet-service-portlet
a92d73738c88019c44c19a4b60f8cfe9a5dcabd7
ea7f2b57e839a464ece13bd2cc331c7e0d16e18c
refs/heads/master
2021-06-02T13:36:03.921507
2016-10-08T10:19:02
2016-10-08T10:19:02
69,859,276
0
0
null
null
null
null
UTF-8
Java
false
false
20,160
java
/** * Copyright (c) 2000-present Liferay, Inc. All rights reserved. * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library 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 Lesser General Public License for more * details. */ package sg.com.para.intranet.timesheet.services.service; import com.liferay.portal.service.InvokableLocalService; /** * @author Fernando Karnagi * @generated */ public class TimesheetLocalServiceClp implements TimesheetLocalService { public TimesheetLocalServiceClp(InvokableLocalService invokableLocalService) { _invokableLocalService = invokableLocalService; _methodName0 = "addTimesheet"; _methodParameterTypes0 = new String[] { "sg.com.para.intranet.timesheet.services.model.Timesheet" }; _methodName1 = "createTimesheet"; _methodParameterTypes1 = new String[] { "int" }; _methodName2 = "deleteTimesheet"; _methodParameterTypes2 = new String[] { "int" }; _methodName3 = "deleteTimesheet"; _methodParameterTypes3 = new String[] { "sg.com.para.intranet.timesheet.services.model.Timesheet" }; _methodName4 = "dynamicQuery"; _methodParameterTypes4 = new String[] { }; _methodName5 = "dynamicQuery"; _methodParameterTypes5 = new String[] { "com.liferay.portal.kernel.dao.orm.DynamicQuery" }; _methodName6 = "dynamicQuery"; _methodParameterTypes6 = new String[] { "com.liferay.portal.kernel.dao.orm.DynamicQuery", "int", "int" }; _methodName7 = "dynamicQuery"; _methodParameterTypes7 = new String[] { "com.liferay.portal.kernel.dao.orm.DynamicQuery", "int", "int", "com.liferay.portal.kernel.util.OrderByComparator" }; _methodName8 = "dynamicQueryCount"; _methodParameterTypes8 = new String[] { "com.liferay.portal.kernel.dao.orm.DynamicQuery" }; _methodName9 = "dynamicQueryCount"; _methodParameterTypes9 = new String[] { "com.liferay.portal.kernel.dao.orm.DynamicQuery", "com.liferay.portal.kernel.dao.orm.Projection" }; _methodName10 = "fetchTimesheet"; _methodParameterTypes10 = new String[] { "int" }; _methodName11 = "getTimesheet"; _methodParameterTypes11 = new String[] { "int" }; _methodName12 = "getPersistedModel"; _methodParameterTypes12 = new String[] { "java.io.Serializable" }; _methodName13 = "getTimesheets"; _methodParameterTypes13 = new String[] { "int", "int" }; _methodName14 = "getTimesheetsCount"; _methodParameterTypes14 = new String[] { }; _methodName15 = "updateTimesheet"; _methodParameterTypes15 = new String[] { "sg.com.para.intranet.timesheet.services.model.Timesheet" }; _methodName16 = "getBeanIdentifier"; _methodParameterTypes16 = new String[] { }; _methodName17 = "setBeanIdentifier"; _methodParameterTypes17 = new String[] { "java.lang.String" }; } @Override public sg.com.para.intranet.timesheet.services.model.Timesheet addTimesheet( sg.com.para.intranet.timesheet.services.model.Timesheet timesheet) throws com.liferay.portal.kernel.exception.SystemException { Object returnObj = null; try { returnObj = _invokableLocalService.invokeMethod(_methodName0, _methodParameterTypes0, new Object[] { ClpSerializer.translateInput(timesheet) }); } catch (Throwable t) { t = ClpSerializer.translateThrowable(t); if (t instanceof com.liferay.portal.kernel.exception.SystemException) { throw (com.liferay.portal.kernel.exception.SystemException)t; } if (t instanceof RuntimeException) { throw (RuntimeException)t; } else { throw new RuntimeException(t.getClass().getName() + " is not a valid exception"); } } return (sg.com.para.intranet.timesheet.services.model.Timesheet)ClpSerializer.translateOutput(returnObj); } @Override public sg.com.para.intranet.timesheet.services.model.Timesheet createTimesheet( int timesheetId) { Object returnObj = null; try { returnObj = _invokableLocalService.invokeMethod(_methodName1, _methodParameterTypes1, new Object[] { timesheetId }); } catch (Throwable t) { t = ClpSerializer.translateThrowable(t); if (t instanceof RuntimeException) { throw (RuntimeException)t; } else { throw new RuntimeException(t.getClass().getName() + " is not a valid exception"); } } return (sg.com.para.intranet.timesheet.services.model.Timesheet)ClpSerializer.translateOutput(returnObj); } @Override public sg.com.para.intranet.timesheet.services.model.Timesheet deleteTimesheet( int timesheetId) throws com.liferay.portal.kernel.exception.PortalException, com.liferay.portal.kernel.exception.SystemException { Object returnObj = null; try { returnObj = _invokableLocalService.invokeMethod(_methodName2, _methodParameterTypes2, new Object[] { timesheetId }); } catch (Throwable t) { t = ClpSerializer.translateThrowable(t); if (t instanceof com.liferay.portal.kernel.exception.PortalException) { throw (com.liferay.portal.kernel.exception.PortalException)t; } if (t instanceof com.liferay.portal.kernel.exception.SystemException) { throw (com.liferay.portal.kernel.exception.SystemException)t; } if (t instanceof RuntimeException) { throw (RuntimeException)t; } else { throw new RuntimeException(t.getClass().getName() + " is not a valid exception"); } } return (sg.com.para.intranet.timesheet.services.model.Timesheet)ClpSerializer.translateOutput(returnObj); } @Override public sg.com.para.intranet.timesheet.services.model.Timesheet deleteTimesheet( sg.com.para.intranet.timesheet.services.model.Timesheet timesheet) throws com.liferay.portal.kernel.exception.SystemException { Object returnObj = null; try { returnObj = _invokableLocalService.invokeMethod(_methodName3, _methodParameterTypes3, new Object[] { ClpSerializer.translateInput(timesheet) }); } catch (Throwable t) { t = ClpSerializer.translateThrowable(t); if (t instanceof com.liferay.portal.kernel.exception.SystemException) { throw (com.liferay.portal.kernel.exception.SystemException)t; } if (t instanceof RuntimeException) { throw (RuntimeException)t; } else { throw new RuntimeException(t.getClass().getName() + " is not a valid exception"); } } return (sg.com.para.intranet.timesheet.services.model.Timesheet)ClpSerializer.translateOutput(returnObj); } @Override public com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery() { Object returnObj = null; try { returnObj = _invokableLocalService.invokeMethod(_methodName4, _methodParameterTypes4, new Object[] { }); } catch (Throwable t) { t = ClpSerializer.translateThrowable(t); if (t instanceof RuntimeException) { throw (RuntimeException)t; } else { throw new RuntimeException(t.getClass().getName() + " is not a valid exception"); } } return (com.liferay.portal.kernel.dao.orm.DynamicQuery)ClpSerializer.translateOutput(returnObj); } @Override @SuppressWarnings("rawtypes") public java.util.List dynamicQuery( com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery) throws com.liferay.portal.kernel.exception.SystemException { Object returnObj = null; try { returnObj = _invokableLocalService.invokeMethod(_methodName5, _methodParameterTypes5, new Object[] { ClpSerializer.translateInput(dynamicQuery) }); } catch (Throwable t) { t = ClpSerializer.translateThrowable(t); if (t instanceof com.liferay.portal.kernel.exception.SystemException) { throw (com.liferay.portal.kernel.exception.SystemException)t; } if (t instanceof RuntimeException) { throw (RuntimeException)t; } else { throw new RuntimeException(t.getClass().getName() + " is not a valid exception"); } } return (java.util.List)ClpSerializer.translateOutput(returnObj); } @Override @SuppressWarnings("rawtypes") public java.util.List dynamicQuery( com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, int end) throws com.liferay.portal.kernel.exception.SystemException { Object returnObj = null; try { returnObj = _invokableLocalService.invokeMethod(_methodName6, _methodParameterTypes6, new Object[] { ClpSerializer.translateInput(dynamicQuery), start, end }); } catch (Throwable t) { t = ClpSerializer.translateThrowable(t); if (t instanceof com.liferay.portal.kernel.exception.SystemException) { throw (com.liferay.portal.kernel.exception.SystemException)t; } if (t instanceof RuntimeException) { throw (RuntimeException)t; } else { throw new RuntimeException(t.getClass().getName() + " is not a valid exception"); } } return (java.util.List)ClpSerializer.translateOutput(returnObj); } @Override @SuppressWarnings("rawtypes") public java.util.List dynamicQuery( com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, int end, com.liferay.portal.kernel.util.OrderByComparator orderByComparator) throws com.liferay.portal.kernel.exception.SystemException { Object returnObj = null; try { returnObj = _invokableLocalService.invokeMethod(_methodName7, _methodParameterTypes7, new Object[] { ClpSerializer.translateInput(dynamicQuery), start, end, ClpSerializer.translateInput(orderByComparator) }); } catch (Throwable t) { t = ClpSerializer.translateThrowable(t); if (t instanceof com.liferay.portal.kernel.exception.SystemException) { throw (com.liferay.portal.kernel.exception.SystemException)t; } if (t instanceof RuntimeException) { throw (RuntimeException)t; } else { throw new RuntimeException(t.getClass().getName() + " is not a valid exception"); } } return (java.util.List)ClpSerializer.translateOutput(returnObj); } @Override public long dynamicQueryCount( com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery) throws com.liferay.portal.kernel.exception.SystemException { Object returnObj = null; try { returnObj = _invokableLocalService.invokeMethod(_methodName8, _methodParameterTypes8, new Object[] { ClpSerializer.translateInput(dynamicQuery) }); } catch (Throwable t) { t = ClpSerializer.translateThrowable(t); if (t instanceof com.liferay.portal.kernel.exception.SystemException) { throw (com.liferay.portal.kernel.exception.SystemException)t; } if (t instanceof RuntimeException) { throw (RuntimeException)t; } else { throw new RuntimeException(t.getClass().getName() + " is not a valid exception"); } } return ((Long)returnObj).longValue(); } @Override public long dynamicQueryCount( com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, com.liferay.portal.kernel.dao.orm.Projection projection) throws com.liferay.portal.kernel.exception.SystemException { Object returnObj = null; try { returnObj = _invokableLocalService.invokeMethod(_methodName9, _methodParameterTypes9, new Object[] { ClpSerializer.translateInput(dynamicQuery), ClpSerializer.translateInput(projection) }); } catch (Throwable t) { t = ClpSerializer.translateThrowable(t); if (t instanceof com.liferay.portal.kernel.exception.SystemException) { throw (com.liferay.portal.kernel.exception.SystemException)t; } if (t instanceof RuntimeException) { throw (RuntimeException)t; } else { throw new RuntimeException(t.getClass().getName() + " is not a valid exception"); } } return ((Long)returnObj).longValue(); } @Override public sg.com.para.intranet.timesheet.services.model.Timesheet fetchTimesheet( int timesheetId) throws com.liferay.portal.kernel.exception.SystemException { Object returnObj = null; try { returnObj = _invokableLocalService.invokeMethod(_methodName10, _methodParameterTypes10, new Object[] { timesheetId }); } catch (Throwable t) { t = ClpSerializer.translateThrowable(t); if (t instanceof com.liferay.portal.kernel.exception.SystemException) { throw (com.liferay.portal.kernel.exception.SystemException)t; } if (t instanceof RuntimeException) { throw (RuntimeException)t; } else { throw new RuntimeException(t.getClass().getName() + " is not a valid exception"); } } return (sg.com.para.intranet.timesheet.services.model.Timesheet)ClpSerializer.translateOutput(returnObj); } @Override public sg.com.para.intranet.timesheet.services.model.Timesheet getTimesheet( int timesheetId) throws com.liferay.portal.kernel.exception.PortalException, com.liferay.portal.kernel.exception.SystemException { Object returnObj = null; try { returnObj = _invokableLocalService.invokeMethod(_methodName11, _methodParameterTypes11, new Object[] { timesheetId }); } catch (Throwable t) { t = ClpSerializer.translateThrowable(t); if (t instanceof com.liferay.portal.kernel.exception.PortalException) { throw (com.liferay.portal.kernel.exception.PortalException)t; } if (t instanceof com.liferay.portal.kernel.exception.SystemException) { throw (com.liferay.portal.kernel.exception.SystemException)t; } if (t instanceof RuntimeException) { throw (RuntimeException)t; } else { throw new RuntimeException(t.getClass().getName() + " is not a valid exception"); } } return (sg.com.para.intranet.timesheet.services.model.Timesheet)ClpSerializer.translateOutput(returnObj); } @Override public com.liferay.portal.model.PersistedModel getPersistedModel( java.io.Serializable primaryKeyObj) throws com.liferay.portal.kernel.exception.PortalException, com.liferay.portal.kernel.exception.SystemException { Object returnObj = null; try { returnObj = _invokableLocalService.invokeMethod(_methodName12, _methodParameterTypes12, new Object[] { ClpSerializer.translateInput(primaryKeyObj) }); } catch (Throwable t) { t = ClpSerializer.translateThrowable(t); if (t instanceof com.liferay.portal.kernel.exception.PortalException) { throw (com.liferay.portal.kernel.exception.PortalException)t; } if (t instanceof com.liferay.portal.kernel.exception.SystemException) { throw (com.liferay.portal.kernel.exception.SystemException)t; } if (t instanceof RuntimeException) { throw (RuntimeException)t; } else { throw new RuntimeException(t.getClass().getName() + " is not a valid exception"); } } return (com.liferay.portal.model.PersistedModel)ClpSerializer.translateOutput(returnObj); } @Override public java.util.List<sg.com.para.intranet.timesheet.services.model.Timesheet> getTimesheets( int start, int end) throws com.liferay.portal.kernel.exception.SystemException { Object returnObj = null; try { returnObj = _invokableLocalService.invokeMethod(_methodName13, _methodParameterTypes13, new Object[] { start, end }); } catch (Throwable t) { t = ClpSerializer.translateThrowable(t); if (t instanceof com.liferay.portal.kernel.exception.SystemException) { throw (com.liferay.portal.kernel.exception.SystemException)t; } if (t instanceof RuntimeException) { throw (RuntimeException)t; } else { throw new RuntimeException(t.getClass().getName() + " is not a valid exception"); } } return (java.util.List<sg.com.para.intranet.timesheet.services.model.Timesheet>)ClpSerializer.translateOutput(returnObj); } @Override public int getTimesheetsCount() throws com.liferay.portal.kernel.exception.SystemException { Object returnObj = null; try { returnObj = _invokableLocalService.invokeMethod(_methodName14, _methodParameterTypes14, new Object[] { }); } catch (Throwable t) { t = ClpSerializer.translateThrowable(t); if (t instanceof com.liferay.portal.kernel.exception.SystemException) { throw (com.liferay.portal.kernel.exception.SystemException)t; } if (t instanceof RuntimeException) { throw (RuntimeException)t; } else { throw new RuntimeException(t.getClass().getName() + " is not a valid exception"); } } return ((Integer)returnObj).intValue(); } @Override public sg.com.para.intranet.timesheet.services.model.Timesheet updateTimesheet( sg.com.para.intranet.timesheet.services.model.Timesheet timesheet) throws com.liferay.portal.kernel.exception.SystemException { Object returnObj = null; try { returnObj = _invokableLocalService.invokeMethod(_methodName15, _methodParameterTypes15, new Object[] { ClpSerializer.translateInput(timesheet) }); } catch (Throwable t) { t = ClpSerializer.translateThrowable(t); if (t instanceof com.liferay.portal.kernel.exception.SystemException) { throw (com.liferay.portal.kernel.exception.SystemException)t; } if (t instanceof RuntimeException) { throw (RuntimeException)t; } else { throw new RuntimeException(t.getClass().getName() + " is not a valid exception"); } } return (sg.com.para.intranet.timesheet.services.model.Timesheet)ClpSerializer.translateOutput(returnObj); } @Override public java.lang.String getBeanIdentifier() { Object returnObj = null; try { returnObj = _invokableLocalService.invokeMethod(_methodName16, _methodParameterTypes16, new Object[] { }); } catch (Throwable t) { t = ClpSerializer.translateThrowable(t); if (t instanceof RuntimeException) { throw (RuntimeException)t; } else { throw new RuntimeException(t.getClass().getName() + " is not a valid exception"); } } return (java.lang.String)ClpSerializer.translateOutput(returnObj); } @Override public void setBeanIdentifier(java.lang.String beanIdentifier) { try { _invokableLocalService.invokeMethod(_methodName17, _methodParameterTypes17, new Object[] { ClpSerializer.translateInput(beanIdentifier) }); } catch (Throwable t) { t = ClpSerializer.translateThrowable(t); if (t instanceof RuntimeException) { throw (RuntimeException)t; } else { throw new RuntimeException(t.getClass().getName() + " is not a valid exception"); } } } @Override public java.lang.Object invokeMethod(java.lang.String name, java.lang.String[] parameterTypes, java.lang.Object[] arguments) throws java.lang.Throwable { throw new UnsupportedOperationException(); } private InvokableLocalService _invokableLocalService; private String _methodName0; private String[] _methodParameterTypes0; private String _methodName1; private String[] _methodParameterTypes1; private String _methodName2; private String[] _methodParameterTypes2; private String _methodName3; private String[] _methodParameterTypes3; private String _methodName4; private String[] _methodParameterTypes4; private String _methodName5; private String[] _methodParameterTypes5; private String _methodName6; private String[] _methodParameterTypes6; private String _methodName7; private String[] _methodParameterTypes7; private String _methodName8; private String[] _methodParameterTypes8; private String _methodName9; private String[] _methodParameterTypes9; private String _methodName10; private String[] _methodParameterTypes10; private String _methodName11; private String[] _methodParameterTypes11; private String _methodName12; private String[] _methodParameterTypes12; private String _methodName13; private String[] _methodParameterTypes13; private String _methodName14; private String[] _methodParameterTypes14; private String _methodName15; private String[] _methodParameterTypes15; private String _methodName16; private String[] _methodParameterTypes16; private String _methodName17; private String[] _methodParameterTypes17; }
[ "fernando@localhost" ]
fernando@localhost
7ae1a277df655242e2ae0daea665604b77548d79
d5d97d2038a885d12007b211181d4fb9733cc685
/AWP-H3/src/main/java/com/ns/awp_h3/AwpH3Application.java
70c32aac511d4d49882e4227a78a4719eedc0c0f
[]
no_license
nsreckovic/AWP
292a95a9a3967c8e03f77012de564492c6ecc6e0
c3686d08f66e73c3f9d0c3e858338b05f1a939d6
refs/heads/master
2023-03-22T05:11:17.506878
2021-03-20T20:15:51
2021-03-20T20:15:51
306,871,272
0
0
null
null
null
null
UTF-8
Java
false
false
316
java
package com.ns.awp_h3; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class AwpH3Application { public static void main(String[] args) { SpringApplication.run(AwpH3Application.class, args); } }
[ "sreckonikola@gmail.com" ]
sreckonikola@gmail.com
c4c08ab3c222c600e0016cbb257979c3bbb8d609
9e385204b279f81bdc07ee92e9cde40fe6d927d5
/java/source/com/kodemore/html/cssBuilder/KmCssSpiceConstantsIF.java
31504fc35d4fa769cba7b9ad00177dc8622d1b21
[]
no_license
wyattlove/panda-track-server
4b9ec8f2e10f5731c5088193792bd7b067f911eb
cc2a7ffe844c77b35429ddd84c4bc2c3ddc1d99b
refs/heads/master
2021-01-16T18:29:50.027390
2015-05-21T02:06:25
2015-05-21T02:06:25
33,639,532
0
0
null
null
null
null
UTF-8
Java
false
false
777
java
//############################################################### //############################################################### //## //## AUTO GENERATED - DO NOT EDIT //## //############################################################### //############################################################### package com.kodemore.html.cssBuilder; import com.kodemore.html.KmCssBuilder; import com.kodemore.utility.KmValueHolderIF; public interface KmCssSpiceConstantsIF { //################################################## //# selectors //################################################## String shadow = "shadow"; //################################################## //# composites //################################################## }
[ "wlove@accucode.com" ]
wlove@accucode.com
ff8b0ac9889fd28239547a142abcf168f01de48e
23fc73673668e117955f1f00a5a54864d81c75be
/src/chapter3/Assignment9.java
cd41f89f91df177a4cc8cd41da0e32c5fab0c07a
[]
no_license
SamCymbaluk/ICS4U1
e73ffd6d78aa27e8dd387989b06eb6869b941b8d
1ad1ce33627abf772e2489f8b7ada85814922ec9
refs/heads/master
2020-04-10T00:52:24.950338
2016-12-15T17:12:31
2016-12-15T17:12:31
68,025,468
0
0
null
null
null
null
UTF-8
Java
false
false
1,438
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package chapter3; import java.text.DecimalFormat; import util.IO; public class Assignment9 { static double principal,rate; static int period; public static void main(String[] args){ IO.showMessage("Enter the first loan"); readLoan(); double cost1 = loanCost(principal,period,rate); IO.showMessage("Enter the second loan"); readLoan(); double cost2 = loanCost(principal,period,rate); IO.showMessage("The difference between the two loans is " + decimalFormat(cost2-cost1)); } /** * Takes user input an assigns it to static class variables */ public static void readLoan(){ principal = IO.readDouble("Enter the principle"); period = IO.readInt("Enter the period"); rate = IO.readDouble("Enter the rate"); } public static double loanCost(double principal, int period, double rate){ double payment = (rate/(1-Math.pow(1+rate,-period))) * principal; //Compound interest formula return principal - period * payment; } private static String decimalFormat(double number){ DecimalFormat df2 = new DecimalFormat(".##"); return df2.format(number); } }
[ "cymbalusa405@010-308-02290.hwcdsb.ca" ]
cymbalusa405@010-308-02290.hwcdsb.ca
9698d711707129ce2d5817ae947e277d2afa44ae
d5528063b5351ee071d62bcfd8b933a787c1642c
/app/src/main/java/com/liu/zhibao/angrypandaservice/proxy/DeathRemoteProxy.java
4fb034348125ecfd62052fceca185005a6593a4b
[]
no_license
MMLoveMeMM/AngryPandaService
bb9b63d4fd62c44e16b7df0553bcb979130af790
6b36a3cfd2a8cd2bd7d60a0bb86dd5efbb9905f0
refs/heads/master
2020-03-25T23:30:38.488399
2018-08-23T04:01:29
2018-08-23T04:01:29
144,278,353
0
0
null
null
null
null
UTF-8
Java
false
false
2,953
java
package com.liu.zhibao.angrypandaservice.proxy; import android.app.Service; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.ServiceConnection; import android.os.Binder; import android.os.IBinder; import android.os.RemoteException; import android.telecom.ConnectionService; import android.util.Log; import com.liu.zhibao.angrypandaservice.aidl.IDeathCheckInteface; /** * Created by zhibao.Liu on 2018/8/13. * * @version : * @date : 2018/8/13 * @des : * @see{@link} */ public class DeathRemoteProxy implements ServiceConnection { private final static String TAG=DeathRemoteProxy.class.getName(); private static DeathRemoteProxy instance; private static Context mContext; private IDeathCheckInteface mService; private IBinder mBinder = new Binder(); private IBinder mRemoteBinder; public static DeathRemoteProxy getInstance() { return instance; } public static void init(Context context){ mContext=context; instance = new DeathRemoteProxy(); } /* * 检查远程服务端是否crash * */ private CheckDeathRecipient mCheckDeathRecipient=new CheckDeathRecipient(); private class CheckDeathRecipient implements IBinder.DeathRecipient { @Override public void binderDied() { Log.e(TAG, "remote service has died"); // 反注册 if(mRemoteBinder!=null){ mRemoteBinder.unlinkToDeath(mCheckDeathRecipient,0); } // 重新绑定 bindService(); } } public void bindService(){ Intent intent = new Intent().setClassName("com.liu.zhibao.angrypandaservice","com.liu.zhibao.angrypandaservice.service.DeathCheckService"); if(!mContext.bindService(intent,instance, Service.BIND_AUTO_CREATE)){ Log.e(TAG,"bindService can not be successfully !"); } return; } public void unBindService(){ mContext.unbindService(instance); } @Override public void onServiceConnected(ComponentName name, IBinder service) { mService = IDeathCheckInteface.Stub.asInterface(service); try { // 将binder传给远程service去监听 mService.setBinder(mBinder); // 监听远程服务service是否crash service.linkToDeath(mCheckDeathRecipient,0); mRemoteBinder = service; } catch (RemoteException e) { e.printStackTrace(); } } @Override public void onServiceDisconnected(ComponentName name) { if(mService!=null){ mService=null; } } public void checkDeath(String data){ if(mService!=null){ try { mService.checkDeath(data); } catch (RemoteException e) { e.printStackTrace(); } } } }
[ "liuzhibao@xl.cn" ]
liuzhibao@xl.cn
67daa92bd6c9bae940bc48b2bef64854dd027b93
cba836229c9c3fe47a16cf03b8d67c0affbaea1a
/src/test/java/com/expedia/service/HotelServiceTest.java
846c124bede7922355457d408e30163b38254704
[]
no_license
altayeb1980/HotelDeals
f6c58eed09d66e0742bc5481b5c07d6a45231fa8
42e1193c857a92501798a67dada49f0856dc2f74
refs/heads/master
2020-03-28T06:35:46.694472
2018-09-10T23:18:12
2018-09-10T23:18:12
147,841,800
0
0
null
null
null
null
UTF-8
Java
false
false
9,093
java
package com.expedia.service; import java.text.FieldPosition; import java.text.SimpleDateFormat; import java.util.Arrays; import java.util.Date; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.Captor; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.internal.util.reflection.Whitebox; import org.mockito.junit.MockitoJUnitRunner; import org.springframework.web.client.RestTemplate; import com.expedia.model.Destination; import com.expedia.model.Hotel; import com.expedia.model.HotelDeal; import com.expedia.model.HotelInfo; import com.expedia.model.HotelPricingInfo; import com.expedia.model.HotelUrls; import com.expedia.model.OfferDateRange; import com.expedia.model.OfferInfo; import com.expedia.model.Offers; import com.expedia.model.Persona; import com.expedia.model.SearchCriteria; import com.expedia.model.UserInfo; @RunWith(MockitoJUnitRunner.class) public class HotelServiceTest { private static final String ENDPOINT_URL = "https://offersvc.expedia.com/offers/v2/getOffers?scenario=deal-finder&page=foo&uid=foo&productType=Hotel"; @Mock private RestTemplate restTemplate; @Mock private SimpleDateFormat formatter; @Mock private HotelService hotelService; @Captor private ArgumentCaptor<String> uriArgumentCaptor; @InjectMocks private DefaultHotelService defaultHotelService; @Before public void setup() { Whitebox.setInternalState(defaultHotelService, "hotelDealsUrl", ENDPOINT_URL); Mockito.when(formatter.format(Mockito.any(Date.class), Mockito.any(StringBuffer.class), Mockito.any(FieldPosition.class))).thenReturn(new StringBuffer("2017-02-06")); } @Test public void testUriEndPointWithoutContainsParams() { SearchCriteria searchCriteria = new SearchCriteria.Builder().build(); Mockito.when(restTemplate.getForObject(Mockito.anyString(), Mockito.any())).thenReturn(new HotelDeal()); defaultHotelService.findHotels(searchCriteria); Mockito.verify(restTemplate).getForObject(uriArgumentCaptor.capture(), Mockito.any()); Assert.assertEquals(ENDPOINT_URL, uriArgumentCaptor.getAllValues().get(0)); } @Test public void testUriEndPointWithContainsParams() { SearchCriteria searchCriteria = new SearchCriteria.Builder().withDestinationCity("wadi_rum").withLengthOfStay("1").withMinTripStartDate(new Date()).build(); Mockito.when(restTemplate.getForObject(Mockito.anyString(), Mockito.any())).thenReturn(new HotelDeal()); defaultHotelService.findHotels(searchCriteria); Mockito.verify(restTemplate).getForObject(uriArgumentCaptor.capture(), Mockito.any()); String expectedUriWithParam = new StringBuilder(ENDPOINT_URL).append("&destinationCity="+searchCriteria.getDestinationCity()).append("&lengthOfStay="+searchCriteria.getLengthOfStay()).append("&minTripStartDate="+formatter.format(searchCriteria.getMinTripStartDate())).toString(); Assert.assertEquals(expectedUriWithParam, uriArgumentCaptor.getAllValues().get(0)); } @Test public void testWhenMinTripStartDateInSearchCriteria() { SearchCriteria searchCriteria = new SearchCriteria.Builder().withMinTripStartDate(new Date()).build(); HotelDeal hotelDeal = buildHotelDeal(); Mockito.when(restTemplate.getForObject(Mockito.anyString(), Mockito.any())).thenReturn(hotelDeal); HotelDeal expectedHotelDeal = defaultHotelService.findHotels(searchCriteria); Mockito.verify(restTemplate).getForObject(uriArgumentCaptor.capture(), Mockito.any()); Assert.assertEquals(1, expectedHotelDeal.getOffers().getHotel().size()); Assert.assertEquals("26811791", expectedHotelDeal.getOffers().getHotel().get(0).getHotelInfo().getHotelId()); } @Test public void testWhenDestinationNameInSearchCriteria() { SearchCriteria searchCriteria = new SearchCriteria.Builder().withDestinationName("Wadi Rum").build(); HotelDeal hotelDeal = buildHotelDeal(); Mockito.when(restTemplate.getForObject(Mockito.anyString(), Mockito.any())).thenReturn(hotelDeal); HotelDeal expectedHotelDeal = defaultHotelService.findHotels(searchCriteria); Mockito.verify(restTemplate).getForObject(uriArgumentCaptor.capture(), Mockito.any()); Assert.assertEquals(1, expectedHotelDeal.getOffers().getHotel().size()); Assert.assertEquals("Wadi Rum", expectedHotelDeal.getOffers().getHotel().get(0).getDestination().getShortName()); } @Test public void testWhenLengthOfStayInSearchCriteria() { SearchCriteria searchCriteria = new SearchCriteria.Builder().withLengthOfStay("2").build(); HotelDeal hotelDeal = buildHotelDeal(); Mockito.when(restTemplate.getForObject(Mockito.anyString(), Mockito.any())).thenReturn(hotelDeal); HotelDeal expectedHotelDeal = defaultHotelService.findHotels(searchCriteria); Mockito.verify(restTemplate).getForObject(uriArgumentCaptor.capture(),Mockito.any()); Assert.assertEquals(1, expectedHotelDeal.getOffers().getHotel().size()); Assert.assertEquals("2", String.valueOf(expectedHotelDeal.getOffers().getHotel().get(0).getOfferDateRange().getLengthOfStay())); } private HotelDeal buildHotelDeal() { HotelDeal hotelDeal = new HotelDeal(); OfferInfo offerInfo = buildOfferInfo(); hotelDeal.setOfferInfo(offerInfo); UserInfo userInfo = buildUserInfo(); Persona persona = new Persona(); persona.setPersonaType("OTHERS"); userInfo.setPersona(persona); hotelDeal.setUserInfo(userInfo); Offers offers = new Offers(); Hotel hotel = new Hotel(); hotel.setDestination(buildDestination()); hotel.setHotelInfo(buildHotelInfo()); hotel.setHotelPricingInfo(buildHotelPricingInfo()); hotel.setOfferDateRange(buildOfferDateRange()); hotel.setHotelUrls(buildHotelUrls()); offers.setHotel(Arrays.asList(hotel)); hotelDeal.setOffers(offers); return hotelDeal; } private UserInfo buildUserInfo() { UserInfo userInfo = new UserInfo(); userInfo.setUserId("foo"); return userInfo; } private OfferInfo buildOfferInfo() { OfferInfo offerInfo = new OfferInfo(); offerInfo.setCurrency("USD"); offerInfo.setLanguage("en_US"); offerInfo.setSiteID("1"); offerInfo.setUserSelectedCurrency("USD"); return offerInfo; } private OfferDateRange buildOfferDateRange() { OfferDateRange offerDateRange = new OfferDateRange(); offerDateRange.setLengthOfStay(2); offerDateRange.setTravelEndDate(Arrays.asList(2018, 9, 8)); offerDateRange.setTravelStartDate(Arrays.asList(2018, 9, 7)); return offerDateRange; } private HotelUrls buildHotelUrls() { HotelUrls hotelUrls = new HotelUrls(); hotelUrls.setHotelInfositeUrl( "https%3A%2F%2Fwww.expedia.com%2Fgo%2Fhotel%2Finfo%2F26811791%2F2018-09-07%2F2018-09-08"); hotelUrls.setHotelSearchResultUrl( "https%3A%2F%2Fwww.expedia.com%2Fgo%2Fhotel%2Fsearch%2FDestination%2F2018-09-07%2F2018-09-08%3FSearchType%3DDestination%26CityName%3DWadi+Rum%26RegionId%3D6126616%26Selected%3D26811791"); return hotelUrls; } private HotelPricingInfo buildHotelPricingInfo() { HotelPricingInfo hotelPricingInfo = new HotelPricingInfo(); hotelPricingInfo.setAveragePriceValue(Double.parseDouble("12.75")); hotelPricingInfo.setCrossOutPriceValue(Double.parseDouble("18.22")); hotelPricingInfo.setCurrency("USD"); hotelPricingInfo.setDrr(false); hotelPricingInfo.setOriginalPricePerNight(Double.parseDouble("18.22")); hotelPricingInfo.setPercentSavings(Double.parseDouble("30.02")); hotelPricingInfo.setTotalPriceValue(Double.parseDouble("12.75")); return hotelPricingInfo; } private HotelInfo buildHotelInfo() { HotelInfo hotelInfo = new HotelInfo(); hotelInfo.setHotelCity("Wadi Rum"); hotelInfo.setHotelCountryCode("JOR"); hotelInfo.setHotelDestination("Wadi Rum"); hotelInfo.setHotelDestinationRegionID("6126616"); hotelInfo.setHotelGuestReviewRating(Double.valueOf("0.0")); hotelInfo.setHotelId("26811791"); hotelInfo.setHotelImageUrl( "https://images.trvl-media.com/hotels/27000000/26820000/26811800/26811791/e2bbafc4_t.jpg"); hotelInfo.setHotelLatitude(Double.valueOf("29.53467")); hotelInfo.setHotelLongDestination("Wadi Rum,Governorate of Aqaba,JOR"); hotelInfo.setHotelName("Salem Desert Camp"); hotelInfo.setHotelProvince("Governorate of Aqaba"); hotelInfo.setHotelReviewTotal(Integer.parseInt("0")); hotelInfo.setHotelReviewTotal(Integer.parseInt("0")); hotelInfo.setHotelStarRating("1.0"); hotelInfo.setHotelStreetAddress("Wadi Rum protected area"); hotelInfo.setIsOfficialRating(false); hotelInfo.setLocalizedHotelName("Salem Desert Camp "); hotelInfo.setVipAccess(false); return hotelInfo; } private Destination buildDestination() { Destination destination = new Destination(); destination.setAssociatedMultiCityRegionId("6126616"); destination.setCity("Wadi Rum"); destination.setCountry("Jordan"); destination.setLongName("Wadi Rum, Jordan"); destination.setNonLocalizedCity("Wadi Rum"); destination.setProvince("Aqaba Governorate"); destination.setRegionID("6126616"); destination.setShortName("Wadi Rum"); destination.setTla("AQJ"); return destination; } }
[ "loay.saada@gmail.com" ]
loay.saada@gmail.com
73de8df4a0a0cc9c7caaff1d3f3d4cc9948b9d50
9623f83defac3911b4780bc408634c078da73387
/powercraft_145/src/common/net/minecraft/src/EnumEntitySize.java
5873d965c7c547df812ba051122ed5174dd80c5c
[]
no_license
BlearStudio/powercraft-legacy
42b839393223494748e8b5d05acdaf59f18bd6c6
014e9d4d71bd99823cf63d4fbdb65c1b83fde1f8
refs/heads/master
2021-01-21T21:18:55.774908
2015-04-06T20:45:25
2015-04-06T20:45:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,817
java
package net.minecraft.src; public enum EnumEntitySize { SIZE_1, SIZE_2, SIZE_3, SIZE_4, SIZE_5, SIZE_6; public int multiplyBy32AndRound(double par1) { double var3 = par1 - ((double)MathHelper.floor_double(par1) + 0.5D); switch (EnumEntitySizeHelper.field_85153_a[this.ordinal()]) { case 1: if (var3 < 0.0D) { if (var3 < -0.3125D) { return MathHelper.ceiling_double_int(par1 * 32.0D); } } else if (var3 < 0.3125D) { return MathHelper.ceiling_double_int(par1 * 32.0D); } return MathHelper.floor_double(par1 * 32.0D); case 2: if (var3 < 0.0D) { if (var3 < -0.3125D) { return MathHelper.floor_double(par1 * 32.0D); } } else if (var3 < 0.3125D) { return MathHelper.floor_double(par1 * 32.0D); } return MathHelper.ceiling_double_int(par1 * 32.0D); case 3: if (var3 > 0.0D) { return MathHelper.floor_double(par1 * 32.0D); } return MathHelper.ceiling_double_int(par1 * 32.0D); case 4: if (var3 < 0.0D) { if (var3 < -0.1875D) { return MathHelper.ceiling_double_int(par1 * 32.0D); } } else if (var3 < 0.1875D) { return MathHelper.ceiling_double_int(par1 * 32.0D); } return MathHelper.floor_double(par1 * 32.0D); case 5: if (var3 < 0.0D) { if (var3 < -0.1875D) { return MathHelper.floor_double(par1 * 32.0D); } } else if (var3 < 0.1875D) { return MathHelper.floor_double(par1 * 32.0D); } return MathHelper.ceiling_double_int(par1 * 32.0D); case 6: default: if (var3 > 0.0D) { return MathHelper.ceiling_double_int(par1 * 32.0D); } else { return MathHelper.floor_double(par1 * 32.0D); } } } }
[ "rapus95@gmail.com@ed9f5d1b-00bb-0f29-faab-e8ebad1a710c" ]
rapus95@gmail.com@ed9f5d1b-00bb-0f29-faab-e8ebad1a710c
675b7b1f66dbe50a16d6732434a4a643cf22ac53
f2a5398b84cfaa46fde61a6e180c9abeb92c1a5f
/modules/jaxb-xml-binding/geotk-xml-gml/src/main/java/org/geotoolkit/gml/xml/v321/AbstractTimeGeometricPrimitiveType.java
5fd4145729296b737cf9d0b0fd949ac11268ce1b
[]
no_license
glascaleia/geotoolkit-pending
32b3a15ff0c82508af6fc3ee99033724bf0bc85e
e3908e9dfefc415169f80787cff8c94af4afce17
refs/heads/master
2020-05-20T11:09:44.894361
2012-03-29T14:43:34
2012-03-29T14:43:34
3,219,051
0
0
null
null
null
null
UTF-8
Java
false
false
2,431
java
/* * Geotoolkit - An Open Source Java GIS Toolkit * http://www.geotoolkit.org * * (C) 2008 - 2012, Geomatys * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. */ package org.geotoolkit.gml.xml.v321; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlSeeAlso; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for AbstractTimeGeometricPrimitiveType complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="AbstractTimeGeometricPrimitiveType"> * &lt;complexContent> * &lt;extension base="{http://www.opengis.net/gml/3.2}AbstractTimePrimitiveType"> * &lt;attribute name="frame" type="{http://www.w3.org/2001/XMLSchema}anyURI" default="#ISO-8601" /> * &lt;/extension> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "AbstractTimeGeometricPrimitiveType") @XmlSeeAlso({ TimeInstantType.class, TimePeriodType.class }) public abstract class AbstractTimeGeometricPrimitiveType extends AbstractTimePrimitiveType { @XmlAttribute @XmlSchemaType(name = "anyURI") private String frame; /** * Gets the value of the frame property. * * @return * possible object is * {@link String } * */ public String getFrame() { if (frame == null) { return "#ISO-8601"; } else { return frame; } } /** * Sets the value of the frame property. * * @param value * allowed object is * {@link String } * */ public void setFrame(String value) { this.frame = value; } }
[ "guilhem.legal@geomatys.fr" ]
guilhem.legal@geomatys.fr
ca727b1d88ca6710016c58072b2c7c6631f47df9
27cdf49c7b91f697af6d29a60e336a94c9b3974e
/metamodel/src-gen/metamodel/util/MetamodelSwitch.java
6d9c2ba3a0d91e9628a380490f3ca760d115060d
[]
no_license
fcoulon/demoSirius
824d4ffb6d7e11ffd8a8d27cdd660c183e0590ba
1343257b8ec2618bad7f12a676ba711d0cc02f15
refs/heads/master
2020-06-18T11:35:41.785442
2019-07-11T00:07:33
2019-07-11T00:07:33
196,290,603
1
0
null
null
null
null
UTF-8
Java
false
false
6,106
java
/** */ package metamodel.util; import metamodel.*; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.util.Switch; /** * <!-- begin-user-doc --> * The <b>Switch</b> for the model's inheritance hierarchy. * It supports the call {@link #doSwitch(EObject) doSwitch(object)} * to invoke the <code>caseXXX</code> method for each class of the model, * starting with the actual class of the object * and proceeding up the inheritance hierarchy * until a non-null result is returned, * which is the result of the switch. * <!-- end-user-doc --> * @see metamodel.MetamodelPackage * @generated */ public class MetamodelSwitch<T> extends Switch<T> { /** * The cached model package * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected static MetamodelPackage modelPackage; /** * Creates an instance of the switch. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public MetamodelSwitch() { if (modelPackage == null) { modelPackage = MetamodelPackage.eINSTANCE; } } /** * Checks whether this is a switch for the given package. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param ePackage the package in question. * @return whether this is a switch for the given package. * @generated */ @Override protected boolean isSwitchFor(EPackage ePackage) { return ePackage == modelPackage; } /** * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the first non-null result returned by a <code>caseXXX</code> call. * @generated */ @Override protected T doSwitch(int classifierID, EObject theEObject) { switch (classifierID) { case MetamodelPackage.BOX: { Box box = (Box) theEObject; T result = caseBox(box); if (result == null) result = defaultCase(theEObject); return result; } case MetamodelPackage.INPUT: { Input input = (Input) theEObject; T result = caseInput(input); if (result == null) result = defaultCase(theEObject); return result; } case MetamodelPackage.OUTPUT: { Output output = (Output) theEObject; T result = caseOutput(output); if (result == null) result = defaultCase(theEObject); return result; } case MetamodelPackage.WAREHOUSE: { Warehouse warehouse = (Warehouse) theEObject; T result = caseWarehouse(warehouse); if (result == null) result = defaultCase(theEObject); return result; } case MetamodelPackage.COMPOSITE_BOX: { CompositeBox compositeBox = (CompositeBox) theEObject; T result = caseCompositeBox(compositeBox); if (result == null) result = caseBox(compositeBox); if (result == null) result = defaultCase(theEObject); return result; } default: return defaultCase(theEObject); } } /** * Returns the result of interpreting the object as an instance of '<em>Box</em>'. * <!-- begin-user-doc --> * This implementation returns null; * returning a non-null result will terminate the switch. * <!-- end-user-doc --> * @param object the target of the switch. * @return the result of interpreting the object as an instance of '<em>Box</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseBox(Box object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Input</em>'. * <!-- begin-user-doc --> * This implementation returns null; * returning a non-null result will terminate the switch. * <!-- end-user-doc --> * @param object the target of the switch. * @return the result of interpreting the object as an instance of '<em>Input</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseInput(Input object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Output</em>'. * <!-- begin-user-doc --> * This implementation returns null; * returning a non-null result will terminate the switch. * <!-- end-user-doc --> * @param object the target of the switch. * @return the result of interpreting the object as an instance of '<em>Output</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseOutput(Output object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Warehouse</em>'. * <!-- begin-user-doc --> * This implementation returns null; * returning a non-null result will terminate the switch. * <!-- end-user-doc --> * @param object the target of the switch. * @return the result of interpreting the object as an instance of '<em>Warehouse</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseWarehouse(Warehouse object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Composite Box</em>'. * <!-- begin-user-doc --> * This implementation returns null; * returning a non-null result will terminate the switch. * <!-- end-user-doc --> * @param object the target of the switch. * @return the result of interpreting the object as an instance of '<em>Composite Box</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseCompositeBox(CompositeBox object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. * <!-- begin-user-doc --> * This implementation returns null; * returning a non-null result will terminate the switch, but this is the last case anyway. * <!-- end-user-doc --> * @param object the target of the switch. * @return the result of interpreting the object as an instance of '<em>EObject</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) * @generated */ @Override public T defaultCase(EObject object) { return null; } } //MetamodelSwitch
[ "fabien.coulon@obeo.fr" ]
fabien.coulon@obeo.fr
5a51c00b3e7d18f41a85d1a73f95734075891d33
e9affefd4e89b3c7e2064fee8833d7838c0e0abc
/aws-java-sdk-lakeformation/src/main/java/com/amazonaws/services/lakeformation/model/GetTemporaryGluePartitionCredentialsResult.java
0811a429690fb57ada6831c5c1123d9f95cb3b93
[ "Apache-2.0" ]
permissive
aws/aws-sdk-java
2c6199b12b47345b5d3c50e425dabba56e279190
bab987ab604575f41a76864f755f49386e3264b4
refs/heads/master
2023-08-29T10:49:07.379135
2023-08-28T21:05:55
2023-08-28T21:05:55
574,877
3,695
3,092
Apache-2.0
2023-09-13T23:35:28
2010-03-22T23:34:58
null
UTF-8
Java
false
false
8,911
java
/* * Copyright 2018-2023 Amazon.com, Inc. 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. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.lakeformation.model; import java.io.Serializable; import javax.annotation.Generated; /** * * @see <a href="http://docs.aws.amazon.com/goto/WebAPI/lakeformation-2017-03-31/GetTemporaryGluePartitionCredentials" * target="_top">AWS API Documentation</a> */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class GetTemporaryGluePartitionCredentialsResult extends com.amazonaws.AmazonWebServiceResult<com.amazonaws.ResponseMetadata> implements Serializable, Cloneable { /** * <p> * The access key ID for the temporary credentials. * </p> */ private String accessKeyId; /** * <p> * The secret key for the temporary credentials. * </p> */ private String secretAccessKey; /** * <p> * The session token for the temporary credentials. * </p> */ private String sessionToken; /** * <p> * The date and time when the temporary credentials expire. * </p> */ private java.util.Date expiration; /** * <p> * The access key ID for the temporary credentials. * </p> * * @param accessKeyId * The access key ID for the temporary credentials. */ public void setAccessKeyId(String accessKeyId) { this.accessKeyId = accessKeyId; } /** * <p> * The access key ID for the temporary credentials. * </p> * * @return The access key ID for the temporary credentials. */ public String getAccessKeyId() { return this.accessKeyId; } /** * <p> * The access key ID for the temporary credentials. * </p> * * @param accessKeyId * The access key ID for the temporary credentials. * @return Returns a reference to this object so that method calls can be chained together. */ public GetTemporaryGluePartitionCredentialsResult withAccessKeyId(String accessKeyId) { setAccessKeyId(accessKeyId); return this; } /** * <p> * The secret key for the temporary credentials. * </p> * * @param secretAccessKey * The secret key for the temporary credentials. */ public void setSecretAccessKey(String secretAccessKey) { this.secretAccessKey = secretAccessKey; } /** * <p> * The secret key for the temporary credentials. * </p> * * @return The secret key for the temporary credentials. */ public String getSecretAccessKey() { return this.secretAccessKey; } /** * <p> * The secret key for the temporary credentials. * </p> * * @param secretAccessKey * The secret key for the temporary credentials. * @return Returns a reference to this object so that method calls can be chained together. */ public GetTemporaryGluePartitionCredentialsResult withSecretAccessKey(String secretAccessKey) { setSecretAccessKey(secretAccessKey); return this; } /** * <p> * The session token for the temporary credentials. * </p> * * @param sessionToken * The session token for the temporary credentials. */ public void setSessionToken(String sessionToken) { this.sessionToken = sessionToken; } /** * <p> * The session token for the temporary credentials. * </p> * * @return The session token for the temporary credentials. */ public String getSessionToken() { return this.sessionToken; } /** * <p> * The session token for the temporary credentials. * </p> * * @param sessionToken * The session token for the temporary credentials. * @return Returns a reference to this object so that method calls can be chained together. */ public GetTemporaryGluePartitionCredentialsResult withSessionToken(String sessionToken) { setSessionToken(sessionToken); return this; } /** * <p> * The date and time when the temporary credentials expire. * </p> * * @param expiration * The date and time when the temporary credentials expire. */ public void setExpiration(java.util.Date expiration) { this.expiration = expiration; } /** * <p> * The date and time when the temporary credentials expire. * </p> * * @return The date and time when the temporary credentials expire. */ public java.util.Date getExpiration() { return this.expiration; } /** * <p> * The date and time when the temporary credentials expire. * </p> * * @param expiration * The date and time when the temporary credentials expire. * @return Returns a reference to this object so that method calls can be chained together. */ public GetTemporaryGluePartitionCredentialsResult withExpiration(java.util.Date expiration) { setExpiration(expiration); return this; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getAccessKeyId() != null) sb.append("AccessKeyId: ").append(getAccessKeyId()).append(","); if (getSecretAccessKey() != null) sb.append("SecretAccessKey: ").append(getSecretAccessKey()).append(","); if (getSessionToken() != null) sb.append("SessionToken: ").append(getSessionToken()).append(","); if (getExpiration() != null) sb.append("Expiration: ").append(getExpiration()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof GetTemporaryGluePartitionCredentialsResult == false) return false; GetTemporaryGluePartitionCredentialsResult other = (GetTemporaryGluePartitionCredentialsResult) obj; if (other.getAccessKeyId() == null ^ this.getAccessKeyId() == null) return false; if (other.getAccessKeyId() != null && other.getAccessKeyId().equals(this.getAccessKeyId()) == false) return false; if (other.getSecretAccessKey() == null ^ this.getSecretAccessKey() == null) return false; if (other.getSecretAccessKey() != null && other.getSecretAccessKey().equals(this.getSecretAccessKey()) == false) return false; if (other.getSessionToken() == null ^ this.getSessionToken() == null) return false; if (other.getSessionToken() != null && other.getSessionToken().equals(this.getSessionToken()) == false) return false; if (other.getExpiration() == null ^ this.getExpiration() == null) return false; if (other.getExpiration() != null && other.getExpiration().equals(this.getExpiration()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getAccessKeyId() == null) ? 0 : getAccessKeyId().hashCode()); hashCode = prime * hashCode + ((getSecretAccessKey() == null) ? 0 : getSecretAccessKey().hashCode()); hashCode = prime * hashCode + ((getSessionToken() == null) ? 0 : getSessionToken().hashCode()); hashCode = prime * hashCode + ((getExpiration() == null) ? 0 : getExpiration().hashCode()); return hashCode; } @Override public GetTemporaryGluePartitionCredentialsResult clone() { try { return (GetTemporaryGluePartitionCredentialsResult) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } }
[ "" ]
7dd08ae9d9ec48d0da6a830ba52256452b3aace6
1d206ab19de221374d26a1ba2f9f1f70733d483b
/proposta-service/src/main/java/com/proposta/propostaservice/carteira/CarteiraRepository.java
41475ebfdb8581794d1e693526d14634388eefc2
[ "Apache-2.0" ]
permissive
ssimiao/orange-talents-03-template-proposta
6c9449d3e2774d2f736628f52f1a36bae5a2236d
67b224c570c3a833bc6fcf0ba7e631e2b71c9070
refs/heads/main
2023-04-12T23:30:12.777874
2021-04-26T10:30:03
2021-04-26T10:30:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
359
java
package com.proposta.propostaservice.carteira; import com.proposta.propostaservice.cartao.Cartao; import org.springframework.data.jpa.repository.JpaRepository; import java.util.Optional; public interface CarteiraRepository extends JpaRepository<Carteira,Long> { Optional<Carteira> findByCartaoAndPagamento(Cartao cartao, GatewayPagamento pagamento); }
[ "samusimiao@gmail.com" ]
samusimiao@gmail.com
43f37621b7eaf7db261180c3228e74d4a5d5a92f
c7c76c8dee09f85f8069f75c320f680815e7eef0
/app/src/main/java/com/video/aashi/school/adapters/animate/SideNavUtils.java
383aaeeb24ac3682c92a2fcfb718313dc231c566
[]
no_license
mohanarchu/School
954f57b0f60c48ed6d0264841068edda67f645b2
e85463201313fe95b27b0976d354a5b298e9a125
refs/heads/master
2020-04-03T18:55:56.947764
2019-04-29T06:44:41
2019-04-29T06:44:41
155,502,742
0
1
null
null
null
null
UTF-8
Java
false
false
296
java
package com.video.aashi.school.adapters.animate; /** * Created by yarolegovich on 25.03.2017. */ public abstract class SideNavUtils { public static float evaluate(float fraction, float startValue, float endValue) { return startValue + fraction * (endValue - startValue); } }
[ "43693193+mohanarchu@users.noreply.github.com" ]
43693193+mohanarchu@users.noreply.github.com
55301609149799e49e09aa117bbfb430adcce929
f0ed87a03eb17504a45fdabc952ab0692aabb2e8
/src/main/java/controladores/PlanoPagamentoControle.java
431b63aa418f9ba2b963727867b8061161b11264
[]
no_license
vcostee/tcc
79a58c791dd638d0818829d25dfcf2024a70e635
56c87967cf6694c16f0afa55880cb52c05c08087
refs/heads/master
2023-09-02T19:01:42.126687
2021-11-18T03:30:08
2021-11-18T03:30:08
423,180,055
0
0
null
null
null
null
UTF-8
Java
false
false
2,119
java
package controladores; import ENUM.TipoPlanoPagamento; import converter.ConverterGenerico; import entidades.PlanoPagamento; import facade.PlanoPagamentoFacade; import org.apache.deltaspike.core.api.scope.ViewAccessScoped; import javax.annotation.PostConstruct; import javax.inject.Inject; import javax.inject.Named; import java.io.Serializable; import java.util.List; @Named @ViewAccessScoped public class PlanoPagamentoControle implements Serializable { private PlanoPagamento planoPagamento ; @Inject transient private PlanoPagamentoFacade planoPagamentoFacade; private ConverterGenerico converterGenerico; @PostConstruct public void init(){ } public ConverterGenerico getPlanoPagamentoConverter() { if (converterGenerico == null) { converterGenerico = new ConverterGenerico(planoPagamentoFacade); } return converterGenerico; } public void setPlanoPagamentoConverter(ConverterGenerico converterGenerico) { this.converterGenerico = converterGenerico; } public List<PlanoPagamento> getListaFiltrando(String parte) { return planoPagamentoFacade.listaFiltrando(parte, "nome"); } public List<PlanoPagamento> getListaPlanoPagamento() { return planoPagamentoFacade.listaTodos(); } public void novo() { planoPagamento = new PlanoPagamento(); } public PlanoPagamento getPlanoPagamento() { return planoPagamento; } public void setPlanoPagamento(PlanoPagamento planoPagamento) { this.planoPagamento = planoPagamento; } public void editar(PlanoPagamento planoPagamento) { this.planoPagamento = planoPagamento; } public void excluir(PlanoPagamento planoPagamento) { planoPagamentoFacade.remover(planoPagamento); } public void salvar() { planoPagamentoFacade.salvar(planoPagamento); planoPagamento = null; } public TipoPlanoPagamento[] tiposPlano(){ return TipoPlanoPagamento.values(); } }
[ "vitor.cost.silva@gmail.com" ]
vitor.cost.silva@gmail.com
f6700b9414ca1eaa0809416c8373eca476931e40
a1a750bfdeaa9a8c840aa310549daba4c7dad3e5
/AddStrings.java
c4d3e11d92fee8bbb56a3fb5d11728fa6065b166
[]
no_license
sree09/KSQIT
2c2bc8f41ff70ce601dec67b32a694518b453aa3
8587782d22a5941c51560286457e86ee69ee2dd2
refs/heads/master
2021-05-11T07:27:23.039580
2018-01-19T16:53:59
2018-01-19T16:53:59
118,019,489
0
0
null
null
null
null
UTF-8
Java
false
false
806
java
import java.io.*; import java.util.*; import java.math.*; public class AddStrings{ public static void main(String []args){ Scanner s = new Scanner(System.in); String number1 = s.next(); String number2 = s.next(); int num1 = stringToint(number1); int num2 = stringToint(number2); int res = num1+num2; System.out.println(num2); System.out.println("The resultant string is "+res); } public static int stringToint(String str){ int i = 0,number = 0; int len = str.length(); while( i < len ){ number *= 10; number += ( str.charAt(i++) - '0' ); } return number; } } //TODO: validate for strings and minus values ' //TODO: Static blocks //TODO: package names
[ "35574144+sree09@users.noreply.github.com" ]
35574144+sree09@users.noreply.github.com