blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
sequencelengths
1
1
author_id
stringlengths
0
313
0ff8a98125d022cd875b389bd709324ac9d4092c
6bd60729d32540828f888a2c88ba0f7e91fcc2c4
/Android/CS8803-Mobile-Appplications-and-Services/app/src/main/java/com/jluo80/amazinggifter/model/Gift.java
3937aeddab65c45762f682f589d3a384d2a2d105
[]
no_license
TongzheZhang/CodeWork
2dcd41efad673e60dad519290c311b5edec10eb0
8934f7d4645b2555a9f85ebb36a75c7bb3cdc211
refs/heads/master
2020-06-29T13:26:41.028747
2018-05-07T02:11:13
2018-05-07T02:11:13
74,423,259
1
0
null
null
null
null
UTF-8
Java
false
false
3,160
java
package com.jluo80.amazinggifter.model; /** * Created by Jiahao on 7/2/2016. */ public class Gift { private String unique_key; private String category; private String due_date; private String initiator_id; private String item_id; private String item_url; private String name; private String picture_url; private String post_time; private double price; private double progress; private String reason; private String receiver_id; public Gift() {} public Gift(String category, String due_date, String initiator_id, String item_id, String item_url, String name, String picture_url, String post_time, double price, double progress, String reason, String receiver_id) { this.category = category; this.due_date = due_date; this.initiator_id = initiator_id; this.item_id = item_id; this.item_url = item_url; this.name = name; this.picture_url = picture_url; this.post_time = post_time; this.price = price; this.progress = progress; this.reason = reason; this.receiver_id = receiver_id; } public String getUnique_key() { return unique_key; } public void setUnique_key(String unique_key) { this.unique_key = unique_key; } public String getCategory() { return category; } public void setCategory(String category) { this.category = category; } public String getDue_date() { return due_date; } public void setDue_date(String due_date) { this.due_date = due_date; } public String getInitiator_id() { return initiator_id; } public void setInitiator_id(String initiator_id) { this.initiator_id = initiator_id; } public String getItem_id() { return item_id; } public void setItem_id(String item_id) { this.item_id = item_id; } public String getItem_url(){ return item_url; } public void setItem_url(String item_url){ this.item_url = item_url; } public String getName(){ return name; } public void setName(String name){ this.name = name; } public String getPicture_url(){ return picture_url; } public void setPicture_url(String picture_url){ this.picture_url = picture_url; } public String getPost_time() { return post_time; } public void setPost_time(String post_time) { this.post_time = post_time; } public double getPrice(){ return price; } public void setPrice(double price){ this.price = price; } public double getProgress() { return progress; } public void setProgress(double progress) { this.progress = progress; } public String getReason() { return reason; } public void setReason(String reason) { this.reason = reason; } public String getReceiver_id() { return receiver_id; } public void setReceiver_id(String receiver_id) { this.receiver_id = receiver_id; } }
45f3293a3e53166b6bfe6758afa031f40f94cc67
0a826107a0cc2af2a76fdf21a123bf675b781af5
/src/com/p1/mobile/p1android/ui/listeners/OnViewMeasuredListener.java
8d7d0c786d42a5d7472ba097cfb681a86fe3b368
[ "Apache-2.0" ]
permissive
cuipengpeng/p1-android
a8855b44d14f4d047694c30d272c07fde3d91694
60b3d6c06bc02a223590bc694889da8e55b62219
refs/heads/master
2021-01-15T11:48:51.290257
2013-08-07T08:37:23
2013-08-07T08:37:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
264
java
package com.p1.mobile.p1android.ui.listeners; public interface OnViewMeasuredListener { /** * This method is generally called multiple times. It should doublecheck with old values or only contain light logic. */ public void onViewMeasured(); }
c422774191a75d30859a3704c7608a8422e52b76
b493cc74e82640b8518548e8cfc7c489d22ab814
/src/main/java/com/grich/hsnp/model/user/VlabUser.java
2d5ee66ca5e22607f897fc127c353f522f1cfc47
[]
no_license
haigemsa/NETTY-HSNP
79c546b76792b2ba7ec4c60290dd3eeef8496ac2
c668b43eb65619061b798c3cb2e9434f9e12d148
refs/heads/master
2023-07-01T13:21:03.051952
2021-08-01T15:30:18
2021-08-01T15:30:18
389,393,910
1
0
null
null
null
null
UTF-8
Java
false
false
2,919
java
package com.grich.hsnp.model.user; import com.fasterxml.jackson.annotation.JsonIgnore; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.util.Date; import javax.persistence.*; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; /** * Created by Mybatis Generator on 2020/05/11 * @author William */ @Data @Builder @NoArgsConstructor @AllArgsConstructor public class VlabUser { /** * 用户ID(UUID) */ @Id @ApiModelProperty("用户ID(UUID)") private String id; /** * 昵称 */ @ApiModelProperty("昵称") private String nickName; /** * 微信用户唯一标识 */ @JsonIgnore @ApiModelProperty("微信用户唯一标识") private String openId; /** * 微信会话密钥 */ @JsonIgnore @ApiModelProperty(value = "微信会话密钥",hidden = true) private String sessionKey; /** * 密码 */ @ApiModelProperty(value ="密码",hidden = true) @JsonIgnore private String password; /** * 真实姓名 */ @ApiModelProperty("真实姓名") private String realname; /** * 身份证号码 */ @ApiModelProperty(value = "身份证号码",hidden = true) @JsonIgnore private String idCard; /** * 账户余额 */ @ApiModelProperty(value = "账户余额") private BigDecimal balance; /** * 手机号 */ @ApiModelProperty("手机号") private String mobile; /** * 头像 */ @Column(name = "head_image_url") @ApiModelProperty("头像") private String headImageUrl; /** * 出生年月日 */ @ApiModelProperty("出生年月日") private String birthdate; /** * 用户类别:0 - 普通用户;1 - 管理员用户 */ @ApiModelProperty("用户类别:0 - 普通用户;1 - 管理员用户") private Integer userType; /** * 性别:0 - 女;1 - 男 */ @ApiModelProperty("性别:0 - 女;1 - 男") private Integer sex; /** * 状态:0 - 已删除;1 - 正常, 2 - 锁定 */ @ApiModelProperty("状态:0 - 已删除;1 - 正常, 2 - 锁定") private Integer status; /** * 邮箱 */ @ApiModelProperty("邮箱") private String email; /** * 备注 */ @ApiModelProperty("备注") private String remark; /** * 创建时间 */ @Column(name = "create_time") @ApiModelProperty("创建时间") private Date createTime; /** * 更新时间 */ @Column(name = "update_time") @ApiModelProperty("更新时间") private Date updateTime; /** * 上次登录时间 */ @Column(name = "last_login_time") @ApiModelProperty("上次登录时间") private Date lastLoginTime; }
db0e312ab80172784d983dda3ccb1de1f3e7d59b
05c69e981dc513f72c06c8bdeeeba1cd574f1ffc
/Programmr/Strings/sumNumber_Completed/Challenge.java
92c7b30446075d26830c33f0218281033a1bda6d
[]
no_license
Koaja/Programmr
90316963a60027a241ad1c01c4ba48443d5145d0
6cd268501179f0e23b4ec718fffa136af52732c6
refs/heads/master
2021-01-18T22:09:20.664522
2016-06-15T12:57:33
2016-06-15T12:57:33
46,869,453
0
0
null
null
null
null
UTF-8
Java
false
false
590
java
package sumNumber_Completed; import java.util.Scanner; class Challenge { public static void main(String args[]) { Scanner scanner = new Scanner(System.in); System.out.println("Enter a string:"); String string = scanner.nextLine(); System.out.println("Sum:" + sumNumbers(string)); } /// {write your code here public static int sumNumbers(String str) { String[] array = str.split("[a-zA-Z]"); int sum = 0; for (int i = 0; i < array.length; i++) { try { sum += Integer.parseInt(array[i]); } catch (NumberFormatException e) { } } return sum; } /// } }
654e6fc2a21dca741f34fab1ded5b14b74a95a27
60b3aa0ae501058f26326b77bc5292e1c3a72859
/ClassDemo/genericTest/src/genericTest/InterImpl2.java
23d7859a0c85757ac577d1436c5a22ccd677ce65
[]
no_license
puyanLiu/javaAndAndroidDemo
36ea3538ded86be3ad70202f09276e324b4ba173
b4c1b8623f6c25fb80c4a1f405c9664f5b399baa
refs/heads/master
2021-09-28T20:12:23.145754
2018-11-20T02:33:13
2018-11-20T02:33:13
null
0
0
null
null
null
null
UTF-8
Java
false
false
210
java
package genericTest; /** * @author liupuyan * 还不确定什么类型 * @param <T> */ public class InterImpl2<T> implements Inter<T> { @Override public void show(T t) { System.out.println(t); } }
876082bafa495f19eefbee2f75bcc9ca70db81ab
0712d8fc8ed8d967888a7a98d152dc48ce8a2033
/3bgogiOpera/src/main/java/com/gogi/proj/orders/vo/IrregularOrderVO.java
05ac99dc40773e60d98e112565217e041fd9ccde
[]
no_license
CptgodKi/3bgogiShereOpera
f1ec0fd745cd905ae27ca59b07a892650f0fa51d
d4c26c1a9ebd2610f7cc2e37e499325b39104bcb
refs/heads/master
2023-08-29T16:14:35.271703
2021-11-01T07:53:24
2021-11-01T07:53:24
289,178,114
0
0
null
null
null
null
UTF-8
Java
false
false
2,164
java
package com.gogi.proj.orders.vo; import java.sql.Timestamp; //주문서 입력 후 구매자 체크사항 public class IrregularOrderVO { private int iroPk; //고유값 private int ssFk; // 스토어 구분 private String iroName; //구매자명 private String iroPhoneNumber; //구매자 핸드폰 번호 private String iroDetail; //확인 할 사항 private boolean iroFlag; //확인 여부 private Timestamp iroRegdate; //등록일 public IrregularOrderVO() { super(); // TODO Auto-generated constructor stub } public IrregularOrderVO(int iroPk, int ssFk, String iroName, String iroPhoneNumber, String iroDetail, boolean iroFlag, Timestamp iroRegdate) { super(); this.iroPk = iroPk; this.ssFk = ssFk; this.iroName = iroName; this.iroPhoneNumber = iroPhoneNumber; this.iroDetail = iroDetail; this.iroFlag = iroFlag; this.iroRegdate = iroRegdate; } public int getIroPk() { return iroPk; } public void setIroPk(int iroPk) { this.iroPk = iroPk; } public int getSsFk() { return ssFk; } public void setSsFk(int ssFk) { this.ssFk = ssFk; } public String getIroName() { return iroName; } public void setIroName(String iroName) { this.iroName = iroName; } public String getIroPhoneNumber() { return iroPhoneNumber; } public void setIroPhoneNumber(String iroPhoneNumber) { this.iroPhoneNumber = iroPhoneNumber; } public String getIroDetail() { return iroDetail; } public void setIroDetail(String iroDetail) { this.iroDetail = iroDetail; } public boolean isIroFlag() { return iroFlag; } public void setIroFlag(boolean iroFlag) { this.iroFlag = iroFlag; } public Timestamp getIroRegdate() { return iroRegdate; } public void setIroRegdate(Timestamp iroRegdate) { this.iroRegdate = iroRegdate; } @Override public String toString() { return "IrregularOrderVO [iroPk=" + iroPk + ", ssFk=" + ssFk + ", iroName=" + iroName + ", iroPhoneNumber=" + iroPhoneNumber + ", iroDetail=" + iroDetail + ", iroFlag=" + iroFlag + ", iroRegdate=" + iroRegdate + "]"; } }
f0de830f938e51d0d41b26873d2e0ac4e78cf34b
a1d39b88c346b00dfeb4506e9a7a863f879eb53d
/src/com/leetcode/LRUCache.java
8c9be17bc4a3380ba306da5c581b84378542d72f
[]
no_license
xiaohanchen/AlgorithmTraining
09c3ea6baff4dac6bb47bac1bdf4be136cb6c7e7
19e83da3df413a2ec4e4816fe261c0d8681460dc
refs/heads/master
2021-09-14T05:54:35.119408
2018-05-08T23:42:27
2018-05-08T23:42:27
114,456,063
0
0
null
null
null
null
UTF-8
Java
false
false
1,280
java
package com.leetcode; public class LRUCache { //age of DLinkedNode head; DLinkedNode tail; int capacity; int count; public LRUCache(int capacity) { this.capacity = capacity; this.count = 0; } public int get(int key) { return -1; } public void put(int key, int value) { } class DLinkedNode { int key; int value; DLinkedNode pre; DLinkedNode post; } /** * Always add the new node right after head; */ private void addNode(DLinkedNode node){ node.pre = head; node.post = head.post; head.post.pre = node; head.post = node; } /** * Remove an existing node from the linked list. */ private void removeNode(DLinkedNode node){ DLinkedNode pre = node.pre; DLinkedNode post = node.post; pre.post = post; post.pre = pre; } /** * Move certain node in between to the head. */ private void moveToHead(DLinkedNode node){ this.removeNode(node); this.addNode(node); } // pop the current tail. private DLinkedNode popTail(){ DLinkedNode res = tail.pre; this.removeNode(res); return res; } }
b65079921032377a93d30e24846c18157d8de3e9
b2fc3c814bbff3c3820b4033231a560ec0ec930d
/Vinculacion I-E/Proceso vinculacion I-E/src/main/java/Domain/Converters/CriteriosAdapter.java
e8eed50c7d7c85e4fdc4593b969a89c43d8c22b1
[]
no_license
dprez8/GestionDeContabilidad
9a8304880ca4c61ac286a9562a98db440f99f379
e44882dcc3a353d11c6323eae9b1fefe6bc93ae5
refs/heads/master
2023-02-11T12:41:55.931756
2021-01-08T02:45:05
2021-01-08T02:45:05
327,776,760
0
0
null
null
null
null
UTF-8
Java
false
false
1,976
java
package Domain.Converters; import Domain.Entities.Criterios.*; import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonToken; import com.google.gson.stream.JsonWriter; import java.io.IOException; import java.util.ArrayList; import java.util.List; public class CriteriosAdapter extends TypeAdapter<Criterio> { @Override public void write(final JsonWriter jsonWriter, final Criterio criterio ) throws IOException { } @Override public Criterio read( final JsonReader jsonReader ) throws IOException { JsonToken token = jsonReader.peek(); if(token.equals(JsonToken.STRING)) { // Nos llego un solo criterio String criterioString = jsonReader.nextString(); CriterioUnico criterioUnico = criterioFromString(criterioString); return criterioUnico; } else if(token.equals(JsonToken.BEGIN_ARRAY)) { // Nos llego varios criterios, por lo tanto MIX List<CriterioUnico> criterioList = new ArrayList<>(); jsonReader.beginArray(); while(!token.equals(JsonToken.END_ARRAY)) { String criterioString = jsonReader.nextString(); criterioList.add(criterioFromString(criterioString)); token = jsonReader.peek(); } jsonReader.endArray(); Mix criterioMix = new Mix(); criterioMix.setCriteriosUnicos(criterioList); return criterioMix; } return null; } public CriterioUnico criterioFromString(String string) { CriterioUnico criterio = null; switch (string) { case "OrdenValorPrimeroEgreso": criterio = new OrdenValorPrimeroEgreso(); break; case "OrdenValorPrimeroIngreso": criterio = new OrdenValorPrimeroIngreso(); break; case "Fecha": criterio = new Fecha(); break; } return criterio; } }
8cc32d42a5ad5ae4776ec97cf82ec8a6807ad642
1f0be937904dec7b51c6de99a3cc58ab0da35e81
/portlet/catalog/catalog-portlet-service/src/main/java/org/nterlearning/datamodel/catalog/service/ExternalLinkLocalServiceClp.java
94b25bf069f8177495af93f83571e79b12425cbe
[]
no_license
sbreidba/nter.portal-core-devel
032b5ee0f918e3d662db1e5d2c1e6f412853003b
1900a8e6122d63c1eff81a0bbf1c83d62e603cc7
refs/heads/master
2022-08-20T15:00:13.207226
2014-01-31T20:17:01
2014-01-31T20:17:01
37,631,560
0
0
null
2022-03-21T20:31:16
2015-06-18T01:56:54
Java
UTF-8
Java
false
false
26,453
java
package org.nterlearning.datamodel.catalog.service; import com.liferay.portal.kernel.util.ClassLoaderProxy; import com.liferay.portal.kernel.util.MethodHandler; import com.liferay.portal.kernel.util.MethodKey; public class ExternalLinkLocalServiceClp implements ExternalLinkLocalService { private ClassLoaderProxy _classLoaderProxy; private MethodKey _addExternalLinkMethodKey0; private MethodKey _createExternalLinkMethodKey1; private MethodKey _deleteExternalLinkMethodKey2; private MethodKey _deleteExternalLinkMethodKey3; private MethodKey _dynamicQueryMethodKey4; private MethodKey _dynamicQueryMethodKey5; private MethodKey _dynamicQueryMethodKey6; private MethodKey _dynamicQueryCountMethodKey7; private MethodKey _fetchExternalLinkMethodKey8; private MethodKey _getExternalLinkMethodKey9; private MethodKey _getPersistedModelMethodKey10; private MethodKey _getExternalLinksMethodKey11; private MethodKey _getExternalLinksCountMethodKey12; private MethodKey _updateExternalLinkMethodKey13; private MethodKey _updateExternalLinkMethodKey14; private MethodKey _getBeanIdentifierMethodKey15; private MethodKey _setBeanIdentifierMethodKey16; private MethodKey _findByCourseIdMethodKey17; private MethodKey _findByCourseIdWithTypeMethodKey18; private MethodKey _findByComponentIdMethodKey19; private MethodKey _findByComponentIdWithTypeMethodKey20; public ExternalLinkLocalServiceClp(ClassLoaderProxy classLoaderProxy) { _classLoaderProxy = classLoaderProxy; _addExternalLinkMethodKey0 = new MethodKey(_classLoaderProxy.getClassName(), "addExternalLink", org.nterlearning.datamodel.catalog.model.ExternalLink.class); _createExternalLinkMethodKey1 = new MethodKey(_classLoaderProxy.getClassName(), "createExternalLink", long.class); _deleteExternalLinkMethodKey2 = new MethodKey(_classLoaderProxy.getClassName(), "deleteExternalLink", long.class); _deleteExternalLinkMethodKey3 = new MethodKey(_classLoaderProxy.getClassName(), "deleteExternalLink", org.nterlearning.datamodel.catalog.model.ExternalLink.class); _dynamicQueryMethodKey4 = new MethodKey(_classLoaderProxy.getClassName(), "dynamicQuery", com.liferay.portal.kernel.dao.orm.DynamicQuery.class); _dynamicQueryMethodKey5 = new MethodKey(_classLoaderProxy.getClassName(), "dynamicQuery", com.liferay.portal.kernel.dao.orm.DynamicQuery.class, int.class, int.class); _dynamicQueryMethodKey6 = new MethodKey(_classLoaderProxy.getClassName(), "dynamicQuery", com.liferay.portal.kernel.dao.orm.DynamicQuery.class, int.class, int.class, com.liferay.portal.kernel.util.OrderByComparator.class); _dynamicQueryCountMethodKey7 = new MethodKey(_classLoaderProxy.getClassName(), "dynamicQueryCount", com.liferay.portal.kernel.dao.orm.DynamicQuery.class); _fetchExternalLinkMethodKey8 = new MethodKey(_classLoaderProxy.getClassName(), "fetchExternalLink", long.class); _getExternalLinkMethodKey9 = new MethodKey(_classLoaderProxy.getClassName(), "getExternalLink", long.class); _getPersistedModelMethodKey10 = new MethodKey(_classLoaderProxy.getClassName(), "getPersistedModel", java.io.Serializable.class); _getExternalLinksMethodKey11 = new MethodKey(_classLoaderProxy.getClassName(), "getExternalLinks", int.class, int.class); _getExternalLinksCountMethodKey12 = new MethodKey(_classLoaderProxy.getClassName(), "getExternalLinksCount"); _updateExternalLinkMethodKey13 = new MethodKey(_classLoaderProxy.getClassName(), "updateExternalLink", org.nterlearning.datamodel.catalog.model.ExternalLink.class); _updateExternalLinkMethodKey14 = new MethodKey(_classLoaderProxy.getClassName(), "updateExternalLink", org.nterlearning.datamodel.catalog.model.ExternalLink.class, boolean.class); _getBeanIdentifierMethodKey15 = new MethodKey(_classLoaderProxy.getClassName(), "getBeanIdentifier"); _setBeanIdentifierMethodKey16 = new MethodKey(_classLoaderProxy.getClassName(), "setBeanIdentifier", java.lang.String.class); _findByCourseIdMethodKey17 = new MethodKey(_classLoaderProxy.getClassName(), "findByCourseId", java.lang.Long.class); _findByCourseIdWithTypeMethodKey18 = new MethodKey(_classLoaderProxy.getClassName(), "findByCourseIdWithType", java.lang.Long.class, java.lang.String.class); _findByComponentIdMethodKey19 = new MethodKey(_classLoaderProxy.getClassName(), "findByComponentId", java.lang.Long.class); _findByComponentIdWithTypeMethodKey20 = new MethodKey(_classLoaderProxy.getClassName(), "findByComponentIdWithType", java.lang.Long.class, java.lang.String.class); } public org.nterlearning.datamodel.catalog.model.ExternalLink addExternalLink( org.nterlearning.datamodel.catalog.model.ExternalLink externalLink) throws com.liferay.portal.kernel.exception.SystemException { Object returnObj = null; MethodHandler methodHandler = new MethodHandler(_addExternalLinkMethodKey0, ClpSerializer.translateInput(externalLink)); try { returnObj = _classLoaderProxy.invoke(methodHandler); } catch (Throwable 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 (org.nterlearning.datamodel.catalog.model.ExternalLink) ClpSerializer.translateOutput(returnObj); } public org.nterlearning.datamodel.catalog.model.ExternalLink createExternalLink( long linkId) { Object returnObj = null; MethodHandler methodHandler = new MethodHandler(_createExternalLinkMethodKey1, linkId); try { returnObj = _classLoaderProxy.invoke(methodHandler); } catch (Throwable t) { if (t instanceof RuntimeException) { throw (RuntimeException) t; } else { throw new RuntimeException(t.getClass().getName() + " is not a valid exception"); } } return (org.nterlearning.datamodel.catalog.model.ExternalLink) ClpSerializer.translateOutput(returnObj); } public void deleteExternalLink(long linkId) throws com.liferay.portal.kernel.exception.PortalException, com.liferay.portal.kernel.exception.SystemException { MethodHandler methodHandler = new MethodHandler(_deleteExternalLinkMethodKey2, linkId); try { _classLoaderProxy.invoke(methodHandler); } catch (Throwable 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"); } } } public void deleteExternalLink( org.nterlearning.datamodel.catalog.model.ExternalLink externalLink) throws com.liferay.portal.kernel.exception.SystemException { MethodHandler methodHandler = new MethodHandler(_deleteExternalLinkMethodKey3, ClpSerializer.translateInput(externalLink)); try { _classLoaderProxy.invoke(methodHandler); } catch (Throwable 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"); } } } @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; MethodHandler methodHandler = new MethodHandler(_dynamicQueryMethodKey4, ClpSerializer.translateInput(dynamicQuery)); try { returnObj = _classLoaderProxy.invoke(methodHandler); } catch (Throwable 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); } @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; MethodHandler methodHandler = new MethodHandler(_dynamicQueryMethodKey5, ClpSerializer.translateInput(dynamicQuery), start, end); try { returnObj = _classLoaderProxy.invoke(methodHandler); } catch (Throwable 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); } @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; MethodHandler methodHandler = new MethodHandler(_dynamicQueryMethodKey6, ClpSerializer.translateInput(dynamicQuery), start, end, ClpSerializer.translateInput(orderByComparator)); try { returnObj = _classLoaderProxy.invoke(methodHandler); } catch (Throwable 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); } public long dynamicQueryCount( com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery) throws com.liferay.portal.kernel.exception.SystemException { Object returnObj = null; MethodHandler methodHandler = new MethodHandler(_dynamicQueryCountMethodKey7, ClpSerializer.translateInput(dynamicQuery)); try { returnObj = _classLoaderProxy.invoke(methodHandler); } catch (Throwable 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(); } public org.nterlearning.datamodel.catalog.model.ExternalLink fetchExternalLink( long linkId) throws com.liferay.portal.kernel.exception.SystemException { Object returnObj = null; MethodHandler methodHandler = new MethodHandler(_fetchExternalLinkMethodKey8, linkId); try { returnObj = _classLoaderProxy.invoke(methodHandler); } catch (Throwable 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 (org.nterlearning.datamodel.catalog.model.ExternalLink) ClpSerializer.translateOutput(returnObj); } public org.nterlearning.datamodel.catalog.model.ExternalLink getExternalLink( long linkId) throws com.liferay.portal.kernel.exception.PortalException, com.liferay.portal.kernel.exception.SystemException { Object returnObj = null; MethodHandler methodHandler = new MethodHandler(_getExternalLinkMethodKey9, linkId); try { returnObj = _classLoaderProxy.invoke(methodHandler); } catch (Throwable 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 (org.nterlearning.datamodel.catalog.model.ExternalLink) ClpSerializer.translateOutput(returnObj); } 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; MethodHandler methodHandler = new MethodHandler(_getPersistedModelMethodKey10, ClpSerializer.translateInput(primaryKeyObj)); try { returnObj = _classLoaderProxy.invoke(methodHandler); } catch (Throwable 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); } public java.util.List<org.nterlearning.datamodel.catalog.model.ExternalLink> getExternalLinks( int start, int end) throws com.liferay.portal.kernel.exception.SystemException { Object returnObj = null; MethodHandler methodHandler = new MethodHandler(_getExternalLinksMethodKey11, start, end); try { returnObj = _classLoaderProxy.invoke(methodHandler); } catch (Throwable 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<org.nterlearning.datamodel.catalog.model.ExternalLink>) ClpSerializer.translateOutput(returnObj); } public int getExternalLinksCount() throws com.liferay.portal.kernel.exception.SystemException { Object returnObj = null; MethodHandler methodHandler = new MethodHandler(_getExternalLinksCountMethodKey12); try { returnObj = _classLoaderProxy.invoke(methodHandler); } catch (Throwable 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(); } public org.nterlearning.datamodel.catalog.model.ExternalLink updateExternalLink( org.nterlearning.datamodel.catalog.model.ExternalLink externalLink) throws com.liferay.portal.kernel.exception.SystemException { Object returnObj = null; MethodHandler methodHandler = new MethodHandler(_updateExternalLinkMethodKey13, ClpSerializer.translateInput(externalLink)); try { returnObj = _classLoaderProxy.invoke(methodHandler); } catch (Throwable 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 (org.nterlearning.datamodel.catalog.model.ExternalLink) ClpSerializer.translateOutput(returnObj); } public org.nterlearning.datamodel.catalog.model.ExternalLink updateExternalLink( org.nterlearning.datamodel.catalog.model.ExternalLink externalLink, boolean merge) throws com.liferay.portal.kernel.exception.SystemException { Object returnObj = null; MethodHandler methodHandler = new MethodHandler(_updateExternalLinkMethodKey14, ClpSerializer.translateInput(externalLink), merge); try { returnObj = _classLoaderProxy.invoke(methodHandler); } catch (Throwable 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 (org.nterlearning.datamodel.catalog.model.ExternalLink) ClpSerializer.translateOutput(returnObj); } public java.lang.String getBeanIdentifier() { Object returnObj = null; MethodHandler methodHandler = new MethodHandler(_getBeanIdentifierMethodKey15); try { returnObj = _classLoaderProxy.invoke(methodHandler); } catch (Throwable 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); } public void setBeanIdentifier(java.lang.String beanIdentifier) { MethodHandler methodHandler = new MethodHandler(_setBeanIdentifierMethodKey16, ClpSerializer.translateInput(beanIdentifier)); try { _classLoaderProxy.invoke(methodHandler); } catch (Throwable t) { if (t instanceof RuntimeException) { throw (RuntimeException) t; } else { throw new RuntimeException(t.getClass().getName() + " is not a valid exception"); } } } public java.util.List<org.nterlearning.datamodel.catalog.model.ExternalLink> findByCourseId( java.lang.Long courseId) throws com.liferay.portal.kernel.exception.SystemException { Object returnObj = null; MethodHandler methodHandler = new MethodHandler(_findByCourseIdMethodKey17, ClpSerializer.translateInput(courseId)); try { returnObj = _classLoaderProxy.invoke(methodHandler); } catch (Throwable 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<org.nterlearning.datamodel.catalog.model.ExternalLink>) ClpSerializer.translateOutput(returnObj); } public java.util.List<org.nterlearning.datamodel.catalog.model.ExternalLink> findByCourseIdWithType( java.lang.Long courseId, java.lang.String type) throws com.liferay.portal.kernel.exception.SystemException { Object returnObj = null; MethodHandler methodHandler = new MethodHandler(_findByCourseIdWithTypeMethodKey18, ClpSerializer.translateInput(courseId), ClpSerializer.translateInput(type)); try { returnObj = _classLoaderProxy.invoke(methodHandler); } catch (Throwable 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<org.nterlearning.datamodel.catalog.model.ExternalLink>) ClpSerializer.translateOutput(returnObj); } public java.util.List<org.nterlearning.datamodel.catalog.model.ExternalLink> findByComponentId( java.lang.Long componentId) throws com.liferay.portal.kernel.exception.SystemException { Object returnObj = null; MethodHandler methodHandler = new MethodHandler(_findByComponentIdMethodKey19, ClpSerializer.translateInput(componentId)); try { returnObj = _classLoaderProxy.invoke(methodHandler); } catch (Throwable 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<org.nterlearning.datamodel.catalog.model.ExternalLink>) ClpSerializer.translateOutput(returnObj); } public java.util.List<org.nterlearning.datamodel.catalog.model.ExternalLink> findByComponentIdWithType( java.lang.Long componentId, java.lang.String type) throws com.liferay.portal.kernel.exception.SystemException { Object returnObj = null; MethodHandler methodHandler = new MethodHandler(_findByComponentIdWithTypeMethodKey20, ClpSerializer.translateInput(componentId), ClpSerializer.translateInput(type)); try { returnObj = _classLoaderProxy.invoke(methodHandler); } catch (Throwable 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<org.nterlearning.datamodel.catalog.model.ExternalLink>) ClpSerializer.translateOutput(returnObj); } public ClassLoaderProxy getClassLoaderProxy() { return _classLoaderProxy; } }
[ "l.moulder.sri@localhost" ]
l.moulder.sri@localhost
f3eb7957973fe2a1e097b48aa65e607704325619
9a7eb90b964835399d47d58e71bca8ad3ef7fb84
/GraficoBasico/src/ejercicio_3/MiniEncuestaApp.java
dcd7aa3637838ec15736234cb5db63b5cf1348a6
[]
no_license
abmedinas/Expo_prueba
71fbfc1044ed6075d7e519700a1561b3e261f36c
9e1860af242d44954393b146f34d45b3d94b8980
refs/heads/master
2020-09-25T14:01:35.657447
2019-12-06T00:03:02
2019-12-06T00:03:02
226,018,778
0
0
null
null
null
null
UTF-8
Java
false
false
11,537
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 ejercicio_3; import javax.swing.ButtonGroup; import javax.swing.JCheckBox; import javax.swing.JOptionPane; import javax.swing.JRadioButton; /** * @author DiscoDurodeRoer */ public class MiniEncuestaApp extends javax.swing.JFrame { public MiniEncuestaApp() { initComponents(); //Creamos una instacia de ButtonGroup ButtonGroup btg=new ButtonGroup(); //Añadimos los botones radiobutton //Si no lo hacemos, los botones seran independientes btg.add(btnWindows); btg.add(btnLinux); btg.add(btnMac); } @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { btnWindows = new javax.swing.JRadioButton(); btnLinux = new javax.swing.JRadioButton(); btnMac = new javax.swing.JRadioButton(); jLabel1 = new javax.swing.JLabel(); ckbProgramacion = new javax.swing.JCheckBox(); jLabel2 = new javax.swing.JLabel(); ckbDiseno = new javax.swing.JCheckBox(); ckbAdministracion = new javax.swing.JCheckBox(); jSeparator1 = new javax.swing.JSeparator(); btnGenerar = new javax.swing.JButton(); jSeparator2 = new javax.swing.JSeparator(); jlHoras = new javax.swing.JSlider(); jLabel3 = new javax.swing.JLabel(); lblHoras = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("Mini Encuesta"); btnWindows.setText("Windows"); btnLinux.setText("Linux"); btnMac.setText("Mac"); jLabel1.setText("Elige un sistema operativo"); ckbProgramacion.setText("Programación"); jLabel2.setText("Elige tu especialidad"); ckbDiseno.setText("Diseño gráfico"); ckbAdministracion.setText("Administración"); btnGenerar.setText("Generar"); btnGenerar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnGenerarActionPerformed(evt); } }); jlHoras.setMaximum(10); jlHoras.setValue(0); jlHoras.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { jlHorasStateChanged(evt); } }); jLabel3.setText("Horas que dedicas en el ordenador"); lblHoras.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); lblHoras.setText("0"); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(66, 66, 66) .addComponent(btnGenerar) .addGap(0, 0, Short.MAX_VALUE)) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(22, 22, 22) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(ckbProgramacion) .addComponent(jLabel2) .addComponent(ckbAdministracion) .addComponent(ckbDiseno) .addComponent(jLabel3) .addComponent(jLabel1) .addComponent(btnLinux) .addComponent(btnMac) .addComponent(btnWindows))) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(lblHoras, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jlHoras, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 189, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 188, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(37, 37, 37) .addComponent(jLabel1) .addGap(18, 18, 18) .addComponent(btnWindows) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(btnLinux) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(btnMac) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel2) .addGap(13, 13, 13) .addComponent(ckbProgramacion) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(ckbDiseno) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(ckbAdministracion) .addGap(19, 19, 19) .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 11, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel3) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jlHoras, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 1, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lblHoras, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(18, 18, 18) .addComponent(btnGenerar) .addContainerGap(21, Short.MAX_VALUE)) ); pack(); setLocationRelativeTo(null); }// </editor-fold>//GEN-END:initComponents private void btnGenerarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGenerarActionPerformed String informacion="Tu sistema operativo favorito es: "; //Cogemos todos los radiobutton en un array JRadioButton[] rdbs={btnWindows, btnLinux, btnMac}; for(int i=0;i<rdbs.length;i++){ //Si esta seleccionado, coge el texto if(rdbs[i].isSelected()){ informacion+=rdbs[i].getText(); } } //Hacemos igual con los checkboxes JCheckBox[] ckbs={ckbProgramacion, ckbDiseno, ckbAdministracion}; informacion+=", \nTu especialidad es: "; for(int i=0;i<ckbs.length;i++){ if(ckbs[i].isSelected()){ informacion+=ckbs[i].getText()+" "; } } informacion+=" \n El numero de horas que dedicas al ordenador es: "+jlHoras.getValue(); JOptionPane.showMessageDialog(this, informacion, "Muestra de datos", JOptionPane.INFORMATION_MESSAGE); }//GEN-LAST:event_btnGenerarActionPerformed private void jlHorasStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jlHorasStateChanged lblHoras.setText(String.valueOf(jlHoras.getValue())); }//GEN-LAST:event_jlHorasStateChanged /** * @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(MiniEncuestaApp.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(MiniEncuestaApp.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(MiniEncuestaApp.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(MiniEncuestaApp.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 MiniEncuestaApp().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnGenerar; private javax.swing.JRadioButton btnLinux; private javax.swing.JRadioButton btnMac; private javax.swing.JRadioButton btnWindows; private javax.swing.JCheckBox ckbAdministracion; private javax.swing.JCheckBox ckbDiseno; private javax.swing.JCheckBox ckbProgramacion; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JSeparator jSeparator1; private javax.swing.JSeparator jSeparator2; private javax.swing.JSlider jlHoras; private javax.swing.JLabel lblHoras; // End of variables declaration//GEN-END:variables }
5506b24df155ae7c3703874f09a39a5db740cafb
ff3ac89fe8c02b64eadd4049fe4f1aee41297963
/buri-core-test/src/test/java/org/escafe/buri/engine/processor/impl/NadejyakoBuriTest.java
36201f4430b6d90483d3b76dbda86f589d297e79
[]
no_license
seasarorg/s2buri
9402125ade5b4d7c38f2a766dd468a5556356922
fbaf32dd3ec2a815dfe3f4426f10d6b0ce53547d
refs/heads/master
2021-01-23T07:15:30.961379
2013-10-04T05:03:42
2013-10-04T05:03:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,541
java
package org.escafe.buri.engine.processor.impl; import java.math.BigDecimal; import java.util.Date; import org.escafe.buri.engine.BuriEngine; import org.escafe.buri.engine.processor.BuriProcessorInfo; import org.escafe.buri.engine.processor.SimpleBuriProcessor; import org.escafe.buri.entity.AcquisitionType; import org.escafe.buri.entity.FurnitureItem; import org.seasar.extension.unit.S2TestCase; public class NadejyakoBuriTest extends S2TestCase { private final String PATH = "buri/dicon/buriSimple.dicon"; private BuriEngine buriEngine; private SimpleBuriProcessor invoker_; public NadejyakoBuriTest(String name) { super(name); } @Override protected void setUp() throws Exception { super.setUp(); include(PATH); } public void testDummy() { // なでじゃこがうまくいくようになるまでテスト中止 } public void te1stなでじゃこをぶりから呼んでみるTx() { buriEngine.readWorkFlowFromResource("wakanagoxpdl/なでじゃこ.xpdl", "なでなで"); FurnitureItem furnitureItem = new FurnitureItem(); furnitureItem.type = "サーバ"; furnitureItem.name = "PS3"; furnitureItem.acquisition = new Date(); furnitureItem.acquisitionType = AcquisitionType.LEASE; BuriProcessorInfo info = new BuriProcessorInfo(); info.put("備品", furnitureItem); info.put("リース", new BigDecimal(1)); invoker_.toNextStatus("なでなで.なでじゃこてすと.開始", furnitureItem, info); System.out.println(furnitureItem); } }
59eb043fbd81c7552a69b83a564e70f4555a3493
c04f06755278d084cc7653b7efe9afe1e9caf168
/marknode-integration-test/src/test/java/org/marknode/integration/BoundsIntegrationTest.java
ac4519989d22dfecc7c3ae05c1d9b9890c40f2cb
[ "BSD-2-Clause", "Apache-2.0" ]
permissive
nickhristov/marknode
54f44cd11061ebea60b489b5c9ec54e777264014
fbfd9e19874af5e02efa0c66b424a0e4de9e54a4
refs/heads/master
2021-05-01T08:14:36.047793
2016-03-19T07:56:58
2016-03-19T07:56:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,518
java
package org.marknode.integration; import org.marknode.node.Node; import org.marknode.parser.Parser; import org.marknode.spec.SpecExample; import org.marknode.spec.SpecReader; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; import java.util.List; import static org.testng.Assert.assertNotNull; /** * Tests various substrings of the spec examples to check for out of bounds exceptions. */ public class BoundsIntegrationTest { private static final Parser PARSER = Parser.builder().build(); @DataProvider(name = "data") public Object[][] data() { List<SpecExample> examples = SpecReader.readExamples(); Object[][] data = new Object[examples.size()][]; for (int i = 0; i < examples.size(); i++) { final SpecExample example = examples.get(i); data[i] = new Object[]{example.getSource()}; } return data; } @Test(dataProvider = "data") public void testSubstrings(String input) { // Check possibly truncated block/inline starts for (int i = 1; i < input.length() - 1; i++) { parse(input.substring(i)); } // Check possibly truncated block/inline ends for (int i = input.length() - 1; i > 1; i--) { parse(input.substring(0, i)); } } private void parse(String input) { try { Node parsed = PARSER.parse(input); // Parsing should always return a node assertNotNull(parsed); } catch (Exception e) { throw new AssertionError("Parsing failed, input: " + input, e); } } }
0bc5624b7f10f23912ab557f6bc84851b87da7e1
eb5cf4ab43912940e26758b00a8a82c02a18adff
/src/main/java/com/xmage/dm01/utils/RSAUtil.java
5edccb934ebc7532793294e57a369cea1ca4b55f
[]
no_license
ahmachan/bootDm01
1105633075d99b14da37e2499993a4b236258c99
162a3feb94d0b593cec5ba4afe615ee17cd57a31
refs/heads/master
2020-04-07T23:34:38.655774
2018-11-30T10:44:03
2018-11-30T10:44:03
158,817,766
0
0
null
null
null
null
UTF-8
Java
false
false
10,043
java
package com.xmage.dm01.utils; //import sun.misc.BASE64Decoder; //import sun.misc.BASE64Encoder; import org.apache.commons.codec.binary.Base64; import java.security.*; import java.security.interfaces.RSAPrivateKey; import java.security.interfaces.RSAPublicKey; import java.security.spec.PKCS8EncodedKeySpec; import java.security.spec.X509EncodedKeySpec; import javax.crypto.Cipher; import javax.crypto.KeyGenerator; import javax.crypto.SecretKey; import javax.crypto.spec.SecretKeySpec; import java.util.HashMap; import java.util.Map; /** * @ClassName: RSAUtil * @Description: 公钥、密钥生成和校验 * **/ public class RSAUtil { public static final String KEY_ALGORTHM="RSA";//加密类型 public static final String SIGNATURE_ALGORITHM="MD5withRSA"; public static final String CIPHER = "aes-256-cbc"; public static final String PUBLIC_KEY = "RSAPublicKey";//公钥 public static final String PRIVATE_KEY = "RSAPrivateKey";//私钥 /** * BASE64解密 * @param byteData * @return * @throws Exception */ public static byte[] decryptBASE64(String data){ //String strByte = Arrays.toString(Base64.decodeBase64(str)); //String strByte = new String(byteData); return Base64.decodeBase64(data); } /** * BASE64加密 * @param data * @return * @throws Exception */ public static String encryptBASE64(byte[] data) throws Exception{ //return (new Base64()).encodeToString(data.getBytes("UTF-8")); return (new Base64()).encodeToString(data); } /** * 初始化密钥 * @return * @throws Exception */ public static Map<String,Object> initKey()throws Exception{ KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance(KEY_ALGORTHM); keyPairGenerator.initialize(1024); KeyPair keyPair = keyPairGenerator.generateKeyPair(); //公钥 RSAPublicKey publicKey = (RSAPublicKey) keyPair.getPublic(); //私钥 RSAPrivateKey privateKey = (RSAPrivateKey) keyPair.getPrivate(); Map<String,Object> keyMap = new HashMap<String, Object>(2); keyMap.put(PUBLIC_KEY, publicKey); keyMap.put(PRIVATE_KEY, privateKey); return keyMap; } /** * 取得公钥,并转化为String类型 * @param keyMap * @return * @throws Exception */ public static String getPublicKey(Map<String, Object> keyMap)throws Exception{ Key key = (Key) keyMap.get(PUBLIC_KEY); return encryptBASE64(key.getEncoded()); } /** * 取得私钥,并转化为String类型 * @param keyMap * @return * @throws Exception */ public static String getPrivateKey(Map<String, Object> keyMap) throws Exception{ Key key = (Key) keyMap.get(PRIVATE_KEY); return encryptBASE64(key.getEncoded()); } /** * 用公钥加密 * @param data 加密数据 * @param key 密钥 * @return * @throws Exception */ public static byte[] encryptByPublicKey(byte[] data,String key)throws Exception{ //对公钥解密 byte[] keyBytes = decryptBASE64(key); //取公钥 X509EncodedKeySpec x509EncodedKeySpec = new X509EncodedKeySpec(keyBytes); KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORTHM); Key publicKey = keyFactory.generatePublic(x509EncodedKeySpec); //对数据解密 Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm()); cipher.init(Cipher.ENCRYPT_MODE, publicKey); return cipher.doFinal(data); } /** * 用私钥解密 * @param data 加密数据 * @param key 密钥 * @return * @throws Exception */ public static byte[] decryptByPrivateKey(byte[] data,String key)throws Exception{ //对私钥解密 byte[] keyBytes = decryptBASE64(key); PKCS8EncodedKeySpec pkcs8EncodedKeySpec = new PKCS8EncodedKeySpec(keyBytes); KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORTHM); Key privateKey = keyFactory.generatePrivate(pkcs8EncodedKeySpec); //对数据解密 Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm()); cipher.init(Cipher.DECRYPT_MODE, privateKey); return cipher.doFinal(data); } /** * 用私钥对信息生成数字签名 * @param data //加密数据 * @param privateKey //私钥 * @return * @throws Exception */ public static String sign(byte[] data,String privateKey)throws Exception{ //解密私钥 byte[] keyBytes = decryptBASE64(privateKey); //构造PKCS8EncodedKeySpec对象 PKCS8EncodedKeySpec pkcs8EncodedKeySpec = new PKCS8EncodedKeySpec(keyBytes); //指定加密算法 KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORTHM); //取私钥匙对象 PrivateKey privateKey2 = keyFactory.generatePrivate(pkcs8EncodedKeySpec); //用私钥对信息生成数字签名 Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM); signature.initSign(privateKey2); signature.update(data); return encryptBASE64(signature.sign()); } /** * 校验数字签名 * @param data 加密数据 * @param publicKey 公钥 * @param sign 数字签名 * @return * @throws Exception */ public static boolean verify(byte[] data,String publicKey,String sign)throws Exception{ //解密公钥 byte[] keyBytes = decryptBASE64(publicKey); //构造X509EncodedKeySpec对象 X509EncodedKeySpec x509EncodedKeySpec = new X509EncodedKeySpec(keyBytes); //指定加密算法 KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORTHM); //取公钥匙对象 PublicKey publicKey2 = keyFactory.generatePublic(x509EncodedKeySpec); Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM); signature.initVerify(publicKey2); signature.update(data); //验证签名是否正常 return signature.verify(decryptBASE64(sign)); } public static byte[] aesDecrypt(byte[] data, byte rawKeyData[]) throws GeneralSecurityException { // 处理密钥 //SecretKeySpec key = new SecretKeySpec(rawKeyData, "DES"); // 解密 //Cipher cipher = Cipher.getInstance("DES/ECB/PKCS5Padding"); SecretKeySpec key = new SecretKeySpec(rawKeyData, "AES"); Cipher cipher = Cipher.getInstance("AES/ECB/PKCS7Padding"); cipher.init(Cipher.DECRYPT_MODE, key); return cipher.doFinal(data); } public static byte[] desEncrypt(byte[] source, byte rawKeyData[]) throws GeneralSecurityException { // 处理密钥 SecretKeySpec key = new SecretKeySpec(rawKeyData, "AES"); // 加密 Cipher cipher = Cipher.getInstance("AES/ECB/PKCS7Padding"); cipher.init(Cipher.ENCRYPT_MODE, key); return cipher.doFinal(source); } public static byte[] encryptAES256(String content, String password) { try { //"AES":请求的密钥算法的标准名称 -指定加密算法 KeyGenerator kgen = KeyGenerator.getInstance("AES"); //256:密钥生成参数;securerandom:密钥生成器的随机源 SecureRandom securerandom = new SecureRandom(tohash256Deal(password)); kgen.init(256, securerandom); //生成秘密(对称)密钥 SecretKey secretKey = kgen.generateKey(); //返回基本编码格式的密钥 byte[] enCodeFormat = secretKey.getEncoded(); //根据给定的字节数组构造一个密钥。enCodeFormat:密钥内容;"AES":与给定的密钥内容相关联的密钥算法的名称 SecretKeySpec key = new SecretKeySpec(enCodeFormat, "AES"); //将提供程序添加到下一个可用位置 //Security.addProvider(new BouncyCastleProvider()); //创建一个实现指定转换的 Cipher对象,该转换由指定的提供程序提供。 //"AES/ECB/PKCS7Padding":转换的名称;"BC":提供程序的名称 Cipher cipher = Cipher.getInstance("AES/ECB/PKCS7Padding"); cipher.init(Cipher.ENCRYPT_MODE, key); byte[] byteContent = content.getBytes("utf-8"); byte[] cryptograph = cipher.doFinal(byteContent); return (new Base64()).encode(cryptograph); ///return Base64.encode(cryptograph); } catch (Exception e) { e.printStackTrace(); } return null; } public static String decryptAES256(byte[] cryptograph, String password) { try { KeyGenerator kgen = KeyGenerator.getInstance("AES"); SecureRandom securerandom = new SecureRandom(tohash256Deal(password)); kgen.init(256, securerandom); SecretKey secretKey = kgen.generateKey(); byte[] enCodeFormat = secretKey.getEncoded(); SecretKeySpec key = new SecretKeySpec(enCodeFormat, "AES"); //Security.addProvider(new BouncyCastleProvider()); Cipher cipher = Cipher.getInstance("AES/ECB/PKCS7Padding"); cipher.init(Cipher.DECRYPT_MODE, key); //byte[] content = cipher.doFinal(Base64.decode(cryptograph)); byte[] content = cipher.doFinal((new Base64()).encode(cryptograph)); return new String(content); } catch (Exception e) { e.printStackTrace(); } return null; } public static String parseByte2HexStr(byte buf[]) { StringBuffer sb = new StringBuffer(); for (int i = 0; i < buf.length; i++) { String hex = Integer.toHexString(buf[i] & 0xFF); if (hex.length() == 1) { hex = '0' + hex; } sb.append(hex.toUpperCase()); } return sb.toString(); } private static byte[] tohash256Deal(String datastr) { try { MessageDigest digester=MessageDigest.getInstance("SHA-256"); digester.update(datastr.getBytes()); byte[] hex=digester.digest(); return hex; } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e.getMessage()); } } }
e709df2e6fab15947e4c10f4cd95ce382ff86f3d
8809f22b1afd8dc87d5d2e9e3c1440a6affc2bcc
/spring_learn/src/cn/spring/spring_proxy/dao/xml_spring_aop/Person.java
f04c53d977550b7a3d85942d609182bfadf3a07a
[]
no_license
vicTheo/Java_Learning
5100eacea3a2274519e225048e5f73155d693b6b
b073c5b6363f84f90de94f00e5448e8d635fdfb8
refs/heads/master
2021-01-10T02:10:26.778061
2015-06-18T13:02:10
2015-06-18T13:02:10
36,284,174
0
0
null
null
null
null
UTF-8
Java
false
false
409
java
package cn.spring.spring_proxy.dao.xml_spring_aop; public class Person { private String pname; private Integer pid; public Person(String pname,Integer pid){ this.pname=pname; this.pid=pid; } public String getPname() { return pname; } public void setPname(String pname) { this.pname = pname; } public Integer getPid() { return pid; } public void setPid(Integer pid) { this.pid = pid; } }
0d5af6ddc37381d7dba4665bb935958fb515e71d
4cba9c30a002f7894ad42c9abc95ae3d329761e1
/javabase-multithreading/src/main/java/守护线程.java
f8ad1a19ef93c3be9b2f8b3166a6bdb92a1ac62f
[]
no_license
lafeier888/learn
d9fa10461f975b73d52ad438cbcd8538e2823ce2
2e5876221ad3c4720accd2bf5072584e9d752466
refs/heads/master
2020-06-01T00:05:04.401548
2019-06-06T09:03:27
2019-06-06T09:03:27
190,549,980
0
0
null
null
null
null
UTF-8
Java
false
false
82
java
public class 守护线程 { public static void main(String[] args) { } }
6ee78d0d683521ce9213baa79a85e0d0eaa2ff1a
00ce956e611a4b1d214a9d54ca538469359484f9
/hbase-common/src/main/java/org/apache/hadoop/hbase/io/ByteBufferPool.java
e528f028f81d0cd9abe6d792a43de98c85e9ccda
[ "Apache-2.0", "BSD-3-Clause", "MIT", "LicenseRef-scancode-protobuf", "CC-BY-3.0" ]
permissive
enis/hbase-sal
35cecd7917dacae7f5445b971cf009bd9f5a3271
4c122ced6e025805dcb2af07ac60f83482f51a5a
refs/heads/master
2021-01-12T17:53:52.459692
2016-10-22T01:54:01
2016-11-07T22:24:42
71,297,613
1
2
Apache-2.0
2023-03-20T11:56:29
2016-10-18T22:44:52
Java
UTF-8
Java
false
false
6,248
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.hadoop.hbase.io; import java.nio.ByteBuffer; import java.util.Queue; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.atomic.AtomicInteger; import com.google.common.annotations.VisibleForTesting; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.hbase.classification.InterfaceAudience; /** * Like Hadoops' ByteBufferPool only you do not specify desired size when getting a ByteBuffer. This * pool keeps an upper bound on the count of ByteBuffers in the pool and a fixed size of ByteBuffer * that it will create. When requested, if a free ByteBuffer is already present, it will return * that. And when no free ByteBuffer available and we are below the max count, it will create a new * one and return that. * * <p> * Note: This pool returns off heap ByteBuffers by default. If on heap ByteBuffers to be pooled, * pass 'directByteBuffer' as false while construction of the pool. * <p> * This class is thread safe. * * @see ByteBufferListOutputStream */ @InterfaceAudience.Private public class ByteBufferPool { private static final Log LOG = LogFactory.getLog(ByteBufferPool.class); // TODO better config names? // hbase.ipc.server.reservoir.initial.max -> hbase.ipc.server.reservoir.max.buffer.count // hbase.ipc.server.reservoir.initial.buffer.size -> hbase.ipc.server.reservoir.buffer.size public static final String MAX_POOL_SIZE_KEY = "hbase.ipc.server.reservoir.initial.max"; public static final String BUFFER_SIZE_KEY = "hbase.ipc.server.reservoir.initial.buffer.size"; public static final int DEFAULT_BUFFER_SIZE = 64 * 1024;// 64 KB. Making it same as the chunk size // what we will write/read to/from the // socket channel. private final Queue<ByteBuffer> buffers = new ConcurrentLinkedQueue<ByteBuffer>(); private final int bufferSize; private final int maxPoolSize; private AtomicInteger count; // Count of the BBs created already for this pool. private final boolean directByteBuffer; //Whether this pool should return DirectByteBuffers private boolean maxPoolSizeInfoLevelLogged = false; /** * @param bufferSize Size of each buffer created by this pool. * @param maxPoolSize Max number of buffers to keep in this pool. */ public ByteBufferPool(int bufferSize, int maxPoolSize) { this(bufferSize, maxPoolSize, true); } /** * @param bufferSize Size of each buffer created by this pool. * @param maxPoolSize Max number of buffers to keep in this pool. * @param directByteBuffer Whether to create direct ByteBuffer or on heap ByteBuffer. */ public ByteBufferPool(int bufferSize, int maxPoolSize, boolean directByteBuffer) { this.bufferSize = bufferSize; this.maxPoolSize = maxPoolSize; this.directByteBuffer = directByteBuffer; // TODO can add initialPoolSize config also and make those many BBs ready for use. LOG.info("Created ByteBufferPool with bufferSize : " + bufferSize + " and maxPoolSize : " + maxPoolSize); this.count = new AtomicInteger(0); } /** * @return One free ByteBuffer from the pool. If no free ByteBuffer and we have not reached the * maximum pool size, it will create a new one and return. In case of max pool size also * reached, will return null. When pool returned a ByteBuffer, make sure to return it back * to pool after use. * @see #putbackBuffer(ByteBuffer) */ public ByteBuffer getBuffer() { ByteBuffer bb = buffers.poll(); if (bb != null) { // Clear sets limit == capacity. Position == 0. bb.clear(); return bb; } while (true) { int c = this.count.intValue(); if (c >= this.maxPoolSize) { if (maxPoolSizeInfoLevelLogged) { if (LOG.isDebugEnabled()) { LOG.debug("Pool already reached its max capacity : " + this.maxPoolSize + " and no free buffers now. Consider increasing the value for '" + MAX_POOL_SIZE_KEY + "' ?"); } } else { LOG.info("Pool already reached its max capacity : " + this.maxPoolSize + " and no free buffers now. Consider increasing the value for '" + MAX_POOL_SIZE_KEY + "' ?"); maxPoolSizeInfoLevelLogged = true; } return null; } if (!this.count.compareAndSet(c, c + 1)) { continue; } if (LOG.isTraceEnabled()) { LOG.trace("Creating a new offheap ByteBuffer of size: " + this.bufferSize); } return this.directByteBuffer ? ByteBuffer.allocateDirect(this.bufferSize) : ByteBuffer.allocate(this.bufferSize); } } /** * Return back a ByteBuffer after its use. Do not try to return put back a ByteBuffer, not * obtained from this pool. * @param buf ByteBuffer to return. */ public void putbackBuffer(ByteBuffer buf) { if (buf.capacity() != this.bufferSize || (this.directByteBuffer ^ buf.isDirect())) { LOG.warn("Trying to put a buffer, not created by this pool! Will be just ignored"); return; } buffers.offer(buf); } int getBufferSize() { return this.bufferSize; } /** * @return Number of free buffers */ @VisibleForTesting int getQueueSize() { return buffers.size(); } }
96a983ad05b166c0e0b3039d5edd812eec506f8c
a354b8264b50a47f81361543966a567b8601a94e
/project1227/src/p0103/ChatC.java
0992981b3a59ac1767b0940721cefd1c62576958
[]
no_license
myungjae18/JavaSE
bce6b898c0797512fc2d160bb6e1604b3955db81
d21556280c5d5845b6ebe1cf0afa886049d78db8
refs/heads/master
2020-05-20T09:20:11.341301
2019-05-08T12:59:56
2019-05-08T12:59:56
null
0
0
null
null
null
null
UHC
Java
false
false
542
java
package p0103; import javax.swing.*; import java.awt.*; import java.awt.event.*; public class ChatC extends JFrame{ //앞으로 개발 시 필요한 건 보유(필요 객체를 has a 관계로 갖자) JTextArea area; JScrollPane scroll; JPanel p_south; JTextField t_input; public ChatC(){ area=new JTextArea(); scroll=new JScrollPane(area); p_south=new JPanel(); t_input=new JTextField(12); p_south.add(t_input); add(scroll); add(p_south, BorderLayout.SOUTH); setBounds(400,500,300,400); setVisible(true); } }
bd77c5afd567284e77d62fda6c1091989a62d70a
aa605322921bea5d68d55ef8b7b83dab48fb3319
/src/test/java/com/example/ConsumingRestApplicationTests.java
75e7014fb7432ac12bb15e8d0f060da4296b1ae0
[]
no_license
atropose/consuming-rest
8e434811c26c9b6a24c8b8d340e640f252298bf0
e3d5cfeb246a2b7013803e23f96dc32064cd330d
refs/heads/master
2023-04-11T03:30:18.819155
2021-04-04T22:03:48
2021-04-04T22:03:48
354,653,892
0
0
null
null
null
null
UTF-8
Java
false
false
210
java
package com.example; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class ConsumingRestApplicationTests { @Test void contextLoads() { } }
09ae73bb6ab7af6d5a9ea8fd718fcbaf96372677
57069d9ea11c77f61ec65b6a687b139e161a2aec
/src/main/java/me/jiaojian/domain/Catalog.java
2227ffac94f521fc4c380806b4642b822e37e638
[]
no_license
JiaoJian1221/ibook-web
dd861435d265863f17673c89b0b99677fa47bd4e
c534568134579a0ac98000e7c5c7cc6d2e5637f5
refs/heads/master
2021-09-05T21:19:40.015026
2018-01-31T03:24:43
2018-01-31T03:24:43
119,628,634
0
0
null
null
null
null
UTF-8
Java
false
false
1,034
java
package me.jiaojian.domain; import javax.persistence.*; import java.util.List; /** * Created by jiaojian on 2018/1/4. */ @Entity public class Catalog { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private String name; @ManyToOne @JoinColumn(name = "channel_id") private Channel channel; @OneToMany @JoinColumn(name = "catalog_id") private List<Book> books; private String jdUri; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Channel getChannel() { return channel; } public void setChannel(Channel channel) { this.channel = channel; } public String getJdUri() { return jdUri; } public void setJdUri(String jdUri) { this.jdUri = jdUri; } public List<Book> getBooks() { return books; } public void setBooks(List<Book> books) { this.books = books; } }
c8348e9ad7638744097a7fa4daf00a6368aa7320
26dd66af1b87c5a6424ee614c4e2be00151edcf8
/src/org/usfirst/frc/team321/robot/commands/subsystems/manipulator/UseIntakeJoystick.java
98deefbcb9a8f30a5eb86e7b7970abfae1f13e2c
[]
no_license
RoboLancers/FRC_2018
6a62e55794e3fb0b01ac91141c480d2983e00f63
6da40a390544c6c32f7ce40591fbeba1aaa4d01e
refs/heads/master
2021-03-27T10:04:00.365632
2018-05-04T16:09:56
2018-05-04T16:09:56
116,182,328
0
0
null
null
null
null
UTF-8
Java
false
false
1,296
java
package org.usfirst.frc.team321.robot.commands.subsystems.manipulator; import org.usfirst.frc.team321.robot.Robot; import edu.wpi.first.wpilibj.command.Command; public class UseIntakeJoystick extends Command { double power; boolean rumble = false; boolean wasIntaking = false; public UseIntakeJoystick() { requires(Robot.manipulator.getIntake()); } protected void initialize() { Robot.manipulator.getIntake().stop(false); } protected void execute() { if (Robot.oi.xboxController.leftBumper.get()) { power = 0.87; } else if (Robot.oi.xboxController.rightBumper.get()){ power = -0.7; } else { power = -Math.abs(Math.abs(Robot.oi.flightController.getRotateAxisValue()) > 0.5 ? Robot.oi.flightController.getRotateAxisValue() : 0) * 0.25; } if (power > 0) { wasIntaking = true; } else if (power < 0) { wasIntaking = false; } if (wasIntaking && power == 0) { power = 0.2; } Robot.manipulator.getIntake().setAll(power); Robot.oi.xboxController.setRumble(power > 0 && !wasIntaking); } protected void interrupted() { end(); } protected void end() { Robot.oi.xboxController.setRumble(false); } @Override protected boolean isFinished() { return false; } }
892eb61e06f33201467b47177b0644249a4d7354
25cb67f4d7ffd89258fd6fe4e51be0e9eaf57e95
/src/main/java/com/zjw/jdk/xml/convert/utils/JSONPointerException.java
8be4ed5a27eb77da534a79abb3f937e5d8862824
[]
no_license
zhouminsen/jdk
f9b58a20c9dc873622c7d164063e65b2930a5a2a
234b90fb862761fb3868aeb05daeae064743fde2
refs/heads/master
2022-12-22T12:02:25.317531
2020-05-22T03:04:45
2020-05-22T03:04:45
116,328,867
1
0
null
2022-12-16T03:28:05
2018-01-05T02:07:31
Java
UTF-8
Java
false
false
1,632
java
package com.zjw.jdk.xml.convert.utils; /* Copyright (c) 2002 JSON.org Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. The Software shall be used for Good, not Evil. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * The JSONPointerException is thrown by {@link JSONPointer} if an error occurs * during evaluating a pointer. * * @author JSON.org * @version 2016-05-13 */ public class JSONPointerException extends JSONException { private static final long serialVersionUID = 8872944667561856751L; public JSONPointerException(String message) { super(message); } public JSONPointerException(String message, Throwable cause) { super(message, cause); } }
[ "weijia1992427" ]
weijia1992427
41db315fd1113b1017ccbae1f1314f0627bc961d
d603c031019ae27128a04e8d0fc1597fb3b749f3
/app/src/main/java/com/zinios/dealab/api/APIURLHelper.java
690ebac1dbb29eea70c03ae97f3e83663171738d
[]
no_license
vihangayw/dealab-android
a1fade9271f966006c79a039653474b159b0c971
af878e7885cb707542a7c34a13ee2563e63a3717
refs/heads/master
2023-07-09T23:37:39.601267
2018-11-03T06:25:07
2018-11-03T06:25:07
396,614,172
0
0
null
null
null
null
UTF-8
Java
false
false
963
java
package com.zinios.dealab.api; public class APIURLHelper { private static final String BASE_URL = "http://192.168.8.102:9000/v1/deal"; private static final String ALL_LOCATIONS = "/map-all"; private static final String NEAR_LOCATIONS = "/map-boundary-all"; private static final String DEAL_TODAY = "/all-today"; private static final String LONGITUDE = "lng="; private static final String LATITUDE = "lat="; private static final String BRANCH_ID = "branchId="; public static String getAllLocationsURL() { return BASE_URL.concat(ALL_LOCATIONS); } public static String getAllLocationsURL(int bid) { return BASE_URL.concat(DEAL_TODAY) .concat("?").concat(BRANCH_ID).concat(String.valueOf(bid)); } public static String getNearLocationsURL(double lat, double lng) { return BASE_URL.concat(NEAR_LOCATIONS).concat("?") .concat(LONGITUDE).concat(String.valueOf(lng)) .concat("&") .concat(LATITUDE).concat(String.valueOf(lat)); } }
4f587656f60f9b3737a5f9599783f830df175472
17a33488736d3f6b84beaacbfcdc15dc43261a9e
/support/cas-server-support-oidc-core-api/src/main/java/org/apereo/cas/oidc/jwks/generator/OidcJsonWebKeystoreModifiedEvent.java
c1057ce2f9bde99cbc60e3fa8d65b4ecee53d51d
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-free-unknown" ]
permissive
hdeadman/cas
68fa815d55ccc36a31b5037f500a8e827b6a566d
6d3cf1b64b2d4f9ab1ba07ab1105c9b7c77e8870
refs/heads/pr-puppeteerwin2
2023-08-06T05:59:12.248532
2022-03-16T00:32:45
2022-03-16T00:32:45
80,761,455
1
1
Apache-2.0
2022-03-22T00:15:11
2017-02-02T19:38:09
Java
UTF-8
Java
false
false
629
java
package org.apereo.cas.oidc.jwks.generator; import org.apereo.cas.support.events.AbstractCasEvent; import lombok.Getter; import lombok.ToString; import java.io.File; /** * This is {@link OidcJsonWebKeystoreModifiedEvent}. * * @author Misagh Moayyed * @since 6.5.0 */ @ToString(callSuper = true) @Getter public class OidcJsonWebKeystoreModifiedEvent extends AbstractCasEvent { private static final long serialVersionUID = 8059647975948452375L; private final File file; public OidcJsonWebKeystoreModifiedEvent(final Object source, final File file) { super(source); this.file = file; } }
41a3dc2d9604c36e25f1792c161412c8d70cd23e
9410ef0fbb317ace552b6f0a91e0b847a9a841da
/src/main/java/com/tencentcloudapi/tcss/v20201101/models/DescribeReverseShellWhiteListDetailRequest.java
7c9814e5a85f4c745971b0ccf4bb1be8067a978f
[ "Apache-2.0" ]
permissive
TencentCloud/tencentcloud-sdk-java-intl-en
274de822748bdb9b4077e3b796413834b05f1713
6ca868a8de6803a6c9f51af7293d5e6dad575db6
refs/heads/master
2023-09-04T05:18:35.048202
2023-09-01T04:04:14
2023-09-01T04:04:14
230,567,388
7
4
Apache-2.0
2022-05-25T06:54:45
2019-12-28T06:13:51
Java
UTF-8
Java
false
false
2,138
java
/* * Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.tencentcloudapi.tcss.v20201101.models; import com.tencentcloudapi.common.AbstractModel; import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.Expose; import java.util.HashMap; public class DescribeReverseShellWhiteListDetailRequest extends AbstractModel{ /** * Allowed item ID */ @SerializedName("WhiteListId") @Expose private String WhiteListId; /** * Get Allowed item ID * @return WhiteListId Allowed item ID */ public String getWhiteListId() { return this.WhiteListId; } /** * Set Allowed item ID * @param WhiteListId Allowed item ID */ public void setWhiteListId(String WhiteListId) { this.WhiteListId = WhiteListId; } public DescribeReverseShellWhiteListDetailRequest() { } /** * NOTE: Any ambiguous key set via .set("AnyKey", "value") will be a shallow copy, * and any explicit key, i.e Foo, set via .setFoo("value") will be a deep copy. */ public DescribeReverseShellWhiteListDetailRequest(DescribeReverseShellWhiteListDetailRequest source) { if (source.WhiteListId != null) { this.WhiteListId = new String(source.WhiteListId); } } /** * Internal implementation, normal users should not use it. */ public void toMap(HashMap<String, String> map, String prefix) { this.setParamSimple(map, prefix + "WhiteListId", this.WhiteListId); } }
8b218dda6d70ab26ea1c4ce890a43c89db520bb7
3d6082261fcdd8121b615e589982c9601faca2f6
/app/src/main/java/com/example/reem/eventmaker/EventsAvailable.java
bf62063dc06f95aaee146ad5e4c46a1ddf32354c
[]
no_license
TareqElgafy/EventMakerApp
a41599b6341bcc6cb5004e24892706ff58f37cc5
37dbfba64a1193140320ac95161a5302d2ffc5a4
refs/heads/master
2016-08-12T11:40:18.252903
2015-10-04T17:09:05
2015-10-04T17:09:05
43,644,478
0
0
null
null
null
null
UTF-8
Java
false
false
3,557
java
package com.example.reem.eventmaker; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.AutoCompleteTextView; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; import java.util.ArrayList; import retrofit.Callback; import retrofit.RestAdapter; import retrofit.RetrofitError; import retrofit.client.Response; /** * Created by Reem on 8/24/2015. */ public class EventsAvailable extends Activity { Button btn_createEvent,btn_viewEvents; AutoCompleteTextView autoCompleteTextView; ShowSend showSend=new ShowSend(); TextView tv; public static ShowReceive eventDetails=new ShowReceive(); protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.events); btn_createEvent = (Button) findViewById(R.id.btn_createEvent); btn_viewEvents=(Button)findViewById(R.id.btn_show); autoCompleteTextView=(AutoCompleteTextView)findViewById(R.id.autoComplete); tv=(TextView)findViewById(R.id.textView2); ArrayAdapter<EventName> adapter = new ArrayAdapter<EventName>(this,android.R.layout.simple_list_item_1,SignIn.events); autoCompleteTextView.setAdapter(adapter); autoCompleteTextView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { EventName selected = (EventName) parent.getAdapter().getItem(position); showSend.setUser_id(SignIn.user_id); showSend.setId(selected.getId()); RestAdapter adapter = new RestAdapter.Builder() .setLogLevel(RestAdapter.LogLevel.FULL) .setEndpoint(SignIn.Endpoint) .build(); GetAPI api = adapter.create(GetAPI.class); api.show_event(showSend,new Callback<ShowReceive>() { @Override public void success(ShowReceive showReceive, Response response) { eventDetails=showReceive; Intent in =new Intent(getApplicationContext(),EventDetails.class); startActivity(in); // tv.setText(showReceive.getId()+""+showReceive.getUsername()+" "+showReceive.getName()+" " // +showReceive.getDescription()+" "+showReceive.getLocation()+" "+showReceive.getDate()); } @Override public void failure(RetrofitError error) { Toast.makeText(EventsAvailable.this, "Cannot connect to server", Toast.LENGTH_SHORT).show(); } }); } }); btn_createEvent.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent in = new Intent(getApplicationContext(),CreateEvent.class); startActivity(in); } }); btn_viewEvents.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent in2 = new Intent(getApplicationContext(),listActivity.class); startActivity(in2); } }); } }
9ff3c063f5dc04a852a87029a3c638b3856d33d3
d6df0692aa0b048c059ec0b47b53885e8180513c
/src/main/java/com/gl365/member/mq/producer/JPushProducer.java
45b4cddff34d3dc91977d9cdf07b3eb028760898
[]
no_license
pengjianbo3478/member
9c4d02d2694060d93fefaa29e7f7272b8f20e555
51a4082253adb49eecb10629a2a166fac2abd2ed
refs/heads/master
2020-03-13T19:36:01.067895
2018-04-27T06:43:52
2018-04-27T06:43:52
131,256,654
0
0
null
null
null
null
UTF-8
Java
false
false
955
java
package com.gl365.member.mq.producer; import javax.annotation.Resource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Component; import com.gl365.aliyun.ons.OnsProducer; import com.gl365.member.common.JsonUtils; import com.gl365.member.dto.mq.push.PushMQ; import com.gl365.member.mq.consumer.PaymentConsumer; @Component public class JPushProducer { private static final Logger LOG = LoggerFactory.getLogger(PaymentConsumer.class); @Lazy @Resource(name = "gl365-jpush-producer") private OnsProducer jpushProducer; public void send(PushMQ command) { String message = JsonUtils.toJsonString(command); LOG.info("<mq-send>推送通知APP》》》入参:{}", message); try { jpushProducer.send(message); } catch (Exception e) { LOG.error("<mq-send>推送通知APP》》》错误:{}", e); } } }
[ "DEKK@DESKTOP-D6KV7VG" ]
DEKK@DESKTOP-D6KV7VG
e88bbfa275ed6e17ec23c95d2cd714b49dbb154d
69474017e51115048103f5775dbf14d4070eb8ce
/src/main/java/com/uptc/desingMatch/controllers/DraftController.java
f6a50aeb8c99d90721ec8b7fb64dd4f310b0e217
[]
no_license
felipGonzalez/BackenDesing-Match
bd8d0bcf1b8938468c6516880b86857e0cb6969a
d0b8422099d9f808d6a636152f3d722d9cfa15af
refs/heads/master
2021-06-16T11:53:22.870843
2019-07-23T17:12:57
2019-07-23T17:12:57
194,929,144
0
0
null
2021-04-26T19:19:22
2019-07-02T20:18:00
Java
UTF-8
Java
false
false
2,956
java
package com.uptc.desingMatch.controllers; import java.io.File; import java.util.List; import java.util.Optional; import javax.servlet.ServletContext; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.uptc.desingMatch.models.Company; import com.uptc.desingMatch.models.Draft; import com.uptc.desingMatch.service.CompanyService; import com.uptc.desingMatch.service.DraftService; import com.uptc.desingMatch.util.Const; import com.uptc.desingMatch.util.RestResponse; import com.uptc.desingMatch.util.Util; @RestController @RequestMapping("/draft") @CrossOrigin(origins = {Const.DOMAIN}) public class DraftController { @Autowired private DraftService service; @Autowired private CompanyService service2; @Autowired private ServletContext context; @GetMapping(value="/{id}") public List<Draft> getList(@PathVariable int id){ return service.getList(id); } //guardar Proyecto @PostMapping(value="") public RestResponse save(@RequestBody Draft draft) { if(!this.validate(draft)) { return new RestResponse(HttpStatus.NOT_ACCEPTABLE.value(),"Los campos obligatorios no estan diligenciados "); } service.save(draft); Optional<Company> company = service2.getCompany(draft.getIdCompany()); Util.createImg(context.getRealPath("/finalDisenos")+"/"+company.get().getUrlCompany()+"/"+draft.getIdDraft()); Util.createImg(context.getRealPath("/imgDisenos")+"/"+company.get().getUrlCompany()+"/"+draft.getIdDraft()); return new RestResponse(HttpStatus.OK.value(), "Operacion exitosa"); } private boolean validate(Draft draft) { return (!validateString(draft.getNameDraft())); } private boolean validateString(String string) { return string.isEmpty(); } //Borrar proyecto @DeleteMapping(value = "{id}") public RestResponse remove(@PathVariable int id){ Optional<Draft> draft = service.getDraft(id); try { service.remove(id); return new RestResponse(HttpStatus.OK.value(), "Proyecto borrado"); } catch (Exception e) { try { service.removeCascade(id); return new RestResponse(HttpStatus.OK.value(), "Proyecto y diseños borrados"); } catch (Exception e2) { return new RestResponse(HttpStatus.EXPECTATION_FAILED.value(), "Proyecto no encontrado"); } } } public void deleteData() { String filesPath = context.getRealPath("/img"); File fileFolder = new File(filesPath); } }
f96271b1e69c070c861a1fadbdc69be64b482153
12ae3500b57ffb09f9d1418a0ecacf3bca425a19
/core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/TabButtonContainer.java
af0b64a3a110d80bd5cde9cb0b02bee410f53ab1
[ "MIT" ]
permissive
x4e/darklaf
67ce92eab2eaa078e5a47fab43af49ae2a86e862
8de4f56c00b6752d6306c815d9bbd63de924f825
refs/heads/master
2023-01-02T14:33:31.642357
2020-10-16T21:12:39
2020-10-16T21:12:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,934
java
/* * MIT License * * Copyright (c) 2020 Jannis Weis * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and * associated documentation files (the "Software"), to deal in the Software without restriction, * including without limitation the rights to use, copy, modify, merge, publish, distribute, * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all copies or * substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ package com.github.weisj.darklaf.ui.tabbedpane; import java.awt.*; import javax.swing.*; import javax.swing.plaf.UIResource; import com.github.weisj.darklaf.util.DarkUIUtil; public abstract class TabButtonContainer extends JPanel implements UIResource { protected final JButton button; protected final DarkTabbedPaneUI ui; private final Insets borderInsets; protected TabButtonContainer(final DarkTabbedPaneUI ui) { this.ui = ui; borderInsets = UIManager.getInsets("TabbedPane.tabArea.buttonInsets"); button = createButton(); add(button); setOpaque(false); setLayout(null); } protected abstract JButton createButton(); @Override public void doLayout() { Dimension b = button.getPreferredSize(); int w = Math.min(getWidth(), b.width); int h = Math.min(getHeight(), b.height); int x = (getWidth() - w) / 2; int y = (getHeight() - h) / 2; button.setBounds(x, y, w, h); } @Override public void setBounds(final int x, final int y, final int width, final int height) { super.setBounds(x, y, width, height); doLayout(); } @Override protected void paintComponent(final Graphics g) { super.paintComponent(g); ui.paintTabAreaBorder(g, ui.tabPane.getTabPlacement(), 0, 0, getWidth(), getHeight()); } @Override public Dimension getPreferredSize() { return DarkUIUtil.addInsets(button.getPreferredSize(), getInsets()); } @Override public Insets getInsets() { if (ui.isHorizontalTabPlacement()) { return new Insets(0, borderInsets.left, 0, borderInsets.right); } else { return new Insets(borderInsets.top, 0, borderInsets.bottom, 0); } } }
39ec6d0932855753ce5c55ac8b7357ba30048e08
d74c2ca437a58670dc8bfbf20a3babaecb7d0bea
/SAP_858310_lines/Source - 963k/js.webcontainer.service/dev/src/_tc~je~webcontainer/java/com/sap/engine/services/servlets_jsp/server/qos/wcerdresourceprovider.java
45c9f83462c066dba3e3f51b08f2d5174c251f27
[]
no_license
javafullstackstudens/JAVA_SAP
e848e9e1a101baa4596ff27ce1aedb90e8dfaae8
f1b826bd8a13d1432e3ddd4845ac752208df4f05
refs/heads/master
2023-06-05T20:00:48.946268
2021-06-30T10:07:39
2021-06-30T10:07:39
381,657,064
0
0
null
null
null
null
UTF-8
Java
false
false
2,466
java
package com.sap.engine.services.servlets_jsp.server.qos; import com.sap.engine.lib.rcm.Constraint; import com.sap.engine.lib.rcm.Notification; import com.sap.engine.lib.rcm.Resource; import com.sap.engine.lib.rcm.ResourceContext; import com.sap.engine.lib.rcm.ResourceManager; import com.sap.engine.lib.rcm.ResourceProvider; import com.sap.engine.lib.rcm.impl.ResourceManagerImpl; import com.sap.engine.services.servlets_jsp.server.LogContext; import com.sap.engine.services.servlets_jsp.server.ServiceContext; import com.sap.tc.logging.Severity; public class WCERDResourceProvider implements ResourceProvider { private ResourceManager rcm = new ResourceManagerImpl(); private ThreadResource threadResource = null; private RDUsageMonitor wceMonitor = null; private RDConstraint constraint; public WCERDResourceProvider() { super(); //TODO max per consumer int maxPerConsumer = ServiceContext.getServiceContext().getWebContainerProperties().getRDThreadCountFactor() * ServiceContext.getServiceContext().getHttpProvider().getHttpProperties().getFCAServerThreadCount(); threadResource = new ThreadResource("HTTP Worker", 0); rcm.registerResource(this); ResourceContext resCxt = rcm.createResourceContext(threadResource.getName(), RequestDispatcherConsumer.WCE_REQUEST_DISPATCHER_CONSUMER); threadResource.setTotalQuantity(maxPerConsumer); wceMonitor = new RDUsageMonitor(); resCxt.addNotification(wceMonitor); constraint = new RDConstraint(wceMonitor); resCxt.addConstraint(constraint); } @Override public Constraint getDefaultConstrait() { return constraint; } @Override public Notification getDefaultNotification() { return wceMonitor; } @Override public Resource getResource() { return threadResource; } public boolean consume(RequestDispatcherConsumer consumer) { if (LogContext.getLocationQoS().beDebug()) { LogContext.getLocationQoS().logT(Severity.DEBUG, "WCE RD is consuming by [" + consumer.getId() + "]"); } return rcm.consume(consumer, threadResource.getName(), 1); } public void release(RequestDispatcherConsumer consumer) { if (LogContext.getLocationQoS().beDebug()) { LogContext.getLocationQoS().logT(Severity.DEBUG, "WCE RD is released by [" + consumer.getId() + "]"); } rcm.release(consumer, threadResource.getName(), 1); } public RDUsageMonitor getMonitor() { return wceMonitor; } }
890e2d8284995231d2a15325d0385e3ec459cbd0
b0607996d57abfd6d4f057cd65772a14a03ee938
/cache2k-jcache/src/main/java/org/cache2k/jcache/provider/JCacheJmxSupport.java
85aeebb3810a79d62d998eaace18972c8725bcb1
[ "Apache-2.0" ]
permissive
cache2k/cache2k
447328703ca7e4a77487a8063881e33998c29669
0eaa156bdecd617b2aa4c745d0f8844a32609697
refs/heads/master
2023-08-01T03:36:51.443163
2022-11-01T08:25:04
2022-11-01T08:25:04
15,289,581
684
88
Apache-2.0
2023-04-17T17:40:48
2013-12-18T17:25:04
Java
UTF-8
Java
false
false
3,681
java
package org.cache2k.jcache.provider; /*- * #%L * cache2k JCache provider * %% * Copyright (C) 2000 - 2022 headissue GmbH, Munich * %% * 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. * #L% */ import org.cache2k.Cache; import org.cache2k.annotation.Nullable; import org.cache2k.event.CacheClosedListener; import javax.management.InstanceNotFoundException; import javax.management.MBeanServer; import javax.management.ObjectName; import java.lang.management.ManagementFactory; import java.util.concurrent.CompletableFuture; /** * @author Jens Wilke */ @SuppressWarnings("WeakerAccess") public class JCacheJmxSupport implements CacheClosedListener { private static final MBeanServer PLATFORM_SERVER = ManagementFactory.getPlatformMBeanServer(); public static final JCacheJmxSupport SINGLETON = new JCacheJmxSupport(); private JCacheJmxSupport() { } @Override public @Nullable CompletableFuture<Void> onCacheClosed(Cache cache) { disableStatistics(cache); disableJmx(cache); return null; } public void enableStatistics(JCacheAdapter c) { MBeanServer mbs = PLATFORM_SERVER; String name = createStatisticsObjectName(c.cache); try { mbs.registerMBean( new JCacheJmxStatisticsMXBean(c), new ObjectName(name)); } catch (Exception e) { throw new IllegalStateException("Error registering JMX bean, name='" + name + "'", e); } } public void disableStatistics(Cache c) { MBeanServer mbs = PLATFORM_SERVER; String name = createStatisticsObjectName(c); try { mbs.unregisterMBean(new ObjectName(name)); } catch (InstanceNotFoundException ignore) { } catch (Exception e) { throw new IllegalStateException("Error unregister JMX bean, name='" + name + "'", e); } } public void enableJmx(Cache c, javax.cache.Cache ca) { MBeanServer mbs = PLATFORM_SERVER; String name = createJmxObjectName(c); try { mbs.registerMBean(new JCacheJmxCacheMXBean(ca), new ObjectName(name)); } catch (Exception e) { throw new IllegalStateException("Error register JMX bean, name='" + name + "'", e); } } public void disableJmx(Cache c) { MBeanServer mbs = PLATFORM_SERVER; String name = createJmxObjectName(c); try { mbs.unregisterMBean(new ObjectName(name)); } catch (InstanceNotFoundException ignore) { } catch (Exception e) { throw new IllegalStateException("Error unregister JMX bean, name='" + name + "'", e); } } public String createStatisticsObjectName(Cache cache) { return "javax.cache:type=CacheStatistics," + "CacheManager=" + sanitizeName(cache.getCacheManager().getName()) + ",Cache=" + sanitizeName(cache.getName()); } public String createJmxObjectName(Cache cache) { return "javax.cache:type=CacheConfiguration," + "CacheManager=" + sanitizeName(cache.getCacheManager().getName()) + ",Cache=" + sanitizeName(cache.getName()); } /** * Filter illegal chars, same rule as in TCK or RI? */ public static String sanitizeName(String string) { return string == null ? "" : string.replaceAll(":|=|\n|,", "."); } }
854c88d979d0bf42cc06846ff6dd1a6c52dd02f6
62ddade93fbe9682df9d71f684d5270c4a691323
/ch04-aop-aspectj/src/main/java/com/ywt/ba03/MyAspect.java
2dc2dd5ce58006e968b1b9b89d3a9ef79102bfae
[]
no_license
xxxdrawayne/SpringTest
0c1d8852e4c9135d5787b2d33d991dfbaf3107a9
bc7c149e3fa041558b6a5e6718f05cec3a32d7ab
refs/heads/master
2023-03-27T04:17:09.323164
2021-03-26T13:00:34
2021-03-26T13:00:34
351,781,939
0
0
null
null
null
null
UTF-8
Java
false
false
2,192
java
package com.ywt.ba03; import com.ywt.ba02.Student; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.AfterReturning; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import org.springframework.stereotype.Component; import java.util.Date; /** * @author ywt * @version 1.0 * @date 2020/12/1 19:16 */ /** * @Aspect :是Aspectj框架中的注解。 * 作用:表示当前类是切面类。 * 切面类:是用来给业务方法增加功能的类,在这个类中由切面的功能代码。 */ @Aspect @Component("myAspect") public class MyAspect { /** * 环绕方法的定义格式:公共方法public, * 必须有一个返回值,推荐是Object * 方法名称自定义, * 方法是有参数的,固定的参数 ProceedingJointPoint */ /** * @Around:环绕置通知 * 属性:value 切入表达式 * 位置:在方法定义的上面 * 特点:1.它是功能最强的通知 * 2.在目标方法前和后都能增强功能。 * 3.控制目标方法是否被调用执行。 * 4.修改原来的目标方法的执行结果。 影响最后的调用结果。 * * 环绕通知,等同于JDK动态代理的 InvocationHandler接口 * 参数:ProceedingJoinPoint 等同于Method * 返回值:就是目标方法的执行结果,可以被修改 * * 环绕通知:经常做事务,在目标方法之前开启事务,执行目标方法,在目标方法之后执行事务。 */ @Around(value = "execution(* *..SomeServiceImpl.doFirst(..))") public Object myAround(ProceedingJoinPoint pjb) throws Throwable { //实现环绕通知 Object obj = null; System.out.println("在目标方法执行之前,添加日志:"+new Date()); //目标方法调用 obj = pjb.proceed(); //等同于method.invote(); System.out.println("在目标方法执行之后,提交事务"); obj = "sss"; return obj; } }
3348c45861b7b0323d6c714fbf6b85704c03ae75
f10dafcd4cad941de4a52f93859a29ea73d7c776
/app/src/main/java/com/georgeadaimi/scoutguide/NthLebList.java
130c3de00143ceeb77340c5f93fdb1d466df412d
[]
no_license
george-adaimi/ScoutGuide
5d92a37b3b74a0c002475320d30ef1624695d7d7
72160d1919eed117cd991eddd28289d9329faa17
refs/heads/master
2021-01-20T19:59:40.683189
2016-07-24T05:34:41
2016-07-24T05:34:41
64,050,359
0
0
null
null
null
null
UTF-8
Java
false
false
6,002
java
package com.georgeadaimi.scoutguide; import java.net.MalformedURLException; import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.SettableFuture; import com.microsoft.windowsazure.mobileservices.MobileServiceClient; import com.microsoft.windowsazure.mobileservices.MobileServiceList; import com.microsoft.windowsazure.mobileservices.http.NextServiceFilterCallback; import com.microsoft.windowsazure.mobileservices.http.ServiceFilter; import com.microsoft.windowsazure.mobileservices.http.ServiceFilterRequest; import com.microsoft.windowsazure.mobileservices.http.ServiceFilterResponse; import com.microsoft.windowsazure.mobileservices.table.MobileServiceTable; import android.app.AlertDialog; import android.app.Fragment; import android.os.AsyncTask; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ListView; import android.widget.ProgressBar; import android.widget.TextView; public class NthLebList extends Fragment { private MobileServiceClient mClient; private MobileServiceTable<Emplacement> mToDoTable; private ProgressBar mProgressBar; private CursorAdapter mAdapter; AsyncTask<Void, Void, Void> task; public NthLebList(){ } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.listview, container, false); //getActivity().getActionBar().setTitle("North Lebanon"); mProgressBar = (ProgressBar) view.findViewById(R.id.loadingProgressBar); // Initialize the progress bar mProgressBar.setVisibility(ProgressBar.GONE); try { // Create the Mobile Service Client instance, using the provided // Mobile Service URL and key mClient = new MobileServiceClient( "https://scoutguide.azurewebsites.net", getActivity() ).withFilter(new ProgressFilter()); // Get the Mobile Service Table instance to use mToDoTable = mClient.getTable(Emplacement.class); // Create an adapter to bind the items with the view mAdapter = new CursorAdapter(getActivity(), R.layout.listview_item); ListView listViewToDo = (ListView) view.findViewById(R.id.listView1); listViewToDo.setAdapter(mAdapter); TextView delete = (TextView) view.findViewById(R.id.deleteText); delete.setVisibility(View.INVISIBLE); // Load the items from the Mobile Service refreshItemsFromTable(); } catch (MalformedURLException e) { createAndShowDialog(new Exception("There was an error creating the Mobile Service. Verify the URL"), "Error"); } return view; } /** * Creates a dialog and shows it * * @param exception * The exception to show in the dialog * @param title * The dialog title */ private void createAndShowDialog(Exception exception, String title) { Throwable ex = exception; if(exception.getCause() != null){ ex = exception.getCause(); } createAndShowDialog(ex.getMessage(), title); } /** * Refresh the list with the items in the Mobile Service Table */ private void refreshItemsFromTable() { // Get the items that weren't marked as completed and add them in the // adapter task= new AsyncTask<Void, Void, Void>() { @Override protected Void doInBackground(Void... params) { try { final MobileServiceList<Emplacement> result = mToDoTable.where().field("district").eq("North Lebanon").execute().get(); getActivity().runOnUiThread(new Runnable() { @Override public void run() { mAdapter.clear(); for (Emplacement item : result) { mAdapter.add(item); } } }); } catch (Exception exception) { createAndShowDialog(exception, "Error"); } return null; } }.execute(); } /** * Creates a dialog and shows it * * @param message * The dialog message * @param title * The dialog title */ private void createAndShowDialog(String message, String title) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setMessage(message); builder.setTitle(title); builder.create().show(); } private class ProgressFilter implements ServiceFilter { @Override public ListenableFuture<ServiceFilterResponse> handleRequest( ServiceFilterRequest request, NextServiceFilterCallback next) { getActivity().runOnUiThread(new Runnable() { @Override public void run() { if (mProgressBar != null) mProgressBar.setVisibility(ProgressBar.VISIBLE); } }); SettableFuture<ServiceFilterResponse> result = SettableFuture.create(); try { ServiceFilterResponse response = next.onNext(request).get(); result.set(response); } catch (Exception exc) { result.setException(exc); } dismissProgressBar(); return result; } private void dismissProgressBar() { getActivity().runOnUiThread(new Runnable() { @Override public void run() { if (mProgressBar != null) mProgressBar.setVisibility(ProgressBar.GONE); } }); } } @Override public void onStop() { super.onStop(); //check the state of the task if(task != null && task.getStatus() == AsyncTask.Status.RUNNING) task.cancel(true); } }
[ "George Adaimi" ]
George Adaimi
397f0868c0a8905c49fe0202db479889696d2461
042a45380fb482d86d53623cb809649f7f26868b
/hc-pd-dao/src/main/java/com/hc/scm/pd/dao/mapper/PdWorkProcessCategoryMapper.java
f617a918fa9eb0dfa939714ee0703034a594138c
[]
no_license
lijinxi/hc-pd
61aa35fd55a0b99b69a029ab8293af930a28a6ba
216a231be5e1b46c05c95ccf75b37bd598509172
refs/heads/master
2021-01-10T08:42:58.019295
2015-12-17T07:35:20
2015-12-17T07:35:20
47,649,522
0
0
null
null
null
null
UTF-8
Java
false
false
467
java
package com.hc.scm.pd.dao.mapper; import com.hc.scm.common.base.mapper.BaseCrudMapper; /** * Description: 请写出类的用途 * All rights Reserved, Designed By hc* Copyright: Copyright(C) 2014-2015 * Company: Wonhigh. * @author: Administrator * @date: 2015-04-29 17:34:08 * @version 1.0.0 */ public interface PdWorkProcessCategoryMapper extends BaseCrudMapper { public <ModelType> String checkCategoryNo(String workCateCode); }
000ecfaf4aa697c962ddef2d13d3ff621cfcbe14
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/9/9_2c5ad38166ecdf5916bbdb345437a6f60b580880/AdministradorOrdenesDespachoBean/9_2c5ad38166ecdf5916bbdb345437a6f60b580880_AdministradorOrdenesDespachoBean_t.java
b6eeb4c86bfd61c5ccaebc59afc787e9f6bbf8f8
[]
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
1,245
java
package despacho.backend.administradores; import java.util.List; import javax.ejb.Stateless; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import despacho.backend.entities.*; @Stateless public class AdministradorOrdenesDespachoBean implements AdministradorOrdenesDespacho { @PersistenceContext(unitName="portalweb.despacho") private EntityManager em; @Override public void agregar(OrdenDespacho ordenDespacho) { this.em.persist(ordenDespacho); } @Override public List<OrdenDespacho> listar() { @SuppressWarnings("unchecked") List<OrdenDespacho> ordenesDespacho = this.em.createQuery(" FROM OrdenDespacho").getResultList(); return ordenesDespacho; } @Override public List<OrdenDespacho> listarPorEstado(String estado) { @SuppressWarnings("unchecked") List<OrdenDespacho> ordenesDespacho = this.em.createQuery(" FROM OrdenDespacho WHERE estado = '" + estado + "' ORDER BY fecha").getResultList(); return ordenesDespacho; } @Override public void actualizar(OrdenDespacho ordenDespacho) { this.em.merge(ordenDespacho); } @Override public OrdenDespacho get(int id) { return this.em.find(OrdenDespacho.class, id); } }
a52f01343e7bad603ab9798b6111a996d9390e5f
87912046ca1a6e204d87d5fd06361738b4a11027
/src/main/java/com/async/metrics/module/AspectsModule.java
2ded9aebd4bf4ad0fe4a005ff08ccd536ceeb8b1
[]
no_license
dalalsunil1986/async-metrics-codahale
0537d93edff323764fd81ff65193ee7aed668110
70bee68f4efa406ae92bfdfebe0298e498941fcf
refs/heads/master
2020-12-14T12:34:56.623546
2019-09-29T20:38:15
2019-09-29T20:38:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
948
java
package com.async.metrics.module; import com.async.metrics.aspect.AsyncExceptionMeteredAspect; import com.async.metrics.aspect.AsyncTimedAspect; import com.codahale.metrics.MetricRegistry; import com.google.inject.AbstractModule; import com.google.inject.Provides; import com.google.inject.Singleton; import org.aspectj.lang.Aspects; public class AspectsModule extends AbstractModule { private final MetricRegistry metricRegistry; public AspectsModule(MetricRegistry metricRegistry) { this.metricRegistry = metricRegistry; } @Override protected void configure() { initializeAspects(); } @Provides @Singleton private MetricRegistry getMetricRegistry() { return this.metricRegistry; } private void initializeAspects() { requestInjection(Aspects.aspectOf(AsyncTimedAspect.class)); requestInjection(Aspects.aspectOf(AsyncExceptionMeteredAspect.class)); } }
e920e2fb0ffe3ae73a84a9e6a745d24e4d6522ad
f283c18843cd0f4f54f64957b88160d48c0cb7d9
/Weartry/mobile/src/main/java/com/example/admin/weartry/MyService.java
8d4d203dd21df439d93173a113030e5549e8aeaa
[]
no_license
furyjack/Andorid-Tutorials
99aba4d4706a2234702555ed560c659236a3bb5b
7ca2e84605f30fb283a413eb1dcfbb71524c55e3
refs/heads/master
2021-01-12T04:21:31.323166
2016-12-29T08:04:26
2016-12-29T08:04:26
77,594,789
0
0
null
null
null
null
UTF-8
Java
false
false
1,255
java
package com.example.admin.weartry; import android.content.Intent; import com.google.android.gms.wearable.DataEvent; import com.google.android.gms.wearable.DataEventBuffer; import com.google.android.gms.wearable.DataMap; import com.google.android.gms.wearable.DataMapItem; import com.google.android.gms.wearable.WearableListenerService; public class MyService extends WearableListenerService { @Override public void onDataChanged(DataEventBuffer dataEventBuffer) { super.onDataChanged(dataEventBuffer); for(DataEvent dataevent:dataEventBuffer) { if(dataevent.getType()==DataEvent.TYPE_CHANGED) { DataMap map= DataMapItem.fromDataItem(dataevent.getDataItem()).getDataMap(); String path= dataevent.getDataItem().getUri().getPath(); if(path.equals("/int")) { int num=map.getInt("num"); Intent myintent = new Intent("com.example.admin.weartry"); myintent.putExtra("message",""+ num); myintent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);//You might need this getApplicationContext().sendBroadcast(myintent); } } } } }
a0e19613c619d5e3525db45fce4ce4a6ed2c8d50
c5a7bb4a54a7e16d4b6e53b234981f984d54b901
/src/main/java/com/yts/art/DemoClass.java
c482615c5a2957122061048b6ea4bc2234c1fb62
[]
no_license
ashwinnigam/testrepo
00dafeee04eb9f4093f203d833e9d9768fae984d
c01aa97c8f36eef365f3d139e02a0465ba9266a8
refs/heads/master
2021-01-09T13:47:59.235815
2020-02-23T13:33:54
2020-02-23T13:33:54
242,324,859
0
0
null
2020-02-23T13:33:55
2020-02-22T10:51:14
Java
UTF-8
Java
false
false
138
java
package com.yts.art; public class DemoClass { public static void main(String[] args) { System.out.println("some code"); } }
12498d4f4f613ab64bbc441a86644c96bd946fb8
9998e826df8ba268cd62238f2b428f821a78359c
/src/main/java/com/organization/bo/EmployeeBOImpl.java
77458b085c82b78514fc4107690483ba4d5a8f51
[]
no_license
metallicatony/EmpGeoMongoWebapp
c170beb8f43738b719aa9f839c282c56cf8d6144
44b86750f23ba005b8ef19d304406c7780de7a13
refs/heads/master
2016-09-06T15:52:35.390109
2015-05-15T06:02:12
2015-05-15T06:02:12
35,656,366
0
0
null
null
null
null
UTF-8
Java
false
false
4,158
java
package com.organization.bo; import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.data.mongodb.core.query.Update; import org.springframework.stereotype.Component; import com.organization.adapter.EmployeeAdapter; import com.organization.domain.Employee; import com.organization.exception.AddressException; import com.organization.helper.EmployeeHelper; import com.organization.repository.EmployeeRepository; import com.organization.service.request.EmployeeRequest; import com.organization.service.response.EmployeeResponse; import com.organization.service.response.EmployeeResponses; @Component("employeeBO") @Scope("prototype") public class EmployeeBOImpl implements EmployeeBO { @Autowired private EmployeeRepository employeeRepository; @Autowired private EmployeeAdapter employeeAdapter; @Autowired private EmployeeHelper employeeHelper; private static final String default_radius = "20"; private static final Logger log = LoggerFactory.getLogger(EmployeeBOImpl.class); public EmployeeResponses getAllEmployees(String lname, String address, String radius) throws AddressException, Exception { Double[] latlng = null; // convert address to lat and long if (address != null) { latlng = employeeHelper.geoCode(address); radius = (radius != null) ? radius : default_radius; } // get all employees List<Employee> empDomainList = employeeRepository.findAll(lname, latlng, radius); // convert employee list to employee response EmployeeResponses empResponseList = null; if (empDomainList != null && empDomainList.size() > 0) { empResponseList = employeeAdapter.convertToEmployeeResponse(empDomainList); } else { // throw unknown input exception } log.info("employeeResponseList={}", empResponseList); return empResponseList; } public EmployeeResponse getEmployeeById(String empId) throws Exception { EmployeeResponse employeeResponse = null; Employee employee = employeeRepository.findById(empId); if (employee != null) { employeeResponse = employeeAdapter.convertToEmployeeResponse(employee); } log.info("employeeResponse={}", employeeResponse); return employeeResponse; } public EmployeeResponse updateEmployee(Long empId, EmployeeRequest employeeRequest) throws AddressException, Exception { EmployeeResponse employeeResponse = null; Employee employee = null; Update updateObject = null; Double[] latlng = null; if (employeeRequest != null) { latlng = employeeHelper.getGeoResult(employeeRequest.getAddress()); updateObject = employeeAdapter.buildDocument(employeeRequest, latlng); employee = employeeRepository.updateEmployee(empId, updateObject); if (employee != null && employee.getEmpId() != null) { employeeResponse = getEmployeeById(employee.getEmpId().toString()); } } log.info("employeeResponse={}", employeeResponse); return employeeResponse; } public EmployeeResponse createEmployee(EmployeeRequest employeeRequest) throws AddressException, Exception { EmployeeResponse employeeResponse = null; Employee employee = null; Double[] latlng = null; if (employeeRequest != null) { Long empId = employeeRepository.getNextId(); log.info("new employeeId={}", empId); latlng = employeeHelper.getGeoResult(employeeRequest.getAddress()); employee = employeeAdapter.buildDocument(empId, employeeRequest, latlng); employeeRepository.createEmployee(employee); if (employee.get_id() != null) { employeeResponse = employeeAdapter.convertToEmployeeResponse(employee); } } log.info("employeeResponse={}", employeeResponse); return employeeResponse; } public EmployeeResponse deleteEmployee(Long empId) throws Exception { EmployeeResponse employeeResponse = null; Employee employee = employeeRepository.deleteEmployee(empId); if (employee != null) { employeeResponse = employeeAdapter.convertToEmployeeResponse(employee); } log.info("employeeResponse={}", employeeResponse); return employeeResponse; } }
ce793828ed9af60355206c0b38594675412dac39
2e7da7b4a945ad9d713712ec944700def43006c5
/playground/src/battleship/Ship.java
dc0e4f8703bc5aa2067df633c0a818aab139ef41
[]
no_license
cnewmiller/se350_projects
cd8243e23d5711112945bb076a0676fa675e073c
f9082f0c3ce51a80a7cd18fa9bb6d476dff66f20
refs/heads/master
2021-01-23T17:42:57.986227
2017-11-19T21:31:01
2017-11-19T21:31:01
102,774,124
0
1
null
null
null
null
UTF-8
Java
false
false
795
java
package battleship; public class Ship { public enum Orientations{Horizontal, Vertical}; int x, y; //the top left corner int len; String name; Orientations orientation; Ship(int x1, int y1, int len, Ship.Orientations or){ this.x = x1; this.y = y1; this.len = len; this.name = (5 == len ? "carrier" : (3 == len ? "submarine" : "Unknown ship type")); this.orientation = or; }; @Override public String toString() { return String.format("Name: %s\nLeft corner = %d, top corner = %d, length = %d", name, x, y, len); } public String getCoordsFormatted() { return String.format("%s found: (%d,%d) to (%d,%d)",this.name, x, y, (orientation == Orientations.Horizontal ? x+len-1 : x), (orientation == Orientations.Vertical ? y+len-1 : y)); } }
f19f21986bc627eed48007a639f1645756662499
5e14786bb9d356a7735985bc0adc4acc7b4ecdcf
/src/main/java/com/jeecg/empchangewf/controller/EmpChangeWfController.java
1d7cf7f423a7b8d39c51f79d29962f1ff0753e4d
[]
no_license
zskang/jeecg-humSystem
bc3db30cca3cdcebd30910a8ccc663d86804ae00
a524bedd77dcd551e40a876780f8ebb3a48bdede
refs/heads/master
2020-12-25T15:17:51.864453
2016-09-12T11:49:48
2016-09-12T11:49:48
66,537,154
0
0
null
null
null
null
UTF-8
Java
false
false
14,090
java
package com.jeecg.empchangewf.controller; import com.jeecg.empchangewf.entity.EmpChangeWfEntity; import com.jeecg.empchangewf.service.EmpChangeWfServiceI; import java.util.ArrayList; import java.util.List; import java.text.SimpleDateFormat; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; import org.jeecgframework.core.common.controller.BaseController; import org.jeecgframework.core.common.exception.BusinessException; import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery; import org.jeecgframework.core.common.model.json.AjaxJson; import org.jeecgframework.core.common.model.json.DataGrid; import org.jeecgframework.core.constant.Globals; import org.jeecgframework.core.util.StringUtil; import org.jeecgframework.tag.core.easyui.TagUtil; import org.jeecgframework.web.system.pojo.base.TSDepart; import org.jeecgframework.web.system.service.SystemService; import org.jeecgframework.core.util.MyBeanUtils; import java.io.OutputStream; import org.jeecgframework.core.util.BrowserUtils; import org.jeecgframework.poi.excel.ExcelExportUtil; import org.jeecgframework.poi.excel.ExcelImportUtil; import org.jeecgframework.poi.excel.entity.ExportParams; import org.jeecgframework.poi.excel.entity.ImportParams; import org.jeecgframework.poi.excel.entity.TemplateExportParams; import org.jeecgframework.poi.excel.entity.vo.NormalExcelConstants; import org.jeecgframework.poi.excel.entity.vo.TemplateExcelConstants; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.jeecgframework.core.util.ResourceUtil; import java.io.IOException; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartHttpServletRequest; import java.util.Map; import org.jeecgframework.core.util.ExceptionUtil; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.jeecgframework.core.beanvalidator.BeanValidators; import java.util.Set; import javax.validation.ConstraintViolation; import javax.validation.Validator; import java.net.URI; import org.springframework.http.MediaType; import org.springframework.web.util.UriComponentsBuilder; /** * @Title: Controller * @Description: 员工异动流程表 * @author onlineGenerator * @date 2016-09-06 17:23:59 * @version V1.0 * */ @Controller @RequestMapping("/empChangeWfController") public class EmpChangeWfController extends BaseController { /** * Logger for this class */ private static final Logger logger = Logger.getLogger(EmpChangeWfController.class); @Autowired private EmpChangeWfServiceI empChangeWfService; @Autowired private SystemService systemService; @Autowired private Validator validator; /** * 员工异动流程表列表 页面跳转 * * @return */ @RequestMapping(params = "list") public ModelAndView list(HttpServletRequest request) { return new ModelAndView("com/jeecg/empchangewf/empChangeWfList"); } /** * easyui AJAX请求数据 * * @param request * @param response * @param dataGrid * @param user */ @RequestMapping(params = "datagrid") public void datagrid(EmpChangeWfEntity empChangeWf,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) { CriteriaQuery cq = new CriteriaQuery(EmpChangeWfEntity.class, dataGrid); //查询条件组装器 org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, empChangeWf, request.getParameterMap()); try{ //自定义追加查询条件 }catch (Exception e) { throw new BusinessException(e.getMessage()); } cq.add(); this.empChangeWfService.getDataGridReturn(cq, true); TagUtil.datagrid(response, dataGrid); } /** * 删除员工异动流程表 * * @return */ @RequestMapping(params = "doDel") @ResponseBody public AjaxJson doDel(EmpChangeWfEntity empChangeWf, HttpServletRequest request) { String message = null; AjaxJson j = new AjaxJson(); empChangeWf = systemService.getEntity(EmpChangeWfEntity.class, empChangeWf.getId()); message = "员工异动流程表删除成功"; try{ empChangeWfService.delete(empChangeWf); systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO); }catch(Exception e){ e.printStackTrace(); message = "员工异动流程表删除失败"; throw new BusinessException(e.getMessage()); } j.setMsg(message); return j; } /** * 批量删除员工异动流程表 * * @return */ @RequestMapping(params = "doBatchDel") @ResponseBody public AjaxJson doBatchDel(String ids,HttpServletRequest request){ String message = null; AjaxJson j = new AjaxJson(); message = "员工异动流程表删除成功"; try{ for(String id:ids.split(",")){ EmpChangeWfEntity empChangeWf = systemService.getEntity(EmpChangeWfEntity.class, id ); empChangeWfService.delete(empChangeWf); systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO); } }catch(Exception e){ e.printStackTrace(); message = "员工异动流程表删除失败"; throw new BusinessException(e.getMessage()); } j.setMsg(message); return j; } /** * 添加员工异动流程表 * * @param ids * @return */ @RequestMapping(params = "doAdd") @ResponseBody public AjaxJson doAdd(EmpChangeWfEntity empChangeWf, HttpServletRequest request) { String message = null; AjaxJson j = new AjaxJson(); message = "员工异动流程表添加成功"; try{ empChangeWfService.save(empChangeWf); systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO); }catch(Exception e){ e.printStackTrace(); message = "员工异动流程表添加失败"; throw new BusinessException(e.getMessage()); } j.setMsg(message); return j; } /** * 更新员工异动流程表 * * @param ids * @return */ @RequestMapping(params = "doUpdate") @ResponseBody public AjaxJson doUpdate(EmpChangeWfEntity empChangeWf, HttpServletRequest request) { String message = null; AjaxJson j = new AjaxJson(); message = "员工异动流程表更新成功"; EmpChangeWfEntity t = empChangeWfService.get(EmpChangeWfEntity.class, empChangeWf.getId()); try { MyBeanUtils.copyBeanNotNull2Bean(empChangeWf, t); empChangeWfService.saveOrUpdate(t); systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO); } catch (Exception e) { e.printStackTrace(); message = "员工异动流程表更新失败"; throw new BusinessException(e.getMessage()); } j.setMsg(message); return j; } /** * 员工异动流程表新增页面跳转 * * @return */ @RequestMapping(params = "goAdd") public ModelAndView goAdd(EmpChangeWfEntity empChangeWf, HttpServletRequest req) { if (StringUtil.isNotEmpty(empChangeWf.getId())) { empChangeWf = empChangeWfService.getEntity(EmpChangeWfEntity.class, empChangeWf.getId()); req.setAttribute("empChangeWfPage", empChangeWf); } return new ModelAndView("com/jeecg/empchangewf/empChangeWf-add"); } /** * 员工异动流程表编辑页面跳转 * * @return */ @RequestMapping(params = "goUpdate") public ModelAndView goUpdate(EmpChangeWfEntity empChangeWf, HttpServletRequest req) { if (StringUtil.isNotEmpty(empChangeWf.getId())) { empChangeWf = empChangeWfService.getEntity(EmpChangeWfEntity.class, empChangeWf.getId()); req.setAttribute("empChangeWfPage", empChangeWf); } return new ModelAndView("com/jeecg/empchangewf/empChangeWf-update"); } /** * 导入功能跳转 * * @return */ @RequestMapping(params = "upload") public ModelAndView upload(HttpServletRequest req) { req.setAttribute("controller_name","empChangeWfController"); return new ModelAndView("common/upload/pub_excel_upload"); } /** * 导出excel * * @param request * @param response */ @RequestMapping(params = "exportXls") public String exportXls(EmpChangeWfEntity empChangeWf,HttpServletRequest request,HttpServletResponse response , DataGrid dataGrid,ModelMap modelMap) { CriteriaQuery cq = new CriteriaQuery(EmpChangeWfEntity.class, dataGrid); org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, empChangeWf, request.getParameterMap()); List<EmpChangeWfEntity> empChangeWfs = this.empChangeWfService.getListByCriteriaQuery(cq,false); modelMap.put(NormalExcelConstants.FILE_NAME,"员工异动流程表"); modelMap.put(NormalExcelConstants.CLASS,EmpChangeWfEntity.class); modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("员工异动流程表列表", "导出人:"+ResourceUtil.getSessionUserName().getRealName(), "导出信息")); modelMap.put(NormalExcelConstants.DATA_LIST,empChangeWfs); return NormalExcelConstants.JEECG_EXCEL_VIEW; } /** * 导出excel 使模板 * * @param request * @param response */ @RequestMapping(params = "exportXlsByT") public String exportXlsByT(EmpChangeWfEntity empChangeWf,HttpServletRequest request,HttpServletResponse response , DataGrid dataGrid,ModelMap modelMap) { modelMap.put(NormalExcelConstants.FILE_NAME,"员工异动流程表"); modelMap.put(NormalExcelConstants.CLASS,EmpChangeWfEntity.class); modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("员工异动流程表列表", "导出人:"+ResourceUtil.getSessionUserName().getRealName(), "导出信息")); modelMap.put(NormalExcelConstants.DATA_LIST,new ArrayList()); return NormalExcelConstants.JEECG_EXCEL_VIEW; } @SuppressWarnings("unchecked") @RequestMapping(params = "importExcel", method = RequestMethod.POST) @ResponseBody public AjaxJson importExcel(HttpServletRequest request, HttpServletResponse response) { AjaxJson j = new AjaxJson(); MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; Map<String, MultipartFile> fileMap = multipartRequest.getFileMap(); for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { MultipartFile file = entity.getValue();// 获取上传文件对象 ImportParams params = new ImportParams(); params.setTitleRows(2); params.setHeadRows(1); params.setNeedSave(true); try { List<EmpChangeWfEntity> listEmpChangeWfEntitys = ExcelImportUtil.importExcel(file.getInputStream(),EmpChangeWfEntity.class,params); for (EmpChangeWfEntity empChangeWf : listEmpChangeWfEntitys) { empChangeWfService.save(empChangeWf); } j.setMsg("文件导入成功!"); } catch (Exception e) { j.setMsg("文件导入失败!"); logger.error(ExceptionUtil.getExceptionMessage(e)); }finally{ try { file.getInputStream().close(); } catch (IOException e) { e.printStackTrace(); } } } return j; } @RequestMapping(method = RequestMethod.GET) @ResponseBody public List<EmpChangeWfEntity> list() { List<EmpChangeWfEntity> listEmpChangeWfs=empChangeWfService.getList(EmpChangeWfEntity.class); return listEmpChangeWfs; } @RequestMapping(value = "/{id}", method = RequestMethod.GET) @ResponseBody public ResponseEntity<?> get(@PathVariable("id") String id) { EmpChangeWfEntity task = empChangeWfService.get(EmpChangeWfEntity.class, id); if (task == null) { return new ResponseEntity(HttpStatus.NOT_FOUND); } return new ResponseEntity(task, HttpStatus.OK); } @RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) @ResponseBody public ResponseEntity<?> create(@RequestBody EmpChangeWfEntity empChangeWf, UriComponentsBuilder uriBuilder) { //调用JSR303 Bean Validator进行校验,如果出错返回含400错误码及json格式的错误信息. Set<ConstraintViolation<EmpChangeWfEntity>> failures = validator.validate(empChangeWf); if (!failures.isEmpty()) { return new ResponseEntity(BeanValidators.extractPropertyAndMessage(failures), HttpStatus.BAD_REQUEST); } //保存 empChangeWfService.save(empChangeWf); //按照Restful风格约定,创建指向新任务的url, 也可以直接返回id或对象. String id = empChangeWf.getId(); URI uri = uriBuilder.path("/rest/empChangeWfController/" + id).build().toUri(); HttpHeaders headers = new HttpHeaders(); headers.setLocation(uri); return new ResponseEntity(headers, HttpStatus.CREATED); } @RequestMapping(value = "/{id}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<?> update(@RequestBody EmpChangeWfEntity empChangeWf) { //调用JSR303 Bean Validator进行校验,如果出错返回含400错误码及json格式的错误信息. Set<ConstraintViolation<EmpChangeWfEntity>> failures = validator.validate(empChangeWf); if (!failures.isEmpty()) { return new ResponseEntity(BeanValidators.extractPropertyAndMessage(failures), HttpStatus.BAD_REQUEST); } //保存 empChangeWfService.saveOrUpdate(empChangeWf); //按Restful约定,返回204状态码, 无内容. 也可以返回200状态码. return new ResponseEntity(HttpStatus.NO_CONTENT); } @RequestMapping(value = "/{id}", method = RequestMethod.DELETE) @ResponseStatus(HttpStatus.NO_CONTENT) public void delete(@PathVariable("id") String id) { empChangeWfService.deleteEntityById(EmpChangeWfEntity.class, id); } }
64ba57bf72541488eb42702f9ab007b00bf83930
7927344fbe02af07ef137a3b3453a9891c586238
/net/minecraft/tileentity/TileEntityCommandBlock.java
f3cde59db041036aa62f9150870dbde8c3e1eb4c
[ "MIT" ]
permissive
Hexeption/How-to-code-an-advanced-hacked-client-for-1.9
a9d4df9c1254402c5ccf47912dbd8c6e1d9894c3
f23beceb4b2996e0de24b2822aae940dae1fc88e
refs/heads/master
2021-01-18T22:41:13.800852
2016-12-11T18:25:26
2016-12-11T18:25:26
53,270,980
9
19
null
2016-06-05T07:24:26
2016-03-06T19:04:09
Java
UTF-8
Java
false
false
6,314
java
package net.minecraft.tileentity; import io.netty.buffer.ByteBuf; import net.minecraft.block.Block; import net.minecraft.block.BlockCommandBlock; import net.minecraft.block.state.IBlockState; import net.minecraft.command.CommandResultStats; import net.minecraft.entity.Entity; import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.Packet; import net.minecraft.network.play.server.SPacketUpdateTileEntity; import net.minecraft.server.MinecraftServer; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; public class TileEntityCommandBlock extends TileEntity { private boolean powered; private boolean auto; private boolean conditionMet; private boolean field_184262_h; private final CommandBlockBaseLogic commandBlockLogic = new CommandBlockBaseLogic() { public BlockPos getPosition() { return TileEntityCommandBlock.this.pos; } public Vec3d getPositionVector() { return new Vec3d((double)TileEntityCommandBlock.this.pos.getX() + 0.5D, (double)TileEntityCommandBlock.this.pos.getY() + 0.5D, (double)TileEntityCommandBlock.this.pos.getZ() + 0.5D); } public World getEntityWorld() { return TileEntityCommandBlock.this.getWorld(); } public void setCommand(String command) { super.setCommand(command); TileEntityCommandBlock.this.markDirty(); } public void updateCommand() { IBlockState iblockstate = TileEntityCommandBlock.this.worldObj.getBlockState(TileEntityCommandBlock.this.pos); TileEntityCommandBlock.this.getWorld().notifyBlockUpdate(TileEntityCommandBlock.this.pos, iblockstate, iblockstate, 3); } public int func_145751_f() { return 0; } public void func_145757_a(ByteBuf p_145757_1_) { p_145757_1_.writeInt(TileEntityCommandBlock.this.pos.getX()); p_145757_1_.writeInt(TileEntityCommandBlock.this.pos.getY()); p_145757_1_.writeInt(TileEntityCommandBlock.this.pos.getZ()); } public Entity getCommandSenderEntity() { return null; } public MinecraftServer getServer() { return TileEntityCommandBlock.this.worldObj.getMinecraftServer(); } }; public void writeToNBT(NBTTagCompound compound) { super.writeToNBT(compound); this.commandBlockLogic.writeDataToNBT(compound); compound.setBoolean("powered", this.isPowered()); compound.setBoolean("conditionMet", this.isConditionMet()); compound.setBoolean("auto", this.isAuto()); } public void readFromNBT(NBTTagCompound compound) { super.readFromNBT(compound); this.commandBlockLogic.readDataFromNBT(compound); this.setPowered(compound.getBoolean("powered")); this.setConditionMet(compound.getBoolean("conditionMet")); this.setAuto(compound.getBoolean("auto")); } public Packet<?> getDescriptionPacket() { if (this.func_184257_h()) { this.func_184252_d(false); NBTTagCompound nbttagcompound = new NBTTagCompound(); this.writeToNBT(nbttagcompound); return new SPacketUpdateTileEntity(this.pos, 2, nbttagcompound); } else { return null; } } public boolean func_183000_F() { return true; } public CommandBlockBaseLogic getCommandBlockLogic() { return this.commandBlockLogic; } public CommandResultStats getCommandResultStats() { return this.commandBlockLogic.getCommandResultStats(); } public void setPowered(boolean p_184250_1_) { this.powered = p_184250_1_; } public boolean isPowered() { return this.powered; } public boolean isAuto() { return this.auto; } public void setAuto(boolean p_184253_1_) { boolean flag = this.auto; this.auto = p_184253_1_; if (!flag && p_184253_1_ && !this.powered && this.worldObj != null && this.func_184251_i() != TileEntityCommandBlock.Mode.SEQUENCE) { Block block = this.getBlockType(); if (block instanceof BlockCommandBlock) { BlockPos blockpos = this.getPos(); BlockCommandBlock blockcommandblock = (BlockCommandBlock)block; this.conditionMet = !this.func_184258_j() || blockcommandblock.func_185562_e(this.worldObj, blockpos, this.worldObj.getBlockState(blockpos)); this.worldObj.scheduleUpdate(blockpos, block, block.tickRate(this.worldObj)); if (this.conditionMet) { blockcommandblock.func_185563_c(this.worldObj, blockpos); } } } } public boolean isConditionMet() { return this.conditionMet; } public void setConditionMet(boolean p_184249_1_) { this.conditionMet = p_184249_1_; } public boolean func_184257_h() { return this.field_184262_h; } public void func_184252_d(boolean p_184252_1_) { this.field_184262_h = p_184252_1_; } public TileEntityCommandBlock.Mode func_184251_i() { Block block = this.getBlockType(); return block == Blocks.command_block ? TileEntityCommandBlock.Mode.REDSTONE : (block == Blocks.repeating_command_block ? TileEntityCommandBlock.Mode.AUTO : (block == Blocks.chain_command_block ? TileEntityCommandBlock.Mode.SEQUENCE : TileEntityCommandBlock.Mode.REDSTONE)); } public boolean func_184258_j() { IBlockState iblockstate = this.worldObj.getBlockState(this.getPos()); return iblockstate.getBlock() instanceof BlockCommandBlock ? ((Boolean)iblockstate.getValue(BlockCommandBlock.CONDITIONAL)).booleanValue() : false; } /** * validates a tile entity */ public void validate() { this.blockType = null; super.validate(); } public static enum Mode { SEQUENCE, AUTO, REDSTONE; } }
b34b8ef740707a7d08e9935a0471d564bd97d13f
dd276cd187a30367f3ae7fae52aa982db7233188
/src/java/entity/mpm/PontosFortesInternos.java
d524d5c79c7a1fcc083d1d2ada1d59c3f209eb7e
[]
no_license
tenclar/sgcn
7b4320df7e8c6cddb3326e2f08c19c63ccdf0a15
8486cac62d1f857403b16ccc6480e9fe5e633155
refs/heads/master
2021-09-08T11:28:24.477425
2015-03-13T16:04:10
2015-03-13T16:04:10
13,866,831
0
0
null
null
null
null
UTF-8
Java
false
false
1,708
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package entity.mpm; import java.io.Serializable; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.ManyToOne; import javax.persistence.Table; /** * * @author tenclar */ @Entity @Table(name="mpm_pontosfortesinternos") public class PontosFortesInternos implements Serializable{ @Id @GeneratedValue private Integer id; @ManyToOne private PontoForteInterno pontoforteinterno; @ManyToOne private Plano plano; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public PontoForteInterno getPontoforteinterno() { return pontoforteinterno; } public void setPontoforteinterno(PontoForteInterno pontoforteinterno) { this.pontoforteinterno = pontoforteinterno; } public Plano getPlano() { return plano; } public void setPlano(Plano plano) { this.plano = plano; } @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final PontosFortesInternos other = (PontosFortesInternos) obj; if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) { return false; } return true; } @Override public int hashCode() { int hash = 3; hash = 61 * hash + (this.id != null ? this.id.hashCode() : 0); return hash; } }
7e7dc7c3bcedc37a8b353c1cd2a8554daec872c6
0f1b156c646af5bb9b4ac3feaec65c0f4199d043
/backend/src/main/java/com/mygroup/project/model/dto/specialized/OpinionFormDTO.java
e8066a869c3ffded3a0b99f817fdfaeb22871f2e
[]
no_license
I-AzraeL-I/Projekt-Kompetencyjny-GRUPA2
8015ef81169ced00b5010169b0559e2e09031394
aea39bdeab12925f5ee5476c2bd58092cb6e45a1
refs/heads/main
2023-02-21T20:59:22.790721
2021-01-28T12:45:26
2021-01-28T12:45:26
304,338,599
0
0
null
null
null
null
UTF-8
Java
false
false
559
java
package com.mygroup.project.model.dto.specialized; import lombok.Getter; import lombok.Setter; import org.hibernate.validator.constraints.Length; import javax.validation.constraints.Max; import javax.validation.constraints.Min; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; @Getter @Setter public class OpinionFormDTO { @NotBlank @Length(max = 255) private String comment; @NotNull @Min(value = 0) @Max(value = 5) private Integer rating; @NotNull private Long tutorId; }
c78ad18e1056b0eeaa4e674dd05db0496dad1d99
61e2d1fbf4edfac1f8e2bd37608a8fa59b38c858
/src/heritagePackage/Vehicle.java
c58d4ccc33343f33da72a62850ff705b895ab373
[]
no_license
Luiso88/GenericTypes
7d6ff788ae6b8ba43621a7b37c051ce14f576ef4
359fc70ed1194a21a4c8e2fa4c9e1b5141377610
refs/heads/master
2022-04-24T11:59:58.187520
2020-04-26T10:46:54
2020-04-26T10:46:54
255,138,553
0
0
null
null
null
null
UTF-8
Java
false
false
1,223
java
package heritagePackage; public abstract class Vehicle { private int wheels; public Vehicle(int newWheels, String newDriver, String newColour, int newSpeed, double newPositionX) { this.wheels = newWheels; this.driver = newDriver; this.colour = newColour; this.speed = newSpeed; this.positionX = newPositionX; } private double relativeMovement(int time) { return speed * time; } protected int getWheels() { return wheels; } protected double getRelativeMovement(int time) { return relativeMovement(time); } public void setWheels(int wheels) { this.wheels = wheels; } public String getDriver() { return driver; } public void setDriver(String driver) { this.driver = driver; } public String getColour() { return colour; } public void setColour(String colour) { this.colour = colour; } public int getSpeed() { return speed; } public void setSpeed(int speed) { this.speed = speed; } public double getPositionX() { return positionX; } public void setPositionX(double positionX) { this.positionX = positionX; } private String driver; private String colour; protected int speed; protected double positionX; protected abstract void move(int time); }
5a8d4bc858b0c9206b82646c17ca2cbf3b1a48a2
ef3f0863342b140d93d05c584b7c7ed1a773abef
/src/test/java/com/springbot/phapdinh/github/web/springbootwebapplication/TodoServiceTests.java
59094c04c5a3a79498d553815eef94b5272d307b
[]
no_license
phapdinh/springbot
3fff27d2191fed07cc15312e9b701eac3efd50e9
e34c03332c9df225622062cf8a6246a2787e29bf
refs/heads/master
2021-06-20T02:14:30.553949
2020-12-11T02:43:58
2020-12-11T02:43:58
146,522,254
0
0
null
2020-12-11T02:43:59
2018-08-29T00:27:28
Java
UTF-8
Java
false
false
710
java
package com.springbot.phapdinh.github.web.springbootwebapplication; import static org.junit.Assert.assertEquals; import java.util.Date; import com.springbot.phapdinh.github.web.springbootwebapplication.model.Todo; import com.springbot.phapdinh.github.web.springbootwebapplication.service.TodoService; import org.junit.Test; public class TodoServiceTests { private TodoService todos = new TodoService(); @Test public void TodoService() { Todo retrievedTodo0 = todos.retrieveTodo(0); Todo todo = new Todo(1, "in28Minutes", "Learn Spring MVC", new Date(), false); Todo retrievedTodo1 = todos.retrieveTodo(1); assertEquals(todo, retrievedTodo1); assertEquals(null, retrievedTodo0); } }
d30baa38474ed0a6b19858895e42846d33b50dd4
38f2f5d6a05f1c733af019dec2befc65383d806d
/src/com/pm/order/busin/OrderFromBusin.java
17d9c5f8516f00178f3755d6f9db6fc6af0451d2
[]
no_license
guanzihao/pm
374cb27249fe5a273b088b903f8a8834c65921ab
60a57e3bb2505ca9ad12ba267454c744354352ce
refs/heads/master
2021-01-18T09:55:51.308939
2017-08-15T09:15:40
2017-08-15T09:15:40
100,359,341
0
0
null
null
null
null
UTF-8
Java
false
false
4,693
java
package com.pm.order.busin; /** * 订单的业务接口 * @author Administrator * */ import java.util.Date; import java.util.List; import com.pm.order.bean.BgEcExpDomain; import com.pm.order.bean.BgIcExpDomain; import com.pm.order.bean.CcEcExpDomain; import com.pm.order.bean.CcIcExpDomain; import com.pm.order.bean.DingdanAddtion; import com.pm.order.bean.WlEcExpDomain; import com.pm.order.bean.WlIcExpDomain; import com.pm.order.bean.WmEcExpDomain; import com.pm.order.bean.WmIcExpDomain; import com.sup.order.bean.OrderFrom; public interface OrderFromBusin { /** * 按类型保存任务 * @param taskId */ void saveTaskIdOrderFrom(String taskId); /** * 根据 任务Id得到一条任务信息 * @param id * @return */ OrderFrom getOrderFrom(String id); /** * @Description 根据任务ID返回订单列表 * @author Chu Zhaocheng * @date 2017年6月15日 下午12:52:28 * @action listOrderFrom * @return List<OrderFrom> */ List<OrderFrom> listOrderFrom(String taskId); /** * 对订单进行修改操作 * @param task */ void saveOrderFrom(OrderFrom orderFrom,String suppersId,String flowTypeId,String taskId,String currUserId); /** * 根据类型Id和主任务Id得到一个子订单信息 * @param typeId * @param taskId */ OrderFrom getTypeIdByOrderFrom(String typeId, String taskId); /** * 客服对订单进行终止 * @param id */ void terminationOrderFrom(String id); /** * 根据订单类型得到订单的数量 * @param id * @param flag -1:提前 0:按时 1: 延迟 2:同类型的全部订单 * @return */ Integer getOrderStatusCount(String id,String flag, String name,String supName, String startDate, String endDate); /** * 会员订单数 * @param endDate * @param startDate * @param endDate * @return */ List<Integer> getOrderMemberNum(Date startDate, Date endDate); /** * 进口报关导出报表 * @param orderCode * @param startDate * @param endDate * @param name * @param supName * @return */ List<BgIcExpDomain> getBgImccOrderExecl(String typeId,String orderCode, String startDate, String endDate, String supName, String name); /** * 出口报关导出报表 * @param orderCode * @param startDate * @param endDate * @param name * @param supName * @return */ List<BgEcExpDomain> getBgEmccOrderExecl(String typeId,String orderCode, String startDate, String endDate, String supName, String name); /** * 物流出口导出报表 * @param orderCode * @param startDate * @param endDate * @param name * @param supName * @return */ List<WlIcExpDomain> getWlImccOrderExecl(String typeId,String orderCode, String startDate, String endDate, String supName, String name); /** * 物流进口导出报表 * @param orderCode * @param startDate * @param endDate * @param name * @param supName * @return */ List<WlEcExpDomain> getWlEmccOrderExecl(String typeId,String orderCode, String startDate, String endDate, String supName, String name); /** * 外贸进口导出报表 * @param orderCode * @param startDate * @param endDate * @return */ List<WmIcExpDomain> getWmImccOrderExecl(String typeId,String orderCode, String startDate, String endDate); /** * 外贸出口导出报表 * @param orderCode * @param startDate * @param endDate * @param name * @param supName * @return */ List<WmEcExpDomain> getWmEmccOrderExecl(String typeId,String orderCode, String startDate, String endDate, String supName, String name); /** * 仓储进库导出报表 * @param orderCode * @param startDate * @param endDate * @param name * @param supName * @return */ List<CcIcExpDomain> getCcImccOrderExecl(String typeId,String orderCode, String startDate, String endDate, String supName, String name); /** * 仓储出库导出报表 * @param orderCode * @param startDate * @param endDate * @param name * @param supName * @return */ List<CcEcExpDomain> getCcEmccOrderExecl(String typeId,String orderCode, String startDate, String endDate, String supName, String name); /** * 查询补充信息 * @param id * @return */ DingdanAddtion getOrderAddtion(String id); }
fc507b3280045fd8af30990f01835545040e9f93
71d31a10b8569a84cee9bdb426f8fb11e0068114
/src/com/company/Model/Golden.java
480d56f95ed52d4d5d82c82c65afcae477a1caa1
[]
no_license
proton2/generics
135f24bcd6b46094ad6b572f5a093f42ffd5e7ae
eb7cbc524aae89134be767662d4ae1e068d3ce5a
refs/heads/master
2021-05-05T13:36:07.152498
2017-09-28T10:20:28
2017-09-28T10:20:28
105,058,487
0
0
null
null
null
null
UTF-8
Java
false
false
301
java
package com.company.Model; import com.company.Model.Apple; /** * Created by b.yacenko on 27.09.2017. */ public class Golden extends Apple { public Golden() { } public Golden(String aName) { super(aName); } public Golden(String aName, String aSort) { super(aName, aSort); } }
a01633b0997edd3724af78955611d9302d7a99e2
6aab36022e31063b609479bbdbdd7d0817c0cd39
/src/main/java/com/zeal/shiyulin/common/utils/excel/ImportExcel.java
b9d39bd978426321f2cca3967355064159ee653a
[]
no_license
GodLikeZeal/autocode
f7c5a7329da6f613453d86b41561631dd612c5d7
10ecfddb57485219ac0f163031a2a6facfb0b5dd
refs/heads/master
2020-03-13T07:12:35.473189
2018-04-25T15:41:12
2018-04-25T15:41:18
131,020,899
0
0
null
null
null
null
UTF-8
Java
false
false
10,949
java
package com.zeal.shiyulin.common.utils.excel; /** * Copyright &copy; 2012-2014 zealAll rights reserved. */ import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.Collections; import java.util.Comparator; import java.util.Date; import java.util.List; import com.zeal.shiyulin.common.utils.Reflections; import com.zeal.shiyulin.common.utils.excel.annotation.ExcelField; import org.apache.commons.lang3.StringUtils; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.openxml4j.exceptions.InvalidFormatException; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.DateUtil; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.multipart.MultipartFile; import com.google.common.collect.Lists; /** * 导入Excel文件(支持“XLS”和“XLSX”格式) * @author zeal * @version 2013-03-10 */ public class ImportExcel { private static Logger log = LoggerFactory.getLogger(ImportExcel.class); /** * 工作薄对象 */ private Workbook wb; /** * 工作表对象 */ private Sheet sheet; /** * 标题行号 */ private int headerNum; /** * 构造函数 * @param path 导入文件,读取第一个工作表 * @param headerNum 标题行号,数据行号=标题行号+1 * @throws InvalidFormatException * @throws IOException */ public ImportExcel(String fileName, int headerNum) throws InvalidFormatException, IOException { this(new File(fileName), headerNum); } /** * 构造函数 * @param path 导入文件对象,读取第一个工作表 * @param headerNum 标题行号,数据行号=标题行号+1 * @throws InvalidFormatException * @throws IOException */ public ImportExcel(File file, int headerNum) throws InvalidFormatException, IOException { this(file, headerNum, 0); } /** * 构造函数 * @param path 导入文件 * @param headerNum 标题行号,数据行号=标题行号+1 * @param sheetIndex 工作表编号 * @throws InvalidFormatException * @throws IOException */ public ImportExcel(String fileName, int headerNum, int sheetIndex) throws InvalidFormatException, IOException { this(new File(fileName), headerNum, sheetIndex); } /** * 构造函数 * @param path 导入文件对象 * @param headerNum 标题行号,数据行号=标题行号+1 * @param sheetIndex 工作表编号 * @throws InvalidFormatException * @throws IOException */ public ImportExcel(File file, int headerNum, int sheetIndex) throws InvalidFormatException, IOException { this(file.getName(), new FileInputStream(file), headerNum, sheetIndex); } /** * 构造函数 * @param file 导入文件对象 * @param headerNum 标题行号,数据行号=标题行号+1 * @param sheetIndex 工作表编号 * @throws InvalidFormatException * @throws IOException */ public ImportExcel(MultipartFile multipartFile, int headerNum, int sheetIndex) throws InvalidFormatException, IOException { this(multipartFile.getOriginalFilename(), multipartFile.getInputStream(), headerNum, sheetIndex); } /** * 构造函数 * @param path 导入文件对象 * @param headerNum 标题行号,数据行号=标题行号+1 * @param sheetIndex 工作表编号 * @throws InvalidFormatException * @throws IOException */ public ImportExcel(String fileName, InputStream is, int headerNum, int sheetIndex) throws InvalidFormatException, IOException { if (StringUtils.isBlank(fileName)){ throw new RuntimeException("导入文档为空!"); }else if(fileName.toLowerCase().endsWith("xls")){ this.wb = new HSSFWorkbook(is); }else if(fileName.toLowerCase().endsWith("xlsx")){ this.wb = new XSSFWorkbook(is); }else{ throw new RuntimeException("文档格式不正确!"); } if (this.wb.getNumberOfSheets()<sheetIndex){ throw new RuntimeException("文档中没有工作表!"); } this.sheet = this.wb.getSheetAt(sheetIndex); this.headerNum = headerNum; log.debug("Initialize success."); } /** * 获取行对象 * @param rownum * @return */ public Row getRow(int rownum){ return this.sheet.getRow(rownum); } /** * 获取数据行号 * @return */ public int getDataRowNum(){ return headerNum+1; } /** * 获取最后一个数据行号 * @return */ public int getLastDataRowNum(){ return this.sheet.getLastRowNum()+headerNum; } /** * 获取最后一个列号 * @return */ public int getLastCellNum(){ return this.getRow(headerNum).getLastCellNum(); } /** * 获取单元格值 * @param row 获取的行 * @param column 获取单元格列号 * @return 单元格值 */ public Object getCellValue(Row row, int column){ Object val = ""; try{ Cell cell = row.getCell(column); if (cell != null){ if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC){ val = cell.getNumericCellValue(); }else if (cell.getCellType() == Cell.CELL_TYPE_STRING){ val = cell.getStringCellValue(); }else if (cell.getCellType() == Cell.CELL_TYPE_FORMULA){ val = cell.getCellFormula(); }else if (cell.getCellType() == Cell.CELL_TYPE_BOOLEAN){ val = cell.getBooleanCellValue(); }else if (cell.getCellType() == Cell.CELL_TYPE_ERROR){ val = cell.getErrorCellValue(); } } }catch (Exception e) { return val; } return val; } /** * 获取导入数据列表 * @param cls 导入对象类型 * @param groups 导入分组 */ public <E> List<E> getDataList(Class<E> cls, int... groups) throws InstantiationException, IllegalAccessException{ List<Object[]> annotationList = Lists.newArrayList(); // Get annotation field Field[] fs = cls.getDeclaredFields(); for (Field f : fs){ ExcelField ef = f.getAnnotation(ExcelField.class); if (ef != null && (ef.type()==0 || ef.type()==2)){ if (groups!=null && groups.length>0){ boolean inGroup = false; for (int g : groups){ if (inGroup){ break; } for (int efg : ef.groups()){ if (g == efg){ inGroup = true; annotationList.add(new Object[]{ef, f}); break; } } } }else{ annotationList.add(new Object[]{ef, f}); } } } // Get annotation method Method[] ms = cls.getDeclaredMethods(); for (Method m : ms){ ExcelField ef = m.getAnnotation(ExcelField.class); if (ef != null && (ef.type()==0 || ef.type()==2)){ if (groups!=null && groups.length>0){ boolean inGroup = false; for (int g : groups){ if (inGroup){ break; } for (int efg : ef.groups()){ if (g == efg){ inGroup = true; annotationList.add(new Object[]{ef, m}); break; } } } }else{ annotationList.add(new Object[]{ef, m}); } } } // Field sorting Collections.sort(annotationList, new Comparator<Object[]>() { public int compare(Object[] o1, Object[] o2) { return new Integer(((ExcelField)o1[0]).sort()).compareTo( new Integer(((ExcelField)o2[0]).sort())); }; }); //log.debug("Import column count:"+annotationList.size()); // Get excel data List<E> dataList = Lists.newArrayList(); for (int i = this.getDataRowNum(); i < this.getLastDataRowNum(); i++) { E e = (E)cls.newInstance(); int column = 0; Row row = this.getRow(i); StringBuilder sb = new StringBuilder(); for (Object[] os : annotationList){ Object val = this.getCellValue(row, column++); if (val != null){ ExcelField ef = (ExcelField)os[0]; // If is dict type, get dict value if (StringUtils.isNotBlank(ef.dictType())){ //val = DictUtils.getDictValue(val.toString(), ef.dictType(), ""); //log.debug("Dictionary type value: ["+i+","+colunm+"] " + val); } // Get param type and type cast Class<?> valType = Class.class; if (os[1] instanceof Field){ valType = ((Field)os[1]).getType(); }else if (os[1] instanceof Method){ Method method = ((Method)os[1]); if ("get".equals(method.getName().substring(0, 3))){ valType = method.getReturnType(); }else if("set".equals(method.getName().substring(0, 3))){ valType = ((Method)os[1]).getParameterTypes()[0]; } } //log.debug("Import value type: ["+i+","+column+"] " + valType); try { if (valType == String.class){ String s = String.valueOf(val.toString()); if(StringUtils.endsWith(s, ".0")){ val = StringUtils.substringBefore(s, ".0"); }else{ val = String.valueOf(val.toString()); } }else if (valType == Integer.class){ val = Double.valueOf(val.toString()).intValue(); }else if (valType == Long.class){ val = Double.valueOf(val.toString()).longValue(); }else if (valType == Double.class){ val = Double.valueOf(val.toString()); }else if (valType == Float.class){ val = Float.valueOf(val.toString()); }else if (valType == Date.class){ val = DateUtil.getJavaDate((Double)val); }else{ if (ef.fieldType() != Class.class){ val = ef.fieldType().getMethod("getValue", String.class).invoke(null, val.toString()); }else{ val = Class.forName(this.getClass().getName().replaceAll(this.getClass().getSimpleName(), "fieldtype."+valType.getSimpleName()+"Type")).getMethod("getValue", String.class).invoke(null, val.toString()); } } } catch (Exception ex) { log.info("Get cell value ["+i+","+column+"] error: " + ex.toString()); val = null; } // set entity value if (os[1] instanceof Field){ Reflections.invokeSetter(e, ((Field)os[1]).getName(), val); }else if (os[1] instanceof Method){ String mthodName = ((Method)os[1]).getName(); if ("get".equals(mthodName.substring(0, 3))){ mthodName = "set"+StringUtils.substringAfter(mthodName, "get"); } Reflections.invokeMethod(e, mthodName, new Class[] {valType}, new Object[] {val}); } } sb.append(val+", "); } dataList.add(e); log.debug("Read success: ["+i+"] "+sb.toString()); } return dataList; } // /** // * 导入测试 // */ // public static void main(String[] args) throws Throwable { // // ImportExcel ei = new ImportExcel("target/export.xlsx", 1); // // for (int i = ei.getDataRowNum(); i < ei.getLastDataRowNum(); i++) { // Row row = ei.getRow(i); // for (int j = 0; j < ei.getLastCellNum(); j++) { // Object val = ei.getCellValue(row, j); // System.out.print(val+", "); // } // System.out.print("\n"); // } // // } }
11cf15cea0ce58ac0bef697974107a27f6148537
fc989dccaeba788c599ee0fc5cd0505dd8908f94
/cci/urlify.java
97614242a7f819ef998aabc1ec3c1b5fec412647
[]
no_license
arthurdamm/algorithms-practice
fec4425b955e70dba0c60ae658efe13098b7ae06
2a4a4c625bdf68b5ce1f24c894640069be8fa29f
refs/heads/master
2022-03-11T13:43:30.061612
2022-03-11T04:20:06
2022-03-11T04:20:06
216,130,117
2
0
null
null
null
null
UTF-8
Java
false
false
1,374
java
/* Cracking the Code Interview 1.3 * checks if str1 is a permutation of str2 */ import java.util.*; public class urlify { public static void main(String[] args) { System.out.println("example: [" + urlifyBrute("Mr John Smith ", 13) + "]"); System.out.println("example: [" + urlifyBrute("Mr John Sm i th ", 15) + "]"); } public static void print(Object arg) { System.out.println(arg); } static String urlifyBrute(String arg, int len) { char[] str = arg.toCharArray(); int spaces = 0; // Count the number of spaces in first pass. for (int i = 0; i < len; i++) if (str[i] == ' ') spaces++; // Now start from the back, shifting everything by spaces * 2 for (int i = len - 1, shift = spaces * 2; i >= 0; i--) { print("Char:" + str[i]); // every time we hit a space... if (str[i] == ' ') { // replace chars (there is enough space made behind us) str[i + shift - 2] = '%'; str[i + shift - 1] = '2'; str[i + shift] = '0'; // reduce shifting shift -= 2; } else // just shift str[i + shift] = str[i]; print(Arrays.toString(str)); } return new String(str); } }
f72eebea885e402568d656f1d569da1e750f93ce
d2df2e68ee1d0bb84243add5dcfd8920fb790333
/modules/distribution-service-aws-s3/src/main/java/org/opencastproject/distribution/aws/s3/PresignedUrlMediaPackageSerializer.java
f2de22bd49804f56a42cdc9ebea006693723149b
[ "LicenseRef-scancode-free-unknown", "ECL-2.0", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "LicenseRef-scancode-unknown" ]
permissive
rfharokh/Opencast
ec5603939759c9cc05acb4bd82b378761b9652b8
971702a4bbfafda9dfa1aeb0d3723b878bb693b7
refs/heads/develop
2021-06-18T14:43:21.193592
2021-01-26T08:17:30
2021-01-26T08:17:30
166,364,821
1
1
ECL-2.0
2019-03-01T08:26:15
2019-01-18T07:40:53
Java
UTF-8
Java
false
false
2,725
java
/** * Licensed to The Apereo Foundation under one or more contributor license * agreements. See the NOTICE file distributed with this work for additional * information regarding copyright ownership. * * * The Apereo Foundation licenses this file to you under the Educational * Community License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of the License * at: * * http://opensource.org/licenses/ecl2.txt * * 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.opencastproject.distribution.aws.s3; import org.opencastproject.distribution.aws.s3.api.AwsS3DistributionService; import org.opencastproject.mediapackage.MediaPackageSerializer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.net.URI; import java.net.URISyntaxException; /** * Implementation of a {@link MediaPackageSerializer} that will support presigned URL feature for a Mediapackage */ public class PresignedUrlMediaPackageSerializer implements MediaPackageSerializer { private static final Logger logger = LoggerFactory.getLogger(PresignedUrlMediaPackageSerializer.class); public static final int RANKING = 10; /** S3 distribution service used for generate presigned URL */ private AwsS3DistributionService service; public PresignedUrlMediaPackageSerializer() { logger.info("Init PresignedUrlMediaPackageSerializer"); } public void setService(AwsS3DistributionService service) { this.service = service; } /** * {@inheritDoc} * * Generate a presigned URI for the given URI if AwsS3DistributionService is enabled. */ @Override public URI decodeURI(URI uri) throws URISyntaxException { URI presignedURI = null; if (service instanceof AwsS3DistributionServiceImpl) { presignedURI = ((AwsS3DistributionServiceImpl)service).presignedURI(uri); } logger.debug("Decode in presigned URL serializer: {} -> {}", uri, presignedURI); return presignedURI; } /** * {@inheritDoc} */ @Override public URI encodeURI(URI uri) throws URISyntaxException { URI encodedUri = null; logger.debug("Encode in presigned URL serializer: {} -> {}", uri, encodedUri); return uri; } /** * {@inheritDoc} */ @Override public int getRanking() { return RANKING; } }
bf246876a8da4177cbc028729bb6c6305e6f3f2d
62a85772d935e6b58c5abd28f4ca2b561e52a19d
/src/test/java/testesRepositorioClientes/BDDTest.java
623873924b833d4e220d7903108ecf098bb9c5fe
[]
no_license
jeancarlos2015/servicocontrolepedidos
4f93ea1f64593620b23ebee2f29aa5b4ffbba689
5f0c7d4960147473be4145835e8ace4af3339cf8
refs/heads/master
2021-05-07T15:12:50.645904
2017-12-13T01:09:49
2017-12-13T01:09:49
109,979,817
0
0
null
null
null
null
UTF-8
Java
false
false
272
java
package testesRepositorioClientes; import cucumber.api.CucumberOptions; import cucumber.api.junit.Cucumber; import org.junit.runner.RunWith; @RunWith(Cucumber.class) @CucumberOptions(features = "src/main/resources/featuresRepositorioClientes") public class BDDTest { }
d71d62ffc9c6bcf3ace914753509057aac7af0a2
8a6dfcd056e104a7e0ad5fb516690120d4d469e7
/commontools/src/main/java/com/cccts/helpers/Log4jHelper.java
f596a09aa02dbc7bbb23904be521c192f8caee55
[]
no_license
ewsq/gateway808
0847b6237f4c7dd59287165e67f6738f649ab2f0
ff1e0fcb145fad94186199cbf2ed2cc78fa597c8
refs/heads/master
2022-01-25T01:02:51.045617
2019-07-01T00:21:43
2019-07-01T00:21:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,324
java
package com.cccts.helpers; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.core.config.ConfigurationSource; import org.apache.logging.log4j.core.config.Configurator; import java.io.File; import java.io.FileInputStream; public final class Log4jHelper { /** * 启用自定义log4j2.xml的路径,在conf目录下 */ public static void useCustomerConfig (){ ConfigurationSource source; String relativePath = "log4j2.xml"; String filePath = System.getProperty("user.dir") + System.getProperty("file.separator") + "conf" + System.getProperty("file.separator") + relativePath; File log4jFile = new File(filePath); try { if (log4jFile.exists()) { source = new ConfigurationSource(new FileInputStream(log4jFile), log4jFile); Configurator.initialize(null, source); } else { System.out.println("loginit failed"); System.exit(1); } } catch (Exception e) { e.printStackTrace(); System.exit(0); } } public static Logger getLogger(String loggerName) { return LogManager.getLogger(loggerName); } }
dcdeb64bed085c8d79871626d7acfeb9ae945494
13423c5c9ec11b1c14c4477ba22f41f3627812b9
/web/src/main/java/com/socialworld/web/entity/Chat.java
86c794ab4dde65d74998d3bffbb76047c1e07e4f
[]
no_license
Stoyanov22/SocialWorld
099eda740453de6c5f3fac1dddf8534932418dd6
ea221353221b87b72e25511ad31328902963064e
refs/heads/master
2021-01-16T09:41:36.006213
2020-10-09T19:22:29
2020-10-09T19:22:29
243,065,209
0
0
null
null
null
null
UTF-8
Java
false
false
2,178
java
package com.socialworld.web.entity; import java.util.Date; import java.util.Objects; public class Chat { private String id; private String content; private Date timestamp; private String fromUserId; private String toUserId; public Chat(){ } public Chat(String id, String content, Date timestamp, String fromUserId, String toUserId) { this.id = id; this.content = content; this.timestamp = timestamp; this.fromUserId = fromUserId; this.toUserId = toUserId; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } public Date getTimestamp() { return timestamp; } public void setTimestamp(Date timestamp) { this.timestamp = timestamp; } public String getFromUserId() { return fromUserId; } public void setFromUserId(String fromUserId) { this.fromUserId = fromUserId; } public String getToUserId() { return toUserId; } public void setToUserId(String toUserId) { this.toUserId = toUserId; } @Override public String toString() { return "Chat{" + "id='" + id + '\'' + ", content='" + content + '\'' + ", timestamp=" + timestamp + ", fromUserId='" + fromUserId + '\'' + ", toUserId='" + toUserId + '\'' + '}'; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Chat chat = (Chat) o; return id.equals(chat.id) && content.equals(chat.content) && timestamp.equals(chat.timestamp) && fromUserId.equals(chat.fromUserId) && toUserId.equals(chat.toUserId); } @Override public int hashCode() { return Objects.hash(id, content, timestamp, fromUserId, toUserId); } }
0864e3830298aa73167cc93ab4704405e57f049e
6d5ebe72b9001e67eab8d5082f9ec5760608e27d
/MyFirstProject/src/boris/teams/Week1.java
bf865a144e50f14c7d2d80a572f9a7f1444eec25
[]
no_license
bgoetz22/git-test
3e56b9d29cdad2dc7f3e0425ee3dd0a791d2aaa8
ae5b97e7fdb3aa070bd90e7a7db2de9cb60d01d5
refs/heads/master
2023-08-04T00:04:56.465104
2021-09-24T19:16:19
2021-09-24T19:16:19
408,982,979
0
0
null
null
null
null
UTF-8
Java
false
false
952
java
package boris.teams; public class Week1 { public static void main(String[] args) { // TODO Comment whatever I want int age = 34; String firstName = "Boris"; String lastName = "Goetz"; String wholeName = firstName + " " + lastName; double accountBalance = 23.70; char middleinitial = 'V'; System.out.println("Hello, my name is wholeName"); System.out.println(age); System.out.println("Hello, my name is " + wholeName ); System.out.println("Halo, ich heibe " + firstName +" "+ lastName); System.out.println("I am " + age ); System.out.println(". I am " + age * 8); System.out.println("The definition of love and beauty and wierdness is " + wholeName); System.out.println("Jason takes a bite out of crime and acts like he is " + age/17); System.out.println(accountBalance / 12); System.out.println(firstName +" "+ lastName); System.out.println(firstName +" "+ middleinitial +" "+ lastName); } }
a0d213837b5894f7458b9741735b51150c2e7032
6aca25c0e9152b7d4f37d4ac2474dd4c222007b3
/app/src/main/java/com/isaacsmobiledevelopment/lehmanit17/budgetapplication/DataBackend.java
ba7f2cf763c67bcbab41c4289c285a782ad4b7d5
[]
no_license
IsaacLehman/BudgetApplication
aee352bcdb762f5af0e8ad3bcf5a7d60a1c4860f
faec5aae8c342755e92b1a1cf8cbc996a51e42d3
refs/heads/master
2020-09-12T20:21:17.442720
2019-11-18T20:51:09
2019-11-18T20:51:09
222,542,092
0
0
null
null
null
null
UTF-8
Java
false
false
1,417
java
package com.isaacsmobiledevelopment.lehmanit17.budgetapplication; import android.content.Context; import java.io.IOException; import java.util.ArrayList; /** * Gets all the file data on open and writes all the file data upon close * @author LEHMANIT17 * */ public class DataBackend extends ExpenceOperations{ CSVfile csvFile; budgetFile budgetKeyFile; budgetFile userBudgetFile; public DataBackend(String csvFileName, String budgetKeyFileName, String userBudgetFileName, Context context) { csvFile = new CSVfile(csvFileName, ";", context); budgetKeyFile = new budgetFile(budgetKeyFileName, ";", ",", context); userBudgetFile = new budgetFile(userBudgetFileName, ";", ",", context); } public void resetUserBudgetFile() throws IOException{ userBudgetFile.fileTools.clearFile(); ArrayList<BudgetCategory> budgetKeys = budgetKeyFile.getbudgetDataFromFile(); userBudgetFile.writebudgetDataToFile(budgetKeys); } public void writeBudget(ArrayList<BudgetCategory> budget) throws IOException { userBudgetFile.writebudgetDataToFile(budget); } public ArrayList<BudgetCategory> getBudget() throws IOException { return userBudgetFile.getbudgetDataFromFile(); } public void writeExpences(ArrayList<Expence> expences) throws IOException { csvFile.appendExpences(expences); } public ArrayList<Expence> getExpences() throws IOException{ return csvFile.getCSVDataFromFile(); } }
[ "Pizza123#" ]
Pizza123#
1c2f885011669b42cd57e74290e3f43b4c0e47eb
5e57cab79834229d5057803d6f4209d9b4d0c9b9
/Liste/src/liste/ElemBidir.java
0606282889ad744e5659c4b9e86cb92fbcbed83d
[]
no_license
NickBodliev/Liste
f7e7c8f01920cfce18daf56248984ee6fedc2473
d7c2b85d104c2d7a289816d5b0135f07c9097127
refs/heads/main
2023-01-31T07:19:17.600950
2020-12-18T12:50:20
2020-12-18T12:50:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
334
java
package liste; public class ElemBidir { int inf; ElemBidir prev; ElemBidir next; public ElemBidir(){ inf = 0; prev = null; next = null; } public ElemBidir(int info, ElemBidir p, ElemBidir n){ inf = info; prev = p; next = n; } }
47d6381b741e87e76ca031f53e4c688e12121524
44abee7981ec47704f59d0cb9345efc4b909ad4f
/src/chap18/textbook/s180504/PrintStreamExample.java
0e9af22397a89213ceaa69121072ce892a6840b8
[]
no_license
hyojjjin/java20200929
ad24e96c2c3837f695951be783c59418559eceee
8a2d7b34bc814465c83ae0efa0bd59f29205c738
refs/heads/master
2023-03-11T22:56:51.890496
2021-03-02T01:08:15
2021-03-02T01:08:15
299,485,576
0
0
null
null
null
null
UTF-8
Java
false
false
517
java
package chap18.textbook.s180504; import java.io.FileOutputStream; import java.io.PrintStream; public class PrintStreamExample { public static void main(String[] args) throws Exception { FileOutputStream fos = new FileOutputStream("file.txt"); PrintStream ps = new PrintStream(fos); ps.println("[프린터 보조 스트림"); ps.print("마치"); ps.println("프린터가 출력하는 것처럼"); ps.println("데이터를 출력합니다."); ps.flush(); ps.close(); fos.close(); } }
6ac8ae41a0fc60beadfa7418ee2cfb5dadf83070
7c07cba0cede271f05c5a5ef70cd33efab6cebc8
/src/com/topone/powerreader/RecordListAdapter.java
51cba8e269750b21aeeff40875cb30066bcf194c
[]
no_license
yanshen6/powerreader
bccb429012d050419def26df445659a217b0bf5b
faf6caa29ec20bca4c799e59dd106c55bf32e5ef
refs/heads/master
2021-04-30T18:22:13.766616
2017-01-29T15:15:51
2017-01-29T15:15:51
80,351,201
0
0
null
null
null
null
UTF-8
Java
false
false
10,331
java
package com.topone.powerreader; import java.util.List; import com.topone.powerreader.R; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.RelativeLayout; import android.widget.TextView; public class RecordListAdapter extends BaseAdapter{ private List<JJLChaxunRecordItem> mListItem; private LayoutInflater mInflater=null; public RecordListAdapter(Context context,List<JJLChaxunRecordItem> listItem){ this.mListItem=listItem; this.mInflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } @Override public int getCount() { return mListItem.size(); } @Override public Object getItem(int position) { return mListItem.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder=null; if(convertView==null) { holder=new ViewHolder(); convertView = mInflater.inflate(R.layout.item_chaxun_record_list, null); holder.rl_item_homeno=(RelativeLayout)convertView.findViewById(R.id.rl_item_homeno); holder.lable_item_homeno =(TextView)convertView.findViewById(R.id.lable_item_homeno); holder.tv_item_homeno =(TextView)convertView.findViewById(R.id.tv_item_homeno); holder.rl_item_homename=(RelativeLayout)convertView.findViewById(R.id.rl_item_homename); holder.lable_item_homename =(TextView)convertView.findViewById(R.id.lable_item_homename); holder.tv_item_homename =(TextView)convertView.findViewById(R.id.tv_item_homename); holder.rl_item_pdno=(RelativeLayout)convertView.findViewById(R.id.rl_item_pdno); holder.lable_item_pdno=(TextView)convertView.findViewById(R.id.lable_item_pdno); holder.tv_item_pdno =(TextView)convertView.findViewById(R.id.tv_item_pdno); holder.rl_item_meterno=(RelativeLayout)convertView.findViewById(R.id.rl_item_meterno); holder.lable_item_meterno =(TextView)convertView.findViewById(R.id.lable_item_meterno); holder.tv_item_meterno =(TextView)convertView.findViewById(R.id.tv_item_meterno); holder.rl_item_meterpoint=(RelativeLayout)convertView.findViewById(R.id.rl_item_meterpoint); holder.lable_item_meterpoint =(TextView)convertView.findViewById(R.id.lable_item_meterpoint); holder.tv_item_meterpoint =(TextView)convertView.findViewById(R.id.tv_item_meterpoint); holder.rl_item_meteraddress=(RelativeLayout)convertView.findViewById(R.id.rl_item_meteraddress); holder.lable_item_meteraddress =(TextView)convertView.findViewById(R.id.lable_item_meteraddress); holder.tv_item_meteraddress =(TextView)convertView.findViewById(R.id.tv_item_meteraddress); holder.rl_item_fixaddress=(RelativeLayout)convertView.findViewById(R.id.rl_item_fixaddress); holder.lable_item_fixaddress=(TextView)convertView.findViewById(R.id.lable_item_fixaddress); holder.tv_item_fixaddress=(TextView)convertView.findViewById(R.id.tv_item_fixaddress); holder.rl_item_poweraddress=(RelativeLayout)convertView.findViewById(R.id.rl_item_poweraddress); holder.lable_item_poweraddress =(TextView)convertView.findViewById(R.id.lable_item_poweraddress); holder.tv_item_poweraddress =(TextView)convertView.findViewById(R.id.tv_item_poweraddress); holder.rl_item_fault_reason=(RelativeLayout)convertView.findViewById(R.id.rl_item_fault_reason); holder.lable_item_fault_reason =(TextView)convertView.findViewById(R.id.lable_item_fault_reason); holder.tv_item_fault_reason =(TextView)convertView.findViewById(R.id.tv_item_fault_reason); holder.rl_item_fault_type=(RelativeLayout)convertView.findViewById(R.id.rl_item_fault_type); holder.lable_item_fault_type =(TextView)convertView.findViewById(R.id.lable_item_fault_type); holder.tv_item_fault_type =(TextView)convertView.findViewById(R.id.tv_item_fault_type); holder.rl_item_check_user=(RelativeLayout)convertView.findViewById(R.id.rl_item_check_user); holder.lable_item_check_user =(TextView)convertView.findViewById(R.id.lable_item_check_user); holder.tv_item_check_user =(TextView)convertView.findViewById(R.id.tv_item_check_user); holder.rl_item_check_time=(RelativeLayout)convertView.findViewById(R.id.rl_item_check_time); holder.lable_item_check_time =(TextView)convertView.findViewById(R.id.lable_item_check_time); holder.tv_item_check_time =(TextView)convertView.findViewById(R.id.tv_item_check_time); convertView.setTag(holder); }else{ holder=(ViewHolder)convertView.getTag(); } JJLChaxunRecordItem item = (JJLChaxunRecordItem) getItem(position); if(item.data_homeno!=null && item.data_homeno.trim().length()>0) { holder.rl_item_homeno.setVisibility(View.VISIBLE); holder.tv_item_homeno.setText(item.data_homeno); } if(item.data_homename!=null && item.data_homename.trim().length()>0) { holder.rl_item_homename.setVisibility(View.VISIBLE); holder.tv_item_homename.setText(item.data_homename); } if(item.data_checkTime!=null && item.data_checkTime.trim().length()>0) { holder.rl_item_check_time.setVisibility(View.VISIBLE); holder.tv_item_check_time.setText(item.data_checkTime); } if(item.data_checkuser!=null && item.data_checkuser.trim().length()>0) { holder.rl_item_check_user.setVisibility(View.VISIBLE); holder.tv_item_check_user.setText(item.data_checkuser); } if(item.data_faultReason!=null && item.data_faultReason.trim().length()>0) { holder.rl_item_fault_reason.setVisibility(View.VISIBLE); holder.tv_item_fault_reason.setText(item.data_faultReason); } if(item.data_faultType!=null && item.data_faultType.trim().length()>0) { holder.rl_item_fault_type.setVisibility(View.VISIBLE); holder.tv_item_fault_type.setText(item.data_faultType); } if(item.data_fixaddress!=null && item.data_fixaddress.trim().length()>0) { holder.rl_item_fixaddress.setVisibility(View.VISIBLE); holder.tv_item_fixaddress.setText(item.data_fixaddress); } if(item.data_meteraddress!=null && item.data_meteraddress.trim().length()>0) { holder.rl_item_meteraddress.setVisibility(View.VISIBLE); holder.tv_item_meteraddress.setText(item.data_meteraddress); } if(item.data_meterno!=null && item.data_meterno.trim().length()>0) { holder.rl_item_meterno.setVisibility(View.VISIBLE); holder.tv_item_meterno.setText(item.data_meterno); } if(item.data_pdno!=null && item.data_pdno.trim().length()>0) { holder.rl_item_pdno.setVisibility(View.VISIBLE); holder.tv_item_pdno.setText(item.data_pdno); } if(item.data_meterpoint!=null && item.data_meterpoint.trim().length()>0) { holder.rl_item_meterpoint.setVisibility(View.VISIBLE); holder.tv_item_meterpoint.setText(item.data_meterpoint); } if(item.data_poweraddress!=null && item.data_poweraddress.trim().length()>0) { holder.rl_item_poweraddress.setVisibility(View.VISIBLE); holder.tv_item_poweraddress.setText(item.data_poweraddress); } return convertView; } class ViewHolder{ //户号 RelativeLayout rl_item_homeno; TextView lable_item_homeno; TextView tv_item_homeno; //户名 RelativeLayout rl_item_homename; TextView lable_item_homename; TextView tv_item_homename; //终端号 RelativeLayout rl_item_meterno; TextView lable_item_meterno; TextView tv_item_meterno; //表号 RelativeLayout rl_item_pdno; TextView lable_item_pdno; TextView tv_item_pdno; //测量点 RelativeLayout rl_item_meterpoint; TextView lable_item_meterpoint; TextView tv_item_meterpoint; //终端地址 RelativeLayout rl_item_meteraddress; TextView lable_item_meteraddress; TextView tv_item_meteraddress; //安装地址 RelativeLayout rl_item_fixaddress; TextView lable_item_fixaddress; TextView tv_item_fixaddress; //用电地址 RelativeLayout rl_item_poweraddress; TextView lable_item_poweraddress; TextView tv_item_poweraddress; //故障原因 RelativeLayout rl_item_fault_reason; TextView lable_item_fault_reason; TextView tv_item_fault_reason; //故障分类 RelativeLayout rl_item_fault_type; TextView lable_item_fault_type; TextView tv_item_fault_type; //排查人 RelativeLayout rl_item_check_user; TextView lable_item_check_user; TextView tv_item_check_user; //排查时间 RelativeLayout rl_item_check_time; TextView lable_item_check_time; TextView tv_item_check_time; } }
179896fb07759d38b637ffa5205207981def2037
dc7bf4e3217f820b6c161cade8184b32f18cb85d
/1.OOP/2.Learn_OOP_In_Java/oop_design/interface_segregation/transaction/CustomerTransaction.java
c98994054caaaced81e051e08d5e5d35de3ce145
[]
no_license
Hopw06/Software_Design
a777802c6668290d7f1ef3cc011e54a311ba678a
27c4095b029408ea40b3224bdbaf4e676b741fb5
refs/heads/master
2023-02-24T13:52:07.330485
2021-01-29T12:21:04
2021-01-29T12:21:04
312,309,692
0
0
null
null
null
null
UTF-8
Java
false
false
1,785
java
package com.company.oop_design.interface_segregation.transaction; import com.company.oop_design.interface_segregation.model.Customer; import com.company.oop_design.interface_segregation.model.Product; import java.util.Date; import java.util.List; /* This principle state that no client should be forced to depend on code that they do not use. Such as here: AccountsReceivable only use prepareInvoice, chargeCustomer methods. => So it should only accept an Accounting instance to perform these methods ReportGenerator only use getName, getDate, productBreakDown methods. => So it should only accept a Reporting instance to perform these methods. A fat class which has many responsibilities Use interface to separate behavior is a good idea. */ public class CustomerTransaction implements Accounting, Reporting { private Customer mCustomer; private List<Product> mProducts; public CustomerTransaction(Customer customer, List<Product> products) { this.mCustomer = customer; this.mProducts = products; } // methods for reporting public String getName() { return mCustomer.getName(); } public Date getDate() { return new Date(); } public String productBreakDown() { String productsReporting = ""; for (Product product : mProducts) { productsReporting += product.getProductId() + " " + product.getProductName() + "\n"; } return productsReporting; } // methods for accounting public void prepareInvoice() { System.out.println("prepare invoice"); } public void chargeCustomer() { System.out.println("change customer"); } }
9287135457670cda08ce77127249d59495de3063
7fe40170bdb9620f51887ec52df2430defd94345
/src/main/java/com/ultracart/admin/v2/models/GiftCertificatesResponse.java
5669bd24b94efa955ff42e3293a9c85771f6e3ab
[ "Apache-2.0" ]
permissive
UltraCart/rest_api_v2_sdk_java
15878b91beef97843f2938f3048a7010e7328127
bfecb94bb931dfe190d98663d8b1593c6f9dfabb
refs/heads/master
2023-02-08T13:38:03.769682
2023-01-31T20:48:35
2023-01-31T20:48:35
67,046,576
0
2
Apache-2.0
2022-06-23T01:46:12
2016-08-31T14:48:01
Java
UTF-8
Java
false
false
5,352
java
/* * UltraCart Rest API V2 * UltraCart REST API Version 2 * * OpenAPI spec version: 2.0.0 * Contact: [email protected] * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ package com.ultracart.admin.v2.models; import java.util.Objects; import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.ultracart.admin.v2.models.Error; import com.ultracart.admin.v2.models.GiftCertificate; import com.ultracart.admin.v2.models.ResponseMetadata; import com.ultracart.admin.v2.models.Warning; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.util.ArrayList; import java.util.List; /** * GiftCertificatesResponse */ @javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2023-01-31T15:48:16.171-05:00") public class GiftCertificatesResponse { @SerializedName("error") private Error error = null; @SerializedName("gift_certificates") private List<GiftCertificate> giftCertificates = null; @SerializedName("metadata") private ResponseMetadata metadata = null; @SerializedName("success") private Boolean success = null; @SerializedName("warning") private Warning warning = null; public GiftCertificatesResponse error(Error error) { this.error = error; return this; } /** * Get error * @return error **/ @ApiModelProperty(value = "") public Error getError() { return error; } public void setError(Error error) { this.error = error; } public GiftCertificatesResponse giftCertificates(List<GiftCertificate> giftCertificates) { this.giftCertificates = giftCertificates; return this; } public GiftCertificatesResponse addGiftCertificatesItem(GiftCertificate giftCertificatesItem) { if (this.giftCertificates == null) { this.giftCertificates = new ArrayList<GiftCertificate>(); } this.giftCertificates.add(giftCertificatesItem); return this; } /** * Get giftCertificates * @return giftCertificates **/ @ApiModelProperty(value = "") public List<GiftCertificate> getGiftCertificates() { return giftCertificates; } public void setGiftCertificates(List<GiftCertificate> giftCertificates) { this.giftCertificates = giftCertificates; } public GiftCertificatesResponse metadata(ResponseMetadata metadata) { this.metadata = metadata; return this; } /** * Get metadata * @return metadata **/ @ApiModelProperty(value = "") public ResponseMetadata getMetadata() { return metadata; } public void setMetadata(ResponseMetadata metadata) { this.metadata = metadata; } public GiftCertificatesResponse success(Boolean success) { this.success = success; return this; } /** * Indicates if API call was successful * @return success **/ @ApiModelProperty(value = "Indicates if API call was successful") public Boolean isSuccess() { return success; } public void setSuccess(Boolean success) { this.success = success; } public GiftCertificatesResponse warning(Warning warning) { this.warning = warning; return this; } /** * Get warning * @return warning **/ @ApiModelProperty(value = "") public Warning getWarning() { return warning; } public void setWarning(Warning warning) { this.warning = warning; } @Override public boolean equals(java.lang.Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } GiftCertificatesResponse giftCertificatesResponse = (GiftCertificatesResponse) o; return Objects.equals(this.error, giftCertificatesResponse.error) && Objects.equals(this.giftCertificates, giftCertificatesResponse.giftCertificates) && Objects.equals(this.metadata, giftCertificatesResponse.metadata) && Objects.equals(this.success, giftCertificatesResponse.success) && Objects.equals(this.warning, giftCertificatesResponse.warning); } @Override public int hashCode() { return Objects.hash(error, giftCertificates, metadata, success, warning); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class GiftCertificatesResponse {\n"); sb.append(" error: ").append(toIndentedString(error)).append("\n"); sb.append(" giftCertificates: ").append(toIndentedString(giftCertificates)).append("\n"); sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); sb.append(" success: ").append(toIndentedString(success)).append("\n"); sb.append(" warning: ").append(toIndentedString(warning)).append("\n"); sb.append("}"); return sb.toString(); } /** * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } }
4ac73733ffdb153f70e976aafb2f9a0b0d56cd79
5e1313cfd708eb29e5baae1d21b9b3c737d33f23
/camera/src/com/commonsware/cwac/camera/ImageCleanupTask.java
26f28f1cb33ba426f2c6205f37a29e453dd759a7
[ "Apache-2.0" ]
permissive
nilsymbol/cwac-camera
dc725c65606c98ce6b211b7e517f5ff6b4d906f2
9e61fd085e55830b52abdc26ad2ab156be1dbdc1
refs/heads/master
2021-05-29T06:42:29.218456
2014-02-08T22:11:02
2014-02-08T22:11:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,914
java
/*** Copyright (c) 2013-2014 CommonsWare, LLC 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.commonsware.cwac.camera; import android.annotation.TargetApi; import android.app.ActivityManager; import android.content.Context; import android.content.pm.ApplicationInfo; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Matrix; import android.hardware.Camera; import android.os.Build; import android.util.Log; import java.io.ByteArrayOutputStream; import java.io.IOException; import com.android.mms.exif.ExifInterface; public class ImageCleanupTask extends Thread { private byte[] data; private int cameraId; private PictureTransaction xact=null; private boolean applyMatrix=true; ImageCleanupTask(Context ctxt, byte[] data, int cameraId, PictureTransaction xact) { this.data=data; this.cameraId=cameraId; this.xact=xact; float heapPct=(float)data.length / calculateHeapSize(ctxt); applyMatrix=(heapPct < xact.host.maxPictureCleanupHeapUsage()); } @Override public void run() { Camera.CameraInfo info=new Camera.CameraInfo(); Camera.getCameraInfo(cameraId, info); Matrix matrix=null; Bitmap cleaned=null; ExifInterface exif=null; if (applyMatrix) { if (info.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) { if (xact.host.getDeviceProfile().portraitFFCFlipped() && (xact.displayOrientation == 90 || xact.displayOrientation == 270)) { matrix=flip(new Matrix()); } else if (xact.mirrorFFC()) { matrix=mirror(new Matrix()); } } try { int imageOrientation=0; if (xact.host.getDeviceProfile().useDeviceOrientation()) { imageOrientation=xact.displayOrientation; } else { exif=new ExifInterface(); exif.readExif(data); int exifOrientation= exif.getTagIntValue(ExifInterface.TAG_ORIENTATION); if (exifOrientation == 6) { imageOrientation=90; } else if (exifOrientation == 8) { imageOrientation=270; } else if (exifOrientation == 3) { imageOrientation=180; } else if (exifOrientation == 1) { imageOrientation=0; } else { // imageOrientation= // xact.host.getDeviceProfile().getDefaultOrientation(); // // if (imageOrientation == -1) { // imageOrientation=xact.displayOrientation; // } } } if (imageOrientation != 0) { matrix= rotate((matrix == null ? new Matrix() : matrix), imageOrientation); } } catch (IOException e) { Log.e("CWAC-Camera", "Exception parsing JPEG", e); // TODO: ripple to client } if (matrix != null) { Bitmap original= BitmapFactory.decodeByteArray(data, 0, data.length); cleaned= Bitmap.createBitmap(original, 0, 0, original.getWidth(), original.getHeight(), matrix, true); original.recycle(); } } if (xact.needBitmap) { if (cleaned == null) { cleaned=BitmapFactory.decodeByteArray(data, 0, data.length); } xact.host.saveImage(xact, cleaned); } if (xact.needByteArray) { if (matrix != null) { ByteArrayOutputStream out=new ByteArrayOutputStream(); // if (exif == null) { cleaned.compress(Bitmap.CompressFormat.JPEG, 100, out); // } // else { // exif.deleteTag(ExifInterface.TAG_ORIENTATION); // // try { // exif.writeExif(cleaned, out); // } // catch (IOException e) { // Log.e("CWAC-Camera", "Exception writing to JPEG", e); // // TODO: ripple to client // } // } data=out.toByteArray(); try { out.close(); } catch (IOException e) { Log.e(CameraView.TAG, "Exception in closing a BAOS???", e); } } xact.host.saveImage(xact, data); } System.gc(); } // from http://stackoverflow.com/a/8347956/115145 private Matrix mirror(Matrix input) { float[] mirrorY= { -1, 0, 0, 0, 1, 0, 0, 0, 1 }; Matrix matrixMirrorY=new Matrix(); matrixMirrorY.setValues(mirrorY); input.postConcat(matrixMirrorY); return(input); } private Matrix flip(Matrix input) { float[] mirrorY= { -1, 0, 0, 0, 1, 0, 0, 0, 1 }; Matrix matrixMirrorY=new Matrix(); matrixMirrorY.setValues(mirrorY); input.preScale(1.0f, -1.0f); input.postConcat(matrixMirrorY); return(input); } private Matrix rotate(Matrix input, int degree) { input.setRotate(degree); return(input); } @TargetApi(Build.VERSION_CODES.HONEYCOMB) private static int calculateHeapSize(Context ctxt) { ActivityManager am= (ActivityManager)ctxt.getSystemService(Context.ACTIVITY_SERVICE); int memoryClass=am.getMemoryClass(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { if ((ctxt.getApplicationInfo().flags & ApplicationInfo.FLAG_LARGE_HEAP) != 0) { memoryClass=am.getLargeMemoryClass(); } } return(memoryClass * 1048576); // MB * bytes in MB } }
c566c6a0ffbc27e29e78719e5ef30ade20f7e861
4a9283ac8e992d9db217822e025262f9be4a1b46
/core/src/com/averyduffin/spaceexplorer/box2d/UserData.java
deb21ec859f460c69695b459ee8e03530cff47cb
[]
no_license
averyduffin/SpaceExplorer
97e1fdbc8bc511f5117648ac5b524ffd629af93e
e90c75770f076c235cfc33d33ecdaebc79bc073f
refs/heads/master
2020-05-25T09:29:48.316104
2015-04-17T05:55:43
2015-04-17T05:55:43
33,576,507
0
0
null
null
null
null
UTF-8
Java
false
false
741
java
package com.averyduffin.spaceexplorer.box2d; import com.averyduffin.spaceexplorer.enums.UserDataType; public abstract class UserData { protected UserDataType userDataType; protected float width; protected float height; public UserData(){ } public UserData(float width, float height) { this.width = width; this.height = height; } public UserDataType getUserDataType(){ return userDataType; } public float getWidth() { return width; } public void setWidth(float width) { this.width = width; } public float getHeight() { return height; } public void setHeight(float height) { this.height = height; } }
6371cd5260da120dfa0d119590766e003d3d06f0
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/24/24_97ccd658bd9f2fce35c1d7ed18bd23908c918b8d/PostgresPointService/24_97ccd658bd9f2fce35c1d7ed18bd23908c918b8d_PostgresPointService_s.java
ae2f580c9cb1a05d6e6581a16f739e9fb52d0b45
[]
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
29,833
java
/** * Copyright (C) 2014 * by 52 North Initiative for Geospatial Open Source Software GmbH * * Contact: Andreas Wytzisk * 52 North Initiative for Geospatial Open Source Software GmbH * Martin-Luther-King-Weg 24 * 48155 Muenster, Germany * [email protected] * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.envirocar.analyse; import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import org.envirocar.analyse.entities.InMemoryPoint; import org.envirocar.analyse.entities.Point; import org.envirocar.analyse.properties.Properties; import org.envirocar.analyse.util.Utils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.Geometry; /** * <code>Pointservice</code> implementation using a Postgres database to store the aggregated measurements. * * @author Benjamin Pross, Matthes Rieke * */ public class PostgresPointService implements PointService { private static final Logger LOGGER = LoggerFactory .getLogger(PostgresPointService.class); private Connection conn = null; private String connectionURL = null; private String databaseName; private String databasePath; private String username; private String password; public static String aggregated_MeasurementsTableName = (String) Properties.getProperty("aggregated_MeasurementsTableName"); public static String original_MeasurementsTableName = (String) Properties.getProperty("original_MeasurementsTableName"); public static String measurementRelationsTableName = (String) Properties.getProperty("measurement_relationsTableName"); public static String aggregatedTracksTableName = (String) Properties.getProperty("aggregatedTracksTableName"); private String spatial_ref_sys = "4326";// TODO from properties private String id_exp = "$id$"; private String distance_exp = "$distance$"; private String table_name_exp = "$tablename$"; private String geomFromText_exp = "$geom_from_text$"; private final String speed_value_exp = "$speed_value$"; private final String speedNumberOfContributingPoints_value_exp = "$speedNumberOfContributingPoints_value$"; private final String co2_value_exp = "$co2_value$"; private final String co2NumberOfContributingPoints_value_exp = "$co2NumberOfContributingPoints_value$"; private final String generalNumberOfContributingPoints_value_exp = "$generalNumberOfContributingPoints_value$"; private final String generalnumberOfContributingTracks_value_exp = "$generalnumberOfContributingTracks_value$"; private final String lastContributingTrack_value_exp = "$lastContributingTrack_value$"; private final String geometryEncoded_value_exp = "$geometryEncoded_value$"; private String idField = "id"; private String generalNumberOfContributingPointsField = "generalnumberofcontributingpoints"; private String generalnumberOfContributingTracksField = "generalnumberofcontributingtracks"; private String lastContributingTrackField = "lastcontributingtrack"; private String co2Field = "co2"; private String speedField = "speed"; private String co2NumberOfContributingPointsField = "co2numberofcontributingpoints"; private String speedNumberOfContributingPointsField = "speednumberofcontributingpoints"; private String trackIDField = "trackid"; private String geometryEncodedField = "the_geom"; private String geometryPlainTextField = "text_geom"; private String distField = "dist"; private String aggregated_measurement_idField = "aggregated_measurement_id"; private String aggregation_dateField = "aggregation_date"; private SimpleDateFormat iso8601DateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); private final String pgCreationString = "CREATE TABLE " + aggregated_MeasurementsTableName + " (" + idField + " INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, " + generalNumberOfContributingPointsField + " INTEGER, " + generalnumberOfContributingTracksField + " INTEGER," + lastContributingTrackField + " VARCHAR(24)," + co2Field + " DOUBLE PRECISION," + co2NumberOfContributingPointsField + " INTEGER, " + speedField + " DOUBLE PRECISION, " + speedNumberOfContributingPointsField + " INTEGER)"; private final String pgMeasurementRelationsTableCreationString = "CREATE TABLE " + measurementRelationsTableName + " (" + idField + " INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, " + aggregated_measurement_idField + " VARCHAR(24), " + "CONSTRAINT measurement_relations_aggregated_measurement_id_fkey FOREIGN KEY (" + aggregated_measurement_idField + ") " + "REFERENCES " + aggregated_MeasurementsTableName + " (" + idField + ") MATCH SIMPLE " + "ON UPDATE NO ACTION ON DELETE NO ACTION)"; private final String pgAggregatedTracksTableCreationString = "CREATE TABLE " + aggregatedTracksTableName + " (" + idField + " VARCHAR(24) NOT NULL PRIMARY KEY, " + aggregation_dateField + " timestamp with time zone)"; private String pgNearestNeighborCreationString = "select h." + idField + ", h." + speedField + ", h." + co2Field + ", h." + generalNumberOfContributingPointsField + ", h." + speedNumberOfContributingPointsField + ", h." + co2NumberOfContributingPointsField + ", h." + generalnumberOfContributingTracksField + ", h." + lastContributingTrackField + ", ST_AsText(h.the_geom) as " + geometryPlainTextField + ", ST_distance(" + geomFromText_exp + ",h.the_geom) as " + distField + " from " + aggregated_MeasurementsTableName + " h " + "where ST_DWithin(" + geomFromText_exp + ",h." + geometryEncodedField + "," + distance_exp + ") " + "order by " + distField + " ASC;"; private final String addGeometryColumnToTableString = "SELECT AddGeometryColumn( '" + table_name_exp + "', '" + geometryEncodedField + "', " + spatial_ref_sys + ", 'POINT', 2 );"; private final String selectAllAggregatedMeasurementsString = "select h." + idField + ", h." + speedField + ", h." + co2Field + ", h." + generalNumberOfContributingPointsField + ", h." + speedNumberOfContributingPointsField + ", h." + co2NumberOfContributingPointsField + ", h." + generalnumberOfContributingTracksField + ", h." + lastContributingTrackField + ", ST_AsText(h.the_geom) as " + geometryPlainTextField + " from " + aggregated_MeasurementsTableName + " h; "; private final String deletePointFromTableString = "delete from " + table_name_exp + " where " + idField + "="; private final String updateAggregatedMeasurementString = "UPDATE " + aggregated_MeasurementsTableName + " SET " + speedField + " = " + speed_value_exp + ", " + speedNumberOfContributingPointsField + " = " + speedNumberOfContributingPoints_value_exp + ", " + co2Field + " = " + co2_value_exp + ", " + co2NumberOfContributingPointsField + " = " + co2NumberOfContributingPoints_value_exp + ", " + generalNumberOfContributingPointsField + " = " + generalNumberOfContributingPoints_value_exp + ", " + generalnumberOfContributingTracksField + " = " + generalnumberOfContributingTracks_value_exp + ", " + lastContributingTrackField + " = '" + lastContributingTrack_value_exp + "', " + geometryEncodedField + " = " + geometryEncoded_value_exp + " WHERE " + idField + " = '" + id_exp + "';"; private Geometry bbox; public PostgresPointService() { this(null); } public PostgresPointService(Geometry bbox) { this.bbox = bbox; try { createConnection(); } catch (ClassNotFoundException e) { throw new IllegalStateException(e); } createTable(pgCreationString, aggregated_MeasurementsTableName, true); createTable(pgMeasurementRelationsTableCreationString, measurementRelationsTableName, false); createTable(pgAggregatedTracksTableCreationString, aggregatedTracksTableName, false); } @Override public Point getNearestNeighbor(Point point, double distance) { String queryString = pgNearestNeighborCreationString.replace(distance_exp, "" + distance).replace(geomFromText_exp, createST_GeometryFromTextStatement(point.getX(), point.getY())); ResultSet resultSet = executeQueryStatement(queryString); try { if (resultSet != null) { while (resultSet.next()) { String resultID = Integer.toString(resultSet.getInt(idField)); Map<String, Object> propertyMap = new HashMap<>(); Map<String, Integer> propertyPointsUsedForAggregationMap = new HashMap<>(); for (String propertyName : Properties .getPropertiesOfInterestDatatypeMapping().keySet()) { Class<?> propertyClass = Properties .getPropertiesOfInterestDatatypeMapping().get( propertyName); Object value = null; if (propertyClass.equals(Double.class)) { value = resultSet.getDouble(propertyName .toLowerCase()); } propertyMap.put(propertyName, value); int pointsUsedForAggregation = resultSet.getInt(propertyName .toLowerCase() + "numberofcontributingpoints"); propertyPointsUsedForAggregationMap.put(propertyName, pointsUsedForAggregation); } String resultLastContributingTrack = resultSet .getString(lastContributingTrackField); int resultNumberOfContributingPoints = resultSet .getInt(generalNumberOfContributingPointsField); int resultNumberOfContributingTracks = resultSet .getInt(generalnumberOfContributingTracksField); String resultGeomAsText = resultSet.getString(geometryPlainTextField); double[] resultXY = Utils .convertWKTPointToXY(resultGeomAsText); Point resultPoint = new InMemoryPoint(resultID, resultXY[0], resultXY[1], propertyMap, resultNumberOfContributingPoints, resultNumberOfContributingTracks, resultLastContributingTrack, propertyPointsUsedForAggregationMap); return resultPoint; } } } catch (SQLException e) { LOGGER.error("Could not query nearest neighbor of " + point.getID(), e); } return null; } @Override public boolean updateResultSet(String idOfPointToBeUpdated, Point newPoint) { String updateString = updateAggregatedMeasurementString; updateString = updateString.replace(speed_value_exp, "" + newPoint.getProperty("Speed")); updateString = updateString.replace(speedNumberOfContributingPoints_value_exp, "" + newPoint.getNumberOfPointsUsedForAggregation("Speed")); updateString = updateString.replace(co2_value_exp, "" + newPoint.getProperty("CO2")); updateString = updateString.replace(co2NumberOfContributingPoints_value_exp, "" + newPoint.getNumberOfPointsUsedForAggregation("CO2")); updateString = updateString.replace(generalNumberOfContributingPoints_value_exp, "" + newPoint.getNumberOfPointsUsedForAggregation()); updateString = updateString.replace(generalnumberOfContributingTracks_value_exp, "" + newPoint.getNumberOfTracksUsedForAggregation()); updateString = updateString.replace(lastContributingTrack_value_exp, newPoint.getLastContributingTrack()); updateString = updateString.replace(geometryEncoded_value_exp, createST_GeometryFromTextStatement(newPoint.getX(), newPoint.getY())); updateString = updateString.replace(id_exp, idOfPointToBeUpdated); return executeUpdateStatement(updateString); } @Override public List<Point> getResultSet() { List<Point> result = new ArrayList<>(); ResultSet resultSet = executeQueryStatement(selectAllAggregatedMeasurementsString); try { if (resultSet != null) { while (resultSet.next()) { Point resultPoint = createPointFromCurrentResultSetEntry(resultSet); result.add(resultPoint); } } } catch (SQLException e) { LOGGER.error("Could not query resultset.", e); } return result; } @Override public Point aggregate(Point point, Point nearestNeighborPoint, String trackId) { Point aggregatedPoint = new InMemoryPoint(point); updateValues(aggregatedPoint, nearestNeighborPoint); /* * distance weighting */ double averagedX = ((nearestNeighborPoint.getX() * nearestNeighborPoint.getNumberOfPointsUsedForAggregation()) + aggregatedPoint.getX()) / (nearestNeighborPoint.getNumberOfPointsUsedForAggregation() + 1); double averagedY = ((nearestNeighborPoint.getY() * nearestNeighborPoint.getNumberOfPointsUsedForAggregation()) + aggregatedPoint.getY()) / (nearestNeighborPoint.getNumberOfPointsUsedForAggregation() + 1); aggregatedPoint.setNumberOfPointsUsedForAggregation(nearestNeighborPoint.getNumberOfPointsUsedForAggregation()+1); aggregatedPoint.setX(averagedX); aggregatedPoint.setY(averagedY); LOGGER.debug(aggregatedPoint.getLastContributingTrack() + " vs. " + nearestNeighborPoint.getLastContributingTrack()); if(!aggregatedPoint.getLastContributingTrack().equals(nearestNeighborPoint.getLastContributingTrack())){ aggregatedPoint.setNumberOfTracksUsedForAggregation(nearestNeighborPoint.getNumberOfTracksUsedForAggregation() +1); }else{ aggregatedPoint.setNumberOfTracksUsedForAggregation(nearestNeighborPoint.getNumberOfTracksUsedForAggregation()); } LOGGER.debug("Aggregated: " + aggregatedPoint.getID() + " and " + nearestNeighborPoint.getID()); LOGGER.debug("NumberOfPoints " + aggregatedPoint.getNumberOfPointsUsedForAggregation()); insertMeasurementRelation(point.getID(), Integer.parseInt(nearestNeighborPoint.getID())); /* * store result in DB */ updateResultSet(nearestNeighborPoint.getID(), aggregatedPoint); return aggregatedPoint; } @Override public boolean isFitForAggregation(Point point) { boolean result = false; for (String propertyName : Properties.getPropertiesOfInterestDatatypeMapping().keySet()) { Object numberObject = point.getProperty(propertyName); if(numberObject instanceof Number){ result = result || !isNumberObjectNullOrZero((Number) numberObject); }else{ /* * not a number, we cannot aggregate this currently */ result = result || false; } } /* * also check for bbox */ if (bbox != null) { Coordinate pointCoordinate = new Coordinate(point.getX(), point.getY()); if (!bbox.contains(Utils.geometryFactory .createPoint(pointCoordinate))) { return false; } } return result; } @Override public void addToResultSet(Point newPoint) { int newId; try { newId = insertPoint(newPoint); } catch (SQLException e) { LOGGER.warn(e.getMessage(), e); return; } insertMeasurementRelation(newPoint.getID(), newId); } private String createST_GeometryFromTextStatement(double x, double y){ return "ST_GeomFromText('POINT(" + x + " " + y + ")', " + spatial_ref_sys + ")"; } private boolean insertMeasurementRelation(String originalID, int aggregatedID){ String statement = "INSERT INTO " + measurementRelationsTableName + "(" + idField + ", " + aggregated_measurement_idField + ") VALUES ('" + originalID + "', " + aggregatedID + ");"; return executeUpdateStatement(statement); } private boolean isNumberObjectNullOrZero(Number numberObject) { Number sourceValue = (Number) numberObject; double value = sourceValue.doubleValue(); if (value == 0.0) { return true; } return false; } public boolean removePoint(String pointID, String tableName){ return executeUpdateStatement(deletePointFromTableString.replace(table_name_exp, tableName).concat("'" + pointID + "';")); } private String getDatabaseName() { if(databaseName == null || databaseName.equals("")){ this.databaseName = Properties.getProperty("databaseName").toString(); } return databaseName; } private String getDatabasePath() { if(databasePath == null || databasePath.equals("")){ databasePath = Properties.getProperty("databasePath").toString(); } return databasePath; } private String getDatabaseUsername() { if(username == null || username.equals("")){ username = Properties.getProperty("username").toString(); } return username; } private String getDatabasePassword() { if(password == null || password.equals("")){ this.password = Properties.getProperty("password").toString(); } return password; } private void updateValues(Point source, Point closestPointInRange){ for (String propertyName : Properties.getPropertiesOfInterestDatatypeMapping().keySet()) { double weightedAvg = getWeightedAverage(source, closestPointInRange, propertyName); LOGGER.debug("Average: " + weightedAvg); source.setProperty(propertyName, weightedAvg); } } private double getWeightedAverage(Point source, Point closestPointInRange, String propertyName) { Object sourceNumberObject = source.getProperty(propertyName); if (sourceNumberObject instanceof Number) { Number sourceValue = (Number) sourceNumberObject; double summedUpValues = sourceValue.doubleValue(); LOGGER.debug("Value of " + propertyName + " of point " + source.getID() + " = " + summedUpValues); Object pointNumberObject = closestPointInRange.getProperty(propertyName); if (pointNumberObject instanceof Number) { double d = ((Number) pointNumberObject).doubleValue(); int numberOfPointsUsedForAggregation = closestPointInRange.getNumberOfPointsUsedForAggregation(propertyName); /* * sort out values of 0.0 */ if(d == 0.0){ LOGGER.debug("Value for aggregation is 0.0, will not use this."); source.setNumberOfPointsUsedForAggregation(numberOfPointsUsedForAggregation, propertyName); return summedUpValues; } double weightedAvg = ((d * numberOfPointsUsedForAggregation) + summedUpValues) / (numberOfPointsUsedForAggregation + 1); source.setNumberOfPointsUsedForAggregation(numberOfPointsUsedForAggregation + 1, propertyName); LOGGER.debug("Value of " + propertyName + " of point " + closestPointInRange.getID() + " = " + d); return weightedAvg; } } LOGGER.debug("Source property " + propertyName + " is not a number."); return -1; } private Point createPointFromCurrentResultSetEntry(ResultSet resultSet) throws SQLException{ String resultID = resultSet.getString(idField); Map<String, Object> propertyMap = new HashMap<>(); Map<String, Integer> propertyPointsUsedForAggregationMap = new HashMap<>(); for (String propertyName : Properties .getPropertiesOfInterestDatatypeMapping().keySet()) { Class<?> propertyClass = Properties .getPropertiesOfInterestDatatypeMapping().get( propertyName); Object value = null; if (propertyClass.equals(Double.class)) { value = resultSet.getDouble(propertyName .toLowerCase()); } propertyMap.put(propertyName, value); try{ int pointsUsedForAggregation = resultSet.getInt(propertyName .toLowerCase() + "numberofcontributingpoints"); propertyPointsUsedForAggregationMap.put(propertyName, pointsUsedForAggregation); }catch(Exception e){ LOGGER.info("Column " + propertyName.toLowerCase() + "numberofcontributingpoints" + " not available."); LOGGER.info(e.getMessage()); } } String resultLastContributingTrack = ""; try { resultLastContributingTrack = resultSet.getString(lastContributingTrackField); } catch (SQLException e) { LOGGER.info("Column " + lastContributingTrackField + " not available."); LOGGER.info(e.getMessage()); } int resultNumberOfContributingPoints = 1; try { resultNumberOfContributingPoints = resultSet.getInt(generalNumberOfContributingPointsField); } catch (SQLException e) { LOGGER.info("Column " + generalNumberOfContributingPointsField + " not available. Defaulting to 1."); LOGGER.info(e.getMessage()); } int resultNumberOfContributingTracks = 1; try { resultNumberOfContributingTracks = resultSet.getInt(generalnumberOfContributingTracksField); } catch (SQLException e) { LOGGER.info("Column " + generalnumberOfContributingTracksField + " not available. Defaulting to 1."); LOGGER.info(e.getMessage()); } if(resultLastContributingTrack == null || resultLastContributingTrack.isEmpty()){ /* * point seems to be original point, try accessing trackid column */ try { resultLastContributingTrack = resultSet.getString(trackIDField); } catch (SQLException e) { LOGGER.info("Column " + trackIDField + " not available."); LOGGER.info(e.getMessage()); } } double[] resultXY = new double[2]; try { String resultGeomAsText = resultSet.getString(geometryPlainTextField); resultXY = Utils.convertWKTPointToXY(resultGeomAsText); } catch (SQLException e) { LOGGER.info("Column " + geometryPlainTextField + " not available."); LOGGER.error(e.getMessage()); } Point resultPoint = new InMemoryPoint(resultID, resultXY[0], resultXY[1], propertyMap, resultNumberOfContributingPoints, resultNumberOfContributingTracks, resultLastContributingTrack, propertyPointsUsedForAggregationMap); return resultPoint; } private boolean createConnection() throws ClassNotFoundException { Class.forName("org.postgresql.Driver"); connectionURL = "jdbc:postgresql:" + getDatabasePath() + "/" + getDatabaseName(); java.util.Properties props = new java.util.Properties(); props.setProperty("create", "true"); props.setProperty("user", getDatabaseUsername()); props.setProperty("password", getDatabasePassword()); conn = null; try { conn = DriverManager.getConnection(connectionURL, props); conn.setAutoCommit(false); LOGGER.info("Connected to measurement database."); } catch (SQLException e) { LOGGER.error("Could not connect to or create the database.", e); return false; } return true; } private boolean createTable(String creationString, String tableName, boolean addToGeometryColumnTable) { try { ResultSet rs; DatabaseMetaData meta = conn.getMetaData(); rs = meta .getTables(null, null, tableName, new String[] { "TABLE" }); if (!rs.next()) { LOGGER.info("Table " + tableName + " does not yet exist."); Statement st = conn.createStatement(); st.executeUpdate(creationString); conn.commit(); meta = conn.getMetaData(); rs = meta.getTables(null, null, tableName, new String[] { "TABLE" }); if (rs.next()) { LOGGER.info("Succesfully created table " + tableName + "."); /* * add geometry column */ if(addToGeometryColumnTable){ executeStatement(addGeometryColumnToTableString.replace(table_name_exp, tableName)); } } else { LOGGER.error("Could not create table " + tableName + "."); return false; } } } catch (SQLException e) { LOGGER.error("Connection to the Postgres database failed: " + e.getMessage()); return false; } return true; } private boolean executeStatement(String statement) { Statement st = null; try { st = conn.createStatement(); st.execute(statement); } catch (SQLException e) { LOGGER.error("Execution of the following statement failed: " + statement + " cause: " + e.getMessage()); return false; } finally { try { conn.commit(); } catch (SQLException e) { LOGGER.warn(e.getMessage(), e); } } return true; } private ResultSet executeQueryStatement(String statement) { Statement st = null; try { st = conn.createStatement(); ResultSet resultSet = st.executeQuery(statement); return resultSet; } catch (SQLException e) { LOGGER.error("Execution of the following statement failed: " + statement + " cause: " + e.getMessage()); return null; } finally { try { conn.commit(); } catch (SQLException e) { LOGGER.warn(e.getMessage(), e); } } } private boolean executeUpdateStatement(String statement) { Statement st = null; try { st = conn.createStatement(); st.executeUpdate(statement); } catch (SQLException e) { LOGGER.error("Execution of the following statement failed: " + statement + " cause: " + e.getMessage()); return false; } finally { try { conn.commit(); st.close(); } catch (SQLException e) { LOGGER.warn(e.getMessage(), e); } } return true; } private int insertPoint(Point point) throws SQLException { PreparedStatement statement = createInsertPointStatement(point); int affectedRows = statement.executeUpdate(); if (affectedRows == 0) { throw new SQLException("Creating user failed, no rows affected."); } try (ResultSet generatedKeys = statement.getGeneratedKeys()) { if (generatedKeys.next()) { return generatedKeys.getInt(1); } else { throw new SQLException("Creating user failed, no ID obtained."); } } } private PreparedStatement createInsertPointStatement(Point point) throws SQLException { String columnNameString = "( "+ geometryEncodedField +", "+ generalNumberOfContributingPointsField +", "+ generalnumberOfContributingTracksField +", "+ lastContributingTrackField +", "; Iterator<String> propertyNameIterator = Properties .getPropertiesOfInterestDatatypeMapping().keySet().iterator(); List<Object> values = new ArrayList<>(); // String valueString = "( ST_GeomFromText('POINT(" + point.getX() + " " + point.getY() + ")', " + spatial_ref_sys + "), " + // point.getNumberOfPointsUsedForAggregation() + ", " + // point.getNumberOfTracksUsedForAggregation() + ", '" + // point.getLastContributingTrack() + "', "; values.add("ST_GeomFromText('POINT(" + point.getX() + " " + point.getY() + ")', " + spatial_ref_sys + ")"); values.add(new Integer(point.getNumberOfPointsUsedForAggregation())); values.add(new Integer(point.getNumberOfTracksUsedForAggregation())); values.add(point.getLastContributingTrack()); while (propertyNameIterator.hasNext()) { String propertyName = (String) propertyNameIterator.next(); columnNameString = columnNameString.concat(propertyName .toLowerCase()); columnNameString = columnNameString.concat(", "); columnNameString = columnNameString.concat(propertyName .toLowerCase() + "numberofcontributingpoints"); Object o = point.getProperty(propertyName); values.add(o == null? null : Double.parseDouble(o.toString())); int v = point.getNumberOfPointsUsedForAggregation(propertyName); values.add(new Integer(v)); if (propertyNameIterator.hasNext()) { columnNameString = columnNameString.concat(", "); } else { columnNameString = columnNameString.concat(")"); } } StringBuilder sb = new StringBuilder(); sb.append("("); for (int i = 0; i < values.size(); i++) { sb.append("?,"); } sb.delete(sb.length()-1, sb.length()); sb.append(")"); String statement = "INSERT INTO " + aggregated_MeasurementsTableName + columnNameString + "VALUES" + sb.toString() + ";"; PreparedStatement result = conn.prepareStatement(statement, PreparedStatement.RETURN_GENERATED_KEYS); int index = 0; for (Object object : values) { if (object instanceof String) { result.setString(index++, object.toString()); } else if (object instanceof Integer) { result.setInt(index++, (int) object); } else if (object instanceof Double) { result.setDouble(index++, (double) object); } } return result; } public boolean insertTrackIntoAggregatedTracksTable(String trackID) { if (trackAlreadyAggregated(trackID)) { return false; } String statement = "INSERT INTO " + aggregatedTracksTableName + "(" + idField + ", " + aggregation_dateField + ") VALUES ('" + trackID + "', '" + iso8601DateFormat.format(new Date()) + "');"; return executeUpdateStatement(statement); } @Override public boolean trackAlreadyAggregated(String trackID) { String alreadyThere = "SELECT * FROM "+ aggregatedTracksTableName +" WHERE " + idField +" = '"+trackID+"'"; ResultSet rs = executeQueryStatement(alreadyThere); try { if (rs.next()) { return true; } } catch (SQLException e) { LOGGER.warn(e.getMessage(), e); } return false; } }
bdc6900a6fcff14b5b16665ab69cdd77c2cc0962
a40f60e31f0df49c375543156632063491936985
/TestProject02/TestProject02/src/syakyo/Syakyo1.java
c49c5b8c13457b2de9dab7b218d3e7256a510752
[]
no_license
tatsuhitomoriya/backup
c93ce47d596dc4605eff63c4545c4aa807646ac4
5d4e760cc9b875f47027e7c4e4f9de0995255e70
refs/heads/master
2021-09-06T04:18:53.947473
2018-02-02T09:04:55
2018-02-02T09:04:55
114,627,161
0
0
null
null
null
null
UTF-8
Java
false
false
198
java
package syakyo; public class Syakyo1 { public static void main(String[] args) { // ここにコードを挿入 String abc = "山田"; System.out.println(abc + "さん"); } }
147b99043d36a0ace8b53b3a4c3a4082e146ebe0
319324796ca587e78cc96de7e039630300ef9f0e
/codeforces/StoneOnTheTable.java
38786a534751325e953a22fa167b6cc938c856f7
[]
no_license
RhythmAgg/java-Problems
1bc96c78a5f6b1e6e0e8ba5d26884113bbb91f7e
ae7529ae25d542f6c2ea8f444eb8a160cc77e8ba
refs/heads/master
2023-09-03T09:10:50.624371
2021-11-22T12:29:41
2021-11-22T12:29:41
430,695,421
0
0
null
null
null
null
UTF-8
Java
false
false
436
java
package codeforces; import java.util.Scanner; public class StoneOnTheTable { public static void main(String[] args) { Scanner sc=new Scanner(System.in); sc.nextLine(); String s=sc.nextLine(); sc.close(); int count=0; for(int i=0;i<s.length()-1;i++){ if(s.charAt(i)==s.charAt(i+1)){ count++; } } System.out.print(count); } }
f44987012c4a5597b3b82a6383de5bbda86853c0
a11ba1b53c0e1e978b5f4f55a38b4ff5b13d5e36
/ui/src/main/java/org/apache/hop/ui/trans/steps/dimensionlookup/DimensionLookupDialog.java
24332ad8c717dd64d2fcfa97e5724ee79d0917df
[ "Apache-2.0" ]
permissive
lipengyu/hop
157747f4da6d909a935b4510e01644935333fef9
8afe35f0705f44d78b5c33c1ba3699f657f8b9dc
refs/heads/master
2020-09-12T06:31:58.176011
2019-11-11T21:17:59
2019-11-11T21:17:59
222,341,727
1
0
Apache-2.0
2019-11-18T01:50:19
2019-11-18T01:50:18
null
UTF-8
Java
false
false
72,669
java
/*! ****************************************************************************** * * Pentaho Data Integration * * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ******************************************************************************/ package org.apache.hop.ui.trans.steps.dimensionlookup; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.CCombo; import org.eclipse.swt.custom.CTabFolder; import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.custom.ScrolledComposite; import org.eclipse.swt.events.FocusAdapter; import org.eclipse.swt.events.FocusEvent; import org.eclipse.swt.events.FocusListener; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.ShellAdapter; import org.eclipse.swt.events.ShellEvent; import org.eclipse.swt.graphics.Cursor; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.layout.FormAttachment; import org.eclipse.swt.layout.FormData; import org.eclipse.swt.layout.FormLayout; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.MessageBox; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Table; import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; import org.apache.hop.core.Const; import org.apache.hop.core.util.Utils; import org.apache.hop.core.Props; import org.apache.hop.core.SQLStatement; import org.apache.hop.core.database.Database; import org.apache.hop.core.database.DatabaseMeta; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.plugins.PluginInterface; import org.apache.hop.core.row.RowMetaInterface; import org.apache.hop.core.row.ValueMetaInterface; import org.apache.hop.i18n.BaseMessages; import org.apache.hop.trans.TransMeta; import org.apache.hop.trans.step.BaseStepMeta; import org.apache.hop.trans.step.StepDialogInterface; import org.apache.hop.trans.step.StepMeta; import org.apache.hop.trans.steps.dimensionlookup.DimensionLookupMeta; import org.apache.hop.ui.core.database.dialog.DatabaseExplorerDialog; import org.apache.hop.ui.core.database.dialog.SQLEditor; import org.apache.hop.ui.core.dialog.EnterSelectionDialog; import org.apache.hop.ui.core.dialog.ErrorDialog; import org.apache.hop.ui.core.widget.ColumnInfo; import org.apache.hop.ui.core.widget.TableView; import org.apache.hop.ui.core.widget.TextVar; import org.apache.hop.ui.trans.step.BaseStepDialog; import org.apache.hop.ui.trans.step.TableItemInsertListener; import org.apache.hop.ui.util.HelpUtils; /** * Dialog for the Dimension Lookup/Update step. */ public class DimensionLookupDialog extends BaseStepDialog implements StepDialogInterface { private static Class<?> PKG = DimensionLookupMeta.class; // for // i18n // purposes, // needed // by // Translator2!! private CTabFolder wTabFolder; private FormData fdTabFolder; private CTabItem wKeyTab, wFieldsTab; private FormData fdKeyComp, fdFieldsComp; private CCombo wConnection; private Label wlSchema; private TextVar wSchema; private Button wbSchema; private FormData fdbSchema; private Label wlTable; private Button wbTable; private TextVar wTable; private Label wlCommit; private Text wCommit; private Label wlUseCache; private Button wUseCache; private Label wlPreloadCache; private Button wPreloadCache; private Label wlCacheSize; private Text wCacheSize; private Label wlTk; private CCombo wTk; private Label wlTkRename; private Text wTkRename; private Group gTechGroup; private Label wlAutoinc; private Button wAutoinc; private Label wlTableMax; private Button wTableMax; private Label wlSeqButton; private Button wSeqButton; private Text wSeq; private Label wlVersion; private CCombo wVersion; private Label wlDatefield; private CCombo wDatefield; private Label wlFromdate; private CCombo wFromdate; private Label wlUseAltStartDate; private Button wUseAltStartDate; private CCombo wAltStartDate; private CCombo wAltStartDateField; private Label wlMinyear; private Text wMinyear; private Label wlTodate; private CCombo wTodate; private Label wlMaxyear; private Text wMaxyear; private Label wlUpdate; private Button wUpdate; private Label wlKey; private TableView wKey; private Label wlUpIns; private TableView wUpIns; private Button wGet, wCreate; private Listener lsGet, lsCreate; private DimensionLookupMeta input; private boolean backupUpdate, backupAutoInc; private DatabaseMeta ci; private ColumnInfo[] ciUpIns; private ColumnInfo[] ciKey; private Map<String, Integer> inputFields; private boolean gotPreviousFields = false; private boolean gotTableFields = false; /** * List of ColumnInfo that should have the field names of the selected database table */ private List<ColumnInfo> tableFieldColumns = new ArrayList<ColumnInfo>(); private ScrolledComposite sComp; private Composite helpComp; private Composite comp; public DimensionLookupDialog( Shell parent, Object in, TransMeta tr, String sname ) { super( parent, (BaseStepMeta) in, tr, sname ); input = (DimensionLookupMeta) in; inputFields = new HashMap<String, Integer>(); } public String open() { Shell parent = getParent(); Display display = parent.getDisplay(); shell = new Shell( parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN ); props.setLook( shell ); ModifyListener lsMod = new ModifyListener() { public void modifyText( ModifyEvent e ) { input.setChanged(); } }; FocusListener lsConnectionFocus = new FocusAdapter() { public void focusLost( FocusEvent event ) { input.setChanged(); setTableFieldCombo(); } }; ModifyListener lsTableMod = new ModifyListener() { public void modifyText( ModifyEvent arg0 ) { input.setChanged(); setTableFieldCombo(); } }; backupChanged = input.hasChanged(); backupUpdate = input.isUpdate(); backupAutoInc = input.isAutoIncrement(); ci = input.getDatabaseMeta(); GridLayout shellLayout = new GridLayout(); shellLayout.numColumns = 1; shell.setLayout( shellLayout ); shell.setText( BaseMessages.getString( PKG, "DimensionLookupDialog.Shell.Title" ) ); int middle = props.getMiddlePct(); int margin = Const.MARGIN; Composite sCompParent = new Composite( shell, SWT.NONE ); sCompParent.setLayout( new FillLayout( SWT.VERTICAL ) ); GridData sCompGridData = new GridData( GridData.FILL_BOTH ); sCompGridData.grabExcessHorizontalSpace = true; sCompGridData.grabExcessVerticalSpace = true; sCompParent.setLayoutData( sCompGridData ); sComp = new ScrolledComposite( sCompParent, SWT.V_SCROLL | SWT.H_SCROLL ); sComp.setLayout( new FormLayout() ); sComp.setExpandHorizontal( true ); sComp.setExpandVertical( true ); helpComp = new Composite( shell, SWT.NONE ); helpComp.setLayout( new FormLayout() ); GridData helpCompData = new GridData(); helpCompData.grabExcessHorizontalSpace = true; helpCompData.grabExcessVerticalSpace = false; helpComp.setLayoutData( helpCompData ); setShellImage( shell, input ); comp = new Composite( sComp, SWT.NONE ); props.setLook( comp ); FormLayout fileLayout = new FormLayout(); fileLayout.marginWidth = 3; fileLayout.marginHeight = 3; comp.setLayout( fileLayout ); // Stepname line wlStepname = new Label( comp, SWT.RIGHT ); wlStepname.setText( BaseMessages.getString( PKG, "DimensionLookupDialog.Stepname.Label" ) ); props.setLook( wlStepname ); fdlStepname = new FormData(); fdlStepname.left = new FormAttachment( 0, 0 ); fdlStepname.right = new FormAttachment( middle, -margin ); fdlStepname.top = new FormAttachment( 0, margin ); wlStepname.setLayoutData( fdlStepname ); wStepname = new Text( comp, SWT.SINGLE | SWT.LEFT | SWT.BORDER ); wStepname.setText( stepname ); props.setLook( wStepname ); wStepname.addModifyListener( lsMod ); fdStepname = new FormData(); fdStepname.left = new FormAttachment( middle, 0 ); fdStepname.top = new FormAttachment( 0, margin ); fdStepname.right = new FormAttachment( 100, 0 ); wStepname.setLayoutData( fdStepname ); // Update the dimension? wlUpdate = new Label( comp, SWT.RIGHT ); wlUpdate.setText( BaseMessages.getString( PKG, "DimensionLookupDialog.Update.Label" ) ); props.setLook( wlUpdate ); FormData fdlUpdate = new FormData(); fdlUpdate.left = new FormAttachment( 0, 0 ); fdlUpdate.right = new FormAttachment( middle, -margin ); fdlUpdate.top = new FormAttachment( wStepname, margin ); wlUpdate.setLayoutData( fdlUpdate ); wUpdate = new Button( comp, SWT.CHECK ); props.setLook( wUpdate ); FormData fdUpdate = new FormData(); fdUpdate.left = new FormAttachment( middle, 0 ); fdUpdate.top = new FormAttachment( wStepname, margin ); fdUpdate.right = new FormAttachment( 100, 0 ); wUpdate.setLayoutData( fdUpdate ); // Clicking on update changes the options in the update combo boxes! wUpdate.addSelectionListener( new SelectionAdapter() { public void widgetSelected( SelectionEvent e ) { input.setUpdate( !input.isUpdate() ); input.setChanged(); setFlags(); } } ); // Connection line wConnection = addConnectionLine( comp, wUpdate, middle, margin ); if ( input.getDatabaseMeta() == null && transMeta.nrDatabases() == 1 ) { wConnection.select( 0 ); } // wConnection.addModifyListener(lsConnectionMod); // wConnection.addSelectionListener(lsSelection); wConnection.addFocusListener( lsConnectionFocus ); wConnection.addModifyListener( new ModifyListener() { public void modifyText( ModifyEvent e ) { // We have new content: change ci connection: ci = transMeta.findDatabase( wConnection.getText() ); setFlags(); } } ); // Schema line... wlSchema = new Label( comp, SWT.RIGHT ); wlSchema.setText( BaseMessages.getString( PKG, "DimensionLookupDialog.TargetSchema.Label" ) ); props.setLook( wlSchema ); FormData fdlSchema = new FormData(); fdlSchema.left = new FormAttachment( 0, 0 ); fdlSchema.right = new FormAttachment( middle, -margin ); fdlSchema.top = new FormAttachment( wConnection, margin ); wlSchema.setLayoutData( fdlSchema ); wbSchema = new Button( comp, SWT.PUSH | SWT.CENTER ); props.setLook( wbSchema ); wbSchema.setText( BaseMessages.getString( PKG, "System.Button.Browse" ) ); fdbSchema = new FormData(); fdbSchema.top = new FormAttachment( wConnection, margin ); fdbSchema.right = new FormAttachment( 100, 0 ); wbSchema.setLayoutData( fdbSchema ); wSchema = new TextVar( transMeta, comp, SWT.SINGLE | SWT.LEFT | SWT.BORDER ); props.setLook( wSchema ); wSchema.addModifyListener( lsTableMod ); FormData fdSchema = new FormData(); fdSchema.left = new FormAttachment( middle, 0 ); fdSchema.top = new FormAttachment( wConnection, margin ); fdSchema.right = new FormAttachment( wbSchema, -margin ); wSchema.setLayoutData( fdSchema ); // Table line... wlTable = new Label( comp, SWT.RIGHT ); wlTable.setText( BaseMessages.getString( PKG, "DimensionLookupDialog.TargeTable.Label" ) ); props.setLook( wlTable ); FormData fdlTable = new FormData(); fdlTable.left = new FormAttachment( 0, 0 ); fdlTable.right = new FormAttachment( middle, -margin ); fdlTable.top = new FormAttachment( wbSchema, margin ); wlTable.setLayoutData( fdlTable ); wbTable = new Button( comp, SWT.PUSH | SWT.CENTER ); props.setLook( wbTable ); wbTable.setText( BaseMessages.getString( PKG, "DimensionLookupDialog.Browse.Button" ) ); FormData fdbTable = new FormData(); fdbTable.right = new FormAttachment( 100, 0 ); fdbTable.top = new FormAttachment( wbSchema, margin ); wbTable.setLayoutData( fdbTable ); wTable = new TextVar( transMeta, comp, SWT.SINGLE | SWT.LEFT | SWT.BORDER ); props.setLook( wTable ); wTable.addModifyListener( lsTableMod ); FormData fdTable = new FormData(); fdTable.left = new FormAttachment( middle, 0 ); fdTable.top = new FormAttachment( wbSchema, margin ); fdTable.right = new FormAttachment( wbTable, 0 ); wTable.setLayoutData( fdTable ); // Commit size ... wlCommit = new Label( comp, SWT.RIGHT ); wlCommit.setText( BaseMessages.getString( PKG, "DimensionLookupDialog.Commit.Label" ) ); props.setLook( wlCommit ); FormData fdlCommit = new FormData(); fdlCommit.left = new FormAttachment( 0, 0 ); fdlCommit.right = new FormAttachment( middle, -margin ); fdlCommit.top = new FormAttachment( wTable, margin ); wlCommit.setLayoutData( fdlCommit ); wCommit = new Text( comp, SWT.SINGLE | SWT.LEFT | SWT.BORDER ); props.setLook( wCommit ); wCommit.addModifyListener( lsMod ); FormData fdCommit = new FormData(); fdCommit.left = new FormAttachment( middle, 0 ); fdCommit.top = new FormAttachment( wTable, margin ); fdCommit.right = new FormAttachment( 100, 0 ); wCommit.setLayoutData( fdCommit ); // Use Cache? wlUseCache = new Label( comp, SWT.RIGHT ); wlUseCache.setText( BaseMessages.getString( PKG, "DimensionLookupDialog.UseCache.Label" ) ); props.setLook( wlUseCache ); FormData fdlUseCache = new FormData(); fdlUseCache.left = new FormAttachment( 0, 0 ); fdlUseCache.right = new FormAttachment( middle, -margin ); fdlUseCache.top = new FormAttachment( wCommit, margin ); wlUseCache.setLayoutData( fdlUseCache ); wUseCache = new Button( comp, SWT.CHECK ); props.setLook( wUseCache ); wUseCache.addSelectionListener( new SelectionAdapter() { public void widgetSelected( SelectionEvent arg0 ) { setFlags(); input.setChanged(); } } ); FormData fdUseCache = new FormData(); fdUseCache.left = new FormAttachment( middle, 0 ); fdUseCache.top = new FormAttachment( wCommit, margin ); fdUseCache.right = new FormAttachment( 100, 0 ); wUseCache.setLayoutData( fdUseCache ); // Preload cache? wlPreloadCache = new Label( comp, SWT.RIGHT ); wlPreloadCache.setText( BaseMessages.getString( PKG, "DimensionLookupDialog.PreloadCache.Label" ) ); props.setLook( wlPreloadCache ); FormData fdlPreloadCache = new FormData(); fdlPreloadCache.left = new FormAttachment( 0, 0 ); fdlPreloadCache.right = new FormAttachment( middle, -margin ); fdlPreloadCache.top = new FormAttachment( wUseCache, margin ); wlPreloadCache.setLayoutData( fdlPreloadCache ); wPreloadCache = new Button( comp, SWT.CHECK ); props.setLook( wPreloadCache ); wPreloadCache.addSelectionListener( new SelectionAdapter() { public void widgetSelected( SelectionEvent arg0 ) { setFlags(); input.setChanged(); } } ); FormData fdPreloadCache = new FormData(); fdPreloadCache.left = new FormAttachment( middle, 0 ); fdPreloadCache.top = new FormAttachment( wUseCache, margin ); fdPreloadCache.right = new FormAttachment( 100, 0 ); wPreloadCache.setLayoutData( fdPreloadCache ); // Cache size ... wlCacheSize = new Label( comp, SWT.RIGHT ); wlCacheSize.setText( BaseMessages.getString( PKG, "DimensionLookupDialog.CacheSize.Label" ) ); props.setLook( wlCacheSize ); FormData fdlCacheSize = new FormData(); fdlCacheSize.left = new FormAttachment( 0, 0 ); fdlCacheSize.right = new FormAttachment( middle, -margin ); fdlCacheSize.top = new FormAttachment( wPreloadCache, margin ); wlCacheSize.setLayoutData( fdlCacheSize ); wCacheSize = new Text( comp, SWT.SINGLE | SWT.LEFT | SWT.BORDER ); props.setLook( wCacheSize ); wCacheSize.addModifyListener( lsMod ); FormData fdCacheSize = new FormData(); fdCacheSize.left = new FormAttachment( middle, 0 ); fdCacheSize.top = new FormAttachment( wPreloadCache, margin ); fdCacheSize.right = new FormAttachment( 100, 0 ); wCacheSize.setLayoutData( fdCacheSize ); wlTkRename = new Label( comp, SWT.RIGHT ); wTabFolder = new CTabFolder( comp, SWT.BORDER ); props.setLook( wTabFolder, Props.WIDGET_STYLE_TAB ); // //////////////////////// // START OF KEY TAB /// // / wKeyTab = new CTabItem( wTabFolder, SWT.NONE ); wKeyTab.setText( BaseMessages.getString( PKG, "DimensionLookupDialog.KeyTab.CTabItem" ) ); FormLayout keyLayout = new FormLayout(); keyLayout.marginWidth = 3; keyLayout.marginHeight = 3; Composite wKeyComp = new Composite( wTabFolder, SWT.NONE ); props.setLook( wKeyComp ); wKeyComp.setLayout( keyLayout ); // // The Lookup fields: usually the key // wlKey = new Label( wKeyComp, SWT.NONE ); wlKey.setText( BaseMessages.getString( PKG, "DimensionLookupDialog.KeyFields.Label" ) ); props.setLook( wlKey ); FormData fdlKey = new FormData(); fdlKey.left = new FormAttachment( 0, 0 ); fdlKey.top = new FormAttachment( 0, margin ); fdlKey.right = new FormAttachment( 100, 0 ); wlKey.setLayoutData( fdlKey ); int nrKeyCols = 2; int nrKeyRows = ( input.getKeyStream() != null ? input.getKeyStream().length : 1 ); ciKey = new ColumnInfo[nrKeyCols]; ciKey[0] = new ColumnInfo( BaseMessages.getString( PKG, "DimensionLookupDialog.ColumnInfo.DimensionField" ), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false ); ciKey[1] = new ColumnInfo( BaseMessages.getString( PKG, "DimensionLookupDialog.ColumnInfo.FieldInStream" ), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false ); tableFieldColumns.add( ciKey[0] ); wKey = new TableView( transMeta, wKeyComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL, ciKey, nrKeyRows, lsMod, props ); FormData fdKey = new FormData(); fdKey.left = new FormAttachment( 0, 0 ); fdKey.top = new FormAttachment( wlKey, margin ); fdKey.right = new FormAttachment( 100, 0 ); fdKey.bottom = new FormAttachment( 100, 0 ); wKey.setLayoutData( fdKey ); fdKeyComp = new FormData(); fdKeyComp.left = new FormAttachment( 0, 0 ); fdKeyComp.top = new FormAttachment( 0, 0 ); fdKeyComp.right = new FormAttachment( 100, 0 ); fdKeyComp.bottom = new FormAttachment( 100, 0 ); wKeyComp.setLayoutData( fdKeyComp ); wKeyComp.layout(); wKeyTab.setControl( wKeyComp ); // /////////////////////////////////////////////////////////// // / END OF KEY TAB // /////////////////////////////////////////////////////////// // Fields tab... // wFieldsTab = new CTabItem( wTabFolder, SWT.NONE ); wFieldsTab.setText( BaseMessages.getString( PKG, "DimensionLookupDialog.FieldsTab.CTabItem.Title" ) ); Composite wFieldsComp = new Composite( wTabFolder, SWT.NONE ); props.setLook( wFieldsComp ); FormLayout fieldsCompLayout = new FormLayout(); fieldsCompLayout.marginWidth = Const.FORM_MARGIN; fieldsCompLayout.marginHeight = Const.FORM_MARGIN; wFieldsComp.setLayout( fieldsCompLayout ); // THE UPDATE/INSERT TABLE wlUpIns = new Label( wFieldsComp, SWT.NONE ); wlUpIns.setText( BaseMessages.getString( PKG, "DimensionLookupDialog.UpdateOrInsertFields.Label" ) ); props.setLook( wlUpIns ); FormData fdlUpIns = new FormData(); fdlUpIns.left = new FormAttachment( 0, 0 ); fdlUpIns.top = new FormAttachment( 0, margin ); wlUpIns.setLayoutData( fdlUpIns ); int UpInsCols = 3; int UpInsRows = ( input.getFieldStream() != null ? input.getFieldStream().length : 1 ); ciUpIns = new ColumnInfo[UpInsCols]; ciUpIns[0] = new ColumnInfo( BaseMessages.getString( PKG, "DimensionLookupDialog.ColumnInfo.DimensionField" ), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false ); ciUpIns[1] = new ColumnInfo( BaseMessages.getString( PKG, "DimensionLookupDialog.ColumnInfo.StreamField" ), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false ); ciUpIns[2] = new ColumnInfo( BaseMessages.getString( PKG, "DimensionLookupDialog.ColumnInfo.TypeOfDimensionUpdate" ), ColumnInfo.COLUMN_TYPE_CCOMBO, input.isUpdate() ? DimensionLookupMeta.typeDesc : DimensionLookupMeta.typeDescLookup ); tableFieldColumns.add( ciUpIns[0] ); wUpIns = new TableView( transMeta, wFieldsComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL, ciUpIns, UpInsRows, lsMod, props ); FormData fdUpIns = new FormData(); fdUpIns.left = new FormAttachment( 0, 0 ); fdUpIns.top = new FormAttachment( wlUpIns, margin ); fdUpIns.right = new FormAttachment( 100, 0 ); fdUpIns.bottom = new FormAttachment( 100, 0 ); wUpIns.setLayoutData( fdUpIns ); // // Search the fields in the background // final Runnable runnable = new Runnable() { public void run() { StepMeta stepMeta = transMeta.findStep( stepname ); if ( stepMeta != null ) { try { RowMetaInterface row = transMeta.getPrevStepFields( stepMeta ); // Remember these fields... for ( int i = 0; i < row.size(); i++ ) { inputFields.put( row.getValueMeta( i ).getName(), i ); } setComboBoxes(); } catch ( HopException e ) { logError( BaseMessages.getString( PKG, "System.Dialog.GetFieldsFailed.Message" ) ); } } } }; new Thread( runnable ).start(); fdFieldsComp = new FormData(); fdFieldsComp.left = new FormAttachment( 0, 0 ); fdFieldsComp.top = new FormAttachment( 0, 0 ); fdFieldsComp.right = new FormAttachment( 100, 0 ); fdFieldsComp.bottom = new FormAttachment( 100, 0 ); wFieldsComp.setLayoutData( fdFieldsComp ); wFieldsComp.layout(); wFieldsTab.setControl( wFieldsComp ); fdTabFolder = new FormData(); fdTabFolder.left = new FormAttachment( 0, 0 ); fdTabFolder.top = new FormAttachment( wCacheSize, margin ); fdTabFolder.right = new FormAttachment( 100, 0 ); fdTabFolder.height = 200; wTabFolder.setLayoutData( fdTabFolder ); // Technical key field: wlTk = new Label( comp, SWT.RIGHT ); wlTk.setText( BaseMessages.getString( PKG, "DimensionLookupDialog.TechnicalKeyField.Label" ) ); props.setLook( wlTk ); FormData fdlTk = new FormData(); fdlTk.left = new FormAttachment( 0, 0 ); fdlTk.right = new FormAttachment( middle, -margin ); fdlTk.top = new FormAttachment( wTabFolder, 2 * margin ); wlTk.setLayoutData( fdlTk ); wTk = new CCombo( comp, SWT.SINGLE | SWT.LEFT | SWT.BORDER ); props.setLook( wTk ); wTk.addModifyListener( lsMod ); FormData fdTk = new FormData(); fdTk.left = new FormAttachment( middle, 0 ); fdTk.top = new FormAttachment( wTabFolder, 2 * margin ); fdTk.right = new FormAttachment( 50 + middle / 2, 0 ); wTk.setLayoutData( fdTk ); wTk.addFocusListener( new FocusListener() { public void focusLost( org.eclipse.swt.events.FocusEvent e ) { } public void focusGained( org.eclipse.swt.events.FocusEvent e ) { Cursor busy = new Cursor( shell.getDisplay(), SWT.CURSOR_WAIT ); shell.setCursor( busy ); getFieldsFromTable(); shell.setCursor( null ); busy.dispose(); } } ); wlTkRename.setText( BaseMessages.getString( PKG, "DimensionLookupDialog.NewName.Label" ) ); props.setLook( wlTkRename ); FormData fdlTkRename = new FormData(); fdlTkRename.left = new FormAttachment( 50 + middle / 2, margin ); fdlTkRename.top = new FormAttachment( wTabFolder, 2 * margin ); wlTkRename.setLayoutData( fdlTkRename ); wTkRename = new Text( comp, SWT.SINGLE | SWT.LEFT | SWT.BORDER ); props.setLook( wTkRename ); wTkRename.addModifyListener( lsMod ); FormData fdTkRename = new FormData(); fdTkRename.left = new FormAttachment( wlTkRename, margin ); fdTkRename.top = new FormAttachment( wTabFolder, 2 * margin ); fdTkRename.right = new FormAttachment( 100, 0 ); wTkRename.setLayoutData( fdTkRename ); // ////////////////////////////////////////////////// // The key creation box // ////////////////////////////////////////////////// gTechGroup = new Group( comp, SWT.SHADOW_ETCHED_IN ); gTechGroup.setText( BaseMessages.getString( PKG, "DimensionLookupDialog.TechGroup.Label" ) ); GridLayout gridLayout = new GridLayout( 3, false ); gTechGroup.setLayout( gridLayout ); FormData fdTechGroup = new FormData(); fdTechGroup.left = new FormAttachment( middle, 0 ); fdTechGroup.top = new FormAttachment( wTkRename, 2 * margin ); fdTechGroup.right = new FormAttachment( 100, 0 ); gTechGroup.setBackground( shell.getBackground() ); // the default looks ugly gTechGroup.setLayoutData( fdTechGroup ); // Use maximum of table + 1 wTableMax = new Button( gTechGroup, SWT.RADIO ); props.setLook( wTableMax ); wTableMax.setSelection( false ); GridData gdTableMax = new GridData(); wTableMax.setLayoutData( gdTableMax ); wTableMax .setToolTipText( BaseMessages.getString( PKG, "DimensionLookupDialog.TableMaximum.Tooltip", Const.CR ) ); wlTableMax = new Label( gTechGroup, SWT.LEFT ); wlTableMax.setText( BaseMessages.getString( PKG, "DimensionLookupDialog.TableMaximum.Label" ) ); props.setLook( wlTableMax ); GridData gdlTableMax = new GridData( GridData.FILL_BOTH ); gdlTableMax.horizontalSpan = 2; gdlTableMax.verticalSpan = 1; wlTableMax.setLayoutData( gdlTableMax ); // Sequence Check Button wSeqButton = new Button( gTechGroup, SWT.RADIO ); props.setLook( wSeqButton ); wSeqButton.setSelection( false ); GridData gdSeqButton = new GridData(); wSeqButton.setLayoutData( gdSeqButton ); wSeqButton.setToolTipText( BaseMessages.getString( PKG, "DimensionLookupDialog.Sequence.Tooltip", Const.CR ) ); wlSeqButton = new Label( gTechGroup, SWT.LEFT ); wlSeqButton.setText( BaseMessages.getString( PKG, "DimensionLookupDialog.Sequence.Label" ) ); props.setLook( wlSeqButton ); GridData gdlSeqButton = new GridData(); wlSeqButton.setLayoutData( gdlSeqButton ); wSeq = new Text( gTechGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER ); props.setLook( wSeq ); wSeq.addModifyListener( lsMod ); GridData gdSeq = new GridData( GridData.FILL_HORIZONTAL ); wSeq.setLayoutData( gdSeq ); wSeq.addFocusListener( new FocusListener() { public void focusGained( FocusEvent arg0 ) { input.setTechKeyCreation( DimensionLookupMeta.CREATION_METHOD_SEQUENCE ); wSeqButton.setSelection( true ); wAutoinc.setSelection( false ); wTableMax.setSelection( false ); } public void focusLost( FocusEvent arg0 ) { } } ); // Use an autoincrement field? wAutoinc = new Button( gTechGroup, SWT.RADIO ); props.setLook( wAutoinc ); wAutoinc.setSelection( false ); GridData gdAutoinc = new GridData(); wAutoinc.setLayoutData( gdAutoinc ); wAutoinc .setToolTipText( BaseMessages.getString( PKG, "DimensionLookupDialog.AutoincButton.Tooltip", Const.CR ) ); wlAutoinc = new Label( gTechGroup, SWT.LEFT ); wlAutoinc.setText( BaseMessages.getString( PKG, "DimensionLookupDialog.Autoincrement.Label" ) ); props.setLook( wlAutoinc ); GridData gdlAutoinc = new GridData(); wlAutoinc.setLayoutData( gdlAutoinc ); // ////////////////////////////////////////////////// // The key creation box END // ////////////////////////////////////////////////// // Version key field: wlVersion = new Label( comp, SWT.RIGHT ); wlVersion.setText( BaseMessages.getString( PKG, "DimensionLookupDialog.Version.Label" ) ); props.setLook( wlVersion ); FormData fdlVersion = new FormData(); fdlVersion.left = new FormAttachment( 0, 0 ); fdlVersion.right = new FormAttachment( middle, -margin ); fdlVersion.top = new FormAttachment( gTechGroup, 2 * margin ); wlVersion.setLayoutData( fdlVersion ); wVersion = new CCombo( comp, SWT.SINGLE | SWT.LEFT | SWT.BORDER ); props.setLook( wVersion ); wVersion.addModifyListener( lsMod ); FormData fdVersion = new FormData(); fdVersion.left = new FormAttachment( middle, 0 ); fdVersion.top = new FormAttachment( gTechGroup, 2 * margin ); fdVersion.right = new FormAttachment( 100, 0 ); wVersion.setLayoutData( fdVersion ); wVersion.addFocusListener( new FocusListener() { public void focusLost( org.eclipse.swt.events.FocusEvent e ) { } public void focusGained( org.eclipse.swt.events.FocusEvent e ) { Cursor busy = new Cursor( shell.getDisplay(), SWT.CURSOR_WAIT ); shell.setCursor( busy ); getFieldsFromTable(); shell.setCursor( null ); busy.dispose(); } } ); // Datefield line wlDatefield = new Label( comp, SWT.RIGHT ); wlDatefield.setText( BaseMessages.getString( PKG, "DimensionLookupDialog.Datefield.Label" ) ); props.setLook( wlDatefield ); FormData fdlDatefield = new FormData(); fdlDatefield.left = new FormAttachment( 0, 0 ); fdlDatefield.right = new FormAttachment( middle, -margin ); fdlDatefield.top = new FormAttachment( wVersion, 2 * margin ); wlDatefield.setLayoutData( fdlDatefield ); wDatefield = new CCombo( comp, SWT.SINGLE | SWT.LEFT | SWT.BORDER ); props.setLook( wDatefield ); wDatefield.addModifyListener( lsMod ); FormData fdDatefield = new FormData(); fdDatefield.left = new FormAttachment( middle, 0 ); fdDatefield.top = new FormAttachment( wVersion, 2 * margin ); fdDatefield.right = new FormAttachment( 100, 0 ); wDatefield.setLayoutData( fdDatefield ); wDatefield.addFocusListener( new FocusListener() { public void focusLost( org.eclipse.swt.events.FocusEvent e ) { } public void focusGained( org.eclipse.swt.events.FocusEvent e ) { Cursor busy = new Cursor( shell.getDisplay(), SWT.CURSOR_WAIT ); shell.setCursor( busy ); getFields(); shell.setCursor( null ); busy.dispose(); } } ); // Fromdate line // // 0 [wlFromdate] middle [wFromdate] (100-middle)/3 [wlMinyear] // 2*(100-middle)/3 [wMinyear] 100% // wlFromdate = new Label( comp, SWT.RIGHT ); wlFromdate.setText( BaseMessages.getString( PKG, "DimensionLookupDialog.Fromdate.Label" ) ); props.setLook( wlFromdate ); FormData fdlFromdate = new FormData(); fdlFromdate.left = new FormAttachment( 0, 0 ); fdlFromdate.right = new FormAttachment( middle, -margin ); fdlFromdate.top = new FormAttachment( wDatefield, 2 * margin ); wlFromdate.setLayoutData( fdlFromdate ); wFromdate = new CCombo( comp, SWT.SINGLE | SWT.LEFT | SWT.BORDER ); props.setLook( wFromdate ); wFromdate.addModifyListener( lsMod ); FormData fdFromdate = new FormData(); fdFromdate.left = new FormAttachment( middle, 0 ); fdFromdate.right = new FormAttachment( middle + ( 100 - middle ) / 3, -margin ); fdFromdate.top = new FormAttachment( wDatefield, 2 * margin ); wFromdate.setLayoutData( fdFromdate ); wFromdate.addFocusListener( new FocusListener() { public void focusLost( org.eclipse.swt.events.FocusEvent e ) { } public void focusGained( org.eclipse.swt.events.FocusEvent e ) { Cursor busy = new Cursor( shell.getDisplay(), SWT.CURSOR_WAIT ); shell.setCursor( busy ); getFieldsFromTable(); shell.setCursor( null ); busy.dispose(); } } ); // Minyear line wlMinyear = new Label( comp, SWT.RIGHT ); wlMinyear.setText( BaseMessages.getString( PKG, "DimensionLookupDialog.Minyear.Label" ) ); props.setLook( wlMinyear ); FormData fdlMinyear = new FormData(); fdlMinyear.left = new FormAttachment( wFromdate, margin ); fdlMinyear.right = new FormAttachment( middle + 2 * ( 100 - middle ) / 3, -margin ); fdlMinyear.top = new FormAttachment( wDatefield, 2 * margin ); wlMinyear.setLayoutData( fdlMinyear ); wMinyear = new Text( comp, SWT.SINGLE | SWT.LEFT | SWT.BORDER ); props.setLook( wMinyear ); wMinyear.addModifyListener( lsMod ); FormData fdMinyear = new FormData(); fdMinyear.left = new FormAttachment( wlMinyear, margin ); fdMinyear.right = new FormAttachment( 100, 0 ); fdMinyear.top = new FormAttachment( wDatefield, 2 * margin ); wMinyear.setLayoutData( fdMinyear ); wMinyear.setToolTipText( BaseMessages.getString( PKG, "DimensionLookupDialog.Minyear.ToolTip" ) ); // Add a line with an option to specify an alternative start date... // wlUseAltStartDate = new Label( comp, SWT.RIGHT ); wlUseAltStartDate .setText( BaseMessages.getString( PKG, "DimensionLookupDialog.UseAlternativeStartDate.Label" ) ); props.setLook( wlUseAltStartDate ); FormData fdlUseAltStartDate = new FormData(); fdlUseAltStartDate.left = new FormAttachment( 0, 0 ); fdlUseAltStartDate.right = new FormAttachment( middle, -margin ); fdlUseAltStartDate.top = new FormAttachment( wFromdate, margin ); wlUseAltStartDate.setLayoutData( fdlUseAltStartDate ); wUseAltStartDate = new Button( comp, SWT.CHECK ); props.setLook( wUseAltStartDate ); wUseAltStartDate.setToolTipText( BaseMessages.getString( PKG, "DimensionLookupDialog.UseAlternativeStartDate.Tooltip", Const.CR ) ); FormData fdUseAltStartDate = new FormData(); fdUseAltStartDate.left = new FormAttachment( middle, 0 ); fdUseAltStartDate.top = new FormAttachment( wFromdate, margin ); wUseAltStartDate.setLayoutData( fdUseAltStartDate ); wUseAltStartDate.addSelectionListener( new SelectionAdapter() { public void widgetSelected( SelectionEvent e ) { setFlags(); input.setChanged(); } } ); // The choice... // wAltStartDate = new CCombo( comp, SWT.BORDER ); props.setLook( wAltStartDate ); // All options except for "No alternative"... wAltStartDate.removeAll(); for ( int i = 1; i < DimensionLookupMeta.getStartDateAlternativeDescriptions().length; i++ ) { wAltStartDate.add( DimensionLookupMeta.getStartDateAlternativeDescriptions()[i] ); } wAltStartDate.setText( BaseMessages.getString( PKG, "DimensionLookupDialog.AlternativeStartDate.SelectItemDefault" ) ); wAltStartDate.setToolTipText( BaseMessages.getString( PKG, "DimensionLookupDialog.AlternativeStartDate.Tooltip", Const.CR ) ); FormData fdAltStartDate = new FormData(); fdAltStartDate.left = new FormAttachment( wUseAltStartDate, 2 * margin ); fdAltStartDate.right = new FormAttachment( wUseAltStartDate, 200 ); fdAltStartDate.top = new FormAttachment( wFromdate, margin ); wAltStartDate.setLayoutData( fdAltStartDate ); wAltStartDate.addModifyListener( new ModifyListener() { public void modifyText( ModifyEvent arg0 ) { setFlags(); input.setChanged(); } } ); wAltStartDateField = new CCombo( comp, SWT.SINGLE | SWT.BORDER ); props.setLook( wAltStartDateField ); wAltStartDateField.setToolTipText( BaseMessages.getString( PKG, "DimensionLookupDialog.AlternativeStartDateField.Tooltip", Const.CR ) ); FormData fdAltStartDateField = new FormData(); fdAltStartDateField.left = new FormAttachment( wAltStartDate, 2 * margin ); fdAltStartDateField.right = new FormAttachment( 100, 0 ); fdAltStartDateField.top = new FormAttachment( wFromdate, margin ); wAltStartDateField.setLayoutData( fdAltStartDateField ); wAltStartDateField.addFocusListener( new FocusListener() { public void focusLost( org.eclipse.swt.events.FocusEvent e ) { } public void focusGained( org.eclipse.swt.events.FocusEvent e ) { Cursor busy = new Cursor( shell.getDisplay(), SWT.CURSOR_WAIT ); shell.setCursor( busy ); getFieldsFromTable(); shell.setCursor( null ); busy.dispose(); } } ); // Todate line wlTodate = new Label( comp, SWT.RIGHT ); wlTodate.setText( BaseMessages.getString( PKG, "DimensionLookupDialog.Todate.Label" ) ); props.setLook( wlTodate ); FormData fdlTodate = new FormData(); fdlTodate.left = new FormAttachment( 0, 0 ); fdlTodate.right = new FormAttachment( middle, -margin ); fdlTodate.top = new FormAttachment( wAltStartDate, margin ); wlTodate.setLayoutData( fdlTodate ); wTodate = new CCombo( comp, SWT.SINGLE | SWT.LEFT | SWT.BORDER ); props.setLook( wTodate ); wTodate.addModifyListener( lsMod ); FormData fdTodate = new FormData(); fdTodate.left = new FormAttachment( middle, 0 ); fdTodate.right = new FormAttachment( middle + ( 100 - middle ) / 3, -margin ); fdTodate.top = new FormAttachment( wAltStartDate, margin ); wTodate.setLayoutData( fdTodate ); wTodate.addFocusListener( new FocusListener() { public void focusLost( org.eclipse.swt.events.FocusEvent e ) { } public void focusGained( org.eclipse.swt.events.FocusEvent e ) { Cursor busy = new Cursor( shell.getDisplay(), SWT.CURSOR_WAIT ); shell.setCursor( busy ); getFieldsFromTable(); shell.setCursor( null ); busy.dispose(); } } ); // Maxyear line wlMaxyear = new Label( comp, SWT.RIGHT ); wlMaxyear.setText( BaseMessages.getString( PKG, "DimensionLookupDialog.Maxyear.Label" ) ); props.setLook( wlMaxyear ); FormData fdlMaxyear = new FormData(); fdlMaxyear.left = new FormAttachment( wTodate, margin ); fdlMaxyear.right = new FormAttachment( middle + 2 * ( 100 - middle ) / 3, -margin ); fdlMaxyear.top = new FormAttachment( wAltStartDate, margin ); wlMaxyear.setLayoutData( fdlMaxyear ); wMaxyear = new Text( comp, SWT.SINGLE | SWT.LEFT | SWT.BORDER ); props.setLook( wMaxyear ); wMaxyear.addModifyListener( lsMod ); FormData fdMaxyear = new FormData(); fdMaxyear.left = new FormAttachment( wlMaxyear, margin ); fdMaxyear.right = new FormAttachment( 100, 0 ); fdMaxyear.top = new FormAttachment( wAltStartDate, margin ); wMaxyear.setLayoutData( fdMaxyear ); wMaxyear.setToolTipText( BaseMessages.getString( PKG, "DimensionLookupDialog.Maxyear.ToolTip" ) ); // THE BOTTOM BUTTONS wOK = new Button( comp, SWT.PUSH ); wOK.setText( BaseMessages.getString( PKG, "System.Button.OK" ) ); wGet = new Button( comp, SWT.PUSH ); wGet.setText( BaseMessages.getString( PKG, "DimensionLookupDialog.GetFields.Button" ) ); wCreate = new Button( comp, SWT.PUSH ); wCreate.setText( BaseMessages.getString( PKG, "DimensionLookupDialog.SQL.Button" ) ); wCancel = new Button( comp, SWT.PUSH ); wCancel.setText( BaseMessages.getString( PKG, "System.Button.Cancel" ) ); setButtonPositions( new Button[] { wOK, wCancel, wGet, wCreate }, margin, wMaxyear ); FormData fdComp = new FormData(); fdComp.left = new FormAttachment( 0, 0 ); fdComp.top = new FormAttachment( 0, 0 ); fdComp.right = new FormAttachment( 100, 0 ); fdComp.bottom = new FormAttachment( 100, 0 ); comp.setLayoutData( fdComp ); comp.pack(); Rectangle bounds = comp.getBounds(); sComp.setContent( comp ); sComp.setExpandHorizontal( true ); sComp.setExpandVertical( true ); sComp.setMinWidth( bounds.width ); sComp.setMinHeight( bounds.height ); // Add listeners lsOK = new Listener() { public void handleEvent( Event e ) { ok(); } }; lsGet = new Listener() { public void handleEvent( Event e ) { get(); } }; lsCreate = new Listener() { public void handleEvent( Event e ) { create(); } }; lsCancel = new Listener() { public void handleEvent( Event e ) { cancel(); } }; wOK.addListener( SWT.Selection, lsOK ); wGet.addListener( SWT.Selection, lsGet ); wCreate.addListener( SWT.Selection, lsCreate ); wCancel.addListener( SWT.Selection, lsCancel ); setTableMax(); setSequence(); setAutoincUse(); lsDef = new SelectionAdapter() { public void widgetDefaultSelected( SelectionEvent e ) { ok(); } }; wStepname.addSelectionListener( lsDef ); wSchema.addSelectionListener( lsDef ); wTable.addSelectionListener( lsDef ); wCommit.addSelectionListener( lsDef ); wCacheSize.addSelectionListener( lsDef ); wTk.addSelectionListener( lsDef ); wTkRename.addSelectionListener( lsDef ); wSeq.addSelectionListener( lsDef ); wVersion.addSelectionListener( lsDef ); wDatefield.addSelectionListener( lsDef ); wFromdate.addSelectionListener( lsDef ); wMinyear.addSelectionListener( lsDef ); wTodate.addSelectionListener( lsDef ); wMaxyear.addSelectionListener( lsDef ); // Detect X or ALT-F4 or something that kills this window... shell.addShellListener( new ShellAdapter() { public void shellClosed( ShellEvent e ) { cancel(); } } ); wbSchema.addSelectionListener( new SelectionAdapter() { public void widgetSelected( SelectionEvent e ) { getSchemaNames(); } } ); wbTable.addSelectionListener( new SelectionAdapter() { public void widgetSelected( SelectionEvent e ) { getTableName(); } } ); wTabFolder.setSelection( 0 ); // Set the shell size, based upon previous time... setSize(); getData(); setTableFieldCombo(); input.setChanged( backupChanged ); shell.open(); while ( !shell.isDisposed() ) { if ( !display.readAndDispatch() ) { display.sleep(); } } return stepname; } public void setFlags() { ColumnInfo colinf = new ColumnInfo( BaseMessages.getString( PKG, "DimensionLookupDialog.ColumnInfo.Type" ), ColumnInfo.COLUMN_TYPE_CCOMBO, input.isUpdate() ? DimensionLookupMeta.typeDesc : DimensionLookupMeta.typeDescLookup ); wUpIns.setColumnInfo( 2, colinf ); if ( input.isUpdate() ) { wUpIns.setColumnText( 2, BaseMessages.getString( PKG, "DimensionLookupDialog.UpdateOrInsertFields.ColumnText.SteamFieldToCompare" ) ); wUpIns.setColumnText( 3, BaseMessages.getString( PKG, "DimensionLookupDialog.UpdateOrInsertFields.ColumnTextTypeOfDimensionUpdate" ) ); wUpIns.setColumnToolTip( 2, BaseMessages.getString( PKG, "DimensionLookupDialog.UpdateOrInsertFields.ColumnToolTip" ) + Const.CR + "Punch Through: Kimball Type I" + Const.CR + "Update: Correct error in last version" ); } else { wUpIns.setColumnText( 2, BaseMessages.getString( PKG, "DimensionLookupDialog.UpdateOrInsertFields.ColumnText.NewNameOfOutputField" ) ); wUpIns.setColumnText( 3, BaseMessages.getString( PKG, "DimensionLookupDialog.UpdateOrInsertFields.ColumnText.TypeOfReturnField" ) ); wUpIns.setColumnToolTip( 2, BaseMessages.getString( PKG, "DimensionLookupDialog.UpdateOrInsertFields.ColumnToolTip2" ) ); } wUpIns.optWidth( true ); // In case of lookup: disable commitsize, etc. boolean update = wUpdate.getSelection(); wlCommit.setEnabled( update ); wCommit.setEnabled( update ); wlMinyear.setEnabled( update ); wMinyear.setEnabled( update ); wlMaxyear.setEnabled( update ); wMaxyear.setEnabled( update ); wlMinyear.setEnabled( update ); wMinyear.setEnabled( update ); wlVersion.setEnabled( update ); wVersion.setEnabled( update ); wlTkRename.setEnabled( !update ); wTkRename.setEnabled( !update ); wCreate.setEnabled( update ); // Set the technical creation key fields correct... then disable // depending on update or not. Then reset if we're updating. It makes // sure that the disabled options because of database restrictions // will always be properly grayed out. setAutoincUse(); setSequence(); setTableMax(); // Surpisingly we can't disable these fields as they influence the // calculation of the "Unknown" key // If we have a MySQL database with Auto-increment for example, the // "unknown" is 1. // If we have a MySQL database with Table-max the "unknown" is 0. // // gTechGroup.setEnabled( update ); // wlAutoinc.setEnabled( update ); // wAutoinc.setEnabled( update ); // wlTableMax.setEnabled( update ); // wTableMax.setEnabled( update ); // wlSeqButton.setEnabled( update ); // wSeqButton.setEnabled( update ); // wSeq.setEnabled( update ); if ( update ) { setAutoincUse(); setSequence(); setTableMax(); } // The alternative start date // wAltStartDate.setEnabled( wUseAltStartDate.getSelection() ); int alternative = DimensionLookupMeta.getStartDateAlternative( wAltStartDate.getText() ); wAltStartDateField.setEnabled( alternative == DimensionLookupMeta.START_DATE_ALTERNATIVE_COLUMN_VALUE ); // Caching... // wlPreloadCache.setEnabled( wUseCache.getSelection() && !wUpdate.getSelection() ); wPreloadCache.setEnabled( wUseCache.getSelection() && !wUpdate.getSelection() ); wlCacheSize.setEnabled( wUseCache.getSelection() && !wPreloadCache.getSelection() ); wCacheSize.setEnabled( wUseCache.getSelection() && !wPreloadCache.getSelection() ); } protected void setComboBoxes() { // Something was changed in the row. // final Map<String, Integer> fields = new HashMap<String, Integer>(); // Add the currentMeta fields... fields.putAll( inputFields ); Set<String> keySet = fields.keySet(); List<String> entries = new ArrayList<String>( keySet ); String[] fieldNames = entries.toArray( new String[entries.size()] ); Const.sortStrings( fieldNames ); ciKey[1].setComboValues( fieldNames ); ciUpIns[1].setComboValues( fieldNames ); } public void setAutoincUse() { boolean enable = ( ci == null ) || ( ci.supportsAutoinc() && ci.supportsAutoGeneratedKeys() ); wlAutoinc.setEnabled( enable ); wAutoinc.setEnabled( enable ); if ( !enable && wAutoinc.getSelection() ) { wAutoinc.setSelection( false ); wSeqButton.setSelection( false ); wTableMax.setSelection( true ); } } public void setTableMax() { wlTableMax.setEnabled( true ); wTableMax.setEnabled( true ); } public void setSequence() { boolean seq = ( ci == null ) || ci.supportsSequences(); wSeq.setEnabled( seq ); wlSeqButton.setEnabled( seq ); wSeqButton.setEnabled( seq ); if ( !seq && wSeqButton.getSelection() ) { wAutoinc.setSelection( false ); wSeqButton.setSelection( false ); wTableMax.setSelection( true ); } } /** * Copy information from the meta-data input to the dialog fields. */ public void getData() { if ( log.isDebug() ) { logDebug( BaseMessages.getString( PKG, "DimensionLookupDialog.Log.GettingKeyInfo" ) ); } if ( input.getKeyStream() != null ) { for ( int i = 0; i < input.getKeyStream().length; i++ ) { TableItem item = wKey.table.getItem( i ); if ( input.getKeyLookup()[i] != null ) { item.setText( 1, input.getKeyLookup()[i] ); } if ( input.getKeyStream()[i] != null ) { item.setText( 2, input.getKeyStream()[i] ); } } } if ( input.getFieldStream() != null ) { for ( int i = 0; i < input.getFieldStream().length; i++ ) { TableItem item = wUpIns.table.getItem( i ); if ( input.getFieldLookup()[i] != null ) { item.setText( 1, input.getFieldLookup()[i] ); } if ( input.getFieldStream()[i] != null ) { item.setText( 2, input.getFieldStream()[i] ); } item.setText( 3, DimensionLookupMeta.getUpdateType( input.isUpdate(), input.getFieldUpdate()[i] ) ); } } wUpdate.setSelection( input.isUpdate() ); if ( input.getSchemaName() != null ) { wSchema.setText( input.getSchemaName() ); } if ( input.getTableName() != null ) { wTable.setText( input.getTableName() ); } if ( input.getKeyField() != null ) { wTk.setText( input.getKeyField() ); } if ( input.getKeyRename() != null ) { wTkRename.setText( input.getKeyRename() ); } wAutoinc.setSelection( input.isAutoIncrement() ); if ( input.getVersionField() != null ) { wVersion.setText( input.getVersionField() ); } if ( input.getSequenceName() != null ) { wSeq.setText( input.getSequenceName() ); } if ( input.getDatabaseMeta() != null ) { wConnection.setText( input.getDatabaseMeta().getName() ); } else if ( transMeta.nrDatabases() == 1 ) { wConnection.setText( transMeta.getDatabase( 0 ).getName() ); } if ( input.getDateField() != null ) { wDatefield.setText( input.getDateField() ); } if ( input.getDateFrom() != null ) { wFromdate.setText( input.getDateFrom() ); } if ( input.getDateTo() != null ) { wTodate.setText( input.getDateTo() ); } String techKeyCreation = input.getTechKeyCreation(); if ( techKeyCreation == null ) { // Determine the creation of the technical key for // backwards compatibility. Can probably be removed at // version 3.x or so (Sven Boden). DatabaseMeta database = input.getDatabaseMeta(); if ( database == null || !database.supportsAutoinc() ) { input.setAutoIncrement( false ); } wAutoinc.setSelection( input.isAutoIncrement() ); wSeqButton.setSelection( input.getSequenceName() != null && input.getSequenceName().length() > 0 ); if ( !input.isAutoIncrement() && ( input.getSequenceName() == null || input.getSequenceName().length() <= 0 ) ) { wTableMax.setSelection( true ); } if ( database != null && database.supportsSequences() && input.getSequenceName() != null ) { wSeq.setText( input.getSequenceName() ); input.setAutoIncrement( false ); wTableMax.setSelection( false ); } } else { // HOP post 2.2 version: // The "creation" field now determines the behaviour of the // key creation. if ( DimensionLookupMeta.CREATION_METHOD_AUTOINC.equals( techKeyCreation ) ) { wAutoinc.setSelection( true ); wSeqButton.setSelection( false ); wTableMax.setSelection( false ); } else if ( ( DimensionLookupMeta.CREATION_METHOD_SEQUENCE.equals( techKeyCreation ) ) ) { wSeqButton.setSelection( true ); wAutoinc.setSelection( false ); wTableMax.setSelection( false ); } else { // the rest wTableMax.setSelection( true ); wAutoinc.setSelection( false ); wSeqButton.setSelection( false ); input.setTechKeyCreation( DimensionLookupMeta.CREATION_METHOD_TABLEMAX ); } if ( input.getSequenceName() != null ) { wSeq.setText( input.getSequenceName() ); } } wCommit.setText( "" + input.getCommitSize() ); wUseCache.setSelection( input.getCacheSize() >= 0 ); wPreloadCache.setSelection( input.isPreloadingCache() ); if ( input.getCacheSize() >= 0 ) { wCacheSize.setText( "" + input.getCacheSize() ); } wMinyear.setText( "" + input.getMinYear() ); wMaxyear.setText( "" + input.getMaxYear() ); wUpIns.removeEmptyRows(); wUpIns.setRowNums(); wUpIns.optWidth( true ); wKey.removeEmptyRows(); wKey.setRowNums(); wKey.optWidth( true ); ci = transMeta.findDatabase( wConnection.getText() ); // The alternative start date... // wUseAltStartDate.setSelection( input.isUsingStartDateAlternative() ); if ( input.isUsingStartDateAlternative() ) { wAltStartDate.setText( DimensionLookupMeta.getStartDateAlternativeDesc( input.getStartDateAlternative() ) ); } wAltStartDateField.setText( Const.NVL( input.getStartDateFieldName(), "" ) ); setFlags(); wStepname.selectAll(); wStepname.setFocus(); } private void cancel() { stepname = null; input.setChanged( backupChanged ); input.setUpdate( backupUpdate ); input.setAutoIncrement( backupAutoInc ); dispose(); } private void ok() { if ( Utils.isEmpty( wStepname.getText() ) ) { return; } getInfo( input ); stepname = wStepname.getText(); // return value if ( input.getDatabaseMeta() == null ) { MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR ); mb.setMessage( BaseMessages.getString( PKG, "DimensionLookupDialog.InvalidConnection.DialogMessage" ) ); mb.setText( BaseMessages.getString( PKG, "DimensionLookupDialog.InvalidConnection.DialogTitle" ) ); mb.open(); return; } dispose(); } private void getInfo( DimensionLookupMeta in ) { in.setUpdate( wUpdate.getSelection() ); // Table ktable = wKey.table; int nrkeys = wKey.nrNonEmpty(); int nrfields = wUpIns.nrNonEmpty(); in.allocate( nrkeys, nrfields ); logDebug( BaseMessages.getString( PKG, "DimensionLookupDialog.Log.FoundKeys", String.valueOf( nrkeys ) ) ); //CHECKSTYLE:Indentation:OFF for ( int i = 0; i < nrkeys; i++ ) { TableItem item = wKey.getNonEmpty( i ); in.getKeyLookup()[i] = item.getText( 1 ); in.getKeyStream()[i] = item.getText( 2 ); } if ( log.isDebug() ) { logDebug( BaseMessages.getString( PKG, "DimensionLookupDialog.Log.FoundFields", String.valueOf( nrfields ) ) ); } //CHECKSTYLE:Indentation:OFF for ( int i = 0; i < nrfields; i++ ) { TableItem item = wUpIns.getNonEmpty( i ); in.getFieldLookup()[i] = item.getText( 1 ); in.getFieldStream()[i] = item.getText( 2 ); in.getFieldUpdate()[i] = DimensionLookupMeta.getUpdateType( in.isUpdate(), item.getText( 3 ) ); } in.setSchemaName( wSchema.getText() ); in.setTableName( wTable.getText() ); in.setKeyField( wTk.getText() ); in.setKeyRename( wTkRename.getText() ); if ( wAutoinc.getSelection() ) { in.setTechKeyCreation( DimensionLookupMeta.CREATION_METHOD_AUTOINC ); in.setAutoIncrement( true ); // for downwards compatibility in.setSequenceName( null ); } else if ( wSeqButton.getSelection() ) { in.setTechKeyCreation( DimensionLookupMeta.CREATION_METHOD_SEQUENCE ); in.setAutoIncrement( false ); in.setSequenceName( wSeq.getText() ); } else { // all the rest in.setTechKeyCreation( DimensionLookupMeta.CREATION_METHOD_TABLEMAX ); in.setAutoIncrement( false ); in.setSequenceName( null ); } in.setAutoIncrement( wAutoinc.getSelection() ); if ( in.getKeyRename() != null && in.getKeyRename().equalsIgnoreCase( in.getKeyField() ) ) { in.setKeyRename( null ); // Don't waste space&time if it's the same } in.setVersionField( wVersion.getText() ); in.setDatabaseMeta( transMeta.findDatabase( wConnection.getText() ) ); in.setDateField( wDatefield.getText() ); in.setDateFrom( wFromdate.getText() ); in.setDateTo( wTodate.getText() ); in.setCommitSize( Const.toInt( wCommit.getText(), 0 ) ); if ( wUseCache.getSelection() ) { in.setCacheSize( Const.toInt( wCacheSize.getText(), -1 ) ); } else { in.setCacheSize( -1 ); } in.setPreloadingCache( wPreloadCache.getSelection() ); if ( wPreloadCache.getSelection() ) { in.setCacheSize( 0 ); } in.setMinYear( Const.toInt( wMinyear.getText(), Const.MIN_YEAR ) ); in.setMaxYear( Const.toInt( wMaxyear.getText(), Const.MAX_YEAR ) ); in.setUsingStartDateAlternative( wUseAltStartDate.getSelection() ); in.setStartDateAlternative( DimensionLookupMeta.getStartDateAlternative( wAltStartDate.getText() ) ); in.setStartDateFieldName( wAltStartDateField.getText() ); } private void getTableName() { int connr = wConnection.getSelectionIndex(); if ( connr < 0 ) { return; } DatabaseMeta inf = transMeta.getDatabase( connr ); logDebug( BaseMessages.getString( PKG, "DimensionLookupDialog.Log.LookingAtConnection" ) + inf.toString() ); DatabaseExplorerDialog std = new DatabaseExplorerDialog( shell, SWT.NONE, inf, transMeta.getDatabases() ); std.setSelectedSchemaAndTable( wSchema.getText(), wTable.getText() ); if ( std.open() ) { wSchema.setText( Const.NVL( std.getSchemaName(), "" ) ); wTable.setText( Const.NVL( std.getTableName(), "" ) ); setTableFieldCombo(); } } private void get() { if ( wTabFolder.getSelection() == wFieldsTab ) { if ( input.isUpdate() ) { getUpdate(); } else { getLookup(); } } else { getKeys(); } } /** * Get the fields from the previous step and use them as "update fields". Only get the the fields which are not yet in * use as key, or in the field table. Also ignore technical key, version, fromdate, todate. */ private void getUpdate() { try { RowMetaInterface r = transMeta.getPrevStepFields( stepname ); if ( r != null && !r.isEmpty() ) { BaseStepDialog.getFieldsFromPrevious( r, wUpIns, 2, new int[] { 1, 2 }, new int[] {}, -1, -1, new TableItemInsertListener() { public boolean tableItemInserted( TableItem tableItem, ValueMetaInterface v ) { tableItem .setText( 3, BaseMessages.getString( PKG, "DimensionLookupDialog.TableItem.Insert.Label" ) ); int idx = wKey.indexOfString( v.getName(), 2 ); return idx < 0 && !v.getName().equalsIgnoreCase( wTk.getText() ) && !v.getName().equalsIgnoreCase( wVersion.getText() ) && !v.getName().equalsIgnoreCase( wFromdate.getText() ) && !v.getName().equalsIgnoreCase( wTodate.getText() ); } } ); } } catch ( HopException ke ) { new ErrorDialog( shell, BaseMessages.getString( PKG, "DimensionLookupDialog.FailedToGetFields.DialogTitle" ), BaseMessages.getString( PKG, "DimensionLookupDialog.FailedToGetFields.DialogMessage" ), ke ); } } // Set table "dimension field" and "technical key" drop downs private void setTableFieldCombo() { Runnable fieldLoader = new Runnable() { public void run() { if ( !wTable.isDisposed() && !wConnection.isDisposed() && !wSchema.isDisposed() ) { final String tableName = wTable.getText(), connectionName = wConnection.getText(), schemaName = wSchema.getText(); // clear for ( ColumnInfo colInfo : tableFieldColumns ) { colInfo.setComboValues( new String[] {} ); } // Ensure other table field dropdowns are refreshed fields when they // next get focus gotTableFields = false; if ( !Utils.isEmpty( tableName ) ) { DatabaseMeta ci = transMeta.findDatabase( connectionName ); if ( ci != null ) { Database db = new Database( loggingObject, ci ); try { db.connect(); RowMetaInterface r = db.getTableFieldsMeta( transMeta.environmentSubstitute( schemaName ), transMeta.environmentSubstitute( tableName ) ); if ( null != r ) { String[] fieldNames = r.getFieldNames(); if ( null != fieldNames ) { for ( ColumnInfo colInfo : tableFieldColumns ) { colInfo.setComboValues( fieldNames ); } wTk.setItems( fieldNames ); } } } catch ( Exception e ) { for ( ColumnInfo colInfo : tableFieldColumns ) { colInfo.setComboValues( new String[] {} ); } // ignore any errors here. drop downs will not be // filled, but no problem for the user } finally { try { if ( db != null ) { db.disconnect(); } } catch ( Exception ignored ) { // ignore any errors here. db = null; } } } } } } }; shell.getDisplay().asyncExec( fieldLoader ); } /** * Get the fields from the table in the database and use them as lookup keys. Only get the the fields which are not * yet in use as key, or in the field table. Also ignore technical key, version, fromdate, todate. */ private void getLookup() { DatabaseMeta databaseMeta = transMeta.findDatabase( wConnection.getText() ); if ( databaseMeta != null ) { Database db = new Database( loggingObject, databaseMeta ); db.shareVariablesWith( transMeta ); try { db.connect(); RowMetaInterface r = db.getTableFieldsMeta( wSchema.getText(), wTable.getText() ); if ( r != null && !r.isEmpty() ) { BaseStepDialog.getFieldsFromPrevious( r, wUpIns, 2, new int[] { 1, 2 }, new int[] { 3 }, -1, -1, new TableItemInsertListener() { public boolean tableItemInserted( TableItem tableItem, ValueMetaInterface v ) { int idx = wKey.indexOfString( v.getName(), 2 ); return idx < 0 && !v.getName().equalsIgnoreCase( wTk.getText() ) && !v.getName().equalsIgnoreCase( wVersion.getText() ) && !v.getName().equalsIgnoreCase( wFromdate.getText() ) && !v.getName().equalsIgnoreCase( wTodate.getText() ); } } ); } } catch ( HopException e ) { MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR ); mb.setText( BaseMessages.getString( PKG, "DimensionLookupDialog.ErrorOccurred.DialogTitle" ) ); mb.setMessage( BaseMessages.getString( PKG, "DimensionLookupDialog.ErrorOccurred.DialogMessage" ) + Const.CR + e.getMessage() ); mb.open(); } finally { db.disconnect(); } } } private void getFields() { if ( !gotPreviousFields ) { try { String field = wDatefield.getText(); RowMetaInterface r = transMeta.getPrevStepFields( stepname ); if ( r != null ) { wDatefield.setItems( r.getFieldNames() ); } if ( field != null ) { wDatefield.setText( field ); } } catch ( HopException ke ) { new ErrorDialog( shell, BaseMessages.getString( PKG, "DimensionLookupDialog.ErrorGettingFields.Title" ), BaseMessages .getString( PKG, "DimensionLookupDialog.ErrorGettingFields.Message" ), ke ); } gotPreviousFields = true; } } private void getFieldsFromTable() { if ( !gotTableFields ) { if ( !Utils.isEmpty( wTable.getText() ) ) { DatabaseMeta ci = transMeta.findDatabase( wConnection.getText() ); if ( ci != null ) { Database db = new Database( loggingObject, ci ); try { db.connect(); RowMetaInterface r = db.getTableFieldsMeta( transMeta.environmentSubstitute( wSchema.getText() ), transMeta.environmentSubstitute( wTable.getText() ) ); if ( null != r ) { String[] fieldNames = r.getFieldNames(); if ( null != fieldNames ) { // Version String version = wVersion.getText(); wVersion.setItems( fieldNames ); if ( version != null ) { wVersion.setText( version ); } // from date String fromdate = wFromdate.getText(); wFromdate.setItems( fieldNames ); if ( fromdate != null ) { wFromdate.setText( fromdate ); } // to date String todate = wTodate.getText(); wTodate.setItems( fieldNames ); if ( todate != null ) { wTodate.setText( todate ); } // tk String tk = wTk.getText(); wTk.setItems( fieldNames ); if ( tk != null ) { wTk.setText( tk ); } // AltStartDateField String sd = wAltStartDateField.getText(); wAltStartDateField.setItems( fieldNames ); if ( sd != null ) { wAltStartDateField.setText( sd ); } } } } catch ( Exception e ) { // ignore any errors here. drop downs will not be // filled, but no problem for the user } } } gotTableFields = true; } } /** * Get the fields from the previous step and use them as "keys". Only get the the fields which are not yet in use as * key, or in the field table. Also ignore technical key, version, fromdate, todate. */ private void getKeys() { try { RowMetaInterface r = transMeta.getPrevStepFields( stepname ); if ( r != null && !r.isEmpty() ) { BaseStepDialog.getFieldsFromPrevious( r, wKey, 2, new int[] { 1, 2 }, new int[] { 3 }, -1, -1, new TableItemInsertListener() { public boolean tableItemInserted( TableItem tableItem, ValueMetaInterface v ) { int idx = wKey.indexOfString( v.getName(), 2 ); return idx < 0 && !v.getName().equalsIgnoreCase( wTk.getText() ) && !v.getName().equalsIgnoreCase( wVersion.getText() ) && !v.getName().equalsIgnoreCase( wFromdate.getText() ) && !v.getName().equalsIgnoreCase( wTodate.getText() ); } } ); Table table = wKey.table; for ( int i = 0; i < r.size(); i++ ) { ValueMetaInterface v = r.getValueMeta( i ); int idx = wKey.indexOfString( v.getName(), 2 ); int idy = wUpIns.indexOfString( v.getName(), 2 ); if ( idx < 0 && idy < 0 && !v.getName().equalsIgnoreCase( wTk.getText() ) && !v.getName().equalsIgnoreCase( wVersion.getText() ) && !v.getName().equalsIgnoreCase( wFromdate.getText() ) && !v.getName().equalsIgnoreCase( wTodate.getText() ) ) { TableItem ti = new TableItem( table, SWT.NONE ); ti.setText( 1, v.getName() ); ti.setText( 2, v.getName() ); ti.setText( 3, v.getTypeDesc() ); } } wKey.removeEmptyRows(); wKey.setRowNums(); wKey.optWidth( true ); } } catch ( HopException ke ) { new ErrorDialog( shell, BaseMessages.getString( PKG, "DimensionLookupDialog.FailedToGetFields.DialogTitle" ), BaseMessages.getString( PKG, "DimensionLookupDialog.FailedToGetFields.DialogMessage" ), ke ); } } @Override protected Button createHelpButton( Shell shell, StepMeta stepMeta, PluginInterface plugin ) { return HelpUtils.createHelpButton( helpComp, HelpUtils.getHelpDialogTitle( plugin ), plugin ); } // Generate code for create table... // Conversions done by Database // For Sybase ASE: don't keep everything in lowercase! private void create() { try { DimensionLookupMeta info = new DimensionLookupMeta(); getInfo( info ); String name = stepname; // new name might not yet be linked to other // steps! StepMeta stepinfo = new StepMeta( BaseMessages.getString( PKG, "DimensionLookupDialog.Stepinfo.Title" ), name, info ); RowMetaInterface prev = transMeta.getPrevStepFields( stepname ); String message = null; if ( Utils.isEmpty( info.getKeyField() ) ) { message = BaseMessages.getString( PKG, "DimensionLookupDialog.Error.NoTechnicalKeySpecified" ); } if ( Utils.isEmpty( info.getTableName() ) ) { message = BaseMessages.getString( PKG, "DimensionLookupDialog.Error.NoTableNameSpecified" ); } if ( message == null ) { SQLStatement sql = info.getSQLStatements( transMeta, stepinfo, prev, repository, metaStore ); if ( !sql.hasError() ) { if ( sql.hasSQL() ) { SQLEditor sqledit = new SQLEditor( transMeta, shell, SWT.NONE, info.getDatabaseMeta(), transMeta.getDbCache(), sql .getSQL() ); sqledit.open(); } else { MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_INFORMATION ); mb.setMessage( BaseMessages.getString( PKG, "DimensionLookupDialog.NoSQLNeeds.DialogMessage" ) ); mb.setText( BaseMessages.getString( PKG, "DimensionLookupDialog.NoSQLNeeds.DialogTitle" ) ); mb.open(); } } else { MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR ); mb.setMessage( sql.getError() ); mb.setText( BaseMessages.getString( PKG, "DimensionLookupDialog.SQLError.DialogTitle" ) ); mb.open(); } } else { MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR ); mb.setMessage( message ); mb.setText( BaseMessages.getString( PKG, "System.Dialog.Error.Title" ) ); mb.open(); } } catch ( HopException ke ) { new ErrorDialog( shell, BaseMessages.getString( PKG, "DimensionLookupDialog.UnableToBuildSQLError.DialogMessage" ), BaseMessages.getString( PKG, "DimensionLookupDialog.UnableToBuildSQLError.DialogTitle" ), ke ); } } private void getSchemaNames() { DatabaseMeta databaseMeta = transMeta.findDatabase( wConnection.getText() ); if ( databaseMeta != null ) { Database database = new Database( loggingObject, databaseMeta ); try { database.connect(); String[] schemas = database.getSchemas(); if ( null != schemas && schemas.length > 0 ) { schemas = Const.sortStrings( schemas ); EnterSelectionDialog dialog = new EnterSelectionDialog( shell, schemas, BaseMessages.getString( PKG, "DimensionLookupDialog.AvailableSchemas.Title", wConnection.getText() ), BaseMessages .getString( PKG, "DimensionLookupDialog.AvailableSchemas.Message", wConnection.getText() ) ); String d = dialog.open(); if ( d != null ) { wSchema.setText( Const.NVL( d, "" ) ); setTableFieldCombo(); } } else { MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR ); mb.setMessage( BaseMessages.getString( PKG, "DimensionLookupDialog.NoSchema.Error" ) ); mb.setText( BaseMessages.getString( PKG, "DimensionLookupDialog.GetSchemas.Error" ) ); mb.open(); } } catch ( Exception e ) { new ErrorDialog( shell, BaseMessages.getString( PKG, "System.Dialog.Error.Title" ), BaseMessages .getString( PKG, "DimensionLookupDialog.ErrorGettingSchemas" ), e ); } finally { database.disconnect(); } } } }
f3f1a07c04cb8919b233576d11618eb841c2cfc6
235829b735c56b1bdc80769b11e7f34929853151
/src/br/common/utils/XmlResponse.java
b4d629b0cdcf019bf46a2bdcea4acb86b1a73b81
[]
no_license
gwenu/BookRegister
6809db9c626b3ae1f2ce83c7ac820b9b2d7c4da7
48712b7866c40b1867de15564774792b52c90f2f
refs/heads/master
2021-01-02T08:34:25.706527
2015-04-21T19:50:14
2015-04-21T19:50:14
22,175,044
0
0
null
null
null
null
UTF-8
Java
false
false
288
java
package br.common.utils; import java.io.OutputStream; public class XmlResponse<T> { public String xmlToString(T obj) { OutputStream os = new XmlWriter<T>(obj).writeToXml(); String responseXml = StreamUtil.convertStreamToString(os); return responseXml; } }
e0c2ea29162f20b4322fcfe9b0281816eed6512c
0d157968ecd484d880d26d9c52f47755548f1680
/src/main/java/com/ifuture/adonline/web/rest/errors/ErrorConstants.java
ee3df41fe862515d65ac59b1021808486d536794
[]
no_license
yongchongwu/adonline
43a7cc1015ecf194ed4049f0d562ef3e1d3ccbd9
7ac8fbf6b12d01778894ee1cc8f06b3422bc9eae
refs/heads/master
2021-05-08T17:37:28.962803
2018-01-30T03:56:16
2018-01-30T03:56:16
103,366,712
0
0
null
null
null
null
UTF-8
Java
false
false
525
java
package com.ifuture.adonline.web.rest.errors; public final class ErrorConstants { public static final String ERR_CONCURRENCY_FAILURE = "error.concurrencyFailure"; public static final String ERR_ACCESS_DENIED = "error.accessDenied"; public static final String ERR_VALIDATION = "error.validation"; public static final String ERR_METHOD_NOT_SUPPORTED = "error.methodNotSupported"; public static final String ERR_INTERNAL_SERVER_ERROR = "error.internalServerError"; private ErrorConstants() { } }
b281e908aa0aa17d95041b77991f9c95bf23a498
db83fd79662bb15f7c89e2e2589cf2881a2faa8f
/src/wget/WgetTest.java
eda739c465c8772d13270e50569cd8fca229dd71
[]
no_license
liuwm/wget
f885e1f4788acf8d09932a735267d84ee67f55a7
e1e69b9c50a22a65ae780bd8af0fdf1e23d420c5
refs/heads/master
2021-01-10T08:12:33.932910
2015-05-21T05:42:52
2015-05-21T05:42:52
35,993,392
0
0
null
null
null
null
UTF-8
Java
false
false
929
java
package wget; import java.util.Arrays; import java.util.Collection; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; @RunWith(Parameterized.class) public class WgetTest { private String input; private boolean expected; public WgetTest(String input,boolean expected){ this.input = input; this.expected = expected; } @Parameters @SuppressWarnings("unchecked") public static Collection prepareData(){ Object[][] object = {{"",false},{"http://www.baidu.com",true},{"www.baidu.com",false},{"http://",false},{"http://dow3.pc6.com/gm/EditPlus3_ha.zip",true}}; return Arrays.asList(object); } @Test public void testSaveFile() { Wget wget = new Wget(); boolean result = wget.saveFile(input); Assert.assertEquals(expected, result); } }
b706f8458b6feb1d1e3c2f6f84e500d564eabcca
3c82999aab38b057ac137e5c1980f139150c9665
/src/main/java/com/dognessnetwork/customer/dto/User.java
d7013c4f360b077f6f96716788ffa3524a8f28c0
[]
no_license
XiaoXiongPotter/customer
1285bdb6a8644b0e4bd392b16f5902007541688b
4243919af1941917493fefab3a8a8d9f1ade2281
refs/heads/master
2020-03-29T18:10:26.154234
2018-08-24T09:55:13
2018-08-24T09:55:13
150,197,890
0
0
null
null
null
null
UTF-8
Java
false
false
2,428
java
package com.dognessnetwork.customer.dto; import java.util.Collection; import java.util.Set; import org.springframework.roo.addon.dto.annotations.RooDTO; import org.springframework.roo.addon.javabean.annotations.RooJavaBean; import org.springframework.security.core.GrantedAuthority; import com.fasterxml.jackson.annotation.JsonIgnore; @RooDTO @RooJavaBean public class User extends org.springframework.security.core.userdetails.User{ /** * */ private static final long serialVersionUID = 500L; public User(String username, String password, Collection<? extends GrantedAuthority> authorities) { super(username, password, true, true, true, true, authorities); } public User(String username, String password, boolean enabled, boolean accountNonExpired, boolean credentialsNonExpired, boolean accountNonLocked, Collection<? extends GrantedAuthority> authorities) { super(username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities); } @JsonIgnore @Override public Collection<GrantedAuthority> getAuthorities() { return super.getAuthorities(); } @JsonIgnore @Override public boolean isAccountNonExpired() { return super.isAccountNonExpired(); } @JsonIgnore @Override public boolean isAccountNonLocked() { return super.isAccountNonLocked(); } @JsonIgnore @Override public boolean isCredentialsNonExpired() { return super.isCredentialsNonExpired(); } private long id; private String name; private String mobile; private String email; private Integer status; private String creatTime; public long getId() { return id; } public void setId(long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getMobile() { return mobile; } public void setMobile(String mobile) { this.mobile = mobile; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public Integer getStatus() { return status; } public void setStatus(Integer status) { this.status = status; } public String getCreatTime() { return creatTime; } public void setCreatTime(String creatTime) { this.creatTime = creatTime; } }
[ "Dogness@DESKTOP-AIKF84U" ]
Dogness@DESKTOP-AIKF84U
94a15b53999a4c0948029c59950856fe01c95e19
eee908a695990d1aa27951365fe79111b81d0712
/Bozze/Implementazione/Tutto_Elettronica/src/it/unisa/control/ModificaRuoloControl.java
d50c872a2ad2bf28022c80077ed27e9e414c0c76
[]
no_license
gaeta987/ProgettoIngegneriaDelSoftware-TuttoElettronica
c859e48735fc8db843e86cfb50680488b241a82a
896d5a31df1d98b83946011f1c1f11fae655a993
refs/heads/master
2020-06-18T04:25:49.091756
2019-02-13T19:00:30
2019-02-13T19:00:30
196,162,745
1
0
null
null
null
null
UTF-8
Java
false
false
2,015
java
package it.unisa.control; import java.io.IOException; import java.sql.SQLException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import it.unisa.bean.UserBean; import it.unisa.model.UserManager; import it.unisa.model.UserManagerDM; /** * Servlet implementation class ModificaRuoloControl */ @WebServlet("/ModificaRuoloControl") public class ModificaRuoloControl extends HttpServlet { private static final long serialVersionUID = 1L; static UserManager<UserBean> clienteModel = new UserManagerDM(); /** * @see HttpServlet#HttpServlet() */ public ModificaRuoloControl() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String userRoles =(String)request.getSession().getAttribute("userRoles"); if(userRoles == null || !userRoles.equalsIgnoreCase("admin")){ response.sendRedirect("./login.jsp"); return; } String cf = request.getParameter("cf"); String vecchioRuolo = request.getParameter("vecchioRuolo"); String ruolo = request.getParameter("ruolo"); try { clienteModel.doUpdateCliente(clienteModel.doRetrieveByKey(cf), ruolo); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } response.sendRedirect(request.getContextPath() + "/VisualizzaDatiControl"); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub doGet(request, response); } }
ef2affaae2192937d92c1aa03a5103ecaaf4fc82
84e156edb40800866b625d3541119e970acad1e1
/bitcamp-java-application4-server/src/main/java/com/eomcs/lms/service/BoardService.java
c142c61abb914bb549d799137927f6302242897b
[]
no_license
Hecklebot/bitcamp-java-20190527
c063803b02015ca0a45ef590b3d5ca1c25201285
c22f695c788ab8da21f7148aa09ec477c57b2a50
refs/heads/master
2020-06-13T20:15:46.420583
2019-10-21T08:12:55
2019-10-21T08:12:55
194,775,337
2
0
null
2020-04-30T11:58:11
2019-07-02T02:41:01
Java
UTF-8
Java
false
false
462
java
package com.eomcs.lms.service; import java.util.List; import com.eomcs.lms.domain.Board; // 역할: // => 게시물 관리 업무를 수행 // => 트랜잭션 제어 // => 여러 페이지 컨트롤러가 사용한다. public interface BoardService { List<Board> list() throws Exception; Board get(int no) throws Exception; void insert(Board board) throws Exception; void update(Board board) throws Exception; void delete(int no) throws Exception; }
d7db963a7cf597586fc161229241210d21063a1a
e5e439c4faa2b3981926a7c66a3a009483161443
/src/main/java/cn/choleece/rpc/demo/provider/ServerBootStrap.java
fd3d8d73f8fcb8f08c1e632a931ca6fbafd363cf
[]
no_license
choleece/rpc-demo
1e81485253513b7df4bb4bc90e6e193a75ba331c
6193a5f16a0c3d7a1f187fc730ff360ec4bbafe0
refs/heads/master
2020-04-24T23:39:42.017133
2019-02-24T15:06:09
2019-02-24T15:06:09
172,352,013
0
0
null
null
null
null
UTF-8
Java
false
false
269
java
package cn.choleece.rpc.demo.provider; import cn.choleece.rpc.demo.netty.NettyServer; /** * Created by choleece on 2019/2/22. */ public class ServerBootStrap { public static void main(String[] args) { NettyServer.startServer("localhost", 8088); } }
8be11f6d306a154c736f1960530a3f662a90fa7b
9dcb43e37096b6928a545c4148793af0c0102ced
/src/main/java/pages/ForgotPasswordPage.java
b061eb8c08750a2a700d5920428a934673bfc823
[]
no_license
ardaytam/PractisePageObjetModel
90aa24bd1e2ce6f60bebf49bb7c9d06698e13d28
6cd9580c8da17608d5dcb8c151a5309fb96cb9d1
refs/heads/master
2023-06-21T07:36:39.231339
2021-08-02T18:18:24
2021-08-02T18:18:24
390,846,106
0
0
null
null
null
null
UTF-8
Java
false
false
635
java
package pages; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; public class ForgotPasswordPage { private WebDriver driver; private By emailField = By.id("email"); private By retrievePasswordButton = By.cssSelector("#form_submit"); public ForgotPasswordPage(WebDriver driver) { this.driver = driver; } public void setEmailField(String email) { driver.findElement(emailField).sendKeys(email); } public EmailSentPage clickRetrievePasswordButton() { driver.findElement(retrievePasswordButton).click(); return new EmailSentPage(driver); } }
81f2789d3d04f0dc146db8754ba83a2a2401e0bd
04074d3f457c2f2a3058071e2a253b4eb321f512
/ACD_android-Session4-assignment1/Android_Session4_assignment1/app/src/test/java/com/android/vicky/listviewexample/ExampleUnitTest.java
7449f381c69bf833f7d52d7ac3a79f65d773fffd
[]
no_license
u174762/ACD_Android_Session4_Assignment1
70c9983940bc6b864550fb8c1ad879af00166030
e775ee979bf081525679662b99cd59189ec171e8
refs/heads/master
2021-01-13T16:29:59.275731
2016-09-25T18:23:06
2016-09-25T18:23:06
69,182,012
0
0
null
null
null
null
UTF-8
Java
false
false
326
java
package com.android.vicky.listviewexample; 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); } }
04b9292fd00f84a79864380b72d9473d24a69890
8e43aec43bfb980868f9dd12b253b0ea144c7e88
/src/DataStructures/JavaList.java
a7bc82fabe927a1227f7b3a6fcaa410567acb41c
[]
no_license
daniloJava/Puzzle-Hackerrank
e68db3e3341d5eb7f366bbeb96b04c21109f8861
f6ea13386284f6d4cc26ffc398cc2428661d47c5
refs/heads/master
2021-01-20T20:08:51.305229
2019-04-03T03:04:57
2019-04-03T03:04:57
63,831,827
1
0
null
null
null
null
UTF-8
Java
false
false
709
java
package DataStructures; import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class JavaList { public static void main(String[] args) { Scanner in = new Scanner(System.in); int size = in.nextInt(); List<Integer> numbers = new ArrayList<>(); for (int i = 0; i < size; i++) { numbers.add(in.nextInt()); } int numberQueries = in.nextInt(); for (int i = 0; i < numberQueries; i++) { if ("Insert".equalsIgnoreCase(in.next())) { int index = in.nextInt(); int element = in.nextInt(); numbers.add(index, element); } else { int index = in.nextInt(); numbers.remove(index); } } numbers.forEach(n -> System.out.print(n + " ")); } }
2dffe4b99d0055dac73f736ac0caa6cdfee25c89
fe8a74de25385e942385611d096851bcb2a3953d
/junit3/src/test/java/org/guiceyfruit/testing/junit3/example/EdamModule.java
e4728ccbaee29e4487d26b51a4a2f62e24486cde
[]
no_license
realityforge/guiceyfruit
91b8b36c2df1065e6748ad221d92fff9b9534eda
114c64ca3e51b493a249de57b4005d4931df887b
refs/heads/master
2020-04-01T06:58:31.884331
2011-08-27T07:28:57
2011-08-27T07:28:57
2,255,575
1
0
null
null
null
null
UTF-8
Java
false
false
1,052
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.guiceyfruit.testing.junit3.example; import com.google.inject.AbstractModule; /** @version $Revision: 1.1 $ */ public class EdamModule extends AbstractModule { protected void configure() { bind(Cheese.class).to(Edam.class); } }
473f6d623e544a1ac6971830e33463bb41bd63c4
d4c1e2d83b100e77c045f82f9b449353841dbf1d
/src/main/java/com/cg/main/model/SensorNodeDiscover.java
ebc031f16fdd1175d249dca0cb51fc6a671b2556
[]
no_license
nilpatid/CG-Parking
3a050835b1791cc585c7d94820adadc6d9c4f6c0
e70821b07947f00a11afedde88d08a2d9e2f26e1
refs/heads/master
2021-06-27T02:07:57.731819
2017-09-12T10:38:07
2017-09-12T10:38:07
103,257,056
0
0
null
null
null
null
UTF-8
Java
false
false
1,051
java
package com.cg.main.model; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; import javax.persistence.UniqueConstraint; @Entity @Table public class SensorNodeDiscover { public String ipAddress; @Id public String macAddress; public SensorNodeDiscover(){} public SensorNodeDiscover(String macAddress){super(); this.macAddress = macAddress;} public SensorNodeDiscover(String ipAddress, String macAddress) { super(); this.ipAddress = ipAddress; this.macAddress = macAddress; } public String getIpAddress() { return ipAddress; } public void setIpAddress(String ipAddress) { this.ipAddress = ipAddress; } public String getMacAddress() { return macAddress; } public void setMacAddress(String macAddress) { this.macAddress = macAddress; } @Override public String toString() { return "SensorNodeDiscover [ipAddress=" + ipAddress + ", macAddress=" + macAddress + "]"; } }
42ff5ff4311bc41c280109d14811a0c31ea86e9e
3f037bcaf39ac6e07dcf67e613695e2bb4629978
/spring-security-oauth/src/main/java/com/springsecurityoauth/entities/Role.java
1ebff30d467682f5073f0ad5fc123f68262af7ee
[]
no_license
poojapathak0001/microservice
ff6dc4cabcafdaff191b81ad7a5851c22ec73fc0
37691a1b7991f18cae5a4f934821cb25d6119a0d
refs/heads/master
2021-04-12T08:57:21.903351
2018-03-27T02:18:00
2018-03-27T02:18:00
126,841,714
0
0
null
null
null
null
UTF-8
Java
false
false
453
java
package com.springsecurityoauth.entities; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @Entity public class Role { @Id @GeneratedValue private Long id; String name; Role() {} public Role(String name) { this.name = name; } public String getName() { return name; } public void setName(String name) { this.name = name; } }
6d3182711e78476ddd7c9232dfcecac2194a3ca8
4a866cb2b9830ccfec0e3ff191b91ecff3bc52d9
/src/Bar/Business/LoginController.java
60ae81c0f7d570781890a001d04ee3b1a7e413b0
[]
no_license
juliocos/exercicio-bar
9c6664bd5c19d892ad9e0931013b79a8a52490b3
1e11183a1f319b7c07fe23988c055ebfaaa15c02
refs/heads/master
2020-03-09T13:06:35.124634
2018-04-09T16:33:35
2018-04-09T16:33:35
128,802,099
0
0
null
null
null
null
UTF-8
Java
false
false
1,297
java
package Bar.Business; import Bar.Main; import Bar.Persistence.Customer; import Bar.Persistence.Member; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.scene.control.Button; import javafx.scene.control.RadioButton; import javafx.scene.control.TextField; import javafx.scene.control.ToggleGroup; public class LoginController { @FXML private TextField cpf; @FXML private TextField name; @FXML private TextField age; @FXML private TextField memberId; @FXML private ToggleGroup gender; @FXML private RadioButton male; @FXML private RadioButton female; @FXML private Button checkin; public void checkin(ActionEvent event) { char genderSelected = male.isSelected() ? 'M' : 'F'; if(memberId.getText().length() > 0 && !memberId.getText().isEmpty()) { Member m = new Member(cpf.getText(), name.getText(), Integer.parseInt(age.getText()), genderSelected, Integer.parseInt(memberId.getText())); Main.bar.addCustomer(m); } else { Customer c = new Customer(cpf.getText(), name.getText(), Integer.parseInt(age.getText()), genderSelected); Main.bar.addCustomer(c); } System.out.println(Main.bar.getCustomers()); } }
[ "juliosantos@[email protected]" ]
juliosantos@[email protected]
e95d58883ce7c1da91bcdbb55116b6cd86655a47
bf2966abae57885c29e70852243a22abc8ba8eb0
/aws-java-sdk-lightsail/src/main/java/com/amazonaws/services/lightsail/model/transform/CreateContactMethodRequestMarshaller.java
b931d747ef511f580e43a4c479445696e488ea37
[ "Apache-2.0" ]
permissive
kmbotts/aws-sdk-java
ae20b3244131d52b9687eb026b9c620da8b49935
388f6427e00fb1c2f211abda5bad3a75d29eef62
refs/heads/master
2021-12-23T14:39:26.369661
2021-07-26T20:09:07
2021-07-26T20:09:07
246,296,939
0
0
Apache-2.0
2020-03-10T12:37:34
2020-03-10T12:37:33
null
UTF-8
Java
false
false
2,398
java
/* * Copyright 2016-2021 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.lightsail.model.transform; import javax.annotation.Generated; import com.amazonaws.SdkClientException; import com.amazonaws.services.lightsail.model.*; import com.amazonaws.protocol.*; import com.amazonaws.annotation.SdkInternalApi; /** * CreateContactMethodRequestMarshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") @SdkInternalApi public class CreateContactMethodRequestMarshaller { private static final MarshallingInfo<String> PROTOCOL_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD) .marshallLocationName("protocol").build(); private static final MarshallingInfo<String> CONTACTENDPOINT_BINDING = MarshallingInfo.builder(MarshallingType.STRING) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("contactEndpoint").build(); private static final CreateContactMethodRequestMarshaller instance = new CreateContactMethodRequestMarshaller(); public static CreateContactMethodRequestMarshaller getInstance() { return instance; } /** * Marshall the given parameter object. */ public void marshall(CreateContactMethodRequest createContactMethodRequest, ProtocolMarshaller protocolMarshaller) { if (createContactMethodRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(createContactMethodRequest.getProtocol(), PROTOCOL_BINDING); protocolMarshaller.marshall(createContactMethodRequest.getContactEndpoint(), CONTACTENDPOINT_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
[ "" ]
4dba366966e9b9d33a7c843f234db824d89d97e7
1bb848a6cf46b3019d86a1426a554b2a3e7e540a
/src/java/LoginServlets/LoginServlet.java
8f128a1f07e382b1050783897ab70f66421857a3
[]
no_license
Hades-999/Project2
df897042d0aaeaceed209bdb88afd66633302dca
18d6eb9b52a5018a63032c842fcd04d2488b3004
refs/heads/master
2020-11-24T01:53:13.508088
2019-12-13T19:58:59
2019-12-13T19:58:59
227,912,130
0
0
null
null
null
null
UTF-8
Java
false
false
3,704
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 LoginServlets; import java.io.IOException; import java.io.PrintWriter; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * * @author HP */ public class LoginServlet extends HttpServlet { /** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> * methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { int x=1; Connection con=null; String email=request.getParameter("email"); String password=request.getParameter("psw"); response.setContentType("text/html"); PrintWriter out=response.getWriter(); Class.forName("com.mysql.cj.jdbc.Driver"); con=DriverManager.getConnection("jdbc:mysql://localhost:3306/hades","root",""); String query = "select email,password from users where email = "+"'"+email+"'"+" and password = '"+password+"'"; Statement st = con.createStatement(); ResultSet rs = st.executeQuery(query); while (rs.next()) { x=1; } if(x==1) { response.sendRedirect("index2.htm"); } else out.print("<script>alert('You are not a registered user')</script>"); } catch( ClassNotFoundException | SQLException e) { System.out.print("Got an exception! "); System.err.println(e.getMessage()); e.printStackTrace(); } } // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."> /** * Handles the HTTP <code>GET</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Handles the HTTP <code>POST</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Returns a short description of the servlet. * * @return a String containing servlet description */ @Override public String getServletInfo() { return "Short description"; }// </editor-fold> }
1ac0734d2d5c478fbd28ebe0fd9e2dc8e8342e3c
13c7e0e6c823909285599f2ac1fe980f03b47e5e
/springcloud-service-feign/src/main/java/com/pci/hystric/SchedualServiceHiHystric.java
777c7a1e9e66f0fe7f482c1f05becb2b3cb2eaaa
[]
no_license
jason-zyf/springcloud-learn
536b83a732bea5ec811fa11454325a77adb67d9b
5f944e4670e9e5d25bd329e9da2ca3b840cf2d39
refs/heads/master
2020-11-25T19:22:36.716355
2020-08-10T11:03:14
2020-08-10T11:03:14
228,810,048
0
0
null
null
null
null
UTF-8
Java
false
false
397
java
/* package com.pci.hystric; import com.pci.service.SchedualServiceHi; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class SchedualServiceHiHystric implements SchedualServiceHi { @Autowired public String sayHiFromFeignOne(String name){ return name+",soryy,服务调用失败!!"; } } */
fcc5c092ea3a516c98456ca535fa96ef8e207a8f
59c10e176981f8e80a42336f712eb03b5b607f87
/wefr/src/webApplication/xml/TypeOfECI.java
9df61ec0f925e62e9f13e9d6e0f7c997a2067602
[]
no_license
UTL/psi
f8e9ef70689bb79299a3f34033c8b9bf26ea1494
12bba4c02bc395e444c5a4e39cc87c88370e6f2e
refs/heads/master
2016-09-06T14:13:01.014234
2011-12-16T18:03:32
2011-12-16T18:03:32
2,006,504
2
0
null
null
null
null
UTF-8
Java
false
false
1,588
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2011.11.06 at 03:09:43 PM CET // package webApplication.xml; import javax.xml.bind.annotation.XmlEnum; import javax.xml.bind.annotation.XmlEnumValue; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for typeOfECI. * * <p>The following schema fragment specifies the expected content contained within this class. * <p> * <pre> * &lt;simpleType name="typeOfECI"> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string"> * &lt;enumeration value="Text"/> * &lt;enumeration value="Image"/> * &lt;enumeration value="Link"/> * &lt;/restriction> * &lt;/simpleType> * </pre> * */ @XmlType(name = "typeOfECI") @XmlEnum public enum TypeOfECI { @XmlEnumValue("Text") TEXT("Text"), @XmlEnumValue("Image") IMAGE("Image"), @XmlEnumValue("Link") LINK("Link"); private final String value; TypeOfECI(String v) { value = v; } public String value() { return value; } public static TypeOfECI fromValue(String v) { for (TypeOfECI c: TypeOfECI.values()) { if (c.value.equals(v)) { return c; } } throw new IllegalArgumentException(v); } }
fa9eb38ec7fc9a51a0fbf00f45fce31cdf45947b
b3294ca8fc9fccc82b31be1be0ee3eb3dd3602ff
/pet-clinic-data/src/main/java/com/springproject/learningpetclinic/services/VisitService.java
0369cefcac86eaf4a6e9ba87dbe1dbd1de0ee3c0
[]
no_license
MariaDn/learning-pet-clinic
e5c627b100fbfb3de31555939d270c1014f67fe2
9ee677de768e6d159ce32d8ab99362ca79f73848
refs/heads/master
2020-03-28T13:05:51.983260
2018-11-23T10:14:03
2018-11-23T10:14:03
148,365,629
0
0
null
null
null
null
UTF-8
Java
false
false
179
java
package com.springproject.learningpetclinic.services; import com.springproject.learningpetclinic.model.Visit; public interface VisitService extends CrudService<Visit, Long> { }
b526e62b51b09025fc2e7631081c673585345c60
6a545c68460bbb4757e502f5d9d649e15cdf2376
/common_parent03/portal/src/main/java/com/vincent/bos/fore/web/action/CustomerAction.java
231bedb8b516700e567eb9452bb1d59c4f2242e0
[]
no_license
SanMaoTaGe/BOS_SUYUN
c6514ff8f8997f77bf26bc897aa356a3587bd9f0
f8d54b9aecb84927148d0da8f12c13dd6916dbd7
refs/heads/master
2021-04-09T13:26:23.485795
2018-04-01T12:43:09
2018-04-01T12:43:09
125,701,838
3
0
null
null
null
null
UTF-8
Java
false
false
6,888
java
package com.vincent.bos.fore.web.action; import com.opensymphony.xwork2.ActionSupport; import com.opensymphony.xwork2.ModelDriven; import com.vincent.bos.fore.domain.Customer; import com.vincent.utils.MailUtils; import org.apache.commons.lang.RandomStringUtils; import org.apache.commons.lang.StringUtils; import org.apache.cxf.jaxrs.client.WebClient; import org.apache.struts2.ServletActionContext; import org.apache.struts2.convention.annotation.Action; import org.apache.struts2.convention.annotation.Namespace; import org.apache.struts2.convention.annotation.ParentPackage; import org.apache.struts2.convention.annotation.Result; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.jms.core.JmsTemplate; import org.springframework.jms.core.MessageCreator; import org.springframework.stereotype.Controller; import javax.jms.JMSException; import javax.jms.MapMessage; import javax.jms.Message; import javax.jms.Session; import javax.ws.rs.core.MediaType; import java.util.concurrent.TimeUnit; /** * @author Vincent * @Description: * @create 2018-03-22 21:08 */ @Namespace("/") @ParentPackage("struts-default") @Controller @Scope("prototype") public class CustomerAction extends ActionSupport implements ModelDriven<Customer> { private Customer customer = new Customer(); @Autowired private JmsTemplate jmsTemplate; @Override public Customer getModel() { return customer; } /** * 发送注册验证码 * @return */ @Action(value = "customerAction_sendSMS") public String sendSMS() { final String code = RandomStringUtils.randomNumeric(6); System.out.println("code:------->" + code); System.out.println("phone:------->" + customer.getTelephone()); //存入session ServletActionContext.getRequest().getSession().setAttribute("ServerCode", code); //SmsUtils.sendSms(customer.getTelephone(), code); jmsTemplate.send("sms_message", new MessageCreator() { @Override public Message createMessage(Session session) throws JMSException { System.out.println("send message to activeMQ------------"); MapMessage mapMessage = session.createMapMessage(); mapMessage.setString("tel", customer.getTelephone()); mapMessage.setString("code", code); return mapMessage; } }); return NONE; } private String checkcode; public void setCheckcode(String checkcode) { this.checkcode = checkcode; } @Autowired private RedisTemplate<String, String> redisTemplate; @Action(value = "customerAction_regist", results = {@Result(name = "success", location = "/signup-success.html", type = "redirect"), @Result(name = "error", location = "/signup-fail.html", type = "redirect")}) public String regist() { System.out.println("-----------------------regist"); String serverCode = (String) ServletActionContext.getRequest().getSession().getAttribute("ServerCode"); //校验注册验证码 if (StringUtils.isNotEmpty(serverCode) && StringUtils.isNotEmpty(checkcode) && checkcode.equals(serverCode)) { //注册 WebClient.create("http://localhost:8180/webService/customerService/save") .type(MediaType.APPLICATION_JSON) // 传递的格式 .post(customer); //信息OK后,发送激活邮件 //生成验证码 String activeCode = RandomStringUtils.randomNumeric(32); //利用redis储存验证码 //有效时间1天 redisTemplate.opsForValue().set(customer.getTelephone(), activeCode, 1, TimeUnit.DAYS); String emailText = "感谢注册,请点解以下链接文字激活您的账号" + "<a href='http://localhost:8280/customerAction_active.action?activeCode=" + activeCode + "&telephone=" + customer.getTelephone() + "'>此链接</a>激活您的账号"; //调用工具类发邮件 MailUtils.sendMail("来自长风的注册邮件", emailText, "[email protected]"); return SUCCESS; } return ERROR; } private String activeCode; public void setActiveCode(String activeCode) { this.activeCode = activeCode; } @Action(value = "customerAction_active", results = {@Result(name = "success", location = "/login.html", type = "redirect"), @Result(name = "error", location = "/signup-fail.html", type = "redirect")}) public String active() { System.out.println("-----------------active---------------\n"); String serverActiveCode = redisTemplate.opsForValue().get(customer.getTelephone()); if (StringUtils.isNotEmpty(activeCode) && StringUtils.isNotEmpty(serverActiveCode) && activeCode.equals(serverActiveCode)) { //到crm中激活 System.out.println("--------------------------通过了激活码的初级验证"); WebClient.create("http://localhost:8180/webService/customerService/active") .type(MediaType.APPLICATION_JSON) .query("telephone", customer.getTelephone()) .accept(MediaType.APPLICATION_JSON) .put(null); return SUCCESS; } return ERROR; } /** * 登录 * * @return */ @Action(value = "customerAction_login", results = { @Result(name = "success", location = "/myhome.html", type = "redirect"), @Result(name = "error", location = "/login.html", type = "redirect"), @Result(name = "unActived", location = "/login.html", type = "redirect") }) public String login() { System.out.println("-----------------login---------------\n"); //拿到验证码,验证由工具类存到session,key为validateCode String serverValidateCode = (String) ServletActionContext.getRequest().getSession().getAttribute(("validateCode")); if (StringUtils.isNotEmpty(serverValidateCode) && StringUtils.isNotEmpty(checkcode) && serverValidateCode.equals(checkcode)) { //验证码正确,做进一步动作 //确认是否激活了 Customer cc = WebClient.create("http://localhost:8180/webService/customerService/isActived") .type(MediaType.APPLICATION_JSON) .query("telephone", this.customer.getTelephone()) .accept(MediaType.APPLICATION_JSON) .get(Customer.class); //用户 if (cc != null && cc.getType() != null) { //符合条件,提取信息并跳转 if (cc.getType() == 1) { Customer c2 = WebClient.create("http://localhost:8180/webService/customerService/login") .type(MediaType.APPLICATION_JSON) .query("telephone", this.customer.getTelephone()) .query("password", this.customer.getPassword()) .accept(MediaType.APPLICATION_JSON) .get(Customer.class); //根据账号密码找用户,如果找到说明账号和密码对 if (c2 != null) { ServletActionContext.getRequest().getSession().setAttribute("user", c2); return SUCCESS; //登录信息有误 } else { return ERROR; } } else { //用户存在,但激活状态未变更 return "unActived"; } } } //验证码验证失败,重新登录 return ERROR; } }
fdf8826ccc3a38ad4b1faacdec829e82bbb6e30e
a363c46e7cbb080db2b3a69a70ebf912195e25c7
/ls-modules/ls-webservice/src/main/java/cn/lonsun/webservice/vo/indicator/IndicatorVO.java
a05b56460adec471f47592a68ada41caa1e58acd
[]
no_license
pologood/excms
601646dd7ea4f58f8423da007413978192090f8d
e1c03f574d0ecbf0200aaffa7facf93841bab02c
refs/heads/master
2020-05-14T20:07:22.979151
2018-10-06T10:51:37
2018-10-06T10:51:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,413
java
package cn.lonsun.webservice.vo.indicator; import cn.lonsun.core.base.entity.AMockEntity; /** * 指示器 * * @author xujh * */ public class IndicatorVO extends AMockEntity { /** * serialVersionUID */ private static final long serialVersionUID = 1L; public enum Type { Shortcut, // 快捷方式 Menu, // 菜单项 ToolBarButton, // 工具栏按钮 Other// 权限集合(不显示) } public enum SizeModel { Pixel, // 像素 Percent, // 百分比 Max, // 最大化 Adaptation, // 自适应 Define// 指定尺寸 } /** * 按钮编码,用于标记操作类型 * * @author xujh * @date 2014年9月29日 下午3:13:22 * @version V1.0 */ public enum OperatorCode { Add, // 新增 Delete, // 删除 Update, // 修改 Query, // 查询 Enable, // 启用 Unable, // 禁用 Export, // 导出 Move // 移动 } private Long indicatorId; // 类型 private String type; // 指示器编码 private String code; // 名称 private String name; // 系统编码,用于标识属于哪个系统 private String systemCode; //服务器地址 private String host; // 访问链接 private String uri; // 资源ID private Long resourceId; // 是否可用 private Boolean isEnable = Boolean.TRUE; // 父菜单的主键 private Long parentId; // 是否系统定义-用户可以自定义菜单 private Boolean isSystem = Boolean.FALSE; // 用户ID-用于用户自定义 private Long userId; // 是否显示子菜单 private Boolean isShowSons = Boolean.FALSE; // 是否为本引用的首页 private Boolean isIndex = Boolean.FALSE; private Boolean isShowInDesktop = Boolean.FALSE; // 序号 private Integer sortNum; // 业务类别主键 private Long businessTypeId; //描述 private String description; // 文字图标 private String textIcon; // 小图片图标 private String smallIconPath; // 中图片图标 private String middleIconPath; // 大图片图标 private String bigIconPath; // 窗口打开模式,如果type为Define,那么width和height必须大于0,否则忽略这两个属性值 private String sizeModel; // 窗口宽度,单位为px private Integer width; // 窗口高度,单位为px private Integer height; //是否是父亲 private Integer isParent = Integer.valueOf(0); //是否需要推送消息 private Boolean hasMessage = Boolean.FALSE; //外部用户是否显示 private Boolean isShown4ExternalUser; //菜单级别 private int menuLevel = 0; public Long getIndicatorId() { return indicatorId; } public void setIndicatorId(Long indicatorId) { this.indicatorId = indicatorId; } public String getType() { return type; } public void setType(String type) { this.type = type; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Long getUserId() { return userId; } public void setUserId(Long userId) { this.userId = userId; } public Long getParentId() { return parentId; } public void setParentId(Long parentId) { this.parentId = parentId; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } public String getUri() { return uri; } public void setUri(String uri) { this.uri = uri; } public Long getResourceId() { return resourceId; } public void setResourceId(Long resourceId) { this.resourceId = resourceId; } public Integer getSortNum() { return sortNum; } public void setSortNum(Integer sortNum) { this.sortNum = sortNum; } public Long getBusinessTypeId() { return businessTypeId; } public void setBusinessTypeId(Long businessTypeId) { this.businessTypeId = businessTypeId; } public Boolean getIsEnable() { return isEnable; } public void setIsEnable(Boolean isEnable) { this.isEnable = isEnable; } public Boolean getIsSystem() { return isSystem; } public void setIsSystem(Boolean isSystem) { this.isSystem = isSystem; } public Boolean getIsShowSons() { return isShowSons; } public void setIsShowSons(Boolean isShowSons) { this.isShowSons = isShowSons; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getTextIcon() { return textIcon; } public void setTextIcon(String textIcon) { this.textIcon = textIcon; } public String getSmallIconPath() { return smallIconPath; } public void setSmallIconPath(String smallIconPath) { this.smallIconPath = smallIconPath; } public String getMiddleIconPath() { return middleIconPath; } public void setMiddleIconPath(String middleIconPath) { this.middleIconPath = middleIconPath; } public String getBigIconPath() { return bigIconPath; } public void setBigIconPath(String bigIconPath) { this.bigIconPath = bigIconPath; } public String getSizeModel() { return sizeModel; } public void setSizeModel(String sizeModel) { this.sizeModel = sizeModel; } public String getHost() { return host; } public void setHost(String host) { this.host = host; } public Integer getWidth() { return width; } public void setWidth(Integer width) { this.width = width; } public Integer getHeight() { return height; } public void setHeight(Integer height) { this.height = height; } public String getSystemCode() { return systemCode; } public void setSystemCode(String systemCode) { this.systemCode = systemCode; } public Integer getIsParent() { return isParent; } public void setIsParent(Integer isParent) { this.isParent = isParent; } public Boolean getIsIndex() { return isIndex; } public void setIsIndex(Boolean isIndex) { this.isIndex = isIndex; } public Boolean getIsShowInDesktop() { return isShowInDesktop; } public void setIsShowInDesktop(Boolean isShowInDesktop) { this.isShowInDesktop = isShowInDesktop; } public Boolean getHasMessage() { return hasMessage; } public void setHasMessage(Boolean hasMessage) { this.hasMessage = hasMessage; } public Boolean getIsShown4ExternalUser() { return isShown4ExternalUser; } public void setIsShown4ExternalUser(Boolean isShown4ExternalUser) { this.isShown4ExternalUser = isShown4ExternalUser; } public int getMenuLevel() { return menuLevel; } public void setMenuLevel(int menuLevel) { this.menuLevel = menuLevel; } }
2e4c855c5b932cf84a006de56e85e66190cd9415
4172f8a054df556aa0c08c598292b3471e15473b
/PartnerApp/app/src/main/java/com/tatx/partnerapp/adapter/HelpListAdapter.java
7d5c9641482057d6a3b7a130e038f668e2851e81
[ "Apache-2.0" ]
permissive
qbizns/Android-Uber-Clone
ca65e3a6a91dc9245a2c94d8b7d21ec56ee7af1e
85c85f5edf518da2ccc3d63f1ceb148e52698b2e
refs/heads/master
2020-08-23T06:56:31.167334
2019-10-21T12:46:26
2019-10-21T12:46:26
216,564,505
0
0
null
null
null
null
UTF-8
Java
false
false
2,204
java
package com.tatx.partnerapp.adapter; import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import java.util.List; import com.tatx.partnerapp.R; import com.tatx.partnerapp.dataset.HelpPojo; /** * Created by Subbu on 6/19/2015. */ public class HelpListAdapter extends RecyclerView.Adapter<HelpListAdapter.ViewHolder> { List<HelpPojo> helpList; private OnItemClickListener mListener; Context context; public HelpListAdapter(com.tatx.partnerapp.menuactivity.HelpActivity context, List<HelpPojo> helpList) { this.helpList = helpList; this.context = context; } public void setOnItemClickListener(OnItemClickListener onItemClickListener) { mListener = onItemClickListener; } public interface OnItemClickListener { void onItemClick(View view, int position); } @Override public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) { View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.help_list, viewGroup, false); ViewHolder vh = new ViewHolder(v); v.setTag(i); return vh; } @Override public void onBindViewHolder(ViewHolder holder, int i) { HelpPojo data2 = helpList.get(i); holder.helplist.setText(data2.getAnswer()); //holder.offersimg.setImageResource(imageId[position]); //Picasso.with(context).load(data2.getRoute()).into(holder.offersimg); } @Override public int getItemCount() { // return productDetailses.size(); return (null != helpList ? helpList.size() : 0); } public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { TextView helplist; public ViewHolder(final View rowView) { super(rowView); helplist = (TextView) rowView.findViewById(R.id.helplist); } @Override public void onClick(View v) { if (mListener != null) { mListener.onItemClick(v, getPosition()); } } } }
[ "Ahmed N. Galal@DESKTOP-EP5BBFO" ]
Ahmed N. Galal@DESKTOP-EP5BBFO
d5ca8690bfe3c21ffe8e9a1dfb016fca3c7a1e33
e24c6c940689c19fdcc2e39dd80a5061e0b0b326
/org.eclipse.emf.refactor.refactorings.uml24.henshin/src/org/eclipse/emf/refactor/refactorings/uml24/renameattribute/RefactoringGuiHandler.java
3fd3db2c37c1c2486081a4d1f45e16844cab399f
[]
no_license
ambrusthomas/MeDeR.refactor.examples
63cf443045be9907d237d543db3df93e93175752
66a35d6f9b2924f7c1172c0fff857badd0e41b8e
refs/heads/master
2021-01-22T19:09:18.404936
2017-03-29T16:24:23
2017-03-29T16:24:23
85,169,831
0
0
null
null
null
null
UTF-8
Java
false
false
2,051
java
/** * <copyright> * </copyright> * * $Id: RefactoringGuiHandlerHenshin.javajet,v 1.2 2012/11/26 15:39:38 tarendt Exp $ */ package org.eclipse.emf.refactor.refactorings.uml24.renameattribute; import java.util.List; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.refactor.refactoring.core.Refactoring; import org.eclipse.emf.refactor.refactoring.interfaces.IGuiHandler; import org.eclipse.ltk.ui.refactoring.RefactoringWizard; /** * Class used for specifying gui topics of a specific model refactoring. * @generated */ public class RefactoringGuiHandler implements IGuiHandler { /** * Refactoring supported by the GuiHandler. * @generated */ private Refactoring parent; /** * @see org.eclipse.emf.refactor.refactoring.interfaces.IGuiHandler#getParent() * @generated */ @Override public Refactoring getParent() { return parent; } /** * @see org.eclipse.emf.refactor.refactoring.interfaces.IGuiHandler# * setParent(org.eclipse.emf.refactor.refactoring.core.Refactoring) * @generated */ @Override public void setParent(Refactoring refactoring) { this.parent = refactoring; } /** * @see org.eclipse.emf.refactor.refactoring.interfaces.IGuiHandler#show() * @generated */ @Override public RefactoringWizard show() { return new org.eclipse.emf.refactor.refactorings.uml24.renameattribute.RefactoringWizard ((RefactoringController) this.parent.getController()); } /** * @see org.eclipse.emf.refactor.refactoring.interfaces.IGuiHandler# * showInMenu(java.util.List) * @generated */ @Override public boolean showInMenu(List<EObject> selection) { if (selection.size() > 2) return false; EObject o = selection.get(0); if(null != o){ if (o instanceof org.eclipse.uml2.uml.Property) { if (selection.size() == 2) { EObject eo = selection.get(1); if (eo.eClass().getName().equals("Diagram")) return true; } else { return true; } } } return false; } }
[ "tarendt" ]
tarendt
9cc11da71edf196d14c730e1a859b653226b99e8
df1fcd8156f02ceb47d9e3445f68e07ee7a446e4
/PrintAncestorOfNode/src/main/java/org/learn/Client/App.java
f1ef7e59a7723a720549495ab42712f3a17562e7
[]
no_license
sjkhullar/PrintAncestorOfNode
b7b5c55ea1089cab916c014f35ed96b8f3b3a049
3b4546943bb74f3542c12c06eedddf888368b9fe
refs/heads/master
2021-01-10T03:18:59.649540
2016-02-21T15:23:36
2016-02-21T15:23:36
46,807,776
0
0
null
null
null
null
UTF-8
Java
false
false
998
java
package org.learn.Client; import org.learn.Question.Node; import org.learn.Question.PrintAncestorOfNode; public class App { public static void main(String[] args) { // root level 0 Node A = Node.createNode(100); // Level 1 Node B = Node.createNode(50); Node C = Node.createNode(150); // Level 2 Node D = Node.createNode(25); Node E = Node.createNode(80); Node F = Node.createNode(125); Node G = Node.createNode(160); // connect Level 0 and 1 A.left = B; A.right = C; // connect level 1 and level 2 B.left = D; B.right = E; C.left = F; C.right = G; int iNode = 50; System.out.printf("Ancestor of Node %d is : \n", iNode); PrintAncestorOfNode.printAncestorOfNode(A, iNode); iNode = 160; System.out.printf("\nAncestor of Node %d is : \n", iNode); PrintAncestorOfNode.printAncestorOfNode(A, iNode); iNode = 25; System.out.printf("\nAncestor of Node %d is : \n", iNode); PrintAncestorOfNode.printAncestorOfNode(A, iNode); } }
6ae316c59d3fa1334a317dbbcc208eb65f67ab72
b85f16dadef1e4118a86b074d11f4508792239c2
/src/test/java/com/redhat/cajun/navy/responder/message/serialization/QuotedStringDeserializerTest.java
d8d28dfbd5289e5b39dacbe7da22d40b62627305
[]
no_license
cgruver-erdemo/responder-service
e8a6e1b6b49950b921b97991e26f7729cd10f9dd
e00d929fcf31810b2973e2cf074341126bab6b4b
refs/heads/master
2022-12-07T12:15:41.143663
2020-07-28T12:14:30
2020-07-28T12:14:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,858
java
package com.redhat.cajun.navy.responder.message.serialization; import org.hamcrest.CoreMatchers; import org.hamcrest.MatcherAssert; import org.junit.Test; public class QuotedStringDeserializerTest { @Test public void testUnquoted() { String json = "{\"messageType\":\"IncidentReportedEvent\"," + "\"id\":\"messageId\"," + "\"invokingService\":\"messageSender\"," + "\"timestamp\":1521148332397," + "\"body\": {\"id\":\"incident123\"," + "\"lat\": \"34.14338\"," + "\"lon\": \"-77.86569\"," + "\"numberOfPeople\": 3," + "\"medicalNeeded\": true," + "\"timestamp\": 1521148332350" + "}}"; QuotedStringDeserializer deserializer = new QuotedStringDeserializer(); byte[] data = json.getBytes(); String deserialized = deserializer.deserialize("test", data); MatcherAssert.assertThat(deserialized, CoreMatchers.equalTo(json)); } @Test public void testQuoted() { String json = "\"{\\\"messageType\\\":\\\"IncidentReportedEvent\\\"," + "\\\"id\\\":\\\"messageId\\\"," + "\\\"invokingService\\\":\\\"messageSender\\\"," + "\\\"timestamp\\\":1521148332397," + "\\\"body\\\": {\\\"id\":\\\"incident123\\\"," + "\\\"lat\\\": \\\"34.14338\\\"," + "\\\"lon\\\": \\\"-77.86569\\\"," + "\\\"numberOfPeople\\\": 3," + "\\\"medicalNeeded\\\": true," + "\\\"timestamp\\\": 1521148332350" + "}}\""; String expected = "{\"messageType\":\"IncidentReportedEvent\"," + "\"id\":\"messageId\"," + "\"invokingService\":\"messageSender\"," + "\"timestamp\":1521148332397," + "\"body\": {\"id\":\"incident123\"," + "\"lat\": \"34.14338\"," + "\"lon\": \"-77.86569\"," + "\"numberOfPeople\": 3," + "\"medicalNeeded\": true," + "\"timestamp\": 1521148332350" + "}}"; QuotedStringDeserializer deserializer = new QuotedStringDeserializer(); byte[] data = json.getBytes(); String deserialized = deserializer.deserialize("test", data); MatcherAssert.assertThat(deserialized, CoreMatchers.equalTo(expected)); } @Test public void testQuotedUnEscaped() { String json = "\"{\"messageType\":\"IncidentReportedEvent\"," + "\"id\":\"messageId\"," + "\"invokingService\":\"messageSender\"," + "\"timestamp\":1521148332397," + "\"body\": {\"id\":\"incident123\"," + "\"lat\": \"34.14338\"," + "\"lon\": \"-77.86569\"," + "\"numberOfPeople\": 3," + "\"medicalNeeded\": true," + "\"timestamp\": 1521148332350" + "}}\""; String expected = "{\"messageType\":\"IncidentReportedEvent\"," + "\"id\":\"messageId\"," + "\"invokingService\":\"messageSender\"," + "\"timestamp\":1521148332397," + "\"body\": {\"id\":\"incident123\"," + "\"lat\": \"34.14338\"," + "\"lon\": \"-77.86569\"," + "\"numberOfPeople\": 3," + "\"medicalNeeded\": true," + "\"timestamp\": 1521148332350" + "}}"; QuotedStringDeserializer deserializer = new QuotedStringDeserializer(); byte[] data = json.getBytes(); String deserialized = deserializer.deserialize("test", data); MatcherAssert.assertThat(deserialized, CoreMatchers.equalTo(expected)); } }
9aa8f25a53eade27f2d34ea178fcde7483c9e4a7
c88a5291b258e3a1bac42fead6f0ca790e279189
/app/src/main/java/com/thebestgroup/io/donkeymoney_io/utils/model/LoginResponse.java
131fbb1302f68d5aea921b63bcfdbadf6637614f
[]
no_license
sher04lock/DonkeyMoneyMobile
f1a5ec2d45df4e9b25f178d7904587a88cbdfbd4
1b501910317ce8394e1e0f2f506d4e5f2dcc6143
refs/heads/master
2020-04-07T17:37:19.245749
2018-01-24T17:28:08
2018-01-24T17:28:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,585
java
package com.thebestgroup.io.donkeymoney_io.utils.model; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; public class LoginResponse { @SerializedName("access_token") @Expose private String accessToken; @SerializedName("instance_url") @Expose private String instanceUrl; @SerializedName("id") @Expose private String id; @SerializedName("token_type") @Expose private String tokenType; @SerializedName("issued_at") @Expose private String issuedAt; @SerializedName("signature") @Expose private String signature; public String getAccessToken() { return accessToken; } public void setAccessToken(String accessToken) { this.accessToken = accessToken; } public String getInstanceUrl() { return instanceUrl; } public void setInstanceUrl(String instanceUrl) { this.instanceUrl = instanceUrl; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getTokenType() { return tokenType; } public void setTokenType(String tokenType) { this.tokenType = tokenType; } public String getIssuedAt() { return issuedAt; } public void setIssuedAt(String issuedAt) { this.issuedAt = issuedAt; } public String getSignature() { return signature; } public void setSignature(String signature) { this.signature = signature; } }
927e9f55d80ab3041ef9ba59d6b76e00a49dd3b3
02507a5e6c42af839370c63870be8ada9599a941
/skin/src/main/java/com/easy/skin/SkinFactory.java
e34169067dfc3a56e67c7c01782dbf427a30406c
[]
no_license
EasyDevWork/EasyAndroid2
42128245c2a1c3f4e483f8e83e101e7dd2130c20
8e70ef7389805f7504525a23aadcb8fda020aee3
refs/heads/master
2021-04-04T16:45:36.535233
2021-02-26T02:51:02
2021-02-26T02:51:02
248,472,146
0
1
null
null
null
null
UTF-8
Java
false
false
2,027
java
package com.easy.skin; import android.content.Context; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import java.lang.reflect.Constructor; import java.util.HashMap; import java.util.Observable; import java.util.Observer; public class SkinFactory implements LayoutInflater.Factory2, Observer { /** * 属性处理类 */ private SkinAttribute mSkinAttribute; AppCompatViewInflater2 inflater2; /** * 保存view的构造方法 */ private static final HashMap<String, Constructor<? extends View>> sConstructorMap = new HashMap<>(); private static final Class<?>[] mConstructorSignature = new Class[]{Context.class, AttributeSet.class}; public final String[] a = new String[]{ "android.widget.", "android.view.", "android.webkit." }; public SkinFactory() { mSkinAttribute = new SkinAttribute(); inflater2 = new AppCompatViewInflater2(); } /** * AppCompatViewInflater * * @param parent * @param name * @param context * @param attributeSet * @return */ @Nullable @Override public View onCreateView(@Nullable View parent, @NonNull String name, @NonNull Context context, @NonNull AttributeSet attributeSet) { View view = inflater2.createView(parent, name, context, attributeSet, false, false, true, false); if (view != null) { mSkinAttribute.loadView(view, attributeSet); } return view; } @Override public void update(Observable observable, Object o) { //接受到换肤请求 mSkinAttribute.applySkin(); } public SkinAttribute getSkinAttribute() { return mSkinAttribute; } @Nullable @Override public View onCreateView(@NonNull String s, @NonNull Context context, @NonNull AttributeSet attributeSet) { return null; } }
fe870f122a50e57bbc7b6e147efebbd2d4b71289
b894e7feec5ef4711e9d5f00bffc3effc1294143
/src/by/it/gerasimov/calc/ReportBuilder.java
5c4a79bbdf658ac83ba602ca65da2e124a81a085
[]
no_license
Vladislav7776/JD2020-01-20
877e311bfa2be42152424f5f4963deb1b718e7e3
2f977ee26b79a97fa37bd1053756c91f344c5757
refs/heads/master
2020-12-22T21:37:24.187529
2020-03-12T20:22:51
2020-03-12T20:22:51
236,938,743
6
0
null
2020-01-29T08:46:59
2020-01-29T08:46:58
null
UTF-8
Java
false
false
1,685
java
package by.it.gerasimov.calc; import by.it.gerasimov.calc.translate.Globalization; import by.it.gerasimov.calc.translate.Messages; import by.it.gerasimov.calc.translate.ResMan; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.util.Deque; import java.util.LinkedList; abstract class ReportBuilder { Deque<String> logs = new LinkedList<>(); StringBuilder report = new StringBuilder(); abstract void addHeader(); void addRunningTime() { report.append(Globalization.getCurrentDate()).append('\n'); } abstract void addLines(); void print() { System.out.println(report.toString()); } void readLog() { try (BufferedReader br = new BufferedReader(new FileReader(Settings.pathToLog))) { String line; while ((line = br.readLine()) != null) { logs.addLast(line); } } catch (IOException e) { System.out.println(e.getMessage()); } } } class ShortReportBuilder extends ReportBuilder { @Override void addHeader() { report.append("Short report:\n"); } @Override void addLines() { readLog(); for (String log : logs) { if (log.contains(ResMan.INSTANCE.get(Messages.ERROR))) { report.append(log).append('\n'); } } } } class FullReportBuilder extends ReportBuilder { @Override void addHeader() { report.append("Full report:\n"); } @Override void addLines() { readLog(); for (String log : logs) { report.append(log).append('\n'); } } }
d0e36ca7828e2ef34cc0eee8777300fd211fc1fa
3dddbe8d199f28d2c18a7782ac49b7b416cbc264
/app/src/main/java/movie/bw/com/movie/net/PMCallback.java
aec261ae286d3f6e076e317aa4abc06880be73d9
[]
no_license
hollewsq/Movie
f8417f18ad5d770dd5d06b84fd899b64a5dfd35b
b3f9e2e7b707b2382ddde18ca3f945829e84b61f
refs/heads/master
2020-05-16T02:02:53.141888
2019-04-19T10:43:22
2019-04-19T10:43:26
182,618,321
0
0
null
null
null
null
UTF-8
Java
false
false
126
java
package movie.bw.com.movie.net; public interface PMCallback { void onFail(String msg); void onSuccess(Object reg); }
4d8654c9106181a40726adc0750e1c1e9d1c08a6
08192e0e593398f42abaf5dc8f51d7726d830839
/cqzqjg-services/src/main/java/cn/roilat/cqzqjg/services/system/sevice/impl/SysMenuServiceImpl.java
f2dcc01576988da0cd509b58ca0e00e2077f08d7
[]
no_license
roilat/zqjg
10ffb767ab8af298ca0fc08f2daac79c52aad31d
a4630b9b11fe533400a2d9eee0ed91f61604479a
refs/heads/master
2022-06-29T18:55:50.084405
2020-02-29T08:49:54
2020-02-29T08:49:54
229,590,120
0
1
null
2022-06-17T02:49:35
2019-12-22T15:36:55
Java
UTF-8
Java
false
false
3,229
java
package cn.roilat.cqzqjg.services.system.sevice.impl; import java.util.ArrayList; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import cn.roilat.cqzqjg.services.system.constants.SysConstants; import cn.roilat.cqzqjg.services.system.dao.SysMenuMapper; import cn.roilat.cqzqjg.services.system.model.SysMenu; import cn.roilat.cqzqjg.services.system.sevice.SysMenuService; import cn.roilat.cqzqjg.core.page.MybatisPageHelper; import cn.roilat.cqzqjg.core.page.PageRequest; import cn.roilat.cqzqjg.core.page.PageResult; @Service public class SysMenuServiceImpl implements SysMenuService { @Autowired private SysMenuMapper sysMenuMapper; @Override public int save(SysMenu record) { if(record.getId() == null || record.getId() == 0) { return sysMenuMapper.insertSelective(record); } if(record.getParentId() == null) { record.setParentId(0L); } return sysMenuMapper.updateByPrimaryKeySelective(record); } @Override public int delete(SysMenu record) { return sysMenuMapper.deleteByPrimaryKey(record.getId()); } @Override public int delete(List<SysMenu> records) { for(SysMenu record:records) { delete(record); } return 1; } @Override public SysMenu findById(Long id) { return sysMenuMapper.selectByPrimaryKey(id); } @Override public PageResult findPage(PageRequest pageRequest) { return MybatisPageHelper.findPage(pageRequest, sysMenuMapper); } @Override public List<SysMenu> findTree(String userName, int menuType) { List<SysMenu> sysMenus = new ArrayList<>(); List<SysMenu> menus = findByUser(userName); for (SysMenu menu : menus) { if (menu.getParentId() == null || menu.getParentId() == 0) { menu.setLevel(0); if(!exists(sysMenus, menu)) { sysMenus.add(menu); } } } sysMenus.sort((o1, o2) -> o1.getOrderNum().compareTo(o2.getOrderNum())); findChildren(sysMenus, menus, menuType); return sysMenus; } @Override public List<SysMenu> findByUser(String userName) { if(userName == null || "".equals(userName) || SysConstants.ADMIN.equalsIgnoreCase(userName)) { return sysMenuMapper.findAll(); } return sysMenuMapper.findByUserName(userName); } private void findChildren(List<SysMenu> SysMenus, List<SysMenu> menus, int menuType) { for (SysMenu SysMenu : SysMenus) { List<SysMenu> children = new ArrayList<>(); for (SysMenu menu : menus) { if(menuType == 1 && menu.getType() == 2) { // 如果是获取类型不需要按钮,且菜单类型是按钮的,直接过滤掉 continue ; } if (SysMenu.getId() != null && SysMenu.getId().equals(menu.getParentId())) { menu.setParentName(SysMenu.getName()); menu.setLevel(SysMenu.getLevel() + 1); if(!exists(children, menu)) { children.add(menu); } } } SysMenu.setChildren(children); children.sort((o1, o2) -> o1.getOrderNum().compareTo(o2.getOrderNum())); findChildren(children, menus, menuType); } } private boolean exists(List<SysMenu> sysMenus, SysMenu sysMenu) { boolean exist = false; for(SysMenu menu:sysMenus) { if(menu.getId().equals(sysMenu.getId())) { exist = true; } } return exist; } }
[ "123456" ]
123456
7fce591c53b848be4f22c402f3299acec4c18c4a
b069c68ba6827618a98babc719d29a4ecbe78164
/client/LibraryClient/src/com/libraryclient/connection/requests/BookInfo.java
d41456336ca1876daa4403dbfec1950c006aac2c
[]
no_license
minthanthtoo/bookaholic
59993315c42548770e6e0bfd8ffe51e74cb506cd
65e0981005612852998aa95949b604b8dc6eeb13
refs/heads/master
2021-01-10T21:36:10.823094
2013-08-24T17:11:52
2013-08-24T17:11:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
422
java
package com.libraryclient.connection.requests; import com.libraryclient.connection.Request; public class BookInfo extends Request { public BookInfo(String requestData) { this(Requests.BookInfo.REQUEST_CODE, requestData); } private BookInfo(int requestCode, String requestData) { super(requestCode, requestData); } @Override public String getTargetResponseTag() { return Requests.BookInfo.RESPONSE_TAG; } }
49713199a3af8f104712e0209ace4bfac377935d
b405a6f7a3358c9008f7a7b30046201647de988d
/Technical/Code/business-card/src/test/java/com/edexer/service/UserServiceManagerImplTest.java
ac100bbe2ab1177b5b7300d69a79efecd13444d8
[]
no_license
edexcompany/edexer
1b9fb02ec4839406ff7c9f448986785b0a873ab7
74621fd172d52948c1878a2c299e941f2bfea0e8
refs/heads/master
2016-09-06T13:12:31.104932
2015-06-04T22:25:00
2015-06-04T22:25:00
35,110,101
0
0
null
null
null
null
UTF-8
Java
false
false
5,743
java
package com.edexer.service; import java.util.ArrayList; import java.util.Date; import java.util.HashSet; import java.util.List; import java.util.Set; import junit.framework.TestCase; import org.hibernate.Hibernate; import org.hibernate.Query; import org.hibernate.Session; import org.junit.Test; import org.junit.runner.RunWith; import org.primefaces.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import com.edexer.dao.RoleEntityDaoImpl; import com.edexer.model.BusinessCard; import com.edexer.model.Role; import com.edexer.model.User; //TODO: add junit 4 dependency in pom.xml @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration("/testapplicationContext.xml") public class UserServiceManagerImplTest extends TestCase { @Autowired UserServiceManager userService; @Autowired RoleEntityDaoImpl roleDao; @Autowired BusinessCardServiceManager bcService; @Test public void test(){ List<BusinessCard> bcList = new ArrayList<BusinessCard>(); BusinessCard bc = bcService.get(50, true); bcList.add(bcService.get(50, true)); bcList.add(bcService.get(51, true)); JSONObject a = new JSONObject(bcList); System.out.println(a); } /* * @Autowired BusinessCardServiceManager bcService; * * @Autowired TagsServiceManager tagsService; * * @Autowired UserSubscriptionServiceManager subService; */ /* * //@Test public void testInsertSubscription(){ BusinessCard bc = new * BusinessCard(); Set<Tags> s = new HashSet(); User u = * null;//userService.getUserById(18); * * * * UserSubscription uSub = new UserSubscription(); * //uSub.setUserByUserId(u); // uSub.setUserId(18); * * ActAs actAs = new ActAs(); actAs.setActAsId(1); uSub.setActAs(actAs); * uSub.setUserByLastEditBy(u); * * Subscription sub = new Subscription(); sub.setSubscriptionId(1); * uSub.setSubscription(sub); * * SubscriptionStatus subStatus = new SubscriptionStatus(); * subStatus.setSubStatusId(1); * * uSub.setSubscriptionStatus(subStatus); * * Tags t = new Tags(); t.setTagName("My tag"); * * //t.setUserSubscription(uSub); s.add(t); uSub.setTagses(s); * * // uSub.set subService.insertUserSubscription(uSub); * * } /* //@Test public void testInsertBusinessCard(){ BusinessCard bc = new * BusinessCard(); Set<Tags> s = new HashSet(); Tags t = new Tags(); * t.setTagName("My tag"); UserSubscription sub = * subService.getUserSubscriptionsByUserId(18).get(0); * t.setUserSubscription(sub); tagsService.addTag(t); // s.add(t); * bc.setBcFirstName("Karim3"); bc.setBcLastName("Karim"); bc.setTagses(s); * Integer x = bcService.addBusinessCard(bc); // System.out.println(x); } * * //@Test public void testInsertUser() { // fail("Not yet implemented"); * User u = new User(); u.setFirstName("Karim2"); u.setLastName("Karim2"); * u.setMobile("01256598"); u.setUserEmail("[email protected]"); * u.setPassword("karim2"); int result = userService.insertUser(u); * UserSubscription userSub = new UserSubscription(); * * UserSubscriptionId usid = new UserSubscriptionId(); usid.setSubType(1); * usid.setUserId(result); * * userSub.setId(usid); * * Date curDate = new Date(); //userSub.setUserByUserId(u); * userSub.setLastEditDate(new Date()); userSub.setStartDate(curDate); * userSub.setUserByLastEditBy(u); * * SubscriptionStatus subStatus = new SubscriptionStatus(); * subStatus.setSubStatusId(1); userSub.setSubscriptionStatus(subStatus); * * ActAs actas = new ActAs(); actas.setActAsId(1); userSub.setActAs(actas); * * subService.insertUserSubscription(userSub); } * * // public void testGetUserById() { //// fail("Not yet implemented"); // } * // // public void testGetUser() { //// fail("Not yet implemented"); // } * // // public void testGetUsers() { //// fail("Not yet implemented"); // } * //@Test public void test(){ * * } */ // @Test /* * public void changeStaffPass() { boolean result=false; try{ User user=new * User(); user=userService.getUserById(1); * result=userService.changeStaffPassword(user, "12345", user, "1781992"); * if(result) { System.out.println("Updated Succesfully"); * * } else{ System.out.println("didn't work"); } * * } catch(Exception e){e.printStackTrace();} * * } */ /* * @Test public void UpdateUser() { try{ User user=new User(); * user=userService.getUserById(1); user.setFirstName("Mohamed"); * userService.update(user); System.out.println("Updated Succesfully"); } * catch(Exception e){e.printStackTrace();System.out.println("Error");} } */ /* * @Test public void DeleteUser() { try{ User user=new User(); * user=userService.getUserById(2); * * userService.delete(user); System.out.println("Deleted Succesfully"); } * catch(Exception e){e.printStackTrace();System.out.println("Error");} } */ //@Test public void InsertUser() { try { User user = new User(); user.setUserEmail("[email protected]"); user.setFirstName("MEDO"); user.setLastName("Rady"); user.setPassword("09876"); user.setPhone("01873298"); Role role = new Role(); // RoleEntityDaoImpl dao=new RoleEntityDaoImpl(); role = roleDao.get(Role.class, 1); user.setRole(role); userService.insertUser(user); System.out.println("Inserted Succesfully"); } catch (Exception e) { e.printStackTrace(); System.out.println("Error"); } } @Test public void getColleagues() { User user = userService.getUserById(59); System.out.println("AA"); List<User> list = userService.getCorporateUsers(user); System.out.println(list.size()); } }
03244bde6f46c2f664a4f6263c6b73445f4f83c4
50d1bd7343009a5d7f4bc3c5995144c1aa9d5c7f
/SpringBootJFX/src/main/java/com/billing/controller/ViewSalesReturnController.java
e679943daf5712e02797b8dffcc7aac59977c459
[]
no_license
kumbharvish/SpringBootJavaFX
ea3731512ffd92bcde48261bc29905a47cce9967
c55dbfbd2a835f138af946e60eeb8284bb70afee
refs/heads/master
2023-08-17T05:21:39.164031
2023-04-09T17:08:15
2023-04-09T17:08:15
193,374,232
0
0
null
null
null
null
UTF-8
Java
false
false
8,077
java
package com.billing.controller; import java.io.IOException; import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import com.billing.dto.ItemDetails; import com.billing.dto.Product; import com.billing.dto.ReturnDetails; import com.billing.main.AppContext; import com.billing.service.SalesReturnService; import com.billing.utils.AlertHelper; import com.billing.utils.AppUtils; import com.billing.utils.IndianCurrencyFormatting; import javafx.beans.property.SimpleStringProperty; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.control.TextField; import javafx.scene.image.Image; import javafx.stage.Modality; import javafx.stage.Stage; @Controller public class ViewSalesReturnController extends AppContext { ReturnDetails returnDetails; private static final Logger logger = LoggerFactory.getLogger(CreateInvoiceController.class); public Stage currentStage = null; ObservableList<Product> productList; @Autowired AlertHelper alertHelper; @Autowired AppUtils appUtils; ObservableList<ItemDetails> productTableData; @Autowired SalesReturnService salesReturnService; @FXML private TextField txtReturnNo; @FXML private TextField txtReturnDate; @FXML private TextField txtInvoiceNo; @FXML private TextField txtInvoiceDate; @FXML private TextField txtComments; @FXML private TextField txtCustomer; @FXML private TableView<ItemDetails> tableView; @FXML private TableColumn<ItemDetails, String> tcItemName; @FXML private TableColumn<ItemDetails, String> tcUnit; @FXML private TableColumn<ItemDetails, String> tcQuantity; @FXML private TableColumn<ItemDetails, String> tcRate; @FXML private TableColumn<ItemDetails, String> tcDiscount; @FXML private TableColumn<ItemDetails, String> tcDiscountAmount; @FXML private TableColumn<ItemDetails, String> tcAmount; @FXML private TableColumn<ItemDetails, String> tcCGSTPercent; @FXML private TableColumn<ItemDetails, String> tcCGST; @FXML private TableColumn<ItemDetails, String> tcSGSTPercent; @FXML private TableColumn<ItemDetails, String> tcSGST; @FXML private TextField txtNoOfItems; @FXML private TextField txtTotalQty; @FXML private TextField txtSubTotal; @FXML private TextField txtDiscountPercent; @FXML private TextField txtDiscountAmt; @FXML private TextField txtPaymentMode; @FXML private TextField txtGstAmount; @FXML private TextField txtGstType; @FXML private TextField txtTotalReturnAmount; public void initialize() { productTableData = FXCollections.observableArrayList(); productList = FXCollections.observableArrayList(); tableView.setItems(productTableData); setTableCellFactories(); } private void setTableCellFactories() { tcItemName.setCellValueFactory(cellData -> new SimpleStringProperty(cellData.getValue().getItemName())); tcUnit.setCellValueFactory(cellData -> new SimpleStringProperty(cellData.getValue().getUnit())); tcQuantity.setCellValueFactory( cellData -> new SimpleStringProperty(appUtils.getDecimalFormat(cellData.getValue().getQuantity()))); tcRate.setCellValueFactory( cellData -> new SimpleStringProperty(appUtils.getDecimalFormat(cellData.getValue().getRate()))); tcAmount.setCellValueFactory( cellData -> new SimpleStringProperty(appUtils.getDecimalFormat(cellData.getValue().getAmount()))); tcDiscountAmount.setCellValueFactory(cellData -> new SimpleStringProperty( appUtils.getDecimalFormat(cellData.getValue().getDiscountAmount()))); tcCGST.setCellValueFactory(cellData -> new SimpleStringProperty( appUtils.getDecimalFormat(cellData.getValue().getGstDetails().getCgst()))); tcSGST.setCellValueFactory(cellData -> new SimpleStringProperty( appUtils.getDecimalFormat(cellData.getValue().getGstDetails().getSgst()))); tcCGSTPercent.setCellValueFactory(cellData -> new SimpleStringProperty( String.valueOf(cellData.getValue().getGstDetails().getCgstPercent()))); tcSGSTPercent.setCellValueFactory(cellData -> new SimpleStringProperty( String.valueOf(cellData.getValue().getGstDetails().getSgstPercent()))); tcDiscount.setCellValueFactory( cellData -> new SimpleStringProperty(String.valueOf(cellData.getValue().getDiscountPercent()))); tcItemName.getStyleClass().add("character-cell"); tcQuantity.getStyleClass().add("numeric-cell"); tcUnit.getStyleClass().add("character-cell"); tcRate.getStyleClass().add("numeric-cell"); tcAmount.getStyleClass().add("numeric-cell"); tcDiscountAmount.getStyleClass().add("numeric-cell"); tcCGST.getStyleClass().add("numeric-cell"); tcDiscount.getStyleClass().add("numeric-cell"); tcCGSTPercent.getStyleClass().add("numeric-cell"); tcSGSTPercent.getStyleClass().add("numeric-cell"); tcSGST.getStyleClass().add("numeric-cell"); } public void loadData() { currentStage = (Stage) txtCustomer.getScene().getWindow(); List<ItemDetails> itemList = salesReturnService.getReturnedItemList(returnDetails.getReturnNumber()); returnDetails.setItemDetails(itemList); for (ItemDetails item : returnDetails.getItemDetails()) { Product p = new Product(); p.setGstDetails(item.getGstDetails()); productTableData.add(item); productList.add(p); } txtComments.setText(returnDetails.getComments()); txtInvoiceNo.setText(String.valueOf(returnDetails.getInvoiceNumber())); txtInvoiceDate.setText(appUtils.getFormattedDateWithTime(returnDetails.getInvoiceDate())); txtReturnNo.setText(String.valueOf(returnDetails.getReturnNumber())); txtReturnDate.setText(appUtils.getFormattedDateWithTime(returnDetails.getTimestamp())); txtCustomer.setText(String.valueOf(returnDetails.getCustomerMobileNo())+" : "+String.valueOf(returnDetails.getCustomerName())); txtNoOfItems.setText(String.valueOf(returnDetails.getNoOfItems())); txtTotalQty.setText(String.valueOf(returnDetails.getTotalQuantity())); txtSubTotal.setText(IndianCurrencyFormatting.applyFormatting(returnDetails.getSubTotal())); txtDiscountAmt.setText(IndianCurrencyFormatting.applyFormatting(returnDetails.getDiscountAmount())); txtDiscountPercent.setText(String.valueOf(returnDetails.getDiscount())); txtPaymentMode.setText(returnDetails.getPaymentMode()); txtGstAmount.setText(IndianCurrencyFormatting.applyFormatting(returnDetails.getGstAmount())); txtGstType.setText(returnDetails.getGstType()); txtTotalReturnAmount .setText(IndianCurrencyFormatting.applyFormattingWithCurrency(returnDetails.getTotalReturnAmount())); } @FXML void onViewGSTDetailsAction(ActionEvent event) { getGSTDetailsPopUp(); } private void getGSTDetailsPopUp() { FXMLLoader fxmlLoader = new FXMLLoader(); fxmlLoader.setControllerFactory(springContext::getBean); fxmlLoader.setLocation(this.getClass().getResource("/com/billing/gui/ViewGSTDetails.fxml")); Parent rootPane = null; try { rootPane = fxmlLoader.load(); } catch (IOException e) { e.printStackTrace(); logger.error("getGSTDetailsPopUp Error in loading the view file :", e); alertHelper.beep(); alertHelper.showErrorAlert(null, "Error Occurred", "Error in creating user interface", "An error occurred in creating user interface " + "for the selected command"); return; } final Scene scene = new Scene(rootPane); final GSTDetailsController controller = (GSTDetailsController) fxmlLoader.getController(); controller.productList = productList; final Stage stage = new Stage(); stage.initModality(Modality.APPLICATION_MODAL); stage.initOwner(currentStage); stage.setUserData(controller); stage.getIcons().add(new Image("/images/shop32X32.png")); stage.setScene(scene); stage.setTitle("GST Details"); controller.loadData(); stage.showAndWait(); } }
[ "VISHAL@HP" ]
VISHAL@HP
1020ce70fbc98a0bdc8b82a27ad6121fb23ce8e5
0571d934e56edba1833662bc52415683f07b94a3
/src/main/java/logik/NoValidSettingsFileException.java
26f6102d1417fbd2bc85dc9f52c400b2887bfcaf
[ "BSD-3-Clause" ]
permissive
art-r/Java-Intelligent-SnakeProject
1ad9b822264c69d97932856982071be73d305d6f
60f69cc7e95c46868e6ff2005d918c1190a15acc
refs/heads/main
2023-07-27T01:28:34.419935
2021-09-15T14:06:27
2021-09-15T14:06:27
364,915,556
4
1
BSD-3-Clause
2021-05-26T08:57:29
2021-05-06T13:13:07
Java
UTF-8
Java
false
false
248
java
package logik; //Exception that we need while checking our custom settings file public class NoValidSettingsFileException extends Exception{ //we only need a constructor without any message! public NoValidSettingsFileException() { } }