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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0bf935d50e552f15a80cae4d12b469cdb3c729c1 | 80f9af9235be06b7448dc3fcc3c1c46fb63decf1 | /docampoparamesa/docampoparamesa/src/main/java/br/com/generation/docampoparamesa/security/UserDetailsImpl.java | 39daa1f6cc18e15a5eab3e7492fdead76aab7af4 | [] | no_license | vivianreis/projeto-integrador | abc0bb4087bfdd21470a801a0ccd087e540602c8 | 82ffe481dac0fc34128635657846d8c8fe1599f9 | refs/heads/master | 2023-01-05T06:30:08.526183 | 2020-11-08T19:19:30 | 2020-11-08T19:19:30 | 282,240,825 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,342 | java | package br.com.generation.docampoparamesa.security;
import java.util.Collection;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import br.com.generation.docampoparamesa.model.Usuario;
public class UserDetailsImpl implements UserDetails{
private static final long serialVersionUID = 1L;
private String userName;
private String password;
public UserDetailsImpl(Usuario user) {
this.userName = user.getUsuario();
this.password = user.getSenha();
}
public UserDetailsImpl() {
}
@Override
public Collection<? extends GrantedAuthority> getAuthorities() {
// TODO Auto-generated method stub
return null;
}
@Override
public String getPassword() {
// TODO Auto-generated method stub
return password;
}
@Override
public String getUsername() {
// TODO Auto-generated method stub
return userName;
}
@Override
public boolean isAccountNonExpired() {
// TODO Auto-generated method stub
return true;
}
@Override
public boolean isAccountNonLocked() {
// TODO Auto-generated method stub
return true;
}
@Override
public boolean isCredentialsNonExpired() {
// TODO Auto-generated method stub
return true;
}
@Override
public boolean isEnabled() {
// TODO Auto-generated method stub
return true;
}
}
| [
"srtvivian@hotmail.com"
] | srtvivian@hotmail.com |
87e869b286334bf2b12a4b85ad5a41f7e23e5f44 | 0abca6a0b9c2ed6cd4a1de6c9bbc8c5508eef188 | /app/src/main/java/com/exercise/stupa/object/Classes.java | 9524d281291bb2a551ff7c7bb2a971151ab44db4 | [] | no_license | anjas29/StupaMobileVersion | 8300e91f30d80aa92be9c0342807af0abaea24d9 | 8a1db1722f38f05cf6cbe7cfbb800c06e3e5a31d | refs/heads/master | 2021-01-20T06:20:02.073977 | 2017-06-15T14:54:07 | 2017-06-15T14:54:07 | 89,865,744 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 529 | java | package com.exercise.stupa.object;
/**
* Created by anjas on 01/05/17.
*/
public class Classes {
private String name;
private String grade;
public Classes(String name, String grade) {
this.name = name;
this.grade = grade;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getGrade() {
return grade;
}
public void setGrade(String grade) {
this.grade = grade;
}
}
| [
"anjasmoro.adi29@gmail.com"
] | anjasmoro.adi29@gmail.com |
1b1bf281391aa276df0a22fb85b33d1e50d86290 | 4312a71c36d8a233de2741f51a2a9d28443cd95b | /RawExperiments/DB/Lang39/AstorMain-lang39/src/variant-1219/org/apache/commons/lang3/StringUtils.java | c3e2cf97f93a35f3f500121df1b42cfd340d03fc | [] | no_license | SajjadZaidi/AutoRepair | 5c7aa7a689747c143cafd267db64f1e365de4d98 | e21eb9384197bae4d9b23af93df73b6e46bb749a | refs/heads/master | 2021-05-07T00:07:06.345617 | 2017-12-02T18:48:14 | 2017-12-02T18:48:14 | 112,858,432 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 74,427 | java | package org.apache.commons.lang3;
public class StringUtils {
public static final java.lang.String EMPTY = "";
public static final int INDEX_NOT_FOUND = -1;
private static final int PAD_LIMIT = 8192;
public StringUtils() {
super();
}
public static boolean isEmpty(java.lang.CharSequence str) {
return (str == null) || ((str.length()) == 0);
}
public static boolean isNotEmpty(java.lang.CharSequence str) {
return !(org.apache.commons.lang3.StringUtils.isEmpty(str));
}
public static boolean isBlank(java.lang.CharSequence str) {
int strLen;
if ((str == null) || ((strLen = str.length()) == 0)) {
return true;
}
for (int i = 0 ; i < strLen ; i++) {
if ((java.lang.Character.isWhitespace(str.charAt(i))) == false) {
return false;
}
}
return true;
}
public static boolean isNotBlank(java.lang.CharSequence str) {
return !(org.apache.commons.lang3.StringUtils.isBlank(str));
}
public static java.lang.String trim(java.lang.String str) {
return str == null ? null : str.trim();
}
public static java.lang.String trimToNull(java.lang.String str) {
java.lang.String ts = org.apache.commons.lang3.StringUtils.trim(str);
return org.apache.commons.lang3.StringUtils.isEmpty(ts) ? null : ts;
}
public static java.lang.String trimToEmpty(java.lang.String str) {
return str == null ? org.apache.commons.lang3.StringUtils.EMPTY : str.trim();
}
public static java.lang.String strip(java.lang.String str) {
return org.apache.commons.lang3.StringUtils.strip(str, null);
}
public static java.lang.String stripToNull(java.lang.String str) {
if (str == null) {
return null;
}
str = org.apache.commons.lang3.StringUtils.strip(str, null);
return (str.length()) == 0 ? null : str;
}
public static java.lang.String stripToEmpty(java.lang.String str) {
return str == null ? org.apache.commons.lang3.StringUtils.EMPTY : org.apache.commons.lang3.StringUtils.strip(str, null);
}
public static java.lang.String strip(java.lang.String str, java.lang.String stripChars) {
if (org.apache.commons.lang3.StringUtils.isEmpty(str)) {
return str;
}
str = org.apache.commons.lang3.StringUtils.stripStart(str, stripChars);
return org.apache.commons.lang3.StringUtils.stripEnd(str, stripChars);
}
public static java.lang.String stripStart(java.lang.String str, java.lang.String stripChars) {
int strLen;
if ((str == null) || ((strLen = str.length()) == 0)) {
return str;
}
int start = 0;
if (stripChars == null) {
while ((start != strLen) && (java.lang.Character.isWhitespace(str.charAt(start)))) {
start++;
}
} else {
if ((stripChars.length()) == 0) {
return str;
} else {
while ((start != strLen) && ((stripChars.indexOf(str.charAt(start))) != (-1))) {
start++;
}
}
}
return str.substring(start);
}
public static java.lang.String stripEnd(java.lang.String str, java.lang.String stripChars) {
int end;
if ((str == null) || ((end = str.length()) == 0)) {
return str;
}
if (stripChars == null) {
while ((end != 0) && (java.lang.Character.isWhitespace(str.charAt((end - 1))))) {
end--;
}
} else {
if ((stripChars.length()) == 0) {
return str;
} else {
while ((end != 0) && ((stripChars.indexOf(str.charAt((end - 1)))) != (-1))) {
end--;
}
}
}
return str.substring(0, end);
}
public static java.lang.String[] stripAll(java.lang.String[] strs) {
return org.apache.commons.lang3.StringUtils.stripAll(strs, null);
}
public static java.lang.String[] stripAll(java.lang.String[] strs, java.lang.String stripChars) {
int strsLen;
if ((strs == null) || ((strsLen = strs.length) == 0)) {
return strs;
}
java.lang.String[] newArr = new java.lang.String[strsLen];
for (int i = 0 ; i < strsLen ; i++) {
newArr[i] = org.apache.commons.lang3.StringUtils.strip(strs[i], stripChars);
}
return newArr;
}
public static java.lang.String stripAccents(java.lang.String input) {
if (input == null) {
return null;
}
if (org.apache.commons.lang3.SystemUtils.isJavaVersionAtLeast(1.6F)) {
try {
java.lang.Class normalizerFormClass = org.apache.commons.lang3.ClassUtils.getClass("java.text.Normalizer$Form", false);
java.lang.Class normalizerClass = org.apache.commons.lang3.ClassUtils.getClass("java.text.Normalizer", false);
java.lang.reflect.Method method = normalizerClass.getMethod("normalize", java.lang.CharSequence.class, normalizerFormClass);
java.lang.reflect.Field nfd = normalizerFormClass.getField("NFD");
java.lang.String decomposed = ((java.lang.String)(method.invoke(null, input, nfd.get(null))));
java.util.regex.Pattern accentPattern = java.util.regex.Pattern.compile("\\p{InCombiningDiacriticalMarks}+");
return accentPattern.matcher(decomposed).replaceAll("");
} catch (java.lang.ClassNotFoundException cnfe) {
throw new java.lang.RuntimeException("ClassNotFoundException occurred during 1.6 backcompat code" , cnfe);
} catch (java.lang.NoSuchMethodException nsme) {
throw new java.lang.RuntimeException("NoSuchMethodException occurred during 1.6 backcompat code" , nsme);
} catch (java.lang.NoSuchFieldException nsfe) {
throw new java.lang.RuntimeException("NoSuchFieldException occurred during 1.6 backcompat code" , nsfe);
} catch (java.lang.IllegalAccessException iae) {
throw new java.lang.RuntimeException("IllegalAccessException occurred during 1.6 backcompat code" , iae);
} catch (java.lang.IllegalArgumentException iae) {
throw new java.lang.RuntimeException("IllegalArgumentException occurred during 1.6 backcompat code" , iae);
} catch (java.lang.reflect.InvocationTargetException ite) {
throw new java.lang.RuntimeException("InvocationTargetException occurred during 1.6 backcompat code" , ite);
} catch (java.lang.SecurityException se) {
throw new java.lang.RuntimeException("SecurityException occurred during 1.6 backcompat code" , se);
}
} else {
throw new java.lang.UnsupportedOperationException("The stripAccents(String) method is not supported until Java 1.6");
}
}
public static boolean equals(java.lang.String str1, java.lang.String str2) {
return str1 == null ? str2 == null : str1.equals(str2);
}
public static boolean equalsIgnoreCase(java.lang.String str1, java.lang.String str2) {
return str1 == null ? str2 == null : str1.equalsIgnoreCase(str2);
}
public static int indexOf(java.lang.String str, char searchChar) {
if (org.apache.commons.lang3.StringUtils.isEmpty(str)) {
return -1;
}
return str.indexOf(searchChar);
}
public static int indexOf(java.lang.String str, char searchChar, int startPos) {
if (org.apache.commons.lang3.StringUtils.isEmpty(str)) {
return -1;
}
return str.indexOf(searchChar, startPos);
}
public static int indexOf(java.lang.String str, java.lang.String searchStr) {
if ((str == null) || (searchStr == null)) {
return -1;
}
return str.indexOf(searchStr);
}
public static int ordinalIndexOf(java.lang.String str, java.lang.String searchStr, int ordinal) {
if (((str == null) || (searchStr == null)) || (ordinal <= 0)) {
return org.apache.commons.lang3.StringUtils.INDEX_NOT_FOUND;
}
if ((searchStr.length()) == 0) {
return 0;
}
int found = 0;
int index = org.apache.commons.lang3.StringUtils.INDEX_NOT_FOUND;
do {
index = str.indexOf(searchStr, (index + 1));
if (index < 0) {
return index;
}
found++;
} while (found < ordinal );
return index;
}
public static int indexOf(java.lang.String str, java.lang.String searchStr, int startPos) {
if ((str == null) || (searchStr == null)) {
return -1;
}
if (((searchStr.length()) == 0) && (startPos >= (str.length()))) {
return str.length();
}
return str.indexOf(searchStr, startPos);
}
public static int lastIndexOf(java.lang.String str, char searchChar) {
if (org.apache.commons.lang3.StringUtils.isEmpty(str)) {
return -1;
}
return str.lastIndexOf(searchChar);
}
public static int lastIndexOf(java.lang.String str, char searchChar, int startPos) {
if (org.apache.commons.lang3.StringUtils.isEmpty(str)) {
return -1;
}
return str.lastIndexOf(searchChar, startPos);
}
public static int lastIndexOf(java.lang.String str, java.lang.String searchStr) {
if ((str == null) || (searchStr == null)) {
return -1;
}
return str.lastIndexOf(searchStr);
}
public static int lastIndexOf(java.lang.String str, java.lang.String searchStr, int startPos) {
if ((str == null) || (searchStr == null)) {
return -1;
}
return str.lastIndexOf(searchStr, startPos);
}
public static boolean contains(java.lang.String str, char searchChar) {
if (org.apache.commons.lang3.StringUtils.isEmpty(str)) {
return false;
}
return (str.indexOf(searchChar)) >= 0;
}
public static boolean contains(java.lang.String str, java.lang.String searchStr) {
if ((str == null) || (searchStr == null)) {
return false;
}
return (str.indexOf(searchStr)) >= 0;
}
public static boolean containsIgnoreCase(java.lang.String str, java.lang.String searchStr) {
if ((str == null) || (searchStr == null)) {
return false;
}
int len = searchStr.length();
int max = (str.length()) - len;
for (int i = 0 ; i <= max ; i++) {
if (str.regionMatches(true, i, searchStr, 0, len)) {
return true;
}
}
return false;
}
public static int indexOfAny(java.lang.String str, char[] searchChars) {
if ((org.apache.commons.lang3.StringUtils.isEmpty(str)) || (org.apache.commons.lang3.ArrayUtils.isEmpty(searchChars))) {
return -1;
}
for (int i = 0 ; i < (str.length()) ; i++) {
char ch = str.charAt(i);
for (int j = 0 ; j < (searchChars.length) ; j++) {
if ((searchChars[j]) == ch) {
return i;
}
}
}
return -1;
}
public static int indexOfAny(java.lang.String str, java.lang.String searchChars) {
if ((org.apache.commons.lang3.StringUtils.isEmpty(str)) || (org.apache.commons.lang3.StringUtils.isEmpty(searchChars))) {
return -1;
}
return org.apache.commons.lang3.StringUtils.indexOfAny(str, searchChars.toCharArray());
}
public static boolean containsAny(java.lang.String str, char[] searchChars) {
if ((((str == null) || ((str.length()) == 0)) || (searchChars == null)) || ((searchChars.length) == 0)) {
return false;
}
for (int i = 0 ; i < (str.length()) ; i++) {
char ch = str.charAt(i);
for (int j = 0 ; j < (searchChars.length) ; j++) {
if ((searchChars[j]) == ch) {
return true;
}
}
}
return false;
}
public static boolean containsAny(java.lang.String str, java.lang.String searchChars) {
if (searchChars == null) {
return false;
}
return org.apache.commons.lang3.StringUtils.containsAny(str, searchChars.toCharArray());
}
public static int indexOfAnyBut(java.lang.String str, char[] searchChars) {
if ((org.apache.commons.lang3.StringUtils.isEmpty(str)) || (org.apache.commons.lang3.ArrayUtils.isEmpty(searchChars))) {
return -1;
}
outer : for (int i = 0 ; i < (str.length()) ; i++) {
char ch = str.charAt(i);
for (int j = 0 ; j < (searchChars.length) ; j++) {
if ((searchChars[j]) == ch) {
continue outer;
}
}
return i;
}
return -1;
}
public static int indexOfAnyBut(java.lang.String str, java.lang.String searchChars) {
if ((org.apache.commons.lang3.StringUtils.isEmpty(str)) || (org.apache.commons.lang3.StringUtils.isEmpty(searchChars))) {
return -1;
}
for (int i = 0 ; i < (str.length()) ; i++) {
if ((searchChars.indexOf(str.charAt(i))) < 0) {
return i;
}
}
return -1;
}
public static boolean containsOnly(java.lang.String str, char[] valid) {
if ((valid == null) || (str == null)) {
return false;
}
if ((str.length()) == 0) {
return true;
}
if ((valid.length) == 0) {
return false;
}
return (org.apache.commons.lang3.StringUtils.indexOfAnyBut(str, valid)) == (-1);
}
public static boolean containsOnly(java.lang.String str, java.lang.String validChars) {
if ((str == null) || (validChars == null)) {
return false;
}
return org.apache.commons.lang3.StringUtils.containsOnly(str, validChars.toCharArray());
}
public static boolean containsNone(java.lang.String str, char[] invalidChars) {
if ((str == null) || (invalidChars == null)) {
return true;
}
int strSize = str.length();
int validSize = invalidChars.length;
for (int i = 0 ; i < strSize ; i++) {
char ch = str.charAt(i);
for (int j = 0 ; j < validSize ; j++) {
if ((invalidChars[j]) == ch) {
return false;
}
}
}
return true;
}
public static boolean containsNone(java.lang.String str, java.lang.String invalidChars) {
if ((str == null) || (invalidChars == null)) {
return true;
}
return org.apache.commons.lang3.StringUtils.containsNone(str, invalidChars.toCharArray());
}
public static int indexOfAny(java.lang.String str, java.lang.String[] searchStrs) {
if ((str == null) || (searchStrs == null)) {
return -1;
}
int sz = searchStrs.length;
int ret = java.lang.Integer.MAX_VALUE;
int tmp = 0;
for (int i = 0 ; i < sz ; i++) {
java.lang.String search = searchStrs[i];
if (search == null) {
continue;
}
tmp = str.indexOf(search);
if (tmp == (-1)) {
continue;
}
if (tmp < ret) {
ret = tmp;
}
}
return ret == (java.lang.Integer.MAX_VALUE) ? -1 : ret;
}
public static int lastIndexOfAny(java.lang.String str, java.lang.String[] searchStrs) {
if ((str == null) || (searchStrs == null)) {
return -1;
}
int sz = searchStrs.length;
int ret = -1;
int tmp = 0;
for (int i = 0 ; i < sz ; i++) {
java.lang.String search = searchStrs[i];
if (search == null) {
continue;
}
tmp = str.lastIndexOf(search);
if (tmp > ret) {
ret = tmp;
}
}
return ret;
}
public static java.lang.String substring(java.lang.String str, int start) {
if (str == null) {
return null;
}
if (start < 0) {
start = (str.length()) + start;
}
if (start < 0) {
start = 0;
}
if (start > (str.length())) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
return str.substring(start);
}
public static java.lang.String substring(java.lang.String str, int start, int end) {
if (str == null) {
return null;
}
if (end < 0) {
end = (str.length()) + end;
}
if (start < 0) {
start = (str.length()) + start;
}
if (end > (str.length())) {
end = str.length();
}
if (start > end) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
if (start < 0) {
start = 0;
}
if (end < 0) {
end = 0;
}
return str.substring(start, end);
}
public static java.lang.String left(java.lang.String str, int len) {
if (str == null) {
return null;
}
if (len < 0) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
if ((str.length()) <= len) {
return str;
}
return str.substring(0, len);
}
public static java.lang.String right(java.lang.String str, int len) {
if (str == null) {
return null;
}
if (len < 0) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
if ((str.length()) <= len) {
return str;
}
return str.substring(((str.length()) - len));
}
public static java.lang.String mid(java.lang.String str, int pos, int len) {
if (str == null) {
return null;
}
if ((len < 0) || (pos > (str.length()))) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
if (pos < 0) {
pos = 0;
}
if ((str.length()) <= (pos + len)) {
return str.substring(pos);
}
return str.substring(pos, (pos + len));
}
public static java.lang.String substringBefore(java.lang.String str, java.lang.String separator) {
if ((org.apache.commons.lang3.StringUtils.isEmpty(str)) || (separator == null)) {
return str;
}
if ((separator.length()) == 0) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
int pos = str.indexOf(separator);
if (pos == (-1)) {
return str;
}
return str.substring(0, pos);
}
public static java.lang.String substringAfter(java.lang.String str, java.lang.String separator) {
if (org.apache.commons.lang3.StringUtils.isEmpty(str)) {
return str;
}
if (separator == null) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
int pos = str.indexOf(separator);
if (pos == (-1)) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
return str.substring((pos + (separator.length())));
}
public static java.lang.String substringBeforeLast(java.lang.String str, java.lang.String separator) {
if ((org.apache.commons.lang3.StringUtils.isEmpty(str)) || (org.apache.commons.lang3.StringUtils.isEmpty(separator))) {
return str;
}
int pos = str.lastIndexOf(separator);
if (pos == (-1)) {
return str;
}
return str.substring(0, pos);
}
public static java.lang.String substringAfterLast(java.lang.String str, java.lang.String separator) {
if (org.apache.commons.lang3.StringUtils.isEmpty(str)) {
return str;
}
if (org.apache.commons.lang3.StringUtils.isEmpty(separator)) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
int pos = str.lastIndexOf(separator);
if ((pos == (-1)) || (pos == ((str.length()) - (separator.length())))) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
return str.substring((pos + (separator.length())));
}
public static java.lang.String substringBetween(java.lang.String str, java.lang.String tag) {
return org.apache.commons.lang3.StringUtils.substringBetween(str, tag, tag);
}
public static java.lang.String substringBetween(java.lang.String str, java.lang.String open, java.lang.String close) {
if (((str == null) || (open == null)) || (close == null)) {
return null;
}
int start = str.indexOf(open);
if (start != (-1)) {
int end = str.indexOf(close, (start + (open.length())));
if (end != (-1)) {
return str.substring((start + (open.length())), end);
}
}
return null;
}
public static java.lang.String[] substringsBetween(java.lang.String str, java.lang.String open, java.lang.String close) {
if (((str == null) || (org.apache.commons.lang3.StringUtils.isEmpty(open))) || (org.apache.commons.lang3.StringUtils.isEmpty(close))) {
return null;
}
int strLen = str.length();
if (strLen == 0) {
return org.apache.commons.lang3.ArrayUtils.EMPTY_STRING_ARRAY;
}
int closeLen = close.length();
int openLen = open.length();
java.util.List<java.lang.String> list = new java.util.ArrayList<java.lang.String>();
int pos = 0;
while (pos < (strLen - closeLen)) {
int start = str.indexOf(open, pos);
if (start < 0) {
break;
}
start += openLen;
int end = str.indexOf(close, start);
if (end < 0) {
break;
}
list.add(str.substring(start, end));
pos = end + closeLen;
}
if (list.isEmpty()) {
return null;
}
return list.toArray(new java.lang.String[list.size()]);
}
public static java.lang.String[] split(java.lang.String str) {
return org.apache.commons.lang3.StringUtils.split(str, null, (-1));
}
public static java.lang.String[] split(java.lang.String str, char separatorChar) {
return org.apache.commons.lang3.StringUtils.splitWorker(str, separatorChar, false);
}
public static java.lang.String[] split(java.lang.String str, java.lang.String separatorChars) {
return org.apache.commons.lang3.StringUtils.splitWorker(str, separatorChars, (-1), false);
}
public static java.lang.String[] split(java.lang.String str, java.lang.String separatorChars, int max) {
return org.apache.commons.lang3.StringUtils.splitWorker(str, separatorChars, max, false);
}
public static java.lang.String[] splitByWholeSeparator(java.lang.String str, java.lang.String separator) {
return org.apache.commons.lang3.StringUtils.splitByWholeSeparatorWorker(str, separator, (-1), false);
}
public static java.lang.String[] splitByWholeSeparator(java.lang.String str, java.lang.String separator, int max) {
return org.apache.commons.lang3.StringUtils.splitByWholeSeparatorWorker(str, separator, max, false);
}
public static java.lang.String[] splitByWholeSeparatorPreserveAllTokens(java.lang.String str, java.lang.String separator) {
return org.apache.commons.lang3.StringUtils.splitByWholeSeparatorWorker(str, separator, (-1), true);
}
public static java.lang.String[] splitByWholeSeparatorPreserveAllTokens(java.lang.String str, java.lang.String separator, int max) {
return org.apache.commons.lang3.StringUtils.splitByWholeSeparatorWorker(str, separator, max, true);
}
private static java.lang.String[] splitByWholeSeparatorWorker(java.lang.String str, java.lang.String separator, int max, boolean preserveAllTokens) {
if (str == null) {
return null;
}
int len = str.length();
if (len == 0) {
return org.apache.commons.lang3.ArrayUtils.EMPTY_STRING_ARRAY;
}
if ((separator == null) || (org.apache.commons.lang3.StringUtils.EMPTY.equals(separator))) {
return org.apache.commons.lang3.StringUtils.splitWorker(str, null, max, preserveAllTokens);
}
int separatorLength = separator.length();
java.util.ArrayList<java.lang.String> substrings = new java.util.ArrayList<java.lang.String>();
int numberOfSubstrings = 0;
int beg = 0;
int end = 0;
while (end < len) {
end = str.indexOf(separator, beg);
if (end > (-1)) {
if (end > beg) {
numberOfSubstrings += 1;
if (numberOfSubstrings == max) {
end = len;
substrings.add(str.substring(beg));
} else {
substrings.add(str.substring(beg, end));
beg = end + separatorLength;
}
} else {
if (preserveAllTokens) {
numberOfSubstrings += 1;
if (numberOfSubstrings == max) {
end = len;
substrings.add(str.substring(beg));
} else {
substrings.add(org.apache.commons.lang3.StringUtils.EMPTY);
}
}
beg = end + separatorLength;
}
} else {
substrings.add(str.substring(beg));
end = len;
}
}
return substrings.toArray(new java.lang.String[substrings.size()]);
}
public static java.lang.String[] splitPreserveAllTokens(java.lang.String str) {
return org.apache.commons.lang3.StringUtils.splitWorker(str, null, (-1), true);
}
public static java.lang.String[] splitPreserveAllTokens(java.lang.String str, char separatorChar) {
return org.apache.commons.lang3.StringUtils.splitWorker(str, separatorChar, true);
}
private static java.lang.String[] splitWorker(java.lang.String str, char separatorChar, boolean preserveAllTokens) {
if (str == null) {
return null;
}
int len = str.length();
if (len == 0) {
return org.apache.commons.lang3.ArrayUtils.EMPTY_STRING_ARRAY;
}
java.util.List<java.lang.String> list = new java.util.ArrayList<java.lang.String>();
int i = 0;
int start = 0;
boolean match = false;
boolean lastMatch = false;
while (i < len) {
if ((str.charAt(i)) == separatorChar) {
if (match || preserveAllTokens) {
list.add(str.substring(start, i));
match = false;
lastMatch = true;
}
start = ++i;
continue;
}
lastMatch = false;
match = true;
i++;
}
if (match || (preserveAllTokens && lastMatch)) {
list.add(str.substring(start, i));
}
return list.toArray(new java.lang.String[list.size()]);
}
public static java.lang.String[] splitPreserveAllTokens(java.lang.String str, java.lang.String separatorChars) {
return org.apache.commons.lang3.StringUtils.splitWorker(str, separatorChars, (-1), true);
}
public static java.lang.String[] splitPreserveAllTokens(java.lang.String str, java.lang.String separatorChars, int max) {
return org.apache.commons.lang3.StringUtils.splitWorker(str, separatorChars, max, true);
}
private static java.lang.String[] splitWorker(java.lang.String str, java.lang.String separatorChars, int max, boolean preserveAllTokens) {
if (str == null) {
return null;
}
int len = str.length();
if (len == 0) {
return org.apache.commons.lang3.ArrayUtils.EMPTY_STRING_ARRAY;
}
java.util.List<java.lang.String> list = new java.util.ArrayList<java.lang.String>();
int sizePlus1 = 1;
int i = 0;
int start = 0;
boolean match = false;
boolean lastMatch = false;
if (separatorChars == null) {
while (i < len) {
if (java.lang.Character.isWhitespace(str.charAt(i))) {
if (match || preserveAllTokens) {
lastMatch = true;
if ((sizePlus1++) == max) {
i = len;
lastMatch = false;
}
list.add(str.substring(start, i));
match = false;
}
start = ++i;
continue;
}
lastMatch = false;
match = true;
i++;
}
} else {
if ((separatorChars.length()) == 1) {
char sep = separatorChars.charAt(0);
while (i < len) {
if ((str.charAt(i)) == sep) {
if (match || preserveAllTokens) {
lastMatch = true;
if ((sizePlus1++) == max) {
i = len;
lastMatch = false;
}
list.add(str.substring(start, i));
match = false;
}
start = ++i;
continue;
}
lastMatch = false;
match = true;
i++;
}
} else {
while (i < len) {
if ((separatorChars.indexOf(str.charAt(i))) >= 0) {
if (match || preserveAllTokens) {
lastMatch = true;
if ((sizePlus1++) == max) {
i = len;
lastMatch = false;
}
list.add(str.substring(start, i));
match = false;
}
start = ++i;
continue;
}
lastMatch = false;
match = true;
i++;
}
}
}
if (match || (preserveAllTokens && lastMatch)) {
list.add(str.substring(start, i));
}
return list.toArray(new java.lang.String[list.size()]);
}
public static java.lang.String[] splitByCharacterType(java.lang.String str) {
return org.apache.commons.lang3.StringUtils.splitByCharacterType(str, false);
}
public static java.lang.String[] splitByCharacterTypeCamelCase(java.lang.String str) {
return org.apache.commons.lang3.StringUtils.splitByCharacterType(str, true);
}
private static java.lang.String[] splitByCharacterType(java.lang.String str, boolean camelCase) {
if (str == null) {
return null;
}
if ((str.length()) == 0) {
return org.apache.commons.lang3.ArrayUtils.EMPTY_STRING_ARRAY;
}
char[] c = str.toCharArray();
java.util.List<java.lang.String> list = new java.util.ArrayList<java.lang.String>();
int tokenStart = 0;
int currentType = java.lang.Character.getType(c[tokenStart]);
for (int pos = tokenStart + 1 ; pos < (c.length) ; pos++) {
int type = java.lang.Character.getType(c[pos]);
if (type == currentType) {
continue;
}
if ((camelCase && (type == (java.lang.Character.LOWERCASE_LETTER))) && (currentType == (java.lang.Character.UPPERCASE_LETTER))) {
int newTokenStart = pos - 1;
if (newTokenStart != tokenStart) {
list.add(new java.lang.String(c , tokenStart , (newTokenStart - tokenStart)));
tokenStart = newTokenStart;
}
} else {
list.add(new java.lang.String(c , tokenStart , (pos - tokenStart)));
tokenStart = pos;
}
currentType = type;
}
list.add(new java.lang.String(c , tokenStart , ((c.length) - tokenStart)));
return list.toArray(new java.lang.String[list.size()]);
}
public static java.lang.String join(java.lang.Object[] array) {
return org.apache.commons.lang3.StringUtils.join(array, null);
}
public static java.lang.String join(java.lang.Object[] array, char separator) {
if (array == null) {
return null;
}
return org.apache.commons.lang3.StringUtils.join(array, separator, 0, array.length);
}
public static java.lang.String join(java.lang.Object[] array, char separator, int startIndex, int endIndex) {
if (array == null) {
return null;
}
int bufSize = endIndex - startIndex;
if (bufSize <= 0) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
bufSize *= ((array[startIndex]) == null ? 16 : array[startIndex].toString().length()) + 1;
java.lang.StringBuilder buf = new java.lang.StringBuilder(bufSize);
for (int i = startIndex ; i < endIndex ; i++) {
if (i > startIndex) {
buf.append(separator);
}
if ((array[i]) != null) {
buf.append(array[i]);
}
}
return buf.toString();
}
public static java.lang.String join(java.lang.Object[] array, java.lang.String separator) {
if (array == null) {
return null;
}
return org.apache.commons.lang3.StringUtils.join(array, separator, 0, array.length);
}
public static java.lang.String join(java.lang.Object[] array, java.lang.String separator, int startIndex, int endIndex) {
if (array == null) {
return null;
}
if (separator == null) {
separator = org.apache.commons.lang3.StringUtils.EMPTY;
}
int bufSize = endIndex - startIndex;
if (bufSize <= 0) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
bufSize *= ((array[startIndex]) == null ? 16 : array[startIndex].toString().length()) + (separator.length());
java.lang.StringBuilder buf = new java.lang.StringBuilder(bufSize);
for (int i = startIndex ; i < endIndex ; i++) {
if (i > startIndex) {
buf.append(separator);
}
if ((array[i]) != null) {
buf.append(array[i]);
}
}
return buf.toString();
}
public static java.lang.String join(java.util.Iterator<?> iterator, char separator) {
if (iterator == null) {
return null;
}
if (!(iterator.hasNext())) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
java.lang.Object first = iterator.next();
if (!(iterator.hasNext())) {
return org.apache.commons.lang3.ObjectUtils.toString(first);
}
java.lang.StringBuilder buf = new java.lang.StringBuilder(256);
if (first != null) {
buf.append(first);
}
while (iterator.hasNext()) {
buf.append(separator);
java.lang.Object obj = iterator.next();
if (obj != null) {
buf.append(obj);
}
}
return buf.toString();
}
public static java.lang.String join(java.util.Iterator<?> iterator, java.lang.String separator) {
if (iterator == null) {
return null;
}
if (!(iterator.hasNext())) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
java.lang.Object first = iterator.next();
if (!(iterator.hasNext())) {
return org.apache.commons.lang3.ObjectUtils.toString(first);
}
java.lang.StringBuilder buf = new java.lang.StringBuilder(256);
if (first != null) {
buf.append(first);
}
while (iterator.hasNext()) {
if (separator != null) {
buf.append(separator);
}
java.lang.Object obj = iterator.next();
if (obj != null) {
buf.append(obj);
}
}
return buf.toString();
}
public static java.lang.String join(java.lang.Iterable<?> iterable, char separator) {
if (iterable == null) {
return null;
}
return org.apache.commons.lang3.StringUtils.join(iterable.iterator(), separator);
}
public static java.lang.String join(java.lang.Iterable<?> iterable, java.lang.String separator) {
if (iterable == null) {
return null;
}
return org.apache.commons.lang3.StringUtils.join(iterable.iterator(), separator);
}
public static java.lang.String deleteWhitespace(java.lang.String str) {
if (org.apache.commons.lang3.StringUtils.isEmpty(str)) {
return str;
}
int sz = str.length();
char[] chs = new char[sz];
int count = 0;
for (int i = 0 ; i < sz ; i++) {
if (!(java.lang.Character.isWhitespace(str.charAt(i)))) {
chs[(count++)] = str.charAt(i);
}
}
if (count == sz) {
return str;
}
return new java.lang.String(chs , 0 , count);
}
public static java.lang.String removeStart(java.lang.String str, java.lang.String remove) {
if ((org.apache.commons.lang3.StringUtils.isEmpty(str)) || (org.apache.commons.lang3.StringUtils.isEmpty(remove))) {
return str;
}
if (str.startsWith(remove)) {
return str.substring(remove.length());
}
return str;
}
public static java.lang.String removeStartIgnoreCase(java.lang.String str, java.lang.String remove) {
if ((org.apache.commons.lang3.StringUtils.isEmpty(str)) || (org.apache.commons.lang3.StringUtils.isEmpty(remove))) {
return str;
}
if (org.apache.commons.lang3.StringUtils.startsWithIgnoreCase(str, remove)) {
return str.substring(remove.length());
}
return str;
}
public static java.lang.String removeEnd(java.lang.String str, java.lang.String remove) {
if ((org.apache.commons.lang3.StringUtils.isEmpty(str)) || (org.apache.commons.lang3.StringUtils.isEmpty(remove))) {
return str;
}
if (str.endsWith(remove)) {
return str.substring(0, ((str.length()) - (remove.length())));
}
return str;
}
public static java.lang.String removeEndIgnoreCase(java.lang.String str, java.lang.String remove) {
if ((org.apache.commons.lang3.StringUtils.isEmpty(str)) || (org.apache.commons.lang3.StringUtils.isEmpty(remove))) {
return str;
}
if (org.apache.commons.lang3.StringUtils.endsWithIgnoreCase(str, remove)) {
return str.substring(0, ((str.length()) - (remove.length())));
}
return str;
}
public static java.lang.String remove(java.lang.String str, java.lang.String remove) {
if ((org.apache.commons.lang3.StringUtils.isEmpty(str)) || (org.apache.commons.lang3.StringUtils.isEmpty(remove))) {
return str;
}
return org.apache.commons.lang3.StringUtils.replace(str, remove, org.apache.commons.lang3.StringUtils.EMPTY, (-1));
}
public static java.lang.String remove(java.lang.String str, char remove) {
if ((org.apache.commons.lang3.StringUtils.isEmpty(str)) || ((str.indexOf(remove)) == (-1))) {
return str;
}
char[] chars = str.toCharArray();
int pos = 0;
for (int i = 0 ; i < (chars.length) ; i++) {
if ((chars[i]) != remove) {
chars[(pos++)] = chars[i];
}
}
return new java.lang.String(chars , 0 , pos);
}
public static java.lang.String replaceOnce(java.lang.String text, java.lang.String searchString, java.lang.String replacement) {
return org.apache.commons.lang3.StringUtils.replace(text, searchString, replacement, 1);
}
public static java.lang.String replace(java.lang.String text, java.lang.String searchString, java.lang.String replacement) {
return org.apache.commons.lang3.StringUtils.replace(text, searchString, replacement, (-1));
}
public static java.lang.String replace(java.lang.String text, java.lang.String searchString, java.lang.String replacement, int max) {
if ((((org.apache.commons.lang3.StringUtils.isEmpty(text)) || (org.apache.commons.lang3.StringUtils.isEmpty(searchString))) || (replacement == null)) || (max == 0)) {
return text;
}
int start = 0;
int end = text.indexOf(searchString, start);
if (end == (-1)) {
return text;
}
int replLength = searchString.length();
int increase = (replacement.length()) - replLength;
increase = increase < 0 ? 0 : increase;
increase *= max < 0 ? 16 : max > 64 ? 64 : max;
java.lang.StringBuilder buf = new java.lang.StringBuilder(((text.length()) + increase));
while (end != (-1)) {
buf.append(text.substring(start, end)).append(replacement);
start = end + replLength;
if ((--max) == 0) {
break;
}
end = text.indexOf(searchString, start);
}
buf.append(text.substring(start));
return buf.toString();
}
public static java.lang.String replaceEach(java.lang.String text, java.lang.String[] searchList, java.lang.String[] replacementList) {
return org.apache.commons.lang3.StringUtils.replaceEach(text, searchList, replacementList, false, 0);
}
public static java.lang.String replaceEachRepeatedly(java.lang.String text, java.lang.String[] searchList, java.lang.String[] replacementList) {
int timeToLive = searchList == null ? 0 : searchList.length;
return org.apache.commons.lang3.StringUtils.replaceEach(text, searchList, replacementList, true, timeToLive);
}
private static java.lang.String replaceEach(java.lang.String text, java.lang.String[] searchList, java.lang.String[] replacementList, boolean repeat, int timeToLive) {
if ((((((text == null) || ((text.length()) == 0)) || (searchList == null)) || ((searchList.length) == 0)) || (replacementList == null)) || ((replacementList.length) == 0)) {
return text;
}
if (timeToLive < 0) {
throw new java.lang.IllegalStateException(((("TimeToLive of " + timeToLive) + " is less than 0: ") + text));
}
int searchLength = searchList.length;
int replacementLength = replacementList.length;
if (searchLength != replacementLength) {
throw new java.lang.IllegalArgumentException(((("Search and Replace array lengths don't match: " + searchLength) + " vs ") + replacementLength));
}
boolean[] noMoreMatchesForReplIndex = new boolean[searchLength];
int textIndex = -1;
int replaceIndex = -1;
int tempIndex = -1;
for (int i = 0 ; i < searchLength ; i++) {
if ((((noMoreMatchesForReplIndex[i]) || ((searchList[i]) == null)) || ((searchList[i].length()) == 0)) || ((replacementList[i]) == null)) {
continue;
}
tempIndex = text.indexOf(searchList[i]);
if (tempIndex == (-1)) {
noMoreMatchesForReplIndex[i] = true;
} else {
if ((textIndex == (-1)) || (tempIndex < textIndex)) {
textIndex = tempIndex;
replaceIndex = i;
}
}
}
if (textIndex == (-1)) {
return text;
}
int start = 0;
int increase = 0;
for (int i = 0 ; i < (searchList.length) ; i++) {
int greater = (replacementList[i].length()) - (searchList[i].length());
if (greater > 0) {
increase += 3 * greater;
}
}
increase = java.lang.Math.min(increase, ((text.length()) / 5));
java.lang.StringBuilder buf = new java.lang.StringBuilder(((text.length()) + increase));
while (textIndex != (-1)) {
for (int i = start ; i < textIndex ; i++) {
buf.append(text.charAt(i));
}
buf.append(replacementList[replaceIndex]);
start = textIndex + (searchList[replaceIndex].length());
textIndex = -1;
replaceIndex = -1;
tempIndex = -1;
for (int i = 0 ; i < searchLength ; i++) {
if ((((noMoreMatchesForReplIndex[i]) || ((searchList[i]) == null)) || ((searchList[i].length()) == 0)) || ((replacementList[i]) == null)) {
continue;
}
tempIndex = text.indexOf(searchList[i], start);
boolean hasExp = false;
if (tempIndex == (-1)) {
noMoreMatchesForReplIndex[i] = true;
} else {
if ((textIndex == (-1)) || (tempIndex < textIndex)) {
textIndex = tempIndex;
replaceIndex = i;
}
}
}
}
int textLength = text.length();
for (int i = start ; i < textLength ; i++) {
buf.append(text.charAt(i));
}
java.lang.String result = buf.toString();
if (!repeat) {
return result;
}
return org.apache.commons.lang3.StringUtils.replaceEach(result, searchList, replacementList, repeat, (timeToLive - 1));
}
public static java.lang.String replaceChars(java.lang.String str, char searchChar, char replaceChar) {
if (str == null) {
return null;
}
return str.replace(searchChar, replaceChar);
}
public static java.lang.String replaceChars(java.lang.String str, java.lang.String searchChars, java.lang.String replaceChars) {
if ((org.apache.commons.lang3.StringUtils.isEmpty(str)) || (org.apache.commons.lang3.StringUtils.isEmpty(searchChars))) {
return str;
}
if (replaceChars == null) {
replaceChars = org.apache.commons.lang3.StringUtils.EMPTY;
}
boolean modified = false;
int replaceCharsLength = replaceChars.length();
int strLength = str.length();
java.lang.StringBuilder buf = new java.lang.StringBuilder(strLength);
for (int i = 0 ; i < strLength ; i++) {
char ch = str.charAt(i);
int index = searchChars.indexOf(ch);
if (index >= 0) {
modified = true;
if (index < replaceCharsLength) {
buf.append(replaceChars.charAt(index));
}
} else {
buf.append(ch);
}
}
if (modified) {
return buf.toString();
}
return str;
}
public static java.lang.String overlay(java.lang.String str, java.lang.String overlay, int start, int end) {
if (str == null) {
return null;
}
if (overlay == null) {
overlay = org.apache.commons.lang3.StringUtils.EMPTY;
}
int len = str.length();
if (start < 0) {
start = 0;
}
if (start > len) {
start = len;
}
if (end < 0) {
end = 0;
}
if (end > len) {
end = len;
}
if (start > end) {
int temp = start;
start = end;
end = temp;
}
return new java.lang.StringBuilder(((((len + start) - end) + (overlay.length())) + 1)).append(str.substring(0, start)).append(overlay).append(str.substring(end)).toString();
}
public static java.lang.String chomp(java.lang.String str) {
if (org.apache.commons.lang3.StringUtils.isEmpty(str)) {
return str;
}
if ((str.length()) == 1) {
char ch = str.charAt(0);
if ((ch == (org.apache.commons.lang3.CharUtils.CR)) || (ch == (org.apache.commons.lang3.CharUtils.LF))) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
return str;
}
int lastIdx = (str.length()) - 1;
char last = str.charAt(lastIdx);
if (last == (org.apache.commons.lang3.CharUtils.LF)) {
if ((str.charAt((lastIdx - 1))) == (org.apache.commons.lang3.CharUtils.CR)) {
lastIdx--;
}
} else {
if (last != (org.apache.commons.lang3.CharUtils.CR)) {
lastIdx++;
}
}
return str.substring(0, lastIdx);
}
public static java.lang.String chomp(java.lang.String str, java.lang.String separator) {
if ((org.apache.commons.lang3.StringUtils.isEmpty(str)) || (separator == null)) {
return str;
}
if (str.endsWith(separator)) {
return str.substring(0, ((str.length()) - (separator.length())));
}
return str;
}
public static java.lang.String chop(java.lang.String str) {
if (str == null) {
return null;
}
int strLen = str.length();
if (strLen < 2) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
int lastIdx = strLen - 1;
java.lang.String ret = str.substring(0, lastIdx);
char last = str.charAt(lastIdx);
if (last == (org.apache.commons.lang3.CharUtils.LF)) {
if ((ret.charAt((lastIdx - 1))) == (org.apache.commons.lang3.CharUtils.CR)) {
return ret.substring(0, (lastIdx - 1));
}
}
return ret;
}
public static java.lang.String repeat(java.lang.String str, int repeat) {
if (str == null) {
return null;
}
if (repeat <= 0) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
int inputLength = str.length();
if ((repeat == 1) || (inputLength == 0)) {
return str;
}
if ((inputLength == 1) && (repeat <= (org.apache.commons.lang3.StringUtils.PAD_LIMIT))) {
return org.apache.commons.lang3.StringUtils.padding(repeat, str.charAt(0));
}
int outputLength = inputLength * repeat;
switch (inputLength) {
case 1 :
char ch = str.charAt(0);
char[] output1 = new char[outputLength];
for (int i = repeat - 1 ; i >= 0 ; i--) {
output1[i] = ch;
}
return new java.lang.String(output1);
case 2 :
char ch0 = str.charAt(0);
char ch1 = str.charAt(1);
char[] output2 = new char[outputLength];
for (int i = (repeat * 2) - 2 ; i >= 0 ; i-- , i--) {
output2[i] = ch0;
output2[(i + 1)] = ch1;
}
return new java.lang.String(output2);
default :
java.lang.StringBuilder buf = new java.lang.StringBuilder(outputLength);
for (int i = 0 ; i < repeat ; i++) {
buf.append(str);
}
return buf.toString();
}
}
public static java.lang.String repeat(java.lang.String str, java.lang.String separator, int repeat) {
if ((str == null) || (separator == null)) {
return org.apache.commons.lang3.StringUtils.repeat(str, repeat);
} else {
java.lang.String result = org.apache.commons.lang3.StringUtils.repeat((str + separator), repeat);
return org.apache.commons.lang3.StringUtils.removeEnd(result, separator);
}
}
private static java.lang.String padding(int repeat, char padChar) throws java.lang.IndexOutOfBoundsException {
if (repeat < 0) {
throw new java.lang.IndexOutOfBoundsException(("Cannot pad a negative amount: " + repeat));
}
final char[] buf = new char[repeat];
for (int i = 0 ; i < (buf.length) ; i++) {
buf[i] = padChar;
}
return new java.lang.String(buf);
}
public static java.lang.String rightPad(java.lang.String str, int size) {
return org.apache.commons.lang3.StringUtils.rightPad(str, size, ' ');
}
public static java.lang.String rightPad(java.lang.String str, int size, char padChar) {
if (str == null) {
return null;
}
int pads = size - (str.length());
if (pads <= 0) {
return str;
}
if (pads > (org.apache.commons.lang3.StringUtils.PAD_LIMIT)) {
return org.apache.commons.lang3.StringUtils.rightPad(str, size, java.lang.String.valueOf(padChar));
}
return str.concat(org.apache.commons.lang3.StringUtils.padding(pads, padChar));
}
public static java.lang.String rightPad(java.lang.String str, int size, java.lang.String padStr) {
if (str == null) {
return null;
}
if (org.apache.commons.lang3.StringUtils.isEmpty(padStr)) {
padStr = " ";
}
int padLen = padStr.length();
int strLen = str.length();
int pads = size - strLen;
if (pads <= 0) {
return str;
}
if ((padLen == 1) && (pads <= (org.apache.commons.lang3.StringUtils.PAD_LIMIT))) {
return org.apache.commons.lang3.StringUtils.rightPad(str, size, padStr.charAt(0));
}
if (pads == padLen) {
return str.concat(padStr);
} else {
if (pads < padLen) {
return str.concat(padStr.substring(0, pads));
} else {
char[] padding = new char[pads];
char[] padChars = padStr.toCharArray();
for (int i = 0 ; i < pads ; i++) {
padding[i] = padChars[(i % padLen)];
}
return str.concat(new java.lang.String(padding));
}
}
}
public static java.lang.String leftPad(java.lang.String str, int size) {
return org.apache.commons.lang3.StringUtils.leftPad(str, size, ' ');
}
public static java.lang.String leftPad(java.lang.String str, int size, char padChar) {
if (str == null) {
return null;
}
int pads = size - (str.length());
if (pads <= 0) {
return str;
}
if (pads > (org.apache.commons.lang3.StringUtils.PAD_LIMIT)) {
return org.apache.commons.lang3.StringUtils.leftPad(str, size, java.lang.String.valueOf(padChar));
}
return org.apache.commons.lang3.StringUtils.padding(pads, padChar).concat(str);
}
public static java.lang.String leftPad(java.lang.String str, int size, java.lang.String padStr) {
if (str == null) {
return null;
}
if (org.apache.commons.lang3.StringUtils.isEmpty(padStr)) {
padStr = " ";
}
int padLen = padStr.length();
int strLen = str.length();
int pads = size - strLen;
if (pads <= 0) {
return str;
}
if ((padLen == 1) && (pads <= (org.apache.commons.lang3.StringUtils.PAD_LIMIT))) {
return org.apache.commons.lang3.StringUtils.leftPad(str, size, padStr.charAt(0));
}
if (pads == padLen) {
return padStr.concat(str);
} else {
if (pads < padLen) {
return padStr.substring(0, pads).concat(str);
} else {
char[] padding = new char[pads];
char[] padChars = padStr.toCharArray();
for (int i = 0 ; i < pads ; i++) {
padding[i] = padChars[(i % padLen)];
}
return new java.lang.String(padding).concat(str);
}
}
}
public static int length(java.lang.String str) {
return str == null ? 0 : str.length();
}
public static java.lang.String center(java.lang.String str, int size) {
return org.apache.commons.lang3.StringUtils.center(str, size, ' ');
}
public static java.lang.String center(java.lang.String str, int size, char padChar) {
if ((str == null) || (size <= 0)) {
return str;
}
int strLen = str.length();
int pads = size - strLen;
if (pads <= 0) {
return str;
}
str = org.apache.commons.lang3.StringUtils.leftPad(str, (strLen + (pads / 2)), padChar);
str = org.apache.commons.lang3.StringUtils.rightPad(str, size, padChar);
return str;
}
public static java.lang.String center(java.lang.String str, int size, java.lang.String padStr) {
if ((str == null) || (size <= 0)) {
return str;
}
if (org.apache.commons.lang3.StringUtils.isEmpty(padStr)) {
padStr = " ";
}
int strLen = str.length();
int pads = size - strLen;
if (pads <= 0) {
return str;
}
str = org.apache.commons.lang3.StringUtils.leftPad(str, (strLen + (pads / 2)), padStr);
str = org.apache.commons.lang3.StringUtils.rightPad(str, size, padStr);
return str;
}
public static java.lang.String upperCase(java.lang.String str) {
if (str == null) {
return null;
}
return str.toUpperCase();
}
public static java.lang.String upperCase(java.lang.String str, java.util.Locale locale) {
if (str == null) {
return null;
}
return str.toUpperCase(locale);
}
public static java.lang.String lowerCase(java.lang.String str) {
if (str == null) {
return null;
}
return str.toLowerCase();
}
public static java.lang.String lowerCase(java.lang.String str, java.util.Locale locale) {
if (str == null) {
return null;
}
return str.toLowerCase(locale);
}
public static java.lang.String capitalize(java.lang.String str) {
int strLen;
if ((str == null) || ((strLen = str.length()) == 0)) {
return str;
}
return new java.lang.StringBuilder(strLen).append(java.lang.Character.toTitleCase(str.charAt(0))).append(str.substring(1)).toString();
}
public static java.lang.String uncapitalize(java.lang.String str) {
int strLen;
if ((str == null) || ((strLen = str.length()) == 0)) {
return str;
}
return new java.lang.StringBuilder(strLen).append(java.lang.Character.toLowerCase(str.charAt(0))).append(str.substring(1)).toString();
}
public static java.lang.String swapCase(java.lang.String str) {
int strLen;
if ((str == null) || ((strLen = str.length()) == 0)) {
return str;
}
java.lang.StringBuilder buffer = new java.lang.StringBuilder(strLen);
char ch = 0;
for (int i = 0 ; i < strLen ; i++) {
ch = str.charAt(i);
if (java.lang.Character.isUpperCase(ch)) {
ch = java.lang.Character.toLowerCase(ch);
} else {
if (java.lang.Character.isTitleCase(ch)) {
ch = java.lang.Character.toLowerCase(ch);
} else {
if (java.lang.Character.isLowerCase(ch)) {
ch = java.lang.Character.toUpperCase(ch);
}
}
}
buffer.append(ch);
}
return buffer.toString();
}
public static int countMatches(java.lang.String str, java.lang.String sub) {
if ((org.apache.commons.lang3.StringUtils.isEmpty(str)) || (org.apache.commons.lang3.StringUtils.isEmpty(sub))) {
return 0;
}
int count = 0;
int idx = 0;
while ((idx = str.indexOf(sub, idx)) != (-1)) {
count++;
idx += sub.length();
}
return count;
}
public static boolean isAlpha(java.lang.String str) {
if (str == null) {
return false;
}
int sz = str.length();
for (int i = 0 ; i < sz ; i++) {
if ((java.lang.Character.isLetter(str.charAt(i))) == false) {
return false;
}
}
return true;
}
public static boolean isAlphaSpace(java.lang.String str) {
if (str == null) {
return false;
}
int sz = str.length();
for (int i = 0 ; i < sz ; i++) {
if (((java.lang.Character.isLetter(str.charAt(i))) == false) && ((str.charAt(i)) != ' ')) {
return false;
}
}
return true;
}
public static boolean isAlphanumeric(java.lang.String str) {
if (str == null) {
return false;
}
int sz = str.length();
for (int i = 0 ; i < sz ; i++) {
if ((java.lang.Character.isLetterOrDigit(str.charAt(i))) == false) {
return false;
}
}
return true;
}
public static boolean isAlphanumericSpace(java.lang.String str) {
if (str == null) {
return false;
}
int sz = str.length();
for (int i = 0 ; i < sz ; i++) {
if (((java.lang.Character.isLetterOrDigit(str.charAt(i))) == false) && ((str.charAt(i)) != ' ')) {
return false;
}
}
return true;
}
public static boolean isAsciiPrintable(java.lang.String str) {
if (str == null) {
return false;
}
int sz = str.length();
for (int i = 0 ; i < sz ; i++) {
if ((org.apache.commons.lang3.CharUtils.isAsciiPrintable(str.charAt(i))) == false) {
return false;
}
}
return true;
}
public static boolean isNumeric(java.lang.String str) {
if (str == null) {
return false;
}
int sz = str.length();
for (int i = 0 ; i < sz ; i++) {
if ((java.lang.Character.isDigit(str.charAt(i))) == false) {
return false;
}
}
return true;
}
public static boolean isNumericSpace(java.lang.String str) {
if (str == null) {
return false;
}
int sz = str.length();
for (int i = 0 ; i < sz ; i++) {
if (((java.lang.Character.isDigit(str.charAt(i))) == false) && ((str.charAt(i)) != ' ')) {
return false;
}
}
return true;
}
public static boolean isWhitespace(java.lang.String str) {
if (str == null) {
return false;
}
int sz = str.length();
for (int i = 0 ; i < sz ; i++) {
if ((java.lang.Character.isWhitespace(str.charAt(i))) == false) {
return false;
}
}
return true;
}
public static boolean isAllLowerCase(java.lang.String str) {
if ((str == null) || (org.apache.commons.lang3.StringUtils.isEmpty(str))) {
return false;
}
int sz = str.length();
for (int i = 0 ; i < sz ; i++) {
if ((java.lang.Character.isLowerCase(str.charAt(i))) == false) {
return false;
}
}
return true;
}
public static boolean isAllUpperCase(java.lang.String str) {
if ((str == null) || (org.apache.commons.lang3.StringUtils.isEmpty(str))) {
return false;
}
int sz = str.length();
for (int i = 0 ; i < sz ; i++) {
if ((java.lang.Character.isUpperCase(str.charAt(i))) == false) {
return false;
}
}
return true;
}
public static java.lang.String defaultString(java.lang.String str) {
return str == null ? org.apache.commons.lang3.StringUtils.EMPTY : str;
}
public static java.lang.String defaultString(java.lang.String str, java.lang.String defaultStr) {
return str == null ? defaultStr : str;
}
public static java.lang.String defaultIfEmpty(java.lang.String str, java.lang.String defaultStr) {
return org.apache.commons.lang3.StringUtils.isEmpty(str) ? defaultStr : str;
}
public static java.lang.String reverse(java.lang.String str) {
if (str == null) {
return null;
}
return new java.lang.StringBuilder(str).reverse().toString();
}
public static java.lang.String reverseDelimited(java.lang.String str, char separatorChar) {
if (str == null) {
return null;
}
java.lang.String[] strs = org.apache.commons.lang3.StringUtils.split(str, separatorChar);
org.apache.commons.lang3.ArrayUtils.reverse(strs);
return org.apache.commons.lang3.StringUtils.join(strs, separatorChar);
}
public static java.lang.String abbreviate(java.lang.String str, int maxWidth) {
return org.apache.commons.lang3.StringUtils.abbreviate(str, 0, maxWidth);
}
public static java.lang.String abbreviate(java.lang.String str, int offset, int maxWidth) {
if (str == null) {
return null;
}
if (maxWidth < 4) {
throw new java.lang.IllegalArgumentException("Minimum abbreviation width is 4");
}
if ((str.length()) <= maxWidth) {
return str;
}
if (offset > (str.length())) {
offset = str.length();
}
if (((str.length()) - offset) < (maxWidth - 3)) {
offset = (str.length()) - (maxWidth - 3);
}
if (offset <= 4) {
return (str.substring(0, (maxWidth - 3))) + "...";
}
if (maxWidth < 7) {
throw new java.lang.IllegalArgumentException("Minimum abbreviation width with offset is 7");
}
if ((offset + (maxWidth - 3)) < (str.length())) {
return "..." + (org.apache.commons.lang3.StringUtils.abbreviate(str.substring(offset), (maxWidth - 3)));
}
return "..." + (str.substring(((str.length()) - (maxWidth - 3))));
}
public static java.lang.String difference(java.lang.String str1, java.lang.String str2) {
if (str1 == null) {
return str2;
}
if (str2 == null) {
return str1;
}
int at = org.apache.commons.lang3.StringUtils.indexOfDifference(str1, str2);
if (at == (-1)) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
return str2.substring(at);
}
public static int indexOfDifference(java.lang.String str1, java.lang.String str2) {
if (str1 == str2) {
return -1;
}
if ((str1 == null) || (str2 == null)) {
return 0;
}
int i;
for (i = 0 ; (i < (str1.length())) && (i < (str2.length())) ; ++i) {
if ((str1.charAt(i)) != (str2.charAt(i))) {
break;
}
}
if ((i < (str2.length())) || (i < (str1.length()))) {
return i;
}
return -1;
}
public static int indexOfDifference(java.lang.String[] strs) {
if ((strs == null) || ((strs.length) <= 1)) {
return -1;
}
boolean anyStringNull = false;
boolean allStringsNull = true;
int arrayLen = strs.length;
int shortestStrLen = java.lang.Integer.MAX_VALUE;
int longestStrLen = 0;
for (int i = 0 ; i < arrayLen ; i++) {
if ((strs[i]) == null) {
anyStringNull = true;
shortestStrLen = 0;
} else {
allStringsNull = false;
shortestStrLen = java.lang.Math.min(strs[i].length(), shortestStrLen);
longestStrLen = java.lang.Math.max(strs[i].length(), longestStrLen);
}
}
if (allStringsNull || ((longestStrLen == 0) && (!anyStringNull))) {
return -1;
}
if (shortestStrLen == 0) {
return 0;
}
int firstDiff = -1;
for (int stringPos = 0 ; stringPos < shortestStrLen ; stringPos++) {
char comparisonChar = strs[0].charAt(stringPos);
for (int arrayPos = 1 ; arrayPos < arrayLen ; arrayPos++) {
if ((strs[arrayPos].charAt(stringPos)) != comparisonChar) {
firstDiff = stringPos;
break;
}
}
if (firstDiff != (-1)) {
break;
}
}
if ((firstDiff == (-1)) && (shortestStrLen != longestStrLen)) {
return shortestStrLen;
}
return firstDiff;
}
public static java.lang.String getCommonPrefix(java.lang.String[] strs) {
if ((strs == null) || ((strs.length) == 0)) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
int smallestIndexOfDiff = org.apache.commons.lang3.StringUtils.indexOfDifference(strs);
if (smallestIndexOfDiff == (-1)) {
if ((strs[0]) == null) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
return strs[0];
} else {
if (smallestIndexOfDiff == 0) {
return org.apache.commons.lang3.StringUtils.EMPTY;
} else {
return strs[0].substring(0, smallestIndexOfDiff);
}
}
}
public static int getLevenshteinDistance(java.lang.String s, java.lang.String t) {
if ((s == null) || (t == null)) {
throw new java.lang.IllegalArgumentException("Strings must not be null");
}
int n = s.length();
int m = t.length();
if (n == 0) {
return m;
} else {
if (m == 0) {
return n;
}
}
if (n > m) {
java.lang.String tmp = s;
s = t;
t = tmp;
n = m;
m = t.length();
}
int[] p = new int[n + 1];
int[] d = new int[n + 1];
int[] _d;
int i;
int j;
char t_j;
int cost;
for (i = 0 ; i <= n ; i++) {
p[i] = i;
}
for (j = 1 ; j <= m ; j++) {
t_j = t.charAt((j - 1));
d[0] = j;
for (i = 1 ; i <= n ; i++) {
cost = (s.charAt((i - 1))) == t_j ? 0 : 1;
d[i] = java.lang.Math.min(java.lang.Math.min(((d[(i - 1)]) + 1), ((p[i]) + 1)), ((p[(i - 1)]) + cost));
}
_d = p;
p = d;
d = _d;
}
return p[n];
}
public static boolean startsWith(java.lang.String str, java.lang.String prefix) {
return org.apache.commons.lang3.StringUtils.startsWith(str, prefix, false);
}
public static boolean startsWithIgnoreCase(java.lang.String str, java.lang.String prefix) {
return org.apache.commons.lang3.StringUtils.startsWith(str, prefix, true);
}
private static boolean startsWith(java.lang.String str, java.lang.String prefix, boolean ignoreCase) {
if ((str == null) || (prefix == null)) {
return (str == null) && (prefix == null);
}
if ((prefix.length()) > (str.length())) {
return false;
}
return str.regionMatches(ignoreCase, 0, prefix, 0, prefix.length());
}
public static boolean startsWithAny(java.lang.String string, java.lang.String[] searchStrings) {
if ((org.apache.commons.lang3.StringUtils.isEmpty(string)) || (org.apache.commons.lang3.ArrayUtils.isEmpty(searchStrings))) {
return false;
}
for (int i = 0 ; i < (searchStrings.length) ; i++) {
java.lang.String searchString = searchStrings[i];
if (org.apache.commons.lang3.StringUtils.startsWith(string, searchString)) {
return true;
}
}
return false;
}
public static boolean endsWith(java.lang.String str, java.lang.String suffix) {
return org.apache.commons.lang3.StringUtils.endsWith(str, suffix, false);
}
public static boolean endsWithIgnoreCase(java.lang.String str, java.lang.String suffix) {
return org.apache.commons.lang3.StringUtils.endsWith(str, suffix, true);
}
private static boolean endsWith(java.lang.String str, java.lang.String suffix, boolean ignoreCase) {
if ((str == null) || (suffix == null)) {
return (str == null) && (suffix == null);
}
if ((suffix.length()) > (str.length())) {
return false;
}
int strOffset = (str.length()) - (suffix.length());
return str.regionMatches(ignoreCase, strOffset, suffix, 0, suffix.length());
}
}
| [
"sajjad.syed@ucalgary.ca"
] | sajjad.syed@ucalgary.ca |
e11f0eb8a5b54c6d46a14869323e59544c590444 | d073ee6efda175685e8e2f06df927e4402cac527 | /app/src/main/java/com/szzcs/smartpos/utils/update/base/FileChecker.java | 55010fd4b57b4bcc2ca9294174c23492f55a346e | [] | no_license | Lalito114/demo | 704abe033fcd287d5326ea437e59ff22c0695400 | 4d76548b2b788d3bb04bbb5a7ba3b6a114513633 | refs/heads/master | 2023-01-06T00:47:00.088200 | 2020-09-10T17:28:38 | 2020-09-10T17:28:38 | 274,290,643 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,395 | java | /*
* Copyright (C) 2017 Haoge
*
* 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.szzcs.smartpos.utils.update.base;
import com.szzcs.smartpos.utils.update.UpdateBuilder;
import com.szzcs.smartpos.utils.update.UpdateConfig;
import com.szzcs.smartpos.utils.update.impl.DefaultFileChecker;
import com.szzcs.smartpos.utils.update.model.Update;
import java.io.File;
/**
* 用于提供在更新中对apk进行有效性、安全性检查的接口
*
* <p>配置方式:通过{@link UpdateConfig#setFileChecker(FileChecker)}或者{@link UpdateBuilder#setFileChecker(FileChecker)}
*
* <p>默认实现:{@link DefaultFileChecker}
*
* @author haoge
*/
public abstract class FileChecker {
protected Update update;
protected File file;
final void attach(Update update, File file) {
this.update = update;
this.file = file;
}
final boolean checkBeforeDownload() {
if (file == null || !file.exists()) {
return false;
}
try {
return onCheckBeforeDownload();
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
/**
* 在启动下载任务前。对{@link FileCreator}创建的缓存文件进行验证。判断是否此文件已被成功下载完成。
*
* <p>当验证成功时,则代表此文件在之前已经被下载好了。则将跳过下载任务。
*
* <p>若下载失败
*/
protected abstract boolean onCheckBeforeDownload() throws Exception;
/**
* 当下载完成后。触发到此。进行文件安全校验检查。当检查成功。即可启动安装任务。安装更新apk
*
* <p>若检查失败。则可主动抛出一个异常。用于提供给框架捕获并通知给用户。
*/
protected abstract void onCheckBeforeInstall() throws Exception;
}
| [
"eduardoriveragonzalez32@gmail.com"
] | eduardoriveragonzalez32@gmail.com |
83fc63b569454d61432b640761f770762f48b78b | f64dec40844786319223ade2154f288413fed42a | /springbootend/src/main/java/spring/Repository/CartRepository.java | e6be2c3e555b81c5e6530fbe26e7495ca67d5780 | [] | no_license | sai-krishna-k/buybooks | 6f0f752ea978af22ccb19aff51d5d3c6720586b9 | 80a7e2f5b7214d343774693e666fd15581e4771d | refs/heads/main | 2023-08-15T07:39:42.279389 | 2021-09-15T07:08:09 | 2021-09-15T07:08:09 | 406,649,326 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 252 | java | package spring.Repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import spring.entity.Cart;
@Repository
public interface CartRepository extends JpaRepository<Cart,Integer>{
}
| [
"kskon1998@gmail.com"
] | kskon1998@gmail.com |
4afcecfffcda3d63c4c4271573eaacb94c6e4c5d | 2f1e7a0134d6b8c078c5ce6049f132296ff94422 | /pagingBoard/src/com/board/biz/BoardBizImpl.java | 180e084673d446f629e5cd138306afdc2e590944 | [] | no_license | Dasommm/Servlet | 91f2433e1fa3fdc739e46bd4cdf55858fcdd57ff | 275c17fed7797ebb845bd0d7423a753a9e4c1386 | refs/heads/master | 2021-05-20T18:57:20.902054 | 2020-04-02T07:51:57 | 2020-04-02T07:51:57 | 252,380,396 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 687 | java | package com.board.biz;
import java.util.List;
import com.board.dao.BoardDao;
import com.board.dao.BoardDaoImpl;
import com.board.dto.BoardDto;
import com.board.dto.PagingDto;
public class BoardBizImpl implements BoardBiz {
private BoardDao dao = new BoardDaoImpl();
@Override
public List<BoardDto> selectAll(PagingDto dto) {
int currentpage = dto.getCurrentpage();
int totalrows = dto.getTotalrows();
int to = totalrows * (currentpage -1)+1;
int from = totalrows * currentpage;
return dao.selectAll(to, from);
}
@Override
public int totalPage(int totalrows) {
int totalpage = (int)Math.ceil((double)dao.totalPage()/totalrows);
return totalpage;
}
}
| [
"dasom.kwon92@gmail.com"
] | dasom.kwon92@gmail.com |
c288df7381976184a38c6550cadef0c1ec5e0e88 | 1195f73aec58f6a7365eaea90b3d390bfbc2bf55 | /ws_condominio/src/main/java/usjt/ws_condominio/WsCondominioApplication.java | 3aaec1bfdfa247129688d48cca74b06014acddfd | [] | no_license | almeida1/20182s_restapi_condominio | f78da69ad69dd8be625bbe3fdf781613977fd5d9 | efb2f18769f23173a9095907048577eb51b32308 | refs/heads/master | 2020-03-28T06:17:44.699820 | 2018-09-07T13:18:52 | 2018-09-07T13:18:52 | 147,825,497 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 322 | java | package usjt.ws_condominio;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class WsCondominioApplication {
public static void main(String[] args) {
SpringApplication.run(WsCondominioApplication.class, args);
}
}
| [
"engsoftware1@gmail.com"
] | engsoftware1@gmail.com |
cdda53e92db561ff50081e301fa42d8e5d8943bc | 7e8b9fadcddde64ae0094eb2016a89629d689f38 | /TestBotCode/src/main/java/org/usfirst/frc/team2855/robot/commands/SwitchMiddleRight.java | a06f8c48ee0ad885e470dfc1da638497f3c75d7d | [] | no_license | BEASTBot2855/FRC2855_Testing2019 | aa75ab9b8ca257d7ab3eeaadaa5cb496889adfb9 | 2cfbd8b27b839d15e323a9598b4a651c2ce1c572 | refs/heads/master | 2020-04-16T21:27:52.378930 | 2019-01-15T21:34:58 | 2019-01-15T21:34:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 737 | java | package org.usfirst.frc.team2855.robot.commands;
import org.usfirst.frc.team2855.robot.RobotMap;
import edu.wpi.first.wpilibj.command.CommandGroup;
public class SwitchMiddleRight extends CommandGroup {
public SwitchMiddleRight() {
addSequential(new AutoTurnRight(RobotMap.preferences.getDouble("MiddleTurn", 1.0)));
addSequential(new AutoForward(RobotMap.preferences.getDouble("MiddleOut", 1.0)));
addParallel(new AutoElevatorUp(RobotMap.preferences.getDouble("ElevatorToSwitch", 1.0)));
addSequential(new AutoTurnLeft(RobotMap.preferences.getDouble("MiddleTurn2", 1.0)));
addSequential(new AutoForward(RobotMap.preferences.getDouble("Turn2ToSwitch", 1.0)));
addSequential(new ReleaseCube());
}
}
| [
"epicpkmn11@outlook.com"
] | epicpkmn11@outlook.com |
f9d5953db41afb976074c701bcae37db71dd228a | 16409c63c651d03805d3105781832f25b6715e09 | /app/src/androidTest/java/jxa/com/app/ApplicationTest.java | daf3202616fcdf7132a20480e7e3d59d21d28f32 | [
"Apache-2.0"
] | permissive | gogoad/Download_Demo | 0c165f4d0d864e53ecf3f3f2350641553a462360 | 4b3284c76c0aade45139fbb1a505cdb557ccbfd6 | refs/heads/master | 2020-12-24T06:04:46.802533 | 2016-07-08T02:12:44 | 2016-07-08T02:12:44 | 62,549,304 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 342 | java | package jxa.com.app;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
} | [
"j276192478@163.com"
] | j276192478@163.com |
5097dcbfbcfcab41f1d8a9b7122dddb12f3550e5 | 12e0ac82fcc115a5ec7878ed80af77c41dff05d7 | /app/src/main/java/com/ztcx/videoplay/fragment/MeFragment.java | c926aefe84cfdcbcd63508b269ad046e7b886d0e | [] | no_license | lfczzy/day11 | eb1f11a2c3985903c150358b86c5318f61c1444c | bc9e9560891d99c258f5680f4965ac3e59f8476c | refs/heads/master | 2022-09-06T18:22:42.392904 | 2020-05-26T15:13:13 | 2020-05-26T15:13:13 | 267,078,370 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,660 | java | package com.ztcx.videoplay.fragment;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.net.Uri;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.google.gson.Gson;
import com.ztcx.videoplay.R;
import com.ztcx.videoplay.activity.BuyVipActivity;
import com.ztcx.videoplay.activity.CollectionActivity;
import com.ztcx.videoplay.activity.FeedbackActivity;
import com.ztcx.videoplay.activity.SplashActivity;
import com.ztcx.videoplay.activity.WalletActivity;
import com.ztcx.videoplay.activity.WatchHistoryActivity;
import com.ztcx.videoplay.base.NativeBaseFragment;
import com.ztcx.videoplay.been.Appconfig;
import com.ztcx.videoplay.been.Collection;
import com.ztcx.videoplay.been.UserInfo;
import com.ztcx.videoplay.been.WatchHistory;
import com.ztcx.videoplay.constant.AppConstant;
import com.ztcx.videoplay.constant.SPConstant;
import com.ztcx.videoplay.dialog.CommonDialogUtils;
import com.ztcx.videoplay.utils.APKVersionCodeUtils;
import com.ztcx.videoplay.utils.CommUtils;
import com.ztcx.videoplay.utils.DataCleanManager;
import com.ztcx.videoplay.utils.KVUtils;
import com.ztcx.videoplay.utils.L;
import com.ztcx.videoplay.utils.UpdateApkUtils;
import com.ztcx.videoplay.view.UpdateView;
import java.sql.DatabaseMetaData;
import cn.bmob.v3.BmobQuery;
import cn.bmob.v3.BmobUser;
import cn.bmob.v3.exception.BmobException;
import cn.bmob.v3.listener.CountListener;
@SuppressLint("ValidFragment")
public class MeFragment extends NativeBaseFragment {
TextView mTvNikeName;
private TextView mTvDataSize;
private TextView mTvVersion;
Handler handler;
private TextView mTvHistoryCount;
private TextView mTvCollectCount;
private UpdateView updateView;
Handler handlerFragment = new Handler(){
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
switch (msg.what){
case 1:
L.e("qpf","下载进度 -- " + msg.obj);
updateView.setUpdateProgress("下载进度("+msg.obj+"%)");
if ("100".equals(msg.obj)){
updateView.setUpdateProgress("去安装");
}
break;
}
}
};
@SuppressLint("ValidFragment")
public MeFragment(Handler handler) {
this.handler = handler;
}
@Override
protected int setLayoutResourceID() {
return R.layout.fragment_me;
}
@Override
protected void setUpView() {
setVisibleTitleBar(AppConstant.MAIN_COLOR,"个人中心");
mTvNikeName = getContentView().findViewById(R.id.tv_nikename);
mTvHistoryCount = getContentView().findViewById(R.id.tv_history_count);
mTvCollectCount = getContentView().findViewById(R.id.tv_collect_count);
mTvDataSize = getContentView().findViewById(R.id.tv_data_size);
mTvVersion = getContentView().findViewById(R.id.tv_version);
getContentView().findViewById(R.id.ll_history).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(getActivity(),WatchHistoryActivity.class));
}
});
getContentView().findViewById(R.id.ll_collect_count).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(getActivity(),CollectionActivity.class));
}
});
getContentView().findViewById(R.id.ll_wallet).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(getActivity(),WalletActivity.class));
}
});
getContentView().findViewById(R.id.ll_feedback).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(getActivity(),FeedbackActivity.class));
}
});
getContentView().findViewById(R.id.ll_clear).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (DataCleanManager.clearAllCache(getActivity())){
try {
mTvDataSize.setText(DataCleanManager.getTotalCacheSize(getActivity()));
Toast.makeText(getActivity(),"清除成功!",Toast.LENGTH_SHORT).show();
} catch (Exception e) {
}
}
}
});
getContentView().findViewById(R.id.ll_update).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//发现新版本
final Appconfig.UpdateBeen updateBeen = new Gson().fromJson(KVUtils.query(SPConstant.UPDATE_INFO_JSON),Appconfig.UpdateBeen.class);
if (updateBeen.getVersion() > APKVersionCodeUtils.getVersionCode(getMContext())){
final String download_url = updateBeen.getApk_url();
String content = updateBeen.getUpdate_explain();
boolean cancel = updateBeen.isForce();
updateView = new UpdateView(getActivity(), "发现新版本!", content, cancel);
updateView.setClicklistener(new UpdateView.ClickListenerInterface() {
@Override
public void doConfirm(UpdateView dialogUtils) {
UpdateApkUtils.NetUntils(download_url,
getActivity(),handlerFragment);
}
@Override
public void doCancel(UpdateView dialogUtils) {
updateView.dismiss();
}
});
updateView.show();
}else {
Toast.makeText(getActivity(),"暂未发现新版本!",Toast.LENGTH_SHORT).show();
}
}
});
/**
* 客服
*/
getContentView().findViewById(R.id.ll_service).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
CommUtils.goToQQ(getActivity(),KVUtils.query(SPConstant.SERVICE_QQ));
}
});
/**
* 商务合作
*/
getContentView().findViewById(R.id.ll_hezuo).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
CommUtils.goToQQ(getActivity(),KVUtils.query(SPConstant.BUSINESS_QQ));
}
});
getContentView().findViewById(R.id.tv_buy_vip).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(getActivity(),BuyVipActivity.class));
}
});
//退出当前账号
getContentView().findViewById(R.id.ll_logout).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
CommonDialogUtils dialogUtils = new CommonDialogUtils(getActivity(),"提示","您确认要退出登录当前账号吗?");
dialogUtils.show();
dialogUtils.setClicklistener(new CommonDialogUtils.ClickListenerInterface() {
@Override
public void doConfirm(CommonDialogUtils dialogUtils) {
BmobUser.logOut(getActivity());
handler.sendMessage(Message.obtain());
dialogUtils.dismiss();
}
});
}
});
}
@Override
public void onResume() {
super.onResume();
UserInfo userInfo = BmobUser.getCurrentUser(getMContext(),UserInfo.class);
mTvNikeName.setText(userInfo.getNikeName());
try {
mTvDataSize.setText(DataCleanManager.getTotalCacheSize(getMContext()));
} catch (Exception e) {
mTvDataSize.setText(0+"KB");
e.printStackTrace();
}
mTvVersion.setText("当前版本号:"+APKVersionCodeUtils.getVerName(getMContext()));
//获取浏览记录
BmobQuery<WatchHistory> query = new BmobQuery<>();
query.addWhereEqualTo("user", BmobUser.getCurrentUser(getMContext(),UserInfo.class));
query.count(getMContext(), WatchHistory.class, new CountListener() {
@Override
public void onSuccess(int i) {
mTvHistoryCount.setText(i+"");
}
@Override
public void onFailure(int i, String s) {
}
});
//获取收藏记录
BmobQuery<Collection> query1 = new BmobQuery<>();
query1.addWhereEqualTo("user", BmobUser.getCurrentUser(getMContext(),UserInfo.class));
query1.count(getMContext(), Collection.class, new CountListener() {
@Override
public void onSuccess(int i) {
mTvCollectCount.setText(i+"");
}
@Override
public void onFailure(int i, String s) {
}
});
}
@Override
protected void setUpData() {
}
}
| [
"44693563+lfczzy@users.noreply.github.com"
] | 44693563+lfczzy@users.noreply.github.com |
d22535bb3ac023c17bf54ebb82ec15d2ca97edca | 9614a9cc6177168341226d8c9c8ff9d11431afb5 | /src/test/java/weiboclient4j/ParseGlobalTrendListTest.java | 35dbdb181cd767cf24103c2e3a190208b5607b2c | [
"Apache-2.0"
] | permissive | skyswind/weiboclient4j | b021455437ce9b51f3530b31d7d6198f3534ff80 | 972c274dc9a9b24118ab6263b887ac72722d2a83 | refs/heads/master | 2021-01-18T04:55:45.928032 | 2012-12-28T15:10:20 | 2012-12-28T15:10:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 511 | java | package weiboclient4j;
import org.codehaus.jackson.JsonNode;
import org.junit.Test;
import weiboclient4j.model.GlobalTrendList;
import static weiboclient4j.utils.JsonUtils.readValue;
/**
* @author Hover Ruan
*/
public class ParseGlobalTrendListTest extends AbstractParseJsonTest {
@Test
public void testParseGlobalTrendList() throws Exception {
String content = readResource("/weiboclient4j/global_trend_list.json");
new GlobalTrendList(readValue(content, JsonNode.class));
}
}
| [
"hoverruan@gmail.com"
] | hoverruan@gmail.com |
6486a4dad2567470fb49328df96d2b45a95c2086 | e6ded25e86cb73d3c508ae1748eaab40331ee656 | /src/test/java/com/in28minutes/data/api/TodoServiceStub.java | 005f3e4b6023e79ea0d8ca133f8d47ce73c319f3 | [] | no_license | jalyseh/mockito-youtube-course | b2d8216808ba6c7a870b4a57851e30ed08da1fdf | 28101483eec0eea7eb004322ad7b00c07f799007 | refs/heads/master | 2023-02-10T21:07:36.789550 | 2021-01-06T19:25:00 | 2021-01-06T19:25:00 | 327,409,195 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 383 | java | package com.in28minutes.data.api;
import java.util.Arrays;
import java.util.List;
public class TodoServiceStub implements TodoService {
//Stub = dummy implementation
//Dynamic Condition
//Service Definition
public List<String> retrieveTodos(String user) {
return Arrays.asList("Learn Spring MVC", "Learn Spring",
"Learn to Dance");
}
}
| [
"hammettjadyn@gmail.com"
] | hammettjadyn@gmail.com |
b5b29120390b37c3f46e03694041ceae3efae9b3 | 882c5635ac34faccb9bd0bceef16bb48a988a9c5 | /app/src/main/java/com/example/bdmap/permission/request/IRequestPermissions.java | a1ea12267a218660e8f9a790c93446c2020c651a | [] | no_license | yuchenyue/BDMap | 6116ab1556c425d8fad25009f3f2e051a8e7fd0c | 724c1489e5015066bd55d4a1b42c13ad16e68875 | refs/heads/master | 2020-06-10T13:14:40.561366 | 2019-07-23T09:47:16 | 2019-07-23T09:47:16 | 180,086,359 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 434 | java | package com.example.bdmap.permission.request;
import android.app.Activity;
public interface IRequestPermissions {
/**
* 请求权限
* @param activity 上下文
* @param permissions 权限集合
* @param resultCode 请求码
* @return 如果权限已全部允许,返回true; 反之,请求权限,在
*/
boolean requestPermissions(Activity activity, String[] permissions, int resultCode);
} | [
"807906065@qq.com"
] | 807906065@qq.com |
c004eb66698ab8af37224397253a3a3d69eb93ee | bb09fe27250a155a44536845ecbd1eadc0ec92a9 | /src/main/java/de/cantry/skinbidlistener/response/FullItem.java | 8fccab083afea23f8676ab9bc00e9ebf7c30367e | [] | no_license | cantryDev/SkinbidListener | dbf472d1ddad6cf16cb9ab3c0ef0375fc1ed17bd | 38d377afd92b1542371209f7618a17acc3130af2 | refs/heads/master | 2023-08-18T13:10:15.567325 | 2021-10-12T15:03:59 | 2021-10-12T15:03:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,179 | java |
package de.cantry.skinbidlistener.response;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import java.util.Objects;
public class FullItem {
@SerializedName("itemHash")
@Expose
private String itemHash;
@SerializedName("isTradeLocked")
@Expose
private Boolean isTradeLocked;
@SerializedName("tradeLockExpireDate")
@Expose
private Object tradeLockExpireDate;
@SerializedName("isOnAuction")
@Expose
private Boolean isOnAuction;
@SerializedName("auctionHash")
@Expose
private String auctionHash;
@SerializedName("skbMeta")
@Expose
private SkbMeta skbMeta;
@SerializedName("item")
@Expose
private ItemInfo itemInfo;
public String getItemHash() {
return itemHash;
}
public void setItemHash(String itemHash) {
this.itemHash = itemHash;
}
public Boolean getIsTradeLocked() {
return isTradeLocked;
}
public void setIsTradeLocked(Boolean isTradeLocked) {
this.isTradeLocked = isTradeLocked;
}
public Object getTradeLockExpireDate() {
return tradeLockExpireDate;
}
public void setTradeLockExpireDate(Object tradeLockExpireDate) {
this.tradeLockExpireDate = tradeLockExpireDate;
}
public Boolean getIsOnAuction() {
return isOnAuction;
}
public void setIsOnAuction(Boolean isOnAuction) {
this.isOnAuction = isOnAuction;
}
public String getAuctionHash() {
return auctionHash;
}
public void setAuctionHash(String auctionHash) {
this.auctionHash = auctionHash;
}
public SkbMeta getSkbMeta() {
return skbMeta;
}
public void setSkbMeta(SkbMeta skbMeta) {
this.skbMeta = skbMeta;
}
public ItemInfo getItemInfo() {
return itemInfo;
}
public void setItemInfo(ItemInfo itemInfo) {
this.itemInfo = itemInfo;
}
@Override
public String toString() {
return "FullItem{" +
"itemHash='" + itemHash + '\'' +
", isTradeLocked=" + isTradeLocked +
", tradeLockExpireDate=" + tradeLockExpireDate +
", isOnAuction=" + isOnAuction +
", auctionHash='" + auctionHash + '\'' +
", skbMeta=" + skbMeta +
", itemInfo=" + itemInfo +
'}';
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
FullItem fullItem = (FullItem) o;
return Objects.equals(itemHash, fullItem.itemHash) && Objects.equals(isTradeLocked, fullItem.isTradeLocked) && Objects.equals(tradeLockExpireDate, fullItem.tradeLockExpireDate) && Objects.equals(isOnAuction, fullItem.isOnAuction) && Objects.equals(auctionHash, fullItem.auctionHash) && Objects.equals(skbMeta, fullItem.skbMeta) && Objects.equals(itemInfo, fullItem.itemInfo);
}
@Override
public int hashCode() {
return Objects.hash(itemHash, isTradeLocked, tradeLockExpireDate, isOnAuction, auctionHash, skbMeta, itemInfo);
}
}
| [
"16962714+cantryDev@users.noreply.github.com"
] | 16962714+cantryDev@users.noreply.github.com |
fbf93905e091e66f23fe0b8a1060173f7894a7ec | aeef9f699da6f3c0e0336ab14412e87e81501e84 | /Assignment/Alphacontrol.java | 755408ff49e4df58290b568979f6930facf7dfe2 | [] | no_license | btes0384/Navneet_A1 | 108de3f40215a35107be468a1c41e7d5ceaabeab | 004f34b5bdf89a46b768b956c918369dc71bbbdf | refs/heads/master | 2021-04-27T18:22:56.667360 | 2018-02-21T13:50:08 | 2018-02-21T13:54:41 | 122,337,910 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 345 | java | package project;
public class Alphacontrol
{
public static void main(String[] args)
{
char i,j,k;
for(i=1;i<=3;i++)
{ int x=97;
for(j=3;j>i;j--)
{
System.out.print(" ");
}
for(k=1;k<=i*2-1;k++)
{
char q=(char)x;
System.out.print(q);
x++;
}
System.out.println();
}
}
}
| [
"BaInS@BaInS-PC"
] | BaInS@BaInS-PC |
3b599540744dcdfd763a42d83dc79708567209d9 | f2cb4871f83dffe1a8b836c54c7eb98253acfd99 | /taller primera parte/Taller/src/modelo/Servicio.java | 9b06889f4938c65c4cf16b13ac7d0fd037c28c7e | [] | no_license | csaez30/fecha | f423d72a5be05729d544c7cc1f552ab4e7fc6e10 | 955dee9c97287a2cb7d9a51adfc7a325c9eda609 | refs/heads/master | 2023-08-16T18:26:53.147161 | 2023-07-26T21:12:41 | 2023-07-26T21:12:41 | 148,942,973 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,401 | 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 modelo;
import java.time.LocalDate;
/**
*
* @author RocaVero
*/
public class Servicio {
private int codigo;
private String nombre;
private String descripcion;
private double costo;
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public int getCodigo() {
return codigo;
}
public void setCodigo(int codigo) {
this.codigo = codigo;
}
public String getDescripcion() {
return descripcion;
}
public void setDescripcion(String descripcion) {
this.descripcion = descripcion;
}
public double getCosto() {
return costo;
}
public void setCosto(double costo) {
this.costo = costo;
}
public Servicio() {
}
public Servicio(String descripcion, double costo) {
this.descripcion = descripcion;
this.costo = costo;
}
public Servicio(int codigo,String nombre, String descripcion, double costo) {
this.codigo = codigo;
this.nombre = nombre;
this.descripcion = descripcion;
this.costo = costo;
}
}
| [
"43256308+csaez30@users.noreply.github.com"
] | 43256308+csaez30@users.noreply.github.com |
7d3dc388d4a18fe50482b4819d5d0bc8bbd4e542 | 77f3971bbeba9f718250bdb610325e0e4f0bf95c | /src/main/java/pl/com/empas/java_introductory_course/io/nio/WriteFileExample.java | b5a73ed424f8d8ddb633d7c27d0bda6ae4b42611 | [] | no_license | jmieszkowski/java-introductary-course | affafadd223d6610354017e8a3f6c4d9375a2522 | 607589930bc1aa13dbd9b0aad90820ba7b743f3b | refs/heads/master | 2020-04-10T08:55:44.855278 | 2019-01-13T21:37:51 | 2019-01-13T21:37:51 | 160,919,855 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,011 | java | package pl.com.empas.java_introductory_course.io.nio;
import java.io.IOException;
import java.net.URL;
import java.nio.ByteBuffer;
import java.nio.channels.SeekableByteChannel;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.util.HashSet;
import java.util.Set;
public class WriteFileExample {
public static void main(String[] args) {
ByteBuffer byteBuffer = ByteBuffer.wrap("New file content".getBytes());
URL url = ReadFileExample.class.getResource("TextInputNio.txt");
Path path = Paths.get(url.getPath());
Set<StandardOpenOption> options = new HashSet<>();
options.add(StandardOpenOption.CREATE);
options.add(StandardOpenOption.APPEND);
try {
SeekableByteChannel byteChannel = Files.newByteChannel(path, options);
byteChannel.write(byteBuffer);
} catch(IOException e) {
e.printStackTrace();
}
}
}
| [
"fronc.piotr@gmail.com"
] | fronc.piotr@gmail.com |
a35ffa962037719c87d6b1b2a1092dafaa1ff207 | e423acf809c580afa732f33acbe3b89d072e3229 | /src/com/opensource/jiangbiao/constract/proxy/Demo.java | 487783e5ee4820912bbd3142ea37d76b949b228b | [] | no_license | standup-jb/DesignPattern | 2a4e3718514a5c60db805b78a8ef80d1e6c861b6 | a37c3744a1437e99bdcc0ad6480162448c507763 | refs/heads/master | 2021-09-03T07:52:37.819660 | 2018-01-07T09:46:16 | 2018-01-07T09:46:16 | 113,877,226 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 281 | java | package com.opensource.jiangbiao.constract.proxy;
public class Demo {
public static void main(String[] args){
Boss boss=new Boss("老板");
boss.writeDocument();
Secretary secretary=new Secretary("秘书");
secretary.writeDocument();
}
}
| [
"jiangbiao@jiangbiaodeMacBook-Pro.local"
] | jiangbiao@jiangbiaodeMacBook-Pro.local |
0dfab9e987ce1223bc677b6098439fb79d022830 | b47e0d5b202f3be877a6bea8cbb44e40e3ef1248 | /530. Minimum Absolute Difference in BST/solution.java | fdc944a2eb257559aeb9e56e7185538f8408300e | [] | no_license | yanggali/leetcode | 38f7c45ed6f95550776ad578283dd5e99287e365 | db1128d2455b1a3506aa37a50e6b29e801799ce2 | refs/heads/master | 2021-05-08T16:14:41.537253 | 2018-03-10T09:12:54 | 2018-03-10T09:12:54 | 120,148,624 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 556 | java | /**
* Definition for a binary tree node.
* public class TreeNode {
* int val;
* TreeNode left;
* TreeNode right;
* TreeNode(int x) { val = x; }
* }
*/
class Solution {
int min = Integer.MAX_VALUE;
Integer prev = null;
public int getMinimumDifference(TreeNode root) {
if(root==null) return min;
getMinimumDifference(root.left);
if(prev != null){
min = Math.min(min,root.val-prev);
}
prev = root.val;
getMinimumDifference(root.right);
return min;
}
} | [
"1243684905@qq.com"
] | 1243684905@qq.com |
957c6d7f8e096c49ecfd42cc9c38d30b50615366 | 3fc503bed9e8ba2f8c49ebf7783bcdaa78951ba8 | /TRAVACC_R5/ndcfacades/src/de/hybris/platform/ndcfacades/ndc/AircraftMetadataType.java | 62cee09348b513268c209db977ef2e418fc204cd | [] | no_license | RabeS/model-T | 3e64b2dfcbcf638bc872ae443e2cdfeef4378e29 | bee93c489e3a2034b83ba331e874ccf2c5ff10a9 | refs/heads/master | 2021-07-01T02:13:15.818439 | 2020-09-05T08:33:43 | 2020-09-05T08:33:43 | 147,307,585 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,558 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2017.02.07 at 04:46:04 PM GMT
//
package de.hybris.platform.ndcfacades.ndc;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* A data type for AIRCRAFT Metadata.
*
* <p>Java class for AircraftMetadataType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="AircraftMetadataType">
* <complexContent>
* <extension base="{http://www.iata.org/IATA/EDIST}MetadataObjectBaseType">
* <sequence>
* <element name="TailNumber" type="{http://www.iata.org/IATA/EDIST}ContextSimpleType" minOccurs="0"/>
* <element name="Name" type="{http://www.iata.org/IATA/EDIST}ProperNameSimpleType" minOccurs="0"/>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "AircraftMetadataType", propOrder = {
"tailNumber",
"name"
})
public class AircraftMetadataType
extends MetadataObjectBaseType
{
@XmlElement(name = "TailNumber")
protected String tailNumber;
@XmlElement(name = "Name")
protected String name;
/**
* Gets the value of the tailNumber property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getTailNumber() {
return tailNumber;
}
/**
* Sets the value of the tailNumber property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setTailNumber(String value) {
this.tailNumber = value;
}
/**
* Gets the value of the name property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getName() {
return name;
}
/**
* Sets the value of the name property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setName(String value) {
this.name = value;
}
}
| [
"sebastian.rulik@gmail.com"
] | sebastian.rulik@gmail.com |
2a6566a8cc62e47e76b6a69e6bc1c3aad9a1224c | c61f8bb3e4bdb9ce5578f8f77f1ca176049dd02a | /Zoho/src/test/java/test/LoginPage5.java | e5a3a9ec2714f5f851c59986f8bbeb927d934524 | [] | no_license | Aloksaha/flash | dac84eb509c58bf3a037b1e3934518f39a710a5f | 274c7f3539e178917cf7163e90344163471718c4 | refs/heads/master | 2022-07-07T12:30:40.781578 | 2019-08-18T18:41:12 | 2019-08-18T18:41:12 | 203,042,382 | 0 | 0 | null | 2022-06-29T17:35:05 | 2019-08-18T18:33:32 | HTML | UTF-8 | Java | false | false | 1,500 | java | package test;
import org.testng.annotations.Test;
import java.io.IOException;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import Page.ZohoHome5;
import utils.ReadxlsFile1;
import utils.Screenshot;
public class LoginPage5 extends LoginPage4 {
@Test(dataProvider="ro")
public void login4(String x,String x1,String x2,String x3,String x4,String x5,String x6,String x7,String x8,String x9,String x10,String x21,String x11,String x12,String x13,String x14,String x15,String x16,String x17,String x18,String x19,String x20) throws InterruptedException, IOException {
ZohoHome5 ak=new ZohoHome5(driver);
ak.setsource();
ak.setfname(x);
ak.setlname(x1);
//ak.setaccount("King");
ak.setemail(x2);
ak.settitle(x3);
ak.setphone(x4);
ak.setdepartment(x5);
ak.setophone(x6);
ak.sethphone(x7);
ak.setmobile(x8);
ak.setfax(x9);
ak.setassistant(x10);
//ak.setdob(x21);
ak.setasst(x11);
ak.setemailout();
ak.setskype(x12);
ak.setseemail(x13);
ak.settwitter(x14);
ak.setstreet(x15);
ak.setcity(x16);
ak.setstate(x17);
ak.setzip(x18);
ak.setcountry(x19);
ak.setcopy();
ak.setdiscription(x20);
ak.setsave();
Screenshot.takePicture(driver);
}
@DataProvider(name="ro")
public Object[][] zohocontact() throws IOException{
String filename1="data1/saha1.xls";
String sheetname1="sheet2";
Object [][]tabArray1 = ReadxlsFile1.getCellData(filename1, sheetname1);
return tabArray1;
}
}
| [
"aloksaha@192.168.0.11"
] | aloksaha@192.168.0.11 |
1d39a6e7765da4c560faa3bef2db730a54e50950 | 248b8b11ca99428906cce49a11d8a93748a4ccb8 | /src/main/java/io/dealhub/demo/repository/dao/Plan.java | 1f71a8b53e8d62c9bb087dcdbca83862d1980724 | [] | no_license | millfreedom/TestWor | 4b029d562389d275115f88ee68871970183a34bf | 6fd44bfa5918f0aeaf8d1727d854cef5354b2988 | refs/heads/master | 2023-03-25T00:23:38.569270 | 2021-03-10T23:30:50 | 2021-03-10T23:34:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 438 | java | package io.dealhub.demo.repository.dao;
import lombok.*;
import javax.persistence.*;
import java.util.List;
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@Builder
@EqualsAndHashCode
@Entity
@Table
public class Plan {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long planId;
private long budget;
private VerificationState verificationState;
@ManyToMany
private List<Chain> chains;
}
| [
"dinxyz@gmail.com"
] | dinxyz@gmail.com |
d42aed9d5326f2ce3c3a30085c107c79512ae499 | e6b1b8777334a1f860d41e816157cae8180efffe | /www-test-web/src/main/java/com/testing/center/web/dao/cxb/test_auto_case/impl/TestAutoCaseRunDaoMapperImpl.java | 517dab3ffc19268b29cfcb74585b2158f2261bd4 | [] | no_license | zhanglylx/testing-center | cb59edac17d9ec3a2b7f3618746567ba22ef6362 | 8d13f9d271168a362c88628ce4d5ec87ecbbc58a | refs/heads/master | 2022-12-24T07:51:10.971385 | 2020-09-29T04:17:23 | 2020-09-29T04:17:23 | 244,171,185 | 0 | 0 | null | 2022-12-16T15:29:15 | 2020-03-01T15:12:21 | JavaScript | UTF-8 | Java | false | false | 2,476 | java | package com.testing.center.web.dao.cxb.test_auto_case.impl;
import java.io.*;
import com.testing.center.web.common.utils.MailClent;
import com.testing.center.web.common.utils.WindosUtils;
import com.testing.center.web.common.utils.ZipUtils;
import com.testing.center.web.dao.cxb.test_auto_case.TestAutoCaseRunDaoMapper;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository("testAutoCaseRunDaoMapper")
public class TestAutoCaseRunDaoMapperImpl implements TestAutoCaseRunDaoMapper {
@Value("#{test_auto_case.pomPath}")
private String pomPath;
@Autowired
private File logPathFile;
@Autowired
private MailClent mailClent;
private static final Logger LOGGER = LoggerFactory.getLogger(TestAutoCaseRunDaoMapperImpl.class);
@Autowired
private File fileLogZip;
@Override
public void execute(String testCaseName, List<String> log) throws IOException, InterruptedException {
if (StringUtils.isBlank(testCaseName)) throw new IllegalArgumentException("testCaseName is Null");
if (logPathFile.exists() && !WindosUtils.removeDir(logPathFile)) {
throw new RuntimeException("历史log文件删除失败了:" + logPathFile);
}
if (fileLogZip.exists() && !fileLogZip.delete()) {
throw new RuntimeException("历史log文件删除失败了:" + fileLogZip);
}
WindosUtils.cmd("mvn.cmd package -f " + this.pomPath + " test -Dtest=" + testCaseName, log);
}
@Override
public boolean sendMailLog(String title, String content) {
if (!logPathFile.exists()) throw new RuntimeException("没有log");
if (!ZipUtils.toZip(logPathFile, fileLogZip, true)) {
if (fileLogZip.exists()) {
if (!fileLogZip.delete()) {
throw new RuntimeException("文件压缩失败,存在历史文件,历史文件删除失败了;");
} else {
LOGGER.info("删除log文件:" + fileLogZip);
}
}
throw new RuntimeException("文件压缩失败了;");
}
return mailClent.sendMail(title, content, fileLogZip);
}
public File getLog() {
return fileLogZip;
}
}
| [
"zhanglylx@163.com"
] | zhanglylx@163.com |
85409eea41ca7917ff836705a7dda1b7d227cf37 | 0283ef21f81631d82384e7617a9929c93bd2b865 | /10. SPRING BOOT/SPRING/src/main/java/com/mycompany/springapp/AppProperties.java | 617ab6b4b4bad9f6928f5a8566e3eece8391b7b0 | [] | no_license | przemo539/Java_GCL07_lato_2018_Przemyslaw_Szymoniak | dc2afd34a21d86cf9c60ecd28185e21be3aafc3a | 35135593ab2726c44907cbec570ae833cb70a123 | refs/heads/master | 2020-03-20T17:52:16.316250 | 2019-01-12T21:13:28 | 2019-01-12T21:13:28 | 137,533,320 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 816 | 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 com.mycompany.springapp;
import javax.validation.constraints.NotEmpty;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
/**
*
* @author Witajcie
*/
@Component
@PropertySource("classpath:AppProperties.properties")
//@ConfigurationProperties(prefix = "app")
public class AppProperties {
@Value("${picturePath}")
private String picturePath;
public String getPicturePath() {
return picturePath;
}
}
| [
"przemo5391@gmail.com"
] | przemo5391@gmail.com |
24f9efc1e40e1670221235ad78885d6d3904b684 | 643e7e96e132998e4b1ca937d6f15bad6ec5e45a | /self/src/main/java/com/lizk/self/Main.java | 07cfd039b307e52b90709e14b1e7e06f3829b8d2 | [] | no_license | lzk97224/self | 9ea7d0bd66c0848a42147ac607e23187d27ac8d6 | ae3fda6d68c4786ad838bafee0d2485ea59630b9 | refs/heads/master | 2016-09-13T00:45:37.838454 | 2016-05-25T01:03:19 | 2016-05-25T01:03:19 | 59,546,548 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 212 | java | package com.lizk.self;
/**
* Hello world!
*
*/
public class Main {
public boolean isWord (String str){
if(str == null){
return false;
}else{
return str.matches(".*[\\u4e00-\\u9fa5]+.*");
}
}
}
| [
"lzkmm@sina.com"
] | lzkmm@sina.com |
403c8a3316c34bc7ff1d9a9b4b86c942ec6c832f | 995f73d30450a6dce6bc7145d89344b4ad6e0622 | /Honor5C-7.0/src/main/java/java/net/StandardProtocolFamily.java | a58390082579c475920804fbe45c25030d0dc07f | [] | no_license | morningblu/HWFramework | 0ceb02cbe42585d0169d9b6c4964a41b436039f5 | 672bb34094b8780806a10ba9b1d21036fd808b8e | refs/heads/master | 2023-07-29T05:26:14.603817 | 2021-09-03T05:23:34 | 2021-09-03T05:23:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,472 | java | package java.net;
public enum StandardProtocolFamily implements ProtocolFamily {
;
static {
/* JADX: method processing error */
/*
Error: jadx.core.utils.exceptions.DecodeException: Load method exception in method: java.net.StandardProtocolFamily.<clinit>():void
at jadx.core.dex.nodes.MethodNode.load(MethodNode.java:113)
at jadx.core.dex.nodes.ClassNode.load(ClassNode.java:256)
at jadx.core.ProcessClass.process(ProcessClass.java:34)
at jadx.api.JadxDecompiler.processClass(JadxDecompiler.java:281)
at jadx.api.JavaClass.decompile(JavaClass.java:59)
at jadx.api.JadxDecompiler$1.run(JadxDecompiler.java:161)
Caused by: jadx.core.utils.exceptions.DecodeException: in method: java.net.StandardProtocolFamily.<clinit>():void
at jadx.core.dex.instructions.InsnDecoder.decodeInsns(InsnDecoder.java:46)
at jadx.core.dex.nodes.MethodNode.load(MethodNode.java:98)
... 5 more
Caused by: java.lang.IllegalArgumentException: bogus opcode: 0073
at com.android.dx.io.OpcodeInfo.get(OpcodeInfo.java:1197)
at com.android.dx.io.OpcodeInfo.getFormat(OpcodeInfo.java:1212)
at com.android.dx.io.instructions.DecodedInstruction.decode(DecodedInstruction.java:72)
at jadx.core.dex.instructions.InsnDecoder.decodeInsns(InsnDecoder.java:43)
... 6 more
*/
/*
// Can't load method instructions.
*/
throw new UnsupportedOperationException("Method not decompiled: java.net.StandardProtocolFamily.<clinit>():void");
}
}
| [
"dstmath@163.com"
] | dstmath@163.com |
a877995ce5f623dba2b884abbb26483e1ae25e05 | 66b4e53ab352733ef109f389f0fce3e6cffa4c6f | /ProjetoPscClasses/src/fachada/IFachada.java | c6debef0fdad4df6f74c09ff57efab704d4fab6d | [] | no_license | liperosas/ProjetoPscClasses | 3cf509b5003c28b2c4042b3220aba31e4075f917 | 9801a762956fba4fee544f32c6276501086e6eb1 | refs/heads/master | 2021-01-19T03:23:33.663422 | 2013-11-30T23:08:20 | 2013-11-30T23:08:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,341 | java | package fachada;
import classes.Alternativa;
import classes.AreaConcurso;
import classes.CartaoResposta;
import java.util.List;
import classes.Concursando;
import classes.Concurso;
import classes.DiaFase;
import classes.Elaborador;
import classes.Funcionario;
import classes.Empresa;
import classes.Fase;
import classes.Gabarito;
import classes.Genero;
import classes.Local;
import classes.Prova;
import classes.QuestaoDiscursiva;
import classes.QuestaoMultiplaEscolha;
public interface IFachada {
void inserirFuncionario(Funcionario funcionario) throws Exception;
void atualizarFuncionario(Funcionario funcionario) throws Exception;
void removerFuncionario(long id) throws Exception;
Funcionario consultarFuncionarioPorId(long id) throws Exception;
List<Funcionario> consultarTodosFuncionarios() throws Exception;
void inserirEmpresa(Empresa empresa) throws Exception;
void atualizarEmpresa(Empresa empresa) throws Exception;
void removerEmpresa(long id) throws Exception;
Empresa consultarEmpresaPorId(long id) throws Exception;
List<Empresa> consultarTodosEmpresa() throws Exception;
void inserirConcursando(Concursando concursando) throws Exception;
void atualizarConcursando(Concursando concursando) throws Exception;
void removerConcursando(long id) throws Exception;
Concursando consultarConcursandoPorId(long id) throws Exception;
List<Concursando> consultarTodosConcursando() throws Exception;
Concursando logarConcrusando(String login, String senha) throws Exception;
List<Concursando> calcularNotaMultiplaConcursandos(Fase fase) throws Exception;
List<CartaoResposta> consultarCartoesRespostaConcursandoProva(Prova prova, Concursando concursando) throws Exception;
void inserirProva(Prova prova) throws Exception;
void atualizarProva(Prova prova) throws Exception;
void removerProva(long id) throws Exception;
Prova consultarProvaPorId(long id) throws Exception;
List<Prova> consultarTodosProva() throws Exception;
void inserirQuestaoDiscursiva(QuestaoDiscursiva questaoDiscursiva)
throws Exception;
void atualizarQuestaoDiscursiva(QuestaoDiscursiva questaoDiscursiva)
throws Exception;
void removerQuestaoDiscursiva(long id) throws Exception;
QuestaoDiscursiva consultarQuestaoDiscursivaPorId(long id) throws Exception;
List<QuestaoDiscursiva> consultarTodosQuestaoDiscursiva() throws Exception;
List<QuestaoDiscursiva> consultarTodosPorGeneroQuestaoDiscursiva(
Genero genero) throws Exception;
void inserirQuestaoMultiplaEscolha(
QuestaoMultiplaEscolha questaoMultiplaEscolha) throws Exception;
void atualizarQuestaoMultiplaEscolha(
QuestaoMultiplaEscolha questaoMultiplaEscolha) throws Exception;
void removerQuestaoMultiplaEscolha(long id) throws Exception;
QuestaoMultiplaEscolha consultarQuestaoMultiplaEscolhaPorId(long id)
throws Exception;
List<QuestaoMultiplaEscolha> consultarTodosQuestaoMultiplaEscolha()
throws Exception;
List<QuestaoMultiplaEscolha> consultarTodosPorGeneroQuestaoMultiplaEscolha(
Genero genero) throws Exception;
void inserirElaborador(Elaborador elaborador) throws Exception;
void atualizarElaborador(Elaborador elaborador) throws Exception;
void removerElaborador(long id) throws Exception;
Elaborador consultarElaboradorPorId(long id) throws Exception;
List<Elaborador> consultarTodosElaborador() throws Exception;
Alternativa inserirAlternativaQuestao(Alternativa alternativa)
throws Exception;
void inserirAlternativa(Alternativa alternativa) throws Exception;
void atualizarAlternativa(Alternativa alternativa) throws Exception;
void removerAlternativa(long id) throws Exception;
Alternativa consultarAlternativaPorId(long id) throws Exception;
List<Alternativa> consultarTodosAlternativa() throws Exception;
void inserirDiaFase(DiaFase diaFase) throws Exception;
void removerDiaFase(long id) throws Exception;
void atualizarDiaFase(DiaFase diaFase) throws Exception;
DiaFase consultarDiaFasePorId(long id) throws Exception;
void inserirFase(Fase fase) throws Exception;
void removerFase(long id) throws Exception;
void atualizarFase(Fase fase) throws Exception;
Fase consultarFasePorId(long id) throws Exception;
void inserirGenero(Genero genero) throws Exception;
void atualizarGenero(Genero genero) throws Exception;
void removerGenero(long id) throws Exception;
Genero consultarGeneroPorId(long id) throws Exception;
List<Genero> consultarTodosGenero() throws Exception;
void inserirConcurso(Concurso concurso) throws Exception;
void atualizarConcurso(Concurso concurso) throws Exception;
void removerConcurso(long id) throws Exception;
List<Concurso> consultarTodosConcurso() throws Exception;
Concurso consultarConcursoPorId(long id) throws Exception;
void inserirAreaConcurso(AreaConcurso areaconcurso) throws Exception;
void atualizarAreaConcurso(AreaConcurso areaconcurso) throws Exception;
void removerAreaConcurso(long id) throws Exception;
AreaConcurso consultarAreaConcursoPorId(long id) throws Exception;
List<AreaConcurso> consultarTodosAreaConcurso() throws Exception;
void inserirCartaoResposta(CartaoResposta cartaoResposta) throws Exception;
void atualizarCartaoResposta(CartaoResposta cartaoResposta)
throws Exception;
void removerCartaoResposta(long id) throws Exception;
CartaoResposta consultarCartaoRespostaPorId(long id) throws Exception;
List<CartaoResposta> consultarTodosCartaoResposta() throws Exception;
void inserirLocal(Local local) throws Exception;
void atualizarLocal(Local local) throws Exception;
void removerLocal(long id) throws Exception;
Local consultarLocalPorId(long id) throws Exception;
List<Local> consultarTodosLocal() throws Exception;
void inserirGabarito(Gabarito gabarito) throws Exception;
void atualizarGabarito(Gabarito gabarito) throws Exception;
void removerGabarito(long id) throws Exception;
Gabarito consultarGabaritoPorId(long id) throws Exception;
List<Gabarito> consultarTodosGabarito() throws Exception;
List<Gabarito> consultarGabaritoProva(long id_prova) throws Exception;
}
| [
"lipe.galoh@gmail.com"
] | lipe.galoh@gmail.com |
bba9bfb886578c53f3931d87518e6fad1ee911d4 | fa9ecfb539398fa982b56bfc5c83d861203b1515 | /src/jensbnt/database/OfflineDatabase.java | 88c52909a99e5ad05fca5c492d2fa80738d90d37 | [] | no_license | jensbnt/GtCarCompare | 56cca6679afc6bc8622ae2cdb3f8ece9b326ac7a | e9168eb569b786d82868cc0a220339217111f880 | refs/heads/master | 2021-09-02T15:12:13.001540 | 2018-01-03T11:18:26 | 2018-01-03T11:18:26 | 109,273,955 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,202 | java | package jensbnt.database;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import jensbnt.compareApp.Car;
import jensbnt.util.CarClasses;
public class OfflineDatabase implements CarDatabase {
private final static Path cardb = Paths.get("car_database");
public OfflineDatabase() {
}
@Override
public List<Car> getCars(CarClasses carClass) throws CarLoadException {
List<Car> cars = new ArrayList<>();
try(BufferedReader reader = Files.newBufferedReader(cardb.resolve(carClass.getFileName()), StandardCharsets.ISO_8859_1)) {
String line = null;
int counter = 1;
while((line = reader.readLine()) != null) {
Car newCar = parseCarFromLine(line, (carClass.getValue() * 1000) + (counter++));
cars.add(newCar);
}
} catch (FileNotFoundException e) {
throw new CarLoadException("'" + carClass.toString() + "' not found");
} catch (IOException | CarLoadException e) {
throw new CarLoadException("Can't parse from " + carClass.getFileName());
}
return cars;
}
/* Helper functions */
private static Car parseCarFromLine(String rawLine, int generatedId) throws CarLoadException {
String[] splittedLine = rawLine.split(" / ");
if (splittedLine.length != 10)
throw new CarLoadException("Parsing error");
int id = generatedId;
String make = splittedLine[0];
String name = splittedLine[1];
double maxSpeed = Double.parseDouble(splittedLine[2]);
double acceleration = Double.parseDouble(splittedLine[3]);
double braking = Double.parseDouble(splittedLine[4]);
double cornering = Double.parseDouble(splittedLine[5]);
double stability = Double.parseDouble(splittedLine[6]);
int bhp = Integer.parseInt(splittedLine[7]);
int weight = Integer.parseInt(splittedLine[8]);
int price = Integer.parseInt(splittedLine[9]);
return new Car(id, make, name, maxSpeed, acceleration, braking, cornering, stability, bhp, weight, price, 0);
}
}
| [
"jens_beernaert@hotmail.com"
] | jens_beernaert@hotmail.com |
89a3319efca750333ddd48703b3222a3b17d892e | 52b5132e94effca079c577e5eedc90914929df7a | /org.xtext.example.hclscope/src-gen/org/xtext/example/hclscope/hclScope/Event.java | 0c08b975de993475ae0fd78d8a0c679501866016 | [] | no_license | blended-modeling/UML-RT_StateMachines_Transformations | 90a289be7f106cce86d72dbca684ae200b97860c | f523a871e033aa38d277fbaa8edfa80ca6087067 | refs/heads/master | 2023-08-12T22:04:10.278686 | 2021-09-30T10:57:59 | 2021-09-30T10:57:59 | 412,038,161 | 1 | 1 | null | 2021-09-30T11:29:55 | 2021-09-30T11:29:54 | null | UTF-8 | Java | false | false | 1,216 | java | /**
* generated by Xtext 2.25.0
*/
package org.xtext.example.hclscope.hclScope;
import org.eclipse.emf.ecore.EObject;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Event</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* </p>
* <ul>
* <li>{@link org.xtext.example.hclscope.hclScope.Event#getName <em>Name</em>}</li>
* </ul>
*
* @see org.xtext.example.hclscope.hclScope.HclScopePackage#getEvent()
* @model
* @generated
*/
public interface Event extends EObject
{
/**
* Returns the value of the '<em><b>Name</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>Name</em>' attribute.
* @see #setName(String)
* @see org.xtext.example.hclscope.hclScope.HclScopePackage#getEvent_Name()
* @model
* @generated
*/
String getName();
/**
* Sets the value of the '{@link org.xtext.example.hclscope.hclScope.Event#getName <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Name</em>' attribute.
* @see #getName()
* @generated
*/
void setName(String value);
} // Event
| [
"malvina.latifaj@mdh.se"
] | malvina.latifaj@mdh.se |
90a8ee8a97001700df99894ff4b0295a1b3e7a5a | 72d72ef57705ddab5239dcd56124f8c3bdd0465b | /src/cn/wyh/util/GameUtil.java | 4876276acfdbfd5b502cfe220e26ba510e14953f | [] | no_license | Wyh0517/SolarSystem | 7c5be3c0fae488395911c430e1fbf189c865245d | eb0232e25af01ce16b4e62395f118132665fd403 | refs/heads/master | 2022-11-09T15:33:42.054348 | 2020-06-25T08:36:26 | 2020-06-25T08:36:26 | 274,868,356 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 616 | java | package cn.wyh.util;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.net.URL;
import javax.imageio.ImageIO;
/**
* 游戏开发中常用的工具类,如加载图片等方法
* @author wyhpc
*
*/
public class GameUtil {
private GameUtil() {} //工具类,将构造方法私有化
public static Image getImage(String path) {
//URL对象
URL u = GameUtil.class.getClassLoader().getResource(path);
BufferedImage img = null;
//捕获
try {
img = ImageIO.read(u);
} catch (IOException e) {
e.printStackTrace();
}
return img;
}
}
| [
"1537992316@qq.com"
] | 1537992316@qq.com |
cf2bf3040c083d7d6138618f5231958394623687 | 44e7adc9a1c5c0a1116097ac99c2a51692d4c986 | /aws-java-sdk-sagemaker/src/main/java/com/amazonaws/services/sagemaker/model/transform/AlgorithmSummaryMarshaller.java | 92d108d22705f2052d70f4571093dd3d2094d23d | [
"Apache-2.0"
] | permissive | QiAnXinCodeSafe/aws-sdk-java | f93bc97c289984e41527ae5bba97bebd6554ddbe | 8251e0a3d910da4f63f1b102b171a3abf212099e | refs/heads/master | 2023-01-28T14:28:05.239019 | 2020-12-03T22:09:01 | 2020-12-03T22:09:01 | 318,460,751 | 1 | 0 | Apache-2.0 | 2020-12-04T10:06:51 | 2020-12-04T09:05:03 | null | UTF-8 | Java | false | false | 3,352 | java | /*
* Copyright 2015-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.sagemaker.model.transform;
import javax.annotation.Generated;
import com.amazonaws.SdkClientException;
import com.amazonaws.services.sagemaker.model.*;
import com.amazonaws.protocol.*;
import com.amazonaws.annotation.SdkInternalApi;
/**
* AlgorithmSummaryMarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
@SdkInternalApi
public class AlgorithmSummaryMarshaller {
private static final MarshallingInfo<String> ALGORITHMNAME_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
.marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("AlgorithmName").build();
private static final MarshallingInfo<String> ALGORITHMARN_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
.marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("AlgorithmArn").build();
private static final MarshallingInfo<String> ALGORITHMDESCRIPTION_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
.marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("AlgorithmDescription").build();
private static final MarshallingInfo<java.util.Date> CREATIONTIME_BINDING = MarshallingInfo.builder(MarshallingType.DATE)
.marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("CreationTime").timestampFormat("unixTimestamp").build();
private static final MarshallingInfo<String> ALGORITHMSTATUS_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
.marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("AlgorithmStatus").build();
private static final AlgorithmSummaryMarshaller instance = new AlgorithmSummaryMarshaller();
public static AlgorithmSummaryMarshaller getInstance() {
return instance;
}
/**
* Marshall the given parameter object.
*/
public void marshall(AlgorithmSummary algorithmSummary, ProtocolMarshaller protocolMarshaller) {
if (algorithmSummary == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(algorithmSummary.getAlgorithmName(), ALGORITHMNAME_BINDING);
protocolMarshaller.marshall(algorithmSummary.getAlgorithmArn(), ALGORITHMARN_BINDING);
protocolMarshaller.marshall(algorithmSummary.getAlgorithmDescription(), ALGORITHMDESCRIPTION_BINDING);
protocolMarshaller.marshall(algorithmSummary.getCreationTime(), CREATIONTIME_BINDING);
protocolMarshaller.marshall(algorithmSummary.getAlgorithmStatus(), ALGORITHMSTATUS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
}
}
| [
""
] | |
eabbb7ddcea8f6dd36136111fb8f0bcc2bce46ca | 0e06e096a9f95ab094b8078ea2cd310759af008b | /classes35-dex2jar/com/google/android/gms/internal/drive/zzcq.java | aa58b5617ad526ca34c19f6a2f451f1542eae6fa | [] | no_license | Manifold0/adcom_decompile | 4bc2907a057c73703cf141dc0749ed4c014ebe55 | fce3d59b59480abe91f90ba05b0df4eaadd849f7 | refs/heads/master | 2020-05-21T02:01:59.787840 | 2019-05-10T00:36:27 | 2019-05-10T00:36:27 | 185,856,424 | 1 | 2 | null | 2019-05-10T00:36:28 | 2019-05-09T19:04:28 | Java | UTF-8 | Java | false | false | 848 | java | //
// Decompiled by Procyon v0.5.34
//
package com.google.android.gms.internal.drive;
import android.os.RemoteException;
import com.google.android.gms.tasks.TaskCompletionSource;
import com.google.android.gms.common.api.Api$AnyClient;
import com.google.android.gms.common.api.internal.ListenerHolder$ListenerKey;
import com.google.android.gms.drive.DriveResource;
import com.google.android.gms.common.api.internal.UnregisterListenerMethod;
final class zzcq extends UnregisterListenerMethod<zzaw, zzdi>
{
private final /* synthetic */ DriveResource zzfo;
private final /* synthetic */ zzdi zzfp;
zzcq(final zzch zzch, final ListenerHolder$ListenerKey listenerHolder$ListenerKey, final DriveResource zzfo, final zzdi zzfp) {
this.zzfo = zzfo;
this.zzfp = zzfp;
super(listenerHolder$ListenerKey);
}
}
| [
"querky1231@gmail.com"
] | querky1231@gmail.com |
746173297aa074cae7d59da5330ccdff155ad62d | 81771af656157bec7b1027feb99a7e45353f9779 | /src/main/java/com/dfksoft/hrm_manage/repository/DevicesRepository.java | dd6885407e261fa526895e8348b2201a65a46719 | [] | no_license | huygia1997/Test | c743e18e28f13faf00634f957b7db087df6c641e | 9939e5896235d6ed7fdf50d6e813b1194a25cdff | refs/heads/master | 2020-05-23T23:31:12.110065 | 2019-05-16T12:59:00 | 2019-05-16T12:59:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 419 | java | package com.dfksoft.hrm_manage.repository;
import com.dfksoft.hrm_manage.entity.Devices;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface DevicesRepository extends JpaRepository<Devices, Long> {
void deleteById(Long id);
Devices findDevicesById(Long id);
}
| [
"huygia1997@gmail.com"
] | huygia1997@gmail.com |
6700849b593d82ed6abf7dd918da98b8846f760a | 1c0235040864aad26903a8a92902d7871923a1b0 | /kachakoCRF1.0/src/kachako/ml/crf/CRFPreProcessing.java | 9f170e85355f1150a6a26142b1b3938dfe5e902c | [] | no_license | mooc1234/Kachakorelated | c69006229bf0011446dabd15cb28acc6abb28cbd | 2d9fdbc90c52963cc709bb78663a534d08e85e1a | refs/heads/master | 2021-01-24T05:24:18.941932 | 2012-09-20T07:17:25 | 2012-09-20T07:17:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,944 | java | package kachako.ml.crf;
import java.io.IOException;
import java.util.StringTokenizer;
import org.apache.hadoop.conf.*;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.io.BytesWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.hadoop.mapreduce.lib.output.SequenceFileOutputFormat;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Reducer;
import org.apache.hadoop.util.GenericOptionsParser;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;
public class CRFPreProcessing extends Configured implements Tool {
static class SequenceFileMapper
extends Mapper<NullWritable, BytesWritable, Text, Text> {
public void map(NullWritable key, BytesWritable value, Context context)
throws IOException, InterruptedException {
Configuration conf = context.getConfiguration();
// String filename = conf.get("map.input.file");
String[] sb= Text.decode(value.getBytes()).split("\n\n");
for (int ii = 0; ii<sb.length;ii++)
{
/* StringTokenizer st = new StringTokenizer(sb[ii], "\n");
String line= "";
while(st.hasMoreTokens())
{
line = line+ st.nextToken()+"\n";
// line = sb.substring(0,21);
//System.out.println("/////////////");
}
*/
System.out.println(sb[ii]+"\n");
context.write(new Text("\\\\\\\\\\\\\\\\"), new Text(sb[ii]));
}
}
}
static class IdentityReducer extends Reducer<Text, BytesWritable, Text, BytesWritable> {
// Use default reduce() == org.apache.hadoop.mapred.lib.IdentityReducer.reduce()
}
public int run(String[] args) throws Exception {
Configuration conf = getConf();
if (conf == null) {
return -1;
}
String[] otherArgs = new GenericOptionsParser(conf, args).getRemainingArgs();
@SuppressWarnings("deprecation")
Job job = new Job(conf, "CRFPreProcessing");
job.setJarByClass(CRFPreProcessing.class);
job.setMapperClass(SequenceFileMapper.class);
//job.setReducerClass(IdentityReducer.class);
job.setInputFormatClass(WholeFileInputFormat.class);
job.setOutputFormatClass(SequenceFileOutputFormat.class);
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(Text.class);
FileInputFormat.addInputPath(job, new Path(otherArgs[0]));
FileOutputFormat.setOutputPath(job, new Path(otherArgs[1]));
return job.waitForCompletion(true) ? 0 : 1;
}
public static void main(String[] args) throws Exception {
int exitCode = ToolRunner.run(new CRFPreProcessing(), args);
System.exit(exitCode);
}
} | [
"baoruihan@gmail.com"
] | baoruihan@gmail.com |
e87d760bf08b06505d80027e739e9c8e90d35fd5 | 85c458f69115bb6b739b9751bb8478ef2a7a393b | /app/src/main/java/com/ctp/swissknife/AlarmDialog.java | 4b623b956c8fb75f871b73812096fd94b83637a6 | [] | no_license | ctp27/Swiss-Knife | 25e11cdbdffbdb3f4abfa9874a7d547bdec41719 | 4ce50945358f73b558e61e244ef524b3ceef9591 | refs/heads/master | 2020-12-31T07:11:08.099501 | 2017-03-29T12:56:20 | 2017-03-29T12:56:20 | 86,580,016 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,016 | java | package com.ctp.swissknife;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.provider.AlarmClock;
import android.view.LayoutInflater;
import android.widget.TimePicker;
/**
* Created by CTP on 2/5/2017.
*/
public class AlarmDialog extends DialogFragment {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
final Context context = MyApplication.getContext();
final AlertDialog.Builder builder= new AlertDialog.Builder(context);
LayoutInflater inflater = getActivity().getLayoutInflater();
builder.setView(inflater.inflate(R.layout.alarm_dialog, null));
builder.setTitle("Set the Alarm")
.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
Dialog d = (Dialog) dialog;
TimePicker timePicker = (TimePicker) d.findViewById(R.id.timePicker);
int hour=timePicker.getHour();
int min= timePicker.getMinute();
setAlarm(hour,min);
}
})
.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
}
});
// Create the AlertDialog object and return it
return builder.create();
}
private void setAlarm(int hours,int min){
Intent intent = new Intent(AlarmClock.ACTION_SET_ALARM);
intent.putExtra(AlarmClock.EXTRA_HOUR, hours);
intent.putExtra(AlarmClock.EXTRA_MINUTES, min);
intent.putExtra(AlarmClock.EXTRA_SKIP_UI,true);
startActivity(intent);
}
}
| [
"ctpinto27@gmail.com"
] | ctpinto27@gmail.com |
778dc5900c9a678ced3d2acfecc0f9a8b0eeb1d8 | 7e5418d44207b61318e677ea276f4290250c4bf4 | /src/model/Client.java | 7eb9f6a7ada91af0720489c14d57d10f357c62e2 | [] | no_license | jhonnycr01/Laboratorio_consecionario | 94163a3465661d7c2aa90618defa71843c392f92 | 0c5722c32d7a22ccdfc9708cd5f1f5d6d958c54d | refs/heads/master | 2022-07-02T03:45:22.759579 | 2020-05-15T01:23:03 | 2020-05-15T01:23:03 | 262,186,593 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 846 | java | package model;
import java.util.ArrayList;
public class Client extends Person {
private String phoneNumber;
private String email;
private ArrayList<Vehicle> interestVehicles;
public Client(String name, String lastName, String id, String phoneNumber, String email) {
super(name,lastName,id);
this.phoneNumber = phoneNumber;
this.email = email;
this.interestVehicles = new ArrayList<>();
}
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public void interestVehicle( Vehicle vehicle) {
this.interestVehicles.add(vehicle);
}
public ArrayList<Vehicle> getInterestVehicles() {
return interestVehicles;
}
}
| [
"54719958+jhonnycr01@users.noreply.github.com"
] | 54719958+jhonnycr01@users.noreply.github.com |
2ca2a4e13224452d522dc0e06bf4cf7c208b0173 | 1e8e1d1fc1221610a71e517a9e2d06ec552df5c4 | /src/main/java/com/virtusa/codetext/numbertowordconvertor/NumberToWordConvertor.java | 0404930cd9818c459c790b828d9bbd502c3074ea | [] | no_license | springbootMicroservices2/virtusa-code-test | fab9db7d8cebdb94f29b7d77ce4c65cd31c48c45 | cbccf172bf675162cd442ac4116ff39bae425d53 | refs/heads/master | 2020-12-20T15:22:51.526453 | 2019-12-03T15:36:12 | 2019-12-03T15:36:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,199 | java | package com.virtusa.codetext.numbertowordconvertor;
import com.virtusa.codetext.numbertowordconvertor.constants.DigitConstant;
public class NumberToWordConvertor {
public String convertNumberToWord(int number) {
if (number < 0) {
return "Minus" + convertNumberToWord(-number);
} else if (number < 20) {
return "" + DigitConstant.UNITS[number];
} else if (number < 100) {
return "" + DigitConstant.TENS[number / 10]
+ ((number % 10 != 0 ? " " : "") + convertNumberToWord(number % 10));
} else if (number < 1000) {
return DigitConstant.UNITS[number / 100] + " Hundred and"
+ ((number % 100 != 0 ? " " : "") + convertNumberToWord(number % 100));
} else if (number < 1000000) {
return convertNumberToWord(number / 1000) + " Thousand"
+ ((number % 1000 != 0 ? " " : "") + convertNumberToWord(number % 1000));
} else if (number < 1000000000) {
return convertNumberToWord(number / 1000000) + " Million"
+ ((number % 1000000 != 0 ? " " : "") + convertNumberToWord(number % 1000000));
}
return convertNumberToWord(number / 1000000000) + " billion" + ((number % 1000000000 != 0) ? " " : "")
+ convertNumberToWord(number % 1000000000);
}
}
| [
"jikriyas@virtusa.com"
] | jikriyas@virtusa.com |
80c1b2c99a25cea9dbfa79136c55ef04cf8719e9 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/24/24_364893d3998018ae9932933955806cf2d0d88c02/XMLBindingComponent/24_364893d3998018ae9932933955806cf2d0d88c02_XMLBindingComponent_s.java | 486d0e04a9d7caa93ccac317db60ae4275dceb54 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 50,988 | java | /**
* Redistribution and use of this software and associated documentation
* ("Software"), with or without modification, are permitted provided
* that the following conditions are met:
*
* 1. Redistributions of source code must retain copyright
* statements and notices. Redistributions must also contain a
* copy of this document.
*
* 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.
*
* 3. The name "Exolab" must not be used to endorse or promote
* products derived from this Software without prior written
* permission of Intalio, Inc. For written permission,
* please contact info@exolab.org.
*
* 4. Products derived from this Software may not be called "Exolab"
* nor may "Exolab" appear in their names without prior written
* permission of Intalio, Inc. Exolab is a registered
* trademark of Intalio, Inc.
*
* 5. Due credit should be given to the Exolab Project
* (http://www.exolab.org/).
*
* THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESSED 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
* INTALIO, INC. OR ITS 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.
*
* Copyright 2002-2004 (C) Intalio Inc. All Rights Reserved.
*
* Any portions of this file developed by Keith Visco after Jan 19 2005
* are Copyright (C) 2005 Keith Visco. All Rights Reserverd.
*
*
* $Id$
*/
package org.exolab.castor.builder.binding;
import org.exolab.castor.builder.BindingComponent;
import org.exolab.castor.builder.BuilderConfiguration;
import org.exolab.castor.builder.GroupNaming;
import org.exolab.castor.builder.TypeConversion;
import org.exolab.castor.builder.types.XSClass;
import org.exolab.castor.builder.types.XSType;
import org.exolab.castor.xml.JavaNaming;
import org.exolab.castor.xml.schema.Annotated;
import org.exolab.castor.xml.schema.AttributeDecl;
import org.exolab.castor.xml.schema.ComplexType;
import org.exolab.castor.xml.schema.ContentModelGroup;
import org.exolab.castor.xml.schema.ElementDecl;
import org.exolab.castor.xml.schema.Form;
import org.exolab.castor.xml.schema.Group;
import org.exolab.castor.xml.schema.ModelGroup;
import org.exolab.castor.xml.schema.Schema;
import org.exolab.castor.xml.schema.SimpleType;
import org.exolab.castor.xml.schema.Structure;
import org.exolab.castor.xml.schema.XMLType;
import org.exolab.javasource.JClass;
import java.util.Enumeration;
/**
* <p>This class is the implementation of BindingComponent from an XML Schema
* point of view. This specific implementation wraps an XML Schema annotated structure.
*
* <p>The XML Schema structure can be only of four different types:
* <ul>
* <li>Element: it represents an XML Schema element.</li>
* <li>ComplexType: it represents an XML Schema complexType.</li>
* <li>ModelGroup: it represents an XML Schema Model group definition.</li>
* <li>Group: it represents an XML Schema Model Group.</li>
* </ul>
*
* <p>The three first items can be customized using a binding file.
* Thus the XMLBindingComponent class takes into account the presence or not
* of a custom binding document in the computation of the needed information for the Source Generator
* to generate java classes from an XML Schema.
* <p>The customizable items are detailled in the binding file documentation.
*
* <p>This class acts like a <i>window</i> on a particular XML Schema structure that the user controls
* by changing the view on the Annotated Structure he is interested in.
*
* TODO: add the link to the documentation.
*
* @see org.exolab.castor.builder.BindingComponent
* @author <a href="mailto:blandin@intalio.com">Arnaud Blandin</a>
* @author <a href="mailto:keith AT kvisco DOT com">Keith Visco</a>
* @version $Revision$ $Date: 2006-04-25 15:08:23 -0600 (Tue, 25 Apr 2006) $
*/
public class XMLBindingComponent implements BindingComponent {
/**
* The Extended Binding used to retrieve the ComponentBindingType
*/
private ExtendedBinding _binding;
/**
* The binding component to use, if no binding component is present then
* the default behavior applies.
*/
private ComponentBindingType _compBinding;
/**
* The BuilderConfiguration instance for obtaining default properties
*/
private BuilderConfiguration _config = null;
/**
* The XML Schema Annotated structure encapsulated in that XMLBinding object
*/
private Annotated _annotated;
/**
* The prefix used to generate the java names
*/
private String _prefix;
/**
* The suffix used to generate the java names
*/
private String _suffix;
/**
* The type of the XMLBinding. -1 is no component binding have been defined.
*/
private short _type = -1;
/**
* caches of several computations
*/
private int _hashCode =-1;
private String _javaClassName = null;
private String _javaMemberName = null;
private String _javaPackage = null;
private FieldType _member = null;
private ClassType _class = null;
private Interface _interface = null;
private Schema _schema = null;
private boolean _userSpecifiedMemberName = false;
/**
* A GroupNaming helper class used to named anonymous groups
*/
// TODO: this property used to be static; currently, I don't see a reason as to why this was/is required. Anybody ?
// private static GroupNaming _groupNaming = new GroupNaming();
private GroupNaming _groupNaming = null;
/**
* Returns the curretn group naming scheme in use; if none has been set set,
* initializes a default one.
* @return The current group naming scheme
*/
private synchronized GroupNaming getGroupNaming() {
if (_groupNaming == null) {
setGroupNaming(new GroupNaming());
}
return _groupNaming;
}
/**
* Sets the group naming instance to be used.
* @param groupNaming The current group naming scheme to be used.
*/
private void setGroupNaming(GroupNaming groupNaming)
{
_groupNaming = groupNaming;
}
/**
* The TypeConversion to use when creating XSTypes from
* SimpleType
*/
private TypeConversion _typeConversion = null;
/**
* Constructs an XMLBindingComponent from an XML Schema Component.
*
* @param config the BuilderConfiguration instance (must not be null).
*/
public XMLBindingComponent(BuilderConfiguration config) {
if (config == null) {
String error = "The argument 'config' must not be null.";
throw new IllegalArgumentException(error);
}
_config = config;
_typeConversion = new TypeConversion(_config);
} //-- XMLBindingComponent
/**
* Returns the Binding Object Model on which this XMLBindingComponent
* will query information.
*
* @return the Extended Binding Object Model that wraps the information located in a
* binding file
*/
public ExtendedBinding getBinding() {
return _binding;
} //-- getBinding
/**
* Sets the Binding Object Model on which this XMLBindingComponent will query information.
*
* @param binding the Extended Binding Object Model that wraps the information located in a
* binding file
*/
public void setBinding(ExtendedBinding binding) {
_binding = binding;
}
/**
* <p>Sets the <i>window</i> on the given Annotated XML Schema structure.
* Once the window is set on a particular XML Schema structure all the information
* returned by this class are relative to that XML Schema structure.
*
* @param annotated an Annotated XML Schema structure.
* @see org.exolab.castor.xml.schema.Annotated
*/
public void setView(Annotated annotated) {
if (annotated == null)
throw new IllegalArgumentException("The XML Schema annotated structure is null.");
_annotated = annotated;
//--reset all the variables
_javaClassName = null;
_javaMemberName = null;
_javaPackage = null;
_schema = null;
_member = null;
_class = null;
_interface = null;
_type = -1;
_prefix = null;
_suffix = null;
_userSpecifiedMemberName = false;
_compBinding = null;
//--look up for the particular componentBinding relative to the
//-- given annotated structure
if (_binding != null) {
_compBinding = _binding.getComponentBindingType(annotated);
NamingXMLType naming = _binding.getNamingXML();
if (naming != null) {
switch (annotated.getStructureType()) {
case Structure.COMPLEX_TYPE:
if (naming.getComplexTypeName() != null) {
_prefix = naming.getComplexTypeName().getPrefix();
_suffix = naming.getComplexTypeName().getSuffix();
}
break;
case Structure.ELEMENT:
if (naming.getElementName() != null) {
_prefix = naming.getElementName().getPrefix();
_suffix = naming.getElementName().getSuffix();
}
break;
case Structure.MODELGROUP:
if (naming.getModelGroupName() != null) {
_prefix = naming.getModelGroupName().getPrefix();
_suffix = naming.getModelGroupName().getSuffix();
}
break;
default:
break;
}
}//--naming != null;
}//--binding != null
if (_compBinding != null) {
ComponentBindingTypeChoice choice = _compBinding.getComponentBindingTypeChoice();
if (choice.getInterface() != null) {
_type = INTERFACE;
_interface = choice.getInterface();
}
else if (choice.getJavaClass() != null) {
_type = CLASS;
_class = choice.getJavaClass();
}
else if (choice.getMember() != null) {
_type = MEMBER;
_member = choice.getMember();
} else {
String err = "Illegal Binding component:";
err += "it does not define a class, an interface or a member binding.";
throw new IllegalStateException(err);
}
}
}//--setView
//--Object manipulation methods
/**
* Returns true if the given Object is equal to this instance of XMLBindingComponent.
*
* @return true if the given Object is equal to this instance of XMLBindingComponent.
* @see java.lang.Object#equals(java.lang.Object)
*/
public boolean equals(Object object) {
if (object == null)
return false;
boolean result = false;
if (object instanceof XMLBindingComponent) {
XMLBindingComponent temp = (XMLBindingComponent)object;
result = _annotated.equals(temp.getAnnotated());
if (_compBinding != null) {
if (temp.getComponentBinding() != null)
result = result && (_compBinding.equals(temp.getComponentBinding()));
else
result = false;
}
else if (temp.getComponentBinding() != null) {
result = false;
}
}
else
result = false;
return result;
}
/**
* Returns the hashCode value for this object.
*
* @return the hashcode value for this object.
* @see java.lang.Object#hashCode()
*/
public int hashCode() {
if (_hashCode == -1) {
int compBindingHash = 0;
if (_compBinding != null) {
compBindingHash = _compBinding.getName().hashCode();
}
//WARNING: THE CASTOR SOM doesn't override hashCode or equals
_hashCode = 37*(_annotated.hashCode()) + compBindingHash;
}
return _hashCode;
}
/**
* Returns the ComponentBinding used in that XMLBindingComponent
* to retrieve customized information.
*
* @return the ComponentBinding used in that XMLBinding.
*/
protected ComponentBindingType getComponentBinding() {
return _compBinding;
}
//--XML Schema information methods
/**
* Returns the XML Schema annotated structure used in this XMLBindingComponent.
*
* @return the XML Schema annotated structure used in this XMLBindingComponent.
*/
public Annotated getAnnotated() {
return _annotated;
}
/**
* Returns true if the binding of this XMLBindingComponent will require
* the generation of 2 java classes.
* Indeed an a nested Model Group that can occur more than once is described
* by the SourceGenerator with a wrapper class.
*
* @return true if the binding of this XMLBindingComponent will require
* the generation of 2 java classes.
*/
public boolean createGroupItem() {
int maxOccurs = 0;
boolean result = false;
switch (_annotated.getStructureType()) {
case Structure.ELEMENT:
XMLType type = ((ElementDecl)_annotated).getType();
if (type.isComplexType()) {
maxOccurs = ((ComplexType)type).getMaxOccurs();
if (((maxOccurs > 1) || (maxOccurs < 0)) && (type.getName() == null))
result = true;
}
break;
case Structure.COMPLEX_TYPE:
maxOccurs = ((ComplexType)_annotated).getMaxOccurs();
if ((maxOccurs > 1) || (maxOccurs < 0))
result = true;
break;
case Structure.MODELGROUP:
case Structure.GROUP:
Group group = (Group)_annotated;
maxOccurs = group.getMaxOccurs();
if ((maxOccurs > 1) || (maxOccurs < 0))
result = true;
break;
case Structure.ATTRIBUTE:
default:
break;
}
return result;
}
/**
* Returns the schemaLocation of the parent schema of the wrapped structure.
*
* @return the schemaLocation of the parent schema of the wrapped structure.
*/
public String getSchemaLocation() {
String location = null;
Schema schema = getSchema();
if (schema != null)
location = schema.getSchemaLocation();
return location;
}
/**
* Returns the targetNamespace of the parent schema of the wrapped structure.
*
* @return the targetNamespace of the parent schema of the wrapped structure.
*/
public String getTargetNamespace() {
String result = null;
Schema schema = null;
Form form = null;
switch (_annotated.getStructureType()) {
case Structure.ATTRIBUTE:
AttributeDecl attribute = (AttributeDecl)_annotated;
//-- resolve reference
if (attribute.isReference())
attribute = attribute.getReference();
schema = attribute.getSchema();
//-- top-level (use targetNamespace of schema)
if (attribute.getParent() == schema)
break;
//-- check form (qualified or unqualified)
form = attribute.getForm();
if (form == null) {
form = schema.getAttributeFormDefault();
}
if ((form == null) || form.isUnqualified()) {
//-- no targetNamespace by default
return null;
}
//-- use targetNamespace of schema
break;
case Structure.ELEMENT:
//--resolve reference?
ElementDecl element = (ElementDecl)_annotated;
if (element.isReference())
element = element.getReference();
schema = element.getSchema();
//-- top-level (use targetNamespace of schema)
if (element.getParent() == schema)
break;
//-- check form (qualified or unqualified)
form = element.getForm();
if (form == null) {
form = schema.getElementFormDefault();
}
if ((form == null) || form.isUnqualified()) {
//-- no targetNamespace by default
return null;
}
//-- use targetNamespace of schema
break;
case Structure.COMPLEX_TYPE:
ComplexType complexType = (ComplexType)_annotated;
schema = complexType.getSchema();
if (complexType.getParent() == schema)
break;
return null;
default:
break;
}
if (schema == null)
schema = getSchema();
if (schema != null)
result = schema.getTargetNamespace();
return result;
} //-- getTargetNamespace
/**
* Returns the underlying Schema of the wrapped structure.
*
* @return the parent schema of the wrapped structure.
*/
public Schema getSchema() {
if (_schema == null) {
switch (_annotated.getStructureType()) {
case Structure.ATTRIBUTE:
//--resolve reference?
AttributeDecl attribute = (AttributeDecl)_annotated;
if (attribute.isReference())
attribute = attribute.getReference();
_schema = attribute.getSchema();
attribute = null;
break;
case Structure.ELEMENT:
//--resolve reference?
ElementDecl element = (ElementDecl)_annotated;
if (element.isReference())
element = element.getReference();
_schema = element.getSchema();
element = null;
break;
case Structure.COMPLEX_TYPE:
_schema = ((ComplexType)_annotated).getSchema();
break;
case Structure.MODELGROUP:
//--resolve reference?
ModelGroup group = (ModelGroup)_annotated;
if (group.isReference())
group = group.getReference();
_schema = group.getSchema();
group = null;
break;
case Structure.GROUP:
Structure parent = ((Group)_annotated).getParent();
short structure = parent.getStructureType();
while (structure == Structure.GROUP) {
parent = ((Group)parent).getParent();
structure = parent.getStructureType();
}
if (structure == Structure.COMPLEX_TYPE)
_schema = ((ComplexType)parent).getSchema();
else if (structure == Structure.MODELGROUP)
_schema = ((ModelGroup)parent).getSchema();
break;
case Structure.SIMPLE_TYPE:
case Structure.UNION:
_schema = ((SimpleType)_annotated).getSchema();
break;
default:
break;
}
}
return _schema;
}
/**
* <p>Returns the XMLType of the underlying structure. The XMLType of an
* element being its XML Schema type, the XMLType of a ComplexType being itself
* and the XMLType of an attribute being its XML Schema simpleType.
* Null is returned for a Model Group.
*
* @return the XMLType of the underlying structure.
*/
public XMLType getXMLType() {
XMLType result = null;
switch (_annotated.getStructureType()) {
case Structure.ELEMENT:
result = ((ElementDecl)_annotated).getType();
break;
case Structure.COMPLEX_TYPE:
result = ((ComplexType)_annotated);
break;
case Structure.ATTRIBUTE:
result = ((AttributeDecl)_annotated).getSimpleType();
break;
case Structure.MODELGROUP:
default:
break;
}
return result;
}
/**
* Returns the XML name declared in the XML Schema for this XMLBindingComponent.
*
* @return the XML name declared in the XML Schema for this XMLBindingComponent.
*/
public String getXMLName() {
String result = null;
switch (_annotated.getStructureType()) {
case Structure.ELEMENT:
result = ((ElementDecl)_annotated).getName();
break;
case Structure.COMPLEX_TYPE:
result = ((ComplexType)_annotated).getName();
break;
case Structure.ATTRIBUTE:
result = ((AttributeDecl)_annotated).getName();
break;
case Structure.MODELGROUP:
case Structure.GROUP:
result = ((Group)_annotated).getName();
break;
default:
break;
}
return result;
}
//--Implementation of BindingComponent
/**
* Returns the value specified in the XML Schema for the XML Schema component
* wrapped in this XMLBindingComponent.
* The value returned is the <i>default</i> or <i>fixed</i> value for an Element
* or an Attribute.
*
* @return the value specified in the XML Schema for the XML Schema annotated structure
* wrapped in this XMLBindingComponent.
*/
public String getValue() {
String result = null;
switch (_annotated.getStructureType()) {
case Structure.ELEMENT:
result = ((ElementDecl)_annotated).getDefaultValue();
if (result == null)
result = ((ElementDecl)_annotated).getFixedValue();
break;
case Structure.ATTRIBUTE:
result = ((AttributeDecl)_annotated).getDefaultValue();
if (result == null)
result = ((AttributeDecl)_annotated).getFixedValue();
break;
case Structure.COMPLEX_TYPE:
case Structure.MODELGROUP:
default:
break;
}
return result;
}
/**
* Returns a valid Java Class Name corresponding to this XMLBindingComponent.
* This name is not qualified, this is only a local Java class name.
*
* @return a valid Java Class Name corresponding to this XMLBindingComponent.
* This name is not qualified, this is only a local Java class name.
* @see #getQualifiedName
*/
public String getJavaClassName() {
if (_javaClassName == null) {
String result = null;
//--is there a class name defined (local name)
if (_compBinding != null) {
switch (getType()) {
case CLASS:
result = _class.getName();
break;
case INTERFACE:
result = _interface.getName();
break;
default:
break;
}
}
if (result == null || result.length() <= 0) {
//--is there a reference?
if (_annotated.getStructureType() == Structure.ELEMENT) {
ElementDecl element = (ElementDecl)_annotated;
if (element.isReference()) {
Annotated temp = _annotated;
setView(element.getReference());
result = getJavaClassName();
setView(temp);
temp = null;
}
element = null;
}
//--Still null?
if (result == null || result.length() <= 0) {
//--create the name
result = getXMLName();
//--create a java name for an anonymous group
if ( (result == null) &&
((_annotated.getStructureType() == Structure.GROUP)||
(_annotated.getStructureType() == Structure.MODELGROUP)) ) {
result = getGroupNaming().createClassName((Group)_annotated, getJavaPackage());
if (result == null) {
String err = "Unable to create name for group.";
throw new IllegalStateException(err);
}
}
if (_prefix != null)
result = _prefix + result;
if (_suffix != null)
result = result + _suffix;
}
}
_javaClassName = JavaNaming.toJavaClassName(result);
}
/**
* @todo ADD A SWITCH TO DETERMINE WETHER OR NOT TO USE JAVA CONVENTIONS
* FOR THE JAVA CLASS NAME (SEE JAXB)
*/
return _javaClassName;
}
/**
* Returns a valid Java Member Name corresponding to this XMLBindingComponent.
* This name is not qualified, this is only a local Java Member name.
*
* @return a valid Java Member Name corresponding to this XMLBindingComponent.
* This name is not qualified, this is only a local Java member name.
* @see #getQualifiedName
*/
public String getJavaMemberName() {
if (_javaMemberName == null) {
String result = null;
if (_compBinding != null) {
switch (getType()) {
case CLASS:
result = _class.getName();
break;
case INTERFACE:
result = _interface.getName();
break;
case MEMBER:
result = _member.getName();
break;
default:
break;
}
}
if (result == null || result.length() <= 0) {
Annotated temp = null;
if (_annotated.getStructureType() == Structure.ATTRIBUTE) {
AttributeDecl att = (AttributeDecl)_annotated;
if (att.isReference()) {
temp = _annotated;
setView(att.getReference());
result = getJavaMemberName();
setView(temp);
}
att = null;
}
else if (_annotated.getStructureType() == Structure.ELEMENT) {
ElementDecl element = (ElementDecl)_annotated;
if (element.isReference()) {
temp = _annotated;
setView(element.getReference());
result = getJavaMemberName();
boolean userSpecified = _userSpecifiedMemberName;
setView(temp);
//-- there might be more than once reference, so we
//-- need to do a little counting here.
if (!userSpecified) {
String refName = element.getReferenceName();
int count = 0;
int index = 0;
Structure structure = element.getParent();
if (structure instanceof ContentModelGroup) {
ContentModelGroup cmg = (ContentModelGroup)structure;
Enumeration enumeration = cmg.enumerate();
while (enumeration.hasMoreElements()) {
Structure tmpStruct = (Structure)enumeration.nextElement();
if (tmpStruct.getStructureType() == Structure.ELEMENT) {
ElementDecl tmpDecl = (ElementDecl)tmpStruct;
if (tmpDecl.isReference()) {
if (tmpDecl.getReferenceName().equals(refName)) {
++count;
if (tmpDecl == element) {
index = count;
}
}
}
}
}
}
if (count > 1) {
result = result + index;
}
}
}
element = null;
}
temp = null;
//--Still null?
if (result == null || result.length() <= 0) {
//--create the name
result = getXMLName();
//--create a java name for an anonymous group
if ( (result == null) &&
((_annotated.getStructureType() == Structure.GROUP)||
(_annotated.getStructureType() == Structure.MODELGROUP)) )
{
result = getGroupNaming().createClassName((Group)_annotated, getJavaPackage());
if (result == null) {
String err = "Unable to create name for group.";
throw new IllegalStateException(err);
}
}
if (_prefix != null)
result = _prefix + result;
if (_suffix != null)
result = result + _suffix;
}
}
else {
_userSpecifiedMemberName = true;
}
_javaMemberName = JavaNaming.toJavaMemberName(result);
}
/**
* @todo ADD A SWITCH TO DETERMINE WETHER OR NOT TO USE JAVA CONVENTIONS
* FOR THE JAVA CLASS NAME (SEE JAXB)
*/
return _javaMemberName;
}
/**
* <p>Returns the fully qualified name used for generating a java name that
* represents this XMLBindingComponent.
* <p>The fully qualified name is computed according the following priority
* order:
* <ul>
* <li>If the XMLBinding wraps a class binding then the package name is
* the name defined locally in the {@literal <java-class>} element.
* More precisely the package name will be the value of the attribute
* package.</li>
* <li>Else the package name will be computed from the schemaLocation
* of the parent schema.</li>
* <li>Else the package name will be computed from the target namespace
* of the parent schema.</li>
* </ul>
*
* Note: the computation of the namespace is a direct look-up for a defined
* mapping (Namespace, package) or (schema location, package).
*
* @return the fully qualified name used for generating a java name that
* represents this XMLBindingComponent.
*/
public String getQualifiedName() {
String result = getJavaClassName();
String packageName = getJavaPackage();
if (packageName != null && packageName.length()>0) {
packageName += '.';
result = packageName + result;
}
return result;
}
/**
* Returns the java package associated with this XML BindingComponent.
* The algorithm used to resolve the package is defined according to the following
* priorities:
* <ol>
* <li>The package defined locally in the class declaration inside the binding file is used.</li>
* <li>If no package has been defined locally then a lookup to a defined mapping
* {targetNamespace, package name} is performed.</li>
* <li>If no package has been defined locally then a lookup to a defined mapping
* {schema location, package name} is performed.</li>
* </ol>
*
* @return the java package associated with this XML BindingComponent.
*/
public String getJavaPackage() {
if (_javaPackage == null) {
String packageName = null;
String schemaLocation = getSchemaLocation();
String targetNamespace = getTargetNamespace();
//-- adjust targetNamespace null -> ""
if (targetNamespace == null) targetNamespace = "";
if (_compBinding != null) {
switch (getType()) {
case CLASS:
packageName = _class.getPackage();
break;
default:
break;
}//--switch
}
if ((packageName == null)|| (packageName.length() ==0) ) {
//--highest priority is targetNamespace
if (( packageName == null || packageName.length() ==0))
{
//--look for a namespace mapping
packageName = _config.lookupPackageByNamespace(targetNamespace);
}
if ( (schemaLocation != null) && ( packageName == null || packageName.length() ==0) ){
packageName = _config.lookupPackageByLocation(schemaLocation);
}
}
_javaPackage = packageName;
}
return _javaPackage;
}
/**
* <p>Returns the upper bound of the collection that is generated from
* this BindingComponent. The upper bound is a positive integer. -1 is returned
* to indicate that the upper bound is unbounded.
* <p>In the case of an XML Schema component,
* the upper bound corresponds to the XML Schema maxOccurs attribute, if any.
*
* @return an int representing the lower bound of the collection generated
* from this BindingComponent. -1 is returned to indicate that the upper bound is unbounded.
* 1 is the default value.
*/
public int getUpperBound() {
switch (_annotated.getStructureType()) {
case Structure.ELEMENT:
return ((ElementDecl)_annotated).getMaxOccurs();
case Structure.COMPLEX_TYPE:
return ((ComplexType)_annotated).getMaxOccurs();
case Structure.GROUP:
case Structure.MODELGROUP:
return ((Group)_annotated).getMaxOccurs();
case Structure.ATTRIBUTE:
default:
break;
}
return 1;
}
/**
* Returns the lower bound of the collection that is generated from
* this BindingComponent. The lower bound is a positive integer.
* In the case of an XML Schema component, it corresponds to the
* XML Schema minOccurs attribute, if any.
*
* @return an int representing the lower bound of the collection generated
* from this BindingComponent. 0 is returned by default.
*/
public int getLowerBound() {
return getLowerBound(_annotated);
}
////////METHODS RELATED TO A CLASS BINDING
/**
* Returns the name of a super class for the current XMLBinding.
* Null is returned if this XMLBinding is not meant to be mapped to
* a java class.
*
* @return the name of a super class for the current XMLBinding.
* Null is returned if this XMLBinding is not meant to be mapped to
* a java class
*/
public String getExtends() {
if (getType() == CLASS) {
return _class.getExtends();
}
return _config.getProperty(BuilderConfiguration.Property.SUPER_CLASS, null);
} //-- getExtends
/**
* Returns an array of the different interface names implemented by the class
* that will represent the current XMLBindingComponent. Null is returned if
* no class binding is defined for the wrapped XML Schema structure.
* @return array of interface names
*/
public String[] getImplements() {
if (getType() == CLASS) {
return _class.getImplements();
}
return null;
}
/**
* Returns true if bound properties must be generated for the class
* that will represent the current XMLBindingComponent.
*
* @return true if bound properties must be generated for the class
* the class that will represent the current XMLBindingComponent.
*/
public boolean hasBoundProperties() {
if (getType() == CLASS) {
if (_class.hasBound())
return _class.getBound();
}
return _config.boundPropertiesEnabled();
}
/**
* Returns true if equal method must be generated for the class
* that will represent the current XMLBindingComponent.
*
* @return true if equal method must be generated for the class
* the class that will represent the current XMLBindingComponent.
*/
public boolean hasEquals() {
if (getType() == CLASS) {
if (_class.hasEquals())
return _class.getEquals();
}
return _config.equalsMethod();
}
/**
* Returns true if the class that will represent the current XMLBindingComponent
* must be abstract.
*
* @return true if the class that will represent the current XMLBindingComponent
* must be abstract.
*/
public boolean isAbstract() {
boolean result = false;
if (getType() == CLASS) {
if (_class.hasAbstract())
result = _class.getAbstract();
}
if (!result) {
switch(_annotated.getStructureType()) {
case Structure.COMPLEX_TYPE:
ComplexType cType = (ComplexType)_annotated;
result = cType.isAbstract();
//-- if we're in element-centric mode, then all
//-- complexTypes are treated as abstract
result = result || _config.mappingSchemaElement2Java();
break;
case Structure.ELEMENT:
ElementDecl eDecl = (ElementDecl)_annotated;
result = eDecl.isAbstract();
break;
default:
break;
}
}
return result;
}
/**
* Returns true if the class that will represent the current XMLBindingComponent
* must be final.
*
* @return true if the class that will represent the current XMLBindingComponent
* must be final.
*/
public boolean isFinal() {
if (getType() == CLASS) {
return _class.getFinal();
}
return false;
}
/**
* Returns true if the wrapped XML Schema component is fixed (i.e the value
* used is fixed).
*
* @return true if the wrapped XML Schema component is fixed (i.e the value
* used is fixed).
*/
public boolean isFixed() {
switch (_annotated.getStructureType()) {
case Structure.ELEMENT:
String fixed = ((ElementDecl)_annotated).getFixedValue();
return (fixed != null);
case Structure.ATTRIBUTE:
return ((AttributeDecl)_annotated).isFixed();
case Structure.GROUP:
case Structure.COMPLEX_TYPE:
case Structure.MODELGROUP:
default:
break;
}
return false;
}
/**
* Returns true if the wrapped XML Schema component is nillable.
*
* @return true if the wrapped XML Schema component is nillable.
*/
public boolean isNillable() {
switch (_annotated.getStructureType()) {
case Structure.ELEMENT:
return ((ElementDecl)_annotated).isNillable();
default:
break;
}
return false;
} //-- isNillable
////////METHODS RELATED TO A MEMBER BINDING
/**
* Returns true if the member represented by that XMLBindingComponent
* is to be represented by an Object wrapper. For instance an int will be
* represented by a java Integer if the property is set to true.
*
* @return true if the member represented by that XMLBindingComponent
* is to be represented by an Object wrapper.
*/
public boolean useWrapper() {
boolean result = false;
if (_type == BindingComponent.MEMBER) {
if (_member.hasWrapper())
result = _member.getWrapper();
}
else {
result = _config.usePrimitiveWrapper();
}
return result;
}
/**
* <p>Returns the XSType that corresponds to the Java type chosen to represent
* the XML Schema component represented by this XMLBindingComponent.
* An XSType is an abstraction of a Java type used in the Source Generator. It
* wraps a JType as well as the necessary methods to convert to/from String.
* <p>If a name of java type is specified then this name will have higher
* priority than the simpleType resolution.
*
* @return an XSType
*/
public XSType getJavaType() {
//--no need for caching it is called only once
XSType result = null;
boolean useWrapper = useWrapper();
XMLType type = getXMLType();
if (type.isComplexType()) {
if (_type == MEMBER && _member.getJavaType() != null) {
String javaType = _member.getJavaType();
if (javaType != null && javaType.length() >0 )
result = TypeConversion.convertType(javaType);
} else {
result = new XSClass(new JClass(getJavaClassName()));
}
}
else {
if (_type == MEMBER) {
String javaType = _member.getJavaType();
if (javaType != null && javaType.length() >0 )
result = TypeConversion.convertType(javaType);
}
}
if (result == null) {
//--simpleType or AnyType
if (type.isSimpleType()) {
String packageName = null;
if (((SimpleType)type).getSchema() != getSchema()) {
XMLBindingComponent comp = new XMLBindingComponent(_config);
comp.setBinding(_binding);
comp.setView(type);
packageName = comp.getJavaPackage();
}
else packageName = getJavaPackage();
if ((packageName == null) || (packageName.length() == 0)) {
String ns = ((SimpleType)type).getSchema().getTargetNamespace();
packageName = _config.lookupPackageByNamespace(ns);
}
result = _typeConversion.convertType((SimpleType)type, useWrapper, packageName, _config.useJava50());
}
}
return result;
}
/**
* Returns the collection name specified in the binding file. If no collection
* was specified, null will be returned and the default collection settings
* will be used.
*
* @return a string that represents the collection name specified in
* the binding file. If no collection was specified, null will be returned
* and the default collection settings will be used.
*
*/
public String getCollectionType() {
String result = null;
if ((_type == MEMBER) && (_member.getCollection() != null)) {
result = _member.getCollection().toString();
}
return result;
}
/**
* Returns the fully qualified name of the Validator to use.
*
* @return the fully qualified name of the Validator to use.
*/
public String getValidator() {
if (_type == MEMBER) {
return _member.getValidator();
}
return null;
}
/**
* Returns the fully qualified name of the XMLFieldHandler to use.
*
* @return the fully qualified name of the XMLFieldHandler to use.
*/
public String getXMLFieldHandler() {
if (_type == MEMBER) {
return _member.getHandler();
}
return null;
}
/**
* <p>Returns the type of this component binding. A component binding can
* be of three different types:
* <ul>
* <li>Interface: it represents the binding to a java interface.</li>
* <li>Class: it represents the binding to a java class.</li>
* <li>Member: it represents the binding to a java class member.</li>
* </ul>
* <p>-1 is returned if the component binding is null.
*
* @return the type of this component binding. A component binding can
* be of three different types:
* <ul>
* <li>Interface: it represents the binding to a java interface.</li>
* <li>Class: it represents the binding to a java class.</li>
* <li>Member: it represents the binding to a java class member.</li>
* </ul>
* -1 is returned if the component binding is null.
*/
public short getType() {
return _type;
}
/**
* Returns the lower bound of the collection that is generated from
* this BindingComponent. The lower bound is a positive integer.
* In the case of an XML Schema component, it corresponds to the
* XML Schema minOccurs attribute, if any.
*
* @return an int representing the lower bound of the collection generated
* from this BindingComponent. 0 is returned by default.
*/
private static int getLowerBound(Annotated annotated) {
switch (annotated.getStructureType()) {
case Structure.ELEMENT:
return ((ElementDecl)annotated).getMinOccurs();
case Structure.COMPLEX_TYPE:
return ((ComplexType)annotated).getMinOccurs();
case Structure.MODELGROUP:
case Structure.GROUP:
Group group = (Group)annotated;
//-- if the group is top-level, then
//-- we always return 0
Structure parent = group.getParent();
if (parent != null) {
if (parent.getStructureType() == Structure.SCHEMA)
return 0;
}
int minOccurs = group.getMinOccurs();
//-- if minOccurs == 1, then check to see
//-- if all elements inside group are
//-- optional, if so, we return 0, not 1.
if (minOccurs == 1) {
Enumeration enumeration = group.enumerate();
while (enumeration.hasMoreElements()) {
if (getLowerBound((Annotated)enumeration.nextElement()) != 0)
return 1;
}
//-- if we make it here, all items in group have a
//-- lowerbound of 0, so the group can be considered
//-- optional
return 0;
}
return minOccurs;
case Structure.ATTRIBUTE:
if (((AttributeDecl)annotated).isRequired())
return 1;
break;
default:
break;
}
return 0;
} //-- getLowerBound
} //-- class: XMLBindingComponent
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
f85cd583db88be645f2a251e5ec24c0df656db45 | 6e924d8859923c10fbb5b2738c43ad360f0d4208 | /SFTR_HRTA/hrhi/private/nc/impl/hi/hi_301/PsnInfDMO.java | 383ae281f5f98f68f9f9844d79c272f8f231e6f3 | [] | no_license | 24986810/SFTR_HRTA | 00b7337c06b0fa00f9635c0df21fae9f61653d47 | cb4aa3876ab019e541cf7ae7dfdfc821ce979103 | refs/heads/master | 2020-07-22T14:15:37.934708 | 2019-10-09T05:15:31 | 2019-10-09T05:15:31 | 207,230,524 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 214,227 | java | package nc.impl.hi.hi_301;
import java.io.IOException;
import java.math.BigDecimal;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Types;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.List;
import java.util.Vector;
import javax.naming.NamingException;
import nc.bs.dao.DAOException;
import nc.bs.hr.utils.setdict.HRResHiDictHelper;
import nc.bs.ml.NCLangResOnserver;
import nc.bs.mw.sqltrans.TempTable;
import nc.hr.utils.PubEnv;
import nc.itf.hi.HIDelegator;
import nc.itf.hr.comp.IParValue;
import nc.itf.hr.pub.HROperatorSQLHelper;
import nc.itf.hr.pub.PubDelegator;
import nc.jdbc.framework.crossdb.CrossDBPreparedStatement;
import nc.jdbc.framework.crossdb.CrossDBResultSet;
import nc.jdbc.framework.crossdb.CrossDBResultSetMetaData;
import nc.vo.bd.b04.DeptdocVO;
import nc.vo.hi.hi_301.CtrlDeptVO;
import nc.vo.hi.hi_301.GeneralVO;
import nc.vo.hi.hi_306.DocApplyHVO;
import nc.vo.hr.formulaset.BusinessFuncParser_sql;
import nc.vo.hr.tools.pub.CommonVO;
import nc.vo.hr.tools.pub.CommonVOProcessor;
import nc.vo.hr.validate.IDValidateUtil;
import nc.vo.jcom.lang.StringUtil;
import nc.vo.pub.BusinessException;
import nc.vo.pub.CircularlyAccessibleValueObject;
import nc.vo.pub.lang.UFBoolean;
import nc.vo.pub.lang.UFDate;
import nc.vo.pub.lang.UFDouble;
import nc.vo.pub.rs.MemoryResultSet;
/**
* 新人员采集、维护的DMO。 创建日期:(2004-5-9 19:20:29)
*
* @author:Administrator
*/
public class PsnInfDMO extends nc.bs.pub.DataManageObject {
// 数据库类型
public final static int DB2 = 0;
public final static int ORACLE = 1;
public final static int SQLSERVER = 2;
public final static int SYBASE = 3;
public final static int UNKOWNDATABASE = -1;
/**
* 此处插入方法说明。
* 创建日期:(2002-12-13 15:50:53)
* @return int
*/
private int getDataBaseType() {
try {
String dpn = getConnection().getMetaData().getDatabaseProductName();
if (dpn.toUpperCase().indexOf("DB2") != -1)
return DB2;
if (dpn.toUpperCase().indexOf("ORACLE") != -1)
return ORACLE;
if (dpn.toUpperCase().indexOf("SYBASE") != -1)
return SYBASE;
if (dpn.toUpperCase().indexOf("SQL") != -1)
return SQLSERVER;
if (dpn.toUpperCase().indexOf("ACCESS") != -1)
return SQLSERVER;
return UNKOWNDATABASE;
} catch (Exception e) {
reportException(e);
return -1;
}
}
/**
* CtrlDeptDMO 构造子注解。
*
* @exception javax.naming.NamingException
* 异常说明。
* @exception nc.bs.pub.SystemException
* 异常说明。
*/
public PsnInfDMO() throws javax.naming.NamingException,
nc.bs.pub.SystemException {
super();
}
public String getOldPsnDocPKOfRef(GeneralVO psndocVO) throws SQLException{
String oldpk=null;
Connection conn = null;
PreparedStatement stmt = null;
String pk_corp = (String)psndocVO.getAttributeValue("pk_corp");
String pk_psnbasdoc = (String)psndocVO.getAttributeValue("pk_psnbasdoc");
String sql = "select pk_psndoc from bd_psndoc where isreferenced ='Y' and pk_corp ='"+pk_corp+"' and pk_psnbasdoc = '" + pk_psnbasdoc + "'";//where psnclscope =0
try {
// 获取连接
conn = getConnection();
stmt = conn.prepareStatement(sql);
ResultSet rs = stmt.executeQuery();
while(rs.next()){
oldpk = rs.getString(1);
}
} finally {
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
return oldpk;
}
/**
* CtrlDeptDMO 构造子注解。
*
* @param dbName
* java.lang.String
* @exception javax.naming.NamingException
* 异常说明。
* @exception nc.bs.pub.SystemException
* 异常说明。
*/
public PsnInfDMO(String dbName) throws javax.naming.NamingException,
nc.bs.pub.SystemException {
super(dbName);
}
/**
*
* @throws javax.naming.NamingException
* @throws nc.bs.pub.SystemException
*/
public void batchUpatePsnCode(GeneralVO[] psnvo) throws java.sql.SQLException{
if(psnvo ==null){
return;
}
Connection conn = null;
PreparedStatement stmt = null;
try {
// 获取连接
conn = getConnection();
String sql = " update bd_psndoc set psncode =? where pk_psndoc =?";
sql = HROperatorSQLHelper.getSQLWithOperator(sql);
stmt = prepareStatement(conn,sql);
for(int i=0;i<psnvo.length;i++){
stmt.setString(1,(String)psnvo[i].getAttributeValue("psncode"));
stmt.setString(2,(String)psnvo[i].getAttributeValue("pk_psndoc"));
stmt.executeUpdate();
}
executeBatch(stmt);
} finally {
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
}
/**
*
*/
public void batchUpdate(String[] pk_psndocs, String tableCode,
String fieldCode, Object value) throws java.sql.SQLException {
Connection conn = null;
PreparedStatement stmt = null;
try {
// 获取连接
conn = getConnection();
TempTable tt = new TempTable();
// tt.dropTempTable(conn, "temppsntable");
String temptable = tt.createTempTable(conn, "temppsntable", "pk_psndoc char(20),ts char(19),dr int", null);
String tempsql = "insert into "+temptable+"(pk_psndoc) values (?)";
stmt = prepareStatement(conn,tempsql);
for(int i=0;i<pk_psndocs.length;i++){
stmt.setString(1,pk_psndocs[i]);
stmt.executeUpdate();
}
executeBatch(stmt);
// 组织sql语句,并检查是否含有blob类型字段
// for (int i = 0; i < pk_psndocs.length; i++) {
String tableCode1 = tableCode;
if (tableCode1.equalsIgnoreCase("hi_psndoc_part")) {
tableCode = "hi_psndoc_deptchg";
}
String sql = "update " + tableCode + " set ";
sql += fieldCode + "=";
if (BSUtil.isSelfDef(fieldCode))
sql += "'" + value.toString() + "'";
else if (BSUtil.isNumeric(value))
sql += value.toString();
else
sql += "'" + value.toString() + "'";
sql += " where ";
if (tableCode1.equalsIgnoreCase("hi_psndoc_deptchg")) {
sql += " recordnum=0 and jobtype=0 and ";
} else if (tableCode1.equalsIgnoreCase("hi_psndoc_part")) {
sql += " recordnum=0 and jobtype>0 and ";// wangkf fixed
} else if (!tableCode.equalsIgnoreCase("bd_psnbasdoc")
&& !tableCode.equalsIgnoreCase("bd_psndoc")) {
if(!tableCode.equalsIgnoreCase("hi_psndoc_edu")){
sql += " recordnum=0 and ";
}else{
sql += " lasteducation='Y' and ";
}
}
if (isTraceTable(tableCode)){
sql += "pk_psndoc in (select distinct pk_psndoc from "+temptable+")";
} else {
sql += "pk_psnbasdoc in (select distinct pk_psndoc from "+temptable+")";
}
sql = HROperatorSQLHelper.getSQLWithOperator(sql);
stmt = conn.prepareStatement( sql);
stmt.executeUpdate();
} finally {
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
}
private boolean isTraceTable(String tableCode){
if (tableCode.equalsIgnoreCase("hi_psndoc_deptchg")
||tableCode.equalsIgnoreCase("hi_psndoc_ctrt")
||tableCode.equalsIgnoreCase("hi_psndoc_part")
||tableCode.equalsIgnoreCase("hi_psndoc_training")
||tableCode.equalsIgnoreCase("hi_psndoc_ass")
||tableCode.equalsIgnoreCase("hi_psndoc_retire")
||tableCode.equalsIgnoreCase("hi_psndoc_orgpsn")
||tableCode.equalsIgnoreCase("hi_psndoc_psnchg")
||tableCode.equalsIgnoreCase("hi_psndoc_dimission")
||tableCode.equalsIgnoreCase("bd_psndoc")
){
return true;
}else
return false;
}
/**
*
* @return
* @throws SQLException
*/
public boolean hasPerson()throws SQLException{
Connection conn = null;
PreparedStatement stmt = null;
String sql = " select psncode from bd_psndoc group by psncode having count(pk_psnbasdoc)>1 ";//where psnclscope =0
boolean hasperson = false;
try {
// 获取连接
conn = getConnection();
stmt = conn.prepareStatement(sql);
ResultSet rs = stmt.executeQuery();
while(rs.next()){
hasperson = true;
}
} finally {
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
return hasperson;
}
/**
*
* @param pk_deptdoc
* @return
* @throws SQLException
*/
public boolean isDeptCancled(String pk_deptdoc)throws SQLException{
Connection conn = null;
PreparedStatement stmt = null;
String sql = " select canceled from bd_deptdoc where pk_deptdoc =? ";
boolean iscancle = false;
try {
// 获取连接
conn = getConnection();
stmt = conn.prepareStatement(sql);
stmt.setString(1, pk_deptdoc);
ResultSet rs = stmt.executeQuery();
while(rs.next()){
String cancle = rs.getString(1);
if(cancle!=null && "Y".equalsIgnoreCase(cancle.trim())){
iscancle =true;
}
}
} finally {
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
return iscancle;
}
public boolean isDeptDrop(String pk_deptdoc) throws SQLException{
Connection conn = null;
PreparedStatement stmt = null;
String sql = " select hrcanceled from bd_deptdoc where pk_deptdoc =? ";
boolean isdrop = false;
try {
// 获取连接
conn = getConnection();
stmt = conn.prepareStatement(sql);
stmt.setString(1, pk_deptdoc);
ResultSet rs = stmt.executeQuery();
while(rs.next()){
String drop = rs.getString(1);
if(drop!=null && "Y".equalsIgnoreCase(drop.trim())){
isdrop =true;
}
}
} finally {
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
return isdrop;
}
/**
*
* @param pk_deptdoc
* @return
* @throws SQLException
*/
public boolean isJobAbort(String pk_om_job)throws SQLException{
Connection conn = null;
PreparedStatement stmt = null;
String sql = " select isabort from om_job where pk_om_job =? ";
boolean isabort = false;
try {
// 获取连接
conn = getConnection();
stmt = conn.prepareStatement(sql);
stmt.setString(1, pk_om_job);
ResultSet rs = stmt.executeQuery();
while(rs.next()){
String abort = rs.getString(1);
if(abort!=null && "Y".equalsIgnoreCase(abort.trim())){
isabort =true;
}
}
} finally {
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
return isabort;
}
/**
* 此处插入方法描述。 创建日期:(2004-7-15 9:31:50)
*
* @return boolean
* @param vo
* nc.vo.hi.hi_301.GeneralVO
* @exception java.sql.SQLException
* 异常说明。
*/
public int checkPsn(GeneralVO vo, Integer flag)
throws java.sql.SQLException {
Connection conn = null;
PreparedStatement stmt = null;
String sql = null;
String sPsnCodeUnique = "N";
try {
IParValue parvalue = PubDelegator.getIParValue();
sPsnCodeUnique = parvalue.getParaString("0001", "HI_CODEUNIQUE");
if (flag.intValue() == 0) {
sql = "select 1 from bd_psndoc where pk_psnbasdoc = ? and indocflag=? and dr = 0";
} else if (flag.intValue() == 1) {
if ("N".equalsIgnoreCase(sPsnCodeUnique)|| sPsnCodeUnique == null) {
Object pk_psnbasdoc = vo.getAttributeValue("pk_psnbasdoc");
if(pk_psnbasdoc!=null){
sql = "select 1 from bd_psndoc where psncode = ? and dr = 0 and pk_corp = ? and pk_psnbasdoc <> '"+pk_psnbasdoc.toString()+"'";
}else{
sql = "select 1 from bd_psndoc where psncode = ? and dr = 0 and pk_corp = ? ";
}
} else {
Object pk_psnbasdoc = vo.getAttributeValue("pk_psnbasdoc");
if(pk_psnbasdoc!=null){
sql = "select 1 from bd_psndoc where psncode = ? and dr = 0 and pk_psnbasdoc <> '"+pk_psnbasdoc.toString()+"'";
}else{
sql = "select 1 from bd_psndoc where psncode = ? and dr = 0 ";
}
}
} else if (flag.intValue() == 2) {
int idLen = vo.getFieldValue("id") == null ? 0 : ((String) vo.getFieldValue("id")).trim().length();
if (idLen == 18) {
String id = ((String) vo.getFieldValue("id")).trim();
String id15 = id.substring(0, 6) + id.substring(8, 17);
String twoid = id + "' or ltrim(rtrim(id)) = '" + id15;
sql = "select 1 from hi_psndoc_bad where ( ltrim(rtrim(id)) = '" + twoid+ "') and dr = 0 and psnname = ? and delflag = 0";
} else {
sql = "select 1 from hi_psndoc_bad where ltrim(rtrim(id)) = ? and dr = 0 and psnname = ? and delflag = 0";
}
} else if (flag.intValue() == 3) {
sql = "select 1 from bd_psndoc where dr = 0 and psncode = ? ";
if ("N".equalsIgnoreCase(sPsnCodeUnique)|| sPsnCodeUnique == null)
sql += "and pk_corp = '"+ (String) vo.getFieldValue("pk_corp") + "'";
} else if (flag.intValue() == 4) {
String name = (String) vo.getAttributeValue("psnname");
String pk_psnbasdoc = (String) vo.getAttributeValue("pk_psnbasdoc");
String id = ((String) vo.getFieldValue("id")).trim();
String whereid = "";
if (id.length() == 18) {
String id15 = id.substring(0, 6) + id.substring(8, 17);
whereid = "(ltrim(rtrim(bd_psnbasdoc.id))||bd_psndoc.psnname = '"
+ id
+ name
+ "' or ltrim(rtrim(bd_psnbasdoc.id))||bd_psndoc.psnname = '"
+ id15 + name + "')";
} else {
whereid = "ltrim(rtrim(bd_psnbasdoc.id))||bd_psndoc.psnname = '"+ id + name + "'";
}
sql = "select 1 from bd_psndoc inner join bd_psnbasdoc on bd_psndoc.pk_psnbasdoc = bd_psnbasdoc.pk_psnbasdoc where "
+ whereid
+ "and bd_psndoc.pk_psnbasdoc <> '"
+ pk_psnbasdoc + "'";
} else if (flag.intValue() == 5) {
if ("N".equalsIgnoreCase(sPsnCodeUnique)|| sPsnCodeUnique == null) {
sql = "select 1 from bd_psndoc where psncode = ? and dr = 0 and pk_psnbasdoc <> ? and pk_corp = ?";
} else {
sql = "select 1 from bd_psndoc where psncode = ? and dr = 0 and pk_psnbasdoc <> ?";
}
}
conn = getConnection();
stmt = conn.prepareStatement(sql);
if (flag.intValue() == 0) {
stmt.setString(1, (String) vo.getFieldValue("pk_psnbasdoc"));
stmt.setString(2, (String) vo.getFieldValue("indocflag").toString());
ResultSet rs = stmt.executeQuery();
if (!rs.next()) {
return 0;
}
} else if (flag.intValue() == 1) {
if ("N".equalsIgnoreCase(sPsnCodeUnique)|| sPsnCodeUnique == null) {
stmt.setString(1, (String) vo.getFieldValue("psncode"));
stmt.setString(2, (String) vo.getFieldValue("pk_corp"));
ResultSet rs = stmt.executeQuery();
if (rs.next()) {
return 1;
}
} else {
stmt.setString(1, (String) vo.getFieldValue("psncode"));
ResultSet rs = stmt.executeQuery();
if (rs.next()) {
return 1;
}
}
} else if (flag.intValue() == 2) {
int idLen = ((String) vo.getFieldValue("id")).trim().length();
if (idLen == 18) {
stmt.setString(1, (String) vo.getFieldValue("psnname"));
} else {
stmt.setString(1, ((String) vo.getFieldValue("id")).trim());
stmt.setString(2, ((String) vo.getFieldValue("psnname")).trim());
}
ResultSet rs = stmt.executeQuery();
if (rs.next()) {
return 2;
}
} else if (flag.intValue() == 3) {
stmt.setString(1, ((String) vo.getFieldValue("psncode")).trim());
ResultSet rs = stmt.executeQuery();
if (rs.next()) {
return 3;
}
} else if (flag.intValue() == 4) {
ResultSet rs = stmt.executeQuery();
if (rs.next()) {
return 4;
}
} else if (flag.intValue() == 5) {
if ("N".equalsIgnoreCase(sPsnCodeUnique)|| sPsnCodeUnique == null) {
stmt.setString(1, (String) vo.getFieldValue("psncode"));
stmt.setString(2, (String) vo.getFieldValue("pk_psnbasdoc"));
stmt.setString(3, (String) vo.getFieldValue("pk_corp"));
ResultSet rs = stmt.executeQuery();
if (rs.next()) {
return 5;
}
} else {
stmt.setString(1, (String) vo.getFieldValue("psncode"));
stmt.setString(2, (String) vo.getFieldValue("pk_psnbasdoc"));
ResultSet rs = stmt.executeQuery();
if (rs.next()) {
return 5;
}
}
}
} catch (Exception ex) {
return -1;
} finally {
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
return -1;
}
/**
* 此处插入方法描述。 创建日期:(2004-6-7 17:14:15)
*
* @param tableCode
* java.lang.String
* @param where
* java.lang.String
* @exception java.sql.SQLException
* 异常说明。
*/
public void deleteData(String tableCode, String where)
throws java.sql.SQLException {
Connection conn = null;
Statement stmt = null;
try {
if (tableCode.equalsIgnoreCase("hi_psndoc_part")) {
tableCode = "hi_psndoc_deptchg";
StringUtil.replaceAllString/*AllString*/(where,
"hi_psndoc_part", "hi_psndoc_deptchg");
}
String sql = "delete from " + tableCode
+ (where == null ? "" : " where " + where);
conn = getConnection();
stmt = conn.createStatement();
stmt.execute(sql);
} finally {
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
}
/**
* 此处插入方法描述。 创建日期:(2004-6-7 17:14:15)
*
* @param tableCode
* java.lang.String
* @param where
* java.lang.String
* @exception java.sql.SQLException
* 异常说明。
*/
public int deletePsnValidate(String pk_psnbasdoc)
throws java.sql.SQLException {
Connection conn = null;
PreparedStatement stmt = null;
ResultSet rs = null;
int count = 0;
try {
String sql = "select count(pk_psndoc) from bd_psndoc where pk_psnbasdoc = ?";
conn = getConnection();
stmt = conn.prepareStatement(sql);
stmt.setString(1, pk_psnbasdoc);
rs = stmt.executeQuery();
while (rs.next()) {
count = rs.getInt(1);
}
} finally {
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
return count;
}
/**
* 删除人员表信息。 创建日期:(2004-5-19 10:34:24)
*
* @param tableCode
* java.lang.String
* @param pk_psndoc
* java.lang.String
* @exception java.sql.SQLException
* 异常说明。
*/
public void deletePsnData(String tableCode, String pk_psndoc)
throws java.sql.SQLException {
/** ********************************************************** */
// 保留的系统管理接口:
beforeCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "delete", new Object[] {
tableCode, pk_psndoc });
/** ********************************************************** */
Connection conn = null;
Statement stmt = null;
try {
String sql = "delete from " + tableCode + " where pk_psndoc='"
+ pk_psndoc + "'";
conn = getConnection();
stmt = conn.createStatement();
stmt.execute(sql);
} finally {
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
/** ********************************************************** */
// 保留的系统管理接口:
afterCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "delete", new Object[] {
tableCode, pk_psndoc });
/** ********************************************************** */
}
/**
* 删除人员时校验存在两条管理档案以上就不让删除
*
* @param corpPK
* @return
* @throws java.sql.SQLException
*/
public String[] getAllUserCode(String corpPK) throws java.sql.SQLException {
String[] code = null;
Connection conn = null;
PreparedStatement stmt = null;
ResultSet result = null;
Vector<String> v = new Vector<String>();
try {
// V55 modify 校验集团所有编码不能唯一
String sql = "select pk_corp,user_code from sm_user"; // where pk_corp = '0001' or pk_corp = ?";
conn = getConnection();
stmt = conn.prepareStatement(sql);
// stmt.setString(1, corpPK);
result = stmt.executeQuery();
while (result.next()) {
v.addElement(result.getString(1) + result.getString(2));
}
code = new String[v.size()];
v.copyInto(code);
} finally {
if (result != null)
result.close();
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
return code;
}
/**
* 此处插入方法描述。 创建日期:(2004-6-8 17:14:17)
*
* @return java.lang.Object
* @param tableName
* java.lang.String
* @param pkField
* java.lang.String
* @param codeField
* java.lang.String
* @param pk
* java.lang.Object
* @exception java.sql.SQLException
* 异常说明。
*/
public Object getValue(String tableName, String pkField, String vField,
Object pk) throws java.sql.SQLException {
Connection conn = null;
PreparedStatement stmt = null;
ResultSet result = null;
try {
if (tableName.equalsIgnoreCase("hi_psndoc_part")) {
tableName = "hi_psndoc_deptchg";
}
String sql = "select " + vField + " from " + tableName + " where "
+ pkField + "=?";
conn = getConnection();
stmt = conn.prepareStatement(sql);
stmt.setObject(1, pk);
result = stmt.executeQuery();
if (result.next())
return result.getObject(1);
return null;
} finally {
if (result != null)
result.close();
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
}
/**
* 此函数
*
* @param pk_psndoc
* @param table
* @return
* @throws java.sql.SQLException
* @throws nc.bs.pub.SystemException
* 查询时增加查询任职信息中的“备注”字段。 fengwei 2009-09-23
*/
public GeneralVO[] queryDeptChgInfos(String pk_psndoc,String isreturn)
throws java.sql.SQLException, nc.bs.pub.SystemException {
/** ********************************************************** */
// 保留的系统管理接口:
beforeCallMethod("nc.bs.hi.hi_301.PsndocMainDMO", "queryDeptChgInfos",
new Object[] { pk_psndoc });
/** ********************************************************** */
GeneralVO[] subInfoVOs = null;
Connection con = null;
PreparedStatement stmt = null;
ResultSet result = null;
Vector v = new Vector();
try {
String sql = " select hi_psndoc_deptchg.begindate,hi_psndoc_deptchg.enddate,hi_psndoc_deptchg.pk_corp as pk_corp,om_duty.pk_om_duty as pk_om_duty ";
sql += ",bd_deptdoc.pk_deptdoc as pk_deptdoc,om_job.pk_om_job as pk_postdoc,hi_psndoc_deptchg.lastflag,hi_psndoc_deptchg.recordnum,hi_psndoc_deptchg.pk_psnbasdoc,hi_psndoc_deptchg.pk_psndoc_sub ";
sql += ",bd_corp.unitname,om_duty.dutyname,bd_deptdoc.deptname,om_job.jobname, hi_psndoc_deptchg.memo from hi_psndoc_deptchg ";
sql += " left outer join bd_corp on bd_corp.pk_corp = hi_psndoc_deptchg.pk_corp ";
sql += " left outer join om_duty on om_duty.pk_om_duty = hi_psndoc_deptchg.pk_om_duty ";
sql += " left outer join bd_deptdoc on bd_deptdoc.pk_deptdoc = hi_psndoc_deptchg.pk_deptdoc ";
sql += " left outer join om_job on om_job.pk_om_job = hi_psndoc_deptchg.pk_postdoc ";
sql += " where hi_psndoc_deptchg.pk_psndoc = ? and hi_psndoc_deptchg.jobtype = 0";
if (isreturn != null && "Y".equalsIgnoreCase(isreturn)) {
sql += " and hi_psndoc_deptchg.isreturn = 'Y' and hi_psndoc_deptchg.recordnum = 0 and lastflag ='Y' ";
}
con = getConnection();
stmt = con.prepareStatement(sql);
// set PK fields:
stmt.setString(1, pk_psndoc);
result = stmt.executeQuery();
while (result.next()) {
GeneralVO vo = new GeneralVO();
vo.setAttributeValue("pk_psndoc", pk_psndoc);
vo.setAttributeValue("begindate", result.getString(1));
vo.setAttributeValue("enddate", result.getString(2));
vo.setAttributeValue("pk_corp", result.getString(3));
vo.setAttributeValue("pk_om_duty", result.getString(4));
vo.setAttributeValue("pk_deptdoc", result.getString(5));
vo.setAttributeValue("pk_postdoc", result.getString(6));
vo.setAttributeValue("lastflag", result.getString(7));
vo.setAttributeValue("recordnum", new Integer(result.getInt(8)));
vo.setAttributeValue("pk_psnbasdoc", result.getString(9));
vo.setAttributeValue("pk_psndoc_sub", result.getString(10));
vo.setAttributeValue("unitname", result.getString(11));
vo.setAttributeValue("dutyname", result.getString(12));
vo.setAttributeValue("deptname", result.getString(13));
vo.setAttributeValue("jobname", result.getString(14));
vo.setAttributeValue("memo", result.getString(15));//增加查询“备注”字段
v.addElement(vo);
}
if (v.size() > 0) {
subInfoVOs = new GeneralVO[v.size()];
v.copyInto(subInfoVOs);
}
} finally {
try {
if (stmt != null) {
stmt.close();
}
} catch (Exception e) {
}
try {
if (con != null) {
con.close();
}
} catch (Exception e) {
}
}
/** ********************************************************** */
// 保留的系统管理接口:
afterCallMethod("nc.bs.hi.hi_301.PsndocMainDMO", "queryDeptChgInfos",
new Object[] { pk_psndoc });
/** ********************************************************** */
return subInfoVOs;
}
/**
* 更新子集表的记录号和标记 wangkf add 创建日期:(2004-7-1 14:50:27)
*
* @return java.lang.String
* @param deptchgVO
* nc.vo.hi.hi_301.HRMainVO
* @exception java.sql.SQLException
* 异常说明。
*/
public int updateRecornum(String table, Integer num, String pk_psndoc)
throws java.sql.SQLException, nc.bs.pub.SystemException {
/** ********************************************************** */
// 保留的系统管理接口:
beforeCallMethod("nc.bs.hi.hi_301.PsndocMainDMO", "updateRecornum",
new Object[] { table, num, pk_psndoc });
/** ********************************************************** */
if (num == null) {
return 0;
}
Connection con = null;
PreparedStatement stmt = null;
int count = 0;
try {
String sql = " update " + table + " set recordnum=recordnum+"
+ num.intValue() + ",lastflag='N' where pk_psndoc= ?";
con = getConnection();
stmt = con.prepareStatement(sql);
if (pk_psndoc == null) {
stmt.setNull(1, Types.CHAR);
} else {
stmt.setString(1, pk_psndoc);
}
count = stmt.executeUpdate();
} finally {
try {
if (stmt != null) {
stmt.close();
}
} catch (Exception e) {
}
try {
if (con != null) {
con.close();
}
} catch (Exception e) {
}
}
/** ********************************************************** */
// 保留的系统管理接口:
afterCallMethod("nc.bs.hi.hi_301.PsndocMainDMO", "updateRecornum",
new Object[] { table, num, pk_psndoc });
/** ********************************************************** */
return count;
}
/**
* 更新子集表的记录号和标记 wangkf add 创建日期:(2004-7-1 14:50:27)
*
* @return java.lang.String
* @param deptchgVO
* nc.vo.hi.hi_301.HRMainVO
* @exception java.sql.SQLException
* 异常说明。
*/
public int updateRecornumforWork(String table, Integer num, String pk_psnbasdoc)
throws java.sql.SQLException, nc.bs.pub.SystemException {
/** ********************************************************** */
// 保留的系统管理接口:
beforeCallMethod("nc.bs.hi.hi_301.PsndocMainDMO", "updateRecornum",
new Object[] { table, num, pk_psnbasdoc });
/** ********************************************************** */
if (num == null) {
return 0;
}
Connection con = null;
PreparedStatement stmt = null;
int count = 0;
try {
String sql = " update " + table + " set recordnum=recordnum+"+ num.intValue() + ",lastflag='N' where pk_psnbasdoc= ?";
con = getConnection();
stmt = con.prepareStatement(sql);
if (pk_psnbasdoc == null) {
stmt.setNull(1, Types.CHAR);
} else {
stmt.setString(1, pk_psnbasdoc);
}
count = stmt.executeUpdate();
} finally {
try {
if (stmt != null) {
stmt.close();
}
} catch (Exception e) {
}
try {
if (con != null) {
con.close();
}
} catch (Exception e) {
}
}
/** ********************************************************** */
// 保留的系统管理接口:
afterCallMethod("nc.bs.hi.hi_301.PsndocMainDMO", "updateRecornum",
new Object[] { table, num, pk_psnbasdoc });
/** ********************************************************** */
return count;
}
/**
* 更新任职表的记录号和标记 ,不处理兼职的记录
*
* @param num
* @param pk_psndoc
* @return
* @throws java.sql.SQLException
* @throws nc.bs.pub.SystemException
* @throws BusinessException
*/
public UFDate updateDeptchgRecornum(int num, String pk_psndoc,UFDate onpostdate,UFDate indutydate)
throws java.sql.SQLException, nc.bs.pub.SystemException, BusinessException {
Connection con = null;
PreparedStatement stmt = null;
UFDate begindate = null;
UFDate date = onpostdate==null?indutydate:onpostdate;
UFDate oldbegindate = null;
try {
String sqlQ = " select enddate, begindate from hi_psndoc_deptchg where pk_psndoc = ? and jobtype= 0 and recordnum = 0 ";
String sqlU = " update hi_psndoc_deptchg set recordnum = recordnum + "
+ num + ",lastflag='N', poststat = 'N' where pk_psndoc= ? and jobtype= 0";
con = getConnection();
// 查询上一条任职结束日期
stmt = con.prepareStatement(sqlQ);
stmt.setString(1, pk_psndoc);
ResultSet rs = stmt.executeQuery();
//任职开始日期规则:如果是第一次任职,首先取最新到岗日期,如果没有,则取到职日期。如果不是第一次任职,则只取最新到岗日期。
if (rs.next()) {
String strDate = rs.getString(1);
// 如果存在任职记录,且任职记录结束日期为空或者到职日期在最新任职记录结束日期之前时,不写入任职开始日期
// if (strDate == null
// || (!indutydate.after(new UFDate(strDate.trim())))) {
// begindate = null;
if (date != null &&strDate != null
&& (!date.after(new UFDate(strDate.trim())))) {
begindate = null;
} else {
begindate = date;
}
oldbegindate = new UFDate(rs.getString(2));
}else{
begindate = date;
}
//置最后一条历史的结束日期为最新到岗日期-1。
if(onpostdate != null && oldbegindate != null){
if(!onpostdate.after(oldbegindate)){
throw new BusinessException(NCLangResOnserver.getInstance().getStrByID("600704", "UPT600704-000360")/*
* @res
* "最新到岗日期应晚于历史任职开始日期!"*/);
}
String updatefirsthistorysql = "update hi_psndoc_deptchg set enddate='"+onpostdate.getDateBefore(1).toString()+"' where pk_psndoc = '"+pk_psndoc+"' and jobtype= 0 and recordnum = 0 and enddate is null";
stmt = con.prepareStatement(updatefirsthistorysql);
stmt.executeUpdate();
}
// 更新历史记录
stmt = con.prepareStatement(sqlU);
if (pk_psndoc == null) {
stmt.setNull(1, Types.CHAR);
} else {
stmt.setString(1, pk_psndoc);
}
stmt.executeUpdate();
} finally {
try {
if (stmt != null) {
stmt.close();
}
} catch (Exception e) {
}
try {
if (con != null) {
con.close();
}
} catch (Exception e) {
}
}
return begindate;
}
/**
* 把任职表中记录插入到履历表 --改进算法,支持批量处理 wangkf add 创建日期:(2004-7-1 14:50:27)
*
* @return java.lang.String
* @param deptchgVO
* nc.vo.hi.hi_301.HRMainVO
* @exception java.sql.SQLException
* 异常说明。
*插入时,将任职信息中的“备注”字段插入。fengwei 2009-09-23
*/
public String[] insertHiPsnWork(GeneralVO[] deptchgVOs)
throws java.sql.SQLException, nc.bs.pub.SystemException {
/** ********************************************************** */
// 保留的系统管理接口:
beforeCallMethod("nc.bs.hi.hi_301.PsndocMainDMO", "insertHiPsnWork",
new Object[] { deptchgVOs });
/** ********************************************************** */
String[] keys = null;
Connection con = null;
PreparedStatement stmt = null;
// ResultSet rs = null;
// int[] counts = null;
try {
con = getConnection();
keys = new String[deptchgVOs.length];
String sql = "insert into hi_psndoc_work ";
sql += " (pk_psndoc_sub,pk_psndoc,begindate,enddate,workcorp,workjob,workdept,workpost,lastflag,recordnum,pk_psnbasdoc,pk_deptchg, memo) ";// lastflag,recordnum
sql += " values( ?,?,?,?,?,?,?,?,?,?,?,?,?) ";
sql = HROperatorSQLHelper.getSQLWithOperator(sql);
stmt = prepareStatement(con, sql);
for (int i = 0; i < deptchgVOs.length; i++) {
keys[i] = getOID();
// set PK fields:
stmt.setString(1, keys[i]);
stmt.setString(2, (String) deptchgVOs[i]
.getAttributeValue("pk_psndoc"));
// 开始日期
if (deptchgVOs[i].getAttributeValue("begindate") == null) {
stmt.setNull(3, Types.CHAR);
} else {
stmt.setString(3, (String) deptchgVOs[i]
.getAttributeValue("begindate"));
}
// 结束日期
if (deptchgVOs[i].getAttributeValue("enddate") == null) {
stmt.setNull(4, Types.CHAR);
} else {
stmt.setString(4, (String) deptchgVOs[i]
.getAttributeValue("enddate"));
}
// 工作单位workcorp
if (deptchgVOs[i].getAttributeValue("unitname") == null) {
stmt.setNull(5, Types.CHAR);
} else {
stmt.setString(5, (String) deptchgVOs[i]
.getAttributeValue("unitname"));
}
// 工作职务 workjob
if (deptchgVOs[i].getAttributeValue("dutyname") == null) {
stmt.setNull(6, Types.CHAR);
} else {
stmt.setString(6, (String) deptchgVOs[i]
.getAttributeValue("dutyname"));
}
// 工作部门 workdept
if (deptchgVOs[i].getAttributeValue("deptname") == null) {
stmt.setNull(7, Types.CHAR);
} else {
stmt.setString(7, (String) deptchgVOs[i]
.getAttributeValue("deptname"));
}
// 工作岗位 workpost
if (deptchgVOs[i].getAttributeValue("jobname") == null) {// 实际上是名称
stmt.setNull(8, Types.CHAR);
} else {
stmt.setString(8, (String) deptchgVOs[i]
.getAttributeValue("jobname"));
}
// --
// 更新标记
if (deptchgVOs[i].getAttributeValue("lastflag") == null) {
stmt.setNull(9, Types.CHAR);
} else {
stmt.setString(9, (String) deptchgVOs[i]
.getAttributeValue("lastflag"));
}
// 记录号
if (deptchgVOs[i].getAttributeValue("recordnum") == null) {// 实际上是名称
stmt.setNull(10, Types.INTEGER);
} else {
stmt.setInt(10, ((Integer) deptchgVOs[i]
.getAttributeValue("recordnum")).intValue());
}
// 人员档案主键
if (deptchgVOs[i].getAttributeValue("pk_psnbasdoc") == null) {
stmt.setNull(11, Types.CHAR);
} else {
stmt.setString(11, (String) deptchgVOs[i]
.getAttributeValue("pk_psnbasdoc"));
}
// 任职记录主键
if (deptchgVOs[i].getAttributeValue("pk_psndoc_sub") == null) {
stmt.setNull(12, Types.CHAR);
} else {
stmt.setString(12, (String) deptchgVOs[i]
.getAttributeValue("pk_psndoc_sub"));
}
//备注 增加插入“备注”字段
if(deptchgVOs[i].getAttributeValue("memo") == null) {
stmt.setNull(13, Types.CHAR);
} else {
stmt.setString(13, (String) deptchgVOs[i].getAttributeValue("memo"));
}
stmt.executeUpdate();
//executeUpdate(stmt);// stmt.addBatch();
}
//
stmt.executeBatch();//executeBatch(stmt); // stmt.executeBatch();
} finally {
try {
if (stmt != null) {
stmt.close();
}
} catch (Exception e) {
}
try {
if (con != null) {
con.close();
}
} catch (Exception e) {
}
}
/** ********************************************************** */
// 保留的系统管理接口:
afterCallMethod("nc.bs.hi.hi_301.PsndocMainDMO", "insertHiPsnWork",
new Object[] { deptchgVOs });
/** ********************************************************** */
return keys;
}
/**
* 把任职表中记录插入到履历表 wangkf add 创建日期:(2004-7-1 14:50:27)
*
* @return java.lang.String
* @param deptchgVO
* nc.vo.hi.hi_301.HRMainVO
* @exception java.sql.SQLException
* 异常说明。
*/
public String insertHiPsnWork(GeneralVO deptchgVO)
throws java.sql.SQLException, nc.bs.pub.SystemException {
/** ********************************************************** */
// 保留的系统管理接口:
beforeCallMethod("nc.bs.hi.hi_301.PsndocMainDMO", "insertHiPsnWork",
new Object[] { deptchgVO });
/** ********************************************************** */
String key = null;
Connection con = null;
PreparedStatement stmt = null;
// ResultSet rs = null;
try {
String sql = "insert into hi_psndoc_work ";
sql += " (pk_psndoc_sub,pk_psndoc,begindate,enddate,workcorp,workjob,workdept,workpost,lastflag,recordnum) ";// lastflag,recordnum
sql += " values( ?,?,?,?,?,?,?,?,?,?) ";
sql = HROperatorSQLHelper.getSQLWithOperator(sql);
key = getOID();
con = getConnection();
stmt = con.prepareStatement(sql);
// set PK fields:
stmt.setString(1, key);
stmt
.setString(2, (String) deptchgVO
.getAttributeValue("pk_psndoc"));
// 开始日期
if (deptchgVO.getAttributeValue("begindate") == null) {
stmt.setNull(3, Types.CHAR);
} else {
stmt.setString(3, (String) deptchgVO
.getAttributeValue("begindate"));
}
// 结束日期
if (deptchgVO.getAttributeValue("enddate") == null) {
stmt.setNull(4, Types.CHAR);
} else {
stmt.setString(4, (String) deptchgVO
.getAttributeValue("enddate"));
}
// 工作单位workcorp
if (deptchgVO.getAttributeValue("pk_corp") == null) {
stmt.setNull(5, Types.CHAR);
} else {
stmt.setString(5, (String) deptchgVO
.getAttributeValue("pk_corp"));
}
// 工作职务 workjob
if (deptchgVO.getAttributeValue("pk_om_duty") == null) {
stmt.setNull(6, Types.CHAR);
} else {
stmt.setString(6, (String) deptchgVO
.getAttributeValue("pk_om_duty"));
}
// 工作部门 workdept
if (deptchgVO.getAttributeValue("pk_deptdoc") == null) {
stmt.setNull(7, Types.CHAR);
} else {
stmt.setString(7, (String) deptchgVO
.getAttributeValue("pk_deptdoc"));
}
// 工作岗位 workpost
if (deptchgVO.getAttributeValue("pk_postdoc") == null) {// 实际上是名称
stmt.setNull(8, Types.CHAR);
} else {
stmt.setString(8, (String) deptchgVO
.getAttributeValue("pk_postdoc"));
}
// --
// 更新标记
if (deptchgVO.getAttributeValue("lastflag") == null) {
stmt.setNull(9, Types.CHAR);
} else {
stmt.setString(9, (String) deptchgVO
.getAttributeValue("lastflag"));
}
// 记录号
if (deptchgVO.getAttributeValue("recordnum") == null) {// 实际上是名称
stmt.setNull(10, Types.INTEGER);
} else {
stmt.setInt(10, ((Integer) deptchgVO
.getAttributeValue("recordnum")).intValue());
}
//
stmt.executeUpdate();
} finally {
try {
if (stmt != null) {
stmt.close();
}
} catch (Exception e) {
}
try {
if (con != null) {
con.close();
}
} catch (Exception e) {
}
}
/** ********************************************************** */
// 保留的系统管理接口:
afterCallMethod("nc.bs.hi.hi_301.PsndocMainDMO", "insertHiPsnWork",
new Object[] { deptchgVO });
/** ********************************************************** */
return key;
}
/**
* 此处插入方法描述。 创建日期:(2004-7-1 14:50:27)
*
* @return java.lang.String
* @param psndocMain
* nc.vo.hi.hi_301.HRMainVO
* @exception java.sql.SQLException
* 异常说明。
*/
public String insertDeptChg(GeneralVO psndocVO,String[] fieldnames,HashMap hash)
throws java.sql.SQLException, nc.bs.pub.SystemException {
/** ********************************************************** */
// 保留的系统管理接口:
beforeCallMethod("nc.bs.hi.hi_301.PsndocMainDMO", "insertDeptChd",
new Object[] { psndocVO });
/** ********************************************************** */
String key = null;
Connection con = null;
PreparedStatement stmt = null;
try {
String sql = "insert into hi_psndoc_deptchg ";
sql += "(pk_psndoc_sub ,pk_psndoc, pk_corp,pk_deptdoc,pk_psncl,recordnum,lastflag,pk_jobrank,pk_jobserial" +
",pk_om_duty,pk_detytype,pk_postdoc,begindate,pk_psnbasdoc,pk_dutyrank,isreturn";
if(fieldnames!=null && fieldnames.length>0){
for(int i=0 ;i<fieldnames.length;i++){
sql+= ","+hash.get(fieldnames[i]);
}
}
sql+=" )";
sql += "values( ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?";
if(fieldnames!=null && fieldnames.length>0){
for(int i=0 ;i<fieldnames.length;i++){
sql+= ",?";
}
}
sql+=" )";
sql = HROperatorSQLHelper.getSQLWithOperator(sql);
key = getOID();
con = getConnection();
stmt = con.prepareStatement(sql);
// set PK fields:
stmt.setString(1, key);
stmt.setString(2, (String) psndocVO.getFieldValue("pk_psndoc"));
stmt
.setString(3, (String) psndocVO
.getFieldValue("belong_pk_corp"));
if (psndocVO.getFieldValue("pk_deptdoc") == null) {
stmt.setNull(4, Types.CHAR);
} else {
stmt
.setString(4, (String) psndocVO
.getFieldValue("pk_deptdoc"));
}
stmt.setString(5, (String) psndocVO.getFieldValue("pk_psncl"));
stmt.setInt(6, 0);
stmt.setString(7, "Y");
// 20030723 ZHJ ADD
// jobrank accpsndocVO-->psndocVO
if (psndocVO.getFieldValue("jobrank") != null) {
stmt.setString(8, psndocVO.getFieldValue("jobrank").toString());
} else {
stmt.setNull(8, Types.CHAR);
}
// jobseries
if (psndocVO.getFieldValue("jobseries") != null) {
stmt.setString(9, psndocVO.getFieldValue("jobseries")
.toString());
} else {
stmt.setNull(9, Types.CHAR);
}
// pk_om_duty
if (psndocVO.getFieldValue("dutyname") != null) {
stmt.setString(10, psndocVO.getFieldValue("dutyname")
.toString());
} else {
stmt.setNull(10, Types.CHAR);
}
// series
if (psndocVO.getFieldValue("series") != null) {
stmt.setString(11, psndocVO.getFieldValue("series").toString());
} else {
stmt.setNull(11, Types.CHAR);
}
// pk_om_job wangkf fixed accpsndocVO-> psndocVO
if (psndocVO.getFieldValue("pk_om_job") != null) {
stmt.setString(12, psndocVO.getFieldValue("pk_om_job")
.toString());
} else {
stmt.setNull(12, Types.CHAR);
}
// indutydate
if (psndocVO.getFieldValue("indutydate") != null) {
stmt.setString(13, (String) psndocVO
.getFieldValue("indutydate").toString());
} else {
stmt.setNull(13, Types.CHAR);
}
stmt.setString(14, (String) psndocVO.getFieldValue("pk_psnbasdoc"));
// indutydate
if (psndocVO.getFieldValue("pk_dutyrank") != null) {
stmt.setString(15, (String) psndocVO
.getFieldValue("pk_dutyrank").toString());
} else {
stmt.setNull(15, Types.CHAR);
}
if (psndocVO.getFieldValue("isreturn") != null) {
stmt.setString(16, (String) psndocVO
.getFieldValue("isreturn").toString());
} else {
stmt.setNull(16, Types.CHAR);
}
if(fieldnames!=null && fieldnames.length>0){
for(int i=0 ;i<fieldnames.length;i++){
String newname =fieldnames[i];
if(fieldnames[i].indexOf(".")!=-1){
//fieldnames[i] = fieldnames[i].substring(fieldnames[i].indexOf(".")+1);
newname = fieldnames[i].substring(fieldnames[i].indexOf(".")+1);
}
Object o= psndocVO.getAttributeValue(newname);
if(o!=null){
stmt.setObject(17+i, psndocVO.getAttributeValue(newname));
}else{
stmt.setNull(17+i,Types.CHAR);
}
}
}
//
stmt.executeUpdate();
} finally {
try {
if (stmt != null) {
stmt.close();
}
} catch (Exception e) {
}
try {
if (con != null) {
con.close();
}
} catch (Exception e) {
}
}
/** ********************************************************** */
// 保留的系统管理接口:
afterCallMethod("nc.bs.hi.hi_301.PsndocMainDMO", "insertDeptChd",
new Object[] { psndocVO });
/** ********************************************************** */
return key;
}
/**
*
* @param pk_psndoc
* @return
* @throws java.sql.SQLException
* @throws nc.bs.pub.SystemException
*/
public String queryDimissionDate(String pk_psndoc)throws java.sql.SQLException, nc.bs.pub.SystemException {
String sqldate = "select leavedate from hi_psndoc_dimission where pk_psndoc = ? and recordnum= 0 and lastflag ='Y'";
Connection con = null;
PreparedStatement stmt = null;
ResultSet rs = null;
String leavedate = null;
try {
con = getConnection();
stmt = con.prepareStatement(sqldate);
stmt.setString(1, pk_psndoc);
rs = stmt.executeQuery();
while (rs.next()) {
leavedate = rs.getString(1);
}
} finally {
try {
if (stmt != null) {
stmt.close();
}
} catch (Exception e) {
}
try {
if (con != null) {
con.close();
}
} catch (Exception e) {
}
}
return leavedate;
}
/**
*
* @param pk_psndoc
* @return
* @throws java.sql.SQLException
* @throws nc.bs.pub.SystemException
*/
public String queryOutdutyDate(String pk_psndoc)throws java.sql.SQLException, nc.bs.pub.SystemException {
String sqldate = "select outdutydate from bd_psndoc where pk_psndoc = ?";
Connection con = null;
PreparedStatement stmt = null;
ResultSet rs = null;
String outduty = null;
try {
con = getConnection();
stmt = con.prepareStatement(sqldate);
stmt.setString(1, pk_psndoc);
rs = stmt.executeQuery();
while (rs.next()) {
outduty = rs.getString(1);
}
} finally {
try {
if (stmt != null) {
stmt.close();
}
} catch (Exception e) {
}
try {
if (con != null) {
con.close();
}
} catch (Exception e) {
}
}
return outduty;
}
/**
* 此处插入方法描述。 创建日期:(2004-7-1 14:50:27)
*
* @return java.lang.String
* @param psndocMain
* nc.vo.hi.hi_301.HRMainVO
* @exception java.sql.SQLException
* 异常说明。
*/
public String insertDismissionChd(GeneralVO psndocVO,String leavedate,GeneralVO deptchginfo,String[] fieldnames,HashMap hash)
throws java.sql.SQLException, nc.bs.pub.SystemException {
/** ********************************************************** */
// 保留的系统管理接口:
beforeCallMethod("nc.bs.hi.hi_301.PsndocMainDMO","insertDismissionChd", new Object[] { psndocVO,leavedate });
/** ********************************************************** */
String key = null;
Connection con = null;
PreparedStatement stmt = null;
try {
String sql = "insert into hi_psndoc_dimission ";
sql += "(pk_psndoc_sub ,pk_psndoc, pk_corp, pkdeptafter, pkdeptbefore,recordnum,lastflag,pkomdutybefore,pkpostbefore,psnclafter,pk_psnbasdoc,leavedate,psnclbefore,pk_corpafter ";
if(fieldnames!=null && fieldnames.length>0){
for(int i=0 ;i<fieldnames.length;i++){
sql+= ","+hash.get(fieldnames[i]);
}
}
sql+=" )";
sql += "values( ?,?,?,?,?,?,?,?,?,?,?,?,?,?";
if(fieldnames!=null && fieldnames.length>0){
for(int i=0 ;i<fieldnames.length;i++){
sql+= ",?";
}
}
sql+=" )";
sql = HROperatorSQLHelper.getSQLWithOperator(sql);
key = getOID();
con = getConnection();
stmt = con.prepareStatement(sql);
stmt.setString(1, key);
stmt.setString(2, (String) psndocVO.getFieldValue("pk_psndoc"));
stmt.setString(3, (String) psndocVO.getFieldValue("belong_pk_corp"));
if (psndocVO.getFieldValue("pk_deptdoc") == null) {
stmt.setNull(4, Types.CHAR);
} else {
stmt.setString(4, (String) psndocVO.getFieldValue("pk_deptdoc"));
}
if(deptchginfo !=null && deptchginfo.getAttributeValue("pk_deptdoc")!=null){
stmt.setString(5, (String)deptchginfo.getAttributeValue("pk_deptdoc"));
} else {
if (psndocVO.getFieldValue("pk_deptdoc") == null) {
stmt.setNull(5, Types.CHAR);
} else {
stmt.setString(5, (String) psndocVO.getFieldValue("pk_deptdoc"));
}
}
stmt.setInt(6, 0);
stmt.setString(7, "Y");
if(deptchginfo !=null){
if( deptchginfo.getAttributeValue("pk_om_duty")!=null){
stmt.setString(8, (String)deptchginfo.getAttributeValue("pk_om_duty"));
}else{
stmt.setNull(8, Types.CHAR);
}
} else {
if (psndocVO.getFieldValue("dutyname") != null) {
stmt.setString(8, psndocVO.getFieldValue("dutyname").toString());
} else {
stmt.setNull(8, Types.CHAR);
}
}
if(deptchginfo !=null){
if(deptchginfo.getAttributeValue("pk_postdoc")!=null){
stmt.setString(9, (String)deptchginfo.getAttributeValue("pk_postdoc"));
}else{
stmt.setNull(9, Types.CHAR);
}
} else {
if (psndocVO.getFieldValue("pk_om_job") != null) {
stmt.setString(9, psndocVO.getFieldValue("pk_om_job").toString());
} else {
stmt.setNull(9, Types.CHAR);
}
}
stmt.setString(10, (String) psndocVO.getFieldValue("pk_psncl"));
stmt.setString(11, (String) psndocVO.getFieldValue("pk_psnbasdoc"));
if(leavedate==null){
stmt.setNull(12, Types.CHAR);
}else{
stmt.setString(12, leavedate);
}
if(deptchginfo !=null){
if(deptchginfo.getAttributeValue("pk_psncl")!=null){
stmt.setString(13, (String)deptchginfo.getAttributeValue("pk_psncl"));
}else{
stmt.setNull(13, Types.CHAR);
}
} else {
// if (psndocVO.getFieldValue("pk_psncl") == null) {
stmt.setNull(13, Types.CHAR);
// } else {
// stmt.setString(13, (String) psndocVO.getFieldValue("pk_psncl"));
// }
}
stmt.setString(14,(String) psndocVO.getFieldValue("belong_pk_corp"));
if(fieldnames!=null && fieldnames.length>0){
for(int i=0 ;i<fieldnames.length;i++){
Object o= psndocVO.getAttributeValue(fieldnames[i]);
if(o!=null){
stmt.setObject(15+i, psndocVO.getAttributeValue(fieldnames[i]));
}else{
stmt.setNull(15+i,Types.CHAR);
}
}
}
stmt.executeUpdate();
} finally {
try {
if (stmt != null) {
stmt.close();
}
} catch (Exception e) {
}
try {
if (con != null) {
con.close();
}
} catch (Exception e) {
}
}
/** ********************************************************** */
// 保留的系统管理接口:
afterCallMethod("nc.bs.hi.hi_301.PsndocMainDMO", "insertDismissionChd",
new Object[] { psndocVO,leavedate });
/** ********************************************************** */
return key;
}
/**
* 插入主信息集信息。 v53增加返聘处理
* @param psndocVO
* @param accpsndocVO
* @param mainaddpsndocVO
* @return
* @throws BusinessException
* @throws NamingException
*/
public String[] insertMain(GeneralVO psndocVO, GeneralVO accpsndocVO,GeneralVO mainaddpsndocVO) throws BusinessException, NamingException {
String[] keys = new String[2];
if(mainaddpsndocVO !=null){//返聘处理,修改个人信息,然后增加工作信息
String pk_psnbasdoc = (String) accpsndocVO.getFieldValue("pk_psnbasdoc");
updateTable("bd_psnbasdoc", accpsndocVO, "pk_psnbasdoc='"+ pk_psnbasdoc + "'");
keys[0] = pk_psnbasdoc;
}else{//正常增加个人信息
accpsndocVO.setAttributeValue("pk_corp", psndocVO.getAttributeValue("pk_corp"));
accpsndocVO.setAttributeValue("indocflag", "N");
keys[0] = insertTable("bd_psnbasdoc", accpsndocVO, "pk_psnbasdoc");
}
psndocVO.setAttributeValue("pk_psnbasdoc", keys[0]);
keys[1] = insertTable("bd_psndoc", psndocVO, "pk_psndoc");
return keys;
}
/**
* 插入HI_PSNDOC_REF数据
*
* @param psndocVO
* @return
* @throws NamingException
* @throws java.io.IOException
* @throws java.sql.SQLException
*/
public String insertHiRef(GeneralVO psndocVO) throws BusinessException, NamingException {
try {
// 替换几个重要字段
psndocVO = replaceMainFields(psndocVO);
} catch (Exception e) {
// TODO: handle exception
throw new BusinessException(e.getMessage());
}
return new PsnInfDAO().insertTable_NOTAlwaysNewPK("hi_psndoc_ref", psndocVO, "pk_psndoc");
}
/**
* 批量插入HI_PSNDOC_REF数据
*
* @param psndocVO
* @return
* @throws java.io.IOException
* @throws java.sql.SQLException
*/
public void insertHiRefs(GeneralVO[] psndocVOs) throws BusinessException {
try {
PsnInfDAO dao = new PsnInfDAO();
PsnInfDMO dmo = new PsnInfDMO();
for (GeneralVO psndocVO:psndocVOs){
String oldpk_psndoc = dmo.getOldPsnDocPKOfRef(psndocVO);
psndocVO.setAttributeValue("pk_psndoc", oldpk_psndoc);
// 替换几个重要字段
psndocVO = replaceMainFields(psndocVO);
dao.insertTable_NOTAlwaysNewPK("hi_psndoc_ref", psndocVO, "pk_psndoc");
}
} catch (Exception e) {
throw new BusinessException(e.getMessage());
}
}
/**
* 批量插入HI_PSNDOC_REF数据
*
* @param psndocVO
* @return
* @throws java.io.IOException
* @throws java.sql.SQLException
*/
public void insertPsndocs(GeneralVO[] psndocVOs) throws BusinessException {
try {
PsnInfDMO dmo = new PsnInfDMO();
PsnInfDAO dao = new PsnInfDAO();
for (GeneralVO psndocVO:psndocVOs){
String oldpk_psndoc = dmo.getOldPsnDocPKOfRef(psndocVO);
psndocVO.setAttributeValue("pk_psndoc", oldpk_psndoc);
if(oldpk_psndoc!=null){//如果原来引用过,再直接插入原pk必定报主键冲突,因此现将原已取消引用的记录删除。
deletePsnData("bd_psndoc",oldpk_psndoc);
}
dao.insertTable_NOTAlwaysNewPK("bd_psndoc", psndocVO, "pk_psndoc");
}
} catch (Exception e) {
throw new BusinessException(e.getMessage());
}
}
/**
* 替换几个重要字段 {公司、部门和岗位}
*
* @param psndocVO
* @return
* @throws java.io.IOException
* @throws java.sql.SQLException
*/
private GeneralVO replaceMainFields(GeneralVO psndocVO)
throws java.io.IOException, java.sql.SQLException {
String pk_psndoc = (String) psndocVO.getAttributeValue("oripk_psndoc");
String sql = "SELECT bd_psndoc.pk_corp,bd_corp.unitname ,bd_psndoc.pk_deptdoc,bd_deptdoc.deptname ,bd_psndoc.pk_om_job,om_job.jobname from bd_psndoc "
+ " left outer join bd_corp on bd_psndoc.pk_corp = bd_corp.pk_corp "
+ " left outer join bd_deptdoc on bd_psndoc.pk_deptdoc = bd_deptdoc.pk_deptdoc "
+ " left outer join om_job on bd_psndoc.pk_om_job = om_job.pk_om_job "
+ " where bd_psndoc.pk_psndoc = ? ";
Connection conn = null;
PreparedStatement stmt = null;
ResultSet rs = null;
try {
conn = getConnection();
stmt = conn.prepareStatement(sql);
stmt.setString(1, pk_psndoc);
rs = stmt.executeQuery();
while (rs.next()) {
psndocVO.setAttributeValue("oripk_corp", rs.getString(1));
psndocVO.setAttributeValue("oriunitname", rs.getString(2));
psndocVO.setAttributeValue("oripk_deptdoc", rs.getString(3));
psndocVO.setAttributeValue("orideptname", rs.getString(4));
psndocVO.setAttributeValue("oripk_om_job", rs.getString(5));
psndocVO.setAttributeValue("orijobname", rs.getString(6));
}
} finally {
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
return psndocVO;
}
public String insertRecievers(String pk_corp,String userids,int sendtype)
throws java.sql.SQLException {
String sql = "insert into hr_message (pk_message,pk_corp ,recieveruserids,sendtype) values(?,?,?,?)";
Connection conn = null;
PreparedStatement stmt = null;
String key = null;
try {
conn = getConnection();
stmt = conn.prepareStatement(sql);
key = getOID();
stmt.setString(1, key);
stmt.setString(2, pk_corp);
stmt.setString(3, userids);
stmt.setInt(4, sendtype);
stmt.executeUpdate();
} finally {
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
return key;
}
/**
*
* @param pk_corp
* @param userids
* @throws java.sql.SQLException
*/
public void updateRecievers(String pk_corp,String userids,int sendtype)
throws java.sql.SQLException {
String sql = "update hr_message set recieveruserids = ?,sendtype =? where pk_corp = ? ";
Connection conn = null;
PreparedStatement stmt = null;
try {
conn = getConnection();
stmt = conn.prepareStatement(sql);
stmt.setString(1, userids);
stmt.setInt(2, sendtype);
stmt.setString(3, pk_corp);
stmt.executeUpdate();
} finally {
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
}
/**
*
* @param pk_corp
* @return
* @throws java.sql.SQLException
*/
public boolean isExistRecievers(String pk_corp)
throws java.sql.SQLException {
String sql = "select pk_message from hr_message where pk_corp =?";
Connection conn = null;
PreparedStatement stmt = null;
ResultSet rs = null;
boolean exist = false;
try {
conn = getConnection();
stmt = conn.prepareStatement(sql);
stmt.setString(1, pk_corp);
rs = stmt.executeQuery();
while (rs.next()) {
exist = true;
}
} finally {
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
return exist;
}
/**
* 插入表table信息。 创建日期:(2004-5-20 13:43:57)
*
* @param table
* java.lang.String
* @param data
* nc.vo.hi.hi_301.GeneralVO
* @throws NamingException
* @exception java.io.IOException
* 异常说明。
* @exception java.sql.SQLException
* 异常说明。
*/
public String insertTable(String tableCode, GeneralVO data,
String primaryKey) throws BusinessException, NamingException {
PsnInfDAO dao = new PsnInfDAO();
return dao.insertTable(tableCode, data, primaryKey);
}
/**
* 转入人员档案。 创建日期:(2004-5-25 11:57:17)
*
* @param psnList
* nc.vo.hi.hi_301.GeneralVO[]
* @exception java.sql.SQLException
* 异常说明。
*/
public void intoDoc(GeneralVO[] psnList) throws java.sql.SQLException {
/** ********************************************************** */
// 保留的系统管理接口:
beforeCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "intoDoc",new Object[] { psnList });
/** ********************************************************** */
Connection conn = null;
Statement stmt = null;
try {
if (psnList == null || psnList.length == 0)
return;
conn = getConnection();
stmt = conn.createStatement();
for (int i = 0; i < psnList.length; i++) {
String pk_psndoc = (String) psnList[i].getFieldValue("pk_psndoc");
String sql = "update bd_psndoc set indocflag='Y' where pk_psndoc='"+ pk_psndoc + "'";
sql = HROperatorSQLHelper.getSQLWithOperator(sql);
stmt.executeUpdate(sql);
nc.bs.bd.cache.CacheProxy.fireDataUpdated("bd_psndoc", pk_psndoc);
}
} finally {
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
/** ********************************************************** */
// 保留的系统管理接口:
afterCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "intoDoc",
new Object[] { psnList });
/** ********************************************************** */
}
/**
* 转入人员档案。 创建日期:(2004-5-25 11:57:17)
*
* @param psnList
* nc.vo.hi.hi_301.GeneralVO[]
* @exception java.sql.SQLException
* 异常说明。
*/
public void intoDocBas(GeneralVO[] psnList) throws java.sql.SQLException {
/** ********************************************************** */
// 保留的系统管理接口:
beforeCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "intoDocBas",new Object[] { psnList });
/** ********************************************************** */
Connection conn = null;
Statement stmt = null;
try {
if (psnList == null || psnList.length == 0)
return;
conn = getConnection();
stmt = conn.createStatement();
for (int i = 0; i < psnList.length; i++) {
String pk_psnbasdoc = (String) psnList[i].getFieldValue("pk_psnbasdoc");
String sql = "update bd_psnbasdoc set indocflag='Y',approveflag =1 where pk_psnbasdoc='"+ pk_psnbasdoc + "'";
sql = HROperatorSQLHelper.getSQLWithOperator(sql);
stmt.executeUpdate(sql);
nc.bs.bd.cache.CacheProxy.fireDataUpdated("bd_psnbasdoc", pk_psnbasdoc);
}
} finally {
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
/** ********************************************************** */
// 保留的系统管理接口:
afterCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "intoDocBas",
new Object[] { psnList });
/** ********************************************************** */
}
/**
* 在信息采集模块,当身份证号和姓名重复时,返回存在的人员信息
*
* @param psnname
* @param id
* @return
* @throws java.sql.SQLException
*/
public GeneralVO queryExistedPsnInfo(String psnname, String id)
throws java.sql.SQLException {
/** ********************************************************** */
// 保留的系统管理接口:
beforeCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "queryExistedPsnInfo",
new Object[] { psnname, id });
/** ********************************************************** */
GeneralVO psnvo = null;
Connection conn = null;
PreparedStatement stmt = null;
ResultSet result = null;
try {
String sql = " select bd_psndoc.psncode,bd_deptdoc.deptname,om_job.jobname from bd_psndoc "
+ " left outer join bd_deptdoc on bd_deptdoc.pk_deptdoc = bd_psndoc.pk_deptdoc "
+ " left outer join om_job on om_job.pk_om_job = bd_psndoc.pk_om_job "
+ " where bd_psndoc.psnname = ? "
+ " and bd_psndoc.pk_psndoc in (select pk_psndoc from bd_accpsndoc where id =?) ";
conn = getConnection();
stmt = conn.prepareStatement(sql);
stmt.setString(1, psnname);
stmt.setString(2, id);
result = stmt.executeQuery();
// Vector v = new Vector();
if (result.next()) {
psnvo = new GeneralVO();
String psncode = result.getString(1);
String deptname = result.getString(2);
String jobname = result.getString(3);
psnvo.setAttributeValue("psncode", psncode);
psnvo.setAttributeValue("deptname", deptname);
psnvo.setAttributeValue("jobname", jobname);
}
} finally {
if (result != null)
result.close();
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
/** ********************************************************** */
// 保留的系统管理接口:
afterCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "queryExistedPsnInfo",
new Object[] { psnname, id });
/** ********************************************************** */
return psnvo;
}
/**
* 从hi_flddict何hi_setdic表中查询bd_accpsndoc中字段acc_fldcode的关联字段。 创建日期:(2004-5-30
* 15:00:59)
*
* @return java.lang.String 返回"表名,字段,辅助信息集字段"的数组
* @param acc_fldcode
* java.lang.String
* @exception java.sql.SQLException
* 异常说明。
*/
public GeneralVO[] queryAllRelatedTableField(String corppk)
throws java.sql.SQLException {
Connection conn = null;
Statement stmt = null;
ResultSet result = null;
try {
String sql = "select hi_setdict.setcode, hi_flddict.fldcode, temp1.fldcode as accfldcode,temp2.setcode as accsetcode from hi_flddict "
+ "inner join hi_setdict on hi_flddict.pk_setdict=hi_setdict.pk_setdict "
+ "inner join hi_flddict as temp1 on hi_flddict.bdfldpk=temp1.pk_flddict "
+ " inner join hi_setdict as temp2 on temp1.pk_setdict = temp2.pk_setdict "
+ "where hi_flddict.bdfldpk in "
+ "(select pk_flddict from hi_flddict "
+ "inner join hi_setdict on hi_flddict.pk_setdict=hi_setdict.pk_setdict "
+ "where hi_setdict.setcode='bd_psndoc' or hi_setdict.setcode='bd_psnbasdoc' )";// bd_accpsndoc
if (corppk != null && corppk.length() > 0) {
sql += " and (hi_flddict.create_pk_corp = '" + corppk
+ "' or hi_flddict.isshare = 'Y' )";
}
conn = getConnection();
stmt = conn.createStatement();
result = stmt.executeQuery(sql);
Vector v = new Vector();
while (result.next()) {
GeneralVO gvo = new GeneralVO();
String setcode = result.getString(1);
setcode = setcode == null ? null : setcode.trim();
gvo.setAttributeValue("setcode", setcode);
String fldcode = result.getString(2);
fldcode = fldcode == null ? null : fldcode.trim();
gvo.setAttributeValue("fldcode", fldcode);
String accfldcode = result.getString(3);
String accsetcode = result.getString(4);
accfldcode = (accfldcode == null ? null
: (accsetcode + "." + accfldcode.trim()));
gvo.setAttributeValue("accfldcode", accfldcode);
v.addElement(gvo);
}
return (GeneralVO[]) v.toArray(new GeneralVO[0]);
} finally {
if (result != null)
result.close();
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
}
/**
* 查询所有pk_corp地子表。 创建日期:(2004-5-19 10:51:02)
*
* @return java.lang.String[]
* @param pk_corp
* java.lang.String
* @exception java.sql.SQLException
* 异常说明。
*/
public String[] queryAllSubTable(String pk_corp)
throws java.sql.SQLException {
Connection conn = null;
Statement stmt = null;
ResultSet result = null;
try {
// modify 2008-3-21 remove " and ts < '2004-06-21 14:12:21'"
String sql = "select setcode from hi_setdict where (pk_corp='0001' or pk_corp='"
+ pk_corp
+ "') and ismainset='N' and pk_hr_defdoctype='00000000000000000004' ";
conn = getConnection();
stmt = conn.createStatement();
result = stmt.executeQuery(sql);
Vector v = new Vector();
while (result.next()) {
String tableCode = result.getString(1);
if (tableCode != null && !"bd_corp".equalsIgnoreCase(tableCode) && !"bd_deptdoc".equalsIgnoreCase(tableCode))
v.addElement(tableCode);
}
return (String[]) v.toArray(new String[0]);
} finally {
if (result != null)
result.close();
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
}
/**
* 根据sql查询所有的信息。 创建日期:(2004-5-9 21:12:06)
*
* @return nc.vo.hi.hi_301.GeneralVO[]
* @param sql
* java.lang.String
* @exception java.lang.Exception
* 异常说明。
*/
public GeneralVO[] queryBySql(String sql) throws java.lang.Exception {
return (GeneralVO[]) querySql(sql).toArray(new GeneralVO[0]);
}
/**
* 根据sql查询所有的信息。 创建日期:(2004-5-9 21:12:06)
*
* @return nc.vo.hi.hi_301.GeneralVO[]
* @param sql
* java.lang.String
* @exception java.lang.Exception
* 异常说明。
*/
public GeneralVO[] queryBySqlForQuery(String sql) throws java.lang.Exception {
if(getDataBaseType()!=ORACLE){
String newsql = "";
//内层select
String truesql = sql.substring(sql.indexOf("(")+1,sql.lastIndexOf(")"));
//外层select
String topsql = sql.substring(0,sql.indexOf("("));
String num = topsql.substring(topsql.indexOf("top")+3, topsql.indexOf("*"));
//有distinct情况
if(truesql.indexOf("distinct")>0 && truesql.indexOf("distinct")<20 ){
newsql = " select distinct top "+num+" "+truesql.substring(truesql.indexOf("distinct")+8);
}else{
newsql = " select top "+num+" "+truesql.substring(truesql.indexOf("select")+6);
}
return (GeneralVO[]) querySql(newsql).toArray(new GeneralVO[0]);
}
return (GeneralVO[]) querySql(sql).toArray(new GeneralVO[0]);
}
/**
* 根据sql查询所有的信息。 创建日期:(2004-5-9 21:12:06)
*
* @return nc.vo.hi.hi_301.GeneralVO[]
* @param sql
* java.lang.String
* @exception java.lang.Exception
* 异常说明。
*/
public int queryRecordCountBySql(String sql) throws java.lang.Exception {
int count = 0;
Connection conn = null;
Statement stmt = null;
ResultSet result = null;
try {
conn = getConnection();
stmt = conn.createStatement();
result = stmt.executeQuery(sql);
while (result.next()) {
count = result.getInt(1);
}
} finally {
if (result != null)
result.close();
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
return count;
}
/**
* 此处插入方法描述。 创建日期:(2004-5-31 15:46:52)
*
* @return java.util.Vector
* @param sql
* java.lang.String
*/
public Vector querySql(String sql) throws java.sql.SQLException,
java.io.IOException {
Connection conn = null;
//Statement stmt = null;
CrossDBPreparedStatement prestmt = null;
CrossDBResultSet result = null;
CrossDBResultSetMetaData meta = null;
//ResultSet result = null;
// ResultSetMetaData meta = null;
boolean isPsnbas = false;// 是否查询人员基本情况
if (sql.indexOf("select * from bd_psnbasdoc where") >= 0) {
isPsnbas = true;
}
try {
conn = getConnection();
prestmt = (CrossDBPreparedStatement)conn.prepareStatement(sql);
result = (CrossDBResultSet)prestmt.executeQuery();
meta = (CrossDBResultSetMetaData)result.getMetaData();
String[] fieldNames = new String[meta.getColumnCount()];
int[] fieldTypes = new int[fieldNames.length];
for (int i = 0; i < fieldNames.length; i++) {
fieldNames[i] = meta.getColumnName(i + 1).toLowerCase();
fieldTypes[i] = meta.getColumnType(i + 1);
}
Vector v = new Vector();
while (result.next()) {
GeneralVO gvo = new GeneralVO();
for (int i = 0; i < fieldNames.length; i++) {
if (BSUtil.isBinary(fieldTypes[i])) { // 如果是blob类型
byte[] data = result.getBlobBytes(i+1);
gvo.setFieldValue(fieldNames[i], data);
} else if (!BSUtil.isSkipField(fieldNames[i])) {
Object value = result.getObject(i + 1);
if (value != null) {
if (value instanceof String)
value = ((String) value).trim();
if (isPsnbas
&& fieldNames[i]
.equalsIgnoreCase("pk_corp")) {
gvo.setFieldValue("belong_pk_corp", value);
} else {
gvo.setFieldValue(fieldNames[i], value);
}
}
} else
result.getObject(i + 1);
}
if (gvo.getAttributeValue("pk_corp") == null
&& gvo.getAttributeValue("man_pk_corp") != null) {
gvo.setAttributeValue("pk_corp", gvo
.getAttributeValue("man_pk_corp"));
}
v.addElement(gvo);
}
return v;
} finally {
if (meta != null)
meta = null;
if (result != null)
result.close();
if (prestmt != null)
prestmt.close();
if (conn != null)
conn.close();
}
}
/**
* 此处插入方法描述。 创建日期:(2004-7-1 16:14:26)
*
* @param vos
* nc.vo.hi.hi_301.GeneralVO[]
* @param isPsnToDeptChg
* java.lang.Boolean true:人员情况到任职情况同步,false:任职情况到部门情况同步
* @exception java.sql.SQLException
* 异常说明。
* @exception nc.bs.pub.SystemException
* 异常说明。
*/
public void synchroDeptChg(GeneralVO[] vos, Boolean isPsnToDeptChg)
throws java.sql.SQLException, nc.bs.pub.SystemException {
/** ********************************************************** */
// 保留的系统管理接口:
beforeCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "synchroDeptChg",
new Object[] { vos, isPsnToDeptChg });
/** ********************************************************** */
String sql = "";
String sql2 = "";
String sql3 = "";
String sql4 = "";
if (isPsnToDeptChg.booleanValue()) {
sql = "update hi_psndoc_deptchg set pk_deptdoc = ? ,pk_psncl=?,pk_jobrank=?,pk_jobserial=?,pk_om_duty=?,pk_detytype=?,pk_postdoc=? where pk_psndoc = ? and recordnum = 0 and jobtype= 0 ";
sql2 = "select pk_psndoc_sub,enddate,begindate from hi_psndoc_deptchg where pk_psndoc = ? and jobtype= 0 order by recordnum asc ";
sql3 = "update hi_psndoc_deptchg set begindate=? where pk_psndoc_sub = ?";
} else {
sql = "update bd_psndoc set pk_deptdoc = ? ,pk_psncl = ?, pk_om_job = ? ,psnclscope = (select psnclscope from bd_psncl where pk_psncl= ?),jobrank=? ,jobseries = ?, dutyname=?,series=? where pk_psndoc = ?";
sql3 = "select max(recordnum) from hi_psndoc_deptchg where pk_psndoc = ?";
sql4 = "update bd_psndoc set indutydate=? where pk_psndoc = ?";
}
Connection con = null;
PreparedStatement stmt = null;
try {
con = getConnection();
if (isPsnToDeptChg.booleanValue()) { // 同步到任职情况
stmt = con.prepareStatement(sql);
stmt.setString(1, (String) vos[0].getFieldValue("pk_deptdoc"));
stmt.setString(2, (String) vos[0].getFieldValue("pk_psncl"));
stmt.setString(3, (String) vos[0].getFieldValue("jobrank"));// V35
// fixed
// 1-->0
stmt.setString(4, (String) vos[0].getFieldValue("jobseries"));// V35
// fixed
// 1-->0
stmt.setString(5, (String) vos[0].getFieldValue("dutyname"));// V35
// fixed
// 1-->0
stmt.setString(6, (String) vos[0].getFieldValue("series"));// V35
// fixed
// 1-->0
stmt.setString(7, (String) vos[0].getFieldValue("pk_om_job"));
stmt.setString(8, (String) vos[0].getFieldValue("pk_psndoc"));
stmt.executeUpdate();
stmt.close();
if (vos[0].getAttributeValue("isSynIndutydate") != null
&& "Y".equals(((String) vos[0]
.getAttributeValue("isSynIndutydate")))) {// 到职日期是否同步的标记
if (vos[0].getFieldValue("indutydate") != null) {
// 查询任职信息
stmt = con.prepareStatement(sql2);
stmt.setString(1, (String) vos[0]
.getFieldValue("pk_psndoc"));
ResultSet rs = stmt.executeQuery();
Vector v = new Vector();
while (rs.next()) {
Vector v2 = new Vector();
v2.addElement(rs.getString(1));
v2.addElement(rs.getString(2));
v2.addElement(rs.getString(3));
v.addElement(v2);
}
stmt.close();
if (v.size() > 0) {
Vector temp = (Vector) v.elementAt(v.size() - 1);
String pk = (String) temp.elementAt(0);
String indutydate = vos[0].getFieldValue(
"indutydate").toString();
// Object obj = temp.elementAt(1);
Object begindate = temp.elementAt(2);
if (begindate == null) {// 只有全为空时同步,如果开始日期不为空,则不用同步
// 更新最后一条的起止日期
stmt = con.prepareStatement(sql3);
stmt.setString(1, indutydate);
stmt.setString(2, pk);
stmt.executeUpdate();
}
}
}
}
} else { // 从任职情况同步到人员情况
Object obj = vos[0].getFieldValue("recordnum");
int recordnum = ((Integer) obj).intValue();
if (recordnum == 0) {
stmt = con.prepareStatement(sql);
stmt.setString(1, (String) vos[0]
.getFieldValue("pk_deptdoc"));
stmt
.setString(2, (String) vos[0]
.getFieldValue("pk_psncl"));
stmt.setString(3, (String) vos[0]
.getFieldValue("pk_postdoc"));
stmt
.setString(4, (String) vos[0]
.getFieldValue("pk_psncl"));
// stmt.setString(5, (String) vos[0]
// .getFieldValue("pk_psndoc"));
// stmt.executeUpdate();
// nc.bs.bd.cache.CacheProxy.fireDataUpdated("bd_psndoc",
// (String) vos[0].getFieldValue("pk_psndoc"));//wangkf
// // add
// stmt.close();
// stmt = con.prepareStatement(sql2);
stmt.setString(5, (String) vos[0]
.getFieldValue("pk_jobrank"));
stmt.setString(6, (String) vos[0]
.getFieldValue("pk_jobserial"));
stmt.setString(7, (String) vos[0]
.getFieldValue("pk_om_duty"));
stmt.setString(8, (String) vos[0]
.getFieldValue("pk_detytype"));
stmt.setString(9, (String) vos[0]
.getFieldValue("pk_psndoc"));
stmt.executeUpdate();
stmt.close();
}
// 得到最后一条记录的记录序号
stmt = con.prepareStatement(sql3);
stmt.setString(1, (String) vos[0].getFieldValue("pk_psndoc"));
ResultSet rs = stmt.executeQuery();
int max = 0;
if (rs.next()) {
max = rs.getInt(1);
}
// 把最后一条记录的开始日期同步到辅表的入职日期
Object lastObj = vos[vos.length - 1].getFieldValue("recordnum");
int lastrecordnum = ((Integer) lastObj).intValue();
if (lastrecordnum == max) {
stmt.close();
stmt = con.prepareStatement(sql4);
if (vos[vos.length - 1].getFieldValue("begindate") != null) {
stmt.setString(1, vos[vos.length - 1].getFieldValue(
"begindate").toString());
} else {
stmt.setNull(1, Types.CHAR);
}
stmt.setString(2, (String) vos[vos.length - 1]
.getFieldValue("pk_psndoc"));
stmt.executeUpdate();
}
}
} finally {
try {
if (stmt != null) {
stmt.close();
}
} catch (Exception e) {
}
try {
if (con != null) {
con.close();
}
} catch (Exception e) {
}
}
/** ********************************************************** */
// 保留的系统管理接口:
afterCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "synchroDeptChg",
new Object[] { vos, isPsnToDeptChg });
/** ********************************************************** */
}
/**
*
* @param pk_psndoc
* @throws java.sql.SQLException
* @throws nc.bs.pub.SystemException
*/
public void synchroPart(String pk_psndoc) throws java.sql.SQLException,
nc.bs.pub.SystemException {
String sql = "update hi_psndoc_deptchg set bendflag='Y' where pk_psndoc = ? and jobtype <> 0 ";
Connection con = null;
PreparedStatement stmt = null;
try {
con = getConnection();
stmt = con.prepareStatement(sql);
stmt.setString(1, pk_psndoc);
stmt.executeUpdate();
} finally {
try {
if (stmt != null) {
stmt.close();
}
} catch (Exception e) {
}
try {
if (con != null) {
con.close();
}
} catch (Exception e) {
}
}
}
/**
* 此处插入方法描述。 创建日期:(2004-7-1 15:45:49)
*
* @param tableCode
* java.lang.String
* @param fldCode
* java.lang.String[]
* @param type
* java.lang.String[]
* @exception java.sql.SQLException
* 异常说明。
*/
public void updateDept(String psnpk, String deptpk, Boolean flag)
throws java.sql.SQLException {
/** ********************************************************** */
// 保留的系统管理接口:
beforeCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "updateDept",
new Object[] { psnpk, deptpk, flag });
/** ********************************************************** */
String sql = "";
if (flag.booleanValue()) {
sql = "update bd_psndoc set pk_deptdoc = ? where pk_psndoc = ?";
} else {
sql = "update hi_psndoc_deptchg set pk_deptdoc = ? where pk_psndoc = ? and recordnum = 0";
}
Connection con = null;
PreparedStatement stmt = null;
try {
con = getConnection();
stmt = con.prepareStatement(sql);
stmt.setString(1, deptpk);
stmt.setString(2, psnpk);
stmt.executeUpdate();
} finally {
try {
if (stmt != null) {
stmt.close();
}
} catch (Exception e) {
}
try {
if (con != null) {
con.close();
}
} catch (Exception e) {
}
}
/** ********************************************************** */
// 保留的系统管理接口:
afterCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "updateDept",
new Object[] { psnpk, deptpk, flag });
/** ********************************************************** */
}
/**
*
* @param pk_psndoc
* @param ifdelete
* @throws java.sql.SQLException
* @throws java.io.IOException
*/
public void updateDeleteFlag(String pk_psndoc, boolean ifdelete)
throws java.sql.SQLException, java.io.IOException {
String sql = "";
if (ifdelete) {
sql = "update bd_psndoc set dr = 1 where pk_psndoc = ? ";
} else {
sql = "update bd_psndoc set dr = 0 where pk_psndoc = ? ";
}
Connection conn = null;
PreparedStatement stmt = null;
ResultSet rs = null;
try {
conn = getConnection();
stmt = conn.prepareStatement(sql);
stmt.setString(1, pk_psndoc);
stmt.executeUpdate();
} finally {
if (rs != null)
rs.close();
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
}
/**
* 更新指定表信息,更新条件sqlWhere
*
* @param tableCode
* @param data
* @param sqlWhere
* @throws NamingException
* @throws java.sql.SQLException
* @throws java.io.IOException
*/
public void updateTable(String tableCode, GeneralVO data, String sqlWhere)
throws DAOException, NamingException {
PsnInfDAO dao = new PsnInfDAO();
dao.updateTable(tableCode, data, sqlWhere);
}
/**
* 执行sql语句检查是否存在记录
* @param sql
* @return
* @throws SQLException
*/
public boolean isRecordExist(String sql)throws SQLException{
boolean result = false;
Connection con = null;
PreparedStatement stmt = null;
try {
con = getConnection();
//String sql = "select 1 from sm_userandclerk where pk_psndoc = ? and pk_corp = ?";
stmt = con.prepareStatement(sql);
//stmt.setString(1, pk_psndoc);
//stmt.setString(2, pkCorp);
ResultSet rs = stmt.executeQuery();
if (rs.next()) {
result = true;
}
} finally {
try {
if (stmt != null) {
stmt.close();
}
} catch (Exception e) {
}
try {
if (con != null) {
con.close();
}
} catch (Exception e) {
}
}
return result;
}
/**
* 检查业务子集是否允许查看历史
* @param sql
* @return
* @throws SQLException
*/
public boolean isTraceTableLookHistory(String tablename)throws SQLException{
boolean result = false;
String sql = "select islookhistory from hi_setdict where setcode =?";
Connection con = null;
PreparedStatement stmt = null;
try {
con = getConnection();
stmt = con.prepareStatement(sql);
stmt.setString(1, tablename);
ResultSet rs = stmt.executeQuery();
if (rs.next()) {
String look = rs.getString(1);
if(look!= null && look.equalsIgnoreCase("Y")){
result = true;
}else{
result = false;
}
}
} finally {
try {
if (stmt != null) {
stmt.close();
}
} catch (Exception e) {
}
try {
if (con != null) {
con.close();
}
} catch (Exception e) {
}
}
return result;
}
/**
*
* @param pk_psndoc
* @return
* @throws java.sql.SQLException
*/
public boolean isNOtZaizhiPerson(String pk_psndoc)
throws java.sql.SQLException {
String sql = "select 1 from bd_psncl where (psnclscope <>0 and psnclscope <>5 ) and pk_psncl in (select pk_psncl from bd_psndoc where pk_psndoc = ?) ";//
boolean isnotzaizhi = false;
Connection conn = null;
PreparedStatement stmt = null;
ResultSet rs = null;
try {
conn = getConnection();
stmt = conn.prepareStatement(sql);
stmt.setString(1, pk_psndoc);
rs = stmt.executeQuery();
while (rs.next()) {
isnotzaizhi = true;
}
} finally {
if (rs != null)
rs.close();
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
return isnotzaizhi;
}
/**
*
* @param pk_psndoc
* @return
* @throws java.sql.SQLException
*/
public boolean isNOtZaizhiPsnclscope(String pk_psncl)
throws java.sql.SQLException {
String sql = "select 1 from bd_psncl where (psnclscope <>0 and psnclscope <>5 ) and pk_psncl = ? ";//
boolean isnotzaizhi = false;
Connection conn = null;
PreparedStatement stmt = null;
ResultSet rs = null;
try {
conn = getConnection();
stmt = conn.prepareStatement(sql);
stmt.setString(1, pk_psncl);
rs = stmt.executeQuery();
while (rs.next()) {
isnotzaizhi = true;
}
} finally {
if (rs != null)
rs.close();
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
return isnotzaizhi;
}
/**
* 此处插入方法描述。 创建日期:(2004-8-6 11:58:42)
*
* @return boolean
* @param pk_psndoc_sub
* java.lang.String
* @exception java.sql.SQLException
* 异常说明。
*/
public boolean checkPsnSub(String pk_psndoc_sub)
throws java.sql.SQLException {
return false;
}
/**
* 此处插入方法描述。 创建日期:(2004-8-6 11:58:42)
*
* @return boolean
* @param pk_psndoc_sub
* java.lang.String
* @exception java.sql.SQLException
* 异常说明。
*/
public boolean checkPsnSub(String pk_psndoc_sub, String tableCode)
throws java.sql.SQLException {
Connection conn = null;
PreparedStatement stmt = null;
String sql = null;
try {
sql = "select 1 from " + tableCode
+ " where pk_psndoc_sub = ? and dr = 0";
conn = getConnection();
stmt = conn.prepareStatement(sql);
stmt.setString(1, pk_psndoc_sub);
ResultSet rs = stmt.executeQuery();
if (rs.next()) {
return true;
}
} finally {
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
return false;
}
/**
* 判断此员工在本公司是否有用户。 创建日期:(2003-7-17 9:18:22)
*
* @return boolean
* @param pk_psndoc
* java.lang.String
* @param pkCorp
* java.lang.String
*/
public boolean checkUserClerk(String pk_psndoc, String pkCorp)
throws java.sql.SQLException {
boolean bool = true;
Connection con = null;
PreparedStatement stmt = null;
try {
con = getConnection();
String sql = "select 1 from sm_userandclerk where pk_psndoc = ? and pk_corp = ?";
stmt = con.prepareStatement(sql);
stmt.setString(1, pk_psndoc);
stmt.setString(2, pkCorp);
ResultSet rs = stmt.executeQuery();
if (rs.next()) {
bool = false;
}
} finally {
try {
if (stmt != null) {
stmt.close();
}
} catch (Exception e) {
}
try {
if (con != null) {
con.close();
}
} catch (Exception e) {
}
}
return bool;
}
/**
* 查询再聘返聘人员原始的归属公司
* @param pk_psnbasdoc
* @return
* @throws java.sql.SQLException
*/
public String queryOriPkcorp(String pk_psnbasdoc,int hiretype)
throws java.sql.SQLException {
String pk_corp = null;
Connection con = null;
PreparedStatement stmt = null;
try {
con = getConnection();
String sql = "select pk_corp from bd_psndoc where pk_psnbasdoc = ? and psnclscope = ? ";
stmt = con.prepareStatement(sql);
stmt.setString(1, pk_psnbasdoc);
stmt.setInt(2, hiretype);
ResultSet rs = stmt.executeQuery();
if (rs.next()) {
pk_corp = rs.getString(1);
}
} finally {
try {
if (stmt != null) {
stmt.close();
}
} catch (Exception e) {
}
try {
if (con != null) {
con.close();
}
} catch (Exception e) {
}
}
return pk_corp;
}
/**
* 此处插入方法描述。 创建日期:(2004-12-3 16:28:15)
*
* @param tableCode
* java.lang.String
* @param psndocvo
* nc.vo.hi.hi_301.GeneralVO
* @exception java.sql.SQLException
* 异常说明。
*/
public void deletePsndoc(String tableCode, GeneralVO psndocvo)
throws java.sql.SQLException {
/** ********************************************************** */
// 保留的系统管理接口:
beforeCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "delete", new Object[] {
tableCode, psndocvo });
/** ********************************************************** */
String pk_psndoc = (String) psndocvo.getFieldValue("pk_psndoc");
Connection conn = null;
Statement stmt = null;
try {
if (!"bd_psnbasdoc".equalsIgnoreCase(tableCode)) {
String sql = "delete from " + tableCode + " where pk_psndoc='"
+ pk_psndoc + "'";
conn = getConnection();
stmt = conn.createStatement();
stmt.execute(sql);
}
} finally {
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
/** ********************************************************** */
// 保留的系统管理接口:
afterCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "delete", new Object[] {
tableCode, psndocvo });
/** ********************************************************** */
}
/**
* 此处插入方法描述。 创建日期:(2004-10-19 9:40:49)
*
* @return nc.vo.hi.hi_301.CtrlDeptVO
* @param pk_corp
* java.lang.String
* @param funcode
* java.lang.String
* @exception java.sql.SQLException
* 异常说明。
*/
public CtrlDeptVO[] queryCreateCorpChildVOs(String pk_corp, String funcode,
String userid, boolean isRelate) throws java.sql.SQLException {
Connection conn = null;
Statement stmt = null;
PreparedStatement stmt2 = null;
PreparedStatement stmt3 = null;
ResultSet rs = null;
ResultSet rs2 = null;
ResultSet rs3 = null;
CtrlDeptVO[] childvos = null;
try {
String sql = "select bd_corp.pk_corp,unitcode,unitname from bd_corp where bd_corp.fathercorp = '"
+ pk_corp + "' order by unitcode";
String checkcreatecorpsql = "select 1 from sm_createcorp t1 , sm_codetocode t2 where t1.pk_corp = ? and t2.pk_codetocode = 'HI' and t1.funccode = t2.funccode";
String checkrelatesql = "select 1 from sm_user_role where pk_corp = ? and cuserid = '"+ userid + "'";
//v50 修改,此处应改为用户关联的公司,通过角色关联公司
conn = getConnection();
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
Vector v = new Vector();
while (rs.next()) {
CtrlDeptVO vo = new CtrlDeptVO();
vo.setPk_corp(rs.getString(1));
vo.setCode(rs.getString(2));
vo.setName(rs.getString(3));
vo.setControlled(true);
vo.setNodeType(CtrlDeptVO.CORP);
v.addElement(vo);
}
stmt.close();
for (int i = v.size() - 1; i >= 0; i--) {
CtrlDeptVO vo = (CtrlDeptVO) v.elementAt(i);
stmt2 = conn.prepareStatement(checkcreatecorpsql);
stmt2.setString(1, vo.getPk_corp());
rs2 = stmt2.executeQuery();
if (!rs2.next()) {
CtrlDeptVO tvo = (CtrlDeptVO) v.elementAt(i);
tvo.setControlled(false);
stmt2.close();
continue;
} else {
stmt2.close();
}
if (isRelate) {
stmt3 = conn.prepareStatement(checkrelatesql);
stmt3.setString(1, vo.getPk_corp());
rs3 = stmt3.executeQuery();
if (!rs3.next()) {
CtrlDeptVO tvo = (CtrlDeptVO) v.elementAt(i);
tvo.setControlled(false);
}
stmt3.close();
}
}
if (v.size() > 0) {
childvos = new CtrlDeptVO[v.size()];
v.copyInto(childvos);
}
return childvos;
} finally {
// if (rs != null)
// rs.close();
if (stmt != null)
stmt.close();
// if(rs2 !=null)
// rs2.close();
if (stmt2 != null)
stmt2.close();
if (isRelate) {
// if(rs3 !=null)
// rs3.close();
if (stmt3 != null)
stmt3.close();
}
if (conn != null)
conn.close();
}
}
/**
* 任职情况增加新纪录时,如果上一条记录的结束日期为空则更新为当前记录的起始日期的前一天。 创建日期:(2004-8-6 9:05:56)
*
* @param pk_psndoc
* java.lang.String
* @param newDate
* nc.vo.pub.lang.UFDate
*/
public void synchroDeptChgEnddate(String pk_psndoc, UFDate newDate)
throws SQLException {
/** ********************************************************** */
// 保留的系统管理接口:
beforeCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "synchroDeptChgEnddate",
new Object[] { pk_psndoc, newDate });
/** ********************************************************** */
if (newDate == null)
return;
String sql = " update hi_psndoc_deptchg set enddate = ? where pk_psndoc = ? and (enddate is null or ltrim(rtrim(enddate))= '') and dr =0 and recordnum=1 and jobtype=0 ";
Connection con = null;
PreparedStatement stmt = null;
try {
con = getConnection();
stmt = con.prepareStatement(sql);
stmt = con.prepareStatement(sql);
stmt.setString(1, newDate.toString());
stmt.setString(2, pk_psndoc);
stmt.executeUpdate();
} finally {
try {
if (stmt != null) {
stmt.close();
}
} catch (Exception e) {
}
try {
if (con != null) {
con.close();
}
} catch (Exception e) {
}
}
/** ********************************************************** */
// 保留的系统管理接口:
afterCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "synchroDeptChgEnddate",
new Object[] { pk_psndoc, newDate });
/** ********************************************************** */
}
/**
* 任职情况增加新纪录时,如果上一条记录的结束日期为空则更新为当前记录的起始日期的前一天。 创建日期:(2004-8-6 9:05:56)
*
* @param pk_psndoc
* java.lang.String
* @param newDate
* nc.vo.pub.lang.UFDate
*/
public void updateBasCorpPk(String pk_psnbasdoc,String pk_corp)
throws SQLException {
/** ********************************************************** */
// 保留的系统管理接口:
beforeCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "updateBasCorpPk",
new Object[] { pk_psnbasdoc,pk_corp });
/** ********************************************************** */
String sql = " update bd_psnbasdoc set pk_corp = ? where pk_psnbasdoc = ? ";
Connection con = null;
PreparedStatement stmt = null;
try {
con = getConnection();
stmt = con.prepareStatement(sql);
stmt = con.prepareStatement(sql);
stmt.setString(1, pk_corp);
stmt.setString(2, pk_psnbasdoc);
stmt.executeUpdate();
// }
} finally {
try {
if (stmt != null) {
stmt.close();
}
} catch (Exception e) {
}
try {
if (con != null) {
con.close();
}
} catch (Exception e) {
}
}
/** ********************************************************** */
// 保留的系统管理接口:
afterCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "updateBasCorpPk",
new Object[] { pk_psnbasdoc,pk_corp });
/** ********************************************************** */
}
/**
* 同步人员标志表,从客户化采集的人员没有插入这个表的数据。 创建日期:(2004-8-23 10:36:59)
*
* @exception java.sql.SQLException
* 异常说明。
*/
public void synchroPsnFlag() throws java.sql.SQLException {
Connection conn = null;
PreparedStatement stmt = null;
String sql = null;
String sql2 = null;
String sql3 = null;
Vector v = new Vector();
try {
sql = "select pk_psndoc from bd_psndoc where pk_psndoc not in (select pk_psndoc from hi_psndoc_flag)";
sql2 = "insert into hi_psndoc_flag(pk_psndoc,showorder) values (?,99)";
sql3 = "update hi_psndoc_flag set regular = 'Y' where regular<>'N' or regular is null";
conn = getConnection();
stmt = conn.prepareStatement(sql);
ResultSet rs = stmt.executeQuery();
while (rs.next()) {
v.addElement(rs.getString(1));
}
if (v.size() > 0) {
stmt.close();
for (int i = 0; i < v.size(); i++) {
stmt = conn.prepareStatement(sql2);
stmt.setString(1, (String) v.elementAt(i));
stmt.executeUpdate();
}
}
stmt.close();
stmt = conn.prepareStatement(sql3);
stmt.executeUpdate();
} finally {
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
}
/**
* 此处插入方法描述。 创建日期:(2004-9-8 16:53:26)
*
* @param pk_psndoc
* java.lang.String
* @exception java.sql.SQLException
* 异常说明。
*/
public void updateCtrt(String pk_psndoc, Boolean isAdd)
throws java.sql.SQLException {
/** ********************************************************** */
// 保留的系统管理接口:
beforeCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "updateCtrt",
new Object[] { pk_psndoc, isAdd });
/** ********************************************************** */
String sql = "";
if (isAdd.booleanValue()) {
sql = "update hi_psndoc_ctrt set icontstate = iconttype where pk_psndoc = ? and recordnum >0 and lastflag <> 'Y' and isrefer = 'Y'";
} else {
sql = "update hi_psndoc_ctrt set icontstate = 2 where pk_psndoc = ? and recordnum = 0 and lastflag = 'Y' and iconttype = 1 and isrefer = 'Y'";
}
Connection con = null;
PreparedStatement stmt = null;
try {
con = getConnection();
stmt = con.prepareStatement(sql);
stmt.setString(1, pk_psndoc);
stmt.executeUpdate();
} finally {
try {
if (stmt != null) {
stmt.close();
}
} catch (Exception e) {
}
try {
if (con != null) {
con.close();
}
} catch (Exception e) {
}
}
/** ********************************************************** */
// 保留的系统管理接口:
afterCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "updateCtrt",
new Object[] { pk_psndoc, isAdd });
/** ********************************************************** */
}
/**
* 此处插入方法描述。 创建日期:(2004-9-8 16:53:26)
*
* @param pk_psndoc
* java.lang.String
* @exception java.sql.SQLException
* 异常说明。
*/
public void updateEdu(String pk_psndoc,String pk_psndoc_sub)
throws java.sql.SQLException {
/** ********************************************************** */
// 保留的系统管理接口:
beforeCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "updateEdu",
new Object[] { pk_psndoc,pk_psndoc_sub});
/** ********************************************************** */
String sql = " update hi_psndoc_edu set lasteducation = 'N' where pk_psndoc = ? and pk_psndoc_sub <>?";
Connection con = null;
PreparedStatement stmt = null;
try {
con = getConnection();
stmt = con.prepareStatement(sql);
stmt.setString(1, pk_psndoc);
stmt.setString(2, pk_psndoc_sub);
stmt.executeUpdate();
} finally {
try {
if (stmt != null) {
stmt.close();
}
} catch (Exception e) {
}
try {
if (con != null) {
con.close();
}
} catch (Exception e) {
}
}
/** ********************************************************** */
// 保留的系统管理接口:
afterCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "updateEdu",
new Object[] { pk_psndoc,pk_psndoc_sub});
/** ********************************************************** */
}
/**
* 更新任职信息的“是否在岗”字段,设置最新增加的一条信息的“是否在岗”为ture,其余的为false。
* @param pk_psndoc
* @param pk_psndoc_sub
* @throws SQLException
* fengwei 2009-09-21
*/
public void updatePoststat(String pk_psndoc, String pk_psndoc_sub) throws SQLException {
/** ********************************************************** */
// 保留的系统管理接口:
beforeCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "updatePoststat",
new Object[] { pk_psndoc,pk_psndoc_sub});
/** ********************************************************** */
String sql = " update hi_psndoc_deptchg set poststat = 'N' where pk_psndoc = ? and pk_psndoc_sub <> ? ";
sql = HROperatorSQLHelper.getSQLWithOperator(sql);
Connection con = null;
PreparedStatement stmt = null;
try{
con = getConnection();
stmt = con.prepareStatement(sql);
stmt.setString(1, pk_psndoc);
stmt.setString(2, pk_psndoc_sub);
stmt.executeUpdate();
}finally {
try {
if (stmt != null) {
stmt.close();
}
} catch (Exception e) {
}
try {
if (con != null) {
con.close();
}
} catch (Exception e) {
}
}
/** ********************************************************** */
// 保留的系统管理接口:
afterCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "updatePoststat",
new Object[] { pk_psndoc,pk_psndoc_sub});
/** ********************************************************** */
}
/**
* 修改非业务子集的recordnum
* @param pk_psnbasdoc
* @param Subsetdatas
* @throws java.sql.SQLException
*/
public void updateSubsetRecordnum(String pk_psnbasdoc,String tablecode,CircularlyAccessibleValueObject[] Subsetdatas)throws java.sql.SQLException {
/** ********************************************************** */
// 保留的系统管理接口:
beforeCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "updateSubsetRecordnum",
new Object[] { pk_psnbasdoc, tablecode, Subsetdatas });
/** ********************************************************** */
if(Subsetdatas==null||Subsetdatas.length==0){
return;
}
String sql = "update " +tablecode+" set recordnum = ? where pk_psndoc_sub =? ";
String querysql = "select 1 from hi_setdict where pk_hr_defdoctype ='00000000000000000004' and reccharacter =3 and setcode = '" +tablecode.trim()+"'";
String sql2 = " update "+ tablecode+ " set lastflag = 'Y' where pk_psnbasdoc = ? and dr =0 and recordnum=0";
String sql3 = " update "+ tablecode+ " set lastflag = ? where pk_psnbasdoc = ? and dr =0 and recordnum>0";
Connection con = null;
PreparedStatement stmt = null;
try {
con = getConnection();
stmt = con.prepareStatement(sql);
for(int i=0; i<Subsetdatas.length ;i++){
stmt.setInt(1, (Integer)Subsetdatas[i].getAttributeValue("recordnum"));
stmt.setString(2, (String)Subsetdatas[i].getAttributeValue("pk_psndoc_sub"));
stmt.executeUpdate();
}
stmt.executeBatch();
stmt.close();
// 更新lastflag
stmt = con.prepareStatement(sql2);
stmt.setString(1, pk_psnbasdoc);
stmt.executeUpdate();
stmt.close();
//查询更改的表是否是同期记录,如果是同期记录,则历史记录lastflag改为‘Y’,否则改为‘N’
boolean tongqi = false;
stmt = con.prepareStatement(querysql);
ResultSet rs = stmt.executeQuery();
if(rs.next()){
tongqi = true;
}
stmt.close();
stmt = con.prepareStatement(sql3);
if(tongqi){
stmt.setString(1, "Y");
}else{
stmt.setString(1, "N");
}
stmt.setString(2, pk_psnbasdoc);
stmt.executeUpdate();
stmt.close();
} finally {
try {
if (stmt != null) {
stmt.close();
}
} catch (Exception e) {
}
try {
if (con != null) {
con.close();
}
} catch (Exception e) {
}
}
/** ********************************************************** */
// 保留的系统管理接口:
afterCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "updateSubsetRecordnum",
new Object[] { pk_psnbasdoc, tablecode, Subsetdatas });
/** ********************************************************** */
}
/**
* 更新子表的记录序号 创建日期:(2004-8-6 8:44:51)
*
* @param tableName
* java.lang.String
* @param recordNum
* java.lang.Integer
* @param isAdd
* boolean
* @exception java.sql.SQLException
* 异常说明。
*/
public void updateRecornum(String tableName, String pk_psndoc,
Integer recordNum, Boolean isAdd) throws java.sql.SQLException {
/** ********************************************************** */
// 保留的系统管理接口:
beforeCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "updateRecornum",
new Object[] { tableName, pk_psndoc, recordNum, isAdd });
/** ********************************************************** */
String sql = "";
String sql2 = " update "
+ tableName
+ " set lastflag = 'Y' where pk_psndoc = ? and dr =0 and recordnum=0";
String sql3 = " update "
+ tableName
+ " set lastflag = 'N' where pk_psndoc = ? and dr =0 and recordnum>0";
if (tableName.equalsIgnoreCase("hi_psndoc_part")) {
String temptableName = "hi_psndoc_deptchg";
sql2 = " update "
+ temptableName
+ " set lastflag = 'Y' where pk_psndoc = ? and dr =0 and recordnum=0 and jobtype>0";
} else if (tableName.equalsIgnoreCase("hi_psndoc_deptchg")) {
sql2 = " update "
+ tableName
+ " set lastflag = 'Y' where pk_psndoc = ? and dr =0 and recordnum=0 and jobtype=0";
sql3 = " update "
+ tableName
+ " set lastflag = 'N' where pk_psndoc = ? and dr =0 and recordnum>0 and jobtype=0";
}
if (isAdd.booleanValue()) {
if (tableName.equalsIgnoreCase("hi_psndoc_part")) {
String temptableName = "hi_psndoc_deptchg";
sql = "update "
+ temptableName
+ " set recordnum = recordnum+1 where pk_psndoc = ? and dr =0 and recordnum >= ? and jobtype>0";
} else if (tableName.equalsIgnoreCase("hi_psndoc_deptchg")) {
sql = "update "
+ tableName
+ " set recordnum = recordnum+1 where pk_psndoc = ? and dr =0 and recordnum >= ? and jobtype=0";
} else {
sql = "update "
+ tableName
+ " set recordnum = recordnum+1 where pk_psndoc = ? and dr =0 and recordnum >= ?";
}
} else {
if (tableName.equalsIgnoreCase("hi_psndoc_part")) {
String temptableName = "hi_psndoc_deptchg";
sql = "update "
+ temptableName
+ " set recordnum = recordnum-1 where pk_psndoc = ? and dr =0 and recordnum >= ? and jobtype>0";
} else if (tableName.equalsIgnoreCase("hi_psndoc_deptchg")) {
sql = "update "
+ tableName
+ " set recordnum = recordnum-1 where pk_psndoc = ? and dr =0 and recordnum >= ? and jobtype=0";
} else {
sql = "update "
+ tableName
+ " set recordnum = recordnum-1 where pk_psndoc = ? and dr =0 and recordnum > ?";
}
}
Connection con = null;
PreparedStatement stmt = null;
try {
con = getConnection();
stmt = con.prepareStatement(sql);
stmt.setString(1, pk_psndoc);
stmt.setInt(2, recordNum.intValue());
stmt.executeUpdate();
stmt.close();
// 更新lastflag
stmt = con.prepareStatement(sql2);
stmt.setString(1, pk_psndoc);
stmt.executeUpdate();
stmt.close();
stmt = con.prepareStatement(sql3);
stmt.setString(1, pk_psndoc);
stmt.executeUpdate();
stmt.close();
} finally {
try {
if (stmt != null) {
stmt.close();
}
} catch (Exception e) {
}
try {
if (con != null) {
con.close();
}
} catch (Exception e) {
}
}
/** ********************************************************** */
// 保留的系统管理接口:
afterCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "updateRecornum",
new Object[] { tableName, pk_psndoc, recordNum, isAdd });
/** ********************************************************** */
}
/**
* 此处插入方法描述。 创建日期:(2004-6-5 14:32:47)
*
* @param pk_psndocs
* java.lang.String[]
* @exception java.sql.SQLException
* 异常说明。
*/
public void updateShoworder(String[] pk_psndocs,HashMap psnshoworder)
throws java.sql.SQLException {
if(psnshoworder==null||psnshoworder.size()<0){
return;
}
/** ********************************************************** */
// 保留的系统管理接口:
beforeCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "updateShoworder",
new Object[] { pk_psndocs, psnshoworder });
/** ********************************************************** */
String sqlupdate = "update bd_psndoc set showorder = ? where pk_psndoc = ?";
sqlupdate = HROperatorSQLHelper.getSQLWithOperator(sqlupdate);
Connection con = null;
PreparedStatement stmt = null;
try {
con = getConnection();
stmt = con.prepareStatement(sqlupdate);
for (int i = 0; i < pk_psndocs.length; i++) {
int showorder = 999999;
if(psnshoworder.get(pk_psndocs[i])!=null){
showorder = ((Integer)psnshoworder.get(pk_psndocs[i])).intValue();
}else{
continue;
}
stmt.setInt(1, showorder);
stmt.setString(2, pk_psndocs[i]);
stmt.executeUpdate();
}
stmt.executeBatch();
} finally {
try {
if (stmt != null) {
stmt.close();
}
} catch (Exception e) {
}
try {
if (con != null) {
con.close();
}
} catch (Exception e) {
}
}
/** ********************************************************** */
// 保留的系统管理接口:
afterCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "updateShoworder",
new Object[] { pk_psndocs, psnshoworder });
/** ********************************************************** */
}
/**
* 此处插入方法描述。 创建日期:(2005-03-28 21:03:27)
*
* @param power
* java.lang.String
*/
public String getBillTempletID(String pk_corp, String userid,
String nodecode) throws SQLException {
/** ********************************************************** */
// 保留的系统管理接口:
beforeCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "getBillTempletID",
new Object[] { pk_corp, userid, nodecode });
/** ********************************************************** */
String templateid = "0001AA10000000000B7G";
String sql1 = "select templateid from pub_systemplate where funnode =? and tempstyle = 0 and operator = ? and pk_corp = ?";
String sql2 = "select templateid from pub_systemplate inner join sm_user_rela on groupid = operator where funnode = ? and tempstyle = 0 and userid = ? and pub_systemplate.pk_corp = ?";
String sql3 = "select templateid from pub_systemplate where funnode = ? and (operator ='' or operator is null) and (pk_corp = '@@@@' or pk_corp is null or pk_corp= '' ) and tempstyle = 0 ";
Connection con = null;
PreparedStatement stmt = null;
try {
ResultSet rs = null;
con = getConnection();
stmt = con.prepareStatement(sql1);
stmt.setString(1, nodecode);
stmt.setString(2, userid);
stmt.setString(3, pk_corp);
rs = stmt.executeQuery();
if (rs.next()) {
templateid = rs.getString(1);
return templateid;
}
stmt.close();
// 更新lastflag
stmt = con.prepareStatement(sql2);
stmt.setString(1, nodecode);
stmt.setString(2, userid);
stmt.setString(3, pk_corp);
rs = stmt.executeQuery();
if (rs.next()) {
templateid = rs.getString(1);
return templateid;
}
stmt.close();
stmt = con.prepareStatement(sql3);
stmt.setString(1, nodecode);
rs = stmt.executeQuery();
if (rs.next()) {
templateid = rs.getString(1);
return templateid;
}
} finally {
try {
if (stmt != null) {
stmt.close();
}
} catch (Exception e) {
}
try {
if (con != null) {
con.close();
}
} catch (Exception e) {
}
}
/** ********************************************************** */
// 保留的系统管理接口:
afterCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "getBillTempletID",
new Object[] { pk_corp, userid, nodecode });
/** ********************************************************** */
return templateid;
}
public void synchronAccpsndoc(String regulardata, String pk_psndoc)
throws java.sql.SQLException, nc.bs.pub.SystemException {
/** ********************************************************** */
// 保留的系统管理接口:
beforeCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "synchronAccpsndoc",
new Object[] { regulardata, pk_psndoc });
/** ********************************************************** */
String sql = "update bd_psndoc set regulardata = ? where pk_psndoc =?";
Connection con = null;
PreparedStatement stmt = null;
try {
con = getConnection();
stmt = con.prepareStatement(sql);
stmt.setString(1, regulardata);
stmt.setString(2, pk_psndoc);
stmt.executeUpdate();
} finally {
try {
if (stmt != null) {
stmt.close();
}
} catch (Exception e) {
}
try {
if (con != null) {
con.close();
}
} catch (Exception e) {
}
}
/** ********************************************************** */
// 保留的系统管理接口:
afterCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "synchronAccpsndoc",
new Object[] { regulardata, pk_psndoc });
/** ********************************************************** */
}
/**
* 根据条件查询部门信息。 创建日期:(2005-7-14 14:32:22)
*
* @return nc.vo.bd.b04.DeptdocVO
* @param vos
* java.lang.String
* @exception java.sql.SQLException
* 异常说明。
*/
public DeptdocVO[] queryDeptVOs(String wheresql)
throws java.sql.SQLException {
Connection conn = null;
Statement stmt = null;
ResultSet result = null;
String sql = "select pk_deptdoc,deptcode,deptname,pk_fathedept,pk_corp,canceled ,hrcanceled,innercode from bd_deptdoc where ";
sql += wheresql;
DeptdocVO[] vos = null;
try {
conn = getConnection();
stmt = conn.createStatement();
result = stmt.executeQuery(sql);
Vector v = new Vector();
while (result.next()) {
DeptdocVO vo = new DeptdocVO();
vo.setPk_deptdoc(result.getString(1));
vo.setDeptcode(result.getString(2));
vo.setDeptname(result.getString(3));
String fatherpk = result.getString(4);
vo.setPk_fathedept(fatherpk == null ? null : fatherpk);
vo.setPk_corp(result.getString(5));
String cancled = result.getString(6);
if(cancled!=null&& cancled.equalsIgnoreCase("Y")){
vo.setCanceled(new UFBoolean(true));
}else{
vo.setCanceled(new UFBoolean(false));
}
String hrcancled = result.getString(7);
if(hrcancled!=null&& hrcancled.equalsIgnoreCase("Y")){
vo.setHrcanceled(new UFBoolean(true));
}else{
vo.setHrcanceled(new UFBoolean(false));
}
//
vo.setInnercode(result.getString(8));
v.addElement(vo);
}
vos = new DeptdocVO[v.size()];
v.copyInto(vos);
return vos;
} finally {
if (result != null)
result.close();
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
}
/**
* 【员工信息采集】打印时,调用的方法,算法模仿querySql(String sql), 因为bd_accpsndoc.dutyname
* 与om_duty.dutyname字段同名,而两个字段存放的值不一样:bd_accpsndoc.dutyname存放主键
* om_duty.dutyname存放名称。 把所有的值都存放在vo中,不管该值是否为空。 创建日期:(2004-5-31 15:46:52)
*
* @return java.util.Vector
* @param sql
* java.lang.String
*/
public GeneralVO[] querySqlForPrint(String sql)
throws java.sql.SQLException, java.io.IOException {
Connection conn = null;
Statement stmt = null;
ResultSet result = null;
ResultSetMetaData meta = null;
try {
conn = getConnection();
stmt = conn.createStatement();
result = stmt.executeQuery(sql);
meta = result.getMetaData();
String[] fieldNames = new String[meta.getColumnCount()];
int[] fieldTypes = new int[fieldNames.length];
for (int i = 0; i < fieldNames.length; i++) {
fieldNames[i] = meta.getColumnName(i + 1).toLowerCase();
fieldTypes[i] = meta.getColumnType(i + 1);
}
Vector v = new Vector();
while (result.next()) {
GeneralVO gvo = new GeneralVO();
for (int i = 0; i < fieldNames.length; i++) {
if (BSUtil.isBinary(fieldTypes[i])) { // 如果是blob类型
// 50 fixed
// byte[] data = ((nc.bs.mw.sql.UFResultSet) result)
// .getBlobBytes(i + 1);
byte[] data = ((MemoryResultSet) result)
.getBytes(i + 1);
// 50 end
gvo.setFieldValue(fieldNames[i], data);
} else if (!BSUtil.isSkipField(fieldNames[i])) {
Object value = result.getObject(i + 1);
if (value != null) {
if (value instanceof String)
value = ((String) value).trim();
// gvo.setFieldValue(fieldNames[i], value);
}
gvo.setFieldValue(fieldNames[i], value);
} else
result.getObject(i + 1);
}
if (gvo.getAttributeValue("pk_corp") == null
&& gvo.getAttributeValue("man_pk_corp") != null) {
gvo.setAttributeValue("pk_corp", gvo
.getAttributeValue("man_pk_corp"));
}
v.addElement(gvo);
}
return (GeneralVO[]) v.toArray(new GeneralVO[0]);
} finally {
if (meta != null) {
meta = null;
}
if (result != null)
result.close();
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
}
/**
* 按照条件多表关联查询入职申请单
* @return
*/
public DocApplyHVO[] queryDocApplyBillByCon(String where)throws java.sql.SQLException, java.io.IOException{
if(where.trim().toLowerCase().startsWith("and")){
where = where.trim().substring(4);
}
if(!where.trim().toLowerCase().startsWith("where")){
where = "where "+where;
}
if(where.indexOf("pk_docapply_h")>0 && where.indexOf("h.pk_docapply_h")<1){
where = where.replaceAll("pk_docapply_h", "h.pk_docapply_h");
}
where = where.replaceAll("hi_docapply_b","b");
where =where.replaceAll("b.psncl", "p.pk_psncl");
where =where.replaceAll("b.psncode", "p.psncode");
where = where.replaceAll("hi_docapply_h", "h");
DocApplyHVO[] docapplyhvos = null;
String sql = " SELECT distinct h.PK_DOCAPPLY_H, h.PK_BILLTYPE, h.BILLSTATE, h.VBILLNO, h.PK_PROPOSER, h.APPLYDATE, h.APPROVEDATE, h.VSUMM, h.PK_CORP, h.APPROVENOTE ,h.busitype,h.attachmentinf " +
" from hi_docapply_h h left outer join hi_docapply_b b on h.pk_docapply_h = b.pk_docapply_h " +
" left outer join bd_psndoc p on b.pk_psndoc = p.pk_psndoc " +where +"order by h.VBILLNO";
Connection conn = null;
PreparedStatement stmt = null;
ResultSet rs = null;
Vector v = new Vector();
try {
conn = getConnection();
stmt = conn.prepareStatement(sql);
rs = stmt.executeQuery();
while (rs.next()) {
DocApplyHVO temp = new DocApplyHVO();
temp.setPk_docapply_h(rs.getString(1));
temp.setPk_billtype(rs.getString(2));
temp.setBillstate(rs.getInt(3));
temp.setVbillno(rs.getString(4));
temp.setPk_proposer(rs.getString(5));
if(rs.getString(6)!=null){
temp.setApplydate(new UFDate(rs.getString(6)));
}
if(rs.getString(7)!=null){
temp.setApprovedate(new UFDate(rs.getString(7)));
}
temp.setVsumm(rs.getString(8));
temp.setPk_corp(rs.getString(9));
temp.setApprovenote(rs.getString(10));
temp.setBusitype(rs.getString(11));
temp.setAttachmentinf(rs.getString(12));
v.addElement(temp);
}
} finally {
if (rs != null)
rs.close();
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
docapplyhvos = new DocApplyHVO[v.size()];
if(v.size()>0){
v.copyInto(docapplyhvos);
}
return docapplyhvos;
}
/**
*
* @param psndoc
* @return
* @throws java.sql.SQLException
* @throws java.io.IOException
*/
public GeneralVO queryDetail(GeneralVO psndoc,String[] fieldnames)
throws java.sql.SQLException, java.io.IOException {
String sql = "select pk_deptdoc,pk_psncl,pk_dutyrank,pk_om_job,indutydate,outdutydate,jobrank,jobseries,dutyname,series,isreturn,bd_psndoc.pk_corp,bd_psndoc.onpostdate " ;
if (fieldnames != null && fieldnames.length > 0){
for (int i = 0; i < fieldnames.length; i++) {
sql += ", " + fieldnames[i];
}
}
sql += " from bd_psndoc left outer join bd_psnbasdoc on bd_psndoc.pk_psnbasdoc = bd_psnbasdoc.pk_psnbasdoc where pk_psndoc= ? ";
Connection conn = null;
PreparedStatement stmt = null;
ResultSet rs = null;
try {
conn = getConnection();
stmt = conn.prepareStatement(sql);
if (psndoc.getAttributeValue("pk_psndoc") != null)
stmt.setString(1, (String) psndoc
.getAttributeValue("pk_psndoc"));
rs = stmt.executeQuery();
while (rs.next()) {
psndoc.setAttributeValue("pk_deptdoc", rs.getString(1));
psndoc.setAttributeValue("pk_psncl", rs.getString(2));
psndoc.setAttributeValue("pk_dutyrank", rs.getString(3));
psndoc.setAttributeValue("pk_om_job", rs.getString(4));
psndoc.setAttributeValue("indutydate", rs.getString(5));
psndoc.setAttributeValue("outdutydate", rs.getString(6));
psndoc.setAttributeValue("jobrank", rs.getString(7));
psndoc.setAttributeValue("jobseries", rs.getString(8));
psndoc.setAttributeValue("dutyname", rs.getString(9));
psndoc.setAttributeValue("series", rs.getString(10));
psndoc.setAttributeValue("isreturn", rs.getString(11));
psndoc.setAttributeValue("pk_corp", rs.getString(12));
psndoc.setAttributeValue("onpostdate", rs.getString(13));
if (fieldnames != null && fieldnames.length > 0){
for (int i = 0; i < fieldnames.length; i++) {
psndoc.setAttributeValue(fieldnames[i], rs.getObject(14+i));
}
}
}
} finally {
if (rs != null)
rs.close();
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
return psndoc;
}
/**
*
* @param psndoc
* @return
* @throws java.sql.SQLException
* @throws java.io.IOException
*/
public GeneralVO queryDetailForDimis(GeneralVO psndoc,String[] fieldnames)
throws java.sql.SQLException, java.io.IOException {
String sql = "select pk_deptdoc,pk_psncl,pk_dutyrank,pk_om_job,indutydate,outdutydate,jobrank,jobseries,dutyname,series,isreturn,bd_psndoc.pk_corp " ;
if (fieldnames != null && fieldnames.length > 0){
for (int i = 0; i < fieldnames.length; i++) {
sql += ", " + fieldnames[i];
}
}
sql += " from bd_psndoc left outer join bd_psnbasdoc on bd_psndoc.pk_psnbasdoc = bd_psnbasdoc.pk_psnbasdoc where pk_psndoc= ? ";
Connection conn = null;
PreparedStatement stmt = null;
ResultSet rs = null;
try {
conn = getConnection();
stmt = conn.prepareStatement(sql);
if (psndoc.getAttributeValue("pk_psndoc") != null)
stmt.setString(1, (String) psndoc
.getAttributeValue("pk_psndoc"));
rs = stmt.executeQuery();
while (rs.next()) {
psndoc.setAttributeValue("pk_deptdoc", rs.getString(1));
psndoc.setAttributeValue("pk_psncl", rs.getString(2));
psndoc.setAttributeValue("pk_dutyrank", rs.getString(3));
psndoc.setAttributeValue("pk_om_job", rs.getString(4));
psndoc.setAttributeValue("indutydate", rs.getString(5));
psndoc.setAttributeValue("outdutydate", rs.getString(6));
psndoc.setAttributeValue("jobrank", rs.getString(7));
psndoc.setAttributeValue("jobseries", rs.getString(8));
psndoc.setAttributeValue("dutyname", rs.getString(9));
psndoc.setAttributeValue("series", rs.getString(10));
psndoc.setAttributeValue("isreturn", rs.getString(11));
psndoc.setAttributeValue("pk_corp", rs.getString(12));
if (fieldnames != null && fieldnames.length > 0){
for (int i = 0; i < fieldnames.length; i++) {
psndoc.setAttributeValue(fieldnames[i], rs.getObject(13+i));
}
}
}
} finally {
if (rs != null)
rs.close();
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
return psndoc;
}
public int[] getDefItem(String tablename) throws java.sql.SQLException {
Connection conn = null;
PreparedStatement stmt = null;
ResultSet result = null;
int[] defItems = new int[2];// defItems[0]:记录公司自定义项的个数,defItems[1]:记录集团自定义项的个数.
try {
conn = getConnection();
String sql = "select idefcorpnum,idefgroupnum from hr_defdoc where vtablename=?";
stmt = conn.prepareStatement(sql);
stmt.setString(1, tablename);
result = stmt.executeQuery();
if (result.next()) {
defItems[0] = result.getInt(1);
defItems[1] = result.getInt(2);
}
return defItems;
} finally {
if (result != null)
result.close();
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
}
/**
* 得到在指定公司兼职的人员所在的公司s。 创建日期:(2004-11-24 10:58:31)
*
* @return java.lang.String[]
* @param pk_corp
* java.lang.String
*/
public String[] queryDeptPowerBySql(String sql) throws SQLException {
Vector vecResult = new Vector();
Connection con = null;
PreparedStatement stmt = null;
try {
con = getConnection();
stmt = con.prepareStatement(sql);
ResultSet rs = stmt.executeQuery();
//
while (rs.next()) {
String pk_deptdoc = rs.getString(1);
vecResult.addElement(pk_deptdoc);
}
} finally {
try {
if (stmt != null) {
stmt.close();
}
} catch (Exception e) {
}
try {
if (con != null) {
con.close();
}
} catch (Exception e) {
}
}
String[] pk_deptdocs = null;
if (vecResult.size() > 0) {
pk_deptdocs = new String[vecResult.size()];
vecResult.copyInto(pk_deptdocs);
}
return pk_deptdocs;
}
/**
* 根据查询条件获得要对应辅助信息。 --解决V30中问题编码为200507111204423395 和
* 200507210913444548中的同步问题 创建日期:(2005-7-13 10:21:02)
*
* @return java.lang.String
* @param tablename
* java.lang.String
* @param fldcode
* java.lang.String
* @param pk_psndoc
* java.lang.String
* @param chkformula
* java.lang.String
*/
public String findItemInf(String tablename, String fldcode,
String pk_psnbasdoc, String chkformula) throws SQLException {
/** ********************************************************** */
// 保留的系统管理接口:
beforeCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "findItemInf",
new Object[] { tablename, fldcode, pk_psnbasdoc, chkformula });
/** ********************************************************** */
String strItemInf = null;
String sql = null;
StringBuffer strBuf = new StringBuffer("select ");
strBuf.append(fldcode);
strBuf.append(" from ");
strBuf.append(tablename);
strBuf.append(" where pk_psnbasdoc = ? and ( ");
if (chkformula != null && chkformula.length() > 0) {
strBuf.append(chkformula);
} else {
// updateBy lvguodong 2010-04-28 start
// strBuf.append(" recordnum = 0");
strBuf.append(" (recordnum = 0 or recordnum is null)");
// updateBy lvguodong 2010-04-28 end
}
sql = strBuf.toString();
sql += " ) ";
if ("hi_psndoc_part".equalsIgnoreCase(tablename)) {
sql = StringUtil.replaceAllString/*AllString*/(sql,
"hi_psndoc_part", "hi_psndoc_deptchg");
sql += " and jobtype <> 0 ";
}
sql += " order by recordnum";
Connection con = null;
PreparedStatement stmt = null;
try {
con = getConnection();
stmt = con.prepareStatement(sql);
stmt.setString(1, pk_psnbasdoc);
ResultSet rs = stmt.executeQuery();
//
if (rs.next()) {
// strItemInf :
strItemInf = rs.getString(1);
}
} finally {
try {
if (stmt != null) {
stmt.close();
}
} catch (Exception e) {
}
try {
if (con != null) {
con.close();
}
} catch (Exception e) {
}
}
/** ********************************************************** */
// 保留的系统管理接口:
afterCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "findItemInf",
new Object[] { tablename, fldcode, pk_psnbasdoc, chkformula });
/** ********************************************************** */
return strItemInf;
}
/**
* V35
*
* @param data
* @param tableCode
* @return
* @throws java.io.IOException
* @throws java.sql.SQLException
*/
public String[] insertHiItemSet(CircularlyAccessibleValueObject[] data,
String tableCode) throws java.io.IOException, java.sql.SQLException {
// 保留的系统管理接口:
beforeCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "insertTable",
new Object[] { data, tableCode });
/** ********************************************************** */
Connection con = null;
PreparedStatement stmt = null;
String[] keys = null;
// int[] counts = null;
if (data == null || data.length == 0) {
return null;
}
try {
String sql = " insert into hi_itemset "
+ "\t (pk_itemset,pk_flddict,showorder,funcode,pk_corp,userid) "
+ " values( ?,?,?,?,?,?)";
con = getConnection();
keys = new String[data.length];
stmt = prepareStatement(con, sql);
for (int i = 1; i < data.length; i++) {
keys[i] = getOID();
stmt.setString(1, keys[i]);
if (data[i].getAttributeValue("pk_flddict") == null) {
stmt.setNull(2, Types.CHAR);
} else {
stmt.setString(2, (String) data[i]
.getAttributeValue("pk_flddict"));
}
if (data[i].getAttributeValue("showorder") == null) {
stmt.setNull(3, Types.INTEGER);
} else {
stmt.setInt(3, ((Integer) data[i]
.getAttributeValue("showorder")).intValue());
}
if (data[0].getAttributeValue("funcode") == null) {
stmt.setNull(4, Types.CHAR);
} else {
stmt.setString(4, (String) data[0]
.getAttributeValue("funcode"));
}
if (data[0].getAttributeValue("pk_corp") == null) {
stmt.setNull(5, Types.CHAR);
} else {
stmt.setString(5, (String) data[0]
.getAttributeValue("pk_corp"));
}
if (data[i].getAttributeValue("userid") == null) {
stmt.setNull(6, Types.CHAR);
} else {
stmt.setString(6, ((String) data[i]
.getAttributeValue("userid")));
}
executeUpdate(stmt);
}
// int[] counts =
executeBatch(stmt);
} finally {
if (stmt != null)
stmt.close();
if (con != null)
con.close();
}
/** ********************************************************** */
// 保留的系统管理接口:
afterCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "insertTable",
new Object[] { data, tableCode });
/** ********************************************************** */
return keys;
}
/**
* V35
*
* @param data
* @param tableCode
* @return
* @throws java.io.IOException
* @throws java.sql.SQLException
*/
public int deleteTable(CircularlyAccessibleValueObject[] data,
String tableCode) throws java.io.IOException, java.sql.SQLException {
// 保留的系统管理接口:
beforeCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "deleteTable",
new Object[] { data, tableCode });
/** ********************************************************** */
Connection con = null;
PreparedStatement stmt = null;
int count = 0;
// int[] counts = null;
if (data == null || data.length == 0) {
return 0;
}
try {
String sql = " delete from hi_itemset where pk_corp=? and funcode=? and userid=?";
con = getConnection();
stmt = prepareStatement(con, sql);
if (data[0].getAttributeValue("pk_corp") == null) {
stmt.setNull(1, Types.CHAR);
} else {
stmt
.setString(1, (String) data[0]
.getAttributeValue("pk_corp"));
}
if (data[0].getAttributeValue("funcode") == null) {
stmt.setNull(2, Types.CHAR);
} else {
stmt
.setString(2, (String) data[0]
.getAttributeValue("funcode"));
}
if (data[0].getAttributeValue("userid") == null) {
stmt.setNull(3, Types.CHAR);
} else {
stmt
.setString(3, (String) data[0]
.getAttributeValue("userid"));
}
count = stmt.executeUpdate();
} finally {
if (stmt != null)
stmt.close();
if (con != null)
con.close();
}
/** ********************************************************** */
// 保留的系统管理接口:
afterCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "deleteTable",
new Object[] { data, tableCode });
/** ********************************************************** */
return count;
}
/**
* V35 add
*
* @param table
* @param data
* @param pkfield
* @param key
* @return
* @throws java.io.IOException
* @throws java.sql.SQLException
* @throws NamingException
*/
public String[] insertSubTable(String table,
nc.vo.pub.CircularlyAccessibleValueObject[] data, String pkfield)
throws IOException, SQLException, DAOException, NamingException {
Connection conn = null;
PreparedStatement stmt = null;
boolean hasByteField = false;
String byteField = null;
byte[] byteValue = null;
String[] keys = null;
// int[] counts = null;
try {
if (data == null || data.length == 0) {
return null;
}
// 先更新当前表中人员的recordnum
updateRecordnum(table, data);
// 从data[0]中 过滤掉 "psncode", "psnname", "deptname" 字段
String[] fieldNames = data[0].getAttributeNames();
Vector vv = new Vector();
for (int i = 0; i < fieldNames.length; i++) {
if (!"psncode".equalsIgnoreCase(fieldNames[i])
&& !"psnname".equalsIgnoreCase(fieldNames[i])
&& !"deptname".equalsIgnoreCase(fieldNames[i])
&& !BSUtil.isSkipField(fieldNames[i])) {
vv.addElement(fieldNames[i]);
}
}
String[] fields = new String[vv.size()];
vv.copyInto(fields);
// 组装sql语句
String sql = "insert into " + table + "(" + pkfield;
String fieldsPart = "";
String valuePart = " values( ?";
for (int i = 0; i < fields.length; i++) {
fieldsPart += ",";
fieldsPart += fields[i];
valuePart += ",";
valuePart += "?";
}
sql += fieldsPart + ",recordnum,lastflag) " + valuePart + ",?,?)";
sql = HROperatorSQLHelper.getSQLWithOperator(sql);
// 执行批量处理
conn = getConnection();
keys = new String[data.length];
stmt = prepareStatement(conn, sql);
for (int i = 0; i < data.length; i++) {
keys[i] = getOID();
stmt.setString(1, keys[i]);
for (int j = 1; j <= fields.length; j++) {
Object value = data[i].getAttributeValue("$"
+ fields[j - 1]);
if (value == null) {
value = data[i].getAttributeValue(fields[j - 1]);
if (value != null
&& value.toString().trim().equalsIgnoreCase("")) {
value = null;
}
}
// if (value != null && !(value instanceof byte[]))
{
if (BSUtil.isSelfDef(fields[j - 1])) {
if (value == null) {
stmt.setNull(j + 1, Types.CHAR);
} else {
stmt.setString(j + 1, value.toString());
}
} else if (BSUtil.isNumeric(value)) {
if (value instanceof Integer
|| value instanceof Short) {
if (value == null) {
stmt.setNull(j + 1, Types.INTEGER);
} else {
stmt.setInt(j + 1, ((Integer) value)
.intValue());
}
} else if (value instanceof BigDecimal) {
if (value == null) {
stmt.setNull(j + 1, Types.DECIMAL);
} else {
stmt.setBigDecimal(j + 1,
(BigDecimal) value);
}
} else if (value instanceof Float) {
if (value == null) {
stmt.setNull(j + 1, Types.FLOAT);
} else {
stmt.setFloat(j + 1, ((Float) value)
.floatValue());
}
} else if (value instanceof Double) {
if (value == null) {
stmt.setNull(j + 1, Types.DOUBLE);
} else {
stmt.setDouble(j + 1, ((Double) value)
.doubleValue());
}
} else if (value instanceof UFDouble) {
if (value == null) {
stmt.setNull(j + 1, Types.DOUBLE);
} else {
stmt.setDouble(j + 1, ((UFDouble) value)
.doubleValue());
}
}
} else {
if (value == null) {
stmt.setNull(j + 1, Types.CHAR);
} else {
stmt.setString(j + 1, value.toString());
}
}
}
// else if (value != null && value instanceof byte[]) {
// // hasByteField = true;
// // byteField = fieldNames[i];
// // byteValue = (byte[]) value;
// }
}
stmt.setInt(fields.length + 2, 0);
stmt.setString(fields.length + 3, "Y");
// 如果当前更新的值中含有blob类型则:
if (hasByteField) {
// updateBlob(pkfield, keys[i], byteField, byteValue,
// table);
PsnInfDAO dao = new PsnInfDAO();
dao.updateBlob(table, byteField, byteValue, pkfield,
keys[i]);
}
executeUpdate(stmt);
// stmt.addBatch();
// stmt.executeUpdate();
}
// counts = stmt.executeBatch();
// counts =
executeBatch(stmt);
return keys;
} finally {
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
}
private int[] updateRecordnum(String table,
nc.vo.pub.CircularlyAccessibleValueObject[] data)
throws java.io.IOException, java.sql.SQLException {
Connection conn = null;
PreparedStatement stmt = null;
int[] counts = null;
try {
if (data == null || data.length == 0) {
return null;
}
String psnpk = "pk_psnbasdoc";
if(isTraceTable(table)){
psnpk = "pk_psndoc";
}
String setsql = "select reccharacter from hi_setdict where setcode like ?";
String updatelastflag = "update "+table+ " set lastflag = ? where "+psnpk+" = ?";
conn = getConnection();
String sql = " update " + table + " set recordnum =recordnum+1 ";
String wheresql = " where "+psnpk+" = ?";
sql = sql + wheresql;
conn = getConnection();
stmt = prepareStatement(conn, sql);
for (int i = 0; i < data.length; i++) {
Object value = data[i].getAttributeValue(psnpk);
if (value == null) {
stmt.setNull(1, Types.CHAR);
} else {
stmt.setString(1, (String) value);
}
executeUpdate(stmt);
}
counts = executeBatch(stmt);
//查询信息集类型
String lastflag = "Y";
if("hi_psndoc_edu".equalsIgnoreCase(table)){
lastflag = "Y";
}else{
stmt.close();
stmt = conn.prepareStatement(setsql);
stmt.setString(1, table);
ResultSet rs = stmt.executeQuery();
if(rs.next()){
String recflag = rs.getString(1);
if("3".equals(recflag)){
lastflag = "Y";
}else{
lastflag = "N";
}
}
}
//更新已有信息集数据的lastflag
stmt = prepareStatement(conn, updatelastflag);
for (int i = 0; i < data.length; i++) {
Object value = data[i].getAttributeValue(psnpk);
stmt.setString(1, lastflag);
if (value == null) {
stmt.setNull(2, Types.CHAR);
} else {
stmt.setString(2, (String) value);
}
executeUpdate(stmt);
}
counts = executeBatch(stmt);
return counts;
} finally {
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
}
public int deleteEmployeeRef(nc.vo.hi.hi_301.GeneralVO[] data,
String tableCode) throws java.io.IOException, java.sql.SQLException {
// 保留的系统管理接口:
beforeCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "deleteEmployeeRef",
new Object[] { data, tableCode });
/** ********************************************************** */
Connection con = null;
PreparedStatement stmt = null;
int count = 0;
if (data == null || data.length == 0) {
return 0;
}
try {
String sql = " delete from hi_psndoc_ref where pk_psnbasdoc=?";
con = getConnection();
stmt = prepareStatement(con, sql);
for (int i = 0; i < data.length; i++) {
if (data[i].getAttributeValue("pk_psnbasdoc") == null) {
stmt.setNull(1, Types.CHAR);
} else {
stmt.setString(1, (String) data[i]
.getAttributeValue("pk_psnbasdoc"));
}
executeUpdate(stmt);
count++;
}
executeBatch(stmt);
} finally {
if (stmt != null)
stmt.close();
if (con != null)
con.close();
}
/** ********************************************************** */
// 保留的系统管理接口:
afterCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "deleteEmployeeRef",
new Object[] { data, tableCode });
/** ********************************************************** */
return count;
}
/**
* 应判断人员是否离职或已调离
*/
public void checkPsnHaveChanged(nc.vo.hi.hi_301.GeneralVO[] data) throws BusinessException{
if(data==null || data.length<1) return;
String pks ="";
for(int i=0;i<data.length;i++){
//若是被拒绝的就不检查了
if((Boolean)data[i].getAttributeValue("isRefused")) continue;
pks += ",'"+data[i].getAttributeValue("oripk_psndoc")+"'";
}
if(pks.length()<20) return;
pks = pks.substring(1);
String sql = "select distinct psnname from bd_psndoc where psnclscope not in (0,3,5) and " +
"pk_psndoc in ("+pks+")";
CommonVO[] illegalpsns = null;
try{
List<CommonVO> list =
(List<CommonVO>) PubDelegator.getIPersistenceHome().executeQuery(sql,null,
new CommonVOProcessor());
if (!list.isEmpty())
{
illegalpsns = list.toArray(new CommonVO[list.size()]);
}
}
catch (Exception e) {
e.printStackTrace();
}
//如果有不符合的人员,则抛出异常
if (illegalpsns!=null && illegalpsns.length>0){
String psnnames = "";
for(int i=0;i<illegalpsns.length;i++){
String psnname = (String)illegalpsns[i].getAttributeValue("psnname");
psnnames = psnnames+","+psnname;
}
// throw new BusinessException("以下这些人员已有变动,不能被引用:\n"+psnnames);
throw new BusinessException(nc.bs.ml.NCLangResOnserver.getInstance().getStrByID("600700",
"UPP600700-000236")/* @res "以下这些人员已有变动,不能被引用:\n" */
+ psnnames);
}
}
/**
* 把引用的人员转入到管理档案中
*
*/
public int addRefEmployees(nc.vo.hi.hi_301.GeneralVO[] data,
String tableCode) throws java.io.IOException, java.sql.SQLException {
// 保留的系统管理接口:
beforeCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "addRefEmployees",
new Object[] { data, tableCode });
/** ********************************************************** */
Connection con = null;
PreparedStatement stmt = null;
int count = 0;
if (data == null || data.length == 0) {
return 0;
}
try {
// 删除原有引用人员信息(已经取消引用)
String sqlDel = "delete from bd_psndoc where pk_psnbasdoc = ? and pk_corp = ? and sealdate is not null";
String selectfield = " pk_psndoc,amcode,clerkcode ,clerkflag,indocflag ,innercode,maxinnercode ,pk_corp,pk_deptdoc,pk_om_job,pk_psncl,psnclscope,psncode,psnname,sealdate, def1,def10,def11,def12,def13,def14,def15,def16,def17,def18,def19,def2,def20,def3,def4,def5,def6,def7,def8,def9,indutydate,jobrank,jobseries,outdutydate,pk_psnbasdoc,directleader,dutyname,groupdef1,groupdef10,groupdef11,groupdef12,groupdef13,groupdef14,groupdef15,groupdef16,groupdef17,groupdef18,groupdef19,groupdef2,groupdef20,groupdef3,groupdef4,groupdef5,groupdef6,groupdef7,groupdef8,groupdef9,insource,iscalovertime,outmethod,pk_clerkclass,pk_dutyrank,pk_psntype,poststat,recruitresource,regular,regulardata,series,tbm_prop,timecardid,wastopdate ";
String desttable = " bd_psndoc";
String srctable = " hi_psndoc_ref";
String sql = " insert into " + desttable + " ( " + selectfield
+ ")" + " select " + selectfield + " from " + srctable
+ " where pk_psnbasdoc = ?";
//
String sqlUpdate = "update bd_psndoc set isreferenced = 'Y' where pk_psndoc in (select pk_psndoc from hi_psndoc_ref where pk_psnbasdoc = ? ) ";
sql = HROperatorSQLHelper.getSQLWithOperator(sql);
sqlUpdate = HROperatorSQLHelper.getSQLWithOperator(sqlUpdate);
con = getConnection();
for (int i = 0; i < data.length; i++) {
Boolean isAffirmed = (Boolean) data[i]
.getAttributeValue("isAffirmed");// 只有确认的人员才转入人员档案
if (isAffirmed != null && isAffirmed.booleanValue()) {
// 更新是否引用标记
stmt = con.prepareStatement(sqlDel);
stmt.setString(1, (String) data[i]
.getAttributeValue("pk_psnbasdoc"));
stmt.setString(2, (String) data[i]
.getAttributeValue("pk_corp"));
stmt.executeUpdate();
stmt.close();
// 转入人员档案
stmt = con.prepareStatement(sql);
if (data[i].getAttributeValue("pk_psnbasdoc") == null) {
stmt.setNull(1, Types.CHAR);
} else {
stmt.setString(1, (String) data[i]
.getAttributeValue("pk_psnbasdoc"));
}
stmt.executeUpdate();
stmt.close();
// 更新是否引用标记
stmt = con.prepareStatement(sqlUpdate);
if (data[i].getAttributeValue("pk_psnbasdoc") == null) {
stmt.setNull(1, Types.CHAR);
} else {
stmt.setString(1, (String) data[i]
.getAttributeValue("pk_psnbasdoc"));
}
stmt.executeUpdate();
stmt.close();
count++;
}
}
} finally {
if (stmt != null)
stmt.close();
if (con != null)
con.close();
}
/** ********************************************************** */
// 保留的系统管理接口:
afterCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "addRefEmployees",
new Object[] { data, tableCode });
/** ********************************************************** */
return count;
}
public nc.vo.hi.hi_301.GeneralVO[] queryRefEmployees(String strParam,
Integer type, String power) throws java.io.IOException,
java.sql.SQLException {
// 保留的系统管理接口:
beforeCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "queryRefEmployees",
new Object[] { strParam, type });
/** ********************************************************** */
Connection con = null;
PreparedStatement stmt = null;
ResultSet rs = null;
nc.vo.hi.hi_301.GeneralVO[] refEmployees = null;
if (strParam == null || type == null) {
return null;
}
try {
String sql = " select distinct ";
String[] fields = { "hi_psndoc_ref.psncode", "bd_psndoc.psncode",
"hi_psndoc_ref.psnname", "bd_corp.unitname",
"bd_deptdoc.deptname", "om_job.jobname",
"bd_psncl.psnclassname", "hi_psndoc_ref.pk_psnbasdoc",
"hi_psndoc_ref.pk_corp", "hi_psndoc_ref.pk_deptdoc",
"hi_psndoc_ref.pk_om_job", "hi_psndoc_ref.pk_psncl",
"hi_psndoc_ref.userid", "hi_psndoc_ref.appdate",
"hi_psndoc_ref.oriunitname", "hi_psndoc_ref.orideptname",
"hi_psndoc_ref.orijobname","hi_psndoc_ref.oripk_psndoc", };
for (int i = 0; i < fields.length; i++) {
String field = fields[i];
// if(type.intValue() == 1 && i == 0){
// field = "bd_psndoc.psncode";
// }
sql += field;
if (i < fields.length - 1) {
sql += ",";
}
}
String from = " from hi_psndoc_ref inner join bd_psnbasdoc on bd_psnbasdoc.pk_psnbasdoc = hi_psndoc_ref.pk_psnbasdoc left join bd_corp on bd_corp.pk_corp = hi_psndoc_ref.pk_corp left join bd_deptdoc on bd_deptdoc.pk_deptdoc = hi_psndoc_ref.pk_deptdoc left join om_job on om_job.pk_om_job = hi_psndoc_ref.pk_om_job left join bd_psncl on bd_psncl.pk_psncl = hi_psndoc_ref.pk_psncl ";
from += " inner join bd_psndoc on bd_psndoc.pk_psnbasdoc = hi_psndoc_ref.pk_psnbasdoc ";
String where = null;
if (type.intValue() == 0) {// 查看申请
where = " where hi_psndoc_ref.userid = ? and bd_psnbasdoc.pk_corp =bd_psndoc.pk_corp ";
} else if (type.intValue() == 1) {// 确认引用
where = " where bd_psnbasdoc.pk_corp = ? and bd_psndoc.pk_corp = ? ";
}
/* V55 modify 取消部门档案权限
if (power != null && !power.trim().equalsIgnoreCase("0=0")) {
where += " and hi_psndoc_ref.oripk_deptdoc in (" + power + ")";
}
*/
sql += (from + where);
con = getConnection();
stmt = prepareStatement(con, sql);
if (type.intValue() == 0) {
stmt.setString(1, strParam);
} else if (type.intValue() == 1) {
stmt.setString(1, strParam);
stmt.setString(2, strParam);
}
rs = stmt.executeQuery();
Vector vv = new Vector();
while (rs.next()) {
nc.vo.hi.hi_301.GeneralVO vo = new nc.vo.hi.hi_301.GeneralVO();
for (int i = 0; i < fields.length; i++) {
vo.setAttributeValue(fields[i], rs.getString(i + 1));
}
vv.addElement(vo);
}
if (vv.size() > 0) {
refEmployees = new nc.vo.hi.hi_301.GeneralVO[vv.size()];
vv.copyInto(refEmployees);
}
} finally {
if (stmt != null)
stmt.close();
if (con != null)
con.close();
}
/** ********************************************************** */
// 保留的系统管理接口:
afterCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "queryRefEmployees",
new Object[] { strParam, type });
/** ********************************************************** */
return refEmployees;
}
/**
* 此方法可以写得更灵活:改成 queryPsnCountByPk(String table,String pk_field,Object
* field_obj)
*
* @param table
* @param pk
* @return
* @throws java.io.IOException
* @throws java.sql.SQLException
*/
public int queryPsnCountByPk(String table, String pk, String condition)
throws java.io.IOException, java.sql.SQLException {
// 保留的系统管理接口:
beforeCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "queryPsnCountByPk",
new Object[] { table, table });
/** ********************************************************** */
Connection con = null;
PreparedStatement stmt = null;
int count = 0;
try {
String sql = "";
if ("bd_deptdoc".equalsIgnoreCase(table)) {
sql = " select count(*) from hi_psndoc_deptchg left outer join bd_psndoc on hi_psndoc_deptchg.pk_psndoc = bd_psndoc.pk_psndoc where hi_psndoc_deptchg.pk_deptdoc = ? and indocflag = 'Y' and jobtype =0 and recordnum = 0 and "+condition;
} else if ("om_job".equalsIgnoreCase(table)) {
sql = " select count(*) from bd_psndoc where pk_om_job = ? and indocflag = 'Y' and "+condition;
} else if ("bd_corp".equalsIgnoreCase(table)) {
sql = " select count(*) from hi_psndoc_deptchg left outer join bd_psndoc on hi_psndoc_deptchg.pk_psndoc = bd_psndoc.pk_psndoc where hi_psndoc_deptchg.pk_corp = ? and indocflag = 'Y' and jobtype =0 and recordnum = 0 and "+condition;
}
con = getConnection();
stmt = prepareStatement(con, sql);
if (pk == null) {
stmt.setNull(1, Types.CHAR);
} else {
stmt.setString(1, pk);
}
ResultSet rs = stmt.executeQuery();
if (rs.next()) {
count = rs.getInt(1);
}
} finally {
if (stmt != null)
stmt.close();
if (con != null)
con.close();
}
/** ********************************************************** */
// 保留的系统管理接口:
afterCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "queryPsnCountByPk",
new Object[] { table, table });
/** ********************************************************** */
return count;
}
public void deleteMainPsnDoc(GeneralVO psndocvo)
throws java.sql.SQLException {
/** ********************************************************** */
// 保留的系统管理接口:
beforeCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "deleteMainPsnDoc",
new Object[] { psndocvo });
/** ********************************************************** */
String pk_psnbasdoc = (String) psndocvo.getFieldValue("pk_psnbasdoc");
Connection conn = null;
Statement stmt = null;
try {
conn = getConnection();
stmt = conn.createStatement();
String sql1 = " select 1 from bd_psndoc where pk_psnbasdoc='"
+ pk_psnbasdoc + "'";
ResultSet rs = stmt.executeQuery(sql1);
if (rs.next()) {
String sql2 = "delete from bd_psndoc where pk_psnbasdoc='"
+ pk_psnbasdoc + "'";
stmt.execute(sql2);
} else {
String sql = "delete from bd_psnbasdoc where pk_psnbasdoc='"
+ pk_psnbasdoc + "'";
stmt.execute(sql);
}
} finally {
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
/** ********************************************************** */
// 保留的系统管理接口:
afterCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "deleteMainPsnDoc",
new Object[] { psndocvo });
/** ********************************************************** */
}
public String[] queryRefPsndoc(String pk_psnbasdoc)
throws java.sql.SQLException {
/** ********************************************************** */
// 保留的系统管理接口:
beforeCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "queryRefPsndoc",
new Object[] { pk_psnbasdoc });
/** ********************************************************** */
Connection conn = null;
Statement stmt = null;
Vector vv = new Vector();
String[] psndocs = null;
try {
conn = getConnection();
stmt = conn.createStatement();
String sql = " select pk_psndoc from bd_psndoc where pk_psnbasdoc='"
+ pk_psnbasdoc + "'";
ResultSet rs = stmt.executeQuery(sql);
while (rs.next()) {
vv.addElement(rs.getString(1));
}
psndocs = new String[vv.size()];
vv.copyInto(psndocs);
} finally {
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
/** ********************************************************** */
// 保留的系统管理接口:
afterCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "queryRefPsndoc",
new Object[] { pk_psnbasdoc });
/** ********************************************************** */
return psndocs;
}
public nc.vo.pub.msg.UserNameObject[] getUserObj(String[] userids)
throws java.sql.SQLException {
/** ********************************************************** */
// 保留的系统管理接口:
beforeCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "getUserObj",
new Object[] { userids });
/** ********************************************************** */
Connection conn = null;
Statement stmt = null;
Vector vv = new Vector();
nc.vo.pub.msg.UserNameObject[] userObjs = null;
try {
conn = getConnection();
stmt = conn.createStatement();
String sql = "select user_name,user_code,cuserid from sm_user where cuserid in (";
for (int i = 0; i < userids.length; i++) {
sql += "'" + userids[i] + "'";
if (i < userids.length - 1) {
sql += ",";
}
}
sql += " )";
ResultSet rs = stmt.executeQuery(sql);
while (rs.next()) {
nc.vo.pub.msg.UserNameObject userObj = new nc.vo.pub.msg.UserNameObject(
rs.getString(1));
userObj.setUserCode(rs.getString(2));
userObj.setUserPK(rs.getString(3));
vv.addElement(userObj);
}
userObjs = new nc.vo.pub.msg.UserNameObject[vv.size()];
vv.copyInto(userObjs);
} finally {
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
/** ********************************************************** */
// 保留的系统管理接口:
afterCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "getUserObj",
new Object[] { userids });
/** ********************************************************** */
return userObjs;
}
/**
*
* @param pk_corp
* @param funcode
* @return
* @throws java.sql.SQLException
*/
public nc.vo.pub.msg.UserNameObject[] getPowerUserid(String pk_corp,String funcode) throws java.sql.SQLException {
/** ********************************************************** */
// 保留的系统管理接口:
beforeCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "getPowerUserid",
new Object[] { pk_corp, funcode });
/** ********************************************************** */
Connection conn = null;
Statement stmt = null;
Vector vv = new Vector();
nc.vo.pub.msg.UserNameObject[] userObjs = null;
try {
conn = getConnection();
stmt = conn.createStatement();
String sql = " ";
// update by zhyan v50 由于权限表改为角色后,查询用户分配的功能权限节点
if(funcode !=null && funcode.equalsIgnoreCase("600707")){
sql = "select distinct user_name,user_code,u.cuserid from sm_user u "
+"left outer join sm_user_role ur on ur.cuserid = u.cuserid "
+"left outer join sm_power_func pf on ur.pk_role = pf.pk_role "
+"left outer join sm_funcregister f on pf.resource_data_id = f.cfunid "
+"where f.fun_code ='"+funcode +"' and (pf.pk_corp = '"+pk_corp+"' or pf.pk_corp ='0001')"
+" and ur.pk_corp ='"+pk_corp+"' ";
// }else if(funcode.equalsIgnoreCase("600706")){
// sql = "select distinct user_name,user_code,u.cuserid from sm_user u "
// +"left outer join sm_user_role ur on ur.cuserid = u.cuserid "
// +"left outer join sm_power_func pf on ur.pk_role = pf.pk_role "
// +"where (pf.pk_corp = '"+pk_corp+"' or pf.pk_corp ='0001')"
// +" and ur.pk_corp ='"+pk_corp+"' ";
}else {
sql = "select distinct user_name,user_code,u.cuserid from sm_user_role ur "
+" left outer join sm_user u on ur.cuserid=u.cuserid "
+" left outer join sm_power_func pf on ur.pk_role = pf.pk_role "
+" where ur.pk_corp = '"+pk_corp+"'order by user_name ";
}
ResultSet rs = stmt.executeQuery(sql);
while (rs.next()) {
nc.vo.pub.msg.UserNameObject userObj = new nc.vo.pub.msg.UserNameObject(rs.getString(1));
userObj.setUserCode(rs.getString(2));
userObj.setUserPK(rs.getString(3));
vv.addElement(userObj);
}
userObjs = new nc.vo.pub.msg.UserNameObject[vv.size()];
vv.copyInto(userObjs);
} finally {
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
/** ********************************************************** */
// 保留的系统管理接口:
afterCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "getPowerUserid",
new Object[] { pk_corp, funcode });
/** ********************************************************** */
return userObjs;
}
/**
*
* @param pk_corp
* @return
* @throws java.sql.SQLException
*/
public String getRecievers(String pk_corp,int usertype) throws java.sql.SQLException {
String sql = "select recieveruserids from hr_message where pk_corp = ?";
String recievers = null;
Connection conn = null;
PreparedStatement stmt = null;
try {
conn = getConnection();
stmt = conn.prepareStatement(sql);
stmt.setString(1, pk_corp);
ResultSet rs = stmt.executeQuery();
while (rs.next()) {
String r =rs.getString(1);
if(r!=null){
recievers = r.trim();
}
}
} finally {
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
return recievers;
}
/**
*
* @param pk_corp
* @return
* @throws java.sql.SQLException
*/
public String getPsnchgpk(String pk_psndoc) throws java.sql.SQLException {
String sql = "select pk_psndoc_sub from hi_psndoc_deptchg where pk_psndoc = ? and recordnum=0 and lastflag='Y' and jobtype=0";
String pk = null;
Connection conn = null;
PreparedStatement stmt = null;
try {
conn = getConnection();
stmt = conn.prepareStatement(sql);
stmt.setString(1, pk_psndoc);
ResultSet rs = stmt.executeQuery();
while (rs.next()) {
pk = rs.getString(1).trim();
}
} finally {
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
return pk;
}
public GeneralVO[] queryListItem(String pk_corp, String funcode,
String queryScope) throws SQLException {
/** ********************************************************** */
// 保留的系统管理接口:
beforeCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "queryListItem",
new Object[] { pk_corp, funcode, queryScope });
/** ********************************************************** */
GeneralVO[] items = null;
boolean isAll = "all".equalsIgnoreCase(queryScope);
Connection conn = null;
PreparedStatement stmt = null;
Vector v = new Vector();
try {
conn = getConnection();
String sql = "select hi_itemset.pk_flddict,setcode,setname,hi_flddict.fldcode,hi_flddict.fldname,hi_flddict.datatype,hi_flddict.pk_fldreftype,hi_flddict.pk_flddict,hi_flddict.pk_setdict,hi_itemset.showorder,hi_flddict.showorder as dictshoworder " +
"from hi_flddict inner join hi_setdict on hi_flddict.pk_setdict = hi_setdict.pk_setdict " +
"left outer join hi_itemset on (hi_flddict.pk_flddict = hi_itemset.pk_flddict and hi_itemset.funcode = '"
+ funcode
+ "' and hi_itemset.pk_corp = '"
+ pk_corp
+ "' and hi_itemset.userid='"+PubEnv.getPk_user()+"') where (hi_flddict.pk_setdict in ('40000000000000000001','40000000000000000002') and (fldcode not like 'UFAGE%' and fldcode <> 'photo' ) and ( fldcode not like 'UFFORMULA_DATA_%' ) and (hi_flddict.create_pk_corp = '"
+ pk_corp
//+ "' or hi_flddict.isshare = 'Y') and hi_flddict.isdisplay = 'Y') or ( hi_flddict.pk_setdict = '20000000000000000001' and hi_flddict.fldcode = 'deptcode') order by hi_itemset.showorder,hi_flddict.pk_setdict,hi_flddict.showorder";
+ "' or hi_flddict.isshare = 'Y') and hi_flddict.isdisplay = 'Y') "
+"or ( hi_flddict.pk_setdict = '20000000000000000001' and hi_flddict.fldcode = 'deptcode') "
+"or ( hi_flddict.pk_setdict = '10000000000000000001' and hi_flddict.fldcode = 'unitcode') "
+"or ( hi_flddict.pk_setdict = '10000000000000000001' and hi_flddict.fldcode = 'unitname') "
+"or ( hi_flddict.pk_setdict = '40000000000000000003' and hi_flddict.fldcode = 'jobtype') "
+"order by hi_itemset.showorder,hi_flddict.pk_setdict,hi_flddict.showorder";
stmt = conn.prepareStatement(sql);
ResultSet rs = stmt.executeQuery();
while (rs.next()) {
GeneralVO item = new GeneralVO();
String pkflddict1 = rs.getString(1);
item.setAttributeValue("isDisplay",pkflddict1 == null ? new Boolean(false) : new Boolean(true));
item.setAttributeValue("setcode", rs.getString(2));
item.setAttributeValue("setname", HRResHiDictHelper.getSetName((String) item.getAttributeValue("setcode"), rs.getString(3)));
String fldcode = rs.getString(4);
item.setAttributeValue("fldcode", fldcode);
item.setAttributeValue("fldname", HRResHiDictHelper.getFldName((String) item.getAttributeValue("setcode"),(String) item.getAttributeValue("fldcode"), rs.getString(5)));
item.setAttributeValue("datatype", new Integer(rs.getInt(6)));
item.setAttributeValue("fldreftype", rs.getString(7));
item.setAttributeValue("pk_flddict", rs.getString(8));
item.setAttributeValue("pk_setdict", rs.getString(9));
item.setAttributeValue("showorder", new Integer(rs.getInt(10)));
// del by zhyan 2006-04-14
// int showorder = rs.getInt(11);
// if(pkflddict1==null){
// item.setAttributeValue("showorder",new Integer(showorder));
// }
if (isAll) {
if ("psncode".equalsIgnoreCase(fldcode) || "psnname".equalsIgnoreCase(fldcode)
|| "unitname".equalsIgnoreCase(fldcode) || "jobtype".equalsIgnoreCase(fldcode)) {
item.setAttributeValue("isDisplay", new Boolean(true));
}
if("psnname".equalsIgnoreCase(fldcode)){
if(v.size()>1){
v.insertElementAt(item, 1);
}else{
v.addElement(item);
}
}else{
v.addElement(item);
}
} else {
if (((Boolean) item.getAttributeValue("isDisplay"))
.booleanValue()) {
v.addElement(item);
}
}
}
items = new GeneralVO[v.size()];
v.copyInto(items);
} finally {
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
/** ********************************************************** */
// 保留的系统管理接口:
afterCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "queryListItem",
new Object[] { pk_corp, funcode, queryScope });
/** ********************************************************** */
return items;
}
public String dataUniqueValidate(String pk_corp,
nc.vo.bd.psndoc.PsndocConsItmVO[] conitmUniqueFields,
CircularlyAccessibleValueObject psnbasDocVO) throws SQLException {
/** ********************************************************** */
// 保留的系统管理接口:
beforeCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "dataUniqueValidate",
new Object[] { pk_corp, conitmUniqueFields, psnbasDocVO });
/** ********************************************************** */
Connection conn = null;
PreparedStatement stmt = null;
String returnMsg = null;
try {
conn = getConnection();
String sql = " select pk_psnbasdoc,pk_corp from bd_psnbasdoc ";
String where = null;
if (conitmUniqueFields != null && psnbasDocVO != null) {
Object pk_psnbasdocObj = psnbasDocVO
.getAttributeValue("pk_psnbasdoc");
if (pk_psnbasdocObj != null) {
where = " where pk_psnbasdoc <> '"
+ pk_psnbasdocObj.toString() + "'";
}
for (int i = 0; i < conitmUniqueFields.length; i++) {// 没有对数据类型为
// 非字符的进行处理
String fieldname = conitmUniqueFields[i].getField_name();
Object value = psnbasDocVO.getAttributeValue(fieldname);
String whereconditon = "";
if(fieldname.equals("id")){
String anotherID="";
if (value.toString().length() == 18) {
anotherID = value.toString().substring(0, 6) + value.toString().substring(8, 17);
}else if(value.toString().length() ==15){//v53
IDValidateUtil idutil = new IDValidateUtil(value.toString());
anotherID = idutil.getUpgradeId();//v53
}
whereconditon ="(id = '"+value.toString()+"' or id ='"+anotherID+"')";
}else{
whereconditon = fieldname+ " = '"+ value.toString().trim() + "'";
}
if (i == 0) {
if (where == null) {
where = " where ";
where += whereconditon;
} else {
where += " and " + whereconditon;
}
} else {
where += " and " + whereconditon;
}
}
}
if (where != null) {
sql += where;
}
stmt = conn.prepareStatement(sql);
ResultSet rs = stmt.executeQuery();
if (rs.next()) {// 在存在基本档案的情况下,再查找是否存在人员管理档案,如果存在,得到公司,部门,岗位和是否在岗的信息
String pk_psnbasdoc = rs.getString(1);
String create_pk_corp = rs.getString(2);
rs.close();
stmt.close();
if (!"0001".equalsIgnoreCase(create_pk_corp)) {
String sql2 = " select unitname,deptname,jobname,poststat from bd_psndoc "
+ " left outer join bd_corp on bd_psndoc.pk_corp = bd_corp.pk_corp"
+ " left outer join bd_deptdoc on bd_psndoc.pk_deptdoc = bd_deptdoc.pk_deptdoc "
+ " left outer join om_job on bd_psndoc.pk_om_job = om_job.pk_om_job "
+ " where pk_psnbasdoc=? order by psnclscope ";// and bd_psndoc.pk_corp
// = ?
stmt = conn.prepareStatement(sql2);
stmt.setString(1, pk_psnbasdoc);
// stmt.setString(2, create_pk_corp);
rs = stmt.executeQuery();
if (rs.next()) {
String unitname = rs.getString(1);
returnMsg = (unitname == null ? NCLangResOnserver
.getInstance().getStrByID("600704",
"UPP600704-000243")/* @res "无公司" */
+ ", \n" : NCLangResOnserver.getInstance()
.getStrByID("600704", "UPP600704-000053")/*
* @res
* "公司:"
*/
+ ":" + unitname + ", \n");
String deptname = rs.getString(2);
returnMsg += (deptname == null ? NCLangResOnserver
.getInstance().getStrByID("600704",
"UPP600704-000244")/* @res ",无部门" */
+ ", \n" : NCLangResOnserver.getInstance()
.getStrByID("600704", "upt600704-000139")/*
* @res
* ",部门:"
*/
+ ":" + deptname + ", \n");
String jobname = rs.getString(3);
returnMsg += (jobname == null ? NCLangResOnserver
.getInstance().getStrByID("600704",
"UPP600704-000245")/* @res ",无岗位" */
+ ", \n" : NCLangResOnserver.getInstance()
.getStrByID("600704", "upt600704-000094")/*
* @res
* ",岗位:"
*/
+ ":" + jobname + ", \n");
String poststat = rs.getString(4);
if ("Y".equalsIgnoreCase(poststat)) {
returnMsg += NCLangResOnserver.getInstance()
.getStrByID("600704", "UPP600704-000246")/*
* @res
* "在岗"
*/;
} else {
returnMsg += NCLangResOnserver.getInstance()
.getStrByID("600704", "UPP600704-000247")/*
* @res
* "不在岗"
*/;
}
}
}
}
} finally {
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
/** ********************************************************** */
// 保留的系统管理接口:
afterCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "dataUniqueValidate",
new Object[] { pk_corp, conitmUniqueFields, psnbasDocVO });
/** ********************************************************** */
return returnMsg;
}
/**
* 查询是否为再聘返聘人员
* @param pk_corp
* @param conitmUniqueFields
* @param psnbasDocVO
* @param returntype --0 为返聘,1 为再聘,如果有其他类型,可再增加
* @return
* @throws SQLException
*/
public GeneralVO checkRehirePerson(String pk_corp,
nc.vo.bd.psndoc.PsndocConsItmVO[] conitmUniqueFields,
CircularlyAccessibleValueObject psnbasDocVO,int returntype) throws SQLException {
Connection conn = null;
PreparedStatement stmt = null;
String returnMsg = null;
GeneralVO result = null;
try {
conn = getConnection();
String sql = " select bd_psnbasdoc.pk_psnbasdoc,bd_psnbasdoc.pk_corp from bd_psnbasdoc left outer join bd_psndoc on bd_psnbasdoc.pk_psnbasdoc= bd_psndoc.pk_psnbasdoc ";
String where = null;
String subselect = null;
Object pk_psnbasdocObj = psnbasDocVO.getAttributeValue("pk_psnbasdoc");
if (returntype ==0){//返聘查询归属范围为离退休人员 psnclscope =3
if (pk_psnbasdocObj != null) {
where = " where pk_psnbasdoc <> '"
+ pk_psnbasdocObj.toString() + "' and bd_psndoc.psnclscope =3 and bd_psndoc.indocflag ='Y' ";
}else{
where =" where bd_psndoc.psnclscope = 3 and bd_psndoc.indocflag ='Y' ";
}
}else if(returntype ==1){//再聘查询归属范围为解聘人员 psnclscope =2
if (pk_psnbasdocObj != null) {
where = " where pk_psnbasdoc <> '"
+ pk_psnbasdocObj.toString() + "' and bd_psndoc.psnclscope =2 and bd_psndoc.indocflag ='Y' ";
}else{
where =" where bd_psndoc.psnclscope =2 and bd_psndoc.indocflag ='Y' ";
}
}
//过滤掉还有在职的工作信息的人员,查询所有工作记录都是非在职
subselect = " and bd_psndoc.pk_psnbasdoc not in (select pk_psnbasdoc from bd_psndoc where psnclscope in (0) and pk_psnbasdoc in(select pk_psnbasdoc from bd_psnbasdoc where ";
if (conitmUniqueFields != null && psnbasDocVO != null) {
for (int i = 0; i < conitmUniqueFields.length; i++) {// 没有对数据类型为
// 非字符的进行处理
String fieldname = conitmUniqueFields[i].getField_name();
Object value = psnbasDocVO.getAttributeValue(fieldname);
//fengwei 2010-09-08 返聘、再聘时,身份证号不管是15位还是18位,只要是一个人即可。start
String whereconditon = "";
if(fieldname.equals("id")){
String anotherID="";
if (value.toString().length() == 18) {
anotherID = value.toString().substring(0, 6) + value.toString().substring(8, 17);
}else if(value.toString().length() ==15){//v53
IDValidateUtil idutil = new IDValidateUtil(value.toString());
anotherID = idutil.getUpgradeId();//v53
}
whereconditon ="(bd_psnbasdoc.id = '"+value.toString()+"' or bd_psnbasdoc.id ='"+anotherID+"')";
}else{
whereconditon = "bd_psnbasdoc." + fieldname+ " = '"+ value.toString().trim() + "'";
}
if (i == 0) {
if (where == null) {
where = " where ";
where += whereconditon;
} else {
where += " and " + whereconditon;
}
subselect += whereconditon;
} else {
where += " and " + whereconditon;
subselect += " and " + whereconditon;
}
// if (value != null) {
// if (i == 0) {
// if (where == null) {
// where = " where ";
// where += " bd_psnbasdoc."+fieldname + " = '"
// + value.toString().trim() + "'";
// } else {
// where += " and bd_psnbasdoc." + fieldname + " = '"
// + value.toString().trim() + "'";
// }
// subselect += " bd_psnbasdoc." + fieldname + " = '"
// + value.toString().trim() + "'";
// } else {
// where += " and bd_psnbasdoc." + fieldname + " = '"
// + value.toString().trim() + "'";
// subselect += " and bd_psnbasdoc." + fieldname + " = '"
// + value.toString().trim() + "'";
// }
//fengwei 2010-09-08 返聘、再聘时,身份证号不管是15位还是18位,只要是一个人即可。end
// }
}
}
if (where != null) {
sql += where;
}
sql+= subselect+"))";
stmt = conn.prepareStatement(sql);
ResultSet rs = stmt.executeQuery();
if (rs.next()) {// 在存在基本档案的情况下,再查找是否存在人员管理档案,如果存在,得到公司,部门,岗位和是否在岗的信息
String pk_psnbasdoc = rs.getString(1);
String create_pk_corp = rs.getString(2);
rs.close();
stmt.close();
if (!"0001".equalsIgnoreCase(create_pk_corp)) {
String sql2 = "";
if(returntype ==0){//返聘查询离退人员
sql2 = " select unitname,deptname,jobname,poststat,psnclassname ,bd_psndoc.pk_psndoc from bd_psndoc "
+ " left outer join bd_corp on bd_psndoc.pk_corp = bd_corp.pk_corp"
+ " left outer join bd_deptdoc on bd_psndoc.pk_deptdoc = bd_deptdoc.pk_deptdoc "
+ " left outer join om_job on bd_psndoc.pk_om_job = om_job.pk_om_job "
+ " left outer join bd_psncl on bd_psndoc.pk_psncl = bd_psncl.pk_psncl "
+ " where pk_psnbasdoc =? and bd_psndoc.psnclscope = 3 and bd_psndoc.pk_corp ='"+create_pk_corp+"'";
}else if(returntype ==1){//再聘查询解聘人员
sql2 = " select unitname,deptname,jobname,poststat,psnclassname ,bd_psndoc.pk_psndoc from bd_psndoc "
+ " left outer join bd_corp on bd_psndoc.pk_corp = bd_corp.pk_corp"
+ " left outer join bd_deptdoc on bd_psndoc.pk_deptdoc = bd_deptdoc.pk_deptdoc "
+ " left outer join om_job on bd_psndoc.pk_om_job = om_job.pk_om_job "
+ " left outer join bd_psncl on bd_psndoc.pk_psncl = bd_psncl.pk_psncl "
+ " where pk_psnbasdoc=? and bd_psndoc.psnclscope = 2 and bd_psndoc.pk_corp ='"+create_pk_corp+"'";
}
//add by lq --------------------------
sql2 = sql2 +" and not exists (select pk_psndoc from hi_psndoc_deptchg where lastflag='Y' and isreturn='Y' and pk_psnbasdoc='"+pk_psnbasdoc+"' and bd_psndoc.pk_psndoc=hi_psndoc_deptchg.pk_psndoc)";
//add by lq --------------------------
stmt = conn.prepareStatement(sql2);
stmt.setString(1, pk_psnbasdoc);
rs = stmt.executeQuery();
if (rs.next()) {
result = new GeneralVO();
String unitname = rs.getString(1);
returnMsg = (unitname == null ? NCLangResOnserver
.getInstance().getStrByID("600704",
"UPP600704-000243")/* @res "无公司" */
+ ", \n" : NCLangResOnserver.getInstance()
.getStrByID("600704", "UPP600704-000053")/*
* @res
* "公司:"
*/
+ ":" + unitname + ", \n");
String deptname = rs.getString(2);
returnMsg += (deptname == null ? NCLangResOnserver
.getInstance().getStrByID("600704",
"UPP600704-000244")/* @res ",无部门" */
+ ", \n" : NCLangResOnserver.getInstance()
.getStrByID("600704", "upt600704-000139")/*
* @res
* ",部门:"
*/
+ ":" + deptname + ", \n");
String jobname = rs.getString(3);
returnMsg += (jobname == null ? NCLangResOnserver
.getInstance().getStrByID("600704",
"UPP600704-000245")/* @res ",无岗位" */
+ ", \n" : NCLangResOnserver.getInstance()
.getStrByID("600704", "upt600704-000094")/*
* @res
* ",岗位:"
*/
+ ":" + jobname + ", \n");
String poststat = rs.getString(4);
if ("Y".equalsIgnoreCase(poststat)) {
returnMsg += NCLangResOnserver.getInstance()
.getStrByID("600704", "UPP600704-000246")/*
* @res
* "在岗"
*/+ ", \n";
} else {
returnMsg += NCLangResOnserver.getInstance()
.getStrByID("600704", "UPP600704-000247")/*
* @res
* "不在岗"
*/+ ", \n";
}
String psncl = rs.getString(5);
returnMsg += (psncl == null ? NCLangResOnserver.getInstance().getStrByID("600700", "UPP600700-000237")//"无类别"
+ ", \n" : NCLangResOnserver.getInstance()
.getStrByID("600704", "upt600704-000042")/*
* @res"人员类别为"*/
+ ":" + psncl + "\n");
result.setAttributeValue("returnMsg", returnMsg);
result.setAttributeValue("pk_psnbasdoc", pk_psnbasdoc);
result.setAttributeValue("pk_corp", create_pk_corp);
result.setAttributeValue("pk_psndoc", rs.getString(6));
}
}
}
} finally {
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
/** ********************************************************** */
// 保留的系统管理接口:
afterCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "dataUniqueValidate",
new Object[] { pk_corp, conitmUniqueFields, psnbasDocVO });
/** ********************************************************** */
return result;
}
/**
* 根据人员主键查询人员信息
* 创建日期:(2002-4-26 15:08:18)
* @return int
* @param psndocMains nc.vo.hi.hi_301.PsndocMainVO
*/
public GeneralVO queryPsnInfo(String pk_psndoc,String id,String psnname) throws java.sql.SQLException, java.io.IOException {
Connection conn = null;
PreparedStatement stmt = null;
ResultSet result = null;
GeneralVO gvo = new GeneralVO();
try {
String sql = "select psncode,bd_psndoc.psnname,deptname,jobname,unitname from bd_psndoc";
sql += " inner join bd_psnbasdoc on bd_psndoc.pk_psnbasdoc = bd_psnbasdoc.pk_psnbasdoc and bd_psndoc.pk_corp = bd_psnbasdoc.pk_corp";
sql += " inner join bd_corp on bd_corp.pk_corp = bd_psndoc.pk_corp";
sql += " left outer join bd_deptdoc on bd_psndoc.pk_deptdoc = bd_deptdoc.pk_deptdoc";
sql += " left outer join om_job on bd_psndoc.pk_om_job = om_job.pk_om_job";
conn = getConnection();
stmt = null;
if(pk_psndoc == null || pk_psndoc.trim().length() == 0){
sql += " where bd_psndoc.psnname = ? and bd_psnbasdoc.id = ?";
stmt = conn.prepareStatement(sql);
stmt.setString(1,psnname);
stmt.setString(2,id);
}else{
sql += " where bd_psndoc.pk_psndoc <> ? and bd_psndoc.psnname = ? and bd_psnbasdoc.id = ?";
stmt = conn.prepareStatement(sql);
stmt.setString(1,pk_psndoc);
stmt.setString(2,psnname);
stmt.setString(3,id);
}
result = stmt.executeQuery();
String[] fieldNames = new String[]{"psncode","psnname","deptname","jobname","unitname"};
if (result.next()) {
for(int i=0;i<fieldNames.length;i++){
Object value = result.getObject(i + 1);
if (value != null) {
value = ((String) value).trim();
gvo.setFieldValue(fieldNames[i], value);
}
}
}
return gvo;
} finally {
if (result != null)
result.close();
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
}
/**
*
* @param recievers
* @return
* @throws SQLException
*/
public GeneralVO[] getRecieverEmails(String recievers)throws SQLException {
GeneralVO[] address = null;
Vector v = new Vector();
String sql ="select u.cuserid,u.user_name,b.email from sm_user u left outer join sm_userandclerk c on u.cuserid = c.userid";
sql+= " left outer join bd_psnbasdoc b on b.pk_psnbasdoc = c.pk_psndoc " ;
sql+= " where u.cuserid in "+recievers;
Connection con = null;
PreparedStatement stmt = null;
String gorop_code = nc.vo.pub.CommonConstant.GROUP_CODE;
try {
con = getConnection();
stmt = con.prepareStatement(sql);
ResultSet rs = stmt.executeQuery();
while (rs.next()) {
GeneralVO vo = new GeneralVO();
String userid = rs.getString(1);
vo.setAttributeValue("cuserid", userid);
String username = rs.getString(2);
vo.setAttributeValue("username", username);
String email = rs.getString(3);
if(!" ".equalsIgnoreCase(email)){
vo.setAttributeValue("email", email);
}
v.addElement(vo);
}
} finally {
try {
if (stmt != null) {
stmt.close();
}
} catch (Exception e) {
}
try {
if (con != null) {
con.close();
}
} catch (Exception e) {
}
}
address = new GeneralVO[v.size()];
if (v.size() > 0) {
v.copyInto(address);
}
return address;
}
/**
* @得到信息集中的自定义项
* @param pk_corp
* @param pk_setdict
* @return
* @throws SQLException
*/
public String[] queryAllDefFlddict(String pk_corp,String pk_setdict) throws SQLException {
/** ********************************************************** */
// 保留的系统管理接口:
beforeCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "queryAllDefFlddict",
new Object[] { pk_corp, pk_setdict });
/** ********************************************************** */
String sql = "";
sql = "select fldcode from hi_flddict where pk_setdict = ? and fldcode like '%def%' and (pk_corp ='0001' or pk_corp = ?)";
String[] fldcodes = null;
Vector v = new Vector();
Connection con = null;
PreparedStatement stmt = null;
String gorop_code = nc.vo.pub.CommonConstant.GROUP_CODE;
try {
con = getConnection();
stmt = con.prepareStatement(sql);
stmt.setString(1, pk_setdict);
stmt.setString(2, pk_corp);
ResultSet rs = stmt.executeQuery();
while (rs.next()) {
String fldcode = new String();
fldcode = rs.getString(1);
v.addElement(fldcode);
}
} finally {
try {
if (stmt != null) {
stmt.close();
}
} catch (Exception e) {
}
try {
if (con != null) {
con.close();
}
} catch (Exception e) {
}
}
fldcodes = new String[v.size()];
if (v.size() > 0) {
v.copyInto(fldcodes);
}
/** ********************************************************** */
// 保留的系统管理接口:
afterCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "queryAllDefFlddict",
new Object[] { pk_corp, pk_setdict});
/** ********************************************************** */
return fldcodes;
}
/**
* 修改人员状态
* @param pk_psndocs
* @throws BusinessException
*/
public void updatePsnState(String[] pk_psndocs,int state)throws java.sql.SQLException {
String sql = " update bd_psnbasdoc set approveflag = "+state+ " where pk_psnbasdoc in (select pk_psnbasdoc from bd_psndoc where pk_psndoc = ? )";
sql = HROperatorSQLHelper.getSQLWithOperator(sql);
Connection con = null;
PreparedStatement stmt = null;
try {
con = getConnection();
stmt = con.prepareStatement(sql);
for (int i = 0; i < pk_psndocs.length; i++) {
stmt.setString(1, pk_psndocs[i]);
stmt.executeUpdate();
}
stmt.executeBatch();
} finally {
try {
if (stmt != null) {
stmt.close();
}
} catch (Exception e) {
}
try {
if (con != null) {
con.close();
}
} catch (Exception e) {
}
}
}
/**
* 返聘再聘人员的处理,先删除非在职记录,然后将非在职记录主键更新到新记录上
* @param pk_psndoc
* @param oldpk_psndoc
* @throws java.sql.SQLException
*/
public void updatePsnpkAnddel(String pk_psndoc,String oldpk_psndoc) throws java.sql.SQLException {
String sql = " delete from bd_psndoc where pk_psndoc = '"+oldpk_psndoc+"'";
String sql2 = " update bd_psndoc set pk_psndoc ='"+oldpk_psndoc+"' where pk_psndoc ='"+pk_psndoc+"'";
//处理入职申请单
String sql3 = " update hi_docapply_b set pk_psndoc ='"+oldpk_psndoc+"' where pk_psndoc ='"+pk_psndoc+"'";
// //处理任职记录
// String sql4 = " update hi_psndoc_deptchg set pk_psndoc ='"+oldpk_psndoc+"' where pk_psndoc ='"+pk_psndoc+"'";
Connection con = null;
PreparedStatement stmt = null;
try {
con = getConnection();
stmt = con.prepareStatement(sql);
stmt.executeUpdate();
stmt.close();
stmt = con.prepareStatement(sql2);
stmt.executeUpdate();
stmt.close();
stmt = con.prepareStatement(sql3);
stmt.executeUpdate();
// stmt.close();
// stmt = con.prepareStatement(sql4);
// stmt.executeUpdate();
} finally {
try {
if (stmt != null) {
stmt.close();
}
} catch (Exception e) {
}
try {
if (con != null) {
con.close();
}
} catch (Exception e) {
}
}
}
/**
* 校验申请单保存时的人员是否已经转入人员档案
* @param pk_psndocs
* @param pk_docapply_b
* @return
* @throws BusinessException
*/
public String checkIndoc(String pk_psndoc)throws java.sql.SQLException {
String sql = " select psnname from bd_psndoc where pk_psndoc =? and indocflag ='Y' ";
Connection con = null;
PreparedStatement stmt = null;
try {
con = getConnection();
stmt = con.prepareStatement(sql);
stmt.setString(1, pk_psndoc);
ResultSet rs =stmt.executeQuery();
if(rs.next()){
return rs.getString(1);
}
} finally {
try {
if (stmt != null) {
stmt.close();
}
} catch (Exception e) {
}
try {
if (con != null) {
con.close();
}
} catch (Exception e) {
}
}
return null;
}
/**
* 查询返聘再聘人员的非在职记录的主键,更新到新的返聘再聘记录上
* @param pk_psnbasdoc
* @param pk_corp
* @return
* @throws java.sql.SQLException
*/
public String getPkpsndoc(String pk_psnbasdoc,String pk_corp,String newpk_psndoc)throws java.sql.SQLException {
//此时新的工作档案也已经indocflag = 'Y',所以不能光通过indocflag = 'Y'来判断是老的工作记录
String sql = " select pk_psndoc from bd_psndoc where psnclscope >0 and indocflag = 'Y' and pk_psnbasdoc ='"+pk_psnbasdoc+"' and pk_corp ='"+pk_corp+"' and pk_psndoc<>'"+newpk_psndoc+"'";
Connection con = null;
PreparedStatement stmt = null;
try {
con = getConnection();
stmt = con.prepareStatement(sql);
ResultSet rs =stmt.executeQuery();
if(rs.next()){
return rs.getString(1);
}
} finally {
try {
if (stmt != null) {
stmt.close();
}
} catch (Exception e) {
}
try {
if (con != null) {
con.close();
}
} catch (Exception e) {
}
}
return null;
}
/**
* 查询采集的离职人员的任职部门
* @param pk_psndoc
* @param pk_corp
* @return
* @throws java.sql.SQLException
*/
public GeneralVO getChginfo(String pk_psndoc,String pk_corp)throws java.sql.SQLException {
GeneralVO vo = null;
String sql = " select pk_deptdoc,pk_psncl,pk_postdoc,pk_om_duty from hi_psndoc_deptchg where jobtype =0 and recordnum =0 and lastflag ='Y'and pk_psndoc ='"+pk_psndoc+"' and pk_corp ='"+pk_corp+"'";
Connection con = null;
PreparedStatement stmt = null;
try {
con = getConnection();
stmt = con.prepareStatement(sql);
ResultSet rs =stmt.executeQuery();
if(rs.next()){
vo = new GeneralVO();
vo.setAttributeValue("pk_deptdoc", rs.getString(1));
vo.setAttributeValue("pk_psncl", rs.getString(2));
vo.setAttributeValue("pk_postdoc", rs.getString(3));
vo.setAttributeValue("pk_om_duty", rs.getString(4));
}
} finally {
try {
if (stmt != null) {
stmt.close();
}
} catch (Exception e) {
}
try {
if (con != null) {
con.close();
}
} catch (Exception e) {
}
}
return vo;
}
/**
* 查询培训类别和培训方式名称
* @param tratypepkssql
* @param type 0为类别,1为方式
* @return
* @throws java.sql.SQLException
*/
public String[] getNames(String trapkssql,int type)throws java.sql.SQLException {
String[] names = null;
String sql = "";
if(type == 0){
sql = " select item_name from trm_item where pk_trm_item in "+trapkssql;
}else{
sql = " select docname from bd_defdoc where pk_defdoc in "+trapkssql;
}
Vector v = new Vector();
Connection con = null;
PreparedStatement stmt = null;
try {
con = getConnection();
stmt = con.prepareStatement(sql);
ResultSet rs =stmt.executeQuery();
while(rs.next()){
String name = rs.getString(1);
v.addElement(name);
}
} finally {
try {
if (stmt != null) {
stmt.close();
}
} catch (Exception e) {
}
try {
if (con != null) {
con.close();
}
} catch (Exception e) {
}
}
if(v.size()>0){
names = new String[v.size()];
v.copyInto(names);
}
return names;
}
/**
*
* @param pk_sub
* @param names
* @param type
* @throws java.sql.SQLException
*/
public void updateTraining(String pk_sub,String names ,int type)throws java.sql.SQLException {
String sql = "";
if(type == 0){
sql = " update hi_psndoc_training set trm_class_names ='"+names+"' where pk_psndoc_sub ='"+pk_sub+"'";
}else{
sql = " update hi_psndoc_training set tra_mode_name ='"+names+"' where pk_psndoc_sub ='"+pk_sub+"'";
}
Vector v = new Vector();
Connection con = null;
PreparedStatement stmt = null;
try {
con = getConnection();
stmt = con.prepareStatement(sql);
stmt.executeUpdate();
} finally {
try {
if (stmt != null) {
stmt.close();
}
} catch (Exception e) {
}
try {
if (con != null) {
con.close();
}
} catch (Exception e) {
}
}
}
/**
* 校验申请单保存时的人员信息
* @param pk_psndocs
* @param pk_docapply_b
* @return
* @throws BusinessException
*/
public String checkApplyPsn(String pk_psndoc,String pk_docapply_b)throws java.sql.SQLException {
String sql = " select psnname from hi_docapply_b b inner join hi_docapply_h h on b.pk_docapply_h = h.pk_docapply_h "
+" inner join bd_psndoc p on b.pk_psndoc= p.pk_psndoc ";
if( pk_docapply_b != null && pk_docapply_b.trim().length()>0 )
{
sql += " where ( (h.billstate in(2,3,8) and b.bapprove ='Y' and b.pk_psndoc ='"+pk_psndoc+"'and b.pk_docapply_b<>'"+pk_docapply_b+"') or ( h.pk_docapply_h = b.pk_docapply_h and h.billstate in ( 3,8 ) and b.bapprove = 'N' and b.pk_psndoc ='"+pk_psndoc+"'and b.pk_docapply_b<>'"+pk_docapply_b+"'))";
}else{
sql += " where ( (h.billstate in(2,3,8) and b.bapprove ='Y' and b.pk_psndoc ='"+pk_psndoc+"') or ( h.pk_docapply_h = b.pk_docapply_h and h.billstate in ( 3,8 ) and b.bapprove = 'N' and b.pk_psndoc ='"+pk_psndoc+"'))";
}
Connection con = null;
PreparedStatement stmt = null;
try {
con = getConnection();
stmt = con.prepareStatement(sql);
ResultSet rs =stmt.executeQuery();
if(rs.next()){
return rs.getString(1);
}
} finally {
try {
if (stmt != null) {
stmt.close();
}
} catch (Exception e) {
}
try {
if (con != null) {
con.close();
}
} catch (Exception e) {
}
}
return null;
}
public void afterInsertChild(String tablecode, String[] pk_psndoc_subs) throws SQLException {
if(tablecode==null||pk_psndoc_subs==null)
return;
Connection con = null;
PreparedStatement stmt = null;
String sql0 = "select pk_psnbasdoc,pk_corp from "+tablecode+" where pk_psndoc_sub = ?";
String sql1 = "update " +tablecode+ " set recordnum=recordnum+1,lastflag='N' where pk_psnbasdoc = ? and pk_corp = ? and pk_psndoc_sub<>?";
String sql2 = "update " +tablecode+ " set recordnum=0,lastflag='Y' where pk_psndoc_sub = ?";
try {
con = getConnection();
for(String pk_psndoc_sub : pk_psndoc_subs){
stmt = con.prepareStatement(sql0);
stmt.setString(1, pk_psndoc_sub);
ResultSet rs = stmt.executeQuery();
if(rs.next()){
String pk_psnbasdoc = rs.getString(1);
String pk_corp = rs.getString(2);
stmt.close();
stmt = con.prepareStatement(sql1);
stmt.setString(1,pk_psnbasdoc);
stmt.setString(2, pk_corp);
stmt.setString(3, pk_psndoc_sub);
stmt.executeUpdate();
stmt.close();
stmt = con.prepareStatement(sql2);
stmt.setString(1,pk_psndoc_sub);
stmt.executeUpdate();
stmt.close();
}
}
} finally {
try {
if (con != null) {
con.close();
}
} catch (Exception e) {
}
}
}
public void deleteChildSet(String tablecode, String[] pk_psndoc_subs) throws SQLException {
if(tablecode==null||pk_psndoc_subs==null)
return;
Connection con = null;
PreparedStatement stmt = null;
String sql = "delete from "+tablecode+" where pk_psndoc_sub = ?";
String sql0 = "select pk_psnbasdoc,pk_corp,recordnum from "+tablecode+" where pk_psndoc_sub = ?";
String sql1 = "update " +tablecode+ " set recordnum=recordnum-1,lastflag='N' where pk_psnbasdoc = ? and pk_corp = ? and recordnum>?";
String sql2 = "update " +tablecode+ " set lastflag='Y' where pk_psnbasdoc = ? and pk_corp = ? and recordnum=0 ";
try {
con = getConnection();
for(String pk_psndoc_sub : pk_psndoc_subs){
stmt = con.prepareStatement(sql0); //查询基本表主键,业务公司,序列号
stmt.setString(1, pk_psndoc_sub);
ResultSet rs = stmt.executeQuery();
if(rs.next()){
String pk_psnbasdoc = rs.getString(1);
String pk_corp = rs.getString(2);
int recordnum = rs.getInt(3);
stmt.close();
stmt = con.prepareStatement(sql); //删除记录
stmt.setString(1, pk_psndoc_sub);
stmt.executeUpdate();
stmt.close();
stmt = con.prepareStatement(sql1); //更新大于recordnum>当前删除行的序号减一
stmt.setString(1,pk_psnbasdoc);
stmt.setString(2, pk_corp);
stmt.setInt(3, recordnum);
stmt.executeUpdate();
stmt.close();
stmt = con.prepareStatement(sql2); //更新recordnum=0的记录的最新标志为Y
stmt.setString(1,pk_psnbasdoc);
stmt.setString(2, pk_corp);
stmt.executeUpdate();
stmt.close();
}
}
} finally {
try {
if (con != null) {
con.close();
}
} catch (Exception e) {
}
}
}
/**
* 是否存在自助用户
*
* @param pk_psndoc
* @return
* @throws java.sql.SQLException
*/
public Hashtable isNeedSelfUser(GeneralVO[] vos)
throws java.sql.SQLException {
// 公司主键
String pk_corp = null;
if (vos != null && vos.length > 0) {
pk_corp = (String) vos[0].getAttributeValue("pk_corp");
} else
return null;
Connection con = null;
PreparedStatement stmt = null;
ResultSet rs = null;
Hashtable isNeedSelfUser = new Hashtable();
// 人员基本主键
String pk_psnbasdoc = null;
// 人员管理主键
String pk_psndoc = null ;
try {
con = getConnection();
// 生成临时表
TempTable tt = new TempTable();
// 创建临时表
String temptable = tt.createTempTable(con, "tquerySelfUsertable",
"pk_psnbasdoc char(20),pk_psndoc char(20),ts char(19)",
null);
// 插入记录到临时表
String tempsql = "insert into " + temptable
+ " (pk_psnbasdoc,pk_psndoc) values(?,?) ";
StringBuffer bsql = new StringBuffer("select ");
bsql
.append(temptable)
.append(".pk_psndoc from ")
.append(temptable)
.append(
" where pk_psnbasdoc not in (select pk_psndoc from sm_userandclerk where pk_corp = ?) ");
// 获取插入值
stmt = con.prepareStatement(tempsql);
for (int i = 0; i < vos.length; i++) {
pk_psnbasdoc = (String) vos[i]
.getAttributeValue("pk_psnbasdoc");
pk_psndoc = (String) vos[i].getAttributeValue("pk_psndoc");
stmt.setObject(1, pk_psnbasdoc);
stmt.setObject(2, pk_psndoc);
stmt.executeUpdate();
}
executeBatch(stmt);
stmt = con.prepareStatement(bsql.toString());
stmt.setObject(1, pk_corp);
rs = stmt.executeQuery();
while (rs.next()) {
pk_psndoc = rs.getString(1);
// 是否部门负责人
if (isPrincipal(pk_psndoc))
isNeedSelfUser.put(pk_psndoc, true);
else
isNeedSelfUser.put(pk_psndoc, false);
}
} finally {
if (stmt != null)
stmt.close();
if (con != null)
con.close();
}
return isNeedSelfUser;
}
/**
* 是否是部门负责人
*
* @param pk_psndoc
* @return
* @throws java.sql.SQLException
*/
public boolean isPrincipal(String pk_psndoc)
throws java.sql.SQLException {
String sql = "select 1 from bd_deptdoc where pk_psndoc = ? or pk_psndoc2 = ? or pk_psndoc3 = ? ";
Connection conn = null;
PreparedStatement stmt = null;
ResultSet rs = null;
boolean isPrincipal = false;
try {
conn = getConnection();
stmt = conn.prepareStatement(sql);
stmt.setString(1, pk_psndoc);
stmt.setString(2, pk_psndoc);
stmt.setString(3, pk_psndoc);
rs = stmt.executeQuery();
if (rs.next()) {
isPrincipal = true;
}
} finally {
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
return isPrincipal;
}
/**
* 根据人员主键查询人员信息 创建日期:(2002-4-26 15:08:18)
*
* @return int
* @param psndocMains
* nc.vo.hi.hi_301.PsndocMainVO
*/
public GeneralVO[] queryPsnInfo(String pk, String sqlDate, String table,
String[] fieldNames, GeneralVO[] psnList,
BusinessFuncParser_sql funcParser)
throws java.sql.SQLException,
java.io.IOException {
Connection conn = null;
PreparedStatement stmt = null;
ResultSet result = null;
try {
sqlDate += " from bd_psndoc inner join bd_psnbasdoc on bd_psndoc.pk_psnbasdoc = bd_psnbasdoc.pk_psnbasdoc ";
if ("bd_psndoc".equalsIgnoreCase(table)) {
sqlDate += " where bd_psndoc.pk_psndoc='" + pk + "'";
} else {
sqlDate += " where bd_psndoc.pk_psnbasdoc='"
+ pk
+ "' or bd_psndoc.pk_psnbasdoc = (select pk_psnbasdoc from bd_psndoc where pk_psndoc='"
+ pk + "')";
}
conn = getConnection();
stmt = null;
stmt = conn.prepareStatement(sqlDate);
result = stmt.executeQuery();
if (result.next()) {
for (int i = 0; i < fieldNames.length; i++) {
Object value = result.getObject(i + 2);
if (value != null) {
if (value instanceof String)
value = ((String) value).trim();
//
psnList[0].setFieldValue(fieldNames[i], value);
}
}
}
return psnList;
} finally {
if (result != null)
result.close();
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
}
/**
*
* @param pk_om_dumorg
* @return
* @throws java.sql.SQLException
* @throws java.io.IOException
*/
public GeneralVO queryDetailForDumorg(String pk_om_dumorg)
throws java.sql.SQLException, java.io.IOException {
String sql = "select builddate from om_dumorg where pk_om_dumorg = ? ";
GeneralVO vo = null;
Connection conn = null;
PreparedStatement stmt = null;
ResultSet rs = null;
try {
conn = getConnection();
stmt = conn.prepareStatement(sql);
stmt.setString(1, pk_om_dumorg);
rs = stmt.executeQuery();
//
if (rs.next()) {
vo = new GeneralVO();
vo.setAttributeValue("builddate", rs.getString(1));
}
} finally {
if (rs != null)
rs.close();
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
return vo;
}
public String queryFieldDict(String pk_corp) throws java.sql.SQLException{
String sql_setdict = "SELECT a.fldcode from hi_flddict a,HI_SETDICT b"
+" WHERE a.PK_SETDICT = b.PK_SETDICT"
+" and b.SETCODE = 'bd_psndoc' "
+" AND (a.pk_corp ='0001' OR a.pk_corp = ?)"
+" and (((a.fldcode like 'def%' or a.fldcode like 'groupdef%') and a.PK_FLDREFTYPE is not null )"
+" or((a.fldcode not like 'def%' and a.fldcode not like 'groupdef%')))"
+" and a.DATATYPE <>10"
+" order by a.SHOWORDER";
Connection conn = null;
PreparedStatement stmt = null;
ResultSet rs = null;
String resultstr = "";
try {
conn = getConnection();
stmt = conn.prepareStatement(sql_setdict);
stmt.setString(1, pk_corp);
rs = stmt.executeQuery();
while (rs.next()) {
resultstr+="bd_psndoc."+rs.getString(1)+",";
}
} finally {
if (rs != null)
rs.close();
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
return resultstr;
}
public GeneralVO[] queryPerson(String pk_psndocs[],String fields_select) throws java.sql.SQLException, IOException{
String pk_psndoc_str = "";
for(String pk_psndoc:pk_psndocs){
pk_psndoc_str+=",'"+pk_psndoc+"'";
}
pk_psndoc_str = pk_psndoc_str.substring(1);
String sql = "select "+fields_select+" from bd_psndoc";
sql += " inner join bd_psnbasdoc on bd_psndoc.pk_psnbasdoc = bd_psnbasdoc.pk_psnbasdoc and bd_psndoc.pk_corp = bd_psnbasdoc.pk_corp";
sql += " inner join bd_corp on bd_corp.pk_corp = bd_psndoc.pk_corp";
sql += " left outer join bd_deptdoc on bd_psndoc.pk_deptdoc = bd_deptdoc.pk_deptdoc";
sql += " left outer join om_job on bd_psndoc.pk_om_job = om_job.pk_om_job";
sql += " left outer join bd_psncl on bd_psndoc.pk_psncl=bd_psncl.pk_psncl";
sql += " left outer join om_duty on bd_psndoc.dutyname=om_duty.pk_om_duty";
sql += " where bd_psndoc.pk_psndoc in ("+pk_psndoc_str+")";
return (GeneralVO[]) querySql(sql).toArray(new GeneralVO[0]);
}
public void checkIfExistsUnAuditBillofPSN(String[] pk_psndocs,String setcode)
throws BusinessException {
String pk_psndoc_str = "";
for(String pk_psndoc:pk_psndocs){
pk_psndoc_str+=",'"+pk_psndoc+"'";
}
pk_psndoc_str = pk_psndoc_str.substring(1);
String sql ="";
if(setcode.equals("maintable")){
sql ="select bd_psndoc.psnname from hrss_setalter,bd_psndoc where bd_psndoc.pk_psndoc = hrss_setalter.pk_psndoc"
+" and bd_psndoc.pk_psndoc in ("+pk_psndoc_str+") and (hrss_setalter.setcode ='bd_psndoc' or hrss_setalter.setcode ='bd_psnbasdoc') and hrss_setalter.data_status=1 ";
}else{
sql ="select bd_psndoc.psnname from hrss_setalter,bd_psndoc where bd_psndoc.pk_psndoc = hrss_setalter.pk_psndoc"
+" and bd_psndoc.pk_psndoc in ("+pk_psndoc_str+") and hrss_setalter.setcode ='"+setcode+"' and hrss_setalter.data_status=1 ";
}
Connection conn = null;
PreparedStatement stmt = null;
ResultSet rs = null;
String resultstr = "";
try {
conn = getConnection();
stmt = conn.prepareStatement(sql);
rs = stmt.executeQuery();
while (rs.next()) {
resultstr+=","+rs.getString(1);
}
}
catch(Exception e){
e.printStackTrace();
}
finally {
try{
if (rs != null)
rs.close();
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}catch(Exception e){
e.printStackTrace();
}
}
if("".equals(resultstr)) return ;
resultstr = resultstr.substring(1);
/*有未审批的人员信息变更,不能编辑!*/
throw new BusinessException(resultstr+":"+nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("6007","UPT6007-000236"));
}
/*********************************************************************************************************
* 查询引用人员
* @param data
* @param tableCode
* @return GeneralVO[]
* @throws java.io.IOException
* @throws java.sql.SQLException
********************************************************************************************************/
public GeneralVO[] queryRefPsn(GeneralVO[] data) throws java.io.IOException, java.sql.SQLException {
// 保留的系统管理接口:
beforeCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "queryRefPsn",
new Object[] { data});
/** ********************************************************** */
Connection con = null;
PreparedStatement stmt = null;
if (data == null || data.length == 0) {
return null;
}
ArrayList<GeneralVO> list = new ArrayList<GeneralVO>();
try {
String sql = "select pk_deptdoc,pk_corp,pk_psnbasdoc,pk_psndoc " +
" from bd_psndoc where isreferenced = 'Y' and pk_psndoc " +
"in (select pk_psndoc from hi_psndoc_ref where pk_psnbasdoc = ? ) ";
con = getConnection();
for (int i = 0; i < data.length; i++) {
stmt = con.prepareStatement(sql);
stmt.setString(1, (String) data[i].getAttributeValue("pk_psnbasdoc"));
ResultSet rs = stmt.executeQuery();
while(rs.next()){
GeneralVO psndoc = new GeneralVO();
psndoc.setAttributeValue("pk_dept_new", rs.getString(1));
psndoc.setAttributeValue("pk_corp_new", rs.getString(2));
psndoc.setAttributeValue("pk_psnbasdoc", rs.getString(3));
psndoc.setAttributeValue("pk_psndoc", rs.getString(4));
list.add(psndoc);
}
stmt.close();
}
} finally {
if (stmt != null)
stmt.close();
if (con != null)
con.close();
}
/** ********************************************************** */
// 保留的系统管理接口:
afterCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "queryRefPsn",
new Object[] { data });
/** ********************************************************** */
return list.toArray(new GeneralVO[0]);
}
/**
* 获取当前辅助信息集字段的关联信息,放在映射表中。 创建日期:(2004-5-30 16:42:44)
* @author lvgd1
*/
public Hashtable getTempRelationMap() {
// 辅助信息表的关联字段逆向映射表
Hashtable relationMap = new Hashtable();
// 查询所有关联字段信息
GeneralVO[] relatedFields;
try {
relatedFields = HIDelegator.getPsnInf().queryAllRelatedTableField(
PubEnv.getPk_corp());
// 放入映射表中
for (int i = 0; i < relatedFields.length; i++) {
String table = (String) relatedFields[i]
.getAttributeValue("setcode");
String field = (String) relatedFields[i]
.getAttributeValue("fldcode");
String accfield = (String) relatedFields[i]
.getAttributeValue("accfldcode");
relationMap.put(table + "." + field, accfield);
}
} catch (BusinessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return relationMap;
}
public String queryPkPsnDoc(String pk_psnbasdoc,String pk_corp) throws SQLException{
// 保留的系统管理接口:
beforeCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "queryPkPsnDoc",
new Object[] { pk_psnbasdoc,pk_corp});
/** ********************************************************** */
String pk_psndoc=null;
Connection con = null;
PreparedStatement stmt = null;
String sql = "select pk_psndoc from bd_psndoc where pk_psnbasdoc='"+pk_psnbasdoc+"' ";
if(pk_corp !=null){
sql += " and pk_corp='"+pk_corp+"'";
}
try {
con = getConnection();
stmt = con.prepareStatement(sql);
ResultSet rs = stmt.executeQuery();
if(rs.next()){
pk_psndoc=rs.getString(1);
}
if(pk_psndoc == null || pk_psndoc.length() <= 0){
pk_psndoc = queryPkPsnDoc(pk_psnbasdoc,null);
}
} finally {
if (stmt != null)
stmt.close();
if (con != null)
con.close();
}
/** ********************************************************** */
// 保留的系统管理接口:
afterCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "queryPkPsnDoc",
new Object[] { pk_psnbasdoc,pk_corp });
/** ********************************************************** */
return pk_psndoc;
}
public String queryPkPsnBasDoc(String pk_psndoc) throws SQLException{
// 保留的系统管理接口:
beforeCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "queryPkPsnBasDoc",
new Object[] { pk_psndoc});
/** ********************************************************** */
String pk_psnbasdoc=null;
Connection con = null;
PreparedStatement stmt = null;
String sql = "select pk_psnbasdoc from bd_psndoc where pk_psndoc='"+pk_psndoc+"'";
try {
con = getConnection();
stmt = con.prepareStatement(sql);
ResultSet rs = stmt.executeQuery();
if(rs.next()){
pk_psnbasdoc=rs.getString(1);
}
} finally {
if (stmt != null)
stmt.close();
if (con != null)
con.close();
}
/** ********************************************************** */
// 保留的系统管理接口:
afterCallMethod("nc.bs.hi.hi_301.PsnInfDMO", "queryPkPsnBasDoc",
new Object[] { pk_psnbasdoc });
/** ********************************************************** */
return pk_psnbasdoc;
}
public String getPkpsnbasdoc(String pk_psndoc)
throws SQLException{
Connection conn = null;
PreparedStatement stmt = null;
try{
String sql="";
sql = "select pk_psnbasdoc from bd_psndoc where pk_psndoc='"+pk_psndoc+"'";
String str = "";
conn = getConnection();
stmt = conn.prepareStatement(sql);
ResultSet rs = stmt.executeQuery();
if(rs.next()){
str = rs.getString(1);
}
return str;
}finally {
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
}
}
| [
"24986810@qq.com"
] | 24986810@qq.com |
5567918f05da1d812937f548fdd008a5d1736e5e | 8959e41407a5334396adab75f056068c0973f66f | /financing/src/com/jiangchuanbanking/financing/service/impl/TargetService.java | 228c614997061b71b2945524a7527b1257deb7dd | [] | no_license | xinyucmd/pysh | 6c9deb1509c3c3664f83044ccecfe005bfe17849 | ad11fc0cc267e9978635573db8db3284df881279 | refs/heads/master | 2020-06-11T09:26:47.592181 | 2016-12-06T08:38:58 | 2016-12-06T08:38:58 | 75,700,477 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,198 | java |
package com.jiangchuanbanking.financing.service.impl;
import com.jiangchuanbanking.base.service.IBaseService;
import com.jiangchuanbanking.base.service.impl.BaseService;
import com.jiangchuanbanking.dict.domain.LeadStatus;
import com.jiangchuanbanking.financing.domain.Lead;
import com.jiangchuanbanking.financing.domain.Target;
import com.jiangchuanbanking.financing.service.ITargetService;
/**
* Target service
*/
public class TargetService extends BaseService<Target> implements
ITargetService {
private IBaseService<Lead> leadService;
private IBaseService<LeadStatus> leadStatusService;
/*
* (non-Javadoc)
*
* @see com.gcrm.service.ITargetService#convert(java.lang.Integer)
*/
public void convert(Integer id) throws Exception {
Target target = this.getEntityById(Target.class, id);
Lead lead = new Lead();
lead.setSalutation(target.getSalutation());
lead.setFirst_name(target.getFirst_name());
lead.setLast_name(target.getLast_name());
lead.setOffice_phone(target.getOffice_phone());
lead.setCompany(target.getCompany());
lead.setTitle(target.getTitle());
lead.setMobile(target.getMobile());
lead.setDepartment(target.getDepartment());
lead.setFax(target.getFax());
lead.setAccount(target.getAccount());
lead.setPrimary_street(target.getPrimary_street());
lead.setPrimary_city(target.getPrimary_city());
lead.setPrimary_country(target.getPrimary_country());
lead.setPrimary_postal_code(target.getPrimary_postal_code());
lead.setPrimary_state(target.getPrimary_state());
lead.setOther_street(target.getOther_street());
lead.setOther_city(target.getOther_city());
lead.setOther_country(target.getOther_country());
lead.setOther_postal_code(target.getOther_postal_code());
lead.setOther_state(target.getOther_state());
lead.setEmail(target.getEmail());
lead.setNotes(target.getNotes());
lead.setNot_call(target.isNot_call());
lead.setAssigned_to(target.getAssigned_to());
lead.setOwner(target.getOwner());
LeadStatus status = this.getLeadStatusService().findByName(
LeadStatus.class.getSimpleName(), "New");
lead.setStatus(status);
lead = this.getLeadService().makePersistent(lead);
target.setLead_id(lead.getId());
this.makePersistent(target);
}
/**
* @return the leadService
*/
public IBaseService<Lead> getLeadService() {
return leadService;
}
/**
* @param leadService
* the leadService to set
*/
public void setLeadService(IBaseService<Lead> leadService) {
this.leadService = leadService;
}
/**
* @return the leadStatusService
*/
public IBaseService<LeadStatus> getLeadStatusService() {
return leadStatusService;
}
/**
* @param leadStatusService
* the leadStatusService to set
*/
public void setLeadStatusService(IBaseService<LeadStatus> leadStatusService) {
this.leadStatusService = leadStatusService;
}
}
| [
"xinyucmd@163.com"
] | xinyucmd@163.com |
956feaa45b10bba13d25f87e7eab34a6c1fea835 | d73fb068e789ac96121d25c8d59aee46df78afad | /app/src/main/java/com/zzu/ehome/ehomefordoctor/mvp/view/IOnLineView.java | 8cd910189bd05045ad1f1d9cf79511e179982157 | [] | no_license | xtfgq/ehomedoctor | 1d0e21a800e0e11b9de8274015dec5336cf70fb0 | 7d547e58862e8e8a20ce0d4e8a87eefe80e2010c | refs/heads/master | 2020-06-23T23:05:56.455465 | 2017-08-01T09:45:17 | 2017-08-01T09:45:17 | 74,632,675 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 326 | java | package com.zzu.ehome.ehomefordoctor.mvp.view;
import com.zzu.ehome.ehomefordoctor.entity.UsersBySignDoctor;
import java.util.List;
import static android.R.id.list;
/**
* Created by Administrator on 2016/10/15.
*/
public interface IOnLineView {
void onLineSuccess(String str);
void onLineErroe(Exception e);
}
| [
"gq820125@163.com"
] | gq820125@163.com |
829010437a098c157d7cfe38b8d948ea6505932f | 79d8886493bb2e69eecd00c83ec774ac4d0becb1 | /dashboard/src/main/java/com/tsys/dashboard/DashboardApplication.java | fde8a0c98d5aca0eab10cffd8df067bfe16b28fb | [] | no_license | sunilAgrhari/microservices-demo | 3e2126ef07d4d23158adc2406b07e3422df09ee9 | 3cb0fa5a76a9584711915f71d382ddd5825f5c82 | refs/heads/master | 2020-04-01T19:48:35.695905 | 2018-10-18T06:21:30 | 2018-10-18T06:21:30 | 153,572,356 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 423 | java | package com.tsys.dashboard;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
@SpringBootApplication
@EnableHystrixDashboard
public class DashboardApplication {
public static void main(String[] args) {
SpringApplication.run(DashboardApplication.class, args);
}
}
| [
"agrahari.sunil@gmail.com"
] | agrahari.sunil@gmail.com |
9545e00c50f191597f91b383a596e5ae887bebf9 | 4f986f7139ba5d761523bf0038ad7da624d3e834 | /evpop/src/main/java/com/zx/evpop/jdbc/entity/LongInstructions.java | 5e658cd27c8ac23f05ff7ffad7bb38a705aa6d67 | [] | no_license | jiangmenglin/zx | 4e367ffa20a1bc6443f873519f2f681784ce0639 | cbd911db4dfbf85f3c963e4911ce12dd2235ad0a | refs/heads/master | 2020-04-30T09:36:59.759771 | 2019-03-20T14:50:17 | 2019-03-20T14:50:17 | 176,753,352 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,199 | java | package com.zx.evpop.jdbc.entity;
import java.io.Serializable;
import java.util.Date;
public class LongInstructions implements Serializable {
private Long tbliId;
private Long tbliHost;
private String tbliName;
private String tbliflag;
private String tbliDescribe;
private String tbliNumber;
private Date tbliAddTime;
private Date tbliUpdateTime;
private Short tbliStatus;
private String tbliContent;
private static final long serialVersionUID = 1L;
public Long getTbliId() {
return tbliId;
}
public void setTbliId(Long tbliId) {
this.tbliId = tbliId;
}
public Long getTbliHost() {
return tbliHost;
}
public void setTbliHost(Long tbliHost) {
this.tbliHost = tbliHost;
}
public String getTbliName() {
return tbliName;
}
public void setTbliName(String tbliName) {
this.tbliName = tbliName == null ? null : tbliName.trim();
}
public String getTbliflag() {
return tbliflag;
}
public void setTbliflag(String tbliflag) {
this.tbliflag = tbliflag == null ? null : tbliflag.trim();
}
public String getTbliDescribe() {
return tbliDescribe;
}
public void setTbliDescribe(String tbliDescribe) {
this.tbliDescribe = tbliDescribe == null ? null : tbliDescribe.trim();
}
public String getTbliNumber() {
return tbliNumber;
}
public void setTbliNumber(String tbliNumber) {
this.tbliNumber = tbliNumber == null ? null : tbliNumber.trim();
}
public Date getTbliAddTime() {
return tbliAddTime;
}
public void setTbliAddTime(Date tbliAddTime) {
this.tbliAddTime = tbliAddTime;
}
public Date getTbliUpdateTime() {
return tbliUpdateTime;
}
public void setTbliUpdateTime(Date tbliUpdateTime) {
this.tbliUpdateTime = tbliUpdateTime;
}
public Short getTbliStatus() {
return tbliStatus;
}
public void setTbliStatus(Short tbliStatus) {
this.tbliStatus = tbliStatus;
}
public String getTbliContent() {
return tbliContent;
}
public void setTbliContent(String tbliContent) {
this.tbliContent = tbliContent == null ? null : tbliContent.trim();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", tbliId=").append(tbliId);
sb.append(", tbliHost=").append(tbliHost);
sb.append(", tbliName=").append(tbliName);
sb.append(", tbliflag=").append(tbliflag);
sb.append(", tbliDescribe=").append(tbliDescribe);
sb.append(", tbliNumber=").append(tbliNumber);
sb.append(", tbliAddTime=").append(tbliAddTime);
sb.append(", tbliUpdateTime=").append(tbliUpdateTime);
sb.append(", tbliStatus=").append(tbliStatus);
sb.append(", tbliContent=").append(tbliContent);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
} | [
"jiangmenglin@aliyun.com"
] | jiangmenglin@aliyun.com |
2e1109c10861e07b031b6844238bd742de330149 | f52052408da5f2e97584513672e31e2eb0a7d501 | /trading-system-springboot-master/src/test/java/edu/sollers/javaprog/springtrading/BootprojApplicationTests.java | ad68339d4a8153c3f83683dbd73df849b57baf52 | [] | no_license | darkerror96/pro-trading_system | 5aa79141e1b053339d1457b10cca1e0f6dcf0e37 | be32d485c5253781ecd378ff679ba7519796031f | refs/heads/master | 2020-04-13T09:20:29.421481 | 2019-07-24T14:10:33 | 2019-07-24T14:10:33 | 163,108,719 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 353 | java | package edu.sollers.javaprog.springtrading;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class BootprojApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"rutpatel@10.155.21.207"
] | rutpatel@10.155.21.207 |
3acc0faa4e898c753b1b101db11ee4546253ed3c | fe03fbce1020b3c966df0dec0908ae1695cd3b63 | /src/main/java/qimingx/dbe/TableInfo.java | 58f88fc4084c08082623e257ab683433413691c7 | [] | no_license | 1036956372/openapi2_console | 81d7d594bb4775662cfb08adb0b72bf5f09ec5bf | d13bd920363cd90d4b2bedcecfc1e74a15a318a7 | refs/heads/master | 2020-04-11T03:12:02.116757 | 2018-12-21T11:21:11 | 2018-12-21T11:21:11 | 161,470,694 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,675 | java | package qimingx.dbe;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.io.IOUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import qimingx.core.ProcessResult;
import qimingx.dbe.service.WorkDirectory;
import qimingx.utils.ExtTypeInfo;
import qimingx.utils.PDFUtils;
import com.lowagie.text.Cell;
import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.Phrase;
import com.lowagie.text.Table;
import com.lowagie.text.pdf.PdfWriter;
/**
* @author inc062805
*
* Table 信息描述对象
*/
public class TableInfo {
// logger
private static final Log log = LogFactory.getLog(TableDataInfo.class);
// 表名称
private String tableName;
// 主键列名称
private String pkColumnName;
// 列信息
private List<TableColumnInfo> columns;
// 表数据信息
private TableDataInfo data;
// 是否只读
private boolean readOnly = true;
public boolean isReadOnly() {
return readOnly;
}
public void setReadOnly(boolean readOnly) {
this.readOnly = readOnly;
}
public String getTableName() {
return tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
//
public TableInfo() {
}
//
public TableInfo(String pkColumnName, List<TableColumnInfo> columns) {
this.pkColumnName = pkColumnName;
this.columns = columns;
}
// 生成指定格式的数据文件
public ProcessResult<File> makeDataFile(String fileType, WorkDirectory wd) {
ProcessResult<File> pr = new ProcessResult<File>();
// 检查类型格式
if (!isSupportType(fileType)) {
pr.setMessage("不支持的格式类型:" + fileType);
return pr;
}
// 取得临时文件
File file = wd.newFile(fileType, ".tmp");
OutputStream stream = null;
try {
stream = new FileOutputStream(file);
OutputStreamWriter writer = new OutputStreamWriter(stream, "utf-8");
BufferedWriter buffer = new BufferedWriter(writer);
if (fileType.equalsIgnoreCase("CSV")) {
// 生成文件内容..
makeCSVContent(buffer);
} else if (fileType.equalsIgnoreCase("HTML")) {
// 生成HTML文件
makeHTMLContent(buffer);
} else if (fileType.equalsIgnoreCase("PDF")) {
// 生成PDF格式的文件
makePDFContent(stream);
} else {
// 生成sql语句文件
makeSQLContent(buffer);
}
pr.setSuccess(true);
pr.setData(file);
} catch (IOException e) {
pr.setMessage("写文件出错:" + e.getMessage());
log.error(pr.getMessage());
} finally {
IOUtils.closeQuietly(stream);
}
// done
return pr;
}
// 生成sql语句文件
private void makeSQLContent(BufferedWriter writer) throws IOException {
List<Map<String, Object>> rows = data.getRows();
if (rows.size() < 1) {
return;
}
// add table data header
String insert = "";
for (TableColumnInfo column : getColumns()) {
String name = column.getName();
if (insert.length() > 0) {
insert += ",";
}
insert += name;
}
insert = "insert to " + getTableName() + "(" + insert + ") values(";
for (Map<String, Object> map : rows) {
String row = "";
for (TableColumnInfo column : getColumns()) {
Object value = map.get(column.getName());
String col = "NULL";
if (value != null) {
col = value.toString();
ExtTypeInfo type = column.getExtType();
if (type.isDateType()) {
col = "toDate('" + col + "' HH24:mm)";
} else if (type.isBooleanType() && type.isNumberType()) {
} else {
col = "'" + col + "'";
}
}
if (row.length() > 0) {
row += ",";
}
row += col;
}
writer.write(insert + row + ")");
writer.newLine();
}
writer.flush();
}
// 生成PDF格式的文件内容
private void makePDFContent(OutputStream stream) throws IOException {
List<Map<String, Object>> rows = data.getRows();
if (rows.size() < 1) {
return;
}
Document pdfDoc = new Document();
try {
PdfWriter.getInstance(pdfDoc, stream);
// create table
Map<String, Object> row = rows.get(0);
Set<String> columns = row.keySet();
Table table = new Table(columns.size());
table.setWidth(90);
table.setAutoFillEmptyCells(true);
table.setPadding(3);
table.setSpacing(0);
table.setBorder(1);
// add table data header
for (TableColumnInfo column : getColumns()) {
String name = column.getName();
Phrase phe = new Phrase(name, PDFUtils.createChineseFont());
Cell cell = new Cell(phe);
cell.setHorizontalAlignment(Cell.ALIGN_LEFT);
cell.setVerticalAlignment(Cell.ALIGN_MIDDLE);
table.addCell(new Cell(phe));
}
for (Map<String, Object> map : rows) {
for (TableColumnInfo column : getColumns()) {
Object value = map.get(column.getName());
String col = " ";
if (value != null) {
col = value.toString();
}
Phrase phe = new Phrase(col, PDFUtils.createChineseFont());
Cell cell = new Cell(phe);
cell.setHorizontalAlignment(Cell.ALIGN_LEFT);
cell.setVerticalAlignment(Cell.ALIGN_MIDDLE);
table.addCell(new Cell(phe));
}
}
// add to pdf Document
pdfDoc.open();
pdfDoc.add(table);
} catch (DocumentException e) {
log.error("create PDFDocument error:" + e.getMessage());
throw new IOException("create PDFDocument Error");
} finally {
if (pdfDoc.isOpen()) {
pdfDoc.close();
}
}
}
// 生成html格式的文件内容
private void makeHTMLContent(BufferedWriter writer) throws IOException {
List<Map<String, Object>> rows = data.getRows();
writer.write("<html><head>");
writer.write("<meta http-equiv='Content-Type' "
+ "content='text/html;charset=UTF-8'/>");
writer.write("</head><body><table border='1' width='95%'>");
String header = "";
for (TableColumnInfo column : getColumns()) {
String name = column.getName();
header += "<td>" + name + "</td>";
}
writer.write("<tr>" + header + "</tr>");
for (Map<String, Object> map : rows) {
String row = "";
for (TableColumnInfo column : getColumns()) {
Object value = map.get(column.getName());
String col = value == null ? "<NULL>" : value.toString();
row += "<td>" + col + "</td>";
}
writer.write("<tr>" + row + "</tr>");
}
writer.write("</table></body></html>");
writer.flush();
}
// 生成 分号 ; 分隔的文件内容
private void makeCSVContent(BufferedWriter writer) throws IOException {
List<Map<String, Object>> rows = data.getRows();
for (Map<String, Object> map : rows) {
String row = "";
for (TableColumnInfo column : getColumns()) {
row += map.get(column.getName()) + ";";
}
writer.write(row);
writer.newLine();
}
writer.flush();
}
// 判断是否是受支持的类型
private boolean isSupportType(String type) {
type = type.toUpperCase();
if (type.equals("CSV") || type.equals("HTML") || type.equals("PDF")
|| type.equals("SQL")) {
return true;
}
return false;
}
public String getPkColumnName() {
return pkColumnName;
}
public void setPkColumnName(String pkColumnName) {
this.pkColumnName = pkColumnName;
}
public List<TableColumnInfo> getColumns() {
if (columns == null) {
columns = new ArrayList<TableColumnInfo>();
}
return columns;
}
public void setColumns(List<TableColumnInfo> columns) {
this.columns = columns;
}
public TableDataInfo getData() {
return data;
}
public void setData(TableDataInfo data) {
this.data = data;
}
}
| [
"1036956372@qq.com"
] | 1036956372@qq.com |
5716d160ca2e94c94b5bb8a3252b616f08ba5940 | 2cef6a37026ac6f41f2d04e696ca5d5627db6a98 | /ParkSolutions/app/src/main/java/com/furkancetin/parksolutions/parksolutions/DownloaderTask.java | 6a83913397a2f72cd9e903f8ec340f1e3e21523f | [] | no_license | Furkan68/ParkSolutions | 0a76e1c8be020fb128987f4a7df3549bdea96739 | 2df8ce6a368991cc7187a5d9db7794f23c9ebd9a | refs/heads/master | 2016-09-14T06:04:26.597686 | 2016-04-23T11:51:30 | 2016-04-23T11:51:30 | 56,806,687 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,996 | java | package com.furkancetin.parksolutions.parksolutions;
import android.os.AsyncTask;
import android.os.Handler;
import android.util.Log;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class DownloaderTask extends AsyncTask<Void, Void, Data> {
private MainActivity ma;
private Data data;
private boolean isBusy;
private boolean stop;
private Handler handler;
public DownloaderTask(MainActivity ma) {
this.ma = ma;
handler = new Handler();
isBusy = false;//this flag to indicate whether your async task completed or not
stop = false;//this flag to indicate whether your button stop clicked
startHandler();
}
public void startHandler()
{
handler.postDelayed(new Runnable()
{
@Override
public void run()
{
if(!isBusy) callAysncTask();
if(!stop) startHandler();
}
}, 10000);
}
private void callAysncTask()
{
//TODO
new DownloaderTask(ma).execute();
}
public Data getData() {
data = new Data();
HttpURLConnection con = null;
try {
URL url = new URL("http://furkancetin.nl/data/");
con = (HttpURLConnection) url.openConnection();
// Start the query
con.connect();
// Read results from the query
BufferedReader reader = new BufferedReader(
new InputStreamReader(con.getInputStream(), "UTF-8"));
StringBuilder result = new StringBuilder();
String line;
while ((line = reader.readLine()) != null) {
result.append(line);
}
reader.close();
// Parse to get translated text
JSONObject jsonObject = new JSONObject(result.toString());
for (int i = 0; i < jsonObject.getJSONArray("data").length(); i++) {
data.distance = jsonObject.getJSONArray("data").getJSONObject(i).getDouble("distance");
data.available = jsonObject.getJSONArray("data").getJSONObject(i).getBoolean("available");
}
} catch (IOException e) {
Log.e(MainActivity.LOG_TAG, "IOException", e);
} catch (JSONException e) {
Log.e(MainActivity.LOG_TAG, "JSONException", e);
} catch (Exception e) {
Log.d(MainActivity.LOG_TAG, "Something went wrong... ", e);
} finally {
if (con != null) {
con.disconnect();
}
}
// All done
return data;
}
@Override
protected Data doInBackground(Void... params) {
return getData();
}
@Override
protected void onPostExecute(Data result) {
ma.setData(result);
}
}
| [
"furkancetin70@gmail.com"
] | furkancetin70@gmail.com |
2a756c1717b6641932eb3e7c194334f1589d61e4 | 36e3674e96cff7fce4cba244e8a3e94136fdcc4b | /JestSPL/Jest/source_gen/io/searchbox/core/search/aggregation/TermsAggregation.java | b6e825ee194bac30a0cf714c6bafdd6aa3d453d8 | [] | no_license | hui8958/SPLE_Project | efa79728a288cb798ab9d7d5a1b993c295895ff5 | f659dec562e7321d2e6e72983a47bca4657f3a3c | refs/heads/master | 2020-06-28T19:28:31.925001 | 2016-11-22T15:19:37 | 2016-11-22T15:19:37 | 74,481,878 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 4,226 | java | package io.searchbox.core.search.aggregation;
/*Generated by MPS */
import java.util.List;
import java.util.LinkedList;
import com.google.gson.JsonObject;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
public class TermsAggregation extends BucketAggregation {
public static final String TYPE = "terms";
private Long docCountErrorUpperBound;
private Long sumOtherDocCount;
private List<TermsAggregation.Entry> buckets = new LinkedList<TermsAggregation.Entry>();
public TermsAggregation(String name, JsonObject termAggregation) {
super(name, termAggregation);
if (termAggregation.has(String.valueOf(AggregationField.DOC_COUNT_ERROR_UPPER_BOUND))) {
docCountErrorUpperBound = termAggregation.get(String.valueOf(AggregationField.DOC_COUNT_ERROR_UPPER_BOUND)).getAsLong();
}
if (termAggregation.has(String.valueOf(AggregationField.SUM_OTHER_DOC_COUNT))) {
sumOtherDocCount = termAggregation.get(String.valueOf(AggregationField.SUM_OTHER_DOC_COUNT)).getAsLong();
}
if (termAggregation.has(String.valueOf(AggregationField.BUCKETS)) && termAggregation.get(String.valueOf(AggregationField.BUCKETS)).isJsonArray()) {
parseBuckets(termAggregation.get(String.valueOf(AggregationField.BUCKETS)).getAsJsonArray());
}
}
private void parseBuckets(JsonArray bucketsSource) {
for (JsonElement bucketElement : bucketsSource) {
JsonObject bucket = (JsonObject) bucketElement;
if (bucket.has(String.valueOf(AggregationField.KEY_AS_STRING))) {
buckets.add(new TermsAggregation.Entry(bucket, bucket.get(String.valueOf(AggregationField.KEY)).getAsString(), bucket.get(String.valueOf(AggregationField.KEY_AS_STRING)).getAsString(), bucket.get(String.valueOf(AggregationField.DOC_COUNT)).getAsLong()));
} else {
buckets.add(new TermsAggregation.Entry(bucket, bucket.get(String.valueOf(AggregationField.KEY)).getAsString(), bucket.get(String.valueOf(AggregationField.DOC_COUNT)).getAsLong()));
}
}
}
public Long getDocCountErrorUpperBound() {
return docCountErrorUpperBound;
}
public Long getSumOtherDocCount() {
return sumOtherDocCount;
}
public List<TermsAggregation.Entry> getBuckets() {
return buckets;
}
public class Entry extends Bucket {
private String key;
private String keyAsString;
public Entry(JsonObject bucket, String key, Long count) {
this(bucket, key, key, count);
}
public Entry(JsonObject bucket, String key, String keyAsString, Long count) {
super(bucket, count);
this.key = key;
this.keyAsString = keyAsString;
}
public String getKey() {
return key;
}
public String getKeyAsString() {
return keyAsString;
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (obj == this) {
return true;
}
if (obj.getClass() != getClass()) {
return false;
}
TermsAggregation.Entry rhs = (TermsAggregation.Entry) obj;
return new EqualsBuilder().appendSuper(super.equals(obj)).append(key, rhs.key).append(keyAsString, rhs.keyAsString).isEquals();
}
@Override
public int hashCode() {
return new HashCodeBuilder().append(getCount()).append(getKey()).append(keyAsString).toHashCode();
}
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (obj == this) {
return true;
}
if (obj.getClass() != getClass()) {
return false;
}
TermsAggregation rhs = (TermsAggregation) obj;
return new EqualsBuilder().appendSuper(super.equals(obj)).append(buckets, rhs.buckets).append(docCountErrorUpperBound, rhs.docCountErrorUpperBound).append(sumOtherDocCount, rhs.sumOtherDocCount).isEquals();
}
@Override
public int hashCode() {
return new HashCodeBuilder().appendSuper(super.hashCode()).append(docCountErrorUpperBound).append(sumOtherDocCount).append(buckets).toHashCode();
}
}
| [
"hui8958@gmail.com"
] | hui8958@gmail.com |
d16561201e912e4298168dcd9b6d9c2a382f9035 | b86b80784dae42e1a9073388afab8e2072b74833 | /src/Agenda/Driver.java | 1757231fe91e0cf9e4c7feb728b4c67ee834466a | [] | no_license | zoiloreyes/Agendav1 | 4a001185df14abd7e46b82bb16d89b822748330a | 31e0340569f7b628bd670d6f60fb59951ab4064a | refs/heads/master | 2020-07-03T19:52:15.163018 | 2016-11-21T23:43:30 | 2016-11-21T23:43:30 | 74,233,839 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,050 | 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 Agenda;
import java.sql.*;
/**
*
* @author zoiloreyes
*/
public class Driver {
public static void main(String[] args){
try{
getConnection();
}catch(Exception e){
System.out.println(e.getMessage());
}
}
public static Connection getConnection() throws Exception{
try{
String driver = "com.mysql.jdbc.Driver";
String url = "jdbc:mysql://localhost:3306/agenda";
String username = "root";
String password = "";
Class.forName(driver);
Connection conn = DriverManager.getConnection(url,username,password);
System.out.println("Connected");
return conn;
} catch(ClassNotFoundException | SQLException e){System.out.println(e);}
return null;
}
}
| [
"zoiloreyes@localhost.localdomain"
] | zoiloreyes@localhost.localdomain |
586e3d831bc4e98f05660f95d01e3e266703c2c5 | d450b243f597035008412ff3e1b6404cd1979e04 | /src/main/java/io/gumga/business/requirement/DefaultRequirementMetric.java | abc6ccaac9892c152cbf1521a7cb84506e497b65 | [
"Apache-2.0"
] | permissive | carlosjustino/gumgapasswordmeter | 82142a5ca52fb88511b6fdcf0f053773db02fd0d | 86b357e6501925d1e9047037fca7c4a7f12c1249 | refs/heads/master | 2020-03-28T17:30:06.081363 | 2018-09-15T01:55:23 | 2018-09-15T01:55:23 | 148,795,584 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,001 | java | package io.gumga.business.requirement;
import io.gumga.business.entity.Metric;
import java.util.List;
/**
* <b>Implementação padrão de validações</b><br>
*
* @author Carlos Eduardo Justino
*/
public class DefaultRequirementMetric extends Requirement {
public DefaultRequirementMetric(List<Metric> requiredMetrics) {
super(requiredMetrics);
}
@Override
public int count(String password) {
int length = password.length();
int satisfiedRequiredMetrics = 0;
for (Metric m : requiredMetrics) {
if (m.count(password) > 0)
satisfiedRequiredMetrics++;
}
boolean lengthSatisfied = length >= 8;
int count = satisfiedRequiredMetrics;
if (lengthSatisfied)
count++;
boolean satisfied = lengthSatisfied && satisfiedRequiredMetrics >= 3;
return satisfied ? count : 0;
}
@Override
public int rate(int n, int len) {
return +(n * 2);
}
}
| [
"carlos.justino08@gmail.com"
] | carlos.justino08@gmail.com |
f287e40f3412822a60c2cb3c73f5950d6900550a | 44939c2280eff6884a366839ae21e23bfcb4a30c | /Ribbon/src/test/java/org/sakura/ribbon/RibbonApplicationTests.java | 3e08df5ae98cf2dae580b10a9754591609019380 | [] | no_license | Qiyue0726/Eureka | a779714577ae469d3ed3222f90166547df3d1ed5 | 64e0d7e25d5f47cdfedf59660cdabfdca38d7f3a | refs/heads/master | 2020-07-11T23:44:02.409299 | 2019-08-27T15:33:12 | 2019-08-27T15:33:12 | 204,668,179 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 343 | java | package org.sakura.ribbon;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class RibbonApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"1301616594@qq.com"
] | 1301616594@qq.com |
1c97eea74ad720bc2bb57b0e600476df193b5a81 | 7c212876e8c6000feb70ca55100582dcd786c312 | /shiro/src/main/java/com/dade/imsserver/shiro/ShiroApplication.java | d7a33cb7329cfffd2c83ef31a952d79e83c64ab4 | [] | no_license | CoderDade/ims-server | 9ee39ef2bbf19f957a0ff567fc741ef7d522b3ed | 43c9435e402132ab83228b1fd6641cfe726f217f | refs/heads/master | 2020-03-20T23:54:47.053940 | 2018-06-19T09:28:44 | 2018-06-19T09:28:44 | 137,204,357 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 314 | java | package com.dade.imsserver.shiro;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ShiroApplication {
public static void main(String[] args) {
SpringApplication.run(ShiroApplication.class, args);
}
}
| [
"coder.dade@gmail.com"
] | coder.dade@gmail.com |
45ebe794afab80c0a2b0a063a9c4b3f7a35a564b | e309857413087bc9bc223ef330bd70afc2979f77 | /src/main/java/pl/coderslab/BookDao.java | 6a20db9f2cd5d4fc32a8a4651c6a906b6254dda1 | [] | no_license | malgorzatajablonska/Spring02Hibernate | cefa759c7da3db8cda591e549152e4ff2bf7daf0 | 94a80b619bcc22c471e39ed6364d727879addd06 | refs/heads/master | 2021-05-06T16:39:14.083504 | 2017-12-10T20:45:53 | 2017-12-10T20:45:53 | 113,782,007 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 805 | java | package pl.coderslab;
import javax.persistence.EntityManager;
import javax.persistence.Id;
import javax.persistence.PersistenceContext;
import javax.transaction.Transactional;
import org.springframework.stereotype.Component;
@Component
@Transactional
public class BookDao {
@PersistenceContext
EntityManager entityManager;
public void saveBook(Book entity) {
entityManager.persist(entity);
}
@Id
public Book findById(long id) {
return entityManager.find(Book.class, id);
}
//
//
//// public void update(Book entity) {
//// entityManager.merge(entity);
////
//// }
public void update(long id) {
entityManager.merge(findById(id));
}
// public void delete(Book entity) {
// entityManager.remove(entityManager.contains(entity) ?
// entity : entityManager.merge(entity)); }
} | [
"malgorzata@jablonska.tv"
] | malgorzata@jablonska.tv |
7d1e72fd2856bf0a8691dd6f0f82ca92ea634b73 | 647ec12ce50f06e7380fdbfb5b71e9e2d1ac03b4 | /com.tencent.mm/classes.jar/com/tencent/mm/protocal/protobuf/sj.java | 5d01d2667ff3a26cf6dcb749c9657ebf66361773 | [] | no_license | tsuzcx/qq_apk | 0d5e792c3c7351ab781957bac465c55c505caf61 | afe46ef5640d0ba6850cdefd3c11badbd725a3f6 | refs/heads/main | 2022-07-02T10:32:11.651957 | 2022-02-01T12:41:38 | 2022-02-01T12:41:38 | 453,860,108 | 36 | 9 | null | 2022-01-31T09:46:26 | 2022-01-31T02:43:22 | Java | UTF-8 | Java | false | false | 3,691 | java | package com.tencent.mm.protocal.protobuf;
import com.tencent.matrix.trace.core.AppMethodBeat;
import java.util.LinkedList;
public final class sj
extends erp
{
public eh YXl;
public String YXm;
public final int op(int paramInt, Object... paramVarArgs)
{
AppMethodBeat.i(91372);
if (paramInt == 0)
{
paramVarArgs = (i.a.a.c.a)paramVarArgs[0];
if (this.BaseRequest != null)
{
paramVarArgs.qD(1, this.BaseRequest.computeSize());
this.BaseRequest.writeFields(paramVarArgs);
}
if (this.YXl != null)
{
paramVarArgs.qD(2, this.YXl.computeSize());
this.YXl.writeFields(paramVarArgs);
}
if (this.YXm != null) {
paramVarArgs.g(3, this.YXm);
}
AppMethodBeat.o(91372);
return 0;
}
if (paramInt == 1) {
if (this.BaseRequest == null) {
break label478;
}
}
label478:
for (int i = i.a.a.a.qC(1, this.BaseRequest.computeSize()) + 0;; i = 0)
{
paramInt = i;
if (this.YXl != null) {
paramInt = i + i.a.a.a.qC(2, this.YXl.computeSize());
}
i = paramInt;
if (this.YXm != null) {
i = paramInt + i.a.a.b.b.a.h(3, this.YXm);
}
AppMethodBeat.o(91372);
return i;
if (paramInt == 2)
{
paramVarArgs = new i.a.a.a.a((byte[])paramVarArgs[0], unknownTagHandler);
for (paramInt = erp.getNextFieldNumber(paramVarArgs); paramInt > 0; paramInt = erp.getNextFieldNumber(paramVarArgs)) {
if (!super.populateBuilderWithField(paramVarArgs, this, paramInt)) {
paramVarArgs.kFT();
}
}
AppMethodBeat.o(91372);
return 0;
}
if (paramInt == 3)
{
Object localObject1 = (i.a.a.a.a)paramVarArgs[0];
sj localsj = (sj)paramVarArgs[1];
paramInt = ((Integer)paramVarArgs[2]).intValue();
Object localObject2;
switch (paramInt)
{
default:
AppMethodBeat.o(91372);
return -1;
case 1:
paramVarArgs = ((i.a.a.a.a)localObject1).aMP(paramInt);
i = paramVarArgs.size();
paramInt = 0;
while (paramInt < i)
{
localObject1 = (byte[])paramVarArgs.get(paramInt);
localObject2 = new kc();
if ((localObject1 != null) && (localObject1.length > 0)) {
((kc)localObject2).parseFrom((byte[])localObject1);
}
localsj.BaseRequest = ((kc)localObject2);
paramInt += 1;
}
AppMethodBeat.o(91372);
return 0;
case 2:
paramVarArgs = ((i.a.a.a.a)localObject1).aMP(paramInt);
i = paramVarArgs.size();
paramInt = 0;
while (paramInt < i)
{
localObject1 = (byte[])paramVarArgs.get(paramInt);
localObject2 = new eh();
if ((localObject1 != null) && (localObject1.length > 0)) {
((eh)localObject2).parseFrom((byte[])localObject1);
}
localsj.YXl = ((eh)localObject2);
paramInt += 1;
}
AppMethodBeat.o(91372);
return 0;
}
localsj.YXm = ((i.a.a.a.a)localObject1).ajGk.readString();
AppMethodBeat.o(91372);
return 0;
}
AppMethodBeat.o(91372);
return -1;
}
}
}
/* Location: L:\local\mybackup\temp\qq_apk\com.tencent.mm\classes2.jar
* Qualified Name: com.tencent.mm.protocal.protobuf.sj
* JD-Core Version: 0.7.0.1
*/ | [
"98632993+tsuzcx@users.noreply.github.com"
] | 98632993+tsuzcx@users.noreply.github.com |
e23e1cc242cb6618dd0acfa360271a322454e065 | d9af287a2fe83d12a5cb51d55bb4bbbc54ba4435 | /app/src/main/java/eoghan/societygolf/AddGolfer.java | 2604764b3a6b64a2586b2668c866a5bec3062530 | [] | no_license | nolane29-dcu/Assign52017EoghanNolan-master | 420519f18dbdff21fc64f5c211141ce8e968d6d3 | b7200d100e1b27576d836a1c944471d923bc417b | refs/heads/master | 2021-01-18T16:14:14.232123 | 2017-03-30T17:37:40 | 2017-03-30T17:37:40 | 86,730,793 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,681 | java | package eoghan.societygolf;
import android.content.ContentValues;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.support.v4.app.NavUtils;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.Toast;
import eoghan.societygolf.GolferContract.GolferEntry;
/**
* Allows user to create a new golfer or edit an existing one.
*/
public class AddGolfer extends AppCompatActivity {
/** EditText field to enter the golfer's name */
private EditText mNameEditText;
/** EditText field to enter the golfer's handicap */
private EditText mHandicapEditText;
/** EditText field to enter the golfer's contact number */
private EditText mPhoneEditText;
/** EditText field to enter the golfer's gender */
private Spinner mGenderSpinner;
private int mGender;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_golfer);
// Find all relevant views that we will need to read user input from
mNameEditText = (EditText) findViewById(R.id.editGolferName);
mHandicapEditText = (EditText) findViewById(R.id.editGolferHandicap);
mPhoneEditText = (EditText) findViewById(R.id.editGolferPhone);
mGenderSpinner = (Spinner) findViewById(R.id.spinner_gender);
setupSpinner();
}
/**
* Setup the dropdown spinner that allows the user to select the gender of the pet.
*/
private void setupSpinner() {
// Create adapter for spinner. The list options are from the String array it will use
// the spinner will use the default layout
ArrayAdapter genderSpinnerAdapter = ArrayAdapter.createFromResource(this,
R.array.array_gender_options, android.R.layout.simple_spinner_item);
// Specify dropdown layout style - simple list view with 1 item per line
genderSpinnerAdapter.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line);
// Apply the adapter to the spinner
mGenderSpinner.setAdapter(genderSpinnerAdapter);
// Set the integer mSelected to the constant values
mGenderSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
String selection = (String) parent.getItemAtPosition(position);
if (!TextUtils.isEmpty(selection)) {
if (selection.equals(getString(R.string.gender_male))) {
mGender = GolferEntry.GENDER_MALE;
} else if (selection.equals(getString(R.string.gender_female))) {
mGender = GolferEntry.GENDER_FEMALE;
}
}
}
// Because AdapterView is an abstract class, onNothingSelected must be defined
@Override
public void onNothingSelected(AdapterView<?> parent) {
mGender = GolferEntry.GENDER_MALE;
}
});
}
/**
* Get user input from editor and save new golfer into database.
*/
private void insertGolfer() {
// Read from input fields
// Use trim to eliminate leading or trailing white space
String nameString = mNameEditText.getText().toString().trim();
String breedString = mHandicapEditText.getText().toString().trim();
String weightString = mPhoneEditText.getText().toString().trim();
int weight = Integer.parseInt(weightString);
// Create database helper
DatabaseHelper mDbHelper = new DatabaseHelper(this);
// Gets the database in write mode
SQLiteDatabase db = mDbHelper.getWritableDatabase();
// Create a ContentValues object where column names are the keys,
// and golfer attributes from the editor are the values.
ContentValues values = new ContentValues();
values.put(GolferEntry.COLUMN_GOLFER_NAME, nameString);
values.put(GolferEntry.COLUMN_HANDICAP, breedString);
values.put(GolferEntry.COLUMN_GENDER, mGender);
values.put(GolferEntry.COLUMN_PHONENO, weight);
// Insert a new row for a golfer in the database, returning the ID of that new row.
long newRowId = db.insert(GolferEntry.TABLE_NAME, null, values);
// Show a toast message depending on whether or not the insertion was successful
if (newRowId == -1) {
// If the row ID is -1, then there was an error with insertion.
Toast.makeText(this, "Error with saving golfer", Toast.LENGTH_SHORT).show();
} else {
// Otherwise, the insertion was successful and we can display a toast with the row ID.
Toast.makeText(this, "Golfer saved with row id: " + newRowId, Toast.LENGTH_SHORT).show();
}
}
public void clearGolfer () {
mNameEditText.setText("");
mHandicapEditText.setText("");
mPhoneEditText.setText("");
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu options from the res/menu/menu_editor.xml file.
// This adds menu items to the app bar.
getMenuInflater().inflate(R.menu.menu_editor, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// User clicked on a menu option in the app bar overflow menu
switch (item.getItemId()) {
// Respond to a click on the "Save" menu option
case R.id.action_save:
// Save golfer to database
insertGolfer();
// Exit activity
finish();
return true;
// Respond to a click on the "Clear" menu option
case R.id.action_clear:
clearGolfer();
return true;
// Respond to a click on the "Up" arrow button in the app bar
case R.id.action_back:
NavUtils.navigateUpFromSameTask(this);
return true;
case android.R.id.home:
// Navigate back to parent activity (CatalogActivity)
NavUtils.navigateUpFromSameTask(this);
return true;
}
return super.onOptionsItemSelected(item);
}
} | [
"eoghan.nolan29@mail.dcu.ie"
] | eoghan.nolan29@mail.dcu.ie |
dae33f9102321991a9563489674f441f9d7d675d | 5d2f845d1e3f08c65dbc0f0bcacfc20247e7445c | /hibernate-problems/src/main/java/hello/entity/nPlusOneProblem/Comment.java | ac8978cea79da36afa3f4d7605850a076279b1cc | [] | no_license | Freeongoo/spring-examples | 15cf87912ddeb2a3de294375bbf404451f622e01 | 48ffdf267837f95e67bf1f702812b57647afbf5e | refs/heads/master | 2022-01-28T21:33:53.275548 | 2021-03-29T14:07:20 | 2021-03-29T14:07:20 | 148,529,220 | 17 | 17 | null | 2022-01-21T23:22:14 | 2018-09-12T19:12:31 | Java | UTF-8 | Java | false | false | 1,013 | java | package hello.entity.nPlusOneProblem;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import hello.entity.AbstractBaseEntity;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;
import javax.persistence.*;
@Entity
@Table(name = "comment")
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class Comment extends AbstractBaseEntity<Long> {
// Lazy
@ManyToOne(fetch = FetchType.LAZY, optional = false)
@JoinColumn(name = "post_id", nullable = false)
@OnDelete(action = OnDeleteAction.CASCADE)
private Post post;
public Comment() {
}
public Comment(String name) {
this.name = name;
}
public Comment(String name, Post post) {
this.name = name;
this.post = post;
}
public Post getPost() {
return post;
}
public void setPost(Post post) {
this.post = post;
}
}
| [
"freeongoo@gmail.com"
] | freeongoo@gmail.com |
bb6e3abe2d545d39facd941980a3b3e65878d082 | aaeaa847b89219dbbc59f7785fb5dd67273f0b94 | /common/src/data/SQLiteManager.java | 050974d0f7754b2a192e4dcd5175d8f35a26fc20 | [
"MIT"
] | permissive | gye-tgm/schat | 94b7998ec63160e1cefb9afda345adfc71d57293 | 627ed78d5ace19218f59da4b232b65fe0bf6a9b1 | refs/heads/master | 2020-12-24T13:28:57.505448 | 2013-12-18T09:22:04 | 2013-12-18T09:22:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,335 | java | package data;
import crypto.Cryptography;
import crypto.Envelope;
import data.contents.ChatContent;
import javax.crypto.SecretKey;
import java.io.*;
import java.security.KeyPair;
import java.security.PublicKey;
import java.sql.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.Scanner;
/**
* @author Gary Ye
* @version 11/30/13
* This class can interact with an SQLite database and it offers
* the needed methods to retrieve or update data.
*/
public class SQLiteManager implements DatabaseManager {
private String url; // the connection url, needed to specify the database to connect to.
/**
* Constructs a SQLite Manager, which can do update or queries
* on the given database. The SQLiteManager needs the name of the
* database to work on. If the name of the database is "client.db"
* then one should pass this string to the constructor.
*
* @param db the database name
*/
public SQLiteManager(String db) {
try {
Class.forName("org.sqlite.JDBC");
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
this.url = "jdbc:sqlite:" + db;
}
/**
* Calls the given create script. The create script is only allowed to have DDL statements like
* CREATE, DROP, ALTER.
*
* @param createScriptFile the filename of the create script
*/
public void createTables(String createScriptFile) {
try (Connection connection = DriverManager.getConnection(url);
Statement statement = connection.createStatement();) {
String sqlScript = new Scanner(new File(createScriptFile)).useDelimiter("\\A").next();
String[] sqlQueries = sqlScript.split(";");
for (String query : sqlQueries) {
statement.executeUpdate(query);
}
} catch (SQLException | FileNotFoundException e) {
e.printStackTrace();
}
}
/**
* Return the user from the given id
*
* @return null if the user was not found or otherwise the data of the user
*/
public User getUserFromGivenId(String id) {
String query = "SELECT id, public_key, symmetric_key FROM user WHERE id = \'" + id + "\'";
PublicKey publicKey = null;
SecretKey secretKey = null;
try (
Connection connection = DriverManager.getConnection(url);
Statement statement = connection.createStatement();
ResultSet rs = statement.executeQuery(query)
) {
if (!rs.next())
return null;
publicKey = Cryptography.getPublicKeyFromBytes(rs.getBytes("public_key"));
secretKey = Cryptography.getSecretKeyFromBytes(rs.getBytes("symmetric_key")); // sprint(publicKeyBytes);
} catch (SQLException e) {
System.err.println(e.getMessage());
}
return new User(id, new KeyPair(publicKey, null), secretKey);
}
/**
* Returns the public of the given user
*
* @param id the given id
* @return the public key of the given user
*/
public PublicKey getPublicKeyFromId(String id) {
return getUserFromGivenId(id).getKeyPair().getPublic();
}
/**
* Returns whether the user exists or not.
*
* @param id the given user id
* @return whether the user exists or not
*/
public boolean userExists(String id) {
return getUserFromGivenId(id) != null;
}
/**
* Execute a simple DDL query like INSERT, UPDATE or ALTER.
*
* @param sql the sql query
*/
public void executeQuery(String sql) {
try (Connection connection = getConnection();
Statement stmt = connection.createStatement();
) {
stmt.executeUpdate(sql);
} catch (SQLException e) {
e.printStackTrace();
}
}
/**
* This method will insert the given user to the database.
* Every attribute of the user will be inserted into.
*
* @param user the user
*/
public void insertUser(User user) {
String sql = "INSERT INTO user VALUES(?,?,?) ";
try (Connection connection = getConnection();
) {
PreparedStatement pstmt = connection.prepareStatement(sql);
pstmt.setString(1, user.getId());
// In SQLite you set blob as bytes
if (user.getPublicKey() != null)
pstmt.setBytes(2, user.getKeyPair().getPublic().getEncoded());
if (user.getSecretKey() != null)
pstmt.setBytes(3, user.getSecretKey().getEncoded());
pstmt.executeUpdate();
} catch (SQLException ex) {
System.out.println("Unexpected exception: " + ex.toString());
}
}
/**
* Returns a list of all users in the lexicographical order from the database.
*
* @return all users in the lexicographical order
*/
public ArrayList<User> loadUsers() {
String sql = "SELECT id, public_key, symmetric_key FROM user ORDER BY id ASC";
ArrayList<User> list = new ArrayList<>();
try (Connection connection = getConnection();
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery(sql);
) {
while (rs.next()) {
String id = rs.getString("id");
PublicKey publicKey = Cryptography.getPublicKeyFromBytes(rs.getBytes("public_key"));
SecretKey secretKey = Cryptography.getSecretKeyFromBytes(rs.getBytes("symmetric_key"));
list.add(new User(id, new KeyPair(publicKey, null), secretKey));
}
} catch (SQLException e) {
e.printStackTrace();
}
return list;
}
/**
* Gets a connection from the driver manager
*
* @return a connection to an SQLite database
* @throws SQLException will be thrown if an sql exception occurs
*/
public Connection getConnection() throws SQLException {
return DriverManager.getConnection(url);
}
/**
* Remove the user with the given id from the database
*
* @param id the id of the user to remove
* @return if the operation was successful
*/
public boolean removeUser(String id) {
try (
Connection conn = getConnection();
PreparedStatement pstmt = conn.prepareStatement("DELETE FROM user WHERE id = ?")
) {
pstmt.setString(1, id);
pstmt.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
return false;
}
return true;
}
/**
* Inserts the encrypted message to the database.
*
* @param envelope the envelope to insert
*/
public void insertEncryptedMessage(Envelope envelope) {
try (
Connection connection = getConnection();
PreparedStatement pstmt = connection.prepareStatement("INSERT INTO message VALUES(?,?,?)");
) {
pstmt.setString(1, envelope.getReceiver());
pstmt.setLong(2, envelope.getTimestamp().getTime());
try (ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutput out = new ObjectOutputStream(bos)
) {
out.writeObject(envelope);
pstmt.setBytes(3, bos.toByteArray());
} catch (IOException e) {
e.printStackTrace();
}
pstmt.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
}
}
/**
* Loads the stored envelopes from the database.
*
* @param id the id of the receiver
* @return the stored envelopes from the database.
*/
public ArrayList<Envelope> loadEncryptedMessagesFromReceiver(String id) {
ArrayList<Envelope> ret = new ArrayList<>();
ResultSet rs = null;
try (
Connection connection = getConnection();
PreparedStatement pstmt = connection.prepareStatement("SELECT content" +
" FROM message WHERE receiver_id = ? ORDER BY timestamp ASC")
) {
pstmt.setString(1, id);
rs = pstmt.executeQuery();
while (rs.next()) {
try (
ByteArrayInputStream bis = new ByteArrayInputStream(rs.getBytes(1));
ObjectInput in = new ObjectInputStream(bis)
) {
ret.add((Envelope) in.readObject());
} catch (IOException | ClassNotFoundException e) {
e.printStackTrace();
}
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
if (rs != null)
try {
rs.close();
} catch (SQLException ignored) {
}
}
return ret;
}
/**
* Inserts the given message.
*
* @param message the message
*/
@Override
public void insertMessage(Message<ChatContent> message) {
try (
Connection connection = getConnection();
PreparedStatement pstmt = connection.prepareStatement("INSERT INTO message VALUES(?,?,?,?)");
) {
pstmt.setString(1, message.getSender());
pstmt.setString(2, message.getReceiver());
pstmt.setLong(3, message.getTimestamp().getTime() / 1000);
pstmt.setString(4, message.getContent().getMessage());
pstmt.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
}
}
/**
* Loads the messages from the given given receiver id.
*
* @param id the id of the receiver
* @return the messages from the given receiver id
*/
public ArrayList<Message<ChatContent>> loadMessagesFromReceiver(String id) {
return loadMessagesFromUser("receiver_id", id);
}
/**
* Loads the messages from the given sender id
*
* @param id the id of the sender id
* @return the messages from the given sender id
*/
public ArrayList<Message<ChatContent>> loadMessagesFromSender(String id) {
return loadMessagesFromUser("sender_id", id);
}
/**
* Loads the message from the given user.
* One must specify whether the given user is the receiver or the sender.
*
* @param who "receiver_id" or "sender_id"
* @param id the id of the corresponding user
* @return the corresponding messages to the given set of user data
*/
public ArrayList<Message<ChatContent>> loadMessagesFromUser(String who, String id) {
ArrayList<Message<ChatContent>> ret = new ArrayList<>();
try (
Connection connection = getConnection();
PreparedStatement pstmt = connection.prepareStatement("SELECT sender_id, receiver_id, timestamp, content" +
" FROM message WHERE " + who + " = ? ORDER BY timestamp ASC")
) {
pstmt.setString(1, id);
ResultSet rs = pstmt.executeQuery();
while (rs.next()) {
String senderId = rs.getString(1);
String receiverId = rs.getString(2);
long timestamp = rs.getLong(3);
String content = rs.getString(4);
ret.add(new Message<ChatContent>(new Date(timestamp), senderId, receiverId, new ChatContent(content)));
}
} catch (SQLException e) {
e.printStackTrace();
}
return ret;
}
/**
* Removes the encrypted message
*
* @param e the encrypted message to delete
*/
public void removeEncryptedMessage(Envelope e) {
try (
Connection conn = getConnection();
PreparedStatement stmt = conn.prepareStatement("DELETE FROM message WHERE receiver_id = ? AND timestamp = ?")
) {
stmt.setString(1, e.getReceiver());
stmt.setLong(2, e.getTimestamp().getTime());
stmt.executeUpdate();
} catch (SQLException ex) {
ex.printStackTrace();
}
}
}
| [
"gye@student.tgm.ac.at"
] | gye@student.tgm.ac.at |
8ebd301b60cbae9c2c1156cd779a6b265e61015f | 071a9fa7cfee0d1bf784f6591cd8d07c6b2a2495 | /corpus/norm-class/tomcat70/713.java | 2aec26ef9e02a2cf0c1e4f17931cabd1febbf1d5 | [
"MIT"
] | permissive | masud-technope/ACER-Replication-Package-ASE2017 | 41a7603117f01382e7e16f2f6ae899e6ff3ad6bb | cb7318a729eb1403004d451a164c851af2d81f7a | refs/heads/master | 2021-06-21T02:19:43.602864 | 2021-02-13T20:44:09 | 2021-02-13T20:44:09 | 187,748,164 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,562 | java | licensed apache software foundation asf contributor license agreements notice file distributed work additional copyright ownership asf licenses file apache license version license file compliance license copy license http apache org licenses license required applicable law agreed writing software distributed license distributed basis warranties conditions kind express implied license specific language governing permissions limitations license org apache tomcat jni multicast author mladen turk multicast join multicast group param sock socket join multicast group param join address multicast group join param iface address passed multicast dependent param source source address accept transmissions impl ies implies source specific multicast join sock join iface source leave multicast group arguments apr mcast join param sock socket leave multicast group param add r addr address multicast group leave param iface address passed multicast dependent param source source address accept transmissions impl ies implies source specific multicast leave sock add r addr iface source multicast time live ttl multicast tra nsmission transmission param sock socket multicast ttl param ttl time live assign remark ttl pack ets packets sockets local machine multicast loop back loopback enabled hops sock ttl toggle multicast loop back loopback param sock socket multicast loop back loopback param opt disable enable loop back loopback sock opt out going outgoing multicast transmissions param sock socket multicast param iface address multicast ointerface sock iface | [
"masudcseku@gmail.com"
] | masudcseku@gmail.com |
4e9cfd6147598ccab5963756282cfad6730a863b | 24b244d9dfaf0806132625525a71ac556efdee74 | /src/Main/Application.java | 480b2fae5d1595d8fc570dff3053b0e913500119 | [] | no_license | Zulfe/Sudoku | 9dce279dc37d040985f671a6b61694a552b07b52 | e9a60b22409ed20215fbe0de3ddec5d1cac312ce | refs/heads/master | 2021-01-01T19:55:26.629079 | 2016-11-28T04:54:21 | 2016-11-28T04:54:21 | 31,303,848 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 331 | java | package Main;
import Model.PuzzleModel;
import Model.WebScraperModel;
public class Application {
public static void main(String[] args){
WebScraperModel wsm = new WebScraperModel();
int[] oneDimPuzzle = wsm.scrapeWebSudokuByLevel("medium");
PuzzleModel puzzle = new PuzzleModel(oneDimPuzzle);
puzzle.printPuzzle();
}
}
| [
"Zulfe@live.com"
] | Zulfe@live.com |
bc05f8bf0847b8943ef46c510e61cbb097a258ff | cd391afb50d894127ada1ef1b983a8fbffd3846c | /app/src/test/java/com/example/justin/draganddrop/ExampleUnitTest.java | e118767a51008025a57557c888ecb9eda912fb5c | [] | no_license | djen10/DragAndDrop | 5bfc0e6e1361211112272d9f9d5b7646fa394d75 | b24542176b75e6904b603d9ee06cf63c5ff1a86a | refs/heads/master | 2021-08-06T23:19:19.547429 | 2017-11-07T05:10:32 | 2017-11-07T05:10:32 | 109,781,834 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 408 | java | package com.example.justin.draganddrop;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"djen12@naver.com"
] | djen12@naver.com |
83b1672d548626c9f5bd787d52a1fad4aec1471b | 934a82c56245fa6ac65e9600fc0fc66582c3fb18 | /FirstNotRepeatingChar.java | 84adc9598aba97d981e5561f7f4589e3f0513bf8 | [] | no_license | yanpangzhi/Algorithms | 0a18ccfc3ca3ae992b2c15df0c0ecdd857286bd3 | d2781ffa97605a5a05fb1a39dbfff949a8abc2f6 | refs/heads/main | 2023-06-04T19:40:07.310794 | 2021-06-30T01:23:32 | 2021-06-30T01:23:32 | 373,239,271 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 365 | java | //第一个只出现一次的字符
public class FirstNotRepeatingChar {
public int FirsChar(String str) {
if(str==null ||str.length()==0)
return -1;
int len = str.length();
int []arr = new int[256];
for(int i=0;i<len;i++) {
arr[str.charAt(i)]+=1;
}
for(int i =0;i<len;i++) {
if(arr[str.charAt(i)]==1)
return i;
}
return -1;
}
}
| [
"1219100243@qq.com"
] | 1219100243@qq.com |
9cd295b57153167a2b0ca4e8147c2d3c28075375 | 0231b4570a8c34e3c8e2934d0bf79b116e4f35f0 | /src/com/snapIT/c_objectOrientedProgramming/fundamentals/interfaces/Engineer.java | 30463bea7bb94a819c1938bc989dd14b03fe4a77 | [] | no_license | CarloSantos11/JavaTrack | fd5b0767aed3977fc0ed75dcb8523f5b305cc1ec | 3c03774b94ff215ccc504a1b473240b088d0f0a6 | refs/heads/master | 2023-02-10T06:04:06.036198 | 2020-12-16T16:22:17 | 2020-12-16T16:22:17 | 311,139,433 | 0 | 0 | null | 2020-12-16T16:22:18 | 2020-11-08T19:35:07 | Java | UTF-8 | Java | false | false | 276 | java | package com.snapIT.c_objectOrientedProgramming.fundamentals.interfaces;
public class Engineer implements PersonBehavior{
@Override
public void breathe(){
}
@Override
public void sleep() {
}
@Override
public void walk(int speed) {
}
}
| [
"carlo@snapit.solutions"
] | carlo@snapit.solutions |
3bec9f2b6cb039ac68de0fb09a71a3c59eb322bc | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/28/28_59f216256b23f4c4dc64152eb1b2ceeaab496b5f/ContextualPalette/28_59f216256b23f4c4dc64152eb1b2ceeaab496b5f_ContextualPalette_t.java | b1a55862cdf2083d996261726952ef8341d9f304 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 9,710 | java | /*
* (c) Copyright 2010-2011 AgileBirds
*
* This file is part of OpenFlexo.
*
* OpenFlexo is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* OpenFlexo 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 for more details.
*
* You should have received a copy of the GNU General Public License
* along with OpenFlexo. If not, see <http://www.gnu.org/licenses/>.
*
*/
package org.openflexo.vpm.drawingshema;
import java.util.Hashtable;
import java.util.Vector;
import java.util.logging.Logger;
import javax.swing.JScrollPane;
import org.openflexo.fge.DrawingGraphicalRepresentation;
import org.openflexo.fge.GraphicalRepresentation;
import org.openflexo.fge.ShapeGraphicalRepresentation;
import org.openflexo.fge.controller.DrawingPalette;
import org.openflexo.fge.controller.PaletteElement;
import org.openflexo.fge.geom.FGEPoint;
import org.openflexo.foundation.DataModification;
import org.openflexo.foundation.FlexoObservable;
import org.openflexo.foundation.GraphicalFlexoObserver;
import org.openflexo.foundation.ontology.EditionPatternReference;
import org.openflexo.foundation.view.ViewShape;
import org.openflexo.foundation.viewpoint.AddShape;
import org.openflexo.foundation.viewpoint.DropScheme;
import org.openflexo.foundation.viewpoint.EditionAction;
import org.openflexo.foundation.viewpoint.EditionPattern;
import org.openflexo.foundation.viewpoint.ExampleDrawingObject;
import org.openflexo.foundation.viewpoint.GraphicalElementPatternRole;
import org.openflexo.foundation.viewpoint.ShapePatternRole;
import org.openflexo.foundation.viewpoint.ViewPointPalette;
import org.openflexo.foundation.viewpoint.ViewPointPaletteElement;
import org.openflexo.foundation.viewpoint.action.AddExampleDrawingShape;
import org.openflexo.foundation.viewpoint.dm.CalcPaletteElementInserted;
import org.openflexo.foundation.viewpoint.dm.CalcPaletteElementRemoved;
public class ContextualPalette extends DrawingPalette implements GraphicalFlexoObserver {
private static final Logger logger = Logger.getLogger(ContextualPalette.class.getPackage().getName());
private ViewPointPalette _calcPalette;
public ContextualPalette(ViewPointPalette viewPointPalette) {
super((int) ((DrawingGraphicalRepresentation) viewPointPalette.getGraphicalRepresentation()).getWidth(),
(int) ((DrawingGraphicalRepresentation) viewPointPalette.getGraphicalRepresentation()).getHeight(), viewPointPalette
.getName());
_calcPalette = viewPointPalette;
for (ViewPointPaletteElement element : viewPointPalette.getElements()) {
addElement(makePaletteElement(element));
}
makePalettePanel();
getPaletteView().revalidate();
viewPointPalette.addObserver(this);
}
@Override
public void update(FlexoObservable observable, DataModification dataModification) {
if (observable == _calcPalette) {
if (dataModification instanceof CalcPaletteElementInserted) {
logger.info("Notified new Palette Element added");
CalcPaletteElementInserted dm = (CalcPaletteElementInserted) dataModification;
ContextualPaletteElement e = makePaletteElement(dm.newValue());
addElement(e);
e.getGraphicalRepresentation().notifyObjectHierarchyHasBeenUpdated();
JScrollPane oldPaletteView = getPaletteViewInScrollPane();
updatePalette();
getController().updatePalette(_calcPalette, oldPaletteView);
} else if (dataModification instanceof CalcPaletteElementRemoved) {
logger.info("Notified new Palette Element removed");
CalcPaletteElementRemoved dm = (CalcPaletteElementRemoved) dataModification;
ContextualPaletteElement e = getContextualPaletteElement(dm.oldValue());
removeElement(e);
JScrollPane oldPaletteView = getPaletteViewInScrollPane();
updatePalette();
getController().updatePalette(_calcPalette, oldPaletteView);
}
}
}
protected ContextualPaletteElement getContextualPaletteElement(ViewPointPaletteElement element) {
for (PaletteElement e : elements) {
if (e instanceof ContextualPaletteElement && ((ContextualPaletteElement) e).viewPointPaletteElement == element) {
return (ContextualPaletteElement) e;
}
}
return null;
}
@Override
public CalcDrawingShemaController getController() {
return (CalcDrawingShemaController) super.getController();
}
private Vector<DropScheme> getAvailableDropSchemes(EditionPattern pattern, GraphicalRepresentation target) {
Vector<DropScheme> returned = new Vector<DropScheme>();
for (DropScheme dropScheme : pattern.getDropSchemes()) {
if (dropScheme.isTopTarget() && target instanceof DrawingGraphicalRepresentation) {
returned.add(dropScheme);
}
if (target.getDrawable() instanceof ViewShape) {
ViewShape targetShape = (ViewShape) target.getDrawable();
for (EditionPatternReference ref : targetShape.getEditionPatternReferences()) {
if (dropScheme.isValidTarget(ref.getEditionPattern(), ref.getPatternRole())) {
returned.add(dropScheme);
}
}
}
}
return returned;
}
private ContextualPaletteElement makePaletteElement(final ViewPointPaletteElement element) {
return new ContextualPaletteElement(element);
}
protected class ContextualPaletteElement implements PaletteElement {
private ViewPointPaletteElement viewPointPaletteElement;
private PaletteElementGraphicalRepresentation gr;
public ContextualPaletteElement(final ViewPointPaletteElement aPaletteElement) {
viewPointPaletteElement = aPaletteElement;
gr = new PaletteElementGraphicalRepresentation(viewPointPaletteElement.getGraphicalRepresentation(), null, getPaletteDrawing()) {
@Override
public String getText() {
if (aPaletteElement != null && aPaletteElement.getBoundLabelToElementName()) {
return aPaletteElement.getName();
}
return "";
}
};
gr.setDrawable(this);
}
@Override
public boolean acceptDragging(GraphicalRepresentation target) {
return target instanceof CalcDrawingShemaGR || target instanceof CalcDrawingShapeGR;
}
@Override
public boolean elementDragged(GraphicalRepresentation containerGR, FGEPoint dropLocation) {
if (containerGR.getDrawable() instanceof ExampleDrawingObject) {
ExampleDrawingObject rootContainer = (ExampleDrawingObject) containerGR.getDrawable();
DropScheme dropScheme = viewPointPaletteElement.getDropScheme();
Hashtable<GraphicalElementPatternRole, ExampleDrawingObject> grHierarchy = new Hashtable<GraphicalElementPatternRole, ExampleDrawingObject>();
for (EditionAction action : dropScheme.getActions()) {
if (action instanceof AddShape) {
ShapePatternRole role = ((AddShape) action).getPatternRole();
ShapeGraphicalRepresentation<?> shapeGR = (ShapeGraphicalRepresentation<?>) viewPointPaletteElement
.getOverridingGraphicalRepresentation(role);
if (shapeGR == null) {
shapeGR = role.getGraphicalRepresentation();
}
ExampleDrawingObject container = null;
if (role.getParentShapePatternRole() != null) {
logger.info("Adding shape " + role + " under " + role.getParentShapePatternRole());
container = grHierarchy.get(role.getParentShapePatternRole());
} else {
logger.info("Adding shape " + role + " as root");
container = rootContainer;
if (viewPointPaletteElement.getBoundLabelToElementName()) {
shapeGR.setText(viewPointPaletteElement.getName());
}
shapeGR.setLocation(dropLocation);
}
AddExampleDrawingShape addShapeAction = AddExampleDrawingShape.actionType.makeNewAction(container, null,
getController().getCEDController().getEditor());
addShapeAction.graphicalRepresentation = shapeGR;
addShapeAction.newShapeName = role.getPatternRoleName();
if (role.getParentShapePatternRole() == null) {
addShapeAction.newShapeName = viewPointPaletteElement.getName();
}
addShapeAction.doAction();
grHierarchy.put(role, addShapeAction.getNewShape());
}
}
/*ShapeGraphicalRepresentation<?> shapeGR = getGraphicalRepresentation().clone();
shapeGR.setIsSelectable(true);
shapeGR.setIsFocusable(true);
shapeGR.setIsReadOnly(false);
shapeGR.setLocationConstraints(LocationConstraints.FREELY_MOVABLE);
shapeGR.setLocation(dropLocation);
shapeGR.setLayer(containerGR.getLayer() + 1);
shapeGR.setAllowToLeaveBounds(true);
AddExampleDrawingShape action = AddExampleDrawingShape.actionType.makeNewAction(container, null, getController()
.getCEDController().getEditor());
action.graphicalRepresentation = shapeGR;
action.newShapeName = shapeGR.getText();
if (action.newShapeName == null) {
action.newShapeName = FlexoLocalization.localizedForKey("shape");
// action.nameSetToNull = true;
// action.setNewShapeName(FlexoLocalization.localizedForKey("unnamed"));
}
action.doAction();
return action.hasActionExecutionSucceeded();*/
return true;
}
return false;
}
@Override
public PaletteElementGraphicalRepresentation getGraphicalRepresentation() {
return gr;
}
@Override
public DrawingPalette getPalette() {
return ContextualPalette.this;
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
361452bdf9900796a502d4074458ef38b45e85c9 | 016a5d32c6140c032a7a94b88f34659cf0b3f0a6 | /app/src/main/java/com/iitbhu/technex18/JSONParses/JSONParseNotification.java | 795c7d061bc05d5af5bc1caf2da5144489346d0c | [] | no_license | abhinavcode/Technex-18 | 760d906751825895c8471a8945bf44f61413cb78 | 29926ad67d82dd9acdc3e190f6017bd0a1393ca3 | refs/heads/master | 2021-07-17T13:10:54.405655 | 2017-10-24T21:19:24 | 2017-10-24T21:19:24 | 106,311,536 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,751 | java | package com.iitbhu.technex18.JSONParses;
import com.iitbhu.technex18.container.Notification;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
/**
* Created by abhinav on 21/10/17.
*/
public class JSONParseNotification {
public static String[] times;
public static String[] msg;
public static Boolean[] read;
private JSONArray notification = null;
List<Notification> items ;
private String json;
public void parseJSONNotification(String json){
// JSONObject jsonObject=null;
this.json = json;
try {
notification = new JSONArray(json);
times = new String[notification.length()];
msg= new String[notification.length()];
read= new Boolean[notification.length()];
items = new ArrayList<Notification>();
for(int i=0;i< notification.length();i++){
Notification object = new Notification();
JSONObject jsonObject = notification.getJSONObject(i);
msg[i] = jsonObject.getString("message");
times[i] = jsonObject.getString("creation_time");
read[i]=jsonObject.getBoolean("mark_read");
object.setMessage(msg[i]);
object.setRead(read[i]);
object.setTime(times[i]);
// System.out.println("link is "+hyperlink[i]);
items.add(object);
}
} catch (JSONException e) {
e.printStackTrace();
}
}
public List<Notification> getItems()
{
//function to return the final populated list
return items;
}
}
| [
"cancrackjee2014@gmail.com"
] | cancrackjee2014@gmail.com |
19311b48d1a18610d6cd8152e4f3ccbb72705a29 | 06f7723c6a6de96b15162850d8a7de9e46e6ea40 | /Java-Code-Practices/src/main/java/org/java/coding/practices/FlatMapListOfStudents.java | 4d2eaa615870b703accbc18184e99182e63835ff | [] | no_license | DhirenKumar13/CoreJavaPractice | a09a67f30b4ec857a0d333553c2e48e29037dc2b | edce169c836f472c10dcea619e0736143224c029 | refs/heads/master | 2020-03-20T22:10:58.299586 | 2018-08-27T10:51:41 | 2018-08-27T10:51:41 | 137,783,618 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,349 | java | package org.java.coding.practices;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
public class FlatMapListOfStudents {
public static void main(String[] args) {
Student s1 = new Student();
s1.setName("Dhiren");
s1.addBook("Java");
s1.addBook("NodeJS");
s1.addBook("Spring Boot");
Student s2 = new Student();
s2.setName("Anushka");
s2.addBook("ReactJS");
s2.addBook("NodeJS");
List<Student> studentList = new ArrayList<>();
studentList.add(s1);
studentList.add(s2);
List<String> collectedList = studentList.stream()
.map(student -> student.getBooks())
.flatMap(student -> student.stream())
.distinct()
.collect(Collectors.toList());
collectedList.forEach(System.out::println);
}
}
class Student {
private String name;
private Set<String> books;
public Set<String> getBooks() {
return books;
}
public void setBooks(Set<String> books) {
this.books = books;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public void addBook(String book) {
if(books == null) {
books = new HashSet<>();
}
books.add(book);
}
@Override
public String toString() {
return "Student [name=" + name + ", books=" + books + "]";
}
} | [
"DH317097@wipro.com"
] | DH317097@wipro.com |
ef4161a6580caad85b9545e45411cfa4ab104dce | da9398e3c2233704c10ba32aada8e870f35fe788 | /SpringEx10HasARelation/src/com/spring/test/Employee.java | 0ff0e1a46ca55519cef4395ee1b71096aa013cfa | [] | no_license | ravidream/spring-framework_examples | 9bf5471dff5d3b0fab4012794ae362f75810c56f | bf94a11b6178c66c05b9363e498a72e5be65883b | refs/heads/master | 2020-03-21T06:14:47.758308 | 2018-06-22T20:46:42 | 2018-06-22T20:46:42 | 138,207,105 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 571 | java | package com.spring.test;
/**
*
* @author Ravi Thapa
*
*/
public class Employee {
private int id;
private String name;
private Address address;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Address getAddress() {
return address;
}
public void setAddress(Address address) {
this.address = address;
}
void displayInfo() {
System.out.println(id + " " + name);
System.out.println(address);
}
}
| [
"ravi.thapa@csireg.com"
] | ravi.thapa@csireg.com |
8f00cb59c3cbafa54835a6f986650cd3f6f318c4 | 70b444c8f54bf0515848bcb35b5621736cc616f0 | /Assignments/Assignment_4/src/Business/Department.java | 79b7c8cda17949fd4326859d3012f55b286e9c99 | [] | no_license | MalickFairoz/INFO5100-Application-Engineering-and-Development | 7d6e87056e05fab82dc3cd223a4a648afd4eee2f | c4c407931b9a5c0374dd59aa293c74f42f55455f | refs/heads/master | 2021-01-19T12:22:38.218864 | 2018-07-31T03:39:29 | 2018-07-31T03:39:29 | 69,261,276 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,905 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Business;
//import java.util.*;
/**
*
* @author Malick
*/
public class Department {
private String departmentName;
private FacultyDirectory facultyDirectory;
private StudentDirectory studentDirectory;
private CourseCatalog courseCatalog;
private StaffRoleDirectory staffRoleDirectory;
public Department(StaffRoleDirectory staffRoleDirectory) {
this.staffRoleDirectory = staffRoleDirectory;
}
public StaffRoleDirectory getStaffRoleDirectory() {
return staffRoleDirectory;
}
public void setStaffRoleDirectory(StaffRoleDirectory staffRoleDirectory) {
this.staffRoleDirectory = staffRoleDirectory;
}
public CourseCatalog getCourseCatalog() {
return courseCatalog;
}
public void setCourseCatalog(CourseCatalog courseCatalog) {
this.courseCatalog = courseCatalog;
}
public StudentDirectory getStudentDirectory() {
return studentDirectory;
}
public void setStudentDirectory(StudentDirectory studentDirectory) {
this.studentDirectory = studentDirectory;
}
public String getDepartmentName() {
return departmentName;
}
public void setDepartmentName(String departmentName) {
this.departmentName = departmentName;
}
public FacultyDirectory getFacultyDirectory() {
return facultyDirectory;
}
public void setFacultyDirectory(FacultyDirectory facultyDirectory) {
this.facultyDirectory = facultyDirectory;
}
public Department(){
facultyDirectory = new FacultyDirectory();
studentDirectory = new StudentDirectory();
this.courseCatalog = new CourseCatalog();
}
}
| [
"sayeedabuthahir.m@husky.neu.edu"
] | sayeedabuthahir.m@husky.neu.edu |
fec77748a7305cc560f387fa84872da260d90887 | de721e8a5c8b4eca0caa52324b2f1376f0c6f58f | /src/main/java/com/noturingback/tradinglearning/service/mapper/package-info.java | 09b8e237e675fdc9f9ef6acbfffaa4da2860a69e | [] | no_license | BulkSecurityGeneratorProject/trading-learning | 9dcf0638830512d15a97f99a16481df5a064cd8f | d74ee78c3574600a4bd10adc831cb777e53b6c02 | refs/heads/master | 2022-12-17T04:23:33.614345 | 2016-12-02T04:44:54 | 2016-12-02T04:44:54 | 296,675,082 | 0 | 0 | null | 2020-09-18T16:32:44 | 2020-09-18T16:32:43 | null | UTF-8 | Java | false | false | 140 | java | /**
* MapStruct mappers for mapping domain objects and Data Transfer Objects.
*/
package com.noturingback.tradinglearning.service.mapper;
| [
"pauletienne.francois@gmail.com"
] | pauletienne.francois@gmail.com |
73c7005ec8bec4ea5e993afa427fb8c0b346f044 | d9328fbc6a29c4103dd0df99d285405deb735125 | /bbcProject/WebContent/WEB-INF/jspwork/org/apache/jsp/views/branch/helpcenter/eventDetail_jsp.java | fa7f2e0c20847ef617951288b6709d2cd94c7cb6 | [] | no_license | yongwhan0213/bbcProject | b7fb13539847779f4f217ab13260131ac1e81bad | a56f402840b8b231be044ff7f36903eb9e7eb5d9 | refs/heads/master | 2022-04-11T06:53:21.606377 | 2020-03-27T06:01:35 | 2020-03-27T06:01:35 | 250,166,501 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 24,533 | java | /*
* Generated by the Jasper component of Apache Tomcat
* Version: Apache Tomcat/8.5.51
* Generated at: 2020-03-23 12:03:19 UTC
* Note: The last modified time of this file was set to
* the last modified time of the source file after
* generation to assist with modification tracking.
*/
package org.apache.jsp.views.branch.helpcenter;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import com.bbc.event.model.vo.Event;
public final class eventDetail_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent,
org.apache.jasper.runtime.JspSourceImports {
private static final javax.servlet.jsp.JspFactory _jspxFactory =
javax.servlet.jsp.JspFactory.getDefaultFactory();
private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants;
static {
_jspx_dependants = new java.util.HashMap<java.lang.String,java.lang.Long>(1);
_jspx_dependants.put("/views/branch/helpcenter/../../../views/branch/common/menubar.jsp", Long.valueOf(1584950460296L));
}
private static final java.util.Set<java.lang.String> _jspx_imports_packages;
private static final java.util.Set<java.lang.String> _jspx_imports_classes;
static {
_jspx_imports_packages = new java.util.HashSet<>();
_jspx_imports_packages.add("javax.servlet");
_jspx_imports_packages.add("javax.servlet.http");
_jspx_imports_packages.add("javax.servlet.jsp");
_jspx_imports_classes = new java.util.HashSet<>();
_jspx_imports_classes.add("com.bbc.event.model.vo.Event");
}
private volatile javax.el.ExpressionFactory _el_expressionfactory;
private volatile org.apache.tomcat.InstanceManager _jsp_instancemanager;
public java.util.Map<java.lang.String,java.lang.Long> getDependants() {
return _jspx_dependants;
}
public java.util.Set<java.lang.String> getPackageImports() {
return _jspx_imports_packages;
}
public java.util.Set<java.lang.String> getClassImports() {
return _jspx_imports_classes;
}
public javax.el.ExpressionFactory _jsp_getExpressionFactory() {
if (_el_expressionfactory == null) {
synchronized (this) {
if (_el_expressionfactory == null) {
_el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
}
}
}
return _el_expressionfactory;
}
public org.apache.tomcat.InstanceManager _jsp_getInstanceManager() {
if (_jsp_instancemanager == null) {
synchronized (this) {
if (_jsp_instancemanager == null) {
_jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig());
}
}
}
return _jsp_instancemanager;
}
public void _jspInit() {
}
public void _jspDestroy() {
}
public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response)
throws java.io.IOException, javax.servlet.ServletException {
final java.lang.String _jspx_method = request.getMethod();
if (!"GET".equals(_jspx_method) && !"POST".equals(_jspx_method) && !"HEAD".equals(_jspx_method) && !javax.servlet.DispatcherType.ERROR.equals(request.getDispatcherType())) {
response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, "JSPs only permit GET POST or HEAD");
return;
}
final javax.servlet.jsp.PageContext pageContext;
javax.servlet.http.HttpSession session = null;
final javax.servlet.ServletContext application;
final javax.servlet.ServletConfig config;
javax.servlet.jsp.JspWriter out = null;
final java.lang.Object page = this;
javax.servlet.jsp.JspWriter _jspx_out = null;
javax.servlet.jsp.PageContext _jspx_page_context = null;
try {
response.setContentType("text/html; charset=UTF-8");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write("\r\n");
out.write("\r\n");
Event eList = (Event)request.getAttribute("eList");
out.write("\r\n");
out.write("<!DOCTYPE html>\r\n");
out.write("<html>\r\n");
out.write("<head>\r\n");
out.write("<meta charset=\"UTF-8\">\r\n");
out.write("<title>Insert title here</title>\r\n");
out.write("<link href=\"");
out.print( request.getContextPath() );
out.write("/resources/css/sb-admin-2.css\" rel=\"stylesheet\">\r\n");
out.write("</head>\r\n");
out.write("<body id=\"page-top\">\r\n");
out.write("\r\n");
out.write("\t<!-- Page Wrapper -->\r\n");
out.write("\t<div id=\"wrapper\">\r\n");
out.write("\r\n");
out.write("\t\t");
out.write("\r\n");
out.write("<!DOCTYPE html>\r\n");
out.write("<html>\r\n");
out.write("<head>\r\n");
out.write("\r\n");
out.write("<!-- 공통 -->\r\n");
out.write("<link href=\"");
out.print( request.getContextPath() );
out.write("/resources/vendor/fontawesome-free/css/all.min.css\" rel=\"stylesheet\" type=\"text/css\">\r\n");
out.write("<link href=\"https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i\" rel=\"stylesheet\">\r\n");
out.write("<script src=\"");
out.print( request.getContextPath() );
out.write("/resources/vendor/jquery-easing/jquery.easing.min.js\"></script>\r\n");
out.write("<script src=\"");
out.print( request.getContextPath() );
out.write("/resources/vendor/jquery/jquery.min.js\"></script>\r\n");
out.write("<script src=\"");
out.print( request.getContextPath() );
out.write("/resources/vendor/bootstrap/js/bootstrap.bundle.min.js\"></script>\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("<link href=\"");
out.print( request.getContextPath() );
out.write("/resources/css/common/menubar.css\" rel=\"stylesheet\">\r\n");
out.write("\r\n");
out.write("<meta charset=\"UTF-8\">\r\n");
out.write("<title>Insert title here</title>\r\n");
out.write("</head>\r\n");
out.write("<body>\r\n");
out.write("\r\n");
out.write("\t<!-- Sidebar -->\r\n");
out.write("\t<ul class=\"navbar-nav sidebar sidebar-dark accordion\"\r\n");
out.write("\t\tid=\"accordionSidebar\">\r\n");
out.write("\r\n");
out.write("\t\t<!-- Sidebar - Home -->\r\n");
out.write("\t\t<a class=\"sidebar-brand d-flex align-items-center justify-content-center\" href=\"");
out.print( request.getContextPath() );
out.write("/views/branch/common/branchmain.jsp\">\r\n");
out.write("\t\t\t<div class=\"sidebar-brand-text mx-3\">\r\n");
out.write("\t\t\t\tBBC <i class=\"fa fa-home fa-fw home-icon\"></i>\r\n");
out.write("\t\t\t</div>\r\n");
out.write("\t\t</a>\r\n");
out.write("\r\n");
out.write("\t\t<!-- Divider -->\r\n");
out.write("\t\t<hr class=\"sidebar-divider my-0\">\r\n");
out.write("\r\n");
out.write("\t\t<!-- Nav Item - Dashboard -->\r\n");
out.write("\t\t<li class=\"nav-item active\"><i class=\"nav-link fa fa-user fa-5x\"></i>\r\n");
out.write("\t\t\t<p class=\"m-name\">지점 관리자</p></li>\r\n");
out.write("\r\n");
out.write("\t\t<!-- Divider -->\r\n");
out.write("\t\t<hr class=\"sidebar-divider\">\r\n");
out.write("\r\n");
out.write("\t\t<!-- Nav Item - 예약 관리 Collapse Menu -->\r\n");
out.write("\t\t<li class=\"nav-item\">\r\n");
out.write("\t\t\t<a class=\"nav-link collapsed\" href=\"#\"\r\n");
out.write("\t\t\tdata-toggle=\"collapse\" data-target=\"#collapseTwo\"\r\n");
out.write("\t\t\taria-expanded=\"true\" aria-controls=\"collapseTwo\"> <i\r\n");
out.write("\t\t\t\tclass=\"fa fa-book fa-fw\"></i> <span>예약 관리</span>\r\n");
out.write("\t\t\t</a>\r\n");
out.write("\t\t\t<div id=\"collapseTwo\" class=\"collapse\" aria-labelledby=\"headingTwo\"\r\n");
out.write("\t\t\t\tdata-parent=\"#accordionSidebar\">\r\n");
out.write("\t\t\t\t<div class=\"py-2 collapse-inner rounded\">\r\n");
out.write("\t\t\t\t\t<a class=\"collapse-item\" href=\"#\" onclick=\"goWholeList();\">전체조회</a>\r\n");
out.write("\t\t\t\t\t<a class=\"collapse-item\" href=\"#\" onclick=\"goRentList();\">대여리스트</a>\r\n");
out.write("\t\t\t\t\t<a class=\"collapse-item\" href=\"#\" onclick=\"goReturnManage();\">반납처리 </a>\r\n");
out.write("\t\t\t\t\t<a class=\"collapse-item\" href=\"#\" onclick=\"goReservClient();\">예약 회원 조회 </a>\r\n");
out.write("\t\t\t\t</div>\r\n");
out.write("\t\t\t</div>\r\n");
out.write("\t\t</li>\r\n");
out.write("\t\t\r\n");
out.write("\t\t<script>\r\n");
out.write("\t\t\tfunction goWholeList(){\r\n");
out.write("\t\t\t\tlocation.href=\"");
out.print( request.getContextPath() );
out.write("/wholeList.b.rv\";\r\n");
out.write("\t\t\t}\r\n");
out.write("\t\t\t\r\n");
out.write("\t\t\tfunction goRentList(){\r\n");
out.write("\t\t\t\tlocation.href=\"");
out.print( request.getContextPath() );
out.write("/rentList.b.rv\";\r\n");
out.write("\t\t\t}\r\n");
out.write("\t\t\t\r\n");
out.write("\t\t\tfunction goReturnManage(){\r\n");
out.write("\t\t\t\tlocation.href=\"");
out.print( request.getContextPath() );
out.write("/returnManage.b.rv\";\r\n");
out.write("\t\t\t}\r\n");
out.write("\t\t\t\r\n");
out.write("\t\t\tfunction goReservClient(){\r\n");
out.write("\t\t\t\tlocation.href=\"");
out.print( request.getContextPath() );
out.write("/reservClient.b.rv\";\r\n");
out.write("\t\t\t}\r\n");
out.write("\t\t</script>\r\n");
out.write("\r\n");
out.write("\t\t<!-- Nav Item - 고객 센터 Collapse Menu -->\r\n");
out.write("\t\t<li class=\"nav-item\">\r\n");
out.write("\t\t\t<a class=\"nav-link collapsed\" href=\"#\" data-toggle=\"collapse\" data-target=\"#collapseUtilities\"\r\n");
out.write("\t\t\t\taria-expanded=\"true\" aria-controls=\"collapseUtilities\">\r\n");
out.write("\t\t\t\t<i class=\"fas fa-fw fa-users\"></i>\r\n");
out.write("\t\t\t\t<span>고객 센터</span>\r\n");
out.write("\t\t\t</a>\r\n");
out.write("\t\t\t<div id=\"collapseUtilities\" class=\"collapse\" aria-labelledby=\"headingUtilities\" data-parent=\"#accordionSidebar\">\r\n");
out.write("\t\t\t\t<div class=\"py-2 collapse-inner rounded\">\r\n");
out.write("\t\t\t\t\t<a class=\"collapse-item\" href=\"#\" onclick=\"goNotice();\">공지사항</a>\r\n");
out.write("\t\t\t\t\t<a class=\"collapse-item\" href=\"#\" onclick=\"goEvent();\">이벤트 관리</a>\r\n");
out.write("\t\t\t\t</div>\r\n");
out.write("\t\t\t</div>\r\n");
out.write("\t\t</li>\r\n");
out.write("\t\t\r\n");
out.write("\t\t<script>\r\n");
out.write("\t\t\tfunction goNotice(){\r\n");
out.write("\t\t\t\tlocation.href=\"");
out.print(request.getContextPath());
out.write("/notice.b.no\";\r\n");
out.write("\t\t\t}\r\n");
out.write("\t\t\t\r\n");
out.write("\t\t\tfunction goEvent(){\r\n");
out.write("\t\t\t\tlocation.href=\"");
out.print(request.getContextPath());
out.write("/event.b.ev\";\r\n");
out.write("\t\t\t}\r\n");
out.write("\t\t</script>\r\n");
out.write("\r\n");
out.write("\t\t<!-- Nav Item - 차량 관리 Collapse Menu -->\r\n");
out.write("\t\t<li class=\"nav-item\">\r\n");
out.write("\t\t\t<a class=\"nav-link collapsed\" href=\"#\" data-toggle=\"collapse\" data-target=\"#collapseCar\"\r\n");
out.write("\t\t\t\taria-expanded=\"true\" aria-controls=\"collapseCar\">\r\n");
out.write("\t\t\t\t<i class=\"fas fa-fw fa-car\"></i>\r\n");
out.write("\t\t\t\t<span>차량 관리</span>\r\n");
out.write("\t\t\t</a>\r\n");
out.write("\t\t\t<div id=\"collapseCar\" class=\"collapse\" aria-labelledby=\"headingTwo\" data-parent=\"#accordionSidebar\">\r\n");
out.write("\t\t\t\t<div class=\"py-2 collapse-inner rounded\">\r\n");
out.write("\t\t\t\t\t<a class=\"collapse-item\" href=\"#\" onclick=\"goCurrentCar();\">보유 차량 </a>\r\n");
out.write("\t\t\t\t\t<a class=\"collapse-item\" href=\"#\" onclick=\"goEnrollCar();\">차량 등록 </a>\r\n");
out.write("\t\t\t\t\t<a class=\"collapse-item\" href=\"#\" onclick=\"goDeleteCar();\">차량 삭제 </a>\r\n");
out.write("\t\t\t\t</div>\r\n");
out.write("\t\t\t</div>\r\n");
out.write("\t\t</li>\r\n");
out.write("\r\n");
out.write("\t</ul>\r\n");
out.write("\t\r\n");
out.write("\t<script>\r\n");
out.write("\t\tfunction goCurrentCar(){\r\n");
out.write("\t\t\tlocation.href=\"");
out.print(request.getContextPath());
out.write("/carList.b.ci\";\r\n");
out.write("\t\t}\r\n");
out.write("\t\t\r\n");
out.write("\t\tfunction goEnrollCar(){\r\n");
out.write("\t\t\tlocation.href=\"");
out.print(request.getContextPath());
out.write("/enrollCar.b.ci\";\r\n");
out.write("\t\t}\r\n");
out.write("\t\t\r\n");
out.write("\t\tfunction goDeleteCar(){\r\n");
out.write("\t\t\tlocation.href=\"");
out.print(request.getContextPath());
out.write("/deleteCar.b.ci\";\r\n");
out.write("\t\t}\r\n");
out.write("\t</script>\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\t<!-- Logout Modal-->\r\n");
out.write("\t<div class=\"modal fade\" id=\"logoutModal\" tabindex=\"-1\" role=\"dialog\"\r\n");
out.write("\t\taria-labelledby=\"exampleModalLabel\" aria-hidden=\"true\">\r\n");
out.write("\t\t<div class=\"modal-dialog\">\r\n");
out.write("\t\t\t<div class=\"modal-content\">\r\n");
out.write("\t\t\t\t<div class=\"modal-header\">\r\n");
out.write("\t\t\t\t\t<h5 class=\"modal-title\" id=\"exampleModalLabel\">Ready to Leave?</h5>\r\n");
out.write("\t\t\t\t\t<button class=\"close\" type=\"button\" data-dismiss=\"modal\"\r\n");
out.write("\t\t\t\t\t\taria-label=\"Close\">\r\n");
out.write("\t\t\t\t\t\t<span aria-hidden=\"true\">×</span>\r\n");
out.write("\t\t\t\t\t</button>\r\n");
out.write("\t\t\t\t</div>\r\n");
out.write("\t\t\t\t<div class=\"modal-body\">Select \"Logout\" below if you are ready\r\n");
out.write("\t\t\t\t\tto end your current session.</div>\r\n");
out.write("\t\t\t\t<div class=\"modal-footer\">\r\n");
out.write("\t\t\t\t\t<button class=\"btn btn-secondary\" type=\"button\"\r\n");
out.write("\t\t\t\t\t\tdata-dismiss=\"modal\">Cancel</button>\r\n");
out.write("\t\t\t\t\t<a class=\"btn btn-primary\" href=\"login.html\">Logout</a>\r\n");
out.write("\t\t\t\t</div>\r\n");
out.write("\t\t\t</div>\r\n");
out.write("\t\t</div>\r\n");
out.write("\t</div>\r\n");
out.write("</body>\r\n");
out.write("</html>");
out.write("\r\n");
out.write("\r\n");
out.write("\t\t<!-- Content Wrapper -->\r\n");
out.write("\t\t<div id=\"content-wrapper\" class=\"d-flex flex-column\">\r\n");
out.write("\r\n");
out.write("\t\t\t<!-- Main Content -->\r\n");
out.write("\t\t\t<div id=\"content\">\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\t\t\t\t<!-- Begin Page Content -->\r\n");
out.write("\t\t\t\t<div class=\"container-fluid\">\r\n");
out.write("\r\n");
out.write("\t\t\t\t\t<!-- Content Row -->\r\n");
out.write("\t\t\t\t\t<div class=\"h-bar list-bar\">\r\n");
out.write("\r\n");
out.write("\t\t\t\t\t\t<a href=\"#\" class=\"logout-bt\" data-toggle=\"modal\" data-target=\"#logoutModal\">\r\n");
out.write("\t\t\t\t\t\t\t<i class=\"fas fa-sign-out-alt logout-icon\"> log out </i>\r\n");
out.write("\t\t\t\t\t\t</a>\r\n");
out.write("\t\t\t\t\t</div>\r\n");
out.write("\r\n");
out.write("\t\t\t\t\t<!-- DataTales Example -->\r\n");
out.write("\t\t\t\t\t<div class=\"content\">\r\n");
out.write("\t\t\t\t\t\t<div class=\"wrap-event\">\r\n");
out.write("\t\t\t\t\t\t\t<div class=\"tab-name\">\r\n");
out.write("\t\t\t\t\t\t\t\t<h1>이벤트 관리</h1>\r\n");
out.write("\t\t\t\t\t\t\t</div>\r\n");
out.write("\r\n");
out.write("\t\t\t\t\t\t\t<hr class=\"tab-divider black-divider\">\r\n");
out.write("\r\n");
out.write("\t\t\t\t\t\t\t<div class=\"tit\">\r\n");
out.write("\t\t\t\t\t\t\t\t<h4 class=\"tit-name\">");
out.print( eList.getEventTitle() );
out.write("</h4>\r\n");
out.write("\t\t\t\t\t\t\t\t<em class=\"status\">");
out.print( eList.getEventEnrollDate() );
out.write("</em>\r\n");
out.write("\t\t\t\t\t\t\t</div>\r\n");
out.write("\r\n");
out.write("\t\t\t\t\t\t\t<div class=\"list-bt m-list-bt\">\r\n");
out.write("\t\t\t\t\t\t\t\t<button class=\"list-modify-bt\" id=\"event-detail-modify-bt\" onclick=\"modifyEvent();\">수정</button>\r\n");
out.write("\t\t\t\t\t\t\t\t<a data-toggle=\"modal\" onClick=\"$('#event-delete-Modal').modal('show')\"><button class=\"list-delete-bt\" id=\"event-detail-delete-bt\">삭제</button></a>\r\n");
out.write("\t\t\t\t\t\t\t</div>\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\t\t\t\t\t\t\t<hr class=\"tab-divider\">\r\n");
out.write("\r\n");
out.write("\t\t\t\t\t\t\t<div class=\"detail-cnt\">\r\n");
out.write("\r\n");
out.write("\t\t\t\t\t\t\t\t<ul>\r\n");
out.write("\t\t\t\t\t\t\t\t\t<li>할인율 : ");
out.print( eList.getDiscountRate() );
out.write("%</li>\r\n");
out.write("\t\t\t\t\t\t\t\t\t<li>유효 기간 : ");
out.print( eList.getEventStartDate() );
out.write(' ');
out.write('~');
out.write(' ');
out.print( eList.getEventEndDate() );
out.write("</li>\r\n");
out.write("\t\t\t\t\t\t\t\t\t<br>\r\n");
out.write("\t\t\t\t\t\t\t\t</ul>\r\n");
out.write("\r\n");
out.write("\t\t\t\t\t\t\t\t");
out.print( eList.getEventContent() );
out.write("\r\n");
out.write("\r\n");
out.write("\t\t\t\t\t\t\t</div>\r\n");
out.write("\r\n");
out.write("\t\t\t\t\t\t</div>\r\n");
out.write("\t\t\t\t\t\t<!-- End of wrap-event-->\r\n");
out.write("\r\n");
out.write("\t\t\t\t\t\t<div class=\"view-list\">\r\n");
out.write("\t\t\t\t\t\t\t<table class=\"tb_col\">\r\n");
out.write("\t\t\t\t\t\t\t\t<colgroup>\r\n");
out.write("\t\t\t\t\t\t\t\t\t<col>\r\n");
out.write("\t\t\t\t\t\t\t\t\t<col>\r\n");
out.write("\t\t\t\t\t\t\t\t\t<col>\r\n");
out.write("\t\t\t\t\t\t\t\t</colgroup>\r\n");
out.write("\t\t\t\t\t\t\t\t<tbody>\r\n");
out.write("\t\t\t\t\t\t\t\t\t<tr class=\"next\">\r\n");
out.write("\t\t\t\t\t\t\t\t\t\t<td>다음</td>\r\n");
out.write("\t\t\t\t\t\t\t\t\t\t<td class=\"left\"><a href=\"");
out.print( request.getContextPath() );
out.write("/detail.b.ev?eno=");
out.print( eList.getNext() );
out.write("\">멤버십 서비스 이용 불가 안내</a></td>\r\n");
out.write("\t\t\t\t\t\t\t\t\t\t<td>2020-02-26</td>\r\n");
out.write("\t\t\t\t\t\t\t\t\t</tr>\r\n");
out.write("\t\t\t\t\t\t\t\t\t<tr class=\"current\">\r\n");
out.write("\t\t\t\t\t\t\t\t\t\t<td>-</td>\r\n");
out.write("\t\t\t\t\t\t\t\t\t\t<td class=\"left\">현대카드 시스템 점검으로 인해 서비스 중단 공지</td>\r\n");
out.write("\t\t\t\t\t\t\t\t\t\t<td>2020-02-24</td>\r\n");
out.write("\t\t\t\t\t\t\t\t\t</tr>\r\n");
out.write("\t\t\t\t\t\t\t\t\t<tr class=\"prev\">\r\n");
out.write("\t\t\t\t\t\t\t\t\t\t<td>이전</td>\r\n");
out.write("\t\t\t\t\t\t\t\t\t\t<td><a href=\"");
out.print( request.getContextPath() );
out.write("/detail.b.ev?eno=");
out.print( eList.getPrev() );
out.write("\">브라우저 시스템 점검 안내</a></td>\r\n");
out.write("\t\t\t\t\t\t\t\t\t\t<td>2020-02-18</td>\r\n");
out.write("\t\t\t\t\t\t\t\t\t</tr>\r\n");
out.write("\t\t\t\t\t\t\t\t</tbody>\r\n");
out.write("\r\n");
out.write("\t\t\t\t\t\t\t</table>\r\n");
out.write("\r\n");
out.write("\t\t\t\t\t\t\t<div class=\"btn btn-search btn-default back-list\" id=\"event-back-list\" onclick=\"backEvent();\">목록</div>\r\n");
out.write("\r\n");
out.write("\t\t\t\t\t\t</div>\r\n");
out.write("\r\n");
out.write("\t\t\t\t\t</div>\r\n");
out.write("\t\t\t\t\t<!-- /.container-fluid -->\r\n");
out.write("\r\n");
out.write("\t\t\t\t</div>\r\n");
out.write("\t\t\t\t<!-- End of Main Content -->\r\n");
out.write("\r\n");
out.write("\t\t\t</div>\r\n");
out.write("\t\t\t<!-- End of Content Wrapper -->\r\n");
out.write("\r\n");
out.write("\t\t</div>\r\n");
out.write("\t\t<!-- End of Page Wrapper -->\r\n");
out.write("\t</div>\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\t<script>\r\n");
out.write("\t \tfunction backEvent(){\r\n");
out.write("\t \t\tlocation.href=\"");
out.print( request.getContextPath() );
out.write("/event.b.ev\";\r\n");
out.write("\t \t}\r\n");
out.write("\t \t\r\n");
out.write("\t \tfunction modifyEvent(){\r\n");
out.write("\t \t\tlocation.href=\"");
out.print( request.getContextPath() );
out.write("/modifyForm.b.ev?eno=");
out.print( eList.getEventNo() );
out.write("\";\r\n");
out.write("\t \t}\r\n");
out.write("\t \t\r\n");
out.write("\t \tfunction deleteEventOne(){\r\n");
out.write("\t \t\tlocation.href=\"");
out.print( request.getContextPath() );
out.write("/deleteOne.b.ev?eno=");
out.print( eList.getEventNo() );
out.write("\";\r\n");
out.write("\t \t}\r\n");
out.write(" \t</script>\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\t<!-- event Delete Modal -->\r\n");
out.write("\t<div class=\"modal fade\" id=\"event-delete-Modal\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"exampleModalLabel\" aria-hidden=\"true\">\r\n");
out.write("\t\t<div class=\"modal-dialog\" role=\"document\">\r\n");
out.write("\t\t\t<div class=\"modal-content\">\r\n");
out.write("\t\t\t\t<div class=\"modal-header\">\r\n");
out.write("\t\t\t\t\t<button class=\"close\" type=\"button\" data-dismiss=\"modal\" aria-label=\"Close\">\r\n");
out.write("\t\t\t\t\t\t<span aria-hidden=\"true\">×</span>\r\n");
out.write("\t\t\t\t\t</button>\r\n");
out.write("\t\t\t\t</div>\r\n");
out.write("\t\t\t\t<div class=\"modal-body\">이벤트를 삭제하시겠습니까?</div>\r\n");
out.write("\t\t\t\t<div class=\"modal-footer\">\r\n");
out.write("\t\t\t\t\t<button class=\"btn btn-secondary\" type=\"button\" data-dismiss=\"modal\">Cancel</button>\r\n");
out.write("\t\t\t\t\t<a class=\"btn btn-primary\" href=\"javascript:deleteEventOne();\">삭제</a>\r\n");
out.write("\t\t\t\t</div>\r\n");
out.write("\t\t\t</div>\r\n");
out.write("\t\t</div>\r\n");
out.write("\t</div>\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("</body>\r\n");
out.write("</html>");
} catch (java.lang.Throwable t) {
if (!(t instanceof javax.servlet.jsp.SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
try {
if (response.isCommitted()) {
out.flush();
} else {
out.clearBuffer();
}
} catch (java.io.IOException e) {}
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
else throw new ServletException(t);
}
} finally {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
}
| [
"62366330+bbc719@users.noreply.github.com"
] | 62366330+bbc719@users.noreply.github.com |
6682756652b4d7d125adb80cb42ae393eb65e35b | 9a48ddd21dd978f9ed740d0d68025ce8796e4c3e | /mySite-dao/src/main/java/org/mySite/dao/App.java | ffe9e63d104be740291e657b1908980eb9950e03 | [] | no_license | liaowenhua/mySite | 7d921cc97ff0fe4ff58871d8cb19a0ae08e61495 | 0913258ca17636b1c24bc774b03e427c0f0f3a55 | refs/heads/master | 2020-03-25T08:42:45.284414 | 2018-08-13T15:18:12 | 2018-08-13T15:18:12 | 143,628,889 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 177 | java | package org.mySite.dao;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}
| [
"wb-liaowenhua@le.com"
] | wb-liaowenhua@le.com |
6ceb192f9d4a75ff2246ff4f7923ed4bb9b55c35 | 84f8491a151e4d13fe3bf74115ef3375e48fc05e | /Old Project/src/FunctionReader/src/Operations.java | 723eb90965d3c2a42269c225ffef57ba024b1aef | [] | no_license | ThibaultVandeSom/mainProject | 8bd441112f52634b58e5d5a5d9f3af02ff84b4c2 | a8e5f6b6b47b9f5883b19dd1da2e61e3d38ebd88 | refs/heads/master | 2021-05-22T16:43:54.187685 | 2020-04-04T13:36:54 | 2020-04-04T13:36:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,388 | java | public class Operations implements Something {
/*
GUIDE FOR WHOEVER HAS TO FINISH HARDCODING THIS:
-Information about things that are functions:
-If it's a function only assign it a left, don't assign both
-Functions start from operation type 7 onwards
-Operation type is more than all used to categorize the operations, just add go in increasing order for them
-For functions precedence and leftass don't matter
-Operations (AKA the Operate function):
-These should just do whatever the operation does
-So the + operation will sum the left and right, etc.
-FOR THE FUNCTIONS ONLY OPERATE THEM ON THE LEFT SOMETHING
-So f(x) = f(solve.left) <-- Visualize it like that if it makes it easier for you
-Cos is done, that should work as an example of what's expected for functions
-DOING IT WITH solve.right WILL BREAK EVERYTHING. DON'T
-https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html
-For the trigonometric it should work relatively easy, there might be some weirder implementation for some of the other functions (or we might need to specify something)
-For example, for absolute value doing it with the |x| is a pain, so just do Abs ( x ), or something like that
-For these weird guys make sure to add how you're reading them into the readme file included.
*/
/*
Use operation Type to properly define what operation is being used, a pain in the ass but fuck it.
*/
int operationType;
String operViso;
Something left;
Something right;
int precedence;
/*
trigonometric functions (weird shit) are precedence 5
Exponent is precedence 4
Multiplication and division are 3
addition and substraction are 2
() are 1
*/
boolean leftAss;
/*
If it's false, it's right associative
If it's true, it's left associative
As far as I'm aware, it's only the exponent that is true for this case
*/
boolean isFunction;
/*
So if it's a function it's true. If it's not it aint
Functions are things like cos(x), sin(), things like that.
*/
public Operations(String operType) {
/*
Something annoying to create what kind of operation type it will be
Probably a lot of annoying if else statements.
*/
this.operViso = operType;
if (operType.equals("(")){
this.operationType = 1;
this.leftAss = false;
this.precedence = 1;
this.isFunction = false;
} else if (operType.equals(")")){
this.operationType = 2;
this.precedence = 1;
this.isFunction = false;
this.leftAss = false;
} else if (operType.equals("+")){
this.operationType = 3;
this.precedence = 2;
this.leftAss = false;
this.isFunction = false;
} else if (operType.equals("-")){
this.operationType = 4;
this.precedence = 2;
this.leftAss = false;
this.isFunction = false;
} else if (operType.equals("*")){
this.operationType = 5;
this.precedence = 3;
this.leftAss = false;
this.isFunction = false;
} else if (operType.equals("/")){
this.operationType = 6;
this.precedence = 3;
this.leftAss = false;
} else if (operType.equals("^")){
this.operationType = 7;
this.precedence = 4;
this.leftAss = true;
this.isFunction = false;
} else if (operType.equals("cos")){
this.operationType = 8;
this.isFunction = true;
}
}
public boolean getIsFunction(){
return isFunction;
}
public Operations(String operType, Something aLeft, Something aRight){
this(operType);
this.left = aLeft;
this.right = aRight;
}
public int getOperationType(){
return operationType;
}
public boolean getLeftAss(){
return leftAss;
}
public int getPrecedence(){
return precedence;
}
public void setLeft(Something aThing){
this.left = aThing;
}
public void setRight(Something aThing){
this.right = aThing;
}
public double solve() {
return Operate(left, right);
}
public double Operate(Something left, Something right){
/*
This is where the eternally long if else loop would be used in order to process the type of operator that's being used.
*/
/*
The gist of operate is that it's going to do the relevant operation for what's on the left and what's on the right
*/
if (this.operationType == 3){
return left.solve() + right.solve();
} else if (this.operationType == 4){
return left.solve() - right.solve();
} else if (this.operationType == 5){
return left.solve()*right.solve();
} else if (this.operationType == 7){
return Math.pow(left.solve(), right.solve());
} else if (this.operationType == 8){
return Math.cos(left.solve());
}
return 0;
}
public String toString(){
return operViso;
}
} | [
"nicolasarturopz@gmail.com"
] | nicolasarturopz@gmail.com |
d687c313e3f37fcca5501c91ea145ceb9be08c95 | 33e1da53d56cecb7f9a81e508ef0baa98a67a654 | /aliyun-java-sdk-market/src/main/java/com/aliyuncs/market/model/v20151101/CreateRateRequest.java | 1e61042c0435ceee368124168600944633e1c8ce | [
"Apache-2.0"
] | permissive | atptro/aliyun-openapi-java-sdk | ad91f2bd221baa742b5de970e4639a4a129fe692 | 4be810bae7156b0386b29d47bef3878a08fa6ad2 | refs/heads/master | 2020-06-14T11:57:46.313857 | 2019-07-03T05:57:50 | 2019-07-03T05:57:50 | 164,553,262 | 0 | 0 | NOASSERTION | 2019-01-08T04:44:56 | 2019-01-08T03:39:41 | Java | UTF-8 | Java | false | false | 1,890 | java | /*
* 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.aliyuncs.market.model.v20151101;
import com.aliyuncs.RpcAcsRequest;
/**
* @author auto create
* @version
*/
public class CreateRateRequest extends RpcAcsRequest<CreateRateResponse> {
public CreateRateRequest() {
super("Market", "2015-11-01", "CreateRate");
}
private String score;
private String orderId;
private String requestId;
private String content;
public String getScore() {
return this.score;
}
public void setScore(String score) {
this.score = score;
if(score != null){
putQueryParameter("Score", score);
}
}
public String getOrderId() {
return this.orderId;
}
public void setOrderId(String orderId) {
this.orderId = orderId;
if(orderId != null){
putQueryParameter("OrderId", orderId);
}
}
public String getRequestId() {
return this.requestId;
}
public void setRequestId(String requestId) {
this.requestId = requestId;
if(requestId != null){
putQueryParameter("RequestId", requestId);
}
}
public String getContent() {
return this.content;
}
public void setContent(String content) {
this.content = content;
if(content != null){
putQueryParameter("Content", content);
}
}
@Override
public Class<CreateRateResponse> getResponseClass() {
return CreateRateResponse.class;
}
}
| [
"sdk-team@alibabacloud.com"
] | sdk-team@alibabacloud.com |
d625f18ad07367fc7f030ec9b1e501ac4cc9cab4 | 42ba0062b66e14e3dd314d64ec6b1856d750ff13 | /clients/java/src/org/httpmock/Stubber.java | abdd28a5ae71cd297753062d23794af93f30fbf5 | [
"MIT"
] | permissive | bbyars/httpmock | a5bf37ad8b21765dbf24e24b217ae0f27f013ed2 | f5fa18dd6444febba16172557bb81cbbd5ceb793 | refs/heads/master | 2021-01-10T18:34:55.817425 | 2011-06-13T03:11:22 | 2011-06-13T03:11:22 | 1,019,008 | 12 | 1 | null | 2012-06-23T18:12:41 | 2010-10-24T04:05:54 | JavaScript | UTF-8 | Java | false | false | 727 | java | package org.httpmock;
public class Stubber {
private final HttpMock httpMock;
private final String urlToSetStub;
private final String urlToStub;
private String requestMethod;
public Stubber(HttpMock httpMock, String urlToSetStub, String urlToStub) {
this.httpMock = httpMock;
this.urlToSetStub = urlToSetStub;
this.urlToStub = urlToStub;
}
public void setRequestMethod(String requestMethod) {
this.requestMethod = requestMethod;
}
public void returns(Stub stub) {
stub.withRequestMethod(requestMethod).withPath(urlToStub);
HttpResponse response = httpMock.post(urlToSetStub, stub.getJSON());
response.assertStatusIs(204);
}
}
| [
"brandon.byars@gmail.com"
] | brandon.byars@gmail.com |
f376eec43730a55bec8e27eb870882a66387dcd1 | b1ec13f18d4cec98bde3006044fa9c83bb568846 | /personcatch/build/generated/not_namespaced_r_class_sources/debug/generateDebugRFile/out/android/support/graphics/drawable/R.java | 7bb076197d7a4236ec6f4654f2a220d314673497 | [] | no_license | fangligen/mirrorlauncher | 23d5a364a517a4a99385bfee9d26d5dc42318504 | b3d9cc37a70af321f57adc56391960eb0c57592d | refs/heads/master | 2020-07-16T16:36:10.404445 | 2019-09-02T09:43:03 | 2019-09-02T09:43:03 | 205,825,276 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 7,655 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* gradle plugin from the resource data it found. It
* should not be modified by hand.
*/
package android.support.graphics.drawable;
public final class R {
private R() {}
public static final class attr {
private attr() {}
public static int font = 0x7f040072;
public static int fontProviderAuthority = 0x7f040074;
public static int fontProviderCerts = 0x7f040075;
public static int fontProviderFetchStrategy = 0x7f040076;
public static int fontProviderFetchTimeout = 0x7f040077;
public static int fontProviderPackage = 0x7f040078;
public static int fontProviderQuery = 0x7f040079;
public static int fontStyle = 0x7f04007a;
public static int fontWeight = 0x7f04007b;
}
public static final class bool {
private bool() {}
public static int abc_action_bar_embed_tabs = 0x7f050001;
}
public static final class color {
private color() {}
public static int notification_action_color_filter = 0x7f06003c;
public static int notification_icon_bg_color = 0x7f06003d;
public static int ripple_material_light = 0x7f060047;
public static int secondary_text_default_material_light = 0x7f060049;
}
public static final class dimen {
private dimen() {}
public static int compat_button_inset_horizontal_material = 0x7f08004c;
public static int compat_button_inset_vertical_material = 0x7f08004d;
public static int compat_button_padding_horizontal_material = 0x7f08004e;
public static int compat_button_padding_vertical_material = 0x7f08004f;
public static int compat_control_corner_material = 0x7f080050;
public static int notification_action_icon_size = 0x7f08005a;
public static int notification_action_text_size = 0x7f08005b;
public static int notification_big_circle_margin = 0x7f08005c;
public static int notification_content_margin_start = 0x7f08005d;
public static int notification_large_icon_height = 0x7f08005e;
public static int notification_large_icon_width = 0x7f08005f;
public static int notification_main_column_padding_top = 0x7f080060;
public static int notification_media_narrow_margin = 0x7f080061;
public static int notification_right_icon_size = 0x7f080062;
public static int notification_right_side_padding_top = 0x7f080063;
public static int notification_small_icon_background_padding = 0x7f080064;
public static int notification_small_icon_size_as_large = 0x7f080065;
public static int notification_subtext_size = 0x7f080066;
public static int notification_top_pad = 0x7f080067;
public static int notification_top_pad_large_text = 0x7f080068;
}
public static final class drawable {
private drawable() {}
public static int notification_action_background = 0x7f090054;
public static int notification_bg = 0x7f090055;
public static int notification_bg_low = 0x7f090056;
public static int notification_bg_low_normal = 0x7f090057;
public static int notification_bg_low_pressed = 0x7f090058;
public static int notification_bg_normal = 0x7f090059;
public static int notification_bg_normal_pressed = 0x7f09005a;
public static int notification_icon_background = 0x7f09005b;
public static int notification_template_icon_bg = 0x7f09005c;
public static int notification_template_icon_low_bg = 0x7f09005d;
public static int notification_tile_bg = 0x7f09005e;
public static int notify_panel_notification_icon_bg = 0x7f09005f;
}
public static final class id {
private id() {}
public static int action_container = 0x7f0c0008;
public static int action_divider = 0x7f0c000a;
public static int action_image = 0x7f0c000b;
public static int action_text = 0x7f0c0011;
public static int actions = 0x7f0c0012;
public static int async = 0x7f0c0016;
public static int blocking = 0x7f0c0017;
public static int chronometer = 0x7f0c001b;
public static int forever = 0x7f0c0025;
public static int icon = 0x7f0c0027;
public static int icon_group = 0x7f0c0028;
public static int info = 0x7f0c002a;
public static int italic = 0x7f0c002b;
public static int line1 = 0x7f0c002d;
public static int line3 = 0x7f0c002e;
public static int normal = 0x7f0c0034;
public static int notification_background = 0x7f0c0035;
public static int notification_main_column = 0x7f0c0036;
public static int notification_main_column_container = 0x7f0c0037;
public static int right_icon = 0x7f0c003d;
public static int right_side = 0x7f0c003e;
public static int tag_transition_group = 0x7f0c0058;
public static int text = 0x7f0c0059;
public static int text2 = 0x7f0c005a;
public static int time = 0x7f0c005d;
public static int title = 0x7f0c005e;
}
public static final class integer {
private integer() {}
public static int status_bar_notification_info_maxnum = 0x7f0d0005;
}
public static final class layout {
private layout() {}
public static int notification_action = 0x7f0f001c;
public static int notification_action_tombstone = 0x7f0f001d;
public static int notification_template_custom_big = 0x7f0f001e;
public static int notification_template_icon_group = 0x7f0f001f;
public static int notification_template_part_chronometer = 0x7f0f0020;
public static int notification_template_part_time = 0x7f0f0021;
}
public static final class string {
private string() {}
public static int status_bar_notification_info_overflow = 0x7f150020;
}
public static final class style {
private style() {}
public static int TextAppearance_Compat_Notification = 0x7f1600e7;
public static int TextAppearance_Compat_Notification_Info = 0x7f1600e8;
public static int TextAppearance_Compat_Notification_Line2 = 0x7f1600e9;
public static int TextAppearance_Compat_Notification_Time = 0x7f1600ea;
public static int TextAppearance_Compat_Notification_Title = 0x7f1600eb;
public static int Widget_Compat_NotificationActionContainer = 0x7f160153;
public static int Widget_Compat_NotificationActionText = 0x7f160154;
}
public static final class styleable {
private styleable() {}
public static int[] FontFamily = { 0x7f040074, 0x7f040075, 0x7f040076, 0x7f040077, 0x7f040078, 0x7f040079 };
public static int FontFamily_fontProviderAuthority = 0;
public static int FontFamily_fontProviderCerts = 1;
public static int FontFamily_fontProviderFetchStrategy = 2;
public static int FontFamily_fontProviderFetchTimeout = 3;
public static int FontFamily_fontProviderPackage = 4;
public static int FontFamily_fontProviderQuery = 5;
public static int[] FontFamilyFont = { 0x1010532, 0x101053f, 0x1010533, 0x7f040072, 0x7f04007a, 0x7f04007b };
public static int FontFamilyFont_android_font = 0;
public static int FontFamilyFont_android_fontStyle = 1;
public static int FontFamilyFont_android_fontWeight = 2;
public static int FontFamilyFont_font = 3;
public static int FontFamilyFont_fontStyle = 4;
public static int FontFamilyFont_fontWeight = 5;
}
}
| [
"fangligen@shouqiev.com"
] | fangligen@shouqiev.com |
938b5ccdeae11fd40387b583166d7dfc152bee82 | 97baaa9cc7b9143ec2c405d5e59f6b793ba81575 | /src/com/lucasalvessm/composite/Structure.java | f07be904480d3c6e2e4d52927a619e4851936c4a | [] | no_license | lucasalvessm/java-design-pattern | 6c080ad4d6d605fb4a8287f8bcd653faf60e1107 | d4a9a3f3f79c9c5961e5d1646cd9b5c77491f085 | refs/heads/master | 2023-01-03T05:39:45.645108 | 2020-10-22T00:32:58 | 2020-10-22T00:32:58 | 306,179,967 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 149 | java | package com.lucasalvessm.composite;
public interface Structure {
void enter();
void exit();
void location();
String getName();
}
| [
"lucasalvessm@outlook.com"
] | lucasalvessm@outlook.com |
88fc3ec9a0ef1a35be41c6eae5c409bf43ac5b4a | 2d61cb0ced8492e49fe52514be25a5f771831c32 | /src/star/CloudThree.java | 3e3fc028ac6a5c46ff652195ff9e4bef9b7d6aa8 | [] | no_license | BeverlyLi/BananaWars | f11800234f7a76290cc16690ef0dd2a4255e6676 | d241d82f8bcc6c379a5c686be372684118096c90 | refs/heads/master | 2020-03-14T09:37:36.727998 | 2018-04-30T06:16:17 | 2018-04-30T06:16:17 | 131,548,613 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 266 | java | package star;
public class CloudThree extends Sprite {
public CloudThree(int x, int y) {
super(x, y);
init();
}
private void init() {
loadImage("Cloud3.png");
}
public void move() {
x -= 1;
if (x < -150) {
x = 500;
}
}
}
| [
"bel058@ucsd.edu"
] | bel058@ucsd.edu |
f229d787709a216f18af7c394e99d60bb4e35242 | 6e41615e6f4850cf891e52c2710aeeee0704e9ca | /src/main/java/br/ucb/prevejo/previsao/operacao/veiculo/VeiculoInstanteSerializer.java | 52fc07167d1eab470fbbc41a5f13d8890caf115d | [] | no_license | prevejo/appservice | 2d0150fcb22639011a583ea217df41f8c0c6befb | 5d11a0e623ad6b1fe0ec1213d49d67d87b9ecae4 | refs/heads/master | 2021-06-22T01:55:39.828402 | 2020-09-03T16:58:33 | 2020-09-03T16:58:33 | 226,908,051 | 0 | 0 | null | 2021-06-04T02:21:44 | 2019-12-09T15:47:12 | Java | UTF-8 | Java | false | false | 899 | java | package br.ucb.prevejo.previsao.operacao.veiculo;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import java.io.IOException;
import java.util.Arrays;
import java.util.stream.Collectors;
public class VeiculoInstanteSerializer extends StdSerializer<VeiculoInstante> {
public VeiculoInstanteSerializer() {
super(VeiculoInstante.class);
}
@Override
public void serialize(VeiculoInstante veiculoInstante, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
jsonGenerator.writeStartObject();
jsonGenerator.writeObjectField("veiculo", veiculoInstante.getInstante());
jsonGenerator.writeObjectField("historico", veiculoInstante.getHistorico());
jsonGenerator.writeEndObject();
}
}
| [
"universo42.01@gmail.com"
] | universo42.01@gmail.com |
e29f42b5e0e0e619439c88fad153475ebec43fea | fdf8f907f7d413489e00caac03686c803b3dafd0 | /Observer/Follower.java | c53f9ced13193bc84b8e00f5cbbfdb715e3b9643 | [] | no_license | sirget/Software-Architecture | 86107ec388d109e19eefe06fc24309d81e55461d | 4d9e870dbfcd809a6ee685072cbee1b9e3077e3c | refs/heads/main | 2023-01-10T20:37:58.448947 | 2020-11-14T11:13:50 | 2020-11-14T11:13:50 | 312,800,607 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 595 | java | public class Follower implements Observer {
private String followerName;
public Follower(String followerName) {
this.followerName = followerName;
}
public String getFollowerName() {
return followerName;
}
public void setFollowerName(String followerName) {
this.followerName = followerName;
}
public void update(String status) {
// ส่งข้อความให้ผู้ติดตามว่าเรากำลังไลฟ์อยู่
}
public void play() {
// เล่น channel
}
}
| [
"37872290+sirget@users.noreply.github.com"
] | 37872290+sirget@users.noreply.github.com |
d26fcfd0c4c116aa6b19e46316b1877570d1382c | f553655f5e7b53be71945ba3e73a71ece80e72cf | /src/cmdb/com/h3c/iclouds/po/Master2Router.java | 21f18477f912d567760085e66cd9daeb41bd66b5 | [] | no_license | 873191303/iclouds | 20d09602a30b715f8fade90ea74dd8e755cf9a1e | acd5599c1835db43cdeeb9547c5fc4922b414a30 | refs/heads/master | 2020-07-13T00:16:12.935201 | 2019-08-28T17:54:46 | 2019-08-28T17:54:46 | 204,940,519 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,690 | java | package com.h3c.iclouds.po;
import com.h3c.iclouds.base.BaseEntity;
import com.wordnik.swagger.annotations.ApiModel;
import com.wordnik.swagger.annotations.ApiModelProperty;
import org.hibernate.validator.constraints.Length;
@ApiModel(value = "资产设备-路由器配置", description = "资产设备-路由器配置")
public class Master2Router extends BaseEntity implements java.io.Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "id")
private String id;
@Length(max = 50)
@ApiModelProperty(value = "CPU")
private String cpu;
@Length(max = 50)
@ApiModelProperty(value = "内存")
private String ram;
@Length(max = 50)
@ApiModelProperty(value = "IPv4转发率")
private String ipv4RRate;
@Length(max = 50)
@ApiModelProperty(value = "IPv6转发率")
private String ipv6RRate;
@Length(max = 50)
@ApiModelProperty(value = "主控版槽位数")
private String mpuSlots;
@Length(max = 50)
@ApiModelProperty(value = "业务板槽位数")
private String baseSlots;
@Length(max = 50)
@ApiModelProperty(value = "交换容量")
private String swCapacity;
@Length(max = 50)
@ApiModelProperty(value = "包转发率")
private String pacRate;
@Length(max = 600)
@ApiModelProperty(value = "备注")
private String remark;
public Master2Router() {
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getCpu() {
return cpu;
}
public void setCpu(String cpu) {
this.cpu = cpu;
}
public String getRam() {
return ram;
}
public void setRam(String ram) {
this.ram = ram;
}
public String getIpv4RRate() {
return ipv4RRate;
}
public void setIpv4RRate(String ipv4rRate) {
ipv4RRate = ipv4rRate;
}
public String getIpv6RRate() {
return ipv6RRate;
}
public void setIpv6RRate(String ipv6rRate) {
ipv6RRate = ipv6rRate;
}
public String getMpuSlots() {
return mpuSlots;
}
public void setMpuSlots(String mpuSlots) {
this.mpuSlots = mpuSlots;
}
public String getBaseSlots() {
return baseSlots;
}
public void setBaseSlots(String baseSlots) {
this.baseSlots = baseSlots;
}
public String getSwCapacity() {
return swCapacity;
}
public void setSwCapacity(String swCapacity) {
this.swCapacity = swCapacity;
}
public String getPacRate() {
return pacRate;
}
public void setPacRate(String pacRate) {
this.pacRate = pacRate;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
}
| [
"xingguo@windows10.microdone.cn"
] | xingguo@windows10.microdone.cn |
dda110a694e96dbae4bb249612332139aa55a25e | 1c12b5b8d190b8cc26f8ed58d150c344511c097f | /Demo/build/generated/source/buildConfig/debug/demo/com/BuildConfig.java | cf743de6c5119767d601ec7f7c6e11206a2af7b0 | [] | no_license | AilsaLT/SecondhandDemo | 52de1bb73b312010ab7e9928dfd72471d962ad11 | 6baa773603de69c48756c1af20795c586cc76f53 | refs/heads/master | 2020-06-01T18:29:30.999001 | 2019-09-16T14:19:23 | 2019-09-16T14:19:23 | 190,883,539 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 427 | java | /**
* Automatically generated file. DO NOT MODIFY
*/
package demo.com;
public final class BuildConfig {
public static final boolean DEBUG = Boolean.parseBoolean("true");
public static final String APPLICATION_ID = "demo.com";
public static final String BUILD_TYPE = "debug";
public static final String FLAVOR = "";
public static final int VERSION_CODE = 317;
public static final String VERSION_NAME = "3.1.7";
}
| [
"2926509946@qq.com"
] | 2926509946@qq.com |
e9e1f62a5c7dc871183a665371845778cfde8376 | c7622061d8534e90f878e40dc7c8338b7bea6c27 | /src/main/java/com/han/test/springboot_test3/wang/rabbitmq/ConsumerThreadHan.java | b0af6f215c3ef504d6a578c07ad81bfb396c67d9 | [] | no_license | hanyueqian2/springboot_test3 | 88fde880aed242f4634d9c1305bc5a11b5d63d5f | c8802b96b2895f9a556307e75cbd794f575095f8 | refs/heads/master | 2022-12-21T02:01:00.600909 | 2020-08-25T09:45:01 | 2020-08-25T09:45:01 | 157,957,771 | 0 | 0 | null | 2022-12-13T19:29:36 | 2018-11-17T06:34:28 | Java | UTF-8 | Java | false | false | 6,877 | java | package com.han.test.springboot_test3.wang.rabbitmq;
import com.rabbitmq.client.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.TimeoutException;
public class ConsumerThreadHan implements Runnable {
private static Logger logger = LoggerFactory.getLogger(ConsumerThreadHan.class);
private Channel channel;
private static final String QUEUE_NAME = "agv_pod_queue3";
private static final String EXCHANGE_NAME = "iwcs_exchange_A";
/**
* TODO 存放一个大对象
*/
private List<String> bigList = new ArrayList<>();
private Object lock = new Object();
public ConsumerThreadHan() {
}
@Override
public void run() {
while (true){
try {
logger.info("Thread started.");
listenMsg();
myListenMsg();
synchronized (lock) {
lock.wait();
}
logger.info("Thread exited.");
break;
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
private void myListenMsg() {
String queueName = "task_log_queue";
Connection connection = ConnectionUtil.getNewConnection();
Channel channel;
try {
channel = connection.createChannel();
String queue = channel.queueDeclare(queueName, false, false, true, null).getQueue();
logger.debug("建立消息队列成功:" + queue);
channel.queueBind(queue, "iwcs_exchange_A", "agv.task.taskLog");
logger.debug("交换机与消息队列绑定成功:" + queue);
//每次仅处理一条消息
channel.basicQos(1);
Consumer consumer = new DefaultConsumer(channel) {
@Override
public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException {
String message = new String(body, "UTF-8");
logger.info("队列名称:{} routeKey:{} 信息:{}", queueName, envelope.getRoutingKey() , message);
//调用消费者活动
// consumerAction.action(new ConsumerActionInfo(message, queueName));
System.out.println("消息日志:" + message);
try {
Thread.sleep(20);
} catch (InterruptedException e) {
e.printStackTrace();
}
channel.basicAck(envelope.getDeliveryTag(), false);
//返回确认状态
if (!queueName.contains("_")) {
return;
}
//获取子任务单号
String subTaskNum = queueName.split("_")[1];
//当队列消息含有结束标识,并且含有启动这个子任务的子任务号时,则认为这个子任务已经执行完了,可以关闭这个消息队列了
if (message.contains("OK") && message.contains(subTaskNum)){
logger.info("{}队列的连接将被关闭: {}, routeKey:{}", queueName, consumerTag, envelope.getRoutingKey());
channel.basicCancel(consumerTag);
try {
channel.close();
} catch (TimeoutException e) {
e.printStackTrace();
}
synchronized (lock) {
lock.notifyAll();
}
}
}
};
//false是取消自动应答机制,开启手动应答机制
boolean autoAck = false;
String consumerTag = channel.basicConsume(queueName, autoAck, consumer);
logger.info("Consume with tag: {}", consumerTag);
} catch (IOException e) {
e.printStackTrace();
}
}
private void listenMsg(){
Connection connection = ConnectionUtil.getNewConnection();
try {
Channel channel = connection.createChannel();
try {
boolean durable = true;
boolean autoDelete = false;
channel.exchangeDeclare(EXCHANGE_NAME, BuiltinExchangeType.TOPIC, durable, autoDelete, null);
// boolean durable, boolean exclusive, boolean autoDelete,
String queueName = channel.queueDeclare(QUEUE_NAME + UUID.randomUUID().toString().substring(0,6), false, false, true, null).getQueue();
String routeKey = "agv.test.test1";
channel.queueBind(queueName, EXCHANGE_NAME, routeKey);
channel.basicQos(1);
Consumer tConsumer = new DefaultConsumer(channel) {
@Override
public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException {
String message = new String(body, "UTF-8");
channel.basicAck(envelope.getDeliveryTag(), false);
System.out.println("ReceiveLogsTopic1 [" + queueName + "] Received '" + envelope.getRoutingKey() + "':'" + message + "'");
try {
Thread.sleep(20);
} catch (InterruptedException e) {
e.printStackTrace();
}
if (message.contains("StopMe")){
channel.basicCancel(consumerTag);
try {
channel.close();
// connection.close();
} catch (TimeoutException e) {
e.printStackTrace();
}
synchronized (lock) {
lock.notifyAll();
}
}
}
};
String consumerTag = channel.basicConsume(queueName, false, tConsumer);
logger.info("Consume with tag: {}", consumerTag);
} catch (IOException e) {
e.printStackTrace();
}
} catch (IOException e) {
e.printStackTrace();
}
}
public static void main(String [] args){
for (int i = 0; i < 1; i++) {
// TODO 给线程起个名
Thread t = new Thread(new ConsumerThreadHan() , "线程" + (i + 1));
t.start();
}
}
}
| [
"hanyueqian@wisdom56.com"
] | hanyueqian@wisdom56.com |
ae232b392517db71693889c16bab915b6fbbdd8f | e41d380dcbd66ae386358a8bc873e0d523e0bd36 | /src/main/java/com/iamgpj/begin/module/admin/auth/dao/RoleDAO.java | 13b86c70cb10703ca9babe18eb206cbe0b5e6782 | [] | no_license | heibais/begin | b9930e236b7adfdfd6c7aac6017c2ff5b3cd83f6 | 0e04aeabc13c90168019cdf86fe4a81e22daa07b | refs/heads/master | 2020-03-19T18:47:32.210470 | 2018-07-16T15:56:06 | 2018-07-16T15:56:06 | 119,272,368 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 312 | java | package com.iamgpj.begin.module.admin.auth.dao;
import com.iamgpj.begin.core.biz.mybatisPlus.SuperMapper;
import com.iamgpj.begin.module.admin.auth.entity.Role;
/**
* @author: GPJ
* @Description:
* @Date Created in 15:42 2018/2/6
* @Modified By:
*/
public interface RoleDAO extends SuperMapper<Role> {
}
| [
"iamgpj@163.com"
] | iamgpj@163.com |
ee66f7143ee2be3b79bc1122db8f32dc25f4c0b0 | 60c4b9a6daadc1d387c29f8bf92790e972b4db5a | /src/main/java/com/weddingplanner/server/model/BusinessOwner.java | a29e600be7aad4da436886dd40900ddc8ea4cc27 | [] | no_license | avishkajayasundara/Wedding-Elements | ac8d1fa7e3e03b985a0bbf381e1071aad84734fc | 2f2dfba90a13259c444e860be882d0891d1b8d71 | refs/heads/master | 2023-02-12T00:20:06.069357 | 2021-01-01T10:11:27 | 2021-01-01T10:11:27 | 297,853,102 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,918 | java | package com.weddingplanner.server.model;
import com.sun.istack.NotNull;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
@Entity
public class BusinessOwner extends SystemUser {
@NotBlank(message = "The name should not be blank or null")
private String name;
@NotNull
private String businessType;
@Size(max=1000,message = "The description is too long")
@Column(length = 500)
private String description;
private String country;
public BusinessOwner(String email, String password, String address, String contactNo, String userRole, String status, String name, String businessType, String description, String country) {
super(email, password, address, contactNo, userRole, status);
this.name = name;
this.businessType = businessType;
this.description = description;
this.country = country;
}
public BusinessOwner(String name, String businessType, String description, String country) {
this.name = name;
this.businessType = businessType;
this.description = description;
this.country = country;
}
public BusinessOwner() {
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getBusinessType() {
return businessType;
}
public void setBusinessType(String businessType) {
this.businessType = businessType;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
} | [
"avishkaaj@live.com"
] | avishkaaj@live.com |
7bdf0620ce75efad0ff43233906d5094428d4018 | 8eef8865b38625c6359fc6916ba285cd83b88637 | /hrms/src/main/java/kodlamaio/hrms/core/utilities/results/Result.java | 8a22b503461cfa8b56e8d29df41fd44644ee5365 | [] | no_license | pltnsl/hrms | a1592da421495c156f479d291a0e17dfbb6971f7 | 10d5c3da9c488f15f640b77516dc5220d6e7c620 | refs/heads/master | 2023-05-14T14:08:16.601697 | 2021-05-30T00:18:27 | 2021-05-30T00:18:27 | 366,113,199 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 409 | java | package kodlamaio.hrms.core.utilities.results;
public class Result {
private boolean success;
private String message;
public Result(boolean success) {
this.success= success;
}
public Result(boolean success, String message) {
this(success);
this.message= message;
}
public boolean isSuccess() {
return this.success;
}
public String getMessage() {
return this.message;
}
}
| [
"pulat_neslihan@hotmail.com"
] | pulat_neslihan@hotmail.com |
e3e1ad1b6969f3437b9b4353e10f535e1fefa16d | f47b193233a4f4d2094505cfcb15823ea47d6bfa | /dubbo-demo/dubbo-provider/src/main/java/com/testcomp/dao/IUserDao.java | 91e66908e79b18af3f2235f767abc53e447b917f | [] | no_license | benany307260/dubbo-demo | 752ec28bf32e893aa7e347ab38f12b890bd1aa2b | 0aea85213d88324e4c3bb51663d81346ebce1875 | refs/heads/master | 2020-03-19T18:48:20.116134 | 2018-07-23T13:03:03 | 2018-07-23T13:03:03 | 136,825,682 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 199 | java | package com.testcomp.dao;
import org.springframework.data.jpa.repository.JpaRepository;
import com.testcomp.entity.User;
public interface IUserDao extends JpaRepository<User, Long> {
}
| [
"307260621@qq.com"
] | 307260621@qq.com |
aac4c9d0b075057a1d1224d2afb0a1f05c975374 | 5707e99df2fbbda2b036298c3c19e0bc9dcfeeec | /app/src/main/java/com/brok/patapata/ReportFragment.java | d5180092be9399ad1365f7fe141f1fc9392f5b69 | [] | no_license | Steven-Nyaga/AndroidProject2 | 27cf824af00d8c366446745de1f80187360ae26f | d68b38dcf31cce7fdd0be2e94f06dada95218def | refs/heads/master | 2020-06-16T15:11:18.327714 | 2019-07-09T10:55:52 | 2019-07-09T10:55:52 | 195,619,539 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,201 | java | package com.brok.patapata;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import com.firebase.ui.database.FirebaseRecyclerAdapter;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import java.util.ArrayList;
public class ReportFragment extends Fragment {
private RecyclerView recyclerView;
ArrayList<user_reports> list;
report_adapter adapter;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_report, container, false);
}
public void onViewCreated(View view, Bundle savedInstanceState) {
recyclerView = (RecyclerView) getView().findViewById(R.id.reportrecyler);
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
list = new ArrayList<user_reports>();
FirebaseDatabase.getInstance().getReference("users").child(FirebaseAuth.
getInstance().getCurrentUser().getUid()).child("reports").addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
for (DataSnapshot dataSnapshot1: dataSnapshot.getChildren()){
String r = dataSnapshot1.getValue(String.class);
user_reports rep = new user_reports(r);
// user_reports r = dataSnapshot1.getValue(user_reports.class);
list.add(rep);
}
adapter = new report_adapter(getActivity(),list );
recyclerView.setAdapter(adapter);
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
Toast.makeText(getActivity(), "Failed", Toast.LENGTH_LONG).show();
}
});
}
} | [
"steven.nyaga@strathmore.edu"
] | steven.nyaga@strathmore.edu |
d49b31618f21dc00354678f03e6c5cef8d2a6f71 | d4eef7f3fb6defc21a867492607745f5ef552057 | /willhoo-utils/src/main/java/cn/willhoo/ssh_bos/utils/pinyin4j/PinYin4jUtils.java | 3ec6b282981eed87d97622a513ad20e39d0ab3b7 | [] | no_license | xiaoding18/studies | c5cad216f1b6cfe905a680f07bddf7db6d3a2fac | e958122860978ab69576f2ad059158a1e5d3b204 | refs/heads/master | 2020-03-18T08:12:37.881008 | 2018-05-23T03:46:55 | 2018-05-23T03:46:55 | 134,496,523 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,244 | java | package cn.willhoo.ssh_bos.utils.pinyin4j;
import java.util.Arrays;
import net.sourceforge.pinyin4j.PinyinHelper;
import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType;
import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;
public class PinYin4jUtils {
/**
* 将字符串转换成拼音数组
*
* @param src
* @return
*/
public static String[] stringToPinyin(String src) {
return stringToPinyin(src, false, null);
}
/**
* 将字符串转换成拼音数组
*
* @param src
* @return
*/
public static String[] stringToPinyin(String src, String separator) {
return stringToPinyin(src, true, separator);
}
/**
* 将字符串转换成拼音数组
*
* @param src
* @param isPolyphone
* 是否查出多音字的所有拼音
* @param separator
* 多音字拼音之间的分隔符
* @return
*/
public static String[] stringToPinyin(String src, boolean isPolyphone,
String separator) {
// 判断字符串是否为空
if ("".equals(src) || null == src) {
return null;
}
char[] srcChar = src.toCharArray();
int srcCount = srcChar.length;
String[] srcStr = new String[srcCount];
for (int i = 0; i < srcCount; i++) {
srcStr[i] = charToPinyin(srcChar[i], isPolyphone, separator);
}
return srcStr;
}
/**
* 将单个字符转换成拼音
*
* @param src
* @return
*/
public static String charToPinyin(char src, boolean isPolyphone,
String separator) {
// 创建汉语拼音处理类
HanyuPinyinOutputFormat defaultFormat = new HanyuPinyinOutputFormat();
// 输出设置,大小写,音标方式
defaultFormat.setCaseType(HanyuPinyinCaseType.LOWERCASE);
defaultFormat.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
StringBuffer tempPinying = new StringBuffer();
// 如果是中文
if (src > 128) {
try {
// 转换得出结果
String[] strs = PinyinHelper.toHanyuPinyinStringArray(src,
defaultFormat);
// 是否查出多音字,默认是查出多音字的第一个字符
if (isPolyphone && null != separator) {
for (int i = 0; i < strs.length; i++) {
tempPinying.append(strs[i]);
if (strs.length != (i + 1)) {
// 多音字之间用特殊符号间隔起来
tempPinying.append(separator);
}
}
} else {
tempPinying.append(strs[0]);
}
} catch (BadHanyuPinyinOutputFormatCombination e) {
e.printStackTrace();
}
} else {
tempPinying.append(src);
}
return tempPinying.toString();
}
public static String hanziToPinyin(String hanzi) {
return hanziToPinyin(hanzi, " ");
}
/**
* 将汉字转换成拼音
*
* @param hanzi
* @param separator
* @return
*/
public static String hanziToPinyin(String hanzi, String separator) {
// 创建汉语拼音处理类
HanyuPinyinOutputFormat defaultFormat = new HanyuPinyinOutputFormat();
// 输出设置,大小写,音标方式
defaultFormat.setCaseType(HanyuPinyinCaseType.LOWERCASE);
defaultFormat.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
String pinyingStr = "";
try {
pinyingStr = PinyinHelper.toHanyuPinyinString(hanzi, defaultFormat,
separator);
} catch (BadHanyuPinyinOutputFormatCombination e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return pinyingStr;
}
/**
* 将字符串数组转换成字符串
*
* @param str
* @param separator
* 各个字符串之间的分隔符
* @return
*/
public static String stringArrayToString(String[] str, String separator) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < str.length; i++) {
sb.append(str[i]);
if (str.length != (i + 1)) {
sb.append(separator);
}
}
return sb.toString();
}
/**
* 简单的将各个字符数组之间连接起来
*
* @param str
* @return
*/
public static String stringArrayToString(String[] str) {
return stringArrayToString(str, "");
}
/**
* 将字符数组转换成字符串
*
* @param str
* @param separator
* 各个字符串之间的分隔符
* @return
*/
public static String charArrayToString(char[] ch, String separator) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < ch.length; i++) {
sb.append(ch[i]);
if (ch.length != (i + 1)) {
sb.append(separator);
}
}
return sb.toString();
}
/**
* 将字符数组转换成字符串
*
* @param str
* @return
*/
public static String charArrayToString(char[] ch) {
return charArrayToString(ch, " ");
}
/**
* 取汉字的首字母
*
* @param src
* @param isCapital
* 是否是大写
* @return
*/
public static char[] getHeadByChar(char src, boolean isCapital) {
// 如果不是汉字直接返回
if (src <= 128) {
return new char[] { src };
}
// 获取所有的拼音
String[] pinyingStr = PinyinHelper.toHanyuPinyinStringArray(src);
// 创建返回对象
int polyphoneSize = pinyingStr.length;
char[] headChars = new char[polyphoneSize];
int i = 0;
// 截取首字符
for (String s : pinyingStr) {
char headChar = s.charAt(0);
// 首字母是否大写,默认是小写
if (isCapital) {
headChars[i] = Character.toUpperCase(headChar);
} else {
headChars[i] = headChar;
}
i++;
}
return headChars;
}
/**
* 取汉字的首字母(默认是大写)
*
* @param src
* @return
*/
public static char[] getHeadByChar(char src) {
return getHeadByChar(src, true);
}
/**
* 查找字符串首字母
*
* @param src
* @return
*/
public static String[] getHeadByString(String src) {
return getHeadByString(src, true);
}
/**
* 查找字符串首字母
*
* @param src
* @param isCapital
* 是否大写
* @return
*/
public static String[] getHeadByString(String src, boolean isCapital) {
return getHeadByString(src, isCapital, null);
}
/**
* 查找字符串首字母
*
* @param src
* @param isCapital
* 是否大写
* @param separator
* 分隔符
* @return
*/
public static String[] getHeadByString(String src, boolean isCapital,
String separator) {
char[] chars = src.toCharArray();
String[] headString = new String[chars.length];
int i = 0;
for (char ch : chars) {
char[] chs = getHeadByChar(ch, isCapital);
StringBuffer sb = new StringBuffer();
if (null != separator) {
int j = 1;
for (char ch1 : chs) {
sb.append(ch1);
if (j != chs.length) {
sb.append(separator);
}
j++;
}
} else {
sb.append(chs[0]);
}
headString[i] = sb.toString();
i++;
}
return headString;
}
public static void main(String[] args) {
// pin4j 简码 和 城市编码
String s1 = "中华人民共和国";
String[] headArray = getHeadByString(s1); // 获得每个汉字拼音首字母
System.out.println(Arrays.toString(headArray));
String s2 ="长城" ;
System.out.println(Arrays.toString(stringToPinyin(s2,true,",")));
String s3 ="长";
System.out.println(Arrays.toString(stringToPinyin(s3,true,",")));
}
}
| [
"1192862531@qq.com"
] | 1192862531@qq.com |
c1eacaf09dfc98e55406e283f02676241cd9daae | 10378c580b62125a184f74f595d2c37be90a5769 | /com/github/steveice10/netty/handler/codec/compression/Bzip2HuffmanAllocator.java | 6c57b36579aaf871f90bcd635bfbd4f76a8f7512 | [] | no_license | ClientPlayground/Melon-Client | 4299d7f3e8f2446ae9f225c0d7fcc770d4d48ecb | afc9b11493e15745b78dec1c2b62bb9e01573c3d | refs/heads/beta-v2 | 2023-04-05T20:17:00.521159 | 2021-03-14T19:13:31 | 2021-03-14T19:13:31 | 347,509,882 | 33 | 19 | null | 2021-03-14T19:13:32 | 2021-03-14T00:27:40 | null | UTF-8 | Java | false | false | 3,698 | java | package com.github.steveice10.netty.handler.codec.compression;
final class Bzip2HuffmanAllocator {
private static int first(int[] array, int i, int nodesToMove) {
int length = array.length;
int limit = i;
int k = array.length - 2;
while (i >= nodesToMove && array[i] % length > limit) {
k = i;
i -= limit - i + 1;
}
i = Math.max(nodesToMove - 1, i);
while (k > i + 1) {
int temp = i + k >>> 1;
if (array[temp] % length > limit) {
k = temp;
continue;
}
i = temp;
}
return k;
}
private static void setExtendedParentPointers(int[] array) {
int length = array.length;
array[0] = array[0] + array[1];
for (int headNode = 0, tailNode = 1, topNode = 2; tailNode < length - 1; tailNode++) {
int temp;
if (topNode >= length || array[headNode] < array[topNode]) {
temp = array[headNode];
array[headNode++] = tailNode;
} else {
temp = array[topNode++];
}
if (topNode >= length || (headNode < tailNode && array[headNode] < array[topNode])) {
temp += array[headNode];
array[headNode++] = tailNode + length;
} else {
temp += array[topNode++];
}
array[tailNode] = temp;
}
}
private static int findNodesToRelocate(int[] array, int maximumLength) {
int currentNode = array.length - 2;
for (int currentDepth = 1; currentDepth < maximumLength - 1 && currentNode > 1; currentDepth++)
currentNode = first(array, currentNode - 1, 0);
return currentNode;
}
private static void allocateNodeLengths(int[] array) {
int firstNode = array.length - 2;
int nextNode = array.length - 1;
for (int currentDepth = 1, availableNodes = 2; availableNodes > 0; currentDepth++) {
int lastNode = firstNode;
firstNode = first(array, lastNode - 1, 0);
for (int i = availableNodes - lastNode - firstNode; i > 0; i--)
array[nextNode--] = currentDepth;
availableNodes = lastNode - firstNode << 1;
}
}
private static void allocateNodeLengthsWithRelocation(int[] array, int nodesToMove, int insertDepth) {
int firstNode = array.length - 2;
int nextNode = array.length - 1;
int currentDepth = (insertDepth == 1) ? 2 : 1;
int nodesLeftToMove = (insertDepth == 1) ? (nodesToMove - 2) : nodesToMove;
for (int availableNodes = currentDepth << 1; availableNodes > 0; currentDepth++) {
int lastNode = firstNode;
firstNode = (firstNode <= nodesToMove) ? firstNode : first(array, lastNode - 1, nodesToMove);
int offset = 0;
if (currentDepth >= insertDepth) {
offset = Math.min(nodesLeftToMove, 1 << currentDepth - insertDepth);
} else if (currentDepth == insertDepth - 1) {
offset = 1;
if (array[firstNode] == lastNode)
firstNode++;
}
for (int i = availableNodes - lastNode - firstNode + offset; i > 0; i--)
array[nextNode--] = currentDepth;
nodesLeftToMove -= offset;
availableNodes = lastNode - firstNode + offset << 1;
}
}
static void allocateHuffmanCodeLengths(int[] array, int maximumLength) {
switch (array.length) {
case 2:
array[1] = 1;
case 1:
array[0] = 1;
return;
}
setExtendedParentPointers(array);
int nodesToRelocate = findNodesToRelocate(array, maximumLength);
if (array[0] % array.length >= nodesToRelocate) {
allocateNodeLengths(array);
} else {
int insertDepth = maximumLength - 32 - Integer.numberOfLeadingZeros(nodesToRelocate - 1);
allocateNodeLengthsWithRelocation(array, nodesToRelocate, insertDepth);
}
}
}
| [
"Hot-Tutorials@users.noreply.github.com"
] | Hot-Tutorials@users.noreply.github.com |
2bcd4a654e138802eb6d107e817a8c35e19dd989 | fa93c9be2923e697fb8a2066f8fb65c7718cdec7 | /sources/com/avito/android/di/SessionRefresherModule_ProvideSessionInterceptorFactory.java | 96023d605bc875baff30333d5a6d2091dd800cd7 | [] | no_license | Auch-Auch/avito_source | b6c9f4b0e5c977b36d5fbc88c52f23ff908b7f8b | 76fdcc5b7e036c57ecc193e790b0582481768cdc | refs/heads/master | 2023-05-06T01:32:43.014668 | 2021-05-25T10:19:22 | 2021-05-25T10:19:22 | 370,650,685 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,724 | java | package com.avito.android.di;
import com.avito.android.Features;
import com.avito.android.account.AccountStorageInteractor;
import com.avito.android.remote.interceptor.SessionInterceptor;
import com.avito.android.session_refresh.SessionRefresher;
import dagger.internal.Factory;
import dagger.internal.Preconditions;
import javax.inject.Provider;
public final class SessionRefresherModule_ProvideSessionInterceptorFactory implements Factory<SessionInterceptor> {
public final Provider<AccountStorageInteractor> a;
public final Provider<SessionRefresher> b;
public final Provider<Features> c;
public SessionRefresherModule_ProvideSessionInterceptorFactory(Provider<AccountStorageInteractor> provider, Provider<SessionRefresher> provider2, Provider<Features> provider3) {
this.a = provider;
this.b = provider2;
this.c = provider3;
}
public static SessionRefresherModule_ProvideSessionInterceptorFactory create(Provider<AccountStorageInteractor> provider, Provider<SessionRefresher> provider2, Provider<Features> provider3) {
return new SessionRefresherModule_ProvideSessionInterceptorFactory(provider, provider2, provider3);
}
public static SessionInterceptor provideSessionInterceptor(AccountStorageInteractor accountStorageInteractor, SessionRefresher sessionRefresher, Features features) {
return (SessionInterceptor) Preconditions.checkNotNullFromProvides(SessionRefresherModule.INSTANCE.provideSessionInterceptor(accountStorageInteractor, sessionRefresher, features));
}
@Override // javax.inject.Provider
public SessionInterceptor get() {
return provideSessionInterceptor(this.a.get(), this.b.get(), this.c.get());
}
}
| [
"auchhunter@gmail.com"
] | auchhunter@gmail.com |
673201b61e9240a9c4d0546fb7dab6e63e8b34cf | c9da71648dfc400548884bc309cca823450e8663 | /ICBC-Probe-Project/icbc-probe-common/src/main/java/org/xbill/DNS/MINFORecord.java | dbf0e99c420086cf42a25d75b9cb9b860059dca7 | [] | no_license | chrisyun/macho-project-home | 810f984601bd42bc8bf6879b278e2cde6230e1d8 | f79f18f980178ebd01d3e916829810e94fd7dc04 | refs/heads/master | 2016-09-05T17:10:18.021448 | 2014-05-22T07:46:09 | 2014-05-22T07:46:09 | 36,444,782 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,183 | java | // Copyright (c) 2004 Brian Wellington (bwelling@xbill.org)
package org.xbill.DNS;
import java.io.IOException;
/**
* Mailbox information Record - lists the address responsible for a mailing
* list/mailbox and the address to receive error messages relating to the
* mailing list/mailbox.
*
* @author Brian Wellington
*/
public class MINFORecord extends Record {
private static final long serialVersionUID = -3962147172340353796L;
private Name responsibleAddress;
private Name errorAddress;
MINFORecord() {
}
Record getObject() {
return new MINFORecord();
}
/**
* Creates an MINFO Record from the given data
*
* @param responsibleAddress
* The address responsible for the mailing list/mailbox.
* @param errorAddress
* The address to receive error messages relating to the mailing
* list/mailbox.
*/
public MINFORecord(Name name, int dclass, long ttl, Name responsibleAddress, Name errorAddress) {
super(name, Type.MINFO, dclass, ttl);
this.responsibleAddress = checkName("responsibleAddress", responsibleAddress);
this.errorAddress = checkName("errorAddress", errorAddress);
}
void rrFromWire(DNSInput in) throws IOException {
responsibleAddress = new Name(in);
errorAddress = new Name(in);
}
void rdataFromString(Tokenizer st, Name origin) throws IOException {
responsibleAddress = st.getName(origin);
errorAddress = st.getName(origin);
}
/** Converts the MINFO Record to a String */
String rrToString() {
StringBuffer sb = new StringBuffer();
sb.append(responsibleAddress);
sb.append(" ");
sb.append(errorAddress);
return sb.toString();
}
/** Gets the address responsible for the mailing list/mailbox. */
public Name getResponsibleAddress() {
return responsibleAddress;
}
/**
* Gets the address to receive error messages relating to the mailing
* list/mailbox.
*/
public Name getErrorAddress() {
return errorAddress;
}
void rrToWire(DNSOutput out, Compression c, boolean canonical) {
responsibleAddress.toWire(out, null, canonical);
errorAddress.toWire(out, null, canonical);
}
}
| [
"machozhao@gmail.com"
] | machozhao@gmail.com |
826cdedbe7944d80f956d62fb1bbb78d2b6f9a44 | 50f7e1c1b0c3b158459c884592f4718242160368 | /contentserver/contentserver-server/src/main/java/com/hwxiasn/contentserver/server/StartupGen.java | 7576da140b776a5bddc7b6ac1fed9b8b19de42e9 | [
"Apache-2.0"
] | permissive | hwxiasn/archetypes | 81a9c66737b62c3df295153883c038004eeaa8ed | 6fb990ad85a9d0dc47b8e84fad4cd3eb207f65c2 | refs/heads/master | 2021-01-10T21:11:04.234405 | 2015-03-17T07:56:05 | 2015-03-17T07:56:05 | 24,813,043 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,056 | java | package com.hwxiasn.contentserver.server;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
public class StartupGen {
public static void main(String[] args) throws IOException {
File lib = new File("target/contentserver-server/WEB-INF/lib");
System.out.println(lib.getAbsolutePath());
StringBuilder cp = new StringBuilder();
for(File jar : lib.listFiles()) {
if(jar.getName().endsWith(".jar")) {
cp.append(jar.getName());
cp.append(File.pathSeparator);
}
}
String mainClass = "com.sohu.wap.cms.content.ServerLoader";
String command = "java -cp "+cp.toString()+" "+mainClass;
System.out.println(command);
String shell = "setsid java -cp "+cp.toString()+" "+mainClass;
System.out.println(shell);
File bat = new File(lib, "startup.bat");
FileWriter writer = new FileWriter(bat);
writer.write(command);
writer.close();
File sh = new File(lib, "startup.sh");
writer = new FileWriter(sh);
writer.write(shell);
writer.close();
}
}
| [
"hwxiasn@sina.com"
] | hwxiasn@sina.com |
9e38b09c8761533e232e8820cc02873f0de35a26 | 823e7cf19ee5f2c079405b60c13715a598d48aa4 | /src/org/marketsuite/scanner/query/VsqPanel.java | ceec2b018e059001e8467282a661c536e036523f | [] | no_license | shorebird2016/market-suite | 2836ba54944ce915c045f5d06389d5ac1749ccde | ecb245b917c725464a8cde160e1e94af05291fd1 | refs/heads/master | 2020-12-30T16:45:46.504672 | 2017-05-11T20:51:28 | 2017-05-11T20:51:28 | 91,022,492 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,534 | java | package org.marketsuite.scanner.query;
import org.marketsuite.component.field.DecimalField;
import org.marketsuite.component.field.LongIntegerField;
import org.marketsuite.component.panel.SkinPanel;
import org.marketsuite.component.resource.LazyIcon;
import org.marketsuite.framework.market.MarketInfo;
import org.marketsuite.framework.market.MarketUtil;
import org.marketsuite.framework.model.FundQuote;
import org.marketsuite.framework.model.indicator.BollingerBand;
import org.marketsuite.framework.resource.FrameworkConstants;
import org.marketsuite.resource.ApolloConstants;
import net.miginfocom.swing.MigLayout;
import org.marketsuite.component.field.DecimalField;
import org.marketsuite.component.field.LongIntegerField;
import org.marketsuite.component.panel.SkinPanel;
import org.marketsuite.framework.market.MarketInfo;
import org.marketsuite.framework.model.indicator.BollingerBand;
import org.marketsuite.framework.resource.FrameworkConstants;
import org.marketsuite.resource.ApolloConstants;
import javax.swing.*;
import javax.swing.border.BevelBorder;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
//VSQ - Volatility Squeeze
class VsqPanel extends JPanel {
VsqPanel() {
setLayout(new MigLayout("insets 0, gap 0", "[grow]"));
setBorder(new BevelBorder(BevelBorder.LOWERED));
JPanel ttl = new SkinPanel(LazyIcon.BACKGROUND_TOOLBAR, new MigLayout("insets 0", "5[]5[][][]", "3[]3"));
JLabel lbl = new JLabel(ApolloConstants.APOLLO_BUNDLE.getString("qp_68"));
ttl.add(lbl); lbl.setFont(FrameworkConstants.SMALL_FONT_BOLD);
ttl.add(_fldMa);
ttl.add(_fldUpperBound);
ttl.add(_fldLowerBound);
add(ttl, "dock north");
add(_chkSqueeze, "wrap");
_chkSqueeze.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
_fldSqueezeThreshold.setEnabled(_chkSqueeze.isSelected());
}
});
add(_fldSqueezeThreshold, "center, split"); _fldSqueezeThreshold.setText("6"); _fldSqueezeThreshold.setEnabled(false);
add(new JLabel("%"));
}
//----- protected methods -----
// macd1 = older, macd2 = newer
boolean isSqueezed(ArrayList<FundQuote> quotes) {
BollingerBand bb = new BollingerBand((int)_fldMa.getValue(), (int)_fldUpperBound.getValue(),
(int)_fldLowerBound.getValue(), quotes);
float pct = bb.getBandwidth()[0];
boolean vsq = pct < _fldSqueezeThreshold.getValue() / 100;
return !_chkSqueeze.isSelected() || (vsq && _chkSqueeze.isSelected());
}
boolean isSqueezed(MarketInfo mki) {
float bw = mki.getBollingerBand().getBandwidth()[0];
boolean vsq = bw < (_fldSqueezeThreshold.getValue() / 100);
return !_chkSqueeze.isSelected() || (vsq && _chkSqueeze.isSelected());
}
void recalcBb(MarketInfo mki) {
mki.recalcBollingerBand((int)_fldMa.getValue(), (int)_fldUpperBound.getValue(),
(int)_fldLowerBound.getValue());
}
//----- variables -----
private DecimalField _fldSqueezeThreshold = new DecimalField(16, 5, 0, 100, null);
private LongIntegerField _fldMa = new LongIntegerField(20, 3, 1, 500);
private LongIntegerField _fldUpperBound = new LongIntegerField(2, 3, 1, 5);
private LongIntegerField _fldLowerBound = new LongIntegerField(2, 3, 1, 5);
private JCheckBox _chkSqueeze = new JCheckBox(ApolloConstants.APOLLO_BUNDLE.getString("qp_67"));
}
| [
"chenat2006@gmail.com"
] | chenat2006@gmail.com |
fcb4a2528e2c8979bb88d064857a28cd8d4fb53b | 8803f38db2839831c09ebff75bfcfac399aa02ba | /library/src/main/java/com/activeandroid/serializer/BigDecimalSerializer.java | ba0c510022932e4b53701d6bc078a799556cda42 | [] | no_license | snigavig/ThreadSafeActiveAndroid | cc71af4503d0236485478fa4a5a051f6bd85409c | 7239de392cc54b8b23eaeef2026532979846f762 | refs/heads/master | 2021-01-15T13:11:56.075490 | 2016-06-09T11:53:12 | 2016-06-09T11:53:12 | 37,404,787 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 623 | java | package com.activeandroid.serializer;
import java.math.BigDecimal;
public final class BigDecimalSerializer extends TypeSerializer {
public Class<?> getDeserializedType() {
return BigDecimal.class;
}
public Class<?> getSerializedType() {
return String.class;
}
public String serialize(Object data) {
if (data == null) {
return null;
}
return ((BigDecimal) data).toString();
}
public BigDecimal deserialize(Object data) {
if (data == null) {
return null;
}
return new BigDecimal((String) data);
}
} | [
"mdmi@ciklum.com"
] | mdmi@ciklum.com |
ae8e66eb48cff918555f76b30f841dba19186d3e | cf5e78efa0f03ed7545e3927e65c6fde9045865e | /src/lessonspackage/Loops.java | fdd8a636e99e9d1b40ae95a88ba2de01be293124 | [] | no_license | tmarcelojr/jeff-test | 818c6a1d891d73089b95b34119783f747a5ead92 | 601fb1a02c41848a823755f8e4816ff2d7c7ce3c | refs/heads/master | 2023-08-11T01:50:05.687412 | 2021-10-01T19:35:11 | 2021-10-01T19:35:11 | 412,193,756 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,456 | java | package lessonspackage;
public class Loops {
public static void main(String[] args) {
// Print numbers 1 to 50
// Remember we have to specify the data type of our iterator "i"
// We would use int for "i" because we know it is an integer
for(int i = 1; i <= 50; i++) {
// Print "i" in new line
// System.out.println(i);
// Print "i" in same line
// System.out.print(i);
// If you want to iterate by 2 change i++ to i+=2
}
// Print numbers 50 to 1
for(int i = 50; i >= 1; i--) {
// System.out.println(i);
}
// Pass on an empty to print space in the console
System.out.println();
for(int i = 50; i >= 1; i-=2) {
// System.out.println(i);
}
// Nested for loops
// Goal Output:
// 1
// 12
// 123
// 1234
// 12345
for(int r = 1; r <= 5; r++) {
for(int c = 1; c <= r; c++) {
// System.out.print(c);
}
// System.out.println();
}
// Goal Output:
// 55555
// 4444
// 333
// 22
// 1
for(int r = 5; r >= 1; r--) {
// Method 1
// for(int c = 1; c <= r; c++) {
// System.out.print(r);
// }
// Method 2
for(int c = r; c >= 1; c--) {
// System.out.print(r);
}
// System.out.println();
}
// ===== WHILE LOOP =====
int i = 1;
// increment
while(i <= 50) {
// System.out.println(i);
i+=2;
}
int x = 50;
// decrement
while(x >= 0) {
System.out.println(x);
x-=2;
}
}
}
| [
"tmarcelojr@gmail.com"
] | tmarcelojr@gmail.com |
31f111760e50e81ab05d28845fa6d1a9ef52787f | 18d9eb24ff33cb85ea3cdcf689d73f0f0f6db48d | /app/src/main/java/com/example/beerlovers/utils/CircleTransform.java | 47349dd972e36200752f44e6d292dde8c4043de0 | [
"Apache-2.0"
] | permissive | DiegoCotta/Capstone-Project | eb130bae2f9e339fcd6f91fe95d1cd5235c51233 | d4736e5bb84c3774f249328f26a768e868771cbf | refs/heads/master | 2020-04-24T16:38:55.477383 | 2019-04-14T05:42:56 | 2019-04-14T05:42:56 | 172,116,028 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,213 | java | package com.example.beerlovers.utils;
import android.graphics.Bitmap;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.Paint;
import com.squareup.picasso.Transformation;
public class CircleTransform implements Transformation {
@Override
public Bitmap transform(Bitmap source) {
int size = Math.min(source.getWidth(), source.getHeight());
int x = (source.getWidth() - size) / 2;
int y = (source.getHeight() - size) / 2;
Bitmap squaredBitmap = Bitmap.createBitmap(source, x, y, size, size);
if (squaredBitmap != source) {
source.recycle();
}
Bitmap bitmap = Bitmap.createBitmap(size, size, source.getConfig());
Canvas canvas = new Canvas(bitmap);
Paint paint = new Paint();
BitmapShader shader = new BitmapShader(squaredBitmap, BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP);
paint.setShader(shader);
paint.setAntiAlias(true);
float r = size/2f;
canvas.drawCircle(r, r, r, paint);
squaredBitmap.recycle();
return bitmap;
}
@Override
public String key() {
return "circle";
}
} | [
"diego.cotta@zup.com.br"
] | diego.cotta@zup.com.br |
fa2ef00726ca3c5c468601f74ddf2fecc58eddc1 | fe49198469b938a320692bd4be82134541e5e8eb | /scenarios/web/large/gradle/ClassLib005/src/main/java/ClassLib005/Class061.java | 07aef1b841c0883e097d6c5c11566f68ea7a59e2 | [] | no_license | mikeharder/dotnet-cli-perf | 6207594ded2d860fe699fd7ef2ca2ae2ac822d55 | 2c0468cb4de9a5124ef958b315eade7e8d533410 | refs/heads/master | 2022-12-10T17:35:02.223404 | 2018-09-18T01:00:26 | 2018-09-18T01:00:26 | 105,824,840 | 2 | 6 | null | 2022-12-07T19:28:44 | 2017-10-04T22:21:19 | C# | UTF-8 | Java | false | false | 122 | java | package ClassLib005;
public class Class061 {
public static String property() {
return "ClassLib005";
}
}
| [
"mharder@microsoft.com"
] | mharder@microsoft.com |
8316d3a0b98e26d191652c979d65879fe683b3f9 | 5ea191d974fef976eaeeb3ba4b2eb91eca0cdbe6 | /mall-user-web/src/main/java/com/beemall/user/controller/LoginController.java | 7b8bee24e6d56006c6b0457051a120e319ce34d9 | [] | no_license | huxiaofeng1995/BeeMall | ad9f41e6b5995a24da48709741e30f46410d5207 | 8d26f747ef5520ba7e23746968af58994def2f8e | refs/heads/master | 2022-07-10T09:15:24.670969 | 2019-07-22T06:45:17 | 2019-07-22T06:45:17 | 192,475,159 | 0 | 0 | null | 2022-06-21T01:18:35 | 2019-06-18T05:58:59 | JavaScript | UTF-8 | Java | false | false | 768 | java | package com.beemall.user.controller;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;
/**
* @author :bee
* @date :Created in 2019/6/21 17:15
* @description:
* @modified By:
*/
@RestController
@RequestMapping("/login")
public class LoginController {
@GetMapping("name")
public Map name(){
String name= SecurityContextHolder.getContext()
.getAuthentication().getName();
Map map=new HashMap();
map.put("loginName", name);
return map ;
}
}
| [
"huxiaofeng@agree.com.cn"
] | huxiaofeng@agree.com.cn |
7bbcbd4e7f0f19db6f3bdf16071b8babfc8f194e | 93bbd51ca7311651a77cb6521b77fea15fc4d2c7 | /app/src/main/java/com/huaihsuanhuang/TravelMate/Adapter/ChatViewHolder.java | c794ff187673f554173fd849f2bb5c04d5829aca | [] | no_license | huaihsuanbusiness/TravelMate | ba18a8052beb9225c9d530c39992b93f4342cd5e | fdf4d715a2bab5965d397d39cce0c2c847242599 | refs/heads/master | 2020-03-27T15:02:41.201585 | 2018-08-30T14:31:25 | 2018-08-30T14:31:25 | 146,694,743 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 625 | java | package com.huaihsuanhuang.TravelMate.Adapter;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;
import com.huaihsuanhuang.TravelMate.R;
public class ChatViewHolder extends RecyclerView.ViewHolder {
public TextView chat_sticker;
public TextView chat_message;
public TextView chat_time;
public ChatViewHolder(View itemView) {
super(itemView);
chat_sticker = itemView.findViewById(R.id.chat_sticker);
chat_message = itemView.findViewById(R.id.chat_message);
chat_time = itemView.findViewById(R.id.chat_time);
}
}
| [
"ilj9549@gmail.com"
] | ilj9549@gmail.com |
7125b352478f743f624b0127f5a39cf2187fc643 | 78dc119e4f6319c51f6a50736ba0b116a7aca58c | /src/by/bsuir/iit/kp/expert/util/Constants.java | 1e86eb4cbae7f41d3ba22ddc0892318dfb8cee3e | [] | no_license | dzmitry-chuchva/expert | 15f55bb789c0e0223e024bf28e146594e5d07edb | a06174046c12a0cce069ce771f68a9801ca71e19 | refs/heads/master | 2021-01-11T01:45:57.464346 | 2016-10-11T23:20:45 | 2016-10-11T23:20:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,501 | java | package by.bsuir.iit.kp.expert.util;
import java.util.regex.Pattern;
import by.bsuir.iit.kp.expert.Loader;
import by.bsuir.iit.kp.expert.exceptions.ModelException;
import by.bsuir.iit.kp.expert.presentation.base.Constraints;
public class Constants {
public static final Pattern complexReferencePattern = Pattern.compile("\\[([^\\.]+)\\.([^\\.]+)\\]");
public static double constrFrom;
public static double constrTo;
public static final String DEFAULT_ALTERNATE_PROMT = "Choose value of attribute {0}:";
public static final String DEFAULT_DISTRIBUTE_PROMT = "Define probabilities of values of attribute {0}:";
public static final String DEFAULT_SIMPLE_PROMT = "Enter value of attribute {0}:";
public static final String FULL_REFERENCE_FORMAT = "[{0}.{1}]";
public static double EPSILON = 0.001;
public static Constraints SymbolValueConstraints;
public static double trueIfGreaterThan;
static {
try {
constrFrom = Double.parseDouble(Loader.getProperty(Loader.SYMBOL_FROM_PROP));
constrTo = Double.parseDouble(Loader.getProperty(Loader.SYMBOL_TO_PROP));
trueIfGreaterThan = Double.parseDouble(Loader.getProperty(Loader.SYMBOL_TRUE_IF_GT_PROP));
} catch (RuntimeException e) {
throw new RuntimeException("error: configuration of value constraints not set or invalid");
}
}
static {
try {
SymbolValueConstraints = new Constraints(constrFrom,constrTo);
} catch (ModelException e) {
SymbolValueConstraints = null;
}
}
private Constants() {
}
}
| [
"realmitro@gmai.com"
] | realmitro@gmai.com |
9adfdf5c2ed90914db6e4cf1ed31a3f1a18a7f03 | 87be0c06cbfe81f3adf27b4d62be6d50972e526b | /supreme_consumer/src/main/java/com/objcom/supreme/feign/fallback/UserClientFallback.java | e7f86521b0b5a4cd166f20cbf393032ed2b64c32 | [] | no_license | suqinqiong/supreme | 676c6c3ceaf7595e7fa48b0b02f7501515126d00 | f51549f356a4d0e8e90e7c4d0418d6bf8f6824c8 | refs/heads/master | 2023-04-20T00:17:35.092028 | 2021-05-09T13:56:53 | 2021-05-09T13:56:53 | 284,932,150 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 546 | java | package com.objcom.supreme.feign.fallback;
import com.objcom.supreme.domain.User;
import com.objcom.supreme.feign.UserClient;
import org.springframework.stereotype.Component;
/**
* Feign 对hystrix熔断器的支持
*/
@Component
public class UserClientFallback implements UserClient {
/**
* 服务降级实现
* @param id id
* @return user
*/
@Override
public User findById(Integer id) {
User user = new User();
user.setUsername("Fallback,Feign服务降级...");
return user;
}
}
| [
"358524209@qq.com"
] | 358524209@qq.com |
0a729effb2b5b200f12a7939500bf845838cbde6 | cca87c4ade972a682c9bf0663ffdf21232c9b857 | /com/tencent/mm/e/a/pw.java | 48bfa6a377ccbb2113ccfcef91500b0357fe2e08 | [] | no_license | ZoranLi/wechat_reversing | b246d43f7c2d7beb00a339e2f825fcb127e0d1a1 | 36b10ef49d2c75d69e3c8fdd5b1ea3baa2bba49a | refs/heads/master | 2021-07-05T01:17:20.533427 | 2017-09-25T09:07:33 | 2017-09-25T09:07:33 | 104,726,592 | 12 | 1 | null | null | null | null | UTF-8 | Java | false | false | 343 | java | package com.tencent.mm.e.a;
import com.tencent.mm.sdk.b.b;
public final class pw extends b {
public a fWW;
public static final class a {
public int status;
}
public pw() {
this((byte) 0);
}
private pw(byte b) {
this.fWW = new a();
this.use = false;
this.nFq = null;
}
}
| [
"lizhangliao@xiaohongchun.com"
] | lizhangliao@xiaohongchun.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.