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
76285595a4a5facd690f1ebf1497291f05583661
9ab17c6807de2d925ac2b988cece76963aa47c92
/app/src/main/java/com/example/Samar/capstonetwo/activities/LoginActivity.java
5c0938ca47ed20af05c406839742c2d192ebd4ca
[]
no_license
samar24/CapstoneTwo
6cacea1882077a3b9ac377435f1aab5fbc76bb8e
89908506cd5183b596a9029f61a6a5b87b177d65
refs/heads/master
2020-03-24T21:33:08.842518
2018-08-06T14:59:47
2018-08-06T14:59:47
143,038,524
0
0
null
null
null
null
UTF-8
Java
false
false
5,344
java
package com.example.Samar.capstonetwo.activities; import android.content.Intent; import android.support.annotation.NonNull; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.text.TextUtils; import android.view.View; import android.widget.EditText; import com.example.Samar.capstonetwo.R; import com.google.firebase.auth.FirebaseAuth; import android.util.Log; import android.widget.Toast; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; import com.google.firebase.auth.AuthCredential; import com.google.firebase.auth.AuthResult; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; import com.google.firebase.auth.GoogleAuthProvider; public class LoginActivity extends AppCompatActivity implements View.OnClickListener { private EditText mEmailField; private EditText mPasswordField; // [START declare_auth] private FirebaseAuth mAuth; // [END declare_auth] @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); mEmailField = (EditText) findViewById(R.id.gmail); mPasswordField = (EditText) findViewById(R.id.password); // Buttons findViewById(R.id.login).setOnClickListener(this); findViewById(R.id.SignUp).setOnClickListener(this); mAuth = FirebaseAuth.getInstance(); } // [START on_start_check_user] @Override public void onStart() { super.onStart(); // Check if user is signed in (non-null) and update UI accordingly. FirebaseUser currentUser = mAuth.getCurrentUser(); updateUI(currentUser); } // [END on_start_check_user] private void createAccount(String email, String password) { if (!validateForm()) { return; } mAuth.createUserWithEmailAndPassword(email, password) .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() { @Override public void onComplete(@NonNull Task<AuthResult> task) { if (task.isSuccessful()) { // Sign in success, update UI with the signed-in user's information FirebaseUser user = mAuth.getCurrentUser(); updateUI(user); } else { // If sign in fails, display a message to the user. updateUI(null); } } }); } private void signIn(String email, String password) { if (!validateForm()) { return; } mAuth.signInWithEmailAndPassword(email, password) .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() { @Override public void onComplete(@NonNull Task<AuthResult> task) { if (task.isSuccessful()) { // Sign in success, update UI with the signed-in user's information FirebaseUser user = mAuth.getCurrentUser(); updateUI(user); } else { // If sign in fails, display a message to the user. updateUI(null); } // [START_EXCLUDE] if (!task.isSuccessful()) { } // [END_EXCLUDE] } }); // [END sign_in_with_email] } private boolean validateForm() { boolean valid = true; String email = mEmailField.getText().toString(); if (TextUtils.isEmpty(email)) { mEmailField.setError(getApplicationContext().getResources().getString(R.string.require)); valid = false; } else { mEmailField.setError(null); } String password = mPasswordField.getText().toString(); if (TextUtils.isEmpty(password)) { mPasswordField.setError(getApplicationContext().getResources().getString(R.string.require)); valid = false; } else { mPasswordField.setError(null); } return valid; } private void updateUI(FirebaseUser user) { if (user != null) { Intent i=new Intent(getApplicationContext(),MainActivity.class); startActivity(i); Toast.makeText(getApplicationContext(), getApplicationContext().getResources().getString(R.string.welcome)+" "+user.getEmail().toString(), Toast.LENGTH_SHORT).show(); } } @Override public void onClick(View v) { int i = v.getId(); if (i == R.id.SignUp) { createAccount(mEmailField.getText().toString(), mPasswordField.getText().toString()); } else if (i == R.id.login) { signIn(mEmailField.getText().toString(), mPasswordField.getText().toString()); } } }
[ "samar.abou.abeed.saad@gmail.com" ]
samar.abou.abeed.saad@gmail.com
c454407bbdf46f800ac51a851dba37a6b5e18a0e
0c14263a35ae5d6e8d22a9cc59b1fb80a0e8531e
/src/main/java/com/ivc/talonsystem/dao/RjuDaoImpl.java
b71bed73cf812be0b8991ab3a09fe5ec9e73b12e
[]
no_license
shone1991/springtalonsystem
d0ac835672b637418be2f5b216f7923f1a5b3829
88928f74c258d59722bdea55d7efedcb3a561194
refs/heads/master
2023-02-26T00:05:59.801873
2021-01-29T11:29:34
2021-01-29T11:29:34
334,124,142
0
0
null
null
null
null
UTF-8
Java
false
false
1,344
java
package com.ivc.talonsystem.dao; import java.util.List; import org.hibernate.Criteria; import org.hibernate.criterion.Order; import org.hibernate.criterion.Restrictions; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Repository; import com.ivc.talonsystem.entity.Rju; @Repository("rjuDao") public class RjuDaoImpl extends AbstractDao<Integer, Rju> implements RjuDao{ static final Logger logger = LoggerFactory.getLogger(RjuDaoImpl.class); @Override public Rju findById(int id) { Rju rju = getByKey(id); return rju; } @Override public void save(Rju rju) { persist(rju); } @Override public void edit(Rju rju) { update(rju); } @Override public void delete(Rju rju) { delete(rju); } @SuppressWarnings("unchecked") @Override public List<Rju> findAllRjus() { Criteria criteria = createEntityCriteria().addOrder(Order.asc("namerju")); criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);//To avoid duplicates. List<Rju> units = (List<Rju>) criteria.list(); return units; } @Override public Rju findByCallname(String callname) { Criteria crit = createEntityCriteria(); crit.add(Restrictions.eq("callname", callname)); Rju unit = (Rju)crit.uniqueResult(); return unit; } }
[ "furqatlapasov1991@gmail.com" ]
furqatlapasov1991@gmail.com
6e1f620bac4a9cedee4f2071ebfeb9ce52207bb4
108b9133574a2f4fc72b5545a68cf8e1e887fa9a
/src/main/java/com/atguigu/contants/Constants.java
311aa6172a5eb3b031155979137e50897dd66922
[]
no_license
myflash163/guli-weibo
d36968609eb726763766a7f18ea9090c4955667b
3a050936043eb821066287585a0e0dd487925ef6
refs/heads/master
2022-05-05T10:52:59.620179
2020-03-25T11:03:48
2020-03-25T11:03:48
249,955,426
1
0
null
2022-04-12T21:58:51
2020-03-25T11:03:29
Java
UTF-8
Java
false
false
967
java
package com.atguigu.contants; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseConfiguration; public class Constants { public static final Configuration CONFIGURATION = HBaseConfiguration.create(); //ๅ‘ฝๅ็ฉบ้—ด public static final String NAMESPACE = "weibo"; //ๅพฎๅšๅ†…ๅฎน่กจ public static final String CONTENT_TABLE = "weibo:content"; public static final String CONTENT_TABLE_CF = "info"; public static final int CONTENT_TABLE_VERSIONS = 1; //็”จๆˆทๅ…ณ็ณป่กจ public static final String RELATION_TABLE = "weibo:relation"; public static final String RELATION_TABLE_CF1 = "attends"; public static final String RELATION_TABLE_CF2 = "fans"; public static final int RELATION_TABLE_VERSIONS = 1; //ๆ”ถไปถ็ฎฑ่กจ public static final String INBOX_TABLE = "weibo:inbox"; public static final String INBOX_TABLE_CF = "info"; public static final int INBOX_TABLE_VERSIONS = 2; }
[ "myflash2012@gmail.com" ]
myflash2012@gmail.com
26418a406dfdbf56657e390b0bfe059398d1e535
d2287c5762e985e14ff6fe84c643c75de4c1787a
/src/main/java/com/oj/configuration/RedisConfiguration.java
01157bfc3a41ceb4a3e36577f1d8268294e41abe
[]
no_license
PanQihang/OJ_front
0ac228634f970110d76fed9f6fd0cacbd950dfc6
a3f82a00dd5648030653a448aaa1f2f1d0449f14
refs/heads/master
2022-12-25T01:21:43.006809
2019-06-18T02:44:35
2019-06-18T02:44:35
192,452,063
1
0
null
2022-12-16T00:02:06
2019-06-18T02:38:09
JavaScript
UTF-8
Java
false
false
1,970
java
package com.oj.configuration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.cache.annotation.EnableCaching; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import redis.clients.jedis.JedisPool; import redis.clients.jedis.JedisPoolConfig; /** * Redis ้…็ฝฎ็ฑป * * @author Leon * @version 2018/6/17 17:46 */ @Configuration // ๅฟ…้กปๅŠ ๏ผŒไฝฟ้…็ฝฎ็”Ÿๆ•ˆ @EnableCaching public class RedisConfiguration{ /** * Logger */ private static final Logger log = LoggerFactory.getLogger(RedisConfiguration.class); @Value("${spring.redis.host}") private String host; @Value("${spring.redis.port}") private int port; @Value("${spring.redis.timeout}") private int timeout; @Value("${spring.redis.jedis.pool.max-idle}") private int maxIdle; @Value("${spring.redis.jedis.pool.max-wait}") private long maxWaitMillis; @Value("${spring.redis.password}") private String password; // @Value("${spring.redis.block-when-exhausted}") // private boolean blockWhenExhausted; @Bean public JedisPool redisPoolFactory() throws Exception{ log.info("JedisPoolๆณจๅ…ฅๆˆๅŠŸ๏ผ๏ผ"); log.info("redisๅœฐๅ€๏ผš" + host + ":" + port); JedisPoolConfig jedisPoolConfig = new JedisPoolConfig(); jedisPoolConfig.setMaxIdle(maxIdle); jedisPoolConfig.setMaxWaitMillis(maxWaitMillis); // ่ฟžๆŽฅ่€—ๅฐฝๆ—ถๆ˜ฏๅฆ้˜ปๅกž, falseๆŠฅๅผ‚ๅธธ,ture้˜ปๅกž็›ดๅˆฐ่ถ…ๆ—ถ, ้ป˜่ฎคtrue jedisPoolConfig.setBlockWhenExhausted(true); // ๆ˜ฏๅฆๅฏ็”จpool็š„jmx็ฎก็†ๅŠŸ่ƒฝ, ้ป˜่ฎคtrue jedisPoolConfig.setJmxEnabled(true); JedisPool jedisPool = new JedisPool(jedisPoolConfig, host, port, timeout, password); return jedisPool; } }
[ "954347921@qq.com" ]
954347921@qq.com
d57dd6dd429397852871234aa58036ba9a35fc3c
308ecd7af526315abc095d8726fc103760c68318
/src/main/java/com/example/knowledgedbcore/dao/userdao/UserDao.java
f94ae352054f9a89014197c9dbb231c67e06a96d
[]
no_license
Maureus/knowledge-db-test
d134c9a164eb68235e45ee724251e0418d693980
84f02c5f3c68bcaddf130d2c9821ec33ab587455
refs/heads/master
2022-12-14T10:13:09.723183
2020-09-08T14:20:51
2020-09-08T14:20:51
293,828,483
0
0
null
null
null
null
UTF-8
Java
false
false
403
java
package com.example.knowledgedbcore.dao.userdao; import com.example.knowledgedbcore.models.User; import java.util.Optional; public interface UserDao { Optional<User> findById(int id); User saveUser(User user); Iterable<User> findAll(); Boolean existsByUserName(String userName); Boolean existsByEmail(String email); Optional<User> finUserByUserName(String userName); }
[ "andriiandrusenko@gmail.com" ]
andriiandrusenko@gmail.com
fe0d585d911189b779f36a46ce42acbfe09150b9
1d8ff4600495e0b89f0156f86780a98c9fb9e4aa
/Pro_manageuser_buimanhdung333/src/manageuser/logics/TblDetailUserJapanLogic.java
e42dfa26805194841c03a115218174662c6c9dda
[]
no_license
nongviettri/javacore
6c784f93d067e057368d1b9dab6ccd6f89e1178a
71d27e67a8d1d6b7056ab3fd985b440b3d619f9c
refs/heads/master
2022-11-30T12:08:09.116438
2020-04-26T05:33:33
2020-04-26T05:33:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
620
java
/** * Copyright(C) 2019 Luvina Software * TblDetailUserJapanLogic.java, Dec 27, 2019, MDung */ package manageuser.logics; import java.sql.SQLException; /** * @author MDung * */ public interface TblDetailUserJapanLogic { /** * Kiแปƒm tra xem user ฤ‘รฃ cรณ trรฌnh ฤ‘แป™ tiแบฟng Nhแบญt hay chฦฐa * * @param userId id cแปงa user cแบงn kiแปƒm tra * @return true nแบฟu cรณ trรฌnh ฤ‘แป™ tiแบฟng Nhแบญt, false nแบฟu khรดng * @throws ClassNotFoundException lแป—i load DRIVER * @throws SQLException lแป—i SQL */ boolean checkExistDetailUserJapan(int userId) throws ClassNotFoundException, SQLException; }
[ "dung080198@gmail.com" ]
dung080198@gmail.com
a2cbb150491fd8f855a13e1922a76eb562152379
4d6f449339b36b8d4c25d8772212bf6cd339f087
/netreflected/src/Core/System.Data.Common,Version=4.2.2.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a/system/data/IsolationLevel.java
0ffd407b02e59f2b6390b91d216d2bd1ffd7f383
[ "MIT" ]
permissive
lvyitian/JCOReflector
299a64550394db3e663567efc6e1996754f6946e
7e420dca504090b817c2fe208e4649804df1c3e1
refs/heads/master
2022-12-07T21:13:06.208025
2020-08-28T09:49:29
2020-08-28T09:49:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,065
java
/* * MIT License * * Copyright (c) 2020 MASES s.r.l. * * 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. */ /************************************************************************************** * <auto-generated> * This code was generated from a template using JCOReflector * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. * </auto-generated> *************************************************************************************/ package system.data; import org.mases.jcobridge.*; import org.mases.jcobridge.netreflection.*; // Import section // PACKAGE_IMPORT_SECTION /** * The base .NET class managing System.Data.IsolationLevel, System.Data.Common, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. Extends {@link NetObject}. * <p> * * See: <a href="https://docs.microsoft.com/en-us/dotnet/api/System.Data.IsolationLevel" target="_top">https://docs.microsoft.com/en-us/dotnet/api/System.Data.IsolationLevel</a> */ public class IsolationLevel extends NetObject { /** * Fully assembly qualified name: System.Data.Common, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a */ public static final String assemblyFullName = "System.Data.Common, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; /** * Assembly name: System.Data.Common */ public static final String assemblyShortName = "System.Data.Common"; /** * Qualified class name: System.Data.IsolationLevel */ public static final String className = "System.Data.IsolationLevel"; static JCOBridge bridge = JCOBridgeInstance.getInstance(assemblyFullName); /** * The type managed from JCOBridge. See {@link JCType} */ public static JCType classType = createType(); static JCEnum enumReflected = createEnum(); JCEnum classInstance = null; static JCType createType() { try { return bridge.GetType(className + ", " + (JCOBridgeInstance.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName)); } catch (JCException e) { return null; } } static JCEnum createEnum() { try { return bridge.GetEnum(className + ", " + (JCOBridgeInstance.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName)); } catch (JCException e) { return null; } } void addReference(String ref) throws Throwable { try { bridge.AddReference(ref); } catch (JCNativeException jcne) { throw translateException(jcne); } } public IsolationLevel(Object instance) { super(instance); if (instance instanceof JCObject) { try { String enumName = NetEnum.GetName(classType, (JCObject)instance); classInstance = enumReflected.fromValue(enumName); } catch (Throwable t) { if (JCOBridgeInstance.getDebug()) t.printStackTrace(); classInstance = enumReflected; } } else if (instance instanceof JCEnum) { classInstance = (JCEnum)instance; } } public IsolationLevel() { super(); // add reference to assemblyName.dll file try { addReference(JCOBridgeInstance.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName); } catch (Throwable jcne) { if (JCOBridgeInstance.getDebug()) jcne.printStackTrace(); } } public String getJCOAssemblyName() { return assemblyFullName; } public String getJCOClassName() { return className; } public String getJCOObjectName() { return className + ", " + (JCOBridgeInstance.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName); } public Object getJCOInstance() { return classInstance; } public JCType getJCOType() { return classType; } final static IsolationLevel getFrom(JCEnum object, String value) { try { return new IsolationLevel(object.fromValue(value)); } catch (JCException e) { return new IsolationLevel(object); } } // Enum fields section public static IsolationLevel Chaos = getFrom(enumReflected, "Chaos"); public static IsolationLevel ReadUncommitted = getFrom(enumReflected, "ReadUncommitted"); public static IsolationLevel ReadCommitted = getFrom(enumReflected, "ReadCommitted"); public static IsolationLevel RepeatableRead = getFrom(enumReflected, "RepeatableRead"); public static IsolationLevel Serializable = getFrom(enumReflected, "Serializable"); public static IsolationLevel Snapshot = getFrom(enumReflected, "Snapshot"); public static IsolationLevel Unspecified = getFrom(enumReflected, "Unspecified"); // Flags management section }
[ "mario.mastrodicasa@masesgroup.com" ]
mario.mastrodicasa@masesgroup.com
facf2ce0e966d4759d1c9c97fe8c8b7ad52460f4
1550225295026fa6a57ccaf7ec51051cf8a2edf8
/pet-modules/pet-system/src/main/java/com/pet/system/dubbo/RemoteUserServiceImpl.java
0db9adfec3bb005c2db5b41446e726b7d16fa547
[]
no_license
LiangJiaqi1999694/NTGO
21955af246f77c2f79d4666faa898f7c120b56bc
bc6dd009d42f60b81f1c02bda4ccfa5e2888a792
refs/heads/master
2023-05-26T18:38:45.627045
2023-05-19T06:05:09
2023-05-19T06:05:09
162,426,360
0
0
null
null
null
null
UTF-8
Java
false
false
4,983
java
package com.pet.system.dubbo; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.pet.common.core.enums.UserStatus; import com.pet.common.core.exception.ServiceException; import com.pet.common.core.exception.user.UserException; import com.pet.system.api.RemoteUserService; import com.pet.system.api.domain.SysUser; import com.pet.system.api.model.LoginUser; import com.pet.system.api.model.RoleDTO; import com.pet.system.api.model.XcxLoginUser; import com.pet.system.mapper.SysUserMapper; import com.pet.system.service.ISysConfigService; import com.pet.system.service.ISysPermissionService; import com.pet.system.service.ISysUserService; import lombok.RequiredArgsConstructor; import org.apache.dubbo.config.annotation.DubboService; import org.springframework.stereotype.Service; import java.util.List; /** * ็”จๆˆทๆœๅŠก * * @author zy */ @RequiredArgsConstructor @Service @DubboService public class RemoteUserServiceImpl implements RemoteUserService { private final ISysUserService userService; private final ISysPermissionService permissionService; private final ISysConfigService configService; private final SysUserMapper userMapper; @Override public LoginUser getUserInfo(String username) throws UserException { SysUser sysUser = userMapper.selectOne(new LambdaQueryWrapper<SysUser>() .select(SysUser::getUserName, SysUser::getStatus) .eq(SysUser::getUserName, username)); if (ObjectUtil.isNull(sysUser)) { throw new UserException("user.not.exists", username); } if (UserStatus.DISABLE.getCode().equals(sysUser.getStatus())) { throw new UserException("user.blocked", username); } // ๆญคๅค„ๅฏๆ นๆฎ็™ปๅฝ•็”จๆˆท็š„ๆ•ฐๆฎไธๅŒ ่‡ช่กŒๅˆ›ๅปบ loginUser return buildLoginUser(userMapper.selectUserByUserName(username)); } @Override public LoginUser getUserInfoByPhonenumber(String phonenumber) throws UserException { SysUser sysUser = userMapper.selectOne(new LambdaQueryWrapper<SysUser>() .select(SysUser::getPhonenumber, SysUser::getStatus) .eq(SysUser::getPhonenumber, phonenumber)); if (ObjectUtil.isNull(sysUser)) { throw new UserException("user.not.exists", phonenumber); } if (UserStatus.DISABLE.getCode().equals(sysUser.getStatus())) { throw new UserException("user.blocked", phonenumber); } // ๆญคๅค„ๅฏๆ นๆฎ็™ปๅฝ•็”จๆˆท็š„ๆ•ฐๆฎไธๅŒ ่‡ช่กŒๅˆ›ๅปบ loginUser return buildLoginUser(userMapper.selectUserByPhonenumber(phonenumber)); } @Override public XcxLoginUser getUserInfoByOpenid(String openid) throws UserException { // todo ่‡ช่กŒๅฎž็Žฐ userService.selectUserByOpenid(openid); SysUser sysUser = new SysUser(); if (ObjectUtil.isNull(sysUser)) { // todo ็”จๆˆทไธๅญ˜ๅœจ ไธšๅŠก้€ป่พ‘่‡ช่กŒๅฎž็Žฐ } if (UserStatus.DISABLE.getCode().equals(sysUser.getStatus())) { // todo ็”จๆˆทๅทฒ่ขซๅœ็”จ ไธšๅŠก้€ป่พ‘่‡ช่กŒๅฎž็Žฐ } // ๆญคๅค„ๅฏๆ นๆฎ็™ปๅฝ•็”จๆˆท็š„ๆ•ฐๆฎไธๅŒ ่‡ช่กŒๅˆ›ๅปบ loginUser XcxLoginUser loginUser = new XcxLoginUser(); loginUser.setUserId(sysUser.getUserId()); loginUser.setUsername(sysUser.getUserName()); loginUser.setUserType(sysUser.getUserType()); loginUser.setOpenid(openid); return loginUser; } @Override public Boolean registerUserInfo(SysUser sysUser) { String username = sysUser.getUserName(); if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) { throw new ServiceException("ๅฝ“ๅ‰็ณป็ปŸๆฒกๆœ‰ๅผ€ๅฏๆณจๅ†ŒๅŠŸ่ƒฝ"); } if (!userService.checkUserNameUnique(sysUser)) { throw new UserException("user.register.save.error", username); } return userService.registerUser(sysUser); } @Override public String selectUserNameById(Long userId) { return userService.selectUserNameById(userId); } /** * ๆž„ๅปบ็™ปๅฝ•็”จๆˆท */ private LoginUser buildLoginUser(SysUser user) { LoginUser loginUser = new LoginUser(); loginUser.setUserId(user.getUserId()); loginUser.setDeptId(user.getDeptId()); loginUser.setUsername(user.getUserName()); loginUser.setPassword(user.getPassword()); loginUser.setUserType(user.getUserType()); loginUser.setMenuPermission(permissionService.getMenuPermission(user)); loginUser.setRolePermission(permissionService.getRolePermission(user)); loginUser.setDeptName(ObjectUtil.isNull(user.getDept()) ? "" : user.getDept().getDeptName()); List<RoleDTO> roles = BeanUtil.copyToList(user.getRoles(), RoleDTO.class); loginUser.setRoles(roles); return loginUser; } }
[ "zhuangyong@hotwater.com.cn" ]
zhuangyong@hotwater.com.cn
54bcbd5eaa3dc4109acf4d113c6a8891d4e064e8
0d65b964b7953a9138943f1280e303bba64307af
/kitty-dynamic-thread-pool/src/main/java/com/cxytiandi/kitty/threadpool/alarm/DynamicThreadPoolAlarm.java
851b7bc564ee169c5d463d984b2d9d8c7890ab6e
[]
no_license
ylwb/kitty
7053b7fd89dbb7a307b3fc012503035d04f2c666
97dfcc48ffa3e9e9052cc48e530172d23f9cfb18
refs/heads/master
2023-04-02T14:47:02.733323
2020-12-28T09:19:27
2020-12-28T09:19:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,495
java
package com.cxytiandi.kitty.threadpool.alarm; import com.cxytiandi.kitty.common.alarm.AlarmManager; import com.cxytiandi.kitty.common.alarm.AlarmMessage; import com.cxytiandi.kitty.common.alarm.AlarmTypeEnum; import com.cxytiandi.kitty.common.json.JsonUtils; import com.cxytiandi.kitty.threadpool.DynamicThreadPoolManager; import com.cxytiandi.kitty.threadpool.KittyThreadPoolExecutor; import com.cxytiandi.kitty.threadpool.config.DynamicThreadPoolProperties; import com.cxytiandi.kitty.threadpool.config.ThreadPoolProperties; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.util.StringUtils; import javax.annotation.PostConstruct; import java.util.Map; import java.util.concurrent.atomic.AtomicLong; /** * ็บฟ็จ‹ๆฑ ๅ‘Š่ญฆ * * @ไฝœ่€… ๅฐนๅ‰ๆฌข * @ไธชไบบๅพฎไฟก jihuan900 * @ๅพฎไฟกๅ…ฌไผ—ๅท ็Œฟๅคฉๅœฐ * @GitHub https://github.com/yinjihuan * @ไฝœ่€…ไป‹็ป http://cxytiandi.com/about * @ๆ—ถ้—ด 2020-05-26 21:44 */ public class DynamicThreadPoolAlarm { @Autowired private DynamicThreadPoolManager dynamicThreadPoolManager; @Autowired private DynamicThreadPoolProperties dynamicThreadPoolProperties; @Autowired(required = false) private ThreadPoolAlarmNotify threadPoolAlarmNotify; /** * ๅบ”็”จๅ็งฐ๏ผŒๅ‘Š่ญฆ็”จๅˆฐ */ @Value("${spring.application.name:unknown}") private String applicationName; /** * ๆ˜ฏๅฆไฝฟ็”จ้ป˜่ฎคๅ‘Š่ญฆ */ @Value("${kitty.threadpools.alarm.default:true}") private boolean useDefaultAlarm; @PostConstruct public void init() { new Thread(() -> { while (true) { dynamicThreadPoolProperties.getExecutors().stream().forEach(prop -> { String threadPoolName = prop.getThreadPoolName(); KittyThreadPoolExecutor threadPoolExecutor = dynamicThreadPoolManager.getThreadPoolExecutor(threadPoolName); dynamicThreadPoolManager.registerStatusExtension(prop, threadPoolExecutor); int queueCapacityThreshold = prop.getQueueCapacityThreshold(); int taskCount = threadPoolExecutor.getQueue().size(); if (taskCount > queueCapacityThreshold) { sendQueueCapacityThresholdAlarmMessage(prop, taskCount); } AtomicLong rejectCount = dynamicThreadPoolManager.getRejectCount(threadPoolName); if (rejectCount != null && rejectCount.get() > 0) { sendRejectAlarmMessage(rejectCount.get(), prop); // ๆธ…็ฉบๆ‹’็ปๆ•ฐๆฎ dynamicThreadPoolManager.clearRejectCount(threadPoolName); } }); try { Thread.sleep(5000); } catch (InterruptedException e) { e.printStackTrace(); } } }).start(); } private void sendRejectAlarmMessage(long rejectCount, ThreadPoolProperties prop) { AlarmMessage alarmMessage = AlarmMessage.builder() .alarmName("rejectCount") .alarmType(getAlarmType()) .apiUrl(dynamicThreadPoolProperties.getAlarmApiUrl()) .message(getRejectCountMessage(rejectCount, prop)) .accessToken(dynamicThreadPoolProperties.getAccessToken()) .secret(dynamicThreadPoolProperties.getSecret()) .alarmTimeInterval(dynamicThreadPoolProperties.getAlarmTimeInterval()) .build(); if (useDefaultAlarm) { AlarmManager.sendAlarmMessage(alarmMessage); } alarmNotify(alarmMessage); } private void sendQueueCapacityThresholdAlarmMessage(ThreadPoolProperties prop, int taskCount) { AlarmMessage alarmMessage = AlarmMessage.builder() .alarmName("queueCapacityThreshold") .alarmType(getAlarmType()) .apiUrl(dynamicThreadPoolProperties.getAlarmApiUrl()) .message(getQueueCapacityThresholdMessage(prop, taskCount)) .accessToken(dynamicThreadPoolProperties.getAccessToken()) .secret(dynamicThreadPoolProperties.getSecret()) .alarmTimeInterval(dynamicThreadPoolProperties.getAlarmTimeInterval()) .build(); if (useDefaultAlarm) { AlarmManager.sendAlarmMessage(alarmMessage); } alarmNotify(alarmMessage); } private void alarmNotify(AlarmMessage alarmMessage) { if (threadPoolAlarmNotify != null) { threadPoolAlarmNotify.alarmNotify(alarmMessage); } } private String getQueueCapacityThresholdMessage(ThreadPoolProperties prop, int taskCount) { return getAlarmMessage("็บฟ็จ‹ๆฑ ๅ‡บ็ŽฐไปปๅŠกๅ †็งฏๆƒ…ๅ†ต,้˜Ÿๅˆ—ๅฎน้‡:" + prop.getQueueCapacity() + ",็ญ‰ๅพ…ๆ‰ง่กŒไปปๅŠกๆ•ฐ้‡:" + taskCount , prop); } private String getRejectCountMessage(long rejectCount, ThreadPoolProperties prop) { return getAlarmMessage("็บฟ็จ‹ๆฑ ไธญๅ‡บ็ŽฐRejectedExecutionExceptionๅผ‚ๅธธ" + rejectCount + "ๆฌก", prop); } private String getAlarmMessage(String reason, ThreadPoolProperties prop) { StringBuilder content = new StringBuilder(); content.append("ๅ‘Š่ญฆๅบ”็”จ:").append(applicationName).append("\n"); content.append("็บฟ็จ‹ๆฑ ๅ็งฐ:").append(prop.getThreadPoolName()).append("\n"); content.append("ๅ‘Š่ญฆๅŽŸๅ› :").append(reason).append("\n"); content.append("ๅ‚ๆ•ฐไฟกๆฏ:").append(formatThreadPoolParam(prop)); content.append("ไธšๅŠก่ดŸ่ดฃไบบ:").append(dynamicThreadPoolProperties.getOwner()).append("\n"); content.append("ๅ‘Š่ญฆ้—ด้š”:").append(dynamicThreadPoolProperties.getAlarmTimeInterval()).append("ๅˆ†้’Ÿ\n"); return content.toString(); } private String formatThreadPoolParam(ThreadPoolProperties prop) { StringBuilder content = new StringBuilder("\n"); Map map = JsonUtils.toBean(Map.class, JsonUtils.toJson(prop)); map.forEach((k,v) -> { content.append(k).append(":").append(v).append("\n"); }); return content.toString(); } private AlarmTypeEnum getAlarmType() { return StringUtils.hasText(dynamicThreadPoolProperties.getAlarmApiUrl()) ? AlarmTypeEnum.EXTERNAL_SYSTEM : AlarmTypeEnum.DING_TALK; } }
[ "jihuan.yin@ipiaoniu.com" ]
jihuan.yin@ipiaoniu.com
bf8d0e4f715b2944ca021a1c58a0166831531e8d
b56417d72503b50df274b2475b1fb4853c4d2b03
/app/src/main/java/tech/mbsoft/simplemvvm/repository/model/Currency.java
9ee5564bb03fe1de508d0e5de092d6c1a0020ed0
[ "Apache-2.0" ]
permissive
mostasim/SimpleMVVM
961c5f1106e9213f79f0deec1c174a04af31019a
04d02a66aee9d406fb5063a7008f4301ab54feba
refs/heads/master
2021-07-07T01:28:05.150376
2020-10-01T11:06:36
2020-10-01T11:06:36
191,329,830
0
0
null
2019-07-25T17:29:28
2019-06-11T08:40:28
Java
UTF-8
Java
false
false
775
java
package tech.mbsoft.simplemvvm.repository.model; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; public class Currency { @SerializedName("code") @Expose private String code; @SerializedName("name") @Expose private Object name; @SerializedName("symbol") @Expose private Object symbol; public String getCode() { return code; } public void setCode(String code) { this.code = code; } public Object getName() { return name; } public void setName(Object name) { this.name = name; } public Object getSymbol() { return symbol; } public void setSymbol(Object symbol) { this.symbol = symbol; } }
[ "mostasim.billah@mobioapp.com" ]
mostasim.billah@mobioapp.com
31c7f6d66be625c3d963fd291af8efa2a8b665d2
3ee68589ff78426e8340d9152741b612b5575a8d
/app/src/main/java/com/example/naada/view/JsonPlaceHolderApi.java
186fb8e35c7ff15e817f46c490ef9e2fa2762e41
[]
no_license
NAADATastemaquers/Naada_App
08833067834908f344bf6e50d64003c5b6cb5b13
0c1a5146bb4c04ea6713b90346dd6b3853e28323
refs/heads/master
2020-12-12T03:34:27.128387
2020-04-19T14:15:17
2020-04-19T14:15:17
234,032,430
0
10
null
2020-05-11T17:07:46
2020-01-15T08:19:04
Java
UTF-8
Java
false
false
381
java
package com.example.naada.view; import java.util.List; import retrofit2.Call; import retrofit2.http.Body; import retrofit2.http.GET; import retrofit2.http.POST; import retrofit2.http.Path; public interface JsonPlaceHolderApi { @GET("message/{no}") Call<List<Post>> getPosts(@Path("no") int number); @POST("message/0") Call<Post> createPost(@Body Post post); }
[ "kmoorthy.blr@gmail.com" ]
kmoorthy.blr@gmail.com
173e237ca842f0e77d2e1774da1af32718dd6926
35c977e0a107d386ecb09481d012367b71a04f85
/src/main/java/mx/edu/utez/controller/Service.java
7867dd7976679fb69eba40bae42285e64a8003a2
[]
no_license
Miriam2106/REST-CRUD-JAVACUSTOMERS
3ef7001d91e72b2f4b32cefe8537eff0e96d0432
c60089425f02d8127ceb88659e013e3ae6ccd4f8
refs/heads/master
2023-08-06T21:50:59.118654
2021-09-30T13:02:16
2021-09-30T13:02:16
411,929,384
0
0
null
null
null
null
UTF-8
Java
false
false
3,021
java
package mx.edu.utez.controller; import mx.edu.utez.model.Customer; import mx.edu.utez.model.DaoCustomer; import mx.edu.utez.util.ConnectionMySQL; import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import java.sql.*; import java.util.ArrayList; import java.util.List; @Path("/customer") public class Service { @GET @Path("/") @Produces(MediaType.APPLICATION_JSON) public List<Customer> getCustomers(){ return new DaoCustomer().findAll(); } @GET @Path("/{id}") @Produces(MediaType.APPLICATION_JSON) public Customer getCustomers(@PathParam("id") int customerNumber){ //CONSULTA POR ID return new DaoCustomer().findById(customerNumber); } @POST @Path("/save") //Registra @Produces(MediaType.APPLICATION_JSON) @Consumes("application/x-www-form-urlencoded") public Customer save(MultivaluedMap<String, String> formParams){ int customerNumber = Integer.parseInt(formParams.get("customerNumber").get(0)); if(new DaoCustomer().insertCustomer(getParams(customerNumber, formParams), true)) return new DaoCustomer().findById(customerNumber); return null; } @POST @Path("/save/{id}") //Modifica @Produces(MediaType.APPLICATION_JSON) @Consumes("application/x-www-form-urlencoded") public Customer save(@PathParam("id") int customerNumber, MultivaluedMap<String, String> formParams){ if(new DaoCustomer().insertCustomer(getParams(customerNumber, formParams), false)) return new DaoCustomer().findById(customerNumber); return null; } @DELETE @Path("/delete/{id}") @Produces(MediaType.APPLICATION_JSON) public boolean deleteCustomer(@PathParam("id") int customerNumber){ return new DaoCustomer().delete(customerNumber); } private Customer getParams(int customerNumber, MultivaluedMap<String, String> formParams) { String customerName = formParams.get("customerName").get(0); String contactFirstname = formParams.get("contactFirstname").get(0); String contactLastname = formParams.get("contactLastname").get(0); String phone = formParams.get("phone").get(0); String address1 = formParams.get("addressLine1").get(0); String address2 = formParams.get("addressLine2").get(0); String city = formParams.get("city").get(0); String state = formParams.get("state").get(0); String postalCode = formParams.get("postalCode").get(0); String country = formParams.get("country").get(0); int salesRep = Integer.parseInt(formParams.get("salesRepEmployeeNumber").get(0)); double credit = Double.parseDouble(formParams.get("creditLimit").get(0)); Customer customer = new Customer(customerNumber, customerName, contactLastname, contactFirstname, phone, address1, address2, city, state, postalCode, country, salesRep, credit); System.out.println(customer); return customer; } }
[ "20203tn055@utez.edu.mx" ]
20203tn055@utez.edu.mx
8f1009c04a4b684345791cb176627d0dd59c31e4
7e48c21faec8b5c5230dfc59c5f719663bfe836a
/Applets/src/TickTackToe.java
8cdf45ae32d269fc60bc1869a944f5fe7e2e16c4
[]
no_license
Cmheidelberg/eclipse-workspace
6287691e4fe7b5ea26fab88382deb64ad0792ef8
41a39a5c269f8b705a8ce9b204cec73bc950f4e2
refs/heads/master
2023-03-20T12:16:02.049725
2021-03-07T21:31:12
2021-03-07T21:31:12
345,458,108
0
0
null
null
null
null
UTF-8
Java
false
false
6,559
java
import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.util.*; public class TickTackToe extends JApplet{ JPanel gameBoxes; JPanel infoBox; JPanel mainPanel; JMenuBar menuBar; JMenu fileMenu; JMenuItem exitItem; JMenuItem newGameItem; Font font = new Font("Calbri",Font.PLAIN,30); JLabel[] info; JButton[] button; Random rand = new Random(); ImageIcon x = new ImageIcon("C:\\Users\\Admin\\Pictures\\X.png"); ImageIcon o = new ImageIcon("C:\\Users\\Admin\\Pictures\\O.png"); int[] game; int[] ai = {26,11,11,0,1,9,11,14,17}; int winner; private final int WIDTH = 800; private final int HEIGHT = 850; private final String BUFFER_STR = " "; private boolean ended; //Used so that the game does'nt keep saying "Game Over" see ButtonListener class public TickTackToe() { buildMenuBar(); } public void buildMenuBar() { menuBar = new JMenuBar(); exitItem = new JMenuItem("Quit"); newGameItem = new JMenuItem("New Game"); exitItem.addActionListener(new ExitListener()); newGameItem.addActionListener(new NewGameListener()); fileMenu = new JMenu("File"); fileMenu.add(exitItem); fileMenu.add(newGameItem); fileMenu.setFont(font); exitItem.setFont(font); newGameItem.setFont(font); menuBar.add(fileMenu); startGame(); } public void startGame() { System.out.println("New Game"); info = new JLabel[4]; button = new JButton[9]; game = new int[9]; ended = false; winner = 0; //frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); mainPanel = new JPanel(); mainPanel.setLayout(new BoxLayout(mainPanel,BoxLayout.Y_AXIS)); gameBoxes = new JPanel(); gameBoxes.setLayout(new GridLayout(3,3,2,2)); gameBoxes.setMaximumSize(new Dimension(800,800)); for(int i = 0; i < button.length; i++) { button[i] = new JButton("b" + i); button[i].setPreferredSize(new Dimension(50,200)); button[i].addActionListener(new ButtonListener()); gameBoxes.add(button[i]); } infoBox = new JPanel(); infoBox.setLayout(new GridLayout(info.length,1)); //Sets up the text boxes under the game board for(int i = 0; i < info.length; i++) { info[i] = new JLabel(""); info[i].setFont(font); infoBox.add(info[i]); } mainPanel.add(gameBoxes); mainPanel.add(infoBox); setSize(WIDTH,HEIGHT); setContentPane(mainPanel); setMinimumSize(new Dimension(850,850)); add(mainPanel); //setVisible(true); } private void shiftText() { for(int i = info.length-2; i >= 0; i--) { info[i+1].setText(info[i].getText()); info[i+1].setForeground(info[i].getForeground()); info[i].setForeground(Color.BLACK); } } private void updateInfo(String str) { shiftText(); str = BUFFER_STR + str; info[0].setText(str); } private void updateInfo(String str, int color) { shiftText(); str = BUFFER_STR + str; info[0].setText(str); if(color == 1) { info[0].setForeground(Color.RED); } else if(color == 2) { info[0].setForeground(Color.ORANGE); } } private boolean checkClick(String box) { int index = Integer.parseInt(box.charAt(box.length()-1)+ ""); updateGame(); if(gameOver()) { updateInfo("The game has ended!",2); return false; } if(game[index] != 0) { updateInfo("That box is already marked!",2); return false; } game[index] = 1; updateGame(); return true; } public void updateGame() { for(int i = 0; i < game.length; i++) { if(game[i] == 1 && button[i].getIcon() == null) { button[i].setIcon(x); updateInfo("X added in b" + i); } else if(game[i] == 2 && button[i].getIcon() == null) { button[i].setIcon(o); updateInfo("O added in b" + i); } } } private void compTurn() { boolean placed = false; int num = 0; if(!gameOver()) { //There is a 4.5% chance the game will randomly //place the marker (this is in case if all the spots //the computer wants to place the 'O' is taken) num = rand.nextInt(105); if(num > 100) { updateInfo("Random Move"); while(!placed) { num = rand.nextInt(9); if(game[num] == 0) { game[num] = 2; placed = true; updateGame(); } } } else { while(!placed) { for(int i = 0; i < ai.length; i++) { num -= ai[i]; if(num <= 0 && game[i] == 0 && !placed) { game[i] = 2; placed = true; updateGame(); } } } } } } private void redistributeAiWeights(int indexToRemove) { for(int i = 0; i < ai[indexToRemove]; i++) { int num = 0; boolean place = false; while(!place) { num = rand.nextInt(9); if(num != indexToRemove) { place = true; } } ai[num] += 1; ai[indexToRemove] -= 1; } } private boolean gameOver() { boolean over = true; for(int i = 0; i < game.length; i++) { if(game[i] == 0) { over = false; } } //Checks horizontally to see if the game is over for(int i = 0; i <= 6; i+=3) { if(game[i] == game[i+1] && game[i] == game[i+2] && game[i] != 0) { winner = game[i]; over = true; break; } } //Checks vertically to see if the game is over for(int i = 0; i < 3; i++) { if(game[i] == game[i+3] && game[i] == game[i+6] && game[i] != 0) { winner = game[i]; over = true; break; } } //Next two check the verticalls if(game[0] == game[4] && game[0] == game[8] && game[0] != 0) { over = true; winner = game[0]; } if(game[2] == game[4] && game[2] == game[6] && game[2] != 0) { over = true; winner = game[2]; } return over; } private class ButtonListener implements ActionListener { public void actionPerformed(ActionEvent e) { //Refers to action command method from buttons String com = e.getActionCommand(); if(checkClick(com)) compTurn(); if(gameOver() && !ended) { updateInfo("Game Over!",1); if(winner == 1) { updateInfo("Plater Wins!"); } else if(winner == 2) { updateInfo("Computer Wins!"); } ended = true; } } } private class ExitListener implements ActionListener { public void actionPerformed(ActionEvent e) { System.exit(0); } } private class NewGameListener implements ActionListener { public void actionPerformed(ActionEvent e) { startGame(); } } }
[ "cmheidelberg@gmail.com" ]
cmheidelberg@gmail.com
c6c3c163da8abecb93e169537669a8c7f277afc1
1cc942433d6bcb68b3b46e2ef5660ab793b559d3
/src/main/java/com/adrian/blog/repository/IFavoritoRepository.java
7a0a43e75bd898b86f9daa78baae630164cf8f32
[ "MIT" ]
permissive
adriancice/adrian-pfm-heroku
fa22c353031b530b08caa3b9f6ac623bae09e415
24dec115f8f2620958c5f8371ff9549ac35cd7c2
refs/heads/master
2020-03-28T16:35:22.602870
2019-02-14T20:07:08
2019-02-14T20:07:08
148,710,304
0
0
null
null
null
null
UTF-8
Java
false
false
384
java
package com.adrian.blog.repository; import java.util.Collection; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; import com.adrian.blog.model.Favorito; @Repository("favoritoRepository") public interface IFavoritoRepository extends CrudRepository<Favorito, Integer> { Collection<Favorito> findByIdUser(int idUser); }
[ "naikonpaul@gmail.com" ]
naikonpaul@gmail.com
ec8823a2e3105100d4cd111dfca3ab3e48fc5805
5e39d702888f62c4e41e117a9cc5ae871331fed6
/my algorithms/src/algorithms/mazeGenerators/CommonPop.java
b609a59e40a6f75084a1c999a2a247a37bb84e2b
[]
no_license
kenanbarak/Java-Project
7855d2ca05d478a24d3d359d327b6e43b680c3c7
7b106fc971d459462b16c947732e62cd75327ccc
refs/heads/master
2021-01-10T23:48:13.044711
2016-10-13T11:09:16
2016-10-13T11:09:16
70,794,252
0
0
null
null
null
null
UTF-8
Java
false
false
198
java
package algorithms.mazeGenerators; import java.util.ArrayList; public abstract class CommonPop implements Pop { @Override public abstract Position selectPop(ArrayList<Position> pos); }
[ "barakkenann@gmail.comโ€ฌ" ]
barakkenann@gmail.comโ€ฌ
5c929a6284b3000b62849dcb84ac37fab2933924
ac2ccec9c9d78c61b9fa537acb617a29253ca29f
/print/src/main/java/com/lubian/cpf/vo/SysRelRoleFunc.java
e2e59f61952a763d2cc64973044707424c98e807
[]
no_license
sunxiaozao/print
b187b5b23deecd2d272450b4f7d0dd004ab1a15a
09916d473a6123cc9966ced41305e86133ccd56f
refs/heads/master
2020-03-26T10:23:19.431096
2018-08-15T04:27:59
2018-08-15T04:27:59
144,795,204
0
0
null
null
null
null
UTF-8
Java
false
false
1,793
java
package com.lubian.cpf.vo; import java.util.*; /** * SysRelRoleFunc * @author:Lusir<lusire@gmail.com> */ public class SysRelRoleFunc implements java.io.Serializable{ private java.lang.Integer roleFuncId; public java.lang.Integer getRoleFuncId() { return roleFuncId; } public void setRoleFuncId(java.lang.Integer roleFuncId) { this.roleFuncId = roleFuncId; } private java.lang.Integer roleId; public java.lang.Integer getRoleId() { return roleId; } public void setRoleId(java.lang.Integer roleId) { this.roleId = roleId; } private java.lang.Integer relId; public java.lang.Integer getRelId() { return relId; } public void setRelId(java.lang.Integer relId) { this.relId = relId; } private java.lang.String functionCrudUrl; public java.lang.String getFunctionCrudUrl() { return functionCrudUrl; } public void setFunctionCrudUrl(java.lang.String functionCrudUrl) { this.functionCrudUrl = functionCrudUrl; } private String functionCrudUrlEq; public String getFunctionCrudUrlEq() { return functionCrudUrlEq; } public void setFunctionCrudUrlEq(String functionCrudUrl) { this.functionCrudUrlEq = functionCrudUrl; } public void fixup(){ } //be carefull of the case,key is the original name public HashMap toHashMap() { HashMap ht = new HashMap(); if(this.roleFuncId!=null) ht.put("roleFuncId",this.roleFuncId); if(this.roleId!=null) ht.put("roleId",this.roleId); if(this.relId!=null) ht.put("relId",this.relId); if(this.functionCrudUrl!=null) ht.put("functionCrudUrl",this.functionCrudUrl); if(this.functionCrudUrlEq!=null) ht.put("functionCrudUrlEq",this.functionCrudUrlEq); return ht; } }
[ "453999605@qq.com" ]
453999605@qq.com
b6a3d68f92245ce4d58d0542ae3b9e988331522b
d6920bff5730bf8823315e15b0858c68a91db544
/android/ftsafe_0.7.04_source_from_cfr/gnu/kawa/io/Path.java
458f2bc723482c3f0109a0b0ea72dca7468ac656
[]
no_license
AppWerft/Ti.FeitianSmartcardReader
f862f9a2a01e1d2f71e09794aa8ff5e28264e458
48657e262044be3ae8b395065d814e169bd8ad7d
refs/heads/master
2020-05-09T10:54:56.278195
2020-03-17T08:04:07
2020-03-17T08:04:07
181,058,540
2
0
null
null
null
null
UTF-8
Java
false
false
11,869
java
/* * Decompiled with CFR 0.139. */ package gnu.kawa.io; import gnu.kawa.io.FilePath; import gnu.kawa.io.URIPath; import gnu.kawa.io.URLPath; import gnu.mapping.WrappedException; import gnu.mapping.WrongType; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.Reader; import java.io.Writer; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import java.net.URLConnection; public abstract class Path { public static final FilePath userDirPath = FilePath.valueOf(System.getProperty("user.dir")); public static final ThreadLocal<Path> pathLocation = new InheritableThreadLocal<Path>(){ @Override protected Path initialValue() { return Path.userDirPath; } @Override public void set(Path path) { if (path == null) { super.remove(); } else { if (!path.isAbsolute()) { path = path.getAbsolute(); } super.set(path); } } }; public static final Object PATH_CURRENT = new String("<current>"); public static final Object PATH_RELATIVE = new String("<relative>"); protected Path() { } public static Path currentPath() { return pathLocation.get(); } public static void setCurrentPath(Path path) { pathLocation.set(path); } public static Path coerceToPathOrNull(Object path) { char ch0; if (path instanceof Path) { return (Path)path; } if (path instanceof URL) { return URLPath.valueOf((URL)path); } if (path instanceof URI) { return URIPath.valueOf((URI)path); } if (path instanceof File) { return FilePath.valueOf((File)path); } if (!(path instanceof CharSequence)) { return null; } String str = path.toString(); if (str.startsWith("file:") || File.separatorChar == '\\' && str.length() >= 2 && str.charAt(1) == ':' && Character.isLetter(str.charAt(0)) || str.length() > 0 && ((ch0 = str.charAt(0)) == '.' || ch0 == File.separatorChar)) { return FilePath.valueOf(str); } return URIPath.valueOf(str); } public static Path valueOf(Object arg) { Path path = Path.coerceToPathOrNull(arg); if (path == null) { throw new WrongType((String)null, -4, arg, "path"); } return path; } public static URL toURL(String str) { try { if (!Path.uriSchemeSpecified(str)) { Path cur = Path.currentPath(); Path path = cur.resolve(str); if (path.isAbsolute()) { return path.toURL(); } str = path.toString(); } return new URL(str); } catch (Exception ex) { throw WrappedException.wrapIfNeeded(ex); } } public static int uriSchemeLength(String uri) { int len = uri.length(); for (int i = 0; i < len; ++i) { char ch = uri.charAt(i); if (ch == ':') { return i; } if (!(i == 0 ? !Character.isLetter(ch) : !Character.isLetterOrDigit(ch) && ch != '+' && ch != '-' && ch != '.')) continue; return -1; } return -1; } public static boolean uriSchemeSpecified(String name) { int ulen = Path.uriSchemeLength(name); if (ulen == 1 && File.separatorChar == '\\') { char drive = name.charAt(0); return !(drive >= 'a' && drive <= 'z' || drive >= 'A' && drive <= 'Z'); } return ulen > 0; } public abstract boolean isAbsolute(); public boolean isDirectory() { char last; String str = this.toString(); int len = str.length(); return len > 0 && ((last = str.charAt(len - 1)) == '/' || last == File.separatorChar); } public boolean isPlainFile() { File file2 = this.toFile(); if (file2 != null) { return file2.isFile(); } return !this.isDirectory() && this.getPath() != null; } public boolean delete() { try { this.deleteFile(); return true; } catch (Exception ex) { return false; } } public void deleteFile() throws IOException { throw new UnsupportedOperationException(); } public boolean exists() { return this.getLastModified() != 0L; } public abstract long getLastModified(); public long getContentLength() { return -1L; } public abstract String getScheme(); public String getAuthority() { return null; } public String getUserInfo() { return null; } public String getHost() { return null; } public abstract String getPath(); public Path getDirectory() { if (this.isDirectory()) { return this; } return this.resolve("."); } public Path getParent() { return this.resolve(this.isDirectory() ? ".." : "."); } public String getLast() { int len; String p = this.getPath(); if (p == null) { return null; } int end = len = p.length(); int i = len; do { if (--i <= 0) { return end == len ? p : p.substring(0, end); } char c = p.charAt(i); if (c != '/') continue; if (i + 1 != len) break; end = i; } while (true); return p.substring(i + 1, end); } public String getExtension() { int len; boolean sawDot; String p = this.getPath(); if (p == null) { return null; } int i = len = p.length(); do { if (--i <= 0) { return null; } char c = p.charAt(i); sawDot = false; if (c == '.') { c = p.charAt(i - 1); sawDot = true; } if (c != '/' && (!(this instanceof FilePath) || c != File.separatorChar)) continue; return null; } while (!sawDot); return p.substring(i + 1); } public int getPort() { return -1; } public String getQuery() { return null; } public String getFragment() { return null; } public abstract URL toURL(); public abstract URI toUri(); public final URI toURI() { return this.toUri(); } public String toURIString() { return this.toUri().toString(); } public Path resolve(Path relative) { if (relative.isAbsolute()) { return relative; } return this.resolve(relative.toString()); } public abstract Path resolve(String var1); public static InputStream openInputStream(Object uri) throws IOException { return Path.valueOf(uri).openInputStream(); } public abstract InputStream openInputStream() throws IOException; public abstract OutputStream openOutputStream() throws IOException; public Reader openReader(boolean ignoreEncodingErrors) throws IOException { throw new UnsupportedOperationException(); } public Writer openWriter() throws IOException { return new OutputStreamWriter(this.openOutputStream()); } public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException { byte[] bytes = this.readAllBytes(); return new String(bytes, System.getProperty("sun.jnu.encoding", "UTF-8")); } public byte[] readAllBytes() throws IOException { int cnt; long len = this.getContentLength(); if (len > 0x7FFFFFF7L) { throw new Error("path contents too big"); } int ilen = (int)len; byte[] buffer = new byte[ilen < 0 ? 8192 : ilen]; InputStream in = this.openInputStream(); for (int sofar = 0; sofar < ilen || ilen < 0; sofar += cnt) { if (sofar == buffer.length) { byte[] tmp = new byte[sofar * 3 >> 1]; System.arraycopy(buffer, 0, tmp, 0, sofar); buffer = tmp; } if ((cnt = in.read(buffer, sofar, buffer.length - sofar)) > 0) continue; if (ilen < 0) break; throw new IOException("unable to read enture file"); } return buffer; } public static String relativize(String in, String base2) throws URISyntaxException, IOException { int i; char cb; char ci; String baseStr = base2; String inStr = in; baseStr = new URI(baseStr).normalize().toString(); inStr = URLPath.valueOf(in).toURI().normalize().toString(); int baseLen = baseStr.length(); int inLen = inStr.length(); int sl = 0; int colon = 0; for (i = 0; i < baseLen && i < inLen && (cb = baseStr.charAt(i)) == (ci = inStr.charAt(i)); ++i) { if (cb == '/') { sl = i; } if (cb != ':') continue; colon = i; } if (colon <= 0 || sl <= colon + 2 && baseLen > colon + 2 && baseStr.charAt(colon + 2) == '/') { return in; } baseStr = baseStr.substring(sl + 1); inStr = inStr.substring(sl + 1); StringBuilder sbuf = new StringBuilder(); sl = 0; i = baseLen = baseStr.length(); while (--i >= 0) { if (baseStr.charAt(i) != '/') continue; sbuf.append("../"); } sbuf.append(inStr); return sbuf.toString(); } public String getName() { return this.toString(); } public Path getAbsolute() { if (this == userDirPath) { return this.resolve("."); } return Path.currentPath().resolve(this); } public Path getCanonical() { return this.getAbsolute(); } public File toFile() { return null; } public String probeContentType() { String contentType = null; if (contentType == null) { int bang; String p = this.getPath(); if (p == null) { p = this.toString(); } if (p.startsWith("jar:") && (bang = p.indexOf(33)) > 0) { p = p.substring(bang + 1); } if ((contentType = URLConnection.guessContentTypeFromName(p)) == null) { if (p.endsWith(".xhtml")) { contentType = "application/xhtml+xml"; } else if (p.endsWith(".css")) { contentType = "text/css"; } else if (p.endsWith(".js")) { contentType = "application/javascript"; } } } return contentType; } public static Object[] search(Object[] searchPath, String filename, String base2) { for (int i = 0; i < searchPath.length; ++i) { Object spath = searchPath[i]; if (spath == PATH_RELATIVE) { String tpath = base2; spath = tpath == null || tpath.startsWith("/dev/") ? PATH_CURRENT : tpath; } Path path = spath == PATH_CURRENT ? Path.currentPath() : Path.valueOf(spath); try { InputStream istrm = path.resolve(filename).openInputStream(); return new Object[]{istrm, path}; } catch (Exception ex) { continue; } } return null; } }
[ "โ€œrs@hamburger-appwerft.deโ€œ" ]
โ€œrs@hamburger-appwerft.deโ€œ
f2e2b53dde5842bbe17cac1351dd4e4ab308e811
26f6b25684c4ac943a0d2f62a42fdbe049b3d2b3
/src/rs/fon/pp/dodatna/sistemskeoperacije/SODodajSalu.java
68fe725e9b98ba898ef4330316b01cd769290cb3
[]
no_license
JGRASS/projekat18
f5b77173fb0406fc29f5e9d2abdc915b597c887e
e290a214f973856c0d555dc4c71e579b26ad13d2
refs/heads/master
2021-03-12T21:20:10.821695
2015-05-14T17:16:57
2015-05-14T20:42:26
33,117,292
0
0
null
null
null
null
UTF-8
Java
false
false
404
java
package rs.fon.pp.dodatna.sistemskeoperacije; import java.util.LinkedList; import rs.fon.pp.dodatna.bioskop.Sala; public class SODodajSalu { public static void dodajSalu(Sala sala, LinkedList<Sala> sale) { if(!(sale.contains(sala)) && sala != null) sale.add(sala); else throw new RuntimeException("Sala je veฤ‡ uneta u sistem ili ste pokuลกali uneti null objekat."); } }
[ "anisjakijevcanin@gmail.com" ]
anisjakijevcanin@gmail.com
829fe002adc60d1d54192cf0a58cd9cc73cccce4
41a5ce39648523be781f35cdc5b69f93d57829a5
/src/main/java/org/webguitoolkit/ui/controls/form/CheckBox.java
fd015124d990b3ccc7d1a9f4b7f1de9cd38efeab
[ "Apache-2.0" ]
permissive
webguitoolkit/wgt-ui
455dd35bbfcb6835e3834a4537e3ffc668f15389
747530b462e9377a0ece473b97ce2914fb060cb5
refs/heads/master
2020-04-06T05:46:43.511525
2012-03-02T08:40:44
2012-03-02T08:40:44
1,516,251
0
0
null
null
null
null
UTF-8
Java
false
false
3,723
java
/* Copyright 2008 Endress+Hauser Infoserve GmbH&Co KG Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package org.webguitoolkit.ui.controls.form; import java.io.PrintWriter; import org.apache.commons.lang.StringUtils; import org.apache.ecs.html.Input; import org.apache.ecs.html.Span; import org.webguitoolkit.ui.ajax.ContextElement; import org.webguitoolkit.ui.ajax.IContext; import org.webguitoolkit.ui.controls.event.ClientEvent; import org.webguitoolkit.ui.controls.util.JSUtil; /** * <pre> * CheckBox control: * * // create CheckBox * CheckBox checkbox = factory.newCheckBox( parent, "isSelected" ); * checkbox.setSelected( true ); * * </pre> */ public class CheckBox extends OptionControl implements ICheckBox { // indicates it the event bubbles upwards in the DOM tree private boolean eventBubble = true; /** * @see org.webguitoolkit.ui.controls.BaseControl#BaseControl() */ public CheckBox() { super(); setCssClass("wgtInputCheckbox"); } /** * @see org.webguitoolkit.ui.controls.BaseControl#BaseControl(String) * @param id unique HTML id */ public CheckBox(String id) { super(id); setCssClass("wgtInputCheckbox"); } /** * generating HTML for CheckBox */ protected void endHTML(PrintWriter out) { Input input = new Input(); input.setType( "checkbox" ); if( StringUtils.isNotBlank(getLabel()) ) getStyle().add("float", "left"); stdParameter( input); if (hasActionListener()) { if( eventBubble ) input.setOnClick( JSUtil.jsFireEvent(getId(), ClientEvent.TYPE_ACTION )); else input.setOnClick( JSUtil.jsFireEvent(getId(), ClientEvent.TYPE_ACTION)+";stopEvent(event);" ); } //add tabindex to html element if the tabindex is greater than 0 if(tabindex >= 0){ input.addAttribute(TABINDEX, Integer.valueOf(tabindex).toString()); } input.setChecked( getContext().processBool(getId()) ); // eating the read only settings ContextElement ce = getContext().processContextElement( getId() + DOT_RO); boolean ro = ce != null && IContext.TYPE_READONLY.equals( ce.getType() ); input.setDisabled( ro ); Span surroundigSpan = new Span(); surroundigSpan.setID(getId()+"_ss"); surroundigSpan.addElement(input); surroundigSpan.output(out); //input.output(out); makeLabel( out ); } /** * set the event bubbling to false to avoid the bubbling of the event in the DOM tree, * useful for tables where you don't want to select the row when clicking the CheckBox * * @param eventBubble false to stop event bubbling */ public void setEventBubbling(boolean eventBubble){ this.eventBubble = eventBubble; } public void clearError() { if (getContext().getValue(getId() + "_ss.addClass") != null && getContext().getValue(getId() + "_ss.addClass").equals(ERROR_STYLE_CLASS)) getContext().removeClass(getId(), getContext().processValue(getId() + "_ss.addClass")); } public void showError() { getContext().addClass(getId()+"_ss", FormControl.ERROR_STYLE_CLASS); } }
[ "peter@17sprints.de" ]
peter@17sprints.de
c53cb6a4f403985c28305772496fe27508b905b7
2b8c47031dddd10fede8bcf16f8db2b52521cb4f
/subject SPLs and test cases/BerkeleyDB(5)/BerkeleyDB_P5/evosuite-tests1/com/sleepycat/je/util/DbRunAction_ESTest_scaffolding1.java
0a6570ff610ee469629b184652652b47f3dc2bf1
[]
no_license
psjung/SRTST_experiments
6f1ff67121ef43c00c01c9f48ce34f31724676b6
40961cb4b4a1e968d1e0857262df36832efb4910
refs/heads/master
2021-06-20T04:45:54.440905
2019-09-06T04:05:38
2019-09-06T04:05:38
206,693,757
1
0
null
2020-10-13T15:50:41
2019-09-06T02:10:06
Java
UTF-8
Java
false
false
2,303
java
/** * Scaffolding file used to store all the setups needed to run * tests automatically generated by EvoSuite * Fri Apr 21 21:24:36 KST 2017 */ package com.sleepycat.je.util; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; import org.junit.Before; import org.junit.After; import org.junit.AfterClass; import org.evosuite.runtime.sandbox.Sandbox; import org.evosuite.runtime.sandbox.Sandbox.SandboxMode; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; @EvoSuiteClassExclude public class DbRunAction_ESTest_scaffolding1 { @org.junit.Rule public org.junit.rules.Timeout globalTimeout = new org.junit.rules.Timeout(4000); protected static ExecutorService executor; private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); @BeforeClass public static void initEvoSuiteFramework() { org.evosuite.runtime.RuntimeSettings.className = "com.sleepycat.je.util.DbRunAction"; org.evosuite.runtime.GuiSupport.initialize(); org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); executor = Executors.newCachedThreadPool(); } @AfterClass public static void clearEvoSuiteFramework(){ Sandbox.resetDefaultSecurityManager(); executor.shutdownNow(); } @Before public void initTestCase(){ threadStopper.storeCurrentThreads(); threadStopper.startRecordingTime(); org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); org.evosuite.runtime.GuiSupport.setHeadless(); org.evosuite.runtime.agent.InstrumentingAgent.activate(); } @After public void doneWithTestCase(){ threadStopper.killAndJoinClientThreads(); org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); } }
[ "psjung@kaist.ac.kr" ]
psjung@kaist.ac.kr
6a3569e4f415cbb53f3c885ddc32011b7a86a4f4
1705e4b816b53920be52db753c1b96169f752d87
/src/diablo/analyzer/MorphologyAnalyzer.java
f48e02b95fd98dd50cf8aa48a1695d89b35452d0
[]
no_license
Drunkman/CompileDesign
94d6525cd78ef7c0d42149279eec65cccd34611e
fcdd114b854659a787e0d68ee86732e8f180cfc4
refs/heads/master
2021-01-10T17:06:56.924441
2015-09-27T15:05:48
2015-09-27T15:05:48
51,578,447
0
0
null
null
null
null
GB18030
Java
false
false
5,662
java
package diablo.analyzer; import java.io.BufferedReader; import java.io.IOException; import java.util.ArrayList; import java.util.Stack; import diablo.model.Item; /** * ่ฏๆณ•ๅˆ†ๆžๅ™จ * * @author mgy * */ public class MorphologyAnalyzer { // private String[] keywords = { "abstract", "assert", "boolean", "break", // "byte", "case", "catch", "char", "class", "continue", "default", // "do", "double", "else", "extends", "false", "final", "float", // "finally", "for", "if", "implements", "import", "instanceof", // "int", "interface", "long", "native", "new", "null", "package", // "private", "protected", "public", "return", "short", "static", // "super", "switch", "synchronized", "this", "throw", "throws", // "transient", "true", "try", "void", "volatie", "while" }; // // private String[] signs = { ".", "[", "]", "(", ")", "++", "--", "+", "-", // "~", "!", "*", "/", "%", "<<", ">>", "<", "<=", ">", ">=", // "==", "!=", "&", "^", "|", "||", "&&", "?", ":", "+=", "-=", "*=", // "/=", "%=", "&=", "^=", "|=", ";", "," }; // ๅ…ณ้”ฎๅญ—้›† private String[] keywords = { "begin", "call", "const", "do", "end", "if", "procedure", "read", "then", "var", "while", "write" }; // ็ฌฆๅท้›† private String[] signs = { "+", "-", "*", "/", "=", "#", "<", "<=", ">", ">=", "(", ")", ",", ".", ";", ":=", }; private ArrayList<Item> items;// ่ฏๆณ•ๅˆ†ๆž็š„็ป“ๆžœ้›† private BufferedReader reader;// ่ฆๅˆ†ๆž็š„่พ“ๅ…ฅๆต private CharFactory charFactory;// ๅญ—็ฌฆๅทฅๅŽ‚ private static StringBuilder sb;// ็ป„ๅˆๅญ—็ฌฆ public MorphologyAnalyzer(BufferedReader reader) { this.reader = reader; this.charFactory = new CharFactory(reader); sb = new StringBuilder(); items = new ArrayList<Item>(); } // ๅˆ†ๆž๏ผŒ่ฟ”ๅ›ž็ป“ๆžœ้›† public ArrayList<Item> analysis() { Character c = charFactory.getNextChar(); while (c != null) { if (c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z') { letter(c); } else if (c >= '0' && c <= '9') { num(c, 0); } else { sign(c); } c = charFactory.getNextChar(); } return items; } // ๅฏนๆ ‡่ฏ†็ฌฆ่ฟ›่กŒๅˆ†ๆž void letter(Character c) { int row = charFactory.getRowcount(); sb.append(c); c = charFactory.getNextChar(); while (c != null && (c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c >= '0' && c <= '9' || c == '_')) { sb.append(c); c = charFactory.getNextChar(); } String s = sb.toString(); if (isKeyword(s)) { items.add(new Item("keyword", s, row)); } else { items.add(new Item("identifier", s, row)); } sb = new StringBuilder(); if (c == null) return; else if (c >= '0' && c <= '9') { num(c, 0); } else { sign(c); } } // ๅฏนๆ— ็ฌฆๅทๅฎžๆ•ฐ่ฟ›่กŒๅˆ†ๆž void num(Character c, int flag) { int row = charFactory.getRowcount(); sb.append(c); c = charFactory.getNextChar(); while (c != null && (c >= '0' && c <= '9' || c == '.' && flag == 0)) { if (c == '.') { flag = 1; sb.append(c); c = charFactory.getNextChar(); if (c != null && !(c >= '0' && c <= '9')) sb.append('0'); continue; } sb.append(c); c = charFactory.getNextChar(); } String s = sb.toString(); items.add(new Item("number", s, row)); sb = new StringBuilder(); if (c == null) return; else if (c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z') { letter(c); } else { sign(c); } } // ๅฏน็ฌฆๅท่ฟ›่กŒๅˆ†ๆž void sign(Character c) { int row = charFactory.getRowcount(); if (c == ' ') c = charFactory.getNextChar(); else if (c == ',' || c == ';' || c == '(' || c == ')' || c == '#' || c == '=' || c == '.') { sb.append(c); items.add(new Item("sign", sb.toString(), row)); c = charFactory.getNextChar(); sb = new StringBuilder(); } else if (c == '<') { sb.append(c); c = charFactory.getNextChar(); if (c == '=') { sb.append(c); c = charFactory.getNextChar(); } items.add(new Item("sign", sb.toString(), row)); sb = new StringBuilder(); } else if (c == '>') { sb.append(c); c = charFactory.getNextChar(); if (c == '=') { sb.append(c); c = charFactory.getNextChar(); } items.add(new Item("sign", sb.toString(), row)); sb = new StringBuilder(); } else if (c == '-') { sb.append(c); c = charFactory.getNextChar(); items.add(new Item("sign", sb.toString(), row)); sb = new StringBuilder(); } else if (c == '+') { sb.append(c); c = charFactory.getNextChar(); items.add(new Item("sign", sb.toString(), row)); sb = new StringBuilder(); } else if (c == '*') { sb.append(c); c = charFactory.getNextChar(); items.add(new Item("sign", sb.toString(), row)); sb = new StringBuilder(); } else if (c == '/') { sb.append(c); c = charFactory.getNextChar(); items.add(new Item("sign", sb.toString(), row)); sb = new StringBuilder(); } else if (c == ':') { sb.append(c); c = charFactory.getNextChar(); if (c == '=') { sb.append(c); c = charFactory.getNextChar(); } items.add(new Item("sign", sb.toString(), row)); sb = new StringBuilder(); } else { items.add(new Item("error", c.toString(), row)); c = charFactory.getNextChar(); } if (c == null) return; else if (c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z') { letter(c); } else if (c >= '0' && c <= '9') { num(c, 0); } else { sign(c); } } // ๆ˜ฏๅฆๆ˜ฏๅ…ณ้”ฎๅญ— boolean isKeyword(String s) { for (String keyword : keywords) { if (s.equals(keyword)) return true; } return false; } // ๆ˜ฏๅฆๆ˜ฏ็ฌฆๅท boolean isSign(String s) { for (String sign : signs) { if (s.equals(sign)) return true; } return false; } }
[ "2052943631@qq.com" ]
2052943631@qq.com
bede0ae91ea9edc72d7a033602dd479d99bc6670
aaac30301a5b18e8b930d9932a5e11d514924c7e
/framework/ssmjavaconfig/src/main/java/me/maiz/trainning/framework/ssmjavaconfig/dao/ProductMapper.java
1506b4910c8070b8613ed281b1fa81a398df8cf2
[]
no_license
stickgoal/trainning
9206e30fc0b17c817c5826a6e212ad25a3b9d8a6
58348f8a3d21e91cad54d0084078129e788ea1f4
refs/heads/master
2023-03-14T12:29:11.508957
2022-12-01T09:17:50
2022-12-01T09:17:50
91,793,279
1
0
null
2023-02-22T06:55:38
2017-05-19T10:06:01
JavaScript
UTF-8
Java
false
false
3,029
java
package me.maiz.trainning.framework.ssmjavaconfig.dao; import java.util.List; import me.maiz.trainning.framework.ssmjavaconfig.entity.Product; import me.maiz.trainning.framework.ssmjavaconfig.entity.ProductExample; import org.apache.ibatis.annotations.Param; public interface ProductMapper { /** * This method was generated by MyBatis Generator. * This method corresponds to the database table product * * @mbg.generated Thu Nov 07 20:07:03 CST 2019 */ long countByExample(ProductExample example); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table product * * @mbg.generated Thu Nov 07 20:07:03 CST 2019 */ int deleteByExample(ProductExample example); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table product * * @mbg.generated Thu Nov 07 20:07:03 CST 2019 */ int deleteByPrimaryKey(Integer productId); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table product * * @mbg.generated Thu Nov 07 20:07:03 CST 2019 */ int insert(Product record); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table product * * @mbg.generated Thu Nov 07 20:07:03 CST 2019 */ int insertSelective(Product record); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table product * * @mbg.generated Thu Nov 07 20:07:03 CST 2019 */ List<Product> selectByExample(ProductExample example); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table product * * @mbg.generated Thu Nov 07 20:07:03 CST 2019 */ Product selectByPrimaryKey(Integer productId); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table product * * @mbg.generated Thu Nov 07 20:07:03 CST 2019 */ int updateByExampleSelective(@Param("record") Product record, @Param("example") ProductExample example); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table product * * @mbg.generated Thu Nov 07 20:07:03 CST 2019 */ int updateByExample(@Param("record") Product record, @Param("example") ProductExample example); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table product * * @mbg.generated Thu Nov 07 20:07:03 CST 2019 */ int updateByPrimaryKeySelective(Product record); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table product * * @mbg.generated Thu Nov 07 20:07:03 CST 2019 */ int updateByPrimaryKey(Product record); }
[ "stick.goal@163.com" ]
stick.goal@163.com
e7c817c6206887185c5dbf026332bf4f568c61ed
127b9612a1e0646a90cd96391dcde6f53c820919
/samples/server/petstore/jaxrs-spec/src/gen/java/io/swagger/model/Client.java
57bcea24a47422108acacb76aabf1e4b7885dc7d
[ "Apache-2.0" ]
permissive
Metaswitch/swagger-codegen
bbbcb7f248ed8a484ab5a69a4baaa4d999295700
2e5289c4d74eafd48e3a324ccdd9e39323b5fb06
refs/heads/master
2021-09-14T18:49:40.690702
2017-10-05T15:07:53
2017-10-05T15:07:53
105,641,359
4
2
null
2017-10-18T07:59:49
2017-10-03T10:55:27
HTML
UTF-8
Java
false
false
1,364
java
package io.swagger.model; import javax.validation.constraints.*; import javax.validation.Valid; import io.swagger.annotations.*; import java.util.Objects; public class Client { private @Valid String client = null; /** **/ public Client client(String client) { this.client = client; return this; } @ApiModelProperty(value = "") public String getClient() { return client; } public void setClient(String client) { this.client = client; } @Override public boolean equals(java.lang.Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Client client = (Client) o; return Objects.equals(client, client.client); } @Override public int hashCode() { return Objects.hash(client); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Client {\n"); sb.append(" client: ").append(toIndentedString(client)).append("\n"); sb.append("}"); return sb.toString(); } /** * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } }
[ "wing328hk@gmail.com" ]
wing328hk@gmail.com
1e29f27bed0fcb300a439037c15d7128fd82f51c
ca0d3740edab3545737b7e07bdc30ff4712d621a
/src/Lote2_31_45/Ex33.java
6d7132cbd071358b444cb3b2b41a9d6ac27f199c
[]
no_license
iza-csoares/Logica-Java
8d4d6799a2db070f864e752be1793bd22b002583
0b4c12c8f2548618d9ad8d05cc08b3f27e7b40fa
refs/heads/master
2021-07-12T12:22:23.361699
2017-10-18T15:51:38
2017-10-18T15:51:38
null
0
0
null
null
null
null
UTF-8
Java
false
false
431
java
package Lote2_31_45; import javax.swing.JOptionPane; public class Ex33 { public static void main(String[] args){ int n = 0; double i, conta, soma = 0; n = Integer.parseInt(JOptionPane.showInputDialog(null, "Valor: ")); for(i = 1; i <= n; i++){ conta = (1/i); soma = (soma + conta); } JOptionPane.showMessageDialog(null, "Total" + soma); } }
[ "bellecsoares@gmail.com" ]
bellecsoares@gmail.com
386cecca64c791ee25fd1bac28572aff38307328
58433c7edef5e0ba208ea357c97cc6a78acf9fa8
/EdwinAttempt/src/main/aidl/com/edwin/attempt/aidl/Book.java
69ab85403b054b062f412f73fe00bcba8c30590d
[]
no_license
hongyi0609/EdwinAttempt
e69e6a32ed672221cad041cbdca4ff6c2cd2da3b
40c757f91faaaf9394ec602a034e0874b8c1238b
refs/heads/master
2021-05-15T10:39:11.307942
2017-12-24T08:02:36
2017-12-24T08:02:36
108,197,530
0
0
null
null
null
null
UTF-8
Java
false
false
999
java
package com.edwin.attempt.aidl; import android.os.Parcel; import android.os.Parcelable; /** * Created by hongy_000 on 2017/10/25. * * @author hongy_000 */ public class Book implements Parcelable { private int bookId; private String bookName; public Book(int bookId, String bookName) { this.bookId = bookId; this.bookName = bookName; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeInt(bookId); dest.writeString(bookName); } @Override public int describeContents() { return 0; } protected Book(Parcel in) { bookId = in.readInt(); bookName = in.readString(); } public static final Creator<Book> CREATOR = new Creator<Book>() { @Override public Book createFromParcel(Parcel in) { return new Book(in); } @Override public Book[] newArray(int size) { return new Book[size]; } }; }
[ "hongyi0609@126.com" ]
hongyi0609@126.com
7f55cf936b8d9cb3b2070eed4f1c36f44646e57e
08167dee2f60b0a4cb4e2cdf1255fce52a95b940
/src/ReviewParser.java
3027499583f3b4d29b8c6b954e219cc6a5aaff8d
[]
no_license
mpmilano/nlp-final-project
c2b99e5136005f9f423f88bcd91cac1ee488024b
2476e6c93855a3c9a136d4c6eaf4f47b77fd6119
refs/heads/master
2020-06-06T20:43:38.535856
2014-12-11T21:27:51
2014-12-11T21:27:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,207
java
import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.*; import java.util.Set; class ReviewParser { class OutOfTextException extends IOException { /** * */ private static final long serialVersionUID = -5624253573956415820L; public String p; public OutOfTextException(String s){ super(s); p = s; } } private BufferedReader r; private ReviewParser(BufferedReader f){ this.r = f; } private String overflow = ""; private String rangeFromOverflow(String prefix, String done){ if (overflow.contains(prefix)){ if (overflow.endsWith(prefix)) return prefix; String[] tmp = overflow.split(prefix)[1].split(done); if (tmp.length > 1) overflow = done + tmp[1]; return prefix + tmp[0]; } return ""; } private String reallyRead(String prefix, String done) throws IOException{ String acc = rangeFromOverflow(prefix, done); if (overflow.contains(done)) return acc.split(prefix)[1]; while (r.ready()){ acc += r.readLine(); if (acc.contains(done)){ String[] split = acc.split(done); overflow = done + (split.length > 1 ? split[1] : ""); try { return split[0].split(prefix)[1]; } catch (ArrayIndexOutOfBoundsException e) { return "";} } } throw new OutOfTextException(acc.split(prefix)[1]); } /** Give me a filename and three empty sets, and I'll populate the sets with all of the stuff in the file. * @throws FileNotFoundException */ private static void addAll(Set<T> s, Collection<Memento<T> > c){ for (T t : c){ s.add(t.unpack()); } } private static void readFromFile(String filename, Set<Reviewer> cs, Set<Product> ps, Set<Review> rs) throws IOException{ String cachefileprefix = "/tmp/" + filename.replace('/','%'); String rprr = cachefileprefix + "rp-rr.obj"; String rpp = cachefileprefix + "rp-p.obj"; String rpr = cachefileprefix + "rp-r.obj"; addAll(cs, ((Set<Memento<Reviewer> >) new ObjectInputStream(new FileInputStream(new File(rprr))).readObject()); ps.addAll((Set<Product>) new ObjectInputStream(new FileInputStream(new File(rpp))).readObject()); rs.addAll((Set<Review>) new ObjectInputStream(new FileInputStream(new File(rpr))).readObject()); return; } private static void writeToFile() { } public static void parse(String filename, Set<Reviewer> cs, Set<Product> ps, Set<Review> rs ) throws IOException{ BufferedReader f = new BufferedReader(new FileReader(new File(filename))); ReviewParser rp = new ReviewParser(f); int count = 0; String cachefileprefix = "/tmp/" + filename.replace('/','%'); String rprr = cachefileprefix + "rp-rr.obj"; String rpp = cachefileprefix + "rp-p.obj"; String rpr = cachefileprefix + "rp-r.obj"; try { cs.addAll((Set<Reviewer>) new ObjectInputStream(new FileInputStream(new File(rprr))).readObject()); ps.addAll((Set<Product>) new ObjectInputStream(new FileInputStream(new File(rpp))).readObject()); rs.addAll((Set<Review>) new ObjectInputStream(new FileInputStream(new File(rpr))).readObject()); return; } catch (Exception ignoreme){ try { while (f.ready()){ ++count; String productId = rp.reallyRead("product/productId: ","product/title: "); productId.intern(); String productTitle = rp.reallyRead("product/title: ","product/price: "); productTitle.intern(); String productPrice = rp.reallyRead("product/price: ", "review/userId: "); productPrice.intern(); String reviewUserId = rp.reallyRead("review/userId: ", "review/profileName: "); reviewUserId.intern(); String reviewProfileName = rp.reallyRead("review/profileName: ", "review/helpfulness: "); reviewProfileName.intern(); String reviewHelpfulness = rp.reallyRead("review/helpfulness: ", "review/score: "); String reviewScore = rp.reallyRead("review/score: ", "review/time: "); String reviewTime = rp.reallyRead("review/time: ", "review/summary: "); String reviewSummary = rp.reallyRead("review/summary: ", "review/text: "); String reviewText = ""; try { reviewText = rp.reallyRead("review/text: ", "product/productId: "); } catch (OutOfTextException e){ reviewText = e.p; } double price = -1; try { price = Double.parseDouble(productPrice); } catch (NumberFormatException e){ //ignore } Product p = Product.build(productId, productTitle, price); Reviewer c = Reviewer.build(reviewProfileName, reviewUserId); String[] hlp = reviewHelpfulness.split("/"); Helpfulness h = Helpfulness.build(Integer.parseInt(hlp[0]), Integer.parseInt(hlp[1])); Review r = Review.build(reviewSummary,Double.parseDouble(reviewScore), Integer.parseInt(reviewTime),c,h,p,reviewText); cs.add(c); ps.add(p); rs.add(r); } new ObjectOutputStream(new FileOutputStream(new File(rprr))).writeObject(cs); new ObjectOutputStream(new FileOutputStream(new File(rpr))).writeObject(rs); new ObjectOutputStream(new FileOutputStream(new File(rpp))).writeObject(ps); } catch (RuntimeException e){ System.out.println("Got this far: " + count); throw e; } } } }
[ "milano@cs.cornell.edu" ]
milano@cs.cornell.edu
da123dd198f0fe67c542a266cb238c60ef42afd6
7f3d6a5324867c6c956e34dabf33514f458fc57f
/src/com/patriqdesigns/patterns/factory/pizzastore/ingredient/Dough.java
61b55560c7aaed2df874d74273a7d04631277227
[]
no_license
chdyldz/DesignPatterns
6b560e0dc7e6011fde988028a5e30268fb7a9c87
bef9fe9ce7eb264be8ef533b2dcec8f724a8c8c7
refs/heads/master
2023-03-15T20:22:27.403289
2016-01-11T19:11:17
2016-01-11T19:11:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
135
java
package com.patriqdesigns.patterns.factory.pizzastore.ingredient; /** * Created by Andre on 16/07/15. */ public interface Dough { }
[ "patriqdesigns@gmail.com" ]
patriqdesigns@gmail.com
2c44f51ce60688b48a4274819e79e096e70dafac
c9b9ca73d3c9c9d3f31ec5818a412aed33e8e464
/models-impl/src/test/java/io/xmljim/algorithms/models/impl/provider/ParameterFactoryImplTest.java
cfbf8635c8f8c79220a40acff845fa1b916fc6ad
[]
no_license
xmljim/algorithms
bb7540c603b79a59ceb7f69347e874c679ac2d7d
133ad06ef2fdf473215e982712596b100b1e4701
refs/heads/main
2023-08-02T12:32:25.423844
2021-09-08T22:43:28
2021-09-08T22:43:28
400,223,452
0
0
null
null
null
null
UTF-8
Java
false
false
3,253
java
package io.xmljim.algorithms.models.impl.provider; import io.xmljim.algorithms.model.*; import io.xmljim.algorithms.model.util.Scalar; import io.xmljim.algorithms.model.util.SerialTemporal; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import java.time.LocalDate; import static org.junit.jupiter.api.Assertions.*; @DisplayName("Test ParameterFactory") class ParameterFactoryImplTest extends ImplementationTestBase { @Test @DisplayName("Create a Generic Parameter") void testCreateParameterGeneric() { Parameter<LocalDate> localDateParameter = getModelProvider().getParameterFactory().createParameter("currentDate", "currentDate", LocalDate.now()); assertEquals(LocalDate.now(), localDateParameter.getValue()); assertEquals(ParameterTypes.GENERIC, localDateParameter.getParameterType()); Parameter<?> wildcardParam = getModelProvider().getParameterFactory().createParameter("wildcard", "WILDCARD"); String wildcardValue = (String) wildcardParam.getValue(); assertEquals("WILDCARD", wildcardValue); assertEquals(ParameterTypes.GENERIC, wildcardParam.getParameterType()); } @Test @DisplayName("Create a Vector Parameter") void testCreateParameterVector() { Vector<String> stringVector = getModelProvider().getVectorFactory().createVector("stringVector", "a", "a","b","c","d","e","f","g"); Parameter<Vector<String>> stringVectorParameter = getModelProvider().getParameterFactory().createParameter(stringVector); assertEquals(stringVector.getName(), stringVectorParameter.getName()); assertEquals(ParameterTypes.VECTOR, stringVectorParameter.getParameterType()); } @Test @DisplayName("Create a Scalar Parameter") void testCreateParameterNumber() { ScalarParameter scalarParameter1 = getModelProvider().getParameterFactory().createParameter("p1", 100); ScalarParameter scalarParameterBool = getModelProvider().getParameterFactory().createParameter("p2", Scalar.of(true)); ScalarParameter scalarParameterDate = getModelProvider().getParameterFactory().createParameter("p3", Scalar.of(LocalDate.now())); assertEquals(100, scalarParameter1.getValue().asInt()); assertEquals(ParameterTypes.SCALAR, scalarParameter1.getParameterType()); assertEquals(0.0, scalarParameterBool.getValue().asDouble()); assertEquals(ParameterTypes.SCALAR, scalarParameterBool.getParameterType()); assertEquals(SerialTemporal.of(LocalDate.now()).intValue(), scalarParameterDate.getValue().intValue()); assertEquals(ParameterTypes.SCALAR, scalarParameterDate.getParameterType()); } @Test @DisplayName("Create ScalarVector Parameter") void testCreateParameterScalarVector() { ScalarVector vector = getModelProvider().getVectorFactory().createScalarVector("testVector", 1,2,3,4,5,6,7,8,9,0); ScalarVectorParameter vectorParameter = getModelProvider().getParameterFactory().createParameter(vector); assertEquals(ParameterTypes.SCALAR_VECTOR, vectorParameter.getParameterType()); } }
[ "jearley@captechconsulting.com" ]
jearley@captechconsulting.com
4f28136a17f16db2797ba736ffb1163572547bb3
354bdb76f393e4df6dad96bd53187a2f4d8263c5
/src/auth/model/User.java
fbede21eb466e4d83b7a507a40e8854b4c55082d
[]
no_license
Mosquito06/Chapter21_Board_JDBC
d1ea6e7cc79ef9cd3130a317e4e094be8b96fc7d
fcaaa5261752d7d9f0d54d64301c6273faeac6c2
refs/heads/master
2021-09-06T01:53:23.190943
2018-02-01T13:01:52
2018-02-01T13:01:52
119,836,019
0
0
null
null
null
null
UTF-8
Java
false
false
412
java
package auth.model; public class User { private String id; private String name; public User(String id, String name) { super(); this.id = id; this.name = name; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } }
[ "skykim10908@naver.com" ]
skykim10908@naver.com
878c65a763ee8996464a05b6dedf6277a2c4bc2e
3735a07d455d7b40613c3c4160aa8b1cb1b3472a
/platform/lang-impl/src/com/intellij/largeFilesEditor/search/actions/StopRangeSearchAction.java
df8181ff160c9a0e38b276928479d4a5dca3b192
[ "Apache-2.0" ]
permissive
caofanCPU/intellij-community
ede9417fc4ccb4b5efefb099906e4abe6871f3b4
5ad3e2bdf3c83d86e7c4396f5671929768d76999
refs/heads/master
2023-02-27T21:38:33.416107
2021-02-05T06:37:40
2021-02-05T06:37:40
321,209,485
1
0
Apache-2.0
2021-02-05T06:37:41
2020-12-14T02:22:32
null
UTF-8
Java
false
false
1,491
java
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.largeFilesEditor.search.actions; import com.intellij.icons.AllIcons; import com.intellij.largeFilesEditor.search.searchResultsPanel.RangeSearch; import com.intellij.largeFilesEditor.search.searchTask.RangeSearchTask; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.editor.EditorBundle; import com.intellij.openapi.project.DumbAware; import org.jetbrains.annotations.NotNull; public class StopRangeSearchAction extends AnAction implements DumbAware { private final RangeSearch myRangeSearch; public StopRangeSearchAction(@NotNull RangeSearch rangeSearch) { this.myRangeSearch = rangeSearch; getTemplatePresentation().setText(EditorBundle.messagePointer("large.file.editor.stop.searching.action.text")); getTemplatePresentation().setIcon(AllIcons.Actions.Suspend); } @Override public void update(@NotNull AnActionEvent e) { RangeSearchTask task = myRangeSearch.getLastExecutedRangeSearchTask(); e.getPresentation().setEnabled( task != null && !task.isFinished() && !task.isShouldStop() ); } @Override public void actionPerformed(@NotNull AnActionEvent e) { RangeSearchTask task = myRangeSearch.getLastExecutedRangeSearchTask(); if (task != null) { task.shouldStop(); } } }
[ "intellij-monorepo-bot-no-reply@jetbrains.com" ]
intellij-monorepo-bot-no-reply@jetbrains.com
c17db6b645d4057901d51feedcc586f21cdaa618
d4eae735f5359a8479c37f0cfdc1fd09eb50653c
/src/p08/lecture/ex1/Pet.java
e6122b9cce49157835518ca642e435974b93260d
[]
no_license
soobin-0513/java20210325
76752ce735e099bbc13cfaa8315a8a1f4529cb03
b31cbbba0fc7750652d652b9b92ede5acc0b72d7
refs/heads/master
2023-05-01T03:32:11.522917
2021-05-24T10:20:15
2021-05-24T10:20:15
351,269,325
0
0
null
null
null
null
UTF-8
Java
false
false
180
java
package p08.lecture.ex1; public interface Pet { //interface์€ ์ถ”์ƒ์ ์ธ๊ฑฐ abstract ์ƒ๋žต๋˜์žˆ์Œ ,public์ƒ๋žตํ•ด๋„ public void sit(); //public abstract void sit(); }
[ "rxb0513@gmail.com" ]
rxb0513@gmail.com
827d95de11e1eab6ce2756393d2911b37bf56f77
fcbb9f01d0bbb521a231a72eda6b1fec2c5e1c51
/lib_mpchart/src/main/java/com/github/mikephil/charting/renderer/DataRenderer.java
4effa3b88d45858c3d1d42d6966c118a572fab99
[]
no_license
AELFSTAKING/Android
45e6c7e5eeb8308b5d2d6d34b5c714b1439950af
6c4bb529b006e9ec37aaf5a0bf20d07678ad15f5
refs/heads/master
2021-02-07T22:00:08.388969
2020-03-13T08:09:07
2020-03-13T08:09:07
247,011,248
1
0
null
null
null
null
UTF-8
Java
false
false
4,914
java
package com.github.mikephil.charting.renderer; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Paint.Align; import android.graphics.Paint.Style; import com.github.mikephil.charting.animation.ChartAnimator; import com.github.mikephil.charting.data.Entry; import com.github.mikephil.charting.formatter.IValueFormatter; import com.github.mikephil.charting.highlight.Highlight; import com.github.mikephil.charting.interfaces.dataprovider.ChartInterface; import com.github.mikephil.charting.interfaces.datasets.IDataSet; import com.github.mikephil.charting.utils.Utils; import com.github.mikephil.charting.utils.ViewPortHandler; /** * Superclass of all render classes for the different data types (line, bar, ...). * * @author Philipp Jahoda */ public abstract class DataRenderer extends Renderer { /** * the animator object used to perform animations on the chart data */ protected ChartAnimator mAnimator; /** * main paint object used for rendering */ protected Paint mRenderPaint; /** * paint used for highlighting values */ protected Paint mHighlightPaint; protected Paint mDrawPaint; /** * paint object for drawing values (text representing values of chart * entries) */ protected Paint mValuePaint; public DataRenderer(ChartAnimator animator, ViewPortHandler viewPortHandler) { super(viewPortHandler); this.mAnimator = animator; mRenderPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mRenderPaint.setStyle(Style.FILL); mDrawPaint = new Paint(Paint.DITHER_FLAG); mValuePaint = new Paint(Paint.ANTI_ALIAS_FLAG); mValuePaint.setColor(Color.rgb(63, 63, 63)); mValuePaint.setTextAlign(Align.CENTER); mValuePaint.setTextSize(Utils.convertDpToPixel(9f)); mHighlightPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mHighlightPaint.setStyle(Paint.Style.STROKE); mHighlightPaint.setStrokeWidth(2f); mHighlightPaint.setColor(Color.rgb(255, 187, 115)); } protected boolean isDrawingValuesAllowed(ChartInterface chart) { return chart.getData().getEntryCount() < chart.getMaxVisibleCount() * mViewPortHandler.getScaleX(); } /** * Returns the Paint object this renderer uses for drawing the values * (value-text). * * @return */ public Paint getPaintValues() { return mValuePaint; } /** * Returns the Paint object this renderer uses for drawing highlight * indicators. * * @return */ public Paint getPaintHighlight() { return mHighlightPaint; } /** * Returns the Paint object used for rendering. * * @return */ public Paint getPaintRender() { return mRenderPaint; } /** * Applies the required styling (provided by the DataSet) to the value-paint * object. * * @param set */ protected void applyValueTextStyle(IDataSet set) { mValuePaint.setTypeface(set.getValueTypeface()); mValuePaint.setTextSize(set.getValueTextSize()); } /** * Initializes the buffers used for rendering with a new size. Since this * method performs memory allocations, it should only be called if * necessary. */ public abstract void initBuffers(); /** * Draws the actual data in form of lines, bars, ... depending on Renderer subclass. * * @param c */ public abstract void drawData(Canvas c); /** * Loops over all Entrys and draws their values. * * @param c */ public abstract void drawValues(Canvas c); /** * Draws the value of the given entry by using the provided IValueFormatter. * * @param c canvas * @param formatter formatter for custom value-formatting * @param value the value to be drawn * @param entry the entry the value belongs to * @param dataSetIndex the index of the DataSet the drawn Entry belongs to * @param x position * @param y position * @param color */ public void drawValue(Canvas c, IValueFormatter formatter, float value, Entry entry, int dataSetIndex, float x, float y, int color) { mValuePaint.setColor(color); c.drawText(formatter.getFormattedValue(value, entry, dataSetIndex, mViewPortHandler), x, y, mValuePaint); } /** * Draws any kind of additional information (e.g. line-circles). * * @param c */ public abstract void drawExtras(Canvas c); /** * Draws all highlight indicators for the values that are currently highlighted. * * @param c * @param indices the highlighted values */ public abstract void drawHighlighted(Canvas c, Highlight[] indices); }
[ "dupeng@kofo.io" ]
dupeng@kofo.io
466436eec8e0146df74e347e97ddf69ca1ec89d8
4deccf3e9eb563cf32cc4b732e314a564747a194
/src/main/java/com/example/demo/app/controller/StudentManagementController.java
645a8c18c297560951bca31115e6db8debd15b35
[]
no_license
DmitriyLy/spring-security
08e7fa497425a84219811a2b59301276d8fffe24
f0f6174048073c96756c3cbef2cefddb1f8a1433
refs/heads/master
2023-04-23T09:52:02.870147
2021-05-12T14:26:40
2021-05-12T14:26:40
358,208,336
0
0
null
null
null
null
UTF-8
Java
false
false
1,361
java
package com.example.demo.app.controller; import com.example.demo.app.entity.Student; import com.example.demo.app.service.StudentService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import java.util.List; @RestController @RequestMapping("management/api/v1/students") public class StudentManagementController { private final StudentService studentService; @Autowired public StudentManagementController(StudentService studentService) { this.studentService = studentService; } @GetMapping @PreAuthorize("hasAnyRole('ROLE_ADMIN', 'ROLE_ADMINTRAINEE')") public List<Student> getAll() { return studentService.getAll(); } @PostMapping @PreAuthorize("hasAuthority('student:write')") public void create(@RequestBody Student student) { studentService.create(student); } @DeleteMapping(path = "/{id}") @PreAuthorize("hasAuthority('student:write')") public void delete(@PathVariable("id") Long id) { studentService.delete(id); } @PutMapping(path = "/{id}") @PreAuthorize("hasAuthority('student:write')") public void update(@PathVariable("id") Long id, Student student) { studentService.update(id, student); } }
[ "dmytro.lysai@netcracker.com" ]
dmytro.lysai@netcracker.com
f13363f0abc2ac901a2433d65a94555e08051c29
de66a0a70c93aa4a32b26de0daa4245ac38b2e07
/app/src/main/java/com/wisbalam/server/list/ViewPagerAdapter.java
a988afc0e50e6218efb28fff39434ae5ccadee20
[ "MIT" ]
permissive
fonysaputra/wisbalam
8c2f8faeae2f134440a21817e7b465af196a4579
5b7e37da5962290e8cb94da603d3a92d2b8a1af8
refs/heads/master
2020-04-13T08:02:30.769492
2018-12-25T09:58:36
2018-12-25T09:58:36
163,070,110
0
0
null
null
null
null
UTF-8
Java
false
false
1,300
java
package com.wisbalam.server.list; import android.content.Context; import android.support.annotation.NonNull; import android.support.v4.view.PagerAdapter; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import com.squareup.picasso.Picasso; public class ViewPagerAdapter extends PagerAdapter { private Context context; private String[] imageUrls; ViewPagerAdapter(Context context, String[] imageUrls) { this.context = context; this.imageUrls = imageUrls; } @Override public int getCount() { return imageUrls.length; } @Override public boolean isViewFromObject(@NonNull View view, @NonNull Object object) { return view == object; } @NonNull @Override public Object instantiateItem(@NonNull ViewGroup container, int position) { ImageView imageView = new ImageView(context); Picasso.get() .load(imageUrls[position]) .fit() .centerCrop() .into(imageView); container.addView(imageView); return imageView; } @Override public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) { container.removeView((View) object); } }
[ "โ€œfonysaputra95@gmail.comโ€œ" ]
โ€œfonysaputra95@gmail.comโ€œ
d8fc020fbc18aea86d7deb5bfbc98699b9c480ce
17e62c1f5a65fbfc058af274ce57794338689391
/src/java/eft/BlockchainProcessor.java
6e466c5775944b176e13a088651763bc537421b3
[ "MIT" ]
permissive
eforint/eft
b125dad0ced0aebc6af754a9c51f7839d7b49a56
89d6d335f9fd1dad2682c901d95340df4a995f42
refs/heads/master
2021-01-23T09:34:00.442139
2014-10-24T13:32:47
2014-10-24T13:32:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,462
java
package eft; import eft.peer.Peer; import eft.util.Observable; import org.json.simple.JSONObject; public interface BlockchainProcessor extends Observable<Block,BlockchainProcessor.Event> { public static enum Event { BLOCK_PUSHED, BLOCK_POPPED, BLOCK_GENERATED, BLOCK_SCANNED, RESCAN_BEGIN, RESCAN_END, BEFORE_BLOCK_ACCEPT, BEFORE_BLOCK_APPLY, AFTER_BLOCK_APPLY, BEFORE_BLOCK_UNDO } Peer getLastBlockchainFeeder(); int getLastBlockchainFeederHeight(); boolean isScanning(); void processPeerBlock(JSONObject request) throws EftException; void fullReset(); public static class BlockNotAcceptedException extends EftException { BlockNotAcceptedException(String message) { super(message); } } public static class TransactionNotAcceptedException extends BlockNotAcceptedException { private final TransactionImpl transaction; TransactionNotAcceptedException(String message, TransactionImpl transaction) { super(message + " transaction: " + transaction.getJSONObject().toJSONString()); this.transaction = transaction; } public Transaction getTransaction() { return transaction; } } public static class BlockOutOfOrderException extends BlockNotAcceptedException { BlockOutOfOrderException(String message) { super(message); } } }
[ "root@crsnode.fdnxt.org" ]
root@crsnode.fdnxt.org
b1c5a2718f351c7c2d520500e03c644a6465fb5f
ae64a6a2ef2ec228dc00fb3c545d17fe0d01b596
/android/support/v4/p001b/C0043c.java
21716a844abc925a0f4d22d62ee191bbd8f6d196
[]
no_license
Ravinther/Createnotes
1ed5a2a5d8825e2482b17754b152c9a646631a9c
2179f634acb5f00402806a672778b52f7508295b
refs/heads/master
2021-01-20T19:53:12.160695
2016-08-15T15:56:32
2016-08-15T15:56:32
65,744,902
0
0
null
null
null
null
UTF-8
Java
false
false
219
java
package android.support.v4.p001b; import android.os.Parcel; /* renamed from: android.support.v4.b.c */ public interface C0043c { Object m220a(Parcel parcel, ClassLoader classLoader); Object[] m221a(int i); }
[ "m.ravinther@yahoo.com" ]
m.ravinther@yahoo.com
48fea73df503a0bbcb06e7cd92d79aa032a9c890
6ac15f226f712133b2a71da59d4ddccce5983aab
/src/main/java/com/codecool/sketch/model/User.java
5acb4c730f923fdb692c52ef350c45e69181b2c2
[]
no_license
aronszucs/sketch-n-share
8295b02535b199de7235766bfb1051c55c7e0d9d
2f28cd6aa26da77e644499981f2bfc199b266429
refs/heads/master
2022-11-19T04:10:44.299604
2019-07-19T08:31:16
2019-07-19T08:31:16
197,729,804
0
0
null
2022-11-16T10:28:59
2019-07-19T08:02:59
Java
UTF-8
Java
false
false
569
java
package com.codecool.sketch.model; public class User { private int id; private String name; private String password; private Role role; public User(int id, String name, String password, Role role) { this.id = id; this.name = name; this.password = password; this.role = role; } public int getId() { return id; } public String getName() { return name; } public String getPassword() { return password; } public Role getRole() { return role; } }
[ "aron.szucs.miskolc@gmail.com" ]
aron.szucs.miskolc@gmail.com
f040ee2e2ec46e75b9a77ac2ea118e0caf800074
ce956f62248c128308019262fe0f40ec4ee65155
/src/cn/com/bohui/bohuifin/bean/AuthorityAuthorityGroupBean.java
f6f925df344726f7fdf79ea3513f2258ea15fa01
[]
no_license
scorpio018/bohuifin
824018e3b2f3056a8bb35e38776ebb408a9a1311
ad4bf05f22aabc99f73ea38afa1db6bb20e32343
refs/heads/master
2021-01-24T08:22:16.561154
2017-09-16T08:26:48
2017-09-16T08:26:48
93,382,165
0
0
null
null
null
null
UTF-8
Java
false
false
624
java
package cn.com.bohui.bohuifin.bean; /** * ่กจๅ๏ผšt_authority_authority_group */ import java.io.Serializable; public class AuthorityAuthorityGroupBean implements Serializable { /** * */ private static final long serialVersionUID = 1L; private int authorityId; private int authorityGroupId; public int getAuthorityId() { return authorityId; } public void setAuthorityId(int authorityId) { this.authorityId = authorityId; } public int getAuthorityGroupId() { return authorityGroupId; } public void setAuthorityGroupId(int authorityGroupId) { this.authorityGroupId = authorityGroupId; } }
[ "scorpioyoung@gmail.com" ]
scorpioyoung@gmail.com
fc122e940ca8644e6a21920d8d5e751f9562c5e0
69c1256baec48b66365b5ec8faec5d6318b0eb21
/Mage.Sets/src/mage/sets/magic2014/MindRot.java
3d89e0ac24f7e0c211ddfdfbabe59e850e4f6bfd
[]
no_license
gbraad/mage
3b84eefe4845258f6250a7ff692e1f2939864355
18ce6a0305db6ebc0d34054af03fdb0ba88b5a3b
refs/heads/master
2022-09-28T17:31:38.653921
2015-04-04T22:28:22
2015-04-04T22:28:22
33,435,029
1
0
null
2022-09-01T23:39:50
2015-04-05T08:25:58
Java
UTF-8
Java
false
false
2,132
java
/* * Copyright 2010 BetaSteward_at_googlemail.com. 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 following disclaimer. * * 2. 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. * * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``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 BetaSteward_at_googlemail.com 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. * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ package mage.sets.magic2014; import java.util.UUID; /** * * @author LevelX2 */ public class MindRot extends mage.sets.tenth.MindRot { public MindRot(UUID ownerId) { super(ownerId); this.cardNumber = 106; this.expansionSetCode = "M14"; } public MindRot(final MindRot card) { super(card); } @Override public MindRot copy() { return new MindRot(this); } }
[ "ludwig.hirth@online.de" ]
ludwig.hirth@online.de
6b0088b4c4b92f686d8e817180fb1b87adef131a
f634f56a8aff696fbe975ff8ad041326277d1a3d
/MyPlaces/app/src/main/java/com/rn/myplaces/myplaces/weather/Weather.java
9a8ccc415d838b8b241c984a39a13655060b06b8
[]
no_license
OlgaTUD/AppDevelopmentWS1516
6dc85c5cf3c9f446dbe29c8a52e5ac1a49b845e7
c484790ba137311cd447c1daa503e4587ac6e0e3
refs/heads/master
2021-01-10T15:55:19.086823
2016-01-28T10:10:13
2016-01-28T10:10:13
44,877,505
0
0
null
null
null
null
UTF-8
Java
false
false
3,746
java
package com.rn.myplaces.myplaces.weather; /** * Created by Uto4ko on 17.12.2015. */ public class Weather { public Location location; public CurrentCondition currentCondition = new CurrentCondition(); public Temperature temperature = new Temperature(); public Wind wind = new Wind(); public Rain rain = new Rain(); public Snow snow = new Snow() ; public Clouds clouds = new Clouds(); public byte[] iconData; public class CurrentCondition { private int weatherId; private String condition; private String descr; private String icon; private float pressure; private float humidity; public int getWeatherId() { return weatherId; } public void setWeatherId(int weatherId) { this.weatherId = weatherId; } public String getCondition() { return condition; } public void setCondition(String condition) { this.condition = condition; } public String getDescr() { return descr; } public void setDescr(String descr) { this.descr = descr; } public String getIcon() { return icon; } public void setIcon(String icon) { this.icon = icon; } public float getPressure() { return pressure; } public void setPressure(float pressure) { this.pressure = pressure; } public float getHumidity() { return humidity; } public void setHumidity(float humidity) { this.humidity = humidity; } } public class Temperature { private float temp; private float minTemp; private float maxTemp; public float getTemp() { return temp; } public void setTemp(float temp) { this.temp = temp; } public float getMinTemp() { return minTemp; } public void setMinTemp(float minTemp) { this.minTemp = minTemp; } public float getMaxTemp() { return maxTemp; } public void setMaxTemp(float maxTemp) { this.maxTemp = maxTemp; } } public class Wind { private float speed; private float deg; public float getSpeed() { return speed; } public void setSpeed(float speed) { this.speed = speed; } public float getDeg() { return deg; } public void setDeg(float deg) { this.deg = deg; } } public class Rain { private String time; private float ammount; public String getTime() { return time; } public void setTime(String time) { this.time = time; } public float getAmmount() { return ammount; } public void setAmmount(float ammount) { this.ammount = ammount; } } public class Snow { private String time; private float ammount; public String getTime() { return time; } public void setTime(String time) { this.time = time; } public float getAmmount() { return ammount; } public void setAmmount(float ammount) { this.ammount = ammount; } } public class Clouds { private int perc; public int getPerc() { return perc; } public void setPerc(int perc) { this.perc = perc; } } }
[ "olpitkin@gmail.com" ]
olpitkin@gmail.com
b912bc58e74a613e21d95e13850159570d9c9455
b257df0bb0dcfbf2c095e350203007e55722c908
/app/src/main/java/radio/sa/com/oir_dev_3/List_Activity.java
311a2b57470ca5c11095570485435b0242bfadc7
[]
no_license
SamLikesCoding/OIR_prototype_3
ef9df7dbde8989f5fa77dbbb353fc687708b3ed7
52f717178a4e9498a25514b85a841290864658ff
refs/heads/master
2020-03-23T14:33:58.015620
2018-10-24T16:07:49
2018-10-24T16:07:49
141,684,722
1
17
null
2019-10-31T16:11:00
2018-07-20T08:21:42
Java
UTF-8
Java
false
false
2,772
java
package radio.sa.com.oir_dev_3; import android.content.Intent; import android.database.Cursor; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.ListAdapter; import android.widget.ListView; import android.widget.Toast; import java.util.ArrayList; public class List_Activity extends AppCompatActivity { Button to_add; DB_Interface db; ListView the_list; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_list_); the_list = findViewById(R.id.ch_list); to_add = findViewById(R.id.to_add_page); db = new DB_Interface(this); to_add.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent to_edit_page = new Intent(List_Activity.this, Edit_Area.class); startActivity(to_edit_page); } }); fill_the_list(); } private void fill_the_list(){ Cursor channels = db.get_the_point(); ArrayList<Station> Ch_LIST = new ArrayList<>(); while (channels.moveToNext()){ Ch_LIST.add(new Station(channels.getString(1),channels.getString(2))); } PListAdapter listAdapter = new PListAdapter(this, R.layout.channel_node, Ch_LIST); the_list.setAdapter(listAdapter); the_list.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Station channel = (Station) parent.getItemAtPosition(position); String c_name = channel.getStation_name(); String c_url = channel.getStation_url(); Cursor data = db.get_channel_id(c_name); int Ch_ID = -1; while (data.moveToNext()){ Ch_ID = data.getInt(0); if (Ch_ID > -1){ Intent to_drw = new Intent(List_Activity.this,delete_or_rewrite.class); to_drw.putExtra("ID",Ch_ID); to_drw.putExtra("C_NAME",c_name); to_drw.putExtra("C_URL",c_url); startActivity(to_drw); } else{ toaster("Did not find anything "); } } } }); } private void toaster(String content){ Toast.makeText(this,content,Toast.LENGTH_SHORT).show(); } }
[ "sarathpeter@Saraths-MacBook-Air.local" ]
sarathpeter@Saraths-MacBook-Air.local
06fe54192010511754dc41080bac476f77047099
3368de9a5b2d449340e15caee2340621763912cd
/adapterlib/src/main/java/com/zhuangfei/adapterlib/activity/StationWebViewActivity.java
3ecdb7f7b50f56c7135387a6b2f4048f45dbc807
[ "MIT" ]
permissive
VenomBat/CourseAdapter
73ab598c30cb0b1df711172f2e24344b2c5ec8d0
85c94a102dad00051445ec02e552871cbbdddd45
refs/heads/master
2020-05-02T13:14:10.229903
2019-03-13T03:52:51
2019-03-13T03:52:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
15,966
java
package com.zhuangfei.adapterlib.activity; import android.annotation.SuppressLint; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.graphics.Color; import android.graphics.drawable.GradientDrawable; import android.net.Uri; import android.net.http.SslError; import android.os.Bundle; import android.support.v4.widget.ContentLoadingProgressBar; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.text.TextUtils; import android.util.Log; import android.view.Gravity; import android.view.View; import android.view.ViewGroup; import android.webkit.DownloadListener; import android.webkit.SslErrorHandler; import android.webkit.WebChromeClient; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.PopupWindow; import android.widget.TextView; import android.widget.Toast; import com.zhuangfei.adapterlib.activity.custom.CustomPopWindow; import com.zhuangfei.adapterlib.R; import com.zhuangfei.adapterlib.utils.ScreenUtils; import com.zhuangfei.adapterlib.station.StationManager; import com.zhuangfei.adapterlib.utils.ViewUtils; import com.zhuangfei.adapterlib.apis.TimetableRequest; import com.zhuangfei.adapterlib.apis.model.ListResult; import com.zhuangfei.adapterlib.apis.model.StationModel; import com.zhuangfei.adapterlib.station.StationSdk; import java.util.List; import java.util.Map; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; /** * ๆœๅŠก็ซ™ๅŠ ่ฝฝๅผ•ๆ“Ž * ๆš‚ๆ—ถไธๅฏ็”จ */ public class StationWebViewActivity extends AppCompatActivity { private static final String TAG = "StationWebViewActivity"; // wenviewไธŽๅŠ ่ฝฝๆก WebView webView; // ๆ ‡้ข˜ TextView titleTextView; String url,title; ContentLoadingProgressBar loadingProgressBar; TextView functionButton; // ๅฃฐๆ˜ŽPopupWindow private CustomPopWindow popupWindow; StationModel stationModel; public static final String EXTRAS_STATION_MODEL="station_model_extras"; LinearLayout rootLayout; List<StationModel> localStationModels; boolean haveLocal=false; int deleteId=-1; LinearLayout actionbarLayout; Map<String,String> configMap; ImageView moreImageView; ImageView closeImageView; LinearLayout buttonGroupLayout; View diverView;//ๅˆ†้š”็ซ–็บฟ int needUpdate=0; String[] textArray=null,linkArray=null; String tipText=null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); beforeSetContentView(); setContentView(R.layout.activity_station_web_view); initUrl(); initView(); loadWebView(); findStationLocal(); getStationById(); } private void initUrl() { url=StationManager.getRealUrl(stationModel.getUrl()); title=stationModel.getName(); needUpdate=0; } private void initView() { webView=findViewById(R.id.id_webview); moreImageView=findViewById(R.id.iv_station_more); diverView=findViewById(R.id.id_station_diver); buttonGroupLayout=findViewById(R.id.id_station_buttongroup); closeImageView=findViewById(R.id.iv_station_close); actionbarLayout=findViewById(R.id.id_station_action_bg); rootLayout=findViewById(R.id.id_station_root); titleTextView=findViewById(R.id.id_web_title); loadingProgressBar=findViewById(R.id.id_loadingbar); functionButton=findViewById(R.id.id_btn_function); titleTextView.setText(title); if(configMap!=null&&!configMap.isEmpty()){ try{ actionbarLayout.setBackgroundColor(Color.parseColor(configMap.get("actionColor"))); }catch (Exception e){} try{ int textcolor=Color.parseColor(configMap.get("actionTextColor")); titleTextView.setTextColor(textcolor); moreImageView.setColorFilter(textcolor); closeImageView.setColorFilter(textcolor); GradientDrawable gd=new GradientDrawable(); gd.setCornerRadius(ScreenUtils.dip2px(this,25)); gd.setStroke(2,textcolor); diverView.setBackgroundColor(textcolor); buttonGroupLayout.setBackgroundDrawable(gd); }catch (Exception e){} } functionButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { onButtonClicked(); } }); findViewById(R.id.id_station_close).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { finish(); } }); findViewById(R.id.id_station_more).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { showMorePopWindow(); } }); } private void beforeSetContentView() { stationModel= (StationModel) getIntent().getSerializableExtra(EXTRAS_STATION_MODEL); if(stationModel==null){ Toast.makeText(this,"ไผ ๅ‚ๅผ‚ๅธธ",Toast.LENGTH_SHORT).show(); finish(); } configMap= StationManager.getStationConfig(stationModel.getUrl()); if(configMap!=null&&!configMap.isEmpty()){ try{ ViewUtils.setStatusBarColor(this, Color.parseColor(configMap.get("statusColor"))); }catch (Exception e){} } } public void getStationById(){ if(needUpdate==0) return; TimetableRequest.getStationById(this, stationModel.getStationId(), new Callback<ListResult<StationModel>>() { @Override public void onResponse(Call<ListResult<StationModel>> call, Response<ListResult<StationModel>> response) { ListResult<StationModel> result = response.body(); if (result != null) { if (result.getCode() == 200) { showStationResult(result.getData()); } else { Toast.makeText(StationWebViewActivity.this, result.getMsg(), Toast.LENGTH_SHORT).show(); } } else { Toast.makeText(StationWebViewActivity.this, "station response is null!", Toast.LENGTH_SHORT).show(); } } @Override public void onFailure(Call<ListResult<StationModel>> call, Throwable t) { } }); } private void showStationResult(List<StationModel> result) { if (result == null||result.size()==0) return; final StationModel model=result.get(0); if(model!=null){ boolean update=false; if(model.getName()!=null&&!model.getName().equals(stationModel.getName())){ update=true; } if(model.getUrl()!=null&&!model.getUrl().equals(stationModel.getUrl())){ update=true; } if(model.getImg()!=null&&!model.getImg().equals(stationModel.getImg())){ update=true; } if(update){ // final StationModel local=DataSupport.find(StationModel.class,stationModel.getId()); // if(local!=null){ // local.setName(model.getName()); // local.setUrl(model.getUrl()); // local.setImg(model.getImg()); // local.update(stationModel.getId()); // } // // AlertDialog.Builder builder=new AlertDialog.Builder(this) // .setTitle("ๆœๅŠก็ซ™ๆ›ดๆ–ฐ") // .setMessage("ๆœฌๅœฐไฟๅญ˜็š„ๆœๅŠก็ซ™ๅทฒ่ฟ‡ๆœŸ๏ผŒ้œ€่ฆ้‡ๆ–ฐๅŠ ่ฝฝ") // .setPositiveButton("้‡ๆ–ฐๅŠ ่ฝฝ", new DialogInterface.OnClickListener() { // @Override // public void onClick(DialogInterface dialogInterface, int i) { // //todo post reload event // finish(); // } // }); // builder.create().show(); } } } /** * ่Žทๅ–ๆทปๅŠ ๅˆฐ้ฆ–้กต็š„ๆœๅŠก็ซ™ */ public void findStationLocal(){ // FindMultiExecutor findMultiExecutor=DataSupport.findAllAsync(StationModel.class); // findMultiExecutor.listen(new FindMultiCallback() { // @Override // public <T> void onFinish(List<T> t) { // List<StationModel> stationModels= (List<StationModel>) t; // if(localStationModels==null){ // localStationModels=new ArrayList<>(); // } // localStationModels.clear(); // localStationModels.addAll(stationModels); // haveLocal=searchInList(localStationModels,stationModel.getStationId()); // } // }); } public boolean searchInList(List<StationModel> list,int stationId){ if(list==null) return false; for(StationModel model:list){ if(model.getStationId()==stationId){ this.deleteId=model.getId(); return true; } } return false; } //ไธบๅผนๅ‡บ็ช—ๅฃๅฎž็Žฐ็›‘ๅฌ็ฑป private View.OnClickListener itemsOnClick = new View.OnClickListener() { public void onClick(View v) { if(v.getId()==R.id.pop_add_home){ if(haveLocal){ Toast.makeText(StationWebViewActivity.this,"ๅทฒไปŽไธป้กตๅˆ ้™ค",Toast.LENGTH_SHORT).show(); }else { if(localStationModels.size()>=15){ Toast.makeText(StationWebViewActivity.this,"ๅทฒ่พพๅˆฐๆœ€ๅคงๆ•ฐ้‡้™ๅˆถ15๏ผŒ่ฏทๅ…ˆๅˆ ้™คๅ…ถไป–ๆœๅŠก็ซ™ๅŽๅฐ่ฏ•",Toast.LENGTH_SHORT).show(); }else { Toast.makeText(StationWebViewActivity.this,"ๅทฒๆทปๅŠ ๅˆฐ้ฆ–้กต",Toast.LENGTH_SHORT).show(); } } findStationLocal(); } if(v.getId()==R.id.pop_add_home){ } if(v.getId()==R.id.pop_about){ if(stationModel!=null&&stationModel.getOwner()!=null){ Toast.makeText(StationWebViewActivity.this,stationModel.getOwner(),Toast.LENGTH_SHORT).show(); }else { Toast.makeText(StationWebViewActivity.this,"ๆ‰€ๆœ‰่€…ๆœช็Ÿฅ!",Toast.LENGTH_SHORT).show(); } } if(v.getId()==R.id.pop_to_home){ webView.clearHistory(); webView.loadUrl(stationModel.getUrl()); } popupWindow.dismiss(); } }; @SuppressLint("SetJavaScriptEnabled") private void loadWebView() { webView.loadUrl(url); WebSettings settings = webView.getSettings(); settings.setJavaScriptEnabled(true); settings.setDefaultTextEncodingName("gb2312"); settings.setCacheMode(WebSettings.LOAD_NO_CACHE); settings.setDomStorageEnabled(true); webView.addJavascriptInterface(new StationSdk(this,getStationSpace()), "sdk"); // settings.setSupportZoom(true); // settings.setBuiltInZoomControls(true); webView.setDownloadListener(new DownloadListener() { @Override public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) { Uri uri = Uri.parse(url); Intent intent = new Intent(Intent.ACTION_VIEW, uri); startActivity(intent); } }); webView.setWebViewClient(new WebViewClient(){ @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { Log.d(TAG, "shouldOverrideUrlLoading: "+url); webView.loadUrl(url); return true; } @Override public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) { handler.proceed(); } }); webView.setWebChromeClient(new WebChromeClient() { @Override public void onProgressChanged(WebView view, int newProgress) { super.onProgressChanged(view, newProgress); loadingProgressBar.setProgress(newProgress); if(newProgress==100) loadingProgressBar.hide(); else loadingProgressBar.show(); } @Override public void onReceivedTitle(WebView view, String title) { super.onReceivedTitle(view, title); // titleTextView.setText(title); } }); } @Override public void onBackPressed() { if (webView.canGoBack()) { webView.goBack(); } else { finish(); } } @Override protected void onDestroy() { if (webView!= null) { webView.loadDataWithBaseURL(null, "", "text/html", "utf-8", null); webView.clearHistory(); ((ViewGroup) webView.getParent()).removeView(webView); webView.destroy(); webView= null; } super.onDestroy(); } public void setButtonSettings(String btnText,String[] textArray,String[] linkArray){ if(TextUtils.isEmpty(btnText)) return; functionButton.setText(btnText); functionButton.setVisibility(View.VISIBLE); this.textArray=textArray; this.linkArray=linkArray; } @Override public void finish() { super.finish(); this.overridePendingTransition(R.anim.anim_station_static,R.anim.anim_station_close_activity); } /** * ๅผนๅ‡บpopupWindow */ public void showMorePopWindow() { popupWindow = new CustomPopWindow(StationWebViewActivity.this,haveLocal, itemsOnClick); popupWindow.showAtLocation(rootLayout, Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, 0); popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() { @Override public void onDismiss() { popupWindow.backgroundAlpha(StationWebViewActivity.this, 1f); } }); } public void showMessage(String msg){ Toast.makeText(this,msg,Toast.LENGTH_SHORT).show(); } public Context getStationContext(){ return this; } public WebView getWebView(){ return webView; } public String getStationSpace(){ return "station_space_"+stationModel.getStationId(); } public void setTitle(String title){ titleTextView.setText(title); } public void onButtonClicked(){ if(textArray==null||linkArray==null) return; if(textArray.length!=linkArray.length) return; AlertDialog.Builder builder=new AlertDialog.Builder(this) .setTitle("่ฏท้€‰ๆ‹ฉๅŠŸ่ƒฝ") .setItems(textArray, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { if(i<linkArray.length){ webView.loadUrl(linkArray[i]); } if(dialogInterface!=null){ dialogInterface.dismiss(); } } }); builder.create().show(); } }
[ "13937267417@139.com" ]
13937267417@139.com
84235e141aef5b7647eaf1686917e34d2a8faa28
5d277287370a6e7bd5a9aa7be089b56427c65f98
/core/src/com/github/kkysen/megamashbros/ai/JumpingAI.java
537e4dd768ea90a8aa6aff4852a9dad5c99ab12a
[ "Apache-2.0" ]
permissive
wertylop5/Mega-Mash-Bros
fa625dee746717358b267b6c4158d7d05dd89d3f
a8fad202cffb4b5b0531c2a3b204aa6a929bbf3e
refs/heads/master
2021-04-15T06:37:00.816976
2017-06-12T07:29:01
2017-06-12T07:29:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
498
java
package com.github.kkysen.megamashbros.ai; import com.badlogic.gdx.utils.Array; import com.github.kkysen.libgdx.util.keys.KeyBinding; import com.github.kkysen.megamashbros.core.Player; public class JumpingAI extends AI { @Override public void makeDecisions(final Player self, final Array<Player> enemies) { if ((cycle & cycles - 1) != 0) { return; // only run every AI#cycles game loops } pressKeys(KeyBinding.JUMP); } }
[ "kkysen@gmail.com" ]
kkysen@gmail.com
3b05fb648a9e13c4fedd6108e28dcabdbf5d823b
056ff5f928aec62606f95a6f90c2865dc126bddc
/javashop/shop-core/src/main/java/com/enation/app/shop/component/payment/plugin/alipay/sdk34/api/domain/AlipayOfflineMarketReportGetModel.java
ffb67e805e64379012004c023c52b47cde9315cf
[]
no_license
luobintianya/javashop
7846c7f1037652dbfdd57e24ae2c38237feb1104
ac15b14e8f6511afba93af60e8878ff44e380621
refs/heads/master
2022-11-17T11:12:39.060690
2019-09-04T08:57:58
2019-09-04T08:57:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,170
java
package com.enation.app.shop.component.payment.plugin.alipay.sdk34.api.domain; import com.enation.app.shop.component.payment.plugin.alipay.sdk34.api.AlipayObject; import com.enation.app.shop.component.payment.plugin.alipay.sdk34.api.internal.mapping.ApiField; /** * ่Žทๅ–ๅบ—้“บไฟกๆฏ * * @author auto create * @since 1.0, 2015-12-17 10:04:22 */ public class AlipayOfflineMarketReportGetModel extends AlipayObject { private static final long serialVersionUID = 8746896377618331274L; /** * ๆ“ไฝœไบบPID */ @ApiField("ope_pid") private String opePid; /** * ๅ…จๅฑ€ๅ”ฏไธ€็š„ๆตๆฐดๅท */ @ApiField("request_id") private String requestId; /** * ้—จๅบ—id */ @ApiField("shop_id") private String shopId; public String getOpePid() { return this.opePid; } public void setOpePid(String opePid) { this.opePid = opePid; } public String getRequestId() { return this.requestId; } public void setRequestId(String requestId) { this.requestId = requestId; } public String getShopId() { return this.shopId; } public void setShopId(String shopId) { this.shopId = shopId; } }
[ "sylow@javashop.cn" ]
sylow@javashop.cn
a7c874e73ca52658dde208d760f3f124db8684d5
54502ac83eb7a8b02c7e162321bf3cba1399f6f9
/app/src/main/java/com/mp/mpplayer/model/Album.java
eeeb34c21dd2fcc07a737240520a0efaad805f32
[]
no_license
bipin-adh/MP-Player
833d0817e20efeb91c96e0b5056d35ef3cd49635
4ff58d24de9c3e4d345ffb078474a4b7dd8e0995
refs/heads/master
2022-11-19T19:08:44.777656
2020-07-13T08:01:31
2020-07-13T08:01:31
198,020,743
1
0
null
null
null
null
UTF-8
Java
false
false
1,226
java
package com.mp.mpplayer.model; import java.io.Serializable; public class Album implements Serializable { String albumId; String artist; String album; String albumArt; String trackCount; public Album(String albumId, String artist, String album, String albumArt, String trackCount) { this.albumId = albumId; this.artist = artist; this.album = album; this.albumArt = albumArt; this.trackCount = trackCount; } public String getAlbumId() { return albumId; } public void setAlbumId(String albumId) { this.albumId = albumId; } public String getArtist() { return artist; } public void setArtist(String artist) { this.artist = artist; } public String getAlbum() { return album; } public void setAlbum(String album) { this.album = album; } public String getAlbumArt() { return albumArt; } public void setAlbumArt(String albumArt) { this.albumArt = albumArt; } public String getTrackCount() { return trackCount; } public void setTrackCount(String trackCount) { this.trackCount = trackCount; } }
[ "sthpuzan@gmail.com" ]
sthpuzan@gmail.com
e7fe82dec3a095161c8dc8f2a219f18ce4a944bb
f2d217a850ec1183ed8f7a35d334c5e09e6fd0a6
/src/main/java/edu/quipu/rrhh/services/implement/RotacionesServiceImpl.java
96ae8edcb4d209ba13c48bd98c4c8cab4454a4bd
[]
no_license
geiner/quipucamayoc2014
437454e2daad5d8d6d627c7f31cadef52332cbf1
2031f7b72078e7f7f270a2cdeecd611f88211143
refs/heads/master
2016-09-06T04:14:50.246294
2014-09-05T20:04:07
2014-09-05T20:04:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,216
java
package edu.quipu.rrhh.services.implement; import edu.quipu.rrhh.models.HistorialPlaza; import edu.quipu.rrhh.models.PlazaCAP; import edu.quipu.rrhh.persistence.RotacionesMapper; import edu.quipu.rrhh.services.RotacionesService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Service public class RotacionesServiceImpl implements RotacionesService { @Autowired RotacionesMapper rotacionesMapper; @Override public List<PlazaCAP> plazasAsignadasPorServidor(String codSer) { return rotacionesMapper.plazasAsignadasPorServidor(codSer); } @Override public List<HistorialPlaza> historialPlaza(String codPlaza) { System.out.print("SericeImpl"); return rotacionesMapper.historialPlaza(codPlaza); } @Override public void eliminarHistorialPlaza(HistorialPlaza obj) { rotacionesMapper.eliminarHistorialPlaza(obj.getIdHistorialPlaza()); } @Override public void addItemHistorialPlaza(HistorialPlaza obj) { rotacionesMapper.addItemHistorialPlaza(obj.getCodPlaza(),obj.getFechaRotacion(),obj.getDepActual(),obj.getNroDocu()); } }
[ "xtr3msoft@gmail.com" ]
xtr3msoft@gmail.com
46ae6a305828995b1bdbf22c8e6c8b76efee9277
9dc886bc865923f70fa61d02429e87f24c68adc4
/simple-video-panel/src/main/java/pub/androidrubick/litevideo/panel/widget/ScaleType.java
80f77a4930e06cc580b0ff0f40b7e2a6a4071346
[ "Apache-2.0" ]
permissive
bblue000/lite-video
9398d265e9f426e3c526488303d11dd4852c40dc
e0f711eecb6ec0d9b247f5dae15822763459ae9b
refs/heads/master
2020-12-23T20:04:18.686144
2017-06-02T07:50:27
2017-06-02T07:50:27
92,568,205
0
0
null
null
null
null
UTF-8
Java
false
false
1,083
java
package pub.androidrubick.litevideo.panel.widget; /** * ็ผฉๆ”พ็ฑปๅž‹ * * * <p/> * Created by Yin Yong on 2017/5/3. */ public enum ScaleType { /** * ๅฎฝ้ซ˜็ผฉๆ”พๅˆฐๆ‰€ๅฑž่ง†ๅ›พ็š„ๅฎž้™…ๅฎฝ้ซ˜; * * fit full area of target view. */ FIT_XY, /** * ็ผฉๆ”พ, ไฟๆŒๅŽŸๆฅ็š„ๆฏ”ไพ‹, ไฝฟๅพ—ๅฎฝๅบฆๆˆ–่€…้ซ˜ๅบฆไธญๆŸไธ€้กนๅกซๅ……ๆปก่ง†ๅ›พ็š„ๅฎฝ/้ซ˜ */ FIT_CENTER, /** * Scale the image/subview uniformly (maintain the image/subview's aspect ratio) so * that both dimensions (width and height) of the image/subview will be equal * to or less than the corresponding dimension of the view * (minus padding). The image/subview is then centered in the view. */ CENTER_INSIDE, /** * Scale the image/subview uniformly (maintain the image's aspect ratio) so * that both dimensions (width and height) of the image/subview will be equal * to or larger than the corresponding dimension of the view * (minus padding). The image/subview is then centered in the view. */ CENTER_CROP; }
[ "yy15151877621@126.com" ]
yy15151877621@126.com
27ad0020afeb3fdf7b87b2306c154ab1bc388663
14a5d365e6c2cc3536d57cd86ed80d0f23e16ae1
/aula04/tarde/tinder-evolution/src/main/java/br/com/cwi/tinderevolution/dominio/usuario/Usuario.java
a84a061acb5db777953d756ccf66c3c6f8ed60bc
[]
no_license
TheisenLucas/reset-01
f6044401ff395147eff23f88601cfda7c8ea29f0
802e34866bfa4f1d2da7b30f2d31bd424b1e018f
refs/heads/master
2021-02-27T20:37:55.439280
2020-04-05T17:28:05
2020-04-05T17:28:05
245,634,373
0
0
null
null
null
null
UTF-8
Java
false
false
2,559
java
package br.com.cwi.tinderevolution.dominio.usuario; import java.time.LocalDate; public class Usuario { // Dados de Usuรกrio: // Id // Nome // Email // Telefone // Data de Nascimento // Bio // Localizaรงรฃo: // Latitude // Longitude private int id; private String nome; private String email; private String telefone; private LocalDate dataNascimento; private String biografia; private Double latitude; private Double longitude; public Usuario(String nome, String email, String telefone, LocalDate dataNascimento, String biografia, Double latitude, Double longitude) { this.nome = nome; this.email = email; this.telefone = telefone; this.dataNascimento = dataNascimento; this.biografia = biografia; this.latitude = latitude; this.longitude = longitude; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getTelefone() { return telefone; } public void setTelefone(String telefone) { this.telefone = telefone; } public LocalDate getDataNascimento() { return dataNascimento; } public void setDataNascimento(LocalDate dataNascimento) { this.dataNascimento = dataNascimento; } public String getBiografia() { return biografia; } public void setBiografia(String biografia) { this.biografia = biografia; } public Double getLatitude() { return latitude; } public void setLatitude(Double latitude) { this.latitude = latitude; } public Double getLongitude() { return longitude; } public void setLongitude(Double longitude) { this.longitude = longitude; } @Override public String toString() { return "Dados do Usuario>" + "id=" + id + ", Nome='" + nome + '\'' + ", Email='" + email + '\'' + ", Telefone='" + telefone + '\'' + ", Data de Nascimento=" + dataNascimento + ", Biografia='" + biografia + '\'' + ", Latitude=" + latitude + ", Longitude=" + longitude + '>'; } }
[ "lucas.theisen@hotmail.com" ]
lucas.theisen@hotmail.com
b3006b9abafca6b99eef475172d6efa2f0ebde04
5b1fefaafc4a6bab8da0ec25fce585ef36f99602
/src/main/java/com/tiagomac/services/exceptions/ObjectNotFoundException.java
8f56237fc4072e8795c4186d5cf7ef01743c1856
[]
no_license
tiagomac/conceptmodel
1f63f8bf1c62892f0f6c01b83cb5c7bb1f1276bb
81e375c8faaf9905fe8108279eb3e1c7677a63b2
refs/heads/master
2021-06-28T19:08:22.360593
2018-09-13T22:56:51
2018-09-13T22:56:51
135,347,365
0
0
null
null
null
null
UTF-8
Java
false
false
313
java
package com.tiagomac.services.exceptions; public class ObjectNotFoundException extends RuntimeException { private static final long serialVersionUID = 1L; public ObjectNotFoundException(String msg) { super(msg); } public ObjectNotFoundException(String arg0, Throwable arg1) { super(arg0, arg1); } }
[ "tiagomac@gmail.com" ]
tiagomac@gmail.com
0a3ac68dd2633cf1180cd43534981d380ba73498
17c188ad3b17b849cce0734f59c9e4d58676cd89
/metastore/src/test/java/org/apache/hop/metastore/test/MetaStoreFactoryTest.java
8cc1f9e491e0312b39b7cb7a17caafeab1c42001
[ "Apache-2.0" ]
permissive
voutilad/hop
9b61bd4c8622b60e0c497c8e5ff910081b353007
14e712b3d404a9fd494d0a83df04f4fc18aa102b
refs/heads/master
2022-07-02T23:55:57.865399
2020-05-05T21:28:46
2020-05-05T21:28:46
260,455,813
0
0
Apache-2.0
2020-05-01T12:38:00
2020-05-01T12:37:59
null
UTF-8
Java
false
false
24,537
java
/*! ****************************************************************************** * * Hop : The Hop Orchestration Platform * * http://www.project-hop.org * ******************************************************************************* * * 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. * ******************************************************************************/ /*! * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2002-2017 Hitachi Vantara.. All rights reserved. */ package org.apache.hop.metastore.test; import junit.framework.TestCase; import org.apache.hop.metastore.api.IMetaStore; import org.apache.hop.metastore.api.IMetaStoreAttribute; import org.apache.hop.metastore.api.IMetaStoreElement; import org.apache.hop.metastore.api.IMetaStoreElementType; import org.apache.hop.metastore.api.exceptions.MetaStoreException; import org.apache.hop.metastore.persist.IMetaStoreObjectFactory; import org.apache.hop.metastore.persist.MetaStoreElementType; import org.apache.hop.metastore.persist.MetaStoreFactory; import org.apache.hop.metastore.stores.memory.MemoryMetaStore; import org.apache.hop.metastore.test.testclasses.cube.Cube; import org.apache.hop.metastore.test.testclasses.cube.Dimension; import org.apache.hop.metastore.test.testclasses.cube.DimensionAttribute; import org.apache.hop.metastore.test.testclasses.cube.DimensionType; import org.apache.hop.metastore.test.testclasses.cube.Kpi; import org.apache.hop.metastore.test.testclasses.factory.A; import org.apache.hop.metastore.test.testclasses.factory.B; import org.apache.hop.metastore.test.testclasses.factory_shared.X; import org.apache.hop.metastore.test.testclasses.factory_shared.Y; import org.apache.hop.metastore.test.testclasses.my.MyElement; import org.apache.hop.metastore.test.testclasses.my.MyElementAttr; import org.apache.hop.metastore.test.testclasses.my.MyFilenameElement; import org.apache.hop.metastore.test.testclasses.my.MyMigrationElement; import org.apache.hop.metastore.test.testclasses.my.MyNameElement; import org.apache.hop.metastore.test.testclasses.my.MyOtherElement; import org.apache.hop.metastore.util.MetaStoreUtil; import org.junit.Test; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.atomic.AtomicInteger; import static org.mockito.Matchers.anyMap; import static org.mockito.Matchers.anyObject; import static org.mockito.Matchers.anyString; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; public class MetaStoreFactoryTest extends TestCase { public static final String PASSWORD = "my secret password"; public static final String ANOTHER = "2222222"; public static final String ATTR = "11111111"; public static final String NAME = "one"; public static final int INT = 3; public static final long LONG = 4; public static final boolean BOOL = true; public static final Date DATE = new Date(); public static final int NR_ATTR = 10; public static final int NR_NAME = 5; public static final int NR_FILENAME = 5; @Test public void testIDMigration() throws Exception { String pipelineName = "Pipeline Name"; String transformName = "Transform Name"; String elementName = "migration"; String hostName = "Host Name"; String fieldMappings = "Field Mappings"; String sourceFieldName = "Source Field Name"; String targetFieldName = "Target Field Name"; String parameterName = "Parameter Name"; IMetaStore metaStore = new MemoryMetaStore(); MetaStoreFactory<MyMigrationElement> factory = new MetaStoreFactory<MyMigrationElement>( MyMigrationElement.class, metaStore ); MetaStoreElementType elementTypeAnnotation = MyMigrationElement.class.getAnnotation( MetaStoreElementType.class ); // Make sure the element type exists... IMetaStoreElementType elementType = metaStore.getElementTypeByName( elementTypeAnnotation.name() ); if ( elementType == null ) { elementType = metaStore.newElementType(); elementType.setName( elementTypeAnnotation.name() ); elementType.setDescription( elementTypeAnnotation.description() ); metaStore.createElementType( elementType ); } // Create an element with the old keys we want to migrate IMetaStoreElement element = metaStore.newElement(); element.setName( elementName ); element.setElementType( elementType ); element.addChild( metaStore.newAttribute( MyMigrationElement.MY_MIGRATION_PIPELINE_NAME, pipelineName ) ); element.addChild( metaStore.newAttribute( MyMigrationElement.MY_MIGRATION_TRANSFORM_NAME, transformName ) ); element.addChild( metaStore.newAttribute( MyMigrationElement.MY_MIGRATION_HOST_NAME, hostName ) ); element.addChild( metaStore.newAttribute( MyMigrationElement.MY_MIGRATION_FIELD_MAPPINGS, fieldMappings ) ); element.addChild( metaStore.newAttribute( MyMigrationElement.MY_MIGRATION_SOURCE_FIELD_NAME, sourceFieldName ) ); element.addChild( metaStore.newAttribute( MyMigrationElement.MY_MIGRATION_TARGET_FIELD_NAME, targetFieldName ) ); element.addChild( metaStore.newAttribute( MyMigrationElement.MY_MIGRATION_PARAMETER_NAME, parameterName ) ); metaStore.createElement( elementType, element ); MyMigrationElement loadedElement = factory.loadElement( elementName ); assertNotNull( loadedElement ); assertEquals( loadedElement.getPipelineName(), pipelineName ); assertEquals( loadedElement.getTransformName(), transformName ); assertEquals( loadedElement.getHostname(), hostName ); assertEquals( loadedElement.getFieldMappings(), fieldMappings ); assertEquals( loadedElement.getSourceFieldName(), sourceFieldName ); assertEquals( loadedElement.getTargetFieldName(), targetFieldName ); assertEquals( loadedElement.getParameterName(), parameterName ); // Test the variation of the transform name id element = metaStore.newElement(); element.setName( elementName ); element.setElementType( elementType ); element.addChild( metaStore.newAttribute( MyMigrationElement.MY_MIGRATION_TRANSFORM_NAME, transformName ) ); metaStore.createElement( elementType, element ); loadedElement = factory.loadElement( elementName ); assertNotNull( loadedElement ); assertEquals( loadedElement.getTransformName(), transformName ); } @Test public void testMyElement() throws Exception { IMetaStore metaStore = new MemoryMetaStore(); // List of named elements... // List<MyNameElement> nameList = new ArrayList<MyNameElement>(); for ( int i = 0; i < NR_NAME; i++ ) { nameList.add( new MyNameElement( "name" + i, "description" + i, "color" + i ) ); } List<MyFilenameElement> filenameList = new ArrayList<MyFilenameElement>(); for ( int i = 0; i < NR_FILENAME; i++ ) { filenameList.add( new MyFilenameElement( "filename" + i, "size" + i, "gender" + i ) ); } // Construct our test element... // MyElement me = new MyElement( NAME, ATTR, ANOTHER, PASSWORD, INT, LONG, BOOL, DATE ); for ( int i = 0; i < NR_ATTR; i++ ) { me.getSubAttributes().add( new MyElementAttr( "key" + i, "value" + i, "desc" + i ) ); } me.setNameElement( nameList.get( NR_NAME - 1 ) ); me.setFilenameElement( filenameList.get( NR_FILENAME - 1 ) ); List<String> stringList = Arrays.asList( "a", "b", "c", "d" ); me.setStringList( stringList ); MyOtherElement myOtherElement = new MyOtherElement( "other", "other attribute" ); me.setMyOtherElement( myOtherElement ); MetaStoreFactory<MyOtherElement> otherFactory = new MetaStoreFactory<>( MyOtherElement.class, metaStore ); MetaStoreFactory<MyElement> factory = new MetaStoreFactory<>( MyElement.class, metaStore ); // For loading, specify the name, filename lists or factory that we're referencing... // factory.addNameList( MyElement.LIST_KEY_MY_NAMES, nameList ); factory.addFilenameList( MyElement.LIST_KEY_MY_FILENAMES, filenameList ); factory.addNameFactory( MyElement.FACTORY_OTHER_ELEMENT, otherFactory ); // Store the class in the meta store // factory.saveElement( me ); // Load the class from the meta store // MyElement verify = factory.loadElement( NAME ); // Verify list element details... // IMetaStoreElement element = metaStore.getElementByName( factory.getElementType(), NAME ); assertNotNull( element ); // Verify the general idea // assertNotNull( verify ); assertEquals( ATTR, verify.getMyAttribute() ); assertEquals( ANOTHER, verify.getAnotherAttribute() ); assertEquals( PASSWORD, verify.getPasswordAttribute() ); assertEquals( INT, verify.getIntAttribute() ); assertEquals( LONG, verify.getLongAttribute() ); assertEquals( BOOL, verify.isBoolAttribute() ); assertEquals( DATE, verify.getDateAttribute() ); assertEquals( me.getSubAttributes().size(), verify.getSubAttributes().size() ); assertEquals( me.getNameElement(), verify.getNameElement() ); assertEquals( me.getFilenameElement(), verify.getFilenameElement() ); // verify the details... // IMetaStoreElementType elementType = factory.getElementType(); assertNotNull( elementType ); assertEquals( "My element type", elementType.getName() ); assertEquals( "This is my element type", elementType.getDescription() ); assertNotNull( element ); IMetaStoreAttribute child = element.getChild( "my_attribute" ); assertNotNull( child ); assertEquals( ATTR, MetaStoreUtil.getAttributeString( child ) ); child = element.getChild( "passwordAttribute" ); assertNotNull( child ); assertNotSame( "Password needs to be encoded", PASSWORD, MetaStoreUtil.getAttributeString( child ) ); child = element.getChild( "anotherAttribute" ); assertNotNull( child ); assertEquals( ANOTHER, MetaStoreUtil.getAttributeString( child ) ); // Verify the child attributes as well... // This also verifies that the attributes are in the right order. // The list can't be re-ordered after loading. // for ( int i = 0; i < NR_ATTR; i++ ) { MyElementAttr attr = verify.getSubAttributes().get( i ); assertEquals( "key" + i, attr.getKey() ); assertEquals( "value" + i, attr.getValue() ); assertEquals( "desc" + i, attr.getDescription() ); } // Verify the referenced MyOtherElement // MyOtherElement verifyOtherElement = verify.getMyOtherElement(); assertNotNull( verifyOtherElement ); assertEquals( myOtherElement.getName(), verifyOtherElement.getName() ); assertEquals( myOtherElement.getSomeAttribute(), verifyOtherElement.getSomeAttribute() ); // verify that the String list is loaded... List<String> verifyList = verify.getStringList(); assertEquals( stringList.size(), verifyList.size() ); for ( int i = 0; i < stringList.size(); i++ ) { assertEquals( stringList.get( i ), verifyList.get( i ) ); } List<String> names = factory.getElementNames(); assertEquals( 1, names.size() ); assertEquals( NAME, names.get( 0 ) ); List<MyElement> list = factory.getElements(); assertEquals( 1, list.size() ); assertEquals( NAME, list.get( 0 ).getName() ); factory.deleteElement( NAME ); assertEquals( 0, factory.getElementNames().size() ); assertEquals( 0, factory.getElements().size() ); } @Test public void testFactoryShared() throws Exception { IMetaStore metaStore = new MemoryMetaStore(); MetaStoreFactory<A> factoryA = new MetaStoreFactory<A>( A.class, metaStore ); MetaStoreFactory<B> factoryB = new MetaStoreFactory<B>( B.class, metaStore ); factoryA.addNameFactory( A.FACTORY_B, factoryB ); // Construct test-class A a = new A( "a" ); a.getBees().add( new B( "1", true ) ); a.getBees().add( new B( "2", true ) ); a.getBees().add( new B( "3", false ) ); a.getBees().add( new B( "4", true ) ); a.setB( new B( "b", false ) ); factoryA.saveElement( a ); // 1, 2, 4 // assertEquals( 3, factoryB.getElements().size() ); A _a = factoryA.loadElement( "a" ); assertNotNull( _a ); assertEquals( 4, _a.getBees().size() ); assertEquals( "1", a.getBees().get( 0 ).getName() ); assertEquals( true, a.getBees().get( 0 ).isShared() ); assertEquals( "2", a.getBees().get( 1 ).getName() ); assertEquals( true, a.getBees().get( 1 ).isShared() ); assertEquals( "3", a.getBees().get( 2 ).getName() ); assertEquals( false, a.getBees().get( 2 ).isShared() ); assertEquals( "4", a.getBees().get( 3 ).getName() ); assertEquals( true, a.getBees().get( 3 ).isShared() ); assertNotNull( _a.getB() ); assertEquals( "b", _a.getB().getName() ); assertEquals( false, _a.getB().isShared() ); } @Test public void testFactory() throws Exception { IMetaStore metaStore = new MemoryMetaStore(); MetaStoreFactory<X> factoryX = new MetaStoreFactory<X>( X.class, metaStore ); MetaStoreFactory<Y> factoryY = new MetaStoreFactory<Y>( Y.class, metaStore ); factoryX.addNameFactory( X.FACTORY_Y, factoryY ); // Construct test-class X x = new X( "x" ); x.getYs().add( new Y( "1", "desc1" ) ); x.getYs().add( new Y( "2", "desc2" ) ); x.getYs().add( new Y( "3", "desc3" ) ); x.getYs().add( new Y( "4", "desc4" ) ); x.setY( new Y( "y", "descY" ) ); factoryX.saveElement( x ); // 1, 2, 3, 4, y // assertEquals( 5, factoryY.getElements().size() ); X _x = factoryX.loadElement( "x" ); assertNotNull( _x ); assertEquals( 4, _x.getYs().size() ); assertEquals( "1", x.getYs().get( 0 ).getName() ); assertEquals( "desc1", x.getYs().get( 0 ).getDescription() ); assertEquals( "2", x.getYs().get( 1 ).getName() ); assertEquals( "desc2", x.getYs().get( 1 ).getDescription() ); assertEquals( "3", x.getYs().get( 2 ).getName() ); assertEquals( "desc3", x.getYs().get( 2 ).getDescription() ); assertEquals( "4", x.getYs().get( 3 ).getName() ); assertEquals( "desc4", x.getYs().get( 3 ).getDescription() ); assertNotNull( _x.getY() ); assertEquals( "y", _x.getY().getName() ); assertEquals( "descY", _x.getY().getDescription() ); } /** * Save and load a complete Cube object in the IMetaStore through named references and factories. * Some object are saved through a factory with a name reference. One dimension is embedded in the cube. * * @throws Exception */ @SuppressWarnings( "unchecked" ) @Test public void testCube() throws Exception { IMetaStore metaStore = new MemoryMetaStore(); MetaStoreFactory<Cube> factoryCube = new MetaStoreFactory<Cube>( Cube.class, metaStore ); MetaStoreFactory<Dimension> factoryDimension = new MetaStoreFactory<Dimension>( Dimension.class, metaStore ); factoryCube.addNameFactory( Cube.DIMENSION_FACTORY_KEY, factoryDimension ); IMetaStoreObjectFactory objectFactory = mock( IMetaStoreObjectFactory.class ); factoryCube.setObjectFactory( objectFactory ); factoryDimension.setObjectFactory( objectFactory ); final AtomicInteger contextCount = new AtomicInteger( 0 ); when( objectFactory.getContext( anyObject() ) ).thenAnswer( new Answer<Object>() { @Override public Object answer( InvocationOnMock invocation ) throws Throwable { Map<String, String> context = new HashMap<>(); context.put( "context-num", String.valueOf( contextCount.getAndIncrement() ) ); return context; } } ); when( objectFactory.instantiateClass( anyString(), anyMap(), anyObject() ) ).thenAnswer( new Answer<Object>() { @Override public Object answer( InvocationOnMock invocation ) throws Throwable { String className = (String) invocation.getArguments()[ 0 ]; return Class.forName( className ).newInstance(); } } ); Cube cube = generateCube(); factoryCube.saveElement( cube ); // Now load back and verify... Cube verify = factoryCube.loadElement( cube.getName() ); assertEquals( cube.getName(), verify.getName() ); assertEquals( cube.getDimensions().size(), verify.getDimensions().size() ); for ( int i = 0; i < cube.getDimensions().size(); i++ ) { Dimension dimension = cube.getDimensions().get( i ); Dimension verifyDimension = verify.getDimensions().get( i ); assertEquals( dimension.getName(), verifyDimension.getName() ); assertEquals( dimension.getDimensionType(), verifyDimension.getDimensionType() ); assertEquals( dimension.getAttributes().size(), verifyDimension.getAttributes().size() ); for ( int x = 0; x < dimension.getAttributes().size(); x++ ) { DimensionAttribute attr = dimension.getAttributes().get( i ); DimensionAttribute attrVerify = verifyDimension.getAttributes().get( i ); assertEquals( attr.getName(), attrVerify.getName() ); assertEquals( attr.getDescription(), attrVerify.getDescription() ); assertEquals( attr.getSomeOtherStuff(), attrVerify.getSomeOtherStuff() ); } } assertEquals( cube.getKpis().size(), verify.getKpis().size() ); for ( int i = 0; i < cube.getKpis().size(); i++ ) { Kpi kpi = cube.getKpis().get( i ); Kpi verifyKpi = verify.getKpis().get( i ); assertEquals( kpi.getName(), verifyKpi.getName() ); assertEquals( kpi.getDescription(), verifyKpi.getDescription() ); assertEquals( kpi.getOtherDetails(), verifyKpi.getOtherDetails() ); } assertNotNull( verify.getJunkDimension() ); Dimension junk = cube.getJunkDimension(); Dimension junkVerify = verify.getJunkDimension(); assertEquals( junk.getName(), junkVerify.getName() ); assertEquals( junk.getAttributes().size(), junkVerify.getAttributes().size() ); for ( int i = 0; i < junk.getAttributes().size(); i++ ) { DimensionAttribute attr = junk.getAttributes().get( i ); DimensionAttribute attrVerify = junkVerify.getAttributes().get( i ); assertEquals( attr.getName(), attrVerify.getName() ); assertEquals( attr.getDescription(), attrVerify.getDescription() ); assertEquals( attr.getSomeOtherStuff(), attrVerify.getSomeOtherStuff() ); } assertNotNull( verify.getNonSharedDimension() ); Dimension nonShared = cube.getNonSharedDimension(); Dimension nonSharedVerify = verify.getNonSharedDimension(); assertEquals( nonShared.getName(), nonSharedVerify.getName() ); assertEquals( nonShared.getAttributes().size(), nonSharedVerify.getAttributes().size() ); for ( int i = 0; i < junk.getAttributes().size(); i++ ) { DimensionAttribute attr = nonShared.getAttributes().get( i ); DimensionAttribute attrVerify = nonSharedVerify.getAttributes().get( i ); assertEquals( attr.getName(), attrVerify.getName() ); assertEquals( attr.getDescription(), attrVerify.getDescription() ); assertEquals( attr.getSomeOtherStuff(), attrVerify.getSomeOtherStuff() ); } // Make sure that nonShared and product are not shared. // We can load them with the dimension factory and they should not come back. // assertNull( factoryDimension.loadElement( "analyticalDim" ) ); assertNull( factoryDimension.loadElement( "product" ) ); assertNotNull( verify.getMainKpi() ); assertEquals( cube.getMainKpi().getName(), verify.getMainKpi().getName() ); assertEquals( cube.getMainKpi().getDescription(), verify.getMainKpi().getDescription() ); assertEquals( cube.getMainKpi().getOtherDetails(), verify.getMainKpi().getOtherDetails() ); for ( int i = 0; i < contextCount.get(); i++ ) { Map<String, String> context = new HashMap<>(); context.put( "context-num", String.valueOf( i ) ); verify( objectFactory ).instantiateClass( anyString(), eq( context ), anyObject() ); } } private Cube generateCube() { Cube cube = new Cube(); cube.setName( "Fact" ); Dimension customer = new Dimension(); customer.setName( "customer" ); customer.setAttributes( generateAttributes() ); customer.setDimensionType( DimensionType.SCD ); cube.getDimensions().add( customer ); Dimension product = new Dimension(); product.setName( "product" ); product.setAttributes( generateAttributes() ); product.setDimensionType( null ); product.setShared( false ); cube.getDimensions().add( product ); Dimension date = new Dimension(); date.setName( "date" ); date.setAttributes( generateAttributes() ); date.setDimensionType( DimensionType.DATE ); cube.getDimensions().add( date ); Dimension junk = new Dimension(); junk.setName( "junk" ); junk.setAttributes( generateAttributes() ); junk.setDimensionType( DimensionType.JUNK ); cube.setJunkDimension( junk ); Dimension nonShared = new Dimension(); nonShared.setName( "analyticalDim" ); nonShared.setAttributes( generateAttributes() ); nonShared.setDimensionType( DimensionType.JUNK ); nonShared.setShared( false ); cube.setNonSharedDimension( nonShared ); cube.setKpis( generateKpis() ); Kpi mainKpi = new Kpi(); mainKpi.setName( "mainKpi-name" ); mainKpi.setDescription( "mainKpi-description" ); mainKpi.setOtherDetails( "mainKpi-otherDetails" ); cube.setMainKpi( mainKpi ); return cube; } public void testSanitizeName() throws Exception { IMetaStore metaStore = new MemoryMetaStore(); MetaStoreFactory<MyOtherElement> factory = new MetaStoreFactory<MyOtherElement>( MyOtherElement.class, metaStore ); MyOtherElement element = new MyOtherElement( null, ATTR ); try { factory.saveElement( element ); fail( "Saved illegal element (name == null)" ); } catch ( MetaStoreException e ) { assertNotNull( e ); } try { element.setName( "" ); factory.saveElement( element ); fail( "Saved illegal element (name.isEmpty())" ); } catch ( MetaStoreException e ) { assertNotNull( e ); } try { element.setName( " " ); factory.saveElement( element ); fail( "Saved illegal element (name.isEmpty())" ); } catch ( MetaStoreException e ) { assertNotNull( e ); } element.setName( NAME ); factory.saveElement( element ); assertEquals( Arrays.asList( NAME ), factory.getElementNames() ); } private List<Kpi> generateKpis() { List<Kpi> list = new ArrayList<Kpi>(); for ( int i = 0; i < 5; i++ ) { Kpi kpi = new Kpi(); kpi.setName( "kpi-" + ( i + 1 ) ); kpi.setDescription( "desc-" + ( i + 1 ) ); kpi.setOtherDetails( "othd-" + ( i + 1 ) ); } return list; } private List<DimensionAttribute> generateAttributes() { List<DimensionAttribute> list = new ArrayList<DimensionAttribute>(); for ( int i = 0; i < 10; i++ ) { DimensionAttribute attribute = new DimensionAttribute(); attribute.setName( "attr-" + ( i + 1 ) ); attribute.setDescription( "desc-" + ( i + 1 ) ); attribute.setSomeOtherStuff( "other" + ( i + 1 ) ); list.add( attribute ); } return list; } }
[ "mattcasters@gmail.com" ]
mattcasters@gmail.com
3ba928069fff00b866b7db896329698a0dd52881
b85d0ce8280cff639a80de8bf35e2ad110ac7e16
/com/fossil/csh.java
07bc954fdcfd59202a42fb891edfb42b3f8bed2b
[]
no_license
MathiasMonstrey/fosil_decompiled
3d90433663db67efdc93775145afc0f4a3dd150c
667c5eea80c829164220222e8fa64bf7185c9aae
refs/heads/master
2020-03-19T12:18:30.615455
2018-06-07T17:26:09
2018-06-07T17:26:09
136,509,743
1
0
null
null
null
null
UTF-8
Java
false
false
2,280
java
package com.fossil; import android.content.Context; import com.misfit.frameworks.common.enums.HTTPMethod; import com.misfit.frameworks.common.log.MFLogger; import com.misfit.frameworks.network.configuration.MFConfiguration; import com.misfit.frameworks.network.request.MFBaseRequest; import com.misfit.frameworks.network.responses.MFResponse; import com.portfolio.platform.data.model.microapp.SavedPreset; import com.portfolio.platform.response.microapp.MFUpsertPresetResponse; import java.util.ArrayList; import java.util.List; import org.json.JSONArray; import org.json.JSONObject; public class csh extends MFBaseRequest { private static final String TAG = csh.class.getSimpleName(); private List<SavedPreset> cCm; public csh(Context context, List<SavedPreset> list) { super(context); if (this.cCm == null) { this.cCm = new ArrayList(); } this.cCm.addAll(list); } protected Object initJsonData() { JSONObject jSONObject = new JSONObject(); JSONArray jSONArray = new JSONArray(); for (SavedPreset savedPreset : this.cCm) { JSONObject jSONObject2 = new JSONObject(); try { jSONObject2.put("createAt", savedPreset.getCreateAt()); jSONObject2.put("updatedAt", savedPreset.getUpdateAt()); jSONObject2.put("id", savedPreset.getId()); jSONObject2.put("name", savedPreset.getName()); jSONObject2.put("buttons", new JSONArray(savedPreset.getButtons())); } catch (Exception e) { e.printStackTrace(); } jSONArray.put(jSONObject2); MFLogger.m12670d(TAG, "initJsonData - json: " + jSONObject); } try { jSONObject.put("_items", jSONArray); } catch (Exception e2) { e2.printStackTrace(); } return jSONObject; } protected HTTPMethod initHttpMethod() { return HTTPMethod.PATCH; } protected MFResponse initResponse() { return new MFUpsertPresetResponse(); } protected MFConfiguration initConfiguration() { return dqn.bK(this.context); } protected String initApiMethod() { return "/user-presets"; } }
[ "me@mathiasmonstrey.be" ]
me@mathiasmonstrey.be
0981f74ae799c4c7d92d5ba680b370b8d499e3e5
cbeb953273dfbec9414f90794072fe4f0ec0e54a
/09/src/src/com/company/AbstractQueue.java
8e20992dd3726372dd9a8522e15455d4b58c3460
[]
no_license
Veronika-Kulichenko/LevelUpProjects
69b4b26db6948e425a00fa4c39db9b3ef5d26396
6ab990bb3d003db001e7c2b138c0c1ecd3b4f6d1
refs/heads/master
2020-04-02T03:15:40.065292
2017-01-04T20:29:37
2017-01-04T20:29:37
65,318,173
0
0
null
null
null
null
UTF-8
Java
false
false
423
java
package com.company; import java.util.Iterator; public abstract class AbstractQueue { abstract int size(); abstract boolean isEmpty(); abstract boolean isNotEmpty(); abstract Iterator<Node> iterator(); abstract Node[] toArray(); abstract boolean contains(Object o); abstract void add(Node node); abstract boolean offer(Node node); abstract Node poll(); abstract Node peek(); }
[ "alexandrshegeda@gmai.com" ]
alexandrshegeda@gmai.com
00ad9d4d834ae43b71823a4dfa43d571a3d3415c
c986434cb2c93adacc03f9b51883049d7865ecea
/m_news/src/main/java/com/example/m_news/manager/INewsDemoIDL.java
00751c8c81a687c2cf992986b72b078786074bfc
[]
no_license
CYF-66/HarmonyApp
5ea33a7b635190fdfb80a6d391e90026f67bd7c0
889341bd9b25a00d3a13772a3c6f9cc70550a097
refs/heads/master
2023-02-10T23:51:46.936502
2020-12-25T09:46:28
2020-12-25T09:46:28
323,569,256
1
0
null
null
null
null
UTF-8
Java
false
false
376
java
package com.example.m_news.manager; import ohos.rpc.IRemoteBroker; import ohos.rpc.RemoteException; /** * News demo */ public interface INewsDemoIDL extends IRemoteBroker { void tranShare( String deviceId, String shareUrl, String shareTitle, String shareAbstract, String shareImg) throws RemoteException; }
[ "chenyf45@centaline.com.cn" ]
chenyf45@centaline.com.cn
7d84700cf3fa29cbe3d227b8be30ace0e14a6145
bf420bef12c214bac7940d915b3d86de46cf49ff
/src/Model/SimulatedAnnealingAlgorithm.java
debd4377dc6bc233df6d12e39378c01f4a16b559
[]
no_license
mmLake/nQueenPuzzle
75057d295c5e9965a7be4d206a73e2575a152bed
103a1e8afe81f96f3441b91edadb91ff49d7b2a0
refs/heads/master
2020-03-14T22:30:08.364261
2018-05-06T18:00:54
2018-05-06T18:00:54
131,822,734
0
0
null
null
null
null
UTF-8
Java
false
false
2,090
java
package Model; import Controller.ChessBoardController; import java.util.Arrays; import java.util.Random; /** * Created by mayalake on 5/6/18. */ public class SimulatedAnnealingAlgorithm { private static final double MAX_STEPS = 5000; private Random random = new Random(); public SimulatedAnnealingAlgorithm(){ ChessBoard problem = new ChessBoard(); ChessBoard finalBoard = run(problem); System.out.println(Arrays.toString(finalBoard.getBoard()) + "\n" + finalBoard.getFitness() + "\n"); } private ChessBoard run(ChessBoard curBoard){ double totalSteps = 0; double temp = 1.0; while ((totalSteps < MAX_STEPS) && (curBoard.getFitness() < ChessBoardController.MAX_FITNESS)){ curBoard.setChessBoard(neighbor(curBoard, temp)); temp = Math.max(temp*.99, .0000000001); totalSteps++; } return curBoard; } private ChessBoard neighbor(ChessBoard curBoard, double temp){ int idx; int oldVal, newVal; int[] nextBoardTiles = curBoard.getBoard(); ChessBoard nextBoard = new ChessBoard(curBoard); while (true) { //generate random values idx = random.nextInt(ChessBoardController.CHESSBOARD_SIZE); newVal = random.nextInt(ChessBoardController.CHESSBOARD_SIZE); //set old and new values oldVal = nextBoardTiles[idx]; nextBoardTiles[idx] = newVal; //set new next board nextBoard.setBoard(nextBoardTiles); //set probability int dE = nextBoard.getFitness() - curBoard.getFitness(); double probability = Math.min(1, Math.exp(dE / temp)); //return board or reset tiles and continue while loop if (curBoard.getFitness() < nextBoard.getFitness()) { return nextBoard; } else if (probability > Math.random()) { return nextBoard; } else{ nextBoardTiles[idx] = oldVal; } } } }
[ "abcdcookiemonster@gmail.com" ]
abcdcookiemonster@gmail.com
4a2e20a51d2538de25d7d41facdfeef0a190298e
2bf4b149c58f0dbe23f1ad2791a69c64fce7cec0
/src/main/java/ru/lephant/learning/spring/SomeFirmWebFlow/workshop/service/WorkshopService.java
cf0315da6ead2c23a17d3d4f92486c5b3935c795
[]
no_license
lephant/SomeFirm
2d5283c3384e94fdb732055181db4d6b3b26fa57
c9608d21524fac2864738f516cb6fdf7ef9b5674
refs/heads/master
2020-06-30T23:34:20.954977
2017-01-26T19:44:39
2017-01-26T19:44:39
74,145,936
0
0
null
null
null
null
UTF-8
Java
false
false
948
java
package ru.lephant.learning.spring.SomeFirmWebFlow.workshop.service; import org.springframework.binding.message.MessageContext; import ru.lephant.learning.spring.SomeFirmWebFlow.entities.StorageContent; import ru.lephant.learning.spring.SomeFirmWebFlow.entities.StorageJournal; import ru.lephant.learning.spring.SomeFirmWebFlow.entities.Workshop; import java.util.ArrayList; import java.util.List; public interface WorkshopService { public List listWorkshop(); public List listWorkshopWithAbstractMainStorage(); public Workshop getWorkshopById(long id); public Workshop getLazyWorkshopById(long id); public boolean deleteWorkshop(long id, MessageContext messageContext); public void saveWorkshop(Workshop workshop, ArrayList<StorageJournal> noteList, ArrayList<StorageContent> storageContent, MessageContext messageContext); }
[ "levb97@yandex.ru" ]
levb97@yandex.ru
101b8f8ddc5af28f6517e7b56ff661bb87227e6a
ae5eb1a38b4d22c82dfd67c86db73592094edc4b
/project197/src/test/java/org/gradle/test/performance/largejavamultiproject/project197/p987/Test19756.java
e2e9aa04e8dce57f7fc3ca766b91fefb08da9dab
[]
no_license
big-guy/largeJavaMultiProject
405cc7f55301e1fd87cee5878a165ec5d4a071aa
1cd6a3f9c59e9b13dffa35ad27d911114f253c33
refs/heads/main
2023-03-17T10:59:53.226128
2021-03-04T01:01:39
2021-03-04T01:01:39
344,307,977
0
0
null
null
null
null
UTF-8
Java
false
false
2,181
java
package org.gradle.test.performance.largejavamultiproject.project197.p987; import org.junit.Test; import static org.junit.Assert.*; public class Test19756 { Production19756 objectUnderTest = new Production19756(); @Test public void testProperty0() { Production19753 value = new Production19753(); objectUnderTest.setProperty0(value); assertEquals(value, objectUnderTest.getProperty0()); } @Test public void testProperty1() { Production19754 value = new Production19754(); objectUnderTest.setProperty1(value); assertEquals(value, objectUnderTest.getProperty1()); } @Test public void testProperty2() { Production19755 value = new Production19755(); objectUnderTest.setProperty2(value); assertEquals(value, objectUnderTest.getProperty2()); } @Test public void testProperty3() { String value = "value"; objectUnderTest.setProperty3(value); assertEquals(value, objectUnderTest.getProperty3()); } @Test public void testProperty4() { String value = "value"; objectUnderTest.setProperty4(value); assertEquals(value, objectUnderTest.getProperty4()); } @Test public void testProperty5() { String value = "value"; objectUnderTest.setProperty5(value); assertEquals(value, objectUnderTest.getProperty5()); } @Test public void testProperty6() { String value = "value"; objectUnderTest.setProperty6(value); assertEquals(value, objectUnderTest.getProperty6()); } @Test public void testProperty7() { String value = "value"; objectUnderTest.setProperty7(value); assertEquals(value, objectUnderTest.getProperty7()); } @Test public void testProperty8() { String value = "value"; objectUnderTest.setProperty8(value); assertEquals(value, objectUnderTest.getProperty8()); } @Test public void testProperty9() { String value = "value"; objectUnderTest.setProperty9(value); assertEquals(value, objectUnderTest.getProperty9()); } }
[ "sterling.greene@gmail.com" ]
sterling.greene@gmail.com
a8ef488ddf4f096bccd3ba84dcf7e57e616dd464
c7d2dc4552e2e954efabaf1d5da8ba346dd1e6ee
/src/facebookCoding/MaximumSumNonAdjacentSequence.java
7fbb4f41add8b69872e618789089e9a99e6f4c3c
[]
no_license
shirleyyoung0812/Facebook
b457ecc97a524ccc01548ab78b570df2708cc112
cac2597af01b65f4c2895abc5ab51f864be903c0
refs/heads/master
2021-03-12T23:50:43.015767
2015-08-15T22:10:41
2015-08-15T22:10:41
29,643,114
0
1
null
null
null
null
UTF-8
Java
false
false
786
java
package facebookCoding; /** * FInd the maximum sum of a sub-sequence from an positive integer array where any two * numbers of sub-sequence are not adjacent to each other in the original sequence. * E.g 1 2 3 4 5 6 --> 2 4 6 * @author shirleyyoung * */ public class MaximumSumNonAdjacentSequence { public static int maxSum(int[] num) { if (num == null || num.length == 0) throw new IllegalArgumentException("Invalid input!"); int[] sum = new int[num.length]; sum[0] = num[0]; sum[1] = Math.max(num[0], num[1]); for (int i = 2; i < num.length; i++) { sum[i] = Math.max(sum[i - 1], sum[i - 2] + num[i]); } return sum[num.length - 1]; } public static void main(String[] args) { int[] num = {1, -1, 3, 5, 2, 0, 7}; System.out.println(maxSum(num)); } }
[ "yutian.yang.88@gmail.com" ]
yutian.yang.88@gmail.com
7785946c3115b7999c2d45f73d80158ffaa90da2
198fe8cceeb2025b7500ee149229bb4c36156b1d
/CrmPro/src/main/java/com/ujiuye/auth/bean/EmpRole.java
530a2909b6e6c0dff038a86ba2461acf0c88e11c
[]
no_license
beyond-zzy/Demo
8d93a4e2c137007c5b8b41fab6e04967a0a30f5c
8706be5dcd37cf720bdc1e4e5f22d2dd67f297ab
refs/heads/master
2022-12-23T00:28:44.918074
2020-08-05T13:35:37
2020-08-05T13:35:37
177,192,527
1
0
null
2022-12-16T11:33:38
2019-03-22T18:41:36
JavaScript
UTF-8
Java
false
false
745
java
package com.ujiuye.auth.bean; public class EmpRole { private Integer erid; private Integer empFk; private Integer roleFk; private String erdis; public Integer getErid() { return erid; } public void setErid(Integer erid) { this.erid = erid; } public Integer getEmpFk() { return empFk; } public void setEmpFk(Integer empFk) { this.empFk = empFk; } public Integer getRoleFk() { return roleFk; } public void setRoleFk(Integer roleFk) { this.roleFk = roleFk; } public String getErdis() { return erdis; } public void setErdis(String erdis) { this.erdis = erdis == null ? null : erdis.trim(); } }
[ "15824763204@163.com" ]
15824763204@163.com
9871e00412beb800d09ccb828118073cef6d2883
af678f9c4421f4cc3d6f8078da20a99a8d1407b1
/iBATIS_JPetStore-4.0.5/src/com/ibatis/jpetstore/persistence/sqlmapdao/ItemSqlMapDao.java
a09242749a32eda95891d86768b76ce677dd4129
[]
no_license
ZhangJunGuo1/ibatis
0ccdafaa3c1e04fd692dc8556b510c34fdaa297e
82a3e66cb34141683388cbc0183176c3c353b6e6
refs/heads/master
2023-03-19T22:25:38.007067
2021-03-20T06:49:18
2021-03-20T06:49:18
342,785,861
0
0
null
null
null
null
UTF-8
Java
false
false
1,589
java
/** * User: Clinton Begin * Date: Jul 13, 2003 * Time: 7:21:08 PM */ package com.ibatis.jpetstore.persistence.sqlmapdao; import com.ibatis.common.util.PaginatedList; import com.ibatis.dao.client.DaoManager; import com.ibatis.jpetstore.domain.Item; import com.ibatis.jpetstore.domain.LineItem; import com.ibatis.jpetstore.domain.Order; import com.ibatis.jpetstore.persistence.iface.ItemDao; import java.util.HashMap; import java.util.Map; public class ItemSqlMapDao extends BaseSqlMapDao implements ItemDao { public ItemSqlMapDao(DaoManager daoManager) { super(daoManager); } public void updateQuantity(Order order) { for (int i = 0; i < order.getLineItems().size(); i++) { LineItem lineItem = (LineItem) order.getLineItems().get(i); String itemId = lineItem.getItemId(); Integer increment = new Integer(lineItem.getQuantity()); Map param = new HashMap(2); param.put("itemId", itemId); param.put("increment", increment); update("updateInventoryQuantity", param); } } public boolean isItemInStock(String itemId) { Integer i = (Integer) queryForObject("getInventoryQuantity", itemId); return (i != null && i.intValue() > 0); } public PaginatedList getItemListByProduct(String productId) { return queryForPaginatedList("getItemListByProduct", productId, PAGE_SIZE); } public Item getItem(String itemId) { Integer i = (Integer) queryForObject("getInventoryQuantity", itemId); Item item = (Item) queryForObject("getItem", itemId); item.setQuantity(i.intValue()); return item; } }
[ "982237998@qq.com" ]
982237998@qq.com
78eb1ecc9b261510204084a762425262aab726b7
509cf4f51afb745ee0389b15c561cc0ec13c3019
/target/celerio-maven-plugin/collisions/src/main/generated-java/com/mycompany/myapp/domain/UseCase3_.java
7ca5f508acee831ffc457014e7b11a20f692a35e
[]
no_license
ajayanand10/warehouse-springboot-app
1ba107dc7c58d80a085064e55e0f361c5665fdcc
998da2830a71105fdd2fbdb240cb68be0d3b5f94
refs/heads/master
2021-01-24T00:27:41.264779
2018-03-02T07:35:29
2018-03-02T07:35:29
122,765,500
0
0
null
null
null
null
UTF-8
Java
false
false
830
java
/* * Project home: https://github.com/jaxio/celerio-angular-quickstart * * Source code generated by Celerio, an Open Source code generator by Jaxio. * Documentation: http://www.jaxio.com/documentation/celerio/ * Source code: https://github.com/jaxio/celerio/ * Follow us on twitter: @jaxiosoft * This header can be customized in Celerio conf... * Template pack-angular:src/main/java/domain/EntityMeta_.java.e.vm */ package com.mycompany.myapp.domain; import javax.persistence.metamodel.SingularAttribute; import javax.persistence.metamodel.StaticMetamodel; @StaticMetamodel(UseCase3.class) public abstract class UseCase3_ { // Composite primary key public static volatile SingularAttribute<UseCase3, UseCase3Pk> id; // Raw attributes public static volatile SingularAttribute<UseCase3, String> dummy; }
[ "ajayanand10@ajay.akhilis@gmail.com" ]
ajayanand10@ajay.akhilis@gmail.com
8a3ea1cc89b944e0727d207b7528c9b563d61495
968e401df9cb189f169f508a9f8dc9a5ff1ed099
/src/main/java/ch/parren/jdepchk/classes/ClassJarEntry.java
f1547c8460af4b77be0de9b30724a5bb8d08b2b6
[ "BSD-3-Clause" ]
permissive
parren/jdepchk
62b40fa0067f46dd0505001b891df4df4204166d
950b0a232246b3be4e2e0d4b704bc11c4026291f
refs/heads/master
2016-09-06T20:01:16.483089
2012-12-14T07:47:59
2012-12-14T07:47:59
38,260,257
0
0
null
null
null
null
UTF-8
Java
false
false
509
java
package ch.parren.jdepchk.classes; import java.io.IOException; import java.io.InputStream; import java.util.jar.JarEntry; import java.util.jar.JarFile; public class ClassJarEntry extends AbstractClassBytes { private final JarFile file; private final JarEntry entry; public ClassJarEntry(String name, JarFile file, JarEntry entry) { super(name); this.file = file; this.entry = entry; } @Override public InputStream inputStream() throws IOException { return file.getInputStream(entry); } }
[ "peter.arrenbrecht@gmail.com" ]
peter.arrenbrecht@gmail.com
0a5290133e213b14b506ebbc3efa4fb81907e851
4701b8c99b9ff4a281c78affeed37db67639a205
/app/src/main/java/com/idat/mototaxi/retrofit/RetrofitClient.java
5735216f6d6933f7abaf19a9bb3d34fd3c5ea51e
[]
no_license
diegomgt354/mototaxi
0ab0f4ab669958c7b195b8b3ff9d5faa3af5d723
7fc115788fb4fa10f1385ef619defb92d4e06e65
refs/heads/master
2023-03-03T20:35:38.854758
2021-02-10T01:26:22
2021-02-10T01:26:22
337,583,284
0
0
null
null
null
null
UTF-8
Java
false
false
787
java
package com.idat.mototaxi.retrofit; import retrofit2.Retrofit; import retrofit2.converter.gson.GsonConverterFactory; import retrofit2.converter.scalars.ScalarsConverterFactory; public class RetrofitClient { public static Retrofit getClient(String url){ Retrofit retrofit = new Retrofit.Builder() .baseUrl(url) .addConverterFactory(ScalarsConverterFactory.create()) .build(); return retrofit; } public static Retrofit getClientObject(String url){ Retrofit retrofit = new Retrofit.Builder() .baseUrl(url) .addConverterFactory(GsonConverterFactory.create()) .build(); return retrofit; } }
[ "idatazo123@gmail.com" ]
idatazo123@gmail.com
26904140392445306ddbdfc365f1af25003bbe8a
42053d2b5bafdbc075b8c13047e4ee0cfbab8142
/designmodel/src/main/java/com/choe/designmodel/singleton/Singleton4.java
d7b571b7e9020d6eb0c0aacf885c174e1da6cf0b
[]
no_license
Choe1027/Demo
a1a7c3d47550c83426bda308ecd8d0a92c001a64
5c7b636b5cbc58f399da1a576535c398cdda7211
refs/heads/master
2020-03-21T17:50:13.816713
2018-09-06T08:08:38
2018-09-06T08:08:38
138,856,925
0
0
null
null
null
null
UTF-8
Java
false
false
476
java
package com.choe.designmodel.singleton; /** * @author cyk * @date 2018/7/25/025 14:42 * @email choe0227@163.com * @desc ไฝฟ็”จ้™ๆ€ไปฃ็ ๅ—็š„ๆ–นๅผๆฅๅฎž็Žฐๅ•ไพ‹๏ผŒไธ€็งๅ˜็›ธ็š„ไผช้ฅฟๆฑ‰ๆจกๅผ๏ผŒ็บฟ็จ‹ๅฎ‰ๅ…จ * @modifier * @modify_time * @modify_remark */ public class Singleton4 { private static Singleton4 singleton; static { singleton = new Singleton4(); } public static Singleton4 getInstance(){ return singleton; } }
[ "348863046@qq.com" ]
348863046@qq.com
595050944ff0f1f1a529c256cbf2d3c5c2eb4fbf
f8426d9766cddc2b6be389add73386a5d9b05e5a
/fluentlenium-core/src/main/java/org/fluentlenium/core/label/FluentLabel.java
0682bb9dfa6c2cbd652144f71dbd006348d53565
[ "Apache-2.0" ]
permissive
wenceslas/FluentLenium
1876cce26cefaa3ef6c1b1342fa414b041ce7b5a
098586dc06af0ba86bcc0d9f1ce95b598a01f2c5
refs/heads/master
2022-12-05T16:15:20.964069
2020-08-14T13:45:44
2020-08-14T13:45:44
285,835,407
0
0
NOASSERTION
2020-08-07T13:26:57
2020-08-07T13:26:57
null
UTF-8
Java
false
false
691
java
package org.fluentlenium.core.label; /** * Apply label and label hints to element. * * @param <T> {@code this} class to chain method calls */ public interface FluentLabel<T> { /** * Apply a label that will be displayed as the representation of this object for error message. * * @param label label to use * @return reference to this object to chain calls */ T withLabel(String label); /** * Add a label hint that will be appended to the representation of this object for error message. * * @param labelHint label hints to add * @return reference to this object to chain calls */ T withLabelHint(String... labelHint); }
[ "toilal.dev@gmail.com" ]
toilal.dev@gmail.com
eaa05910b8a570701f5dd6b0513bea21524c0493
c47c33cd3369546330e98a00bf533bf723e91590
/src/main/java/mcjty/questutils/blocks/itemcomparator/ItemComparatorContainer.java
c57ee982c3dc8affcdfeb5c2c4177cd25d8e60c9
[ "MIT" ]
permissive
McJtyMods/QuestUtils
569910eae7972d8b5d2c632519ec5ebcf8093a03
bdfcc939169864c94a46aa9e0567e4d59b6f1186
refs/heads/master
2021-04-15T09:44:51.151943
2019-04-26T13:24:42
2019-04-26T13:24:42
126,376,457
1
0
null
null
null
null
UTF-8
Java
false
false
2,192
java
package mcjty.questutils.blocks.itemcomparator; import mcjty.lib.container.*; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.ClickType; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; public class ItemComparatorContainer extends GenericContainer { public static final String CONTAINER_INVENTORY = "container"; public static final int SLOT_MATCHER = 0; public static final int SLOT_INPUT = 4*4; public static final ContainerFactory factory = new ContainerFactory() { @Override protected void setup() { addSlotBox(new SlotDefinition(SlotType.SLOT_CONTAINER), CONTAINER_INVENTORY, SLOT_MATCHER, 12, 37, 4, 18, 4, 18); addSlotBox(new SlotDefinition(SlotType.SLOT_CONTAINER), CONTAINER_INVENTORY, SLOT_INPUT, 102, 37, 4, 18, 4, 18); layoutPlayerInventorySlots(12, 142); } }; public ItemComparatorContainer(EntityPlayer player, IInventory containerInventory) { super(factory); addInventory(CONTAINER_INVENTORY, containerInventory); addInventory(ContainerFactory.CONTAINER_PLAYER, player.inventory); generateSlots(); } @Override protected Slot createSlot(SlotFactory slotFactory, IInventory inventory, int index, int x, int y, SlotType slotType) { if (index >= 16 && index < 16+16) { return new BaseSlot(inventory, index, x, y) { @Override public boolean isItemValid(ItemStack stack) { if (!inventory.isItemValidForSlot(getSlotIndex(), stack)) { return false; } return super.isItemValid(stack); } }; } else { return super.createSlot(slotFactory, inventory, index, x, y, slotType); } } @Override public ItemStack slotClick(int index, int button, ClickType mode, EntityPlayer player) { ItemStack stack = super.slotClick(index, button, mode, player); ((ItemComparatorTE)getInventory(CONTAINER_INVENTORY)).detect(); return stack; } }
[ "mcjty1@gmail.com" ]
mcjty1@gmail.com
355005831f7bd33d240b01c80771427125a1860b
09da5f9357ff775f9120c99bb470ffc1a08325a9
/jpa.inheritance.joined/src/main/java/org/anderes/edu/jpa/inheritance/joined/NaturalPerson.java
1370658d0ca722974f5c6c1cbf72014eb27edc27
[ "Apache-2.0" ]
permissive
eismeraldo/edu
41f8195f955500ad4879d9e4beabd7817349b300
96f32c8704c36d36367fdf48a382818b8592a288
refs/heads/master
2021-01-16T18:48:21.202691
2016-06-23T10:26:13
2016-06-23T10:26:13
null
0
0
null
null
null
null
UTF-8
Java
false
false
597
java
package org.anderes.edu.jpa.inheritance.joined; import javax.persistence.Column; import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; import javax.persistence.Table; @Entity @Table(name = "NP") @DiscriminatorValue(value = "NP") public class NaturalPerson extends Person { private static final long serialVersionUID = 1L; private String lastname; @Column(name = "LASTNAME") public String getLastname() { return lastname; } public void setLastname(String lastname) { this.lastname = lastname; } }
[ "randeres@yahoo.de" ]
randeres@yahoo.de
1771a1c53e3bd75dbc8f35bbad2033619a195f17
88663c5ea7b964c41c036e861d8f8264e9f71894
/src/main/java/io/zipcoder/interfaces/Teacher.java
2e6e1a1ea34511be17786954318fe4a57b9c6992
[]
no_license
kavyamuppalla/Maven.LearnerLab
91be95b1b9b1a1267bf100bc31ef55e11c22daa2
68b9210efd94f7e767fd1e048bd2382168211f68
refs/heads/master
2020-06-05T19:53:00.099940
2019-06-23T15:34:54
2019-06-23T15:34:54
192,531,160
0
0
null
2019-06-18T11:58:40
2019-06-18T11:58:40
null
UTF-8
Java
false
false
177
java
package io.zipcoder.interfaces; public interface Teacher { void teach(Learner leaner, double numberOfHours); void lecture(Learner[] learners, double numberOfHours); }
[ "kavyamuppalla@gmail.com" ]
kavyamuppalla@gmail.com
b65dddf47b264160173f776a2969f275ed1edc41
e2c9b3b38b5decc263a64db41a0b5e6307521da8
/src/ua/com/privateplace/smsparser/SmsParserMessageManager.java
470a61729cf5ce6b409bfa9f7d39e44db92fae2c
[]
no_license
yolizarovich/SmsParser
5029fcf8efbc8be218935ccd571dd251bb65db41
05263d725dcde96b9c98494f501e43b7309a3ae4
refs/heads/master
2016-09-06T09:34:57.763202
2011-08-19T13:46:11
2011-08-19T13:46:11
2,160,405
0
1
null
null
null
null
UTF-8
Java
false
false
7,883
java
package ua.com.privateplace.smsparser; //ะปะพะฒะธั‚ัŒ ัะพะพะฑั‰ะตะฝะธะต ะพะฑ ัƒะดะฐะปะตะฝะธะธ ัะผั ั‡ะตั€ะตะท ัั‚ะฐะฝะดะฐั€ั‚ะฝั‹ะน ะฑั€ะฐะฒะทะตั€ //ะดะพะฑะฐะฒะธั‚ัŒ ะฟั€ะธะทะฝะฐะบ ัั‚ะฐั€ั‚ะฐ ะฐะบั‚ะธะฒะธั‚ะธ ะฟะพ ัะพะฑั‹ั‚ะธัŽ ะฝะพะฒะพะณะพ ัะผั ะฐ ะฝะต ั‡ะตั€ะตะท ัŽะทะตั€ะฐ import java.util.ArrayList; import java.util.regex.Matcher; import java.util.regex.Pattern; import android.content.ContentResolver; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.graphics.Color; import android.net.Uri; import android.text.Spannable; import android.text.style.ForegroundColorSpan; import android.text.style.StyleSpan; public class SmsParserMessageManager { public static final Uri SMS_CONTENT_URI = Uri.parse("content://sms"); public static final Uri SMS_INBOX_CONTENT_URI = Uri.withAppendedPath(SMS_CONTENT_URI, "inbox"); Pattern pBank = Pattern.compile(".*(OPLATA\\D*|BANKOMAT\\D*|KASSA\\D*).*(?:[\\D&&[^,.]])(\\d+[.,]?\\d*UAH).*(Bal:\\d+[.,]?\\d*)(?:.*|$)"); Pattern pPass = Pattern.compile("(?:^|.*Vhod|.*Parol).*(?:\\D)(\\d{8})(?:\\D|$)"); //Pattern pBank = Pattern.compile(".*(OPLATA\\D*|BANKOMAT\\D*|KASSA\\D*).*(?:[\\D&&[^,.]])(\\d+[.,]?\\d*UAH).*(Bal:\\d+[.,]?\\d*)(?:.*|$)"); //pass = Pattern.compile("(?:^|\\D*)(OPLATA\\D*|KASSA\\D*)(\\d+[.,]?\\d*UAH)(?:\\D*)(Bal:\\d+[.,]?\\d*)(?:\\D*|$)"); private ArrayList<SmsParserMessage> smsMessages = null; private Integer smsCount = 0; private Integer lasstRequestedMessage = -1; public void getUnreadMessages(Context context) { AppEx.v("getUnreadMessages(): "); SmsParserMessage message; final String[] projection = new String[] { "_id", "thread_id", "address", "date", "body", "read" }; String selection = "read in (0,1) and address = '10060'"; String[] selectionArgs = null; final String sortOrder = "date"; if (smsCount > 0) { String unn = ""; //selectionArgs = new String[smsCount]; selection += " and _id not in ("; for (int i = 0; i < smsCount; i++){ selection += unn + smsMessages.get(i).messageId; unn = ", "; } selection += ")"; AppEx.v(selection); } // Create cursor Cursor cursor = context.getContentResolver().query( SMS_INBOX_CONTENT_URI, projection, selection, selectionArgs, sortOrder); if (cursor != null) { try { int count = cursor.getCount(); if (count > 0) { if (smsMessages == null) smsMessages = new ArrayList<SmsParserMessage>(count); while (cursor.moveToNext()) { message = new SmsParserMessage(); message.messageId = cursor.getLong(0); message.threadId = cursor.getLong(1); message.fromAddress = cursor.getString(2); message.timestamp = cursor.getLong(3); message.messageBody = cursor.getString(4); message.isRead = cursor.getString(5).equalsIgnoreCase("1"); smsMessages.add(message); } } else AppEx.v("!!!!!!!!!!!!!!!!!!!!!!!----------------------------------------------> nothing new was found");; } finally { cursor.close(); } if (smsMessages != null) smsCount = smsMessages.size(); } } synchronized public void setMessageRead(Context context) { SmsParserMessage message; if (smsCount > 0 && lasstRequestedMessage >= 0 && lasstRequestedMessage < smsCount){ message = smsMessages.get(lasstRequestedMessage); if (!message.isRead ){ ContentValues values = new ContentValues(1); values.put("read", 1); Uri messageUri = Uri.withAppendedPath(SMS_CONTENT_URI, String.valueOf(message.messageId)); ContentResolver cr = context.getContentResolver(); int result; try { result = cr.update(messageUri, values, null, null); message.isRead = true; } catch (Exception e) { result = 0; } AppEx.v(String.format("message id = %s marked as read, result = %s", message.messageId, result )); }else AppEx.v(String.format("message WAS marked as read")); } } public void deleteCurrentMessage(Context context) { SmsParserMessage message; if (smsCount > 0 && lasstRequestedMessage >= 0 && lasstRequestedMessage < smsCount){ message = smsMessages.get(lasstRequestedMessage); AppEx.v("id of message to delete is " + message.messageId); // We need to mark this message read first to ensure the entire thread is marked as read setMessageRead(context); // Construct delete message uri Uri deleteUri; deleteUri = Uri.withAppendedPath(SMS_CONTENT_URI, String.valueOf(message.messageId)); int count = 0; try { count = context.getContentResolver().delete(deleteUri, null, null); } catch (Exception e) { AppEx.v("deleteMessage(): Problem deleting message - " + e.toString()); } AppEx.v("Messages deleted: " + count); if (count == 1) { deleteRequestedMessage(); //TODO: should only set the thread read if there are no more unread messages //setThreadRead(context, threadId); } } } /** * * @param i * number of sms message from 1 to SmsCount * * @return * sms message from manager list */ public SmsParserMessage getMessage(int i){ if (smsCount <= 0 && i >= smsCount && i <= 0 ) return null; lasstRequestedMessage = i - 1; return smsMessages.get(lasstRequestedMessage); } public SmsParserMessage getLastMessage(){ if (smsCount <= 0) return null; lasstRequestedMessage = smsCount - 1; return smsMessages.get(lasstRequestedMessage); } public SmsParserMessage getNextMessage(){ if (smsCount <= 0) return null; if (lasstRequestedMessage + 1 < smsCount){ lasstRequestedMessage ++; return smsMessages.get(lasstRequestedMessage); }else return null; } public SmsParserMessage getPrevMessage(){ if (smsCount <= 0) return null; if (lasstRequestedMessage - 1 >= 0 && lasstRequestedMessage < smsCount ){ lasstRequestedMessage --; return smsMessages.get(lasstRequestedMessage); }else return null; } public SmsParserMessage getCurrentMessage(){ if (smsCount <= 0 || lasstRequestedMessage >= smsCount || lasstRequestedMessage < 0 ) return null; return smsMessages.get(lasstRequestedMessage); } private void deleteRequestedMessage(){ SmsParserMessage message; AppEx.v("---- lasstRequestedMessage------" + lasstRequestedMessage); AppEx.v("---- smsCount------" + smsCount); if (smsCount > 0 && lasstRequestedMessage >= 0 && lasstRequestedMessage < smsCount){ message = smsMessages.get(lasstRequestedMessage); smsMessages.remove(message); if (smsMessages != null){ smsCount = smsMessages.size();}else {smsCount = 0;} if (lasstRequestedMessage >= smsCount) lasstRequestedMessage --; AppEx.v("---- lasstRequestedMessage2------" + lasstRequestedMessage); AppEx.v("---- smsCount2------" + smsCount); } } public void parse(Spannable str){ AppEx.v("===sp===PARSING==="); Matcher mt = pPass.matcher(str); while (mt.find()) { str.setSpan(new StyleSpan(android.graphics.Typeface.BOLD ), mt.start(1), mt.end(1), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); str.setSpan(new ForegroundColorSpan(Color.GREEN), mt.start(1), mt.end(1), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); } mt = pBank.matcher(str); while (mt.find()) { for (int i = 1;i<4;i++){ if (mt.group(i) != null){ str.setSpan(new StyleSpan(android.graphics.Typeface.BOLD), mt.start(i), mt.end(i), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); str.setSpan(new ForegroundColorSpan(Color.GREEN), mt.start(i), mt.end(i), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); } }} } public String getPositionInfo(){ if (smsCount <= 0 || lasstRequestedMessage >= smsCount || lasstRequestedMessage < 0 ) return "0/0"; return (lasstRequestedMessage +1) + "/" + smsCount; } }
[ "yurij.olizarovich@gmail.com" ]
yurij.olizarovich@gmail.com
a8fa47993fa804247592e76c99b6e6348602383b
1bb55e316b2882a64145c1f7b2fff0fb554276a1
/plugins/groovy/src/org/jetbrains/plugins/groovy/geb/GebPageMemberContributor.java
2cdebaeed83b930a9b6d72e0e7050c1ed082a9b8
[ "Apache-2.0" ]
permissive
dnkoutso/intellij-community
70109525a6ff1a5e8b39559dc12b27055373bbb8
b61f35ff2604cab5e4df217d9debdb656674a9b6
refs/heads/master
2021-01-16T20:57:03.721492
2012-12-10T21:31:21
2012-12-10T21:53:52
7,098,498
1
0
null
null
null
null
UTF-8
Java
false
false
3,159
java
package org.jetbrains.plugins.groovy.geb; import com.intellij.psi.*; import com.intellij.psi.scope.PsiScopeProcessor; import org.jetbrains.annotations.NotNull; import org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElement; import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrField; import org.jetbrains.plugins.groovy.lang.psi.api.statements.blocks.GrClosableBlock; import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrMethodCall; import org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.TypesUtil; import org.jetbrains.plugins.groovy.lang.resolve.NonCodeMembersContributor; import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil; import org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint; import java.util.Map; /** * @author Sergey Evdokimov */ public class GebPageMemberContributor extends NonCodeMembersContributor { @Override protected String getParentClassName() { return "geb.Page"; } @Override public void processDynamicElements(@NotNull PsiType qualifierType, PsiClass aClass, PsiScopeProcessor processor, GroovyPsiElement place, ResolveState state) { ClassHint classHint = processor.getHint(ClassHint.KEY); if (classHint != null && !classHint.shouldProcess(ClassHint.ResolveKind.PROPERTY)) return; PsiElement grCall = place.getParent(); if (grCall instanceof GrMethodCall) { PsiElement grClosure = grCall.getParent(); if (grClosure instanceof GrClosableBlock) { PsiElement contentField = grClosure.getParent(); if (contentField instanceof GrField) { GrField f = (GrField)contentField; if ("content".equals(f.getName()) && f.hasModifierProperty(PsiModifier.STATIC) && f.getContainingClass() == aClass) { Map<String, PsiField> elements = GebUtil.getContentElements(aClass); for (PsiField field : elements.values()) { if (field.getNavigationElement() == place) { return; // Don't resolve variable definition. } } } } } } processPageFields(processor, aClass, state); } public static boolean processPageFields(PsiScopeProcessor processor, @NotNull PsiClass pageClass, ResolveState state) { Map<String, PsiClass> supers = TypesUtil.getSuperClassesWithCache(pageClass); String nameHint = ResolveUtil.getNameHint(processor); for (PsiClass psiClass : supers.values()) { Map<String, PsiField> contentFields = GebUtil.getContentElements(psiClass); if (nameHint == null) { for (Map.Entry<String, PsiField> entry : contentFields.entrySet()) { if (!processor.execute(entry.getValue(), state)) return false; } } else { PsiField field = contentFields.get(nameHint); if (field != null) { return processor.execute(field, state); } } } return true; } }
[ "sergey.evdokimov@jetbrains.com" ]
sergey.evdokimov@jetbrains.com
5632d70c9a0e7bfe8c731b55f9bd2b6212c4dc3a
22cf2218d46edaa375f60b787db9064258afbd38
/src/main/java/ar/com/kfgodel/asql/impl/lang/indices/NameDefinedDropIndexImpl.java
e15402559aad6b9b36572bfc2c9eeec2588cc08d
[]
no_license
10Pines/agnostic-sql
2b210ed0e1dc6948005fcbfb0b64c890c0ef5f7b
6de19e2d3de147a65c931a4c5443fd6b94e19be2
refs/heads/master
2020-07-04T20:31:23.979404
2017-09-03T03:14:16
2017-09-03T03:14:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
873
java
package ar.com.kfgodel.asql.impl.lang.indices; import ar.com.kfgodel.asql.api.indices.DropIndexStatement; import ar.com.kfgodel.asql.api.indices.NameDefinedDropIndex; import ar.com.kfgodel.asql.impl.lang.Internal; import ar.com.kfgodel.asql.impl.lang.references.IndexReference; /** * Created by tenpines on 27/09/15. */ public class NameDefinedDropIndexImpl implements NameDefinedDropIndex { private IndexReference index; public IndexReference getIndex() { return index; } @Override public DropIndexStatement from(String tableName) { return DropIndexStatementImpl.create(this, Internal.table(tableName)); } public static NameDefinedDropIndexImpl create(IndexReference index){ NameDefinedDropIndexImpl dropIndex = new NameDefinedDropIndexImpl(); dropIndex.index = index; return dropIndex; } }
[ "kfgodel@gmail.com" ]
kfgodel@gmail.com
0153bf7dac33d9959f754492b4ada195695ba2f1
1a1af1445b66714b765e06e3e7685977712bd203
/src/main/java/cn/javass/spring/chapter3/helloworld/HelloImpl4.java
125bf89543eef244c0b2ef7e3de8d6273088fbee
[]
no_license
kaelsass/learn-spring
e793631fcd58c15a44d11460e364e549c0e81544
bd50be0dab08e5659e0b6c295ef96593d93e246a
refs/heads/master
2020-12-24T15:05:04.354353
2015-06-29T08:31:14
2015-06-29T08:31:14
38,042,180
0
0
null
null
null
null
UTF-8
Java
false
false
504
java
package cn.javass.spring.chapter3.helloworld; import cn.javass.spring.chapter2.helloworld.HelloApi; public class HelloImpl4 implements HelloApi{ private String message; private int index; public void sayHello() { System.out.println(index + " : " + message); } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public int getIndex() { return index; } public void setIndex(int index) { this.index = index; } }
[ "xing_x@mail.worksap.com" ]
xing_x@mail.worksap.com
01b1b287c5e24c38fdab0945e7d27134ddde8ebc
16bb0421048b9dfe280d432a100afbc57819353b
/Acme-Madruga/src/main/java/controllers/administrator/PositionAdministratorController.java
045bdd7676e535a170d42dd78b6222edd7cd8efb
[]
no_license
Alvcalgon/DP2
713f669b3f187594d0a0c5d0015695cbd3360ece
7943ca84f83dfedadd187821e28e470466be83d9
refs/heads/master
2020-04-22T21:38:57.432289
2019-03-31T11:00:07
2019-03-31T11:00:07
170,679,578
0
0
null
null
null
null
UTF-8
Java
false
false
5,556
java
package controllers.administrator; import java.util.Collection; import java.util.Locale; import java.util.SortedMap; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.DataIntegrityViolationException; import org.springframework.stereotype.Controller; import org.springframework.validation.BindingResult; 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.servlet.ModelAndView; import services.PositionService; import services.TranslationPositionService; import controllers.AbstractController; import domain.Position; import domain.TranslationPosition; import forms.PositionForm; @Controller @RequestMapping("/position/administrator") public class PositionAdministratorController extends AbstractController { @Autowired private PositionService positionService; @Autowired private TranslationPositionService translationPositionService; public PositionAdministratorController() { super(); } @RequestMapping(value = "/display", method = RequestMethod.GET) public ModelAndView display(@RequestParam final int positionId, final Locale locale) { ModelAndView result; TranslationPosition translationPosition; final String name; try { translationPosition = this.translationPositionService.findByLanguagePosition(positionId, locale.getLanguage()); name = translationPosition.getName(); result = new ModelAndView("position/display"); result.addObject("name", name); } catch (final Throwable oops) { result = new ModelAndView("redirect:/error.do"); } return result; } @RequestMapping(value = "/list", method = RequestMethod.GET) public ModelAndView list(final Locale locale) { ModelAndView result; Collection<Position> positions; SortedMap<Integer, String> mapa; positions = this.positionService.findAll(); mapa = this.positionService.positionsByLanguages(positions, locale.getLanguage()); result = new ModelAndView("position/list"); result.addObject("mapa", mapa); result.addObject("requestURI", "position/administrator/list.do"); return result; } @RequestMapping(value = "/create", method = RequestMethod.GET) public ModelAndView create(final Locale locale) { ModelAndView result; PositionForm positionForm; positionForm = new PositionForm(); result = this.createEditModelAndView(positionForm, locale); return result; } @RequestMapping(value = "/edit", method = RequestMethod.GET) public ModelAndView edit(@RequestParam final int positionId, final Locale locale) { final ModelAndView result; PositionForm positionForm; String en_name, es_name; en_name = this.translationPositionService.findByLanguagePosition(positionId, "en").getName(); es_name = this.translationPositionService.findByLanguagePosition(positionId, "es").getName(); positionForm = new PositionForm(); positionForm.setId(positionId); positionForm.setEn_name(en_name); positionForm.setEs_name(es_name); result = this.createEditModelAndView(positionForm, locale); return result; } @RequestMapping(value = "/edit", method = RequestMethod.POST, params = "save") public ModelAndView save(final PositionForm positionForm, final BindingResult binding, final Locale locale) { ModelAndView result; Position position; this.positionService.validateName(locale.getLanguage(), "en_name", positionForm.getEn_name(), binding); this.positionService.validateName(locale.getLanguage(), "es_name", positionForm.getEs_name(), binding); if (binding.hasErrors()) result = this.createEditModelAndView(positionForm, locale); else try { position = this.positionService.reconstruct(positionForm); this.positionService.save(position); result = new ModelAndView("redirect:list.do"); } catch (final DataIntegrityViolationException oops) { result = this.createEditModelAndView(positionForm, locale, "position.name.unique"); } catch (final Throwable oops) { result = this.createEditModelAndView(positionForm, locale, "position.commit.error"); } return result; } @RequestMapping(value = "/edit", method = RequestMethod.POST, params = "delete") public ModelAndView delete(final PositionForm positionForm, final BindingResult binding, final Locale locale) { ModelAndView result; Position position; try { position = this.positionService.findOne(positionForm.getId()); this.positionService.delete(position); result = new ModelAndView("redirect:list.do"); } catch (final Throwable oops) { result = this.createEditModelAndView(positionForm, locale, "position.commit.error"); } return result; } // Arcillary methods ------------------------------------ protected ModelAndView createEditModelAndView(final PositionForm positionForm, final Locale locale) { ModelAndView result; result = this.createEditModelAndView(positionForm, locale, null); return result; } protected ModelAndView createEditModelAndView(final PositionForm positionForm, final Locale locale, final String messageCode) { ModelAndView result; Boolean canBeDeleted; if (positionForm.getId() == 0) canBeDeleted = false; else canBeDeleted = this.positionService.isUsedPosition(positionForm.getId()) == 0; result = new ModelAndView("position/edit"); result.addObject("positionForm", positionForm); result.addObject("canBeDeleted", canBeDeleted); result.addObject("messageCode", messageCode); return result; } }
[ "alvcalgon\t@alum.us.es" ]
alvcalgon @alum.us.es
d513278c8e05bf8db20ec9c8796e348c2c2b703a
87a3d6bcc1634514e6a1ae6aac171fef85e68363
/app/src/main/java/com/uniquindio/mueveteuq/activities/ui/main/PageViewModel.java
60a73afe6e12d94bc9706f8c845f3036db54fac9
[]
no_license
MariaPaulaS/MueveteUQPodometro
f460919f6f63c8cc51eeed27ba3712ac608fa8ff
db9f29fb53c46c6d6adaf15ffebb5f5260155942
refs/heads/master
2021-07-24T01:03:10.278919
2020-08-24T13:21:36
2020-08-24T13:21:36
207,199,986
0
0
null
2020-08-24T13:21:37
2019-09-09T01:36:37
Java
UTF-8
Java
false
false
758
java
package com.uniquindio.mueveteuq.activities.ui.main; import androidx.arch.core.util.Function; import androidx.lifecycle.LiveData; import androidx.lifecycle.MutableLiveData; import androidx.lifecycle.Transformations; import androidx.lifecycle.ViewModel; public class PageViewModel extends ViewModel { private MutableLiveData<Integer> mIndex = new MutableLiveData<>(); private LiveData<String> mText = Transformations.map(mIndex, new Function<Integer, String>() { @Override public String apply(Integer input) { return "Hello world from section: " + input; } }); public void setIndex(int index) { mIndex.setValue(index); } public LiveData<String> getText() { return mText; } }
[ "mariathecharmix@hotmail.com" ]
mariathecharmix@hotmail.com
a0fd2d8e8b837326077b3e08c126cc9701558b3c
350e754b6e3d08d71664f946f0e4cf5989f12687
/src/test/java/com/dongdl/springboot1/RegisterTest/HttpUtilTest.java
dc665e9e7c761a8f9c8585e58f7fd3f90cae4d42
[]
no_license
zzt002/open-hsb-plugin-service
3ebb9d74445d3b4521de69f64e81a6bebb2e66f6
4c997d2eb54b976d9ceb4c3f9168e6f5ca085b39
refs/heads/master
2023-03-06T20:26:31.332318
2021-02-18T02:40:43
2021-02-18T02:40:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,034
java
package com.dongdl.springboot1.RegisterTest; import com.dongdl.springboot1.util.HttpUtil; import org.junit.jupiter.api.Test; public class HttpUtilTest { @Test public void TimeoutTest() { String url = "http://localhost:9977/test/test?seconds=99999999"; String result = HttpUtil.doGet(url, 10000, 60000); // String state = JSONObject.parseObject(result).getString("state"); System.out.println(result); } @Test public void TimeoutTest0() { String url = "http://localhost:9977/test/test?seconds=99999999"; String result = HttpUtil.doGet(url, 0, 0); // String state = JSONObject.parseObject(result).getString("state"); System.out.println(result); } @Test public void timeoutTest() { String url = "http://localhost:8086/test/redis2?num=5"; String response = null; try { response = HttpUtil.doGet(url); } catch (Exception e) { ; } System.out.println(response); } }
[ "dongdongliang13@hotmail.com" ]
dongdongliang13@hotmail.com
4103d6043ad52d42bebf513dea2e63903219c364
6a3b597ffcc5a24a6e55caa5994f92e66e10e5ca
/BDim_HW5/fragment_manager/FragmentManager/app/src/main/java/ru/geekbrains/fragmentmanager/Fragment2.java
6ab0b136729abd591f536ea77c81289253abc704
[]
no_license
Dmitry108/android_1
a46a94a4acc6eba801bf05e3a114ac18e92e81cc
9b2b1689a35c1f3432027133896740b568fe770d
refs/heads/master
2021-01-01T10:46:53.945931
2020-04-13T12:39:53
2020-04-13T12:39:53
239,244,770
0
0
null
2020-04-18T14:48:30
2020-02-09T04:12:18
Java
UTF-8
Java
false
false
585
java
package ru.geekbrains.fragmentmanager; import android.os.Bundle; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; public class Fragment2 extends Fragment { @Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_2, container, false); } }
[ "babanov1984@mail.ru" ]
babanov1984@mail.ru
55bb5dbd552866a7a0815f107dae6eb7d47f6dba
d7df31bfeb96b0a16f7b80cda65097a06c28a6ca
/app/src/main/java/com/my/eduardarefjev/aviaapp/CreateEngine.java
dad1efc43b4c5436062bc6a7802b923564b10931
[]
no_license
burzik/aviaapp
358732e39c4427e1ee063efd46870619b8aebc62
9ffb0bdd1476cfa80294970a73c3e0c3551da260
refs/heads/master
2021-09-14T19:49:27.289060
2018-05-18T10:28:21
2018-05-18T10:28:21
112,386,308
0
0
null
null
null
null
UTF-8
Java
false
false
1,507
java
package com.my.eduardarefjev.aviaapp; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import android.widget.EditText; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import java.util.HashMap; /** * HISTORY * Date Author Comments * 06.02.2017 Eduard Arefjev Created */ public class CreateEngine extends AppCompatActivity { private DatabaseReference mDatabase; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.linear_insert_engine); createEngineNumber(); } public void createEngineNumber(){ Button bInsertEngine = findViewById(R.id.buttonCreateEngineNumber); bInsertEngine.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { EditText eEngineNumber = findViewById(R.id.LinearLabelInpEngineNumber); mDatabase = FirebaseDatabase.getInstance().getReference().child("EngineNumber").child(String.valueOf(eEngineNumber.getText().toString())); EngineInformation engineInformation = new EngineInformation(); engineInformation.setEngineNumber(Integer.valueOf(eEngineNumber.getText().toString())); mDatabase.setValue(engineInformation); } }); } }
[ "burzikmail@gmail.com" ]
burzikmail@gmail.com
66bc2b3fb4a230fd90faffc38873b5806b8452c8
2d4269e873a082871f395c91d485ab616b3c6c67
/src/DataBase.java
3401f3f77a7c27553f84e3813ba9c5a285758629
[]
no_license
VivekVuppala/MakeMyTrip
d6a27949bac9f92d8ecaa1840d5cb3df852e1717
f7ab2da9078957fa41e9febab79ff4cad135976c
refs/heads/master
2023-01-23T00:59:53.910963
2020-11-25T09:59:55
2020-11-25T09:59:55
315,262,880
0
0
null
null
null
null
UTF-8
Java
false
false
1,573
java
import java.sql.Connection; import java.sql.Statement; import java.sql.ResultSet; import java.sql.DriverManager; import java.sql.SQLException; public class DataBase { public static void main(String[] args) throws ClassNotFoundException, SQLException { //Connection URL Syntax: "jdbc:mysql://ipaddress:portnumber/db_name" String dbUrl = "jdbc:mysql://localhost:3036/emp"; //Database Username String username = "root"; //Database Password String password = "Vicky@123"; //Query to Execute String query = "select * from employee;"; //Load mysql jdbc driver Class.forName("com.mysql.jdbc.Driver"); //Create Connection to DB Connection con = DriverManager.getConnection(dbUrl,username,password); //Create Statement Object Statement stmt = con.createStatement(); // Execute the SQL Query. Store results in ResultSet ResultSet rs= stmt.executeQuery(query); // While Loop to iterate through all data and print results while (rs.next()){ String myName = rs.getString(1); String myAge = rs.getString(2); System. out.println(myName+" "+myAge); } // closing DB Connection con.close(); } }
[ "vickycrazy.cool@gmail.com" ]
vickycrazy.cool@gmail.com
19c5254bae5eec0dbdeeeef2429956fb2417d504
291793c8108efadda983668f567e5c8d8373df53
/android/NIMKit/src/com/netease/nim/uikit/common/media/picker/PickImageHelper.java
fe89b6ad20de239036d9f12ec837f2e240dbadac
[ "MIT" ]
permissive
farwolf2010/NIMKit
903b909f29c7ca2e7a823116bcbe60fa0c9c0c21
82de3434dd8631b7fd3be8f638ef212185fa4c1a
refs/heads/master
2020-05-29T13:27:51.701837
2020-05-02T11:53:46
2020-05-02T11:53:46
189,163,423
0
3
null
null
null
null
UTF-8
Java
false
false
4,776
java
package com.netease.nim.uikit.common.media.picker; import android.Manifest; import android.app.Activity; import android.content.Context; import com.farwolf.perssion.Perssion; import com.farwolf.perssion.PerssionCallback; import com.netease.nim.uikit.R; import com.netease.nim.uikit.common.media.picker.activity.PickImageActivity; import com.netease.nim.uikit.common.ui.dialog.CustomAlertDialog; import com.netease.nim.uikit.common.util.storage.StorageType; import com.netease.nim.uikit.common.util.storage.StorageUtil; import com.netease.nim.uikit.common.util.string.StringUtil; /** * Created by huangjun on 2015/9/22. */ public class PickImageHelper { public static class PickImageOption { /** * ๅ›พ็‰‡้€‰ๆ‹ฉๅ™จๆ ‡้ข˜ */ public int titleResId = R.string.choose; /** * ๆ˜ฏๅฆๅคš้€‰ */ public boolean multiSelect = true; /** * ๆœ€ๅคš้€‰ๅคšๅฐ‘ๅผ ๅ›พ๏ผˆๅคš้€‰ๆ—ถๆœ‰ๆ•ˆ๏ผ‰ */ public int multiSelectMaxCount = 9; /** * ๆ˜ฏๅฆ่ฟ›่กŒๅ›พ็‰‡่ฃๅ‰ช(ๅ›พ็‰‡้€‰ๆ‹ฉๆจกๅผ๏ผšfalse / ๅ›พ็‰‡่ฃๅ‰ชๆจกๅผ๏ผštrue) */ public boolean crop = false; /** * ๅ›พ็‰‡่ฃๅ‰ช็š„ๅฎฝๅบฆ๏ผˆ่ฃๅ‰ชๆจกๅผๆ—ถๆœ‰ๆ•ˆ๏ผ‰ */ public int cropOutputImageWidth = 720; /** * ๅ›พ็‰‡่ฃๅ‰ช็š„้ซ˜ๅบฆ๏ผˆ่ฃๅ‰ชๆจกๅผๆ—ถๆœ‰ๆ•ˆ๏ผ‰ */ public int cropOutputImageHeight = 720; /** * ๅ›พ็‰‡้€‰ๆ‹ฉไฟๅญ˜่ทฏๅพ„ */ public String outputPath = StorageUtil.getWritePath(StringUtil.get32UUID() + ".jpg", StorageType.TYPE_TEMP); } /** * ๆ‰“ๅผ€ๅ›พ็‰‡้€‰ๆ‹ฉๅ™จ */ public static void pickImage(final Context context, final int requestCode, final PickImageOption option) { if (context == null) { return; } CustomAlertDialog dialog = new CustomAlertDialog(context); dialog.setTitle(option.titleResId); dialog.addItem(context.getString(R.string.input_panel_take), new CustomAlertDialog.onSeparateItemClickListener() { @Override public void onClick() { Perssion.check((Activity) context, Manifest.permission.CAMERA,new PerssionCallback(){ @Override public void onGranted() { Perssion.check((Activity) context,Manifest.permission.WRITE_EXTERNAL_STORAGE , new PerssionCallback() { @Override public void onGranted() { int from = PickImageActivity.FROM_CAMERA; if (!option.crop) { PickImageActivity.start((Activity) context, requestCode, from, option.outputPath, option.multiSelect, 1, true, false, 0, 0); } else { PickImageActivity.start((Activity) context, requestCode, from, option.outputPath, false, 1, false, true, option.cropOutputImageWidth, option.cropOutputImageHeight); } } }); } }); } }); dialog.addItem(context.getString(R.string.choose_from_photo_album), new CustomAlertDialog .onSeparateItemClickListener() { @Override public void onClick() { Perssion.check((Activity) context, Manifest.permission.CAMERA,new PerssionCallback(){ @Override public void onGranted() { Perssion.check((Activity) context,Manifest.permission.WRITE_EXTERNAL_STORAGE , new PerssionCallback() { @Override public void onGranted() { int from = PickImageActivity.FROM_LOCAL; if (!option.crop) { PickImageActivity.start((Activity) context, requestCode, from, option.outputPath, option.multiSelect, option.multiSelectMaxCount, true, false, 0, 0); } else { PickImageActivity.start((Activity) context, requestCode, from, option.outputPath, false, 1, false, true, option.cropOutputImageWidth, option.cropOutputImageHeight); } } }); } }); } }); dialog.show(); } }
[ "362675035@qq.com" ]
362675035@qq.com
91a3cb77a7ea1259c7c11b12b8cbfc4508066fdb
1c5ea416a9362e29160a9bb6ecb284b297e043d7
/Project 0/libs/mysql-connector-java-8.0.26/src/main/core-api/java/com/mysql/cj/CharsetMapping.java
8f3c7bba5f8e564e23be494df28ae7f5052b209b
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-unicode", "LicenseRef-scancode-warranty-disclaimer", "LGPL-2.0-or-later", "EPL-1.0", "BSD-3-Clause", "LicenseRef-scancode-free-unknown", "LGPL-2.1-or-later", "GPL-1.0-or-later", "EPL-2.0", "GPL-3.0-only", "MIT", "LGPL-2.1-...
permissive
ManuelNavarro1103/ManuelNavarroJavaFSD
958fa6b33068e8ad9325bb9d4d14c6b3e7ca2f55
2a71c732927bb11465d732181d0a8c829cfaca3f
refs/heads/main
2023-07-04T02:50:41.504627
2021-08-13T14:18:14
2021-08-13T14:18:14
390,370,651
0
0
MIT
2021-08-13T14:18:15
2021-07-28T13:57:53
Java
UTF-8
Java
false
false
49,609
java
/* * Copyright (c) 2002, 2021, Oracle and/or its affiliates. * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License, version 2.0, as published by the * Free Software Foundation. * * This program is also distributed with certain software (including but not * limited to OpenSSL) that is licensed under separate terms, as designated in a * particular file or component or in included license documentation. The * authors of MySQL hereby grant you an additional permission to link the * program and your derivative works with the separately licensed software that * they have included with MySQL. * * Without limiting anything contained in the foregoing, this file, which is * part of MySQL Connector/J, is also subject to the Universal FOSS Exception, * version 1.0, a copy of which can be found at * http://oss.oracle.com/licenses/universal-foss-exception. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0, * for more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ package com.mysql.cj; import java.nio.charset.Charset; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Set; import java.util.TreeMap; /** * Mapping between MySQL charset names and Java charset names. I've investigated placing these in a .properties file, but unfortunately under most appservers * this complicates configuration because the security policy needs to be changed by the user to allow the driver to read them :( */ public class CharsetMapping { public static final int MAP_SIZE = 1024; // Size of static maps private static final String[] COLLATION_INDEX_TO_COLLATION_NAME; private static final Map<Integer, MysqlCharset> COLLATION_INDEX_TO_CHARSET; private static final Map<String, MysqlCharset> CHARSET_NAME_TO_CHARSET; private static final Map<String, Integer> CHARSET_NAME_TO_COLLATION_INDEX; private static final Map<String, Integer> COLLATION_NAME_TO_COLLATION_INDEX; private static final Map<String, List<MysqlCharset>> JAVA_ENCODING_UC_TO_MYSQL_CHARSET; private static final Set<String> MULTIBYTE_ENCODINGS; /** * Indexes of collations using ucs2, utf16, utf16le or utf32 character sets and that cannot be set to character_set_client system variable. */ private static final Set<Integer> IMPERMISSIBLE_INDEXES; public static final String MYSQL_CHARSET_NAME_armscii8 = "armscii8"; public static final String MYSQL_CHARSET_NAME_ascii = "ascii"; public static final String MYSQL_CHARSET_NAME_big5 = "big5"; public static final String MYSQL_CHARSET_NAME_binary = "binary"; public static final String MYSQL_CHARSET_NAME_cp1250 = "cp1250"; public static final String MYSQL_CHARSET_NAME_cp1251 = "cp1251"; public static final String MYSQL_CHARSET_NAME_cp1256 = "cp1256"; public static final String MYSQL_CHARSET_NAME_cp1257 = "cp1257"; public static final String MYSQL_CHARSET_NAME_cp850 = "cp850"; public static final String MYSQL_CHARSET_NAME_cp852 = "cp852"; public static final String MYSQL_CHARSET_NAME_cp866 = "cp866"; public static final String MYSQL_CHARSET_NAME_cp932 = "cp932"; public static final String MYSQL_CHARSET_NAME_dec8 = "dec8"; public static final String MYSQL_CHARSET_NAME_eucjpms = "eucjpms"; public static final String MYSQL_CHARSET_NAME_euckr = "euckr"; public static final String MYSQL_CHARSET_NAME_gb18030 = "gb18030"; public static final String MYSQL_CHARSET_NAME_gb2312 = "gb2312"; public static final String MYSQL_CHARSET_NAME_gbk = "gbk"; public static final String MYSQL_CHARSET_NAME_geostd8 = "geostd8"; public static final String MYSQL_CHARSET_NAME_greek = "greek"; public static final String MYSQL_CHARSET_NAME_hebrew = "hebrew"; public static final String MYSQL_CHARSET_NAME_hp8 = "hp8"; public static final String MYSQL_CHARSET_NAME_keybcs2 = "keybcs2"; public static final String MYSQL_CHARSET_NAME_koi8r = "koi8r"; public static final String MYSQL_CHARSET_NAME_koi8u = "koi8u"; public static final String MYSQL_CHARSET_NAME_latin1 = "latin1"; public static final String MYSQL_CHARSET_NAME_latin2 = "latin2"; public static final String MYSQL_CHARSET_NAME_latin5 = "latin5"; public static final String MYSQL_CHARSET_NAME_latin7 = "latin7"; public static final String MYSQL_CHARSET_NAME_macce = "macce"; public static final String MYSQL_CHARSET_NAME_macroman = "macroman"; public static final String MYSQL_CHARSET_NAME_sjis = "sjis"; public static final String MYSQL_CHARSET_NAME_swe7 = "swe7"; public static final String MYSQL_CHARSET_NAME_tis620 = "tis620"; public static final String MYSQL_CHARSET_NAME_ucs2 = "ucs2"; public static final String MYSQL_CHARSET_NAME_ujis = "ujis"; public static final String MYSQL_CHARSET_NAME_utf16 = "utf16"; public static final String MYSQL_CHARSET_NAME_utf16le = "utf16le"; public static final String MYSQL_CHARSET_NAME_utf32 = "utf32"; public static final String MYSQL_CHARSET_NAME_utf8 = "utf8"; public static final String MYSQL_CHARSET_NAME_utf8mb4 = "utf8mb4"; public static final int MYSQL_COLLATION_INDEX_utf8mb4_general_ci = 45; public static final int MYSQL_COLLATION_INDEX_utf8mb4_0900_ai_ci = 255; public static final int MYSQL_COLLATION_INDEX_binary = 63; static { // complete list of mysql character sets and their corresponding java encoding names MysqlCharset[] charset = new MysqlCharset[] { new MysqlCharset(MYSQL_CHARSET_NAME_ascii, 1, 0, new String[] { "US-ASCII", "ASCII" }), new MysqlCharset(MYSQL_CHARSET_NAME_big5, 2, 0, new String[] { "Big5" }), new MysqlCharset(MYSQL_CHARSET_NAME_gbk, 2, 0, new String[] { "GBK" }), new MysqlCharset(MYSQL_CHARSET_NAME_sjis, 2, 0, new String[] { "SHIFT_JIS", "Cp943", "WINDOWS-31J" }), // SJIS is alias for SHIFT_JIS, Cp943 is rather a cp932 but we map it to sjis for years new MysqlCharset(MYSQL_CHARSET_NAME_cp932, 2, 1, new String[] { "WINDOWS-31J" }), new MysqlCharset(MYSQL_CHARSET_NAME_gb2312, 2, 0, new String[] { "GB2312" }), new MysqlCharset(MYSQL_CHARSET_NAME_ujis, 3, 0, new String[] { "EUC_JP" }), new MysqlCharset(MYSQL_CHARSET_NAME_eucjpms, 3, 0, new String[] { "EUC_JP_Solaris" }, new ServerVersion(5, 0, 3)), new MysqlCharset(MYSQL_CHARSET_NAME_gb18030, 4, 0, new String[] { "GB18030" }, new ServerVersion(5, 7, 4)), new MysqlCharset(MYSQL_CHARSET_NAME_euckr, 2, 0, new String[] { "EUC-KR" }), new MysqlCharset(MYSQL_CHARSET_NAME_latin1, 1, 1, new String[] { "Cp1252", "ISO8859_1" }), new MysqlCharset(MYSQL_CHARSET_NAME_swe7, 1, 0, new String[] { "Cp1252" }), new MysqlCharset(MYSQL_CHARSET_NAME_hp8, 1, 0, new String[] { "Cp1252" }), new MysqlCharset(MYSQL_CHARSET_NAME_dec8, 1, 0, new String[] { "Cp1252" }), new MysqlCharset(MYSQL_CHARSET_NAME_armscii8, 1, 0, new String[] { "Cp1252" }), new MysqlCharset(MYSQL_CHARSET_NAME_geostd8, 1, 0, new String[] { "Cp1252" }), new MysqlCharset(MYSQL_CHARSET_NAME_latin2, 1, 0, new String[] { "ISO8859_2" }), new MysqlCharset(MYSQL_CHARSET_NAME_greek, 1, 0, new String[] { "ISO8859_7", "greek" }), new MysqlCharset(MYSQL_CHARSET_NAME_latin7, 1, 0, new String[] { "ISO-8859-13" }), new MysqlCharset(MYSQL_CHARSET_NAME_hebrew, 1, 0, new String[] { "ISO8859_8" }), new MysqlCharset(MYSQL_CHARSET_NAME_latin5, 1, 0, new String[] { "ISO8859_9" }), new MysqlCharset(MYSQL_CHARSET_NAME_cp850, 1, 0, new String[] { "Cp850", "Cp437" }), new MysqlCharset(MYSQL_CHARSET_NAME_cp852, 1, 0, new String[] { "Cp852" }), new MysqlCharset(MYSQL_CHARSET_NAME_keybcs2, 1, 0, new String[] { "Cp852" }), // Kamenicky encoding usually known as Cp895 but there is no official cp895 specification; close to Cp852, see http://ftp.muni.cz/pub/localization/charsets/cs-encodings-faq new MysqlCharset(MYSQL_CHARSET_NAME_cp866, 1, 0, new String[] { "Cp866" }), new MysqlCharset(MYSQL_CHARSET_NAME_koi8r, 1, 1, new String[] { "KOI8_R" }), new MysqlCharset(MYSQL_CHARSET_NAME_koi8u, 1, 0, new String[] { "KOI8_R" }), new MysqlCharset(MYSQL_CHARSET_NAME_tis620, 1, 0, new String[] { "TIS620" }), new MysqlCharset(MYSQL_CHARSET_NAME_cp1250, 1, 0, new String[] { "Cp1250" }), new MysqlCharset(MYSQL_CHARSET_NAME_cp1251, 1, 1, new String[] { "Cp1251" }), new MysqlCharset(MYSQL_CHARSET_NAME_cp1256, 1, 0, new String[] { "Cp1256" }), new MysqlCharset(MYSQL_CHARSET_NAME_cp1257, 1, 0, new String[] { "Cp1257" }), new MysqlCharset(MYSQL_CHARSET_NAME_macroman, 1, 0, new String[] { "MacRoman" }), new MysqlCharset(MYSQL_CHARSET_NAME_macce, 1, 0, new String[] { "MacCentralEurope" }), new MysqlCharset(MYSQL_CHARSET_NAME_utf8, 3, 0, new String[] { "UTF-8" }), new MysqlCharset(MYSQL_CHARSET_NAME_utf8mb4, 4, 1, new String[] { "UTF-8" }), // "UTF-8 = *> 5.5.2 utf8mb4" new MysqlCharset(MYSQL_CHARSET_NAME_binary, 1, 1, new String[] { "ISO8859_1" }), new MysqlCharset(MYSQL_CHARSET_NAME_ucs2, 2, 0, new String[] { "UnicodeBig" }), new MysqlCharset(MYSQL_CHARSET_NAME_utf16, 4, 0, new String[] { "UTF-16" }), new MysqlCharset(MYSQL_CHARSET_NAME_utf16le, 4, 0, new String[] { "UTF-16LE" }), new MysqlCharset(MYSQL_CHARSET_NAME_utf32, 4, 0, new String[] { "UTF-32" }) }; HashMap<String, MysqlCharset> charsetNameToMysqlCharsetMap = new HashMap<>(); HashMap<String, List<MysqlCharset>> javaUcToMysqlCharsetMap = new HashMap<>(); Set<String> tempMultibyteEncodings = new HashSet<>(); for (int i = 0; i < charset.length; i++) { String charsetName = charset[i].charsetName; charsetNameToMysqlCharsetMap.put(charsetName, charset[i]); for (String encUC : charset[i].javaEncodingsUc) { List<MysqlCharset> charsets = javaUcToMysqlCharsetMap.get(encUC); if (charsets == null) { charsets = new ArrayList<>(); javaUcToMysqlCharsetMap.put(encUC, charsets); } charsets.add(charset[i]); if (charset[i].mblen > 1) { tempMultibyteEncodings.add(encUC); } } } CHARSET_NAME_TO_CHARSET = Collections.unmodifiableMap(charsetNameToMysqlCharsetMap); JAVA_ENCODING_UC_TO_MYSQL_CHARSET = Collections.unmodifiableMap(javaUcToMysqlCharsetMap); MULTIBYTE_ENCODINGS = Collections.unmodifiableSet(tempMultibyteEncodings); // complete list of mysql collations and their corresponding character sets each element of collation[1]..collation[MAP_SIZE-1] must not be null Collation[] collation = new Collation[MAP_SIZE]; collation[1] = new Collation(1, "big5_chinese_ci", 1, MYSQL_CHARSET_NAME_big5); collation[2] = new Collation(2, "latin2_czech_cs", 0, MYSQL_CHARSET_NAME_latin2); collation[3] = new Collation(3, "dec8_swedish_ci", 0, MYSQL_CHARSET_NAME_dec8); collation[4] = new Collation(4, "cp850_general_ci", 1, MYSQL_CHARSET_NAME_cp850); collation[5] = new Collation(5, "latin1_german1_ci", 0, MYSQL_CHARSET_NAME_latin1); collation[6] = new Collation(6, "hp8_english_ci", 0, MYSQL_CHARSET_NAME_hp8); collation[7] = new Collation(7, "koi8r_general_ci", 0, MYSQL_CHARSET_NAME_koi8r); collation[8] = new Collation(8, "latin1_swedish_ci", 1, MYSQL_CHARSET_NAME_latin1); collation[9] = new Collation(9, "latin2_general_ci", 1, MYSQL_CHARSET_NAME_latin2); collation[10] = new Collation(10, "swe7_swedish_ci", 0, MYSQL_CHARSET_NAME_swe7); collation[11] = new Collation(11, "ascii_general_ci", 0, MYSQL_CHARSET_NAME_ascii); collation[12] = new Collation(12, "ujis_japanese_ci", 0, MYSQL_CHARSET_NAME_ujis); collation[13] = new Collation(13, "sjis_japanese_ci", 0, MYSQL_CHARSET_NAME_sjis); collation[14] = new Collation(14, "cp1251_bulgarian_ci", 0, MYSQL_CHARSET_NAME_cp1251); collation[15] = new Collation(15, "latin1_danish_ci", 0, MYSQL_CHARSET_NAME_latin1); collation[16] = new Collation(16, "hebrew_general_ci", 0, MYSQL_CHARSET_NAME_hebrew); collation[18] = new Collation(18, "tis620_thai_ci", 0, MYSQL_CHARSET_NAME_tis620); collation[19] = new Collation(19, "euckr_korean_ci", 0, MYSQL_CHARSET_NAME_euckr); collation[20] = new Collation(20, "latin7_estonian_cs", 0, MYSQL_CHARSET_NAME_latin7); collation[21] = new Collation(21, "latin2_hungarian_ci", 0, MYSQL_CHARSET_NAME_latin2); collation[22] = new Collation(22, "koi8u_general_ci", 0, MYSQL_CHARSET_NAME_koi8u); collation[23] = new Collation(23, "cp1251_ukrainian_ci", 0, MYSQL_CHARSET_NAME_cp1251); collation[24] = new Collation(24, "gb2312_chinese_ci", 0, MYSQL_CHARSET_NAME_gb2312); collation[25] = new Collation(25, "greek_general_ci", 0, MYSQL_CHARSET_NAME_greek); collation[26] = new Collation(26, "cp1250_general_ci", 1, MYSQL_CHARSET_NAME_cp1250); collation[27] = new Collation(27, "latin2_croatian_ci", 0, MYSQL_CHARSET_NAME_latin2); collation[28] = new Collation(28, "gbk_chinese_ci", 1, MYSQL_CHARSET_NAME_gbk); collation[29] = new Collation(29, "cp1257_lithuanian_ci", 0, MYSQL_CHARSET_NAME_cp1257); collation[30] = new Collation(30, "latin5_turkish_ci", 1, MYSQL_CHARSET_NAME_latin5); collation[31] = new Collation(31, "latin1_german2_ci", 0, MYSQL_CHARSET_NAME_latin1); collation[32] = new Collation(32, "armscii8_general_ci", 0, MYSQL_CHARSET_NAME_armscii8); collation[33] = new Collation(33, "utf8_general_ci", 1, MYSQL_CHARSET_NAME_utf8); collation[34] = new Collation(34, "cp1250_czech_cs", 0, MYSQL_CHARSET_NAME_cp1250); collation[35] = new Collation(35, "ucs2_general_ci", 1, MYSQL_CHARSET_NAME_ucs2); collation[36] = new Collation(36, "cp866_general_ci", 1, MYSQL_CHARSET_NAME_cp866); collation[37] = new Collation(37, "keybcs2_general_ci", 1, MYSQL_CHARSET_NAME_keybcs2); collation[38] = new Collation(38, "macce_general_ci", 1, MYSQL_CHARSET_NAME_macce); collation[39] = new Collation(39, "macroman_general_ci", 1, MYSQL_CHARSET_NAME_macroman); collation[40] = new Collation(40, "cp852_general_ci", 1, MYSQL_CHARSET_NAME_cp852); collation[41] = new Collation(41, "latin7_general_ci", 1, MYSQL_CHARSET_NAME_latin7); collation[42] = new Collation(42, "latin7_general_cs", 0, MYSQL_CHARSET_NAME_latin7); collation[43] = new Collation(43, "macce_bin", 0, MYSQL_CHARSET_NAME_macce); collation[44] = new Collation(44, "cp1250_croatian_ci", 0, MYSQL_CHARSET_NAME_cp1250); collation[45] = new Collation(45, "utf8mb4_general_ci", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[46] = new Collation(46, "utf8mb4_bin", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[47] = new Collation(47, "latin1_bin", 0, MYSQL_CHARSET_NAME_latin1); collation[48] = new Collation(48, "latin1_general_ci", 0, MYSQL_CHARSET_NAME_latin1); collation[49] = new Collation(49, "latin1_general_cs", 0, MYSQL_CHARSET_NAME_latin1); collation[50] = new Collation(50, "cp1251_bin", 0, MYSQL_CHARSET_NAME_cp1251); collation[51] = new Collation(51, "cp1251_general_ci", 1, MYSQL_CHARSET_NAME_cp1251); collation[52] = new Collation(52, "cp1251_general_cs", 0, MYSQL_CHARSET_NAME_cp1251); collation[53] = new Collation(53, "macroman_bin", 0, MYSQL_CHARSET_NAME_macroman); collation[54] = new Collation(54, "utf16_general_ci", 1, MYSQL_CHARSET_NAME_utf16); collation[55] = new Collation(55, "utf16_bin", 0, MYSQL_CHARSET_NAME_utf16); collation[56] = new Collation(56, "utf16le_general_ci", 1, MYSQL_CHARSET_NAME_utf16le); collation[57] = new Collation(57, "cp1256_general_ci", 1, MYSQL_CHARSET_NAME_cp1256); collation[58] = new Collation(58, "cp1257_bin", 0, MYSQL_CHARSET_NAME_cp1257); collation[59] = new Collation(59, "cp1257_general_ci", 1, MYSQL_CHARSET_NAME_cp1257); collation[60] = new Collation(60, "utf32_general_ci", 1, MYSQL_CHARSET_NAME_utf32); collation[61] = new Collation(61, "utf32_bin", 0, MYSQL_CHARSET_NAME_utf32); collation[62] = new Collation(62, "utf16le_bin", 0, MYSQL_CHARSET_NAME_utf16le); collation[63] = new Collation(63, "binary", 1, MYSQL_CHARSET_NAME_binary); collation[64] = new Collation(64, "armscii8_bin", 0, MYSQL_CHARSET_NAME_armscii8); collation[65] = new Collation(65, "ascii_bin", 0, MYSQL_CHARSET_NAME_ascii); collation[66] = new Collation(66, "cp1250_bin", 0, MYSQL_CHARSET_NAME_cp1250); collation[67] = new Collation(67, "cp1256_bin", 0, MYSQL_CHARSET_NAME_cp1256); collation[68] = new Collation(68, "cp866_bin", 0, MYSQL_CHARSET_NAME_cp866); collation[69] = new Collation(69, "dec8_bin", 0, MYSQL_CHARSET_NAME_dec8); collation[70] = new Collation(70, "greek_bin", 0, MYSQL_CHARSET_NAME_greek); collation[71] = new Collation(71, "hebrew_bin", 0, MYSQL_CHARSET_NAME_hebrew); collation[72] = new Collation(72, "hp8_bin", 0, MYSQL_CHARSET_NAME_hp8); collation[73] = new Collation(73, "keybcs2_bin", 0, MYSQL_CHARSET_NAME_keybcs2); collation[74] = new Collation(74, "koi8r_bin", 0, MYSQL_CHARSET_NAME_koi8r); collation[75] = new Collation(75, "koi8u_bin", 0, MYSQL_CHARSET_NAME_koi8u); collation[76] = new Collation(76, "utf8_tolower_ci", 0, MYSQL_CHARSET_NAME_utf8); collation[77] = new Collation(77, "latin2_bin", 0, MYSQL_CHARSET_NAME_latin2); collation[78] = new Collation(78, "latin5_bin", 0, MYSQL_CHARSET_NAME_latin5); collation[79] = new Collation(79, "latin7_bin", 0, MYSQL_CHARSET_NAME_latin7); collation[80] = new Collation(80, "cp850_bin", 0, MYSQL_CHARSET_NAME_cp850); collation[81] = new Collation(81, "cp852_bin", 0, MYSQL_CHARSET_NAME_cp852); collation[82] = new Collation(82, "swe7_bin", 0, MYSQL_CHARSET_NAME_swe7); collation[83] = new Collation(83, "utf8_bin", 0, MYSQL_CHARSET_NAME_utf8); collation[84] = new Collation(84, "big5_bin", 0, MYSQL_CHARSET_NAME_big5); collation[85] = new Collation(85, "euckr_bin", 0, MYSQL_CHARSET_NAME_euckr); collation[86] = new Collation(86, "gb2312_bin", 0, MYSQL_CHARSET_NAME_gb2312); collation[87] = new Collation(87, "gbk_bin", 0, MYSQL_CHARSET_NAME_gbk); collation[88] = new Collation(88, "sjis_bin", 0, MYSQL_CHARSET_NAME_sjis); collation[89] = new Collation(89, "tis620_bin", 0, MYSQL_CHARSET_NAME_tis620); collation[90] = new Collation(90, "ucs2_bin", 0, MYSQL_CHARSET_NAME_ucs2); collation[91] = new Collation(91, "ujis_bin", 0, MYSQL_CHARSET_NAME_ujis); collation[92] = new Collation(92, "geostd8_general_ci", 0, MYSQL_CHARSET_NAME_geostd8); collation[93] = new Collation(93, "geostd8_bin", 0, MYSQL_CHARSET_NAME_geostd8); collation[94] = new Collation(94, "latin1_spanish_ci", 0, MYSQL_CHARSET_NAME_latin1); collation[95] = new Collation(95, "cp932_japanese_ci", 1, MYSQL_CHARSET_NAME_cp932); collation[96] = new Collation(96, "cp932_bin", 0, MYSQL_CHARSET_NAME_cp932); collation[97] = new Collation(97, "eucjpms_japanese_ci", 1, MYSQL_CHARSET_NAME_eucjpms); collation[98] = new Collation(98, "eucjpms_bin", 0, MYSQL_CHARSET_NAME_eucjpms); collation[99] = new Collation(99, "cp1250_polish_ci", 0, MYSQL_CHARSET_NAME_cp1250); collation[101] = new Collation(101, "utf16_unicode_ci", 0, MYSQL_CHARSET_NAME_utf16); collation[102] = new Collation(102, "utf16_icelandic_ci", 0, MYSQL_CHARSET_NAME_utf16); collation[103] = new Collation(103, "utf16_latvian_ci", 0, MYSQL_CHARSET_NAME_utf16); collation[104] = new Collation(104, "utf16_romanian_ci", 0, MYSQL_CHARSET_NAME_utf16); collation[105] = new Collation(105, "utf16_slovenian_ci", 0, MYSQL_CHARSET_NAME_utf16); collation[106] = new Collation(106, "utf16_polish_ci", 0, MYSQL_CHARSET_NAME_utf16); collation[107] = new Collation(107, "utf16_estonian_ci", 0, MYSQL_CHARSET_NAME_utf16); collation[108] = new Collation(108, "utf16_spanish_ci", 0, MYSQL_CHARSET_NAME_utf16); collation[109] = new Collation(109, "utf16_swedish_ci", 0, MYSQL_CHARSET_NAME_utf16); collation[110] = new Collation(110, "utf16_turkish_ci", 0, MYSQL_CHARSET_NAME_utf16); collation[111] = new Collation(111, "utf16_czech_ci", 0, MYSQL_CHARSET_NAME_utf16); collation[112] = new Collation(112, "utf16_danish_ci", 0, MYSQL_CHARSET_NAME_utf16); collation[113] = new Collation(113, "utf16_lithuanian_ci", 0, MYSQL_CHARSET_NAME_utf16); collation[114] = new Collation(114, "utf16_slovak_ci", 0, MYSQL_CHARSET_NAME_utf16); collation[115] = new Collation(115, "utf16_spanish2_ci", 0, MYSQL_CHARSET_NAME_utf16); collation[116] = new Collation(116, "utf16_roman_ci", 0, MYSQL_CHARSET_NAME_utf16); collation[117] = new Collation(117, "utf16_persian_ci", 0, MYSQL_CHARSET_NAME_utf16); collation[118] = new Collation(118, "utf16_esperanto_ci", 0, MYSQL_CHARSET_NAME_utf16); collation[119] = new Collation(119, "utf16_hungarian_ci", 0, MYSQL_CHARSET_NAME_utf16); collation[120] = new Collation(120, "utf16_sinhala_ci", 0, MYSQL_CHARSET_NAME_utf16); collation[121] = new Collation(121, "utf16_german2_ci", 0, MYSQL_CHARSET_NAME_utf16); collation[122] = new Collation(122, "utf16_croatian_ci", 0, MYSQL_CHARSET_NAME_utf16); collation[123] = new Collation(123, "utf16_unicode_520_ci", 0, MYSQL_CHARSET_NAME_utf16); collation[124] = new Collation(124, "utf16_vietnamese_ci", 0, MYSQL_CHARSET_NAME_utf16); collation[128] = new Collation(128, "ucs2_unicode_ci", 0, MYSQL_CHARSET_NAME_ucs2); collation[129] = new Collation(129, "ucs2_icelandic_ci", 0, MYSQL_CHARSET_NAME_ucs2); collation[130] = new Collation(130, "ucs2_latvian_ci", 0, MYSQL_CHARSET_NAME_ucs2); collation[131] = new Collation(131, "ucs2_romanian_ci", 0, MYSQL_CHARSET_NAME_ucs2); collation[132] = new Collation(132, "ucs2_slovenian_ci", 0, MYSQL_CHARSET_NAME_ucs2); collation[133] = new Collation(133, "ucs2_polish_ci", 0, MYSQL_CHARSET_NAME_ucs2); collation[134] = new Collation(134, "ucs2_estonian_ci", 0, MYSQL_CHARSET_NAME_ucs2); collation[135] = new Collation(135, "ucs2_spanish_ci", 0, MYSQL_CHARSET_NAME_ucs2); collation[136] = new Collation(136, "ucs2_swedish_ci", 0, MYSQL_CHARSET_NAME_ucs2); collation[137] = new Collation(137, "ucs2_turkish_ci", 0, MYSQL_CHARSET_NAME_ucs2); collation[138] = new Collation(138, "ucs2_czech_ci", 0, MYSQL_CHARSET_NAME_ucs2); collation[139] = new Collation(139, "ucs2_danish_ci", 0, MYSQL_CHARSET_NAME_ucs2); collation[140] = new Collation(140, "ucs2_lithuanian_ci", 0, MYSQL_CHARSET_NAME_ucs2); collation[141] = new Collation(141, "ucs2_slovak_ci", 0, MYSQL_CHARSET_NAME_ucs2); collation[142] = new Collation(142, "ucs2_spanish2_ci", 0, MYSQL_CHARSET_NAME_ucs2); collation[143] = new Collation(143, "ucs2_roman_ci", 0, MYSQL_CHARSET_NAME_ucs2); collation[144] = new Collation(144, "ucs2_persian_ci", 0, MYSQL_CHARSET_NAME_ucs2); collation[145] = new Collation(145, "ucs2_esperanto_ci", 0, MYSQL_CHARSET_NAME_ucs2); collation[146] = new Collation(146, "ucs2_hungarian_ci", 0, MYSQL_CHARSET_NAME_ucs2); collation[147] = new Collation(147, "ucs2_sinhala_ci", 0, MYSQL_CHARSET_NAME_ucs2); collation[148] = new Collation(148, "ucs2_german2_ci", 0, MYSQL_CHARSET_NAME_ucs2); collation[149] = new Collation(149, "ucs2_croatian_ci", 0, MYSQL_CHARSET_NAME_ucs2); collation[150] = new Collation(150, "ucs2_unicode_520_ci", 0, MYSQL_CHARSET_NAME_ucs2); collation[151] = new Collation(151, "ucs2_vietnamese_ci", 0, MYSQL_CHARSET_NAME_ucs2); collation[159] = new Collation(159, "ucs2_general_mysql500_ci", 0, MYSQL_CHARSET_NAME_ucs2); collation[160] = new Collation(160, "utf32_unicode_ci", 0, MYSQL_CHARSET_NAME_utf32); collation[161] = new Collation(161, "utf32_icelandic_ci", 0, MYSQL_CHARSET_NAME_utf32); collation[162] = new Collation(162, "utf32_latvian_ci", 0, MYSQL_CHARSET_NAME_utf32); collation[163] = new Collation(163, "utf32_romanian_ci", 0, MYSQL_CHARSET_NAME_utf32); collation[164] = new Collation(164, "utf32_slovenian_ci", 0, MYSQL_CHARSET_NAME_utf32); collation[165] = new Collation(165, "utf32_polish_ci", 0, MYSQL_CHARSET_NAME_utf32); collation[166] = new Collation(166, "utf32_estonian_ci", 0, MYSQL_CHARSET_NAME_utf32); collation[167] = new Collation(167, "utf32_spanish_ci", 0, MYSQL_CHARSET_NAME_utf32); collation[168] = new Collation(168, "utf32_swedish_ci", 0, MYSQL_CHARSET_NAME_utf32); collation[169] = new Collation(169, "utf32_turkish_ci", 0, MYSQL_CHARSET_NAME_utf32); collation[170] = new Collation(170, "utf32_czech_ci", 0, MYSQL_CHARSET_NAME_utf32); collation[171] = new Collation(171, "utf32_danish_ci", 0, MYSQL_CHARSET_NAME_utf32); collation[172] = new Collation(172, "utf32_lithuanian_ci", 0, MYSQL_CHARSET_NAME_utf32); collation[173] = new Collation(173, "utf32_slovak_ci", 0, MYSQL_CHARSET_NAME_utf32); collation[174] = new Collation(174, "utf32_spanish2_ci", 0, MYSQL_CHARSET_NAME_utf32); collation[175] = new Collation(175, "utf32_roman_ci", 0, MYSQL_CHARSET_NAME_utf32); collation[176] = new Collation(176, "utf32_persian_ci", 0, MYSQL_CHARSET_NAME_utf32); collation[177] = new Collation(177, "utf32_esperanto_ci", 0, MYSQL_CHARSET_NAME_utf32); collation[178] = new Collation(178, "utf32_hungarian_ci", 0, MYSQL_CHARSET_NAME_utf32); collation[179] = new Collation(179, "utf32_sinhala_ci", 0, MYSQL_CHARSET_NAME_utf32); collation[180] = new Collation(180, "utf32_german2_ci", 0, MYSQL_CHARSET_NAME_utf32); collation[181] = new Collation(181, "utf32_croatian_ci", 0, MYSQL_CHARSET_NAME_utf32); collation[182] = new Collation(182, "utf32_unicode_520_ci", 0, MYSQL_CHARSET_NAME_utf32); collation[183] = new Collation(183, "utf32_vietnamese_ci", 0, MYSQL_CHARSET_NAME_utf32); collation[192] = new Collation(192, "utf8_unicode_ci", 0, MYSQL_CHARSET_NAME_utf8); collation[193] = new Collation(193, "utf8_icelandic_ci", 0, MYSQL_CHARSET_NAME_utf8); collation[194] = new Collation(194, "utf8_latvian_ci", 0, MYSQL_CHARSET_NAME_utf8); collation[195] = new Collation(195, "utf8_romanian_ci", 0, MYSQL_CHARSET_NAME_utf8); collation[196] = new Collation(196, "utf8_slovenian_ci", 0, MYSQL_CHARSET_NAME_utf8); collation[197] = new Collation(197, "utf8_polish_ci", 0, MYSQL_CHARSET_NAME_utf8); collation[198] = new Collation(198, "utf8_estonian_ci", 0, MYSQL_CHARSET_NAME_utf8); collation[199] = new Collation(199, "utf8_spanish_ci", 0, MYSQL_CHARSET_NAME_utf8); collation[200] = new Collation(200, "utf8_swedish_ci", 0, MYSQL_CHARSET_NAME_utf8); collation[201] = new Collation(201, "utf8_turkish_ci", 0, MYSQL_CHARSET_NAME_utf8); collation[202] = new Collation(202, "utf8_czech_ci", 0, MYSQL_CHARSET_NAME_utf8); collation[203] = new Collation(203, "utf8_danish_ci", 0, MYSQL_CHARSET_NAME_utf8); collation[204] = new Collation(204, "utf8_lithuanian_ci", 0, MYSQL_CHARSET_NAME_utf8); collation[205] = new Collation(205, "utf8_slovak_ci", 0, MYSQL_CHARSET_NAME_utf8); collation[206] = new Collation(206, "utf8_spanish2_ci", 0, MYSQL_CHARSET_NAME_utf8); collation[207] = new Collation(207, "utf8_roman_ci", 0, MYSQL_CHARSET_NAME_utf8); collation[208] = new Collation(208, "utf8_persian_ci", 0, MYSQL_CHARSET_NAME_utf8); collation[209] = new Collation(209, "utf8_esperanto_ci", 0, MYSQL_CHARSET_NAME_utf8); collation[210] = new Collation(210, "utf8_hungarian_ci", 0, MYSQL_CHARSET_NAME_utf8); collation[211] = new Collation(211, "utf8_sinhala_ci", 0, MYSQL_CHARSET_NAME_utf8); collation[212] = new Collation(212, "utf8_german2_ci", 0, MYSQL_CHARSET_NAME_utf8); collation[213] = new Collation(213, "utf8_croatian_ci", 0, MYSQL_CHARSET_NAME_utf8); collation[214] = new Collation(214, "utf8_unicode_520_ci", 0, MYSQL_CHARSET_NAME_utf8); collation[215] = new Collation(215, "utf8_vietnamese_ci", 0, MYSQL_CHARSET_NAME_utf8); collation[223] = new Collation(223, "utf8_general_mysql500_ci", 0, MYSQL_CHARSET_NAME_utf8); collation[224] = new Collation(224, "utf8mb4_unicode_ci", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[225] = new Collation(225, "utf8mb4_icelandic_ci", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[226] = new Collation(226, "utf8mb4_latvian_ci", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[227] = new Collation(227, "utf8mb4_romanian_ci", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[228] = new Collation(228, "utf8mb4_slovenian_ci", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[229] = new Collation(229, "utf8mb4_polish_ci", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[230] = new Collation(230, "utf8mb4_estonian_ci", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[231] = new Collation(231, "utf8mb4_spanish_ci", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[232] = new Collation(232, "utf8mb4_swedish_ci", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[233] = new Collation(233, "utf8mb4_turkish_ci", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[234] = new Collation(234, "utf8mb4_czech_ci", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[235] = new Collation(235, "utf8mb4_danish_ci", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[236] = new Collation(236, "utf8mb4_lithuanian_ci", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[237] = new Collation(237, "utf8mb4_slovak_ci", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[238] = new Collation(238, "utf8mb4_spanish2_ci", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[239] = new Collation(239, "utf8mb4_roman_ci", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[240] = new Collation(240, "utf8mb4_persian_ci", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[241] = new Collation(241, "utf8mb4_esperanto_ci", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[242] = new Collation(242, "utf8mb4_hungarian_ci", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[243] = new Collation(243, "utf8mb4_sinhala_ci", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[244] = new Collation(244, "utf8mb4_german2_ci", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[245] = new Collation(245, "utf8mb4_croatian_ci", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[246] = new Collation(246, "utf8mb4_unicode_520_ci", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[247] = new Collation(247, "utf8mb4_vietnamese_ci", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[248] = new Collation(248, "gb18030_chinese_ci", 1, MYSQL_CHARSET_NAME_gb18030); collation[249] = new Collation(249, "gb18030_bin", 0, MYSQL_CHARSET_NAME_gb18030); collation[250] = new Collation(250, "gb18030_unicode_520_ci", 0, MYSQL_CHARSET_NAME_gb18030); collation[255] = new Collation(255, "utf8mb4_0900_ai_ci", 1, MYSQL_CHARSET_NAME_utf8mb4); collation[256] = new Collation(256, "utf8mb4_de_pb_0900_ai_ci", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[257] = new Collation(257, "utf8mb4_is_0900_ai_ci", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[258] = new Collation(258, "utf8mb4_lv_0900_ai_ci", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[259] = new Collation(259, "utf8mb4_ro_0900_ai_ci", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[260] = new Collation(260, "utf8mb4_sl_0900_ai_ci", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[261] = new Collation(261, "utf8mb4_pl_0900_ai_ci", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[262] = new Collation(262, "utf8mb4_et_0900_ai_ci", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[263] = new Collation(263, "utf8mb4_es_0900_ai_ci", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[264] = new Collation(264, "utf8mb4_sv_0900_ai_ci", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[265] = new Collation(265, "utf8mb4_tr_0900_ai_ci", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[266] = new Collation(266, "utf8mb4_cs_0900_ai_ci", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[267] = new Collation(267, "utf8mb4_da_0900_ai_ci", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[268] = new Collation(268, "utf8mb4_lt_0900_ai_ci", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[269] = new Collation(269, "utf8mb4_sk_0900_ai_ci", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[270] = new Collation(270, "utf8mb4_es_trad_0900_ai_ci", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[271] = new Collation(271, "utf8mb4_la_0900_ai_ci", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[273] = new Collation(273, "utf8mb4_eo_0900_ai_ci", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[274] = new Collation(274, "utf8mb4_hu_0900_ai_ci", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[275] = new Collation(275, "utf8mb4_hr_0900_ai_ci", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[277] = new Collation(277, "utf8mb4_vi_0900_ai_ci", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[278] = new Collation(278, "utf8mb4_0900_as_cs", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[279] = new Collation(279, "utf8mb4_de_pb_0900_as_cs", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[280] = new Collation(280, "utf8mb4_is_0900_as_cs", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[281] = new Collation(281, "utf8mb4_lv_0900_as_cs", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[282] = new Collation(282, "utf8mb4_ro_0900_as_cs", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[283] = new Collation(283, "utf8mb4_sl_0900_as_cs", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[284] = new Collation(284, "utf8mb4_pl_0900_as_cs", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[285] = new Collation(285, "utf8mb4_et_0900_as_cs", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[286] = new Collation(286, "utf8mb4_es_0900_as_cs", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[287] = new Collation(287, "utf8mb4_sv_0900_as_cs", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[288] = new Collation(288, "utf8mb4_tr_0900_as_cs", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[289] = new Collation(289, "utf8mb4_cs_0900_as_cs", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[290] = new Collation(290, "utf8mb4_da_0900_as_cs", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[291] = new Collation(291, "utf8mb4_lt_0900_as_cs", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[292] = new Collation(292, "utf8mb4_sk_0900_as_cs", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[293] = new Collation(293, "utf8mb4_es_trad_0900_as_cs", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[294] = new Collation(294, "utf8mb4_la_0900_as_cs", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[296] = new Collation(296, "utf8mb4_eo_0900_as_cs", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[297] = new Collation(297, "utf8mb4_hu_0900_as_cs", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[298] = new Collation(298, "utf8mb4_hr_0900_as_cs", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[300] = new Collation(300, "utf8mb4_vi_0900_as_cs", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[303] = new Collation(303, "utf8mb4_ja_0900_as_cs", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[304] = new Collation(304, "utf8mb4_ja_0900_as_cs_ks", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[305] = new Collation(305, "utf8mb4_0900_as_ci", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[306] = new Collation(306, "utf8mb4_ru_0900_ai_ci", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[307] = new Collation(307, "utf8mb4_ru_0900_as_cs", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[308] = new Collation(308, "utf8mb4_zh_0900_as_cs", 0, MYSQL_CHARSET_NAME_utf8mb4); collation[309] = new Collation(309, "utf8mb4_0900_bin", 0, MYSQL_CHARSET_NAME_utf8mb4); COLLATION_INDEX_TO_COLLATION_NAME = new String[MAP_SIZE]; Map<Integer, MysqlCharset> collationIndexToCharset = new TreeMap<>(); Map<String, Integer> charsetNameToCollationIndexMap = new TreeMap<>(); Map<String, Integer> charsetNameToCollationPriorityMap = new TreeMap<>(); Map<String, Integer> collationNameToCollationIndexMap = new TreeMap<>(); Set<Integer> impermissibleIndexes = new HashSet<>(); for (int i = 1; i < MAP_SIZE; i++) { Collation coll = collation[i]; if (coll != null) { COLLATION_INDEX_TO_COLLATION_NAME[i] = coll.collationName; collationIndexToCharset.put(i, coll.mysqlCharset); collationNameToCollationIndexMap.put(coll.collationName, i); String charsetName = coll.mysqlCharset.charsetName; if (!charsetNameToCollationIndexMap.containsKey(charsetName) || charsetNameToCollationPriorityMap.get(charsetName) < coll.priority) { charsetNameToCollationIndexMap.put(charsetName, i); charsetNameToCollationPriorityMap.put(charsetName, coll.priority); } // Filling indexes of impermissible client character sets ucs2, utf16, utf16le, utf32 if (charsetName.equals(MYSQL_CHARSET_NAME_ucs2) || charsetName.equals(MYSQL_CHARSET_NAME_utf16) || charsetName.equals(MYSQL_CHARSET_NAME_utf16le) || charsetName.equals(MYSQL_CHARSET_NAME_utf32)) { impermissibleIndexes.add(i); } } } COLLATION_INDEX_TO_CHARSET = Collections.unmodifiableMap(collationIndexToCharset); CHARSET_NAME_TO_COLLATION_INDEX = Collections.unmodifiableMap(charsetNameToCollationIndexMap); COLLATION_NAME_TO_COLLATION_INDEX = Collections.unmodifiableMap(collationNameToCollationIndexMap); IMPERMISSIBLE_INDEXES = Collections.unmodifiableSet(impermissibleIndexes); collation = null; } protected static String getStaticMysqlCharsetForJavaEncoding(String javaEncoding, ServerVersion version) { List<MysqlCharset> mysqlCharsets = CharsetMapping.JAVA_ENCODING_UC_TO_MYSQL_CHARSET.get(javaEncoding.toUpperCase(Locale.ENGLISH)); if (mysqlCharsets != null) { if (version == null) { return mysqlCharsets.get(0).charsetName; // Take the first one we get } MysqlCharset currentChoice = null; for (MysqlCharset charset : mysqlCharsets) { if (charset.isOkayForVersion(version) && (currentChoice == null || currentChoice.minimumVersion.compareTo(charset.minimumVersion) < 0 || currentChoice.priority < charset.priority && currentChoice.minimumVersion.compareTo(charset.minimumVersion) == 0)) { currentChoice = charset; } } if (currentChoice != null) { return currentChoice.charsetName; } } return null; } protected static int getStaticCollationIndexForJavaEncoding(String javaEncoding, ServerVersion version) { String charsetName = getStaticMysqlCharsetForJavaEncoding(javaEncoding, version); return getStaticCollationIndexForMysqlCharsetName(charsetName); } protected static int getStaticCollationIndexForMysqlCharsetName(String charsetName) { if (charsetName != null) { Integer ci = CHARSET_NAME_TO_COLLATION_INDEX.get(charsetName); if (ci != null) { return ci.intValue(); } } return 0; } // TODO turn it to protected when com.mysql.cj.xdevapi.ColumnImpl can use dynamic maps public static String getStaticMysqlCharsetNameForCollationIndex(Integer collationIndex) { MysqlCharset charset = null; if (collationIndex != null) { charset = COLLATION_INDEX_TO_CHARSET.get(collationIndex); } return charset != null ? charset.charsetName : null; } // TODO turn it to protected when com.mysql.cj.xdevapi.ColumnImpl can use dynamic maps public static String getStaticCollationNameForCollationIndex(Integer collationIndex) { if (collationIndex != null && collationIndex > 0 && collationIndex < MAP_SIZE) { return COLLATION_INDEX_TO_COLLATION_NAME[collationIndex]; } return null; } protected static Integer getStaticCollationIndexForCollationName(String collationName) { return CharsetMapping.COLLATION_NAME_TO_COLLATION_INDEX.get(collationName); } /** * MySQL charset could map to several Java encodings. * So here we choose the one according to next rules: * <ul> * <li>if there is no static mapping for this charset then return javaEncoding value as is because this * could be a custom charset for example * <li>if static mapping exists and javaEncoding equals to one of Java encoding canonical names or aliases available * for this mapping then javaEncoding value as is; this is required when result should match to connection encoding, for example if connection encoding is * Cp943 we must avoid getting SHIFT_JIS for sjis mysql charset * <li>if static mapping exists and javaEncoding doesn't match any Java encoding canonical * names or aliases available for this mapping then return default Java encoding (the first in mapping list) * </ul> * * @param mysqlCharsetName * MySQL charset name * @param fallbackJavaEncoding * fall-back java encoding name * @return java encoding name */ protected static String getStaticJavaEncodingForMysqlCharset(String mysqlCharsetName, String fallbackJavaEncoding) { MysqlCharset cs = getStaticMysqlCharsetByName(mysqlCharsetName); return cs != null ? cs.getMatchingJavaEncoding(fallbackJavaEncoding) : fallbackJavaEncoding; } protected static MysqlCharset getStaticMysqlCharsetByName(String mysqlCharsetName) { return CHARSET_NAME_TO_CHARSET.get(mysqlCharsetName); } protected static String getStaticJavaEncodingForMysqlCharset(String mysqlCharsetName) { return getStaticJavaEncodingForMysqlCharset(mysqlCharsetName, null); } protected static String getStaticJavaEncodingForCollationIndex(Integer collationIndex, String fallbackJavaEncoding) { MysqlCharset charset = null; if (collationIndex != null) { charset = COLLATION_INDEX_TO_CHARSET.get(collationIndex); } return charset != null ? charset.getMatchingJavaEncoding(fallbackJavaEncoding) : fallbackJavaEncoding; } // TODO turn it to protected when com.mysql.cj.protocol.x.FieldFactory can use dynamic maps public static String getStaticJavaEncodingForCollationIndex(Integer collationIndex) { return getStaticJavaEncodingForCollationIndex(collationIndex, null); } /** * Does the character set contain multi-byte encoded characters. * * @param javaEncodingName * java encoding name * @return true if the character set contains multi-byte encoded characters. */ protected static boolean isStaticMultibyteCharset(String javaEncodingName) { return MULTIBYTE_ENCODINGS.contains(javaEncodingName.toUpperCase(Locale.ENGLISH)); } protected static int getStaticMblen(String charsetName) { if (charsetName != null) { MysqlCharset cs = getStaticMysqlCharsetByName(charsetName); if (cs != null) { return cs.mblen; } } return 0; } protected static boolean isStaticImpermissibleCollation(int collationIndex) { return CharsetMapping.IMPERMISSIBLE_INDEXES.contains(collationIndex); } } class MysqlCharset { public final String charsetName; public final int mblen; public final int priority; public final List<String> javaEncodingsUc = new ArrayList<>(); public final ServerVersion minimumVersion; /** * Constructs MysqlCharset object * * @param charsetName * MySQL charset name * @param mblen * Max number of bytes per character * @param priority * MysqlCharset with highest value of this param will be used for Java encoding --&gt; Mysql charsets conversion. * @param javaEncodings * List of Java encodings corresponding to this MySQL charset; the first name in list is the default for mysql --&gt; java data conversion */ public MysqlCharset(String charsetName, int mblen, int priority, String[] javaEncodings) { this(charsetName, mblen, priority, javaEncodings, new ServerVersion(0, 0, 0)); } private void addEncodingMapping(String encoding) { String encodingUc = encoding.toUpperCase(Locale.ENGLISH); if (!this.javaEncodingsUc.contains(encodingUc)) { this.javaEncodingsUc.add(encodingUc); } } public MysqlCharset(String charsetName, int mblen, int priority, String[] javaEncodings, ServerVersion minimumVersion) { this.charsetName = charsetName; this.mblen = mblen; this.priority = priority; for (int i = 0; i < javaEncodings.length; i++) { String encoding = javaEncodings[i]; try { Charset cs = Charset.forName(encoding); addEncodingMapping(cs.name()); cs.aliases().forEach(this::addEncodingMapping); } catch (Exception e) { // if there is no support of this charset in JVM it's still possible to use our converter for 1-byte charsets if (mblen == 1) { addEncodingMapping(encoding); } } } if (this.javaEncodingsUc.size() == 0) { addEncodingMapping(mblen > 1 ? "UTF-8" : "Cp1252"); } this.minimumVersion = minimumVersion; } @Override public String toString() { StringBuilder asString = new StringBuilder(); asString.append("["); asString.append("charsetName="); asString.append(this.charsetName); asString.append(",mblen="); asString.append(this.mblen); // asString.append(",javaEncoding="); // asString.append(this.javaEncodings.toString()); asString.append("]"); return asString.toString(); } boolean isOkayForVersion(ServerVersion version) { return version.meetsMinimum(this.minimumVersion); } /** * If javaEncoding parameter value is one of available java encodings for this charset * then returns javaEncoding value as is. Otherwise returns first available java encoding name. * * @param javaEncoding * java encoding name * @return java encoding name */ String getMatchingJavaEncoding(String javaEncoding) { if (javaEncoding != null && this.javaEncodingsUc.contains(javaEncoding.toUpperCase(Locale.ENGLISH))) { return javaEncoding; } return this.javaEncodingsUc.get(0); } } class Collation { public final int index; public final String collationName; public final int priority; public final MysqlCharset mysqlCharset; public Collation(int index, String collationName, int priority, String charsetName) { this.index = index; this.collationName = collationName; this.priority = priority; this.mysqlCharset = CharsetMapping.getStaticMysqlCharsetByName(charsetName); } @Override public String toString() { StringBuilder asString = new StringBuilder(); asString.append("["); asString.append("index="); asString.append(this.index); asString.append(",collationName="); asString.append(this.collationName); asString.append(",charsetName="); asString.append(this.mysqlCharset.charsetName); asString.append(",javaCharsetName="); asString.append(this.mysqlCharset.getMatchingJavaEncoding(null)); asString.append("]"); return asString.toString(); } }
[ "Manuel.navarro@revature.net" ]
Manuel.navarro@revature.net
8d645a6d621929c9425966be965a824b16073695
556b31afb251be4b404fb34224d0639a464ae0ad
/src/main/java/com/easysign/gateway/controller/AppleApiDeviceController.java
3e9c561e624efbd475b2a359164e8601dd7683a5
[]
no_license
bollus/apple-api-gateway
7c790237a32ff1ee4c3a2e040e1ea61369de0bd4
c9b1e0b23c78e0d8d360873bf64c1ff5d8ee7d07
refs/heads/master
2023-05-30T03:10:26.161756
2021-06-12T15:24:50
2021-06-12T15:24:50
376,321,678
0
0
null
null
null
null
UTF-8
Java
false
false
2,912
java
package com.easysign.gateway.controller; import com.easysign.gateway.entity.request.AppleAccountRequest; import com.easysign.gateway.entity.request.AppleCreateDeviceRequest; import com.easysign.gateway.entity.response.AppleCreateDeviceResponse; import com.easysign.gateway.entity.response.AppleDeviceResponse; import com.easysign.gateway.entity.response.AppleDeviceStatisticsResponse; import com.easysign.gateway.enums.RequestMethod; import com.easysign.gateway.enums.ResultCode; import com.easysign.gateway.service.DeviceService; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; /** * @ProjectName: gateway * @Package: com.easysign.gateway.controller * @ClassName: AppleApiDeviceController * @Author: Strawberry * @Description: * @Date: 2021/06/12 17:26 */ @RestController @RequestMapping("/o/apple/device") @Slf4j public class AppleApiDeviceController { @Resource private DeviceService deviceService; @RequestMapping("create") public AppleCreateDeviceResponse create(AppleCreateDeviceRequest appleCreateDeviceRequest, HttpServletRequest request) { AppleCreateDeviceResponse response = new AppleCreateDeviceResponse(); if (!request.getMethod().equals(RequestMethod.POST.name())) { response.init(request); response.setCode(ResultCode.METHOD_NOT_SUPPORTED.getCode()); response.setError("This Method Not Allowed"); } else { response = deviceService.create(appleCreateDeviceRequest, request); } return response; } @RequestMapping("list") public AppleDeviceResponse list(AppleAccountRequest appleAccountRequest, HttpServletRequest request) { AppleDeviceResponse response = new AppleDeviceResponse(); if (!request.getMethod().equals(RequestMethod.POST.name())) { response.init(request); response.setCode(ResultCode.METHOD_NOT_SUPPORTED.getCode()); response.setError("This Method Not Allowed"); } else { response = deviceService.list(appleAccountRequest, request); } return response; } @RequestMapping("statistics") public AppleDeviceStatisticsResponse statistics(AppleAccountRequest appleAccountRequest, HttpServletRequest request) { AppleDeviceStatisticsResponse response = new AppleDeviceStatisticsResponse(); if (!request.getMethod().equals(RequestMethod.POST.name())) { response.init(request); response.setCode(ResultCode.METHOD_NOT_SUPPORTED.getCode()); response.setError("This Method Not Allowed"); } else { response = deviceService.statistics(appleAccountRequest, request); } return response; } }
[ "13547990344@139.com" ]
13547990344@139.com
acf90c89392dbb26dc897e4881b5037062cebb98
0610fb594915eef52d1b6fdef121f0f8f4059d26
/src/main/java/exceptions/Example.java
fbe2403009de765a197865c2c72101f8d8d0e5c2
[]
no_license
amhtech/safari-start-java
6039fcbde012f3a3ab430fa8e1359f689323fabd
3c439bcea82844c82f25585b351ea862be75fa86
refs/heads/master
2022-12-25T04:47:17.676851
2020-10-09T16:01:27
2020-10-09T16:01:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
750
java
package exceptions; public class Example { public static String dayName(int d) { if (d < 0 || d > 6) { throw new IllegalArgumentException("Bad day number " + d); } String[] names = {"Saturday", "Sunday", "Monday", "Tuesday", "Wendesday", "Thursday", "Friday"}; return names[d]; } public static void main(String[] args) { System.out.println("day 0 is " + dayName(0)); try { System.out.println("About to try silly day name"); String name = dayName(-1); System.out.println("day 0 is " + name); System.out.println("Name succesfully extracted"); } catch (IllegalArgumentException ie) { System.out.println("oops, " + ie.getMessage()); } System.out.println("Finished"); } }
[ "simon@dancingcloudservices.com" ]
simon@dancingcloudservices.com
5156fbd2977e87087dc66eee5f51ed5cd186d23d
5c1562e2ed8c62623ddfa29ac46197841bfddbc9
/ztest-boot-mvc/src/main/java/com/ztest/boot/mvc/common/Statistics.java
d051182a522b94a337bcb5883ec31fb0252c2c90
[]
no_license
pxiebray/boot-example
ef4c6566c56c08b92216bbb5ab16a46633838b56
91a255da0adf3e8a89d9bc3434c66f038a2ff0ec
refs/heads/master
2022-12-22T12:28:17.687669
2019-10-11T12:59:40
2019-10-11T12:59:40
144,964,719
0
0
null
2022-12-16T04:33:41
2018-08-16T09:12:12
Java
UTF-8
Java
false
false
323
java
package com.ztest.boot.mvc.common; import java.lang.annotation.*; /** * ๅŸบไบŽ@Aspect้…็ฝฎAOPๅฎž็Žฐ็š„็ปŸ่ฎกๆณจ่งฃ * * @author Administrator * @version 1.0 * @data 2018/7/13 0013 43 */ @Documented @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) public @interface Statistics { String value(); }
[ "pxiebray@gmail.com" ]
pxiebray@gmail.com
13aa8f13ab62680620002a30b8c8ffac41741b23
d52e27a6f83539574fe8070612076fc234395250
/comsumer-feign/src/test/java/com/camp/ComsumerFeignApplicationTests.java
5a66effc706042735a04287ed71359674b7a3b66
[]
no_license
tigerlw/spring-cloud-demo
a55cd1273542ea6ec9d3403072f08a34392a6d4a
b8333c4a636a44d57d791b71af9c62cd20f1e348
refs/heads/master
2020-04-06T04:09:17.789323
2018-11-25T03:52:55
2018-11-25T03:52:55
83,028,657
0
0
null
null
null
null
UTF-8
Java
false
false
1,586
java
package com.camp; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.context.embedded.LocalServerPort; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringRunner; import static org.assertj.core.api.BDDAssertions.then; @RunWith(SpringRunner.class) @SpringBootTest(classes = ComsumerFeignApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @ActiveProfiles("test") public class ComsumerFeignApplicationTests { @BeforeClass public static void startEureka() { // ๅ…ˆ่ฟ่กŒ register-eureka ๅ’Œ provider-eureka } @AfterClass public static void closeEureka() { } @LocalServerPort private int port; @Autowired private TestRestTemplate testRestTemplate; @Test public void campAddTest() throws InterruptedException { Thread.sleep(3000); // registration has to take place... ResponseEntity<String> response = this.testRestTemplate.getForEntity( "http://localhost:" + this.port + "/add", String.class); then(response.getStatusCode()).isEqualTo(HttpStatus.OK); then(response.getBody()).contains("40"); } }
[ "301076651@qq.com" ]
301076651@qq.com
fe022ab8d248da4e5e9cebf2e4ffe2eac84010fb
769e01d5c60f01eef96429de3df1a3e2864de945
/modules/ads_lib/src/main/java/com/google/api/ads/adwords/lib/selectorfields/v201605/cm/BudgetOrderField.java
7ad44d05ae43477da764aa9226c7f3fb75e7f6e5
[ "Apache-2.0" ]
permissive
EliaKunz/googleads-java-lib
a0af9422cb078342b5c16e95667e2421720823d5
963f48ec99c1f5d5243e1efc72328635916e4f17
refs/heads/master
2021-01-21T05:55:07.914627
2016-08-26T19:03:00
2016-08-26T19:03:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,331
java
// Copyright 2016 Google Inc. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.api.ads.adwords.lib.selectorfields.v201605.cm; import com.google.api.ads.adwords.lib.selectorfields.EntityField; import com.google.api.ads.adwords.lib.selectorfields.Filterable; /** * A {@code Enum} to facilitate the selection of fields for {@code BudgetOrder}. */ public enum BudgetOrderField implements EntityField { // Fields constants definitions /** * This must be passed as a string with dashes, e.g. * "1234-5678-9012-3456". */ @Filterable BillingAccountId(true), /** * Enables user to specify meaningful name for a billing account to aid in reconciling monthly invoices. * This name will be printed in the monthly invoices. * <span class="constraint Billing">This element only applies if manager account is whitelisted for new billing backend.</span> */ @Filterable BillingAccountName(true), /** * Enables user to specify meaningful name for referencing this budget order. * A default name will be provided if none is specified. * This name will be printed in the monthly invoices. * <span class="constraint Billing">This element only applies if manager account is whitelisted for new billing backend.</span> */ @Filterable BudgetOrderName(true), /** * EndDateTime must be on or before "20361231 235959 America/Los_Angeles" or must set the same instant as "20371230 235959 America/Los_Angeles" to indicate infinite end date. * StartDateTime and EndDateTime must use the same time zone. */ @Filterable EndDateTime(true), /** * */ @Filterable Id(true), /** * Contains fields that provide information on the last set of values that were passed in through the parent BudgetOrder for mutate.add and mutate.set. * <span class="constraint Billing">This element only applies if manager account is whitelisted for new billing backend.</span> */ LastRequest(false), /** * Enables user to enter a value that helps them reference this budget order in their monthly invoices. * This number will be printed in the monthly invoices. * <span class="constraint Billing">This element only applies if manager account is whitelisted for new billing backend.</span> */ @Filterable PoNumber(true), /** * A 12 digit billing ID assigned to the user by Google. * This must be passed in as a string with dashes, e.g. * "1234-5678-9012". * For mutate.add, this field is required if billingAccountId is not specified. * <span class="constraint Billing">This element only applies if manager account is whitelisted for new billing backend.</span> */ @Filterable PrimaryBillingId(true), /** * For certain users, a secondary billing ID will be required on mutate.add. * If this requirement was not communicated to the user, the user may ignore this parameter. * If specified, this must be passed in as a string with dashes, e.g. * "1234-5678-9012". * <span class="constraint Billing">This element only applies if manager account is whitelisted for new billing backend.</span> */ @Filterable SecondaryBillingId(true), /** * The spending limit in micros. * To specify an unlimited budget, set spendingLimit to -1, otherwise spendingLimit must be greater than 0. */ @Filterable SpendingLimit(true), /** * StartDateTime cannot be in the past, it must be on or before "20361231 235959 America/Los_Angeles". * StartDateTime and EndDateTime must use the same time zone. */ @Filterable StartDateTime(true), ; private final boolean isFilterable; private BudgetOrderField(boolean isFilterable) { this.isFilterable = isFilterable; } @Override public boolean isFilterable() { return this.isFilterable; } }
[ "jradcliff@users.noreply.github.com" ]
jradcliff@users.noreply.github.com
24042fdfacb51c18fc3870a05088ea2fa33f9210
5fc120ac308e959eb9919ecc2cffbeddd0e00a0d
/snowjena-core/src/main/java/cn/yueshutong/core/observer/RateLimiterObserver.java
cc4cdf17ad92a5315f9fc37f8601dcd9f8d3d127
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
ItOntheWay/SnowJena
cd284fb3481d228594842b49944f945049d80338
69976b45386e1ae8f948bce0a84f44b8cb8253b1
refs/heads/master
2022-11-24T21:00:54.701262
2020-08-02T15:47:59
2020-08-02T15:47:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,587
java
package cn.yueshutong.core.observer; import cn.yueshutong.commoon.entity.RateLimiterRule; import cn.yueshutong.commoon.enums.LimiterModel; import cn.yueshutong.core.config.RateLimiterConfig; import cn.yueshutong.core.exception.SnowJeanException; import cn.yueshutong.core.limiter.RateLimiter; import cn.yueshutong.monitor.entity.MonitorBean; import com.alibaba.fastjson.JSON; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.TimeUnit; /** * ่ง‚ๅฏŸ่€…ๆจกๅผ๏ผˆไธ€ๅฏนๅคš๏ผ‰ */ public class RateLimiterObserver { private static Map<String, RateLimiter> map = new ConcurrentHashMap<>(); private static Logger logger = LoggerFactory.getLogger(RateLimiterObserver.class); /** * ๆณจๅ†Œ้™ๆตๅ™จ */ public static void registered(RateLimiter limiter, RateLimiterConfig config) { if (map.containsKey(limiter.getId())) { throw new SnowJeanException("Repeat registration for current limiting rules:" + limiter.getId()); } map.put(limiter.getId(), limiter); if (!limiter.getRule().getLimiterModel().equals(LimiterModel.CLOUD)){ //ๆœฌๅœฐ้™ๆตๅชๆณจๅ†Œ return; } update(limiter, config); monitor(limiter, config); } public static Map<String, RateLimiter> getMap() { return map; } /** * ๅ‘้€ๅฟƒ่ทณๅนถๆ›ดๆ–ฐ้™ๆต่ง„ๅˆ™ */ private static void update(RateLimiter limiter, RateLimiterConfig config) { config.getScheduledThreadExecutor().scheduleWithFixedDelay(() -> { String rules = config.getTicketServer().connect(RateLimiterConfig.http_heart, JSON.toJSONString(limiter.getRule())); if (rules == null) { //TicketServerๆŒ‚ๆމ logger.debug("update limiter fail, automatically switch to local current limit"); RateLimiterRule rule = limiter.getRule(); rule.setLimiterModel(LimiterModel.POINT); limiter.init(rule); return; } RateLimiterRule rateLimiterRule = JSON.parseObject(rules, RateLimiterRule.class); if (rateLimiterRule.getVersion() > limiter.getRule().getVersion()) { //็‰ˆๆœฌๅ‡็บง logger.info("update rule version: {} -> {}", limiter.getRule().getVersion(), rateLimiterRule.getVersion()); map.get(limiter.getId()).init(rateLimiterRule); } else if (rateLimiterRule.getLimiterModel().equals(LimiterModel.POINT)) { //ๆœฌๅœฐ/ๅˆ†ๅธƒๅผๅˆ‡ๆข rateLimiterRule.setLimiterModel(LimiterModel.CLOUD); map.get(limiter.getId()).init(rateLimiterRule); } }, 0, 1, TimeUnit.SECONDS); } /** * ็›‘ๆŽงๆ•ฐๆฎไธŠๆŠฅ */ private static void monitor(RateLimiter limiter, RateLimiterConfig config) { config.getScheduledThreadExecutor().scheduleWithFixedDelay(() -> { if (limiter.getRule().getMonitor() == 0) { //็›‘ๆŽงๅŠŸ่ƒฝๅทฒๅ…ณ้—ญ return; } List<MonitorBean> monitorBeans = limiter.getMonitorService().getAndDelete(); if (monitorBeans.size() < 1) { return; } String result = config.getTicketServer().connect(RateLimiterConfig.http_monitor, JSON.toJSONString(monitorBeans)); if (result == null) { logger.debug("http_monitor data update fail"); } }, 0, 3, TimeUnit.SECONDS); } }
[ "yster@foxmail.com" ]
yster@foxmail.com
452af9372ee6cee8b22a1c968f6f39d066662dfa
2913e9a9b47c08a10e7227e071c924694bd760a7
/DesighPattem/src/com/factory/abtract/ingredient/implement/ThickCrustDough.java
61639ca6f1f04c6496ee81a56001c55eee6a9394
[]
no_license
luongbangnguyen/Design_Pattem
dc67630e046cbc8f8995864972deb691544da69f
8fff02993a6ab7af9719d69c9b45fb1c681b2122
refs/heads/master
2021-01-22T14:02:08.447827
2015-04-06T02:20:50
2015-04-06T02:21:31
31,666,742
0
0
null
null
null
null
UTF-8
Java
false
false
144
java
package com.factory.abtract.ingredient.implement; import com.factory.abtract.ingredient.Dough; public class ThickCrustDough extends Dough{ }
[ "luongbangvh@gmail.com" ]
luongbangvh@gmail.com
11bc12d95e8cc1584abfb521190a7688076cc9ef
062fd109111337e64734dfe759ca078b6a85f6ef
/src/main/java/com/sg/vendingmachine/dto/VendingMachineDetails.java
088030865ed70252331e7a3c752869ed20778962
[]
no_license
yy2325/VendingMachineWithSpringDI
e18bc0effde7f548ed124b5fe5fc08cc8473b892
df40809455c8779690139be2344a1f27d5fecf9d
refs/heads/main
2023-09-02T04:52:34.646024
2021-11-19T05:48:34
2021-11-19T05:48:34
429,683,714
0
0
null
null
null
null
UTF-8
Java
false
false
671
java
package com.sg.vendingmachine.dto; /** * This class contains getter and setter for * int array, to be used to calculate the change in Change class * @author Yi Yang * */ public class VendingMachineDetails { int[] intArray = new int[10]; /** * Constructs a new VendingMachineDetails object */ public VendingMachineDetails() { } /** * Sets the int array * @param intArray */ public void setIntArray(int[] intArray) { this.intArray = intArray; } /** * Returns the int array * @return the int array */ public int[] getIntArray() { return this.intArray; } }
[ "yy2324@nyu.edu" ]
yy2324@nyu.edu
b1facceabf63f556645ad042deedc9339773f5ae
71a5184b55d73d593f1f5d5bc960bf62066fd252
/beadando/bank-application/src/main/java/hu/elte/bankapp/controllers/AccountsController.java
0cea5f81764286c45670f821e736df750e835745
[]
no_license
gulyassimone/Elte-5fv-Web-fejlesztes-4.-Java-alapon-EA-GY
05252066c14528c60631683f9c9c38cb533e29ad
d264e6cec3c9123ad8ebac62dc309f944c98c8d1
refs/heads/main
2023-08-02T08:35:03.534965
2021-11-14T14:22:26
2021-11-14T14:22:26
403,713,589
0
0
null
null
null
null
UTF-8
Java
false
false
4,315
java
package hu.elte.bankapp.controllers; import hu.elte.bankapp.webdomain.*; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import java.util.ArrayList; import java.util.List; @Controller public class AccountsController { CustomerView customerView; List<TransactionView> transactionViews; List<TransactionView> savedTransactionViews; List<AccountView> personalAccountViews; List<AccountView> savingAccountViews; List<DirectDebitView> directDebitViews; @RequestMapping("/personal_account") public String getPersonalAccounts(Model model) { model.addAttribute("title", "Personal Accounts"); if (personalAccountViews == null) { dummyPersonalAccounts(); } if (transactionViews == null) { dummyTransactions(); } model.addAttribute("accountViews", personalAccountViews); model.addAttribute("transactionViews", transactionViews); return "personal_accounts.html"; } @RequestMapping("/account_history") public String getAccountHistory(Model model) { model.addAttribute("title", "Account history"); if(transactionViews == null) { dummyTransactions(); } if(personalAccountViews == null) { dummyPersonalAccounts(); } model.addAttribute("account", new AccountView(123, "9809890")); model.addAttribute("accounts", personalAccountViews); model.addAttribute("transactions", transactionViews); return "account_history_module.html"; } @RequestMapping("/saving_account") public String getSavingAccounts(Model model) { model.addAttribute("title", "Saving Accounts"); if (transactionViews == null) { dummyTransactions(); } if (personalAccountViews == null) { dummyPersonalAccounts(); } if (savingAccountViews == null) { dummySavingAccounts(); } model.addAttribute("transactionViews", transactionViews); model.addAttribute("accountViews", savingAccountViews); return "saving_accounts.html"; } //DUMMY DATA private void dummySavedTransactions() { savedTransactionViews = new ArrayList<>(); TransactionView transaction1 = new TransactionView("Deposit", 25000, null, null, null, "77665775"); TransactionView transaction2 = new TransactionView("Deposit", 100000, null, null, null, "77665775"); savedTransactionViews.add(transaction1); savedTransactionViews.add(transaction2); } private void dummyPersonalAccounts() { personalAccountViews = new ArrayList<>(); AccountView accountView1 = new AccountView(1540, "7335300594110"); AccountView accountView2 = new AccountView(3230, "60232312312344"); personalAccountViews.add(accountView1); personalAccountViews.add(accountView2); } private void dummyTransactions() { transactionViews = new ArrayList<>(); TransactionView transaction1 = new TransactionView("Withdraw", 25000, "Rezsi", null, "888888", "77665775"); TransactionView transaction2 = new TransactionView("Withdraw", 100000, "Albรฉrlet", null, "333333", "77665775"); transactionViews.add(transaction1); transactionViews.add(transaction2); } private void dummySavingAccounts() { savingAccountViews = new ArrayList<>(); AccountView accountView1 = new AccountView(1540, "999999999999"); AccountView accountView2 = new AccountView(3230, "876543211111"); savingAccountViews.add(accountView1); savingAccountViews.add(accountView2); } private void dummyDirectDebits() { directDebitViews = new ArrayList<>(); DirectDebitView directDebitView1 = new DirectDebitView("Provider1", "176788873", 5000); DirectDebitView directDebitView2 = new DirectDebitView("Provider1", "176788873", 7000); DirectDebitView directDebitView3 = new DirectDebitView("Provider2", "6666666666", 23999); directDebitViews.add(directDebitView1); directDebitViews.add(directDebitView2); directDebitViews.add(directDebitView3); } }
[ "gulyassimone@gmail.com" ]
gulyassimone@gmail.com
ed8f45ca5c84c9d9a0d6b6c32284242f81227a57
71ef1618384823d984b1949828f59d51db950c47
/visualization/edu.iu.nwb.visualization.prefuse.alpha.smallworld/src/edu/iu/nwb/visualization/prefuse/alpha/smallworld/layout/VoroNetLayout.java
be8eef2f41119d56714b0c0a84fb7eb38c99f852
[]
no_license
mtgallant/cishell-plugins
d6a35838f0478ef6209abcc81b22ace30b6fd739
615e44ca380e0696c2572b15323d8720be9f569c
refs/heads/master
2020-09-25T23:08:35.956705
2017-12-05T19:11:16
2017-12-05T19:11:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,125
java
/* * Created on Nov 13, 2005 * */ package edu.iu.nwb.visualization.prefuse.alpha.smallworld.layout; import java.util.Iterator; import edu.berkeley.guir.prefuse.ItemRegistry; import edu.berkeley.guir.prefuse.action.assignment.Layout; import edu.iu.nwb.visualization.prefuse.alpha.smallworld.geom.DelaunayTriangulation; import edu.iu.nwb.visualization.prefuse.alpha.smallworld.geom.Pnt; import edu.iu.nwb.visualization.prefuse.alpha.smallworld.geom.Simplex; import edu.iu.nwb.visualization.prefuse.alpha.smallworld.types.VoroNode; /** * Constructs voronoi cell shapes and delaunay neighbors for * each voronode in the registry * * This code isn't used but could be if you feel like making life * hard. * * @author Stephen */ public class VoroNetLayout extends Layout { protected String m_itemClass = ItemRegistry.DEFAULT_NODE_CLASS; // protected String m_itemClass = "VoroNode"; private DelaunayTriangulation dt; // The Delaunay triangulation public Simplex initialTriangle; // The large initial triangle private int initialSize = 10000; // Controls size of initial triangle /* (non-Javadoc) * @see edu.berkeley.guir.prefuse.action.Action#run(edu.berkeley.guir.prefuse.ItemRegistry, double) */ public void run( ItemRegistry registry, double frac ) { // create the initial simplex in which to insert // voronodes initialTriangle = new Simplex(new Pnt[] { new Pnt(-initialSize, -initialSize), new Pnt( initialSize, -initialSize), new Pnt( 0, initialSize)}); dt = new DelaunayTriangulation(initialTriangle); // insert the positions of the voronodes // Iterator iter = registry.getItems( m_itemClass, true ); Iterator iter = registry.getNodeItems( true ); while( iter.hasNext( ) ) { try { VoroNode node = (VoroNode) iter.next( ); node.pos( ).owner = node; dt.delaunayPlace( node.pos( ) ); } catch ( ClassCastException e ) { /* do nothing */ }; } // construct the shape of each voronoi cell // System.out.println("---"); // Loop through all the edges of the DT (each is done twice) for (Iterator it = dt.iterator(); it.hasNext();) { Simplex triangle = (Simplex) it.next(); for (Iterator otherIt = dt.neighbors(triangle).iterator(); otherIt.hasNext();) { Simplex other = (Simplex) otherIt.next(); VoroNode a = null; VoroNode b = null; // find the two vertices the simplices share // (a total of 9 iterations max) Iterator yetAnotherIt = triangle.iterator(); while( yetAnotherIt.hasNext( ) ) { VoroNode test = ( ( Pnt ) yetAnotherIt.next() ).owner; if( test == null ) continue; Iterator yetAnotherItStill = other.iterator(); while( yetAnotherItStill.hasNext( ) ) { if( test == ( ( Pnt ) yetAnotherItStill.next() ).owner ) { if( a == null ) { a = test; break; } else { b = test; } } } if( b != null ) break; } Pnt p = Pnt.circumcenter((Pnt[]) triangle.toArray(new Pnt[0])); Pnt q = Pnt.circumcenter((Pnt[]) other.toArray(new Pnt[0])); // add edge to both voronodes if( b != null ) { a.addEdge( p, q ); b.addEdge( p, q ); a.addNeighbor( b ); b.addNeighbor( a ); } } } // build cell shapes from nodes iter = registry.getItems( m_itemClass, true ); while( iter.hasNext( ) ) { try { VoroNode node = (VoroNode) iter.next( ); node.computeCell( ); } catch ( ClassCastException e ) { /* do nothing */ }; } // build shapes from nodes iter = registry.getItems( m_itemClass, true ); while( iter.hasNext( ) ) { try { VoroNode node = (VoroNode) iter.next( ); node.computeShape( ); } catch ( ClassCastException e ) { /* do nothing */ }; } } public static void main( String[] args ) { } public String getItemClass( ) { return m_itemClass; } public void setItemClass( String class1 ) { m_itemClass = class1; } }
[ "rduhon@indiana.edu" ]
rduhon@indiana.edu
53cfcedee4e288a47d09f819a197edc300f68028
9df515f1b1498d9923c8fdbd4cc024781fd59024
/app/src/main/java/com/afwsamples/testdpc/search/XmlIndexableFragment.java
11d184a161ee3a7f4c6c427d8afadb1f824127b9
[ "Apache-2.0" ]
permissive
jindog/android-testdpc
0452866f6a73e3fd46ffff6e9501e81bb5f04d05
14d1aa42539dbe8232d89b9b810afff079d41544
refs/heads/master
2021-06-21T13:58:33.958065
2020-12-10T11:11:00
2020-12-10T11:11:00
140,535,194
0
0
Apache-2.0
2020-12-10T11:11:02
2018-07-11T07:03:16
Java
UTF-8
Java
false
false
3,157
java
package com.afwsamples.testdpc.search; import android.content.Context; import android.support.annotation.XmlRes; import android.text.TextUtils; import android.util.AttributeSet; import android.util.Log; import android.util.Xml; import com.afwsamples.testdpc.common.BaseSearchablePolicyPreferenceFragment; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import java.io.IOException; import java.util.ArrayList; import java.util.List; public class XmlIndexableFragment extends BaseIndexableFragment { private static final String NODE_NAME_PREFERENCE_SCREEN = "PreferenceScreen"; private static final String NODE_NAME_PREFERENCE_CATEGORY = "PreferenceCategory"; private static final String TAG = "PreferenceCrawler_Timer"; public @XmlRes int xmlRes; public XmlIndexableFragment( Class<? extends BaseSearchablePolicyPreferenceFragment> fragmentClass, @XmlRes int xmlRes) { super(fragmentClass); this.xmlRes = xmlRes; } /** * Skim through the xml preference file. * @return a list of indexable preference. */ @Override public List<PreferenceIndex> index(Context context) { List<PreferenceIndex> indexablePreferences = new ArrayList<>(); XmlPullParser parser = context.getResources().getXml(xmlRes); int type; try { while ((type = parser.next()) != XmlPullParser.END_DOCUMENT && type != XmlPullParser.START_TAG) { // Parse next until start tag is found } String nodeName = parser.getName(); if (!NODE_NAME_PREFERENCE_SCREEN.equals(nodeName)) { throw new RuntimeException( "XML document must start with <PreferenceScreen> tag; found" + nodeName + " at " + parser.getPositionDescription()); } final int outerDepth = parser.getDepth(); final AttributeSet attrs = Xml.asAttributeSet(parser); while ((type = parser.next()) != XmlPullParser.END_DOCUMENT && (type != XmlPullParser.END_TAG || parser.getDepth() > outerDepth)) { if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) { continue; } nodeName = parser.getName(); String key = PreferenceXmlUtil.getDataKey(context, attrs); String title = PreferenceXmlUtil.getDataTitle(context, attrs); if (NODE_NAME_PREFERENCE_CATEGORY.equals(nodeName) || TextUtils.isEmpty(key) || TextUtils.isEmpty(title)) { continue; } PreferenceIndex indexablePreference = new PreferenceIndex(key, title, fragmentName); indexablePreferences.add(indexablePreference); } } catch (XmlPullParserException | IOException | ReflectiveOperationException ex) { Log.e(TAG, "Error in parsing a preference xml file, skip it", ex); } return indexablePreferences; } }
[ "tonymak@google.com" ]
tonymak@google.com
5177900567d1703d27654ff9227ad6c441e60071
bbccd2cd5de0f20c02ea445fcda3fc5c874322e2
/app/src/main/java/com/enfermeraya/enfermeraya/culqi/Culqi/CargoCallback.java
477835d5801f86d6110d7e01bfff0485e7b8250e
[]
no_license
tapia2390/emfermeraya
e8c847dad70add459f802d7cd7078f85ce7a173d
a7432bbb5acc3d9dbc6cc81563b7aa382911bcf0
refs/heads/master
2023-02-02T02:40:28.098729
2020-12-24T14:02:43
2020-12-24T14:02:43
261,238,881
0
0
null
null
null
null
UTF-8
Java
false
false
244
java
package com.enfermeraya.enfermeraya.culqi.Culqi; import org.json.JSONObject; /** * Created by culqi on 2/7/17. */ public interface CargoCallback { public void onSuccess(JSONObject cargo); public void onError(Exception error); }
[ "ytapias@dataifx.com" ]
ytapias@dataifx.com
906505265c330e2a291c851b3a9dfb92a7f600fa
8b3cf24a41c4eb1ac8012aa84afb238f962a4ce3
/app/src/main/java/com/github/javiersantos/bottomdialogs/demo/MainActivity.java
37fbf2d7be5d2ca9a5a1f8333ca56ac08b242266
[ "Apache-2.0" ]
permissive
javiersantos/BottomDialogs
bafca8fdb1a7e37299086baa4d0fb5ca5a79d620
ef43b5183bd8d9c0d10cd5b804565def37231151
refs/heads/master
2022-07-01T05:53:51.160821
2021-11-12T08:16:01
2021-11-12T08:16:01
61,056,219
726
145
Apache-2.0
2021-11-12T08:16:02
2016-06-13T17:29:37
Java
UTF-8
Java
false
false
3,269
java
package com.github.javiersantos.bottomdialogs.demo; import android.content.Context; import android.content.Intent; import android.graphics.Color; import android.net.Uri; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import com.github.javiersantos.bottomdialogs.BottomDialog; import com.mikepenz.iconics.IconicsDrawable; import com.mikepenz.material_design_iconic_typeface_library.MaterialDesignIconic; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setImageDrawable(new IconicsDrawable(this).icon(MaterialDesignIconic.Icon.gmi_github).color(Color.WHITE).sizeDp(24)); } public void sample(View view) { new BottomDialog.Builder(this) .setTitle("Awesome!") .setContent("Glad to see you like BottomDialogs! If you're up for it, we would really appreciate you reviewing us.") .setPositiveText("Google Play") .setNegativeText("Close") .show(); } public void sampleCustomView(View view) { LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); View customView = inflater.inflate(R.layout.bottomdialog_layout, null); new BottomDialog.Builder(this) .setTitle("Awesome!") .setContent("Glad to see you like BottomDialogs! If you're up for it, we would really appreciate you reviewing us.") .setCustomView(customView) .setPositiveText("Google Play") .setNegativeText("Close") .show(); } public void toGithub(View view) { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/javiersantos/BottomDialogs"))); } @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_main, menu); menu.findItem(R.id.action_about).setIcon(new IconicsDrawable(this).icon(MaterialDesignIconic.Icon.gmi_info).color(Color.WHITE).actionBar()); 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(); //noinspection SimplifiableIfStatement if (id == R.id.action_about) { startActivity(new Intent(this, AboutActivity.class)); return true; } return super.onOptionsItemSelected(item); } }
[ "me@javiersantos.me" ]
me@javiersantos.me
8a1a2b6540b418f7ab3a53581a176a3f61321b8e
d7da8297ab4eb8e11d56f110e0fb587a6fbaf757
/core/src/main/java/com/netflix/iceberg/MergeAppend.java
1f7258931db2f8892176aff797d31190eea43e7f
[ "Apache-2.0" ]
permissive
julienledem/iceberg
da023517663f049a9679130d0aa0280b269ed918
ab84940b24e58b366f1bd8f3bd4ae57d3fa0bf59
refs/heads/master
2021-04-06T00:47:05.945828
2018-02-20T21:10:59
2018-02-20T21:12:03
124,578,482
0
1
null
2018-03-09T18:29:47
2018-03-09T18:29:47
null
UTF-8
Java
false
false
7,821
java
/* * Copyright 2017 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.iceberg; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.io.Closeables; import com.netflix.iceberg.exceptions.CommitFailedException; import com.netflix.iceberg.exceptions.RuntimeIOException; import com.netflix.iceberg.io.OutputFile; import com.netflix.iceberg.util.BinPacking.ListPacker; import java.io.IOException; import java.util.List; import java.util.Map; import java.util.Set; import static com.netflix.iceberg.TableProperties.MANIFEST_TARGET_SIZE_BYTES; import static com.netflix.iceberg.TableProperties.MANIFEST_TARGET_SIZE_BYTES_DEFAULT; /** * Append implementation that produces a minimal number of manifest files. * <p> * This implementation will attempt to commit 5 times before throwing {@link CommitFailedException}. */ class MergeAppend extends SnapshotUpdate implements AppendFiles { private static final long SIZE_PER_FILE = 100; // assume each file will be ~100 bytes private final TableOperations ops; private final PartitionSpec spec; private final List<DataFile> newFiles = Lists.newArrayList(); private final long manifestTargetSizeBytes; // cache merge results to reuse when retrying private final Map<List<String>, String> mergedManifests = Maps.newHashMap(); MergeAppend(TableOperations ops) { super(ops); this.ops = ops; this.spec = ops.current().spec(); this.manifestTargetSizeBytes = ops.current() .propertyAsLong(MANIFEST_TARGET_SIZE_BYTES, MANIFEST_TARGET_SIZE_BYTES_DEFAULT); } @Override public MergeAppend appendFile(DataFile file) { newFiles.add(file); return this; } @Override public List<String> apply(TableMetadata base) { Snapshot current = base.currentSnapshot(); List<PartitionSpec> specs = Lists.newArrayList(); List<List<ManifestReader>> groups = Lists.newArrayList(); // add the current spec as the first group. files are added to the beginning. specs.add(spec); groups.add(Lists.newArrayList()); groups.get(0).add(newFilesAsManifest()); List<ManifestReader> toClose = Lists.newArrayList(); boolean threw = true; try { // group manifests by compatible partition specs to be merged if (current != null) { for (String manifest : current.manifests()) { ManifestReader reader = ManifestReader.read(ops.newInputFile(manifest)); toClose.add(reader); int index = findMatch(specs, reader.spec()); if (index < 0) { // not found, add a new one List<ManifestReader> newList = Lists.<ManifestReader>newArrayList(reader); specs.add(reader.spec()); groups.add(newList); } else { // replace the reader spec with the later one specs.set(index, reader.spec()); groups.get(index).add(reader); } } } List<String> manifests = Lists.newArrayList(); for (int i = 0; i < specs.size(); i += 1) { manifests.addAll(mergeGroup(specs.get(i), groups.get(i))); } threw = false; return manifests; } finally { for (ManifestReader reader : toClose) { try { Closeables.close(reader, threw); } catch (IOException e) { throw new RuntimeIOException(e); } } } } @Override protected void cleanUncommitted(Set<String> committed) { for (String merged: mergedManifests.values()) { // delete any new merged manifests that aren't in the committed list if (!committed.contains(merged)) { deleteFile(merged); } } mergedManifests.clear(); } private List<String> mergeGroup(PartitionSpec spec, List<ManifestReader> group) { // use a lookback of 1 to avoid reordering the manifests. using 1 also means this should pack // from the end so that the manifest that gets under-filled is the first one, which will be // merged the next time. ListPacker<ManifestReader> packer = new ListPacker<>(manifestTargetSizeBytes, 1); List<List<ManifestReader>> bins = packer.packEnd(group, reader -> reader.file() != null ? reader.file().getLength() : newFiles.size() * SIZE_PER_FILE); List<String> outputManifests = Lists.newLinkedList(); for (int i = 0; i < bins.size(); i += 1) { List<ManifestReader> bin = bins.get(i); if (bin.size() == 1 && bin.get(0).file() != null) { // no need to rewrite outputManifests.add(bin.get(0).file().location()); continue; } List<String> key = cacheKey(bin); // if this merge was already rewritten, use the existing file. // if the new files are in this merge, the key is based on the number of new files so files // added after the last merge will cause a cache miss. if (mergedManifests.containsKey(key)) { outputManifests.add(mergedManifests.get(key)); continue; } OutputFile out = manifestPath(mergedManifests.size()); try (ManifestWriter writer = new ManifestWriter(spec, out, snapshotId())) { for (ManifestReader reader : bin) { if (reader.file() != null) { writer.addExisting(reader.entries()); } else { writer.addEntries(reader.entries()); } } } catch (IOException e) { throw new RuntimeIOException(e, "Failed to write manifest: %s", out); } // update the cache mergedManifests.put(key, out.location()); outputManifests.add(out.location()); } return outputManifests; } private ManifestReader newFilesAsManifest() { long id = snapshotId(); ManifestEntry reused = new ManifestEntry(spec.partitionType()); return ManifestReader.inMemory(spec, Iterables.transform(newFiles, file -> { reused.wrapAppend(id, file); return reused; })); } private List<String> cacheKey(List<ManifestReader> group) { List<String> key = Lists.newArrayList(); for (ManifestReader reader : group) { if (reader.file() != null) { key.add(reader.file().location()); } else { // if the file is null, this is an in-memory reader // use the size to avoid collisions if retries have added files key.add("append-" + newFiles.size() + "-files"); } } return key; } /** * Helper method to group manifests by compatible partition spec. * <p> * When a match is found, this will replace the current spec for the group with the query spec. * This is to produce manifests with the latest compatible spec. * * @param specs a list of partition specs, corresponding to the groups of readers * @param spec spec to be matched to a group * @return group of readers files for this spec can be merged into */ private static int findMatch(List<PartitionSpec> specs, PartitionSpec spec) { // loop from last to first because later specs are most likely to match for (int i = specs.size() - 1; i >= 0; i -= 1) { if (specs.get(i).compatibleWith(spec)) { return i; } } return -1; } }
[ "blue@apache.org" ]
blue@apache.org
7d404502630ffd098b05a3f3470ab66b6e257823
48f937579f72c5851bd9a91af3ad07fbdc1a1b2f
/resource-management/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/models/ErrorDetails.java
7a9f4d90814348a9fe2b4953a3096d4161d03143
[ "Apache-2.0" ]
permissive
wjobin/azure-sdk-for-java
6e86029d84c0afe902e0182834162c38dcb420c6
a1894e4d5e45dbe1c8741673b847e4f813095027
refs/heads/master
2020-12-25T04:55:15.740461
2016-05-11T13:44:06
2016-05-11T13:44:06
41,445,204
0
0
null
2015-08-26T19:20:15
2015-08-26T19:20:12
null
UTF-8
Java
false
false
1,887
java
/** * * Copyright (c) Microsoft and contributors. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * limitations under the License. * */ // Warning: This code was generated by a tool. // // Changes to this file may cause incorrect behavior and will be lost if the // code is regenerated. package com.microsoft.azure.management.network.models; public class ErrorDetails { private String code; /** * Optional. * @return The Code value. */ public String getCode() { return this.code; } /** * Optional. * @param codeValue The Code value. */ public void setCode(final String codeValue) { this.code = codeValue; } private String message; /** * Optional. * @return The Message value. */ public String getMessage() { return this.message; } /** * Optional. * @param messageValue The Message value. */ public void setMessage(final String messageValue) { this.message = messageValue; } private String target; /** * Optional. * @return The Target value. */ public String getTarget() { return this.target; } /** * Optional. * @param targetValue The Target value. */ public void setTarget(final String targetValue) { this.target = targetValue; } }
[ "david.justice@microsoft.com" ]
david.justice@microsoft.com
4852674193d4bbbe9bcb131c9b8fdef5043e34cd
a0bff10cee4c4dea2104e5f2277cc78872de0646
/app/src/main/java/com/fastandroid/demo/FastAndroidApplication.java
893d2b090b2ec3d157914e186a72fe58a4955bbe
[ "Apache-2.0" ]
permissive
Lowen10/FastMvpAndroid
0cbf7eafe6865802a49554df196480b777280652
b6bfcc9461eb7cf8ff6e97da49bb4e01a4f06828
refs/heads/master
2020-03-22T11:14:25.428915
2019-04-07T09:11:51
2019-04-07T09:11:51
139,957,704
0
0
null
null
null
null
UTF-8
Java
false
false
214
java
package com.fastandroid.demo; import com.app.framework.BaseApplication; public class FastAndroidApplication extends BaseApplication { @Override public void onCreate() { super.onCreate(); } }
[ "yun1.luo@symbio.com" ]
yun1.luo@symbio.com
6dfe62057d518e0177315f896682e16082c763fc
f467d9d70429811dd18281fafa4597498297e149
/SolarTrails/src/byui/cit260/SolarTrails/model/Item.java
8d1a611653286a2bae8fdd3fb3c33ed1d9485510
[]
no_license
jtdavis247/Davis-Volle-Team
5e41b39fe991c01dcb7b7bc36e5381d1cb9360c5
1ceb9926084913dcf04635ab26fa83d05b43bb06
refs/heads/master
2020-04-24T15:58:27.963153
2015-07-23T05:23:57
2015-07-23T05:23:57
35,645,769
0
0
null
null
null
null
UTF-8
Java
false
false
350
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 byui.cit260.SolarTrails.model; /** * * @author Kyle */ public enum Item { food, water, fuel, luxuries, research; }
[ "white.rabbit.44@gmail.com" ]
white.rabbit.44@gmail.com
2be588d8900353db38bba80e631628acc90abcdf
62b815429bad003595cce0c18c1c9dba938e67d0
/frostmourne-monitor/src/main/java/com/autohome/frostmourne/monitor/service/admin/impl/DataAdminService.java
e6b82ec5b9e36877faea01a2d12449105aff1879
[ "MIT" ]
permissive
xyzj91/frostmourne
c0bd496f8f1597bb45a259147a3041a99fb13ea1
4123ef4ae71aae1da47be9db5401bc73cc7d5f42
refs/heads/master
2022-11-11T02:06:55.370880
2020-07-06T13:13:32
2020-07-06T13:13:32
276,055,352
1
0
null
2020-06-30T09:28:37
2020-06-30T09:28:37
null
UTF-8
Java
false
false
9,071
java
package com.autohome.frostmourne.monitor.service.admin.impl; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; import javax.annotation.Resource; import com.autohome.frostmourne.core.contract.PagerContract; import com.autohome.frostmourne.core.contract.ProtocolException; import com.autohome.frostmourne.core.jackson.JacksonUtil; import com.autohome.frostmourne.monitor.contract.DataNameContract; import com.autohome.frostmourne.monitor.contract.DataOption; import com.autohome.frostmourne.monitor.contract.DataSourceContract; import com.autohome.frostmourne.monitor.contract.DataSourceOption; import com.autohome.frostmourne.monitor.dao.mybatis.frostmourne.domain.DataName; import com.autohome.frostmourne.monitor.dao.mybatis.frostmourne.domain.DataSource; import com.autohome.frostmourne.monitor.dao.mybatis.frostmourne.mapper.DataNameMapper; import com.autohome.frostmourne.monitor.dao.mybatis.frostmourne.mapper.DataSourceMapper; import com.autohome.frostmourne.monitor.dao.mybatis.frostmourne.mapper.MetricMapper; import com.autohome.frostmourne.monitor.service.admin.IDataAdminService; import com.autohome.frostmourne.monitor.transform.DataNameTransformer; import com.autohome.frostmourne.monitor.transform.DataSourceTransformer; import com.fasterxml.jackson.core.type.TypeReference; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; import org.springframework.stereotype.Service; @Service public class DataAdminService implements IDataAdminService { @Resource private DataSourceMapper dataSourceMapper; @Resource private DataNameMapper dataNameMapper; @Resource private MetricMapper metricMapper; public DataSourceContract findDatasourceById(Long id) { DataSource dataSource = dataSourceMapper.selectByPrimaryKey(id); return DataSourceTransformer.model2Contract(dataSource); } public boolean saveDataSource(String account, DataSourceContract dataSourceContract) { DataSource dataSource = new DataSource(); dataSource.setDatasource_name(dataSourceContract.getDatasource_name()); dataSource.setDatasource_type(dataSourceContract.getDatasource_type()); dataSource.setModifier(account); dataSource.setService_address(dataSourceContract.getService_address()); dataSource.setModify_at(new Date()); if (dataSourceContract.getSettings() != null && dataSourceContract.getSettings().size() > 0) { dataSource.setProperties(JacksonUtil.serialize(dataSourceContract.getSettings())); } if (dataSourceContract.getId() != null && dataSourceContract.getId() > 0) { dataSource.setId(dataSourceContract.getId()); return dataSourceMapper.updateByPrimaryKeySelective(dataSource) > 0; } dataSource.setCreator(account); dataSource.setCreate_at(new Date()); return dataSourceMapper.insert(dataSource) > 0; } public boolean removeDataSource(Long id) { int datasourceCount = metricMapper.datasourceCount(id); if (datasourceCount > 0) { throw new ProtocolException(600, "ๆ•ฐๆฎๆบๆญฃๅœจไฝฟ็”จๆ— ๆณ•ๅˆ ้™ค"); } return this.dataSourceMapper.deleteByPrimaryKey(id) > 0; } public PagerContract<DataSourceContract> findDatasource(int pageIndex, int pageSize, String datasourceType) { Page page = PageHelper.startPage(pageIndex, pageSize); List<DataSource> list = this.dataSourceMapper.find(datasourceType); return new PagerContract<>(list.stream().map(DataSourceTransformer::model2Contract).collect(Collectors.toList()), page.getPageSize(), page.getPageNum(), (int) page.getTotal()); } public List<DataSource> findDataSourceByType(String datasourceType) { return this.dataSourceMapper.find(datasourceType); } public List<DataOption> dataOptions() { List<DataSource> dataSourceList = this.dataSourceMapper.find(null); List<DataName> dataNameList = this.dataNameMapper.find(null, null); Map<String, List<DataSourceOption>> dataOptionMap = new HashMap<>(); for (DataSource dataSource : dataSourceList) { DataSourceOption dataSourceOption = new DataSourceOption(); dataSourceOption.setDataSource(dataSource); dataSourceOption.setDataNameContractList(dataNameList.stream() .filter(dataName -> dataName.getData_source_id().equals(dataSource.getId())) .map(DataAdminService::toDataNameContract) .collect(Collectors.toList())); if (dataOptionMap.containsKey(dataSource.getDatasource_type())) { dataOptionMap.get(dataSource.getDatasource_type()).add(dataSourceOption); } else { List<DataSourceOption> dataSourceOptionList = new ArrayList<>(); dataSourceOptionList.add(dataSourceOption); dataOptionMap.put(dataSource.getDatasource_type(), dataSourceOptionList); } } List<DataOption> dataOptionList = new ArrayList<>(); for (Map.Entry<String, List<DataSourceOption>> entry : dataOptionMap.entrySet()) { DataOption dataOption = new DataOption(); dataOption.setDatasourceType(entry.getKey()); dataOption.setDataSourceOptionList(entry.getValue()); dataOptionList.add(dataOption); } return dataOptionList; } public boolean saveDataName(String account, DataNameContract dataNameContract) { DataName dataName = new DataName(); Date now = new Date(); dataName.setData_name(dataNameContract.getData_name()); dataName.setModifier(account); dataName.setModify_at(now); dataName.setData_source_id(dataNameContract.getData_source_id()); dataName.setDatasource_type(dataNameContract.getDatasource_type()); dataName.setDisplay_name(dataNameContract.getDisplay_name()); dataName.setProperties(JacksonUtil.serialize(dataNameContract.getSettings())); dataName.setTimestamp_field(dataNameContract.getTimestamp_field()); if (dataNameContract.getId() != null && dataNameContract.getId() > 0) { dataName.setId(dataNameContract.getId()); return this.dataNameMapper.updateByPrimaryKeySelective(dataName) > 0; } DataName oldDataName = this.dataNameMapper.findByName(dataNameContract.getData_name()); if (oldDataName != null) { throw new ProtocolException(504, "ๆ•ฐๆฎๅ็งฐๅ‘็”Ÿ้‡ๅค"); } dataName.setCreator(account); dataName.setCreate_at(now); return this.dataNameMapper.insert(dataName) > 0; } public boolean removeDataName(Long datanameId) { int datanameCount = this.metricMapper.datanameCount(datanameId); if (datanameCount > 0) { throw new ProtocolException(600, "ๆ•ฐๆฎๅๆญฃๅœจไฝฟ็”จๆ— ๆณ•ๅˆ ้™ค"); } return this.dataNameMapper.deleteByPrimaryKey(datanameId) > 0; } public PagerContract<DataNameContract> findDataName(int pageIndex, int pageSize, String datasourceType, Long datasourceId) { Page page = PageHelper.startPage(pageIndex, pageSize); List<DataName> list = this.dataNameMapper.find(datasourceType, datasourceId); return new PagerContract<>(list.stream().map(DataAdminService::toDataNameContract).collect(Collectors.toList()), page.getPageSize(), page.getPageNum(), (int) page.getTotal()); } public List<DataNameContract> findDataNameByType(String datasourceType) { List<DataName> list = this.dataNameMapper.find(datasourceType, null); return list.stream().map(DataAdminService::toDataNameContract).collect(Collectors.toList()); } public DataNameContract findDataNameByName(String name) { DataName dataName = dataNameMapper.findByName(name); return DataNameTransformer.model2Contract(dataName); } public static DataNameContract toDataNameContract(DataName dataName) { DataNameContract dataNameContract = new DataNameContract(); dataNameContract.setId(dataName.getId()); dataNameContract.setData_source_id(dataName.getData_source_id()); dataNameContract.setDatasource_type(dataName.getDatasource_type()); dataNameContract.setData_name(dataName.getData_name()); dataNameContract.setDisplay_name(dataName.getDisplay_name()); dataNameContract.setTimestamp_field(dataName.getTimestamp_field()); dataNameContract.setCreator(dataName.getCreator()); dataNameContract.setCreate_at(dataName.getCreate_at()); dataNameContract.setModifier(dataName.getModifier()); dataNameContract.setModify_at(dataName.getModify_at()); dataNameContract.setSettings(JacksonUtil.deSerialize(dataName.getProperties(), new TypeReference<Map<String, String>>() { })); return dataNameContract; } }
[ "kechangqing@autohome.com.cn" ]
kechangqing@autohome.com.cn
65e85184f59a9cdf19b300d209309aec99dfbdac
78ec75d62d04fb0ef0ab85140c860703043ce507
/wweProject/src/com/wwe/leader/controller/LeaderController.java
7364a7f33e21c8c96248f8087fa079d5cd4ea9d6
[]
no_license
yeongwoojang/WWE_PROJECT
8e7f539eaf54bcc7e43f2a0ab933ddec09a0cb97
577f413a66bad38623fbd02b781115ca44431912
refs/heads/main
2023-03-06T00:48:47.481383
2021-02-16T06:43:30
2021-02-16T06:43:30
333,318,317
1
3
null
null
null
null
UTF-8
Java
false
false
16,123
java
package com.wwe.leader.controller; import java.io.IOException; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.Map; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import com.google.gson.Gson; import com.wwe.common.code.AddAlarmCode; import com.wwe.leader.model.service.LeaderService; import com.wwe.leader.model.vo.ProjUser; import com.wwe.member.model.service.MemberService; import com.wwe.member.model.vo.Member; import com.wwe.project.model.vo.ProjectMaster; import com.wwe.task.model.service.TaskService; import com.wwe.task.model.vo.Task; @WebServlet("/leader/*") public class LeaderController extends HttpServlet { private static final long serialVersionUID = 1L; private LeaderService leaderService = new LeaderService(); private TaskService taskService = new TaskService(); protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String[] uriArr = request.getRequestURI().split("/"); switch (uriArr[uriArr.length - 1]) { case "manage": manage(request, response); // ํŒ€๊ด€๋ฆฌ ๋ฉ”๋‰ด๋ฅผ ํด๋ฆญํ–ˆ์„ ์‹œ break; case "totaltask": totalTask(request, response); // ์—…๋ฌด๊ด€๋ฆฌ ๋ฉ”๋‰ด๋ฅผ ํด๋ฆญํ–ˆ์„ ์‹œ break; case "chkuser": chkInvalidUser(request, response); // ์ดˆ๋Œ€ํŒ์—…์—์„œ ์ดˆ๋Œ€ ๋ฒ„ํŠผ ํด๋ฆญํ–ˆ์„ ์‹œ break; case "inviteimpl": inviteImpl(request, response); // ํŒ€์› ์ดˆ๋Œ€ ๊ธฐ๋Šฅ์„ ์ˆ˜ํ–‰ break; case "gettaskimpl": selectTaskList(request, response); // ํ”„๋กœ์ ํŠธ์˜ ์—…๋ฌด ๋ฆฌ์ŠคํŠธ๋ฅผ ๋ถˆ๋Ÿฌ์˜ค๋Š” ๊ธฐ๋Šฅ์„ ์ˆ˜ํ–‰ break; case "updateauthority": updateAuthority(request, response); // ํŒ€์›์˜ ๊ถˆํ•œ์„ ์ˆ˜์ • break; case "searchbytask": searchTaskByTask(request, response); // ์—…๋ฌด๋ช…์œผ๋กœ ์—…๋ฌด๋ชฉ๋ก์„ ๊ฒ€์ƒ‰ break; case "searchbyid": searchTaskById(request, response); // ์œ ์ €๋ช…์œผ๋กœ ์—…๋ฌด๋ชฉ๋ก์„ ๊ฒ€์ƒ‰ break; case "modifytask": modifyTaskByIdx(request, response); // ์—…๋ฌด๋‚ด์šฉ์„ ์ˆ˜์ • break; case "deletetask": deleteTask(request, response); // ์—…๋ฌด ์‚ญ์ œ break; case "deletemember": deleteMember(request, response); break; case "alloctask" : allocTask(request,response); break; case "deleteproject" : deleteProject(request,response); break; default: break; } } // post์š”์ฒญ์ด ๋“ค์–ด์™”์„ ์‹œ doGet์œผ๋กœ ๋„˜๊ฒจ์ค€๋‹ค, protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); } // ํŒ€๊ด€๋ฆฌ ํŽ˜์ด์ง€๋กœ ์ด๋™ private void manage(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession session = request.getSession(); ProjUser projUser= (ProjUser)session.getAttribute("selectProject"); ProjUser projUserInfo = (ProjUser)session.getAttribute("projUserInfo"); ArrayList<ProjUser> userList = leaderService.selectUserListByPid(projUser.getProjectId()); System.out.println("์œ ์ € ๋ฆฌ์ŠคํŠธ : "+userList); request.setAttribute("userList", userList); // ํŽ˜์ด์ง€์— DB์—์„œ ์ฝ์–ด์˜จ ์œ ์ € ๋ฆฌ์ŠคํŠธ๋ฅผ ์ „์†ก request.getRequestDispatcher("/WEB-INF/view/leader/leader_page.jsp").forward(request, response); } // ์—…๋ฌด๊ด€๋ฆฌ ํŽ˜์ด์ง€๋กœ ์ด๋™ private void totalTask(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession session = request.getSession(); ProjUser project = (ProjUser) session.getAttribute("selectProject"); String projectId = project.getProjectId(); ArrayList<Task> taskList = leaderService.selectTaskList(projectId); if (taskList.size() > 0) { System.out.println("์—…๋ฌด๋ฆฌ์ŠคํŠธ ๋ถˆ๋Ÿฌ์˜ค๊ธฐ ์„ฑ๊ณต"); request.setAttribute("taskList", taskList); request.setAttribute("taskCount", taskList.size()); request.getRequestDispatcher("/WEB-INF/view/leader/total_task.jsp").forward(request, response); } else { request.setAttribute("alertMsg", "ํ•ด๋‹น ํ”„๋กœ์ ํŠธ์— ์—…๋ฌด๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค."); request.setAttribute("url", "/task/main"); request.getRequestDispatcher("/WEB-INF/view/common/result.jsp").forward(request, response); } } // ํŒ€์›์„ ์ดˆ๋Œ€ํ•˜๊ธฐ ์œ„ํ•ด ์ž…๋ ฅํ•œ ์•„์ด๋””๊ฐ€ ์œ ํšจํ•œ์ง€ ํ™•์ธ private void chkInvalidUser(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String userId = request.getParameter("userId"); System.out.println(userId); String mUserId = leaderService.chkInvalidUser(userId); if (!mUserId.equals(" ")) { response.getWriter().print("success"); } else { response.getWriter().print("failed"); } } // ํŒ€์— ์œ ์ €๋ฅผ ์ดˆ๋Œ€ํ•˜๋Š” ์ž‘์—…์„ ์ฒ˜๋ฆฌ private void inviteImpl(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String data = request.getParameter("data"); Gson gson = new Gson(); Map parsedData = gson.fromJson(data, Map.class); String userId = parsedData.get("userId").toString(); String authority = parsedData.get("authority").toString(); HttpSession session = request.getSession(); ProjUser project = (ProjUser) session.getAttribute("selectProject"); String projectId = project.getProjectId(); Member member = (Member) session.getAttribute("user"); int res = leaderService.inviteUser(userId, authority,projectId); if (res == 1) { new MemberService().addAlarm(member.getUserID(), projectId, AddAlarmCode.IU02.alarmCode()); new MemberService().kakaoSendMessage("rkZVd00R_wEE82fu2ustpOknZNHZXVv0IpSx0AopdSkAAAF3i7FSxA", member.getUserName() + " ๋‹˜์ด "+userId+"๋ฅผ ์ดˆ๋Œ€ํ–ˆ์Šต๋‹ˆ๋‹ค."); response.getWriter().print("success"); } else { response.getWriter().print("failed"); } } // ํ”„๋กœ์ ํŠธ์˜ ์œ ์ €๋‹น ์—…๋ฌด ๋ฆฌ์ŠคํŠธ๋ฅผ ๊ฐ€์ ธ์˜ค๋Š” ๋ฉ”์†Œ๋“œ private void selectTaskList(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String projectId = request.getParameter("projectId"); System.out.println(projectId); ArrayList<Task> taskList = leaderService.selectTaskList(projectId); if (taskList.size() > 0) { System.out.println("์—…๋ฌด๋ฆฌ์ŠคํŠธ ๋ถˆ๋Ÿฌ์˜ค๊ธฐ ์„ฑ๊ณต"); request.setAttribute("taskList", taskList); request.setAttribute("taskCount", taskList.size()); request.getRequestDispatcher("/WEB-INF/view/leader/total_task.jsp").forward(request, response); } else { request.setAttribute("alertMsg", "ํ•ด๋‹น ํ”„๋กœ์ ํŠธ์— ์—…๋ฌด๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค."); request.setAttribute("url", "/task/main"); request.getRequestDispatcher("/WEB-INF/view/common/result.jsp").forward(request, response); } } // ์œ ์ €์˜ ๊ถŒํ•œ์„ ๋ณ€๊ฒฝํ•˜๋Š” ๋ฉ”์†Œ๋“œ private void updateAuthority(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String data = request.getParameter("data"); Gson gson = new Gson(); Map parsedData = gson.fromJson(data, Map.class); HttpSession session = request.getSession(); ProjUser project = (ProjUser) session.getAttribute("selectProject"); Member member = (Member) session.getAttribute("user"); String projectId = project.getProjectId(); String userId = parsedData.get("userId").toString(); String authority = parsedData.get("authority").toString(); Member curUser = (Member)request.getSession().getAttribute("user"); ProjUser projUser = new ProjUser(); projUser.setProjectId(projectId); projUser.setUserId(userId); projUser.setAuthority(authority); System.out.println("๋ฐ”๊ฟ€ ํ”Œ์  ์•„์ด๋”” : "+projUser.getProjectId()); System.out.println("๋ฐ”๊ฟ€ ๋ฆฌ๋”์•„์ด๋”” : "+projUser.getUserId()); int res = leaderService.updateAuthority(projUser); if (res > 0) { if (authority.equals("ํŒ€์žฅ")) { leaderService.changeProLeader(projUser); //TB_PROJECT์˜ LEADER_ID๋ฅผ ์ˆ˜์ •ํ•˜๋Š” ์ฝ”๋“œ projUser.setUserId(curUser.getUserID()); projUser.setAuthority("์ฝ๊ธฐ/์“ฐ๊ธฐ"); res = leaderService.changeLeader(projUser); //๊ธฐ์กด์— ํŒ€์žฅ์ด์—ˆ๋˜ ์‚ฌ๋žŒ์˜ ์ •๋ณด๋ฅผ ๋„˜๊ฒจ์•ผํ•จ. if (res > 0) { new MemberService().addAlarm(member.getUserID(), projectId, AddAlarmCode.UL01.alarmCode()); response.getWriter().print("authChange"); } else { response.getWriter().print("authChangeFailed"); } }else { new MemberService().addAlarm(member.getUserID(), projectId, AddAlarmCode.UU01.alarmCode()); response.getWriter().print("success"); } } else { response.getWriter().print("failed"); } } private void searchTaskByTask(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String data = request.getParameter("data"); Gson gson = new Gson(); Map parsedData = gson.fromJson(data, Map.class); HttpSession session = request.getSession(); ProjUser project = (ProjUser) session.getAttribute("selectProject"); String projectId = project.getProjectId(); String word = parsedData.get("word").toString(); Task task = new Task(); task.setProjectId(projectId); task.setTaskId(word); ArrayList<Task> searchTaskList = leaderService.selectTaskByTask(task); if (searchTaskList.size() > 0) { String jArray = gson.toJson(searchTaskList); response.getWriter().print(jArray); } else { response.getWriter().print("failed"); } } private void searchTaskById(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String data = request.getParameter("data"); Gson gson = new Gson(); Map parsedData = gson.fromJson(data, Map.class); HttpSession session = request.getSession(); ProjUser project = (ProjUser) session.getAttribute("selectProject"); String projectId = project.getProjectId(); String word = parsedData.get("word").toString(); Task task = new Task(); task.setProjectId(projectId); task.setUserId(word); ArrayList<Task> searchTaskList = leaderService.selectTaskById(task); if (searchTaskList.size() > 0) { String jArray = gson.toJson(searchTaskList); response.getWriter().print(jArray); } else { response.getWriter().print("failed"); } } // ์—…๋ฌด๋ฅผ ์ˆ˜์ •ํ•˜๋Š” ๋ฉ”์†Œ๋“œ public void modifyTaskByIdx(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String data = request.getParameter("data"); Gson gson = new Gson(); Map parsedData = gson.fromJson(data, Map.class); String taskUser = parsedData.get("modTaskUser").toString(); String taskId = parsedData.get("taskId").toString(); String deadLine = parsedData.get("deadLine").toString(); String modifiedContent = parsedData.get("modifiedContent").toString(); int tIdx = Integer.parseInt(parsedData.get("tIdx").toString()); Task task = new Task(); task.setUserId(taskUser); task.setTaskId(taskId); task.setDeadLine(deadLine); task.setTaskContent(modifiedContent); task.settIdx(tIdx); HttpSession session = request.getSession(); ProjUser project = (ProjUser) session.getAttribute("selectProject"); Member member = (Member) session.getAttribute("user"); int res = leaderService.updateTask(task); if (res > 0) { new MemberService().addAlarm(member.getUserID(), project.getProjectId(), AddAlarmCode.UT01.alarmCode()); new MemberService().kakaoSendMessage("rkZVd00R_wEE82fu2ustpOknZNHZXVv0IpSx0AopdSkAAAF3i7FSxA", member.getUserName() + " ๋‹˜์ด ์—…๋ฌด๋ฅผ ์ˆ˜์ •ํ–ˆ์Šต๋‹ˆ๋‹ค."); response.getWriter().print("success"); } else { response.getWriter().print("failed"); } } public void deleteTask(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String data = request.getParameter("data"); Gson gson = new Gson(); Map parsedData = gson.fromJson(data, Map.class); ArrayList<Integer> tIdx = (ArrayList<Integer>) parsedData.get("tIdx"); int res = leaderService.deleteTask(tIdx); HttpSession session = request.getSession(); ProjUser project = (ProjUser) session.getAttribute("selectProject"); Member member = (Member) session.getAttribute("user"); if (res > 0) { new MemberService().addAlarm(member.getUserID(), project.getProjectId(), AddAlarmCode.DT01.alarmCode()); new MemberService().kakaoSendMessage("rkZVd00R_wEE82fu2ustpOknZNHZXVv0IpSx0AopdSkAAAF3i7FSxA", member.getUserName() + " ๋‹˜์ด ์—…๋ฌด๋ฅผ ์‚ญ์ œํ–ˆ์Šต๋‹ˆ๋‹ค."); response.getWriter().print("success"); } else { response.getWriter().print("failed"); } } public void deleteMember(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String data = request.getParameter("data"); Gson gson = new Gson(); Map parsedData = gson.fromJson(data, Map.class); HttpSession session = request.getSession(); ProjUser project = (ProjUser) session.getAttribute("selectProject"); String projectId = project.getProjectId(); String deleteMember = parsedData.get("deleteMember").toString(); ProjUser user = new ProjUser(); user.setProjectId(projectId); user.setUserId(deleteMember); Member member = (Member) session.getAttribute("user"); int res = leaderService.deleteMember(user); if (res > 0) { res = leaderService.deleteMemberTask(user); if(res > 0) { res = leaderService.deleteProjectMaster(user); if(res > 0) { new MemberService().addAlarm(member.getUserID(), projectId, AddAlarmCode.DM01.alarmCode()); new MemberService().kakaoSendMessage("rkZVd00R_wEE82fu2ustpOknZNHZXVv0IpSx0AopdSkAAAF3i7FSxA", member.getUserName() + " ๋‹˜์ด "+user.getUserId()+"๋‹˜์„ ํŒ€์—์„œ ๋‚ด๋ณด๋ƒˆ์Šต๋‹ˆ๋‹ค."); response.getWriter().print("success"); }else { response.getWriter().print("failed"); } } } } public void allocTask(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException{ String data = request.getParameter("data"); Gson gson = new Gson(); HttpSession session = request.getSession(); ProjUser project = (ProjUser) session.getAttribute("selectProject"); String projectId = project.getProjectId(); Map parsedData = gson.fromJson(data, Map.class); String userId = parsedData.get("userId").toString(); String taskId = parsedData.get("taskId").toString(); String deadLine = parsedData.get("deadLine").toString(); String content = parsedData.get("content").toString(); Task task = new Task(); task.setProjectId(projectId); task.setUserId(userId); task.setTaskId(taskId); task.setDeadLine(deadLine); task.setTaskContent(content); Member member = (Member) session.getAttribute("user"); int res = taskService.insertTask(task); if(res>0) { new MemberService().addAlarm(member.getUserID(), projectId, AddAlarmCode.IT01.alarmCode()); new MemberService().kakaoSendMessage("rkZVd00R_wEE82fu2ustpOknZNHZXVv0IpSx0AopdSkAAAF3i7FSxA", member.getUserName() + " ๋‹˜์ด "+task.getUserId()+"๋‹˜์—๊ฒŒ ์—…๋ฌด๋ฅผ ํ• ๋‹นํ–ˆ์Šต๋‹ˆ๋‹ค."); response.getWriter().print("success"); }else { response.getWriter().print("failed"); } } public void deleteProject(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException{ String projectId = request.getParameter("projectId"); System.out.println(projectId); int res = leaderService.deleteProject(projectId); HttpSession session = request.getSession(); Member member = (Member) session.getAttribute("user"); if(res>0) { new MemberService().addAlarm(member.getUserID(), projectId, AddAlarmCode.DP01.alarmCode()); new MemberService().kakaoSendMessage("rkZVd00R_wEE82fu2ustpOknZNHZXVv0IpSx0AopdSkAAAF3i7FSxA", member.getUserName() + " ๋‹˜์ด ํ”„๋กœ์ ํŠธ "+projectId+"๋ฅผ ์‚ญ์ œํ–ˆ์Šต๋‹ˆ๋‹ค."); response.getWriter().print("success"); }else { response.getWriter().print("failed"); } } }
[ "sbtmxhs@gmail.com" ]
sbtmxhs@gmail.com
57b999b3dfa934e9f2e404c552f9433c37e09f8d
9de797c6479fe5397f8a5e317e0d954c9f88532b
/review/src/review/article/ArticleEditMobileOk.java
a68ca4ce0bea194a60cd4f2f3a2d84778a30f8ea
[]
no_license
reum1015/review
0737eb83449a1e9855de02b3428d5770d49cb551
a5bb4fafb633e0abcbc1799244985367cbd99417
refs/heads/master
2021-01-22T12:25:54.236186
2017-09-09T10:37:45
2017-09-09T10:37:45
92,724,598
0
0
null
null
null
null
UTF-8
Java
false
false
7,655
java
package review.article; import java.io.IOException; import java.util.List; import java.util.Map; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.ibatis.session.SqlSession; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import review.dao.MybatisConnectionFactory; import review.jsp.helper.BaseController; import review.jsp.helper.FileInfo; import review.jsp.helper.RegexHelper; import review.jsp.helper.UploadHelper; import review.jsp.helper.WebHelper; import review.model.Article; import review.model.ImageFile; import review.model.Member; import review.service.ArticleService; import review.service.ImageFileService; import review.service.impl.ArticleServiceImpl; import review.service.impl.ImageFileServiceImpl; @WebServlet("/article/article_edit_mobile_ok") public class ArticleEditMobileOk extends BaseController { private static final long serialVersionUID = -1391748040235555563L; /** (1) ์‚ฌ์šฉํ•˜๊ณ ์ž ํ•˜๋Š” Helper+Service ๊ฐ์ฒด ์„ ์–ธ */ Logger logger; SqlSession sqlSession; WebHelper web; RegexHelper regex; UploadHelper upload; ArticleService articleService; ImageFileService imageFileService; @Override public String doRun(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { /** (2) ํ•„์š”ํ•œ ํ—ฌํผ ๊ฐ์ฒด ์ƒ์„ฑ */ logger = LogManager.getFormatterLogger(request.getRequestURI()); // --> import study.jsp.mysite.service.impl.MemberServiceImpl; sqlSession = MybatisConnectionFactory.getSqlSession(); web = WebHelper.getInstance(request, response); regex = RegexHelper.getInstance(); upload = UploadHelper.getInstance(); articleService = new ArticleServiceImpl(sqlSession, logger); imageFileService = new ImageFileServiceImpl(sqlSession, logger); /** (3) ํŒŒ์ผ์ด ํฌํ•จ๋œ POST ํŒŒ๋ผ๋ฏธํ„ฐ ๋ฐ›๊ธฐ */ try { upload.multipartRequest(request); } catch (Exception e) { sqlSession.close(); web.redirect(null, "it's not multipart data"); return null; } /** (4) UploadHelper์—์„œ ํ…์ŠคํŠธ ํ˜•์‹์˜ ๊ฐ’์„ ์ถ”์ถœ */ Map<String, String> paramMap = upload.getParamMap(); int article_id = 0; try { article_id = Integer.parseInt(paramMap.get("article_id")); } catch (NumberFormatException e) { sqlSession.close(); web.redirect(null, "do not get article_id number"); return null; } String category = paramMap.get("category"); String title = paramMap.get("title"); String content = paramMap.get("content"); String ip_address = web.getClientIP(); int member_id = 0; /** (7) ๋กœ๊ทธ์ธ ํ•œ ๊ฒฝ์šฐ ์ž์‹ ์˜ ๊ธ€์ด๋ผ๋ฉด ์ž…๋ ฅํ•˜์ง€ ์•Š์€ ์ •๋ณด๋ฅผ ์„ธ์…˜ ๋ฐ์ดํ„ฐ๋กœ ๋Œ€์ฒดํ•œ๋‹ค. */ // ์†Œ์œ ๊ถŒ ๊ฒ€์‚ฌ ์ •๋ณด boolean myArticle = false; Member loginInfo = (Member) web.getSession("loginInfo"); if (loginInfo != null) { try { // ์†Œ์œ ๊ถŒ ํŒ์ •์„ ์œ„ํ•˜์—ฌ ์‚ฌ์šฉํ•˜๋Š” ์ž„์‹œ ๊ฐ์ฒด Article temp = new Article(); temp.setCategory(category); temp.setId(article_id); temp.setMember_id(loginInfo.getId()); if (articleService.selectArticleCountByMemberId(temp) > 0) { // ์†Œ์œ ๊ถŒ์„ ์˜๋ฏธํ•˜๋Š” ๋ณ€์ˆ˜ ๋ณ€๊ฒฝ myArticle = true; // ์ž…๋ ฅ๋˜์ง€ ์•Š์€ ์ •๋ณด๋“ค ๊ฐฑ์‹  } } catch (Exception e) { sqlSession.close(); web.redirect(null, e.getLocalizedMessage()); return null; } } // ์ „๋‹ฌ๋œ ํŒŒ๋ผ๋ฏธํ„ฐ๋Š” ๋กœ๊ทธ๋กœ ํ™•์ธํ•œ๋‹ค. logger.debug("article_id=" + article_id); logger.debug("category=" + category); logger.debug("title=" + title); logger.debug("content=" + content); logger.debug("ip_address=" + ip_address); logger.debug("member_id=" + member_id); if(!regex.isValue(title)) { sqlSession.close(); web.redirect(null, "title field is required"); return null; } if(!regex.isValue(content)) { sqlSession.close(); web.redirect(null, "content field is required"); return null; } Article article = new Article(); article.setId(article_id); article.setCategory(category); article.setTitle(title); article.setContent(content); article.setMember_id(member_id); article.setIp_address(ip_address); logger.debug("article >> " + article.toString()); /** (10) ๊ฒŒ์‹œ๋ฌผ ๋ณ€๊ฒฝ์„ ์œ„ํ•œ Service ๊ธฐ๋Šฅ์„ ํ˜ธ์ถœ */ try { if (articleService.selectArticleCountByMemberId(article) < 1) { articleService.updateArticle(article); } } catch (Exception e) { sqlSession.close(); web.redirect(null, e.getLocalizedMessage()); return null; } /** (11) ์‚ญ์ œ๋ฅผ ์„ ํƒํ•œ ์ฒจ๋ถ€ํŒŒ์ผ์— ๋Œ€ํ•œ ์ฒ˜๋ฆฌ */ // ์‚ญ์ œํ•  ํŒŒ์ผ ๋ชฉ๋ก์— ๋Œ€ํ•œ ์ฒดํฌ๊ฒฐ๊ณผ --> ์ฒดํฌ๋ฐ•์Šค์˜ ์„ ํƒ๊ฐ’์„ paramMap์—์„œ ์ถ”์ถœ String delFile = paramMap.get("del_file"); if (delFile != null) { // ์ฝค๋งˆ ๋‹จ์œ„๋กœ ์ž˜๋ผ์„œ ๋ฐฐ์—ด๋กœ ๋ณ€ํ™˜ String[] delFileList = delFile.split(","); for (int i = 0; i < delFileList.length; i++) { try { // ์ฒดํฌ๋ฐ•์Šค์— ์˜ํ•ด์„œ ์ „๋‹ฌ๋œ id๊ฐ’์œผ๋กœ ๊ฐœ๋ณ„ ํŒŒ์ผ์— ๋Œ€ํ•œ Beans ์ƒ์„ฑ ImageFile file = new ImageFile(); file.setId(Integer.parseInt(delFileList[i])); // ๊ฐœ๋ณ„ ํŒŒ์ผ์— ๋Œ€ํ•œ ์ •๋ณด๋ฅผ ์กฐํšŒํ•˜์—ฌ ์‹ค์ œ ํŒŒ์ผ์„ ์‚ญ์ œํ•œ๋‹ค. ImageFile item = imageFileService.selectFile(file); upload.removeFile(item.getFileDir() + "/" + item.getFileName()); // DB์—์„œ ํŒŒ์ผ์ •๋ณด ์‚ญ์ œ์ฒ˜๋ฆฌ imageFileService.deleteFile(file); } catch (Exception e) { sqlSession.close(); web.redirect(null, e.getLocalizedMessage()); return null; } } } /** (12) ์ฒจ๋ถ€ํŒŒ์ผ ๋ชฉ๋ก ์ฒ˜๋ฆฌ */ // ์—…๋กœ๋“œ ๋œ ํŒŒ์ผ ๋ชฉ๋ก // --> import study.jsp.helper.FileInfo; List<FileInfo> fileList = upload.getFileList(); // ์—…๋กœ๋“œ ๋œ ํŒŒ์ผ์˜ ์ˆ˜ ๋งŒํผ ๋ฐ˜๋ณต ์ฒ˜๋ฆฌ ํ•œ๋‹ค. for(int i = 0; i <fileList.size(); i++){ // ์—…๋กœ๋“œ ๋œ ์ •๋ณด ํ•˜๋‚˜ ์ถ”์ถœํ•˜์—ฌ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์— ์ €์žฅํ•˜๊ธฐ ์œ„ํ•œ ํ˜•ํƒœ๋กœ ๊ฐ€๊ณตํ•ด์•ผ ํ•œ๋‹ค. FileInfo info = fileList.get(i); //DB์— ์ €์žฅํ•˜๊ธฐ ์œ„ํ•œ ํ•ญ๋ชฉ ํ•˜๋‚˜ ์ƒ์„ฑ ImageFile file = new ImageFile(); // ๋ฐ์ดํ„ฐ ๋ณต์‚ฌ file.setOriginName(info.getOrginName()); file.setFileDir(info.getFileDir()); file.setFileName(info.getFileName()); file.setContentType(info.getContentType()); file.setFileSize(info.getFileSize()); // ์–ด๋А ๊ฒŒ์‹œ๋ฌผ์— ์†ํ•œ ํŒŒ์ผ์ธ์ง€ ์ธ์‹ file.setArticle_id(article_id); // ์ €์žฅ์ฒ˜๋ฆฌ try { imageFileService.insertArticleFile(file); }catch (Exception e) { web.redirect(null, e.getLocalizedMessage()); return null; }//end try ~ catch }//end if /** (13) ๋ชจ๋“  ์ ˆ์ฐจ๊ฐ€ ์ข…๋ฃŒ๋˜์—ˆ์œผ๋ฏ€๋กœ DB์ ‘์† ํ•ด์ œ ํ›„ ํŽ˜์ด์ง€ ์ด๋™ */ sqlSession.close(); String url = "%s/article/article_read_mobile?article_id=%d"; url = String.format(url, web.getRootPath(), article_id); web.redirect(url, null); return null; } }
[ "yunsig@222.114.240.105" ]
yunsig@222.114.240.105
718c46edb5fec99842a00599e6346f7c3c3c40c4
8c8578aa43adf8c17b209901627f00cc84cd9f35
/ExamDemo/src/com/icss/entity/Tteacher.java
ff2aae49eac1270b96f03fa1b32f78ed576878c9
[]
no_license
Orangeletbear/javaweb-
14bbcdcbd8c41c1e716d1622da6d16671f6b929c
2fc500cdb03b4bb75d454ad62ab39d51036d8692
refs/heads/master
2020-06-08T09:05:45.662794
2019-06-22T06:55:34
2019-06-22T06:55:34
193,202,101
0
0
null
null
null
null
GB18030
Java
false
false
852
java
package com.icss.entity; public class Tteacher { private String tno; private String tname; private String tgender;//ๆ€งๅˆซ private String tcontact; private String temail; private String ison;//ๆ˜ฏๅฆๅœจ่Œ public String getTno() { return tno; } public void setTno(String tno) { this.tno = tno; } public String getTname() { return tname; } public void setTname(String tname) { this.tname = tname; } public String getTgender() { return tgender; } public void setTgender(String tgender) { this.tgender = tgender; } public String getTcontact() { return tcontact; } public void setTcontact(String tcontact) { this.tcontact = tcontact; } public String getTemail() { return temail; } public void setTemail(String temail) { this.temail = temail; } public String getIson() { return ison; } public void setIson(String ison) { this.ison = ison; } }
[ "1471755989@qq.com" ]
1471755989@qq.com