blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
132 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
28 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
352
04e3a2004b184533077555f640414a654101430d
5fd454807588d2ff24740457063aea9f8d9f764c
/app/src/main/java/com/jyutwaa/zhaoziliang/glimpse/Presenter/presenterImpl/IBilibiliFunnyPresenterImpl.java
bc2bf323b2f77dd9273256d537886819aa2c4bc9
[ "MIT" ]
permissive
ValentinZhao/Glimpse
d8cb87b0a1789a8b3f91928cecf8a6118a64e5e5
74c788d57808f1aa2e2dfad77c060cd1338b6753
refs/heads/master
2021-01-09T05:41:40.418698
2017-06-17T15:06:35
2017-06-17T15:06:35
80,813,939
0
0
null
null
null
null
UTF-8
Java
false
false
2,771
java
package com.jyutwaa.zhaoziliang.glimpse.Presenter.presenterImpl; import android.content.Context; import android.util.Log; import com.jyutwaa.zhaoziliang.glimpse.Api.ApiManager; import com.jyutwaa.zhaoziliang.glimpse.Config.Config; import com.jyutwaa.zhaoziliang.glimpse.Fragment.Bilibili.FunnySciFragment; import com.jyutwaa.zhaoziliang.glimpse.Model.Bilibili.TopListType; import com.jyutwaa.zhaoziliang.glimpse.Model.Bilibili.TopListTypeItem; import com.jyutwaa.zhaoziliang.glimpse.Presenter.IBilibiliFunnyPresenter; import com.jyutwaa.zhaoziliang.glimpse.Utils.CacheUtil; import rx.Observer; import rx.Subscription; import rx.android.schedulers.AndroidSchedulers; import rx.functions.Func1; import rx.schedulers.Schedulers; /** * Created by zhaoziliang on 17/2/28. */ public class IBilibiliFunnyPresenterImpl extends BasePresenterImpl implements IBilibiliFunnyPresenter{ Context mContext; FunnySciFragment mIBilibiliFunnyFragment; CacheUtil mCacheUtils; public IBilibiliFunnyPresenterImpl(Context mContext, FunnySciFragment mIBilibiliFunnyFragment) { this.mContext = mContext; this.mIBilibiliFunnyFragment = mIBilibiliFunnyFragment; this.mCacheUtils = CacheUtil.get(mContext); } @Override public void getFunnyTopList() { Subscription subscription = ApiManager.getInstance().getBilibiliApiService().getTopList() .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .map(new Func1<TopListType, TopListType>() { @Override public TopListType call(TopListType topListType) { for(TopListTypeItem item : topListType.getFunny_sci_human_list().getAllItems()){ item.setVideoUrl(Config.BILIBILI_VIDEO_BASE_URL + item.getAid()); Log.d("BILIBILI", Config.BILIBILI_VIDEO_BASE_URL + item.getAid()); } return topListType; } }).subscribe(new Observer<TopListType>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { mIBilibiliFunnyFragment.hideProgressbar(); mIBilibiliFunnyFragment.showError(e.getMessage()); } @Override public void onNext(TopListType topListType) { mIBilibiliFunnyFragment.hideProgressbar(); mIBilibiliFunnyFragment.updateList(topListType); } }); addSubscription(subscription); } }
[ "2264709714@qq.com" ]
2264709714@qq.com
ffc728903e8e97bc912cdb95df0daf24b03bd086
ac6c275f5438fdc3edec1cbf2791a77195b6633a
/taotao-parent2/taotao-manage/taotao-manage-service/src/main/java/com/taotao/service/ItemCatService.java
a7bdeeca024462f3406a2bd2289f4a91ebb319c8
[]
no_license
leo613/taotao
c3d6fc203b8cf870816387e8f45f73f59e477488
13943f56fd84c055d2a5e1c3ae145289cd716920
refs/heads/master
2022-12-10T08:37:39.841295
2020-09-08T12:27:22
2020-09-08T12:27:22
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,954
java
package com.taotao.service; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.taotao.common.bean.ItemCatData; import com.taotao.common.bean.ItemCatResult; import com.taotao.common.service.RedisService; import com.taotao.pojo.ItemCat; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @Service public class ItemCatService extends BaseService<ItemCat> { // @Autowired // public ItemCatMapper itemCatMapper; // // /** // * 查询商品类目信息W // * @param parentId // * @return // */ // // public List<ItemCat> queryItemCatList(Long parentId) { // ItemCat itemCat=new ItemCat(); // itemCat.setParentId(parentId); // return itemCatMapper.select(itemCat); // } @Autowired private RedisService redisService; private static final String ITEM_CAT_KEY="TAOTAO_MANAGE_ITEM_CAT_ALL";// key 命名规则: 项目名_模块名_方法名(业务名称) private static final int ITEM_CAT_KEY_TIME=60 * 60 * 24 * 30 * 3; //连接超时时间 private ObjectMapper mapper = new ObjectMapper(); /** * 全部查询,并且生成树状结构 * * @return */ public ItemCatResult queryAllToTree() { // 直接从缓存中取数据 try { String itemCatResultStr = redisService.get(ITEM_CAT_KEY); if (StringUtils.isNotBlank(itemCatResultStr)){ return mapper.readValue(itemCatResultStr,ItemCatResult.class); } } catch (IOException e) { e.printStackTrace(); } ItemCatResult result = new ItemCatResult(); // 全部查出,并且在内存中生成树形结构 List<ItemCat> itemCats = super.queryAll(); //创建map集合 Map<Long, List<ItemCat>> itemCatMap = new HashMap<Long, List<ItemCat>>(); // 转为map存储,key为父节点ID,value为数据集合 for (ItemCat itemCat : itemCats) { // 父节点Id Long parentId = itemCat.getParentId(); //判断itemCatMap有没有相同父节点,若没有则添加否则跳过直接添加value数据集合 if (!itemCatMap.containsKey(parentId)){ //添加父节点key itemCatMap.put(itemCat.getParentId(),new ArrayList<ItemCat>()); } //添加value 数据集合 itemCatMap.get(parentId).add(itemCat); } // 封装一级对象 List<ItemCat> itemCatList1 = itemCatMap.get(0L); for (ItemCat itemCat : itemCatList1) { ItemCatData itemCatData=new ItemCatData(); itemCatData.setUrl("/products/" + itemCat.getId() + ".html"); itemCatData.setName("<a href='" + itemCatData.getUrl() + "'>" + itemCat.getName() + "</a>"); result.getItemCats().add(itemCatData); //判断是否为父节点 if (!itemCat.getIsParent()){ continue; } // 封装二级对象 Long secondId = itemCat.getId(); List<ItemCat> itemCatList2 = itemCatMap.get(secondId); List<ItemCatData> itemCatDataList2=new ArrayList<ItemCatData>(); itemCatData.setItems(itemCatDataList2); for (ItemCat itemCat2 : itemCatList2) { //封装成ItemCatData 对象 ItemCatData itemCatData2=new ItemCatData(); itemCatData2.setUrl("/products/"+itemCat2.getId()+".html"); itemCatData2.setName("<a href='"+itemCatData2.getUrl()+"'>"+itemCat2.getName()+"</a>"); itemCatDataList2.add(itemCatData2); //判断二级对象是否有三级对象 if (itemCat2.getIsParent()){ // 封装三级对象 Long thirdId = itemCat2.getId(); List<ItemCat> itemCatList3 = itemCatMap.get(thirdId); List<String> itemCatDataList3=new ArrayList<>(); itemCatData2.setItems(itemCatDataList3); for (ItemCat itemCat3 : itemCatList3) { itemCatDataList3.add("/products/" + itemCat3.getId() + ".html|" + itemCat3.getName()); } } } if (result.getItemCats().size()>=14){ break; } } // 将result存储到redis中 try { redisService.set(ITEM_CAT_KEY,mapper.writeValueAsString(result),ITEM_CAT_KEY_TIME); } catch (JsonProcessingException e) { e.printStackTrace(); } return result; } }
[ "lovestoplove@163.com" ]
lovestoplove@163.com
36534b25744d8c89af9706c90f7492e5f9667e92
c605b9ba733efad610158c17aa5fa16b84d358a7
/src/main/java/word_count/utilities/GroupCountBuffer.java
26d833e0a0e1ae35259182b0f76ea21ee65e8a18
[]
no_license
arjungautam1/Cascading
f6c4b78b07e6e6151102dd0eca472580c5d723d7
3f429fd136b35b27bd1a20aa2553c5e96f6bc14b
refs/heads/master
2023-08-21T20:07:32.173636
2021-09-25T06:12:54
2021-09-25T06:12:54
408,323,511
1
0
null
null
null
null
UTF-8
Java
false
false
1,189
java
/** * Created By Arjun Gautam * Date :21/09/2021 * Time :12:28 * Project Name :CustomFilterCascading */ package word_count.utilities; import cascading.flow.FlowProcess; import cascading.operation.BaseOperation; import cascading.operation.Buffer; import cascading.operation.BufferCall; import cascading.tuple.Fields; import cascading.tuple.TupleEntry; import java.util.Iterator; public class GroupCountBuffer extends BaseOperation implements Buffer { public GroupCountBuffer() { super(Fields.ARGS); } @Override public void operate(FlowProcess flowProcess, BufferCall bufferCall) { Iterator<TupleEntry> tupleEntryIterator = bufferCall.getArgumentsIterator(); TupleEntry tuple = new TupleEntry(tupleEntryIterator.next()); tuple.setString("count", counter(tupleEntryIterator).toString()); bufferCall.getOutputCollector().add(tuple); } //count the size of grouped tuples private Long counter(Iterator iterator) { Long i = 1l; //first iteration was made while crating tuple from TupleEntry while (iterator.hasNext()) { i++; iterator.next(); } return i; } }
[ "arjungautam5431@gmail.com" ]
arjungautam5431@gmail.com
b360cda8eca99f4c7c846300b20ddff1ac514afb
552b65b6d6677161601ae58e4f422322149555d2
/src/Practice/Test1.java
508b5b81d0113145ca53420389ba2520dbe0fb1f
[]
no_license
JanHezz/lanqiao
88917d245d12322e40ffd394c499635e206e8c57
cc7c6deddeb851869decfa791e9680c16d6247c9
refs/heads/master
2020-06-02T14:36:03.248045
2019-06-10T15:11:10
2019-06-10T15:11:10
191,190,809
0
0
null
null
null
null
GB18030
Java
false
false
386
java
package Practice; import java.util.Scanner; class Test1 { public static void main(String[] args) { Scanner input=new Scanner(System.in); System.out.println("请输入一个整数"); int n=input.nextInt(); int m=10007; int a1=1,a2=1; int sum=0; for(int i=1;i<=n;i++) { sum=a1%m; int temp=a2; a2=(a1+a2)%m; a1=temp; } System.out.println(sum); } }
[ "975532442@qq.com" ]
975532442@qq.com
5cdb698560a1d1d6cf31c70ccdaff1d6c8394820
e7253dafc6ad1767664212897b23890d67fee267
/src/main/java/lee/study/proxyee/crt/CertUtil.java
5b16e1db5c39a1a87dce21ae23194ad34b9f33e5
[ "MIT" ]
permissive
lingh0205/proxy
b68a8da249aaf5c10259d1eecdf2758767eaeeac
ddf6a01e1d9e780c3ff598e45422c5fb1a9c2646
refs/heads/master
2020-03-12T04:18:36.601758
2018-08-30T10:59:55
2018-08-30T10:59:55
130,442,709
2
1
null
null
null
null
UTF-8
Java
false
false
7,646
java
package lee.study.proxyee.crt; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import java.math.BigInteger; import java.net.URI; import java.nio.file.Files; import java.nio.file.Paths; import java.security.KeyFactory; import java.security.KeyPair; import java.security.KeyPairGenerator; import java.security.NoSuchAlgorithmException; import java.security.PrivateKey; import java.security.PublicKey; import java.security.SecureRandom; import java.security.Security; import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; import java.security.spec.EncodedKeySpec; import java.security.spec.PKCS8EncodedKeySpec; import java.security.spec.X509EncodedKeySpec; import java.util.Arrays; import java.util.Date; import java.util.List; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; import java.util.stream.IntStream; import org.bouncycastle.asn1.x500.X500Name; import org.bouncycastle.asn1.x509.BasicConstraints; import org.bouncycastle.asn1.x509.Extension; import org.bouncycastle.asn1.x509.GeneralName; import org.bouncycastle.asn1.x509.GeneralNames; import org.bouncycastle.cert.jcajce.JcaX509CertificateConverter; import org.bouncycastle.cert.jcajce.JcaX509v3CertificateBuilder; import org.bouncycastle.jce.provider.BouncyCastleProvider; import org.bouncycastle.operator.ContentSigner; import org.bouncycastle.operator.jcajce.JcaContentSignerBuilder; public class CertUtil { private static KeyFactory keyFactory = null; static { Security.addProvider(new BouncyCastleProvider()); } private static KeyFactory getKeyFactory() throws NoSuchAlgorithmException { if (keyFactory == null) { keyFactory = KeyFactory.getInstance("RSA"); } return keyFactory; } /** */ public static KeyPair genKeyPair() throws Exception { KeyPairGenerator caKeyPairGen = KeyPairGenerator.getInstance("RSA", "BC"); caKeyPairGen.initialize(2048, new SecureRandom()); return caKeyPairGen.genKeyPair(); } /** * ca_private.der */ public static PrivateKey loadPriKey(byte[] bts) throws Exception { EncodedKeySpec privateKeySpec = new PKCS8EncodedKeySpec(bts); return getKeyFactory().generatePrivate(privateKeySpec); } /** * ca_private.der */ public static PrivateKey loadPriKey(String path) throws Exception { return loadPriKey(Files.readAllBytes(Paths.get(path))); } /** * ca_private.der */ public static PrivateKey loadPriKey(URI uri) throws Exception { return loadPriKey(Paths.get(uri).toString()); } /** * ca_private.der */ public static PrivateKey loadPriKey(InputStream inputStream) throws Exception { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); byte[] bts = new byte[1024]; int len; while ((len = inputStream.read(bts)) != -1) { outputStream.write(bts, 0, len); } inputStream.close(); outputStream.close(); return loadPriKey(outputStream.toByteArray()); } /** */ public static PublicKey loadPubKey(byte[] bts) throws Exception { EncodedKeySpec publicKeySpec = new X509EncodedKeySpec(bts); return getKeyFactory().generatePublic(publicKeySpec); } /** */ public static PublicKey loadPubKey(String path) throws Exception { EncodedKeySpec publicKeySpec = new X509EncodedKeySpec(Files.readAllBytes(Paths.get(path))); return getKeyFactory().generatePublic(publicKeySpec); } /** */ public static PublicKey loadPubKey(URI uri) throws Exception { return loadPubKey(Paths.get(uri).toString()); } /** */ public static PublicKey loadPubKey(InputStream inputStream) throws Exception { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); byte[] bts = new byte[1024]; int len; while ((len = inputStream.read(bts)) != -1) { outputStream.write(bts, 0, len); } inputStream.close(); outputStream.close(); return loadPubKey(outputStream.toByteArray()); } /** */ public static X509Certificate loadCert(InputStream inputStream) throws Exception { CertificateFactory cf = CertificateFactory.getInstance("X.509"); return (X509Certificate) cf.generateCertificate(inputStream); } /** */ public static X509Certificate loadCert(String path) throws Exception { return loadCert(new FileInputStream(path)); } /** */ public static X509Certificate loadCert(URI uri) throws Exception { return loadCert(Paths.get(uri).toString()); } /** */ public static String getSubject(InputStream inputStream) throws Exception { X509Certificate certificate = loadCert(inputStream); List<String> tempList = Arrays.asList(certificate.getIssuerDN().toString().split(", ")); return IntStream.rangeClosed(0, tempList.size() - 1) .mapToObj(i -> tempList.get(tempList.size() - i - 1)).collect(Collectors.joining(", ")); } /** */ public static String getSubject(X509Certificate certificate) throws Exception { List<String> tempList = Arrays.asList(certificate.getIssuerDN().toString().split(", ")); return IntStream.rangeClosed(0, tempList.size() - 1) .mapToObj(i -> tempList.get(tempList.size() - i - 1)).collect(Collectors.joining(", ")); } /** * */ public static X509Certificate genCert(String issuer, PrivateKey caPriKey, Date caNotBefore, Date caNotAfter, PublicKey serverPubKey, String... hosts) throws Exception { String subject = "C=CN, ST=GD, L=SZ, O=lee, OU=study, CN=" + hosts[0]; JcaX509v3CertificateBuilder jv3Builder = new JcaX509v3CertificateBuilder(new X500Name(issuer), BigInteger.valueOf(System.currentTimeMillis() + (long) (Math.random() * 10000) + 1000), caNotBefore, caNotAfter, new X500Name(subject), serverPubKey); GeneralName[] generalNames = new GeneralName[hosts.length]; for (int i = 0; i < hosts.length; i++) { generalNames[i] = new GeneralName(GeneralName.dNSName, hosts[i]); } GeneralNames subjectAltName = new GeneralNames(generalNames); jv3Builder.addExtension(Extension.subjectAlternativeName, false, subjectAltName); ContentSigner signer = new JcaContentSignerBuilder("SHA256WithRSAEncryption").build(caPriKey); return new JcaX509CertificateConverter().getCertificate(jv3Builder.build(signer)); } /** */ public static X509Certificate genCACert(String subject, Date caNotBefore, Date caNotAfter, KeyPair keyPair) throws Exception { JcaX509v3CertificateBuilder jv3Builder = new JcaX509v3CertificateBuilder(new X500Name(subject), BigInteger.valueOf(System.currentTimeMillis() + (long) (Math.random() * 10000) + 1000), caNotBefore, caNotAfter, new X500Name(subject), keyPair.getPublic()); jv3Builder.addExtension(Extension.basicConstraints, true, new BasicConstraints(0)); ContentSigner signer = new JcaContentSignerBuilder("SHA256WithRSAEncryption") .build(keyPair.getPrivate()); return new JcaX509CertificateConverter().getCertificate(jv3Builder.build(signer)); } public static void main(String[] args) throws Exception { KeyPair keyPair = CertUtil.genKeyPair(); File caCertFile = new File("e:/ssl/Proxyee.crt"); if(caCertFile.exists()){ caCertFile.delete(); } Files.write(Paths.get(caCertFile.toURI()), CertUtil.genCACert( "C=CN, ST=GD, L=SZ, O=lee, OU=study, CN=Proxyee", new Date(), new Date(System.currentTimeMillis() + TimeUnit.DAYS.toMillis(3650)), keyPair) .getEncoded()); } }
[ "wb-lgh204255@alibaba-inc.com" ]
wb-lgh204255@alibaba-inc.com
e6e90b74e536581229b988f16f1e93d487c4a500
fbece9766e999d6d569051075b218ac8c434b61f
/carpark-api/src/main/java/com/carpark/rest/MigrateRestController.java
a1533afa21cfc94209ad1e67d75cee52a610c07e
[]
no_license
vtnhanhcmus/carpark
b7bf3fd77eabcf6d33c0dfcf24e3711900132e3b
6d9996261f98ec09170ca6f6556ffc34eb570cfd
refs/heads/master
2020-08-08T01:04:57.735232
2019-10-14T20:26:05
2019-10-14T20:26:05
213,651,106
2
0
null
2019-10-14T13:26:50
2019-10-08T13:36:06
Java
UTF-8
Java
false
false
1,253
java
package com.carpark.rest; import com.carpark.rest.externalapis.DataSetCarParkApi; import com.carpark.rest.response.json.SuccessJson; import com.carpark.services.DummyService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; import java.io.IOException; @RestController @RequestMapping("api/migrate") public class MigrateRestController { @Autowired private DummyService dummyService; @Autowired private DataSetCarParkApi dataSetCarParkApi; @Autowired private Environment env; @GetMapping(value = "/dummy", produces = "application/json") @ResponseStatus(HttpStatus.CREATED) public ResponseEntity dummy() throws IOException { dummyService.dummy(env.getProperty("path.csv.cark.park")); dataSetCarParkApi.convertLocation(); return ResponseEntity.ok().body(new SuccessJson(true)); } }
[ "vtnhanhcmus@gmail.com" ]
vtnhanhcmus@gmail.com
b940d45392defadab96943e6345d5a57f7c9f682
08bccffb260f654a6f7198ac2fc96eaf3049e79e
/src/gameoffours/Level.java
8e2e4009a44061b068144c8425620d31c5d933e5
[]
no_license
Qblack/GameOf4s
6f56edd76cd4ea2dcf279b4ad3d5934f7df78286
b2812ea4cab053631dbca1d79b6bd90fd781a3cc
refs/heads/master
2020-05-18T16:05:36.265634
2013-09-29T00:28:34
2013-09-29T00:28:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
212
java
package gameoffours; public interface Level { public abstract boolean IsSolved(); public abstract float GetValue(); public abstract int GetDifficulty(); public abstract void SetSolved(boolean solved); }
[ "blac2410@mylaurier.ca" ]
blac2410@mylaurier.ca
f6e3d5005187e8b06df6e5e1c2fbe59e6a9fec00
bbe10639bb9c8f32422122c993530959534560e1
/delivery/app-release_source_from_JADX/com/google/android/gms/games/internal/game/GameBadgeBuffer.java
de3b352db518054673efa5605798bbf0744e3ed0
[ "Apache-2.0" ]
permissive
ANDROFAST/delivery_articulos
dae74482e41b459963186b6e7e3d6553999c5706
ddcc8b06d7ea2895ccda2e13c179c658703fec96
refs/heads/master
2020-04-07T15:13:18.470392
2018-11-21T02:15:19
2018-11-21T02:15:19
158,476,390
0
0
null
null
null
null
UTF-8
Java
false
false
362
java
package com.google.android.gms.games.internal.game; import com.google.android.gms.common.data.AbstractDataBuffer; public final class GameBadgeBuffer extends AbstractDataBuffer<GameBadge> { public /* synthetic */ Object get(int x0) { return zzgq(x0); } public GameBadge zzgq(int i) { return new GameBadgeRef(this.zzafC, i); } }
[ "cespedessanchezalex@gmail.com" ]
cespedessanchezalex@gmail.com
adcbe75301fd1e99c7cfaf0b08afcc516ce6bf32
a663acbb6e533a3674e5083147a089db6564115c
/semi/src/servlet/Cud_servlet.java
64f837eda17222ec9f6760ba2ad46afd802c0f70
[]
no_license
minjminj/MjPractice
e0dd409c2782f64cb456fe6c4dfe864aa9826b8a
73483419b8baa5f15ca43d67c203699112f96fa9
refs/heads/master
2020-03-29T16:16:42.952552
2018-09-24T14:37:57
2018-09-24T14:37:57
150,106,731
0
0
null
null
null
null
UTF-8
Java
false
false
5,184
java
package servlet; import java.io.IOException; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import bean.Cud_dao; import bean.Cud_vo; public class Cud_servlet extends HttpServlet{ String index = "index.jsp?content="; String content = ""; String msg = ""; Cud_dao dao = new Cud_dao(); @Override public void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { req.setCharacterEncoding("utf-8"); resp.setCharacterEncoding("text/html;charset=utf-8"); String temp = req.getServletPath(); String url = temp.substring(1, temp.indexOf(".")); switch(url) { case "register": register(req, resp); content = "member/register.jsp"; break; case "registerR": registerR(req, resp); content = "member/register_result.jsp"; break; case "login": login(req, resp); break; case "logout": logout(req, resp); break; case "forgitId": forgitId(req, resp); break; case "forgitPwd": forgitPwd(req, resp); break; } req.setAttribute("content", content); req.setAttribute("msg", msg); RequestDispatcher disp = req.getRequestDispatcher(index + content); disp.forward(req, resp); } public void register(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { } public void registerR(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { Cud_vo v = setVo(req); if (dao.insert(v)) { msg = "가입이 완료되었습니다."; return; } else { msg = "회원 가입이 정상적으로 완료되지 않았습니다."; return; } } //로그인 데이터가 올라왔을 때 처리 public void login(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { System.out.println("qqqqqqqqqqqqqqqq"); Cud_dao cud_dao = new Cud_dao(); HttpSession session = req.getSession(); String id = req.getParameter("cud_id").trim(); String pwd = req.getParameter("cud_pwd").trim(); System.out.println("id =" + id); System.out.println("pwd =" + pwd); // DAO의 login메소드로 사용자가 입력한 로그인 정보 인자로 보내고 결과를 vo에 담음 Cud_vo vo = cud_dao.login(id, pwd); // id와 pwd의 정보를 db 쿼리문으로 체킹하여 vo에 값을 넣었는데 vo에 값이 들어있지 않다면 쿼리결과가 없다는 뜻이므로 로그인 실패, 결과 값이 있을 시 세션add if (vo.getCud_id() != null && vo.getCud_id() != "") { System.out.println("true = " + vo.getCud_id()); session.setAttribute("vo", vo); // login.jsp 이전 페이지 url을 받아와서 다시 돌아가기 String refer = req.getParameter("referrer"); String urla = refer.substring(refer.indexOf("semi/") + 5); if(refer!=null) { index = urla; } } else { System.out.println("else = " + vo.getCud_id()); msg = "아이디 또는 암호가 잘못 되었습니다"; content = "member/login.jsp"; } } // 로그아웃이 작동하였을 시 모든 세션을 지워버림 private void logout(HttpServletRequest req, HttpServletResponse resp) { HttpSession session = req.getSession(); session.invalidate(); index = "index.jsp"; content = ""; } // 아이디를를 잃어버렸을 때 public void forgitId(HttpServletRequest req, HttpServletResponse resp) { Cud_dao dao = new Cud_dao(); String cud_name = req.getParameter("cud_name"), cud_phone = req.getParameter("cud_phone"); System.out.println("cud_name = " + cud_name); System.out.println("cud_phone = " + cud_phone); String forgitId = dao.forgitId(cud_name, cud_phone); req.setAttribute("forgitId", forgitId); index = "indexHead.jsp?content="; content = "member/idForgit.jsp"; } // 비밀번호를 잃어버렸을 때 public void forgitPwd(HttpServletRequest req, HttpServletResponse resp) { String cud_id = req.getParameter("cud_id"), cud_pwdchk = req.getParameter("cud_pwdchk"), cud_pwdans = req.getParameter("cud_pwdans"); System.out.println("cud_id = " + cud_id); System.out.println("cud_pwdchk = " + cud_pwdchk); System.out.println("cud_pwdans = " + cud_pwdans); String forgitPwd = dao.forgitPwd(cud_id, cud_pwdchk, cud_pwdans); req.setAttribute("forgitPwd", forgitPwd); index = "indexHead.jsp?content="; content = "member/pwdForgit.jsp"; } // 공용 setVo public Cud_vo setVo(HttpServletRequest req) { Cud_vo v = new Cud_vo(); v.setCud_id(req.getParameter("cud_id")); v.setCud_name(req.getParameter("cud_name")); v.setCud_pwd(req.getParameter("cud_pwd")); v.setCud_pwdchk(req.getParameter("cud_pwdchk")); v.setCud_pwdans(req.getParameter("cud_pwdans")); v.setCud_phone(req.getParameter("cud_phone")); return v; } }
[ "MinJeong@MinJeong-PC" ]
MinJeong@MinJeong-PC
b24fffbf1cb7cad7e5c15b4d9313ea91b9f44588
394deda396861849b2d71b48baee0a1b73046899
/src/test/java/org/example/TransactionTest.java
2467e44b2bea9f0c4acd7ccadd5814c099b4c534
[ "Apache-2.0" ]
permissive
luramarchanjo/poc-map-struct
47642ce4374938fada2b3d8cb6384240082bc1ec
728340f1d25c348c00534c9ce5ee8c40e437cfda
refs/heads/master
2022-12-02T12:52:15.189400
2020-08-10T12:22:14
2020-08-10T12:22:14
286,230,413
1
0
null
null
null
null
UTF-8
Java
false
false
1,643
java
package org.example; import junit.framework.TestCase; import org.junit.Test; import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.List; import java.util.Map; public class TransactionTest extends TestCase { @Test public void testMapper() { CreateTransactionRequest request = CreateTransactionRequest.builder() .type(TransactionType.PURCHASE) .cardNumber("9999 8888 7777 6666") .terminal("POS-000001") .merchant("MACDONALDS-0000001") .amount(BigDecimal.valueOf(55.43)) .date(LocalDateTime.of(2020, 8, 9, 9, 45)) .ips(List.of("127.0.0.1, 192.168.0.1, 0.0.0.0")) .headers(Map.of("content-type", "application/json")) .build(); TransactionMapper transactionMapper = new TransactionMapperImpl(); Transaction transaction = transactionMapper.requestToTransaction(request); assertEquals(transaction.getType(), request.getType()); assertEquals(transaction.getCard(), request.getCardNumber()); assertEquals(transaction.getTerminalId(), request.getTerminal()); assertEquals(transaction.getMerchantId(), request.getMerchant()); assertEquals(transaction.getAmount(), request.getAmount().doubleValue()); assertEquals(transaction.getMerchantDate(), request.getDate()); assertEquals(transaction.getIps(), request.getIps()); assertEquals(transaction.getHeaders(), request.getHeaders()); assertNotNull(transaction.getSystemDate()); assertNotNull(transaction.getId()); } }
[ "luram.archanjo@hotmail.com.br" ]
luram.archanjo@hotmail.com.br
381494b260e63ec8bda893023ff1fef9b5d0b947
84197a7b9b37c832d7b18a84fff4cbd6f6ac443f
/xsh/activity/src/main/java/com/xsh/activity/utils/Base64Utils.java
97268d3899f7b4ee175a8b87a7ecda26b0e4d9dd
[]
no_license
dengboyu/graduation
999663d3f98f3625f32ff3c3298b5694b2a8c641
eb74c171c75dd25106b59a32631cc54595a97d02
refs/heads/master
2021-05-12T18:58:33.784474
2018-05-25T15:18:46
2018-05-25T15:18:46
117,073,796
4
0
null
null
null
null
UTF-8
Java
false
false
2,461
java
package com.xsh.activity.utils; import com.xsh.activity.common.sysconstant.Constants ; import org.apache.commons.codec.binary.Base64; import sun.misc.BASE64Decoder; import sun.misc.BASE64Encoder; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; /** * Created by zeal on 2015-09-03. */ public class Base64Utils { /** * 将文件转成base64 字符串 * @param path * @return * * @throws Exception */ public static String encodeBase64File(String path) throws Exception { File file = new File(path); FileInputStream inputFile = new FileInputStream(file); byte[] buffer = new byte[(int) file.length()]; inputFile.read(buffer); inputFile.close(); return new BASE64Encoder().encode(buffer); } /** * 将base64字符解码保存文件 * @param base64Code * @param targetPath * @throws Exception */ public static void decodeBase64File(String base64Code, String targetPath) throws Exception { byte[] buffer = new BASE64Decoder().decodeBuffer(base64Code); FileOutputStream out = new FileOutputStream(targetPath); out.write(buffer); out.close(); } /** * 将base64字符转换成二进制数据 * @param base64Code * @throws Exception */ public static byte[] toByteArray(String base64Code) throws Exception { if(base64Code==null) return null; byte[] buffer = new BASE64Decoder().decodeBuffer(base64Code); return buffer; } /** * 将base64字符保存到文本文件 * @param base64Code * @param targetPath * @throws Exception */ public static void toTxtFile(String base64Code, String targetPath) throws Exception { byte[] buffer = base64Code.getBytes(); FileOutputStream out = new FileOutputStream(targetPath); out.write(buffer); out.close(); } /** * 将字符串编码为base64编码 * @author by@Deng * @date 2017/10/15 下午11:15 */ public static String convert(String str) { byte[] value; try { value = str.getBytes(Constants.DEFAULTCHARSET); return new String(Base64.encodeBase64(value),Constants.DEFAULTCHARSET); } catch (Exception e) { e.printStackTrace(); } return null; } }
[ "by6886432@163.com" ]
by6886432@163.com
93eab96295cf59504558878de910e7762d342003
c75c482bae31cc70e4cb8abf35ee6af2e7ad2fca
/Proyecto_integrador/src/controlador/CVPrincipal.java
212f66b28677c0add9d0276f67bdc2c05316d109
[]
no_license
javiermiok/Proyecto_Integrador
fb78b917717c4b08d15d18b00c12544092b76178
492e8028f36e8d8fcb7f569606ee30ccb3d6dbe5
refs/heads/master
2020-03-17T09:23:11.183132
2018-05-24T11:28:01
2018-05-24T11:28:01
133,399,623
0
0
null
null
null
null
ISO-8859-1
Java
false
false
2,770
java
package controlador; import java.awt.event.ActionEvent; import vista.VentanaPrincipal; import vista.ProyectoIntegrador.PProyIntegConsModificar; import vista.ProyectoIntegrador.PProyIntegConsulta; import vista.ProyectoIntegrador.PProyIntegCrear; import vista.ProyectoIntegrador.PProyIntegEliminar; public class CVPrincipal implements ControladorPadre { public static final String P_CREATE="P_C"; public static final String P_MOD="P_M"; public static final String P_DEL="P_D"; public static final String P_CONS="P_CONS"; public static final String AREA_CREATE="AR_C"; public static final String AREA_MOD="AR_M"; public static final String AREA_DEL="AR_D"; public static final String ALUMNO_CREATE="AL_C"; public static final String ALUMNO_MOD="AL_M"; public static final String ALUMNO_DEL="AL_D"; private VentanaPrincipal vp; private PProyIntegCrear pCrear; private PProyIntegConsModificar pConsModificar; private PProyIntegEliminar pEliminar; private PProyIntegConsulta pConsulta; //TODO Ricardo Añadir paneles Áreas //TODO Gonzalo Añadir paneles alumnos public CVPrincipal(VentanaPrincipal vp) { this.vp=vp; } public void setpCrear(PProyIntegCrear pCrear) { this.pCrear = pCrear; } public void setpConsModificar(PProyIntegConsModificar pConsModificar) { this.pConsModificar = pConsModificar; } public void setpEliminar(PProyIntegEliminar pEliminar) { this.pEliminar = pEliminar; } public void setpConsulta(PProyIntegConsulta pConsulta) { this.pConsulta = pConsulta; } //TODO Ricardo Añadir setters de paneles Áreas //TODO Gonzalo Añadir setters de paneles alumnos /** * Administra las opciones del menú * Asigna el panel de la opción a la ventana principal */ @Override public void actionPerformed(ActionEvent e) { switch(e.getActionCommand()) { case P_CREATE: vp.setPanelCentral(pCrear); break; case P_MOD: vp.setPanelCentral(pConsModificar); break; case P_DEL: vp.setPanelCentral(pEliminar); break; case P_CONS: vp.setPanelCentral(pConsulta); break; case AREA_CREATE: // TODO Ricardo activar el panel crear_area break; case AREA_MOD: // TODO Ricardo activar el panel modificar_area break; case AREA_DEL: // TODO Ricardo activar el panel eliminar_area break; case ALUMNO_CREATE: // TODO Gonzalo activar el panel crear_alumno break; case ALUMNO_MOD: // TODO Gonzalo activar el panel modificar_alumno break; case ALUMNO_DEL: // TODO Gonzalo activar el panel eliminar_alumno break; default: ; }//fin switch }//fin actionPerformed() }//fin de la clase
[ "21752434@N207-13.alumnos.uem.es" ]
21752434@N207-13.alumnos.uem.es
f7f3c64091876d966c710cdcf27b277c73d9c3f1
29890f4d3d7458d1ac9683fcbfde91fa35c09cfe
/kernel-common/kernel-common-security/src/main/java/org/springframework/cloud/openfeign/KernelHystrixFeignTargeterConfiguration.java
8675e231ae9035a3ecf3c7b80b1bc64c31ce3967
[]
no_license
funySunny/kernel
95a4088b5f2480cef8a8519216de40afed9a7b37
9ce2d168695caa432abbe1e33312c604a687657a
refs/heads/master
2020-08-30T00:48:46.082561
2019-09-27T03:28:09
2019-09-27T03:28:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,542
java
/* * Copyright (c) 2018-2025, lengleng All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the pig4cloud.com developer nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * Author: lengleng (wangiegie@gmail.com) */ package org.springframework.cloud.openfeign; import feign.hystrix.HystrixFeign; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Primary; /** * @author lengleng * <p> * HystrixFeignTargeter 配置 */ @Configuration @ConditionalOnClass(HystrixFeign.class) @ConditionalOnProperty("feign.hystrix.enabled") public class KernelHystrixFeignTargeterConfiguration { @Bean @Primary public Targeter pigxFeignTargeter() { return new KernelHystrixTargeter(); } }
[ "mayu@zytcft.com" ]
mayu@zytcft.com
b9d09cdfef8d4e5f36737b80e5fe87590dc93ddc
2cf3b3ea49e95323180f0f48981c1c165aab18f9
/src/main/java/no/emagnus/ulurulib/EvaluationResult.java
c9e5d2fa1f88a68be52c19e1dc2238bafc6a86e3
[]
no_license
emagnus/ulurulib
6ae694c29ad8510388bbc6bd5ff8cd82063a6310
495061ce5c7b3a0c2655dd76f2727c3592eb8760
refs/heads/master
2021-01-17T12:10:23.248719
2014-10-12T19:57:45
2014-10-12T19:57:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,653
java
package no.emagnus.ulurulib; import java.util.List; import no.emagnus.ulurulib.conditions.Condition; public class EvaluationResult { private List<Condition> conditionsMet; private List<Condition> conditionsNotMet; private List<Condition> conditionsNA; public EvaluationResult(List<Condition> conditionsMet, List<Condition> conditionsNotMet, List<Condition> conditionsNA) { this.conditionsMet = conditionsMet; this.conditionsNotMet = conditionsNotMet; this.conditionsNA = conditionsNA; } public List<Condition> getConditionsMet() { return conditionsMet; } public List<Condition> getConditionsNotMet() { return conditionsNotMet; } public List<Condition> getConditionsNA() { return conditionsNA; } public int getNumberOfConditionsMet() { return conditionsMet.size(); } public int getNumberOfConditionsNotMet() { return conditionsNotMet.size() + conditionsNA.size(); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("Conditions met: \n"); for (Condition condition : conditionsMet) { sb.append(condition); sb.append("\n"); } sb.append(String.format("Total: %d\n", getNumberOfConditionsMet())); sb.append("\nConditions not met: \n"); for (Condition condition : conditionsNotMet) { sb.append(condition); sb.append("\n"); } sb.append("\nConditions not applied: \n"); for (Condition condition : conditionsNA) { sb.append(condition); sb.append("\n"); } sb.append(String.format("Total: %d\n", getNumberOfConditionsNotMet())); return sb.toString(); } }
[ "westerga@gmail.com" ]
westerga@gmail.com
00d9e2e6ceda330c020ae315182ca07f44d7afac
c4345a57b39276b6c4515503aadfd70f34546de4
/dubbo-sample/dubbo-sample-consumer/src/test/java/com/europe/england/dubbo/sample/consumer/user/service/UserServiceTest.java
279bdea74efa5245e9e8c58bed3a7cea1027709a
[ "Apache-2.0" ]
permissive
xueqinghua/dubbox-sample
dfbc57af5f056f0a3dd1e06215731ea106d8013e
68517eea0dbcc39dd284c9d40bd4d1ea21d23d4f
refs/heads/master
2021-01-18T15:37:19.413518
2017-04-01T08:21:45
2017-04-01T08:21:45
86,663,660
0
0
null
null
null
null
UTF-8
Java
false
false
1,259
java
package com.europe.england.dubbo.sample.consumer.user.service; import java.util.ArrayList; import java.util.List; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import com.alibaba.dubbo.config.annotation.Reference; import com.europe.england.dubbo.sample.api.user.service.UserService; @RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest public class UserServiceTest { @Reference private UserService userService; @Test public void test() throws Exception { final double count = 10000.00; int times = 10; long start = System.nanoTime(); /* for(double i=0;i<count;i++){ userService.get("id_"+i); }*/ long end = System.nanoTime(); List<Thread> threads = new ArrayList<>(); for(int i=0;i<times;i++){ Thread t = new Thread(new Runnable() { @Override public void run() { for(double i=0;i<count;i++){ userService.get("id_"+i); } } }); threads.add(t); t.start(); } for(Thread t:threads){ t.join(); } System.out.println((count*times*1000*1000*1000)/(end-start)); } }
[ "819182529@qq.com" ]
819182529@qq.com
369cdc29987c32742b50c91b0035b3942de2a6f5
9304784c0fea91f2f6a57dfa9f55bee61a852708
/Test1/src/test08/JavaTest8.java
8801eca11669a1e559b45058487fb4d03366f955
[]
no_license
dbwls5573/Java
f8c3127ef8cc6116b6928b8968171522e34e0764
08f8a78309a5b63a216e2fcf67c348f1d5e171c5
refs/heads/master
2023-01-25T05:14:04.481439
2020-11-11T02:55:12
2020-11-11T02:55:12
311,218,194
0
0
null
null
null
null
UTF-8
Java
false
false
320
java
package test08; public class JavaTest8 { public static void main(String[] args) { int n = 5; for(int i = 0 ; i<n ; i++) { for(int j= n-1 ; j>i ; j--) { System.out.print(" "); } for(int j=0 ; j<2*i+1 ; j++) { System.out.print("*"); } System.out.print("\n"); } } }
[ "dbwndbwn5@gmail.com" ]
dbwndbwn5@gmail.com
207c5d99f21885220f6755b41bbeac9b8125fb24
3c668d5701b62a4e018afd8fb068e23303891da9
/src/wavy/util/dsa/Map/Map.java
6906818f344fb3e58d285710e6ddb4bb33659485
[]
no_license
NONO9527/DSALib
d7489aae98c9e5270f320f4776997f4e6d1bbe8c
62de0689d3e8890cb1f99fb596c197811ed0bd03
refs/heads/master
2023-03-16T14:28:51.812132
2018-09-06T10:21:02
2018-09-06T10:21:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
756
java
package wavy.util.dsa.Map; /** * 映射接口 * Created by WavyPeng on 2018/7/16. */ public interface Map<K,V> { /** * 添加元素 * @param key * @param value */ void add(K key, V value); /** * 删除元素 * @param key * @return */ V remove(K key); /** * 判断元素是否存在 * @param key * @return */ boolean contains(K key); /** * 获取元素 * @param key * @return */ V get(K key); /** * 设置元素 * @param key * @param value */ void set(K key, V value); /** * 获取大小 * @return */ int getSize(); /** * 判空 * @return */ boolean isEmpty(); }
[ "w1a9v9y3@gmail.com" ]
w1a9v9y3@gmail.com
38a9ee35d48343b3af9877cd220cf1e5341bb98a
be73270af6be0a811bca4f1710dc6a038e4a8fd2
/crash-reproduction-moho/results/XRENDERING-418-8-14-PESA_II-WeightedSum:TestLen:CallDiversity/org/xwiki/rendering/listener/chaining/AbstractChainingListener_ESTest.java
0225ac1118c55d103c3f400798401060b38feff7
[]
no_license
STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application
cf118b23ecb87a8bf59643e42f7556b521d1f754
3bb39683f9c343b8ec94890a00b8f260d158dfe3
refs/heads/master
2022-07-29T14:44:00.774547
2020-08-10T15:14:49
2020-08-10T15:14:49
285,804,495
0
0
null
null
null
null
UTF-8
Java
false
false
592
java
/* * This file was automatically generated by EvoSuite * Fri Apr 03 01:54:48 UTC 2020 */ package org.xwiki.rendering.listener.chaining; import org.junit.Test; import static org.junit.Assert.*; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.junit.runner.RunWith; @RunWith(EvoRunner.class) @EvoRunnerParameters(useVFS = true, useJEE = true) public class AbstractChainingListener_ESTest extends AbstractChainingListener_ESTest_scaffolding { @Test public void notGeneratedAnyTest() { // EvoSuite did not generate any tests } }
[ "pouria.derakhshanfar@gmail.com" ]
pouria.derakhshanfar@gmail.com
4ab58478ee8ae0b1bf3eb746dccf7ec2e2030a45
4c249b5c6eddd0c3f52db768602a12a98e306ec5
/auto-aid-adviser-user-profile/src/main/java/com/hillel/evo/adviser/repository/CarBrandRepository.java
e64366b0749c3d1be338dfca770ff28e077d958e
[]
no_license
SergeyGr36/Auto-aid-adviser
be591d8735f01e3d1e7b45655f4a73c52864cb26
c97f64d90d4a3ddcfc0c940eb1383524b228d195
refs/heads/master
2020-12-27T20:56:34.223678
2020-03-28T13:02:03
2020-03-28T13:02:03
238,051,135
0
0
null
null
null
null
UTF-8
Java
false
false
461
java
package com.hillel.evo.adviser.repository; import com.hillel.evo.adviser.entity.CarBrand; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; import java.util.Optional; public interface CarBrandRepository extends JpaRepository<CarBrand, Long> { Optional<CarBrand> findByName(String name); Optional<CarBrand> findById(Long id); }
[ "gan30101983@gmail.com" ]
gan30101983@gmail.com
29ec3ada5576c01259494cb2012dd768046ed593
b508f87d88f20a3901e6f1d10522a59a5d8918fc
/src/main/java/com/nibiru/opengldemo/sample7/sample7_10/MyActivity.java
ac59a5d74294c9bbac69155dd80a8ca6ab52c6da
[]
no_license
zkuokuo/OpenGl3ES
692175e07b49e11a3fa59d50ac787d26afeac841
f8c1242b766310c1f6309fe23bf5d832ac13360b
refs/heads/master
2020-05-02T17:27:11.328966
2019-04-10T10:53:26
2019-04-10T10:53:26
178,098,834
0
0
null
null
null
null
UTF-8
Java
false
false
1,438
java
package com.nibiru.opengldemo.sample7.sample7_10; import android.app.Activity; import android.content.pm.ActivityInfo; import android.os.Bundle; import android.view.Window; import android.view.WindowManager; import com.nibiru.opengldemo.utils.Constant; /** * 作者:dick * 公司:nibiru * 时间:2019-04-02 * 描述: */ public class MyActivity extends Activity { private MySurfaceView mGLSurfaceView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //设置为全屏 requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN , WindowManager.LayoutParams.FLAG_FULLSCREEN); //设置为横屏模式 setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); //初始化GLSurfaceView mGLSurfaceView = new MySurfaceView(this); //切换到主界面 setContentView(mGLSurfaceView); mGLSurfaceView.requestFocus();//获取焦点 mGLSurfaceView.setFocusableInTouchMode(true);//设置为可触控 } @Override protected void onResume() { super.onResume(); mGLSurfaceView.onResume(); Constant.threadFlag=true; } @Override protected void onPause() { super.onPause(); mGLSurfaceView.onPause(); Constant.threadFlag=false; } }
[ "1216819573@qq.com" ]
1216819573@qq.com
c2b18365783dd55bd10d0591bc275086e8eca4bc
107c709ce7832452ce5b1512883f346eeb51870a
/Learning System/app/src/main/java/com/example/diptapaul/learningsystem/MyCustomAdapter.java
e23e660d62a0422b7f1819ac63e285090d2ea1c8
[]
no_license
diptapaul/Third-Year-Android-Project
1dbeef14a3cccb3a58e88c65d48900563627c01b
34f3583be6809c9337547d5b6ba3e031a015254b
refs/heads/master
2021-05-05T07:50:17.771776
2018-01-25T09:40:18
2018-01-25T09:40:18
118,890,609
0
0
null
null
null
null
UTF-8
Java
false
false
1,440
java
package com.example.diptapaul.learningsystem; import android.content.ContentValues; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.TextView; /** * Created by Dipta Paul on 5/20/2017. */ public class MyCustomAdapter extends BaseAdapter { String [] name; int [] icon; Context ct; private static LayoutInflater inflater = null; public MyCustomAdapter(Context eng, String[] nameofitem, int[] pic) { name = nameofitem; ct = eng; icon = pic; inflater = (LayoutInflater) ct.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } @Override public int getCount() { return name.length; } @Override public Object getItem(int i) { return i; } @Override public long getItemId(int i) { return i; } public class MyHolder { TextView tv; } @Override public View getView(int i, View view, ViewGroup viewGroup) { MyHolder myh = new MyHolder(); View myView; myView = inflater.inflate(R.layout.listview, null); myh.tv = (TextView) myView.findViewById(R.id.t4); myh.tv.setText(name[i]); myh.tv.setCompoundDrawablesRelativeWithIntrinsicBounds(icon[i], 0, 0, 0); return myView; } }
[ "diptapaul000@gmail.com" ]
diptapaul000@gmail.com
c4c06c95476e556c388c6ce68d6640cff4691c37
f409db203d66f6ee6b33cfde9f6d7fc6c25639b8
/src/test/java/stepDef/CRMTests.java
ad848e4a2c78ecb3a0c723f27d1827fc11b83ee0
[ "Apache-2.0" ]
permissive
alekseyp555/safowebtests
303822e9bb75f4451a616a6cabd029cd0345ae80
6630b07a99a6771a64ef2bd496a38b2264cd5e62
refs/heads/master
2021-10-26T05:44:46.189059
2021-10-07T09:02:43
2021-10-07T09:02:43
154,264,592
0
1
Apache-2.0
2018-10-30T15:27:34
2018-10-23T04:53:54
Java
UTF-8
Java
false
false
11,101
java
package stepDef; import cucumber.api.java.en.Given; import cucumber.api.java.en.Then; import cucumber.api.java.en.When; import io.qameta.allure.Feature; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.testng.annotations.Test; import ru.yandex.qatools.allure.annotations.Description; import java.util.concurrent.TimeUnit; @Description("Проверка модуля CRM") @Feature("Операции") @Test(retryAnalyzer = MyRetry.class) public class CRMTests extends TestBase { private WebDriver driver = app.getDriver(); public CRMTests () throws Throwable { super(); app.login(); driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); Thread.sleep(5000); app.waitForPageLoadComplete(driver); app.selectPusk(); //клик пуск driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); app.selectOperaciy(); //выбрать операции //app.getOperationsHelper().selectOperaciy(); } @Given("^Выбрать модуль CRM$") public void selectCRM() throws InterruptedException { driver.findElement(By.id("ext-comp-1046")).click(); //Клик на CRM driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); //ожидание загрузки страницы Thread.sleep(5000); } @When("^Выбрать настройки$") public void selectSettings() { driver.findElement(By.cssSelector("#settings")).click(); //клик настройки } @Then("^Выбрать пользователи$") public void selectUser() throws InterruptedException { driver.findElement(By.cssSelector("#settingsUsers")).click(); //клик Пользователи driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); //ожидание загрузки страницы Thread.sleep(3000); WebElement element = driver.findElement(By.cssSelector("#crm2-settingsUsers > div > div > div > div > div > div > div:nth-child(5)"));//локатор 5го пользователя System.out.println(element.getText()); //имя 5го пользователя element.click(); //клик на 5го пользователя driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); //ожидание загрузки страницы Thread.sleep(3000); } @Then("^Выбрать настройка обработка заявок по email$") public void selectSettingsQueryByEmail() throws InterruptedException { app.gotoCrmSettings(); driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); //ожидание загрузки страницы driver.findElement(By.cssSelector("#settingsRqsMail")).click(); //клик обработка заявок по email driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); //ожидание загрузки страницы Thread.sleep(5000); driver.findElement(By.name("MAIL_HOST")).click(); } @Then("^Выбрать справочники$") public void selectSpravochniki() { app.gotoCrmSettings(); driver.findElement(By.cssSelector("#settingsDict")).click(); //клик справочники driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); //ожидание загрузки страницы driver.findElement(By.cssSelector("#crm2-settingsDict > div > div > div > div > div > div > div > div > div > div:nth-child(5)")).click(); //клик на 5й элемент driver.findElement(By.xpath("//div[2]/div/div[2]/div/div/div[2]/div/div[5]/table/tbody/tr/td/div")).click(); driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); //ожидание загрузки страницы } @Then("^Выбрать настройки клиентский менеджер$") public void selectClientManager () throws InterruptedException { app.gotoCrmSettings(); driver.findElement(By.cssSelector("#settings_client_manager")).click(); //клик на клиенсткий менеджер Thread.sleep(3000); if (app.isElementVisible("#settings_client_manager > div > div > div > div > div > div > div > div > div > div:nth-child(5)")) driver.findElement(By.cssSelector("#settings_client_manager > div > div > div > div > div > div > div > div > div > div:nth-child(5)")).click(); //выбрать 5й элемент в списке Thread.sleep(2000); } /* @When("^Выбрать ввод заявок, ручной ввод$") public void inputQuery() throws InterruptedException { WebElement inputRequest = driver.findElement(By.cssSelector("#addRequest")); assertEquals(inputRequest.getText(), "Ввод заявок"); System.out.println(inputRequest.getText()); inputRequest.click(); //клик на ввод заявок //driver.findElement(By.cssSelector("#addRequest")).click(); driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); //ожидание загрузки страницы Thread.sleep(5000); } @Then("^Отобразились поля для ввода$") public void mainQueryForm() throws InterruptedException { WebElement actions = driver.findElement(By.cssSelector("#crm2-addRequest > div > div > div > table > tbody > tr > td > table > tbody > tr > td")); //driver.findElement(By.xpath("//div[2]/div/div/div/table/tbody/tr/td/table/tbody/tr/td/table/tbody/tr[2]/td[2]/em/button")).click(); //клик действия System.out.println(actions.getText()); //имя кнопки actions.isDisplayed(); actions.click(); //клик валидный локатор для кнопки "Действия" Thread.sleep(5000); //List<WebElement> li = driver.findElements(By.cssSelector("#ext-comp-7698 > ul > li > a > span")); //List<WebElement> li = driver.findElements(By.xpath("//div[19]/ul/li/a/span")); //li.get(1).click();//If there are only two such element, here 1 is index of 2nd element in list returned. //driver.findElement(By.xpath("//input[2]")).click(); //клик второе поля ввода //driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); //ожидание загрузки страницы //Thread.sleep(5000); } @Then("^Выбрать рабочий список, выбрать 5й элемент$") public void selectWorkQuery() throws InterruptedException { app.startPageOperations(); //возврат на стартовую Thread.sleep(5000); WebElement workRequest = driver.findElement(By.cssSelector("#workList")); //Клик на рабочий список (ххх) System.out.println(workRequest.getText()); workRequest.click(); //клик на ввод заявок driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); //ожидание загрузки страницы Thread.sleep(5000); //driver.findElement(By.xpath("//div[6]/table/tbody/tr/td[3]/div")).click(); //выбрать 6 элемент в списке } */ /* @Then("^Загрузилась информация по заявке$") public void loadedQueryInfo() throws InterruptedException { driver.findElement(By.cssSelector("#crm2-workList-main > div > div > div > div > div > div > div > div:nth-child(5)")).click(); //клик на 5й элемент в таблице driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); //ожидание загрузки страницы Thread.sleep(5000); driver.findElement(By.xpath("//div[2]/div/div/div/div/ul/li/a[2]/em/span/span")).click(); driver.findElement(By.xpath("//div[2]/div/div/div/div/ul/li[2]/a[2]/em/span/span")).click(); driver.findElement(By.xpath("//li[4]/a[2]/em/span/span")).click(); driver.findElement(By.xpath("//li[5]/a[2]/em/span/span")).click(); driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); //ожидание загрузки страницы Thread.sleep(5000); } @Then("^Выбрать заявки в работе, выбрать 5й элемент$") public void selectActiveQueries() throws InterruptedException { app.startPageOperations(); //возврат на стартовую driver.findElement(By.cssSelector("#requestList")).click(); //клик на рабочий список (ххх) driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); //ожидание загрузки страницы Thread.sleep(5000); driver.findElement(By.cssSelector("#crm2-requestList-main > div > div > div > div > div > div > div > div > div:nth-child(5)")).click(); //клик на 5й элемет в таблице driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); //ожидание загрузки страницы Thread.sleep(5000); } */ @Then("^Выбрать отчеты$") public void selectReports() throws InterruptedException { driver.findElement(By.cssSelector("span.x-tab-strip-text.applications-icon-16")).click(); //клик на главную driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); //ожидание загрузки страницы Thread.sleep(2000); driver.findElement(By.cssSelector("#reportPage")).click(); //клик отчеты driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); //ожидание загрузки страницы } @Then("^Загрузились отчеты$") public void loadedQueries() { //driver.findElement(By.xpath("//td/table/tbody[2]/tr/td/a/span")).click(); driver.findElement(By.cssSelector("td > table > tbody:nth-of-type(2) > tr > td > a > span")).click(); //клик на отчет driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); //ожидание загрузки страницы } @Then("^Выбрать руководство пользователя$") public void selectUserManual() { driver.findElement(By.cssSelector("span.x-tab-strip-text.applications-icon-16")).click(); //клик на главную driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); //ожидание загрузки страницы driver.findElement(By.cssSelector("#faqPage")).click(); //клик отчеты driver.findElement(By.cssSelector("#crm2-faqPage > div > div > div > div > div > ul > div > li:nth-child(2)")).click(); //клик на форма рабочий список driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); //ожидание загрузки страницы } }
[ "park.aleksey@gmail.com" ]
park.aleksey@gmail.com
683111d508a88f467a43c112ea1d44adc1e349d6
939723acd81ad9c2c5c58ab85e16f7fbf031ff58
/services_common/java/src/org/alljoyn/common/ServiceAvailabilityListener.java
7dce216e609f4e140f1495126889a4daa1c1a427
[]
no_license
casper-kim/services-base
c13313178c020e84fa3509bd9be5b6d731c95056
fbb04373116d6d59e58081e9bbabe10eed07cc10
refs/heads/master
2020-03-21T04:39:35.707215
2018-04-09T17:55:44
2018-04-09T17:55:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,223
java
/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.common; /** * Listens to connection losses with a peer device */ public interface ServiceAvailabilityListener { /** * Fired when a connection to the peer device was lost. */ public void connectionLost(); }
[ "jarrod@two-bulls.com" ]
jarrod@two-bulls.com
c0c0d29573c2f5d6391920d604a2d99c35314399
b1bb1548fb258db67235571dd40afce59f1535a9
/HomeAutomationDetector/app/src/main/java/com/softwaresolution/homeautomationdetector/env/CameraConnectionFragment.java
8f497d5b1064821131e9c755b7e4cc09a70a2d59
[]
no_license
SalesDomini/HomeAutomationDetector
01fca12a2a8d98b88eeb7569e20a9d284d4fae6e
0d91f7ce29a88b324f104bd67f3e38d6208df2dc
refs/heads/master
2022-04-08T07:21:13.000989
2020-03-12T13:37:18
2020-03-12T13:37:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
21,631
java
package com.softwaresolution.homeautomationdetector.env; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; import android.app.DialogFragment; import android.app.Fragment; import android.content.Context; import android.content.DialogInterface; import android.content.res.Configuration; import android.graphics.ImageFormat; import android.graphics.Matrix; import android.graphics.RectF; import android.graphics.SurfaceTexture; import android.hardware.camera2.CameraAccessException; import android.hardware.camera2.CameraCaptureSession; import android.hardware.camera2.CameraCharacteristics; import android.hardware.camera2.CameraDevice; import android.hardware.camera2.CameraManager; import android.hardware.camera2.CaptureRequest; import android.hardware.camera2.CaptureResult; import android.hardware.camera2.TotalCaptureResult; import android.hardware.camera2.params.StreamConfigurationMap; import android.media.ImageReader; import android.media.ImageReader.OnImageAvailableListener; import android.os.Bundle; import android.os.Handler; import android.os.HandlerThread; import android.text.TextUtils; import android.util.Size; import android.util.SparseIntArray; import android.view.LayoutInflater; import android.view.Surface; import android.view.TextureView; import android.view.View; import android.view.ViewGroup; import android.widget.Toast; import com.softwaresolution.homeautomationdetector.R; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.List; import java.util.concurrent.Semaphore; import java.util.concurrent.TimeUnit; public class CameraConnectionFragment extends Fragment { private static final Logger LOGGER = new Logger(); /** * The camera preview size will be chosen to be the smallest frame by pixel size capable of * containing a DESIRED_SIZE x DESIRED_SIZE square. */ private static final int MINIMUM_PREVIEW_SIZE = 320; /** * Conversion from screen rotation to JPEG orientation. */ private static final SparseIntArray ORIENTATIONS = new SparseIntArray(); private static final String FRAGMENT_DIALOG = "dialog"; static { ORIENTATIONS.append(Surface.ROTATION_0, 90); ORIENTATIONS.append(Surface.ROTATION_90, 0); ORIENTATIONS.append(Surface.ROTATION_180, 270); ORIENTATIONS.append(Surface.ROTATION_270, 180); } /** * {@link TextureView.SurfaceTextureListener} handles several lifecycle events on a * {@link TextureView}. */ private final TextureView.SurfaceTextureListener surfaceTextureListener = new TextureView.SurfaceTextureListener() { @Override public void onSurfaceTextureAvailable( final SurfaceTexture texture, final int width, final int height) { openCamera(width, height); } @Override public void onSurfaceTextureSizeChanged( final SurfaceTexture texture, final int width, final int height) { configureTransform(width, height); } @Override public boolean onSurfaceTextureDestroyed(final SurfaceTexture texture) { return true; } @Override public void onSurfaceTextureUpdated(final SurfaceTexture texture) {} }; /** * Callback for Activities to use to initialize their data once the * selected preview size is known. */ public interface ConnectionCallback { void onPreviewSizeChosen(Size size, int cameraRotation); } /** * ID of the current {@link CameraDevice}. */ private String cameraId; /** * An {@link AutoFitTextureView} for camera preview. */ private AutoFitTextureView textureView; /** * A {@link CameraCaptureSession } for camera preview. */ private CameraCaptureSession captureSession; /** * A reference to the opened {@link CameraDevice}. */ private CameraDevice cameraDevice; /** * The rotation in degrees of the camera sensor from the display. */ private Integer sensorOrientation; /** * The {@link Size} of camera preview. */ private Size previewSize; /** * {@link CameraDevice.StateCallback} * is called when {@link CameraDevice} changes its state. */ private final CameraDevice.StateCallback stateCallback = new CameraDevice.StateCallback() { @Override public void onOpened(final CameraDevice cd) { // This method is called when the camera is opened. We start camera preview here. cameraOpenCloseLock.release(); cameraDevice = cd; createCameraPreviewSession(); } @Override public void onDisconnected(final CameraDevice cd) { cameraOpenCloseLock.release(); cd.close(); cameraDevice = null; } @Override public void onError(final CameraDevice cd, final int error) { cameraOpenCloseLock.release(); cd.close(); cameraDevice = null; final Activity activity = getActivity(); if (null != activity) { activity.finish(); } } }; /** * An additional thread for running tasks that shouldn't block the UI. */ private HandlerThread backgroundThread; /** * A {@link Handler} for running tasks in the background. */ private Handler backgroundHandler; /** * An {@link ImageReader} that handles preview frame capture. */ private ImageReader previewReader; /** * {@link CaptureRequest.Builder} for the camera preview */ private CaptureRequest.Builder previewRequestBuilder; /** * {@link CaptureRequest} generated by {@link #previewRequestBuilder} */ private CaptureRequest previewRequest; /** * A {@link Semaphore} to prevent the app from exiting before closing the camera. */ private final Semaphore cameraOpenCloseLock = new Semaphore(1); /** * A {@link OnImageAvailableListener} to receive frames as they are available. */ private final OnImageAvailableListener imageListener; /** The input size in pixels desired by TensorFlow (width and height of a square bitmap). */ private final Size inputSize; /** * The layout identifier to inflate for this Fragment. */ private final int layout; private final ConnectionCallback cameraConnectionCallback; private CameraConnectionFragment( final ConnectionCallback connectionCallback, final OnImageAvailableListener imageListener, final int layout, final Size inputSize) { this.cameraConnectionCallback = connectionCallback; this.imageListener = imageListener; this.layout = layout; this.inputSize = inputSize; } /** * Shows a {@link Toast} on the UI thread. * * @param text The message to show */ private void showToast(final String text) { final Activity activity = getActivity(); if (activity != null) { activity.runOnUiThread( new Runnable() { @Override public void run() { Toast.makeText(activity, text, Toast.LENGTH_SHORT).show(); } }); } } /** * Given {@code choices} of {@code Size}s supported by a camera, chooses the smallest one whose * width and height are at least as large as the minimum of both, or an exact match if possible. * * @param choices The list of sizes that the camera supports for the intended output class * @param width The minimum desired width * @param height The minimum desired height * @return The optimal {@code Size}, or an arbitrary one if none were big enough */ protected static Size chooseOptimalSize(final Size[] choices, final int width, final int height) { final int minSize = Math.max(Math.min(width, height), MINIMUM_PREVIEW_SIZE); final Size desiredSize = new Size(width, height); // Collect the supported resolutions that are at least as big as the preview Surface boolean exactSizeFound = false; final List<Size> bigEnough = new ArrayList<Size>(); final List<Size> tooSmall = new ArrayList<Size>(); for (final Size option : choices) { if (option.equals(desiredSize)) { // Set the size but don't return yet so that remaining sizes will still be logged. exactSizeFound = true; } if (option.getHeight() >= minSize && option.getWidth() >= minSize) { bigEnough.add(option); } else { tooSmall.add(option); } } LOGGER.i("Desired size: " + desiredSize + ", min size: " + minSize + "x" + minSize); LOGGER.i("Valid preview sizes: [" + TextUtils.join(", ", bigEnough) + "]"); LOGGER.i("Rejected preview sizes: [" + TextUtils.join(", ", tooSmall) + "]"); if (exactSizeFound) { LOGGER.i("Exact size match found."); return desiredSize; } // Pick the smallest of those, assuming we found any if (bigEnough.size() > 0) { final Size chosenSize = Collections.min(bigEnough, new CompareSizesByArea()); LOGGER.i("Chosen size: " + chosenSize.getWidth() + "x" + chosenSize.getHeight()); return chosenSize; } else { LOGGER.e("Couldn't find any suitable preview size"); return choices[0]; } } public static CameraConnectionFragment newInstance( final ConnectionCallback callback, final OnImageAvailableListener imageListener, final int layout, final Size inputSize) { return new CameraConnectionFragment(callback, imageListener, layout, inputSize); } @Override public View onCreateView( final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { return inflater.inflate(layout, container, false); } @Override public void onViewCreated(final View view, final Bundle savedInstanceState) { textureView = (AutoFitTextureView) view.findViewById(R.id.texture); } @Override public void onActivityCreated(final Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); } @Override public void onResume() { super.onResume(); startBackgroundThread(); // When the screen is turned off and turned back on, the SurfaceTexture is already // available, and "onSurfaceTextureAvailable" will not be called. In that case, we can open // a camera and start preview from here (otherwise, we wait until the surface is ready in // the SurfaceTextureListener). if (textureView.isAvailable()) { openCamera(textureView.getWidth(), textureView.getHeight()); } else { textureView.setSurfaceTextureListener(surfaceTextureListener); } } @Override public void onPause() { closeCamera(); stopBackgroundThread(); super.onPause(); } public void setCamera(String cameraId) { this.cameraId = cameraId; } /** * Sets up member variables related to camera. */ private void setUpCameraOutputs() { final Activity activity = getActivity(); final CameraManager manager = (CameraManager) activity.getSystemService(Context.CAMERA_SERVICE); try { final CameraCharacteristics characteristics = manager.getCameraCharacteristics(cameraId); final StreamConfigurationMap map = characteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP); // For still image captures, we use the largest available size. final Size largest = Collections.max( Arrays.asList(map.getOutputSizes(ImageFormat.YUV_420_888)), new CompareSizesByArea()); sensorOrientation = characteristics.get(CameraCharacteristics.SENSOR_ORIENTATION); // Danger, W.R.! Attempting to use too large a preview size could exceed the camera // bus' bandwidth limitation, resulting in gorgeous previews but the storage of // garbage capture data. previewSize = chooseOptimalSize(map.getOutputSizes(SurfaceTexture.class), inputSize.getWidth(), inputSize.getHeight()); // We fit the aspect ratio of TextureView to the size of preview we picked. final int orientation = getResources().getConfiguration().orientation; if (orientation == Configuration.ORIENTATION_LANDSCAPE) { textureView.setAspectRatio(previewSize.getWidth(), previewSize.getHeight()); } else { textureView.setAspectRatio(previewSize.getHeight(), previewSize.getWidth()); } } catch (final CameraAccessException e) { LOGGER.e(e, "Exception!"); } catch (final NullPointerException e) { // Currently an NPE is thrown when the Camera2API is used but not supported on the // device this code runs. // TODO(andrewharp): abstract ErrorDialog/RuntimeException handling out into new method and // reuse throughout app. ErrorDialog.newInstance(getString(R.string.camera_error)) .show(getChildFragmentManager(), FRAGMENT_DIALOG); throw new RuntimeException(getString(R.string.camera_error)); } cameraConnectionCallback.onPreviewSizeChosen(previewSize, sensorOrientation); } /** * Opens the camera specified by {@link CameraConnectionFragment#cameraId}. */ private void openCamera(final int width, final int height) { setUpCameraOutputs(); configureTransform(width, height); final Activity activity = getActivity(); final CameraManager manager = (CameraManager) activity.getSystemService(Context.CAMERA_SERVICE); try { if (!cameraOpenCloseLock.tryAcquire(2500, TimeUnit.MILLISECONDS)) { throw new RuntimeException("Time out waiting to lock camera opening."); } manager.openCamera(cameraId, stateCallback, backgroundHandler); } catch (final CameraAccessException e) { LOGGER.e(e, "Exception!"); } catch (final InterruptedException e) { throw new RuntimeException("Interrupted while trying to lock camera opening.", e); } } /** * Closes the current {@link CameraDevice}. */ private void closeCamera() { try { cameraOpenCloseLock.acquire(); if (null != captureSession) { captureSession.close(); captureSession = null; } if (null != cameraDevice) { cameraDevice.close(); cameraDevice = null; } if (null != previewReader) { previewReader.close(); previewReader = null; } } catch (final InterruptedException e) { throw new RuntimeException("Interrupted while trying to lock camera closing.", e); } finally { cameraOpenCloseLock.release(); } } /** * Starts a background thread and its {@link Handler}. */ private void startBackgroundThread() { backgroundThread = new HandlerThread("ImageListener"); backgroundThread.start(); backgroundHandler = new Handler(backgroundThread.getLooper()); } /** * Stops the background thread and its {@link Handler}. */ private void stopBackgroundThread() { backgroundThread.quitSafely(); try { backgroundThread.join(); backgroundThread = null; backgroundHandler = null; } catch (final InterruptedException e) { LOGGER.e(e, "Exception!"); } } private final CameraCaptureSession.CaptureCallback captureCallback = new CameraCaptureSession.CaptureCallback() { @Override public void onCaptureProgressed( final CameraCaptureSession session, final CaptureRequest request, final CaptureResult partialResult) {} @Override public void onCaptureCompleted( final CameraCaptureSession session, final CaptureRequest request, final TotalCaptureResult result) {} }; /** * Creates a new {@link CameraCaptureSession} for camera preview. */ private void createCameraPreviewSession() { try { final SurfaceTexture texture = textureView.getSurfaceTexture(); assert texture != null; // We configure the size of default buffer to be the size of camera preview we want. texture.setDefaultBufferSize(previewSize.getWidth(), previewSize.getHeight()); // This is the output Surface we need to start preview. final Surface surface = new Surface(texture); // We set up a CaptureRequest.Builder with the output Surface. previewRequestBuilder = cameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW); previewRequestBuilder.addTarget(surface); LOGGER.i("Opening camera preview: " + previewSize.getWidth() + "x" + previewSize.getHeight()); // Create the reader for the preview frames. previewReader = ImageReader.newInstance( previewSize.getWidth(), previewSize.getHeight(), ImageFormat.YUV_420_888, 2); previewReader.setOnImageAvailableListener(imageListener, backgroundHandler); previewRequestBuilder.addTarget(previewReader.getSurface()); // Here, we create a CameraCaptureSession for camera preview. cameraDevice.createCaptureSession( Arrays.asList(surface, previewReader.getSurface()), new CameraCaptureSession.StateCallback() { @Override public void onConfigured(final CameraCaptureSession cameraCaptureSession) { // The camera is already closed if (null == cameraDevice) { return; } // When the session is ready, we start displaying the preview. captureSession = cameraCaptureSession; try { // Auto focus should be continuous for camera preview. previewRequestBuilder.set( CaptureRequest.CONTROL_AF_MODE, CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE); // Flash is automatically enabled when necessary. previewRequestBuilder.set( CaptureRequest.CONTROL_AE_MODE, CaptureRequest.CONTROL_AE_MODE_ON_AUTO_FLASH); // Finally, we start displaying the camera preview. previewRequest = previewRequestBuilder.build(); captureSession.setRepeatingRequest( previewRequest, captureCallback, backgroundHandler); } catch (final CameraAccessException e) { LOGGER.e(e, "Exception!"); } } @Override public void onConfigureFailed(final CameraCaptureSession cameraCaptureSession) { showToast("Failed"); } }, null); } catch (final CameraAccessException e) { LOGGER.e(e, "Exception!"); } } /** * Configures the necessary {@link Matrix} transformation to `mTextureView`. * This method should be called after the camera preview size is determined in * setUpCameraOutputs and also the size of `mTextureView` is fixed. * * @param viewWidth The width of `mTextureView` * @param viewHeight The height of `mTextureView` */ private void configureTransform(final int viewWidth, final int viewHeight) { final Activity activity = getActivity(); if (null == textureView || null == previewSize || null == activity) { return; } final int rotation = activity.getWindowManager().getDefaultDisplay().getRotation(); final Matrix matrix = new Matrix(); final RectF viewRect = new RectF(0, 0, viewWidth, viewHeight); final RectF bufferRect = new RectF(0, 0, previewSize.getHeight(), previewSize.getWidth()); final float centerX = viewRect.centerX(); final float centerY = viewRect.centerY(); if (Surface.ROTATION_90 == rotation || Surface.ROTATION_270 == rotation) { bufferRect.offset(centerX - bufferRect.centerX(), centerY - bufferRect.centerY()); matrix.setRectToRect(viewRect, bufferRect, Matrix.ScaleToFit.FILL); final float scale = Math.max( (float) viewHeight / previewSize.getHeight(), (float) viewWidth / previewSize.getWidth()); matrix.postScale(scale, scale, centerX, centerY); matrix.postRotate(90 * (rotation - 2), centerX, centerY); } else if (Surface.ROTATION_180 == rotation) { matrix.postRotate(180, centerX, centerY); } textureView.setTransform(matrix); } /** * Compares two {@code Size}s based on their areas. */ static class CompareSizesByArea implements Comparator<Size> { @Override public int compare(final Size lhs, final Size rhs) { // We cast here to ensure the multiplications won't overflow return Long.signum( (long) lhs.getWidth() * lhs.getHeight() - (long) rhs.getWidth() * rhs.getHeight()); } } /** * Shows an error message dialog. */ public static class ErrorDialog extends DialogFragment { private static final String ARG_MESSAGE = "message"; public static ErrorDialog newInstance(final String message) { final ErrorDialog dialog = new ErrorDialog(); final Bundle args = new Bundle(); args.putString(ARG_MESSAGE, message); dialog.setArguments(args); return dialog; } @Override public Dialog onCreateDialog(final Bundle savedInstanceState) { final Activity activity = getActivity(); return new AlertDialog.Builder(activity) .setMessage(getArguments().getString(ARG_MESSAGE)) .setPositiveButton( android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialogInterface, final int i) { activity.finish(); } }) .create(); } } }
[ "michaelpuzon06@gmail.com" ]
michaelpuzon06@gmail.com
a906c06389d385e7760727179eaf6017a675e16a
bee4de4cdda2739e0c62f15168b52d089dcee2a0
/src/main/java/com/sop4j/base/apache/compress/archivers/zip/ZipExtraField.java
d89b4057039a20661623acd347d6774796fe70d3
[ "Apache-2.0" ]
permissive
wspeirs/sop4j-base
5be82eafa27bbdb42a039d7642d5efb363de56d0
3640cdd20c5227bafc565c1155de2ff756dca9da
refs/heads/master
2021-01-19T11:29:34.918100
2013-11-27T22:15:26
2013-11-27T22:15:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,969
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 com.sop4j.base.apache.compress.archivers.zip; import java.util.zip.ZipException; /** * General format of extra field data. * * <p>Extra fields usually appear twice per file, once in the local * file data and once in the central directory. Usually they are the * same, but they don't have to be. {@link * java.util.zip.ZipOutputStream java.util.zip.ZipOutputStream} will * only use the local file data in both places.</p> * */ public interface ZipExtraField { /** * The Header-ID. * * @return The HeaderId value */ ZipShort getHeaderId(); /** * Length of the extra field in the local file data - without * Header-ID or length specifier. * @return the length of the field in the local file data */ ZipShort getLocalFileDataLength(); /** * Length of the extra field in the central directory - without * Header-ID or length specifier. * @return the length of the field in the central directory */ ZipShort getCentralDirectoryLength(); /** * The actual data to put into local file data - without Header-ID * or length specifier. * @return the data */ byte[] getLocalFileDataData(); /** * The actual data to put into central directory - without Header-ID or * length specifier. * @return the data */ byte[] getCentralDirectoryData(); /** * Populate data from this array as if it was in local file data. * * @param buffer the buffer to read data from * @param offset offset into buffer to read data * @param length the length of data * @exception ZipException on error */ void parseFromLocalFileData(byte[] buffer, int offset, int length) throws ZipException; /** * Populate data from this array as if it was in central directory data. * * @param buffer the buffer to read data from * @param offset offset into buffer to read data * @param length the length of data * @exception ZipException on error */ void parseFromCentralDirectoryData(byte[] buffer, int offset, int length) throws ZipException; }
[ "bill.speirs@gmail.com" ]
bill.speirs@gmail.com
60c737edf74e9dd82b7b8a4e8e0e7284205d084a
e975ee570579068717e2cd28d14e9c3d5e02cf83
/app/src/main/java/com/example/greaper/mediaplayer/view/ListSongActivity.java
ac9e6e72631a09e1141b29c7a1ce861471d198ce
[]
no_license
GReaper13/My-Playlist
a95d01a26899de2fa9dcf9ca562d3a3e971a40eb
4fba5a51846845d9ed2fca6257e8a778fe04f3fa
refs/heads/master
2021-09-07T15:07:03.798049
2018-02-24T16:30:07
2018-02-24T16:30:07
120,642,804
0
0
null
null
null
null
UTF-8
Java
false
false
5,719
java
package com.example.greaper.mediaplayer.view; import android.Manifest; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.pm.InstrumentationInfo; import android.content.pm.PackageManager; import android.graphics.Color; import android.support.v4.app.ActivityCompat; import android.support.v4.content.ContextCompat; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.ListView; import android.widget.Toast; import com.example.greaper.mediaplayer.R; import com.example.greaper.mediaplayer.controller.AddSongAdapter; import com.example.greaper.mediaplayer.controller.ISong; import com.example.greaper.mediaplayer.controller.ImpAddSong; import com.example.greaper.mediaplayer.controller.SongManager; import com.example.greaper.mediaplayer.database.SongDataSource; import com.example.greaper.mediaplayer.model.AddSongModel; import com.example.greaper.mediaplayer.model.SongModel; import java.util.ArrayList; public class ListSongActivity extends AppCompatActivity implements ImpAddSong, View.OnClickListener { Toolbar toolbar; private ListView lvListSong; private AddSongAdapter addSongAdapter; private ArrayList<AddSongModel> listSong; private SongManager songManager; private SongDataSource songDataSource; private ArrayList<SongModel> listSongInDatabase; private CheckBox checkBoxSelectAll; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_list_song); initViews(); } private void initViews() { initToolbar(); songManager = new SongManager(); listSong = songManager.getSongList(); addSongAdapter = new AddSongAdapter(listSong, this, this); songDataSource = new SongDataSource(this); songDataSource.open(); lvListSong = (ListView) findViewById(R.id.lv_list_song); listSongInDatabase = songDataSource.getCurrentSong(); for (int i = 0; i < listSongInDatabase.size(); i++) { int index = getIndex(listSongInDatabase.get(i).getTitle()); if (index != -1) { listSong.get(index).setSelect(true); } else { Toast.makeText(this, "Somethings was wrong", Toast.LENGTH_SHORT).show(); } } lvListSong.setAdapter(addSongAdapter); lvListSong.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { if (listSong.get(i).isSelect()) { listSong.get(i).setSelect(false); } else { listSong.get(i).setSelect(true); } checkBoxSelectAll.setChecked(isSelectingAll()); addSongAdapter.notifyDataSetChanged(); } }); } private int getIndex(String itemName) { for (int i = 0; i < listSong.size(); i++) { AddSongModel addSongModel = listSong.get(i); if (addSongModel.getTitle().equals(itemName)) { return i; } } return -1; } private void initToolbar() { toolbar = (Toolbar) findViewById(R.id.toobar_list_song); toolbar.setTitleTextColor(Color.BLACK); toolbar.setNavigationIcon(R.drawable.ic_music); toolbar.setTitle("List songs"); setSupportActionBar(toolbar); } @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater menuInflater = getMenuInflater(); menuInflater.inflate(R.menu.add_menu, menu); checkBoxSelectAll = (CheckBox) menu.findItem(R.id.select_all).getActionView(); checkBoxSelectAll.setText(""); checkBoxSelectAll.setChecked(isSelectingAll()); checkBoxSelectAll.setOnClickListener(this); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.add_song: songDataSource.deleteAllSong(); for (int i = 0; i < listSong.size(); i++) { if (listSong.get(i).isSelect()) { AddSongModel add = listSong.get(i); songDataSource.addNewSong(new SongModel(add.getTitle(), add.getPath(), i)); } } songDataSource.close(); Intent intent = new Intent(); setResult(RESULT_OK, intent); finish(); } return true; } @Override protected void onDestroy() { songDataSource.close(); super.onDestroy(); } // check all checkbox is selecting private boolean isSelectingAll() { for (AddSongModel add : listSong) { if (!add.isSelect()) { return false; } } return true; } @Override public void checkCheckBoxSelectAll() { checkBoxSelectAll.setChecked(isSelectingAll()); } @Override public void onClick(View view) { for (AddSongModel addSong : listSong) { addSong.setSelect(checkBoxSelectAll.isChecked()); } addSongAdapter.notifyDataSetChanged(); } }
[ "xavanakhet13@gmail.com" ]
xavanakhet13@gmail.com
a4fd89f5fca294efc70beacb211e37fa7a3def1c
489a5b4ffd1eb11b6599728e758ec3ac981d87fa
/app/src/main/java/com/eficaz_fitbet_android/fitbet/model/ArchivesDetails.java
5b77525920f8576776340c8e5dd13726ea7b4fb5
[]
no_license
eficaz/Fit-Bet-Android
aee69cd162f3890bc36cbe80116036db31dbd210
0478d7cce1aa34a418af4d1151481eb27867637c
refs/heads/master
2020-12-06T13:59:31.903297
2020-01-10T15:22:25
2020-01-10T15:22:25
232,479,752
0
0
null
null
null
null
UTF-8
Java
false
false
4,272
java
package com.eficaz_fitbet_android.fitbet.model; public class ArchivesDetails { String position=""; String reg_key=""; String firstname=""; String email=""; String creditScore=""; String won=""; String lost=""; String country=""; String profile_pic=""; String regType=""; String distance=""; String startdate=""; String positionlongitude=""; String positionlatitude=""; String startlocation=""; String image_status=""; String endlocation=""; String startlatitude=""; String endlatitude=""; String startlongitude=""; String endlongitude=""; String route=""; public String getRoute() { return route; } public void setRoute(String route) { this.route = route; } public String getStartlatitude() { return startlatitude; } public void setStartlatitude(String startlatitude) { this.startlatitude = startlatitude; } public String getEndlatitude() { return endlatitude; } public void setEndlatitude(String endlatitude) { this.endlatitude = endlatitude; } public String getStartlongitude() { return startlongitude; } public void setStartlongitude(String startlongitude) { this.startlongitude = startlongitude; } public String getEndlongitude() { return endlongitude; } public void setEndlongitude(String endlongitude) { this.endlongitude = endlongitude; } public String getImage_status() { return image_status; } public void setImage_status(String image_status) { this.image_status = image_status; } public String getPosition() { return position; } public void setPosition(String position) { this.position = position; } public String getReg_key() { return reg_key; } public void setReg_key(String reg_key) { this.reg_key = reg_key; } public String getFirstname() { return firstname; } public void setFirstname(String firstname) { this.firstname = firstname; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getCreditScore() { return creditScore; } public void setCreditScore(String creditScore) { this.creditScore = creditScore; } public String getWon() { return won; } public void setWon(String won) { this.won = won; } public String getLost() { return lost; } public void setLost(String lost) { this.lost = lost; } public String getCountry() { return country; } public void setCountry(String country) { this.country = country; } public String getProfile_pic() { return profile_pic; } public void setProfile_pic(String profile_pic) { this.profile_pic = profile_pic; } public String getRegType() { return regType; } public void setRegType(String regType) { this.regType = regType; } public String getDistance() { return distance; } public void setDistance(String distance) { this.distance = distance; } public String getStartdate() { return startdate; } public void setStartdate(String startdate) { this.startdate = startdate; } public String getPositionlongitude() { return positionlongitude; } public void setPositionlongitude(String positionlongitude) { this.positionlongitude = positionlongitude; } public String getPositionlatitude() { return positionlatitude; } public void setPositionlatitude(String positionlatitude) { this.positionlatitude = positionlatitude; } public String getStartlocation() { return startlocation; } public void setStartlocation(String startlocation) { this.startlocation = startlocation; } public String getEndlocation() { return endlocation; } public void setEndlocation(String endlocation) { this.endlocation = endlocation; } }
[ "eficaztechsol@gmail.com" ]
eficaztechsol@gmail.com
20a317c5feae6e88a43dcfb42c62b94386e4e04a
27b52e47bf77d71ab48a09a535327f6aa5a0e170
/src/com/bytezone/dm3270/display/FieldChangeListener.java
cd4efc727da5564a9d92e401b2e13851fd1d1ca7
[ "Apache-2.0" ]
permissive
physicist86/dm3270
df4b8920ae5a4a259ee71ccc2637e8b23e213497
9f5d1ad0b2e311e7a1b178dcc475df72924a308a
refs/heads/master
2022-04-03T23:53:12.120323
2020-02-13T06:55:09
2020-02-13T06:55:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
148
java
package com.bytezone.dm3270.display; public interface FieldChangeListener { public abstract void fieldChanged (Field oldField, Field newField); }
[ "dmolony@iinet.net.au" ]
dmolony@iinet.net.au
28d45547c0f222085043875229129a00ec9d5efd
6fd8e47cdba944697e6bb3acbc9ccb0d09a17991
/cli/trunk/cli-profiles-parser/src/main/java/eu/cloud4soa/cli/profiles/grammar/syntaxtree/StorageComponent.java
c45a3c485f1f541543066a7d5450894a22267adf
[ "Apache-2.0" ]
permissive
Cloud4SOA/Cloud4SOA
0bc251780fcb6934b1d50027c3638f31d60c0f40
eff65895b215873bef0dd07e899fc01abccb19b6
refs/heads/master
2023-01-22T02:22:01.225319
2013-08-08T08:03:39
2013-08-08T08:03:39
11,971,122
2
2
null
2023-01-02T21:59:37
2013-08-08T08:00:58
Java
UTF-8
Java
false
false
1,446
java
/* * Copyright 2013 Cloud4SOA, www.cloud4soa.eu * * 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. */ /* Generated by JTB 1.4.4 */ package eu.cloud4soa.cli.profiles.grammar.syntaxtree; import eu.cloud4soa.cli.profiles.grammar.visitor.*; public class StorageComponent implements INode { public Component f0; public Capacity f1; public NodeOptional f2; private static final long serialVersionUID = 144L; public StorageComponent(final Component n0, final Capacity n1, final NodeOptional n2) { f0 = n0; f1 = n1; f2 = n2; } public <R, A> R accept(final IRetArguVisitor<R, A> vis, final A argu) { return vis.visit(this, argu); } public <R> R accept(final IRetVisitor<R> vis) { return vis.visit(this); } public <A> void accept(final IVoidArguVisitor<A> vis, final A argu) { vis.visit(this, argu); } public void accept(final IVoidVisitor vis) { vis.visit(this); } }
[ "pgouvas@gmail.com" ]
pgouvas@gmail.com
7149196a917955a9f4450c260746dcd0bfdd1848
e76c78aa9208564b09bff5535610b470323ff876
/OptimisY3/ServiceManifest/tags/ServiceManifest-1.0.6/service-manifest-api/src/main/java/eu/optimis/manifest/api/impl/ManifestImpl.java
e5d220499e25d1d33ab0da4e94d875ab54618d8c
[]
no_license
ldionmarcil/optimistoolkit
d9bb06e6e1e7262323cff553fc53b32d3b8bba8a
5733efef99d523de19f6be4a819ddc6b9f755499
refs/heads/master
2021-01-21T21:22:20.528698
2013-06-07T21:52:35
2013-06-07T21:52:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
11,371
java
/* * Copyright (c) 2012, Fraunhofer-Gesellschaft * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * (1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the disclaimer at the end. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * (2) Neither the name of Fraunhofer nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * DISCLAIMER * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ package eu.optimis.manifest.api.impl; import eu.optimis.manifest.api.exceptions.InvalidDocumentException; import eu.optimis.manifest.api.exceptions.SplittingNotAllowedException; import eu.optimis.schemas.optimis.JaxBServiceManifest; import eu.optimis.types.xmlbeans.servicemanifest.XmlBeanServiceManifestDocument; import eu.optimis.types.xmlbeans.servicemanifest.XmlBeanVirtualMachineDescriptionType; import eu.optimis.types.xmlbeans.servicemanifest.infrastructure.XmlBeanIncarnatedVirtualMachineComponentsType; import eu.optimis.types.xmlbeans.servicemanifest.infrastructure.XmlBeanInfrastructureProviderExtensionType; import eu.optimis.types.xmlbeans.servicemanifest.infrastructure.XmlBeanInfrastructureProviderExtensionsDocument; import eu.optimis.types.xmlbeans.servicemanifest.service.XmlBeanServiceProviderExtensionType; import eu.optimis.types.xmlbeans.servicemanifest.service.XmlBeanServiceProviderExtensionsDocument; import org.apache.xmlbeans.XmlCursor; import org.apache.xmlbeans.XmlObject; import org.w3c.dom.Node; import javax.xml.bind.JAXBContext; import javax.xml.bind.Unmarshaller; import java.util.List; /** * @author owaeld */ class ManifestImpl extends AbstractManifestElement<XmlBeanServiceManifestDocument> implements eu.optimis.manifest.api.sp.Manifest, eu.optimis.manifest.api.ip.Manifest { protected ManifestImpl( XmlBeanServiceManifestDocument base ) { super( base ); } @Override public String toString() { if ( !delegate.validate() ) { throw new InvalidDocumentException( "Document to be exported is invalid!", delegate ); } return getXmlObject().xmlText(); } @Override public XmlBeanServiceManifestDocument toXmlBeanObject() { if ( !delegate.validate() ) { throw new InvalidDocumentException( "Document to be exported is invalid!", delegate ); } return getXmlObject(); } @Override public JaxBServiceManifest toJaxB() { try { if ( !delegate.validate() ) { throw new InvalidDocumentException( "Document to be exported is invalid! ", delegate ); } JAXBContext jc = JAXBContext.newInstance( new Class[]{ JaxBServiceManifest.class } ); Unmarshaller u = jc.createUnmarshaller(); // deserialize byte array to jaxb return ( JaxBServiceManifest ) u.unmarshal( this.delegate.getDomNode() ); } catch ( Exception e ) { throw new RuntimeException( e ); } } @Override public DataProtectionSectionImpl getDataProtectionSection() { return new DataProtectionSectionImpl( delegate.getServiceManifest().getDataProtectionSection() ); } @Override public ElasticitySectionImpl getElasticitySection() { return new ElasticitySectionImpl( delegate.getServiceManifest().getElasticitySection() ); } @Override public String getManifestId() { return delegate.getServiceManifest().getManifestId(); } @Override public void setManifestId( String manifestId ) { delegate.getServiceManifest().setManifestId( manifestId ); } @Override public VirtualMachineDescriptionSectionImpl getVirtualMachineDescriptionSection() { return new VirtualMachineDescriptionSectionImpl( ( XmlBeanVirtualMachineDescriptionType ) delegate.getServiceManifest() .getServiceDescriptionSection() ); } @Override public String getServiceProviderId() { return delegate.getServiceManifest().getServiceProviderId(); } @Override public void setServiceProviderId( String serviceProviderId ) { delegate.getServiceManifest().setServiceProviderId( serviceProviderId ); } @Override public TRECSectionImpl getTRECSection() { return new TRECSectionImpl( delegate.getServiceManifest().getTRECSection() ); } @Override public ServiceProviderExtensionImpl getServiceProviderExtensionSection() { XmlBeanServiceProviderExtensionType ext = selectServiceProviderExtensionType(); if ( ext != null ) { return new ServiceProviderExtensionImpl( ext ); } else { return null; } } @Override public void initializeIncarnatedVirtualMachineComponents() { if ( this.getInfrastructureProviderExtensions() == null ) { initializeInfrastructureProviderExtensions(); assert getInfrastructureProviderExtensions() != null; } resetIncarnatedVirtualMachineComponents(); XmlBeanIncarnatedVirtualMachineComponentsType componentsType = XmlBeanIncarnatedVirtualMachineComponentsType.Factory.newInstance(); TemplateLoader loader = new TemplateLoader(); VirtualMachineComponentImpl[] vComponentArray = getVirtualMachineDescriptionSection().getVirtualMachineComponentArray(); for ( VirtualMachineComponentImpl component : vComponentArray ) { componentsType.addNewIncarnatedVirtualMachineComponent().set( loader.loadIncarnatedVirtualMachineComponentType( component ) ); } XmlBeanInfrastructureProviderExtensionType extensionDocument = selectInfrastructureProviderExtensionElement(); extensionDocument.addNewIncarnatedServiceComponents().set( componentsType ); } private void resetIncarnatedVirtualMachineComponents() { // we will remove any incarnated components if they exist if ( this.getInfrastructureProviderExtensions().isSetIncarnatedVirtualMachineComponents() ) { this.getInfrastructureProviderExtensions().unsetIncarnatedVirtualMachineComponents(); } } @Override public ManifestImpl extractComponent( String componentId ) throws SplittingNotAllowedException { ManifestSplitter splitter = new ManifestSplitter( delegate ); splitter.splitManifest( componentId ); delegate.set( splitter.getCurrentManifest() ); return new ManifestImpl( splitter.getExtractedManifest() ); } @Override public ManifestImpl extractComponentList( List<String> componentIds ) throws SplittingNotAllowedException { ManifestSplitter splitter = new ManifestSplitter( delegate ); splitter.splitManifest( componentIds ); delegate.set( splitter.getCurrentManifest() ); return new ManifestImpl( splitter.getExtractedManifest() ); } @Override public InfrastructureProviderExtensionImpl getInfrastructureProviderExtensions() { if ( selectInfrastructureProviderExtensionElement() != null ) { XmlBeanInfrastructureProviderExtensionType ext = selectInfrastructureProviderExtensionElement(); return new InfrastructureProviderExtensionImpl( ext ); } else { return null; } } @Override public void unsetInfrastructureProviderExtensions() { if ( isSetInfrastructureProviderExtensions() ) { XmlCursor editCursor = selectInfrastructureProviderExtensionElement().newCursor(); editCursor.removeXml(); } } private XmlBeanInfrastructureProviderExtensionType selectInfrastructureProviderExtensionElement() { XmlObject[] result = delegate.getServiceManifest().selectChildren( XmlBeanInfrastructureProviderExtensionsDocument.type .getDocumentElementName() ); if ( result.length > 0 ) { return ( XmlBeanInfrastructureProviderExtensionType ) result[ 0 ]; } return null; } private XmlBeanServiceProviderExtensionType selectServiceProviderExtensionType() { XmlObject[] elements = delegate.getServiceManifest().selectChildren( XmlBeanServiceProviderExtensionsDocument.type.getDocumentElementName() ); if ( elements.length > 0 ) { return ( XmlBeanServiceProviderExtensionType ) elements[ 0 ]; } else { return null; } } @Override public void unsetServiceProviderExtensions() { if ( selectServiceProviderExtensionType() != null ) { selectServiceProviderExtensionType().newCursor().removeXml(); } } @Override public void initializeInfrastructureProviderExtensions() { if ( !isSetInfrastructureProviderExtensions() ) { XmlBeanInfrastructureProviderExtensionsDocument newIPExtension = XmlBeanInfrastructureProviderExtensionsDocument.Factory.newInstance(); newIPExtension.addNewInfrastructureProviderExtensions(); // now we can import the new node Node node = newIPExtension.getInfrastructureProviderExtensions().getDomNode(); Node importedNode = delegate.getServiceManifest().getDomNode().getOwnerDocument() .importNode( node, true ); delegate.getServiceManifest().getDomNode().appendChild( importedNode ); } } @Override public boolean isSetInfrastructureProviderExtensions() { if ( selectInfrastructureProviderExtensionElement() == null ) { return false; } else { return true; } } }
[ "A136603@ES-CNU2040FVS.es.int.atosorigin.com" ]
A136603@ES-CNU2040FVS.es.int.atosorigin.com
ef7fc3ec85237e24234c7cbbfca23cb9c07faf42
7ec0194c493e63b18ab17b33fe69a39ed6af6696
/masterlock/app_decompiled/sources/com/google/android/gms/location/GeofencingClient.java
54e88cb20473b6e6ad083ebe5986ee83a9e0b854
[]
no_license
rasaford/CS3235
5626a6e7e05a2a57e7641e525b576b0b492d9154
44d393fb3afb5d131ad9d6317458c5f8081b0c04
refs/heads/master
2020-07-24T16:00:57.203725
2019-11-05T13:00:09
2019-11-05T13:00:09
207,975,557
0
1
null
null
null
null
UTF-8
Java
false
false
1,735
java
package com.google.android.gms.location; import android.app.Activity; import android.app.PendingIntent; import android.content.Context; import android.support.annotation.NonNull; import android.support.annotation.RequiresPermission; import com.google.android.gms.common.api.Api.ApiOptions.NoOptions; import com.google.android.gms.common.api.GoogleApi; import com.google.android.gms.common.api.internal.ApiExceptionMapper; import com.google.android.gms.common.api.internal.StatusExceptionMapper; import com.google.android.gms.common.internal.PendingResultUtil; import com.google.android.gms.tasks.Task; import java.util.List; public class GeofencingClient extends GoogleApi<NoOptions> { public GeofencingClient(@NonNull Activity activity) { super(activity, LocationServices.API, null, (StatusExceptionMapper) new ApiExceptionMapper()); } public GeofencingClient(@NonNull Context context) { super(context, LocationServices.API, null, (StatusExceptionMapper) new ApiExceptionMapper()); } @RequiresPermission("android.permission.ACCESS_FINE_LOCATION") public Task<Void> addGeofences(GeofencingRequest geofencingRequest, PendingIntent pendingIntent) { return PendingResultUtil.toVoidTask(LocationServices.GeofencingApi.addGeofences(asGoogleApiClient(), geofencingRequest, pendingIntent)); } public Task<Void> removeGeofences(PendingIntent pendingIntent) { return PendingResultUtil.toVoidTask(LocationServices.GeofencingApi.removeGeofences(asGoogleApiClient(), pendingIntent)); } public Task<Void> removeGeofences(List<String> list) { return PendingResultUtil.toVoidTask(LocationServices.GeofencingApi.removeGeofences(asGoogleApiClient(), list)); } }
[ "fruehaufmaximilian@gmail.com" ]
fruehaufmaximilian@gmail.com
92b2c2f18840cada6a9a31a90c9cfb1032be651f
b4d74c76bad9805ef89faeef54217bf906ec19ab
/src/model/KategoriaEntity.java
3b27703c13e9b8d5dcb0196d1f3b1859b6351000
[]
no_license
SOA-game/webservice
9f436048ab5663d9605a671895832feeaaefede2
5e4eee5c2e548cf5e0063f11baf1ec61bbce5ee9
refs/heads/master
2021-01-10T15:35:13.955232
2015-06-05T23:01:41
2015-06-05T23:01:41
36,432,589
0
0
null
null
null
null
UTF-8
Java
false
false
2,148
java
package model; import javax.persistence.*; import java.util.Collection; /** * Created by Marek on 2015-05-30. * */ @NamedQueries({ @NamedQuery( name = "CAN HAS CATEGORY?", query = "from KategoriaEntity where id = :IZ_ID" ), @NamedQuery( name = "CAN HAS CATEGORIES?", query = "FROM KategoriaEntity " ) }) @Entity @Table(name = "kategoria", schema = "public", catalog = "index") public class KategoriaEntity { private int id; private KategorieEntity typ; private int wartosc; private Collection<ElementEntity> elementy; @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL, mappedBy = "kategoria", orphanRemoval = false) public Collection<ElementEntity> getElementy() { return elementy; } public void setElementy(Collection<ElementEntity> elementy) { this.elementy = elementy; } @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id", unique = true, nullable = false) public int getId() { return id; } public void setId(int id) { this.id = id; } @ManyToOne(fetch = FetchType.EAGER) @JoinColumn(name = "typ", nullable = false) public KategorieEntity getTyp() { return typ; } public void setTyp(KategorieEntity typ) { this.typ = typ; } @Basic @Column(name = "wartosc") public int getWartosc() { return wartosc; } public void setWartosc(int wartosc) { this.wartosc = wartosc; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; KategoriaEntity that = (KategoriaEntity) o; if (id != that.id) return false; if (typ != that.typ) return false; if (wartosc != that.wartosc) return false; return true; } @Override public int hashCode() { int result = id; result = 31 * result + typ.hashCode(); result = 31 * result + wartosc; return result; } }
[ "marek.28.93@gmail.com" ]
marek.28.93@gmail.com
60a9cf7c917f1dc158ee8cb1d8aee1bb105e3cb4
6a37ebbce93392eb1d5739023413d3dccecd297c
/Project/product-phase-development@97ff8629ba9/uat/src/test/java/com/sapient/asde/batch5/ComparisonMatrixMetadata/ComparisonMatrixMetadataTestSteps.java
64ab6223a347cf75fdcd53797a96ecee977d9c53
[]
no_license
AbhishekRajgaria-ps/sapient-asde-june-2021-training
9035810f5c36ce01c4020601a5bf803a8c31d98e
075736b7a3677d10b7ce3c180e4b73deaa6f7f9b
refs/heads/master
2023-08-24T14:45:22.770557
2021-10-08T16:33:58
2021-10-08T16:33:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,265
java
package com.sapient.asde.batch5.ComparisonMatrixMetadata; import static org.junit.Assert.assertEquals; import java.util.List; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.chrome.ChromeOptions; import io.cucumber.java.After; import io.cucumber.java.Before; import io.cucumber.java.en.Given; import io.cucumber.java.en.Then; import io.cucumber.java.en.When; public class ComparisonMatrixMetadataTestSteps { WebDriver driver; List<WebElement> listBefore; String link; @Before public void setup() { String driverLocation = "D:\\SeleniumDrivers\\"; String chromeDriver = driverLocation + "chromedriver_win32\\chromedriver.exe"; System.setProperty("webdriver.chrome.driver", chromeDriver); ChromeOptions options = new ChromeOptions(); // options.addArguments("--headless"); // options.addArguments("--window-size=1200x600"); driver = new ChromeDriver(options); } @After public void tearDown() { driver.quit(); } @Given("I am on the change comparison matrix metadata page") public void i_am_on_the_comparison_matrix_metadata_page() { driver.get("http://localhost:3000/customer/vehicle-comparisons"); } @When("I click on a delete button") public void i_click_on_a_delete_button() { driver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS); listBefore = driver .findElements(By.xpath("//*[@id=\"root\"]/div/div[2]/div/div[2]/div/table/tbody/tr")); driver.findElement(By.xpath("//*[@id=\"root\"]/div/div[2]/div/div[2]/div/table/tbody/tr[1]/td[4]")).click(); } @Then("The record should be deleted") public void the_record_should_be_deleted() { driver.manage().timeouts().implicitlyWait(1, TimeUnit.SECONDS); List<WebElement> listAfter = driver .findElements(By.xpath("//*[@id=\"root\"]/div/div[2]/div/div[2]/div/table/tbody/tr")); assertEquals(listBefore.size() - 1, listAfter.size()); } }
[ "kayartaya.vinod@gmail.com" ]
kayartaya.vinod@gmail.com
1f6d271fee2d8a3b03d6b13396d968f585bd223e
0eaa8ac4d5ecdcc762ce07ecc4c452eb38d4bc64
/java/expression/parser/exceptions/ExpressionException.java
260e9d23e071443fdcdd53ed8f8c0c69e9441590
[]
no_license
avtakhov/paradigms-2020
d79128a06574d89973fcb7185424f7715bf45706
ffc7676a16e5fe6bc259f309d812aff5146f9534
refs/heads/gnome
2021-02-11T11:24:42.084885
2020-05-30T19:53:11
2020-05-30T19:53:11
244,487,191
0
1
null
2020-05-11T23:49:45
2020-03-02T22:15:59
Java
UTF-8
Java
false
false
180
java
package expression.parser.exceptions; public class ExpressionException extends RuntimeException { public ExpressionException(String message) { super(message); } }
[ "avtahovfarit@gmail.com" ]
avtahovfarit@gmail.com
8ad870fa5e2c175b7f2087f00bb13c6a35ecc160
a8f27c61b389e306a20b01e83cf7d5b3678528b0
/src/main/java/com/example/demo/rpc/HelloRequestOrBuilder.java
b0cd0ff4fbe4cc73bec2d5834ad0bd96c96f7ef5
[]
no_license
a4342502cld/grpc-demo
13d6411c56408cf6dc9fc9a99e8701be4035ca3c
fedf14d9b7187b4e6e35e2feebaaa9ce744b8e7c
refs/heads/master
2023-07-27T00:06:08.938699
2019-12-24T04:48:57
2019-12-24T04:48:57
229,870,364
0
0
null
2023-07-05T20:44:33
2019-12-24T04:33:16
Java
UTF-8
Java
false
true
464
java
// Generated by the protocol buffer compiler. DO NOT EDIT! // source: greeter.proto package com.example.demo.rpc; public interface HelloRequestOrBuilder extends // @@protoc_insertion_point(interface_extends:com.example.demo.rpc.HelloRequest) com.google.protobuf.MessageOrBuilder { /** * <code>string name = 1;</code> */ String getName(); /** * <code>string name = 1;</code> */ com.google.protobuf.ByteString getNameBytes(); }
[ "a4342502" ]
a4342502
612d0e9ece2f2f422187caa4f5187c6437c4af24
69afc3a886d2cbaf94cc5663323a8d3b9b42659f
/demo/src/main/java/com/example/scheduler/utils/SchedulerZone.java
dc604ab149b2374c2fc8a727bb4d2335c9934ba2
[]
no_license
vidhyaa11/spring_scheduler
12e2e1831dac9a3b96579f9d10a0020102ac3b3b
8a542e515bc9786e979e0497766440aba757f309
refs/heads/master
2023-08-17T17:56:02.371879
2021-10-22T07:25:19
2021-10-22T07:25:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
309
java
package com.example.scheduler.utils; public enum SchedulerZone { SG("Asia/Singapore"), NZ("Antarctica/McMurdo"); private String countryZone; private SchedulerZone(String countryZone) { this.countryZone = countryZone; } public String getCountryZone() { return countryZone; } }
[ "g.vidhyaa11@gmail.com" ]
g.vidhyaa11@gmail.com
7a953f44bab0c7debc3f2357511b9b591d980af8
af5a1e5fa1a3ee90e0183c05e44cdaf766207853
/WikipediaQA/src/wikipediaqa/Main.java
1b11d416c0ca7a768c5091d5f870701adb46cdc8
[]
no_license
alexginsca/WikipediaQA
0247a728ff9a1d30a347e43ed5d509b6f7ee9f43
9018afd250289c87a86196fc998386ad056991f4
refs/heads/master
2016-09-10T22:37:26.476229
2011-05-05T19:36:04
2011-05-05T19:36:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
303
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package wikipediaqa; /** * * @author Alex Ginsca */ public class Main { /** * @param args the command line arguments */ public static void main(String[] args) { } }
[ "alexgansca@gmail.com" ]
alexgansca@gmail.com
fe153955b4dde719eb68d33b25a65cb7fe3e3633
fdc3417fff2cd8e4235e4468fa8c1e358e75eed7
/test/com/jwetherell/algorithms/data_structures/test/AVLTreeTests.java
1e4b32e4e4d36e09c1709c890e3625387ec9ee0d
[ "Apache-2.0" ]
permissive
m-altieri/java-algorithms-implementation
4cc94a6c90b5fc5fdc9bc57e9ba4cfa730ff554c
8bec7f03ee5ac2abd39574fa5d2f410c8168e1d0
refs/heads/master
2021-09-06T23:19:22.253708
2018-02-13T11:27:51
2018-02-13T11:27:51
106,116,311
0
0
null
2017-10-07T17:18:55
2017-10-07T17:18:55
null
UTF-8
Java
false
false
1,342
java
package com.jwetherell.algorithms.data_structures.test; import static org.junit.Assert.assertTrue; import java.util.Collection; import org.junit.Test; import com.jwetherell.algorithms.data_structures.AVLTree; import com.jwetherell.algorithms.data_structures.BinarySearchTree; import com.jwetherell.algorithms.data_structures.test.common.JavaCollectionTest; import com.jwetherell.algorithms.data_structures.test.common.TreeTest; import com.jwetherell.algorithms.data_structures.test.common.Utils; import com.jwetherell.algorithms.data_structures.test.common.Utils.TestData; // TODO: Auto-generated Javadoc /** * The Class AVLTreeTests. */ public class AVLTreeTests { /** * Test AVL tree. */ @Test public void testAVLTree() { TestData data = Utils.generateTestData(1000); String bstName = "AVL Tree"; BinarySearchTree<Integer> bst = new AVLTree<Integer>(); Collection<Integer> bstCollection = bst.toCollection(); assertTrue(TreeTest.testTree(bst, Integer.class, bstName, data.unsorted, data.invalid)); assertTrue(JavaCollectionTest.testCollection(bstCollection, Integer.class, bstName, data.unsorted, data.sorted, data.invalid)); } }
[ "m.altieri13@studenti.uniba.it" ]
m.altieri13@studenti.uniba.it
8cf35d5228fdd4c54dea3f18178215e0b3ef927c
85113e64599f4c1d49ac5f9f8a49073c32e21cf1
/src/main/java/ru/gb/repository/ProductRepository.java
0416214323cd0bc9f7f3c6b38a6ca97483217eb1
[]
no_license
NoroSaroyan/ru.gb.spring
9ca2b3d88c55542bbe73d90556003cf05db5f570
168544565dd40db70cc946dd2622b1234e53f9f7
refs/heads/main
2023-08-19T08:54:07.086447
2021-09-20T18:57:12
2021-09-20T19:11:44
408,570,396
0
0
null
2021-09-20T19:20:50
2021-09-20T19:12:34
Java
UTF-8
Java
false
false
1,186
java
package ru.gb.repository; import org.springframework.stereotype.Repository; import ru.gb.entity.Product; import java.util.ArrayList; import java.util.List; import java.util.Optional; @Repository public class ProductRepository { private List<Product> products = new ArrayList<>(); public ProductRepository() { products.add(new Product(1, "Toys", 100.50F)); products.add(new Product(2, "Spirits", 500.50F)); products.add(new Product(3, "Bakery", 10.99F)); products.add(new Product(4, "T-Shirts", 49.99F)); products.add(new Product(5, "Ground meet", 19.99F)); } public Optional<Product> findById(int id) { return products.stream().filter(p -> p.getId() == id).findFirst(); } public List<Product> findAll() { return products; } public void add(Product product) { this.products.add(product); } public void remove(int id) { Product product = findById(id).orElseThrow(); this.products.remove(product); } @Override public String toString() { return "ProductRepository{" + "products=" + products + '}'; } }
[ "noriksaroyan@gmail.com" ]
noriksaroyan@gmail.com
249ace122f25d992a4dd803602dd56b20fd0d81a
acae9fdd21e1a93b3df61b732cbab22eca507c51
/src/main/java/edu/mum/petsmart/controller/PetController.java
e2f297102e2d7b934281b84db63e41f5ff406e77
[]
no_license
vp-kchav/PetsMart
92e23b8a6ee5e3d52f7dfd38d425465d59a5b0d1
0d8ccff4305bab85dc38809a0b9f613f64ab9753
refs/heads/master
2021-09-03T11:26:50.457056
2018-01-08T18:07:18
2018-01-08T18:07:18
112,012,263
0
0
null
null
null
null
UTF-8
Java
false
false
6,231
java
/** * This the java source code of Cooking System @ MPP class, 2017 */ package edu.mum.petsmart.controller; import java.util.ArrayList; import java.util.List; import javax.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.SessionAttributes; import edu.mum.petsmart.domain.Cart; import edu.mum.petsmart.domain.Item; import edu.mum.petsmart.domain.Login; import edu.mum.petsmart.domain.Product; import edu.mum.petsmart.service.CartService; import edu.mum.petsmart.service.ItemService; import edu.mum.petsmart.service.ProductService; @Controller @SessionAttributes({"cart", "items"}) public class PetController { @Autowired ProductService productService; @Autowired ItemService itemService; @Autowired CartService cartService; @RequestMapping(value= {"welcome", "/","/products"}, method=RequestMethod.GET) public String welcome(Model model, HttpServletRequest request) { if (checkSession(request)) { return "forward:login"; } model.addAttribute("products", productService.getAll()); if(request.getSession().getAttribute("cart") == null || !cartService.contains((Cart) request.getSession().getAttribute("cart"))) { Cart cart = new Cart(); cartService.save(cart); //request.getSession().setAttribute("cart", cart); model.addAttribute("cart", cart); model.addAttribute("items", new ArrayList<Item>()); request.getSession().setAttribute("cartItems", 0); } return "products"; } @RequestMapping(value = "/product/{productId}", method=RequestMethod.GET) @ResponseBody public Product product(@PathVariable("productId") Long productId, Model model) { System.out.println(productId + "--------------"); return productService.findOne(productId); } @RequestMapping(value = "/addToCart/{productId}/{quantity}", method=RequestMethod.POST) @ResponseBody public String addToCart(@PathVariable("productId") long productId, @PathVariable("quantity") int quantity, HttpServletRequest request, Model model) { Product product = productService.findOne(productId); Item newItem = new Item(); newItem.setProduct(product); newItem.setQuantity(quantity); newItem.setDiscount(product.getPrice() * quantity); itemService.save(newItem); long cartId = ((Cart)request.getSession().getAttribute("cart")).getId(); Cart tempCart = cartService.get(cartId); tempCart.addCartItem(newItem); cartService.save(tempCart); model.addAttribute("items", tempCart.getCartItems()); request.getSession().setAttribute("cartItems", tempCart.getCartItems().size()); return String.valueOf(tempCart.getCartItems().size()); } @RequestMapping(value = "/cart", method=RequestMethod.GET) public String cart(Model model, HttpServletRequest request) throws Exception { if (checkSession(request)) { return "forward:login"; } if(request.getSession().getAttribute("cart") == null || !cartService.contains((Cart) request.getSession().getAttribute("cart"))) { Cart cart = new Cart(); cartService.save(cart); request.getSession().setAttribute("cart", cart); } List<Item> cartItems; long cartId = ((Cart)request.getSession().getAttribute("cart")).getId(); try{ cartItems = cartService.get(cartId).getCartItems(); model.addAttribute("totalCost", cartService.get(cartId).getTotalPrice()); }catch(RuntimeException rte) { throw new Exception("Failed to retrive Cart Items" + rte); } model.addAttribute("items", cartItems); return "cart"; } @RequestMapping(value = "/removeItem/{itemId}") public String removeFromCart(@PathVariable long itemId, Model model, HttpServletRequest request) { if (checkSession(request)) { return "forward:login"; } long cartId = ((Cart)request.getSession().getAttribute("cart")).getId(); Cart testCart = cartService.get(cartId); for(int i = 0; i < testCart.getCartItems().size(); i++) { if(testCart.getCartItems().get(i).getId() == itemId) { testCart.getCartItems().remove(i); } } cartService.save(testCart); model.addAttribute("items", testCart.getCartItems()); request.getSession().setAttribute("cartItems", testCart.getCartItems().size()); return "redirect:/cart"; } @RequestMapping(value = "/updateCart") public String updateCart(HttpServletRequest request, Model model) { if (checkSession(request)) { return "forward:login"; } long cartId =((Cart)request.getSession().getAttribute("cart")).getId(); Cart tempCart = cartService.get(cartId); int quantity = Integer.parseInt((String) request.getParameter("quantity")); long itemId = Long.parseLong((String) request.getParameter("itemId")); for(int i = 0; i < tempCart.getCartItems().size(); i++) { if(tempCart.getCartItems().get(i).getId() == itemId) { Item tempItem = tempCart.getCartItems().get(i); tempItem.setQuantity(quantity); tempItem.setDiscount(tempItem.getQuantity()*tempItem.getProduct().getPrice()); itemService.save(tempItem); } } cartService.save(tempCart); request.getSession().setAttribute("cartItems", tempCart.getCartItems().size()); model.addAttribute("items", tempCart.getCartItems()); return "redirect:/cart"; } @RequestMapping(value = "/search", method=RequestMethod.GET) public String search(@RequestParam("keyword") String keyword, Model model, HttpServletRequest request) { if (checkSession(request)) { return "forward:login"; } model.addAttribute("keyword", keyword); model.addAttribute("products", productService.findProducts(keyword)); return "products"; } private boolean checkSession(HttpServletRequest request) { Object l = request.getSession().getAttribute("login"); if (l !=null && "ADMIN".equals(((Login)l).getRole())) { return true; } return false; } }
[ "kimtey.chav@gmail.com" ]
kimtey.chav@gmail.com
f344fb9c9f4d3d9c8e3fc5d6885337540431ba3a
e353a67ee44c17f063d2719407b18fa11a812051
/src/main/java/com/ctsousa/stoom/controller/input/AddressInput.java
68410ccda4301cb422dc786174463b7f6b8fb8da
[]
no_license
karlostiago/stoom
dbbd4e507ee575a25f877cd9280cddc572a3c005
fc15dc9b041bae9fdf896f6d7d8e71e086531ad1
refs/heads/master
2023-06-25T14:26:14.099473
2021-07-19T03:48:43
2021-07-19T03:48:43
387,292,692
0
0
null
null
null
null
UTF-8
Java
false
false
1,763
java
package com.ctsousa.stoom.controller.input; import javax.validation.constraints.NotBlank; public class AddressInput { @NotBlank private String streetName; @NotBlank private String number; private String complement; @NotBlank private String neighbourhood; @NotBlank private String city; @NotBlank private String state; @NotBlank private String country; @NotBlank private String zipCode; private Double latitude; private Double longitute; public String getStreetName() { return streetName; } public void setStreetName(String streetName) { this.streetName = streetName; } public String getNumber() { return number; } public void setNumber(String number) { this.number = number; } public String getComplement() { return complement; } public void setComplement(String complement) { this.complement = complement; } public String getNeighbourhood() { return neighbourhood; } public void setNeighbourhood(String neighbourhood) { this.neighbourhood = neighbourhood; } public String getCity() { return city; } public void setCity(String city) { this.city = city; } public String getState() { return state; } public void setState(String state) { this.state = state; } public String getCountry() { return country; } public void setCountry(String country) { this.country = country; } public String getZipCode() { return zipCode; } public void setZipCode(String zipCode) { this.zipCode = zipCode; } public Double getLatitude() { return latitude; } public void setLatitude(Double latitude) { this.latitude = latitude; } public Double getLongitute() { return longitute; } public void setLongitute(Double longitute) { this.longitute = longitute; } }
[ "squad15@iconit.com.br" ]
squad15@iconit.com.br
77449f4fbb863ceb54a6efdc5644c607d997735b
923c59e0148715cb030f679aba1b9812654739e6
/app/src/androidTest/java/com/example/acceso/smarttrash_cliente/ExampleInstrumentedTest.java
716c7e8015d6aa8d532d6ce5204084191ce57155
[]
no_license
IamRitian/SmartTrash-Cliente
2708d7e17e2585ae380ac3cf0429b7b6e458976c
a08884708125a33677b5d3e609b4dd04aad7886d
refs/heads/master
2020-04-02T15:36:51.053543
2018-12-05T20:39:49
2018-12-05T20:39:49
154,575,323
0
0
null
null
null
null
UTF-8
Java
false
false
758
java
package com.example.acceso.smarttrash_cliente; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.example.acceso.smarttrash_cliente", appContext.getPackageName()); } }
[ "ritianzhou@gmail.com" ]
ritianzhou@gmail.com
99a668eb506cbbb923c87be019247733e68fcbc7
9ce3fa8a1fdb44221247f109e7b2629456ff97d7
/server/src/main/java/eng/it/loatool/minimal_satisfaction/GetMinimalSatisfactionService.java
b5581d140322757937d2a4161ea88f6a81148676
[]
no_license
Engineering-Research-and-Development/loa-evaluation-tool
07c628ab4ea0bdb0e23a603326e67f53a1522825
cc1ae0dcea2aebcb30a3efa1f11e6db4ff4352ca
refs/heads/master
2023-01-12T16:13:21.194761
2019-09-13T09:40:54
2019-09-13T09:40:54
142,896,017
0
0
null
2023-01-04T12:36:26
2018-07-30T15:43:30
Java
UTF-8
Java
false
false
692
java
package eng.it.loatool.minimal_satisfaction; import java.util.Collection; import java.util.Optional; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service public class GetMinimalSatisfactionService { public Collection<MinimalSatisfaction> getByProcessId(Integer processId) { return minimalSatisfactionRepository.getByProcessId(processId); } public Optional<MinimalSatisfaction> getBySubProcessLevelId(Integer subprocessId) { return minimalSatisfactionRepository.getBySubProcessLevelId(subprocessId); } @Autowired private MinimalSatisfactionRepository minimalSatisfactionRepository; }
[ "drobniac@gmail.com" ]
drobniac@gmail.com
026e93c0399ace35a6c45e870a671d3d035a0125
fdddd4da8f282130a9d714f1bb3bf4f4ea608a73
/src/operations/Subtraction.java
463cef7f6d358637bfd7205827d145f583bce573
[]
no_license
shwetado/better-expression-evaluator
af40416c555b81e7530f31757feebf9843c450bd
3aaf892c0232d52ab651fb1084bf1e0815702b3a
refs/heads/master
2021-01-16T01:01:45.662348
2014-02-08T05:20:50
2014-02-08T05:20:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
216
java
package operations; /** * Created by samiksha on 2/7/14. */ public class Subtraction implements Operator { @Override public double calculate(double num1, double num2) { return num1 - num2; } }
[ "shwetadongare28@gmail.com" ]
shwetadongare28@gmail.com
eed2671007fb26f076dec4e0f66f791318adba39
511af8f0846e9feaa23c67408fa40df74f7e74aa
/dbflute-s2dao-example/src/main/java/com/example/dbflute/basic/dbflute/cbean/bs/BsMemberSecurityCB.java
2fe809d90c3b38a813178e511656aa3397388917
[ "Apache-2.0" ]
permissive
seasarorg/dbflute-nostalgic
f43a55a430d227f4c8e5b1785f3067dc2555e6de
af80e512b92d500c708328241b711003598831a4
refs/heads/master
2021-01-10T22:11:49.029759
2014-01-18T12:10:42
2014-01-18T12:10:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
11,326
java
package com.example.dbflute.basic.dbflute.cbean.bs; import java.util.Map; import com.example.dbflute.basic.dbflute.allcommon.DBFluteConfig; import com.example.dbflute.basic.dbflute.allcommon.ImplementedSqlClauseCreator; import com.example.dbflute.basic.dbflute.allcommon.cbean.AbstractConditionBean; import com.example.dbflute.basic.dbflute.allcommon.cbean.ConditionBean; import com.example.dbflute.basic.dbflute.allcommon.cbean.ConditionQuery; import com.example.dbflute.basic.dbflute.allcommon.cbean.SubQuery; import com.example.dbflute.basic.dbflute.allcommon.cbean.UnionQuery; import com.example.dbflute.basic.dbflute.allcommon.dbmeta.DBMetaInstanceHandler; import com.example.dbflute.basic.dbflute.allcommon.dbmeta.DBMetaProvider; import com.example.dbflute.basic.dbflute.allcommon.cbean.sqlclause.SqlClause; import com.example.dbflute.basic.dbflute.cbean.*; import com.example.dbflute.basic.dbflute.cbean.cq.*; import com.example.dbflute.basic.dbflute.cbean.nss.*; /** * The base condition-bean of MEMBER_SECURITY. * @author DBFlute(AutoGenerator) */ public class BsMemberSecurityCB extends AbstractConditionBean { // =================================================================================== // Attribute // ========= private final DBMetaProvider _dbmetaProvider = new DBMetaInstanceHandler(); protected MemberSecurityCQ _conditionQuery; // =================================================================================== // SqlClause // ========= @Override protected SqlClause createSqlClause() { return new ImplementedSqlClauseCreator().createSqlClause(this); } // =================================================================================== // DBMeta Provider // =============== @Override protected DBMetaProvider getDBMetaProvider() { return _dbmetaProvider; } // =================================================================================== // Table Name // ========== public String getTableDbName() { return "MEMBER_SECURITY"; } public String getTableSqlName() { return "MEMBER_SECURITY"; } // =================================================================================== // PrimaryKey Map // ============== public void acceptPrimaryKeyMap(Map<String, ? extends Object> primaryKeyMap) { assertPrimaryKeyMap(primaryKeyMap); { Object obj = primaryKeyMap.get("MEMBER_ID"); if (obj instanceof Integer) { query().setMemberId_Equal((Integer)obj); } else { query().setMemberId_Equal(new Integer((String)obj)); } } } // =================================================================================== // OrderBy Setting // =============== public ConditionBean addOrderBy_PK_Asc() { query().addOrderBy_MemberId_Asc(); return this; } public ConditionBean addOrderBy_PK_Desc() { query().addOrderBy_MemberId_Desc(); return this; } // =================================================================================== // Query // ===== public MemberSecurityCQ query() { return getConditionQuery(); } public MemberSecurityCQ getConditionQuery() { if (_conditionQuery == null) { _conditionQuery = new MemberSecurityCQ(null, getSqlClause(), getSqlClause().getLocalTableAliasName(), 0); } return _conditionQuery; } /** * {@inheritDoc} * @return The conditionQuery of the local table as interface. (NotNull) */ public ConditionQuery localCQ() { return getConditionQuery(); } // =================================================================================== // Union // ===== /** * Set up 'union'. * <pre> * cb.query().union(new UnionQuery&lt;MemberSecurityCB&gt;() { * public void query(MemberSecurityCB unionCB) { * unionCB.query().setXxx... * } * }); * </pre> * @param unionQuery The query of 'union'. (NotNull) */ public void union(UnionQuery<MemberSecurityCB> unionQuery) { final MemberSecurityCB cb = new MemberSecurityCB(); cb.xsetupForUnion(); unionQuery.query(cb); final MemberSecurityCQ cq = cb.query(); query().xsetUnionQuery(cq); } /** * Set up 'union all'. * <pre> * cb.query().unionAll(new UnionQuery&lt;MemberSecurityCB&gt;() { * public void query(MemberSecurityCB unionCB) { * unionCB.query().setXxx... * } * }); * </pre> * @param unionQuery The query of 'union'. (NotNull) */ public void unionAll(UnionQuery<MemberSecurityCB> unionQuery) { final MemberSecurityCB cb = new MemberSecurityCB(); cb.xsetupForUnion(); unionQuery.query(cb); final MemberSecurityCQ cq = cb.query(); query().xsetUnionAllQuery(cq); } public boolean hasUnionQueryOrUnionAllQuery() { return query().hasUnionQueryOrUnionAllQuery(); } // =================================================================================== // Setup Select // ============ protected MemberNss _nssMember; public MemberNss getNssMember() { if (_nssMember == null) { _nssMember = new MemberNss(null); } return _nssMember; } public MemberNss setupSelect_Member() { doSetupSelect(new SsCall() { public ConditionQuery qf() { return query().queryMember(); } }); if (_nssMember == null || !_nssMember.hasConditionQuery()) { _nssMember = new MemberNss(query().queryMember()); } return _nssMember; } // [DBFlute-0.7.4] // =================================================================================== // Specify // ======= protected Specification _specification; public Specification specify() { if (_specification == null) { _specification = new Specification(this, new SpQyCall<MemberSecurityCQ>() { public boolean has() { return true; } public MemberSecurityCQ qy() { return query(); } }, _forDerivedReferrer, _forScalarSelect, _forScalarSubQuery, getDBMetaProvider()); } return _specification; } public static class Specification extends AbstractSpecification<MemberSecurityCQ> { protected SpQyCall<MemberSecurityCQ> _myQyCall; protected MemberCB.Specification _member; public Specification(ConditionBean baseCB, SpQyCall<MemberSecurityCQ> qyCall , boolean forDeriveReferrer, boolean forScalarSelect, boolean forScalarSubQuery , DBMetaProvider dbmetaProvider) { super(baseCB, qyCall, forDeriveReferrer, forScalarSelect, forScalarSubQuery, dbmetaProvider); _myQyCall = qyCall; } public void columnMemberId() { doColumn("MEMBER_ID"); } public void columnLoginPassword() { doColumn("LOGIN_PASSWORD"); } public void columnReminderQuestion() { doColumn("REMINDER_QUESTION"); } public void columnReminderAnswer() { doColumn("REMINDER_ANSWER"); } public void columnRegisterDatetime() { doColumn("REGISTER_DATETIME"); } public void columnRegisterProcess() { doColumn("REGISTER_PROCESS"); } public void columnRegisterUser() { doColumn("REGISTER_USER"); } public void columnUpdateDatetime() { doColumn("UPDATE_DATETIME"); } public void columnUpdateProcess() { doColumn("UPDATE_PROCESS"); } public void columnUpdateUser() { doColumn("UPDATE_USER"); } public void columnVersionNo() { doColumn("VERSION_NO"); } protected void doSpecifyRequiredColumn() { columnMemberId();// PK if (_myQyCall.qy().hasConditionQueryMember()) { } } protected String getTableDbName() { return "MEMBER_SECURITY"; } public MemberCB.Specification specifyMember() { assertForeign("member"); if (_member == null) { _member = new MemberCB.Specification(_baseCB, new SpQyCall<MemberCQ>() { public boolean has() { return _myQyCall.has() && _myQyCall.qy().hasConditionQueryMember(); } public MemberCQ qy() { return _myQyCall.qy().queryMember(); } } , _forDerivedReferrer, _forScalarSelect, _forScalarSubQuery, _dbmetaProvider); } return _member; } } // =================================================================================== // Display SQL // =========== @Override protected String getLogDateFormat() { return DBFluteConfig.getInstance().getLogDateFormat(); } @Override protected String getLogTimestampFormat() { return DBFluteConfig.getInstance().getLogTimestampFormat(); } // =================================================================================== // Internal // ======== // Very Internal (for Suppressing Warn about 'Not Use Import') protected String getConditionBeanClassNameInternally() { return MemberSecurityCB.class.getName(); } protected String getConditionQueryClassNameInternally() { return MemberSecurityCQ.class.getName(); } protected String getSubQueryClassNameInternally() { return SubQuery.class.getName(); } }
[ "dbflute@gmail.com" ]
dbflute@gmail.com
bf2422f22b7e1f68493e6aeaa0b3580ce8748418
19b76ff9be3584643ffa9e52931df450f3744b06
/app/src/androidTest/java/com/example/temporizador/ExampleInstrumentedTest.java
d34e9d15ed1ff157bb5d1ff5516d6a42dd58c7cd
[]
no_license
AlvaroGordilloMartin/Temporizador
85891b6d28681190b2a37f2a643522d0aa91a739
c9e1287cbae7911a6b334c47a64ff23ee1bf4ecf
refs/heads/master
2023-03-02T10:27:03.308627
2021-02-05T10:04:28
2021-02-05T10:04:28
336,232,830
0
0
null
null
null
null
UTF-8
Java
false
false
762
java
package com.example.temporizador; import android.content.Context; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); assertEquals("com.example.temporizador", appContext.getPackageName()); } }
[ "alvarogm0403@gmail.com" ]
alvarogm0403@gmail.com
f852e06f1e114e2c2f611f144723a6a700af67fc
fa387bd0b19bfd7895d91e76a52b45cf29018448
/src/main/java/com/algaworks/brewer/controller/ErrosController.java
f48539690cb317a3dc2d75b06e31a8b64ea0921d
[]
no_license
williamsilvaec/Spring-Expert-MVC
e3b6de656a98f6449209f7b7cc6418d15dd3a87c
8cb31732805d250b7f6539a40094f63be3d68fa5
refs/heads/master
2021-01-25T06:25:46.270038
2018-02-15T13:30:45
2018-02-15T13:30:45
93,574,853
0
0
null
null
null
null
UTF-8
Java
false
false
447
java
package com.algaworks.brewer.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; @Controller public class ErrosController { @GetMapping("/404") public String paginaNaoEncontrada() { return "404"; } @RequestMapping("/500") public String erroServidor() { return "500"; } }
[ "william@viasoft.com.br" ]
william@viasoft.com.br
bd5d6cab644d6f4f34523c537a3fed7ff11ea6bf
ab5a565bbeb3217837e92b23780d287ad2478fe5
/chapter_002/src/main/java/ru/job4j/oop/Cat.java
0327906bee4eaae27241344205ee8289320accf9
[]
no_license
coffeeturbo/job4j
d939648becc1a5cd8c906643e3ef6667ecf1fb59
e2f10a25b09912e31b11930496bfc5aeb5eb8b2a
refs/heads/master
2020-12-27T19:28:27.370391
2020-04-29T12:13:23
2020-04-29T12:13:23
238,022,649
0
0
null
2020-10-13T19:15:09
2020-02-03T17:33:39
Java
UTF-8
Java
false
false
718
java
package ru.job4j.oop; public class Cat { private String food; private String name; public void giveNick(String name) { this.name = name; } public void show() { System.out.println(this.name + " сьел " + this.food); } public void eat(String meat) { this.food = meat; } public static void main(String[] args) { System.out.println("There are gav's food."); Cat gav = new Cat(); gav.giveNick("Гаф"); gav.eat("kotleta"); gav.show(); System.out.println("There are black's food."); Cat black = new Cat(); black.giveNick("Блек"); black.eat("fish"); black.show(); } }
[ "coffeeturbo@gmail.com" ]
coffeeturbo@gmail.com
e7bf1bce5f84ac4bcc017cbe5528a220315664e2
b0f2249198ba35cfe7f5e3cebbe4413eef264f14
/src/main/java/nd/esp/service/lifecycle/daos/titan/TitanRepositoryFactoryImpl.java
3d9e5a45d64470e16739978d223d1f49db6d049b
[]
no_license
434480761/wisdom_knowledge
f5f520cfb07685fd97d2d1a5970630a00b1fc69f
1ee22a3536c1247f7b78f6815befbd104670119b
refs/heads/master
2021-04-28T23:39:24.844625
2017-01-05T06:26:29
2017-01-05T06:26:29
77,729,017
0
2
null
null
null
null
UTF-8
Java
false
false
2,674
java
package nd.esp.service.lifecycle.daos.titan; import nd.esp.service.lifecycle.daos.titan.inter.*; import nd.esp.service.lifecycle.repository.Education; import nd.esp.service.lifecycle.repository.model.*; import nd.esp.service.lifecycle.support.busi.titan.TitanKeyWords; import nd.esp.service.lifecycle.utils.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; /** * Created by liuran on 2016/6/24. */ @Repository public class TitanRepositoryFactoryImpl implements TitanRepositoryFactory{ @Autowired private TitanCategoryRepository titanCategoryRepository ; @Autowired private TitanCoverageRepository titanCoverageRepository ; @Autowired private TitanRelationRepository titanRelationRepository ; @Autowired private TitanResourceRepository<Education> titanResourceRepository ; @Autowired private TitanTechInfoRepository titanTechInfoRepository ; @Autowired private TitanKnowledgeRelationRepository titanKnowledgeRelationRepository; @Autowired private TitanStatisticalRepository titanStatisticalRepository; public TitanEspRepository getEspRepository(Object model) { if (model instanceof Education) { return titanResourceRepository; } else if (model instanceof TechInfo) { return titanTechInfoRepository; } else if (model instanceof ResourceCategory) { return titanCategoryRepository; } else if (model instanceof ResourceRelation) { return titanRelationRepository; } else if (model instanceof ResCoverage) { return titanCoverageRepository; } else if (model instanceof KnowledgeRelation) { return titanKnowledgeRelationRepository; } else if (model instanceof ResourceStatistical){ return titanStatisticalRepository; } return null; } @Override public TitanEspRepository getEspRepositoryByLabel(String label) { if (StringUtils.isEmpty(label)){ return null; } if(TitanKeyWords.has_resource_statistical.toString().equals(label)){ return titanStatisticalRepository; } else if(TitanKeyWords.has_tech_info.toString().equals(label)){ return titanTechInfoRepository; } else if(TitanKeyWords.has_coverage.toString().equals(label)){ return titanCoverageRepository; } else if(TitanKeyWords.has_category_code.toString().equals(label)){ return titanCategoryRepository; } return null; } }
[ "901112@nd.com" ]
901112@nd.com
389e1ed014fc62b7d422d9cbe067681d95d84a30
5242e7cb0701e99e0382be87c292f56a564ce51f
/src/com/zhijia/util/HouseDBUtil.java
b2e1768cbd10f42c81384811d483bb5bb6ca50af
[]
no_license
wangleinumber1/zhijia
0d011148f07b51a1847ae2a7170c208ef8b5f58b
cb60ff15742cf6ea62d2c76efd90c046b9907173
refs/heads/master
2021-01-19T17:26:03.385131
2017-02-20T06:25:27
2017-02-20T06:25:27
82,456,920
1
0
null
null
null
null
UTF-8
Java
false
false
4,222
java
package com.zhijia.util; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import com.zhijia.Global; import java.util.Calendar; /** * 和房子相关的数据库工具类 */ public class HouseDBUtil { private static DBUtil dbUtil = new DBUtil(Global.getInstance()); /** * 创建一个浏览历史 * * @param hid 房子或小区ID * @param type 类型 取值为HouseType的一个 */ public static void addBrowseHistory(String hid, HouseType type) { SQLiteDatabase database = dbUtil.openDataBase(); database.execSQL("delete from " + DBUtil.BROWSE_HISTORY_TABLE + " where hid = ? and type = ?", new Object[]{hid, type}); database.execSQL("insert into " + DBUtil.BROWSE_HISTORY_TABLE + "(hid, type, millisecond) values(?,?,?)", new Object[]{hid, type, System.currentTimeMillis()}); dbUtil.closeDatabase(); } /** * 从数据库按照时间倒序取出指定count数的id串,用","分割,如:"1,2,3"。 * * @param type * @param begingIndex * @param count * @return 用","分割,如:"1,2,3",String可能为"",一定不为null; */ public static String getBrowseHistoryIds(HouseType type, int begingIndex, int count) { String returnStr = ""; SQLiteDatabase database = dbUtil.openDataBase(); String query = "SELECT hid FROM " + DBUtil.BROWSE_HISTORY_TABLE + " where type=? ORDER BY millisecond DESC LIMIT ?, ?"; Cursor cursor = database.rawQuery(query, new String[]{String.valueOf(type), String.valueOf(begingIndex), String.valueOf(count)}); if (cursor.getCount() > 0) { for (int i = 0; i < cursor.getCount(); i++) { cursor.moveToPosition(i); returnStr = returnStr + cursor.getString(cursor.getColumnIndex("hid")) + ","; } //去掉最后一个"," returnStr = returnStr.substring(0, returnStr.length() - 1); } dbUtil.closeDatabase(); return returnStr; } /** * 从数据库按照时间倒序取出指定count数的id串,用","分割,如:"1,2,3"。 * * @param type * * @return 用","分割,如:"1,2,3",String可能为"",一定不为null; */ public static String getBrowseHistoryIds(HouseType type) { String returnStr = ""; SQLiteDatabase database = dbUtil.openDataBase(); String query = "SELECT hid FROM " + DBUtil.BROWSE_HISTORY_TABLE + " where type=? ORDER BY millisecond DESC"; Cursor cursor = database.rawQuery(query, new String[]{String.valueOf(type)}); if (cursor.getCount() > 0) { for (int i = 0; i < cursor.getCount(); i++) { cursor.moveToPosition(i); returnStr = returnStr + cursor.getString(cursor.getColumnIndex("hid")) + ","; } //去掉最后一个"," returnStr = returnStr.substring(0, returnStr.length() - 1); } dbUtil.closeDatabase(); return returnStr; } /** * 获得一条记录的浏览时间 * * @param hid 房子id * @param type 类型 取值为HouseType的一个 * @return 时间字符串,格式为:"yyyy-MM-dd HH:mm:ss"或者是""串,一定不为null。 */ public static String getBrowseDateTime(String hid, HouseType type) { String returnStr = ""; SQLiteDatabase database = dbUtil.openDataBase(); String query = "SELECT millisecond FROM " + DBUtil.BROWSE_HISTORY_TABLE + " where hid=? and type=?"; Cursor cursor = database.rawQuery(query, new String[]{hid, String.valueOf(type)}); if (cursor.getCount() > 0) { cursor.moveToPosition(0); long millisecond = cursor.getLong(cursor.getColumnIndex("millisecond")); Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(millisecond); returnStr = Global.DEFAULT_DF.format(calendar.getTime()); } return returnStr; } /** * 类型 */ public static enum HouseType { NEW_HOUSE, OLD_HOUSE, RENT_HOUSE, COMMUNITY } }
[ "wang.lei@ecschina.com" ]
wang.lei@ecschina.com
ddac8423034b37aed5e613a1f559f8b53612d2f9
aabe2ea8969e783409e32328a3fb7fe0330eadfd
/src/main/java/com/ballo/core/akka/sl/skatteinfo/message/MapSlSaker.java
fe5236d6f64c1695b570baee4bf1da1b3a93974e
[]
no_license
TorAageBallo/akka-sl-skatteinfo
314b36e229cd0f75ab73637b7c586534c952c532
28ae9d48cfc0ead4fa14e1e5ab618b0d874feff1
refs/heads/master
2016-09-05T12:51:20.711810
2014-10-09T18:16:37
2014-10-09T18:16:37
25,001,260
1
0
null
null
null
null
UTF-8
Java
false
false
346
java
package com.ballo.core.akka.sl.skatteinfo.message; import com.ballo.core.akka.sl.skatteinfo.domain.SlSak; import java.util.List; public class MapSlSaker { private List<SlSak> slSaker; public MapSlSaker(List<SlSak> slSaker) { this.slSaker = slSaker; } public List<SlSak> getSlSaker() { return slSaker; } }
[ "torage.ballo@gmail.com" ]
torage.ballo@gmail.com
f9edc1ddf6ede52f2666ffc89894bbabed36ff05
56732797d3af05a0eb18e0e38ab78ad8d2455d76
/test/java/com/rapleaf/hank/util/TestEncodingHelper.java
bd90a0d0ebae0870c25fcfabfcd9909e296a4deb
[]
no_license
bryanduxbury/hank
4f7035e58b52e0b7e7c164829b3436dbb97bf130
0ca82ceda51ae8b61bb97590dea72e35efce333e
refs/heads/master
2021-01-18T11:45:08.264160
2012-07-31T23:42:00
2012-07-31T23:42:00
1,328,283
66
12
null
null
null
null
UTF-8
Java
false
false
3,385
java
/** * Copyright 2011 Rapleaf * * 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.rapleaf.hank.util; import java.nio.ByteBuffer; import junit.framework.TestCase; public class TestEncodingHelper extends TestCase { public void testEncodeLittleEndianFixedWidthLong() throws Exception { byte[] arr = new byte[3]; EncodingHelper.encodeLittleEndianFixedWidthLong(1, arr); assertEquals(ByteBuffer.wrap(new byte[]{1, 0, 0}), ByteBuffer.wrap(arr)); EncodingHelper.encodeLittleEndianFixedWidthLong(-1, arr); assertEquals(ByteBuffer.wrap(new byte[]{-1, -1, -1}), ByteBuffer.wrap(arr)); EncodingHelper.encodeLittleEndianFixedWidthLong(0x001ff, arr); assertEquals(ByteBuffer.wrap(new byte[]{-1, 1, 0}), ByteBuffer.wrap(arr)); } public void testDecodeLittleEndianFixedWidthLong() throws Exception { byte[] arr = new byte[]{1, 0, 0}; assertEquals(1, EncodingHelper.decodeLittleEndianFixedWidthLong(ByteBuffer.wrap(arr))); arr = new byte[]{-1, -1, -1}; assertEquals(0xffffffL, EncodingHelper.decodeLittleEndianFixedWidthLong(ByteBuffer.wrap(arr))); arr = new byte[]{-1, 1, 0}; assertEquals(0x0001ff, EncodingHelper.decodeLittleEndianFixedWidthLong(ByteBuffer.wrap(arr))); } public void testEncodeLitteEndianVarInt() throws Exception { byte[] buffer = new byte[EncodingHelper.MAX_VARINT_SIZE]; assertEquals(1, EncodingHelper.encodeLittleEndianVarInt(1, buffer)); assertEquals(ByteBuffer.wrap(new byte[]{1}), ByteBuffer.wrap(buffer, 0, 1)); assertEquals(1, EncodingHelper.encodeLittleEndianVarInt(10, buffer)); assertEquals(ByteBuffer.wrap(new byte[]{10}), ByteBuffer.wrap(buffer, 0, 1)); assertEquals(1, EncodingHelper.encodeLittleEndianVarInt(127, buffer)); assertEquals(ByteBuffer.wrap(new byte[]{127}), ByteBuffer.wrap(buffer, 0, 1)); assertEquals(2, EncodingHelper.encodeLittleEndianVarInt(128, buffer)); assertEquals(ByteBuffer.wrap(new byte[]{(byte)0x80, 1}), ByteBuffer.wrap(buffer, 0, 2)); assertEquals(5, EncodingHelper.encodeLittleEndianVarInt(0x7fffffff, buffer)); assertEquals(ByteBuffer.wrap(new byte[]{-1, -1, -1, -1, 0x07}), ByteBuffer.wrap(buffer, 0, 5)); } public void testDecodeLittleEndianVarInt() throws Exception { assertEquals(1, EncodingHelper.decodeLittleEndianVarInt(ByteBuffer.wrap(new byte[]{1}))); assertEquals(10, EncodingHelper.decodeLittleEndianVarInt(ByteBuffer.wrap(new byte[]{10}))); assertEquals(127, EncodingHelper.decodeLittleEndianVarInt(ByteBuffer.wrap(new byte[]{127}))); assertEquals(128, EncodingHelper.decodeLittleEndianVarInt(ByteBuffer.wrap(new byte[]{-128, 1}))); assertEquals(10, EncodingHelper.decodeLittleEndianVarInt(ByteBuffer.wrap(new byte[]{10}))); assertEquals(0x7fffffff, EncodingHelper.decodeLittleEndianVarInt(ByteBuffer.wrap(new byte[]{-1, -1, -1, -1, 0x07}))); } }
[ "bryan@rapleaf.com" ]
bryan@rapleaf.com
096393ea7e06decf7fe52a31f5c2546324941307
8069728e6600b4231613c8ac22a14fd88ea4f36a
/ProjectAED/src/Business/Role/NOCMonitorRole.java
2c90f4ea444b5bec3d1f07a78b6a693bcc3104b3
[]
no_license
JayaLekhrajani/JAVA-Project-Cybersecurity
e56b05998c942b26630f48c31d31f7de769f972d
2f9fcb095e8a0021a82d95cc34344d9c289935dd
refs/heads/master
2021-01-19T12:16:04.765062
2016-10-04T08:11:26
2016-10-04T08:11:26
69,945,458
0
0
null
null
null
null
UTF-8
Java
false
false
1,115
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 Business.Role; import userInterface.MainJFrame; import Business.EcoSystem; import Business.Enterprise.Enterprise; import Business.Organization.MonitoringTeamOrganization; import Business.Organization.Organization; import Business.UserAccount.UserAccount; import javax.swing.JPanel; import userInterface.IncidentManagerRole.IncidentManagerWorkArea; import userInterface.MonitoringTeamRole.MonitoringTeamWorkArea; /** * * @author Jaya_L */ public class NOCMonitorRole extends Role { @Override public JPanel createWorkArea(JPanel userProcessContainer, UserAccount account, Organization organization, Enterprise enterprise, EcoSystem business) { return new MonitoringTeamWorkArea(userProcessContainer, account, (MonitoringTeamOrganization)organization, enterprise, business); } @Override public String toString() { return "NOC Monitor"; } }
[ "jayalekhrajani26@gmail.com" ]
jayalekhrajani26@gmail.com
74cff1d2f0a75c477ffa6a28c3f6c26608def23d
e5c3b20c8230e06297b5b43228729f00f06b1098
/app/src/main/java/com/haribit/testgameproject/android/SoundPlay.java
0fed4f0b76c1b24f9481788f7aaea4ef7027bad2
[]
no_license
48214789/lianliankan
db55e42edb7f77074a84dbcda6801f1cf9eeb325
014ff53166079c647958221c71bb665ee64e4acc
refs/heads/master
2020-04-24T14:14:24.442194
2019-02-22T07:46:21
2019-02-22T07:46:21
172,013,734
1
0
null
null
null
null
UTF-8
Java
false
false
1,884
java
package com.haribit.testgameproject.android; import android.content.Context; import android.media.AudioManager; import android.media.SoundPool; import java.util.HashMap; public class SoundPlay { // 音效的音量 int streamVolume; // 定义SoundPool 对象 private SoundPool soundPool; // 定义HASH表 private HashMap<Integer, Integer> soundPoolMap; /*************************************************************** * Function: initSounds(); Parameters: null Returns: None. Description: * 初始化声音系统 Notes: none. ***************************************************************/ public void initSounds(Context context) { // 初始化soundPool 对象,第一个参数是允许有多少个声音流同时播放,第2个参数是声音类型,第三个参数是声音的品质 soundPool = new SoundPool(25, AudioManager.STREAM_MUSIC, 100); // 初始化HASH表 soundPoolMap = new HashMap<Integer, Integer>(); // 获得声音设备和设备音量 AudioManager mgr = (AudioManager) context .getSystemService(Context.AUDIO_SERVICE); streamVolume = mgr.getStreamVolume(AudioManager.STREAM_MUSIC); } /** * 把资源中的音效加载到指定的ID(播放的时候就对应到这个ID播放就行了) * Function: loadSfx(); Parameters: null Returns: None. Description: 加载音效资源 * Notes: none. */ public void loadSfx(Context context, int raw, int ID) { soundPoolMap.put(ID, soundPool.load(context, raw, 1)); } /*************************************************************** * Function: play(); Parameters: sound:要播放的音效的ID, loop:循环次数 Returns: None. * Description: 播放声音 Notes: none. ***************************************************************/ public void play(int sound, int uLoop) { soundPool.play(soundPoolMap.get(sound), streamVolume, streamVolume, 1, uLoop, 1f); } }
[ "17600045177@163.com" ]
17600045177@163.com
3ad485c156c5e27cb87e16eeca8301e2bfe80080
4f4ab49df90759b3deacf834afdc841d41b888ba
/app/src/main/java/voed/voed/hlrcon/Console.java
285f1faf1c774387fffc309a08ad802d7a139640
[]
no_license
voed/HLRcon
6f6ff3ef4b6a211d7dd7ce09c19e72475f89b16a
b8112bcf6e2adc46dde2aa9106e818031408178c
refs/heads/master
2021-01-09T21:54:33.610649
2016-03-10T20:17:40
2016-03-10T20:17:40
53,614,079
1
0
null
null
null
null
UTF-8
Java
false
false
6,700
java
package voed.voed.hlrcon; //import com.gc.materialdesign.views.ProgressBarIndeterminate; import voed.voed.hlrcon.steamcondenser.exceptions.*; import voed.voed.hlrcon.steamcondenser.steam.servers.GoldSrcServer; import voed.voed.hlrcon.steamcondenser.steam.sockets.GoldSrcSocket; import com.rengwuxian.materialedittext.MaterialEditText; import android.graphics.Typeface; import android.os.AsyncTask; import android.os.Build; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.EditText; import android.widget.ImageButton; import android.widget.TextView; import org.apache.commons.lang3.StringUtils; import java.io.DataInputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.DatagramPacket; import java.net.DatagramSocket; import java.net.ServerSocket; import java.net.Socket; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeoutException; public class Console extends AppCompatActivity { public static MaterialEditText ecmd; public static EditText econsole; private static Server server; public Connect connect; private AsyncTask<Void, Void, Void> async; //public ProgressBarIndeterminate console_progress; @Override protected void onCreate(Bundle savedInstanceState) { //StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); //StrictMode.setThreadPolicy(policy); super.onCreate(savedInstanceState); setContentView(R.layout.activity_console); final Toolbar toolbar = (Toolbar) findViewById(R.id.consoletoolbar); //toolbar.setLogo(R.drawable.hlrcon); setSupportActionBar(toolbar); getSupportActionBar().setDisplayShowHomeEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true); //console_progress = (ProgressBarIndeterminate)findViewById(R.id.console_progress); connect = new Connect(); server = (Server) getIntent().getSerializableExtra("server"); ecmd = (MaterialEditText)this.findViewById(R.id.editText5); econsole = (EditText) this.findViewById(R.id.editText4); //ecmd.requestFocus(); ImageButton btn2 = (ImageButton) findViewById(R.id.button_send); btn2.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { //Toast.makeText(getApplicationContext(), server.getIP() + server.getPort(), Toast.LENGTH_LONG).show(); if(StringUtils.isNotBlank(ecmd.getText().toString())) { sendCommand(); } } }); } public void sendCommand() { if(connect.getStatus() == AsyncTask.Status.RUNNING) return; //Toast.makeText(getApplicationContext(), server.getIP() + ":" + server.getPort() + " | " + server.getPass(), Toast.LENGTH_SHORT).show(); connect = new Connect(); connect.execute(ecmd.getText().toString()); //console_progress.setVisibility(View.VISIBLE); } public void start() { } /*public void getlogs() { async = new AsyncTask<Void, Void, Void>() { @Override protected Void doInBackground(Void... params) { byte[] lMsg = new byte[4096]; DatagramPacket dp = new DatagramPacket(lMsg, lMsg.length); DatagramSocket ds = null; try { ds = new DatagramSocket(0); Log.d("CONLOGS", "Port " + ds.getLocalPort()); GoldSrcServer srv = new GoldSrcServer(server.getIP(), server.getPort()); srv.rconAuth(server.getPass()); srv.rconExec("logaddress_add 192.168.1.37 " + Integer.toString(ds.getLocalPort())); while(true) { ds.receive(dp); Log.d("CONLOGS", new String(lMsg, 0, dp.getLength())); } } catch (Exception e) { Log.d("CONLOGS", e.toString()); } finally { if (ds != null) { ds.close(); } } return null; } }; async.execute(); }*/ public class Connect extends AsyncTask<String, Void, String> { protected String doInBackground(String... args) { String output; try { GoldSrcServer srv = new GoldSrcServer(server.getIP(), server.getPort()); srv.rconAuth(server.getPass()); output = srv.rconExec(args[0]); } catch(RCONNoAuthException e) { output = "Неверный RCON пароль."; } catch(TimeoutException e) { output = "Сервер не отвечает."; } catch(SteamCondenserException e) { output = e.toString(); } return output; } protected void onPostExecute(String result) { econsole.append(">" + ecmd.getText().toString() + "\n"); econsole.append(result + "\n"); ecmd.setText(""); //console_progress.setVisibility(View.GONE); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_console, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); switch(id) { case android.R.id.home: finish(); break; } if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }
[ "n05kill@hotmail.com" ]
n05kill@hotmail.com
e47a75f7a54339b9c90b5829a0d90b6272fcf382
838fbda9fc95f1f5eb93508a5a8bbcc93f701988
/Atoz.java
9b407ecc42a51ca8e2bcab7a8a72174f74381a2e
[]
no_license
SheetalPatil8109/MyRemoteRepo
4483aa371ed0572bff905831c1afea6e35d829e5
5637647cb6749ea5b714aaf3f9d0fe696e19b2b2
refs/heads/main
2023-04-16T10:47:22.743020
2021-04-22T09:37:21
2021-04-22T09:37:21
360,399,589
0
0
null
null
null
null
UTF-8
Java
false
false
102
java
public class Abc { public static void main(String args[]) { System.out.println("good morning"); } }
[ "sheetal.patil@ibm.com" ]
sheetal.patil@ibm.com
81f7f12cb83f3a99a3a55f0c44d4484402893573
4440994a07727d667abb6ce5fe174e338b29f4eb
/app/src/androidTest/java/com/company/p5/ExampleInstrumentedTest.java
f81b9235fe40884f326874cd18e953c6ce743ddb
[]
no_license
gerardfp/P5
484aa2622931e99e62cfe318d2f3edfd644fbb14
3b8dda6c8594c6bfb36f0bc8dc1502efb136c179
refs/heads/master
2020-08-03T19:22:33.237045
2019-11-11T11:55:44
2019-11-11T11:55:44
211,859,995
0
0
null
null
null
null
UTF-8
Java
false
false
744
java
package com.company.p5; import android.content.Context; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); assertEquals("com.company.p5", appContext.getPackageName()); } }
[ "gerardfp@gmail.com" ]
gerardfp@gmail.com
75fe187f4f32e0b092e71186c90a529f4de17306
8b46177c46c00917ed115dfa5d48d4a7ff271562
/src/primetables/IMatrixComputationBehaviour.java
48e96c4b4445864d618593731e29c6598293d701
[]
no_license
leoncard/PrimeTables
ea1e0233b9e36f9d6d1a19a877d71d9c27bddda5
a6c046403824b811057178b2e783cf6e52fefdc6
refs/heads/master
2021-08-11T22:37:11.393818
2017-11-14T06:17:35
2017-11-14T06:17:35
110,118,558
0
0
null
null
null
null
UTF-8
Java
false
false
430
java
package primetables; /** * * Interface for the matrix computation behaviours * @author Leonardo Cardoso */ public interface IMatrixComputationBehaviour { /** * Method to be implemented by ComputationBehaviour classes. Calculates the resulting array after a computation was applied to it. * @param n The number of primes * @return the matrix after the computation * */ public long[][] calculate(int[] n); }
[ "cardosoeb@gmail.com" ]
cardosoeb@gmail.com
6a7a2151a7bb3624ba48a17be6718b119548101c
ebcf52260991690682f816d510e85a7ff60512dd
/system/common/src/main/java/com/brasajava/mail/config/EmailConfig.java
92bd6f29a916ace4b8e1606da96d338f1bd74afb
[]
no_license
ricardomaximino2/elk
e4dd49bfa79d69f6aaa2b3646b1b789aeae87f61
1333f5d7e5df551276b0f0841938cf889b8793af
refs/heads/master
2020-12-02T08:27:40.202294
2020-03-11T06:31:20
2020-03-11T06:31:20
230,941,403
0
1
null
2020-01-12T16:53:11
2019-12-30T15:50:22
Java
UTF-8
Java
false
false
1,921
java
package com.brasajava.mail.config; import com.brasajava.mail.service.MailService; import com.brasajava.mail.service.MailTemplateService; import com.brasajava.mail.service.impl.MailServiceImpl; import com.brasajava.mail.service.impl.MailTemplateServiceImpl; import org.springframework.boot.autoconfigure.mail.MailProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.MessageSource; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.mail.javamail.JavaMailSender; import org.springframework.mail.javamail.JavaMailSenderImpl; import org.thymeleaf.TemplateEngine; import java.util.Properties; @EnableConfigurationProperties(MailProperties.class) @Configuration public class EmailConfig { private static final String EMAIL_TEMPLATE_ENCODING = "UTF-8"; private MessageSource messageSource; @Bean public JavaMailSender createJavaMailSender(MailProperties mailProperties) { JavaMailSenderImpl javaMailSender = new JavaMailSenderImpl(); javaMailSender.setHost(mailProperties.getHost()); javaMailSender.setPort(mailProperties.getPort()); javaMailSender.setUsername(mailProperties.getUsername()); javaMailSender.setPassword(mailProperties.getPassword()); Properties properties = new Properties(); properties.putAll(mailProperties.getProperties()); javaMailSender.setJavaMailProperties(properties); return javaMailSender; } @Bean public MailService getEmailService(JavaMailSender emailSender, MailTemplateService mailTemplateService){ return new MailServiceImpl(emailSender,mailTemplateService); } @Bean public MailTemplateService getMailTemplateService(TemplateEngine templateEngine){ return new MailTemplateServiceImpl(templateEngine); } }
[ "rmaximin@intrasoft-intl.com" ]
rmaximin@intrasoft-intl.com
aa2630713e7ae1f976c3d652550b93ce1be61b3f
95f83ff13a5f009c52be65d571f34ce1d9a28b46
/src/main/java/com/great/dao/LinkCardMapper.java
de21b6564dde198eeec3a89d1266657ea1f14fbb
[]
no_license
piyingxu/order-manage
e53d82861527c8cc88f881404a57049cb6eb1d03
e573ec3b9f718202e1d751915f1ecb9484ba9cb9
refs/heads/master
2020-05-02T11:37:36.475090
2019-03-27T09:15:11
2019-03-27T09:15:11
177,934,884
0
1
null
null
null
null
UTF-8
Java
false
false
355
java
package com.great.dao; import com.great.model.LinkCard; public interface LinkCardMapper { int deleteByPrimaryKey(String id); int insert(LinkCard record); int insertSelective(LinkCard record); LinkCard selectByPrimaryKey(String id); int updateByPrimaryKeySelective(LinkCard record); int updateByPrimaryKey(LinkCard record); }
[ "516609723@qq.com" ]
516609723@qq.com
bb327c2e3e0874ddbd53026312200be340d206cb
3b5f8eba78d24dee1ad4b230e4136d3de569cad0
/DAOFAB_Assignment/src/main/java/com/example/daofab_assignment/DaofabAssignmentApplication.java
c2531f0cb6963feaca6f378c158d22e0617a41b0
[]
no_license
lthcong/DAOFAB_Assignment
b07203a792361a7edac90c9cc2f1c229faa8b844
d5ed12753881d1b8f5ac5cac9ad9981c5f70fd51
refs/heads/main
2023-07-15T10:48:11.203419
2021-08-17T12:07:53
2021-08-17T12:07:53
395,938,511
0
0
null
null
null
null
UTF-8
Java
false
false
527
java
package com.example.daofab_assignment; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; @SpringBootApplication @EnableJpaRepositories(basePackages = { "com.example.daofab_assignment.repository", } ) public class DaofabAssignmentApplication { public static void main(String[] args) { SpringApplication.run(DaofabAssignmentApplication.class, args); } }
[ "lthcongit@gmail.com" ]
lthcongit@gmail.com
4b30cf3be49b8f732390a764db9e733bf80db38c
251a80b004622b573a36d63660fff1d0f6f5913e
/product/src/main/java/com/shine/product/service/PmsSkuImagesService.java
7cc1a23282ea8413d2ab85fd90bb75d891e001c4
[ "Apache-2.0" ]
permissive
ShineXxx/e-commerce
154adafe104bf9a22dc5fcd500efb002a0d4b2c6
fff645fa11544181e1d2ed073d8e426cb6b33ebb
refs/heads/main
2023-07-31T13:49:43.128136
2021-09-14T14:05:41
2021-09-14T14:05:41
405,146,512
0
0
null
null
null
null
UTF-8
Java
false
false
448
java
package com.shine.product.service; import com.baomidou.mybatisplus.extension.service.IService; import com.shine.common.utils.PageUtils; import com.shine.product.entity.PmsSkuImagesEntity; import java.util.Map; /** * sku图片 * * @author zhaoyao * @email zhaoyaoya@gmail.com * @date 2021-09-13 22:04:14 */ public interface PmsSkuImagesService extends IService<PmsSkuImagesEntity> { PageUtils queryPage(Map<String, Object> params); }
[ "15725385907@163.com" ]
15725385907@163.com
1aa46ca4a92b11c2a7f5945f46b048c77570d6cf
41f1d93f7482327d1f23d65941ed8415218d53cb
/src/test/java/com/timiris/crm/service/UserServiceIntTest.java
33678cf2147dd0fd275af2aa56125f03dfc33a98
[]
no_license
timiris/crm
440120fbe9ce836810f1c51c02c7ebe84286197f
8b3ab3f42979f2150c38a1d7b9b783498aae9d44
refs/heads/master
2021-01-01T05:57:44.742216
2017-07-15T13:59:53
2017-07-15T13:59:53
97,318,901
0
0
null
null
null
null
UTF-8
Java
false
false
6,906
java
package com.timiris.crm.service; import com.timiris.crm.TimirisCrmApp; import com.timiris.crm.domain.PersistentToken; import com.timiris.crm.domain.User; import com.timiris.crm.repository.PersistentTokenRepository; import com.timiris.crm.config.Constants; import com.timiris.crm.repository.UserRepository; import com.timiris.crm.service.dto.UserDTO; import com.timiris.crm.service.util.RandomUtil; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.transaction.annotation.Transactional; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import java.time.LocalDate; import java.time.Instant; import java.time.temporal.ChronoUnit; import java.util.Optional; import java.util.List; import static org.assertj.core.api.Assertions.*; /** * Test class for the UserResource REST controller. * * @see UserService */ @RunWith(SpringRunner.class) @SpringBootTest(classes = TimirisCrmApp.class) @Transactional public class UserServiceIntTest { @Autowired private PersistentTokenRepository persistentTokenRepository; @Autowired private UserRepository userRepository; @Autowired private UserService userService; @Test public void testRemoveOldPersistentTokens() { User admin = userRepository.findOneByLogin("admin").get(); int existingCount = persistentTokenRepository.findByUser(admin).size(); generateUserToken(admin, "1111-1111", LocalDate.now()); LocalDate now = LocalDate.now(); generateUserToken(admin, "2222-2222", now.minusDays(32)); assertThat(persistentTokenRepository.findByUser(admin)).hasSize(existingCount + 2); userService.removeOldPersistentTokens(); assertThat(persistentTokenRepository.findByUser(admin)).hasSize(existingCount + 1); } @Test public void assertThatUserMustExistToResetPassword() { Optional<User> maybeUser = userService.requestPasswordReset("john.doe@localhost"); assertThat(maybeUser.isPresent()).isFalse(); maybeUser = userService.requestPasswordReset("admin@localhost"); assertThat(maybeUser.isPresent()).isTrue(); assertThat(maybeUser.get().getEmail()).isEqualTo("admin@localhost"); assertThat(maybeUser.get().getResetDate()).isNotNull(); assertThat(maybeUser.get().getResetKey()).isNotNull(); } @Test public void assertThatOnlyActivatedUserCanRequestPasswordReset() { User user = userService.createUser("johndoe", "johndoe", "John", "Doe", "john.doe@localhost", "http://placehold.it/50x50", "en-US"); Optional<User> maybeUser = userService.requestPasswordReset("john.doe@localhost"); assertThat(maybeUser.isPresent()).isFalse(); userRepository.delete(user); } @Test public void assertThatResetKeyMustNotBeOlderThan24Hours() { User user = userService.createUser("johndoe", "johndoe", "John", "Doe", "john.doe@localhost", "http://placehold.it/50x50", "en-US"); Instant daysAgo = Instant.now().minus(25, ChronoUnit.HOURS); String resetKey = RandomUtil.generateResetKey(); user.setActivated(true); user.setResetDate(daysAgo); user.setResetKey(resetKey); userRepository.save(user); Optional<User> maybeUser = userService.completePasswordReset("johndoe2", user.getResetKey()); assertThat(maybeUser.isPresent()).isFalse(); userRepository.delete(user); } @Test public void assertThatResetKeyMustBeValid() { User user = userService.createUser("johndoe", "johndoe", "John", "Doe", "john.doe@localhost", "http://placehold.it/50x50", "en-US"); Instant daysAgo = Instant.now().minus(25, ChronoUnit.HOURS); user.setActivated(true); user.setResetDate(daysAgo); user.setResetKey("1234"); userRepository.save(user); Optional<User> maybeUser = userService.completePasswordReset("johndoe2", user.getResetKey()); assertThat(maybeUser.isPresent()).isFalse(); userRepository.delete(user); } @Test public void assertThatUserCanResetPassword() { User user = userService.createUser("johndoe", "johndoe", "John", "Doe", "john.doe@localhost", "http://placehold.it/50x50", "en-US"); String oldPassword = user.getPassword(); Instant daysAgo = Instant.now().minus(2, ChronoUnit.HOURS); String resetKey = RandomUtil.generateResetKey(); user.setActivated(true); user.setResetDate(daysAgo); user.setResetKey(resetKey); userRepository.save(user); Optional<User> maybeUser = userService.completePasswordReset("johndoe2", user.getResetKey()); assertThat(maybeUser.isPresent()).isTrue(); assertThat(maybeUser.get().getResetDate()).isNull(); assertThat(maybeUser.get().getResetKey()).isNull(); assertThat(maybeUser.get().getPassword()).isNotEqualTo(oldPassword); userRepository.delete(user); } @Test public void testFindNotActivatedUsersByCreationDateBefore() { userService.removeNotActivatedUsers(); Instant now = Instant.now(); List<User> users = userRepository.findAllByActivatedIsFalseAndCreatedDateBefore(now.minus(3, ChronoUnit.DAYS)); assertThat(users).isEmpty(); } private void generateUserToken(User user, String tokenSeries, LocalDate localDate) { PersistentToken token = new PersistentToken(); token.setSeries(tokenSeries); token.setUser(user); token.setTokenValue(tokenSeries + "-data"); token.setTokenDate(localDate); token.setIpAddress("127.0.0.1"); token.setUserAgent("Test agent"); persistentTokenRepository.saveAndFlush(token); } @Test public void assertThatAnonymousUserIsNotGet() { final PageRequest pageable = new PageRequest(0, (int) userRepository.count()); final Page<UserDTO> allManagedUsers = userService.getAllManagedUsers(pageable); assertThat(allManagedUsers.getContent().stream() .noneMatch(user -> Constants.ANONYMOUS_USER.equals(user.getLogin()))) .isTrue(); } @Test public void testRemoveNotActivatedUsers() { User user = userService.createUser("johndoe", "johndoe", "John", "Doe", "john.doe@localhost", "http://placehold.it/50x50", "en-US"); user.setActivated(false); user.setCreatedDate(Instant.now().minus(30, ChronoUnit.DAYS)); userRepository.save(user); assertThat(userRepository.findOneByLogin("johndoe")).isPresent(); userService.removeNotActivatedUsers(); assertThat(userRepository.findOneByLogin("johndoe")).isNotPresent(); } }
[ "abeidi.yacoub@gmail.com" ]
abeidi.yacoub@gmail.com
50932d8d0bd9e1e0ca80128ce5d4aca0f60fac08
1dd6eb64e9bf94c373448f7e120f07106ded9888
/app/src/main/java/cz/hlubyluk/myapplication/ICancel.java
49284d4fe3cf2800fa7b3518620f241019ec652b
[]
no_license
HlubyLuk/kuf
176af70e225b0ca6e1361c5b32e67cf8b1a0033a
e00b79aaad78f3e0f5e51bccf8162a0598101619
refs/heads/master
2021-01-10T17:49:10.608348
2016-03-28T16:49:14
2016-03-28T16:49:14
54,910,256
0
0
null
null
null
null
UTF-8
Java
false
false
132
java
package cz.hlubyluk.myapplication; /** * Created by HlubyLuk on 28.03.16. */ public interface ICancel { void onCancel(); }
[ "lukas.hlubucek@gmail.com" ]
lukas.hlubucek@gmail.com
0bceb8f76efc387468dd825fa86240177cb741f6
56825934f9d85a857e99d5e9a621eb8f08638eb7
/src/enumtask/service/MonthService.java
896717de9fd2af8b912040ba31ebde44e0b025ff
[]
no_license
annazizian/EPAM_Homeworks
d5bd094add5a4d6d4759c717ca174ac713fe03f3
4a89b4907d9efded94a917ba745bcf2bb6d962d3
refs/heads/master
2022-04-09T07:38:32.541750
2020-02-29T13:48:32
2020-02-29T13:48:32
235,522,872
0
0
null
2020-02-29T13:48:34
2020-01-22T07:42:18
Java
UTF-8
Java
false
false
1,828
java
package enumtask.service; import enumtask.exception.DayIsOutOfBoundsException; import enumtask.exception.NoSuchMonthException; import enumtask.model.Month; import java.util.Arrays; public class MonthService { public boolean isHoliday(Month month, int day) { if (month == null) { throw new NoSuchMonthException("There is no such month"); } if (day < 1 || day > Month.getNumberOfDays(month)) { throw new DayIsOutOfBoundsException("There is no such day in the month"); } for (int i = 0; i < getNumberOfHolidaysInMonth(month); i++) { if (month.getHolidaysInMonth(month)[i] == day) { return true; } } return false; } public int getNumberOfHolidaysInMonth(Month month) { if (month == null) { throw new NoSuchMonthException("There is no such month"); } return month.getHolidaysInMonth(month).length; } public static void printHolidaysOfMonth(Month month) { if (month == null) { throw new NoSuchMonthException("There is no such month"); } System.out.println("Holidays of " + month.name().toLowerCase() + " are " + Arrays.toString(month.getHolidaysInMonth(month)) + "\n"); } public void traverseAndPrintMonthName(Month month) { if (month == null) { throw new NoSuchMonthException("There is no such month"); } StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append(month.name().toLowerCase()); stringBuilder.reverse(); System.out.println(stringBuilder); } public void printAllMonths() { for (Month month : Month.values()) { System.out.println(month.name().toLowerCase()); } } }
[ "annazizian9@gmail.com" ]
annazizian9@gmail.com
8ca0bafd7bb3154fbe9326b1173b2de055c6df6f
0e02393f6d9c09f2453c3e7bc729052ff74f922f
/hBPostal/src/main/java/com/ksource/hbpostal/bean/OrderDetailResultBean.java
baf4a520d86bbb9be839ab3c23aacc0137aadb71
[]
no_license
eaglelhq/HBPostal
fbcb6765d082940cb3511c2312ab9b1cbe8c3180
76df376aed3022506bbb1eacc598dbc1377242ba
refs/heads/master
2021-05-05T19:55:44.299097
2018-11-12T02:49:23
2018-11-12T02:49:23
103,887,994
0
0
null
null
null
null
UTF-8
Java
false
false
6,130
java
package com.ksource.hbpostal.bean; import java.io.Serializable; import java.util.List; public class OrderDetailResultBean implements Serializable{ /** * ID : d40425fe4ca9450586b99ec43b48b82c * ORDER_ID : DD-20161027-207742 * MEMBER_ID : 272dab18a37e4b6bb4bc9d48253c7c2c * STATE : 0 * CREATE_TIME : 20161027195312 * PAY_STATE : 0 * PAY_TYPE : null * BUY_WAY : 0 * TOTAL_PRICE : 5000 * TOTAL_JF : 0 * SEND_TYPE : 1 * TAKE_PLACE : * TAKE_PLACE_ID : * ORDER_TYPE : 1 * PROVINCE_ID : 2668e3fd58e84288a9a23cccaa902612 * PROVINCE_NAME : 新疆维吾尔自治区 * CITY_ID : 365d8d0215dc4b269d35c22f780a7f91 * CITY_NAME : 阿拉尔 * AREA_ID : * AREA_NAME : * ADDRESS : 哈哈哈哈哈哈 * PERSON : null * MOBILE : 25555555 * ORDER_NOTE : * SEND_USER_ID : null * SEND_USER_NAME : null * EXPRESS_CODE : null * ZF_TIME : null * FH_TIME : null * COMPLETE_TIME : null * PAY_CODE : null * DEL_STATE : 1 * SEND_PRICE : null * EXPRESS : null * DHCZ_ID : null * DHCZ_NAME : null * BUY_NUM : 1 * TOTAL_NUM : 1 * TOTAL_MONEY : 5000 * MEMBER_NAME : 会员名5 * goodsList : [{"ID":"b3f16d66f9d4404c89da7f91780e7e1b","GOODS_ID":"1a8beaca5cfd48ccbc2c9fe88013477a","GOODS_NAME":"iPhone5","ONE_USE_SCORE":0,"ONE_USE_MONEY":5000,"BUY_NUM":1,"TOTAL_MONEY":5000,"TOTAL_SCORE":0,"GOODS_NOTE":null,"ORDER_ID":"d40425fe4ca9450586b99ec43b48b82c","GOODS_TYPE":null,"REVIEW_STATE":0,"GOODS_CODE":"22222221","IMAGE":"/upload/infofiles/20161028091920_3020.jpg","PAY_TYPE":1,"LV1_NAME":"电脑、办公","LV2_NAME":"水生动物","LV3_NAME":"鲸鱼"}] */ public OrderInfoBean orderInfo; /** * orderInfo : {"ID":"d40425fe4ca9450586b99ec43b48b82c","ORDER_ID":"DD-20161027-207742","MEMBER_ID":"272dab18a37e4b6bb4bc9d48253c7c2c","STATE":0,"CREATE_TIME":20161027195312,"PAY_STATE":0,"PAY_TYPE":null,"BUY_WAY":0,"TOTAL_PRICE":5000,"TOTAL_JF":0,"SEND_TYPE":1,"TAKE_PLACE":"","TAKE_PLACE_ID":"","ORDER_TYPE":1,"PROVINCE_ID":"2668e3fd58e84288a9a23cccaa902612","PROVINCE_NAME":"新疆维吾尔自治区","CITY_ID":"365d8d0215dc4b269d35c22f780a7f91","CITY_NAME":"阿拉尔","AREA_ID":"","AREA_NAME":"","ADDRESS":"哈哈哈哈哈哈","PERSON":null,"MOBILE":"25555555","ORDER_NOTE":"","SEND_USER_ID":null,"SEND_USER_NAME":null,"EXPRESS_CODE":null,"ZF_TIME":null,"FH_TIME":null,"COMPLETE_TIME":null,"PAY_CODE":null,"DEL_STATE":1,"SEND_PRICE":null,"EXPRESS":null,"DHCZ_ID":null,"DHCZ_NAME":null,"BUY_NUM":1,"TOTAL_NUM":1,"TOTAL_MONEY":5000,"MEMBER_NAME":"会员名5","goodsList":[{"ID":"b3f16d66f9d4404c89da7f91780e7e1b","GOODS_ID":"1a8beaca5cfd48ccbc2c9fe88013477a","GOODS_NAME":"iPhone5","ONE_USE_SCORE":0,"ONE_USE_MONEY":5000,"BUY_NUM":1,"TOTAL_MONEY":5000,"TOTAL_SCORE":0,"GOODS_NOTE":null,"ORDER_ID":"d40425fe4ca9450586b99ec43b48b82c","GOODS_TYPE":null,"REVIEW_STATE":0,"GOODS_CODE":"22222221","IMAGE":"/upload/infofiles/20161028091920_3020.jpg","PAY_TYPE":1,"LV1_NAME":"电脑、办公","LV2_NAME":"水生动物","LV3_NAME":"鲸鱼"}]} * flag : 0 * msg : 获取订单详情列表成功 * success : true */ public int flag; public String msg; public boolean success; public static class OrderInfoBean implements Serializable { public String ID; public String ORDER_ID; public String MEMBER_ID; public int STATE; public String CREATE_TIME; public int PAY_STATE; public int PAY_TYPE; public int BUY_WAY; public double TOTAL_PRICE; public String TOTAL_JF; public int SEND_TYPE; public String TAKE_PLACE; public String TAKE_PLACE_ID; public int ORDER_TYPE; public String PROVINCE_ID; public String PROVINCE_NAME; public String CITY_ID; public String CITY_NAME; public String AREA_ID; public String AREA_NAME; public String ADDRESS; public String PERSON; public String MOBILE; public String ORDER_NOTE; public String SEND_USER_ID; public String SEND_USER_NAME; public String EXPRESS_CODE; public String ZF_TIME; public String FH_TIME; public String COMPLETE_TIME; public String PAY_CODE; public int DEL_STATE; public String SEND_PRICE; public String EXPRESS; public String DHCZ_ID; public String DHCZ_NAME; public int BUY_NUM; public int TOTAL_NUM; public double TOTAL_MONEY; public String MEMBER_NAME; /** * ID : b3f16d66f9d4404c89da7f91780e7e1b * GOODS_ID : 1a8beaca5cfd48ccbc2c9fe88013477a * GOODS_NAME : iPhone5 * ONE_USE_SCORE : 0 * ONE_USE_MONEY : 5000 * BUY_NUM : 1 * TOTAL_MONEY : 5000 * TOTAL_SCORE : 0 * GOODS_NOTE : null * ORDER_ID : d40425fe4ca9450586b99ec43b48b82c * GOODS_TYPE : null * REVIEW_STATE : 0 * GOODS_CODE : 22222221 * IMAGE : /upload/infofiles/20161028091920_3020.jpg * PAY_TYPE : 1 * LV1_NAME : 电脑、办公 * LV2_NAME : 水生动物 * LV3_NAME : 鲸鱼 */ public List<GoodsListBean> goodsList; public static class GoodsListBean implements Serializable{ public String ID; public String GOODS_ID; public String GOODS_NAME; public String ONE_USE_SCORE; public String ONE_USE_MONEY; public int BUY_NUM; public int BUY_TYPE; public String TOTAL_MONEY; public String TOTAL_SCORE; public String GOODS_NOTE; public String ORDER_ID; public int GOODS_TYPE; public int REVIEW_STATE; public int STATE; public String GOODS_CODE; public String IMAGE; public String LV1_NAME; public String LV2_NAME; public String LV3_NAME; } } }
[ "lhq11031103@126.com" ]
lhq11031103@126.com
2533afe70dd6aec63f8605552ccb85affa167000
ebcd85092888d24cb395081efe4efc7f7e5ee368
/app/src/main/java/com/example/text1012/text1012.java
23f93f55ef8964cbe05d29deba3a43cb13325c05
[]
no_license
karta2398982/text1012
059c68ce96323348150e7be1539ee21b73f51a02
76f6c881587551c7409ab15defb01e300f387a25
refs/heads/master
2021-01-12T15:26:41.340631
2016-10-24T12:19:16
2016-10-24T12:19:16
70,970,993
0
0
null
null
null
null
UTF-8
Java
false
false
1,262
java
package com.example.text1012; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import text1012.xml.ResultActivity; public class text1012 extends AppCompatActivity { private Button submit; private Button help; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_text1012); submit = (Button) this.findViewById(R.id.submit); help = (Button) this.findViewById(R.id.help); submit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(); intent.setClass(text1012.this, ResultActivity.class); startActivity(intent); } }); help.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v){ Intent intent = new Intent(); intent.setClass(text1012.this, page3.class); startActivity(intent); } }); } }
[ "karta2398982@gmailc.com" ]
karta2398982@gmailc.com
83b2add25424beed9bd53eab5e7b205410a14393
a8e8528d4247a92fc25d310a03d5b0eaf0438a9c
/src/main/java/model/net/Connection.java
62a28041f3b5271f8aa6dff7d93b52a865e875c0
[]
no_license
shevchuk-na/Messenger
713cd79687116a3607baa7b7f2d5455ff6c974f8
d5c24e94450253d0b7980e023a206945217174a1
refs/heads/master
2021-01-20T12:38:14.447462
2018-02-21T23:52:54
2018-02-21T23:52:54
90,387,809
0
0
null
null
null
null
UTF-8
Java
false
false
1,225
java
package model.net; import java.io.DataOutputStream; import java.io.IOException; import java.io.Serializable; import java.net.InetAddress; import java.net.Socket; public class Connection implements Serializable{ private InetAddress ip; private int port; private Socket socket; private DataOutputStream dos; public Connection(InetAddress ip, int port) { this.ip = ip; this.port = port; } public Connection(Socket socket) { this.ip = socket.getInetAddress(); this.port = socket.getPort(); this.socket = socket; try { dos = new DataOutputStream(socket.getOutputStream()); } catch (IOException e) { e.printStackTrace(); } } public InetAddress getIp() { return ip; } public Socket getSocket() { return socket; } public void setSocket(Socket socket) { this.socket = socket; try { dos = new DataOutputStream(socket.getOutputStream()); } catch (IOException e) { e.printStackTrace(); } } public DataOutputStream getDos() { return dos; } public int getPort() { return port; } }
[ "ozerons@gmail.com" ]
ozerons@gmail.com
4c5158a54633fc88341e3bdff68c09ee88c35f24
05b355b6489f3ebeb1679770825d50d61b808d98
/carService/WEB-INF/classes/com/nuvizz/car/service/login/LoginServiceImpl.java
d6507831b781372e64765f7673e38e5a478fcb89
[]
no_license
krupa7/car
877eac84e74b429b1877126c6e0e41f200123063
57031926010b67ff2fcc28ad612104a0609af13f
refs/heads/master
2021-01-13T14:48:47.077032
2016-12-15T13:14:47
2016-12-15T13:14:47
76,555,799
0
0
null
null
null
null
UTF-8
Java
false
false
991
java
package com.nuvizz.car.service.login; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.nuvizz.car.dao.login.LoginDAOImpl; import com.nuvizz.car.dto.login.LoginDTO; @Component public class LoginServiceImpl implements LoginService { @Autowired private LoginDAOImpl dao; private static final Logger logger = LoggerFactory .getLogger(LoginServiceImpl.class); public LoginDTO loginService(LoginDTO dto) { logger.info("Starting login Service"); LoginDTO fDto = null; try { if (dto.getUid() != null && dto.getPassword() != null) { logger.info("UserId and password found"); fDto = dao.authenticate(dto); } else { logger.info("userId & password not found"); } } catch (Exception e) { logger.error("Exception in service state " + e); e.printStackTrace(); } logger.info("Ending login Service"); return fDto; } }
[ "khnaik@US.NUVIZZ.COM" ]
khnaik@US.NUVIZZ.COM
2ec70299a7020fd293d5e623bef1ca82575d7aaf
cb3de40cecf356ba76c85f3301dbf34d4ee94ecc
/rmb/rmb-common/src/main/java/us/yamb/rmb/impl/RMBBase.java
d5f44c12215c6be7bfec99b1a97684cba754a20b
[]
no_license
meledin/yamb
8a5c27f356ceeffcf24d7507db956ea9e0d48288
642de646660786fa5fc17c39820bb4347a9513d1
refs/heads/master
2021-01-21T04:44:00.313929
2016-03-30T23:55:17
2016-03-30T23:55:17
27,623,482
1
5
null
2016-03-30T23:09:39
2014-12-06T05:26:53
JavaScript
UTF-8
Java
false
false
808
java
package us.yamb.rmb.impl; import us.yamb.amb.spi.ObservableBase; import us.yamb.rmb.RMB; import us.yamb.rmb.RMBStatus; import us.yamb.rmb.callbacks.OnDelete; import us.yamb.rmb.callbacks.OnDisconnect; import us.yamb.rmb.callbacks.OnGet; import us.yamb.rmb.callbacks.OnMessage; import us.yamb.rmb.callbacks.OnPost; import us.yamb.rmb.callbacks.OnPut; import us.yamb.rmb.callbacks.RMBCallbackInterface; public abstract class RMBBase extends ObservableBase<RMBCallbackInterface, RMB> implements RMB { protected RMBStatus status = RMBStatus.DISCONNECTED; protected OnMessage onmessage; protected OnGet onget; protected OnPut onput; protected OnPost onpost; protected OnDelete ondelete; protected OnDisconnect ondisconnect; public RMBStatus status() { return status; } }
[ "vlad@d2dx.com" ]
vlad@d2dx.com
eda77a8a65c61ab576d30b8e1dab6326e8f921b5
e2aad1398ee55d1eff6e967ca37290f2d225dc81
/src/main/java/com/example/javaeefinal/controller/teacherController.java
f4218f8a2f68d500350543b715d31fea14958041
[]
no_license
crtrt/javaee-final
f5adeb8b7669e1f6ad86b4ad0d935f292cd704bf
beb6c3c15197d6983feed8cae67ea567be8d6f82
refs/heads/master
2022-11-12T04:37:50.549135
2020-06-16T07:09:32
2020-06-16T07:09:32
272,621,671
0
1
null
null
null
null
UTF-8
Java
false
false
3,429
java
package com.example.javaeefinal.controller; import com.example.javaeefinal.service.*; import com.example.javaeefinal.model.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import java.sql.Timestamp; import java.util.Date; import java.util.List; @Controller public class teacherController { @Autowired private final StudentHomeworkService studentHomeworkService; @Autowired private final StudentService studentService; @Autowired private final HomeworkService homeworkService; public teacherController(StudentHomeworkService studentHomeworkService, StudentService studentService, HomeworkService homeworkService) { this.studentHomeworkService = studentHomeworkService; this.studentService = studentService; this.homeworkService = homeworkService; } // @RequestMapping(value = "index") // public String login(){ // return "index"; // } /** * 添加学生 * @param sh * @return */ @RequestMapping(value = "AddStudentServlet",method = RequestMethod.POST) public String addStudent(@ModelAttribute Student sh){ //获取当前时间 Timestamp now = new Timestamp(new Date().getTime()); sh.setCreate_time(now); studentService.addStudent(sh); return "redirect:/addStudent"; } /** * 添加作业 * @param sh * @return */ @RequestMapping(value = "AddHomeworkServlet",method = RequestMethod.POST) public String addHomework(@ModelAttribute Homework sh){ //获取当前时间 Timestamp now = new Timestamp(new Date().getTime()); sh.setCreate_time(now); homeworkService.addStudentHomework(sh); return "redirect:/addHomework"; } /** * 提交成绩 * @param sh * @return */ @RequestMapping(value = "SubmitScore",method = RequestMethod.POST) public String updateHomework(@ModelAttribute StudentHomework sh){ //获取当前时间 Timestamp now = new Timestamp(new Date().getTime()); sh.setSet_score_time(now); studentHomeworkService.submitScore(sh); return "redirect:/readHomework"; } /** * 查看所有作业与答案 * @param model * @return */ @RequestMapping("/readHomework") public String student(Model model) { List<StudentHomework> list = studentHomeworkService.selectAll(); model.addAttribute("list",list); return "/readHomework"; } /** * 查看所有老师发布的作业 * @param model * @return */ @RequestMapping("/addHomework") public String selectHomework(Model model) { List<Homework> list = homeworkService.selectHomework(); model.addAttribute("list",list); return "/addHomework"; } /** * 查看所有学生 * @param model * @return */ @RequestMapping("/addStudent") public String selectStudent(Model model) { List<Student> list = studentService.selectStudent(); model.addAttribute("list",list); return "/addStudent"; } }
[ "17301090@bjtu.eddu.cn" ]
17301090@bjtu.eddu.cn
690bc60d57f51db8c300af6679ce42a59be21737
32c0609a0dba148cc6c04a638c323225e3b5acca
/src/android/Appium.java
c87e842a94383a0c8047036c7962b1b8955c37d0
[]
no_license
sarvesh016/Autoamtionframework
c70b0078cebfadd3599cacbda8296a2d28ee9c7e
fa94eb98e3e017a0a9dcf809ece91d9f3986bb66
refs/heads/master
2021-08-24T18:14:53.345214
2017-11-21T11:05:24
2017-11-21T11:05:24
111,526,893
0
0
null
null
null
null
UTF-8
Java
false
false
7,529
java
package android; import java.awt.Event; import java.net.MalformedURLException; import java.net.URL; import java.util.HashMap; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.remote.CapabilityType; import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.remote.RemoteWebDriver; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; import com.sun.glass.events.KeyEvent; import io.appium.java_client.android.AndroidDriver; import io.appium.java_client.android.AndroidKeyCode; public class Appium { WebDriver driver; @BeforeTest public void setUp() throws MalformedURLException { // Created object of DesiredCapabilities class. DesiredCapabilities capabilities = new DesiredCapabilities(); // Set android deviceName desired capability. Set your device name. capabilities.setCapability("deviceName", "42f71107adb99f93"); //42f71107adb99f93 //Sai Sarvesh(SHV-E210K) // Set BROWSER_NAME desired capability. It's Android in our case here. capabilities.setCapability(CapabilityType.BROWSER_NAME, "Android"); // Set android VERSION desired capability. Set your mobile device's OS version. capabilities.setCapability(CapabilityType.VERSION, "4.4.4"); //4.4.4 // Set android platformName desired capability. It's Android in our case here. capabilities.setCapability("platformName", "Android"); // Set android appPackage desired capability. It is // com.android.calculator2 for calculator application. // Set your application's appPackage if you are using any other app. capabilities.setCapability("appPackage", "com.bofin.bank"); // Set android appActivity desired capability. It is // com.android.calculator2.Calculator for calculator application. // Set your application's appPackage if you are using any other app. //Sign in Activity //capabilities.setCapability("appActivity", ".view.signin.activities.SignInActivity"); capabilities.setCapability("appActivity",".view.getstarted.activities.SplashActivity"); //appActivity // Created object of RemoteWebDriver will all set capabilities. // Set appium server address and port number in URL string. // It will launch calculator app in android device. driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities); driver.manage().timeouts().implicitlyWait(40, TimeUnit.SECONDS); } @Test public void Sum() { // Click on DELETE/CLR button to clear result text box before running test. try{ driver.findElement(By.xpath("//android.widget.TextView[contains(@resource-id,'bofin_sign_in_one_signup_txt') and @text='Sign Up to Bofin']")).click(); // driver.findElement(By.xpath("//android.widget.RelativeLayout[contains(@resource-id,'bofin_getstarted_fb_rel')]")).click(); driver.findElement(By.xpath("//android.widget.RelativeLayout[contains(@resource-id,'bofin_getstarted_bofin_rel')]")).click(); driver.findElement(By.xpath("//android.widget.Button[contains(@resource-id,'bofin_getstarted_getstarted_btn')]")).click(); WebElement elm= driver.findElement(By.xpath("//android.widget.EditText[contains(@resource-id,'bofin_sign_in_one_email_edt')]")); elm.click(); elm.sendKeys("sarvesh@constient.com"); driver.navigate().back(); driver.findElement(By.xpath("//android.widget.ImageView[contains(@resource-id,'bofin_sign_in_one_login_img')]")).click(); driver.findElement(By.xpath("//android.widget.EditText[contains(@resource-id,'bofin_sign_in_two_pwd_edt')]")).sendKeys("Test@123"); driver.navigate().back(); driver.findElement(By.xpath("//android.widget.ImageView[contains(@resource-id,'bofin_sign_in_two_login_img')]")).click(); driver.findElement(By.xpath("//android.widget.TextView[contains(@resource-id,'bofin_home_profile_complete_now_txt')]")).click(); driver.findElement(By.xpath("//android.widget.LinearLayout[contains(@resource-id,'bofin_profile_basic_lin')]")).click(); driver.findElement(By.xpath("//android.widget.TextView[contains(@resource-id,'bofin_profile_basic_about_me_complete_txt')]")).click(); driver.findElement(By.xpath("//android.widget.EditText[contains(@resource-id,'bofin_about_me_first_name_edt')]")).sendKeys("sarvesh"); driver.findElement(By.xpath("//android.widget.EditText[contains(@resource-id,'bofin_about_me_last_name_edt')]")).sendKeys("sai"); driver.findElement(By.xpath("//android.widget.EditText[contains(@resource-id,'bofin_about_me_display_name_edt')]")).click(); driver.findElement(By.xpath("//android.widget.EditText[contains(@resource-id,'bofin_display_custom_name_edt')]")).sendKeys("saisang"); driver.navigate().back(); driver.findElement(By.xpath("//android.widget.Button[contains(@resource-id,'bofin_display_name_save_btn')]")).click(); driver.findElement(By.xpath("//android.widget.EditText[contains(@resource-id,'bofin_about_me_gender_edt')]")).click(); driver.findElement(By.xpath("//android.widget.ImageView[contains(@resource-id,'bofin_lnc_gender_male_img')]")).click(); driver.findElement(By.xpath("//android.widget.EditText[contains(@resource-id,'bofin_about_me_birth_day_edt')]")).click(); driver.findElement(By.xpath("//android.widget.Button[contains(@resource-id,'ok')]")).click(); driver.findElement(By.xpath("//android.widget.EditText[contains(@resource-id,'bofin_about_me_born_in_edt')]")).click(); driver.findElement(By.xpath("//android.widget.EditText[contains(@resource-id,'search_src_text')]")).sendKeys("india"); driver.findElement(By.className("android.widget.RelativeLayout")).click(); driver.findElement(By.xpath("//android.widget.Button[contains(@resource-id,'bofin_about_me_save_btn')]")).click(); driver.findElement(By.xpath("//android.widget.TextView[contains(@resource-id,'bofin_profile_contact_detail_complete_txt')]")).click(); driver.findElement(By.xpath("//android.widget.LinearLayout[contains(@resource-id,'bofin_adp_contact_info_add_lin')]")).click(); driver.findElement(By.xpath("//android.widget.TextView[contains(@resource-id,'bofin_my_address_address_one_txt')]")).click(); driver.findElement(By.xpath("//android.widget.EditText[contains(@resource-id,'autocomplete_places')]")).sendKeys("123"); driver.findElement(By.xpath("//android.widget.RelativeLayout[contains(@resource-id,'predictedRow')]")).click(); driver.findElement(By.xpath("//android.widget.TextView[contains(@resource-id,'bofin_my_address_label_txt')]")).click(); driver.findElement(By.xpath("//android.widget.ImageView[contains(@resource-id,'bofin_lnc_label_personal_img')]")).click(); driver.findElement(By.xpath("//android.widget.Button[contains(@resource-id,'bofin_my_address_save_btn')]")).click(); }catch(Exception e){ e.printStackTrace(); } // Click on number 2 button. //driver.findElement(By.name("2")).click(); // Click on + button. //driver.findElement(By.name("+")).click(); // Click on number 5 button. //driver.findElement(By.name("5")).click(); // Click on = button. //driver.findElement(By.name("=")).click(); // Get result from result text box. //String result = driver.findElement(By.className("android.widget.EditText")).getText(); //System.out.println("Number sum result is : " + result); } @AfterTest public void End() { driver.quit(); } }
[ "sarvesh@constient.in" ]
sarvesh@constient.in
8286106f7d74c9362bcf063a7a70eccb999413d4
4fb0458a169c320d3e46e564445a8796c25110dd
/webservice/src/main/java/com/hortonworks/streamline/webservice/LoginConfiguration.java
b4b5b56d62736260023e25393511530c0f988dbb
[ "Apache-2.0", "MIT" ]
permissive
smarthi/streamline
00ce3518c73801af2f70d25a96562578be6dbb74
559fc424f77055671dcd568322d0dbbedea4a7e8
refs/heads/master
2021-01-01T20:37:15.675797
2017-07-26T10:58:11
2017-07-26T10:58:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
793
java
package com.hortonworks.streamline.webservice; import java.util.Map; /** * A class representing information for login mechanism for authentication */ public class LoginConfiguration { private String className; private Map<String, String> params; public String getClassName() { return className; } public void setClassName(String className) { this.className = className; } public Map<String, String> getParams() { return params; } public void setParams(Map<String, String> params) { this.params = params; } @Override public String toString() { return "LoginConfiguration{" + "className='" + className + '\'' + ", params=" + params + '}'; } }
[ "pshah@hortonworks.com" ]
pshah@hortonworks.com
559f952ecf91d1fb943fea1f5aca7605937db3e1
ec01419a153633004a08a091d243bd63709f7956
/appTramDocuConcytecAdvancedFD/src/tramitedoc/concytec/form/FFormMantPreliquidar.java
d5593aff2c5bfa42d5d4e7fd8281c51a9d0aab5a
[]
no_license
angelnoa/TramiteDoc-FD
5c3f4b024d4421486d92e1f3eb88a2de424e9472
e2e2d3e60886efd44d91981a674d1a358cce6aa1
refs/heads/master
2021-01-10T13:50:01.720613
2016-01-25T15:20:57
2016-01-25T15:20:57
50,359,496
0
0
null
null
null
null
ISO-8859-1
Java
false
false
4,853
java
package tramitedoc.concytec.form; import javax.servlet.http.HttpServletRequest; import org.apache.struts.action.ActionError; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionMapping; /** * AUTOR : Machuca Ovalle * FECHA : 03-04-2006 * VERSION : 1.0 * DESCRIPCIÓN : Mapeo de datos del logeo recibidos del jsp */ public class FFormMantPreliquidar extends ActionForm{ private String fecha = null; private String observacion = null; private String hora = null; private String tipo = null; private String codigo_documento = null; private String codigo_expediente = null; private String descripcion_tipo = null; private String numero_documento = null; private String codigo_oficina = null; private String estado_movimiento = null; private String secuencia_movimiento = null; private String codigo_recepcion = null; private String asunto_documento = null; private String codigo_tipo = null; private String cod_ruta = null; private String cod_modalidad = null; private String descripcion = null; private String cod_oficina_rem = null; public void reset(ActionMapping mapping, HttpServletRequest request) { this.tipo = null; this.fecha = null; this.observacion = null; this.hora = null; this.codigo_documento = null; this.codigo_expediente = null; this.descripcion_tipo = null; this.numero_documento = null; this.codigo_oficina = null; this.estado_movimiento = null; this.secuencia_movimiento = null; this.codigo_recepcion = null; this.asunto_documento = null; this.codigo_tipo = null; this.cod_ruta = null; this.cod_modalidad = null; this.cod_modalidad = null; this.cod_oficina_rem = null; } public String getCod_oficina_rem() { return cod_oficina_rem; } public void setCod_oficina_rem(String cod_oficina_rem) { this.cod_oficina_rem = cod_oficina_rem; } public String getCodigo_tipo() { return codigo_tipo; } public void setCodigo_tipo(String codigo_tipo) { this.codigo_tipo = codigo_tipo; } public String getCod_ruta() { return cod_ruta; } public void setCod_ruta(String cod_ruta) { this.cod_ruta = cod_ruta; } public String getCod_modalidad() { return cod_modalidad; } public void setCod_modalidad(String cod_modalidad) { this.cod_modalidad = cod_modalidad; } public String getDescripcion() { return descripcion; } public void setDescripcion(String descripcion) { this.descripcion = descripcion; } public String getFecha() { return fecha; } public void setFecha(String fecha) { this.fecha = fecha; } public String getHora() { return hora; } public void setHora(String hora) { this.hora = hora; } public String getObservacion() { return observacion; } public void setObservacion(String observacion) { this.observacion = observacion; } public String getTipo() { return tipo; } public void setTipo(String tipo) { this.tipo = tipo; } public String getCodigo_documento() { return codigo_documento; } public void setCodigo_documento(String codigo_documento) { this.codigo_documento = codigo_documento; } public String getCodigo_expediente() { return codigo_expediente; } public void setCodigo_expediente(String codigo_expediente) { this.codigo_expediente = codigo_expediente; } public String getDescripcion_tipo() { return descripcion_tipo; } public void setDescripcion_tipo(String descripcion_tipo) { this.descripcion_tipo = descripcion_tipo; } public String getNumero_documento() { return numero_documento; } public void setNumero_documento(String numero_documento) { this.numero_documento = numero_documento; } public String getCodigo_oficina() { return codigo_oficina; } public void setCodigo_oficina(String codigo_oficina) { this.codigo_oficina = codigo_oficina; } public String getEstado_movimiento() { return estado_movimiento; } public void setEstado_movimiento(String estado_movimiento) { this.estado_movimiento = estado_movimiento; } public String getSecuencia_movimiento() { return secuencia_movimiento; } public void setSecuencia_movimiento(String secuencia_movimiento) { this.secuencia_movimiento = secuencia_movimiento; } public String getCodigo_recepcion() { return codigo_recepcion; } public void setCodigo_recepcion(String codigo_recepcion) { this.codigo_recepcion = codigo_recepcion; } public String getAsunto_documento() { return asunto_documento; } public void setAsunto_documento(String asunto_documento) { this.asunto_documento = asunto_documento; } }
[ "anghelo.dj87@gmail.com" ]
anghelo.dj87@gmail.com
0af184394751f4e17c79fb322dee9c6246483302
81643ed18f7e2d4849887166e024d0a133167d6c
/app/src/main/java/com/example/rockscissorspaper/MainActivity.java
0c774956cc9f9101f7511d0880de364df977f2da
[]
no_license
Android-Gex-2019/roshambo-game-jhon3541
e792051c2ec7fa9ea1b1353dbd2ab93332206cf1
d918ff5c5910743c93e9f82bdd8282bd01cf1395
refs/heads/master
2020-04-27T21:15:40.872825
2019-03-10T00:26:12
2019-03-10T00:26:12
174,689,796
0
0
null
null
null
null
UTF-8
Java
false
false
5,723
java
/** * @file * @author Jhon Romero * @version 1.0 * * * @section DESCRIPTION * Roshambo Assignment * * * @section LICENSE * * * Copyright 2019 * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the * above copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * @section Academic Integrity * I certify that this work is solely my own and complies with * NBCC Academic Integrity Policy (policy 1111) */ package com.example.rockscissorspaper; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.animation.AnticipateOvershootInterpolator; import android.widget.ImageView; import android.widget.TextView; import org.w3c.dom.Text; public class MainActivity extends AppCompatActivity { Rochambo game; ImageView playerImage; ImageView computerImage; TextView resultText; int computerMove; int playerMove; int result; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); playerImage = (ImageView) findViewById(R.id.player); computerImage = (ImageView) findViewById(R.id.computer); resultText = (TextView) findViewById(R.id.result); game = new Rochambo(); //Restore the saved state if (savedInstanceState != null) { computerMove= savedInstanceState.getInt("computer_move"); playerMove = savedInstanceState.getInt("player_move"); result= savedInstanceState.getInt("result"); game.setGameMove(computerMove); game.setPlayerMove(playerMove); playerImage.setImageResource( playerMove==1 ? R.drawable.paper : playerMove==0 ? R.drawable.rock : R.drawable.scissors); computerImage.setImageResource( computerMove==1 ? R.drawable.paper : computerMove==0 ? R.drawable.rock : R.drawable.scissors); resultText.setText(result == 1 ? getString(R.string.win_text) : result == 2 ? getString(R.string.lose_text) : getString(R.string.draw_text)); } } /** * Handles click on paper button * @param view */ public void playPaper(View view) { //makes player move game.playerMakesMove(1); //change image according to player move playerImage.setImageResource(R.drawable.paper); computerMove(); getResult(); animateImages(); } /** * Handles click on rock button * @param view */ public void playRock(View view) { //makes player move game.playerMakesMove(0); //change image according to player move playerImage.setImageResource(R.drawable.rock); computerMove(); getResult(); animateImages(); } /** * Handles click on scissor button * @param view */ public void playScissor(View view) { //makes player move game.playerMakesMove(2); //change image according to player move playerImage.setImageResource(R.drawable.scissors); computerMove(); getResult(); animateImages(); } /** * Handles computer move */ private void computerMove() { //get computer move computerMove= game.getGameMove(); //change image according to computer move computerImage.setImageResource( computerMove==1 ? R.drawable.paper : computerMove==0 ? R.drawable.rock : R.drawable.scissors); } /** * Print results */ private void getResult() { //get result result = game.winLoseOrDraw(); //Print results resultText.setText(result == 1 ? getString(R.string.win_text) : result == 2 ? getString(R.string.lose_text) : getString(R.string.draw_text)); } /** * Animate images */ private void animateImages() { // you can animate any prop that there is a setter for playerImage.setRotationX(0f); ObjectAnimator animatorPlayer = ObjectAnimator.ofFloat(playerImage, "rotationX", 0f, 360f) .setDuration(500); ObjectAnimator animatorGame = ObjectAnimator.ofFloat(computerImage, "rotationY", 0f, 360f) .setDuration(500); AnimatorSet set = new AnimatorSet(); set.playTogether(animatorGame, animatorPlayer); set.setInterpolator(new AnticipateOvershootInterpolator()); set.start(); } /** * Save computer and player move * @param outState */ @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putInt("player_move",game.getPlayerMove()); outState.putInt("computer_move",game.getGameMove()); outState.putInt("result", game.winLoseOrDraw()); } }
[ "jhon3541@gmail.com" ]
jhon3541@gmail.com
a8969399681687d95d853712aafccf8503116666
62e334192393326476756dfa89dce9f0f08570d4
/tk_code/course-server/course-web-server/src/main/java/com/huatu/tiku/course/service/v1/impl/practice/LiveCourseRoomInfoServiceImpl.java
d2135d05b8361c912540896af0dae39b081a3331
[]
no_license
JellyB/code_back
4796d5816ba6ff6f3925fded9d75254536a5ddcf
f5cecf3a9efd6851724a1315813337a0741bd89d
refs/heads/master
2022-07-16T14:19:39.770569
2019-11-22T09:22:12
2019-11-22T09:22:12
223,366,837
1
2
null
2022-06-30T20:21:38
2019-11-22T09:15:50
Java
UTF-8
Java
false
false
1,212
java
package com.huatu.tiku.course.service.v1.impl.practice; import com.google.common.collect.Lists; import com.huatu.tiku.course.bean.NetSchoolResponse; import com.huatu.tiku.course.netschool.api.v6.practice.LiveCourseServiceV6; import com.huatu.tiku.course.service.v1.practice.LiveCourseRoomInfoService; import com.huatu.tiku.course.util.ResponseUtil; import lombok.RequiredArgsConstructor; import org.apache.commons.collections.CollectionUtils; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; /** * Created by lijun on 2019/2/21 */ @Service @RequiredArgsConstructor public class LiveCourseRoomInfoServiceImpl implements LiveCourseRoomInfoService { private final LiveCourseServiceV6 liveCourseService; @Override public List<Integer> getLiveCourseIdListByRoomId(Long roomId) { NetSchoolResponse liveCourseIdListByRoomIdList = liveCourseService.getLiveCourseIdListByRoomId(roomId); ArrayList<Integer> courseIdList = ResponseUtil.build(liveCourseIdListByRoomIdList, ArrayList.class, false); if (CollectionUtils.isEmpty(courseIdList)) { return Lists.newArrayList(); } return courseIdList; } }
[ "jelly_b@126.com" ]
jelly_b@126.com
308aa8684cdaa8df7c04b0fc6bb6761306d42532
628ff5fd644839b657122c51e7b2fb908e7cfd96
/empresa/src/entidade/Empregado.java
47a560add3c0841a3c764154a9f419603032ea45
[]
no_license
ANTONIORS1967/professorNelio
f6823b0d644835c091ee31ee617a55a227cacc2b
fc84d5078f019ed2ef8a37ca0e8164281e8c79f4
refs/heads/master
2022-11-28T06:18:08.995686
2020-08-01T01:54:14
2020-08-01T01:54:14
284,163,704
0
0
null
null
null
null
UTF-8
Java
false
false
739
java
package entidade; public class Empregado { private String nome; private Integer hora; private Double valorPorhora; public Empregado() { } public Empregado(String nome, Double valorPorhora, Integer hora) { this.nome = nome; this.hora = hora; this.valorPorhora = valorPorhora; } public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } public Integer getHora() { return hora; } public void setHora(Integer hora) { this.hora = hora; } public Double getValorPorhora() { return valorPorhora; } public void setValorPorhora(Double valorPorhora) { this.valorPorhora = valorPorhora; } public double FormaDePagamento() { return hora*valorPorhora; } }
[ "antoniors1967@gmail.com" ]
antoniors1967@gmail.com
6de8ec0e77db636a3d41b8c87339569333284872
731e458da7ef6726a8355dfab85331dc6c86c9c2
/ReversedLinkList.java
a5f4a6f93952aeabbbd0cf58b92604cc54d4cef5
[]
no_license
sxchen36/LeetCode
a7e8d1b8bc2620647c8d4b4cd2c4a9bad8787483
991142520614f896dcca7203b2063d469a81cb43
refs/heads/master
2021-01-01T17:05:39.900264
2014-06-04T15:04:13
2014-06-04T15:04:13
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,397
java
package Leetcode; public class ReversedLinkList { public static void main(String[] args) { ReversedLinkList t = new ReversedLinkList(); ListNode head = t.new ListNode(3); head.next = t.new ListNode(5); t.reverseBetween(head, 1, 2); } public class ListNode { int val; ListNode next; ListNode(int x) { val = x; next = null; } } public ListNode reverseBetween(ListNode head, int m, int n) { if (m == n) return head; // special case:m=1,then it reverse from head... how about create a fake head ListNode fakeHead = new ListNode(-1); fakeHead.next = head; ListNode right = head; for (int i=0; i< n-m+1; i++) { // move n to reach n+1 th Node right = right.next; } ListNode left = fakeHead; for (int i=0; i<m-1; i++) { // move m-1 to reach Node before m from fakeHead left = left.next; right = right.next; } // left.next is m, right.prev is n // Update: failed when n == m, loop // how about judge in the beginning? ListNode p = left.next; for (int i=0; i< n - m + 1; i++) { // n-m+1 Node -> n-m+1 movement ListNode next = p.next; p.next = right; right = p; p = next; } left.next = right; return fakeHead.next; } }
[ "sxchen36@gmail.com" ]
sxchen36@gmail.com
56f7d76f4162641788e1e4bbb4e3c0ea051bca04
3e233bdfef336bac9953723a0b9f0388a3cfb2fc
/src/com/exercise/web/ServletProductDetail.java
3ac05536c11646bfeeeb1b6d3535205ffa545e75
[]
no_license
naunchazy/onlineshop
df945d6ff236d8b0283226ffee1d9fff079fb3e3
8b1c4b80b87232cc74ee11267a745d48d26a5f1f
refs/heads/master
2021-05-14T11:40:21.659205
2018-01-05T13:40:50
2018-01-05T13:40:50
116,388,542
0
0
null
null
null
null
GB18030
Java
false
false
1,330
java
package com.exercise.web; import java.io.IOException; import java.sql.SQLException; import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.exercise.domain.Product; import com.exercise.service.ProductService; public class ServletProductDetail extends HttpServlet { //若在主页showAllProduct.jsp中点击商品的图片,则跳转到该页面去数据库寻找商品详情 //再跳转到productDetail.jsp显示商品详情 public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String pid = request.getParameter("pid");//得到要显示的商品详情的pid ProductService service=new ProductService(); Product productDetail=null; try { productDetail=service.showProductDetail(pid); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } request.setAttribute("productDetail", productDetail); request.getRequestDispatcher("/productDetail.jsp").forward(request, response); } public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); } }
[ "1476276902@qq.com" ]
1476276902@qq.com
06235447d89a5e2a7cee51fc259d7ac87aa22512
573a66e4f4753cc0f145de8d60340b4dd6206607
/JS-CS-Detection-byExample/Dataset (ALERT 5 GB)/362855/quickfix-1.7.0/quickfix-1.7.0/src/java/src/quickfix/field/NoMDEntryTypes.java
1f3e99ea3a3afc7fdd917cce9aa811d746391519
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "BSD-2-Clause" ]
permissive
mkaouer/Code-Smells-Detection-in-JavaScript
3919ec0d445637a7f7c5f570c724082d42248e1b
7130351703e19347884f95ce6d6ab1fb4f5cfbff
refs/heads/master
2023-03-09T18:04:26.971934
2022-03-23T22:04:28
2022-03-23T22:04:28
73,915,037
8
3
null
2023-02-28T23:00:07
2016-11-16T11:47:44
null
UTF-8
Java
false
false
290
java
package quickfix.field; import quickfix.IntField; import java.util.Date; public class NoMDEntryTypes extends IntField { public static final int FIELD = 267; public NoMDEntryTypes() { super(267); } public NoMDEntryTypes(int data) { super(267, data); } }
[ "mmkaouer@umich.edu" ]
mmkaouer@umich.edu
233f037ff8c012d9dba64394ce50279efd06831e
902681eaaf92e31b605ccd8b25aa5cd8701b3b49
/src/main/java/com/waracle/cakemgr/config/SwaggerConfig.java
022a353f64082ee444b8ac000bb9c2fc3393e7f2
[]
no_license
s4sushil/cake-manager
f970ee49b361c0c4cf13e4b66815eeb84d214466
eb39e73f0a3133a853abfbf6fccccb3f4b153b2d
refs/heads/master
2023-07-26T03:45:20.696936
2021-09-02T21:54:37
2021-09-02T21:54:37
402,497,082
0
0
null
null
null
null
UTF-8
Java
false
false
681
java
package com.waracle.cakemgr.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.RequestHandlerSelectors; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spring.web.plugins.Docket; @Configuration public class SwaggerConfig { @Bean public Docket api() { return new Docket(DocumentationType.SWAGGER_2) .select() .apis(RequestHandlerSelectors.any()) .paths(PathSelectors.ant("/**")) .build(); } }
[ "s4sushil@yahoo.com" ]
s4sushil@yahoo.com
03159760390585d5e9af09237e919f2580c6e2ee
9f7f6ff2b8feda271970e1d2bb5dbda3e13332d5
/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/office/api/OfficesApiResource.java
e7972de373cc69ae74d56348099e880e6071263d
[]
no_license
fitzsij/mifosx
678595c570004eed7a8b81c180b9a9220ee60e41
1a5e36f9e1e138d5faf44ac869d6b6c81443c9fe
refs/heads/master
2021-01-16T18:10:01.476890
2012-12-02T10:15:08
2012-12-02T10:15:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,568
java
package org.mifosplatform.infrastructure.office.api; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.List; import java.util.Set; import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.UriInfo; import org.mifosplatform.commands.service.PortfolioCommandSourceWritePlatformService; import org.mifosplatform.infrastructure.core.api.ApiParameterHelper; import org.mifosplatform.infrastructure.core.api.PortfolioApiDataConversionService; import org.mifosplatform.infrastructure.core.api.PortfolioApiJsonSerializerService; import org.mifosplatform.infrastructure.core.api.PortfolioCommandSerializerService; import org.mifosplatform.infrastructure.core.data.EntityIdentifier; import org.mifosplatform.infrastructure.office.command.OfficeCommand; import org.mifosplatform.infrastructure.office.data.OfficeData; import org.mifosplatform.infrastructure.office.data.OfficeLookup; import org.mifosplatform.infrastructure.office.service.OfficeReadPlatformService; import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; @Path("/offices") @Component @Scope("singleton") public class OfficesApiResource { private final String resourceNameForPermissions = "OFFICE"; private final PlatformSecurityContext context; private final OfficeReadPlatformService readPlatformService; private final PortfolioApiJsonSerializerService apiJsonSerializerService; private final PortfolioApiDataConversionService apiDataConversionService; private final PortfolioCommandSerializerService commandSerializerService; private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService; @Autowired public OfficesApiResource(final PlatformSecurityContext context, final OfficeReadPlatformService readPlatformService, final PortfolioApiJsonSerializerService apiJsonSerializerService, final PortfolioApiDataConversionService apiDataConversionService, final PortfolioCommandSerializerService commandSerializerService, final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) { this.context = context; this.readPlatformService = readPlatformService; this.apiJsonSerializerService = apiJsonSerializerService; this.apiDataConversionService = apiDataConversionService; this.commandSerializerService = commandSerializerService; this.commandsSourceWritePlatformService = commandsSourceWritePlatformService; } @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) public String retrieveOffices(@Context final UriInfo uriInfo) { context.authenticatedUser().validateHasReadPermission(resourceNameForPermissions); final Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters()); final boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters()); final Collection<OfficeData> offices = this.readPlatformService.retrieveAllOffices(); return this.apiJsonSerializerService.serializeOfficeDataToJson(prettyPrint, responseParameters, offices); } @GET @Path("template") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) public String retrieveOfficeTemplate(@Context final UriInfo uriInfo) { context.authenticatedUser().validateHasReadPermission(resourceNameForPermissions); final Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters()); final boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters()); OfficeData office = this.readPlatformService.retrieveNewOfficeTemplate(); final List<OfficeLookup> allowedParents = new ArrayList<OfficeLookup>(this.readPlatformService.retrieveAllOfficesForLookup()); office = OfficeData.appendedTemplate(office, allowedParents); return this.apiJsonSerializerService.serializeOfficeDataToJson(prettyPrint, responseParameters, office); } @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) public String createOffice(final String apiRequestBodyAsJson) { final List<String> allowedPermissions = Arrays.asList("ALL_FUNCTIONS", "ORGANISATION_ADMINISTRATION_SUPER_USER", "CREATE_OFFICE"); context.authenticatedUser().validateHasPermissionTo("CREATE_OFFICE", allowedPermissions); final OfficeCommand command = this.apiDataConversionService.convertApiRequestJsonToOfficeCommand(null, apiRequestBodyAsJson); final String commandSerializedAsJson = this.commandSerializerService.serializeCommandToJson(command); final EntityIdentifier result = this.commandsSourceWritePlatformService.logCommandSource("CREATE", "offices", null, commandSerializedAsJson); return this.apiJsonSerializerService.serializeEntityIdentifier(result); } @GET @Path("{officeId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) public String retreiveOffice(@PathParam("officeId") final Long officeId, @Context final UriInfo uriInfo) { context.authenticatedUser().validateHasReadPermission(resourceNameForPermissions); final Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters()); final boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters()); final boolean template = ApiParameterHelper.template(uriInfo.getQueryParameters()); OfficeData office = this.readPlatformService.retrieveOffice(officeId); if (template) { List<OfficeLookup> allowedParents = this.readPlatformService.retrieveAllowedParents(officeId); office = OfficeData.appendedTemplate(office, allowedParents); } return this.apiJsonSerializerService.serializeOfficeDataToJson(prettyPrint, responseParameters, office); } @PUT @Path("{officeId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) public String updateOffice(@PathParam("officeId") final Long officeId, final String apiRequestBodyAsJson) { final List<String> allowedPermissions = Arrays.asList("ALL_FUNCTIONS", "ORGANISATION_ADMINISTRATION_SUPER_USER", "UPDATE_OFFICE"); context.authenticatedUser().validateHasPermissionTo("UPDATE_OFFICE", allowedPermissions); final OfficeCommand command = this.apiDataConversionService.convertApiRequestJsonToOfficeCommand(officeId, apiRequestBodyAsJson); final String commandSerializedAsJson = this.commandSerializerService.serializeCommandToJson(command); final EntityIdentifier result = this.commandsSourceWritePlatformService.logCommandSource("UPDATE", "offices", officeId, commandSerializedAsJson); return this.apiJsonSerializerService.serializeEntityIdentifier(result); } }
[ "keithwoodlock@gmail.com" ]
keithwoodlock@gmail.com
3cb274e4d864446a002f4d004344af796571e499
56e3a006252a2821463fc7ead58aa324b6dc1ed9
/tensquare_sms/src/main/java/com/tensquare/sms/utils/SmsUtil.java
26e8b03e5b1c8b9832aae8e48b8d52191b173a13
[]
no_license
MengWangwang/tensquare
59547b6e425b3b1fcdca4a7b187ae1d3e07f1ab8
bbbde566ee27898f53ea411cfa0bed12c61c1ff4
refs/heads/master
2020-06-19T16:32:27.423257
2020-04-03T08:44:54
2020-04-03T08:44:54
196,785,173
2
0
null
null
null
null
UTF-8
Java
false
false
4,661
java
package com.tensquare.sms.utils; import com.aliyuncs.DefaultAcsClient; import com.aliyuncs.IAcsClient; import com.aliyuncs.dysmsapi.model.v20170525.QuerySendDetailsRequest; import com.aliyuncs.dysmsapi.model.v20170525.QuerySendDetailsResponse; import com.aliyuncs.dysmsapi.model.v20170525.SendSmsRequest; import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse; import com.aliyuncs.exceptions.ClientException; import com.aliyuncs.profile.DefaultProfile; import com.aliyuncs.profile.IClientProfile; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; import java.text.SimpleDateFormat; import java.util.Date; /** * 短信工具类 * @author Administrator * */ @Component public class SmsUtil { //产品名称:云通信短信API产品,开发者无需替换 static final String product = "Dysmsapi"; //产品域名,开发者无需替换 static final String domain = "dysmsapi.aliyuncs.com"; @Autowired private Environment env; // TODO 此处需要替换成开发者自己的AK(在阿里云访问控制台寻找) /** * 发送短信 * @param mobile 手机号 * @param template_code 模板号 * @param sign_name 签名 * @param param 参数 * @return * @throws ClientException */ public SendSmsResponse sendSms(String mobile,String template_code,String sign_name,String param) throws ClientException { String accessKeyId =env.getProperty("aliyun.sms.accessKeyId"); String accessKeySecret = env.getProperty("aliyun.sms.accessKeySecret"); //可自助调整超时时间 System.setProperty("sun.net.client.defaultConnectTimeout", "10000"); System.setProperty("sun.net.client.defaultReadTimeout", "10000"); //初始化acsClient,暂不支持region化 IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", accessKeyId, accessKeySecret); DefaultProfile.addEndpoint("cn-hangzhou", "cn-hangzhou", product, domain); IAcsClient acsClient = new DefaultAcsClient(profile); //组装请求对象-具体描述见控制台-文档部分内容 SendSmsRequest request = new SendSmsRequest(); //必填:待发送手机号 request.setPhoneNumbers(mobile); //必填:短信签名-可在短信控制台中找到 request.setSignName(sign_name); //必填:短信模板-可在短信控制台中找到 request.setTemplateCode(template_code); //可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时,此处的值为 request.setTemplateParam(param); //选填-上行短信扩展码(无特殊需求用户请忽略此字段) //request.setSmsUpExtendCode("90997"); //可选:outId为提供给业务方扩展字段,最终在短信回执消息中将此值带回给调用者 request.setOutId("yourOutId"); //hint 此处可能会抛出异常,注意catch SendSmsResponse sendSmsResponse = acsClient.getAcsResponse(request); return sendSmsResponse; } public QuerySendDetailsResponse querySendDetails(String mobile,String bizId) throws ClientException { String accessKeyId =env.getProperty("accessKeyId"); String accessKeySecret = env.getProperty("accessKeySecret"); //可自助调整超时时间 System.setProperty("sun.net.client.defaultConnectTimeout", "10000"); System.setProperty("sun.net.client.defaultReadTimeout", "10000"); //初始化acsClient,暂不支持region化 IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", accessKeyId, accessKeySecret); DefaultProfile.addEndpoint("cn-hangzhou", "cn-hangzhou", product, domain); IAcsClient acsClient = new DefaultAcsClient(profile); //组装请求对象 QuerySendDetailsRequest request = new QuerySendDetailsRequest(); //必填-号码 request.setPhoneNumber(mobile); //可选-流水号 request.setBizId(bizId); //必填-发送日期 支持30天内记录查询,格式yyyyMMdd SimpleDateFormat ft = new SimpleDateFormat("yyyyMMdd"); request.setSendDate(ft.format(new Date())); //必填-页大小 request.setPageSize(10L); //必填-当前页码从1开始计数 request.setCurrentPage(1L); //hint 此处可能会抛出异常,注意catch QuerySendDetailsResponse querySendDetailsResponse = acsClient.getAcsResponse(request); return querySendDetailsResponse; } }
[ "1275534396@qq.com" ]
1275534396@qq.com
7cb0764da0fe6ce623c10bf27cac722b817a08c6
6d5eccf3101ffe1159c1095ae4aa40ed3f82ad25
/MobileVectorCalculatorTDD/app/src/main/java/com/mycompany/mobilevectorcalculatortdd/SecondActivity.java
160e6ac36dd5a257839cf44675bc0bb093889703
[]
no_license
JadSayegh/AMV
fb8e5f277418990daf1b942ca14c8a7b68b090db
f3b385997fbeacb1d57456b6763a6af467a80351
refs/heads/master
2020-04-08T22:08:03.872621
2015-02-23T15:47:57
2015-02-23T15:47:57
31,148,010
0
0
null
null
null
null
UTF-8
Java
false
false
2,431
java
package com.mycompany.mobilevectorcalculatortdd; import android.content.Intent; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.widget.TextView; public class SecondActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_second); Intent intent = getIntent(); // get the text view we are going to need to submit the vectorAdd answer TextView vectorAddAnswer = (TextView) findViewById(R.id.cartesianCoordinate_vectorRes); // set it to empty (in case this is the second time someone is calculating a new vector value // we want to make sure it is empty) vectorAddAnswer.setText(String.format("")); String action = intent.getStringExtra("action"); if (action.equals("vector_add")) { Vector vectorSum = (Vector) intent.getSerializableExtra("result"); // fill it with the vectorAdd value we calculated vectorAddAnswer.setText(String.format("The sum of the 3 vectors: (%.2f, %.2f)", vectorSum.x, vectorSum.y)); } else if (action.equals("vector_prod")) { Double vectorProd = intent.getExtras().getDouble("result"); // fill it with the vectorAdd value we calculated vectorAddAnswer.setText(String.format("The vector product of the 2 vectors: %.2f in the z direction", vectorProd)); } else if (action.equals("scalar_prod")) { Double scalarProd = intent.getExtras().getDouble("result"); // fill it with the vectorAdd value we calculated vectorAddAnswer.setText(String.format("The scalar product of the 2 vectors: %.2f", scalarProd)); } } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }
[ "mariam.khan3@mail.mcgill.ca" ]
mariam.khan3@mail.mcgill.ca
804382c664c09fa8f8c77e243c0e79e31bf9fa0a
10917d8bb20bba0410cd272133e6699862e00284
/src/utilitaires/ApplicationConfiguration.java
9748920bcffb661498f0b5a3868ef9ec787d0184
[]
no_license
cgranj01/JCourse
df10e9b8f9a35b98caabca2569b457b51a9764d8
1e72ad023615cd771991163cdcbc826c3d72c68d
refs/heads/master
2016-09-03T07:13:35.071852
2014-11-13T14:13:08
2014-11-13T14:13:08
26,590,157
1
1
null
null
null
null
UTF-8
Java
false
false
1,738
java
package utilitaires; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.util.Properties; public class ApplicationConfiguration { private final static ApplicationConfiguration INSTANCE = new ApplicationConfiguration (); public static ApplicationConfiguration getInstance () { return INSTANCE; } private static Properties configuration = new Properties (); private static Properties getConfiguration () { return configuration; } public void initilize (final String file) { InputStream in = null; try { in = new FileInputStream (new File (file)); configuration.load (in); } catch (IOException e) { e.printStackTrace (); } } public String getConfiguration (final String key) { return (String) getConfiguration ().get (key); } public String getConfigurationWithDefaultValue (final String key, final String defaultValue) { return (String) getConfiguration ().getProperty (key, defaultValue); } public void setConfiguration (String key, String value) { configuration.setProperty (key, value); } public void save (final String file) { FileOutputStream fos = null; try { fos = new FileOutputStream (file); // if (isXML) // { // properties.storeToXML (fos, "SettingsApplication"); // } // else // { configuration.store (fos, "SettingsApplication"); // } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { if (fos != null) { try { fos.close (); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } }
[ "christophe@granjouan.com" ]
christophe@granjouan.com
de8b08195d37a437a12ac68ed03d1774867c932c
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/20/20_fb54c5a276e137ff6708e63e9fff2428ec2f4a0e/FindBugsExtractorTest/20_fb54c5a276e137ff6708e63e9fff2428ec2f4a0e_FindBugsExtractorTest_t.java
03d0ed4ded56eacfbb8d6bc6877c4b550c3ad4b5
[]
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
2,102
java
package org.pescuma.buildhealth.extractor.findbugs; import static org.junit.Assert.*; import static org.mockito.Matchers.*; import static org.mockito.Mockito.*; import java.io.File; import java.io.InputStream; import org.junit.Test; import org.pescuma.buildhealth.extractor.BaseExtractorTest; import org.pescuma.buildhealth.extractor.PseudoFiles; import org.pescuma.buildhealth.extractor.staticanalysis.FindBugsExtractor; public class FindBugsExtractorTest extends BaseExtractorTest { @Test public void test1Folder1Bug() { InputStream stream = load("findbugs.1folder.1bug.xml"); FindBugsExtractor extractor = new FindBugsExtractor(new PseudoFiles(stream)); extractor.extractTo(table, tracker); verify(tracker).onStreamProcessed(); verify(tracker, never()).onFileProcessed(any(File.class)); assertEquals(1, table.size()); assertEquals(1, table.filter("Static analysis", "Java", "FindBugs").sum(), // "C:\\buildhealth.core\\src\\org\\pescuma\\buildhealth\\computer\\loc\\LOCComputer.java", // "86", // "Internationalization", // "Reliance on default encoding", // "Found reliance on default encoding in org.pescuma.buildhealth.computer.loc.LOCComputer.createFileList(): new java.io.FileWriter(File)\n" // + // "Found a call to a method which will perform a byte to String (or String to byte) conversion, and will assume that the default platform encoding is suitable. This will cause the application behaviour to vary between platforms. Use an alternative API and specify a charset name or Charset object explicitly."), 0.0001); } @Test public void test2Folder2Bugs() { InputStream stream = load("findbugs.2folders.2bugs.xml"); FindBugsExtractor extractor = new FindBugsExtractor(new PseudoFiles(stream)); extractor.extractTo(table, tracker); verify(tracker).onStreamProcessed(); verify(tracker, never()).onFileProcessed(any(File.class)); assertEquals(2, table.size()); assertEquals(2, table.sum(), 0.001); } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
40ea944ae15fae9e3792f2d546105e6ea8a3fe0e
45bcb90c060c335bc18877c6154a158f67967148
/pvmanager/datasource/src/main/java/org/diirt/datasource/DataSourceTypeAdapter.java
780b5ea81341b041be25a16ec5c3049d4dae0102
[ "MIT" ]
permissive
gcarcassi/diirt
fee958d4606fe1c619ab28dde2d39bfdb68ccb5f
f2a7caa176f3f76f24c7cfa844029168e9634bb2
refs/heads/master
2020-04-05T22:58:09.892003
2017-06-02T15:23:44
2017-06-02T15:23:44
50,449,601
0
0
null
2016-01-26T18:27:46
2016-01-26T18:27:45
null
UTF-8
Java
false
false
2,077
java
/** * Copyright (C) 2010-14 diirt developers. See COPYRIGHT.TXT * All rights reserved. Use is subject to license terms. See LICENSE.TXT */ /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package org.diirt.datasource; /** * Matches and fills a cache with the data from connection and message payloads. * This optional class helps the writer of a datasource to manage the * type matching and conversions. * * @param <ConnectionPayload> the type of payload given at connection * @param <MessagePayload> the type of payload for each message * @author carcassi */ public interface DataSourceTypeAdapter<ConnectionPayload, MessagePayload> { /** * Determines whether the converter can take values from the channel * described by the connection payload and transform them in a * type required by the cache. * * @param cache the cache where data will need to be written * @param connection the connection information * @return zero if there is no match, or the position of the type matched */ int match(ValueCache<?> cache, ConnectionPayload connection); /** * The parameters required to open a monitor for the channel. The * type of the parameters will be datasource specific * <p> * For channels multiplexed on a single subscription, this method * is never used. * * @param cache the cache where data will need to be written * @param connection the connection information * @return datasource specific subscription information */ Object getSubscriptionParameter(ValueCache<?> cache, ConnectionPayload connection); /** * Takes the information in the message and updates the cache. * * @param cache cache to be updated * @param connection the connection information * @param message the payload of each message * @return true if a new value was stored */ boolean updateCache(ValueCache<?> cache, ConnectionPayload connection, MessagePayload message); }
[ "gabriele.carcassi@gmail.com" ]
gabriele.carcassi@gmail.com
f3971a8ff3a16dcac082bc0499d2c445a34861f8
7f8577aed090977d2d3606f53c91187941eab33f
/travelPlanWebService/src/main/java/com/lsm/travelPlan/scenicSpotWs/ScenicSpotWebService56.java
ecccd664a0dd99b45ca436da3467871f31720c95
[]
no_license
KevinINGitHub/WebserviceSelected-MasterThesisProject-
817389a149ef1701248681bf205331a5ce14f15d
20f2038d087fff236afdbfe46a478b78c09c9726
refs/heads/master
2021-01-20T11:50:51.209628
2017-03-19T11:21:33
2017-03-19T11:23:28
85,469,980
0
0
null
null
null
null
UTF-8
Java
false
false
641
java
package com.lsm.travelPlan.scenicSpotWs; import java.util.List; import com.lsm.perfAnalysis.GenerateQos; import com.lsm.travelPlan.entity.ScenicDetail; import com.lsm.travelPlan.service.ReceiveDataFRestful; import com.lsm.travelPlan.starHotelWs.StarHotelWebService; public class ScenicSpotWebService56 { public String getScenicSpotInfo(){ String className=this.getClass().getSimpleName(); GenerateQos.generateReliab(className); GenerateQos.generateResponseT(className); String httpUrl="http://localhost:8080/justTest/rest/ScenicSpot/ScenicSpotList"; String result=ReceiveDataFRestful.request(httpUrl,""); return result; } }
[ "shimlong@cisco.com" ]
shimlong@cisco.com
95b80f9b2fe92d4329ba213c3d6b9805ca3d6659
4536d5f0d6e074b565a279ff35917bdb4361721e
/08-03-2020/BackEnd/stock-price-service/src/main/java/com/cts/training/stockprice/stockpriceservice/StockPriceServiceImpl.java
7d03dfabf9af695d943a5e478da43c99632ccdb8
[ "Apache-2.0" ]
permissive
JagadamSairam/Training
f55b300c00fea83c407541b29f7b2326c21bd7e1
ac19a8f3165103c8f270f9f7e08088fc122ae6c3
refs/heads/master
2023-01-18T18:40:55.794782
2020-03-14T11:58:17
2020-03-14T11:58:17
232,063,493
0
0
Apache-2.0
2023-01-07T22:30:25
2020-01-06T09:07:38
CSS
UTF-8
Java
false
false
7,515
java
package com.cts.training.stockprice.stockpriceservice; import java.io.IOException; import java.io.InputStream; import java.time.LocalDate; import java.time.LocalTime; import java.time.ZoneId; import java.time.format.DateTimeParseException; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Optional; import java.util.Set; import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFRow; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; @Service public class StockPriceServiceImpl implements StockPriceService{ @Autowired StockPriceRepository stockPriceRepository; @Override public StockPriceEntity addStockPrice(StockPriceEntity stockprice) { StockPriceEntity stockPriceEntity = new StockPriceEntity(); BeanUtils.copyProperties(stockprice, stockPriceEntity); stockPriceRepository.save(stockprice); return stockPriceEntity; } @Override public void deleteStockPrice(int id) { stockPriceRepository.deleteById(id); } @Override public StockPriceEntity updateStockPrice(StockPriceEntity stockprice) { StockPriceEntity stockPriceEntity = new StockPriceEntity(); BeanUtils.copyProperties(stockprice, stockPriceEntity); stockPriceRepository.save(stockPriceEntity); return stockprice; } @Override public List<StockPriceEntity> getAllStockPrices() { List<StockPriceEntity> entities =stockPriceRepository.findAll(); return entities; } @Override public StockPriceEntity getStockPriceById(int id) { Optional<StockPriceEntity> stocks = stockPriceRepository.findById(id); StockPriceEntity stockEntity = new StockPriceEntity(); BeanUtils.copyProperties(stocks.orElse(new StockPriceEntity()), stockEntity); return stockEntity; } @Override public ImportSummaryData addStockPricesFromExcelSheet(MultipartFile file) throws IOException, Exception { InputStream in = file.getInputStream(); int currentRowNum = 1; int currentCellNum = 0; LocalDate startDate = LocalDate.MAX; LocalDate endDate = LocalDate.MIN; List<String> duplicates = new ArrayList<String>(); List<StockPriceEntity> stockPricesEntities = new ArrayList<StockPriceEntity>(); Set<String> companyCodes = new HashSet<String>(); Set<String> stockExchanges = new HashSet<String>(); if (file.getOriginalFilename().endsWith(".xls")) { try (HSSFWorkbook workbook = new HSSFWorkbook(in)) { HSSFSheet stockPricesSheet = workbook.getSheetAt(0); HSSFRow row = stockPricesSheet.getRow(currentRowNum); while (row != null && row.getCell(0) != null) { String companyCode = row.getCell(currentCellNum++).getStringCellValue().trim(); String stockExchangeName = row.getCell(currentCellNum++).getStringCellValue().trim(); long stockPrice = (long) row.getCell(currentCellNum++).getNumericCellValue(); companyCodes.add(companyCode); stockExchanges.add(stockExchangeName); LocalDate date = row.getCell(currentCellNum++).getDateCellValue().toInstant() .atZone(ZoneId.of("+05:30")).toLocalDate(); startDate = date.isBefore(startDate) ? date : startDate; endDate = date.isAfter(endDate) ? date : endDate; LocalTime time = LocalTime.parse(row.getCell(currentCellNum++).getStringCellValue().trim()); if (!stockPriceRepository.getIfAlreadyExists(companyCode, stockExchangeName, date, time).isPresent()) { StockPriceEntity stockPriceEntity = new StockPriceEntity(companyCode, stockExchangeName, stockPrice, date, time); stockPricesEntities.add(stockPriceEntity); } else { duplicates.add("The record at row " + (currentRowNum + 1) + " is duplicate."); } row = stockPricesSheet.getRow(++currentRowNum); currentCellNum = 0; } } catch (NullPointerException e) { throw new Exception("The file has some missing value at " + (currentRowNum + 1) + ":" + (currentCellNum) + " (row:column). "); } catch (IllegalStateException e) { throw new Exception("The file has some wrong value at " + (currentRowNum + 1) + ":" + (currentCellNum) + " (row:column). "); } catch (DateTimeParseException e) { throw new Exception("The file has wrong date/time format value at " + (currentRowNum + 1) + ":" + (currentCellNum) + " (row:column). "); } } else if (file.getOriginalFilename().endsWith(".xlsx")) { try (XSSFWorkbook workbook = new XSSFWorkbook(in)) { XSSFSheet stockPricesSheet = workbook.getSheetAt(0); System.out.println(stockPricesSheet.getLastRowNum()); XSSFRow row = stockPricesSheet.getRow(currentRowNum); while (row != null && row.getCell(0) != null) { String companyCode = row.getCell(currentCellNum++).getStringCellValue().trim(); companyCode = companyCode.trim(); String stockExchangeName = row.getCell(currentCellNum++).getStringCellValue().trim(); long stockPrice = (long) row.getCell(currentCellNum++).getNumericCellValue(); // if (!serviceProxy.getAllStockExchangesNames().contains(stockExchangeName)) { // throw new Exception("The file has unkown stock exchange value at " + (currentRowNum + 1) + ":" // + (currentCellNum - 1) + " (row:column). "); // } // if (!serviceProxy.getCompanyByStockCodeAndExchangeName(companyCode, stockExchangeName)) { // System.out.println(serviceProxy.getCompanyByStockCodeAndExchangeName(companyCode, stockExchangeName)); // throw new Exception("The file has unkown company code value at " + (currentRowNum + 1) + ":" // + (currentCellNum - 2) + " (row:column). "); // } companyCodes.add(companyCode); stockExchanges.add(stockExchangeName); LocalDate date = row.getCell(currentCellNum++).getDateCellValue().toInstant() .atZone(ZoneId.of("+05:30")).toLocalDate(); startDate = date.isBefore(startDate) ? date : startDate; endDate = date.isAfter(endDate) ? date : endDate; LocalTime time = LocalTime.parse(row.getCell(currentCellNum++).getStringCellValue().trim()); if (!stockPriceRepository.getIfAlreadyExists(companyCode, stockExchangeName, date, time).isPresent()) { StockPriceEntity stockPriceEntity = new StockPriceEntity(companyCode, stockExchangeName, stockPrice, date, time); stockPricesEntities.add(stockPriceEntity); } else { duplicates.add("The record at row " + (currentRowNum + 1) + " is duplicate."); } row = stockPricesSheet.getRow(++currentRowNum); currentCellNum = 0; } } catch (NullPointerException e) { throw new Exception("The file has some missing value at " + (currentRowNum + 1) + ":" + (currentCellNum) + " (row:column). "); } catch (IllegalStateException e) { throw new Exception("The file has some wrong value at " + (currentRowNum + 1) + ":" + (currentCellNum) + " (row:column). "); } catch (DateTimeParseException e) { throw new Exception("The file has wrong date/time format value at " + (currentRowNum + 1) + ":" + (currentCellNum) + " (row:column). "); } } stockPriceRepository.saveAll(stockPricesEntities); return new ImportSummaryData(stockPricesEntities.size(), startDate, endDate, companyCodes, stockExchanges, duplicates); } }
[ "jagadamsairam@gmail.com" ]
jagadamsairam@gmail.com
5ea12669a0f394ee09c6e00cf3d88e232f39ac82
230eff181c53b1121711561af910d23c66f8a3d9
/src/main/java/cn/mazu/auth/IdentityPolicy.java
7ca8cc6f5e900a50af19a27f03a2b14051a707a4
[]
no_license
zhaodayan/jubilant-octo-telegram
7499bc3f6a07b05fda573f02d36fcbac6c195427
3acf7361152e5f25e5bd1903a3e702a309e39d84
refs/heads/master
2021-08-29T23:39:23.600400
2017-12-15T09:08:30
2017-12-15T09:08:30
114,351,697
0
0
null
null
null
null
UTF-8
Java
false
false
1,969
java
/* * Copyright (C) 2009 Emweb bvba, Leuven, Belgium. * * See the LICENSE file for terms of use. */ package cn.mazu.auth; /** * Enumeration for an identity policy. * <p> * This enumeration lists possible choices for the user identity (login name). * <p> * When using password authentication, it is clear that the user has to provide * an identity to login. The only choice is whether you will use the user&apos;s * email address or another login name. * <p> * When using a 3rd party authenticator, e.g. using OAuth, a login name is no * longer needed, but you may still want to give the user the opportunity to * choose one. * <p> * * @see AuthService#setIdentityPolicy(IdentityPolicy identityPolicy) */ public enum IdentityPolicy { /** * A unique login name chosen by the user. * <p> * Even if not really required for authentication, a user still chooses a * unique user name. If possible, a third party autheticator may suggest a * user name. * <p> * This may be useful for sites which have a social aspect. */ LoginNameIdentity, /** * The email address serves as the identity. * <p> * This may be useful for sites which do not have any social character, but * instead render a service to individual users. When the site has a social * character, you will likely not want to display the email address of other * users, but instead a user-chosen login name. */ EmailAddressIdentity, /** * An identity is optional, and only asked if needed for authentication. * <p> * Unless the authentication procedure requires a user name, no particular * identity is asked for. In this case, the identity is a unique internal * identifier. * <p> * This may be useful for sites which do not have any social character, but * instead render a service to individual users. */ OptionalIdentity; /** * Returns the numerical representation of this enum. */ public int getValue() { return ordinal(); } }
[ "hp@hp-PC" ]
hp@hp-PC
a263843fa6dea74871124fcde6c5c9659376c826
17b3f76f372a39cfd45142d4a092a9bbb66f249c
/microservice-sc--userservice/src/main/java/cloud/gateway/core/repositories/ServiceRoleRepo.java
65853556d73131592ee15ee01741301fd43a21e9
[]
no_license
oldSun228/microservice-sc-parent
5824491110dc2cf3b63388a06c1d2bcebd313e8a
7c8ff02ce52071144297a52c2bdfae7cf4e98f34
refs/heads/master
2020-05-16T03:49:28.348320
2019-04-25T02:47:56
2019-04-25T02:47:56
182,748,401
0
0
null
null
null
null
UTF-8
Java
false
false
927
java
package cloud.gateway.core.repositories; import cloud.gateway.core.models.Role; import cloud.gateway.core.pagination.Page; import java.util.List; import java.util.Map; /** * @ClassName: IGroupService * @Description:Group接口 * @author: zml * @date: 2014-11-27 下午15:05:07 * */ public interface ServiceRoleRepo { public List<Role> getRoleListPage(Page<Role> page) throws Exception; public List<Role> getRoleList() throws Exception; public Role getRoleById(String id) throws Exception; public List<Role> getRoleListPage() throws Exception; public void doAdd(Role role) throws Exception; public void doUpdate(Role role) throws Exception; public void doDelete(Role role) throws Exception; public void doDelete(Integer roleid) throws Exception; public List<Map<String, Object>> getMenuByRoleid(String id) throws Exception; List<Role> getRoleListBySiteid(String site_id) throws Exception; }
[ "652810758@qq.com" ]
652810758@qq.com
cbda5b02a571c7a63cd0641419361ead67e98aa6
45b8d5da01faf1a1ebd74dbd47eb08f6a7d07da8
/app/src/main/java/br/com/luan2/testetileview/MainActivity.java
9d0e1c827ee2250e3d4c18437b02d15994be7e13
[]
no_license
luangs7/TesteTileView
40303f24d42272f3db46b82334c9599f9aa5241f
9350b3528c80825b9ea22a69b154f5148c4ef626
refs/heads/master
2021-01-23T11:08:08.210822
2017-06-02T17:43:21
2017-06-02T17:43:21
93,125,377
0
0
null
null
null
null
UTF-8
Java
false
false
1,860
java
package br.com.luan2.testetileview; import android.os.Bundle; import android.support.design.widget.TabLayout; import android.support.v4.view.ViewPager; import br.com.luan2.testetileview.adapter.PagerAdapter; public class MainActivity extends TileViewActivity { protected TabLayout tabLayout; protected ViewPager pager; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.setContentView(R.layout.activity_main); initView(); } private void initView() { tabLayout = (TabLayout) findViewById(R.id.tab_layout); pager = (ViewPager) findViewById(R.id.pager); this.pager = (ViewPager) findViewById(R.id.pager); this.tabLayout = (TabLayout) findViewById(R.id.tab_layout); TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout); tabLayout.addTab(tabLayout.newTab().setText("MAP")); tabLayout.addTab(tabLayout.newTab().setText("IMAGE")); tabLayout.setTabGravity(TabLayout.GRAVITY_FILL); final ViewPager viewPager = (ViewPager) findViewById(R.id.pager); final PagerAdapter adapter = new PagerAdapter (getSupportFragmentManager(), tabLayout.getTabCount()); viewPager.setAdapter(adapter); viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout)); tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { @Override public void onTabSelected(TabLayout.Tab tab) { viewPager.setCurrentItem(tab.getPosition()); } @Override public void onTabUnselected(TabLayout.Tab tab) { } @Override public void onTabReselected(TabLayout.Tab tab) { } }); } }
[ "luangabrielcap@hotmail.com" ]
luangabrielcap@hotmail.com
63913a58459b6a60a05d3d92e5fd7a064e8361e7
79a6cf43828280dde4a8957ab2878def495cde95
/workflow/workflow-impl/src/main/java/com/asiainfo/rms/workflow/service/process/common/ISysStaffService.java
51bddb8fb226d75ca27cf533bfa2b59f0bc1ff5c
[]
no_license
zostudy/cb
aeee90afde5f83fc8fecb02073c724963cf3c44f
c18b3d6fb078d66bd45f446707e67d918ca57ae0
refs/heads/master
2020-05-17T22:24:44.910256
2019-05-07T09:29:39
2019-05-07T09:29:39
183,999,895
0
0
null
null
null
null
UTF-8
Java
false
false
695
java
package com.asiainfo.rms.workflow.service.process.common; import com.asiainfo.rms.core.api.Page; import com.asiainfo.rms.workflow.bo.process.common.SysStaffBO; import com.asiainfo.rms.workflow.bo.process.common.SysStaffQueryPageBO; /** * * * @author joker */ public interface ISysStaffService { public void deleteByPrimaryKey(java.lang.Long staffId) throws Exception; public SysStaffBO save(SysStaffBO sysStaffBO) throws Exception; public SysStaffBO findByPrimaryKey(java.lang.Long staffId) throws Exception; public SysStaffBO update(SysStaffBO sysStaffBO) throws Exception; public Page<SysStaffBO> findByConds(SysStaffQueryPageBO sysStaffQueryPageBO) throws Exception; }
[ "wangrupeng@foxmail.com" ]
wangrupeng@foxmail.com
9f344b25fcbbe41aacc91986d19cfab13eaf2520
5358ea0bfbefff747ddb393c7a05b6a74e37c1dc
/ProjectPractice/src/testPaintWizard/TestPaintCan.java
c6e080818b7dd9ead463eb403a5dc866973ff6cb
[]
no_license
SeanMurray21071995/Java_Exercises
9ceecade62e38210db339a261d5df0d00e5cbc47
a15614eff89b04d9435cb09603f54de284906209
refs/heads/master
2020-03-23T07:12:50.151152
2018-07-23T16:31:00
2018-07-23T16:31:00
141,255,421
0
0
null
null
null
null
UTF-8
Java
false
false
375
java
package testPaintWizard; import static org.junit.Assert.*; import org.junit.Test; import paintWizard.PaintCan; public class TestPaintCan { @Test public void testCalculateTotalCoverage() { PaintCan pc = new PaintCan("CheapoMax",20,10,1999); pc.calculateTotalCoverage(); assertEquals("The total calculation wasn't",pc.getTotalCoveragePerProduct(),200); } }
[ "Sean.Murray@academytrainee.com" ]
Sean.Murray@academytrainee.com
406b00d5f02ed5122449d6d491da9e8502a69bb2
5df655f577bd7f4989dd9282cf07e1ddf53c5a32
/src/lk/gamage/stockmgt/model/SupplierDTO.java
b846b3b2a7d6a1ec204485defd9534ef4295994a
[]
no_license
KavindaPushpitha/StoreManagementSystem
b9c6784ac6b8a2ec555df01594413d9550a7fd34
3a2cffc4fc34e579f28bec0d702fa677abe482da
refs/heads/master
2020-03-30T16:09:30.541795
2019-01-05T09:25:26
2019-01-05T09:25:26
151,395,826
2
0
null
null
null
null
UTF-8
Java
false
false
2,456
java
package lk.gamage.stockmgt.model; public class SupplierDTO { private String supplierID; private String supplierName; private String address; private String contact; private String companyName; private String companyAddress; private String companyContact; public SupplierDTO() { } public SupplierDTO(String supplierID, String supplierName, String address, String contact, String companyName, String companyAddress, String companyContact) { this.supplierID = supplierID; this.supplierName = supplierName; this.address = address; this.contact = contact; this.companyName = companyName; this.companyAddress = companyAddress; this.companyContact = companyContact; } public String getSupplierID() { return supplierID; } public void setSupplierID(String supplierID) { this.supplierID = supplierID; } public String getSupplierName() { return supplierName; } public void setSupplierName(String supplierName) { this.supplierName = supplierName; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getContact() { return contact; } public void setContact(String contact) { this.contact = contact; } public String getCompanyName() { return companyName; } public void setCompanyName(String companyName) { this.companyName = companyName; } public String getCompanyAddress() { return companyAddress; } public void setCompanyAddress(String companyAddress) { this.companyAddress = companyAddress; } public String getCompanyContact() { return companyContact; } public void setCompanyContact(String companyContact) { this.companyContact = companyContact; } @Override public String toString() { return "SupplierDTO{" + "supplierID='" + supplierID + '\'' + ", supplierName='" + supplierName + '\'' + ", address='" + address + '\'' + ", contact='" + contact + '\'' + ", companyName='" + companyName + '\'' + ", companyAddress='" + companyAddress + '\'' + ", companyContact='" + companyContact + '\'' + '}'; } }
[ "KevinForGithub@gmail.com" ]
KevinForGithub@gmail.com
a0d96264a03790eafe0f63074e43264d62323a3b
209741f8ae550e321fc2cecbb9c1b69a5a0bd81b
/integtests/src/test/java/integration/tests/smoke/WaveformObjectsTest.java
773ff46c6cc6c42b306bacc792a677746e2f421b
[]
no_license
martin-g/isis-wicket-waveform
0a4fc785d9fe74a441b422e2e96a00dd16d90ff2
226f897b0cf6eb2def0a2d4de2f0219f5e49c5e6
refs/heads/master
2020-05-17T20:37:55.575956
2015-02-10T22:37:31
2015-02-10T22:37:31
30,493,759
1
1
null
null
null
null
UTF-8
Java
false
false
4,977
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 integration.tests.smoke; import dom.waveform.WaveformObject; import dom.waveform.WaveformObjects; import fixture.waveform.WaveformObjectsTearDownFixture; import fixture.waveform.scenario.WaveformObjectsFixture; import integration.tests.WaveformAppIntegTest; import java.sql.SQLIntegrityConstraintViolationException; import java.util.List; import javax.inject.Inject; import com.google.common.base.Throwables; import org.hamcrest.Description; import org.hamcrest.Matcher; import org.hamcrest.TypeSafeMatcher; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.apache.isis.applib.fixturescripts.FixtureScript; import org.apache.isis.applib.fixturescripts.FixtureScripts; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; public class WaveformObjectsTest extends WaveformAppIntegTest { @Rule public ExpectedException expectedException = ExpectedException.none(); @Inject FixtureScripts fixtureScripts; @Inject WaveformObjects simpleObjects; FixtureScript fixtureScript; public static class ListAll extends WaveformObjectsTest { @Test public void happyCase() throws Exception { // given fixtureScript = new WaveformObjectsFixture(); fixtureScripts.runFixtureScript(fixtureScript, null); nextTransaction(); // when final List<WaveformObject> all = wrap(simpleObjects).listAll(); // then assertThat(all.size(), is(3)); WaveformObject simpleObject = wrap(all.get(0)); assertThat(simpleObject.getName(), is("Foo")); } @Test public void whenNone() throws Exception { // given fixtureScript = new WaveformObjectsTearDownFixture(); fixtureScripts.runFixtureScript(fixtureScript, null); nextTransaction(); // when final List<WaveformObject> all = wrap(simpleObjects).listAll(); // then assertThat(all.size(), is(0)); } } public static class Create extends WaveformObjectsTest { @Test public void happyCase() throws Exception { // given fixtureScript = new WaveformObjectsTearDownFixture(); fixtureScripts.runFixtureScript(fixtureScript, null); nextTransaction(); // when wrap(simpleObjects).create("Faz", new int[] {1, 2, 3}); // then final List<WaveformObject> all = wrap(simpleObjects).listAll(); assertThat(all.size(), is(1)); } @Test public void whenAlreadyExists() throws Exception { // given fixtureScript = new WaveformObjectsTearDownFixture(); fixtureScripts.runFixtureScript(fixtureScript, null); nextTransaction(); wrap(simpleObjects).create("Faz", new int[] {1, 2, 3}); nextTransaction(); // then expectedException.expectCause(causalChainContains(SQLIntegrityConstraintViolationException.class)); // when wrap(simpleObjects).create("Faz", new int[] {1, 2, 3}); nextTransaction(); } private static Matcher<? extends Throwable> causalChainContains(final Class<?> cls) { return new TypeSafeMatcher<Throwable>() { @Override protected boolean matchesSafely(Throwable item) { final List<Throwable> causalChain = Throwables.getCausalChain(item); for (Throwable throwable : causalChain) { if(cls.isAssignableFrom(throwable.getClass())){ return true; } } return false; } @Override public void describeTo(Description description) { description.appendText("exception with causal chain containing " + cls.getSimpleName()); } }; } } }
[ "mgrigorov@apache.org" ]
mgrigorov@apache.org
7f332a98c327a6e7807c6370b0d03803af66933d
5633031bf82780981228717b7273c904e332f083
/src/main/java/com/upwork/webcalculator/exception/NotFoundExceptionMapper.java
7362d5206e65e4db0e1cad136be5af0ed7a466ef
[]
no_license
fbonecco/web-calculator
6af6a71de7dee84a4b5f6b3c9835e0ae99ffb230
8464894ab991c58667e8f1e0e8c0d4a363ba9cae
refs/heads/master
2021-01-16T22:06:53.971864
2016-06-20T15:14:25
2016-06-20T15:14:25
61,554,502
0
0
null
null
null
null
UTF-8
Java
false
false
868
java
package com.upwork.webcalculator.exception; import javax.ws.rs.NotFoundException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.ext.ExceptionMapper; import javax.ws.rs.ext.Provider; import com.upwork.webcalculator.domain.ErrorMessage; /** * Custom {@link ExceptionMapper} that handles exceptions that are thrown when a resource is not * found. Instead of returning plain HTML, this provides a more descriptive (and user friendly) * message. * * @author fbonecco * */ @Provider public class NotFoundExceptionMapper implements ExceptionMapper<NotFoundException> { @Override public Response toResponse(NotFoundException exception) { ErrorMessage errorMessage = new ErrorMessage(404, "Resource not found."); return Response.status(404).entity(errorMessage).type(MediaType.APPLICATION_JSON).build(); } }
[ "fbonecco@gmail.com" ]
fbonecco@gmail.com
b7727487b6f08debcf0b18477f7e03dec17baa7d
f09836a76809d077570502ed29047dbd4909688c
/minibox-common/src/main/java/com/ghw/minibox/component/GenerateBean.java
a1374523967c80dd55222363448b9a4682763e5e
[]
no_license
VioletCoding/mini-box
0f92179eecae367398d14889d2d3ff80a9f493a9
f066fa8ebb82c19d9f2698dff59bb801bafcdf95
refs/heads/master
2023-04-11T17:40:10.593050
2021-04-23T12:05:41
2021-04-23T12:05:41
313,925,064
0
0
null
null
null
null
UTF-8
Java
false
false
364
java
package com.ghw.minibox.component; import com.fasterxml.jackson.databind.ObjectMapper; import org.springframework.stereotype.Component; /** * @author Violet * @description 生成一些常用的类,注入到IOC * @date 2021/1/6 */ @Component public class GenerateBean { public ObjectMapper getObjectMapper() { return new ObjectMapper(); } }
[ "1054197367@qq.com" ]
1054197367@qq.com
fc9af68aea5cd264023286d734bf86b21e8aee0e
a97b59f45489dba77a3217128c91b57964776f77
/app/src/main/java/com/xcb/cookiemusic/crash/CrashHandler.java
d225f959bc6462847c101b034c67c1fa548a99fb
[]
no_license
xiechongbin/CookieMusic
6b3290ed240885829ad81dc9a537f35aa0c4fce5
6bb2dcb216fd200cfcf5c1f2b1e56d93afc531d9
refs/heads/master
2021-07-18T15:33:59.244804
2019-12-25T03:07:39
2019-12-25T03:07:39
130,799,258
0
0
null
null
null
null
UTF-8
Java
false
false
4,319
java
package com.xcb.cookiemusic.crash; import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.os.Build; import android.os.Process; import com.xcb.cookiemusic.log.Logger; import com.xcb.cookiemusic.utils.AppUtils; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; /** * 捕获全局异常类 * Created by zhs on 2018/5/4. */ public class CrashHandler implements Thread.UncaughtExceptionHandler { //log文件的文件名 private static final String LOG_FILE_NAME = "crash_"; //log文件的后缀名 private static final String FILE_NAME_SUFFIX = ".txt"; private static CrashHandler instance; private Context mContext; /** * 系统默认的异常处理器 */ private Thread.UncaughtExceptionHandler uncaughtExceptionHandler; /** * 构造方法私有化 */ private CrashHandler() { } public static CrashHandler getInstance() { if (instance == null) { synchronized (CrashHandler.class) { if (instance == null) { instance = new CrashHandler(); } } } return instance; } public void init(Context context) { uncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler(); Thread.setDefaultUncaughtExceptionHandler(this); mContext = context.getApplicationContext(); } @Override public void uncaughtException(Thread t, Throwable e) { try { dumpExceptionToSDCard(e); } catch (IOException e1) { e.printStackTrace(); } //打印出当前调用栈信息 e.printStackTrace(); //如果系统提供了默认的异常处理器,则交给系统去结束我们的程序,否则就由我们自己结束自己 if (uncaughtExceptionHandler != null) { uncaughtExceptionHandler.uncaughtException(t, e); } else { Process.killProcess(Process.myPid()); } } /** * @param ex 异常 * @throws IOException */ private void dumpExceptionToSDCard(Throwable ex) throws IOException { long currentTime = System.currentTimeMillis(); String time = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.CHINESE).format(new Date(currentTime)); //以当前时间创建log文件 String filePath = AppUtils.getAppCacheDir(mContext) + File.separator + LOG_FILE_NAME + time + FILE_NAME_SUFFIX; Logger.d("错误日志保存路径:" + filePath); File file = new File(filePath); try { if (file.exists()) { file.delete(); } file.createNewFile(); PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(file))); //导出发生异常的时间 pw.println(time); //导出手机信息 dumpPhoneInfo(pw); pw.println(); //导出异常的调用栈信息 ex.printStackTrace(pw); pw.close(); } catch (Exception e) { e.printStackTrace(); } } private void dumpPhoneInfo(PrintWriter pw) throws PackageManager.NameNotFoundException { //应用的版本名称和版本号 PackageManager pm = mContext.getPackageManager(); PackageInfo pi = pm.getPackageInfo(mContext.getPackageName(), PackageManager.GET_ACTIVITIES); pw.print("App Version: "); pw.print(pi.versionName); pw.print('_'); pw.println(pi.versionCode); //android版本号 pw.print("OS Version: "); pw.print(Build.VERSION.RELEASE); pw.print("_"); pw.println(Build.VERSION.SDK_INT); //手机制造商 pw.print("Vendor: "); pw.println(Build.MANUFACTURER); //手机型号 pw.print("Model: "); pw.println(Build.MODEL); //cpu架构 pw.print("CPU ABI: "); pw.println(Build.CPU_ABI); pw.print("Device Id:"); pw.println(AppUtils.getDeviceId(mContext)); } }
[ "xiecb@gzyitop.com" ]
xiecb@gzyitop.com
361793fb1d4f7fe24a1024bc8a728ac6886de146
2c24783a132099308ea04a68f185a463f26c5970
/bus-storage/src/main/java/org/aoju/bus/storage/provider/MinioOssProvider.java
aeefb275af8a9e91c889c3098009efb41c2d5821
[ "MIT" ]
permissive
zyj0021/bus
4e36ced3c0ee309c50fe4d296f040830f5e6fdea
03deafcfc1a0b5da0bc71466714b18702eed60b9
refs/heads/master
2023-08-26T02:13:40.569205
2021-11-08T07:52:22
2021-11-08T07:52:22
null
0
0
null
null
null
null
UTF-8
Java
false
false
11,960
java
/********************************************************************************* * * * The MIT License (MIT) * * * * Copyright (c) 2015-2021 aoju.org and other contributors. * * * * 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 org.aoju.bus.storage.provider; import com.google.common.collect.Maps; import io.minio.MinioClient; import io.minio.Result; import io.minio.errors.*; import io.minio.messages.Item; import org.aoju.bus.core.lang.Assert; import org.aoju.bus.core.lang.MediaType; import org.aoju.bus.core.lang.exception.InstrumentException; import org.aoju.bus.core.toolkit.IoKit; import org.aoju.bus.core.toolkit.StringKit; import org.aoju.bus.logger.Logger; import org.aoju.bus.storage.Builder; import org.aoju.bus.storage.Context; import org.aoju.bus.storage.magic.Attachs; import org.aoju.bus.storage.magic.Message; import org.xmlpull.v1.XmlPullParserException; import java.io.*; import java.nio.file.Path; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java.time.Duration; import java.util.Map; import java.util.stream.Collectors; import java.util.stream.StreamSupport; /** * 存储服务-MinIO * * @author Kimi Liu * @version 6.3.1 * @since JDK 1.8+ */ public class MinioOssProvider extends AbstractProvider { private MinioClient client; public MinioOssProvider(Context context) { this.context = context; Assert.notBlank(this.context.getPrefix(), "[prefix] not defined"); Assert.notBlank(this.context.getEndpoint(), "[endpoint] not defined"); Assert.notBlank(this.context.getBucket(), "[bucket] not defined"); Assert.notBlank(this.context.getAccessKey(), "[accessKey] not defined"); Assert.notBlank(this.context.getSecretKey(), "[secretKey] not defined"); Assert.notNull(this.context.isSecure(), "[secure] not defined"); Assert.notBlank(StringKit.toString(this.context.getReadTimeout()), "[readTimeout] not defined"); Assert.notBlank(StringKit.toString(this.context.getConnectTimeout()), "[connectTimeout] not defined"); Assert.notBlank(StringKit.toString(this.context.getWriteTimeout()), "[writeTimeout] not defined"); Assert.notBlank(StringKit.toString(this.context.getReadTimeout()), "[readTimeout] not defined"); try { this.client = new MinioClient( this.context.getEndpoint(), this.context.getAccessKey(), this.context.getSecretKey(), this.context.isSecure() ); this.client.setTimeout( Duration.ofSeconds(this.context.getConnectTimeout() != 0 ? this.context.getConnectTimeout() : 10).toMillis(), Duration.ofSeconds(this.context.getWriteTimeout() != 60 ? this.context.getWriteTimeout() : 60).toMillis(), Duration.ofSeconds(this.context.getReadTimeout() != 0 ? this.context.getReadTimeout() : 10).toMillis() ); } catch (InvalidPortException | InvalidEndpointException ex) { throw new InstrumentException(ex.getMessage()); } } @Override public Message download(String fileName) { return download(this.context.getBucket(), fileName); } @Override public Message download(String bucket, String fileName) { try { InputStream inputStream = this.client.getObject(bucket, fileName); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); return Message.builder() .errcode(Builder.ErrorCode.SUCCESS.getCode()) .errmsg(Builder.ErrorCode.SUCCESS.getMsg()) .data(bufferedReader) .build(); } catch (Exception e) { Logger.error("file download failed", e.getMessage()); } return Message.builder() .errcode(Builder.ErrorCode.FAILURE.getCode()) .errmsg(Builder.ErrorCode.FAILURE.getMsg()) .build(); } @Override public Message download(String bucket, String fileName, File file) { try { InputStream inputStream = this.client.getObject(bucket, fileName); OutputStream outputStream = new FileOutputStream(file); IoKit.copy(inputStream, outputStream); } catch (Exception e) { Logger.error("file download failed", e.getMessage()); } return Message.builder() .errcode(Builder.ErrorCode.FAILURE.getCode()) .errmsg(Builder.ErrorCode.FAILURE.getMsg()) .build(); } @Override public Message download(String fileName, File file) { return download(this.context.getBucket(), fileName, file); } @Override public Message list() { try { Iterable<Result<Item>> iterable = this.client.listObjects(this.context.getBucket()); return Message.builder() .errcode(Builder.ErrorCode.SUCCESS.getCode()) .errmsg(Builder.ErrorCode.SUCCESS.getMsg()) .data(StreamSupport .stream(iterable.spliterator(), true) .map(itemResult -> { try { Attachs storageItem = new Attachs(); Item item = itemResult.get(); storageItem.setName(item.objectName()); storageItem.setSize(StringKit.toString(item.objectSize())); Map<String, Object> extend = Maps.newHashMap(); extend.put("tag", item.etag()); extend.put("storageClass", item.storageClass()); extend.put("lastModified", item.lastModified()); storageItem.setExtend(extend); return storageItem; } catch (InvalidBucketNameException | NoSuchAlgorithmException | InsufficientDataException | IOException | InvalidKeyException | NoResponseException | XmlPullParserException | ErrorResponseException | InternalException e) { return Message.builder() .errcode(Builder.ErrorCode.FAILURE.getCode()) .errmsg(Builder.ErrorCode.FAILURE.getMsg()) .build(); } }) .collect(Collectors.toList())) .build(); } catch (XmlPullParserException e) { Logger.error("file list failed", e.getMessage()); } return Message.builder() .errcode(Builder.ErrorCode.FAILURE.getCode()) .errmsg(Builder.ErrorCode.FAILURE.getMsg()) .build(); } @Override public Message rename(String oldName, String newName) { return Message.builder() .errcode(Builder.ErrorCode.FAILURE.getCode()) .errmsg(Builder.ErrorCode.FAILURE.getMsg()) .build(); } @Override public Message rename(String bucket, String oldName, String newName) { return Message.builder() .errcode(Builder.ErrorCode.FAILURE.getCode()) .errmsg(Builder.ErrorCode.FAILURE.getMsg()) .build(); } @Override public Message upload(String bucket, byte[] content) { InputStream stream = new ByteArrayInputStream(content); return upload(this.context.getBucket(), bucket, stream); } @Override public Message upload(String bucket, String fileName, InputStream content) { try { this.client.putObject(bucket, fileName, content, content.available(), MediaType.APPLICATION_OCTET_STREAM); return Message.builder() .errcode(Builder.ErrorCode.SUCCESS.getCode()) .errmsg(Builder.ErrorCode.SUCCESS.getMsg()) .data(Attachs.builder() .name(fileName) .path(this.context.getPrefix() + fileName)) .build(); } catch (Exception e) { Logger.error("file upload failed", e.getMessage()); } return Message.builder() .errcode(Builder.ErrorCode.FAILURE.getCode()) .errmsg(Builder.ErrorCode.FAILURE.getMsg()) .build(); } @Override public Message upload(String bucket, String fileName, byte[] content) { return upload(bucket, fileName, new ByteArrayInputStream(content)); } @Override public Message remove(String fileName) { return remove(this.context.getBucket(), fileName); } @Override public Message remove(String bucket, String fileName) { try { this.client.removeObject(bucket, fileName); return Message.builder() .errcode(Builder.ErrorCode.SUCCESS.getCode()) .errmsg(Builder.ErrorCode.SUCCESS.getMsg()) .build(); } catch (Exception e) { Logger.error("file remove failed ", e.getMessage()); } return Message.builder() .errcode(Builder.ErrorCode.FAILURE.getCode()) .errmsg(Builder.ErrorCode.FAILURE.getMsg()) .build(); } @Override public Message remove(String bucket, Path path) { return remove(bucket, path.toString()); } }
[ "839536@qq.com" ]
839536@qq.com